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