]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: aui/auibook.h | |
3 | // Purpose: interface of wxAuiNotebook | |
4 | // Author: wxWidgets team | |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows licence | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | /** | |
10 | @class wxAuiNotebook | |
11 | ||
12 | wxAuiNotebook is part of the wxAUI class framework, which represents a | |
13 | notebook control, managing multiple windows with associated tabs. | |
14 | ||
15 | See also @ref overview_aui. | |
16 | ||
17 | wxAuiNotebook is a notebook control which implements many features common in | |
18 | applications with dockable panes. | |
19 | Specifically, wxAuiNotebook implements functionality which allows the user to | |
20 | rearrange tab order via drag-and-drop, split the tab window into many different | |
21 | splitter configurations, and toggle through different themes to customize | |
22 | the control's look and feel. | |
23 | ||
24 | The default theme that is used is wxAuiDefaultTabArt, which provides a modern, | |
25 | glossy look and feel. | |
26 | The theme can be changed by calling wxAuiNotebook::SetArtProvider. | |
27 | ||
28 | @beginStyleTable | |
29 | @style{wxAUI_NB_DEFAULT_STYLE} | |
30 | Defined as wxAUI_NB_TOP | wxAUI_NB_TAB_SPLIT | wxAUI_NB_TAB_MOVE | | |
31 | wxAUI_NB_SCROLL_BUTTONS | wxAUI_NB_CLOSE_ON_ACTIVE_TAB | | |
32 | wxAUI_NB_MIDDLE_CLICK_CLOSE. | |
33 | @style{wxAUI_NB_TAB_SPLIT} | |
34 | Allows the tab control to be split by dragging a tab. | |
35 | @style{wxAUI_NB_TAB_MOVE} | |
36 | Allows a tab to be moved horizontally by dragging. | |
37 | @style{wxAUI_NB_TAB_EXTERNAL_MOVE} | |
38 | Allows a tab to be moved to another tab control. | |
39 | @style{wxAUI_NB_TAB_FIXED_WIDTH} | |
40 | With this style, all tabs have the same width. | |
41 | @style{wxAUI_NB_SCROLL_BUTTONS} | |
42 | With this style, left and right scroll buttons are displayed. | |
43 | @style{wxAUI_NB_WINDOWLIST_BUTTON} | |
44 | With this style, a drop-down list of windows is available. | |
45 | @style{wxAUI_NB_CLOSE_BUTTON} | |
46 | With this style, a close button is available on the tab bar. | |
47 | @style{wxAUI_NB_CLOSE_ON_ACTIVE_TAB} | |
48 | With this style, the close button is visible on the active tab. | |
49 | @style{wxAUI_NB_CLOSE_ON_ALL_TABS} | |
50 | With this style, the close button is visible on all tabs. | |
51 | @style{wxAUI_NB_MIDDLE_CLICK_CLOSE} | |
52 | With this style, middle click on a tab closes the tab. | |
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 | |
58 | ||
59 | @beginEventEmissionTable{wxAuiNotebookEvent} | |
60 | @event{EVT_AUINOTEBOOK_PAGE_CLOSE(id, func)} | |
61 | A page is about to be closed. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE event. | |
62 | @event{EVT_AUINOTEBOOK_PAGE_CLOSED(winid, fn)} | |
63 | A page has been closed. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSED event. | |
64 | @event{EVT_AUINOTEBOOK_PAGE_CHANGED(id, func)} | |
65 | The page selection was changed. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED event. | |
66 | @event{EVT_AUINOTEBOOK_PAGE_CHANGING(id, func)} | |
67 | The page selection is about to be changed. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING event. This event can be vetoed. | |
68 | @event{EVT_AUINOTEBOOK_BUTTON(id, func)} | |
69 | The window list button has been pressed. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_BUTTON event. | |
70 | @event{EVT_AUINOTEBOOK_BEGIN_DRAG(id, func)} | |
71 | Dragging is about to begin. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_BEGIN_DRAG event. | |
72 | @event{EVT_AUINOTEBOOK_END_DRAG(id, func)} | |
73 | Dragging has ended. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_END_DRAG event. | |
74 | @event{EVT_AUINOTEBOOK_DRAG_MOTION(id, func)} | |
75 | Emitted during a drag and drop operation. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_DRAG_MOTION event. | |
76 | @event{EVT_AUINOTEBOOK_ALLOW_DND(id, func)} | |
77 | Whether to allow a tab to be dropped. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_ALLOW_DND event. This event must be specially allowed. | |
78 | @event{EVT_AUINOTEBOOK_DRAG_DONE(winid, fn)} | |
79 | Notify that the tab has been dragged. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_DRAG_DONE event. | |
80 | @event{EVT_AUINOTEBOOK_TAB_MIDDLE_DOWN(winid, fn)} | |
81 | The middle mouse button is pressed on a tab. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_DOWN event. | |
82 | @event{EVT_AUINOTEBOOK_TAB_MIDDLE_UP(winid, fn)} | |
83 | The middle mouse button is released on a tab. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_UP event. | |
84 | @event{EVT_AUINOTEBOOK_TAB_RIGHT_DOWN(winid, fn)} | |
85 | The right mouse button is pressed on a tab. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_DOWN event. | |
86 | @event{EVT_AUINOTEBOOK_TAB_RIGHT_UP(winid, fn)} | |
87 | The right mouse button is released on a tab. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_UP event. | |
88 | @event{EVT_AUINOTEBOOK_BG_DCLICK(winid, fn)} | |
89 | Double clicked on the tabs background area. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_BG_DCLICK event. | |
90 | @endEventTable | |
91 | ||
92 | @library{wxaui} | |
93 | @category{aui} | |
94 | */ | |
95 | class wxAuiNotebook : public wxBookCtrlBase | |
96 | { | |
97 | public: | |
98 | /** | |
99 | Default ctor. | |
100 | */ | |
101 | wxAuiNotebook(); | |
102 | ||
103 | /** | |
104 | Constructor. Creates a wxAuiNotebok control. | |
105 | */ | |
106 | wxAuiNotebook(wxWindow* parent, wxWindowID id = wxID_ANY, | |
107 | const wxPoint& pos = wxDefaultPosition, | |
108 | const wxSize& size = wxDefaultSize, | |
109 | long style = wxAUI_NB_DEFAULT_STYLE); | |
110 | ||
111 | /** | |
112 | Adds a page. | |
113 | If the @a select parameter is @true, calling this will generate a page change event. | |
114 | */ | |
115 | bool AddPage(wxWindow* page, const wxString& caption, | |
116 | bool select = false, | |
117 | const wxBitmap& bitmap = wxNullBitmap); | |
118 | ||
119 | /** | |
120 | Adds a new page. | |
121 | ||
122 | The page must have the book control itself as the parent and must not | |
123 | have been added to this control previously. | |
124 | ||
125 | The call to this function may generate the page changing events. | |
126 | ||
127 | @param page | |
128 | Specifies the new page. | |
129 | @param text | |
130 | Specifies the text for the new page. | |
131 | @param select | |
132 | Specifies whether the page should be selected. | |
133 | @param imageId | |
134 | Specifies the optional image index for the new page. | |
135 | ||
136 | @return @true if successful, @false otherwise. | |
137 | ||
138 | @remarks Do not delete the page, it will be deleted by the book control. | |
139 | ||
140 | @see InsertPage() | |
141 | @since 2.9.3 | |
142 | */ | |
143 | virtual bool AddPage(wxWindow *page, const wxString &text, bool select, int imageId); | |
144 | ||
145 | /** | |
146 | Sets the selection to the next or previous page. | |
147 | */ | |
148 | void AdvanceSelection(bool forward = true); | |
149 | ||
150 | /** | |
151 | Changes the selection for the given page, returning the previous selection. | |
152 | ||
153 | This function behaves as SetSelection() but does @em not generate the | |
154 | page changing events. | |
155 | ||
156 | See @ref overview_events_prog for more information. | |
157 | @since 2.9.3 | |
158 | */ | |
159 | virtual int ChangeSelection(size_t n); | |
160 | ||
161 | /** | |
162 | Creates the notebook window. | |
163 | */ | |
164 | bool Create(wxWindow* parent, wxWindowID id = wxID_ANY, | |
165 | const wxPoint& pos = wxDefaultPosition, | |
166 | const wxSize& size = wxDefaultSize, | |
167 | long style = 0); | |
168 | ||
169 | /** | |
170 | Deletes all pages. | |
171 | @since 2.9.3 | |
172 | */ | |
173 | virtual bool DeleteAllPages(); | |
174 | ||
175 | /** | |
176 | Deletes a page at the given index. | |
177 | Calling this method will generate a page change event. | |
178 | */ | |
179 | bool DeletePage(size_t page); | |
180 | ||
181 | /** | |
182 | Returns the associated art provider. | |
183 | */ | |
184 | wxAuiTabArt* GetArtProvider() const; | |
185 | ||
186 | /** | |
187 | Returns the currently selected page or @NULL. | |
188 | @since 2.9.3 | |
189 | */ | |
190 | wxWindow* GetCurrentPage () const; | |
191 | ||
192 | /** | |
193 | Returns the desired height of the notebook for the given page height. | |
194 | Use this to fit the notebook to a given page size. | |
195 | */ | |
196 | int GetHeightForPageHeight(int pageHeight); | |
197 | ||
198 | /** | |
199 | Returns the page specified by the given index. | |
200 | */ | |
201 | wxWindow* GetPage(size_t page_idx) const; | |
202 | ||
203 | /** | |
204 | Returns the tab bitmap for the page. | |
205 | */ | |
206 | wxBitmap GetPageBitmap(size_t page) const; | |
207 | ||
208 | /** | |
209 | Returns the number of pages in the notebook. | |
210 | */ | |
211 | size_t GetPageCount() const; | |
212 | ||
213 | /** | |
214 | Returns the page index for the specified window. | |
215 | If the window is not found in the notebook, wxNOT_FOUND is returned. | |
216 | */ | |
217 | int GetPageIndex(wxWindow* page_wnd) const; | |
218 | ||
219 | /** | |
220 | Returns the tab label for the page. | |
221 | */ | |
222 | wxString GetPageText(size_t page) const; | |
223 | ||
224 | /** | |
225 | Returns the tooltip for the tab label of the page. | |
226 | ||
227 | @since 2.9.4 | |
228 | */ | |
229 | wxString GetPageToolTip(size_t pageIdx) const; | |
230 | ||
231 | /** | |
232 | Returns the currently selected page. | |
233 | */ | |
234 | int GetSelection() const; | |
235 | ||
236 | /** | |
237 | Returns the height of the tab control. | |
238 | */ | |
239 | int GetTabCtrlHeight() const; | |
240 | ||
241 | /** | |
242 | InsertPage() is similar to AddPage, but allows the ability to specify the | |
243 | insert location. | |
244 | If the @a select parameter is @true, calling this will generate a page change | |
245 | event. | |
246 | */ | |
247 | bool InsertPage(size_t page_idx, wxWindow* page, | |
248 | const wxString& caption, | |
249 | bool select = false, | |
250 | const wxBitmap& bitmap = wxNullBitmap); | |
251 | ||
252 | /** | |
253 | Inserts a new page at the specified position. | |
254 | ||
255 | @param index | |
256 | Specifies the position for the new page. | |
257 | @param page | |
258 | Specifies the new page. | |
259 | @param text | |
260 | Specifies the text for the new page. | |
261 | @param select | |
262 | Specifies whether the page should be selected. | |
263 | @param imageId | |
264 | Specifies the optional image index for the new page. | |
265 | ||
266 | @return @true if successful, @false otherwise. | |
267 | ||
268 | @remarks Do not delete the page, it will be deleted by the book control. | |
269 | ||
270 | @see AddPage() | |
271 | @since 2.9.3 | |
272 | */ | |
273 | virtual bool InsertPage(size_t index, wxWindow *page, const wxString &text, | |
274 | bool select=false, int imageId=NO_IMAGE); | |
275 | ||
276 | /** | |
277 | Removes a page, without deleting the window pointer. | |
278 | */ | |
279 | bool RemovePage(size_t page); | |
280 | ||
281 | /** | |
282 | Sets the art provider to be used by the notebook. | |
283 | */ | |
284 | void SetArtProvider(wxAuiTabArt* art); | |
285 | ||
286 | /** | |
287 | Sets the font for drawing the tab labels, using a bold version of the font for | |
288 | selected tab labels. | |
289 | */ | |
290 | virtual bool SetFont(const wxFont& font); | |
291 | ||
292 | /** | |
293 | Sets the font for measuring tab labels. | |
294 | */ | |
295 | void SetMeasuringFont(const wxFont& font); | |
296 | ||
297 | /** | |
298 | Sets the font for drawing unselected tab labels. | |
299 | */ | |
300 | void SetNormalFont(const wxFont& font); | |
301 | ||
302 | /** | |
303 | Sets the bitmap for the page. To remove a bitmap from the tab caption, pass | |
304 | wxNullBitmap. | |
305 | */ | |
306 | bool SetPageBitmap(size_t page, const wxBitmap& bitmap); | |
307 | ||
308 | /** | |
309 | Sets the image index for the given page. @a image is an index into | |
310 | the image list which was set with SetImageList(). | |
311 | @since 2.9.3 | |
312 | */ | |
313 | virtual bool SetPageImage(size_t n, int imageId); | |
314 | ||
315 | /** | |
316 | Sets the tab label for the page. | |
317 | */ | |
318 | bool SetPageText(size_t page, const wxString& text); | |
319 | ||
320 | /** | |
321 | Sets the tooltip displayed when hovering over the tab label of the page. | |
322 | ||
323 | @return | |
324 | @true if tooltip was updated, @false if it failed, e.g. because the | |
325 | page index is invalid. | |
326 | ||
327 | @since 2.9.4 | |
328 | */ | |
329 | bool SetPageToolTip(size_t page, const wxString& text); | |
330 | ||
331 | /** | |
332 | Sets the font for drawing selected tab labels. | |
333 | */ | |
334 | void SetSelectedFont(const wxFont& font); | |
335 | ||
336 | /** | |
337 | Sets the page selection. Calling this method will generate a page change event. | |
338 | */ | |
339 | size_t SetSelection(size_t new_page); | |
340 | ||
341 | /** | |
342 | Sets the tab height. By default, the tab control height is calculated | |
343 | by measuring the text height and bitmap sizes on the tab captions. Calling this | |
344 | method will override that calculation and set the tab control to the specified | |
345 | height parameter. A call to this method will override any call to | |
346 | SetUniformBitmapSize(). | |
347 | ||
348 | Specifying -1 as the height will return the control to its default auto-sizing | |
349 | behaviour. | |
350 | */ | |
351 | virtual void SetTabCtrlHeight(int height); | |
352 | ||
353 | //@{ | |
354 | /** | |
355 | Split performs a split operation programmatically. The argument @a page | |
356 | indicates the page that will be split off. This page will also become the | |
357 | active page after the split. | |
358 | ||
359 | The @a direction argument specifies where the pane should go, it should be one | |
360 | of the following: wxTOP, wxBOTTOM, wxLEFT, or wxRIGHT. | |
361 | */ | |
362 | virtual void SetUniformBitmapSize(const wxSize& size); | |
363 | virtual void Split(size_t page, int direction); | |
364 | //@} | |
365 | ||
366 | /** | |
367 | Shows the window menu for the active tab control associated with this notebook, | |
368 | and returns @true if a selection was made. | |
369 | */ | |
370 | bool ShowWindowMenu(); | |
371 | }; | |
372 | ||
373 | /** | |
374 | @class wxAuiTabContainerButton | |
375 | ||
376 | A simple class which holds information about wxAuiNotebook tab buttons and their state. | |
377 | ||
378 | @library{wxaui} | |
379 | @category{aui} | |
380 | */ | |
381 | class wxAuiTabContainerButton | |
382 | { | |
383 | public: | |
384 | /// button's id | |
385 | int id; | |
386 | /// current state (normal, hover, pressed, etc.) | |
387 | int curState; | |
388 | /// buttons location (wxLEFT, wxRIGHT, or wxCENTER) | |
389 | int location; | |
390 | /// button's hover bitmap | |
391 | wxBitmap bitmap; | |
392 | /// button's disabled bitmap | |
393 | wxBitmap disBitmap; | |
394 | /// button's hit rectangle | |
395 | wxRect rect; | |
396 | }; | |
397 | ||
398 | ||
399 | /** | |
400 | @class wxAuiTabContainer | |
401 | ||
402 | wxAuiTabContainer is a class which contains information about each tab. | |
403 | It also can render an entire tab control to a specified DC. | |
404 | It's not a window class itself, because this code will be used by | |
405 | the wxAuiNotebook, where it is disadvantageous to have separate | |
406 | windows for each tab control in the case of "docked tabs". | |
407 | ||
408 | A derived class, wxAuiTabCtrl, is an actual wxWindow - derived window | |
409 | which can be used as a tab control in the normal sense. | |
410 | ||
411 | @library{wxaui} | |
412 | @category{aui} | |
413 | */ | |
414 | class wxAuiTabContainer | |
415 | { | |
416 | public: | |
417 | ||
418 | /** | |
419 | Default ctor. | |
420 | */ | |
421 | wxAuiTabContainer(); | |
422 | ||
423 | /** | |
424 | Default dtor. | |
425 | */ | |
426 | virtual ~wxAuiTabContainer(); | |
427 | ||
428 | void SetArtProvider(wxAuiTabArt* art); | |
429 | wxAuiTabArt* GetArtProvider() const; | |
430 | ||
431 | void SetFlags(unsigned int flags); | |
432 | unsigned int GetFlags() const; | |
433 | ||
434 | bool AddPage(wxWindow* page, const wxAuiNotebookPage& info); | |
435 | bool InsertPage(wxWindow* page, const wxAuiNotebookPage& info, size_t idx); | |
436 | bool MovePage(wxWindow* page, size_t newIdx); | |
437 | bool RemovePage(wxWindow* page); | |
438 | bool SetActivePage(wxWindow* page); | |
439 | bool SetActivePage(size_t page); | |
440 | void SetNoneActive(); | |
441 | int GetActivePage() const; | |
442 | bool TabHitTest(int x, int y, wxWindow** hit) const; | |
443 | bool ButtonHitTest(int x, int y, wxAuiTabContainerButton** hit) const; | |
444 | wxWindow* GetWindowFromIdx(size_t idx) const; | |
445 | int GetIdxFromWindow(wxWindow* page) const; | |
446 | size_t GetPageCount() const; | |
447 | wxAuiNotebookPage& GetPage(size_t idx); | |
448 | const wxAuiNotebookPage& GetPage(size_t idx) const; | |
449 | wxAuiNotebookPageArray& GetPages(); | |
450 | void SetNormalFont(const wxFont& normalFont); | |
451 | void SetSelectedFont(const wxFont& selectedFont); | |
452 | void SetMeasuringFont(const wxFont& measuringFont); | |
453 | void SetColour(const wxColour& colour); | |
454 | void SetActiveColour(const wxColour& colour); | |
455 | void DoShowHide(); | |
456 | void SetRect(const wxRect& rect); | |
457 | ||
458 | void RemoveButton(int id); | |
459 | void AddButton(int id, | |
460 | int location, | |
461 | const wxBitmap& normalBitmap = wxNullBitmap, | |
462 | const wxBitmap& disabledBitmap = wxNullBitmap); | |
463 | ||
464 | size_t GetTabOffset() const; | |
465 | void SetTabOffset(size_t offset); | |
466 | ||
467 | // Is the tab visible? | |
468 | bool IsTabVisible(int tabPage, int tabOffset, wxDC* dc, wxWindow* wnd); | |
469 | ||
470 | // Make the tab visible if it wasn't already | |
471 | void MakeTabVisible(int tabPage, wxWindow* win); | |
472 | ||
473 | protected: | |
474 | ||
475 | virtual void Render(wxDC* dc, wxWindow* wnd); | |
476 | ||
477 | protected: | |
478 | ||
479 | wxAuiTabArt* m_art; | |
480 | wxAuiNotebookPageArray m_pages; | |
481 | wxAuiTabContainerButtonArray m_buttons; | |
482 | wxAuiTabContainerButtonArray m_tabCloseButtons; | |
483 | wxRect m_rect; | |
484 | size_t m_tabOffset; | |
485 | unsigned int m_flags; | |
486 | }; | |
487 | ||
488 | ||
489 | ||
490 | /** | |
491 | @class wxAuiTabArt | |
492 | ||
493 | Tab art provider defines all the drawing functions used by wxAuiNotebook. | |
494 | ||
495 | This allows the wxAuiNotebook to have a pluggable look-and-feel. | |
496 | ||
497 | By default, a wxAuiNotebook uses an instance of this class called | |
498 | wxAuiDefaultTabArt which provides bitmap art and a colour scheme that is | |
499 | adapted to the major platforms' look. You can either derive from that class | |
500 | to alter its behaviour or write a completely new tab art class. | |
501 | ||
502 | Another example of creating a new wxAuiNotebook tab bar is wxAuiSimpleTabArt. | |
503 | ||
504 | Call wxAuiNotebook::SetArtProvider() to make use of this new tab art. | |
505 | ||
506 | @library{wxaui} | |
507 | @category{aui} | |
508 | */ | |
509 | class wxAuiTabArt | |
510 | { | |
511 | public: | |
512 | /** | |
513 | Constructor. | |
514 | */ | |
515 | wxAuiTabArt(); | |
516 | ||
517 | /** | |
518 | Clones the art object. | |
519 | */ | |
520 | virtual wxAuiTabArt* Clone() = 0; | |
521 | ||
522 | /** | |
523 | Draws a background on the given area. | |
524 | */ | |
525 | virtual void DrawBackground(wxDC& dc, wxWindow* wnd, const wxRect& rect) = 0; | |
526 | ||
527 | /** | |
528 | Draws a button. | |
529 | */ | |
530 | virtual void DrawButton(wxDC& dc, wxWindow* wnd, const wxRect& in_rect, | |
531 | int bitmap_id, int button_state, int orientation, | |
532 | wxRect* out_rect) = 0; | |
533 | ||
534 | /** | |
535 | Draws a tab. | |
536 | */ | |
537 | virtual void DrawTab(wxDC& dc, wxWindow* wnd, const wxAuiNotebookPage& page, | |
538 | const wxRect& rect, int close_button_state, | |
539 | wxRect* out_tab_rect, wxRect* out_button_rect, int* x_extent) = 0; | |
540 | ||
541 | /** | |
542 | Returns the tab control size. | |
543 | */ | |
544 | virtual int GetBestTabCtrlSize(wxWindow*, const wxAuiNotebookPageArray&, const wxSize&) = 0; | |
545 | ||
546 | /** | |
547 | Returns the indent size. | |
548 | */ | |
549 | virtual int GetIndentSize() = 0; | |
550 | ||
551 | /** | |
552 | Returns the tab size for the given caption, bitmap and state. | |
553 | */ | |
554 | virtual wxSize GetTabSize(wxDC& dc, wxWindow* wnd, const wxString& caption, | |
555 | const wxBitmap& bitmap, bool active, | |
556 | int close_button_state, int* x_extent) = 0; | |
557 | ||
558 | /** | |
559 | Sets flags. | |
560 | */ | |
561 | virtual void SetFlags(unsigned int flags) = 0; | |
562 | ||
563 | /** | |
564 | Sets the font used for calculating measurements. | |
565 | */ | |
566 | virtual void SetMeasuringFont(const wxFont& font) = 0; | |
567 | ||
568 | /** | |
569 | Sets the normal font for drawing labels. | |
570 | */ | |
571 | virtual void SetNormalFont(const wxFont& font) = 0; | |
572 | ||
573 | /** | |
574 | Sets the font for drawing text for selected UI elements. | |
575 | */ | |
576 | virtual void SetSelectedFont(const wxFont& font) = 0; | |
577 | ||
578 | /** | |
579 | Sets the colour of the inactive tabs. | |
580 | ||
581 | @since 2.9.2 | |
582 | */ | |
583 | virtual void SetColour(const wxColour& colour) = 0; | |
584 | ||
585 | /** | |
586 | Sets the colour of the selected tab. | |
587 | ||
588 | @since 2.9.2 | |
589 | */ | |
590 | virtual void SetActiveColour(const wxColour& colour) = 0; | |
591 | ||
592 | /** | |
593 | Sets sizing information. | |
594 | */ | |
595 | virtual void SetSizingInfo(const wxSize& tab_ctrl_size, size_t tab_count) = 0; | |
596 | }; | |
597 | ||
598 | /** | |
599 | @class wxAuiNotebookEvent | |
600 | ||
601 | This class is used by the events generated by wxAuiNotebook. | |
602 | ||
603 | @beginEventEmissionTable{wxAuiNotebookEvent} | |
604 | @event{EVT_AUINOTEBOOK_PAGE_CLOSE(id, func)} | |
605 | A page is about to be closed. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE event. | |
606 | @event{EVT_AUINOTEBOOK_PAGE_CLOSED(winid, fn)} | |
607 | A page has been closed. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSED event. | |
608 | @event{EVT_AUINOTEBOOK_PAGE_CHANGED(id, func)} | |
609 | The page selection was changed. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED event. | |
610 | @event{EVT_AUINOTEBOOK_PAGE_CHANGING(id, func)} | |
611 | The page selection is about to be changed. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING event. This event can be vetoed. | |
612 | @event{EVT_AUINOTEBOOK_BUTTON(id, func)} | |
613 | The window list button has been pressed. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_BUTTON event. | |
614 | @event{EVT_AUINOTEBOOK_BEGIN_DRAG(id, func)} | |
615 | Dragging is about to begin. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_BEGIN_DRAG event. | |
616 | @event{EVT_AUINOTEBOOK_END_DRAG(id, func)} | |
617 | Dragging has ended. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_END_DRAG event. | |
618 | @event{EVT_AUINOTEBOOK_DRAG_MOTION(id, func)} | |
619 | Emitted during a drag and drop operation. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_DRAG_MOTION event. | |
620 | @event{EVT_AUINOTEBOOK_ALLOW_DND(id, func)} | |
621 | Whether to allow a tab to be dropped. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_ALLOW_DND event. This event must be specially allowed. | |
622 | @event{EVT_AUINOTEBOOK_DRAG_DONE(winid, fn)} | |
623 | Notify that the tab has been dragged. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_DRAG_DONE event. | |
624 | @event{EVT_AUINOTEBOOK_TAB_MIDDLE_DOWN(winid, fn)} | |
625 | The middle mouse button is pressed on a tab. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_DOWN event. | |
626 | @event{EVT_AUINOTEBOOK_TAB_MIDDLE_UP(winid, fn)} | |
627 | The middle mouse button is released on a tab. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_UP event. | |
628 | @event{EVT_AUINOTEBOOK_TAB_RIGHT_DOWN(winid, fn)} | |
629 | The right mouse button is pressed on a tab. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_DOWN event. | |
630 | @event{EVT_AUINOTEBOOK_TAB_RIGHT_UP(winid, fn)} | |
631 | The right mouse button is released on a tab. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_UP event. | |
632 | @event{EVT_AUINOTEBOOK_BG_DCLICK(winid, fn)} | |
633 | Double clicked on the tabs background area. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_BG_DCLICK event. | |
634 | @endEventTable | |
635 | ||
636 | @library{wxaui} | |
637 | @category{events,bookctrl} | |
638 | ||
639 | @see wxAuiNotebook, wxBookCtrlEvent | |
640 | */ | |
641 | class wxAuiNotebookEvent : public wxBookCtrlEvent | |
642 | { | |
643 | public: | |
644 | /** | |
645 | Constructor. | |
646 | */ | |
647 | wxAuiNotebookEvent(wxEventType command_type = wxEVT_NULL, int win_id = 0); | |
648 | ||
649 | wxEvent *Clone(); | |
650 | }; | |
651 | ||
652 | /** | |
653 | Default art provider for wxAuiNotebook. | |
654 | ||
655 | @see wxAuiTabArt | |
656 | ||
657 | @genericAppearance{auidefaulttabart.png} | |
658 | ||
659 | @library{wxaui} | |
660 | @category{aui} | |
661 | */ | |
662 | ||
663 | class wxAuiDefaultTabArt : public wxAuiTabArt | |
664 | { | |
665 | public: | |
666 | ||
667 | wxAuiDefaultTabArt(); | |
668 | virtual ~wxAuiDefaultTabArt(); | |
669 | ||
670 | wxAuiTabArt* Clone(); | |
671 | void SetFlags(unsigned int flags); | |
672 | void SetSizingInfo(const wxSize& tabCtrlSize, | |
673 | size_t tabCount); | |
674 | ||
675 | void SetNormalFont(const wxFont& font); | |
676 | void SetSelectedFont(const wxFont& font); | |
677 | void SetMeasuringFont(const wxFont& font); | |
678 | void SetColour(const wxColour& colour); | |
679 | void SetActiveColour(const wxColour& colour); | |
680 | ||
681 | void DrawBackground( | |
682 | wxDC& dc, | |
683 | wxWindow* wnd, | |
684 | const wxRect& rect); | |
685 | ||
686 | void DrawTab(wxDC& dc, | |
687 | wxWindow* wnd, | |
688 | const wxAuiNotebookPage& pane, | |
689 | const wxRect& inRect, | |
690 | int closeButtonState, | |
691 | wxRect* outTabRect, | |
692 | wxRect* outButtonRect, | |
693 | int* xExtent); | |
694 | ||
695 | void DrawButton( | |
696 | wxDC& dc, | |
697 | wxWindow* wnd, | |
698 | const wxRect& inRect, | |
699 | int bitmapId, | |
700 | int buttonState, | |
701 | int orientation, | |
702 | wxRect* outRect); | |
703 | ||
704 | int GetIndentSize(); | |
705 | ||
706 | wxSize GetTabSize( | |
707 | wxDC& dc, | |
708 | wxWindow* wnd, | |
709 | const wxString& caption, | |
710 | const wxBitmap& bitmap, | |
711 | bool active, | |
712 | int closeButtonState, | |
713 | int* xExtent); | |
714 | ||
715 | int ShowDropDown( | |
716 | wxWindow* wnd, | |
717 | const wxAuiNotebookPageArray& items, | |
718 | int activeIdx); | |
719 | ||
720 | int GetBestTabCtrlSize(wxWindow* wnd, | |
721 | const wxAuiNotebookPageArray& pages, | |
722 | const wxSize& requiredBmpSize); | |
723 | ||
724 | protected: | |
725 | /** | |
726 | The font used for all tabs | |
727 | */ | |
728 | wxFont m_normalFont; | |
729 | wxFont m_selectedFont; /// The font used on the selected tab | |
730 | wxFont m_measuringFont; | |
731 | wxColour m_baseColour; | |
732 | wxPen m_baseColourPen; | |
733 | wxPen m_borderPen; | |
734 | wxBrush m_baseColourBrush; | |
735 | wxColour m_activeColour; | |
736 | wxBitmap m_activeCloseBmp; | |
737 | wxBitmap m_disabledCloseBmp; | |
738 | wxBitmap m_activeLeftBmp; | |
739 | wxBitmap m_disabledLeftBmp; | |
740 | wxBitmap m_activeRightBmp; | |
741 | wxBitmap m_disabledRightBmp; | |
742 | wxBitmap m_activeWindowListBmp; | |
743 | wxBitmap m_disabledWindowListBmp; | |
744 | ||
745 | int m_fixedTabWidth; | |
746 | int m_tabCtrlHeight; | |
747 | unsigned int m_flags; | |
748 | }; | |
749 | ||
750 | ||
751 | /** | |
752 | @class wxAuiSimpleTabArt | |
753 | ||
754 | Another standard tab art provider for wxAuiNotebook. | |
755 | ||
756 | wxAuiSimpleTabArt is derived from wxAuiTabArt demonstrating how to write a | |
757 | completely new tab art class. It can also be used as alternative to | |
758 | wxAuiDefaultTabArt. | |
759 | ||
760 | @genericAppearance{auisimpletabart.png} | |
761 | ||
762 | @library{wxaui} | |
763 | @category{aui} | |
764 | */ | |
765 | ||
766 | class wxAuiSimpleTabArt : public wxAuiTabArt | |
767 | { | |
768 | ||
769 | public: | |
770 | ||
771 | wxAuiSimpleTabArt(); | |
772 | virtual ~wxAuiSimpleTabArt(); | |
773 | ||
774 | wxAuiTabArt* Clone(); | |
775 | void SetFlags(unsigned int flags); | |
776 | ||
777 | void SetSizingInfo(const wxSize& tabCtrlSize, | |
778 | size_t tabCount); | |
779 | ||
780 | void SetNormalFont(const wxFont& font); | |
781 | void SetSelectedFont(const wxFont& font); | |
782 | void SetMeasuringFont(const wxFont& font); | |
783 | void SetColour(const wxColour& colour); | |
784 | void SetActiveColour(const wxColour& colour); | |
785 | ||
786 | void DrawBackground( | |
787 | wxDC& dc, | |
788 | wxWindow* wnd, | |
789 | const wxRect& rect); | |
790 | ||
791 | void DrawTab(wxDC& dc, | |
792 | wxWindow* wnd, | |
793 | const wxAuiNotebookPage& pane, | |
794 | const wxRect& inRect, | |
795 | int closeButtonState, | |
796 | wxRect* outTabRect, | |
797 | wxRect* outButtonRect, | |
798 | int* xExtent); | |
799 | ||
800 | void DrawButton( | |
801 | wxDC& dc, | |
802 | wxWindow* wnd, | |
803 | const wxRect& inRect, | |
804 | int bitmapId, | |
805 | int buttonState, | |
806 | int orientation, | |
807 | wxRect* outRect); | |
808 | ||
809 | int GetIndentSize(); | |
810 | ||
811 | wxSize GetTabSize( | |
812 | wxDC& dc, | |
813 | wxWindow* wnd, | |
814 | const wxString& caption, | |
815 | const wxBitmap& bitmap, | |
816 | bool active, | |
817 | int closeButtonState, | |
818 | int* xExtent); | |
819 | ||
820 | int ShowDropDown( | |
821 | wxWindow* wnd, | |
822 | const wxAuiNotebookPageArray& items, | |
823 | int activeIdx); | |
824 | ||
825 | int GetBestTabCtrlSize(wxWindow* wnd, | |
826 | const wxAuiNotebookPageArray& pages, | |
827 | const wxSize& requiredBmpSize); | |
828 | ||
829 | protected: | |
830 | ||
831 | wxFont m_normalFont; | |
832 | wxFont m_selectedFont; | |
833 | wxFont m_measuringFont; | |
834 | wxPen m_normalBkPen; | |
835 | wxPen m_selectedBkPen; | |
836 | wxBrush m_normalBkBrush; | |
837 | wxBrush m_selectedBkBrush; | |
838 | wxBrush m_bkBrush; | |
839 | wxBitmap m_activeCloseBmp; | |
840 | wxBitmap m_disabledCloseBmp; | |
841 | wxBitmap m_activeLeftBmp; | |
842 | wxBitmap m_disabledLeftBmp; | |
843 | wxBitmap m_activeRightBmp; | |
844 | wxBitmap m_disabledRightBmp; | |
845 | wxBitmap m_activeWindowListBmp; | |
846 | wxBitmap m_disabledWindowListBmp; | |
847 | ||
848 | int m_fixedTabWidth; | |
849 | unsigned int m_flags; | |
850 | }; |