<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE erlref SYSTEM "erlref.dtd">

<!-- THIS FILE IS GENERATED DO NOT EDIT -->


<erlref>
<header>
  <copyright>
    <year>2020</year><year>2021</year>
    <holder>wxWidgets team.</holder></copyright>
  <legalnotice>Licensed under the wxWindows Free Documentation Licence, Version 3
  </legalnotice>
  <title>wxScrolledWindow</title>
</header>
<module>wxScrolledWindow</module>
<modulesummary>The wxScrolled (not implemented in wx) class manages scrolling for its client area, transforming the coordinates according to the scrollbar positions, and setting the scroll positions, thumb sizes and ranges according to the area in view. </modulesummary>
<description><p>There are two commonly used (but not the only possible!) specializations of this class:
      </p><p>Note: See <c>wxScrolled::Create()</c> (not implemented in wx) if you want to use <c>wxScrolled</c> (not implemented in wx) with a custom class.
      </p><p> Starting from version 2.4 of wxWidgets, there are several ways to use a ?wxScrolledWindow (and now <c>wxScrolled</c> (not implemented in wx)). In particular, there are three ways to set the size of the scrolling area:
      </p><p>One way is to set the scrollbars directly using a call to <seemfa marker="#setScrollbars/6"><c>setScrollbars/6</c></seemfa>. This is the way it used to be in any previous version of wxWidgets and it will be kept for backwards compatibility.
      </p><p>An additional method of manual control, which requires a little less computation of your own, is to set the total size of the scrolling area by calling either <seemfa marker="wxWindow#setVirtualSize/3"><c>wxWindow:setVirtualSize/3</c></seemfa>, or <seemfa marker="wxWindow#fitInside/1"><c>wxWindow:fitInside/1</c></seemfa>, and setting the scrolling increments for it by calling <seemfa marker="#setScrollRate/3"><c>setScrollRate/3</c></seemfa>. Scrolling in some orientation is enabled by setting a non-zero increment for it.
      </p><p>The most automatic and newest way is to simply let sizers determine the scrolling area. This is now the default when you set an interior sizer into a <c>wxScrolled</c> (not implemented in wx) with <seemfa marker="wxWindow#setSizer/3"><c>wxWindow:setSizer/3</c></seemfa>. The scrolling area will be set to the size requested by the sizer and the scrollbars will be assigned for each orientation according to the need for them and the scrolling increment set by <seemfa marker="#setScrollRate/3"><c>setScrollRate/3</c></seemfa>. As above, scrolling is only enabled in orientations with a non-zero increment. You can influence the minimum size of the scrolled area controlled by a sizer by calling wxWindow::SetVirtualSizeHints(). (Calling <seemfa marker="#setScrollbars/6"><c>setScrollbars/6</c></seemfa> has analogous effects in wxWidgets 2.4 - in later versions it may not continue to override the sizer.)
      </p><p>Note that if maximum size hints are still supported by wxWindow::SetVirtualSizeHints(), use them at your own dire risk. They may or may not have been removed for 2.4, but it really only makes sense to set minimum size hints here. We should probably replace wxWindow::SetVirtualSizeHints() with wxWindow::SetMinVirtualSize() or similar and remove it entirely in future.
      </p><p>As with all windows, an application can draw onto a <c>wxScrolled</c> (not implemented in wx) using a device context.
      </p><p>You have the option of handling the OnPaint handler or overriding the <c>wxScrolled::OnDraw()</c> (not implemented in wx) function, which is passed a pre-scrolled device context (prepared by <seemfa marker="#doPrepareDC/2"><c>doPrepareDC/2</c></seemfa>).
      </p><p>If you don't wish to calculate your own scrolling, you must call <seemfa marker="#doPrepareDC/2"><c>doPrepareDC/2</c></seemfa> when not drawing from within <c>OnDraw()</c> (not implemented in wx), to set the device origin for the device context according to the current scroll position.
      </p><p>A <c>wxScrolled</c> (not implemented in wx) will normally scroll itself and therefore its child windows as well. It might however be desired to scroll a different window than itself: e.g. when designing a spreadsheet, you will normally only have to scroll the (usually white) cell area, whereas the (usually grey) label area will scroll very differently. For this special purpose, you can call <seemfa marker="#setTargetWindow/2"><c>setTargetWindow/2</c></seemfa> which means that pressing the scrollbars will scroll a different window.
      </p><p>Note that the underlying system knows nothing about scrolling coordinates, so that all system functions (mouse events, expose events, refresh calls etc) as well as the position of subwindows are relative to the "physical" origin of the scrolled window. If the user insert a child window at position (10,10) and scrolls the window down 100 pixels (moving the child window out of the visible area), the child window will report a position of (10,-90).
      </p><p>Styles</p><p>This class supports the following styles:
      </p><p>Note: Don't confuse wxScrollWinEvents generated by this class with <seeerl marker="wxScrollEvent"><c>wxScrollEvent</c></seeerl> objects generated by <seeerl marker="wxScrollBar"><c>wxScrollBar</c></seeerl> and <seeerl marker="wxSlider"><c>wxSlider</c></seeerl>.
      </p><p>Remark: Use <c>wxScrolled</c> (not implemented in wx) for applications where the user scrolls by a fixed amount, and where a 'page' can be interpreted to be the current visible portion of the window. For more sophisticated applications, use the <c>wxScrolled</c> (not implemented in wx) implementation as a guide to build your own scroll behaviour or use <c>wxVScrolledWindow</c> (not implemented in wx) or its variants.
      </p><p>Since: The <c>wxScrolled</c> (not implemented in wx) template exists since version 2.9.0. In older versions, only ?wxScrolledWindow (equivalent of wxScrolled&lt;wxPanel&gt;) was available.
      </p><p>See: <seeerl marker="wxScrollBar"><c>wxScrollBar</c></seeerl>, <seeerl marker="wxClientDC"><c>wxClientDC</c></seeerl>, <seeerl marker="wxPaintDC"><c>wxPaintDC</c></seeerl>, <c>wxVScrolledWindow</c> (not implemented in wx), <c>wxHScrolledWindow</c> (not implemented in wx), <c>wxHVScrolledWindow</c> (not implemented in wx)
      </p>
  <p>This class is derived (and can use functions) from: 
    <seeerl marker="wxPanel"><c>wxPanel</c></seeerl> <seeerl marker="wxWindow"><c>wxWindow</c></seeerl> <seeerl marker="wxEvtHandler"><c>wxEvtHandler</c></seeerl></p>
  
  <p>wxWidgets docs: <url href="https://docs.wxwidgets.org/3.1/classwx_scrolled_window.html">wxScrolledWindow</url></p>
  </description><section><title>Events</title><p>Event types emitted from this class: <seeerl marker="wxScrollWinEvent"><c>scrollwin_top</c></seeerl>, <seeerl marker="wxScrollWinEvent"><c>scrollwin_bottom</c></seeerl>, <seeerl marker="wxScrollWinEvent"><c>scrollwin_lineup</c></seeerl>, <seeerl marker="wxScrollWinEvent"><c>scrollwin_linedown</c></seeerl>, <seeerl marker="wxScrollWinEvent"><c>scrollwin_pageup</c></seeerl>, <seeerl marker="wxScrollWinEvent"><c>scrollwin_pagedown</c></seeerl>, <seeerl marker="wxScrollWinEvent"><c>scrollwin_thumbtrack</c></seeerl>, <seeerl marker="wxScrollWinEvent"><c>scrollwin_thumbrelease</c></seeerl></p></section>
