]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/notebook.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxNotebook
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
12 This class represents a notebook control, which manages multiple windows with
15 To use the class, create a wxNotebook object and call wxNotebook::AddPage
16 or wxNotebook::InsertPage, passing a window to be used as the page.
17 Do not explicitly delete the window for a page that is currently managed by
20 @b wxNotebookPage is a typedef for wxWindow.
24 Place tabs on the top side.
26 Place tabs on the left side.
28 Place tabs on the right side.
30 Place tabs under instead of above the notebook pages.
31 @style{wxNB_FIXEDWIDTH}
32 (Windows only) All tabs will have same width.
33 @style{wxNB_MULTILINE}
34 (Windows only) There can be several rows of tabs.
35 @style{wxNB_NOPAGETHEME}
36 (Windows only) Display a solid colour on notebook pages, and not a
37 gradient, which can reduce performance.
39 (Windows CE only) Show tabs in a flat style.
42 The styles wxNB_LEFT, RIGHT and BOTTOM are not supported under
43 Microsoft Windows XP when using visual themes.
45 @beginEventTable{wxBookCtrlEvent}
46 @event{EVT_NOTEBOOK_PAGE_CHANGED(id, func)}
47 The page selection was changed.
48 Processes a @c wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED event.
49 @event{EVT_NOTEBOOK_PAGE_CHANGING(id, func)}
50 The page selection is about to be changed.
51 Processes a @c wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING event.
52 This event can be vetoed.
56 @section notebook_bg Page backgrounds
58 On Windows XP, the default theme paints a gradient on the notebook's pages.
59 If you wish to suppress this theme, for aesthetic or performance reasons,
60 there are three ways of doing it.
61 You can use @c wxNB_NOPAGETHEME to disable themed drawing for a particular
62 notebook, you can call wxSystemOptions::SetOption to disable it for the
63 whole application, or you can disable it for individual pages by using
64 SetBackgroundColour().
66 To disable themed pages globally:
68 wxSystemOptions::SetOption(wxT("msw.notebook.themed-background"), 0);
71 Set the value to 1 to enable it again.
72 To give a single page a solid background that more or less fits in with the
75 wxColour col = notebook->GetThemeBackgroundColour();
78 page->SetBackgroundColour(col);
82 On platforms other than Windows, or if the application is not using Windows
83 themes, GetThemeBackgroundColour() will return an uninitialised colour object,
84 and the above code will therefore work on all platforms.
90 @see wxBookCtrl, wxBookCtrlEvent, wxImageList, @ref page_samples_notebook
92 class wxNotebook
: public wxBookCtrlBase
97 Constructs a notebook control.
102 Constructs a notebook control.
103 Note that sometimes you can reduce flicker by passing the wxCLIP_CHILDREN
107 The parent window. Must be non-@NULL.
109 The window identifier.
115 The window style. See wxNotebook.
117 The name of the control.
119 wxNotebook(wxWindow
* parent
, wxWindowID id
,
120 const wxPoint
& pos
= wxDefaultPosition
,
121 const wxSize
& size
= wxDefaultSize
,
123 const wxString
& name
= wxNotebookNameStr
);
126 Destroys the wxNotebook object.
128 virtual ~wxNotebook();
131 Creates a notebook control.
132 See wxNotebook() for a description of the parameters.
134 bool Create(wxWindow
* parent
, wxWindowID id
,
135 const wxPoint
& pos
= wxDefaultPosition
,
136 const wxSize
& size
= wxDefaultSize
,
138 const wxString
& name
= wxNotebookNameStr
);
142 Returns the number of rows in the notebook control.
144 virtual int GetRowCount() const;
147 If running under Windows and themes are enabled for the application, this
148 function returns a suitable colour for painting the background of a notebook
149 page, and can be passed to SetBackgroundColour().
151 Otherwise, an uninitialised colour will be returned.
153 virtual wxColour
GetThemeBackgroundColour() const;
156 An event handler function, called when the page selection is changed.
160 void OnSelChange(wxBookCtrlEvent
& event
);
163 Sets the amount of space around each page's icon and label, in pixels.
165 @note The vertical padding cannot be changed in wxGTK.
167 virtual void SetPadding(const wxSize
& padding
);