X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/bd0df01f3f59940fdbca7a3472c256be2d034ab9..7c4eef7a75398aab1285e3ad2971c59ea3130293:/docs/latex/wx/scrolwin.tex diff --git a/docs/latex/wx/scrolwin.tex b/docs/latex/wx/scrolwin.tex index 631761b8a7..bdc315b480 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}). @@ -16,10 +16,15 @@ scroll position. \wxheading{Derived from} +\helpref{wxPanel}{wxpanel}\\ \helpref{wxWindow}{wxwindow}\\ \helpref{wxEvtHandler}{wxevthandler}\\ \helpref{wxObject}{wxobject} +\wxheading{Include files} + + + \wxheading{Window styles} \twocolwidtha{5cm} @@ -82,6 +87,40 @@ specify how big the virtual window size should be. Destructor. +\membersection{wxScrolledWindow::CalcScrolledPosition}\label{wxscrolledwindowcalcscrolledposition} + +\constfunc{void}{CalcScrolledPosition}{ + \param{int }{x}, + \param{int }{y}, + \param{int *}{xx} + \param{int *}{yy}} + +Translates the logical coordinates to the device ones. 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, 0, \&xx, \&yy) will return 10 in yy. + +\wxheading{See also} + +\helpref{CalcUnscrolledPosition}{wxscrolledwindowcalcunscrolledposition} + +\membersection{wxScrolledWindow::CalcUnscrolledPosition}\label{wxscrolledwindowcalcunscrolledposition} + +\constfunc{void}{CalcUnscrolledPosition}{ + \param{int }{x}, + \param{int }{y}, + \param{int *}{xx} + \param{int *}{yy}} + +Translates the device coordinates to the logical ones. 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, 10, \&xx, \&yy) will return 0 in yy. + +\wxheading{See also} + +\helpref{CalcScrolledPosition}{wxscrolledwindowcalcscrolledposition} + \membersection{wxScrolledWindow::Create}\label{wxscrolledwindowcreate} \func{bool}{Create}{\param{wxWindow*}{ parent}, \param{wxWindowID }{id = -1},\rtfsp @@ -160,7 +199,7 @@ to translate these units to logical units. \constfunc{bool}{IsRetained}{\void} -TRUE if the window has a backing bitmap. +Motif only: TRUE if the window has a backing bitmap. \membersection{wxScrolledWindow::PrepareDC}\label{wxscrolledwindowpreparedc} @@ -169,7 +208,7 @@ 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 @@ -197,45 +236,13 @@ void MyWindow::OnEvent(wxMouseEvent& event) \func{virtual void}{OnDraw}{\param{wxDC\& }{dc}} -Called by the default \helpref{wxScrolledWindow::OnPaint}{wxscrolledwindowonpaint} implementation -to allow the application to define painting behaviour without having to worry about -calling \helpref{wxScrolledWindow::PrepareDC}{wxscrolledwindowpreparedc}. - -\membersection{wxScrolledWindow::OnPaint}\label{wxscrolledwindowonpaint} - -\func{void}{OnPaint}{\param{wxPaintEvent\& }{event}} - -Sent to the window when the window must be refreshed. - -For more details, see \helpref{wxWindow::OnPaint}{wxwindowonpaint}. - -The default implementation for wxScrolledWindow's OnPaint handler is simply: - -\begin{verbatim} -void wxScrolledWindow::OnPaint(wxPaintEvent& event) -{ - wxPaintDC dc(this); - PrepareDC(dc); - - OnDraw(dc); -} -\end{verbatim} - -\membersection{wxScrolledWindow::OnScroll}\label{wxscrolledwindowonscroll} - -\func{void}{OnScroll}{\param{wxScrollEvent\& }{event}} - -Override this function to intercept scroll events. This -member function implements the default scroll behaviour. If -you do not call the default function, you will have to manage -all scrolling behaviour including drawing the window contents -at an appropriate position relative to the scrollbars. - -For more details, see \helpref{wxWindow::OnScroll}{wxwindowonscroll}. - -\wxheading{See also} +Called by the default paint event handler to allow the application to define +painting behaviour without having to worry about calling +\helpref{wxScrolledWindow::PrepareDC}{wxscrolledwindowpreparedc}. -\helpref{wxScrollEvent}{wxscrollevent} +Instead of overriding this function you may also just process the paint event +in the derived class as usual, but then you will have to call PrepareDC() +yourself. \membersection{wxScrolledWindow::Scroll}\label{wxscrolledwindowscroll}