]> git.saurik.com Git - wxWidgets.git/blame - include/wx/aui/auibook.h
Add wx/datetimectrl.h to the wxAdv files list.
[wxWidgets.git] / include / wx / aui / auibook.h
CommitLineData
c7bfb76a 1//////////////////////////////////////////////////////////////////////////////
4444d148 2// Name: wx/aui/auibook.h
a3219eea
BW
3// Purpose: wxaui: wx advanced user interface - notebook
4// Author: Benjamin I. Williams
5// Modified by:
6// Created: 2006-06-28
7// Copyright: (C) Copyright 2006, Kirix Corporation, All Rights Reserved.
8// Licence: wxWindows Library Licence, Version 3.1
9///////////////////////////////////////////////////////////////////////////////
10
11
12
13#ifndef _WX_AUINOTEBOOK_H_
14#define _WX_AUINOTEBOOK_H_
15
16// ----------------------------------------------------------------------------
17// headers
18// ----------------------------------------------------------------------------
19
20#include "wx/defs.h"
a3219eea
BW
21
22#if wxUSE_AUI
23
4444d148
WS
24#include "wx/aui/framemanager.h"
25#include "wx/aui/dockart.h"
26#include "wx/aui/floatpane.h"
873ff54b 27#include "wx/bookctrl.h"
a3219eea
BW
28
29
5d3aeb0f
BW
30class wxAuiNotebook;
31
702b1c7e
BW
32
33enum wxAuiNotebookOption
34{
35 wxAUI_NB_TOP = 1 << 0,
36 wxAUI_NB_LEFT = 1 << 1, // not implemented yet
37 wxAUI_NB_RIGHT = 1 << 2, // not implemented yet
134198f1 38 wxAUI_NB_BOTTOM = 1 << 3,
702b1c7e
BW
39 wxAUI_NB_TAB_SPLIT = 1 << 4,
40 wxAUI_NB_TAB_MOVE = 1 << 5,
5d3aeb0f 41 wxAUI_NB_TAB_EXTERNAL_MOVE = 1 << 6,
b0d17f7c
BW
42 wxAUI_NB_TAB_FIXED_WIDTH = 1 << 7,
43 wxAUI_NB_SCROLL_BUTTONS = 1 << 8,
44 wxAUI_NB_WINDOWLIST_BUTTON = 1 << 9,
45 wxAUI_NB_CLOSE_BUTTON = 1 << 10,
46 wxAUI_NB_CLOSE_ON_ACTIVE_TAB = 1 << 11,
47 wxAUI_NB_CLOSE_ON_ALL_TABS = 1 << 12,
69f5e420 48 wxAUI_NB_MIDDLE_CLICK_CLOSE = 1 << 13,
a56a1234 49
702b1c7e
BW
50 wxAUI_NB_DEFAULT_STYLE = wxAUI_NB_TOP |
51 wxAUI_NB_TAB_SPLIT |
52 wxAUI_NB_TAB_MOVE |
41b76acd 53 wxAUI_NB_SCROLL_BUTTONS |
69f5e420
BW
54 wxAUI_NB_CLOSE_ON_ACTIVE_TAB |
55 wxAUI_NB_MIDDLE_CLICK_CLOSE
702b1c7e
BW
56};
57
3f69756e
BW
58
59
702b1c7e 60
2b9aac33
BW
61// aui notebook event class
62
873ff54b 63class WXDLLIMPEXP_AUI wxAuiNotebookEvent : public wxBookCtrlEvent
2b9aac33
BW
64{
65public:
66 wxAuiNotebookEvent(wxEventType command_type = wxEVT_NULL,
67 int win_id = 0)
873ff54b 68 : wxBookCtrlEvent(command_type, win_id)
2b9aac33 69 {
2b9aac33
BW
70 drag_source = NULL;
71 }
72#ifndef SWIG
873ff54b 73 wxAuiNotebookEvent(const wxAuiNotebookEvent& c) : wxBookCtrlEvent(c)
2b9aac33 74 {
2b9aac33
BW
75 drag_source = c.drag_source;
76 }
77#endif
78 wxEvent *Clone() const { return new wxAuiNotebookEvent(*this); }
79
2b9aac33
BW
80 void SetDragSource(wxAuiNotebook* s) { drag_source = s; }
81 wxAuiNotebook* GetDragSource() const { return drag_source; }
82
83public:
2b9aac33
BW
84 wxAuiNotebook* drag_source;
85
86#ifndef SWIG
87private:
88 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxAuiNotebookEvent)
89#endif
90};
91
92
93class WXDLLIMPEXP_AUI wxAuiNotebookPage
94{
95public:
96 wxWindow* window; // page's associated window
97 wxString caption; // caption displayed on the tab
98 wxBitmap bitmap; // tab's bitmap
99 wxRect rect; // tab's hit rectangle
100 bool active; // true if the page is currently active
101};
102
103class WXDLLIMPEXP_AUI wxAuiTabContainerButton
104{
105public:
106
107 int id; // button's id
108 int cur_state; // current state (normal, hover, pressed, etc.)
109 int location; // buttons location (wxLEFT, wxRIGHT, or wxCENTER)
110 wxBitmap bitmap; // button's hover bitmap
111 wxBitmap dis_bitmap; // button's disabled bitmap
112 wxRect rect; // button's hit rectangle
113};
114
115
116#ifndef SWIG
117WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiNotebookPage, wxAuiNotebookPageArray, WXDLLIMPEXP_AUI);
118WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiTabContainerButton, wxAuiTabContainerButtonArray, WXDLLIMPEXP_AUI);
119#endif
120
121
702b1c7e
BW
122// tab art class
123
a3a5df9d 124class WXDLLIMPEXP_AUI wxAuiTabArt
3f69756e
BW
125{
126public:
127
a3a5df9d
BW
128 wxAuiTabArt() { }
129 virtual ~wxAuiTabArt() { }
a56a1234 130
b0d17f7c
BW
131 virtual wxAuiTabArt* Clone() = 0;
132 virtual void SetFlags(unsigned int flags) = 0;
133
134 virtual void SetSizingInfo(const wxSize& tab_ctrl_size,
135 size_t tab_count) = 0;
a56a1234 136
a4c8fc23
BW
137 virtual void SetNormalFont(const wxFont& font) = 0;
138 virtual void SetSelectedFont(const wxFont& font) = 0;
139 virtual void SetMeasuringFont(const wxFont& font) = 0;
ceb9b8db
VZ
140 virtual void SetColour(const wxColour& colour) = 0;
141 virtual void SetActiveColour(const wxColour& colour) = 0;
488e50ee 142
3f69756e 143 virtual void DrawBackground(
a6b0e5bd 144 wxDC& dc,
01372b8f 145 wxWindow* wnd,
3f69756e
BW
146 const wxRect& rect) = 0;
147
a6b0e5bd 148 virtual void DrawTab(wxDC& dc,
01372b8f 149 wxWindow* wnd,
793d4365 150 const wxAuiNotebookPage& pane,
3f69756e 151 const wxRect& in_rect,
41b76acd
BW
152 int close_button_state,
153 wxRect* out_tab_rect,
154 wxRect* out_button_rect,
a56a1234
VZ
155 int* x_extent) = 0;
156
4953f8cf 157 virtual void DrawButton(
a6b0e5bd 158 wxDC& dc,
01372b8f 159 wxWindow* wnd,
4953f8cf
BW
160 const wxRect& in_rect,
161 int bitmap_id,
162 int button_state,
163 int orientation,
4953f8cf 164 wxRect* out_rect) = 0;
a56a1234 165
4953f8cf 166 virtual wxSize GetTabSize(
a6b0e5bd 167 wxDC& dc,
01372b8f 168 wxWindow* wnd,
4953f8cf 169 const wxString& caption,
2b9aac33 170 const wxBitmap& bitmap,
4953f8cf 171 bool active,
41b76acd 172 int close_button_state,
4953f8cf 173 int* x_extent) = 0;
a56a1234 174
793d4365 175 virtual int ShowDropDown(
a6b0e5bd 176 wxWindow* wnd,
793d4365 177 const wxAuiNotebookPageArray& items,
a6b0e5bd 178 int active_idx) = 0;
a56a1234 179
793d4365 180 virtual int GetIndentSize() = 0;
a56a1234 181
793d4365
BW
182 virtual int GetBestTabCtrlSize(
183 wxWindow* wnd,
184 const wxAuiNotebookPageArray& pages,
a56a1234 185 const wxSize& required_bmp_size) = 0;
3f69756e
BW
186};
187
188
2b9aac33 189class WXDLLIMPEXP_AUI wxAuiDefaultTabArt : public wxAuiTabArt
b0d17f7c
BW
190{
191
192public:
193
2b9aac33
BW
194 wxAuiDefaultTabArt();
195 virtual ~wxAuiDefaultTabArt();
a56a1234 196
b0d17f7c
BW
197 wxAuiTabArt* Clone();
198 void SetFlags(unsigned int flags);
b0d17f7c
BW
199 void SetSizingInfo(const wxSize& tab_ctrl_size,
200 size_t tab_count);
201
202 void SetNormalFont(const wxFont& font);
203 void SetSelectedFont(const wxFont& font);
204 void SetMeasuringFont(const wxFont& font);
ceb9b8db
VZ
205 void SetColour(const wxColour& colour);
206 void SetActiveColour(const wxColour& colour);
b0d17f7c
BW
207
208 void DrawBackground(
209 wxDC& dc,
210 wxWindow* wnd,
211 const wxRect& rect);
a56a1234 212
b0d17f7c
BW
213 void DrawTab(wxDC& dc,
214 wxWindow* wnd,
793d4365 215 const wxAuiNotebookPage& pane,
b0d17f7c 216 const wxRect& in_rect,
b0d17f7c
BW
217 int close_button_state,
218 wxRect* out_tab_rect,
219 wxRect* out_button_rect,
220 int* x_extent);
a56a1234 221
b0d17f7c
BW
222 void DrawButton(
223 wxDC& dc,
224 wxWindow* wnd,
225 const wxRect& in_rect,
226 int bitmap_id,
227 int button_state,
228 int orientation,
b0d17f7c 229 wxRect* out_rect);
a56a1234 230
2b9aac33 231 int GetIndentSize();
a56a1234 232
b0d17f7c
BW
233 wxSize GetTabSize(
234 wxDC& dc,
235 wxWindow* wnd,
236 const wxString& caption,
2b9aac33 237 const wxBitmap& bitmap,
b0d17f7c
BW
238 bool active,
239 int close_button_state,
240 int* x_extent);
a56a1234 241
793d4365 242 int ShowDropDown(
b0d17f7c 243 wxWindow* wnd,
793d4365 244 const wxAuiNotebookPageArray& items,
b0d17f7c
BW
245 int active_idx);
246
2b9aac33 247 int GetBestTabCtrlSize(wxWindow* wnd,
793d4365 248 const wxAuiNotebookPageArray& pages,
a56a1234 249 const wxSize& required_bmp_size);
b0d17f7c 250
760d3542 251protected:
b0d17f7c
BW
252
253 wxFont m_normal_font;
254 wxFont m_selected_font;
255 wxFont m_measuring_font;
1750e8e2
BW
256 wxColour m_base_colour;
257 wxPen m_base_colour_pen;
003cf4ef 258 wxPen m_border_pen;
1750e8e2 259 wxBrush m_base_colour_brush;
ceb9b8db 260 wxColour m_active_colour;
b0d17f7c
BW
261 wxBitmap m_active_close_bmp;
262 wxBitmap m_disabled_close_bmp;
263 wxBitmap m_active_left_bmp;
264 wxBitmap m_disabled_left_bmp;
265 wxBitmap m_active_right_bmp;
266 wxBitmap m_disabled_right_bmp;
267 wxBitmap m_active_windowlist_bmp;
268 wxBitmap m_disabled_windowlist_bmp;
a56a1234 269
b0d17f7c 270 int m_fixed_tab_width;
2b9aac33 271 int m_tab_ctrl_height;
b0d17f7c
BW
272 unsigned int m_flags;
273};
274
275
2b9aac33 276class WXDLLIMPEXP_AUI wxAuiSimpleTabArt : public wxAuiTabArt
3f69756e
BW
277{
278
279public:
280
2b9aac33
BW
281 wxAuiSimpleTabArt();
282 virtual ~wxAuiSimpleTabArt();
a56a1234 283
b0d17f7c
BW
284 wxAuiTabArt* Clone();
285 void SetFlags(unsigned int flags);
2b9aac33 286
b0d17f7c
BW
287 void SetSizingInfo(const wxSize& tab_ctrl_size,
288 size_t tab_count);
289
a4c8fc23
BW
290 void SetNormalFont(const wxFont& font);
291 void SetSelectedFont(const wxFont& font);
292 void SetMeasuringFont(const wxFont& font);
ceb9b8db
VZ
293 void SetColour(const wxColour& colour);
294 void SetActiveColour(const wxColour& colour);
b0d17f7c 295
3f69756e 296 void DrawBackground(
a6b0e5bd 297 wxDC& dc,
01372b8f 298 wxWindow* wnd,
3f69756e 299 const wxRect& rect);
a56a1234 300
a6b0e5bd 301 void DrawTab(wxDC& dc,
01372b8f 302 wxWindow* wnd,
793d4365 303 const wxAuiNotebookPage& pane,
3f69756e 304 const wxRect& in_rect,
41b76acd
BW
305 int close_button_state,
306 wxRect* out_tab_rect,
307 wxRect* out_button_rect,
3f69756e 308 int* x_extent);
a56a1234 309
4953f8cf 310 void DrawButton(
a6b0e5bd 311 wxDC& dc,
01372b8f 312 wxWindow* wnd,
4953f8cf
BW
313 const wxRect& in_rect,
314 int bitmap_id,
315 int button_state,
316 int orientation,
4953f8cf 317 wxRect* out_rect);
a56a1234 318
b0d17f7c 319 int GetIndentSize();
a56a1234 320
4953f8cf 321 wxSize GetTabSize(
a6b0e5bd 322 wxDC& dc,
01372b8f 323 wxWindow* wnd,
4953f8cf 324 const wxString& caption,
2b9aac33 325 const wxBitmap& bitmap,
4953f8cf 326 bool active,
41b76acd 327 int close_button_state,
4953f8cf 328 int* x_extent);
a56a1234 329
793d4365 330 int ShowDropDown(
a6b0e5bd 331 wxWindow* wnd,
793d4365 332 const wxAuiNotebookPageArray& items,
a6b0e5bd
BW
333 int active_idx);
334
2b9aac33 335 int GetBestTabCtrlSize(wxWindow* wnd,
793d4365 336 const wxAuiNotebookPageArray& pages,
a56a1234 337 const wxSize& required_bmp_size);
a4c8fc23 338
760d3542 339protected:
3f69756e
BW
340
341 wxFont m_normal_font;
342 wxFont m_selected_font;
343 wxFont m_measuring_font;
344 wxPen m_normal_bkpen;
345 wxPen m_selected_bkpen;
346 wxBrush m_normal_bkbrush;
347 wxBrush m_selected_bkbrush;
348 wxBrush m_bkbrush;
4953f8cf
BW
349 wxBitmap m_active_close_bmp;
350 wxBitmap m_disabled_close_bmp;
351 wxBitmap m_active_left_bmp;
352 wxBitmap m_disabled_left_bmp;
353 wxBitmap m_active_right_bmp;
354 wxBitmap m_disabled_right_bmp;
01372b8f
BW
355 wxBitmap m_active_windowlist_bmp;
356 wxBitmap m_disabled_windowlist_bmp;
a56a1234 357
b0d17f7c
BW
358 int m_fixed_tab_width;
359 unsigned int m_flags;
3f69756e
BW
360};
361
362
363
b0d17f7c 364
41b76acd 365
a3219eea
BW
366
367
a3219eea
BW
368
369
370class WXDLLIMPEXP_AUI wxAuiTabContainer
371{
372public:
373
374 wxAuiTabContainer();
9fabaac4 375 virtual ~wxAuiTabContainer();
a3219eea 376
a3a5df9d 377 void SetArtProvider(wxAuiTabArt* art);
e0dc13d4 378 wxAuiTabArt* GetArtProvider() const;
3f69756e 379
702b1c7e
BW
380 void SetFlags(unsigned int flags);
381 unsigned int GetFlags() const;
382
a3219eea
BW
383 bool AddPage(wxWindow* page, const wxAuiNotebookPage& info);
384 bool InsertPage(wxWindow* page, const wxAuiNotebookPage& info, size_t idx);
2fadbbfd 385 bool MovePage(wxWindow* page, size_t new_idx);
a3219eea
BW
386 bool RemovePage(wxWindow* page);
387 bool SetActivePage(wxWindow* page);
388 bool SetActivePage(size_t page);
389 void SetNoneActive();
390 int GetActivePage() const;
391 bool TabHitTest(int x, int y, wxWindow** hit) const;
392 bool ButtonHitTest(int x, int y, wxAuiTabContainerButton** hit) const;
393 wxWindow* GetWindowFromIdx(size_t idx) const;
394 int GetIdxFromWindow(wxWindow* page) const;
395 size_t GetPageCount() const;
396 wxAuiNotebookPage& GetPage(size_t idx);
c3e016e4 397 const wxAuiNotebookPage& GetPage(size_t idx) const;
a3219eea
BW
398 wxAuiNotebookPageArray& GetPages();
399 void SetNormalFont(const wxFont& normal_font);
400 void SetSelectedFont(const wxFont& selected_font);
401 void SetMeasuringFont(const wxFont& measuring_font);
ceb9b8db
VZ
402 void SetColour(const wxColour& colour);
403 void SetActiveColour(const wxColour& colour);
a3219eea
BW
404 void DoShowHide();
405 void SetRect(const wxRect& rect);
a56a1234 406
41b76acd 407 void RemoveButton(int id);
4953f8cf
BW
408 void AddButton(int id,
409 int location,
410 const wxBitmap& normal_bitmap = wxNullBitmap,
411 const wxBitmap& disabled_bitmap = wxNullBitmap);
4444d148 412
4953f8cf
BW
413 size_t GetTabOffset() const;
414 void SetTabOffset(size_t offset);
a56a1234 415
a0c2e4a0
JS
416 // Is the tab visible?
417 bool IsTabVisible(int tabPage, int tabOffset, wxDC* dc, wxWindow* wnd);
418
419 // Make the tab visible if it wasn't already
420 void MakeTabVisible(int tabPage, wxWindow* win);
421
a3219eea
BW
422protected:
423
01372b8f 424 virtual void Render(wxDC* dc, wxWindow* wnd);
a3219eea 425
01372b8f 426protected:
a3219eea 427
a3a5df9d 428 wxAuiTabArt* m_art;
a3219eea
BW
429 wxAuiNotebookPageArray m_pages;
430 wxAuiTabContainerButtonArray m_buttons;
41b76acd 431 wxAuiTabContainerButtonArray m_tab_close_buttons;
a3219eea 432 wxRect m_rect;
4953f8cf 433 size_t m_tab_offset;
702b1c7e 434 unsigned int m_flags;
a3219eea
BW
435};
436
437
438
439class WXDLLIMPEXP_AUI wxAuiTabCtrl : public wxControl,
440 public wxAuiTabContainer
441{
442public:
443
444 wxAuiTabCtrl(wxWindow* parent,
d91fa282 445 wxWindowID id = wxID_ANY,
a3219eea
BW
446 const wxPoint& pos = wxDefaultPosition,
447 const wxSize& size = wxDefaultSize,
448 long style = 0);
4444d148 449
26da5e4f 450 ~wxAuiTabCtrl();
a56a1234 451
d16619f8 452 bool IsDragging() const { return m_is_dragging; }
d16619f8 453
a3219eea 454protected:
dc797d8e
JS
455 // choose the default border for this window
456 virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
a3219eea
BW
457
458 void OnPaint(wxPaintEvent& evt);
459 void OnEraseBackground(wxEraseEvent& evt);
460 void OnSize(wxSizeEvent& evt);
461 void OnLeftDown(wxMouseEvent& evt);
134198f1 462 void OnLeftDClick(wxMouseEvent& evt);
a3219eea 463 void OnLeftUp(wxMouseEvent& evt);
69f5e420
BW
464 void OnMiddleDown(wxMouseEvent& evt);
465 void OnMiddleUp(wxMouseEvent& evt);
466 void OnRightDown(wxMouseEvent& evt);
467 void OnRightUp(wxMouseEvent& evt);
a3219eea
BW
468 void OnMotion(wxMouseEvent& evt);
469 void OnLeaveWindow(wxMouseEvent& evt);
4953f8cf 470 void OnButton(wxAuiNotebookEvent& evt);
a0c2e4a0
JS
471 void OnSetFocus(wxFocusEvent& event);
472 void OnKillFocus(wxFocusEvent& event);
473 void OnChar(wxKeyEvent& event);
45ca0e77 474 void OnCaptureLost(wxMouseCaptureLostEvent& evt);
a56a1234 475
a3219eea 476protected:
4444d148 477
a3219eea 478 wxPoint m_click_pt;
08c068a4 479 wxWindow* m_click_tab;
a3219eea
BW
480 bool m_is_dragging;
481 wxAuiTabContainerButton* m_hover_button;
9b3f654a 482 wxAuiTabContainerButton* m_pressed_button;
a3219eea 483
d91fa282 484#ifndef SWIG
5d3aeb0f 485 DECLARE_CLASS(wxAuiTabCtrl)
a3219eea 486 DECLARE_EVENT_TABLE()
d91fa282 487#endif
a3219eea
BW
488};
489
490
491
492
873ff54b 493class WXDLLIMPEXP_AUI wxAuiNotebook : public wxNavigationEnabled<wxBookCtrlBase>
a3219eea
BW
494{
495
496public:
497
90230407 498 wxAuiNotebook() { Init(); }
4444d148 499
a3a5df9d 500 wxAuiNotebook(wxWindow* parent,
0ce53f32
BW
501 wxWindowID id = wxID_ANY,
502 const wxPoint& pos = wxDefaultPosition,
503 const wxSize& size = wxDefaultSize,
90230407
VZ
504 long style = wxAUI_NB_DEFAULT_STYLE)
505 {
506 Init();
507 Create(parent, id, pos, size, style);
508 }
4444d148 509
a3a5df9d 510 virtual ~wxAuiNotebook();
a3219eea
BW
511
512 bool Create(wxWindow* parent,
d91fa282 513 wxWindowID id = wxID_ANY,
a3219eea
BW
514 const wxPoint& pos = wxDefaultPosition,
515 const wxSize& size = wxDefaultSize,
4444d148 516 long style = 0);
a56a1234 517
d606b6e9
BW
518 void SetWindowStyleFlag(long style);
519 void SetArtProvider(wxAuiTabArt* art);
520 wxAuiTabArt* GetArtProvider() const;
a56a1234 521
d606b6e9
BW
522 virtual void SetUniformBitmapSize(const wxSize& size);
523 virtual void SetTabCtrlHeight(int height);
a56a1234 524
a3219eea
BW
525 bool AddPage(wxWindow* page,
526 const wxString& caption,
527 bool select = false,
528 const wxBitmap& bitmap = wxNullBitmap);
4444d148 529
a3219eea
BW
530 bool InsertPage(size_t page_idx,
531 wxWindow* page,
532 const wxString& caption,
533 bool select = false,
534 const wxBitmap& bitmap = wxNullBitmap);
4444d148 535
a3219eea
BW
536 bool DeletePage(size_t page);
537 bool RemovePage(size_t page);
a56a1234 538
d606b6e9
BW
539 size_t GetPageCount() const;
540 wxWindow* GetPage(size_t page_idx) const;
541 int GetPageIndex(wxWindow* page_wnd) const;
4444d148 542
a3219eea 543 bool SetPageText(size_t page, const wxString& text);
c3e016e4
JS
544 wxString GetPageText(size_t page_idx) const;
545
e0dc13d4 546 bool SetPageBitmap(size_t page, const wxBitmap& bitmap);
c3e016e4
JS
547 wxBitmap GetPageBitmap(size_t page_idx) const;
548
873ff54b 549 int SetSelection(size_t new_page);
a3219eea 550 int GetSelection() const;
c3e016e4 551
d606b6e9 552 virtual void Split(size_t page, int direction);
0eaf8cd1 553
0eaf8cd1 554 const wxAuiManager& GetAuiManager() const { return m_mgr; }
0eaf8cd1 555
98d9f577
JS
556 // Sets the normal font
557 void SetNormalFont(const wxFont& font);
fc17828a 558
98d9f577
JS
559 // Sets the selected tab font
560 void SetSelectedFont(const wxFont& font);
fc17828a 561
98d9f577
JS
562 // Sets the measuring font
563 void SetMeasuringFont(const wxFont& font);
fc17828a 564
98d9f577 565 // Sets the tab font
fc17828a
JS
566 virtual bool SetFont(const wxFont& font);
567
98d9f577 568 // Gets the tab control height
fc17828a
JS
569 int GetTabCtrlHeight() const;
570
571 // Gets the height of the notebook for a given page height
572 int GetHeightForPageHeight(int pageHeight);
573
a0c2e4a0
JS
574 // Advances the selection, generation page selection events
575 void AdvanceSelection(bool forward = true);
576
577 // Shows the window menu
578 bool ShowWindowMenu();
579
580 // we do have multiple pages
581 virtual bool HasMultiplePages() const { return true; }
582
583 // we don't want focus for ourselves
c7bfb76a 584 // virtual bool AcceptsFocus() const { return false; }
a0c2e4a0 585
64178c36
JS
586 // Redo sizing after thawing
587 virtual void Thaw();
588
873ff54b
SL
589 //wxBookCtrlBase functions
590
591 virtual void SetPageSize (const wxSize &size);
592 virtual int HitTest (const wxPoint &pt, long *flags=NULL) const;
593
594 virtual int GetPageImage(size_t n) const;
595 virtual bool SetPageImage(size_t n, int imageId);
596
597 wxWindow* GetCurrentPage () const;
598
599 virtual int ChangeSelection(size_t n);
600
601 virtual bool AddPage(wxWindow *page, const wxString &text, bool select,
602 int imageId);
603 virtual bool DeleteAllPages();
604 virtual bool InsertPage(size_t index, wxWindow *page, const wxString &text,
605 bool select=false, int imageId=NO_IMAGE);
606
a3219eea 607protected:
90230407
VZ
608 // Common part of all ctors.
609 void Init();
610
dc797d8e
JS
611 // choose the default border for this window
612 virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
4444d148 613
2b9aac33 614 // these can be overridden
4026f044
VZ
615
616 // update the height, return true if it was done or false if the new height
617 // calculated by CalculateTabCtrlHeight() is the same as the old one
618 virtual bool UpdateTabCtrlHeight();
619
2b9aac33 620 virtual int CalculateTabCtrlHeight();
9fbb7d80 621 virtual wxSize CalculateNewSplitSize();
a56a1234 622
873ff54b
SL
623 // remove the page and return a pointer to it
624 virtual wxWindow *DoRemovePage(size_t WXUNUSED(page)) { return NULL; }
625
626 //A general selection function
627 virtual int DoModifySelection(size_t n, bool events);
628
2b9aac33
BW
629protected:
630
631 void DoSizing();
632 void InitNotebook(long style);
a3219eea
BW
633 wxAuiTabCtrl* GetTabCtrlFromPoint(const wxPoint& pt);
634 wxWindow* GetTabFrameFromTabCtrl(wxWindow* tab_ctrl);
635 wxAuiTabCtrl* GetActiveTabCtrl();
636 bool FindTab(wxWindow* page, wxAuiTabCtrl** ctrl, int* idx);
637 void RemoveEmptyTabFrames();
9fbb7d80 638 void UpdateHintWindowSize();
a56a1234 639
a3219eea
BW
640protected:
641
5bf3f27f 642 void OnChildFocusNotebook(wxChildFocusEvent& evt);
a3a5df9d 643 void OnRender(wxAuiManagerEvent& evt);
a3219eea 644 void OnSize(wxSizeEvent& evt);
3c778901
VZ
645 void OnTabClicked(wxAuiNotebookEvent& evt);
646 void OnTabBeginDrag(wxAuiNotebookEvent& evt);
647 void OnTabDragMotion(wxAuiNotebookEvent& evt);
648 void OnTabEndDrag(wxAuiNotebookEvent& evt);
2bd82d72 649 void OnTabCancelDrag(wxAuiNotebookEvent& evt);
3c778901
VZ
650 void OnTabButton(wxAuiNotebookEvent& evt);
651 void OnTabMiddleDown(wxAuiNotebookEvent& evt);
652 void OnTabMiddleUp(wxAuiNotebookEvent& evt);
653 void OnTabRightDown(wxAuiNotebookEvent& evt);
654 void OnTabRightUp(wxAuiNotebookEvent& evt);
655 void OnTabBgDClick(wxAuiNotebookEvent& evt);
5bf3f27f 656 void OnNavigationKeyNotebook(wxNavigationKeyEvent& event);
a56a1234 657
849c353a
VZ
658 // set selection to the given window (which must be non-NULL and be one of
659 // our pages, otherwise an assert is raised)
660 void SetSelectionToWindow(wxWindow *win);
661 void SetSelectionToPage(const wxAuiNotebookPage& page)
662 {
663 SetSelectionToWindow(page.window);
664 }
665
a3219eea
BW
666protected:
667
a3a5df9d 668 wxAuiManager m_mgr;
a3219eea
BW
669 wxAuiTabContainer m_tabs;
670 int m_curpage;
671 int m_tab_id_counter;
672 wxWindow* m_dummy_wnd;
4444d148 673
9fbb7d80 674 wxSize m_requested_bmp_size;
ca0d4407 675 int m_requested_tabctrl_height;
a3219eea
BW
676 wxFont m_selected_font;
677 wxFont m_normal_font;
da5e85d9 678 int m_tab_ctrl_height;
a56a1234 679
08c068a4 680 int m_last_drag_x;
702b1c7e 681 unsigned int m_flags;
4444d148 682
d91fa282 683#ifndef SWIG
0ce53f32 684 DECLARE_CLASS(wxAuiNotebook)
a3219eea 685 DECLARE_EVENT_TABLE()
d91fa282 686#endif
a3219eea
BW
687};
688
689
690
691
692// wx event machinery
693
694#ifndef SWIG
695
9b11752c
VZ
696wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE, wxAuiNotebookEvent);
697wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEvent);
698wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING, wxAuiNotebookEvent);
699wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSED, wxAuiNotebookEvent);
700wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_BUTTON, wxAuiNotebookEvent);
701wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_BEGIN_DRAG, wxAuiNotebookEvent);
702wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_END_DRAG, wxAuiNotebookEvent);
703wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_DRAG_MOTION, wxAuiNotebookEvent);
704wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_ALLOW_DND, wxAuiNotebookEvent);
705wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_DOWN, wxAuiNotebookEvent);
706wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_UP, wxAuiNotebookEvent);
707wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_DOWN, wxAuiNotebookEvent);
708wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_UP, wxAuiNotebookEvent);
709wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_DRAG_DONE, wxAuiNotebookEvent);
710wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_BG_DCLICK, wxAuiNotebookEvent);
a3219eea
BW
711
712typedef void (wxEvtHandler::*wxAuiNotebookEventFunction)(wxAuiNotebookEvent&);
713
714#define wxAuiNotebookEventHandler(func) \
3c778901 715 wxEVENT_HANDLER_CAST(wxAuiNotebookEventFunction, func)
a56a1234 716
3fd8c988
BW
717#define EVT_AUINOTEBOOK_PAGE_CLOSE(winid, fn) \
718 wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE, winid, wxAuiNotebookEventHandler(fn))
134198f1
JS
719#define EVT_AUINOTEBOOK_PAGE_CLOSED(winid, fn) \
720 wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSED, winid, wxAuiNotebookEventHandler(fn))
a3219eea
BW
721#define EVT_AUINOTEBOOK_PAGE_CHANGED(winid, fn) \
722 wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, winid, wxAuiNotebookEventHandler(fn))
723#define EVT_AUINOTEBOOK_PAGE_CHANGING(winid, fn) \
724 wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING, winid, wxAuiNotebookEventHandler(fn))
4953f8cf 725#define EVT_AUINOTEBOOK_BUTTON(winid, fn) \
a3219eea
BW
726 wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_BUTTON, winid, wxAuiNotebookEventHandler(fn))
727#define EVT_AUINOTEBOOK_BEGIN_DRAG(winid, fn) \
728 wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_BEGIN_DRAG, winid, wxAuiNotebookEventHandler(fn))
729#define EVT_AUINOTEBOOK_END_DRAG(winid, fn) \
730 wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_END_DRAG, winid, wxAuiNotebookEventHandler(fn))
731#define EVT_AUINOTEBOOK_DRAG_MOTION(winid, fn) \
732 wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_DRAG_MOTION, winid, wxAuiNotebookEventHandler(fn))
5d3aeb0f
BW
733#define EVT_AUINOTEBOOK_ALLOW_DND(winid, fn) \
734 wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_ALLOW_DND, winid, wxAuiNotebookEventHandler(fn))
134198f1
JS
735#define EVT_AUINOTEBOOK_DRAG_DONE(winid, fn) \
736 wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_DRAG_DONE, winid, wxAuiNotebookEventHandler(fn))
69f5e420
BW
737#define EVT_AUINOTEBOOK_TAB_MIDDLE_DOWN(winid, fn) \
738 wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_DOWN, winid, wxAuiNotebookEventHandler(fn))
739#define EVT_AUINOTEBOOK_TAB_MIDDLE_UP(winid, fn) \
740 wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_UP, winid, wxAuiNotebookEventHandler(fn))
741#define EVT_AUINOTEBOOK_TAB_RIGHT_DOWN(winid, fn) \
742 wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_DOWN, winid, wxAuiNotebookEventHandler(fn))
743#define EVT_AUINOTEBOOK_TAB_RIGHT_UP(winid, fn) \
744 wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_UP, winid, wxAuiNotebookEventHandler(fn))
134198f1
JS
745#define EVT_AUINOTEBOOK_BG_DCLICK(winid, fn) \
746 wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_BG_DCLICK, winid, wxAuiNotebookEventHandler(fn))
a3219eea
BW
747#else
748
749// wxpython/swig event work
3fd8c988 750%constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE;
134198f1 751%constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSED;
d91fa282
RD
752%constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED;
753%constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING;
754%constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_BUTTON;
755%constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_BEGIN_DRAG;
756%constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_END_DRAG;
757%constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_DRAG_MOTION;
5d3aeb0f 758%constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_ALLOW_DND;
134198f1 759%constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_DRAG_DONE;
4309ed17
RD
760%constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_DOWN;
761%constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_UP;
762%constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_DOWN;
763%constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_UP;
134198f1 764%constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_BG_DCLICK;
4309ed17 765
d91fa282 766%pythoncode {
3fd8c988 767 EVT_AUINOTEBOOK_PAGE_CLOSE = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE, 1 )
134198f1 768 EVT_AUINOTEBOOK_PAGE_CLOSED = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSED, 1 )
d91fa282
RD
769 EVT_AUINOTEBOOK_PAGE_CHANGED = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, 1 )
770 EVT_AUINOTEBOOK_PAGE_CHANGING = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING, 1 )
771 EVT_AUINOTEBOOK_BUTTON = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_BUTTON, 1 )
772 EVT_AUINOTEBOOK_BEGIN_DRAG = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_BEGIN_DRAG, 1 )
773 EVT_AUINOTEBOOK_END_DRAG = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_END_DRAG, 1 )
4444d148 774 EVT_AUINOTEBOOK_DRAG_MOTION = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_DRAG_MOTION, 1 )
5d3aeb0f 775 EVT_AUINOTEBOOK_ALLOW_DND = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_ALLOW_DND, 1 )
134198f1 776 EVT_AUINOTEBOOK_DRAG_DONE = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_DRAG_DONE, 1 )
4309ed17
RD
777 EVT__AUINOTEBOOK_TAB_MIDDLE_DOWN = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_DOWN, 1 )
778 EVT__AUINOTEBOOK_TAB_MIDDLE_UP = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_UP, 1 )
779 EVT__AUINOTEBOOK_TAB_RIGHT_DOWN = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_DOWN, 1 )
780 EVT__AUINOTEBOOK_TAB_RIGHT_UP = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_UP, 1 )
134198f1 781 EVT_AUINOTEBOOK_BG_DCLICK = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_BG_DCLICK, 1 )
d91fa282 782}
a3219eea
BW
783#endif
784
785
786#endif // wxUSE_AUI
787#endif // _WX_AUINOTEBOOK_H_