]>
Commit | Line | Data |
---|---|---|
a3219eea | 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" | |
4107600f | 27 | #include "wx/control.h" |
a3219eea BW |
28 | |
29 | ||
5d3aeb0f BW |
30 | class wxAuiNotebook; |
31 | ||
702b1c7e BW |
32 | |
33 | enum 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 | |
38 | wxAUI_NB_BOTTOM = 1 << 3, // not implemented yet | |
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, | |
5d3aeb0f | 48 | |
702b1c7e BW |
49 | |
50 | wxAUI_NB_DEFAULT_STYLE = wxAUI_NB_TOP | | |
51 | wxAUI_NB_TAB_SPLIT | | |
52 | wxAUI_NB_TAB_MOVE | | |
41b76acd BW |
53 | wxAUI_NB_SCROLL_BUTTONS | |
54 | wxAUI_NB_CLOSE_ON_ACTIVE_TAB | |
702b1c7e BW |
55 | }; |
56 | ||
3f69756e BW |
57 | |
58 | ||
702b1c7e | 59 | |
2b9aac33 BW |
60 | // aui notebook event class |
61 | ||
62 | class WXDLLIMPEXP_AUI wxAuiNotebookEvent : public wxNotifyEvent | |
63 | { | |
64 | public: | |
65 | wxAuiNotebookEvent(wxEventType command_type = wxEVT_NULL, | |
66 | int win_id = 0) | |
67 | : wxNotifyEvent(command_type, win_id) | |
68 | { | |
69 | old_selection = -1; | |
70 | selection = -1; | |
71 | drag_source = NULL; | |
72 | } | |
73 | #ifndef SWIG | |
74 | wxAuiNotebookEvent(const wxAuiNotebookEvent& c) : wxNotifyEvent(c) | |
75 | { | |
76 | old_selection = c.old_selection; | |
77 | selection = c.selection; | |
78 | drag_source = c.drag_source; | |
79 | } | |
80 | #endif | |
81 | wxEvent *Clone() const { return new wxAuiNotebookEvent(*this); } | |
82 | ||
83 | void SetSelection(int s) { selection = s; m_commandInt = s; } | |
84 | int GetSelection() const { return selection; } | |
85 | ||
86 | void SetOldSelection(int s) { old_selection = s; } | |
87 | int GetOldSelection() const { return old_selection; } | |
88 | ||
89 | void SetDragSource(wxAuiNotebook* s) { drag_source = s; } | |
90 | wxAuiNotebook* GetDragSource() const { return drag_source; } | |
91 | ||
92 | public: | |
93 | int old_selection; | |
94 | int selection; | |
95 | wxAuiNotebook* drag_source; | |
96 | ||
97 | #ifndef SWIG | |
98 | private: | |
99 | DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxAuiNotebookEvent) | |
100 | #endif | |
101 | }; | |
102 | ||
103 | ||
104 | class WXDLLIMPEXP_AUI wxAuiNotebookPage | |
105 | { | |
106 | public: | |
107 | wxWindow* window; // page's associated window | |
108 | wxString caption; // caption displayed on the tab | |
109 | wxBitmap bitmap; // tab's bitmap | |
110 | wxRect rect; // tab's hit rectangle | |
111 | bool active; // true if the page is currently active | |
112 | }; | |
113 | ||
114 | class WXDLLIMPEXP_AUI wxAuiTabContainerButton | |
115 | { | |
116 | public: | |
117 | ||
118 | int id; // button's id | |
119 | int cur_state; // current state (normal, hover, pressed, etc.) | |
120 | int location; // buttons location (wxLEFT, wxRIGHT, or wxCENTER) | |
121 | wxBitmap bitmap; // button's hover bitmap | |
122 | wxBitmap dis_bitmap; // button's disabled bitmap | |
123 | wxRect rect; // button's hit rectangle | |
124 | }; | |
125 | ||
126 | ||
127 | #ifndef SWIG | |
128 | WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiNotebookPage, wxAuiNotebookPageArray, WXDLLIMPEXP_AUI); | |
129 | WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiTabContainerButton, wxAuiTabContainerButtonArray, WXDLLIMPEXP_AUI); | |
130 | #endif | |
131 | ||
132 | ||
702b1c7e BW |
133 | // tab art class |
134 | ||
a3a5df9d | 135 | class WXDLLIMPEXP_AUI wxAuiTabArt |
3f69756e BW |
136 | { |
137 | public: | |
138 | ||
a3a5df9d BW |
139 | wxAuiTabArt() { } |
140 | virtual ~wxAuiTabArt() { } | |
a4c8fc23 | 141 | |
b0d17f7c BW |
142 | virtual wxAuiTabArt* Clone() = 0; |
143 | virtual void SetFlags(unsigned int flags) = 0; | |
144 | ||
145 | virtual void SetSizingInfo(const wxSize& tab_ctrl_size, | |
146 | size_t tab_count) = 0; | |
147 | ||
a4c8fc23 BW |
148 | virtual void SetNormalFont(const wxFont& font) = 0; |
149 | virtual void SetSelectedFont(const wxFont& font) = 0; | |
150 | virtual void SetMeasuringFont(const wxFont& font) = 0; | |
488e50ee | 151 | |
3f69756e | 152 | virtual void DrawBackground( |
a6b0e5bd | 153 | wxDC& dc, |
01372b8f | 154 | wxWindow* wnd, |
3f69756e BW |
155 | const wxRect& rect) = 0; |
156 | ||
a6b0e5bd | 157 | virtual void DrawTab(wxDC& dc, |
01372b8f | 158 | wxWindow* wnd, |
3f69756e BW |
159 | const wxRect& in_rect, |
160 | const wxString& caption, | |
2b9aac33 | 161 | const wxBitmap& bitmap, |
3f69756e | 162 | bool active, |
41b76acd BW |
163 | int close_button_state, |
164 | wxRect* out_tab_rect, | |
165 | wxRect* out_button_rect, | |
3f69756e | 166 | int* x_extent) = 0; |
4953f8cf BW |
167 | |
168 | virtual void DrawButton( | |
a6b0e5bd | 169 | wxDC& dc, |
01372b8f | 170 | wxWindow* wnd, |
4953f8cf BW |
171 | const wxRect& in_rect, |
172 | int bitmap_id, | |
173 | int button_state, | |
174 | int orientation, | |
175 | const wxBitmap& bitmap_override, | |
176 | wxRect* out_rect) = 0; | |
b0d17f7c BW |
177 | |
178 | virtual int GetIndentSize() = 0; | |
179 | ||
4953f8cf | 180 | virtual wxSize GetTabSize( |
a6b0e5bd | 181 | wxDC& dc, |
01372b8f | 182 | wxWindow* wnd, |
4953f8cf | 183 | const wxString& caption, |
2b9aac33 | 184 | const wxBitmap& bitmap, |
4953f8cf | 185 | bool active, |
41b76acd | 186 | int close_button_state, |
4953f8cf | 187 | int* x_extent) = 0; |
a6b0e5bd BW |
188 | |
189 | virtual int ShowWindowList( | |
190 | wxWindow* wnd, | |
191 | const wxArrayString& items, | |
192 | int active_idx) = 0; | |
01372b8f | 193 | |
2b9aac33 | 194 | virtual int GetBestTabCtrlSize(wxWindow* wnd, |
9fbb7d80 BW |
195 | wxAuiNotebookPageArray& pages, |
196 | const wxSize& required_bmp_size) = 0; | |
3f69756e BW |
197 | }; |
198 | ||
199 | ||
2b9aac33 | 200 | class WXDLLIMPEXP_AUI wxAuiDefaultTabArt : public wxAuiTabArt |
b0d17f7c BW |
201 | { |
202 | ||
203 | public: | |
204 | ||
2b9aac33 BW |
205 | wxAuiDefaultTabArt(); |
206 | virtual ~wxAuiDefaultTabArt(); | |
b0d17f7c BW |
207 | |
208 | wxAuiTabArt* Clone(); | |
209 | void SetFlags(unsigned int flags); | |
b0d17f7c BW |
210 | void SetSizingInfo(const wxSize& tab_ctrl_size, |
211 | size_t tab_count); | |
212 | ||
213 | void SetNormalFont(const wxFont& font); | |
214 | void SetSelectedFont(const wxFont& font); | |
215 | void SetMeasuringFont(const wxFont& font); | |
216 | ||
217 | void DrawBackground( | |
218 | wxDC& dc, | |
219 | wxWindow* wnd, | |
220 | const wxRect& rect); | |
2b9aac33 | 221 | |
b0d17f7c BW |
222 | void DrawTab(wxDC& dc, |
223 | wxWindow* wnd, | |
224 | const wxRect& in_rect, | |
225 | const wxString& caption, | |
2b9aac33 | 226 | const wxBitmap& bitmap, |
b0d17f7c BW |
227 | bool active, |
228 | int close_button_state, | |
229 | wxRect* out_tab_rect, | |
230 | wxRect* out_button_rect, | |
231 | int* x_extent); | |
232 | ||
233 | void DrawButton( | |
234 | wxDC& dc, | |
235 | wxWindow* wnd, | |
236 | const wxRect& in_rect, | |
237 | int bitmap_id, | |
238 | int button_state, | |
239 | int orientation, | |
240 | const wxBitmap& bitmap_override, | |
241 | wxRect* out_rect); | |
b0d17f7c | 242 | |
2b9aac33 BW |
243 | int GetIndentSize(); |
244 | ||
b0d17f7c BW |
245 | wxSize GetTabSize( |
246 | wxDC& dc, | |
247 | wxWindow* wnd, | |
248 | const wxString& caption, | |
2b9aac33 | 249 | const wxBitmap& bitmap, |
b0d17f7c BW |
250 | bool active, |
251 | int close_button_state, | |
252 | int* x_extent); | |
253 | ||
254 | int ShowWindowList( | |
255 | wxWindow* wnd, | |
256 | const wxArrayString& items, | |
257 | int active_idx); | |
258 | ||
2b9aac33 | 259 | int GetBestTabCtrlSize(wxWindow* wnd, |
9fbb7d80 BW |
260 | wxAuiNotebookPageArray& pages, |
261 | const wxSize& required_bmp_size); | |
b0d17f7c | 262 | |
760d3542 | 263 | protected: |
b0d17f7c BW |
264 | |
265 | wxFont m_normal_font; | |
266 | wxFont m_selected_font; | |
267 | wxFont m_measuring_font; | |
1750e8e2 BW |
268 | wxColour m_base_colour; |
269 | wxPen m_base_colour_pen; | |
003cf4ef | 270 | wxPen m_border_pen; |
1750e8e2 | 271 | wxBrush m_base_colour_brush; |
b0d17f7c BW |
272 | wxBitmap m_active_close_bmp; |
273 | wxBitmap m_disabled_close_bmp; | |
274 | wxBitmap m_active_left_bmp; | |
275 | wxBitmap m_disabled_left_bmp; | |
276 | wxBitmap m_active_right_bmp; | |
277 | wxBitmap m_disabled_right_bmp; | |
278 | wxBitmap m_active_windowlist_bmp; | |
279 | wxBitmap m_disabled_windowlist_bmp; | |
280 | ||
281 | int m_fixed_tab_width; | |
2b9aac33 | 282 | int m_tab_ctrl_height; |
b0d17f7c BW |
283 | unsigned int m_flags; |
284 | }; | |
285 | ||
286 | ||
2b9aac33 | 287 | class WXDLLIMPEXP_AUI wxAuiSimpleTabArt : public wxAuiTabArt |
3f69756e BW |
288 | { |
289 | ||
290 | public: | |
291 | ||
2b9aac33 BW |
292 | wxAuiSimpleTabArt(); |
293 | virtual ~wxAuiSimpleTabArt(); | |
3f69756e | 294 | |
b0d17f7c BW |
295 | wxAuiTabArt* Clone(); |
296 | void SetFlags(unsigned int flags); | |
2b9aac33 | 297 | |
b0d17f7c BW |
298 | void SetSizingInfo(const wxSize& tab_ctrl_size, |
299 | size_t tab_count); | |
300 | ||
a4c8fc23 BW |
301 | void SetNormalFont(const wxFont& font); |
302 | void SetSelectedFont(const wxFont& font); | |
303 | void SetMeasuringFont(const wxFont& font); | |
b0d17f7c | 304 | |
3f69756e | 305 | void DrawBackground( |
a6b0e5bd | 306 | wxDC& dc, |
01372b8f | 307 | wxWindow* wnd, |
3f69756e | 308 | const wxRect& rect); |
2b9aac33 | 309 | |
a6b0e5bd | 310 | void DrawTab(wxDC& dc, |
01372b8f | 311 | wxWindow* wnd, |
3f69756e BW |
312 | const wxRect& in_rect, |
313 | const wxString& caption, | |
2b9aac33 | 314 | const wxBitmap& bitmap, |
3f69756e | 315 | bool active, |
41b76acd BW |
316 | int close_button_state, |
317 | wxRect* out_tab_rect, | |
318 | wxRect* out_button_rect, | |
3f69756e | 319 | int* x_extent); |
4953f8cf BW |
320 | |
321 | void DrawButton( | |
a6b0e5bd | 322 | wxDC& dc, |
01372b8f | 323 | wxWindow* wnd, |
4953f8cf BW |
324 | const wxRect& in_rect, |
325 | int bitmap_id, | |
326 | int button_state, | |
327 | int orientation, | |
328 | const wxBitmap& bitmap_override, | |
329 | wxRect* out_rect); | |
2b9aac33 | 330 | |
b0d17f7c | 331 | int GetIndentSize(); |
2b9aac33 | 332 | |
4953f8cf | 333 | wxSize GetTabSize( |
a6b0e5bd | 334 | wxDC& dc, |
01372b8f | 335 | wxWindow* wnd, |
4953f8cf | 336 | const wxString& caption, |
2b9aac33 | 337 | const wxBitmap& bitmap, |
4953f8cf | 338 | bool active, |
41b76acd | 339 | int close_button_state, |
4953f8cf | 340 | int* x_extent); |
a6b0e5bd BW |
341 | |
342 | int ShowWindowList( | |
343 | wxWindow* wnd, | |
344 | const wxArrayString& items, | |
345 | int active_idx); | |
346 | ||
2b9aac33 | 347 | int GetBestTabCtrlSize(wxWindow* wnd, |
9fbb7d80 BW |
348 | wxAuiNotebookPageArray& pages, |
349 | const wxSize& required_bmp_size); | |
a4c8fc23 | 350 | |
760d3542 | 351 | protected: |
3f69756e BW |
352 | |
353 | wxFont m_normal_font; | |
354 | wxFont m_selected_font; | |
355 | wxFont m_measuring_font; | |
356 | wxPen m_normal_bkpen; | |
357 | wxPen m_selected_bkpen; | |
358 | wxBrush m_normal_bkbrush; | |
359 | wxBrush m_selected_bkbrush; | |
360 | wxBrush m_bkbrush; | |
4953f8cf BW |
361 | wxBitmap m_active_close_bmp; |
362 | wxBitmap m_disabled_close_bmp; | |
363 | wxBitmap m_active_left_bmp; | |
364 | wxBitmap m_disabled_left_bmp; | |
365 | wxBitmap m_active_right_bmp; | |
366 | wxBitmap m_disabled_right_bmp; | |
01372b8f BW |
367 | wxBitmap m_active_windowlist_bmp; |
368 | wxBitmap m_disabled_windowlist_bmp; | |
b0d17f7c BW |
369 | |
370 | int m_fixed_tab_width; | |
371 | unsigned int m_flags; | |
3f69756e BW |
372 | }; |
373 | ||
374 | ||
375 | ||
b0d17f7c | 376 | |
41b76acd | 377 | |
a3219eea BW |
378 | |
379 | ||
a3219eea BW |
380 | |
381 | ||
382 | class WXDLLIMPEXP_AUI wxAuiTabContainer | |
383 | { | |
384 | public: | |
385 | ||
386 | wxAuiTabContainer(); | |
9fabaac4 | 387 | virtual ~wxAuiTabContainer(); |
a3219eea | 388 | |
a3a5df9d | 389 | void SetArtProvider(wxAuiTabArt* art); |
e0dc13d4 | 390 | wxAuiTabArt* GetArtProvider() const; |
3f69756e | 391 | |
702b1c7e BW |
392 | void SetFlags(unsigned int flags); |
393 | unsigned int GetFlags() const; | |
394 | ||
a3219eea BW |
395 | bool AddPage(wxWindow* page, const wxAuiNotebookPage& info); |
396 | bool InsertPage(wxWindow* page, const wxAuiNotebookPage& info, size_t idx); | |
2fadbbfd | 397 | bool MovePage(wxWindow* page, size_t new_idx); |
a3219eea BW |
398 | bool RemovePage(wxWindow* page); |
399 | bool SetActivePage(wxWindow* page); | |
400 | bool SetActivePage(size_t page); | |
401 | void SetNoneActive(); | |
402 | int GetActivePage() const; | |
403 | bool TabHitTest(int x, int y, wxWindow** hit) const; | |
404 | bool ButtonHitTest(int x, int y, wxAuiTabContainerButton** hit) const; | |
405 | wxWindow* GetWindowFromIdx(size_t idx) const; | |
406 | int GetIdxFromWindow(wxWindow* page) const; | |
407 | size_t GetPageCount() const; | |
408 | wxAuiNotebookPage& GetPage(size_t idx); | |
409 | wxAuiNotebookPageArray& GetPages(); | |
410 | void SetNormalFont(const wxFont& normal_font); | |
411 | void SetSelectedFont(const wxFont& selected_font); | |
412 | void SetMeasuringFont(const wxFont& measuring_font); | |
413 | void DoShowHide(); | |
414 | void SetRect(const wxRect& rect); | |
41b76acd BW |
415 | |
416 | void RemoveButton(int id); | |
4953f8cf BW |
417 | void AddButton(int id, |
418 | int location, | |
419 | const wxBitmap& normal_bitmap = wxNullBitmap, | |
420 | const wxBitmap& disabled_bitmap = wxNullBitmap); | |
4444d148 | 421 | |
4953f8cf BW |
422 | size_t GetTabOffset() const; |
423 | void SetTabOffset(size_t offset); | |
424 | ||
a3219eea BW |
425 | protected: |
426 | ||
01372b8f | 427 | virtual void Render(wxDC* dc, wxWindow* wnd); |
a3219eea | 428 | |
01372b8f | 429 | protected: |
a3219eea | 430 | |
a3a5df9d | 431 | wxAuiTabArt* m_art; |
a3219eea BW |
432 | wxAuiNotebookPageArray m_pages; |
433 | wxAuiTabContainerButtonArray m_buttons; | |
41b76acd | 434 | wxAuiTabContainerButtonArray m_tab_close_buttons; |
a3219eea | 435 | wxRect m_rect; |
4953f8cf | 436 | size_t m_tab_offset; |
702b1c7e | 437 | unsigned int m_flags; |
a3219eea BW |
438 | }; |
439 | ||
440 | ||
441 | ||
442 | class WXDLLIMPEXP_AUI wxAuiTabCtrl : public wxControl, | |
443 | public wxAuiTabContainer | |
444 | { | |
445 | public: | |
446 | ||
447 | wxAuiTabCtrl(wxWindow* parent, | |
d91fa282 | 448 | wxWindowID id = wxID_ANY, |
a3219eea BW |
449 | const wxPoint& pos = wxDefaultPosition, |
450 | const wxSize& size = wxDefaultSize, | |
451 | long style = 0); | |
4444d148 | 452 | |
26da5e4f BW |
453 | ~wxAuiTabCtrl(); |
454 | ||
a3219eea BW |
455 | protected: |
456 | ||
457 | void OnPaint(wxPaintEvent& evt); | |
458 | void OnEraseBackground(wxEraseEvent& evt); | |
459 | void OnSize(wxSizeEvent& evt); | |
460 | void OnLeftDown(wxMouseEvent& evt); | |
461 | void OnLeftUp(wxMouseEvent& evt); | |
462 | void OnMotion(wxMouseEvent& evt); | |
463 | void OnLeaveWindow(wxMouseEvent& evt); | |
4953f8cf | 464 | void OnButton(wxAuiNotebookEvent& evt); |
4444d148 | 465 | |
4953f8cf | 466 | |
a3219eea | 467 | protected: |
4444d148 | 468 | |
a3219eea | 469 | wxPoint m_click_pt; |
08c068a4 | 470 | wxWindow* m_click_tab; |
a3219eea BW |
471 | bool m_is_dragging; |
472 | wxAuiTabContainerButton* m_hover_button; | |
9b3f654a | 473 | wxAuiTabContainerButton* m_pressed_button; |
a3219eea | 474 | |
d91fa282 | 475 | #ifndef SWIG |
5d3aeb0f | 476 | DECLARE_CLASS(wxAuiTabCtrl) |
a3219eea | 477 | DECLARE_EVENT_TABLE() |
d91fa282 | 478 | #endif |
a3219eea BW |
479 | }; |
480 | ||
481 | ||
482 | ||
483 | ||
a3a5df9d | 484 | class WXDLLIMPEXP_AUI wxAuiNotebook : public wxControl |
a3219eea BW |
485 | { |
486 | ||
487 | public: | |
488 | ||
a3a5df9d | 489 | wxAuiNotebook(); |
4444d148 | 490 | |
a3a5df9d | 491 | wxAuiNotebook(wxWindow* parent, |
0ce53f32 BW |
492 | wxWindowID id = wxID_ANY, |
493 | const wxPoint& pos = wxDefaultPosition, | |
494 | const wxSize& size = wxDefaultSize, | |
495 | long style = wxAUI_NB_DEFAULT_STYLE); | |
4444d148 | 496 | |
a3a5df9d | 497 | virtual ~wxAuiNotebook(); |
a3219eea BW |
498 | |
499 | bool Create(wxWindow* parent, | |
d91fa282 | 500 | wxWindowID id = wxID_ANY, |
a3219eea BW |
501 | const wxPoint& pos = wxDefaultPosition, |
502 | const wxSize& size = wxDefaultSize, | |
4444d148 | 503 | long style = 0); |
a3219eea BW |
504 | |
505 | bool AddPage(wxWindow* page, | |
506 | const wxString& caption, | |
507 | bool select = false, | |
508 | const wxBitmap& bitmap = wxNullBitmap); | |
4444d148 | 509 | |
a3219eea BW |
510 | bool InsertPage(size_t page_idx, |
511 | wxWindow* page, | |
512 | const wxString& caption, | |
513 | bool select = false, | |
514 | const wxBitmap& bitmap = wxNullBitmap); | |
4444d148 | 515 | |
a3219eea BW |
516 | bool DeletePage(size_t page); |
517 | bool RemovePage(size_t page); | |
0ce53f32 BW |
518 | |
519 | void SetWindowStyleFlag(long style); | |
4444d148 | 520 | |
a3219eea | 521 | bool SetPageText(size_t page, const wxString& text); |
e0dc13d4 | 522 | bool SetPageBitmap(size_t page, const wxBitmap& bitmap); |
a3219eea BW |
523 | size_t SetSelection(size_t new_page); |
524 | int GetSelection() const; | |
525 | size_t GetPageCount() const; | |
526 | wxWindow* GetPage(size_t page_idx) const; | |
4444d148 | 527 | |
e0dc13d4 BW |
528 | int GetPageIndex(wxWindow* page_wnd) const; |
529 | ||
a3a5df9d | 530 | void SetArtProvider(wxAuiTabArt* art); |
e0dc13d4 | 531 | wxAuiTabArt* GetArtProvider() const; |
9fbb7d80 BW |
532 | |
533 | virtual void SetUniformBitmapSize(const wxSize& size); | |
534 | virtual void SetTabCtrlHeight(int height); | |
ca0d4407 | 535 | |
a3219eea | 536 | protected: |
4444d148 | 537 | |
2b9aac33 | 538 | // these can be overridden |
ca0d4407 | 539 | virtual void UpdateTabCtrlHeight(); |
2b9aac33 | 540 | virtual int CalculateTabCtrlHeight(); |
9fbb7d80 | 541 | virtual wxSize CalculateNewSplitSize(); |
2b9aac33 BW |
542 | |
543 | protected: | |
544 | ||
545 | void DoSizing(); | |
546 | void InitNotebook(long style); | |
a3219eea BW |
547 | wxAuiTabCtrl* GetTabCtrlFromPoint(const wxPoint& pt); |
548 | wxWindow* GetTabFrameFromTabCtrl(wxWindow* tab_ctrl); | |
549 | wxAuiTabCtrl* GetActiveTabCtrl(); | |
550 | bool FindTab(wxWindow* page, wxAuiTabCtrl** ctrl, int* idx); | |
551 | void RemoveEmptyTabFrames(); | |
9fbb7d80 BW |
552 | void UpdateHintWindowSize(); |
553 | ||
a3219eea BW |
554 | protected: |
555 | ||
a3219eea | 556 | void OnChildFocus(wxChildFocusEvent& evt); |
a3a5df9d | 557 | void OnRender(wxAuiManagerEvent& evt); |
a3219eea BW |
558 | void OnEraseBackground(wxEraseEvent& evt); |
559 | void OnSize(wxSizeEvent& evt); | |
560 | void OnTabClicked(wxCommandEvent& evt); | |
561 | void OnTabBeginDrag(wxCommandEvent& evt); | |
562 | void OnTabDragMotion(wxCommandEvent& evt); | |
563 | void OnTabEndDrag(wxCommandEvent& evt); | |
564 | void OnTabButton(wxCommandEvent& evt); | |
4953f8cf | 565 | |
a3219eea BW |
566 | protected: |
567 | ||
a3a5df9d | 568 | wxAuiManager m_mgr; |
a3219eea BW |
569 | wxAuiTabContainer m_tabs; |
570 | int m_curpage; | |
571 | int m_tab_id_counter; | |
572 | wxWindow* m_dummy_wnd; | |
4444d148 | 573 | |
9fbb7d80 | 574 | wxSize m_requested_bmp_size; |
ca0d4407 | 575 | int m_requested_tabctrl_height; |
a3219eea BW |
576 | wxFont m_selected_font; |
577 | wxFont m_normal_font; | |
da5e85d9 | 578 | int m_tab_ctrl_height; |
9fbb7d80 | 579 | |
08c068a4 | 580 | int m_last_drag_x; |
702b1c7e | 581 | unsigned int m_flags; |
4444d148 | 582 | |
d91fa282 | 583 | #ifndef SWIG |
0ce53f32 | 584 | DECLARE_CLASS(wxAuiNotebook) |
a3219eea | 585 | DECLARE_EVENT_TABLE() |
d91fa282 | 586 | #endif |
a3219eea BW |
587 | }; |
588 | ||
589 | ||
590 | ||
591 | ||
592 | // wx event machinery | |
593 | ||
594 | #ifndef SWIG | |
595 | ||
596 | BEGIN_DECLARE_EVENT_TYPES() | |
3fd8c988 | 597 | DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE, 0) |
a3219eea BW |
598 | DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, 0) |
599 | DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING, 0) | |
600 | DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_BUTTON, 0) | |
601 | DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_BEGIN_DRAG, 0) | |
602 | DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_END_DRAG, 0) | |
603 | DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_DRAG_MOTION, 0) | |
5d3aeb0f | 604 | DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_ALLOW_DND, 0) |
a3219eea BW |
605 | END_DECLARE_EVENT_TYPES() |
606 | ||
607 | typedef void (wxEvtHandler::*wxAuiNotebookEventFunction)(wxAuiNotebookEvent&); | |
608 | ||
609 | #define wxAuiNotebookEventHandler(func) \ | |
610 | (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxAuiNotebookEventFunction, &func) | |
3fd8c988 BW |
611 | |
612 | #define EVT_AUINOTEBOOK_PAGE_CLOSE(winid, fn) \ | |
613 | wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE, winid, wxAuiNotebookEventHandler(fn)) | |
a3219eea BW |
614 | #define EVT_AUINOTEBOOK_PAGE_CHANGED(winid, fn) \ |
615 | wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, winid, wxAuiNotebookEventHandler(fn)) | |
616 | #define EVT_AUINOTEBOOK_PAGE_CHANGING(winid, fn) \ | |
617 | wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING, winid, wxAuiNotebookEventHandler(fn)) | |
4953f8cf | 618 | #define EVT_AUINOTEBOOK_BUTTON(winid, fn) \ |
a3219eea BW |
619 | wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_BUTTON, winid, wxAuiNotebookEventHandler(fn)) |
620 | #define EVT_AUINOTEBOOK_BEGIN_DRAG(winid, fn) \ | |
621 | wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_BEGIN_DRAG, winid, wxAuiNotebookEventHandler(fn)) | |
622 | #define EVT_AUINOTEBOOK_END_DRAG(winid, fn) \ | |
623 | wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_END_DRAG, winid, wxAuiNotebookEventHandler(fn)) | |
624 | #define EVT_AUINOTEBOOK_DRAG_MOTION(winid, fn) \ | |
625 | wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_DRAG_MOTION, winid, wxAuiNotebookEventHandler(fn)) | |
5d3aeb0f BW |
626 | #define EVT_AUINOTEBOOK_ALLOW_DND(winid, fn) \ |
627 | wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_ALLOW_DND, winid, wxAuiNotebookEventHandler(fn)) | |
4444d148 | 628 | |
a3219eea BW |
629 | #else |
630 | ||
631 | // wxpython/swig event work | |
3fd8c988 | 632 | %constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE; |
d91fa282 RD |
633 | %constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED; |
634 | %constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING; | |
635 | %constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_BUTTON; | |
636 | %constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_BEGIN_DRAG; | |
637 | %constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_END_DRAG; | |
638 | %constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_DRAG_MOTION; | |
5d3aeb0f | 639 | %constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_ALLOW_DND; |
d91fa282 RD |
640 | |
641 | %pythoncode { | |
3fd8c988 | 642 | EVT_AUINOTEBOOK_PAGE_CLOSE = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE, 1 ) |
d91fa282 RD |
643 | EVT_AUINOTEBOOK_PAGE_CHANGED = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, 1 ) |
644 | EVT_AUINOTEBOOK_PAGE_CHANGING = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING, 1 ) | |
645 | EVT_AUINOTEBOOK_BUTTON = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_BUTTON, 1 ) | |
646 | EVT_AUINOTEBOOK_BEGIN_DRAG = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_BEGIN_DRAG, 1 ) | |
647 | EVT_AUINOTEBOOK_END_DRAG = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_END_DRAG, 1 ) | |
4444d148 | 648 | EVT_AUINOTEBOOK_DRAG_MOTION = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_DRAG_MOTION, 1 ) |
5d3aeb0f | 649 | EVT_AUINOTEBOOK_ALLOW_DND = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_ALLOW_DND, 1 ) |
d91fa282 | 650 | } |
a3219eea BW |
651 | #endif |
652 | ||
653 | ||
654 | #endif // wxUSE_AUI | |
655 | #endif // _WX_AUINOTEBOOK_H_ |