]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/notebook.tex
Commented out deprecated classes: wxProp and wxTab classes; moved some chapters
[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
BP
26
27\twocolitem{\windowstyle{wxNB\_FIXEDWIDTH}}{(Windows only)All tabs will have same width.}
28\twocolitem{\windowstyle{wxNB\_LEFT}}{Place tabs on the left side.}
29\twocolitem{\windowstyle{wxNB\_RIGHT}}{Place tabs on the right side.}
30\twocolitem{\windowstyle{wxNB\_BOTTOM}}{Place tabs under instead of above the notebook pages.}
31
da27bd0b
VZ
32\end{twocollist}
33
f6bcfd97
BP
34See also \helpref{window styles overview}{windowstyles}.
35
1d2bd847 36\input noteevt.inc
3972fb49
JS
37
38\wxheading{See also}
39
40\helpref{wxNotebookEvent}{wxnotebookevent}, \helpref{wxImageList}{wximagelist},\rtfsp
41\helpref{wxTabCtrl}{wxtabctrl}
42
43\latexignore{\rtfignore{\wxheading{Members}}}
44
45\membersection{wxNotebook::wxNotebook}\label{wxnotebookconstr}
46
47\func{}{wxNotebook}{\void}
48
49Default constructor.
50
51\func{}{wxNotebook}{\param{wxWindow*}{ parent}, \param{wxWindowID }{id}, \param{const wxPoint\&}{ pos = wxDefaultPosition},
52 \param{const wxSize\&}{ size}, \param{long}{ style = 0}, \param{const wxString\& }{name = "notebook"}}
53
54Constructs a notebook control.
55
5fa399c9
JS
56Note that sometimes you can reduce flicker by passing the wxCLIP\_CHILDREN window style.
57
3972fb49
JS
58\wxheading{Parameters}
59
60\docparam{parent}{The parent window. Must be non-NULL.}
61
62\docparam{id}{The window identifier.}
63
64\docparam{pos}{The window position.}
65
66\docparam{size}{The window size.}
67
f6bcfd97 68\docparam{style}{The window style. See \helpref{wxNotebook}{wxnotebook}.}
3972fb49 69
8c517ddd
VZ
70\docparam{name}{The name of the control (used only under Motif).}
71
3972fb49
JS
72\membersection{wxNotebook::\destruct{wxNotebook}}
73
74\func{}{\destruct{wxNotebook}}{\void}
75
76Destroys the wxNotebook object.
77
78\membersection{wxNotebook::AddPage}\label{wxnotebookaddpage}
79
80\func{bool}{AddPage}{\param{wxNotebookPage*}{ page},
81 \param{const wxString\&}{ text},
82 \param{bool}{ select = FALSE},
83 \param{int}{ imageId = -1}}
84
85Adds a new page.
86
87\wxheading{Parameters}
88
89\docparam{page}{Specifies the new page.}
90
91\docparam{text}{Specifies the text for the new page.}
92
93\docparam{select}{Specifies whether the page should be selected.}
94
95\docparam{imageId}{Specifies the optional image index for the new page.}
96
97\wxheading{Return value}
98
99TRUE if successful, FALSE otherwise.
100
101\wxheading{Remarks}
102
103Do not delete the page, it will be deleted by the notebook.
104
105\wxheading{See also}
106
107\helpref{wxNotebook::InsertPage}{wxnotebookinsertpage}
108
109\membersection{wxNotebook::AdvanceSelection}\label{wxnotebookadvanceselection}
110
111\func{void}{AdvanceSelection}{\param{bool}{ forward = TRUE}}
112
113Cycles through the tabs.
114
b656febd
VS
115\membersection{wxNotebook::AssignImageList}\label{wxnotebookassignimagelist}
116
117\func{void}{AssignImageList}{\param{wxImageList*}{ imageList}}
118
119Sets the image list for the page control and takes ownership of
120the list.
121
122\wxheading{See also}
123
124\helpref{wxImageList}{wximagelist},
125\helpref{SetImageList}{wxnotebooksetimagelist}
126
3972fb49
JS
127\membersection{wxNotebook::Create}\label{wxnotebookcreate}
128
129\func{bool}{Create}{\param{wxWindow*}{ parent}, \param{wxWindowID }{id}, \param{const wxPoint\&}{ pos = wxDefaultPosition},
130 \param{const wxSize\&}{ size}, \param{long}{ style = 0}, \param{const wxString\& }{name = "notebook"}}
131
132Creates a notebook control. See \helpref{wxNotebook::wxNotebook}{wxnotebookconstr} for a description
133of the parameters.
134
135\membersection{wxNotebook::DeleteAllPages}\label{wxnotebookdeleteallpages}
136
137\func{bool}{DeleteAllPages}{\void}
138
139Deletes all pages.
140
141\membersection{wxNotebook::DeletePage}\label{wxnotebookdeletepage}
142
143\func{bool}{DeletePage}{\param{int}{ page}}
144
621793f4 145Deletes the specified page, and the associated window.
3972fb49
JS
146
147\membersection{wxNotebook::GetImageList}\label{wxnotebookgetimagelist}
148
149\constfunc{wxImageList*}{GetImageList}{\void}
150
151Returns the associated image list.
152
153\wxheading{See also}
154
155\helpref{wxImageList}{wximagelist}, \helpref{wxNotebook::SetImageList}{wxnotebooksetimagelist}
156
157\membersection{wxNotebook::GetPage}\label{wxnotebookgetpage}
158
159\func{wxNotebookPage*}{GetPage}{\param{int}{ page}}
160
161Returns the window at the given page position.
162
163\membersection{wxNotebook::GetPageCount}\label{wxnotebookgetpagecount}
164
165\constfunc{int}{GetPageCount}{\void}
166
167Returns the number of pages in the notebook control.
168
169\membersection{wxNotebook::GetPageImage}\label{wxnotebookgetpageimage}
170
f6bcfd97 171\constfunc{int}{GetPageImage}{\param{int }{nPage}}
3972fb49
JS
172
173Returns the image index for the given page.
174
175\membersection{wxNotebook::GetPageText}\label{wxnotebookgetpagetext}
176
f6bcfd97 177\constfunc{wxString}{GetPageText}{\param{int }{nPage}}
3972fb49
JS
178
179Returns the string for the given page.
180
181\membersection{wxNotebook::GetRowCount}\label{wxnotebookgetrowcount}
182
183\constfunc{int}{GetRowCount}{\void}
184
185Returns the number of rows in the notebook control.
186
187\membersection{wxNotebook::GetSelection}\label{wxnotebookgetselection}
188
189\constfunc{int}{GetSelection}{\void}
190
f0125ede
VZ
191Returns the currently selected page, or $-1$ if none was selected.
192
193Note that this method may return either the previously or newly selected page
194when called from the {\tt EVT\_NOTEBOOK\_PAGE\_CHANGED} handler depending on
195the platform and so\rtfsp
196\helpref{wxNotebookEvent::GetSelection}{wxnotebookeventgetselection} should be
197used instead in this case.
3972fb49
JS
198
199\membersection{wxNotebook::InsertPage}\label{wxnotebookinsertpage}
200
201\func{bool}{InsertPage}{\param{int}{ index}, \param{wxNotebookPage*}{ page},
202 \param{const wxString\&}{ text},
203 \param{bool}{ select = FALSE},
204 \param{int}{ imageId = -1}}
205
206Inserts a new page at the specified position.
207
208\wxheading{Parameters}
209
210\docparam{index}{Specifies the position for the new page.}
211
212\docparam{page}{Specifies the new page.}
213
214\docparam{text}{Specifies the text for the new page.}
215
216\docparam{select}{Specifies whether the page should be selected.}
217
218\docparam{imageId}{Specifies the optional image index for the new page.}
219
220\wxheading{Return value}
221
222TRUE if successful, FALSE otherwise.
223
224\wxheading{Remarks}
225
226Do not delete the page, it will be deleted by the notebook.
227
228\wxheading{See also}
229
230\helpref{wxNotebook::AddPage}{wxnotebookaddpage}
231
232\membersection{wxNotebook::OnSelChange}\label{wxnotebookonselchange}
233
234\func{void}{OnSelChange}{\param{wxNotebookEvent\&}{ event}}
235
236An event handler function, called when the page selection is changed.
237
238\wxheading{See also}
239
240\helpref{wxNotebookEvent}{wxnotebookevent}
241
621793f4
JS
242\membersection{wxNotebook::RemovePage}\label{wxnotebookremovepage}
243
244\func{bool}{RemovePage}{\param{int}{ page}}
245
246Deletes the specified page, without deleting the associated window.
247
3972fb49
JS
248\membersection{wxNotebook::SetImageList}\label{wxnotebooksetimagelist}
249
250\func{void}{SetImageList}{\param{wxImageList*}{ imageList}}
251
b656febd
VS
252Sets the image list for the page control. It does not take
253ownership of the image list, you must delete it yourself.
3972fb49
JS
254
255\wxheading{See also}
256
b656febd
VS
257\helpref{wxImageList}{wximagelist},
258\helpref{AssignImageList}{wxnotebookassignimagelist}
3972fb49
JS
259
260\membersection{wxNotebook::SetPadding}\label{wxnotebooksetpadding}
261
262\func{void}{SetPadding}{\param{const wxSize\&}{ padding}}
263
264Sets the amount of space around each page's icon and label, in pixels.
265
266\membersection{wxNotebook::SetPageSize}\label{wxnotebooksetpagesize}
267
268\func{void}{SetPageSize}{\param{const wxSize\&}{ size}}
269
270Sets the width and height of the pages.
271
272\membersection{wxNotebook::SetPageImage}\label{wxnotebooksetpageimage}
273
274\func{bool}{SetPageImage}{\param{int}{ page}, \param{int }{image}}
275
276Sets the image index for the given page. {\it image} is an index into
277the image list which was set with \helpref{wxNotebook::SetImageList}{wxnotebooksetimagelist}.
278
279\membersection{wxNotebook::SetPageText}\label{wxnotebooksetpagetext}
280
281\func{bool}{SetPageText}{\param{int}{ page}, \param{const wxString\& }{text}}
282
283Sets the text for the given page.
284
285\membersection{wxNotebook::SetSelection}\label{wxnotebooksetselection}
286
287\func{int}{SetSelection}{\param{int}{ page}}
288
289Sets the selection for the given page, returning the previous selection.
290
291\wxheading{See also}
292
293\helpref{wxNotebook::GetSelection}{wxnotebookgetselection}
294
295