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. 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.
}
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 See also
\helpref{window styles overview
}{windowstyles
}.
41 \helpref{wxNotebookEvent
}{wxnotebookevent
},
\helpref{wxImageList
}{wximagelist
},
\rtfsp
42 \helpref{wxTabCtrl
}{wxtabctrl
}
44 \latexignore{\rtfignore{\wxheading{Members
}}}
46 \membersection{wxNotebook::wxNotebook
}\label{wxnotebookconstr
}
48 \func{}{wxNotebook
}{\void}
52 \func{}{wxNotebook
}{\param{wxWindow*
}{ parent
},
\param{wxWindowID
}{id
},
\param{const wxPoint\&
}{ pos = wxDefaultPosition
},
53 \param{const wxSize\&
}{ size = wxDefaultSize
},
\param{long
}{ style =
0},
\param{const wxString\&
}{name = "notebook"
}}
55 Constructs a notebook control.
57 Note that sometimes you can reduce flicker by passing the wxCLIP
\_CHILDREN window style.
59 \wxheading{Parameters
}
61 \docparam{parent
}{The parent window. Must be non-NULL.
}
63 \docparam{id
}{The window identifier.
}
65 \docparam{pos
}{The window position.
}
67 \docparam{size
}{The window size.
}
69 \docparam{style
}{The window style. See
\helpref{wxNotebook
}{wxnotebook
}.
}
71 \docparam{name
}{The name of the control (used only under Motif).
}
73 \membersection{wxNotebook::
\destruct{wxNotebook
}}
75 \func{}{\destruct{wxNotebook
}}{\void}
77 Destroys the wxNotebook object.
79 \membersection{wxNotebook::AddPage
}\label{wxnotebookaddpage
}
81 \func{bool
}{AddPage
}{\param{wxNotebookPage*
}{ page
},
82 \param{const wxString\&
}{ text
},
83 \param{bool
}{ select = false
},
84 \param{int
}{ imageId = -
1}}
88 The call to this function may generate the page changing events.
90 \wxheading{Parameters
}
92 \docparam{page
}{Specifies the new page.
}
94 \docparam{text
}{Specifies the text for the new page.
}
96 \docparam{select
}{Specifies whether the page should be selected.
}
98 \docparam{imageId
}{Specifies the optional image index for the new page.
}
100 \wxheading{Return value
}
102 true if successful, false otherwise.
106 Do not delete the page, it will be deleted by the notebook.
110 \helpref{wxNotebook::InsertPage
}{wxnotebookinsertpage
}
112 \membersection{wxNotebook::AdvanceSelection
}\label{wxnotebookadvanceselection
}
114 \func{void
}{AdvanceSelection
}{\param{bool
}{ forward = true
}}
116 Cycles through the tabs.
118 The call to this function generates the page changing events.
120 \membersection{wxNotebook::AssignImageList
}\label{wxnotebookassignimagelist
}
122 \func{void
}{AssignImageList
}{\param{wxImageList*
}{ imageList
}}
124 Sets the image list for the page control and takes ownership of
129 \helpref{wxImageList
}{wximagelist
},
130 \helpref{SetImageList
}{wxnotebooksetimagelist
}
132 \membersection{wxNotebook::Create
}\label{wxnotebookcreate
}
134 \func{bool
}{Create
}{\param{wxWindow*
}{ parent
},
\param{wxWindowID
}{id
},
\param{const wxPoint\&
}{ pos = wxDefaultPosition
},
135 \param{const wxSize\&
}{ size
},
\param{long
}{ style =
0},
\param{const wxString\&
}{name = "notebook"
}}
137 Creates a notebook control. See
\helpref{wxNotebook::wxNotebook
}{wxnotebookconstr
} for a description
140 \membersection{wxNotebook::DeleteAllPages
}\label{wxnotebookdeleteallpages
}
142 \func{bool
}{DeleteAllPages
}{\void}
146 \membersection{wxNotebook::DeletePage
}\label{wxnotebookdeletepage
}
148 \func{bool
}{DeletePage
}{\param{int
}{ page
}}
150 Deletes the specified page, and the associated window.
152 The call to this function generates the page changing events.
154 \membersection{wxNotebook::GetImageList
}\label{wxnotebookgetimagelist
}
156 \constfunc{wxImageList*
}{GetImageList
}{\void}
158 Returns the associated image list.
162 \helpref{wxImageList
}{wximagelist
},
\helpref{wxNotebook::SetImageList
}{wxnotebooksetimagelist
}
164 \membersection{wxNotebook::GetPage
}\label{wxnotebookgetpage
}
166 \func{wxNotebookPage*
}{GetPage
}{\param{int
}{ page
}}
168 Returns the window at the given page position.
170 \membersection{wxNotebook::GetPageCount
}\label{wxnotebookgetpagecount
}
172 \constfunc{int
}{GetPageCount
}{\void}
174 Returns the number of pages in the notebook control.
176 \membersection{wxNotebook::GetPageImage
}\label{wxnotebookgetpageimage
}
178 \constfunc{int
}{GetPageImage
}{\param{int
}{nPage
}}
180 Returns the image index for the given page.
182 \membersection{wxNotebook::GetPageText
}\label{wxnotebookgetpagetext
}
184 \constfunc{wxString
}{GetPageText
}{\param{int
}{nPage
}}
186 Returns the string for the given page.
188 \membersection{wxNotebook::GetRowCount
}\label{wxnotebookgetrowcount
}
190 \constfunc{int
}{GetRowCount
}{\void}
192 Returns the number of rows in the notebook control.
194 \membersection{wxNotebook::GetSelection
}\label{wxnotebookgetselection
}
196 \constfunc{int
}{GetSelection
}{\void}
198 Returns the currently selected page, or $-
1$ if none was selected.
200 Note that this method may return either the previously or newly selected page
201 when called from the
{\tt EVT
\_NOTEBOOK\_PAGE\_CHANGED} handler depending on
202 the platform and so
\rtfsp
203 \helpref{wxNotebookEvent::GetSelection
}{wxnotebookeventgetselection
} should be
204 used instead in this case.
206 \membersection{wxNotebook::HitTest
}\label{wxnotebookhittest
}
208 \func{int
}{HitTest
}{\param{const wxPoint\&
}{ pt
},
\param{long
}{ *flags =
{\tt NULL
}}}
210 Returns the index of the tab at the specified position or
{\tt wxNOT
\_FOUND}
211 if none. If
{\it flags
} parameter is non
{\tt NULL
}, the position of the point
212 inside the tab is returned as well.
214 {\bf NB:
} This method is currently only implemented under wxMSW and wxUniv.
216 \wxheading{Parameters
}
218 \docparam{pt
}{Specifies the point for the hit test.
}
220 \docparam{flags
}{Return value for detailed information. One of the following values:
222 \begin{twocollist
}\itemsep=
0pt
223 \twocolitem{{\bf wxNB
\_HITTEST\_NOWHERE}}{There was no tab under this point.
}
224 \twocolitem{{\bf wxNB
\_HITTEST\_ONICON}}{The point was over an icon (currently wxMSW only).
}
225 \twocolitem{{\bf wxNB
\_HITTEST\_ONLABEL}}{The point was over a label (currently wxMSW only).
}
226 \twocolitem{{\bf wxNB
\_HITTEST\_ONITEM}}{The point was over an item, but not on the label or icon.
}
230 \wxheading{Return value
}
232 Returns the zero-based tab index or
{\tt wxNOT
\_FOUND} if there is no tab is at
233 the specified position.
236 \membersection{wxNotebook::InsertPage
}\label{wxnotebookinsertpage
}
238 \func{bool
}{InsertPage
}{\param{int
}{ index
},
\param{wxNotebookPage*
}{ page
},
239 \param{const wxString\&
}{ text
},
240 \param{bool
}{ select = false
},
241 \param{int
}{ imageId = -
1}}
243 Inserts a new page at the specified position.
245 \wxheading{Parameters
}
247 \docparam{index
}{Specifies the position for the new page.
}
249 \docparam{page
}{Specifies the new page.
}
251 \docparam{text
}{Specifies the text for the new page.
}
253 \docparam{select
}{Specifies whether the page should be selected.
}
255 \docparam{imageId
}{Specifies the optional image index for the new page.
}
257 \wxheading{Return value
}
259 true if successful, false otherwise.
263 Do not delete the page, it will be deleted by the notebook.
267 \helpref{wxNotebook::AddPage
}{wxnotebookaddpage
}
269 \membersection{wxNotebook::OnSelChange
}\label{wxnotebookonselchange
}
271 \func{void
}{OnSelChange
}{\param{wxNotebookEvent\&
}{ event
}}
273 An event handler function, called when the page selection is changed.
277 \helpref{wxNotebookEvent
}{wxnotebookevent
}
279 \membersection{wxNotebook::RemovePage
}\label{wxnotebookremovepage
}
281 \func{bool
}{RemovePage
}{\param{int
}{ page
}}
283 Deletes the specified page, without deleting the associated window.
285 \membersection{wxNotebook::SetImageList
}\label{wxnotebooksetimagelist
}
287 \func{void
}{SetImageList
}{\param{wxImageList*
}{ imageList
}}
289 Sets the image list for the page control. It does not take
290 ownership of the image list, you must delete it yourself.
294 \helpref{wxImageList
}{wximagelist
},
295 \helpref{AssignImageList
}{wxnotebookassignimagelist
}
297 \membersection{wxNotebook::SetPadding
}\label{wxnotebooksetpadding
}
299 \func{void
}{SetPadding
}{\param{const wxSize\&
}{ padding
}}
301 Sets the amount of space around each page's icon and label, in pixels.
303 {\bf NB:
} The vertical padding cannot be changed in wxGTK.
305 \membersection{wxNotebook::SetPageSize
}\label{wxnotebooksetpagesize
}
307 \func{void
}{SetPageSize
}{\param{const wxSize\&
}{ size
}}
309 Sets the width and height of the pages.
311 {\bf NB:
} This method is currently not implemented for wxGTK.
313 \membersection{wxNotebook::SetPageImage
}\label{wxnotebooksetpageimage
}
315 \func{bool
}{SetPageImage
}{\param{int
}{ page
},
\param{int
}{image
}}
317 Sets the image index for the given page.
{\it image
} is an index into
318 the image list which was set with
\helpref{wxNotebook::SetImageList
}{wxnotebooksetimagelist
}.
320 \membersection{wxNotebook::SetPageText
}\label{wxnotebooksetpagetext
}
322 \func{bool
}{SetPageText
}{\param{int
}{ page
},
\param{const wxString\&
}{text
}}
324 Sets the text for the given page.
326 \membersection{wxNotebook::SetSelection
}\label{wxnotebooksetselection
}
328 \func{int
}{SetSelection
}{\param{int
}{ page
}}
330 Sets the selection for the given page, returning the previous selection.
332 The call to this function generates the page changing events.
336 \helpref{wxNotebook::GetSelection
}{wxnotebookgetselection
}