]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: aui/auibook.h | |
e54c96f1 | 3 | // Purpose: interface of wxAuiNotebook |
23324ae1 FM |
4 | // Author: wxWidgets team |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows license | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | /** | |
10 | @class wxAuiNotebook | |
11 | @headerfile auibook.h wx/aui/auibook.h | |
7c913512 | 12 | |
23324ae1 | 13 | wxAuiNotebook is part of the wxAUI class framework. |
4cc4bfaf | 14 | See also @ref overview_wxauioverview. |
7c913512 | 15 | |
23324ae1 FM |
16 | wxAuiNotebook is a notebook control which implements many features common in |
17 | applications with dockable panes. | |
18 | Specifically, wxAuiNotebook implements functionality which allows the user to | |
19 | rearrange tab order via drag-and-drop, | |
20 | split the tab window into many different splitter configurations, and toggle | |
21 | through different themes to customize | |
22 | the control's look and feel. | |
7c913512 | 23 | |
23324ae1 FM |
24 | An effort has been made to try to maintain an API as similar to that of |
25 | wxNotebook. | |
7c913512 | 26 | |
23324ae1 FM |
27 | The default theme that is used is wxAuiDefaultTabArt, which provides a modern, |
28 | glossy look and feel. | |
29 | The theme can be changed by calling wxAuiNotebook::SetArtProvider. | |
7c913512 | 30 | |
23324ae1 FM |
31 | @beginStyleTable |
32 | @style{wxAUI_NB_DEFAULT_STYLE}: | |
33 | Defined as wxAUI_NB_TOP | wxAUI_NB_TAB_SPLIT | wxAUI_NB_TAB_MOVE | | |
34 | wxAUI_NB_SCROLL_BUTTONS | wxAUI_NB_CLOSE_ON_ACTIVE_TAB. | |
35 | @style{wxAUI_NB_TAB_SPLIT}: | |
36 | Allows the tab control to be split by dragging a tab. | |
37 | @style{wxAUI_NB_TAB_MOVE}: | |
38 | Allows a tab to be moved horizontally by dragging. | |
39 | @style{wxAUI_NB_TAB_EXTERNAL_MOVE}: | |
40 | Allows a tab to be moved to another tab control. | |
41 | @style{wxAUI_NB_TAB_FIXED_WIDTH}: | |
42 | With this style, all tabs have the same width. | |
43 | @style{wxAUI_NB_SCROLL_BUTTONS}: | |
44 | With this style, left and right scroll buttons are displayed. | |
45 | @style{wxAUI_NB_WINDOWLIST_BUTTON}: | |
46 | With this style, a drop-down list of windows is available. | |
47 | @style{wxAUI_NB_CLOSE_BUTTON}: | |
48 | With this style, a close button is available on the tab bar. | |
49 | @style{wxAUI_NB_CLOSE_ON_ACTIVE_TAB}: | |
50 | With this style, the close button is visible on the active tab. | |
51 | @style{wxAUI_NB_CLOSE_ON_ALL_TABS}: | |
52 | With this style, the close button is visible on all tabs. | |
53 | @style{wxAUI_NB_TOP}: | |
54 | With this style, tabs are drawn along the top of the notebook. | |
55 | @style{wxAUI_NB_BOTTOM}: | |
56 | With this style, tabs are drawn along the bottom of the notebook. | |
57 | @endStyleTable | |
7c913512 | 58 | |
23324ae1 FM |
59 | @library{wxaui} |
60 | @category{aui} | |
61 | */ | |
62 | class wxAuiNotebook : public wxControl | |
63 | { | |
64 | public: | |
65 | //@{ | |
66 | /** | |
67 | Constructor. Creates a wxAuiNotebok control. | |
68 | */ | |
69 | wxAuiNotebook(); | |
7c913512 FM |
70 | wxAuiNotebook(wxWindow* parent, wxWindowID id = wxID_ANY, |
71 | const wxPoint& pos = wxDefaultPosition, | |
72 | const wxSize& size = wxDefaultSize, | |
73 | long style = wxAUI_NB_DEFAULT_STYLE); | |
23324ae1 FM |
74 | //@} |
75 | ||
76 | /** | |
4cc4bfaf | 77 | Adds a page. If the @a select parameter is @true, calling this will generate a |
23324ae1 FM |
78 | page change event. |
79 | */ | |
80 | bool AddPage(wxWindow* page, const wxString& caption, | |
4cc4bfaf | 81 | bool select = false, |
23324ae1 FM |
82 | const wxBitmap& bitmap = wxNullBitmap); |
83 | ||
84 | /** | |
85 | Sets the selection to the next or previous page. | |
86 | */ | |
4cc4bfaf | 87 | void AdvanceSelection(bool forward = true); |
23324ae1 FM |
88 | |
89 | /** | |
90 | Creates the notebook window. | |
91 | */ | |
92 | bool Create(wxWindow* parent, wxWindowID id = wxID_ANY, | |
93 | const wxPoint& pos = wxDefaultPosition, | |
94 | const wxSize& size = wxDefaultSize, | |
95 | long style = 0); | |
96 | ||
97 | /** | |
98 | Deletes a page at the given index. Calling this method will generate a page | |
99 | change event. | |
100 | */ | |
101 | bool DeletePage(size_t page); | |
102 | ||
103 | /** | |
104 | Returns the associated art provider. | |
105 | */ | |
328f5751 | 106 | wxAuiTabArt* GetArtProvider() const; |
23324ae1 FM |
107 | |
108 | /** | |
109 | Returns the desired height of the notebook for the given page height. Use this | |
110 | to fit the notebook to | |
111 | a given page size. | |
112 | */ | |
113 | int GetHeightForPageHeight(int pageHeight); | |
114 | ||
115 | /** | |
116 | Returns the page specified by the given index. | |
117 | */ | |
328f5751 | 118 | wxWindow* GetPage(size_t page_idx) const; |
23324ae1 FM |
119 | |
120 | /** | |
121 | Returns the tab bitmap for the page. | |
122 | */ | |
328f5751 | 123 | wxBitmap GetPageBitmap(size_t page) const; |
23324ae1 FM |
124 | |
125 | /** | |
126 | Returns the number of pages in the notebook. | |
127 | */ | |
328f5751 | 128 | size_t GetPageCount() const; |
23324ae1 FM |
129 | |
130 | /** | |
131 | Returns the page index for the specified window. If the window is not found in | |
132 | the notebook, wxNOT_FOUND is returned. | |
133 | */ | |
328f5751 | 134 | int GetPageIndex(wxWindow* page_wnd) const; |
23324ae1 FM |
135 | |
136 | /** | |
137 | Returns the tab label for the page. | |
138 | */ | |
328f5751 | 139 | wxString GetPageText(size_t page) const; |
23324ae1 FM |
140 | |
141 | /** | |
142 | Returns the currently selected page. | |
143 | */ | |
328f5751 | 144 | int GetSelection() const; |
23324ae1 FM |
145 | |
146 | /** | |
147 | Returns the height of the tab control. | |
148 | */ | |
328f5751 | 149 | int GetTabCtrlHeight() const; |
23324ae1 FM |
150 | |
151 | /** | |
152 | InsertPage() is similar to AddPage, but allows the ability to specify the | |
153 | insert location. | |
4cc4bfaf | 154 | If the @a select parameter is @true, calling this will generate a page change |
23324ae1 FM |
155 | event. |
156 | */ | |
157 | bool InsertPage(size_t page_idx, wxWindow* page, | |
158 | const wxString& caption, | |
4cc4bfaf | 159 | bool select = false, |
23324ae1 FM |
160 | const wxBitmap& bitmap = wxNullBitmap); |
161 | ||
162 | /** | |
163 | Removes a page, without deleting the window pointer. | |
164 | */ | |
165 | bool RemovePage(size_t page); | |
166 | ||
167 | /** | |
168 | Sets the art provider to be used by the notebook. | |
169 | */ | |
170 | void SetArtProvider(wxAuiTabArt* art); | |
171 | ||
172 | /** | |
173 | Sets the font for drawing the tab labels, using a bold version of the font for | |
174 | selected tab labels. | |
175 | */ | |
176 | bool SetFont(const wxFont& font); | |
177 | ||
178 | /** | |
179 | Sets the font for measuring tab labels. | |
180 | */ | |
181 | void SetMeasuringFont(const wxFont& font); | |
182 | ||
183 | /** | |
184 | Sets the font for drawing unselected tab labels. | |
185 | */ | |
186 | void SetNormalFont(const wxFont& font); | |
187 | ||
188 | /** | |
189 | Sets the bitmap for the page. To remove a bitmap from the tab caption, pass | |
190 | wxNullBitmap. | |
191 | */ | |
192 | bool SetPageBitmap(size_t page, const wxBitmap& bitmap); | |
193 | ||
194 | /** | |
195 | Sets the tab label for the page. | |
196 | */ | |
197 | bool SetPageText(size_t page, const wxString& text); | |
198 | ||
199 | /** | |
200 | Sets the font for drawing selected tab labels. | |
201 | */ | |
202 | void SetSelectedFont(const wxFont& font); | |
203 | ||
204 | /** | |
205 | Sets the page selection. Calling this method will generate a page change event. | |
206 | */ | |
207 | size_t SetSelection(size_t new_page); | |
208 | ||
209 | /** | |
210 | Sets the tab height. By default, the tab control height is calculated | |
211 | by measuring the text height and bitmap sizes on the tab captions. Calling this | |
212 | method will override that calculation and set the tab control to the specified | |
213 | height parameter. A call to this method will override any call to | |
214 | SetUniformBitmapSize(). | |
215 | Specifying -1 as the height will return the control to its default auto-sizing | |
216 | behaviour. | |
217 | */ | |
218 | void SetTabCtrlHeight(int height); | |
219 | ||
220 | //@{ | |
221 | /** | |
4cc4bfaf | 222 | Split performs a split operation programmatically. The argument @a page |
23324ae1 FM |
223 | indicates |
224 | the page that will be split off. This page will also become the active page | |
225 | after the | |
4cc4bfaf | 226 | split. The @a direction argument specifies where the pane should go, it should |
23324ae1 FM |
227 | be one |
228 | of the following: wxTOP, wxBOTTOM, wxLEFT, or wxRIGHT. | |
229 | */ | |
230 | void SetUniformBitmapSize(const wxSize& size); | |
7c913512 | 231 | void Split(size_t page, int direction); |
23324ae1 FM |
232 | //@} |
233 | ||
234 | /** | |
235 | Shows the window menu for the active tab control associated with this notebook, | |
236 | and returns @true if a selection was made. | |
237 | */ | |
238 | bool ShowWindowMenu(); | |
239 | }; | |
240 | ||
241 | ||
e54c96f1 | 242 | |
23324ae1 FM |
243 | /** |
244 | @class wxAuiTabArt | |
245 | @headerfile auibook.h wx/aui/auibook.h | |
7c913512 | 246 | |
23324ae1 | 247 | Tab art class. |
7c913512 | 248 | |
23324ae1 FM |
249 | @library{wxaui} |
250 | @category{aui} | |
251 | */ | |
7c913512 | 252 | class wxAuiTabArt |
23324ae1 FM |
253 | { |
254 | public: | |
255 | /** | |
256 | Constructor. | |
257 | */ | |
258 | wxAuiTabArt(); | |
259 | ||
260 | /** | |
261 | Clones the art object. | |
262 | */ | |
263 | wxAuiTabArt* Clone(); | |
264 | ||
265 | /** | |
266 | Draws a background on the given area. | |
267 | */ | |
268 | void DrawBackground(wxDC& dc, wxWindow* wnd, const wxRect& rect); | |
269 | ||
270 | /** | |
271 | Draws a button. | |
272 | */ | |
273 | void DrawButton(wxDC& dc, wxWindow* wnd, const wxRect& in_rect, | |
274 | int bitmap_id, | |
275 | int button_state, | |
276 | int orientation, | |
277 | const wxBitmap& bitmap_override, | |
278 | wxRect* out_rect); | |
279 | ||
280 | /** | |
281 | Draws a tab. | |
282 | */ | |
283 | void DrawTab(wxDC& dc, wxWindow* wnd, const wxRect& in_rect, | |
284 | const wxString& caption, | |
285 | const wxBitmap& bitmap, | |
286 | bool active, | |
287 | int close_button_state, | |
288 | wxRect* out_tab_rect, | |
289 | wxRect* out_button_rect, | |
290 | int* x_extent); | |
291 | ||
292 | /** | |
293 | Returns the tab control size. | |
294 | */ | |
295 | int GetBestTabCtrlSize(wxWindow* wnd, | |
296 | wxAuiNotebookPageArray& pages); | |
297 | ||
298 | /** | |
299 | Returns the indent size. | |
300 | */ | |
301 | int GetIndentSize(); | |
302 | ||
303 | /** | |
304 | Returns the tab size for the given caption, bitmap and state. | |
305 | */ | |
306 | wxSize GetTabSize(wxDC& dc, wxWindow* wnd, | |
307 | const wxString& caption, | |
308 | const wxBitmap& bitmap, | |
309 | bool active, | |
310 | int close_button_state, | |
311 | int* x_extent); | |
312 | ||
313 | /** | |
314 | Sets flags. | |
315 | */ | |
316 | void SetFlags(unsigned int flags); | |
317 | ||
318 | /** | |
319 | Sets the font used for calculating measurements. | |
320 | */ | |
321 | void SetMeasuringFont(const wxFont& font); | |
322 | ||
323 | /** | |
324 | Sets the normal font for drawing labels. | |
325 | */ | |
326 | void SetNormalFont(const wxFont& font); | |
327 | ||
328 | /** | |
329 | Sets the font for drawing text for selected UI elements. | |
330 | */ | |
331 | void SetSelectedFont(const wxFont& font); | |
332 | ||
333 | /** | |
334 | Sets sizing information. | |
335 | */ | |
336 | void SetSizingInfo(const wxSize& tab_ctrl_size, size_t tab_count); | |
337 | ||
338 | /** | |
339 | Pops up a menu to show the list of windows managed by wxAui. | |
340 | */ | |
341 | int ShowWindowList(wxWindow* wnd, const wxArrayString& items, | |
342 | int active_idx); | |
343 | }; | |
e54c96f1 | 344 |