]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/notebook.tex
wxPaletteBase introduction. wxPalette::GetColoursCount() in interface of all platform...
[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
df10208f
VZ
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.}
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
df10208f
VZ
35The styles \texttt{wxNB\_LEFT}, \texttt{RIGHT} and \texttt{BOTTOM} are not
36supported under Microsoft Windows XP when using visual themes.
37
f6bcfd97
BP
38See also \helpref{window styles overview}{windowstyles}.
39
1d2bd847 40\input noteevt.inc
3972fb49
JS
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
21db32c1 49
dcbd177f 50\membersection{wxNotebook::wxNotebook}\label{wxnotebookctor}
3972fb49
JS
51
52\func{}{wxNotebook}{\void}
53
54Default constructor.
55
56\func{}{wxNotebook}{\param{wxWindow*}{ parent}, \param{wxWindowID }{id}, \param{const wxPoint\&}{ pos = wxDefaultPosition},
e480a80a 57 \param{const wxSize\&}{ size = wxDefaultSize}, \param{long}{ style = 0}, \param{const wxString\& }{name = "notebook"}}
3972fb49
JS
58
59Constructs a notebook control.
60
5fa399c9
JS
61Note that sometimes you can reduce flicker by passing the wxCLIP\_CHILDREN window style.
62
3972fb49
JS
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
f6bcfd97 73\docparam{style}{The window style. See \helpref{wxNotebook}{wxnotebook}.}
3972fb49 74
8c517ddd
VZ
75\docparam{name}{The name of the control (used only under Motif).}
76
21db32c1 77
dcbd177f 78\membersection{wxNotebook::\destruct{wxNotebook}}\label{wxnotebookdtor}
3972fb49
JS
79
80\func{}{\destruct{wxNotebook}}{\void}
81
82Destroys the wxNotebook object.
83
21db32c1 84
3972fb49
JS
85\membersection{wxNotebook::AddPage}\label{wxnotebookaddpage}
86
87\func{bool}{AddPage}{\param{wxNotebookPage*}{ page},
88 \param{const wxString\&}{ text},
cc81d32f 89 \param{bool}{ select = false},
3972fb49
JS
90 \param{int}{ imageId = -1}}
91
92Adds a new page.
93
f65a450a
VZ
94The call to this function may generate the page changing events.
95
3972fb49
JS
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
cc81d32f 108true if successful, false otherwise.
3972fb49
JS
109
110\wxheading{Remarks}
111
112Do not delete the page, it will be deleted by the notebook.
113
114\wxheading{See also}
115
116\helpref{wxNotebook::InsertPage}{wxnotebookinsertpage}
117
21db32c1 118
3972fb49
JS
119\membersection{wxNotebook::AdvanceSelection}\label{wxnotebookadvanceselection}
120
cc81d32f 121\func{void}{AdvanceSelection}{\param{bool}{ forward = true}}
3972fb49
JS
122
123Cycles through the tabs.
124
f65a450a
VZ
125The call to this function generates the page changing events.
126
21db32c1 127
b656febd
VS
128\membersection{wxNotebook::AssignImageList}\label{wxnotebookassignimagelist}
129
130\func{void}{AssignImageList}{\param{wxImageList*}{ imageList}}
131
132Sets the image list for the page control and takes ownership of
133the list.
134
135\wxheading{See also}
136
137\helpref{wxImageList}{wximagelist},
138\helpref{SetImageList}{wxnotebooksetimagelist}
139
21db32c1 140
3972fb49
JS
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 = "notebook"}}
145
dcbd177f 146Creates a notebook control. See \helpref{wxNotebook::wxNotebook}{wxnotebookctor} for a description
3972fb49
JS
147of the parameters.
148
21db32c1 149
3972fb49
JS
150\membersection{wxNotebook::DeleteAllPages}\label{wxnotebookdeleteallpages}
151
152\func{bool}{DeleteAllPages}{\void}
153
154Deletes all pages.
155
21db32c1 156
3972fb49
JS
157\membersection{wxNotebook::DeletePage}\label{wxnotebookdeletepage}
158
74f8518b 159\func{bool}{DeletePage}{\param{size\_t}{ page}}
3972fb49 160
621793f4 161Deletes the specified page, and the associated window.
3972fb49 162
f65a450a
VZ
163The call to this function generates the page changing events.
164
21db32c1
VZ
165
166\membersection{wxNotebook::GetCurrentPage}\label{wxnotebookgetcurrentpage}
167
168\constfunc{wxWindow *}{GetCurrentPage}{\void}
169
170Returns the currently selected notebook age or \texttt{NULL}.
171
172
3972fb49
JS
173\membersection{wxNotebook::GetImageList}\label{wxnotebookgetimagelist}
174
175\constfunc{wxImageList*}{GetImageList}{\void}
176
177Returns the associated image list.
178
179\wxheading{See also}
180
181\helpref{wxImageList}{wximagelist}, \helpref{wxNotebook::SetImageList}{wxnotebooksetimagelist}
182
21db32c1 183
3972fb49
JS
184\membersection{wxNotebook::GetPage}\label{wxnotebookgetpage}
185
74f8518b 186\func{wxNotebookPage*}{GetPage}{\param{size\_t}{ page}}
3972fb49
JS
187
188Returns the window at the given page position.
189
21db32c1 190
3972fb49
JS
191\membersection{wxNotebook::GetPageCount}\label{wxnotebookgetpagecount}
192
74f8518b 193\constfunc{size\_t}{GetPageCount}{\void}
3972fb49
JS
194
195Returns the number of pages in the notebook control.
196
21db32c1 197
3972fb49
JS
198\membersection{wxNotebook::GetPageImage}\label{wxnotebookgetpageimage}
199
74f8518b 200\constfunc{int}{GetPageImage}{\param{size\_t }{nPage}}
3972fb49
JS
201
202Returns the image index for the given page.
203
21db32c1 204
3972fb49
JS
205\membersection{wxNotebook::GetPageText}\label{wxnotebookgetpagetext}
206
74f8518b 207\constfunc{wxString}{GetPageText}{\param{size\_t }{nPage}}
3972fb49
JS
208
209Returns the string for the given page.
210
21db32c1 211
3972fb49
JS
212\membersection{wxNotebook::GetRowCount}\label{wxnotebookgetrowcount}
213
214\constfunc{int}{GetRowCount}{\void}
215
216Returns the number of rows in the notebook control.
217
21db32c1 218
3972fb49
JS
219\membersection{wxNotebook::GetSelection}\label{wxnotebookgetselection}
220
221\constfunc{int}{GetSelection}{\void}
222
f0125ede
VZ
223Returns the currently selected page, or $-1$ if none was selected.
224
225Note that this method may return either the previously or newly selected page
226when called from the {\tt EVT\_NOTEBOOK\_PAGE\_CHANGED} handler depending on
227the platform and so\rtfsp
228\helpref{wxNotebookEvent::GetSelection}{wxnotebookeventgetselection} should be
229used instead in this case.
3972fb49 230
21db32c1 231
e450aa69
VZ
232\membersection{wxNotebook::HitTest}\label{wxnotebookhittest}
233
234\func{int}{HitTest}{\param{const wxPoint\&}{ pt}, \param{long}{ *flags = {\tt NULL}}}
235
236Returns the index of the tab at the specified position or {\tt wxNOT\_FOUND}
237if none. If {\it flags} parameter is non {\tt NULL}, the position of the point
238inside 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
258Returns the zero-based tab index or {\tt wxNOT\_FOUND} if there is no tab is at
259the specified position.
260
261
21db32c1 262
3972fb49
JS
263\membersection{wxNotebook::InsertPage}\label{wxnotebookinsertpage}
264
74f8518b 265\func{bool}{InsertPage}{\param{size\_t}{ index}, \param{wxNotebookPage*}{ page},
3972fb49 266 \param{const wxString\&}{ text},
cc81d32f 267 \param{bool}{ select = false},
3972fb49
JS
268 \param{int}{ imageId = -1}}
269
270Inserts 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
cc81d32f 286true if successful, false otherwise.
3972fb49
JS
287
288\wxheading{Remarks}
289
290Do not delete the page, it will be deleted by the notebook.
291
292\wxheading{See also}
293
294\helpref{wxNotebook::AddPage}{wxnotebookaddpage}
295
21db32c1 296
3972fb49
JS
297\membersection{wxNotebook::OnSelChange}\label{wxnotebookonselchange}
298
299\func{void}{OnSelChange}{\param{wxNotebookEvent\&}{ event}}
300
301An event handler function, called when the page selection is changed.
302
303\wxheading{See also}
304
305\helpref{wxNotebookEvent}{wxnotebookevent}
306
21db32c1 307
621793f4
JS
308\membersection{wxNotebook::RemovePage}\label{wxnotebookremovepage}
309
74f8518b 310\func{bool}{RemovePage}{\param{size\_t}{ page}}
621793f4
JS
311
312Deletes the specified page, without deleting the associated window.
313
21db32c1 314
3972fb49
JS
315\membersection{wxNotebook::SetImageList}\label{wxnotebooksetimagelist}
316
317\func{void}{SetImageList}{\param{wxImageList*}{ imageList}}
318
b656febd
VS
319Sets the image list for the page control. It does not take
320ownership of the image list, you must delete it yourself.
3972fb49
JS
321
322\wxheading{See also}
323
b656febd
VS
324\helpref{wxImageList}{wximagelist},
325\helpref{AssignImageList}{wxnotebookassignimagelist}
3972fb49 326
21db32c1 327
3972fb49
JS
328\membersection{wxNotebook::SetPadding}\label{wxnotebooksetpadding}
329
330\func{void}{SetPadding}{\param{const wxSize\&}{ padding}}
331
332Sets the amount of space around each page's icon and label, in pixels.
333
b318dc42
JS
334{\bf NB:} The vertical padding cannot be changed in wxGTK.
335
21db32c1 336
3972fb49
JS
337\membersection{wxNotebook::SetPageSize}\label{wxnotebooksetpagesize}
338
339\func{void}{SetPageSize}{\param{const wxSize\&}{ size}}
340
341Sets the width and height of the pages.
342
b318dc42
JS
343{\bf NB:} This method is currently not implemented for wxGTK.
344
21db32c1 345
3972fb49
JS
346\membersection{wxNotebook::SetPageImage}\label{wxnotebooksetpageimage}
347
74f8518b 348\func{bool}{SetPageImage}{\param{size\_t}{ page}, \param{int }{image}}
3972fb49
JS
349
350Sets the image index for the given page. {\it image} is an index into
351the image list which was set with \helpref{wxNotebook::SetImageList}{wxnotebooksetimagelist}.
352
21db32c1 353
3972fb49
JS
354\membersection{wxNotebook::SetPageText}\label{wxnotebooksetpagetext}
355
74f8518b 356\func{bool}{SetPageText}{\param{size\_t}{ page}, \param{const wxString\& }{text}}
3972fb49
JS
357
358Sets the text for the given page.
359
21db32c1 360
3972fb49
JS
361\membersection{wxNotebook::SetSelection}\label{wxnotebooksetselection}
362
74f8518b 363\func{int}{SetSelection}{\param{size\_t}{ page}}
3972fb49
JS
364
365Sets the selection for the given page, returning the previous selection.
366
f65a450a
VZ
367The call to this function generates the page changing events.
368
3972fb49
JS
369\wxheading{See also}
370
371\helpref{wxNotebook::GetSelection}{wxnotebookgetselection}
372
373