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