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