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