]> git.saurik.com Git - wxWidgets.git/blame - include/wx/aui/auibook.h
Add forward declarations to fix wx/propgrid/editors.h compilation.
[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:
9a29fe70
VZ
66 wxAuiNotebookEvent(wxEventType commandType = wxEVT_NULL,
67 int winId = 0)
68 : wxBookCtrlEvent(commandType, winId)
2b9aac33 69 {
9a29fe70 70 m_dragSource = NULL;
2b9aac33
BW
71 }
72#ifndef SWIG
873ff54b 73 wxAuiNotebookEvent(const wxAuiNotebookEvent& c) : wxBookCtrlEvent(c)
2b9aac33 74 {
9a29fe70 75 m_dragSource = c.m_dragSource;
2b9aac33
BW
76 }
77#endif
78 wxEvent *Clone() const { return new wxAuiNotebookEvent(*this); }
79
9a29fe70
VZ
80 void SetDragSource(wxAuiNotebook* s) { m_dragSource = s; }
81 wxAuiNotebook* GetDragSource() const { return m_dragSource; }
2b9aac33 82
9a29fe70
VZ
83private:
84 wxAuiNotebook* m_dragSource;
2b9aac33
BW
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
9a29fe70 108 int curState; // current state (normal, hover, pressed, etc.)
2b9aac33
BW
109 int location; // buttons location (wxLEFT, wxRIGHT, or wxCENTER)
110 wxBitmap bitmap; // button's hover bitmap
9a29fe70 111 wxBitmap disBitmap; // button's disabled bitmap
2b9aac33
BW
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
9a29fe70
VZ
134 virtual void SetSizingInfo(const wxSize& tabCtrlSize,
135 size_t tabCount) = 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,
9a29fe70
VZ
151 const wxRect& inRect,
152 int closeButtonState,
153 wxRect* outTabRect,
154 wxRect* outButtonRect,
155 int* xExtent) = 0;
a56a1234 156
4953f8cf 157 virtual void DrawButton(
a6b0e5bd 158 wxDC& dc,
01372b8f 159 wxWindow* wnd,
9a29fe70
VZ
160 const wxRect& inRect,
161 int bitmapId,
162 int buttonState,
4953f8cf 163 int orientation,
9a29fe70 164 wxRect* outRect) = 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,
9a29fe70
VZ
172 int closeButtonState,
173 int* xExtent) = 0;
a56a1234 174
793d4365 175 virtual int ShowDropDown(
a6b0e5bd 176 wxWindow* wnd,
793d4365 177 const wxAuiNotebookPageArray& items,
9a29fe70 178 int activeIdx) = 0;
a56a1234 179
793d4365 180 virtual int GetIndentSize() = 0;
a56a1234 181
793d4365
BW
182 virtual int GetBestTabCtrlSize(
183 wxWindow* wnd,
184 const wxAuiNotebookPageArray& pages,
9a29fe70 185 const wxSize& requiredBmpSize) = 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);
9a29fe70
VZ
199 void SetSizingInfo(const wxSize& tabCtrlSize,
200 size_t tabCount);
b0d17f7c
BW
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,
9a29fe70
VZ
216 const wxRect& inRect,
217 int closeButtonState,
218 wxRect* outTabRect,
219 wxRect* outButtonRect,
220 int* xExtent);
a56a1234 221
b0d17f7c
BW
222 void DrawButton(
223 wxDC& dc,
224 wxWindow* wnd,
9a29fe70
VZ
225 const wxRect& inRect,
226 int bitmapId,
227 int buttonState,
b0d17f7c 228 int orientation,
9a29fe70 229 wxRect* outRect);
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 238 bool active,
9a29fe70
VZ
239 int closeButtonState,
240 int* xExtent);
a56a1234 241
793d4365 242 int ShowDropDown(
b0d17f7c 243 wxWindow* wnd,
793d4365 244 const wxAuiNotebookPageArray& items,
9a29fe70 245 int activeIdx);
b0d17f7c 246
2b9aac33 247 int GetBestTabCtrlSize(wxWindow* wnd,
793d4365 248 const wxAuiNotebookPageArray& pages,
9a29fe70 249 const wxSize& requiredBmpSize);
b0d17f7c 250
760d3542 251protected:
b0d17f7c 252
9a29fe70
VZ
253 wxFont m_normalFont;
254 wxFont m_selectedFont;
255 wxFont m_measuringFont;
256 wxColour m_baseColour;
257 wxPen m_baseColourPen;
258 wxPen m_borderPen;
259 wxBrush m_baseColourBrush;
260 wxColour m_activeColour;
261 wxBitmap m_activeCloseBmp;
262 wxBitmap m_disabledCloseBmp;
263 wxBitmap m_activeLeftBmp;
264 wxBitmap m_disabledLeftBmp;
265 wxBitmap m_activeRightBmp;
266 wxBitmap m_disabledRightBmp;
267 wxBitmap m_activeWindowListBmp;
268 wxBitmap m_disabledWindowListBmp;
269
270 int m_fixedTabWidth;
271 int m_tabCtrlHeight;
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
9a29fe70
VZ
287 void SetSizingInfo(const wxSize& tabCtrlSize,
288 size_t tabCount);
b0d17f7c 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,
9a29fe70
VZ
304 const wxRect& inRect,
305 int closeButtonState,
306 wxRect* outTabRect,
307 wxRect* outButtonRect,
308 int* xExtent);
a56a1234 309
4953f8cf 310 void DrawButton(
a6b0e5bd 311 wxDC& dc,
01372b8f 312 wxWindow* wnd,
9a29fe70
VZ
313 const wxRect& inRect,
314 int bitmapId,
315 int buttonState,
4953f8cf 316 int orientation,
9a29fe70 317 wxRect* outRect);
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,
9a29fe70
VZ
327 int closeButtonState,
328 int* xExtent);
a56a1234 329
793d4365 330 int ShowDropDown(
a6b0e5bd 331 wxWindow* wnd,
793d4365 332 const wxAuiNotebookPageArray& items,
9a29fe70 333 int activeIdx);
a6b0e5bd 334
2b9aac33 335 int GetBestTabCtrlSize(wxWindow* wnd,
793d4365 336 const wxAuiNotebookPageArray& pages,
9a29fe70 337 const wxSize& requiredBmpSize);
a4c8fc23 338
760d3542 339protected:
3f69756e 340
9a29fe70
VZ
341 wxFont m_normalFont;
342 wxFont m_selectedFont;
343 wxFont m_measuringFont;
344 wxPen m_normalBkPen;
345 wxPen m_selectedBkPen;
346 wxBrush m_normalBkBrush;
347 wxBrush m_selectedBkBrush;
348 wxBrush m_bkBrush;
349 wxBitmap m_activeCloseBmp;
350 wxBitmap m_disabledCloseBmp;
351 wxBitmap m_activeLeftBmp;
352 wxBitmap m_disabledLeftBmp;
353 wxBitmap m_activeRightBmp;
354 wxBitmap m_disabledRightBmp;
355 wxBitmap m_activeWindowListBmp;
356 wxBitmap m_disabledWindowListBmp;
357
358 int m_fixedTabWidth;
b0d17f7c 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);
9a29fe70 385 bool MovePage(wxWindow* page, size_t newIdx);
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 398 wxAuiNotebookPageArray& GetPages();
9a29fe70
VZ
399 void SetNormalFont(const wxFont& normalFont);
400 void SetSelectedFont(const wxFont& selectedFont);
401 void SetMeasuringFont(const wxFont& measuringFont);
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,
9a29fe70
VZ
410 const wxBitmap& normalBitmap = wxNullBitmap,
411 const wxBitmap& disabledBitmap = 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;
9a29fe70 431 wxAuiTabContainerButtonArray m_tabCloseButtons;
a3219eea 432 wxRect m_rect;
9a29fe70 433 size_t m_tabOffset;
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
9a29fe70 452 bool IsDragging() const { return m_isDragging; }
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
9a29fe70
VZ
478 wxPoint m_clickPt;
479 wxWindow* m_clickTab;
480 bool m_isDragging;
481 wxAuiTabContainerButton* m_hoverButton;
482 wxAuiTabContainerButton* m_pressedButton;
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
9a29fe70 530 bool InsertPage(size_t pageIdx,
a3219eea
BW
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 539 size_t GetPageCount() const;
9a29fe70
VZ
540 wxWindow* GetPage(size_t pageIdx) const;
541 int GetPageIndex(wxWindow* pageWnd) const;
4444d148 542
a3219eea 543 bool SetPageText(size_t page, const wxString& text);
9a29fe70 544 wxString GetPageText(size_t pageIdx) const;
c3e016e4 545
e0dc13d4 546 bool SetPageBitmap(size_t page, const wxBitmap& bitmap);
9a29fe70 547 wxBitmap GetPageBitmap(size_t pageIdx) const;
c3e016e4 548
9a29fe70 549 int SetSelection(size_t newPage);
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,
3b7e7e24 605 bool select, int imageId);
873ff54b 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 633 wxAuiTabCtrl* GetTabCtrlFromPoint(const wxPoint& pt);
9a29fe70 634 wxWindow* GetTabFrameFromTabCtrl(wxWindow* tabCtrl);
a3219eea
BW
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 669 wxAuiTabContainer m_tabs;
9a29fe70
VZ
670 int m_curPage;
671 int m_tabIdCounter;
672 wxWindow* m_dummyWnd;
4444d148 673
9a29fe70
VZ
674 wxSize m_requestedBmpSize;
675 int m_requestedTabCtrlHeight;
676 wxFont m_selectedFont;
677 wxFont m_normalFont;
678 int m_tabCtrlHeight;
a56a1234 679
9a29fe70 680 int m_lastDragX;
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_