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