1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/aui/framemanager.h
3 // Purpose: wxaui: wx advanced user interface - docking window manager
4 // Author: Benjamin I. Williams
7 // Copyright: (C) Copyright 2005, Kirix Corporation, All Rights Reserved.
8 // Licence: wxWindows Library Licence, Version 3.1
9 ///////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_FRAMEMANAGER_H_
12 #define _WX_FRAMEMANAGER_H_
14 // ----------------------------------------------------------------------------
16 // ----------------------------------------------------------------------------
22 #include "wx/dynarray.h"
23 #include "wx/gdicmn.h"
24 #include "wx/window.h"
27 #include "wx/bitmap.h"
34 wxAUI_DOCK_BOTTOM
= 3,
36 wxAUI_DOCK_CENTER
= 5,
37 wxAUI_DOCK_CENTRE
= wxAUI_DOCK_CENTER
40 enum wxAuiManagerOption
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,
52 wxAUI_MGR_DEFAULT
= wxAUI_MGR_ALLOW_FLOATING
|
53 wxAUI_MGR_TRANSPARENT_HINT
|
55 wxAUI_MGR_NO_VENETIAN_BLINDS_FADE
59 enum wxAuiPaneDockArtSetting
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
80 enum wxAuiPaneDockArtGradients
82 wxAUI_GRADIENT_NONE
= 0,
83 wxAUI_GRADIENT_VERTICAL
= 1,
84 wxAUI_GRADIENT_HORIZONTAL
= 2
87 enum wxAuiPaneButtonState
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
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
114 enum wxAuiPaneInsertLevel
116 wxAUI_INSERT_PANE
= 0,
117 wxAUI_INSERT_ROW
= 1,
118 wxAUI_INSERT_DOCK
= 2
124 // forwards and array declarations
125 class wxAuiDockUIPart
;
126 class wxAuiPaneButton
;
130 class wxAuiManagerEvent
;
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
);
141 extern WXDLLIMPEXP_AUI wxAuiDockInfo wxAuiNullDockInfo
;
142 extern WXDLLIMPEXP_AUI wxAuiPaneInfo wxAuiNullPaneInfo
;
146 class WXDLLIMPEXP_AUI wxAuiPaneInfo
155 dock_direction
= wxAUI_DOCK_LEFT
;
159 floating_pos
= wxDefaultPosition
;
160 floating_size
= wxDefaultSize
;
161 best_size
= wxDefaultSize
;
162 min_size
= wxDefaultSize
;
163 max_size
= wxDefaultSize
;
172 wxAuiPaneInfo(const wxAuiPaneInfo
& c
)
180 dock_direction
= c
.dock_direction
;
181 dock_layer
= c
.dock_layer
;
182 dock_row
= c
.dock_row
;
183 dock_pos
= c
.dock_pos
;
184 best_size
= c
.best_size
;
185 min_size
= c
.min_size
;
186 max_size
= c
.max_size
;
187 floating_pos
= c
.floating_pos
;
188 floating_size
= c
.floating_size
;
189 dock_proportion
= c
.dock_proportion
;
194 wxAuiPaneInfo
& operator=(const wxAuiPaneInfo
& c
)
201 dock_direction
= c
.dock_direction
;
202 dock_layer
= c
.dock_layer
;
203 dock_row
= c
.dock_row
;
204 dock_pos
= c
.dock_pos
;
205 best_size
= c
.best_size
;
206 min_size
= c
.min_size
;
207 max_size
= c
.max_size
;
208 floating_pos
= c
.floating_pos
;
209 floating_size
= c
.floating_size
;
210 dock_proportion
= c
.dock_proportion
;
217 // Write the safe parts of a newly loaded PaneInfo structure "source" into "this"
218 // used on loading perspectives etc.
219 void SafeSet(wxAuiPaneInfo source
)
221 // note source is not passed by reference so we can overwrite, to keep the
222 // unsafe bits of "dest"
223 source
.window
= window
;
224 source
.frame
= frame
;
225 source
.buttons
= buttons
;
226 wxCHECK_RET(source
.IsValid(),
227 "window settings and pane settings are incompatible");
232 bool IsOk() const { return window
!= NULL
; }
233 bool IsFixed() const { return !HasFlag(optionResizable
); }
234 bool IsResizable() const { return HasFlag(optionResizable
); }
235 bool IsShown() const { return !HasFlag(optionHidden
); }
236 bool IsFloating() const { return HasFlag(optionFloating
); }
237 bool IsDocked() const { return !HasFlag(optionFloating
); }
238 bool IsToolbar() const { return HasFlag(optionToolbar
); }
239 bool IsTopDockable() const { return HasFlag(optionTopDockable
); }
240 bool IsBottomDockable() const { return HasFlag(optionBottomDockable
); }
241 bool IsLeftDockable() const { return HasFlag(optionLeftDockable
); }
242 bool IsRightDockable() const { return HasFlag(optionRightDockable
); }
243 bool IsDockable() const
245 return HasFlag(optionTopDockable
| optionBottomDockable
|
246 optionLeftDockable
| optionRightDockable
);
248 bool IsFloatable() const { return HasFlag(optionFloatable
); }
249 bool IsMovable() const { return HasFlag(optionMovable
); }
250 bool IsDestroyOnClose() const { return HasFlag(optionDestroyOnClose
); }
251 bool IsMaximized() const { return HasFlag(optionMaximized
); }
252 bool HasCaption() const { return HasFlag(optionCaption
); }
253 bool HasGripper() const { return HasFlag(optionGripper
); }
254 bool HasBorder() const { return HasFlag(optionPaneBorder
); }
255 bool HasCloseButton() const { return HasFlag(buttonClose
); }
256 bool HasMaximizeButton() const { return HasFlag(buttonMaximize
); }
257 bool HasMinimizeButton() const { return HasFlag(buttonMinimize
); }
258 bool HasPinButton() const { return HasFlag(buttonPin
); }
259 bool HasGripperTop() const { return HasFlag(optionGripperTop
); }
262 %typemap
(out
) wxAuiPaneInfo
& { $result
= $self
; Py_INCREF($result
); }
264 wxAuiPaneInfo
& Window(wxWindow
* w
)
266 wxAuiPaneInfo
test(*this);
268 wxCHECK_MSG(test
.IsValid(), *this,
269 "window settings and pane settings are incompatible");
273 wxAuiPaneInfo
& Name(const wxString
& n
) { name
= n
; return *this; }
274 wxAuiPaneInfo
& Caption(const wxString
& c
) { caption
= c
; return *this; }
275 wxAuiPaneInfo
& Icon(const wxBitmap
& b
) { icon
= b
; return *this; }
276 wxAuiPaneInfo
& Left() { dock_direction
= wxAUI_DOCK_LEFT
; return *this; }
277 wxAuiPaneInfo
& Right() { dock_direction
= wxAUI_DOCK_RIGHT
; return *this; }
278 wxAuiPaneInfo
& Top() { dock_direction
= wxAUI_DOCK_TOP
; return *this; }
279 wxAuiPaneInfo
& Bottom() { dock_direction
= wxAUI_DOCK_BOTTOM
; return *this; }
280 wxAuiPaneInfo
& Center() { dock_direction
= wxAUI_DOCK_CENTER
; return *this; }
281 wxAuiPaneInfo
& Centre() { dock_direction
= wxAUI_DOCK_CENTRE
; return *this; }
282 wxAuiPaneInfo
& Direction(int direction
) { dock_direction
= direction
; return *this; }
283 wxAuiPaneInfo
& Layer(int layer
) { dock_layer
= layer
; return *this; }
284 wxAuiPaneInfo
& Row(int row
) { dock_row
= row
; return *this; }
285 wxAuiPaneInfo
& Position(int pos
) { dock_pos
= pos
; return *this; }
286 wxAuiPaneInfo
& BestSize(const wxSize
& size
) { best_size
= size
; return *this; }
287 wxAuiPaneInfo
& MinSize(const wxSize
& size
) { min_size
= size
; return *this; }
288 wxAuiPaneInfo
& MaxSize(const wxSize
& size
) { max_size
= size
; return *this; }
289 wxAuiPaneInfo
& BestSize(int x
, int y
) { best_size
.Set(x
,y
); return *this; }
290 wxAuiPaneInfo
& MinSize(int x
, int y
) { min_size
.Set(x
,y
); return *this; }
291 wxAuiPaneInfo
& MaxSize(int x
, int y
) { max_size
.Set(x
,y
); return *this; }
292 wxAuiPaneInfo
& FloatingPosition(const wxPoint
& pos
) { floating_pos
= pos
; return *this; }
293 wxAuiPaneInfo
& FloatingPosition(int x
, int y
) { floating_pos
.x
= x
; floating_pos
.y
= y
; return *this; }
294 wxAuiPaneInfo
& FloatingSize(const wxSize
& size
) { floating_size
= size
; return *this; }
295 wxAuiPaneInfo
& FloatingSize(int x
, int y
) { floating_size
.Set(x
,y
); return *this; }
296 wxAuiPaneInfo
& Fixed() { return SetFlag(optionResizable
, false); }
297 wxAuiPaneInfo
& Resizable(bool resizable
= true) { return SetFlag(optionResizable
, resizable
); }
298 wxAuiPaneInfo
& Dock() { return SetFlag(optionFloating
, false); }
299 wxAuiPaneInfo
& Float() { return SetFlag(optionFloating
, true); }
300 wxAuiPaneInfo
& Hide() { return SetFlag(optionHidden
, true); }
301 wxAuiPaneInfo
& Show(bool show
= true) { return SetFlag(optionHidden
, !show
); }
302 wxAuiPaneInfo
& CaptionVisible(bool visible
= true) { return SetFlag(optionCaption
, visible
); }
303 wxAuiPaneInfo
& Maximize() { return SetFlag(optionMaximized
, true); }
304 wxAuiPaneInfo
& Restore() { return SetFlag(optionMaximized
, false); }
305 wxAuiPaneInfo
& PaneBorder(bool visible
= true) { return SetFlag(optionPaneBorder
, visible
); }
306 wxAuiPaneInfo
& Gripper(bool visible
= true) { return SetFlag(optionGripper
, visible
); }
307 wxAuiPaneInfo
& GripperTop(bool attop
= true) { return SetFlag(optionGripperTop
, attop
); }
308 wxAuiPaneInfo
& CloseButton(bool visible
= true) { return SetFlag(buttonClose
, visible
); }
309 wxAuiPaneInfo
& MaximizeButton(bool visible
= true) { return SetFlag(buttonMaximize
, visible
); }
310 wxAuiPaneInfo
& MinimizeButton(bool visible
= true) { return SetFlag(buttonMinimize
, visible
); }
311 wxAuiPaneInfo
& PinButton(bool visible
= true) { return SetFlag(buttonPin
, visible
); }
312 wxAuiPaneInfo
& DestroyOnClose(bool b
= true) { return SetFlag(optionDestroyOnClose
, b
); }
313 wxAuiPaneInfo
& TopDockable(bool b
= true) { return SetFlag(optionTopDockable
, b
); }
314 wxAuiPaneInfo
& BottomDockable(bool b
= true) { return SetFlag(optionBottomDockable
, b
); }
315 wxAuiPaneInfo
& LeftDockable(bool b
= true) { return SetFlag(optionLeftDockable
, b
); }
316 wxAuiPaneInfo
& RightDockable(bool b
= true) { return SetFlag(optionRightDockable
, b
); }
317 wxAuiPaneInfo
& Floatable(bool b
= true) { return SetFlag(optionFloatable
, b
); }
318 wxAuiPaneInfo
& Movable(bool b
= true) { return SetFlag(optionMovable
, b
); }
319 wxAuiPaneInfo
& DockFixed(bool b
= true) { return SetFlag(optionDockFixed
, b
); }
321 wxAuiPaneInfo
& Dockable(bool b
= true)
323 return TopDockable(b
).BottomDockable(b
).LeftDockable(b
).RightDockable(b
);
326 wxAuiPaneInfo
& DefaultPane()
328 wxAuiPaneInfo
test(*this);
329 test
.state
|= optionTopDockable
| optionBottomDockable
|
330 optionLeftDockable
| optionRightDockable
|
331 optionFloatable
| optionMovable
| optionResizable
|
332 optionCaption
| optionPaneBorder
| buttonClose
;
333 wxCHECK_MSG(test
.IsValid(), *this,
334 "window settings and pane settings are incompatible");
339 wxAuiPaneInfo
& CentrePane() { return CenterPane(); }
340 wxAuiPaneInfo
& CenterPane()
343 return Center().PaneBorder().Resizable();
346 wxAuiPaneInfo
& ToolbarPane()
349 state
|= (optionToolbar
| optionGripper
);
350 state
&= ~(optionResizable
| optionCaption
);
356 wxAuiPaneInfo
& SetFlag(int flag
, bool option_state
)
358 wxAuiPaneInfo
test(*this);
363 wxCHECK_MSG(test
.IsValid(), *this,
364 "window settings and pane settings are incompatible");
369 bool HasFlag(int flag
) const
371 return (state
& flag
) != 0;
375 %typemap
(out
) wxAuiPaneInfo
& ;
380 // NOTE: You can add and subtract flags from this list,
381 // but do not change the values of the flags, because
382 // they are stored in a binary integer format in the
383 // perspective string. If you really need to change the
384 // values around, you'll have to ensure backwards-compatibility
385 // in the perspective loading code.
388 optionFloating
= 1 << 0,
389 optionHidden
= 1 << 1,
390 optionLeftDockable
= 1 << 2,
391 optionRightDockable
= 1 << 3,
392 optionTopDockable
= 1 << 4,
393 optionBottomDockable
= 1 << 5,
394 optionFloatable
= 1 << 6,
395 optionMovable
= 1 << 7,
396 optionResizable
= 1 << 8,
397 optionPaneBorder
= 1 << 9,
398 optionCaption
= 1 << 10,
399 optionGripper
= 1 << 11,
400 optionDestroyOnClose
= 1 << 12,
401 optionToolbar
= 1 << 13,
402 optionActive
= 1 << 14,
403 optionGripperTop
= 1 << 15,
404 optionMaximized
= 1 << 16,
405 optionDockFixed
= 1 << 17,
407 buttonClose
= 1 << 21,
408 buttonMaximize
= 1 << 22,
409 buttonMinimize
= 1 << 23,
412 buttonCustom1
= 1 << 26,
413 buttonCustom2
= 1 << 27,
414 buttonCustom3
= 1 << 28,
416 savedHiddenState
= 1 << 30, // used internally
417 actionPane
= 1 << 31 // used internally
421 wxString name
; // name of the pane
422 wxString caption
; // caption displayed on the window
423 wxBitmap icon
; // icon of the pane, may be invalid
425 wxWindow
* window
; // window that is in this pane
426 wxFrame
* frame
; // floating frame window that holds the pane
427 unsigned int state
; // a combination of wxPaneState values
429 int dock_direction
; // dock direction (top, bottom, left, right, center)
430 int dock_layer
; // layer number (0 = innermost layer)
431 int dock_row
; // row number on the docking bar (0 = first row)
432 int dock_pos
; // position inside the row (0 = first position)
434 wxSize best_size
; // size that the layout engine will prefer
435 wxSize min_size
; // minimum size the pane window can tolerate
436 wxSize max_size
; // maximum size the pane window can tolerate
438 wxPoint floating_pos
; // position while floating
439 wxSize floating_size
; // size while floating
440 int dock_proportion
; // proportion while docked
442 wxAuiPaneButtonArray buttons
; // buttons on the pane
445 wxRect rect
; // current rectangle (populated by wxAUI)
447 bool IsValid() const;
452 class WXDLLIMPEXP_FWD_AUI wxAuiFloatingFrame
;
454 class WXDLLIMPEXP_AUI wxAuiManager
: public wxEvtHandler
456 friend class wxAuiFloatingFrame
;
460 wxAuiManager(wxWindow
* managedWnd
= NULL
,
461 unsigned int flags
= wxAUI_MGR_DEFAULT
);
462 virtual ~wxAuiManager();
465 void SetFlags(unsigned int flags
);
466 unsigned int GetFlags() const;
468 void SetManagedWindow(wxWindow
* managedWnd
);
469 wxWindow
* GetManagedWindow() const;
471 static wxAuiManager
* GetManager(wxWindow
* window
);
473 void SetArtProvider(wxAuiDockArt
* artProvider
);
474 wxAuiDockArt
* GetArtProvider() const;
476 wxAuiPaneInfo
& GetPane(wxWindow
* window
);
477 wxAuiPaneInfo
& GetPane(const wxString
& name
);
478 wxAuiPaneInfoArray
& GetAllPanes();
480 bool AddPane(wxWindow
* window
,
481 const wxAuiPaneInfo
& paneInfo
);
483 bool AddPane(wxWindow
* window
,
484 const wxAuiPaneInfo
& paneInfo
,
485 const wxPoint
& dropPos
);
487 bool AddPane(wxWindow
* window
,
488 int direction
= wxLEFT
,
489 const wxString
& caption
= wxEmptyString
);
491 bool InsertPane(wxWindow
* window
,
492 const wxAuiPaneInfo
& insertLocation
,
493 int insertLevel
= wxAUI_INSERT_PANE
);
495 bool DetachPane(wxWindow
* window
);
499 wxString
SavePaneInfo(wxAuiPaneInfo
& pane
);
500 void LoadPaneInfo(wxString panePart
, wxAuiPaneInfo
&pane
);
501 wxString
SavePerspective();
502 bool LoadPerspective(const wxString
& perspective
, bool update
= true);
504 void SetDockSizeConstraint(double widthPct
, double heightPct
);
505 void GetDockSizeConstraint(double* widthPct
, double* heightPct
) const;
507 void ClosePane(wxAuiPaneInfo
& paneInfo
);
508 void MaximizePane(wxAuiPaneInfo
& paneInfo
);
509 void RestorePane(wxAuiPaneInfo
& paneInfo
);
510 void RestoreMaximizedPane();
514 virtual wxAuiFloatingFrame
* CreateFloatingFrame(wxWindow
* parent
, const wxAuiPaneInfo
& p
);
515 virtual bool CanDockPanel(const wxAuiPaneInfo
& p
);
518 wxWindow
* paneWindow
,
519 const wxPoint
& offset
);
521 wxRect
CalculateHintRect(
522 wxWindow
* paneWindow
,
524 const wxPoint
& offset
);
527 wxWindow
* paneWindow
,
529 const wxPoint
& offset
);
531 virtual void ShowHint(const wxRect
& rect
);
532 virtual void HideHint();
534 void OnHintActivate(wxActivateEvent
& event
);
538 // deprecated -- please use SetManagedWindow() and
539 // and GetManagedWindow() instead
541 wxDEPRECATED( void SetFrame(wxFrame
* frame
) );
542 wxDEPRECATED( wxFrame
* GetFrame() const );
546 void UpdateHintWindowConfig();
548 void DoFrameLayout();
550 void LayoutAddPane(wxSizer
* container
,
553 wxAuiDockUIPartArray
& uiparts
,
556 void LayoutAddDock(wxSizer
* container
,
558 wxAuiDockUIPartArray
& uiParts
,
561 wxSizer
* LayoutAll(wxAuiPaneInfoArray
& panes
,
562 wxAuiDockInfoArray
& docks
,
563 wxAuiDockUIPartArray
& uiParts
,
564 bool spacerOnly
= false);
566 virtual bool ProcessDockResult(wxAuiPaneInfo
& target
,
567 const wxAuiPaneInfo
& newPos
);
569 bool DoDrop(wxAuiDockInfoArray
& docks
,
570 wxAuiPaneInfoArray
& panes
,
573 const wxPoint
& actionOffset
= wxPoint(0,0));
575 wxAuiDockUIPart
* HitTest(int x
, int y
);
576 wxAuiDockUIPart
* GetPanePart(wxWindow
* pane
);
577 int GetDockPixelOffset(wxAuiPaneInfo
& test
);
578 void OnFloatingPaneMoveStart(wxWindow
* window
);
579 void OnFloatingPaneMoving(wxWindow
* window
, wxDirection dir
);
580 void OnFloatingPaneMoved(wxWindow
* window
, wxDirection dir
);
581 void OnFloatingPaneActivated(wxWindow
* window
);
582 void OnFloatingPaneClosed(wxWindow
* window
, wxCloseEvent
& evt
);
583 void OnFloatingPaneResized(wxWindow
* window
, const wxRect
& rect
);
584 void Render(wxDC
* dc
);
585 void Repaint(wxDC
* dc
= NULL
);
586 void ProcessMgrEvent(wxAuiManagerEvent
& event
);
587 void UpdateButtonOnScreen(wxAuiDockUIPart
* buttonUiPart
,
588 const wxMouseEvent
& event
);
589 void GetPanePositionsAndSizes(wxAuiDockInfo
& dock
,
590 wxArrayInt
& positions
,
593 /// Ends a resize action, or for live update, resizes the sash
594 bool DoEndResizeAction(wxMouseEvent
& event
);
596 void SetActivePane(wxWindow
* active_pane
);
600 // public events (which can be invoked externally)
601 void OnRender(wxAuiManagerEvent
& evt
);
602 void OnPaneButton(wxAuiManagerEvent
& evt
);
607 void OnPaint(wxPaintEvent
& evt
);
608 void OnEraseBackground(wxEraseEvent
& evt
);
609 void OnSize(wxSizeEvent
& evt
);
610 void OnSetCursor(wxSetCursorEvent
& evt
);
611 void OnLeftDown(wxMouseEvent
& evt
);
612 void OnLeftUp(wxMouseEvent
& evt
);
613 void OnMotion(wxMouseEvent
& evt
);
614 void OnCaptureLost(wxMouseCaptureLostEvent
& evt
);
615 void OnLeaveWindow(wxMouseEvent
& evt
);
616 void OnChildFocus(wxChildFocusEvent
& evt
);
617 void OnHintFadeTimer(wxTimerEvent
& evt
);
618 void OnFindManager(wxAuiManagerEvent
& evt
);
628 actionDragToolbarPane
,
629 actionDragFloatingPane
634 wxWindow
* m_frame
; // the window being managed
635 wxAuiDockArt
* m_art
; // dock art object which does all drawing
636 unsigned int m_flags
; // manager flags wxAUI_MGR_*
638 wxAuiPaneInfoArray m_panes
; // array of panes structures
639 wxAuiDockInfoArray m_docks
; // array of docks structures
640 wxAuiDockUIPartArray m_uiParts
; // array of UI parts (captions, buttons, etc)
642 int m_action
; // current mouse action
643 wxPoint m_actionStart
; // position where the action click started
644 wxPoint m_actionOffset
; // offset from upper left of the item clicked
645 wxAuiDockUIPart
* m_actionPart
; // ptr to the part the action happened to
646 wxWindow
* m_actionWindow
; // action frame or window (NULL if none)
647 wxRect m_actionHintRect
; // hint rectangle for the action
649 wxAuiDockUIPart
* m_hoverButton
;// button uipart being hovered over
650 wxRect m_lastHint
; // last hint rectangle
651 wxPoint m_lastMouseMove
; // last mouse move position (see OnMotion)
652 int m_currentDragItem
;
656 double m_dockConstraintX
; // 0.0 .. 1.0; max pct of window width a dock can consume
657 double m_dockConstraintY
; // 0.0 .. 1.0; max pct of window height a dock can consume
659 wxFrame
* m_hintWnd
; // transparent hint window, if supported by platform
660 wxTimer m_hintFadeTimer
; // transparent fade timer
661 wxByte m_hintFadeAmt
; // transparent fade amount
662 wxByte m_hintFadeMax
; // maximum value of hint fade
667 DECLARE_EVENT_TABLE()
668 DECLARE_CLASS(wxAuiManager
)
674 // event declarations/classes
676 class WXDLLIMPEXP_AUI wxAuiManagerEvent
: public wxEvent
679 wxAuiManagerEvent(wxEventType type
=wxEVT_NULL
) : wxEvent(0, type
)
689 wxAuiManagerEvent(const wxAuiManagerEvent
& c
) : wxEvent(c
)
694 veto_flag
= c
.veto_flag
;
695 canveto_flag
= c
.canveto_flag
;
699 wxEvent
*Clone() const { return new wxAuiManagerEvent(*this); }
701 void SetManager(wxAuiManager
* mgr
) { manager
= mgr
; }
702 void SetPane(wxAuiPaneInfo
* p
) { pane
= p
; }
703 void SetButton(int b
) { button
= b
; }
704 void SetDC(wxDC
* pdc
) { dc
= pdc
; }
706 wxAuiManager
* GetManager() const { return manager
; }
707 wxAuiPaneInfo
* GetPane() const { return pane
; }
708 int GetButton() const { return button
; }
709 wxDC
* GetDC() const { return dc
; }
711 void Veto(bool veto
= true) { veto_flag
= veto
; }
712 bool GetVeto() const { return veto_flag
; }
713 void SetCanVeto(bool can_veto
) { canveto_flag
= can_veto
; }
714 bool CanVeto() const { return canveto_flag
&& veto_flag
; }
717 wxAuiManager
* manager
;
726 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxAuiManagerEvent
)
731 class WXDLLIMPEXP_AUI wxAuiDockInfo
748 wxAuiDockInfo(const wxAuiDockInfo
& c
)
750 dock_direction
= c
.dock_direction
;
751 dock_layer
= c
.dock_layer
;
752 dock_row
= c
.dock_row
;
754 min_size
= c
.min_size
;
755 resizable
= c
.resizable
;
760 reserved1
= c
.reserved1
;
763 wxAuiDockInfo
& operator=(const wxAuiDockInfo
& c
)
765 dock_direction
= c
.dock_direction
;
766 dock_layer
= c
.dock_layer
;
767 dock_row
= c
.dock_row
;
769 min_size
= c
.min_size
;
770 resizable
= c
.resizable
;
775 reserved1
= c
.reserved1
;
780 bool IsOk() const { return dock_direction
!= 0; }
781 bool IsHorizontal() const { return dock_direction
== wxAUI_DOCK_TOP
||
782 dock_direction
== wxAUI_DOCK_BOTTOM
; }
783 bool IsVertical() const { return dock_direction
== wxAUI_DOCK_LEFT
||
784 dock_direction
== wxAUI_DOCK_RIGHT
||
785 dock_direction
== wxAUI_DOCK_CENTER
; }
787 wxAuiPaneInfoPtrArray panes
; // array of panes
788 wxRect rect
; // current rectangle
789 int dock_direction
; // dock direction (top, bottom, left, right, center)
790 int dock_layer
; // layer number (0 = innermost layer)
791 int dock_row
; // row number on the docking bar (0 = first row)
792 int size
; // size of the dock
793 int min_size
; // minimum size of a dock (0 if there is no min)
794 bool resizable
; // flag indicating whether the dock is resizable
795 bool toolbar
; // flag indicating dock contains only toolbars
796 bool fixed
; // flag indicating that the dock operates on
797 // absolute coordinates as opposed to proportional
802 class WXDLLIMPEXP_AUI wxAuiDockUIPart
818 int type
; // ui part type (see enum above)
819 int orientation
; // orientation (either wxHORIZONTAL or wxVERTICAL)
820 wxAuiDockInfo
* dock
; // which dock the item is associated with
821 wxAuiPaneInfo
* pane
; // which pane the item is associated with
822 wxAuiPaneButton
* button
; // which pane button the item is associated with
823 wxSizer
* cont_sizer
; // the part's containing sizer
824 wxSizerItem
* sizer_item
; // the sizer item of the part
825 wxRect rect
; // client coord rectangle of the part itself
829 class WXDLLIMPEXP_AUI wxAuiPaneButton
832 int button_id
; // id of the button (e.g. buttonClose)
839 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI
, wxEVT_AUI_PANE_BUTTON
, wxAuiManagerEvent
);
840 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI
, wxEVT_AUI_PANE_CLOSE
, wxAuiManagerEvent
);
841 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI
, wxEVT_AUI_PANE_MAXIMIZE
, wxAuiManagerEvent
);
842 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI
, wxEVT_AUI_PANE_RESTORE
, wxAuiManagerEvent
);
843 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI
, wxEVT_AUI_PANE_ACTIVATED
, wxAuiManagerEvent
);
844 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI
, wxEVT_AUI_RENDER
, wxAuiManagerEvent
);
845 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI
, wxEVT_AUI_FIND_MANAGER
, wxAuiManagerEvent
);
847 typedef void (wxEvtHandler::*wxAuiManagerEventFunction
)(wxAuiManagerEvent
&);
849 #define wxAuiManagerEventHandler(func) \
850 wxEVENT_HANDLER_CAST(wxAuiManagerEventFunction, func)
852 #define EVT_AUI_PANE_BUTTON(func) \
853 wx__DECLARE_EVT0(wxEVT_AUI_PANE_BUTTON, wxAuiManagerEventHandler(func))
854 #define EVT_AUI_PANE_CLOSE(func) \
855 wx__DECLARE_EVT0(wxEVT_AUI_PANE_CLOSE, wxAuiManagerEventHandler(func))
856 #define EVT_AUI_PANE_MAXIMIZE(func) \
857 wx__DECLARE_EVT0(wxEVT_AUI_PANE_MAXIMIZE, wxAuiManagerEventHandler(func))
858 #define EVT_AUI_PANE_RESTORE(func) \
859 wx__DECLARE_EVT0(wxEVT_AUI_PANE_RESTORE, wxAuiManagerEventHandler(func))
860 #define EVT_AUI_PANE_ACTIVATED(func) \
861 wx__DECLARE_EVT0(wxEVT_AUI_PANE_ACTIVATED, wxAuiManagerEventHandler(func))
862 #define EVT_AUI_RENDER(func) \
863 wx__DECLARE_EVT0(wxEVT_AUI_RENDER, wxAuiManagerEventHandler(func))
864 #define EVT_AUI_FIND_MANAGER(func) \
865 wx__DECLARE_EVT0(wxEVT_AUI_FIND_MANAGER, wxAuiManagerEventHandler(func))
869 %constant wxEventType wxEVT_AUI_PANE_BUTTON
;
870 %constant wxEventType wxEVT_AUI_PANE_CLOSE
;
871 %constant wxEventType wxEVT_AUI_PANE_MAXIMIZE
;
872 %constant wxEventType wxEVT_AUI_PANE_RESTORE
;
873 %constant wxEventType wxEVT_AUI_PANE_ACTIVATED
;
874 %constant wxEventType wxEVT_AUI_RENDER
;
875 %constant wxEventType wxEVT_AUI_FIND_MANAGER
;
878 EVT_AUI_PANE_BUTTON
= wx
.PyEventBinder( wxEVT_AUI_PANE_BUTTON
)
879 EVT_AUI_PANE_CLOSE
= wx
.PyEventBinder( wxEVT_AUI_PANE_CLOSE
)
880 EVT_AUI_PANE_MAXIMIZE
= wx
.PyEventBinder( wxEVT_AUI_PANE_MAXIMIZE
)
881 EVT_AUI_PANE_RESTORE
= wx
.PyEventBinder( wxEVT_AUI_PANE_RESTORE
)
882 EVT_AUI_PANE_ACTIVATED
= wx
.PyEventBinder( wxEVT_AUI_PANE_ACTIVATED
)
883 EVT_AUI_RENDER
= wx
.PyEventBinder( wxEVT_AUI_RENDER
)
884 EVT_AUI_FIND_MANAGER
= wx
.PyEventBinder( wxEVT_AUI_FIND_MANAGER
)
889 #endif //_WX_FRAMEMANAGER_H_