scrolwin.tex
来自「Wxpython Implemented on Windows CE, Sou」· TEX 代码 · 共 478 行 · 第 1/2 页
TEX
478 行
\wxheading{Parameters}
\docparam{xUnit}{Receives the number of pixels per horizontal unit.}
\docparam{yUnit}{Receives the number of pixels per vertical unit.}
\wxheading{See also}
\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.}
\perlnote{In wxPerl this method takes no parameters and returns a
2-element list {\tt ( xUnit, yUnit )}.}
\membersection{wxScrolledWindow::GetViewStart}\label{wxscrolledwindowgetviewstart}
\constfunc{void}{GetViewStart}{\param{int* }{x}, \param{int* }{ y}}
Get the position at which the visible portion of the window starts.
\wxheading{Parameters}
\docparam{x}{Receives the first visible x position in scroll units.}
\docparam{y}{Receives the first visible y position in scroll units.}
\wxheading{Remarks}
If either of the scrollbars is not at the home position, {\it x} and/or
\rtfsp{\it y} will be greater than zero. Combined with \helpref{wxWindow::GetClientSize}{wxwindowgetclientsize},
the application can use this function to efficiently redraw only the
visible portion of the window. The positions are in logical scroll
units, not pixels, so to convert to pixels you will have to multiply
by the number of pixels per scroll increment.
\wxheading{See also}
\helpref{wxScrolledWindow::SetScrollbars}{wxscrolledwindowsetscrollbars}
\pythonnote{The wxPython version of this methods accepts no
parameters and returns a tuple of values for x and y.}
\perlnote{In wxPerl this method takes no parameters and returns a
2-element list {\tt ( x, y )}.}
\membersection{wxScrolledWindow::GetVirtualSize}\label{wxscrolledwindowgetvirtualsize}
\constfunc{void}{GetVirtualSize}{\param{int* }{x}, \param{int* }{y}}
Gets the size in device units of the scrollable window area (as
opposed to the client size, which is the area of the window currently
visible).
\wxheading{Parameters}
\docparam{x}{Receives the length of the scrollable window, in pixels.}
\docparam{y}{Receives the height of the scrollable window, in pixels.}
\wxheading{Remarks}
Use \helpref{wxDC::DeviceToLogicalX}{wxdcdevicetologicalx} and \helpref{wxDC::DeviceToLogicalY}{wxdcdevicetologicaly}\rtfsp
to translate these units to logical units.
\wxheading{See also}
\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.}
\perlnote{In wxPerl this method takes no parameters and returns a
2-element list {\tt ( x, y )}.}
\membersection{wxScrolledWindow::IsRetained}\label{wxscrolledwindowisretained}
\constfunc{bool}{IsRetained}{\void}
Motif only: true if the window has a backing bitmap.
\membersection{wxScrolledWindow::DoPrepareDC}\label{wxscrolledwindowdopreparedc}
\func{void}{DoPrepareDC}{\param{wxDC\& }{dc}}
Call this function to prepare the device context for drawing a scrolled image. It
sets the device origin according to the current scroll position.
DoPrepareDC 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
call this function yourself. For example:
\begin{verbatim}
void MyWindow::OnEvent(wxMouseEvent& event)
{
wxClientDC dc(this);
DoPrepareDC(dc);
dc.SetPen(*wxBLACK_PEN);
float x, y;
event.Position(&x, &y);
if (xpos > -1 && ypos > -1 && event.Dragging())
{
dc.DrawLine(xpos, ypos, x, y);
}
xpos = x;
ypos = y;
}
\end{verbatim}
\membersection{wxScrolledWindow::OnDraw}\label{wxscrolledwindowondraw}
\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
\helpref{wxScrolledWindow::DoPrepareDC}{wxscrolledwindowdopreparedc}.
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 DoPrepareDC()
yourself.
\membersection{wxScrolledWindow::PrepareDC}\label{wxscrolledwindowpreparedc}
\func{void}{PrepareDC}{\param{wxDC\& }{dc}}
This function is for backwards compatibility only and simply calls
\helpref{DoPrepareDC}{wxscrolledwindowdopreparedc} now. Notice that it is
\emph{not} called by the default paint event handle (DoPrepareDC() is), so
overriding this method in your derived class is useless.
\membersection{wxScrolledWindow::Scroll}\label{wxscrolledwindowscroll}
\func{void}{Scroll}{\param{int}{ x}, \param{int}{ y}}
Scrolls a window so the view start is at the given point.
\wxheading{Parameters}
\docparam{x}{The x position to scroll to, in scroll units.}
\docparam{y}{The y position to scroll to, in scroll units.}
\wxheading{Remarks}
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 -1, that position will be ignored (no change in
that direction).
\wxheading{See also}
\helpref{wxScrolledWindow::SetScrollbars}{wxscrolledwindowsetscrollbars},\rtfsp
\helpref{wxScrolledWindow::GetScrollPixelsPerUnit}{wxscrolledwindowgetscrollpixelsperunit}
\membersection{wxScrolledWindow::SetScrollbars}\label{wxscrolledwindowsetscrollbars}
\func{void}{SetScrollbars}{\param{int}{ pixelsPerUnitX}, \param{int}{ pixelsPerUnitY},\rtfsp
\param{int}{ noUnitsX}, \param{int}{ noUnitsY},\rtfsp
\param{int }{xPos = 0}, \param{int}{ yPos = 0},\rtfsp
\param{bool }{noRefresh = false}}
Sets up vertical and/or horizontal scrollbars.
\wxheading{Parameters}
\docparam{pixelsPerUnitX}{Pixels per scroll unit in the horizontal direction.}
\docparam{pixelsPerUnitY}{Pixels per scroll unit in the vertical direction.}
\docparam{noUnitsX}{Number of units in the horizontal direction.}
\docparam{noUnitsY}{Number of units in the vertical direction.}
\docparam{xPos}{Position to initialize the scrollbars in the horizontal direction, in scroll units.}
\docparam{yPos}{Position to initialize the scrollbars in the vertical direction, in scroll units.}
\docparam{noRefresh}{Will not refresh window if true.}
\wxheading{Remarks}
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.
{\it xPos} and {\it yPos} optionally specify a position to scroll to immediately.
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.
\begin{verbatim}
window->SetScrollbars(20, 20, 50, 50);
\end{verbatim}
wxScrolledWindow manages the page size itself,
using the current client window size as the page size.
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 wxWindow, overriding {\bf OnSize} and
adjusting the scrollbars appropriately.
\wxheading{See also}
\helpref{wxWindow::SetVirtualSize}{wxwindowsetvirtualsize}
\membersection{wxScrolledWindow::SetScrollRate}\label{wxscrolledwindowsetscrollrate}
\func{void}{SetScrollRate}{\param{int}{ xstep}, \param{int}{ ystep}}
Set the horizontal and vertical scrolling increment only. See the pixelsPerUnit
parameter in SetScrollbars.
\membersection{wxScrolledWindow::SetTargetWindow}\label{wxscrolledwindowsettargetwindow}
\func{void}{SetTargetWindow}{\param{wxWindow* }{window}}
Call this function to tell wxScrolledWindow to perform the actual scrolling on
a different window (and not on itself).
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?