X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4092d6f2219a693fb31c624bf6601427678b4d37..d45d30c8682f858321600e2958167d7ef54ebeb5:/docs/latex/wx/scrolwin.tex diff --git a/docs/latex/wx/scrolwin.tex b/docs/latex/wx/scrolwin.tex index f7270d32ff..ef24da24c9 100644 --- a/docs/latex/wx/scrolwin.tex +++ b/docs/latex/wx/scrolwin.tex @@ -6,7 +6,7 @@ scroll positions, thumb sizes and ranges according to the area in view. As with all windows, an application can draw onto a wxScrolledWindow using a \helpref{device context}{dcoverview}. -You have the option of handling the \helpref{OnPaint}{wxscrolledwindowonpaint} handler +You have the option of handling the OnPaint handler or overriding the \helpref{OnDraw}{wxscrolledwindowondraw} function, which is passed a pre-scrolled device context (prepared by \helpref{PrepareDC}{wxscrolledwindowpreparedc}). @@ -14,8 +14,23 @@ If you don't wish to calculate your own scrolling, you must call PrepareDC when within OnDraw, to set the device origin for the device context according to the current scroll position. +A wxScrolledWindow 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'll 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 \helpref{SetTargetWindow}{wxscrolledwindowsettargetwindow} which means that pressing +the scrollbars will scroll a different window. + +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). + + \wxheading{Derived from} +\helpref{wxPanel}{wxpanel}\\ \helpref{wxWindow}{wxwindow}\\ \helpref{wxEvtHandler}{wxevthandler}\\ \helpref{wxObject}{wxobject} @@ -103,6 +118,9 @@ CalcScrolledPosition(0, 0, \&xx, \&yy) will return 10 in yy. \helpref{CalcUnscrolledPosition}{wxscrolledwindowcalcunscrolledposition} +\pythonnote{The wxPython version of this methods accepts only two +parameters and returns xx and yy as a tuple of values.} + \membersection{wxScrolledWindow::CalcUnscrolledPosition}\label{wxscrolledwindowcalcunscrolledposition} \constfunc{void}{CalcUnscrolledPosition}{ @@ -120,6 +138,9 @@ CalcUnscrolledPosition(0, 10, \&xx, \&yy) will return 0 in yy. \helpref{CalcScrolledPosition}{wxscrolledwindowcalcscrolledposition} +\pythonnote{The wxPython version of this methods accepts only two +parameters and returns xx and yy as a tuple of values.} + \membersection{wxScrolledWindow::Create}\label{wxscrolledwindowcreate} \func{bool}{Create}{\param{wxWindow*}{ parent}, \param{wxWindowID }{id = -1},\rtfsp @@ -138,7 +159,9 @@ Enable or disable physical scrolling in the given direction. Physical scrolling is the physical transfer of bits up or down the screen when a scroll event occurs. If the application scrolls by a variable amount (e.g. if there are different font sizes) then physical -scrolling will not work, and you should switch it off. +scrolling will not work, and you should switch it off. Note that you +will have to reposition child windows yourself, if physical scrolling +is disabled. \wxheading{Parameters} @@ -170,6 +193,10 @@ scrolling in that direction. \helpref{wxScrolledWindow::SetScrollbars}{wxscrolledwindowsetscrollbars},\rtfsp \helpref{wxScrolledWindow::GetVirtualSize}{wxscrolledwindowgetvirtualsize} +\pythonnote{The wxPython version of this methods accepts no +parameters and returns a tuple of values for xUnit and yUnit.} + + \membersection{wxScrolledWindow::GetVirtualSize}\label{wxscrolledwindowgetvirtualsize} \constfunc{void}{GetVirtualSize}{\param{int* }{x}, \param{int* }{y}} @@ -194,6 +221,9 @@ to translate these units to logical units. \helpref{wxScrolledWindow::SetScrollbars}{wxscrolledwindowsetscrollbars},\rtfsp \helpref{wxScrolledWindow::GetScrollPixelsPerUnit}{wxscrolledwindowgetscrollpixelsperunit} +\pythonnote{The wxPython version of this methods accepts no +parameters and returns a tuple of values for x and y.} + \membersection{wxScrolledWindow::IsRetained}\label{wxscrolledwindowisretained} \constfunc{bool}{IsRetained}{\void} @@ -207,7 +237,7 @@ Motif only: TRUE if the window has a backing bitmap. Call this function to prepare the device context for drawing a scrolled image. It sets the device origin according to the current scroll position. -PrepareDC is called automatically within the default \helpref{wxScrolledWindow::OnPaint}{wxscrolledwindowonpaint} event +PrepareDC is called automatically within the default wxScrolledWindow::OnPaint event handler, so your \helpref{wxScrolledWindow::OnDraw}{wxscrolledwindowondraw} override will be passed a 'pre-scrolled' device context. However, if you wish to draw from outside of OnDraw (via OnPaint), or you wish to implement OnPaint yourself, you must @@ -236,7 +266,7 @@ void MyWindow::OnEvent(wxMouseEvent& event) \func{virtual void}{OnDraw}{\param{wxDC\& }{dc}} Called by the default paint event handler to allow the application to define -painting behaviour without having to worry about calling +painting behaviour without having to worry about calling \helpref{wxScrolledWindow::PrepareDC}{wxscrolledwindowpreparedc}. Instead of overriding this function you may also just process the paint event @@ -314,6 +344,13 @@ scroll steps may be variable according to the position in the document, it will necessary to derive a new class from wxWindow, overriding {\bf OnSize} and adjusting the scrollbars appropriately. +\membersection{wxScrolledWindow::SetTargetWindow}\label{wxscrolledwindowsettargetwindow} + +\func{void}{SetTargetWindow}{\param{wxWindow* }{window}} + +Call this function to tell wxScrolledWindow to perform the actually scrolling on +a different window (not on itself). + \membersection{wxScrolledWindow::ViewStart}\label{wxscrolledwindowviewstart} \constfunc{void}{ViewStart}{\param{int* }{x}, \param{int* }{ y}} @@ -339,3 +376,6 @@ by the number of pixels per scroll increment. \helpref{wxScrolledWindow::SetScrollbars}{wxscrolledwindowsetscrollbars} +\pythonnote{The wxPython version of this methods accepts no +parameters and returns a tuple of values for x and y.} +