]>
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, |
793d4365 | 159 | const wxAuiNotebookPage& pane, |
3f69756e | 160 | const wxRect& in_rect, |
41b76acd BW |
161 | int close_button_state, |
162 | wxRect* out_tab_rect, | |
163 | wxRect* out_button_rect, | |
3f69756e | 164 | int* x_extent) = 0; |
4953f8cf BW |
165 | |
166 | virtual void DrawButton( | |
a6b0e5bd | 167 | wxDC& dc, |
01372b8f | 168 | wxWindow* wnd, |
4953f8cf BW |
169 | const wxRect& in_rect, |
170 | int bitmap_id, | |
171 | int button_state, | |
172 | int orientation, | |
4953f8cf | 173 | wxRect* out_rect) = 0; |
793d4365 | 174 | |
4953f8cf | 175 | virtual wxSize GetTabSize( |
a6b0e5bd | 176 | wxDC& dc, |
01372b8f | 177 | wxWindow* wnd, |
4953f8cf | 178 | const wxString& caption, |
2b9aac33 | 179 | const wxBitmap& bitmap, |
4953f8cf | 180 | bool active, |
41b76acd | 181 | int close_button_state, |
4953f8cf | 182 | int* x_extent) = 0; |
a6b0e5bd | 183 | |
793d4365 | 184 | virtual int ShowDropDown( |
a6b0e5bd | 185 | wxWindow* wnd, |
793d4365 | 186 | const wxAuiNotebookPageArray& items, |
a6b0e5bd | 187 | int active_idx) = 0; |
793d4365 BW |
188 | |
189 | virtual int GetIndentSize() = 0; | |
01372b8f | 190 | |
793d4365 BW |
191 | virtual int GetBestTabCtrlSize( |
192 | wxWindow* wnd, | |
193 | const wxAuiNotebookPageArray& pages, | |
194 | const wxSize& required_bmp_size) = 0; | |
3f69756e BW |
195 | }; |
196 | ||
197 | ||
2b9aac33 | 198 | class WXDLLIMPEXP_AUI wxAuiDefaultTabArt : public wxAuiTabArt |
b0d17f7c BW |
199 | { |
200 | ||
201 | public: | |
202 | ||
2b9aac33 BW |
203 | wxAuiDefaultTabArt(); |
204 | virtual ~wxAuiDefaultTabArt(); | |
b0d17f7c BW |
205 | |
206 | wxAuiTabArt* Clone(); | |
207 | void SetFlags(unsigned int flags); | |
b0d17f7c BW |
208 | void SetSizingInfo(const wxSize& tab_ctrl_size, |
209 | size_t tab_count); | |
210 | ||
211 | void SetNormalFont(const wxFont& font); | |
212 | void SetSelectedFont(const wxFont& font); | |
213 | void SetMeasuringFont(const wxFont& font); | |
214 | ||
215 | void DrawBackground( | |
216 | wxDC& dc, | |
217 | wxWindow* wnd, | |
218 | const wxRect& rect); | |
2b9aac33 | 219 | |
b0d17f7c BW |
220 | void DrawTab(wxDC& dc, |
221 | wxWindow* wnd, | |
793d4365 | 222 | const wxAuiNotebookPage& pane, |
b0d17f7c | 223 | const wxRect& in_rect, |
b0d17f7c BW |
224 | int close_button_state, |
225 | wxRect* out_tab_rect, | |
226 | wxRect* out_button_rect, | |
227 | int* x_extent); | |
228 | ||
229 | void DrawButton( | |
230 | wxDC& dc, | |
231 | wxWindow* wnd, | |
232 | const wxRect& in_rect, | |
233 | int bitmap_id, | |
234 | int button_state, | |
235 | int orientation, | |
b0d17f7c | 236 | wxRect* out_rect); |
b0d17f7c | 237 | |
2b9aac33 BW |
238 | int GetIndentSize(); |
239 | ||
b0d17f7c BW |
240 | wxSize GetTabSize( |
241 | wxDC& dc, | |
242 | wxWindow* wnd, | |
243 | const wxString& caption, | |
2b9aac33 | 244 | const wxBitmap& bitmap, |
b0d17f7c BW |
245 | bool active, |
246 | int close_button_state, | |
247 | int* x_extent); | |
248 | ||
793d4365 | 249 | int ShowDropDown( |
b0d17f7c | 250 | wxWindow* wnd, |
793d4365 | 251 | const wxAuiNotebookPageArray& items, |
b0d17f7c BW |
252 | int active_idx); |
253 | ||
2b9aac33 | 254 | int GetBestTabCtrlSize(wxWindow* wnd, |
793d4365 | 255 | const wxAuiNotebookPageArray& pages, |
9fbb7d80 | 256 | const wxSize& required_bmp_size); |
b0d17f7c | 257 | |
760d3542 | 258 | protected: |
b0d17f7c BW |
259 | |
260 | wxFont m_normal_font; | |
261 | wxFont m_selected_font; | |
262 | wxFont m_measuring_font; | |
1750e8e2 BW |
263 | wxColour m_base_colour; |
264 | wxPen m_base_colour_pen; | |
003cf4ef | 265 | wxPen m_border_pen; |
1750e8e2 | 266 | wxBrush m_base_colour_brush; |
b0d17f7c BW |
267 | wxBitmap m_active_close_bmp; |
268 | wxBitmap m_disabled_close_bmp; | |
269 | wxBitmap m_active_left_bmp; | |
270 | wxBitmap m_disabled_left_bmp; | |
271 | wxBitmap m_active_right_bmp; | |
272 | wxBitmap m_disabled_right_bmp; | |
273 | wxBitmap m_active_windowlist_bmp; | |
274 | wxBitmap m_disabled_windowlist_bmp; | |
275 | ||
276 | int m_fixed_tab_width; | |
2b9aac33 | 277 | int m_tab_ctrl_height; |
b0d17f7c BW |
278 | unsigned int m_flags; |
279 | }; | |
280 | ||
281 | ||
2b9aac33 | 282 | class WXDLLIMPEXP_AUI wxAuiSimpleTabArt : public wxAuiTabArt |
3f69756e BW |
283 | { |
284 | ||
285 | public: | |
286 | ||
2b9aac33 BW |
287 | wxAuiSimpleTabArt(); |
288 | virtual ~wxAuiSimpleTabArt(); | |
3f69756e | 289 | |
b0d17f7c BW |
290 | wxAuiTabArt* Clone(); |
291 | void SetFlags(unsigned int flags); | |
2b9aac33 | 292 | |
b0d17f7c BW |
293 | void SetSizingInfo(const wxSize& tab_ctrl_size, |
294 | size_t tab_count); | |
295 | ||
a4c8fc23 BW |
296 | void SetNormalFont(const wxFont& font); |
297 | void SetSelectedFont(const wxFont& font); | |
298 | void SetMeasuringFont(const wxFont& font); | |
b0d17f7c | 299 | |
3f69756e | 300 | void DrawBackground( |
a6b0e5bd | 301 | wxDC& dc, |
01372b8f | 302 | wxWindow* wnd, |
3f69756e | 303 | const wxRect& rect); |
2b9aac33 | 304 | |
a6b0e5bd | 305 | void DrawTab(wxDC& dc, |
01372b8f | 306 | wxWindow* wnd, |
793d4365 | 307 | const wxAuiNotebookPage& pane, |
3f69756e | 308 | const wxRect& in_rect, |
41b76acd BW |
309 | int close_button_state, |
310 | wxRect* out_tab_rect, | |
311 | wxRect* out_button_rect, | |
3f69756e | 312 | int* x_extent); |
4953f8cf BW |
313 | |
314 | void DrawButton( | |
a6b0e5bd | 315 | wxDC& dc, |
01372b8f | 316 | wxWindow* wnd, |
4953f8cf BW |
317 | const wxRect& in_rect, |
318 | int bitmap_id, | |
319 | int button_state, | |
320 | int orientation, | |
4953f8cf | 321 | wxRect* out_rect); |
2b9aac33 | 322 | |
b0d17f7c | 323 | int GetIndentSize(); |
2b9aac33 | 324 | |
4953f8cf | 325 | wxSize GetTabSize( |
a6b0e5bd | 326 | wxDC& dc, |
01372b8f | 327 | wxWindow* wnd, |
4953f8cf | 328 | const wxString& caption, |
2b9aac33 | 329 | const wxBitmap& bitmap, |
4953f8cf | 330 | bool active, |
41b76acd | 331 | int close_button_state, |
4953f8cf | 332 | int* x_extent); |
a6b0e5bd | 333 | |
793d4365 | 334 | int ShowDropDown( |
a6b0e5bd | 335 | wxWindow* wnd, |
793d4365 | 336 | const wxAuiNotebookPageArray& items, |
a6b0e5bd BW |
337 | int active_idx); |
338 | ||
2b9aac33 | 339 | int GetBestTabCtrlSize(wxWindow* wnd, |
793d4365 | 340 | const wxAuiNotebookPageArray& pages, |
9fbb7d80 | 341 | const wxSize& required_bmp_size); |
a4c8fc23 | 342 | |
760d3542 | 343 | protected: |
3f69756e BW |
344 | |
345 | wxFont m_normal_font; | |
346 | wxFont m_selected_font; | |
347 | wxFont m_measuring_font; | |
348 | wxPen m_normal_bkpen; | |
349 | wxPen m_selected_bkpen; | |
350 | wxBrush m_normal_bkbrush; | |
351 | wxBrush m_selected_bkbrush; | |
352 | wxBrush m_bkbrush; | |
4953f8cf BW |
353 | wxBitmap m_active_close_bmp; |
354 | wxBitmap m_disabled_close_bmp; | |
355 | wxBitmap m_active_left_bmp; | |
356 | wxBitmap m_disabled_left_bmp; | |
357 | wxBitmap m_active_right_bmp; | |
358 | wxBitmap m_disabled_right_bmp; | |
01372b8f BW |
359 | wxBitmap m_active_windowlist_bmp; |
360 | wxBitmap m_disabled_windowlist_bmp; | |
b0d17f7c BW |
361 | |
362 | int m_fixed_tab_width; | |
363 | unsigned int m_flags; | |
3f69756e BW |
364 | }; |
365 | ||
366 | ||
367 | ||
b0d17f7c | 368 | |
41b76acd | 369 | |
a3219eea BW |
370 | |
371 | ||
a3219eea BW |
372 | |
373 | ||
374 | class WXDLLIMPEXP_AUI wxAuiTabContainer | |
375 | { | |
376 | public: | |
377 | ||
378 | wxAuiTabContainer(); | |
9fabaac4 | 379 | virtual ~wxAuiTabContainer(); |
a3219eea | 380 | |
a3a5df9d | 381 | void SetArtProvider(wxAuiTabArt* art); |
e0dc13d4 | 382 | wxAuiTabArt* GetArtProvider() const; |
3f69756e | 383 | |
702b1c7e BW |
384 | void SetFlags(unsigned int flags); |
385 | unsigned int GetFlags() const; | |
386 | ||
a3219eea BW |
387 | bool AddPage(wxWindow* page, const wxAuiNotebookPage& info); |
388 | bool InsertPage(wxWindow* page, const wxAuiNotebookPage& info, size_t idx); | |
2fadbbfd | 389 | bool MovePage(wxWindow* page, size_t new_idx); |
a3219eea BW |
390 | bool RemovePage(wxWindow* page); |
391 | bool SetActivePage(wxWindow* page); | |
392 | bool SetActivePage(size_t page); | |
393 | void SetNoneActive(); | |
394 | int GetActivePage() const; | |
395 | bool TabHitTest(int x, int y, wxWindow** hit) const; | |
396 | bool ButtonHitTest(int x, int y, wxAuiTabContainerButton** hit) const; | |
397 | wxWindow* GetWindowFromIdx(size_t idx) const; | |
398 | int GetIdxFromWindow(wxWindow* page) const; | |
399 | size_t GetPageCount() const; | |
400 | wxAuiNotebookPage& GetPage(size_t idx); | |
c3e016e4 | 401 | const wxAuiNotebookPage& GetPage(size_t idx) const; |
a3219eea BW |
402 | wxAuiNotebookPageArray& GetPages(); |
403 | void SetNormalFont(const wxFont& normal_font); | |
404 | void SetSelectedFont(const wxFont& selected_font); | |
405 | void SetMeasuringFont(const wxFont& measuring_font); | |
406 | void DoShowHide(); | |
407 | void SetRect(const wxRect& rect); | |
41b76acd BW |
408 | |
409 | void RemoveButton(int id); | |
4953f8cf BW |
410 | void AddButton(int id, |
411 | int location, | |
412 | const wxBitmap& normal_bitmap = wxNullBitmap, | |
413 | const wxBitmap& disabled_bitmap = wxNullBitmap); | |
4444d148 | 414 | |
4953f8cf BW |
415 | size_t GetTabOffset() const; |
416 | void SetTabOffset(size_t offset); | |
417 | ||
a3219eea BW |
418 | protected: |
419 | ||
01372b8f | 420 | virtual void Render(wxDC* dc, wxWindow* wnd); |
a3219eea | 421 | |
01372b8f | 422 | protected: |
a3219eea | 423 | |
a3a5df9d | 424 | wxAuiTabArt* m_art; |
a3219eea BW |
425 | wxAuiNotebookPageArray m_pages; |
426 | wxAuiTabContainerButtonArray m_buttons; | |
41b76acd | 427 | wxAuiTabContainerButtonArray m_tab_close_buttons; |
a3219eea | 428 | wxRect m_rect; |
4953f8cf | 429 | size_t m_tab_offset; |
702b1c7e | 430 | unsigned int m_flags; |
a3219eea BW |
431 | }; |
432 | ||
433 | ||
434 | ||
435 | class WXDLLIMPEXP_AUI wxAuiTabCtrl : public wxControl, | |
436 | public wxAuiTabContainer | |
437 | { | |
438 | public: | |
439 | ||
440 | wxAuiTabCtrl(wxWindow* parent, | |
d91fa282 | 441 | wxWindowID id = wxID_ANY, |
a3219eea BW |
442 | const wxPoint& pos = wxDefaultPosition, |
443 | const wxSize& size = wxDefaultSize, | |
444 | long style = 0); | |
4444d148 | 445 | |
26da5e4f BW |
446 | ~wxAuiTabCtrl(); |
447 | ||
a3219eea BW |
448 | protected: |
449 | ||
450 | void OnPaint(wxPaintEvent& evt); | |
451 | void OnEraseBackground(wxEraseEvent& evt); | |
452 | void OnSize(wxSizeEvent& evt); | |
453 | void OnLeftDown(wxMouseEvent& evt); | |
454 | void OnLeftUp(wxMouseEvent& evt); | |
455 | void OnMotion(wxMouseEvent& evt); | |
456 | void OnLeaveWindow(wxMouseEvent& evt); | |
4953f8cf | 457 | void OnButton(wxAuiNotebookEvent& evt); |
4444d148 | 458 | |
4953f8cf | 459 | |
a3219eea | 460 | protected: |
4444d148 | 461 | |
a3219eea | 462 | wxPoint m_click_pt; |
08c068a4 | 463 | wxWindow* m_click_tab; |
a3219eea BW |
464 | bool m_is_dragging; |
465 | wxAuiTabContainerButton* m_hover_button; | |
9b3f654a | 466 | wxAuiTabContainerButton* m_pressed_button; |
a3219eea | 467 | |
d91fa282 | 468 | #ifndef SWIG |
5d3aeb0f | 469 | DECLARE_CLASS(wxAuiTabCtrl) |
a3219eea | 470 | DECLARE_EVENT_TABLE() |
d91fa282 | 471 | #endif |
a3219eea BW |
472 | }; |
473 | ||
474 | ||
475 | ||
476 | ||
a3a5df9d | 477 | class WXDLLIMPEXP_AUI wxAuiNotebook : public wxControl |
a3219eea BW |
478 | { |
479 | ||
480 | public: | |
481 | ||
a3a5df9d | 482 | wxAuiNotebook(); |
4444d148 | 483 | |
a3a5df9d | 484 | wxAuiNotebook(wxWindow* parent, |
0ce53f32 BW |
485 | wxWindowID id = wxID_ANY, |
486 | const wxPoint& pos = wxDefaultPosition, | |
487 | const wxSize& size = wxDefaultSize, | |
488 | long style = wxAUI_NB_DEFAULT_STYLE); | |
4444d148 | 489 | |
a3a5df9d | 490 | virtual ~wxAuiNotebook(); |
a3219eea BW |
491 | |
492 | bool Create(wxWindow* parent, | |
d91fa282 | 493 | wxWindowID id = wxID_ANY, |
a3219eea BW |
494 | const wxPoint& pos = wxDefaultPosition, |
495 | const wxSize& size = wxDefaultSize, | |
4444d148 | 496 | long style = 0); |
d606b6e9 BW |
497 | |
498 | void SetWindowStyleFlag(long style); | |
499 | void SetArtProvider(wxAuiTabArt* art); | |
500 | wxAuiTabArt* GetArtProvider() const; | |
501 | ||
502 | virtual void SetUniformBitmapSize(const wxSize& size); | |
503 | virtual void SetTabCtrlHeight(int height); | |
504 | ||
a3219eea BW |
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 | 518 | |
d606b6e9 BW |
519 | size_t GetPageCount() const; |
520 | wxWindow* GetPage(size_t page_idx) const; | |
521 | int GetPageIndex(wxWindow* page_wnd) const; | |
4444d148 | 522 | |
a3219eea | 523 | bool SetPageText(size_t page, const wxString& text); |
c3e016e4 JS |
524 | wxString GetPageText(size_t page_idx) const; |
525 | ||
e0dc13d4 | 526 | bool SetPageBitmap(size_t page, const wxBitmap& bitmap); |
c3e016e4 JS |
527 | wxBitmap GetPageBitmap(size_t page_idx) const; |
528 | ||
a3219eea BW |
529 | size_t SetSelection(size_t new_page); |
530 | int GetSelection() const; | |
c3e016e4 | 531 | |
d606b6e9 BW |
532 | virtual void Split(size_t page, int direction); |
533 | ||
a3219eea | 534 | protected: |
4444d148 | 535 | |
2b9aac33 | 536 | // these can be overridden |
ca0d4407 | 537 | virtual void UpdateTabCtrlHeight(); |
2b9aac33 | 538 | virtual int CalculateTabCtrlHeight(); |
9fbb7d80 | 539 | virtual wxSize CalculateNewSplitSize(); |
2b9aac33 BW |
540 | |
541 | protected: | |
542 | ||
543 | void DoSizing(); | |
544 | void InitNotebook(long style); | |
a3219eea BW |
545 | wxAuiTabCtrl* GetTabCtrlFromPoint(const wxPoint& pt); |
546 | wxWindow* GetTabFrameFromTabCtrl(wxWindow* tab_ctrl); | |
547 | wxAuiTabCtrl* GetActiveTabCtrl(); | |
548 | bool FindTab(wxWindow* page, wxAuiTabCtrl** ctrl, int* idx); | |
549 | void RemoveEmptyTabFrames(); | |
9fbb7d80 BW |
550 | void UpdateHintWindowSize(); |
551 | ||
a3219eea BW |
552 | protected: |
553 | ||
a3219eea | 554 | void OnChildFocus(wxChildFocusEvent& evt); |
a3a5df9d | 555 | void OnRender(wxAuiManagerEvent& evt); |
a3219eea BW |
556 | void OnSize(wxSizeEvent& evt); |
557 | void OnTabClicked(wxCommandEvent& evt); | |
558 | void OnTabBeginDrag(wxCommandEvent& evt); | |
559 | void OnTabDragMotion(wxCommandEvent& evt); | |
560 | void OnTabEndDrag(wxCommandEvent& evt); | |
561 | void OnTabButton(wxCommandEvent& evt); | |
4953f8cf | 562 | |
a3219eea BW |
563 | protected: |
564 | ||
a3a5df9d | 565 | wxAuiManager m_mgr; |
a3219eea BW |
566 | wxAuiTabContainer m_tabs; |
567 | int m_curpage; | |
568 | int m_tab_id_counter; | |
569 | wxWindow* m_dummy_wnd; | |
4444d148 | 570 | |
9fbb7d80 | 571 | wxSize m_requested_bmp_size; |
ca0d4407 | 572 | int m_requested_tabctrl_height; |
a3219eea BW |
573 | wxFont m_selected_font; |
574 | wxFont m_normal_font; | |
da5e85d9 | 575 | int m_tab_ctrl_height; |
9fbb7d80 | 576 | |
08c068a4 | 577 | int m_last_drag_x; |
702b1c7e | 578 | unsigned int m_flags; |
4444d148 | 579 | |
d91fa282 | 580 | #ifndef SWIG |
0ce53f32 | 581 | DECLARE_CLASS(wxAuiNotebook) |
a3219eea | 582 | DECLARE_EVENT_TABLE() |
d91fa282 | 583 | #endif |
a3219eea BW |
584 | }; |
585 | ||
586 | ||
587 | ||
588 | ||
589 | // wx event machinery | |
590 | ||
591 | #ifndef SWIG | |
592 | ||
593 | BEGIN_DECLARE_EVENT_TYPES() | |
3fd8c988 | 594 | DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE, 0) |
a3219eea BW |
595 | DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, 0) |
596 | DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING, 0) | |
597 | DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_BUTTON, 0) | |
598 | DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_BEGIN_DRAG, 0) | |
599 | DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_END_DRAG, 0) | |
600 | DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_DRAG_MOTION, 0) | |
5d3aeb0f | 601 | DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_ALLOW_DND, 0) |
a3219eea BW |
602 | END_DECLARE_EVENT_TYPES() |
603 | ||
604 | typedef void (wxEvtHandler::*wxAuiNotebookEventFunction)(wxAuiNotebookEvent&); | |
605 | ||
606 | #define wxAuiNotebookEventHandler(func) \ | |
607 | (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxAuiNotebookEventFunction, &func) | |
3fd8c988 BW |
608 | |
609 | #define EVT_AUINOTEBOOK_PAGE_CLOSE(winid, fn) \ | |
610 | wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE, winid, wxAuiNotebookEventHandler(fn)) | |
a3219eea BW |
611 | #define EVT_AUINOTEBOOK_PAGE_CHANGED(winid, fn) \ |
612 | wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, winid, wxAuiNotebookEventHandler(fn)) | |
613 | #define EVT_AUINOTEBOOK_PAGE_CHANGING(winid, fn) \ | |
614 | wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING, winid, wxAuiNotebookEventHandler(fn)) | |
4953f8cf | 615 | #define EVT_AUINOTEBOOK_BUTTON(winid, fn) \ |
a3219eea BW |
616 | wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_BUTTON, winid, wxAuiNotebookEventHandler(fn)) |
617 | #define EVT_AUINOTEBOOK_BEGIN_DRAG(winid, fn) \ | |
618 | wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_BEGIN_DRAG, winid, wxAuiNotebookEventHandler(fn)) | |
619 | #define EVT_AUINOTEBOOK_END_DRAG(winid, fn) \ | |
620 | wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_END_DRAG, winid, wxAuiNotebookEventHandler(fn)) | |
621 | #define EVT_AUINOTEBOOK_DRAG_MOTION(winid, fn) \ | |
622 | wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_DRAG_MOTION, winid, wxAuiNotebookEventHandler(fn)) | |
5d3aeb0f BW |
623 | #define EVT_AUINOTEBOOK_ALLOW_DND(winid, fn) \ |
624 | wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_ALLOW_DND, winid, wxAuiNotebookEventHandler(fn)) | |
4444d148 | 625 | |
a3219eea BW |
626 | #else |
627 | ||
628 | // wxpython/swig event work | |
3fd8c988 | 629 | %constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE; |
d91fa282 RD |
630 | %constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED; |
631 | %constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING; | |
632 | %constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_BUTTON; | |
633 | %constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_BEGIN_DRAG; | |
634 | %constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_END_DRAG; | |
635 | %constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_DRAG_MOTION; | |
5d3aeb0f | 636 | %constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_ALLOW_DND; |
d91fa282 RD |
637 | |
638 | %pythoncode { | |
3fd8c988 | 639 | EVT_AUINOTEBOOK_PAGE_CLOSE = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE, 1 ) |
d91fa282 RD |
640 | EVT_AUINOTEBOOK_PAGE_CHANGED = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, 1 ) |
641 | EVT_AUINOTEBOOK_PAGE_CHANGING = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING, 1 ) | |
642 | EVT_AUINOTEBOOK_BUTTON = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_BUTTON, 1 ) | |
643 | EVT_AUINOTEBOOK_BEGIN_DRAG = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_BEGIN_DRAG, 1 ) | |
644 | EVT_AUINOTEBOOK_END_DRAG = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_END_DRAG, 1 ) | |
4444d148 | 645 | EVT_AUINOTEBOOK_DRAG_MOTION = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_DRAG_MOTION, 1 ) |
5d3aeb0f | 646 | EVT_AUINOTEBOOK_ALLOW_DND = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_ALLOW_DND, 1 ) |
d91fa282 | 647 | } |
a3219eea BW |
648 | #endif |
649 | ||
650 | ||
651 | #endif // wxUSE_AUI | |
652 | #endif // _WX_AUINOTEBOOK_H_ |