]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/notebook.tex
Added ability to call wxWindow::OnPaint under Windows (experimental).
[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\_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
32 \end{twocollist}
33
34 See also \helpref{window styles overview}{windowstyles}.
35
36
37 \wxheading{Event handling}
38
39 To process input from a notebook control, use the following event handler macros to direct input to member
40 functions that take a \helpref{wxNotebookEvent}{wxnotebookevent} argument.
41
42 \twocolwidtha{7cm}
43 \begin{twocollist}\itemsep=0pt
44 \twocolitem{{\bf EVT\_NOTEBOOK\_PAGE\_CHANGED(id, func)}}{The page selection was changed.}
45 \twocolitem{{\bf EVT\_NOTEBOOK\_PAGE\_CHANGING(id, func)}}{The page selection is about to be changed.
46 This can be prevented by calling \helpref{Veto()}{wxnotifyeventveto}.}
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
60 Default 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
65 Constructs a notebook control.
66
67 Note that sometimes you can reduce flicker by passing the wxCLIP\_CHILDREN window style.
68
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
79 \docparam{style}{The window style. See \helpref{wxNotebook}{wxnotebook}.}
80
81 \docparam{name}{The name of the control (used only under Motif).}
82
83 \membersection{wxNotebook::\destruct{wxNotebook}}
84
85 \func{}{\destruct{wxNotebook}}{\void}
86
87 Destroys 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
96 Adds 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
110 TRUE if successful, FALSE otherwise.
111
112 \wxheading{Remarks}
113
114 Do 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
124 Cycles through the tabs.
125
126 \membersection{wxNotebook::Create}\label{wxnotebookcreate}
127
128 \func{bool}{Create}{\param{wxWindow*}{ parent}, \param{wxWindowID }{id}, \param{const wxPoint\&}{ pos = wxDefaultPosition},
129 \param{const wxSize\&}{ size}, \param{long}{ style = 0}, \param{const wxString\& }{name = "notebook"}}
130
131 Creates a notebook control. See \helpref{wxNotebook::wxNotebook}{wxnotebookconstr} for a description
132 of the parameters.
133
134 \membersection{wxNotebook::DeleteAllPages}\label{wxnotebookdeleteallpages}
135
136 \func{bool}{DeleteAllPages}{\void}
137
138 Deletes all pages.
139
140 \membersection{wxNotebook::DeletePage}\label{wxnotebookdeletepage}
141
142 \func{bool}{DeletePage}{\param{int}{ page}}
143
144 Deletes the specified page, and the associated window.
145
146 \membersection{wxNotebook::GetImageList}\label{wxnotebookgetimagelist}
147
148 \constfunc{wxImageList*}{GetImageList}{\void}
149
150 Returns the associated image list.
151
152 \wxheading{See also}
153
154 \helpref{wxImageList}{wximagelist}, \helpref{wxNotebook::SetImageList}{wxnotebooksetimagelist}
155
156 \membersection{wxNotebook::GetPage}\label{wxnotebookgetpage}
157
158 \func{wxNotebookPage*}{GetPage}{\param{int}{ page}}
159
160 Returns the window at the given page position.
161
162 \membersection{wxNotebook::GetPageCount}\label{wxnotebookgetpagecount}
163
164 \constfunc{int}{GetPageCount}{\void}
165
166 Returns the number of pages in the notebook control.
167
168 \membersection{wxNotebook::GetPageImage}\label{wxnotebookgetpageimage}
169
170 \constfunc{int}{GetPageImage}{\param{int }{nPage}}
171
172 Returns the image index for the given page.
173
174 \membersection{wxNotebook::GetPageText}\label{wxnotebookgetpagetext}
175
176 \constfunc{wxString}{GetPageText}{\param{int }{nPage}}
177
178 Returns the string for the given page.
179
180 \membersection{wxNotebook::GetRowCount}\label{wxnotebookgetrowcount}
181
182 \constfunc{int}{GetRowCount}{\void}
183
184 Returns the number of rows in the notebook control.
185
186 \membersection{wxNotebook::GetSelection}\label{wxnotebookgetselection}
187
188 \constfunc{int}{GetSelection}{\void}
189
190 Returns the currently selected page, or -1 if none was selected.
191
192 \membersection{wxNotebook::InsertPage}\label{wxnotebookinsertpage}
193
194 \func{bool}{InsertPage}{\param{int}{ index}, \param{wxNotebookPage*}{ page},
195 \param{const wxString\&}{ text},
196 \param{bool}{ select = FALSE},
197 \param{int}{ imageId = -1}}
198
199 Inserts a new page at the specified position.
200
201 \wxheading{Parameters}
202
203 \docparam{index}{Specifies the position for the new page.}
204
205 \docparam{page}{Specifies the new page.}
206
207 \docparam{text}{Specifies the text for the new page.}
208
209 \docparam{select}{Specifies whether the page should be selected.}
210
211 \docparam{imageId}{Specifies the optional image index for the new page.}
212
213 \wxheading{Return value}
214
215 TRUE if successful, FALSE otherwise.
216
217 \wxheading{Remarks}
218
219 Do not delete the page, it will be deleted by the notebook.
220
221 \wxheading{See also}
222
223 \helpref{wxNotebook::AddPage}{wxnotebookaddpage}
224
225 \membersection{wxNotebook::OnSelChange}\label{wxnotebookonselchange}
226
227 \func{void}{OnSelChange}{\param{wxNotebookEvent\&}{ event}}
228
229 An event handler function, called when the page selection is changed.
230
231 \wxheading{See also}
232
233 \helpref{wxNotebookEvent}{wxnotebookevent}
234
235 \membersection{wxNotebook::RemovePage}\label{wxnotebookremovepage}
236
237 \func{bool}{RemovePage}{\param{int}{ page}}
238
239 Deletes the specified page, without deleting the associated window.
240
241 \membersection{wxNotebook::SetImageList}\label{wxnotebooksetimagelist}
242
243 \func{void}{SetImageList}{\param{wxImageList*}{ imageList}}
244
245 Sets the image list for the page control.
246
247 \wxheading{See also}
248
249 \helpref{wxImageList}{wximagelist}
250
251 \membersection{wxNotebook::SetPadding}\label{wxnotebooksetpadding}
252
253 \func{void}{SetPadding}{\param{const wxSize\&}{ padding}}
254
255 Sets the amount of space around each page's icon and label, in pixels.
256
257 \membersection{wxNotebook::SetPageSize}\label{wxnotebooksetpagesize}
258
259 \func{void}{SetPageSize}{\param{const wxSize\&}{ size}}
260
261 Sets the width and height of the pages.
262
263 \membersection{wxNotebook::SetPageImage}\label{wxnotebooksetpageimage}
264
265 \func{bool}{SetPageImage}{\param{int}{ page}, \param{int }{image}}
266
267 Sets the image index for the given page. {\it image} is an index into
268 the image list which was set with \helpref{wxNotebook::SetImageList}{wxnotebooksetimagelist}.
269
270 \membersection{wxNotebook::SetPageText}\label{wxnotebooksetpagetext}
271
272 \func{bool}{SetPageText}{\param{int}{ page}, \param{const wxString\& }{text}}
273
274 Sets the text for the given page.
275
276 \membersection{wxNotebook::SetSelection}\label{wxnotebooksetselection}
277
278 \func{int}{SetSelection}{\param{int}{ page}}
279
280 Sets the selection for the given page, returning the previous selection.
281
282 \wxheading{See also}
283
284 \helpref{wxNotebook::GetSelection}{wxnotebookgetselection}
285
286