1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/aui/framemanager.h
3 // Purpose: wxaui: wx advanced user interface - docking window manager
4 // Author: Benjamin I. Williams
8 // Copyright: (C) Copyright 2005, Kirix Corporation, All Rights Reserved.
9 // Licence: wxWindows Library Licence, Version 3.1
10 ///////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_FRAMEMANAGER_H_
13 #define _WX_FRAMEMANAGER_H_
15 // ----------------------------------------------------------------------------
17 // ----------------------------------------------------------------------------
23 #include "wx/dynarray.h"
24 #include "wx/gdicmn.h"
25 #include "wx/window.h"
28 #include "wx/bitmap.h"
35 wxAUI_DOCK_BOTTOM
= 3,
37 wxAUI_DOCK_CENTER
= 5,
38 wxAUI_DOCK_CENTRE
= wxAUI_DOCK_CENTER
41 enum wxAuiManagerOption
43 wxAUI_MGR_ALLOW_FLOATING
= 1 << 0,
44 wxAUI_MGR_ALLOW_ACTIVE_PANE
= 1 << 1,
45 wxAUI_MGR_TRANSPARENT_DRAG
= 1 << 2,
46 wxAUI_MGR_TRANSPARENT_HINT
= 1 << 3,
47 wxAUI_MGR_VENETIAN_BLINDS_HINT
= 1 << 4,
48 wxAUI_MGR_RECTANGLE_HINT
= 1 << 5,
49 wxAUI_MGR_HINT_FADE
= 1 << 6,
50 wxAUI_MGR_NO_VENETIAN_BLINDS_FADE
= 1 << 7,
51 wxAUI_MGR_LIVE_RESIZE
= 1 << 8,
53 wxAUI_MGR_DEFAULT
= wxAUI_MGR_ALLOW_FLOATING
|
54 wxAUI_MGR_TRANSPARENT_HINT
|
56 wxAUI_MGR_NO_VENETIAN_BLINDS_FADE
60 enum wxAuiPaneDockArtSetting
62 wxAUI_DOCKART_SASH_SIZE
= 0,
63 wxAUI_DOCKART_CAPTION_SIZE
= 1,
64 wxAUI_DOCKART_GRIPPER_SIZE
= 2,
65 wxAUI_DOCKART_PANE_BORDER_SIZE
= 3,
66 wxAUI_DOCKART_PANE_BUTTON_SIZE
= 4,
67 wxAUI_DOCKART_BACKGROUND_COLOUR
= 5,
68 wxAUI_DOCKART_SASH_COLOUR
= 6,
69 wxAUI_DOCKART_ACTIVE_CAPTION_COLOUR
= 7,
70 wxAUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR
= 8,
71 wxAUI_DOCKART_INACTIVE_CAPTION_COLOUR
= 9,
72 wxAUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR
= 10,
73 wxAUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR
= 11,
74 wxAUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR
= 12,
75 wxAUI_DOCKART_BORDER_COLOUR
= 13,
76 wxAUI_DOCKART_GRIPPER_COLOUR
= 14,
77 wxAUI_DOCKART_CAPTION_FONT
= 15,
78 wxAUI_DOCKART_GRADIENT_TYPE
= 16
81 enum wxAuiPaneDockArtGradients
83 wxAUI_GRADIENT_NONE
= 0,
84 wxAUI_GRADIENT_VERTICAL
= 1,
85 wxAUI_GRADIENT_HORIZONTAL
= 2
88 enum wxAuiPaneButtonState
90 wxAUI_BUTTON_STATE_NORMAL
= 0,
91 wxAUI_BUTTON_STATE_HOVER
= 1 << 1,
92 wxAUI_BUTTON_STATE_PRESSED
= 1 << 2,
93 wxAUI_BUTTON_STATE_DISABLED
= 1 << 3,
94 wxAUI_BUTTON_STATE_HIDDEN
= 1 << 4,
95 wxAUI_BUTTON_STATE_CHECKED
= 1 << 5
100 wxAUI_BUTTON_CLOSE
= 101,
101 wxAUI_BUTTON_MAXIMIZE_RESTORE
= 102,
102 wxAUI_BUTTON_MINIMIZE
= 103,
103 wxAUI_BUTTON_PIN
= 104,
104 wxAUI_BUTTON_OPTIONS
= 105,
105 wxAUI_BUTTON_WINDOWLIST
= 106,
106 wxAUI_BUTTON_LEFT
= 107,
107 wxAUI_BUTTON_RIGHT
= 108,
108 wxAUI_BUTTON_UP
= 109,
109 wxAUI_BUTTON_DOWN
= 110,
110 wxAUI_BUTTON_CUSTOM1
= 201,
111 wxAUI_BUTTON_CUSTOM2
= 202,
112 wxAUI_BUTTON_CUSTOM3
= 203
115 enum wxAuiPaneInsertLevel
117 wxAUI_INSERT_PANE
= 0,
118 wxAUI_INSERT_ROW
= 1,
119 wxAUI_INSERT_DOCK
= 2
125 // forwards and array declarations
126 class wxAuiDockUIPart
;
127 class wxAuiPaneButton
;
131 class wxAuiManagerEvent
;
134 WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiDockInfo
, wxAuiDockInfoArray
, WXDLLIMPEXP_AUI
);
135 WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiDockUIPart
, wxAuiDockUIPartArray
, WXDLLIMPEXP_AUI
);
136 WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiPaneButton
, wxAuiPaneButtonArray
, WXDLLIMPEXP_AUI
);
137 WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiPaneInfo
, wxAuiPaneInfoArray
, WXDLLIMPEXP_AUI
);
138 WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxAuiPaneInfo
*, wxAuiPaneInfoPtrArray
, class WXDLLIMPEXP_AUI
);
139 WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxAuiDockInfo
*, wxAuiDockInfoPtrArray
, class WXDLLIMPEXP_AUI
);
142 extern WXDLLIMPEXP_AUI wxAuiDockInfo wxAuiNullDockInfo
;
143 extern WXDLLIMPEXP_AUI wxAuiPaneInfo wxAuiNullPaneInfo
;
147 class WXDLLIMPEXP_AUI wxAuiPaneInfo
156 dock_direction
= wxAUI_DOCK_LEFT
;
160 floating_pos
= wxDefaultPosition
;
161 floating_size
= wxDefaultSize
;
162 best_size
= wxDefaultSize
;
163 min_size
= wxDefaultSize
;
164 max_size
= wxDefaultSize
;
173 wxAuiPaneInfo(const wxAuiPaneInfo
& c
)
181 dock_direction
= c
.dock_direction
;
182 dock_layer
= c
.dock_layer
;
183 dock_row
= c
.dock_row
;
184 dock_pos
= c
.dock_pos
;
185 best_size
= c
.best_size
;
186 min_size
= c
.min_size
;
187 max_size
= c
.max_size
;
188 floating_pos
= c
.floating_pos
;
189 floating_size
= c
.floating_size
;
190 dock_proportion
= c
.dock_proportion
;
195 wxAuiPaneInfo
& operator=(const wxAuiPaneInfo
& c
)
202 dock_direction
= c
.dock_direction
;
203 dock_layer
= c
.dock_layer
;
204 dock_row
= c
.dock_row
;
205 dock_pos
= c
.dock_pos
;
206 best_size
= c
.best_size
;
207 min_size
= c
.min_size
;
208 max_size
= c
.max_size
;
209 floating_pos
= c
.floating_pos
;
210 floating_size
= c
.floating_size
;
211 dock_proportion
= c
.dock_proportion
;
218 // Write the safe parts of a newly loaded PaneInfo structure "source" into "this"
219 // used on loading perspectives etc.
220 void SafeSet(wxAuiPaneInfo source
)
222 // note source is not passed by reference so we can overwrite, to keep the
223 // unsafe bits of "dest"
224 source
.window
= window
;
225 source
.frame
= frame
;
226 source
.buttons
= buttons
;
227 wxCHECK_RET(source
.IsValid(),
228 "window settings and pane settings are incompatible");
233 bool IsOk() const { return window
!= NULL
; }
234 bool IsFixed() const { return !HasFlag(optionResizable
); }
235 bool IsResizable() const { return HasFlag(optionResizable
); }
236 bool IsShown() const { return !HasFlag(optionHidden
); }
237 bool IsFloating() const { return HasFlag(optionFloating
); }
238 bool IsDocked() const { return !HasFlag(optionFloating
); }
239 bool IsToolbar() const { return HasFlag(optionToolbar
); }
240 bool IsTopDockable() const { return HasFlag(optionTopDockable
); }
241 bool IsBottomDockable() const { return HasFlag(optionBottomDockable
); }
242 bool IsLeftDockable() const { return HasFlag(optionLeftDockable
); }
243 bool IsRightDockable() const { return HasFlag(optionRightDockable
); }
244 bool IsDockable() const
246 return HasFlag(optionTopDockable
| optionBottomDockable
|
247 optionLeftDockable
| optionRightDockable
);
249 bool IsFloatable() const { return HasFlag(optionFloatable
); }
250 bool IsMovable() const { return HasFlag(optionMovable
); }
251 bool IsDestroyOnClose() const { return HasFlag(optionDestroyOnClose
); }
252 bool IsMaximized() const { return HasFlag(optionMaximized
); }
253 bool HasCaption() const { return HasFlag(optionCaption
); }
254 bool HasGripper() const { return HasFlag(optionGripper
); }
255 bool HasBorder() const { return HasFlag(optionPaneBorder
); }
256 bool HasCloseButton() const { return HasFlag(buttonClose
); }
257 bool HasMaximizeButton() const { return HasFlag(buttonMaximize
); }
258 bool HasMinimizeButton() const { return HasFlag(buttonMinimize
); }
259 bool HasPinButton() const { return HasFlag(buttonPin
); }
260 bool HasGripperTop() const { return HasFlag(optionGripperTop
); }
263 %typemap
(out
) wxAuiPaneInfo
& { $result
= $self
; Py_INCREF($result
); }
265 wxAuiPaneInfo
& Window(wxWindow
* w
)
267 wxAuiPaneInfo
test(*this);
269 wxCHECK_MSG(test
.IsValid(), *this,
270 "window settings and pane settings are incompatible");
274 wxAuiPaneInfo
& Name(const wxString
& n
) { name
= n
; return *this; }
275 wxAuiPaneInfo
& Caption(const wxString
& c
) { caption
= c
; return *this; }
276 wxAuiPaneInfo
& Icon(const wxBitmap
& b
) { icon
= b
; return *this; }
277 wxAuiPaneInfo
& Left() { dock_direction
= wxAUI_DOCK_LEFT
; return *this; }
278 wxAuiPaneInfo
& Right() { dock_direction
= wxAUI_DOCK_RIGHT
; return *this; }
279 wxAuiPaneInfo
& Top() { dock_direction
= wxAUI_DOCK_TOP
; return *this; }
280 wxAuiPaneInfo
& Bottom() { dock_direction
= wxAUI_DOCK_BOTTOM
; return *this; }
281 wxAuiPaneInfo
& Center() { dock_direction
= wxAUI_DOCK_CENTER
; return *this; }
282 wxAuiPaneInfo
& Centre() { dock_direction
= wxAUI_DOCK_CENTRE
; return *this; }
283 wxAuiPaneInfo
& Direction(int direction
) { dock_direction
= direction
; return *this; }
284 wxAuiPaneInfo
& Layer(int layer
) { dock_layer
= layer
; return *this; }
285 wxAuiPaneInfo
& Row(int row
) { dock_row
= row
; return *this; }
286 wxAuiPaneInfo
& Position(int pos
) { dock_pos
= pos
; return *this; }
287 wxAuiPaneInfo
& BestSize(const wxSize
& size
) { best_size
= size
; return *this; }
288 wxAuiPaneInfo
& MinSize(const wxSize
& size
) { min_size
= size
; return *this; }
289 wxAuiPaneInfo
& MaxSize(const wxSize
& size
) { max_size
= size
; return *this; }
290 wxAuiPaneInfo
& BestSize(int x
, int y
) { best_size
.Set(x
,y
); return *this; }
291 wxAuiPaneInfo
& MinSize(int x
, int y
) { min_size
.Set(x
,y
); return *this; }
292 wxAuiPaneInfo
& MaxSize(int x
, int y
) { max_size
.Set(x
,y
); return *this; }
293 wxAuiPaneInfo
& FloatingPosition(const wxPoint
& pos
) { floating_pos
= pos
; return *this; }
294 wxAuiPaneInfo
& FloatingPosition(int x
, int y
) { floating_pos
.x
= x
; floating_pos
.y
= y
; return *this; }
295 wxAuiPaneInfo
& FloatingSize(const wxSize
& size
) { floating_size
= size
; return *this; }
296 wxAuiPaneInfo
& FloatingSize(int x
, int y
) { floating_size
.Set(x
,y
); return *this; }
297 wxAuiPaneInfo
& Fixed() { return SetFlag(optionResizable
, false); }
298 wxAuiPaneInfo
& Resizable(bool resizable
= true) { return SetFlag(optionResizable
, resizable
); }
299 wxAuiPaneInfo
& Dock() { return SetFlag(optionFloating
, false); }
300 wxAuiPaneInfo
& Float() { return SetFlag(optionFloating
, true); }
301 wxAuiPaneInfo
& Hide() { return SetFlag(optionHidden
, true); }
302 wxAuiPaneInfo
& Show(bool show
= true) { return SetFlag(optionHidden
, !show
); }
303 wxAuiPaneInfo
& CaptionVisible(bool visible
= true) { return SetFlag(optionCaption
, visible
); }
304 wxAuiPaneInfo
& Maximize() { return SetFlag(optionMaximized
, true); }
305 wxAuiPaneInfo
& Restore() { return SetFlag(optionMaximized
, false); }
306 wxAuiPaneInfo
& PaneBorder(bool visible
= true) { return SetFlag(optionPaneBorder
, visible
); }
307 wxAuiPaneInfo
& Gripper(bool visible
= true) { return SetFlag(optionGripper
, visible
); }
308 wxAuiPaneInfo
& GripperTop(bool attop
= true) { return SetFlag(optionGripperTop
, attop
); }
309 wxAuiPaneInfo
& CloseButton(bool visible
= true) { return SetFlag(buttonClose
, visible
); }
310 wxAuiPaneInfo
& MaximizeButton(bool visible
= true) { return SetFlag(buttonMaximize
, visible
); }
311 wxAuiPaneInfo
& MinimizeButton(bool visible
= true) { return SetFlag(buttonMinimize
, visible
); }
312 wxAuiPaneInfo
& PinButton(bool visible
= true) { return SetFlag(buttonPin
, visible
); }
313 wxAuiPaneInfo
& DestroyOnClose(bool b
= true) { return SetFlag(optionDestroyOnClose
, b
); }
314 wxAuiPaneInfo
& TopDockable(bool b
= true) { return SetFlag(optionTopDockable
, b
); }
315 wxAuiPaneInfo
& BottomDockable(bool b
= true) { return SetFlag(optionBottomDockable
, b
); }
316 wxAuiPaneInfo
& LeftDockable(bool b
= true) { return SetFlag(optionLeftDockable
, b
); }
317 wxAuiPaneInfo
& RightDockable(bool b
= true) { return SetFlag(optionRightDockable
, b
); }
318 wxAuiPaneInfo
& Floatable(bool b
= true) { return SetFlag(optionFloatable
, b
); }
319 wxAuiPaneInfo
& Movable(bool b
= true) { return SetFlag(optionMovable
, b
); }
320 wxAuiPaneInfo
& DockFixed(bool b
= true) { return SetFlag(optionDockFixed
, b
); }
322 wxAuiPaneInfo
& Dockable(bool b
= true)
324 return TopDockable(b
).BottomDockable(b
).LeftDockable(b
).RightDockable(b
);
327 wxAuiPaneInfo
& DefaultPane()
329 wxAuiPaneInfo
test(*this);
330 test
.state
|= optionTopDockable
| optionBottomDockable
|
331 optionLeftDockable
| optionRightDockable
|
332 optionFloatable
| optionMovable
| optionResizable
|
333 optionCaption
| optionPaneBorder
| buttonClose
;
334 wxCHECK_MSG(test
.IsValid(), *this,
335 "window settings and pane settings are incompatible");
340 wxAuiPaneInfo
& CentrePane() { return CenterPane(); }
341 wxAuiPaneInfo
& CenterPane()
344 return Center().PaneBorder().Resizable();
347 wxAuiPaneInfo
& ToolbarPane()
350 state
|= (optionToolbar
| optionGripper
);
351 state
&= ~(optionResizable
| optionCaption
);
357 wxAuiPaneInfo
& SetFlag(int flag
, bool option_state
)
359 wxAuiPaneInfo
test(*this);
364 wxCHECK_MSG(test
.IsValid(), *this,
365 "window settings and pane settings are incompatible");
370 bool HasFlag(int flag
) const
372 return (state
& flag
) != 0;
376 %typemap
(out
) wxAuiPaneInfo
& ;
381 // NOTE: You can add and subtract flags from this list,
382 // but do not change the values of the flags, because
383 // they are stored in a binary integer format in the
384 // perspective string. If you really need to change the
385 // values around, you'll have to ensure backwards-compatibility
386 // in the perspective loading code.
389 optionFloating
= 1 << 0,
390 optionHidden
= 1 << 1,
391 optionLeftDockable
= 1 << 2,
392 optionRightDockable
= 1 << 3,
393 optionTopDockable
= 1 << 4,
394 optionBottomDockable
= 1 << 5,
395 optionFloatable
= 1 << 6,
396 optionMovable
= 1 << 7,
397 optionResizable
= 1 << 8,
398 optionPaneBorder
= 1 << 9,
399 optionCaption
= 1 << 10,
400 optionGripper
= 1 << 11,
401 optionDestroyOnClose
= 1 << 12,
402 optionToolbar
= 1 << 13,
403 optionActive
= 1 << 14,
404 optionGripperTop
= 1 << 15,
405 optionMaximized
= 1 << 16,
406 optionDockFixed
= 1 << 17,
408 buttonClose
= 1 << 21,
409 buttonMaximize
= 1 << 22,
410 buttonMinimize
= 1 << 23,
413 buttonCustom1
= 1 << 26,
414 buttonCustom2
= 1 << 27,
415 buttonCustom3
= 1 << 28,
417 savedHiddenState
= 1 << 30, // used internally
418 actionPane
= 1 << 31 // used internally
422 wxString name
; // name of the pane
423 wxString caption
; // caption displayed on the window
424 wxBitmap icon
; // icon of the pane, may be invalid
426 wxWindow
* window
; // window that is in this pane
427 wxFrame
* frame
; // floating frame window that holds the pane
428 unsigned int state
; // a combination of wxPaneState values
430 int dock_direction
; // dock direction (top, bottom, left, right, center)
431 int dock_layer
; // layer number (0 = innermost layer)
432 int dock_row
; // row number on the docking bar (0 = first row)
433 int dock_pos
; // position inside the row (0 = first position)
435 wxSize best_size
; // size that the layout engine will prefer
436 wxSize min_size
; // minimum size the pane window can tolerate
437 wxSize max_size
; // maximum size the pane window can tolerate
439 wxPoint floating_pos
; // position while floating
440 wxSize floating_size
; // size while floating
441 int dock_proportion
; // proportion while docked
443 wxAuiPaneButtonArray buttons
; // buttons on the pane
446 wxRect rect
; // current rectangle (populated by wxAUI)
448 bool IsValid() const;
453 class WXDLLIMPEXP_FWD_AUI wxAuiFloatingFrame
;
455 class WXDLLIMPEXP_AUI wxAuiManager
: public wxEvtHandler
457 friend class wxAuiFloatingFrame
;
461 wxAuiManager(wxWindow
* managedWnd
= NULL
,
462 unsigned int flags
= wxAUI_MGR_DEFAULT
);
463 virtual ~wxAuiManager();
466 void SetFlags(unsigned int flags
);
467 unsigned int GetFlags() const;
469 void SetManagedWindow(wxWindow
* managedWnd
);
470 wxWindow
* GetManagedWindow() const;
472 static wxAuiManager
* GetManager(wxWindow
* window
);
474 void SetArtProvider(wxAuiDockArt
* artProvider
);
475 wxAuiDockArt
* GetArtProvider() const;
477 wxAuiPaneInfo
& GetPane(wxWindow
* window
);
478 wxAuiPaneInfo
& GetPane(const wxString
& name
);
479 wxAuiPaneInfoArray
& GetAllPanes();
481 bool AddPane(wxWindow
* window
,
482 const wxAuiPaneInfo
& paneInfo
);
484 bool AddPane(wxWindow
* window
,
485 const wxAuiPaneInfo
& paneInfo
,
486 const wxPoint
& dropPos
);
488 bool AddPane(wxWindow
* window
,
489 int direction
= wxLEFT
,
490 const wxString
& caption
= wxEmptyString
);
492 bool InsertPane(wxWindow
* window
,
493 const wxAuiPaneInfo
& insertLocation
,
494 int insertLevel
= wxAUI_INSERT_PANE
);
496 bool DetachPane(wxWindow
* window
);
500 wxString
SavePaneInfo(wxAuiPaneInfo
& pane
);
501 void LoadPaneInfo(wxString panePart
, wxAuiPaneInfo
&pane
);
502 wxString
SavePerspective();
503 bool LoadPerspective(const wxString
& perspective
, bool update
= true);
505 void SetDockSizeConstraint(double widthPct
, double heightPct
);
506 void GetDockSizeConstraint(double* widthPct
, double* heightPct
) const;
508 void ClosePane(wxAuiPaneInfo
& paneInfo
);
509 void MaximizePane(wxAuiPaneInfo
& paneInfo
);
510 void RestorePane(wxAuiPaneInfo
& paneInfo
);
511 void RestoreMaximizedPane();
515 virtual wxAuiFloatingFrame
* CreateFloatingFrame(wxWindow
* parent
, const wxAuiPaneInfo
& p
);
516 virtual bool CanDockPanel(const wxAuiPaneInfo
& p
);
519 wxWindow
* paneWindow
,
520 const wxPoint
& offset
);
522 wxRect
CalculateHintRect(
523 wxWindow
* paneWindow
,
525 const wxPoint
& offset
);
528 wxWindow
* paneWindow
,
530 const wxPoint
& offset
);
532 virtual void ShowHint(const wxRect
& rect
);
533 virtual void HideHint();
535 void OnHintActivate(wxActivateEvent
& event
);
539 // deprecated -- please use SetManagedWindow() and
540 // and GetManagedWindow() instead
542 wxDEPRECATED( void SetFrame(wxFrame
* frame
) );
543 wxDEPRECATED( wxFrame
* GetFrame() const );
547 void UpdateHintWindowConfig();
549 void DoFrameLayout();
551 void LayoutAddPane(wxSizer
* container
,
554 wxAuiDockUIPartArray
& uiparts
,
557 void LayoutAddDock(wxSizer
* container
,
559 wxAuiDockUIPartArray
& uiParts
,
562 wxSizer
* LayoutAll(wxAuiPaneInfoArray
& panes
,
563 wxAuiDockInfoArray
& docks
,
564 wxAuiDockUIPartArray
& uiParts
,
565 bool spacerOnly
= false);
567 virtual bool ProcessDockResult(wxAuiPaneInfo
& target
,
568 const wxAuiPaneInfo
& newPos
);
570 bool DoDrop(wxAuiDockInfoArray
& docks
,
571 wxAuiPaneInfoArray
& panes
,
574 const wxPoint
& actionOffset
= wxPoint(0,0));
576 wxAuiDockUIPart
* HitTest(int x
, int y
);
577 wxAuiDockUIPart
* GetPanePart(wxWindow
* pane
);
578 int GetDockPixelOffset(wxAuiPaneInfo
& test
);
579 void OnFloatingPaneMoveStart(wxWindow
* window
);
580 void OnFloatingPaneMoving(wxWindow
* window
, wxDirection dir
);
581 void OnFloatingPaneMoved(wxWindow
* window
, wxDirection dir
);
582 void OnFloatingPaneActivated(wxWindow
* window
);
583 void OnFloatingPaneClosed(wxWindow
* window
, wxCloseEvent
& evt
);
584 void OnFloatingPaneResized(wxWindow
* window
, const wxRect
& rect
);
585 void Render(wxDC
* dc
);
586 void Repaint(wxDC
* dc
= NULL
);
587 void ProcessMgrEvent(wxAuiManagerEvent
& event
);
588 void UpdateButtonOnScreen(wxAuiDockUIPart
* buttonUiPart
,
589 const wxMouseEvent
& event
);
590 void GetPanePositionsAndSizes(wxAuiDockInfo
& dock
,
591 wxArrayInt
& positions
,
594 /// Ends a resize action, or for live update, resizes the sash
595 bool DoEndResizeAction(wxMouseEvent
& event
);
599 // public events (which can be invoked externally)
600 void OnRender(wxAuiManagerEvent
& evt
);
601 void OnPaneButton(wxAuiManagerEvent
& evt
);
606 void OnPaint(wxPaintEvent
& evt
);
607 void OnEraseBackground(wxEraseEvent
& evt
);
608 void OnSize(wxSizeEvent
& evt
);
609 void OnSetCursor(wxSetCursorEvent
& evt
);
610 void OnLeftDown(wxMouseEvent
& evt
);
611 void OnLeftUp(wxMouseEvent
& evt
);
612 void OnMotion(wxMouseEvent
& evt
);
613 void OnCaptureLost(wxMouseCaptureLostEvent
& evt
);
614 void OnLeaveWindow(wxMouseEvent
& evt
);
615 void OnChildFocus(wxChildFocusEvent
& evt
);
616 void OnHintFadeTimer(wxTimerEvent
& evt
);
617 void OnFindManager(wxAuiManagerEvent
& evt
);
627 actionDragToolbarPane
,
628 actionDragFloatingPane
633 wxWindow
* m_frame
; // the window being managed
634 wxAuiDockArt
* m_art
; // dock art object which does all drawing
635 unsigned int m_flags
; // manager flags wxAUI_MGR_*
637 wxAuiPaneInfoArray m_panes
; // array of panes structures
638 wxAuiDockInfoArray m_docks
; // array of docks structures
639 wxAuiDockUIPartArray m_uiParts
; // array of UI parts (captions, buttons, etc)
641 int m_action
; // current mouse action
642 wxPoint m_actionStart
; // position where the action click started
643 wxPoint m_actionOffset
; // offset from upper left of the item clicked
644 wxAuiDockUIPart
* m_actionPart
; // ptr to the part the action happened to
645 wxWindow
* m_actionWindow
; // action frame or window (NULL if none)
646 wxRect m_actionHintRect
; // hint rectangle for the action
648 wxAuiDockUIPart
* m_hoverButton
;// button uipart being hovered over
649 wxRect m_lastHint
; // last hint rectangle
650 wxPoint m_lastMouseMove
; // last mouse move position (see OnMotion)
651 int m_currentDragItem
;
655 double m_dockConstraintX
; // 0.0 .. 1.0; max pct of window width a dock can consume
656 double m_dockConstraintY
; // 0.0 .. 1.0; max pct of window height a dock can consume
658 wxFrame
* m_hintWnd
; // transparent hint window, if supported by platform
659 wxTimer m_hintFadeTimer
; // transparent fade timer
660 wxByte m_hintFadeAmt
; // transparent fade amount
661 wxByte m_hintFadeMax
; // maximum value of hint fade
666 DECLARE_EVENT_TABLE()
667 DECLARE_CLASS(wxAuiManager
)
673 // event declarations/classes
675 class WXDLLIMPEXP_AUI wxAuiManagerEvent
: public wxEvent
678 wxAuiManagerEvent(wxEventType type
=wxEVT_NULL
) : wxEvent(0, type
)
688 wxAuiManagerEvent(const wxAuiManagerEvent
& c
) : wxEvent(c
)
693 veto_flag
= c
.veto_flag
;
694 canveto_flag
= c
.canveto_flag
;
698 wxEvent
*Clone() const { return new wxAuiManagerEvent(*this); }
700 void SetManager(wxAuiManager
* mgr
) { manager
= mgr
; }
701 void SetPane(wxAuiPaneInfo
* p
) { pane
= p
; }
702 void SetButton(int b
) { button
= b
; }
703 void SetDC(wxDC
* pdc
) { dc
= pdc
; }
705 wxAuiManager
* GetManager() const { return manager
; }
706 wxAuiPaneInfo
* GetPane() const { return pane
; }
707 int GetButton() const { return button
; }
708 wxDC
* GetDC() const { return dc
; }
710 void Veto(bool veto
= true) { veto_flag
= veto
; }
711 bool GetVeto() const { return veto_flag
; }
712 void SetCanVeto(bool can_veto
) { canveto_flag
= can_veto
; }
713 bool CanVeto() const { return canveto_flag
&& veto_flag
; }
716 wxAuiManager
* manager
;
725 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxAuiManagerEvent
)
730 class WXDLLIMPEXP_AUI wxAuiDockInfo
747 wxAuiDockInfo(const wxAuiDockInfo
& c
)
749 dock_direction
= c
.dock_direction
;
750 dock_layer
= c
.dock_layer
;
751 dock_row
= c
.dock_row
;
753 min_size
= c
.min_size
;
754 resizable
= c
.resizable
;
759 reserved1
= c
.reserved1
;
762 wxAuiDockInfo
& operator=(const wxAuiDockInfo
& c
)
764 dock_direction
= c
.dock_direction
;
765 dock_layer
= c
.dock_layer
;
766 dock_row
= c
.dock_row
;
768 min_size
= c
.min_size
;
769 resizable
= c
.resizable
;
774 reserved1
= c
.reserved1
;
779 bool IsOk() const { return dock_direction
!= 0; }
780 bool IsHorizontal() const { return dock_direction
== wxAUI_DOCK_TOP
||
781 dock_direction
== wxAUI_DOCK_BOTTOM
; }
782 bool IsVertical() const { return dock_direction
== wxAUI_DOCK_LEFT
||
783 dock_direction
== wxAUI_DOCK_RIGHT
||
784 dock_direction
== wxAUI_DOCK_CENTER
; }
786 wxAuiPaneInfoPtrArray panes
; // array of panes
787 wxRect rect
; // current rectangle
788 int dock_direction
; // dock direction (top, bottom, left, right, center)
789 int dock_layer
; // layer number (0 = innermost layer)
790 int dock_row
; // row number on the docking bar (0 = first row)
791 int size
; // size of the dock
792 int min_size
; // minimum size of a dock (0 if there is no min)
793 bool resizable
; // flag indicating whether the dock is resizable
794 bool toolbar
; // flag indicating dock contains only toolbars
795 bool fixed
; // flag indicating that the dock operates on
796 // absolute coordinates as opposed to proportional
801 class WXDLLIMPEXP_AUI wxAuiDockUIPart
817 int type
; // ui part type (see enum above)
818 int orientation
; // orientation (either wxHORIZONTAL or wxVERTICAL)
819 wxAuiDockInfo
* dock
; // which dock the item is associated with
820 wxAuiPaneInfo
* pane
; // which pane the item is associated with
821 wxAuiPaneButton
* button
; // which pane button the item is associated with
822 wxSizer
* cont_sizer
; // the part's containing sizer
823 wxSizerItem
* sizer_item
; // the sizer item of the part
824 wxRect rect
; // client coord rectangle of the part itself
828 class WXDLLIMPEXP_AUI wxAuiPaneButton
831 int button_id
; // id of the button (e.g. buttonClose)
838 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI
, wxEVT_AUI_PANE_BUTTON
, wxAuiManagerEvent
);
839 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI
, wxEVT_AUI_PANE_CLOSE
, wxAuiManagerEvent
);
840 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI
, wxEVT_AUI_PANE_MAXIMIZE
, wxAuiManagerEvent
);
841 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI
, wxEVT_AUI_PANE_RESTORE
, wxAuiManagerEvent
);
842 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI
, wxEVT_AUI_RENDER
, wxAuiManagerEvent
);
843 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI
, wxEVT_AUI_FIND_MANAGER
, wxAuiManagerEvent
);
845 typedef void (wxEvtHandler::*wxAuiManagerEventFunction
)(wxAuiManagerEvent
&);
847 #define wxAuiManagerEventHandler(func) \
848 wxEVENT_HANDLER_CAST(wxAuiManagerEventFunction, func)
850 #define EVT_AUI_PANE_BUTTON(func) \
851 wx__DECLARE_EVT0(wxEVT_AUI_PANE_BUTTON, wxAuiManagerEventHandler(func))
852 #define EVT_AUI_PANE_CLOSE(func) \
853 wx__DECLARE_EVT0(wxEVT_AUI_PANE_CLOSE, wxAuiManagerEventHandler(func))
854 #define EVT_AUI_PANE_MAXIMIZE(func) \
855 wx__DECLARE_EVT0(wxEVT_AUI_PANE_MAXIMIZE, wxAuiManagerEventHandler(func))
856 #define EVT_AUI_PANE_RESTORE(func) \
857 wx__DECLARE_EVT0(wxEVT_AUI_PANE_RESTORE, wxAuiManagerEventHandler(func))
858 #define EVT_AUI_RENDER(func) \
859 wx__DECLARE_EVT0(wxEVT_AUI_RENDER, wxAuiManagerEventHandler(func))
860 #define EVT_AUI_FIND_MANAGER(func) \
861 wx__DECLARE_EVT0(wxEVT_AUI_FIND_MANAGER, wxAuiManagerEventHandler(func))
865 %constant wxEventType wxEVT_AUI_PANE_BUTTON
;
866 %constant wxEventType wxEVT_AUI_PANE_CLOSE
;
867 %constant wxEventType wxEVT_AUI_PANE_MAXIMIZE
;
868 %constant wxEventType wxEVT_AUI_PANE_RESTORE
;
869 %constant wxEventType wxEVT_AUI_RENDER
;
870 %constant wxEventType wxEVT_AUI_FIND_MANAGER
;
873 EVT_AUI_PANE_BUTTON
= wx
.PyEventBinder( wxEVT_AUI_PANE_BUTTON
)
874 EVT_AUI_PANE_CLOSE
= wx
.PyEventBinder( wxEVT_AUI_PANE_CLOSE
)
875 EVT_AUI_PANE_MAXIMIZE
= wx
.PyEventBinder( wxEVT_AUI_PANE_MAXIMIZE
)
876 EVT_AUI_PANE_RESTORE
= wx
.PyEventBinder( wxEVT_AUI_PANE_RESTORE
)
877 EVT_AUI_RENDER
= wx
.PyEventBinder( wxEVT_AUI_RENDER
)
878 EVT_AUI_FIND_MANAGER
= wx
.PyEventBinder( wxEVT_AUI_FIND_MANAGER
)
883 #endif //_WX_FRAMEMANAGER_H_