1 \section{\class{wxNotebook
}}\label{wxnotebook
}
3 This class represents a notebook control, which manages multiple windows with associated tabs.
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
9 {\bf wxNotebookPage
} is a typedef for wxWindow.
11 \wxheading{Derived from
}
13 \helpref{wxControl
}{wxcontrol
}\\
14 \helpref{wxWindow
}{wxwindow
}\\
15 \helpref{wxEvtHandler
}{wxevthandler
}\\
16 \helpref{wxObject
}{wxobject
}
18 \wxheading{Include files
}
22 \wxheading{Window styles
}
25 \begin{twocollist
}\itemsep=
0pt
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.
}
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.
}
35 The styles
\texttt{wxNB
\_LEFT},
\texttt{RIGHT
} and
\texttt{BOTTOM
} are not
36 supported under Microsoft Windows XP when using visual themes.
38 See also
\helpref{window styles overview
}{windowstyles
}.
44 \helpref{wxNotebookEvent
}{wxnotebookevent
},
\helpref{wxImageList
}{wximagelist
},
\rtfsp
45 \helpref{wxTabCtrl
}{wxtabctrl
}
47 \latexignore{\rtfignore{\wxheading{Members
}}}
50 \membersection{wxNotebook::wxNotebook
}\label{wxnotebookctor
}
52 \func{}{wxNotebook
}{\void}
56 \func{}{wxNotebook
}{\param{wxWindow*
}{ parent
},
\param{wxWindowID
}{id
},
\param{const wxPoint\&
}{ pos = wxDefaultPosition
},
57 \param{const wxSize\&
}{ size = wxDefaultSize
},
\param{long
}{ style =
0},
\param{const wxString\&
}{name = wxNotebookNameStr
}}
59 Constructs a notebook control.
61 Note that sometimes you can reduce flicker by passing the wxCLIP
\_CHILDREN window style.
63 \wxheading{Parameters
}
65 \docparam{parent
}{The parent window. Must be non-NULL.
}
67 \docparam{id
}{The window identifier.
}
69 \docparam{pos
}{The window position.
}
71 \docparam{size
}{The window size.
}
73 \docparam{style
}{The window style. See
\helpref{wxNotebook
}{wxnotebook
}.
}
75 \docparam{name
}{The name of the control (used only under Motif).
}
78 \membersection{wxNotebook::
\destruct{wxNotebook
}}\label{wxnotebookdtor
}
80 \func{}{\destruct{wxNotebook
}}{\void}
82 Destroys the wxNotebook object.
85 \membersection{wxNotebook::AddPage
}\label{wxnotebookaddpage
}
87 \func{bool
}{AddPage
}{\param{wxNotebookPage*
}{ page
},
88 \param{const wxString\&
}{ text
},
89 \param{bool
}{ select = false
},
90 \param{int
}{ imageId = -
1}}
94 The call to this function may generate the page changing events.
96 \wxheading{Parameters
}
98 \docparam{page
}{Specifies the new page.
}
100 \docparam{text
}{Specifies the text for the new page.
}
102 \docparam{select
}{Specifies whether the page should be selected.
}
104 \docparam{imageId
}{Specifies the optional image index for the new page.
}
106 \wxheading{Return value
}
108 true if successful, false otherwise.
112 Do not delete the page, it will be deleted by the notebook.
116 \helpref{wxNotebook::InsertPage
}{wxnotebookinsertpage
}
119 \membersection{wxNotebook::AdvanceSelection
}\label{wxnotebookadvanceselection
}
121 \func{void
}{AdvanceSelection
}{\param{bool
}{ forward = true
}}
123 Cycles through the tabs.
125 The call to this function generates the page changing events.
128 \membersection{wxNotebook::AssignImageList
}\label{wxnotebookassignimagelist
}
130 \func{void
}{AssignImageList
}{\param{wxImageList*
}{ imageList
}}
132 Sets the image list for the page control and takes ownership of
137 \helpref{wxImageList
}{wximagelist
},
138 \helpref{SetImageList
}{wxnotebooksetimagelist
}
141 \membersection{wxNotebook::Create
}\label{wxnotebookcreate
}
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 = wxNotebookNameStr
}}
146 Creates a notebook control. See
\helpref{wxNotebook::wxNotebook
}{wxnotebookctor
} for a description
150 \membersection{wxNotebook::DeleteAllPages
}\label{wxnotebookdeleteallpages
}
152 \func{bool
}{DeleteAllPages
}{\void}
157 \membersection{wxNotebook::DeletePage
}\label{wxnotebookdeletepage
}
159 \func{bool
}{DeletePage
}{\param{size
\_t}{ page
}}
161 Deletes the specified page, and the associated window.
163 The call to this function generates the page changing events.
166 \membersection{wxNotebook::GetCurrentPage
}\label{wxnotebookgetcurrentpage
}
168 \constfunc{wxWindow *
}{GetCurrentPage
}{\void}
170 Returns the currently selected notebook age or
\texttt{NULL
}.
173 \membersection{wxNotebook::GetImageList
}\label{wxnotebookgetimagelist
}
175 \constfunc{wxImageList*
}{GetImageList
}{\void}
177 Returns the associated image list.
181 \helpref{wxImageList
}{wximagelist
},
\helpref{wxNotebook::SetImageList
}{wxnotebooksetimagelist
}
184 \membersection{wxNotebook::GetPage
}\label{wxnotebookgetpage
}
186 \func{wxNotebookPage*
}{GetPage
}{\param{size
\_t}{ page
}}
188 Returns the window at the given page position.
191 \membersection{wxNotebook::GetPageCount
}\label{wxnotebookgetpagecount
}
193 \constfunc{size
\_t}{GetPageCount
}{\void}
195 Returns the number of pages in the notebook control.
198 \membersection{wxNotebook::GetPageImage
}\label{wxnotebookgetpageimage
}
200 \constfunc{int
}{GetPageImage
}{\param{size
\_t }{nPage
}}
202 Returns the image index for the given page.
205 \membersection{wxNotebook::GetPageText
}\label{wxnotebookgetpagetext
}
207 \constfunc{wxString
}{GetPageText
}{\param{size
\_t }{nPage
}}
209 Returns the string for the given page.
212 \membersection{wxNotebook::GetRowCount
}\label{wxnotebookgetrowcount
}
214 \constfunc{int
}{GetRowCount
}{\void}
216 Returns the number of rows in the notebook control.
219 \membersection{wxNotebook::GetSelection
}\label{wxnotebookgetselection
}
221 \constfunc{int
}{GetSelection
}{\void}
223 Returns the currently selected page, or $-
1$ if none was selected.
225 Note that this method may return either the previously or newly selected page
226 when called from the
{\tt EVT
\_NOTEBOOK\_PAGE\_CHANGED} handler depending on
227 the platform and so
\rtfsp
228 \helpref{wxNotebookEvent::GetSelection
}{wxnotebookeventgetselection
} should be
229 used instead in this case.
232 \membersection{wxNotebook::HitTest
}\label{wxnotebookhittest
}
234 \func{int
}{HitTest
}{\param{const wxPoint\&
}{ pt
},
\param{long
}{ *flags =
{\tt NULL
}}}
236 Returns the index of the tab at the specified position or
{\tt wxNOT
\_FOUND}
237 if none. If
{\it flags
} parameter is non
{\tt NULL
}, the position of the point
238 inside the tab is returned as well.
240 {\bf NB:
} This method is currently only implemented under wxMSW and wxUniv.
242 \wxheading{Parameters
}
244 \docparam{pt
}{Specifies the point for the hit test.
}
246 \docparam{flags
}{Return value for detailed information. One of the following values:
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.
}
256 \wxheading{Return value
}
258 Returns the zero-based tab index or
{\tt wxNOT
\_FOUND} if there is no tab is at
259 the specified position.
263 \membersection{wxNotebook::InsertPage
}\label{wxnotebookinsertpage
}
265 \func{bool
}{InsertPage
}{\param{size
\_t}{ index
},
\param{wxNotebookPage*
}{ page
},
266 \param{const wxString\&
}{ text
},
267 \param{bool
}{ select = false
},
268 \param{int
}{ imageId = -
1}}
270 Inserts a new page at the specified position.
272 \wxheading{Parameters
}
274 \docparam{index
}{Specifies the position for the new page.
}
276 \docparam{page
}{Specifies the new page.
}
278 \docparam{text
}{Specifies the text for the new page.
}
280 \docparam{select
}{Specifies whether the page should be selected.
}
282 \docparam{imageId
}{Specifies the optional image index for the new page.
}
284 \wxheading{Return value
}
286 true if successful, false otherwise.
290 Do not delete the page, it will be deleted by the notebook.
294 \helpref{wxNotebook::AddPage
}{wxnotebookaddpage
}
297 \membersection{wxNotebook::OnSelChange
}\label{wxnotebookonselchange
}
299 \func{void
}{OnSelChange
}{\param{wxNotebookEvent\&
}{ event
}}
301 An event handler function, called when the page selection is changed.
305 \helpref{wxNotebookEvent
}{wxnotebookevent
}
308 \membersection{wxNotebook::RemovePage
}\label{wxnotebookremovepage
}
310 \func{bool
}{RemovePage
}{\param{size
\_t}{ page
}}
312 Deletes the specified page, without deleting the associated window.
315 \membersection{wxNotebook::SetImageList
}\label{wxnotebooksetimagelist
}
317 \func{void
}{SetImageList
}{\param{wxImageList*
}{ imageList
}}
319 Sets the image list for the page control. It does not take
320 ownership of the image list, you must delete it yourself.
324 \helpref{wxImageList
}{wximagelist
},
325 \helpref{AssignImageList
}{wxnotebookassignimagelist
}
328 \membersection{wxNotebook::SetPadding
}\label{wxnotebooksetpadding
}
330 \func{void
}{SetPadding
}{\param{const wxSize\&
}{ padding
}}
332 Sets the amount of space around each page's icon and label, in pixels.
334 {\bf NB:
} The vertical padding cannot be changed in wxGTK.
337 \membersection{wxNotebook::SetPageSize
}\label{wxnotebooksetpagesize
}
339 \func{void
}{SetPageSize
}{\param{const wxSize\&
}{ size
}}
341 Sets the width and height of the pages.
343 {\bf NB:
} This method is currently not implemented for wxGTK.
346 \membersection{wxNotebook::SetPageImage
}\label{wxnotebooksetpageimage
}
348 \func{bool
}{SetPageImage
}{\param{size
\_t}{ page
},
\param{int
}{image
}}
350 Sets the image index for the given page.
{\it image
} is an index into
351 the image list which was set with
\helpref{wxNotebook::SetImageList
}{wxnotebooksetimagelist
}.
354 \membersection{wxNotebook::SetPageText
}\label{wxnotebooksetpagetext
}
356 \func{bool
}{SetPageText
}{\param{size
\_t}{ page
},
\param{const wxString\&
}{text
}}
358 Sets the text for the given page.
361 \membersection{wxNotebook::SetSelection
}\label{wxnotebooksetselection
}
363 \func{int
}{SetSelection
}{\param{size
\_t}{ page
}}
365 Sets the selection for the given page, returning the previous selection.
367 The call to this function generates the page changing events.
371 \helpref{wxNotebook::GetSelection
}{wxnotebookgetselection
}