2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: notebook.h
|
2008-08-01 09:46:46 -04:00
|
|
|
// Purpose: interface of wxNotebook
|
2008-03-08 08:52:38 -05:00
|
|
|
// Author: wxWidgets team
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Licence: wxWindows license
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxNotebook
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
This class represents a notebook control, which manages multiple windows with
|
|
|
|
associated tabs.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-08-01 09:46:46 -04:00
|
|
|
To use the class, create a wxNotebook object and call wxNotebook::AddPage
|
2008-10-13 06:27:19 -04:00
|
|
|
or wxNotebook::InsertPage, passing a window to be used as the page.
|
|
|
|
Do not explicitly delete the window for a page that is currently managed by
|
2008-08-01 09:46:46 -04:00
|
|
|
wxNotebook.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@b wxNotebookPage is a typedef for wxWindow.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@beginStyleTable
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxNB_TOP}
|
2008-03-08 08:52:38 -05:00
|
|
|
Place tabs on the top side.
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxNB_LEFT}
|
2008-03-08 08:52:38 -05:00
|
|
|
Place tabs on the left side.
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxNB_RIGHT}
|
2008-03-08 08:52:38 -05:00
|
|
|
Place tabs on the right side.
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxNB_BOTTOM}
|
2008-03-08 08:52:38 -05:00
|
|
|
Place tabs under instead of above the notebook pages.
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxNB_FIXEDWIDTH}
|
2008-03-08 08:52:38 -05:00
|
|
|
(Windows only) All tabs will have same width.
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxNB_MULTILINE}
|
2008-03-08 08:52:38 -05:00
|
|
|
(Windows only) There can be several rows of tabs.
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxNB_NOPAGETHEME}
|
2008-03-08 08:52:38 -05:00
|
|
|
(Windows only) Display a solid colour on notebook pages, and not a
|
|
|
|
gradient, which can reduce performance.
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxNB_FLAT}
|
2008-03-08 08:52:38 -05:00
|
|
|
(Windows CE only) Show tabs in a flat style.
|
|
|
|
@endStyleTable
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-10-13 06:27:19 -04:00
|
|
|
The styles wxNB_LEFT, RIGHT and BOTTOM are not supported under
|
|
|
|
Microsoft Windows XP when using visual themes.
|
|
|
|
|
2009-02-18 12:58:51 -05:00
|
|
|
@beginEventEmissionTable{wxBookCtrlEvent}
|
2008-10-13 06:27:19 -04:00
|
|
|
@event{EVT_NOTEBOOK_PAGE_CHANGED(id, func)}
|
|
|
|
The page selection was changed.
|
|
|
|
Processes a @c wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED event.
|
|
|
|
@event{EVT_NOTEBOOK_PAGE_CHANGING(id, func)}
|
|
|
|
The page selection is about to be changed.
|
|
|
|
Processes a @c wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING event.
|
|
|
|
This event can be vetoed.
|
|
|
|
@endEventTable
|
|
|
|
|
|
|
|
|
|
|
|
@section notebook_bg 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 @c wxNB_NOPAGETHEME to disable themed drawing for a particular
|
|
|
|
notebook, you can call wxSystemOptions::SetOption to disable it for the
|
|
|
|
whole application, or you can disable it for individual pages by using
|
|
|
|
SetBackgroundColour().
|
|
|
|
|
|
|
|
To disable themed pages globally:
|
|
|
|
@code
|
2009-01-18 16:46:46 -05:00
|
|
|
wxSystemOptions::SetOption("msw.notebook.themed-background", 0);
|
2008-10-13 06:27:19 -04:00
|
|
|
@endcode
|
|
|
|
|
|
|
|
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:
|
|
|
|
@code
|
|
|
|
wxColour col = notebook->GetThemeBackgroundColour();
|
2009-01-10 13:00:53 -05:00
|
|
|
if (col.IsOk())
|
2008-10-13 06:27:19 -04:00
|
|
|
{
|
|
|
|
page->SetBackgroundColour(col);
|
|
|
|
}
|
|
|
|
@endcode
|
|
|
|
|
|
|
|
On platforms other than Windows, or if the application is not using Windows
|
|
|
|
themes, GetThemeBackgroundColour() will return an uninitialised colour object,
|
|
|
|
and the above code will therefore work on all platforms.
|
|
|
|
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxcore}
|
2009-02-20 06:34:52 -05:00
|
|
|
@category{bookctrl}
|
2008-10-13 15:55:46 -04:00
|
|
|
@appearance{notebook.png}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-10-13 04:55:12 -04:00
|
|
|
@see wxBookCtrl, wxBookCtrlEvent, wxImageList, @ref page_samples_notebook
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-13 06:27:19 -04:00
|
|
|
class wxNotebook : public wxBookCtrlBase
|
2008-03-08 08:52:38 -05:00
|
|
|
{
|
|
|
|
public:
|
2008-07-04 04:02:33 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
Constructs a notebook control.
|
|
|
|
*/
|
|
|
|
wxNotebook();
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
Constructs a notebook control.
|
|
|
|
Note that sometimes you can reduce flicker by passing the wxCLIP_CHILDREN
|
|
|
|
window style.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param parent
|
2008-03-09 08:33:59 -04:00
|
|
|
The parent window. Must be non-@NULL.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param id
|
2008-03-09 08:33:59 -04:00
|
|
|
The window identifier.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param pos
|
2008-03-09 08:33:59 -04:00
|
|
|
The window position.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param size
|
2008-03-09 08:33:59 -04:00
|
|
|
The window size.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param style
|
2008-03-09 08:33:59 -04:00
|
|
|
The window style. See wxNotebook.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param name
|
2008-10-13 04:55:12 -04:00
|
|
|
The name of the control.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-08 09:43:31 -05:00
|
|
|
wxNotebook(wxWindow* parent, wxWindowID id,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = 0,
|
|
|
|
const wxString& name = wxNotebookNameStr);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Destroys the wxNotebook object.
|
|
|
|
*/
|
2008-03-25 08:22:08 -04:00
|
|
|
virtual ~wxNotebook();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-10-13 04:55:12 -04:00
|
|
|
Creates a notebook control.
|
|
|
|
See wxNotebook() for a description of the parameters.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
bool Create(wxWindow* parent, wxWindowID id,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
2008-03-25 08:22:08 -04:00
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = 0,
|
2008-03-08 08:52:38 -05:00
|
|
|
const wxString& name = wxNotebookNameStr);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the number of rows in the notebook control.
|
|
|
|
*/
|
2008-03-25 08:22:08 -04:00
|
|
|
virtual int GetRowCount() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
If running under Windows and themes are enabled for the application, this
|
2008-10-13 04:55:12 -04:00
|
|
|
function returns a suitable colour for painting the background of a notebook
|
|
|
|
page, and can be passed to SetBackgroundColour().
|
|
|
|
|
|
|
|
Otherwise, an uninitialised colour will be returned.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-25 08:22:08 -04:00
|
|
|
virtual wxColour GetThemeBackgroundColour() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
An event handler function, called when the page selection is changed.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-08-01 09:46:46 -04:00
|
|
|
@see wxBookCtrlEvent
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-08-01 09:46:46 -04:00
|
|
|
void OnSelChange(wxBookCtrlEvent& event);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the amount of space around each page's icon and label, in pixels.
|
2008-10-13 04:55:12 -04:00
|
|
|
|
2008-03-28 12:19:12 -04:00
|
|
|
@note The vertical padding cannot be changed in wxGTK.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void SetPadding(const wxSize& padding);
|
2008-03-08 08:52:38 -05:00
|
|
|
};
|
2008-03-10 11:24:38 -04:00
|
|
|
|