]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/notebook.h
Fix wrong wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICK name in the docs.
[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$
526954c5 6// Licence: wxWindows licence
23324ae1
FM
7/////////////////////////////////////////////////////////////////////////////
8
fbfdbb0f
RD
9enum
10{
11 wxNB_HITTEST_NOWHERE = wxBK_HITTEST_NOWHERE,
12 wxNB_HITTEST_ONICON = wxBK_HITTEST_ONICON,
13 wxNB_HITTEST_ONLABEL = wxBK_HITTEST_ONLABEL,
14 wxNB_HITTEST_ONITEM = wxBK_HITTEST_ONITEM,
15 wxNB_HITTEST_ONPAGE = wxBK_HITTEST_ONPAGE
16};
17
18#define wxNB_DEFAULT wxBK_DEFAULT
19#define wxNB_TOP wxBK_TOP
20#define wxNB_BOTTOM wxBK_BOTTOM
21#define wxNB_LEFT wxBK_LEFT
22#define wxNB_RIGHT wxBK_RIGHT
23
24#define wxNB_FIXEDWIDTH 0x0100
25#define wxNB_MULTILINE 0x0200
26#define wxNB_NOPAGETHEME 0x0400
27#define wxNB_FLAT 0x0800
28
23324ae1
FM
29/**
30 @class wxNotebook
7c913512 31
23324ae1
FM
32 This class represents a notebook control, which manages multiple windows with
33 associated tabs.
7c913512 34
3e97a905 35 To use the class, create a wxNotebook object and call wxNotebook::AddPage
340e9651
FM
36 or wxNotebook::InsertPage, passing a window to be used as the page.
37 Do not explicitly delete the window for a page that is currently managed by
3e97a905 38 wxNotebook.
7c913512 39
23324ae1 40 @b wxNotebookPage is a typedef for wxWindow.
7c913512 41
23324ae1 42 @beginStyleTable
8c6791e4 43 @style{wxNB_TOP}
23324ae1 44 Place tabs on the top side.
8c6791e4 45 @style{wxNB_LEFT}
23324ae1 46 Place tabs on the left side.
8c6791e4 47 @style{wxNB_RIGHT}
23324ae1 48 Place tabs on the right side.
8c6791e4 49 @style{wxNB_BOTTOM}
23324ae1 50 Place tabs under instead of above the notebook pages.
8c6791e4 51 @style{wxNB_FIXEDWIDTH}
23324ae1 52 (Windows only) All tabs will have same width.
8c6791e4 53 @style{wxNB_MULTILINE}
23324ae1 54 (Windows only) There can be several rows of tabs.
8c6791e4 55 @style{wxNB_NOPAGETHEME}
23324ae1
FM
56 (Windows only) Display a solid colour on notebook pages, and not a
57 gradient, which can reduce performance.
8c6791e4 58 @style{wxNB_FLAT}
23324ae1
FM
59 (Windows CE only) Show tabs in a flat style.
60 @endStyleTable
7c913512 61
340e9651
FM
62 The styles wxNB_LEFT, RIGHT and BOTTOM are not supported under
63 Microsoft Windows XP when using visual themes.
64
3051a44a 65 @beginEventEmissionTable{wxBookCtrlEvent}
340e9651
FM
66 @event{EVT_NOTEBOOK_PAGE_CHANGED(id, func)}
67 The page selection was changed.
68 Processes a @c wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED event.
69 @event{EVT_NOTEBOOK_PAGE_CHANGING(id, func)}
70 The page selection is about to be changed.
71 Processes a @c wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING event.
72 This event can be vetoed.
73 @endEventTable
74
75
76 @section notebook_bg Page backgrounds
77
78 On Windows XP, the default theme paints a gradient on the notebook's pages.
79 If you wish to suppress this theme, for aesthetic or performance reasons,
80 there are three ways of doing it.
81 You can use @c wxNB_NOPAGETHEME to disable themed drawing for a particular
82 notebook, you can call wxSystemOptions::SetOption to disable it for the
83 whole application, or you can disable it for individual pages by using
84 SetBackgroundColour().
85
86 To disable themed pages globally:
87 @code
f8ebb70d 88 wxSystemOptions::SetOption("msw.notebook.themed-background", 0);
340e9651
FM
89 @endcode
90
91 Set the value to 1 to enable it again.
92 To give a single page a solid background that more or less fits in with the
93 overall theme, use:
94 @code
95 wxColour col = notebook->GetThemeBackgroundColour();
eb2b6166 96 if (col.IsOk())
340e9651
FM
97 {
98 page->SetBackgroundColour(col);
99 }
100 @endcode
101
102 On platforms other than Windows, or if the application is not using Windows
103 themes, GetThemeBackgroundColour() will return an uninitialised colour object,
104 and the above code will therefore work on all platforms.
105
106
23324ae1 107 @library{wxcore}
3c99e2fd 108 @category{bookctrl}
7c14fc8c 109 @appearance{notebook.png}
7c913512 110
e8a8aa37 111 @see wxBookCtrl, wxBookCtrlEvent, wxImageList, @ref page_samples_notebook
23324ae1 112*/
340e9651 113class wxNotebook : public wxBookCtrlBase
23324ae1
FM
114{
115public:
90ae878f
RR
116
117 /**
118 Constructs a notebook control.
119 */
120 wxNotebook();
121
23324ae1
FM
122 /**
123 Constructs a notebook control.
23324ae1
FM
124 Note that sometimes you can reduce flicker by passing the wxCLIP_CHILDREN
125 window style.
3c4f71cc 126
7c913512 127 @param parent
4cc4bfaf 128 The parent window. Must be non-@NULL.
7c913512 129 @param id
4cc4bfaf 130 The window identifier.
7c913512 131 @param pos
4cc4bfaf 132 The window position.
7c913512 133 @param size
4cc4bfaf 134 The window size.
7c913512 135 @param style
4cc4bfaf 136 The window style. See wxNotebook.
7c913512 137 @param name
e8a8aa37 138 The name of the control.
23324ae1 139 */
7c913512
FM
140 wxNotebook(wxWindow* parent, wxWindowID id,
141 const wxPoint& pos = wxDefaultPosition,
142 const wxSize& size = wxDefaultSize,
143 long style = 0,
144 const wxString& name = wxNotebookNameStr);
23324ae1
FM
145
146 /**
147 Destroys the wxNotebook object.
148 */
a6052817 149 virtual ~wxNotebook();
23324ae1 150
23324ae1 151 /**
e8a8aa37
FM
152 Creates a notebook control.
153 See wxNotebook() for a description of the parameters.
23324ae1
FM
154 */
155 bool Create(wxWindow* parent, wxWindowID id,
156 const wxPoint& pos = wxDefaultPosition,
a6052817
FM
157 const wxSize& size = wxDefaultSize,
158 long style = 0,
23324ae1
FM
159 const wxString& name = wxNotebookNameStr);
160
23324ae1
FM
161
162 /**
163 Returns the number of rows in the notebook control.
164 */
a6052817 165 virtual int GetRowCount() const;
23324ae1 166
23324ae1
FM
167 /**
168 If running under Windows and themes are enabled for the application, this
e8a8aa37
FM
169 function returns a suitable colour for painting the background of a notebook
170 page, and can be passed to SetBackgroundColour().
171
172 Otherwise, an uninitialised colour will be returned.
23324ae1 173 */
a6052817 174 virtual wxColour GetThemeBackgroundColour() const;
23324ae1 175
23324ae1
FM
176 /**
177 An event handler function, called when the page selection is changed.
3c4f71cc 178
3e97a905 179 @see wxBookCtrlEvent
23324ae1 180 */
3e97a905 181 void OnSelChange(wxBookCtrlEvent& event);
23324ae1 182
23324ae1
FM
183 /**
184 Sets the amount of space around each page's icon and label, in pixels.
e8a8aa37 185
1f1d2182 186 @note The vertical padding cannot be changed in wxGTK.
23324ae1 187 */
adaaa686 188 virtual void SetPadding(const wxSize& padding);
fbfdbb0f
RD
189
190 // implementations of pure virtuals
191 virtual int GetPageImage(size_t nPage) const;
192 virtual bool SetPageImage(size_t page, int image);
193 virtual wxString GetPageText(size_t nPage) const;
194 virtual bool SetPageText(size_t page, const wxString& text);
195 virtual int GetSelection() const;
196 virtual int SetSelection(size_t page);
197 virtual int ChangeSelection(size_t page);
198 virtual bool InsertPage(size_t index, wxWindow * page, const wxString & text,
199 bool select = false, int imageId = NO_IMAGE);
200
23324ae1 201};
e54c96f1 202