1998-09-06 14:43:36 +00:00
\section { \class { wxNotebook} } \label { wxnotebook}
This class represents a notebook control, which manages multiple windows with associated tabs.
To use the class, create a wxNotebook object and call \helpref { AddPage} { wxnotebookaddpage} or \helpref { InsertPage} { wxnotebookinsertpage} ,
passing a window to be used as the page. Do not explicitly delete the window for a page that is currently
managed by wxNotebook.
{ \bf wxNotebookPage} is a typedef for wxWindow.
\wxheading { Derived from}
2007-04-24 08:28:29 +00:00
wxBookCtrlBase (see \helpref { wxBookCtrl overview} { wxbookctrloverview} )\\
1998-09-06 14:43:36 +00:00
\helpref { wxControl} { wxcontrol} \\
\helpref { wxWindow} { wxwindow} \\
\helpref { wxEvtHandler} { wxevthandler} \\
\helpref { wxObject} { wxobject}
1999-02-15 20:41:29 +00:00
\wxheading { Include files}
<wx/notebook.h>
2007-07-28 12:21:03 +00:00
\wxheading { Library}
\helpref { wxCore} { librarieslist}
2000-04-11 15:47:22 +00:00
\wxheading { Window styles}
\twocolwidtha { 5cm}
\begin { twocollist} \itemsep =0pt
2005-03-06 17:16:58 +00:00
\twocolitem { \windowstyle { wxNB\_ TOP} } { Place tabs on the top side.}
2004-11-24 21:54:00 +00:00
\twocolitem { \windowstyle { wxNB\_ LEFT} } { Place tabs on the left side.}
\twocolitem { \windowstyle { wxNB\_ RIGHT} } { Place tabs on the right side.}
\twocolitem { \windowstyle { wxNB\_ BOTTOM} } { Place tabs under instead of above the notebook pages.}
2002-12-04 14:11:26 +00:00
\twocolitem { \windowstyle { wxNB\_ FIXEDWIDTH} } { (Windows only) All tabs will have same width.}
\twocolitem { \windowstyle { wxNB\_ MULTILINE} } { (Windows only) There can be several rows of tabs.}
2005-02-06 19:17:35 +00:00
\twocolitem { \windowstyle { wxNB\_ NOPAGETHEME} } { (Windows only) Display a solid colour on notebook pages, and not a gradient, which can reduce performance.}
2005-03-13 17:46:23 +00:00
\twocolitem { \windowstyle { wxNB\_ FLAT} } { (Windows CE only) Show tabs in a flat style.}
2000-07-15 19:51:35 +00:00
2000-04-11 15:47:22 +00:00
\end { twocollist}
2004-11-24 21:54:00 +00:00
The styles \texttt { wxNB\_ LEFT} , \texttt { RIGHT} and \texttt { BOTTOM} are not
supported under Microsoft Windows XP when using visual themes.
2000-07-15 19:51:35 +00:00
See also \helpref { window styles overview} { windowstyles} .
2001-11-16 16:53:08 +00:00
\input noteevt.inc
1998-09-06 14:43:36 +00:00
2005-02-06 19:17:35 +00:00
\wxheading { Page backgrounds}
On Windows XP, the default theme paints a gradient on the notebook's pages.
If you wish to suppress this theme, for aesthetic or performance reasons,
there are three ways of doing it. You can use wxNB\_ NOPAGETHEME to disable
2006-07-05 12:21:13 +00:00
themed drawing for a particular notebook, you can call { \tt wxSystemOptions::SetOption}
2005-02-06 19:17:35 +00:00
to disable it for the whole application, or you can disable it for individual
pages by using { \tt SetBackgroundColour} .
To disable themed pages globally:
\begin { verbatim}
wxSystemOptions::SetOption(wxT("msw.notebook.themed-background"), 0);
\end { verbatim}
Set the value to 1 to enable it again.
To give a single page a solid background that more or less fits in with the
overall theme, use:
\begin { verbatim}
wxColour col = notebook->GetThemeBackgroundColour();
if (col.Ok())
{
page->SetBackgroundColour(col);
}
\end { verbatim}
On platforms other than Windows, or if the application is not using Windows
themes, { \tt GetThemeBackgroundColour} will return an uninitialised colour object,
and the above code will therefore work on all platforms.
1998-09-06 14:43:36 +00:00
\wxheading { See also}
2005-02-11 16:24:25 +00:00
\helpref { wxBookCtrl} { wxbookctrloverview} , \helpref { wxNotebookEvent} { wxnotebookevent} , \helpref { wxImageList} { wximagelist} , \helpref { notebook sample} { samplenotebook} \rtfsp
1998-09-06 14:43:36 +00:00
\latexignore { \rtfignore { \wxheading { Members} } }
2004-09-28 11:54:59 +00:00
\membersection { wxNotebook::wxNotebook} \label { wxnotebookctor}
1998-09-06 14:43:36 +00:00
\func { } { wxNotebook} { \void }
Default constructor.
\func { } { wxNotebook} { \param { wxWindow*} { parent} , \param { wxWindowID } { id} , \param { const wxPoint\& } { pos = wxDefaultPosition} ,
2005-01-13 20:30:21 +00:00
\param { const wxSize\& } { size = wxDefaultSize} , \param { long} { style = 0} , \param { const wxString\& } { name = wxNotebookNameStr} }
1998-09-06 14:43:36 +00:00
Constructs a notebook control.
2000-03-08 08:32:31 +00:00
Note that sometimes you can reduce flicker by passing the wxCLIP\_ CHILDREN window style.
1998-09-06 14:43:36 +00:00
\wxheading { Parameters}
\docparam { parent} { The parent window. Must be non-NULL.}
\docparam { id} { The window identifier.}
\docparam { pos} { The window position.}
\docparam { size} { The window size.}
2000-07-15 19:51:35 +00:00
\docparam { style} { The window style. See \helpref { wxNotebook} { wxnotebook} .}
1998-09-06 14:43:36 +00:00
1999-06-15 20:42:48 +00:00
\docparam { name} { The name of the control (used only under Motif).}
2004-11-19 18:57:53 +00:00
2004-09-28 11:54:59 +00:00
\membersection { wxNotebook::\destruct { wxNotebook} } \label { wxnotebookdtor}
1998-09-06 14:43:36 +00:00
\func { } { \destruct { wxNotebook} } { \void }
Destroys the wxNotebook object.
2004-11-19 18:57:53 +00:00
1998-09-06 14:43:36 +00:00
\membersection { wxNotebook::AddPage} \label { wxnotebookaddpage}
\func { bool} { AddPage} { \param { wxNotebookPage*} { page} ,
\param { const wxString\& } { text} ,
2003-01-18 00:16:34 +00:00
\param { bool} { select = false} ,
1998-09-06 14:43:36 +00:00
\param { int} { imageId = -1} }
Adds a new page.
2003-07-07 11:59:15 +00:00
The call to this function may generate the page changing events.
1998-09-06 14:43:36 +00:00
\wxheading { Parameters}
\docparam { page} { Specifies the new page.}
\docparam { text} { Specifies the text for the new page.}
\docparam { select} { Specifies whether the page should be selected.}
\docparam { imageId} { Specifies the optional image index for the new page.}
\wxheading { Return value}
2003-01-18 00:16:34 +00:00
true if successful, false otherwise.
1998-09-06 14:43:36 +00:00
\wxheading { Remarks}
Do not delete the page, it will be deleted by the notebook.
\wxheading { See also}
\helpref { wxNotebook::InsertPage} { wxnotebookinsertpage}
2004-11-19 18:57:53 +00:00
1998-09-06 14:43:36 +00:00
\membersection { wxNotebook::AdvanceSelection} \label { wxnotebookadvanceselection}
2003-01-18 00:16:34 +00:00
\func { void} { AdvanceSelection} { \param { bool} { forward = true} }
1998-09-06 14:43:36 +00:00
Cycles through the tabs.
2003-07-07 11:59:15 +00:00
The call to this function generates the page changing events.
2004-11-19 18:57:53 +00:00
2000-09-28 22:25:07 +00:00
\membersection { wxNotebook::AssignImageList} \label { wxnotebookassignimagelist}
\func { void} { AssignImageList} { \param { wxImageList*} { imageList} }
Sets the image list for the page control and takes ownership of
the list.
\wxheading { See also}
\helpref { wxImageList} { wximagelist} ,
\helpref { SetImageList} { wxnotebooksetimagelist}
2004-11-19 18:57:53 +00:00
1998-09-06 14:43:36 +00:00
\membersection { wxNotebook::Create} \label { wxnotebookcreate}
\func { bool} { Create} { \param { wxWindow*} { parent} , \param { wxWindowID } { id} , \param { const wxPoint\& } { pos = wxDefaultPosition} ,
2005-01-13 20:30:21 +00:00
\param { const wxSize\& } { size} , \param { long} { style = 0} , \param { const wxString\& } { name = wxNotebookNameStr} }
1998-09-06 14:43:36 +00:00
2004-09-28 11:54:59 +00:00
Creates a notebook control. See \helpref { wxNotebook::wxNotebook} { wxnotebookctor} for a description
1998-09-06 14:43:36 +00:00
of the parameters.
2004-11-19 18:57:53 +00:00
1998-09-06 14:43:36 +00:00
\membersection { wxNotebook::DeleteAllPages} \label { wxnotebookdeleteallpages}
\func { bool} { DeleteAllPages} { \void }
Deletes all pages.
2004-11-19 18:57:53 +00:00
1998-09-06 14:43:36 +00:00
\membersection { wxNotebook::DeletePage} \label { wxnotebookdeletepage}
2003-08-21 13:08:00 +00:00
\func { bool} { DeletePage} { \param { size\_ t} { page} }
1998-09-06 14:43:36 +00:00
1998-11-24 21:55:10 +00:00
Deletes the specified page, and the associated window.
1998-09-06 14:43:36 +00:00
2003-07-07 11:59:15 +00:00
The call to this function generates the page changing events.
2004-11-19 18:57:53 +00:00
\membersection { wxNotebook::GetCurrentPage} \label { wxnotebookgetcurrentpage}
\constfunc { wxWindow *} { GetCurrentPage} { \void }
2006-05-24 23:23:19 +00:00
Returns the currently selected notebook page or \NULL .
2004-11-19 18:57:53 +00:00
1998-09-06 14:43:36 +00:00
\membersection { wxNotebook::GetImageList} \label { wxnotebookgetimagelist}
\constfunc { wxImageList*} { GetImageList} { \void }
Returns the associated image list.
\wxheading { See also}
\helpref { wxImageList} { wximagelist} , \helpref { wxNotebook::SetImageList} { wxnotebooksetimagelist}
2004-11-19 18:57:53 +00:00
1998-09-06 14:43:36 +00:00
\membersection { wxNotebook::GetPage} \label { wxnotebookgetpage}
2003-08-21 13:08:00 +00:00
\func { wxNotebookPage*} { GetPage} { \param { size\_ t} { page} }
1998-09-06 14:43:36 +00:00
Returns the window at the given page position.
2004-11-19 18:57:53 +00:00
1998-09-06 14:43:36 +00:00
\membersection { wxNotebook::GetPageCount} \label { wxnotebookgetpagecount}
2003-08-21 13:08:00 +00:00
\constfunc { size\_ t} { GetPageCount} { \void }
1998-09-06 14:43:36 +00:00
Returns the number of pages in the notebook control.
2004-11-19 18:57:53 +00:00
1998-09-06 14:43:36 +00:00
\membersection { wxNotebook::GetPageImage} \label { wxnotebookgetpageimage}
2003-08-21 13:08:00 +00:00
\constfunc { int} { GetPageImage} { \param { size\_ t } { nPage} }
1998-09-06 14:43:36 +00:00
Returns the image index for the given page.
2004-11-19 18:57:53 +00:00
1998-09-06 14:43:36 +00:00
\membersection { wxNotebook::GetPageText} \label { wxnotebookgetpagetext}
2003-08-21 13:08:00 +00:00
\constfunc { wxString} { GetPageText} { \param { size\_ t } { nPage} }
1998-09-06 14:43:36 +00:00
Returns the string for the given page.
2004-11-19 18:57:53 +00:00
1998-09-06 14:43:36 +00:00
\membersection { wxNotebook::GetRowCount} \label { wxnotebookgetrowcount}
\constfunc { int} { GetRowCount} { \void }
Returns the number of rows in the notebook control.
2004-11-19 18:57:53 +00:00
1998-09-06 14:43:36 +00:00
\membersection { wxNotebook::GetSelection} \label { wxnotebookgetselection}
\constfunc { int} { GetSelection} { \void }
2001-11-25 15:32:16 +00:00
Returns the currently selected page, or $ - 1 $ if none was selected.
Note that this method may return either the previously or newly selected page
when called from the { \tt EVT\_ NOTEBOOK\_ PAGE\_ CHANGED} handler depending on
the platform and so\rtfsp
\helpref { wxNotebookEvent::GetSelection} { wxnotebookeventgetselection} should be
used instead in this case.
1998-09-06 14:43:36 +00:00
2005-02-06 19:17:35 +00:00
\membersection { wxNotebook::GetThemeBackgroundColour} \label { wxnotebookgetthemebackgroundcolour}
\constfunc { wxColour} { GetThemeBackgroundColour} { \void }
If running under Windows and themes are enabled for the application, this function
returns a suitable colour for painting the background of a notebook page, and can be passed
to { \tt SetBackgroundColour} . Otherwise, an uninitialised colour will be returned.
2004-11-19 18:57:53 +00:00
2003-07-06 21:02:24 +00:00
\membersection { wxNotebook::HitTest} \label { wxnotebookhittest}
\func { int} { HitTest} { \param { const wxPoint\& } { pt} , \param { long} { *flags = { \tt NULL} } }
2005-01-13 20:30:21 +00:00
Returns the index of the tab at the specified position or { \tt wxNOT\_ FOUND}
2006-05-28 23:56:51 +00:00
if none. If { \it flags} parameter is non-{ \tt NULL} , the position of the point
2003-07-06 21:02:24 +00:00
inside the tab is returned as well.
\wxheading { Parameters}
\docparam { pt} { Specifies the point for the hit test.}
\docparam { flags} { Return value for detailed information. One of the following values:
\twocolwidtha { 7cm}
\begin { twocollist} \itemsep =0pt
2006-07-05 12:21:13 +00:00
\twocolitem { { \bf wxBK\_ HITTEST\_ NOWHERE} } { There was no tab under this point.}
\twocolitem { { \bf wxBK\_ HITTEST\_ ONICON} } { The point was over an icon (currently wxMSW only).}
\twocolitem { { \bf wxBK\_ HITTEST\_ ONLABEL} } { The point was over a label (currently wxMSW only).}
\twocolitem { { \bf wxBK\_ HITTEST\_ ONITEM} } { The point was over an item, but not on the label or icon.}
\twocolitem { { \bf wxBK\_ HITTEST\_ ONPAGE} } { The point was over a currently selected page, not over any tab. Note that this flag is present only if { \tt wxNOT\_ FOUND} is returned.}
2003-07-06 21:02:24 +00:00
\end { twocollist}
}
\wxheading { Return value}
Returns the zero-based tab index or { \tt wxNOT\_ FOUND} if there is no tab is at
the specified position.
2004-11-19 18:57:53 +00:00
1998-09-06 14:43:36 +00:00
\membersection { wxNotebook::InsertPage} \label { wxnotebookinsertpage}
2003-08-21 13:08:00 +00:00
\func { bool} { InsertPage} { \param { size\_ t} { index} , \param { wxNotebookPage*} { page} ,
1998-09-06 14:43:36 +00:00
\param { const wxString\& } { text} ,
2003-01-18 00:16:34 +00:00
\param { bool} { select = false} ,
1998-09-06 14:43:36 +00:00
\param { int} { imageId = -1} }
Inserts a new page at the specified position.
\wxheading { Parameters}
\docparam { index} { Specifies the position for the new page.}
\docparam { page} { Specifies the new page.}
\docparam { text} { Specifies the text for the new page.}
\docparam { select} { Specifies whether the page should be selected.}
\docparam { imageId} { Specifies the optional image index for the new page.}
\wxheading { Return value}
2003-01-18 00:16:34 +00:00
true if successful, false otherwise.
1998-09-06 14:43:36 +00:00
\wxheading { Remarks}
Do not delete the page, it will be deleted by the notebook.
\wxheading { See also}
\helpref { wxNotebook::AddPage} { wxnotebookaddpage}
2004-11-19 18:57:53 +00:00
1998-09-06 14:43:36 +00:00
\membersection { wxNotebook::OnSelChange} \label { wxnotebookonselchange}
\func { void} { OnSelChange} { \param { wxNotebookEvent\& } { event} }
An event handler function, called when the page selection is changed.
\wxheading { See also}
\helpref { wxNotebookEvent} { wxnotebookevent}
2004-11-19 18:57:53 +00:00
1998-11-24 21:55:10 +00:00
\membersection { wxNotebook::RemovePage} \label { wxnotebookremovepage}
2003-08-21 13:08:00 +00:00
\func { bool} { RemovePage} { \param { size\_ t} { page} }
1998-11-24 21:55:10 +00:00
Deletes the specified page, without deleting the associated window.
2004-11-19 18:57:53 +00:00
1998-09-06 14:43:36 +00:00
\membersection { wxNotebook::SetImageList} \label { wxnotebooksetimagelist}
\func { void} { SetImageList} { \param { wxImageList*} { imageList} }
2000-09-28 22:25:07 +00:00
Sets the image list for the page control. It does not take
ownership of the image list, you must delete it yourself.
1998-09-06 14:43:36 +00:00
\wxheading { See also}
2000-09-28 22:25:07 +00:00
\helpref { wxImageList} { wximagelist} ,
\helpref { AssignImageList} { wxnotebookassignimagelist}
1998-09-06 14:43:36 +00:00
2004-11-19 18:57:53 +00:00
1998-09-06 14:43:36 +00:00
\membersection { wxNotebook::SetPadding} \label { wxnotebooksetpadding}
\func { void} { SetPadding} { \param { const wxSize\& } { padding} }
Sets the amount of space around each page's icon and label, in pixels.
2002-08-08 10:11:32 +00:00
{ \bf NB:} The vertical padding cannot be changed in wxGTK.
2004-11-19 18:57:53 +00:00
1998-09-06 14:43:36 +00:00
\membersection { wxNotebook::SetPageSize} \label { wxnotebooksetpagesize}
\func { void} { SetPageSize} { \param { const wxSize\& } { size} }
Sets the width and height of the pages.
2002-08-08 10:11:32 +00:00
{ \bf NB:} This method is currently not implemented for wxGTK.
2004-11-19 18:57:53 +00:00
1998-09-06 14:43:36 +00:00
\membersection { wxNotebook::SetPageImage} \label { wxnotebooksetpageimage}
2003-08-21 13:08:00 +00:00
\func { bool} { SetPageImage} { \param { size\_ t} { page} , \param { int } { image} }
1998-09-06 14:43:36 +00:00
Sets the image index for the given page. { \it image} is an index into
the image list which was set with \helpref { wxNotebook::SetImageList} { wxnotebooksetimagelist} .
2004-11-19 18:57:53 +00:00
1998-09-06 14:43:36 +00:00
\membersection { wxNotebook::SetPageText} \label { wxnotebooksetpagetext}
2003-08-21 13:08:00 +00:00
\func { bool} { SetPageText} { \param { size\_ t} { page} , \param { const wxString\& } { text} }
1998-09-06 14:43:36 +00:00
Sets the text for the given page.
2004-11-19 18:57:53 +00:00
1998-09-06 14:43:36 +00:00
\membersection { wxNotebook::SetSelection} \label { wxnotebooksetselection}
2003-08-21 13:08:00 +00:00
\func { int} { SetSelection} { \param { size\_ t} { page} }
1998-09-06 14:43:36 +00:00
Sets the selection for the given page, returning the previous selection.
2003-07-07 11:59:15 +00:00
The call to this function generates the page changing events.
2006-10-08 17:37:23 +00:00
This function is deprecated and should not be used in new code. Please use the
\helpref { ChangeSelection} { wxnotebookchangeselection} function instead.
1998-09-06 14:43:36 +00:00
\wxheading { See also}
\helpref { wxNotebook::GetSelection} { wxnotebookgetselection}
2006-10-08 17:37:23 +00:00
\membersection { wxNotebook::ChangeSelection} \label { wxnotebookchangeselection}
\func { int} { ChangeSelection} { \param { size\_ t} { page} }
Changes the selection for the given page, returning the previous selection.
The call to this function \emph { does not} generate the page changing events.
This is the only difference with \helpref { SetSelection} { wxnotebooksetselection} .
See \helpref { this topic} { progevent} for more info.
2006-10-10 16:48:47 +00:00