]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/notebook.tex
Documented SetItemDropEffect
[wxWidgets.git] / docs / latex / wx / notebook.tex
1 \section{\class{wxNotebook}}\label{wxnotebook}
2
3 This class represents a notebook control, which manages multiple windows with associated tabs.
4
5 To use the class, create a wxNotebook object and call \helpref{AddPage}{wxnotebookaddpage} or \helpref{InsertPage}{wxnotebookinsertpage},
6 passing a window to be used as the page. Do not explicitly delete the window for a page that is currently
7 managed by wxNotebook.
8
9 {\bf wxNotebookPage} is a typedef for wxWindow.
10
11 \wxheading{Derived from}
12
13 \helpref{wxControl}{wxcontrol}\\
14 \helpref{wxWindow}{wxwindow}\\
15 \helpref{wxEvtHandler}{wxevthandler}\\
16 \helpref{wxObject}{wxobject}
17
18 \wxheading{Include files}
19
20 <wx/notebook.h>
21
22 \wxheading{Window styles}
23
24 \twocolwidtha{5cm}
25 \begin{twocollist}\itemsep=0pt
26
27 \twocolitem{\windowstyle{wxNB\_LEFT}}{Place tabs on the left side.}
28 \twocolitem{\windowstyle{wxNB\_RIGHT}}{Place tabs on the right side.}
29 \twocolitem{\windowstyle{wxNB\_BOTTOM}}{Place tabs under instead of above the notebook pages.}
30 \twocolitem{\windowstyle{wxNB\_FIXEDWIDTH}}{(Windows only) All tabs will have same width.}
31 \twocolitem{\windowstyle{wxNB\_MULTILINE}}{(Windows only) There can be several rows of tabs.}
32
33 \end{twocollist}
34
35 The styles \texttt{wxNB\_LEFT}, \texttt{RIGHT} and \texttt{BOTTOM} are not
36 supported under Microsoft Windows XP when using visual themes.
37
38 See also \helpref{window styles overview}{windowstyles}.
39
40 \input noteevt.inc
41
42 \wxheading{See also}
43
44 \helpref{wxNotebookEvent}{wxnotebookevent}, \helpref{wxImageList}{wximagelist},\rtfsp
45 \helpref{wxTabCtrl}{wxtabctrl}
46
47 \latexignore{\rtfignore{\wxheading{Members}}}
48
49
50 \membersection{wxNotebook::wxNotebook}\label{wxnotebookctor}
51
52 \func{}{wxNotebook}{\void}
53
54 Default constructor.
55
56 \func{}{wxNotebook}{\param{wxWindow*}{ parent}, \param{wxWindowID }{id}, \param{const wxPoint\&}{ pos = wxDefaultPosition},
57 \param{const wxSize\&}{ size = wxDefaultSize}, \param{long}{ style = 0}, \param{const wxString\& }{name = wxNotebookNameStr}}
58
59 Constructs a notebook control.
60
61 Note that sometimes you can reduce flicker by passing the wxCLIP\_CHILDREN window style.
62
63 \wxheading{Parameters}
64
65 \docparam{parent}{The parent window. Must be non-NULL.}
66
67 \docparam{id}{The window identifier.}
68
69 \docparam{pos}{The window position.}
70
71 \docparam{size}{The window size.}
72
73 \docparam{style}{The window style. See \helpref{wxNotebook}{wxnotebook}.}
74
75 \docparam{name}{The name of the control (used only under Motif).}
76
77
78 \membersection{wxNotebook::\destruct{wxNotebook}}\label{wxnotebookdtor}
79
80 \func{}{\destruct{wxNotebook}}{\void}
81
82 Destroys the wxNotebook object.
83
84
85 \membersection{wxNotebook::AddPage}\label{wxnotebookaddpage}
86
87 \func{bool}{AddPage}{\param{wxNotebookPage*}{ page},
88 \param{const wxString\&}{ text},
89 \param{bool}{ select = false},
90 \param{int}{ imageId = -1}}
91
92 Adds a new page.
93
94 The call to this function may generate the page changing events.
95
96 \wxheading{Parameters}
97
98 \docparam{page}{Specifies the new page.}
99
100 \docparam{text}{Specifies the text for the new page.}
101
102 \docparam{select}{Specifies whether the page should be selected.}
103
104 \docparam{imageId}{Specifies the optional image index for the new page.}
105
106 \wxheading{Return value}
107
108 true if successful, false otherwise.
109
110 \wxheading{Remarks}
111
112 Do not delete the page, it will be deleted by the notebook.
113
114 \wxheading{See also}
115
116 \helpref{wxNotebook::InsertPage}{wxnotebookinsertpage}
117
118
119 \membersection{wxNotebook::AdvanceSelection}\label{wxnotebookadvanceselection}
120
121 \func{void}{AdvanceSelection}{\param{bool}{ forward = true}}
122
123 Cycles through the tabs.
124
125 The call to this function generates the page changing events.
126
127
128 \membersection{wxNotebook::AssignImageList}\label{wxnotebookassignimagelist}
129
130 \func{void}{AssignImageList}{\param{wxImageList*}{ imageList}}
131
132 Sets the image list for the page control and takes ownership of
133 the list.
134
135 \wxheading{See also}
136
137 \helpref{wxImageList}{wximagelist},
138 \helpref{SetImageList}{wxnotebooksetimagelist}
139
140
141 \membersection{wxNotebook::Create}\label{wxnotebookcreate}
142
143 \func{bool}{Create}{\param{wxWindow*}{ parent}, \param{wxWindowID }{id}, \param{const wxPoint\&}{ pos = wxDefaultPosition},
144 \param{const wxSize\&}{ size}, \param{long}{ style = 0}, \param{const wxString\& }{name = wxNotebookNameStr}}
145
146 Creates a notebook control. See \helpref{wxNotebook::wxNotebook}{wxnotebookctor} for a description
147 of the parameters.
148
149
150 \membersection{wxNotebook::DeleteAllPages}\label{wxnotebookdeleteallpages}
151
152 \func{bool}{DeleteAllPages}{\void}
153
154 Deletes all pages.
155
156
157 \membersection{wxNotebook::DeletePage}\label{wxnotebookdeletepage}
158
159 \func{bool}{DeletePage}{\param{size\_t}{ page}}
160
161 Deletes the specified page, and the associated window.
162
163 The call to this function generates the page changing events.
164
165
166 \membersection{wxNotebook::GetCurrentPage}\label{wxnotebookgetcurrentpage}
167
168 \constfunc{wxWindow *}{GetCurrentPage}{\void}
169
170 Returns the currently selected notebook age or \texttt{NULL}.
171
172
173 \membersection{wxNotebook::GetImageList}\label{wxnotebookgetimagelist}
174
175 \constfunc{wxImageList*}{GetImageList}{\void}
176
177 Returns the associated image list.
178
179 \wxheading{See also}
180
181 \helpref{wxImageList}{wximagelist}, \helpref{wxNotebook::SetImageList}{wxnotebooksetimagelist}
182
183
184 \membersection{wxNotebook::GetPage}\label{wxnotebookgetpage}
185
186 \func{wxNotebookPage*}{GetPage}{\param{size\_t}{ page}}
187
188 Returns the window at the given page position.
189
190
191 \membersection{wxNotebook::GetPageCount}\label{wxnotebookgetpagecount}
192
193 \constfunc{size\_t}{GetPageCount}{\void}
194
195 Returns the number of pages in the notebook control.
196
197
198 \membersection{wxNotebook::GetPageImage}\label{wxnotebookgetpageimage}
199
200 \constfunc{int}{GetPageImage}{\param{size\_t }{nPage}}
201
202 Returns the image index for the given page.
203
204
205 \membersection{wxNotebook::GetPageText}\label{wxnotebookgetpagetext}
206
207 \constfunc{wxString}{GetPageText}{\param{size\_t }{nPage}}
208
209 Returns the string for the given page.
210
211
212 \membersection{wxNotebook::GetRowCount}\label{wxnotebookgetrowcount}
213
214 \constfunc{int}{GetRowCount}{\void}
215
216 Returns the number of rows in the notebook control.
217
218
219 \membersection{wxNotebook::GetSelection}\label{wxnotebookgetselection}
220
221 \constfunc{int}{GetSelection}{\void}
222
223 Returns the currently selected page, or $-1$ if none was selected.
224
225 Note that this method may return either the previously or newly selected page
226 when called from the {\tt EVT\_NOTEBOOK\_PAGE\_CHANGED} handler depending on
227 the platform and so\rtfsp
228 \helpref{wxNotebookEvent::GetSelection}{wxnotebookeventgetselection} should be
229 used instead in this case.
230
231
232 \membersection{wxNotebook::HitTest}\label{wxnotebookhittest}
233
234 \func{int}{HitTest}{\param{const wxPoint\&}{ pt}, \param{long}{ *flags = {\tt NULL}}}
235
236 Returns the index of the tab at the specified position or {\tt wxNOT\_FOUND}
237 if none. If {\it flags} parameter is non {\tt NULL}, the position of the point
238 inside the tab is returned as well.
239
240 {\bf NB: } This method is currently only implemented under wxMSW and wxUniv.
241
242 \wxheading{Parameters}
243
244 \docparam{pt}{Specifies the point for the hit test.}
245
246 \docparam{flags}{Return value for detailed information. One of the following values:
247 \twocolwidtha{7cm}
248 \begin{twocollist}\itemsep=0pt
249 \twocolitem{{\bf wxNB\_HITTEST\_NOWHERE}}{There was no tab under this point.}
250 \twocolitem{{\bf wxNB\_HITTEST\_ONICON}}{The point was over an icon (currently wxMSW only).}
251 \twocolitem{{\bf wxNB\_HITTEST\_ONLABEL}}{The point was over a label (currently wxMSW only).}
252 \twocolitem{{\bf wxNB\_HITTEST\_ONITEM}}{The point was over an item, but not on the label or icon.}
253 \end{twocollist}
254 }
255
256 \wxheading{Return value}
257
258 Returns the zero-based tab index or {\tt wxNOT\_FOUND} if there is no tab is at
259 the specified position.
260
261
262
263 \membersection{wxNotebook::InsertPage}\label{wxnotebookinsertpage}
264
265 \func{bool}{InsertPage}{\param{size\_t}{ index}, \param{wxNotebookPage*}{ page},
266 \param{const wxString\&}{ text},
267 \param{bool}{ select = false},
268 \param{int}{ imageId = -1}}
269
270 Inserts a new page at the specified position.
271
272 \wxheading{Parameters}
273
274 \docparam{index}{Specifies the position for the new page.}
275
276 \docparam{page}{Specifies the new page.}
277
278 \docparam{text}{Specifies the text for the new page.}
279
280 \docparam{select}{Specifies whether the page should be selected.}
281
282 \docparam{imageId}{Specifies the optional image index for the new page.}
283
284 \wxheading{Return value}
285
286 true if successful, false otherwise.
287
288 \wxheading{Remarks}
289
290 Do not delete the page, it will be deleted by the notebook.
291
292 \wxheading{See also}
293
294 \helpref{wxNotebook::AddPage}{wxnotebookaddpage}
295
296
297 \membersection{wxNotebook::OnSelChange}\label{wxnotebookonselchange}
298
299 \func{void}{OnSelChange}{\param{wxNotebookEvent\&}{ event}}
300
301 An event handler function, called when the page selection is changed.
302
303 \wxheading{See also}
304
305 \helpref{wxNotebookEvent}{wxnotebookevent}
306
307
308 \membersection{wxNotebook::RemovePage}\label{wxnotebookremovepage}
309
310 \func{bool}{RemovePage}{\param{size\_t}{ page}}
311
312 Deletes the specified page, without deleting the associated window.
313
314
315 \membersection{wxNotebook::SetImageList}\label{wxnotebooksetimagelist}
316
317 \func{void}{SetImageList}{\param{wxImageList*}{ imageList}}
318
319 Sets the image list for the page control. It does not take
320 ownership of the image list, you must delete it yourself.
321
322 \wxheading{See also}
323
324 \helpref{wxImageList}{wximagelist},
325 \helpref{AssignImageList}{wxnotebookassignimagelist}
326
327
328 \membersection{wxNotebook::SetPadding}\label{wxnotebooksetpadding}
329
330 \func{void}{SetPadding}{\param{const wxSize\&}{ padding}}
331
332 Sets the amount of space around each page's icon and label, in pixels.
333
334 {\bf NB:} The vertical padding cannot be changed in wxGTK.
335
336
337 \membersection{wxNotebook::SetPageSize}\label{wxnotebooksetpagesize}
338
339 \func{void}{SetPageSize}{\param{const wxSize\&}{ size}}
340
341 Sets the width and height of the pages.
342
343 {\bf NB:} This method is currently not implemented for wxGTK.
344
345
346 \membersection{wxNotebook::SetPageImage}\label{wxnotebooksetpageimage}
347
348 \func{bool}{SetPageImage}{\param{size\_t}{ page}, \param{int }{image}}
349
350 Sets the image index for the given page. {\it image} is an index into
351 the image list which was set with \helpref{wxNotebook::SetImageList}{wxnotebooksetimagelist}.
352
353
354 \membersection{wxNotebook::SetPageText}\label{wxnotebooksetpagetext}
355
356 \func{bool}{SetPageText}{\param{size\_t}{ page}, \param{const wxString\& }{text}}
357
358 Sets the text for the given page.
359
360
361 \membersection{wxNotebook::SetSelection}\label{wxnotebooksetselection}
362
363 \func{int}{SetSelection}{\param{size\_t}{ page}}
364
365 Sets the selection for the given page, returning the previous selection.
366
367 The call to this function generates the page changing events.
368
369 \wxheading{See also}
370
371 \helpref{wxNotebook::GetSelection}{wxnotebookgetselection}
372
373