]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/notebook.h
implement * and / operators for wxPoint, not only wxSize.
[wxWidgets.git] / interface / wx / notebook.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: notebook.h
3e97a905 3// Purpose: interface of wxNotebook
23324ae1
FM
4// Author: wxWidgets team
5// RCS-ID: $Id$
6// Licence: wxWindows license
7/////////////////////////////////////////////////////////////////////////////
8
23324ae1
FM
9/**
10 @class wxNotebook
7c913512 11
23324ae1
FM
12 This class represents a notebook control, which manages multiple windows with
13 associated tabs.
7c913512 14
3e97a905 15 To use the class, create a wxNotebook object and call wxNotebook::AddPage
340e9651
FM
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
3e97a905 18 wxNotebook.
7c913512 19
23324ae1 20 @b wxNotebookPage is a typedef for wxWindow.
7c913512 21
23324ae1 22 @beginStyleTable
8c6791e4 23 @style{wxNB_TOP}
23324ae1 24 Place tabs on the top side.
8c6791e4 25 @style{wxNB_LEFT}
23324ae1 26 Place tabs on the left side.
8c6791e4 27 @style{wxNB_RIGHT}
23324ae1 28 Place tabs on the right side.
8c6791e4 29 @style{wxNB_BOTTOM}
23324ae1 30 Place tabs under instead of above the notebook pages.
8c6791e4 31 @style{wxNB_FIXEDWIDTH}
23324ae1 32 (Windows only) All tabs will have same width.
8c6791e4 33 @style{wxNB_MULTILINE}
23324ae1 34 (Windows only) There can be several rows of tabs.
8c6791e4 35 @style{wxNB_NOPAGETHEME}
23324ae1
FM
36 (Windows only) Display a solid colour on notebook pages, and not a
37 gradient, which can reduce performance.
8c6791e4 38 @style{wxNB_FLAT}
23324ae1
FM
39 (Windows CE only) Show tabs in a flat style.
40 @endStyleTable
7c913512 41
340e9651
FM
42 The styles wxNB_LEFT, RIGHT and BOTTOM are not supported under
43 Microsoft Windows XP when using visual themes.
44
3051a44a 45 @beginEventEmissionTable{wxBookCtrlEvent}
340e9651
FM
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.
53 @endEventTable
54
55
56 @section notebook_bg Page backgrounds
57
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().
65
66 To disable themed pages globally:
67 @code
f8ebb70d 68 wxSystemOptions::SetOption("msw.notebook.themed-background", 0);
340e9651
FM
69 @endcode
70
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
73 overall theme, use:
74 @code
75 wxColour col = notebook->GetThemeBackgroundColour();
eb2b6166 76 if (col.IsOk())
340e9651
FM
77 {
78 page->SetBackgroundColour(col);
79 }
80 @endcode
81
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.
85
86
23324ae1 87 @library{wxcore}
3c99e2fd 88 @category{bookctrl}
7c14fc8c 89 @appearance{notebook.png}
7c913512 90
e8a8aa37 91 @see wxBookCtrl, wxBookCtrlEvent, wxImageList, @ref page_samples_notebook
23324ae1 92*/
340e9651 93class wxNotebook : public wxBookCtrlBase
23324ae1
FM
94{
95public:
90ae878f
RR
96
97 /**
98 Constructs a notebook control.
99 */
100 wxNotebook();
101
23324ae1
FM
102 /**
103 Constructs a notebook control.
23324ae1
FM
104 Note that sometimes you can reduce flicker by passing the wxCLIP_CHILDREN
105 window style.
3c4f71cc 106
7c913512 107 @param parent
4cc4bfaf 108 The parent window. Must be non-@NULL.
7c913512 109 @param id
4cc4bfaf 110 The window identifier.
7c913512 111 @param pos
4cc4bfaf 112 The window position.
7c913512 113 @param size
4cc4bfaf 114 The window size.
7c913512 115 @param style
4cc4bfaf 116 The window style. See wxNotebook.
7c913512 117 @param name
e8a8aa37 118 The name of the control.
23324ae1 119 */
7c913512
FM
120 wxNotebook(wxWindow* parent, wxWindowID id,
121 const wxPoint& pos = wxDefaultPosition,
122 const wxSize& size = wxDefaultSize,
123 long style = 0,
124 const wxString& name = wxNotebookNameStr);
23324ae1
FM
125
126 /**
127 Destroys the wxNotebook object.
128 */
a6052817 129 virtual ~wxNotebook();
23324ae1 130
23324ae1 131 /**
e8a8aa37
FM
132 Creates a notebook control.
133 See wxNotebook() for a description of the parameters.
23324ae1
FM
134 */
135 bool Create(wxWindow* parent, wxWindowID id,
136 const wxPoint& pos = wxDefaultPosition,
a6052817
FM
137 const wxSize& size = wxDefaultSize,
138 long style = 0,
23324ae1
FM
139 const wxString& name = wxNotebookNameStr);
140
23324ae1
FM
141
142 /**
143 Returns the number of rows in the notebook control.
144 */
a6052817 145 virtual int GetRowCount() const;
23324ae1 146
23324ae1
FM
147 /**
148 If running under Windows and themes are enabled for the application, this
e8a8aa37
FM
149 function returns a suitable colour for painting the background of a notebook
150 page, and can be passed to SetBackgroundColour().
151
152 Otherwise, an uninitialised colour will be returned.
23324ae1 153 */
a6052817 154 virtual wxColour GetThemeBackgroundColour() const;
23324ae1 155
23324ae1
FM
156 /**
157 An event handler function, called when the page selection is changed.
3c4f71cc 158
3e97a905 159 @see wxBookCtrlEvent
23324ae1 160 */
3e97a905 161 void OnSelChange(wxBookCtrlEvent& event);
23324ae1 162
23324ae1
FM
163 /**
164 Sets the amount of space around each page's icon and label, in pixels.
e8a8aa37 165
1f1d2182 166 @note The vertical padding cannot be changed in wxGTK.
23324ae1 167 */
adaaa686 168 virtual void SetPadding(const wxSize& padding);
23324ae1 169};
e54c96f1 170