Add support for transparent hint windows under GTK
[wxWidgets.git] / include / wx / aui / framemanager.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/aui/framemanager.h
3 // Purpose: wxaui: wx advanced user interface - docking window manager
4 // Author: Benjamin I. Williams
5 // Modified by:
6 // Created: 2005-05-17
7 // RCS-ID: $Id$
8 // Copyright: (C) Copyright 2005, Kirix Corporation, All Rights Reserved.
9 // Licence: wxWindows Library Licence, Version 3.1
10 ///////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_FRAMEMANAGER_H_
13 #define _WX_FRAMEMANAGER_H_
14
15 // ----------------------------------------------------------------------------
16 // headers
17 // ----------------------------------------------------------------------------
18
19 #include "wx/defs.h"
20
21 #if wxUSE_AUI
22
23 #include "wx/dynarray.h"
24 #include "wx/gdicmn.h"
25 #include "wx/window.h"
26 #include "wx/timer.h"
27 #include "wx/sizer.h"
28
29 enum wxFrameManagerDock
30 {
31 wxAUI_DOCK_NONE = 0,
32 wxAUI_DOCK_TOP = 1,
33 wxAUI_DOCK_RIGHT = 2,
34 wxAUI_DOCK_BOTTOM = 3,
35 wxAUI_DOCK_LEFT = 4,
36 wxAUI_DOCK_CENTER = 5,
37 wxAUI_DOCK_CENTRE = wxAUI_DOCK_CENTER
38 };
39
40 enum wxFrameManagerOption
41 {
42 wxAUI_MGR_ALLOW_FLOATING = 1 << 0,
43 wxAUI_MGR_ALLOW_ACTIVE_PANE = 1 << 1,
44 wxAUI_MGR_TRANSPARENT_DRAG = 1 << 2,
45 wxAUI_MGR_TRANSPARENT_HINT = 1 << 3,
46 wxAUI_MGR_TRANSPARENT_HINT_FADE = 1 << 4,
47 // The venetian blind effect is ONLY used when the wxAUI_MGR_TRANSPARENT_HINT has been used, but
48 // at runtime we determine we cannot use transparency (because, for instance, the OS does not support it).
49 // setting this flag drops back in such circumstances (only) to the behaviour without wxAUI_MGR_TRANSPARENT_HINT
50 wxAUI_MGR_DISABLE_VENETIAN_BLINDS = 1 << 5,
51
52 wxAUI_MGR_DEFAULT = wxAUI_MGR_ALLOW_FLOATING |
53 wxAUI_MGR_TRANSPARENT_HINT |
54 wxAUI_MGR_TRANSPARENT_HINT_FADE
55 };
56
57 enum wxPaneDockArtSetting
58 {
59 wxAUI_ART_SASH_SIZE = 0,
60 wxAUI_ART_CAPTION_SIZE = 1,
61 wxAUI_ART_GRIPPER_SIZE = 2,
62 wxAUI_ART_PANE_BORDER_SIZE = 3,
63 wxAUI_ART_PANE_BUTTON_SIZE = 4,
64 wxAUI_ART_BACKGROUND_COLOUR = 5,
65 wxAUI_ART_SASH_COLOUR = 6,
66 wxAUI_ART_ACTIVE_CAPTION_COLOUR = 7,
67 wxAUI_ART_ACTIVE_CAPTION_GRADIENT_COLOUR = 8,
68 wxAUI_ART_INACTIVE_CAPTION_COLOUR = 9,
69 wxAUI_ART_INACTIVE_CAPTION_GRADIENT_COLOUR = 10,
70 wxAUI_ART_ACTIVE_CAPTION_TEXT_COLOUR = 11,
71 wxAUI_ART_INACTIVE_CAPTION_TEXT_COLOUR = 12,
72 wxAUI_ART_BORDER_COLOUR = 13,
73 wxAUI_ART_GRIPPER_COLOUR = 14,
74 wxAUI_ART_CAPTION_FONT = 15,
75 wxAUI_ART_GRADIENT_TYPE = 16
76 };
77
78 enum wxPaneDockArtGradients
79 {
80 wxAUI_GRADIENT_NONE = 0,
81 wxAUI_GRADIENT_VERTICAL = 1,
82 wxAUI_GRADIENT_HORIZONTAL = 2
83 };
84
85 enum wxPaneButtonState
86 {
87 wxAUI_BUTTON_STATE_NORMAL = 0,
88 wxAUI_BUTTON_STATE_HOVER = 1,
89 wxAUI_BUTTON_STATE_PRESSED = 2
90 };
91
92 enum wxPaneInsertLevel
93 {
94 wxAUI_INSERT_PANE = 0,
95 wxAUI_INSERT_ROW = 1,
96 wxAUI_INSERT_DOCK = 2
97 };
98
99
100
101 // forwards and array declarations
102 class wxDockUIPart;
103 class wxPaneButton;
104 class wxPaneInfo;
105 class wxDockInfo;
106 class wxDockArt;
107 class wxFrameManagerEvent;
108
109 #ifndef SWIG
110 WX_DECLARE_USER_EXPORTED_OBJARRAY(wxDockInfo, wxDockInfoArray, WXDLLIMPEXP_AUI);
111 WX_DECLARE_USER_EXPORTED_OBJARRAY(wxDockUIPart, wxDockUIPartArray, WXDLLIMPEXP_AUI);
112 WX_DECLARE_USER_EXPORTED_OBJARRAY(wxPaneButton, wxPaneButtonArray, WXDLLIMPEXP_AUI);
113 WX_DECLARE_USER_EXPORTED_OBJARRAY(wxPaneInfo, wxPaneInfoArray, WXDLLIMPEXP_AUI);
114 WX_DEFINE_ARRAY_PTR(wxPaneInfo*, wxPaneInfoPtrArray);
115 WX_DEFINE_ARRAY_PTR(wxDockInfo*, wxDockInfoPtrArray);
116 #endif // SWIG
117
118 extern WXDLLIMPEXP_AUI wxDockInfo wxNullDockInfo;
119 extern WXDLLIMPEXP_AUI wxPaneInfo wxNullPaneInfo;
120
121
122
123 class WXDLLIMPEXP_AUI wxPaneInfo
124 {
125 public:
126
127 wxPaneInfo()
128 {
129 window = NULL;
130 frame = NULL;
131 state = 0;
132 dock_direction = wxAUI_DOCK_LEFT;
133 dock_layer = 0;
134 dock_row = 0;
135 dock_pos = 0;
136 floating_pos = wxDefaultPosition;
137 floating_size = wxDefaultSize;
138 best_size = wxDefaultSize;
139 min_size = wxDefaultSize;
140 max_size = wxDefaultSize;
141 dock_proportion = 0;
142
143 DefaultPane();
144 }
145
146 ~wxPaneInfo() {}
147
148 #ifndef SWIG
149 wxPaneInfo(const wxPaneInfo& c)
150 {
151 name = c.name;
152 caption = c.caption;
153 window = c.window;
154 frame = c.frame;
155 state = c.state;
156 dock_direction = c.dock_direction;
157 dock_layer = c.dock_layer;
158 dock_row = c.dock_row;
159 dock_pos = c.dock_pos;
160 best_size = c.best_size;
161 min_size = c.min_size;
162 max_size = c.max_size;
163 floating_pos = c.floating_pos;
164 floating_size = c.floating_size;
165 dock_proportion = c.dock_proportion;
166 buttons = c.buttons;
167 rect = c.rect;
168 }
169
170 wxPaneInfo& operator=(const wxPaneInfo& c)
171 {
172 name = c.name;
173 caption = c.caption;
174 window = c.window;
175 frame = c.frame;
176 state = c.state;
177 dock_direction = c.dock_direction;
178 dock_layer = c.dock_layer;
179 dock_row = c.dock_row;
180 dock_pos = c.dock_pos;
181 best_size = c.best_size;
182 min_size = c.min_size;
183 max_size = c.max_size;
184 floating_pos = c.floating_pos;
185 floating_size = c.floating_size;
186 dock_proportion = c.dock_proportion;
187 buttons = c.buttons;
188 rect = c.rect;
189 return *this;
190 }
191 #endif // SWIG
192
193 bool IsOk() const { return (window != NULL) ? true : false; }
194 bool IsFixed() const { return !HasFlag(optionResizable); }
195 bool IsResizable() const { return HasFlag(optionResizable); }
196 bool IsShown() const { return !HasFlag(optionHidden); }
197 bool IsFloating() const { return HasFlag(optionFloating); }
198 bool IsDocked() const { return !HasFlag(optionFloating); }
199 bool IsToolbar() const { return HasFlag(optionToolbar); }
200 bool IsTopDockable() const { return HasFlag(optionTopDockable); }
201 bool IsBottomDockable() const { return HasFlag(optionBottomDockable); }
202 bool IsLeftDockable() const { return HasFlag(optionLeftDockable); }
203 bool IsRightDockable() const { return HasFlag(optionRightDockable); }
204 bool IsFloatable() const { return HasFlag(optionFloatable); }
205 bool IsMovable() const { return HasFlag(optionMovable); }
206 bool HasCaption() const { return HasFlag(optionCaption); }
207 bool HasGripper() const { return HasFlag(optionGripper); }
208 bool HasBorder() const { return HasFlag(optionPaneBorder); }
209 bool HasCloseButton() const { return HasFlag(buttonClose); }
210 bool HasMaximizeButton() const { return HasFlag(buttonMaximize); }
211 bool HasMinimizeButton() const { return HasFlag(buttonMinimize); }
212 bool HasPinButton() const { return HasFlag(buttonPin); }
213 bool HasGripperTop() const { return HasFlag(optionGripperTop); }
214
215 #ifdef SWIG
216 %typemap(out) wxPaneInfo& { $result = $self; Py_INCREF($result); }
217 #endif
218 wxPaneInfo& Window(wxWindow* w) { window = w; return *this; }
219 wxPaneInfo& Name(const wxString& n) { name = n; return *this; }
220 wxPaneInfo& Caption(const wxString& c) { caption = c; return *this; }
221 wxPaneInfo& Left() { dock_direction = wxAUI_DOCK_LEFT; return *this; }
222 wxPaneInfo& Right() { dock_direction = wxAUI_DOCK_RIGHT; return *this; }
223 wxPaneInfo& Top() { dock_direction = wxAUI_DOCK_TOP; return *this; }
224 wxPaneInfo& Bottom() { dock_direction = wxAUI_DOCK_BOTTOM; return *this; }
225 wxPaneInfo& Center() { dock_direction = wxAUI_DOCK_CENTER; return *this; }
226 wxPaneInfo& Centre() { dock_direction = wxAUI_DOCK_CENTRE; return *this; }
227 wxPaneInfo& Direction(int direction) { dock_direction = direction; return *this; }
228 wxPaneInfo& Layer(int layer) { dock_layer = layer; return *this; }
229 wxPaneInfo& Row(int row) { dock_row = row; return *this; }
230 wxPaneInfo& Position(int pos) { dock_pos = pos; return *this; }
231 wxPaneInfo& BestSize(const wxSize& size) { best_size = size; return *this; }
232 wxPaneInfo& MinSize(const wxSize& size) { min_size = size; return *this; }
233 wxPaneInfo& MaxSize(const wxSize& size) { max_size = size; return *this; }
234 wxPaneInfo& BestSize(int x, int y) { best_size.Set(x,y); return *this; }
235 wxPaneInfo& MinSize(int x, int y) { min_size.Set(x,y); return *this; }
236 wxPaneInfo& MaxSize(int x, int y) { max_size.Set(x,y); return *this; }
237 wxPaneInfo& FloatingPosition(const wxPoint& pos) { floating_pos = pos; return *this; }
238 wxPaneInfo& FloatingPosition(int x, int y) { floating_pos.x = x; floating_pos.y = y; return *this; }
239 wxPaneInfo& FloatingSize(const wxSize& size) { floating_size = size; return *this; }
240 wxPaneInfo& FloatingSize(int x, int y) { floating_size.Set(x,y); return *this; }
241 wxPaneInfo& Fixed() { return SetFlag(optionResizable, false); }
242 wxPaneInfo& Resizable(bool resizable = true) { return SetFlag(optionResizable, resizable); }
243 wxPaneInfo& Dock() { return SetFlag(optionFloating, false); }
244 wxPaneInfo& Float() { return SetFlag(optionFloating, true); }
245 wxPaneInfo& Hide() { return SetFlag(optionHidden, true); }
246 wxPaneInfo& Show(bool show = true) { return SetFlag(optionHidden, !show); }
247 wxPaneInfo& CaptionVisible(bool visible = true) { return SetFlag(optionCaption, visible); }
248 wxPaneInfo& PaneBorder(bool visible = true) { return SetFlag(optionPaneBorder, visible); }
249 wxPaneInfo& Gripper(bool visible = true) { return SetFlag(optionGripper, visible); }
250 wxPaneInfo& GripperTop(bool attop = true) { return SetFlag(optionGripperTop, attop); }
251 wxPaneInfo& CloseButton(bool visible = true) { return SetFlag(buttonClose, visible); }
252 wxPaneInfo& MaximizeButton(bool visible = true) { return SetFlag(buttonMaximize, visible); }
253 wxPaneInfo& MinimizeButton(bool visible = true) { return SetFlag(buttonMinimize, visible); }
254 wxPaneInfo& PinButton(bool visible = true) { return SetFlag(buttonPin, visible); }
255 wxPaneInfo& DestroyOnClose(bool b = true) { return SetFlag(optionDestroyOnClose, b); }
256 wxPaneInfo& TopDockable(bool b = true) { return SetFlag(optionTopDockable, b); }
257 wxPaneInfo& BottomDockable(bool b = true) { return SetFlag(optionBottomDockable, b); }
258 wxPaneInfo& LeftDockable(bool b = true) { return SetFlag(optionLeftDockable, b); }
259 wxPaneInfo& RightDockable(bool b = true) { return SetFlag(optionRightDockable, b); }
260 wxPaneInfo& Floatable(bool b = true) { return SetFlag(optionFloatable, b); }
261 wxPaneInfo& Movable(bool b = true) { return SetFlag(optionMovable, b); }
262 wxPaneInfo& Dockable(bool b = true)
263 {
264 return TopDockable(b).BottomDockable(b).LeftDockable(b).RightDockable(b);
265 }
266
267 wxPaneInfo& DefaultPane()
268 {
269 state |= optionTopDockable | optionBottomDockable |
270 optionLeftDockable | optionRightDockable |
271 optionFloatable | optionMovable | optionResizable |
272 optionCaption | optionPaneBorder | buttonClose;
273 return *this;
274 }
275
276 wxPaneInfo& CentrePane() { return CenterPane(); }
277 wxPaneInfo& CenterPane()
278 {
279 state = 0;
280 return Center().PaneBorder().Resizable();
281 }
282
283 wxPaneInfo& ToolbarPane()
284 {
285 DefaultPane();
286 state |= (optionToolbar | optionGripper);
287 state &= ~(optionResizable | optionCaption);
288 if (dock_layer == 0)
289 dock_layer = 10;
290 return *this;
291 }
292
293 wxPaneInfo& SetFlag(unsigned int flag, bool option_state)
294 {
295 if (option_state)
296 state |= flag;
297 else
298 state &= ~flag;
299 return *this;
300 }
301
302 bool HasFlag(unsigned int flag) const
303 {
304 return (state & flag) ? true:false;
305 }
306
307 #ifdef SWIG
308 %typemap(out) wxPaneInfo& ;
309 #endif
310
311 public:
312
313 enum wxPaneState
314 {
315 optionFloating = 1 << 0,
316 optionHidden = 1 << 1,
317 optionLeftDockable = 1 << 2,
318 optionRightDockable = 1 << 3,
319 optionTopDockable = 1 << 4,
320 optionBottomDockable = 1 << 5,
321 optionFloatable = 1 << 6,
322 optionMovable = 1 << 7,
323 optionResizable = 1 << 8,
324 optionPaneBorder = 1 << 9,
325 optionCaption = 1 << 10,
326 optionGripper = 1 << 11,
327 optionDestroyOnClose = 1 << 12,
328 optionToolbar = 1 << 13,
329 optionActive = 1 << 14,
330 optionGripperTop = 1 << 15,
331
332 buttonClose = 1 << 24,
333 buttonMaximize = 1 << 25,
334 buttonMinimize = 1 << 26,
335 buttonPin = 1 << 27,
336 buttonCustom1 = 1 << 28,
337 buttonCustom2 = 1 << 29,
338 buttonCustom3 = 1 << 30,
339 actionPane = 1 << 31 // used internally
340 };
341
342 public:
343 wxString name; // name of the pane
344 wxString caption; // caption displayed on the window
345
346 wxWindow* window; // window that is in this pane
347 wxFrame* frame; // floating frame window that holds the pane
348 unsigned int state; // a combination of wxPaneState values
349
350 int dock_direction; // dock direction (top, bottom, left, right, center)
351 int dock_layer; // layer number (0 = innermost layer)
352 int dock_row; // row number on the docking bar (0 = first row)
353 int dock_pos; // position inside the row (0 = first position)
354
355 wxSize best_size; // size that the layout engine will prefer
356 wxSize min_size; // minimum size the pane window can tolerate
357 wxSize max_size; // maximum size the pane window can tolerate
358
359 wxPoint floating_pos; // position while floating
360 wxSize floating_size; // size while floating
361 int dock_proportion; // proportion while docked
362
363 wxPaneButtonArray buttons; // buttons on the pane
364
365 wxRect rect; // current rectangle (populated by wxAUI)
366 };
367
368
369
370
371
372 class WXDLLIMPEXP_AUI wxFrameManager : public wxEvtHandler
373 {
374 friend class wxFloatingPane;
375
376 public:
377
378 wxFrameManager(wxWindow* managed_wnd = NULL,
379 unsigned int flags = wxAUI_MGR_DEFAULT);
380 virtual ~wxFrameManager();
381 void UnInit();
382
383 void SetFlags(unsigned int flags);
384 unsigned int GetFlags() const;
385
386 void SetManagedWindow(wxWindow* managed_wnd);
387 wxWindow* GetManagedWindow() const;
388
389 #ifdef SWIG
390 %disownarg( wxDockArt* art_provider );
391 #endif
392 void SetArtProvider(wxDockArt* art_provider);
393 wxDockArt* GetArtProvider() const;
394
395 wxPaneInfo& GetPane(wxWindow* window);
396 wxPaneInfo& GetPane(const wxString& name);
397 wxPaneInfoArray& GetAllPanes();
398
399 bool AddPane(wxWindow* window,
400 const wxPaneInfo& pane_info);
401
402 bool AddPane(wxWindow* window,
403 const wxPaneInfo& pane_info,
404 const wxPoint& drop_pos);
405
406 bool AddPane(wxWindow* window,
407 int direction = wxLEFT,
408 const wxString& caption = wxEmptyString);
409
410 bool InsertPane(wxWindow* window,
411 const wxPaneInfo& insert_location,
412 int insert_level = wxAUI_INSERT_PANE);
413
414 bool DetachPane(wxWindow* window);
415
416 wxString SavePerspective();
417
418 bool LoadPerspective(const wxString& perspective,
419 bool update = true);
420
421 void Update();
422
423
424 public:
425
426 void DrawHintRect(wxWindow* pane_window,
427 const wxPoint& pt,
428 const wxPoint& offset);
429 virtual void ShowHint(const wxRect& rect);
430 virtual void HideHint();
431
432 public:
433
434 // deprecated -- please use SetManagedWindow() and
435 // and GetManagedWindow() instead
436
437 wxDEPRECATED( void SetFrame(wxFrame* frame) );
438 wxDEPRECATED( wxFrame* GetFrame() const );
439
440 protected:
441
442
443
444 void DoFrameLayout();
445
446 void LayoutAddPane(wxSizer* container,
447 wxDockInfo& dock,
448 wxPaneInfo& pane,
449 wxDockUIPartArray& uiparts,
450 bool spacer_only);
451
452 void LayoutAddDock(wxSizer* container,
453 wxDockInfo& dock,
454 wxDockUIPartArray& uiparts,
455 bool spacer_only);
456
457 wxSizer* LayoutAll(wxPaneInfoArray& panes,
458 wxDockInfoArray& docks,
459 wxDockUIPartArray& uiparts,
460 bool spacer_only = false);
461
462 virtual bool ProcessDockResult(wxPaneInfo& target,
463 const wxPaneInfo& new_pos);
464
465 bool DoDrop(wxDockInfoArray& docks,
466 wxPaneInfoArray& panes,
467 wxPaneInfo& drop,
468 const wxPoint& pt,
469 const wxPoint& action_offset = wxPoint(0,0));
470
471 wxPaneInfo& LookupPane(wxWindow* window);
472 wxPaneInfo& LookupPane(const wxString& name);
473 wxDockUIPart* HitTest(int x, int y);
474 wxDockUIPart* GetPanePart(wxWindow* pane);
475 int GetDockPixelOffset(wxPaneInfo& test);
476 void OnFloatingPaneMoveStart(wxWindow* window);
477 void OnFloatingPaneMoving(wxWindow* window);
478 void OnFloatingPaneMoved(wxWindow* window);
479 void OnFloatingPaneActivated(wxWindow* window);
480 void OnFloatingPaneClosed(wxWindow* window, wxCloseEvent& evt);
481 void OnFloatingPaneResized(wxWindow* window, const wxSize& size);
482 void Render(wxDC* dc);
483 void Repaint(wxDC* dc = NULL);
484 void ProcessMgrEvent(wxFrameManagerEvent& event);
485 void UpdateButtonOnScreen(wxDockUIPart* button_ui_part,
486 const wxMouseEvent& event);
487 void GetPanePositionsAndSizes(wxDockInfo& dock,
488 wxArrayInt& positions,
489 wxArrayInt& sizes);
490
491
492 public:
493
494 // public events (which can be invoked externally)
495 void OnRender(wxFrameManagerEvent& evt);
496 void OnPaneButton(wxFrameManagerEvent& evt);
497
498 protected:
499
500 // protected events
501 void OnPaint(wxPaintEvent& evt);
502 void OnEraseBackground(wxEraseEvent& evt);
503 void OnSize(wxSizeEvent& evt);
504 void OnSetCursor(wxSetCursorEvent& evt);
505 void OnLeftDown(wxMouseEvent& evt);
506 void OnLeftUp(wxMouseEvent& evt);
507 void OnMotion(wxMouseEvent& evt);
508 void OnLeaveWindow(wxMouseEvent& evt);
509 void OnChildFocus(wxChildFocusEvent& evt);
510 void OnHintFadeTimer(wxTimerEvent& evt);
511
512 protected:
513
514 enum
515 {
516 actionNone = 0,
517 actionResize,
518 actionClickButton,
519 actionClickCaption,
520 actionDragToolbarPane,
521 actionDragFloatingPane
522 };
523
524 protected:
525
526 wxWindow* m_frame; // the window being managed
527 wxDockArt* m_art; // dock art object which does all drawing
528 unsigned int m_flags; // manager flags wxAUI_MGR_*
529
530 wxPaneInfoArray m_panes; // array of panes structures
531 wxDockInfoArray m_docks; // array of docks structures
532 wxDockUIPartArray m_uiparts; // array of UI parts (captions, buttons, etc)
533
534 int m_action; // current mouse action
535 wxPoint m_action_start; // position where the action click started
536 wxPoint m_action_offset; // offset from upper left of the item clicked
537 wxDockUIPart* m_action_part; // ptr to the part the action happened to
538 wxWindow* m_action_window; // action frame or window (NULL if none)
539 wxRect m_action_hintrect; // hint rectangle for the action
540 wxDockUIPart* m_hover_button;// button uipart being hovered over
541 wxRect m_last_hint; // last hint rectangle
542 wxPoint m_last_mouse_move; // last mouse move position (see OnMotion)
543
544 wxFrame* m_hint_wnd; // transparent hint window, if supported by platform
545 wxTimer m_hint_fadetimer; // transparent fade timer
546 wxByte m_hint_fadeamt; // transparent fade amount
547 wxByte m_hint_fademax; // maximum value of hint fade
548
549 #ifndef SWIG
550 DECLARE_EVENT_TABLE()
551 #endif // SWIG
552 };
553
554
555
556 // event declarations/classes
557
558 class WXDLLIMPEXP_AUI wxFrameManagerEvent : public wxEvent
559 {
560 public:
561 wxFrameManagerEvent(wxEventType type=wxEVT_NULL) : wxEvent(0, type)
562 {
563 pane = NULL;
564 button = 0;
565 veto_flag = false;
566 canveto_flag = true;
567 dc = NULL;
568 }
569 #ifndef SWIG
570 wxFrameManagerEvent(const wxFrameManagerEvent& c) : wxEvent(c)
571 {
572 pane = c.pane;
573 button = c.button;
574 veto_flag = c.veto_flag;
575 canveto_flag = c.canveto_flag;
576 dc = c.dc;
577 }
578 #endif
579 wxEvent *Clone() const { return new wxFrameManagerEvent(*this); }
580
581 void SetPane(wxPaneInfo* p) { pane = p; }
582 void SetButton(int b) { button = b; }
583 void SetDC(wxDC* pdc) { dc = pdc; }
584
585 wxPaneInfo* GetPane() { return pane; }
586 int GetButton() { return button; }
587 wxDC* GetDC() { return dc; }
588
589 void Veto(bool veto = true) { veto_flag = veto; }
590 bool GetVeto() const { return veto_flag; }
591 void SetCanVeto(bool can_veto) { canveto_flag = can_veto; }
592 bool CanVeto() const { return canveto_flag && veto_flag; }
593
594 public:
595 wxPaneInfo* pane;
596 int button;
597 bool veto_flag;
598 bool canveto_flag;
599 wxDC* dc;
600
601 #ifndef SWIG
602 private:
603 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxFrameManagerEvent)
604 #endif
605 };
606
607
608 class WXDLLIMPEXP_AUI wxDockInfo
609 {
610 public:
611 wxDockInfo()
612 {
613 dock_direction = 0;
614 dock_layer = 0;
615 dock_row = 0;
616 size = 0;
617 min_size = 0;
618 resizable = true;
619 fixed = false;
620 toolbar = false;
621 }
622
623 #ifndef SWIG
624 wxDockInfo(const wxDockInfo& c)
625 {
626 dock_direction = c.dock_direction;
627 dock_layer = c.dock_layer;
628 dock_row = c.dock_row;
629 size = c.size;
630 min_size = c.min_size;
631 resizable = c.resizable;
632 fixed = c.fixed;
633 toolbar = c.toolbar;
634 panes = c.panes;
635 rect = c.rect;
636 }
637
638 wxDockInfo& operator=(const wxDockInfo& c)
639 {
640 dock_direction = c.dock_direction;
641 dock_layer = c.dock_layer;
642 dock_row = c.dock_row;
643 size = c.size;
644 min_size = c.min_size;
645 resizable = c.resizable;
646 fixed = c.fixed;
647 toolbar = c.toolbar;
648 panes = c.panes;
649 rect = c.rect;
650 return *this;
651 }
652 #endif // SWIG
653
654 bool IsOk() const { return (dock_direction != 0) ? true : false; }
655 bool IsHorizontal() const { return (dock_direction == wxAUI_DOCK_TOP ||
656 dock_direction == wxAUI_DOCK_BOTTOM) ? true:false; }
657 bool IsVertical() const { return (dock_direction == wxAUI_DOCK_LEFT ||
658 dock_direction == wxAUI_DOCK_RIGHT ||
659 dock_direction == wxAUI_DOCK_CENTER) ? true:false; }
660 public:
661 wxPaneInfoPtrArray panes; // array of panes
662 wxRect rect; // current rectangle
663 int dock_direction; // dock direction (top, bottom, left, right, center)
664 int dock_layer; // layer number (0 = innermost layer)
665 int dock_row; // row number on the docking bar (0 = first row)
666 int size; // size of the dock
667 int min_size; // minimum size of a dock (0 if there is no min)
668 bool resizable; // flag indicating whether the dock is resizable
669 bool toolbar; // flag indicating dock contains only toolbars
670 bool fixed; // flag indicating that the dock operates on
671 // absolute coordinates as opposed to proportional
672 };
673
674
675 class WXDLLIMPEXP_AUI wxDockUIPart
676 {
677 public:
678 enum
679 {
680 typeCaption,
681 typeGripper,
682 typeDock,
683 typeDockSizer,
684 typePane,
685 typePaneSizer,
686 typeBackground,
687 typePaneBorder,
688 typePaneButton
689 };
690
691 int type; // ui part type (see enum above)
692 int orientation; // orientation (either wxHORIZONTAL or wxVERTICAL)
693 wxDockInfo* dock; // which dock the item is associated with
694 wxPaneInfo* pane; // which pane the item is associated with
695 wxPaneButton* button; // which pane button the item is associated with
696 wxSizer* cont_sizer; // the part's containing sizer
697 wxSizerItem* sizer_item; // the sizer item of the part
698 wxRect rect; // client coord rectangle of the part itself
699 };
700
701
702 class WXDLLIMPEXP_AUI wxPaneButton
703 {
704 public:
705 int button_id; // id of the button (e.g. buttonClose)
706 };
707
708
709
710 #ifndef SWIG
711 // wx event machinery
712
713 BEGIN_DECLARE_EVENT_TYPES()
714 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_AUI_PANEBUTTON, 0)
715 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_AUI_PANECLOSE, 0)
716 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_AUI_RENDER, 0)
717 END_DECLARE_EVENT_TYPES()
718
719 typedef void (wxEvtHandler::*wxFrameManagerEventFunction)(wxFrameManagerEvent&);
720
721 #define wxFrameManagerEventHandler(func) \
722 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxFrameManagerEventFunction, &func)
723
724 #define EVT_AUI_PANEBUTTON(func) \
725 wx__DECLARE_EVT0(wxEVT_AUI_PANEBUTTON, wxFrameManagerEventHandler(func))
726 #define EVT_AUI_PANECLOSE(func) \
727 wx__DECLARE_EVT0(wxEVT_AUI_PANECLOSE, wxFrameManagerEventHandler(func))
728 #define EVT_AUI_RENDER(func) \
729 wx__DECLARE_EVT0(wxEVT_AUI_RENDER, wxFrameManagerEventHandler(func))
730
731 #else
732
733 %constant wxEventType wxEVT_AUI_PANEBUTTON;
734 %constant wxEventType wxEVT_AUI_PANECLOSE;
735 %constant wxEventType wxEVT_AUI_RENDER;
736
737 %pythoncode {
738 EVT_AUI_PANEBUTTON = wx.PyEventBinder( wxEVT_AUI_PANEBUTTON )
739 EVT_AUI_PANECLOSE = wx.PyEventBinder( wxEVT_AUI_PANECLOSE )
740 EVT_AUI_RENDER = wx.PyEventBinder( wxEVT_AUI_RENDER )
741 }
742 #endif // SWIG
743
744 #endif // wxUSE_AUI
745 #endif //_WX_FRAMEMANAGER_H_
746