<datatypes><datatype><name name="wxScrolledWindow"/></datatype></datatypes>

<funcs>
  <func>
    <name name="new" arity="0" clause_i="1" since=""/>
    <fsummary>Default constructor. </fsummary>
    <desc><p>Default constructor. 
      </p></desc>
  </func>
  
  <func>
    <name name="new" arity="1" clause_i="1" since=""/>
    <fsummary>See: <c>new/2</c></fsummary>
  </func>
  
  <func>
    <name name="new" arity="2" clause_i="1" since=""/>
    <fsummary>Constructor. </fsummary>
    <desc><p>Constructor. 
      </p><p>Remark: The window is initially created without visible scrollbars. Call <seemfa marker="#setScrollbars/6"><c>setScrollbars/6</c></seemfa> to specify how big the virtual window size should be. 
      </p></desc>
  </func>
  
  <func>
    <name name="calcScrolledPosition" arity="2" clause_i="1" since=""/>
    <fsummary/>
    <desc/>
  </func>
  
  <func>
    <name name="calcScrolledPosition" arity="3" clause_i="1" since=""/>
    <fsummary>Translates the logical coordinates to the device ones. </fsummary>
    <desc><p>Translates the logical coordinates to the device ones. 
      </p><p>For example, if a window is scrolled 10 pixels to the bottom, the device coordinates of the origin are (0, 0) (as always), but the logical coordinates are (0, 10) and so the call to CalcScrolledPosition(0, 10, xx, yy) will return 0 in yy.
      </p><p>See: <seemfa marker="#calcUnscrolledPosition/3"><c>calcUnscrolledPosition/3</c></seemfa>
      </p></desc>
  </func>
  
  <func>
    <name name="calcUnscrolledPosition" arity="2" clause_i="1" since=""/>
    <fsummary/>
    <desc/>
  </func>
  
  <func>
    <name name="calcUnscrolledPosition" arity="3" clause_i="1" since=""/>
    <fsummary>Translates the device coordinates to the logical ones. </fsummary>
    <desc><p>Translates the device coordinates to the logical ones. 
      </p><p>For example, if a window is scrolled 10 pixels to the bottom, the device coordinates of the origin are (0, 0) (as always), but the logical coordinates are (0, 10) and so the call to CalcUnscrolledPosition(0, 0, xx, yy) will return 10 in yy.
      </p><p>See: <seemfa marker="#calcScrolledPosition/3"><c>calcScrolledPosition/3</c></seemfa>
      </p></desc>
  </func>
  
  <func>
    <name name="enableScrolling" arity="3" clause_i="1" since=""/>
    <fsummary>Enable or disable use of <c>wxWindow:scrollWindow/4</c> for scrolling. </fsummary>
    <desc><p>Enable or disable use of <seemfa marker="wxWindow#scrollWindow/4"><c>wxWindow:scrollWindow/4</c></seemfa> for scrolling. 
      </p><p>By default, when a scrolled window is logically scrolled, <seemfa marker="wxWindow#scrollWindow/4"><c>wxWindow:scrollWindow/4</c></seemfa> is called on the underlying window which scrolls the window contents and only invalidates the part of the window newly brought into view. If false is passed as an argument, then this "physical scrolling" is disabled and the window is entirely invalidated whenever it is scrolled by calling <seemfa marker="wxWindow#refresh/2"><c>wxWindow:refresh/2</c></seemfa>.
      </p><p>It should be rarely necessary to disable physical scrolling, so this method shouldn't be called in normal circumstances.
      </p></desc>
  </func>
  
  <func>
    <name name="getScrollPixelsPerUnit" arity="1" clause_i="1" since=""/>
    <fsummary>Get the number of pixels per scroll unit (line), in each direction, as set by <c>setScrollbars/6</c>. </fsummary>
    <desc><p>Get the number of pixels per scroll unit (line), in each direction, as set by <seemfa marker="#setScrollbars/6"><c>setScrollbars/6</c></seemfa>. 
      </p><p>A value of zero indicates no scrolling in that direction.
      </p><p>See: <seemfa marker="#setScrollbars/6"><c>setScrollbars/6</c></seemfa>, <seemfa marker="wxWindow#getVirtualSize/1"><c>wxWindow:getVirtualSize/1</c></seemfa>
      </p></desc>
  </func>
  
  <func>
    <name name="getViewStart" arity="1" clause_i="1" since=""/>
    <fsummary>This is a simple overload of GetViewStart(int*,int*); see that function for more info. </fsummary>
    <desc><p>This is a simple overload of GetViewStart(int*,int*); see that function for more info. 
      </p></desc>
  </func>
  
  <func>
    <name name="doPrepareDC" arity="2" clause_i="1" since=""/>
    <fsummary>Call this function to prepare the device context for drawing a scrolled image. </fsummary>
    <desc><p>Call this function to prepare the device context for drawing a scrolled image. 
      </p><p>It sets the device origin according to the current scroll position. <seemfa marker="#doPrepareDC/2"><c>doPrepareDC/2</c></seemfa> is called automatically within the default <c>wxEVT_PAINT</c> event handler, so your <c>OnDraw()</c> (not implemented in wx) override will be passed an already 'pre-scrolled' device context. However, if you wish to draw from outside of <c>OnDraw()</c> (not implemented in wx) (e.g. from your own <c>wxEVT_PAINT</c> handler), you must call this function yourself.
      </p><p>For example: 
      </p><p>Notice that the function sets the origin by moving it relatively to the current origin position, so you shouldn't change the origin before calling <seemfa marker="#doPrepareDC/2"><c>doPrepareDC/2</c></seemfa> or, if you do, reset it to (0, 0) later. If you call <seemfa marker="#doPrepareDC/2"><c>doPrepareDC/2</c></seemfa> immediately after device context creation, as in the example above, this problem doesn't arise, of course, so it is customary to do it like this. 
      </p></desc>
  </func>
  
  <func>
    <name name="prepareDC" arity="2" clause_i="1" since=""/>
    <fsummary>This function is for backwards compatibility only and simply calls <c>doPrepareDC/2</c> now. </fsummary>
    <desc><p>This function is for backwards compatibility only and simply calls <seemfa marker="#doPrepareDC/2"><c>doPrepareDC/2</c></seemfa> now. 
      </p><p>Notice that it is not called by the default paint event handle (<seemfa marker="#doPrepareDC/2"><c>doPrepareDC/2</c></seemfa> is), so overriding this method in your derived class is useless. 
      </p></desc>
  </func>
  
  <func>
    <name name="scroll" arity="2" clause_i="1" since=""/>
    <fsummary>This is an overload of <c>scroll/3</c>; see that function for more info. </fsummary>
    <desc><p>This is an overload of <seemfa marker="#scroll/3"><c>scroll/3</c></seemfa>; see that function for more info. 
      </p></desc>
  </func>
  
  <func>
    <name name="scroll" arity="3" clause_i="1" since=""/>
    <fsummary>Scrolls a window so the view start is at the given point. </fsummary>
    <desc><p>Scrolls a window so the view start is at the given point. 
      </p><p>Remark: The positions are in scroll units, not pixels, so to convert to pixels you will have to multiply by the number of pixels per scroll increment. If either parameter is ?wxDefaultCoord (-1), that position will be ignored (no change in that direction).
      </p><p>See: <seemfa marker="#setScrollbars/6"><c>setScrollbars/6</c></seemfa>, <seemfa marker="#getScrollPixelsPerUnit/1"><c>getScrollPixelsPerUnit/1</c></seemfa>
      </p></desc>
  </func>
  
  <func>
    <name name="setScrollbars" arity="5" clause_i="1" since=""/>
    <fsummary>See: <c>setScrollbars/6</c></fsummary>
  </func>
  
  <func>
    <name name="setScrollbars" arity="6" clause_i="1" since=""/>
    <fsummary>Sets up vertical and/or horizontal scrollbars. </fsummary>
    <desc><p>Sets up vertical and/or horizontal scrollbars. 
      </p><p>The first pair of parameters give the number of pixels per 'scroll step', i.e. amount moved when the up or down scroll arrows are pressed. The second pair gives the length of scrollbar in scroll steps, which sets the size of the virtual window.
      </p><p><c>xPos</c> and <c>yPos</c> optionally specify a position to scroll to immediately.
      </p><p>For example, the following gives a window horizontal and vertical scrollbars with 20 pixels per scroll step, and a size of 50 steps (1000 pixels) in each direction: 
      </p><p><c>wxScrolled</c> (not implemented in wx) manages the page size itself, using the current client window size as the page size.
      </p><p>Note that for more sophisticated scrolling applications, for example where scroll steps may be variable according to the position in the document, it will be necessary to derive a new class from <seeerl marker="wxWindow"><c>wxWindow</c></seeerl>, overriding OnSize() and adjusting the scrollbars appropriately.
      </p><p>See: <seemfa marker="wxWindow#setVirtualSize/3"><c>wxWindow:setVirtualSize/3</c></seemfa>
      </p></desc>
  </func>
  
  <func>
    <name name="setScrollRate" arity="3" clause_i="1" since=""/>
    <fsummary>Set the horizontal and vertical scrolling increment only. </fsummary>
    <desc><p>Set the horizontal and vertical scrolling increment only. 
      </p><p>See the pixelsPerUnit parameter in <seemfa marker="#setScrollbars/6"><c>setScrollbars/6</c></seemfa>. 
      </p></desc>
  </func>
  
  <func>
    <name name="setTargetWindow" arity="2" clause_i="1" since=""/>
    <fsummary>Call this function to tell <c>wxScrolled</c> (not implemented in wx) to perform the actual scrolling on a different window (and not on itself). </fsummary>
    <desc><p>Call this function to tell <c>wxScrolled</c> (not implemented in wx) to perform the actual scrolling on a different window (and not on itself). 
      </p><p>This method is useful when only a part of the window should be scrolled. A typical example is a control consisting of a fixed header and the scrollable contents window: the scrollbars are attached to the main window itself, hence it, and not the contents window must be derived from <c>wxScrolled</c> (not implemented in wx), but only the contents window scrolls when the scrollbars are used. To implement such setup, you need to call this method with the contents window as argument.
      </p><p>Notice that if this method is used, <c>GetSizeAvailableForScrollTarget()</c> (not implemented in wx) method must be overridden. 
      </p></desc>
  </func>
  
  <func>
    <name name="destroy" arity="1" clause_i="1" since=""/>
    <fsummary>Destructor</fsummary>
    <desc><p>Destroys the object.</p></desc>
  </func>
  </funcs>
</erlref>
