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: framemanager.h 57885 2009-01-07 14:51:49Z JS $
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 wxAuiManagerDock
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 wxAuiManagerOption
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_VENETIAN_BLINDS_HINT     = 1 << 4,
47     wxAUI_MGR_RECTANGLE_HINT           = 1 << 5,
48     wxAUI_MGR_HINT_FADE                = 1 << 6,
49     wxAUI_MGR_NO_VENETIAN_BLINDS_FADE  = 1 << 7,
50     wxAUI_MGR_LIVE_RESIZE              = 1 << 8,
51 
52     wxAUI_MGR_DEFAULT = wxAUI_MGR_ALLOW_FLOATING |
53                         wxAUI_MGR_TRANSPARENT_HINT |
54                         wxAUI_MGR_HINT_FADE |
55                         wxAUI_MGR_NO_VENETIAN_BLINDS_FADE
56 };
57 
58 
59 enum wxAuiPaneDockArtSetting
60 {
61     wxAUI_DOCKART_SASH_SIZE = 0,
62     wxAUI_DOCKART_CAPTION_SIZE = 1,
63     wxAUI_DOCKART_GRIPPER_SIZE = 2,
64     wxAUI_DOCKART_PANE_BORDER_SIZE = 3,
65     wxAUI_DOCKART_PANE_BUTTON_SIZE = 4,
66     wxAUI_DOCKART_BACKGROUND_COLOUR = 5,
67     wxAUI_DOCKART_SASH_COLOUR = 6,
68     wxAUI_DOCKART_ACTIVE_CAPTION_COLOUR = 7,
69     wxAUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR = 8,
70     wxAUI_DOCKART_INACTIVE_CAPTION_COLOUR = 9,
71     wxAUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR = 10,
72     wxAUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR = 11,
73     wxAUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR = 12,
74     wxAUI_DOCKART_BORDER_COLOUR = 13,
75     wxAUI_DOCKART_GRIPPER_COLOUR = 14,
76     wxAUI_DOCKART_CAPTION_FONT = 15,
77     wxAUI_DOCKART_GRADIENT_TYPE = 16
78 };
79 
80 enum wxAuiPaneDockArtGradients
81 {
82     wxAUI_GRADIENT_NONE = 0,
83     wxAUI_GRADIENT_VERTICAL = 1,
84     wxAUI_GRADIENT_HORIZONTAL = 2
85 };
86 
87 enum wxAuiPaneButtonState
88 {
89     wxAUI_BUTTON_STATE_NORMAL   = 0,
90     wxAUI_BUTTON_STATE_HOVER    = 1 << 1,
91     wxAUI_BUTTON_STATE_PRESSED  = 1 << 2,
92     wxAUI_BUTTON_STATE_DISABLED = 1 << 3,
93     wxAUI_BUTTON_STATE_HIDDEN   = 1 << 4,
94     wxAUI_BUTTON_STATE_CHECKED  = 1 << 5
95 };
96 
97 enum wxAuiButtonId
98 {
99     wxAUI_BUTTON_CLOSE = 101,
100     wxAUI_BUTTON_MAXIMIZE_RESTORE = 102,
101     wxAUI_BUTTON_MINIMIZE = 103,
102     wxAUI_BUTTON_PIN = 104,
103     wxAUI_BUTTON_OPTIONS = 105,
104     wxAUI_BUTTON_WINDOWLIST = 106,
105     wxAUI_BUTTON_LEFT = 107,
106     wxAUI_BUTTON_RIGHT = 108,
107     wxAUI_BUTTON_UP = 109,
108     wxAUI_BUTTON_DOWN = 110,
109     wxAUI_BUTTON_CUSTOM1 = 201,
110     wxAUI_BUTTON_CUSTOM2 = 202,
111     wxAUI_BUTTON_CUSTOM3 = 203
112 };
113 
114 enum wxAuiPaneInsertLevel
115 {
116     wxAUI_INSERT_PANE = 0,
117     wxAUI_INSERT_ROW = 1,
118     wxAUI_INSERT_DOCK = 2
119 };
120 
121 
122 
123 
124 // forwards and array declarations
125 class wxAuiDockUIPart;
126 class wxAuiPaneButton;
127 class wxAuiPaneInfo;
128 class wxAuiDockInfo;
129 class wxAuiDockArt;
130 class wxAuiManagerEvent;
131 
132 #ifndef SWIG
133 WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiDockInfo, wxAuiDockInfoArray, WXDLLIMPEXP_AUI);
134 WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiDockUIPart, wxAuiDockUIPartArray, WXDLLIMPEXP_AUI);
135 WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiPaneButton, wxAuiPaneButtonArray, WXDLLIMPEXP_AUI);
136 WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiPaneInfo, wxAuiPaneInfoArray, WXDLLIMPEXP_AUI);
137 WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxAuiPaneInfo*, wxAuiPaneInfoPtrArray, class WXDLLIMPEXP_AUI);
138 WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxAuiDockInfo*, wxAuiDockInfoPtrArray, class WXDLLIMPEXP_AUI);
139 #endif // SWIG
140 
141 extern WXDLLIMPEXP_AUI wxAuiDockInfo wxAuiNullDockInfo;
142 extern WXDLLIMPEXP_AUI wxAuiPaneInfo wxAuiNullPaneInfo;
143 
144 
145 
146 class WXDLLIMPEXP_AUI wxAuiPaneInfo
147 {
148 public:
149 
wxAuiPaneInfo()150     wxAuiPaneInfo()
151     {
152         window = NULL;
153         frame = NULL;
154         state = 0;
155         dock_direction = wxAUI_DOCK_LEFT;
156         dock_layer = 0;
157         dock_row = 0;
158         dock_pos = 0;
159         floating_pos = wxDefaultPosition;
160         floating_size = wxDefaultSize;
161         best_size = wxDefaultSize;
162         min_size = wxDefaultSize;
163         max_size = wxDefaultSize;
164         dock_proportion = 0;
165 
166         DefaultPane();
167     }
168 
~wxAuiPaneInfo()169     ~wxAuiPaneInfo() {}
170 
171 #ifndef SWIG
wxAuiPaneInfo(const wxAuiPaneInfo & c)172     wxAuiPaneInfo(const wxAuiPaneInfo& c)
173     {
174         name = c.name;
175         caption = c.caption;
176         window = c.window;
177         frame = c.frame;
178         state = c.state;
179         dock_direction = c.dock_direction;
180         dock_layer = c.dock_layer;
181         dock_row = c.dock_row;
182         dock_pos = c.dock_pos;
183         best_size = c.best_size;
184         min_size = c.min_size;
185         max_size = c.max_size;
186         floating_pos = c.floating_pos;
187         floating_size = c.floating_size;
188         dock_proportion = c.dock_proportion;
189         buttons = c.buttons;
190         rect = c.rect;
191     }
192 
193     wxAuiPaneInfo& operator=(const wxAuiPaneInfo& c)
194     {
195         name = c.name;
196         caption = c.caption;
197         window = c.window;
198         frame = c.frame;
199         state = c.state;
200         dock_direction = c.dock_direction;
201         dock_layer = c.dock_layer;
202         dock_row = c.dock_row;
203         dock_pos = c.dock_pos;
204         best_size = c.best_size;
205         min_size = c.min_size;
206         max_size = c.max_size;
207         floating_pos = c.floating_pos;
208         floating_size = c.floating_size;
209         dock_proportion = c.dock_proportion;
210         buttons = c.buttons;
211         rect = c.rect;
212         return *this;
213     }
214 #endif // SWIG
215 
216     // Write the safe parts of a newly loaded PaneInfo structure "source" into "this"
217     // used on loading perspectives etc.
SafeSet(wxAuiPaneInfo source)218     void SafeSet(wxAuiPaneInfo source)
219     {
220         // note source is not passed by reference so we can overwrite, to keep the
221         // unsafe bits of "dest"
222         source.window = window;
223         source.frame = frame;
224         source.buttons = buttons;
225         // now assign
226         *this = source;
227     }
228 
IsOk()229     bool IsOk() const { return (window != NULL) ? true : false; }
IsFixed()230     bool IsFixed() const { return !HasFlag(optionResizable); }
IsResizable()231     bool IsResizable() const { return HasFlag(optionResizable); }
IsShown()232     bool IsShown() const { return !HasFlag(optionHidden); }
IsFloating()233     bool IsFloating() const { return HasFlag(optionFloating); }
IsDocked()234     bool IsDocked() const { return !HasFlag(optionFloating); }
IsToolbar()235     bool IsToolbar() const { return HasFlag(optionToolbar); }
IsTopDockable()236     bool IsTopDockable() const { return HasFlag(optionTopDockable); }
IsBottomDockable()237     bool IsBottomDockable() const { return HasFlag(optionBottomDockable); }
IsLeftDockable()238     bool IsLeftDockable() const { return HasFlag(optionLeftDockable); }
IsRightDockable()239     bool IsRightDockable() const { return HasFlag(optionRightDockable); }
IsFloatable()240     bool IsFloatable() const { return HasFlag(optionFloatable); }
IsMovable()241     bool IsMovable() const { return HasFlag(optionMovable); }
IsDestroyOnClose()242     bool IsDestroyOnClose() const { return HasFlag(optionDestroyOnClose); }
IsMaximized()243     bool IsMaximized() const { return HasFlag(optionMaximized); }
HasCaption()244     bool HasCaption() const { return HasFlag(optionCaption); }
HasGripper()245     bool HasGripper() const { return HasFlag(optionGripper); }
HasBorder()246     bool HasBorder() const { return HasFlag(optionPaneBorder); }
HasCloseButton()247     bool HasCloseButton() const { return HasFlag(buttonClose); }
HasMaximizeButton()248     bool HasMaximizeButton() const { return HasFlag(buttonMaximize); }
HasMinimizeButton()249     bool HasMinimizeButton() const { return HasFlag(buttonMinimize); }
HasPinButton()250     bool HasPinButton() const { return HasFlag(buttonPin); }
HasGripperTop()251     bool HasGripperTop() const { return HasFlag(optionGripperTop); }
252 
253 #ifdef SWIG
254     %typemap(out) wxAuiPaneInfo& { $result = $self; Py_INCREF($result); }
255 #endif
Window(wxWindow * w)256     wxAuiPaneInfo& Window(wxWindow* w) { window = w; return *this; }
Name(const wxString & n)257     wxAuiPaneInfo& Name(const wxString& n) { name = n; return *this; }
Caption(const wxString & c)258     wxAuiPaneInfo& Caption(const wxString& c) { caption = c; return *this; }
Left()259     wxAuiPaneInfo& Left() { dock_direction = wxAUI_DOCK_LEFT; return *this; }
Right()260     wxAuiPaneInfo& Right() { dock_direction = wxAUI_DOCK_RIGHT; return *this; }
Top()261     wxAuiPaneInfo& Top() { dock_direction = wxAUI_DOCK_TOP; return *this; }
Bottom()262     wxAuiPaneInfo& Bottom() { dock_direction = wxAUI_DOCK_BOTTOM; return *this; }
Center()263     wxAuiPaneInfo& Center() { dock_direction = wxAUI_DOCK_CENTER; return *this; }
Centre()264     wxAuiPaneInfo& Centre() { dock_direction = wxAUI_DOCK_CENTRE; return *this; }
Direction(int direction)265     wxAuiPaneInfo& Direction(int direction) { dock_direction = direction; return *this; }
Layer(int layer)266     wxAuiPaneInfo& Layer(int layer) { dock_layer = layer; return *this; }
Row(int row)267     wxAuiPaneInfo& Row(int row) { dock_row = row; return *this; }
Position(int pos)268     wxAuiPaneInfo& Position(int pos) { dock_pos = pos; return *this; }
BestSize(const wxSize & size)269     wxAuiPaneInfo& BestSize(const wxSize& size) { best_size = size; return *this; }
MinSize(const wxSize & size)270     wxAuiPaneInfo& MinSize(const wxSize& size) { min_size = size; return *this; }
MaxSize(const wxSize & size)271     wxAuiPaneInfo& MaxSize(const wxSize& size) { max_size = size; return *this; }
BestSize(int x,int y)272     wxAuiPaneInfo& BestSize(int x, int y) { best_size.Set(x,y); return *this; }
MinSize(int x,int y)273     wxAuiPaneInfo& MinSize(int x, int y) { min_size.Set(x,y); return *this; }
MaxSize(int x,int y)274     wxAuiPaneInfo& MaxSize(int x, int y) { max_size.Set(x,y); return *this; }
FloatingPosition(const wxPoint & pos)275     wxAuiPaneInfo& FloatingPosition(const wxPoint& pos) { floating_pos = pos; return *this; }
FloatingPosition(int x,int y)276     wxAuiPaneInfo& FloatingPosition(int x, int y) { floating_pos.x = x; floating_pos.y = y; return *this; }
FloatingSize(const wxSize & size)277     wxAuiPaneInfo& FloatingSize(const wxSize& size) { floating_size = size; return *this; }
FloatingSize(int x,int y)278     wxAuiPaneInfo& FloatingSize(int x, int y) { floating_size.Set(x,y); return *this; }
Fixed()279     wxAuiPaneInfo& Fixed() { return SetFlag(optionResizable, false); }
280     wxAuiPaneInfo& Resizable(bool resizable = true) { return SetFlag(optionResizable, resizable); }
Dock()281     wxAuiPaneInfo& Dock() { return SetFlag(optionFloating, false); }
Float()282     wxAuiPaneInfo& Float() { return SetFlag(optionFloating, true); }
Hide()283     wxAuiPaneInfo& Hide() { return SetFlag(optionHidden, true); }
284     wxAuiPaneInfo& Show(bool show = true) { return SetFlag(optionHidden, !show); }
285     wxAuiPaneInfo& CaptionVisible(bool visible = true) { return SetFlag(optionCaption, visible); }
Maximize()286     wxAuiPaneInfo& Maximize() { return SetFlag(optionMaximized, true); }
Restore()287     wxAuiPaneInfo& Restore() { return SetFlag(optionMaximized, false); }
288     wxAuiPaneInfo& PaneBorder(bool visible = true) { return SetFlag(optionPaneBorder, visible); }
289     wxAuiPaneInfo& Gripper(bool visible = true) { return SetFlag(optionGripper, visible); }
290     wxAuiPaneInfo& GripperTop(bool attop = true) { return SetFlag(optionGripperTop, attop); }
291     wxAuiPaneInfo& CloseButton(bool visible = true) { return SetFlag(buttonClose, visible); }
292     wxAuiPaneInfo& MaximizeButton(bool visible = true) { return SetFlag(buttonMaximize, visible); }
293     wxAuiPaneInfo& MinimizeButton(bool visible = true) { return SetFlag(buttonMinimize, visible); }
294     wxAuiPaneInfo& PinButton(bool visible = true) { return SetFlag(buttonPin, visible); }
295     wxAuiPaneInfo& DestroyOnClose(bool b = true) { return SetFlag(optionDestroyOnClose, b); }
296     wxAuiPaneInfo& TopDockable(bool b = true) { return SetFlag(optionTopDockable, b); }
297     wxAuiPaneInfo& BottomDockable(bool b = true) { return SetFlag(optionBottomDockable, b); }
298     wxAuiPaneInfo& LeftDockable(bool b = true) { return SetFlag(optionLeftDockable, b); }
299     wxAuiPaneInfo& RightDockable(bool b = true) { return SetFlag(optionRightDockable, b); }
300     wxAuiPaneInfo& Floatable(bool b = true) { return SetFlag(optionFloatable, b); }
301     wxAuiPaneInfo& Movable(bool b = true) { return SetFlag(optionMovable, b); }
302 #if wxABI_VERSION >= 20807
303     wxAuiPaneInfo& DockFixed(bool b = true) { return SetFlag(optionDockFixed, b); }
304 #endif
305 
306     wxAuiPaneInfo& Dockable(bool b = true)
307     {
308         return TopDockable(b).BottomDockable(b).LeftDockable(b).RightDockable(b);
309     }
310 
DefaultPane()311     wxAuiPaneInfo& DefaultPane()
312     {
313         state |= optionTopDockable | optionBottomDockable |
314                  optionLeftDockable | optionRightDockable |
315                  optionFloatable | optionMovable | optionResizable |
316                  optionCaption | optionPaneBorder | buttonClose;
317         return *this;
318     }
319 
CentrePane()320     wxAuiPaneInfo& CentrePane() { return CenterPane(); }
CenterPane()321     wxAuiPaneInfo& CenterPane()
322     {
323         state = 0;
324         return Center().PaneBorder().Resizable();
325     }
326 
ToolbarPane()327     wxAuiPaneInfo& ToolbarPane()
328     {
329         DefaultPane();
330         state |= (optionToolbar | optionGripper);
331         state &= ~(optionResizable | optionCaption);
332         if (dock_layer == 0)
333             dock_layer = 10;
334         return *this;
335     }
336 
SetFlag(unsigned int flag,bool option_state)337     wxAuiPaneInfo& SetFlag(unsigned int flag, bool option_state)
338     {
339         if (option_state)
340             state |= flag;
341              else
342             state &= ~flag;
343         return *this;
344     }
345 
HasFlag(unsigned int flag)346     bool HasFlag(unsigned int flag) const
347     {
348         return (state & flag) ? true:false;
349     }
350 
351 #ifdef SWIG
352     %typemap(out) wxAuiPaneInfo& ;
353 #endif
354 
355 public:
356 
357     // NOTE: You can add and subtract flags from this list,
358     // but do not change the values of the flags, because
359     // they are stored in a binary integer format in the
360     // perspective string.  If you really need to change the
361     // values around, you'll have to ensure backwards-compatibility
362     // in the perspective loading code.
363     enum wxAuiPaneState
364     {
365         optionFloating        = 1 << 0,
366         optionHidden          = 1 << 1,
367         optionLeftDockable    = 1 << 2,
368         optionRightDockable   = 1 << 3,
369         optionTopDockable     = 1 << 4,
370         optionBottomDockable  = 1 << 5,
371         optionFloatable       = 1 << 6,
372         optionMovable         = 1 << 7,
373         optionResizable       = 1 << 8,
374         optionPaneBorder      = 1 << 9,
375         optionCaption         = 1 << 10,
376         optionGripper         = 1 << 11,
377         optionDestroyOnClose  = 1 << 12,
378         optionToolbar         = 1 << 13,
379         optionActive          = 1 << 14,
380         optionGripperTop      = 1 << 15,
381         optionMaximized       = 1 << 16,
382         optionDockFixed       = 1 << 17,
383 
384         buttonClose           = 1 << 21,
385         buttonMaximize        = 1 << 22,
386         buttonMinimize        = 1 << 23,
387         buttonPin             = 1 << 24,
388 
389         buttonCustom1         = 1 << 26,
390         buttonCustom2         = 1 << 27,
391         buttonCustom3         = 1 << 28,
392 
393         savedHiddenState      = 1 << 30, // used internally
394         actionPane            = 1 << 31  // used internally
395     };
396 
397 public:
398     wxString name;        // name of the pane
399     wxString caption;     // caption displayed on the window
400 
401     wxWindow* window;     // window that is in this pane
402     wxFrame* frame;       // floating frame window that holds the pane
403     unsigned int state;   // a combination of wxPaneState values
404 
405     int dock_direction;   // dock direction (top, bottom, left, right, center)
406     int dock_layer;       // layer number (0 = innermost layer)
407     int dock_row;         // row number on the docking bar (0 = first row)
408     int dock_pos;         // position inside the row (0 = first position)
409 
410     wxSize best_size;     // size that the layout engine will prefer
411     wxSize min_size;      // minimum size the pane window can tolerate
412     wxSize max_size;      // maximum size the pane window can tolerate
413 
414     wxPoint floating_pos; // position while floating
415     wxSize floating_size; // size while floating
416     int dock_proportion;  // proportion while docked
417 
418     wxAuiPaneButtonArray buttons; // buttons on the pane
419 
420     wxRect rect;              // current rectangle (populated by wxAUI)
421 };
422 
423 
424 
425 class WXDLLIMPEXP_FWD_AUI wxAuiFloatingFrame;
426 
427 class WXDLLIMPEXP_AUI wxAuiManager : public wxEvtHandler
428 {
429 friend class wxAuiFloatingFrame;
430 
431 public:
432 
433     wxAuiManager(wxWindow* managed_wnd = NULL,
434                    unsigned int flags = wxAUI_MGR_DEFAULT);
435     virtual ~wxAuiManager();
436     void UnInit();
437 
438     void SetFlags(unsigned int flags);
439     unsigned int GetFlags() const;
440 
441     void SetManagedWindow(wxWindow* managed_wnd);
442     wxWindow* GetManagedWindow() const;
443 
444     static wxAuiManager* GetManager(wxWindow* window);
445 
446     void SetArtProvider(wxAuiDockArt* art_provider);
447     wxAuiDockArt* GetArtProvider() const;
448 
449     wxAuiPaneInfo& GetPane(wxWindow* window);
450     wxAuiPaneInfo& GetPane(const wxString& name);
451     wxAuiPaneInfoArray& GetAllPanes();
452 
453     bool AddPane(wxWindow* window,
454                  const wxAuiPaneInfo& pane_info);
455 
456     bool AddPane(wxWindow* window,
457                  const wxAuiPaneInfo& pane_info,
458                  const wxPoint& drop_pos);
459 
460     bool AddPane(wxWindow* window,
461                  int direction = wxLEFT,
462                  const wxString& caption = wxEmptyString);
463 
464     bool InsertPane(wxWindow* window,
465                  const wxAuiPaneInfo& insert_location,
466                  int insert_level = wxAUI_INSERT_PANE);
467 
468     bool DetachPane(wxWindow* window);
469 
470     void Update();
471 
472     wxString SavePaneInfo(wxAuiPaneInfo& pane);
473     void LoadPaneInfo(wxString pane_part, wxAuiPaneInfo &pane);
474     wxString SavePerspective();
475     bool LoadPerspective(const wxString& perspective, bool update = true);
476 
477     void SetDockSizeConstraint(double width_pct, double height_pct);
478     void GetDockSizeConstraint(double* width_pct, double* height_pct) const;
479 
480     void ClosePane(wxAuiPaneInfo& pane_info);
481     void MaximizePane(wxAuiPaneInfo& pane_info);
482     void RestorePane(wxAuiPaneInfo& pane_info);
483     void RestoreMaximizedPane();
484 
485 public:
486 
487     virtual wxAuiFloatingFrame* CreateFloatingFrame(wxWindow* parent, const wxAuiPaneInfo& p);
488 
489     void StartPaneDrag(
490                  wxWindow* pane_window,
491                  const wxPoint& offset);
492 
493     wxRect CalculateHintRect(
494                  wxWindow* pane_window,
495                  const wxPoint& pt,
496                  const wxPoint& offset);
497 
498     void DrawHintRect(
499                  wxWindow* pane_window,
500                  const wxPoint& pt,
501                  const wxPoint& offset);
502 
503     virtual void ShowHint(const wxRect& rect);
504     virtual void HideHint();
505 
506 public:
507 
508     // deprecated -- please use SetManagedWindow() and
509     // and GetManagedWindow() instead
510 
511     wxDEPRECATED( void SetFrame(wxFrame* frame) );
512     wxDEPRECATED( wxFrame* GetFrame() const );
513 
514 protected:
515 
516     void UpdateHintWindowConfig();
517 
518     void DoFrameLayout();
519 
520     void LayoutAddPane(wxSizer* container,
521                        wxAuiDockInfo& dock,
522                        wxAuiPaneInfo& pane,
523                        wxAuiDockUIPartArray& uiparts,
524                        bool spacer_only);
525 
526     void LayoutAddDock(wxSizer* container,
527                        wxAuiDockInfo& dock,
528                        wxAuiDockUIPartArray& uiparts,
529                        bool spacer_only);
530 
531     wxSizer* LayoutAll(wxAuiPaneInfoArray& panes,
532                        wxAuiDockInfoArray& docks,
533                        wxAuiDockUIPartArray& uiparts,
534                        bool spacer_only = false);
535 
536     virtual bool ProcessDockResult(wxAuiPaneInfo& target,
537                                    const wxAuiPaneInfo& new_pos);
538 
539     bool DoDrop(wxAuiDockInfoArray& docks,
540                 wxAuiPaneInfoArray& panes,
541                 wxAuiPaneInfo& drop,
542                 const wxPoint& pt,
543                 const wxPoint& action_offset = wxPoint(0,0));
544 
545     wxAuiDockUIPart* HitTest(int x, int y);
546     wxAuiDockUIPart* GetPanePart(wxWindow* pane);
547     int GetDockPixelOffset(wxAuiPaneInfo& test);
548     void OnFloatingPaneMoveStart(wxWindow* window);
549     void OnFloatingPaneMoving(wxWindow* window, wxDirection dir );
550     void OnFloatingPaneMoved(wxWindow* window, wxDirection dir);
551     void OnFloatingPaneActivated(wxWindow* window);
552     void OnFloatingPaneClosed(wxWindow* window, wxCloseEvent& evt);
553     void OnFloatingPaneResized(wxWindow* window, const wxSize& size);
554     void Render(wxDC* dc);
555     void Repaint(wxDC* dc = NULL);
556     void ProcessMgrEvent(wxAuiManagerEvent& event);
557     void UpdateButtonOnScreen(wxAuiDockUIPart* button_ui_part,
558                               const wxMouseEvent& event);
559     void GetPanePositionsAndSizes(wxAuiDockInfo& dock,
560                               wxArrayInt& positions,
561                               wxArrayInt& sizes);
562 
563 #if wxABI_VERSION >= 20810
564     /// Ends a resize action, or for live update, resizes the sash
565     bool DoEndResizeAction(wxMouseEvent& event);
566 #endif
567 
568 public:
569 
570     // public events (which can be invoked externally)
571     void OnRender(wxAuiManagerEvent& evt);
572     void OnPaneButton(wxAuiManagerEvent& evt);
573 
574 protected:
575 
576     // protected events
577     void OnPaint(wxPaintEvent& evt);
578     void OnEraseBackground(wxEraseEvent& evt);
579     void OnSize(wxSizeEvent& evt);
580     void OnSetCursor(wxSetCursorEvent& evt);
581     void OnLeftDown(wxMouseEvent& evt);
582     void OnLeftUp(wxMouseEvent& evt);
583     void OnMotion(wxMouseEvent& evt);
584     void OnLeaveWindow(wxMouseEvent& evt);
585     void OnChildFocus(wxChildFocusEvent& evt);
586     void OnHintFadeTimer(wxTimerEvent& evt);
587     void OnFindManager(wxAuiManagerEvent& evt);
588 
589 protected:
590 
591     enum
592     {
593         actionNone = 0,
594         actionResize,
595         actionClickButton,
596         actionClickCaption,
597         actionDragToolbarPane,
598         actionDragFloatingPane
599     };
600 
601 protected:
602 
603     wxWindow* m_frame;           // the window being managed
604     wxAuiDockArt* m_art;            // dock art object which does all drawing
605     unsigned int m_flags;        // manager flags wxAUI_MGR_*
606 
607     wxAuiPaneInfoArray m_panes;     // array of panes structures
608     wxAuiDockInfoArray m_docks;     // array of docks structures
609     wxAuiDockUIPartArray m_uiparts; // array of UI parts (captions, buttons, etc)
610 
611     int m_action;                // current mouse action
612     wxPoint m_action_start;      // position where the action click started
613     wxPoint m_action_offset;     // offset from upper left of the item clicked
614     wxAuiDockUIPart* m_action_part; // ptr to the part the action happened to
615     wxWindow* m_action_window;   // action frame or window (NULL if none)
616     wxRect m_action_hintrect;    // hint rectangle for the action
617     wxRect m_last_rect;
618     wxAuiDockUIPart* m_hover_button;// button uipart being hovered over
619     wxRect m_last_hint;          // last hint rectangle
620     wxPoint m_last_mouse_move;   // last mouse move position (see OnMotion)
621     bool m_skipping;
622     bool m_has_maximized;
623 
624     double m_dock_constraint_x;  // 0.0 .. 1.0; max pct of window width a dock can consume
625     double m_dock_constraint_y;  // 0.0 .. 1.0; max pct of window height a dock can consume
626 
627     wxFrame* m_hint_wnd;         // transparent hint window, if supported by platform
628     wxTimer m_hint_fadetimer;    // transparent fade timer
629     wxByte m_hint_fadeamt;       // transparent fade amount
630     wxByte m_hint_fademax;       // maximum value of hint fade
631 
632     void* m_reserved;
633 
634 #ifndef SWIG
635     DECLARE_EVENT_TABLE()
636     DECLARE_CLASS(wxAuiManager)
637 #endif // SWIG
638 };
639 
640 
641 
642 // event declarations/classes
643 
644 class WXDLLIMPEXP_AUI wxAuiManagerEvent : public wxEvent
645 {
646 public:
647     wxAuiManagerEvent(wxEventType type=wxEVT_NULL) : wxEvent(0, type)
648     {
649         manager = NULL;
650         pane = NULL;
651         button = 0;
652         veto_flag = false;
653         canveto_flag = true;
654         dc = NULL;
655     }
656 #ifndef SWIG
wxAuiManagerEvent(const wxAuiManagerEvent & c)657     wxAuiManagerEvent(const wxAuiManagerEvent& c) : wxEvent(c)
658     {
659         manager = c.manager;
660         pane = c.pane;
661         button = c.button;
662         veto_flag = c.veto_flag;
663         canveto_flag = c.canveto_flag;
664         dc = c.dc;
665     }
666 #endif
Clone()667     wxEvent *Clone() const { return new wxAuiManagerEvent(*this); }
668 
SetManager(wxAuiManager * mgr)669     void SetManager(wxAuiManager* mgr) { manager = mgr; }
SetPane(wxAuiPaneInfo * p)670     void SetPane(wxAuiPaneInfo* p) { pane = p; }
SetButton(int b)671     void SetButton(int b) { button = b; }
SetDC(wxDC * pdc)672     void SetDC(wxDC* pdc) { dc = pdc; }
673 
GetManager()674     wxAuiManager* GetManager() const { return manager; }
GetPane()675     wxAuiPaneInfo* GetPane() const { return pane; }
GetButton()676     int GetButton() const { return button; }
GetDC()677     wxDC* GetDC() const { return dc; }
678 
679     void Veto(bool veto = true) { veto_flag = veto; }
GetVeto()680     bool GetVeto() const { return veto_flag; }
SetCanVeto(bool can_veto)681     void SetCanVeto(bool can_veto) { canveto_flag = can_veto; }
CanVeto()682     bool CanVeto() const { return  canveto_flag && veto_flag; }
683 
684 public:
685     wxAuiManager* manager;
686     wxAuiPaneInfo* pane;
687     int button;
688     bool veto_flag;
689     bool canveto_flag;
690     wxDC* dc;
691 
692 #ifndef SWIG
693 private:
694     DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxAuiManagerEvent)
695 #endif
696 };
697 
698 
699 class WXDLLIMPEXP_AUI wxAuiDockInfo
700 {
701 public:
wxAuiDockInfo()702     wxAuiDockInfo()
703     {
704         dock_direction = 0;
705         dock_layer = 0;
706         dock_row = 0;
707         size = 0;
708         min_size = 0;
709         resizable = true;
710         fixed = false;
711         toolbar = false;
712         reserved1 = false;
713     }
714 
715 #ifndef SWIG
wxAuiDockInfo(const wxAuiDockInfo & c)716     wxAuiDockInfo(const wxAuiDockInfo& c)
717     {
718         dock_direction = c.dock_direction;
719         dock_layer = c.dock_layer;
720         dock_row = c.dock_row;
721         size = c.size;
722         min_size = c.min_size;
723         resizable = c.resizable;
724         fixed = c.fixed;
725         toolbar = c.toolbar;
726         panes = c.panes;
727         rect = c.rect;
728         reserved1 = c.reserved1;
729     }
730 
731     wxAuiDockInfo& operator=(const wxAuiDockInfo& c)
732     {
733         dock_direction = c.dock_direction;
734         dock_layer = c.dock_layer;
735         dock_row = c.dock_row;
736         size = c.size;
737         min_size = c.min_size;
738         resizable = c.resizable;
739         fixed = c.fixed;
740         toolbar = c.toolbar;
741         panes = c.panes;
742         rect = c.rect;
743         reserved1 = c.reserved1;
744         return *this;
745     }
746 #endif // SWIG
747 
IsOk()748     bool IsOk() const { return (dock_direction != 0) ? true : false; }
IsHorizontal()749     bool IsHorizontal() const { return (dock_direction == wxAUI_DOCK_TOP ||
750                              dock_direction == wxAUI_DOCK_BOTTOM) ? true:false; }
IsVertical()751     bool IsVertical() const { return (dock_direction == wxAUI_DOCK_LEFT ||
752                              dock_direction == wxAUI_DOCK_RIGHT ||
753                              dock_direction == wxAUI_DOCK_CENTER) ? true:false; }
754 public:
755     wxAuiPaneInfoPtrArray panes; // array of panes
756     wxRect rect;              // current rectangle
757     int dock_direction;       // dock direction (top, bottom, left, right, center)
758     int dock_layer;           // layer number (0 = innermost layer)
759     int dock_row;             // row number on the docking bar (0 = first row)
760     int size;                 // size of the dock
761     int min_size;             // minimum size of a dock (0 if there is no min)
762     bool resizable;           // flag indicating whether the dock is resizable
763     bool toolbar;             // flag indicating dock contains only toolbars
764     bool fixed;               // flag indicating that the dock operates on
765                               // absolute coordinates as opposed to proportional
766     bool reserved1;
767 };
768 
769 
770 class WXDLLIMPEXP_AUI wxAuiDockUIPart
771 {
772 public:
773     enum
774     {
775         typeCaption,
776         typeGripper,
777         typeDock,
778         typeDockSizer,
779         typePane,
780         typePaneSizer,
781         typeBackground,
782         typePaneBorder,
783         typePaneButton
784     };
785 
786     int type;                // ui part type (see enum above)
787     int orientation;         // orientation (either wxHORIZONTAL or wxVERTICAL)
788     wxAuiDockInfo* dock;        // which dock the item is associated with
789     wxAuiPaneInfo* pane;        // which pane the item is associated with
790     wxAuiPaneButton* button;    // which pane button the item is associated with
791     wxSizer* cont_sizer;     // the part's containing sizer
792     wxSizerItem* sizer_item; // the sizer item of the part
793     wxRect rect;             // client coord rectangle of the part itself
794 };
795 
796 
797 class WXDLLIMPEXP_AUI wxAuiPaneButton
798 {
799 public:
800     int button_id;        // id of the button (e.g. buttonClose)
801 };
802 
803 
804 
805 #ifndef SWIG
806 // wx event machinery
807 
808 BEGIN_DECLARE_EVENT_TYPES()
809     DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_AUI_PANE_BUTTON, 0)
810     DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_AUI_PANE_CLOSE, 0)
811     DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_AUI_PANE_MAXIMIZE, 0)
812     DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_AUI_PANE_RESTORE, 0)
813     DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_AUI_RENDER, 0)
814     DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_AUI_FIND_MANAGER, 0)
815 END_DECLARE_EVENT_TYPES()
816 
817 typedef void (wxEvtHandler::*wxAuiManagerEventFunction)(wxAuiManagerEvent&);
818 
819 #define wxAuiManagerEventHandler(func) \
820     (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxAuiManagerEventFunction, &func)
821 
822 #define EVT_AUI_PANE_BUTTON(func) \
823    wx__DECLARE_EVT0(wxEVT_AUI_PANE_BUTTON, wxAuiManagerEventHandler(func))
824 #define EVT_AUI_PANE_CLOSE(func) \
825    wx__DECLARE_EVT0(wxEVT_AUI_PANE_CLOSE, wxAuiManagerEventHandler(func))
826 #define EVT_AUI_PANE_MAXIMIZE(func) \
827    wx__DECLARE_EVT0(wxEVT_AUI_PANE_MAXIMIZE, wxAuiManagerEventHandler(func))
828 #define EVT_AUI_PANE_RESTORE(func) \
829    wx__DECLARE_EVT0(wxEVT_AUI_PANE_RESTORE, wxAuiManagerEventHandler(func))
830 #define EVT_AUI_RENDER(func) \
831    wx__DECLARE_EVT0(wxEVT_AUI_RENDER, wxAuiManagerEventHandler(func))
832 #define EVT_AUI_FIND_MANAGER(func) \
833    wx__DECLARE_EVT0(wxEVT_AUI_FIND_MANAGER, wxAuiManagerEventHandler(func))
834 
835 #else
836 
837 %constant wxEventType wxEVT_AUI_PANE_BUTTON;
838 %constant wxEventType wxEVT_AUI_PANE_CLOSE;
839 %constant wxEventType wxEVT_AUI_PANE_MAXIMIZE;
840 %constant wxEventType wxEVT_AUI_PANE_RESTORE;
841 %constant wxEventType wxEVT_AUI_RENDER;
842 %constant wxEventType wxEVT_AUI_FIND_MANAGER;
843 
844 %pythoncode {
845     EVT_AUI_PANE_BUTTON = wx.PyEventBinder( wxEVT_AUI_PANE_BUTTON )
846     EVT_AUI_PANE_CLOSE = wx.PyEventBinder( wxEVT_AUI_PANE_CLOSE )
847     EVT_AUI_PANE_MAXIMIZE = wx.PyEventBinder( wxEVT_AUI_PANE_MAXIMIZE )
848     EVT_AUI_PANE_RESTORE = wx.PyEventBinder( wxEVT_AUI_PANE_RESTORE )
849     EVT_AUI_RENDER = wx.PyEventBinder( wxEVT_AUI_RENDER )
850     EVT_AUI_FIND_MANAGER = wx.PyEventBinder( wxEVT_AUI_FIND_MANAGER )
851 }
852 #endif // SWIG
853 
854 #endif // wxUSE_AUI
855 #endif //_WX_FRAMEMANAGER_H_
856 
857