]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/vscroll.tex
Added shaped sample copying
[wxWidgets.git] / docs / latex / wx / vscroll.tex
CommitLineData
cf7d6329
VZ
1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2%% Name: vscroll.tex
3%% Purpose: wxVScrolledWindow documentation
4%% Author: Vadim Zeitlin
5%% Modified by:
6%% Created: 30.05.03
7%% RCS-ID: $Id$
8%% Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwindows.org>
9%% License: wxWindows license
10%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11
12\section{\class{wxVScrolledWindow}}\label{wxvscrolledwindow}
13
14In the name of this class, "V" may stand for "variable" because it can be
15used for scrolling lines of variable heights; "virtual" because it is not
16necessary to know the heights of all lines in advance -- only those which
17are shown on the screen need to be measured; or, even, "vertical" because
18this class only supports scrolling in one direction currently (this could
19and probably will change in the future however).
20
21In any case, this is a generalization of the
2a70e6eb 22\helpref{wxScrolledWindow}{wxscrolledwindow} class which can be only used when
cf7d6329
VZ
23all lines have the same height. It lacks some other wxScrolledWindow features
24however, notably there is currently no support for horizontal scrolling; it
25can't scroll another window nor only a rectangle of the window and not its
26entire client area.
27
28To use this class, you need to derive from it and implement
29\helpref{OnGetLineHeight()}{wxvscrolledwindowongetlineheight} pure virtual
30method. You also must call \helpref{SetLineCount}{wxvscrolledwindowsetlinecount}
31to let the base class know how many lines it should display but from that
32moment on the scrolling is handled entirely by wxVScrolledWindow, you only
33need to draw the visible part of contents in your {\tt OnPaint()} method as
34usual. You should use \helpref{GetFirstVisibleLine()}{wxvscrolledwindowgetfirstvisibleline}
35and \helpref{GetLastVisibleLine()}{wxvscrolledwindowgetlastvisibleline} to
36select the lines to display. ote that the device context origin is not shifted
37so the first visible line always appears at the point $(0, 0)$ in physical as
38well as logical coordinates.
39
40\wxheading{Derived from}
41
42\helpref{wxPanel}{wxpanel}
43
44\wxheading{Include files}
45
46<wx/vscroll.h>
47
48
49\latexignore{\rtfignore{\wxheading{Members}}}
50
51
52\membersection{wxVScrolledWindow::wxVScrolledWindow}\label{wxvscrolledwindowctor}
53
54\func{}{wxVScrolledWindow}{\param{wxWindow* }{parent}, \param{wxWindowID }{id = wxID\_ANY}, \param{const wxPoint\& }{pos = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize}, \param{long }{style = 0}, \param{const wxString\& }{name = wxPanelNameStr}}
55
56This is the normal constructor, no need to call Create() after using this one.
57
58Note that {\tt wxVSCROLL} is always automatically added to our style, there is
59no need to specify it explicitly.
60
61\func{}{wxVScrolledWindow}{\void}
62
63Default constructor, you must call \helpref{Create()}{wxvscrolledwindowcreate}
64later.
65
66\wxheading{Parameters}
67
68\docparam{parent}{The parent window, must not be {\tt NULL}}
69
70\docparam{id}{The identifier of this window, {\tt wxID\_ANY} by default}
71
72\docparam{pos}{The initial window position}
73
74\docparam{size}{The initial window size}
75
76\docparam{style}{The window style. There are no special style bits defined for
77this class.}
78
79\docparam{name}{The name for this window; usually not used}
80
81
82\membersection{wxVScrolledWindow::Create}\label{wxvscrolledwindowcreate}
83
84\func{bool}{Create}{\param{wxWindow* }{parent}, \param{wxWindowID }{id = wxID\_ANY}, \param{const wxPoint\& }{pos = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize}, \param{long }{style = 0}, \param{const wxString\& }{name = wxPanelNameStr}}
85
86Same as the \helpref{non default ctor}{wxvscrolledwindowctor} but returns
87status code: {\tt true} if ok, {\tt false} if the window couldn't have been created.
88
c9bf76f7 89Just as with the ctor above, {\tt wxVSCROLL} style is always used, there is no
cf7d6329
VZ
90need to specify it explicitly.
91
92
93\membersection{wxVScrolledWindow::GetFirstVisibleLine}\label{wxvscrolledwindowgetfirstvisibleline}
94
95\constfunc{size\_t}{GetFirstVisibleLine}{\void}
96
97Returns the index of the first currently visible line.
98
99
100\membersection{wxVScrolledWindow::GetLastVisibleLine}\label{wxvscrolledwindowgetlastvisibleline}
101
102\constfunc{size\_t}{GetLastVisibleLine}{\void}
103
104Returns the index of the last currently visible line.
105
106
107\membersection{wxVScrolledWindow::GetLineCount}\label{wxvscrolledwindowgetlinecount}
108
109\constfunc{size\_t}{GetLineCount}{\void}
110
111Get the number of lines this window contains (previously set by
112\helpref{SetLineCount()}{wxvscrolledwindowsetlinecount})
113
114
115\membersection{wxVScrolledWindow::OnGetLineHeight}\label{wxvscrolledwindowongetlineheight}
116
117\constfunc{wxCoord}{OnGetLineHeight}{\param{size\_t }{n}}
118
119This protected virtual function must be overridden in the derived class and it
120should return the height of the given line in pixels.
121
122\wxheading{See also}
123
124\helpref{OnGetLinesHint}{wxvscrolledwindowongetlineshint}
125
126
127\membersection{wxVScrolledWindow::OnGetLinesHint}\label{wxvscrolledwindowongetlineshint}
128
129\constfunc{void}{OnGetLinesHint}{\param{size\_t }{lineMin}, \param{size\_t }{lineMax}}
130
131This function doesn't have to be overridden but it may be useful to do
132it if calculating the lines heights is a relatively expensive operation
133as it gives the user code a possibility to calculate several of them at
134once.
135
136{\tt OnGetLinesHint()} is normally called just before
137\helpref{OnGetLineHeight()}{wxvscrolledwindowongetlineheight} but you
138shouldn't rely on the latter being called for all lines in the interval
139specified here. It is also possible that OnGetLineHeight() will be
140called for the lines outside of this interval, so this is really just a
141hint, not a promise.
142
143Finally note that {\it lineMin} is inclusive, while {\it lineMax} is exclusive,
144as usual.
145
146
5de24291
VZ
147\membersection{wxVScrolledWindow::RefreshAll}\label{wxvscrolledwindowrefreshall}
148
149\func{void}{RefreshAll}{\void}
150
151This function completely refreshes the control, recalculating the number of
152items shown on screen and repaining them. It should be called when the values
153returned by \helpref{OnGetLineHeight}{wxvscrolledwindowongetlineheight} change
154for some reason and the window must be updated to reflect this.
155
156
cf7d6329
VZ
157\membersection{wxVScrolledWindow::ScrollLines}\label{wxvscrolledwindowscrolllines}
158
159\func{bool}{ScrollLines}{\param{int }{lines}}
160
161Scroll by the specified number of lines which may be positive (to scroll down)
162or negative (to scroll up).
163
164Returns {\tt true} if the window was scrolled, {\tt false} otherwise (for
165example if we're trying to scroll down but we are already showing the last
166line).
167
168\wxheading{See also}
169
170\helpref{LineUp}{wxwindowlineup}, \helpref{LineDown}{wxwindowlinedown}
171
172
173\membersection{wxVScrolledWindow::ScrollPages}\label{wxvscrolledwindowscrollpages}
174
175\func{bool}{ScrollPages}{\param{int }{pages}}
176
177Scroll by the specified number of pages which may be positive (to scroll down)
178or negative (to scroll up).
179
180\wxheading{See also}
181
182\helpref{ScrollLines}{wxvscrolledwindowscrolllines},\\
183\helpref{PageUp}{wxwindowpageup}, \helpref{PageDown}{wxwindowpagedown}
184
185
186\membersection{wxVScrolledWindow::ScrollToLine}\label{wxvscrolledwindowscrolltoline}
187
188\func{bool}{ScrollToLine}{\param{size\_t }{line}}
189
190Scroll to the specified line: it will become the first visible line in
191the window.
192
193Return {\tt true} if we scrolled the window, {\tt false} if nothing was done.
194
195
196\membersection{wxVScrolledWindow::SetLineCount}\label{wxvscrolledwindowsetlinecount}
197
198\func{void}{SetLineCount}{\param{size\_t }{count}}
199
200Set the number of lines the window contains: the derived class must
201provide the heights for all lines with indices up to the one given here
202in its \helpref{OnGetLineHeight()}{wxvscrolledwindowongetlineheight}.
203
204