ALBA
albaGUIDockManager.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: ALBA (Agile Library for Biomedical Applications)
4 Module: albaGUIDockManager
5 Authors: Benjamin I. Williams
6
7 Copyright (c) BIC
8 All rights reserved. See Copyright.txt or
9
10
11 This software is distributed WITHOUT ANY WARRANTY; without even
12 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13 PURPOSE. See the above copyright notice for more information.
14
15=========================================================================*/
16
17#ifndef __albaGUIDockManager__H
18#define __albaGUIDockManager__H
19
20#include "albaDefines.h"
21
23{
31};
32
34{
40
44};
45
47{
65};
66
68{
72};
73
75{
79};
80
82{
86};
87
88
89
90// forwards and array declarations
91class ALBA_EXPORT wxDockUIPart;
92class ALBA_EXPORT wxPaneButton;
93class ALBA_EXPORT wxPaneInfo;
94class ALBA_EXPORT wxDockInfo;
95class ALBA_EXPORT wxDockArt;
96class ALBA_EXPORT wxFrameManagerEvent;
97
98WX_DECLARE_OBJARRAY_WITH_DECL(wxDockInfo, wxDockInfoArray,class ALBA_EXPORT);
99WX_DECLARE_OBJARRAY_WITH_DECL(wxDockUIPart, wxDockUIPartArray,class ALBA_EXPORT);
100WX_DECLARE_OBJARRAY_WITH_DECL(wxPaneButton, wxPaneButtonArray,class ALBA_EXPORT);
101WX_DECLARE_OBJARRAY_WITH_DECL(wxPaneInfo, wxPaneInfoArray,class ALBA_EXPORT);
102WX_DEFINE_ARRAY_PTR(wxPaneInfo*, wxPaneInfoPtrArray);
103WX_DEFINE_ARRAY_PTR(wxDockInfo*, wxDockInfoPtrArray);
104
105ALBA_EXPORT extern wxDockInfo wxNullDockInfo;
106ALBA_EXPORT extern wxPaneInfo wxNullPaneInfo;
107
108
109
114class ALBA_EXPORT wxPaneInfo
115{
116public:
117
120 {
121 m_Window = NULL;
122 m_Frame = NULL;
123 m_State = 0;
124 m_DockDirection = wxAUI_DOCK_LEFT;
125 m_DockLayer = 0;
126 m_DockRow = 0;
127 m_DockPos = 0;
128 m_FloatingPos = wxDefaultPosition;
129 m_FloatingSize = wxDefaultSize;
130 m_BestSize = wxDefaultSize;
131 m_MinSize = wxDefaultSize;
132 m_MaxSize = wxDefaultSize;
133 m_DockProportion = 0;
134
135 DefaultPane();
136 }
137
140 {
141 m_Name = c.m_Name;
142 m_Caption = c.m_Caption;
143 m_Window = c.m_Window;
144 m_Frame = c.m_Frame;
145 m_State = c.m_State;
146 m_DockDirection = c.m_DockDirection;
147 m_DockLayer = c.m_DockLayer;
148 m_DockRow = c.m_DockRow;
149 m_DockPos = c.m_DockPos;
150 m_BestSize = c.m_BestSize;
151 m_MinSize = c.m_MinSize;
152 m_MaxSize = c.m_MaxSize;
153 m_FloatingPos = c.m_FloatingPos;
154 m_FloatingSize = c.m_FloatingSize;
155 m_DockProportion = c.m_DockProportion;
156 m_Buttons = c.m_Buttons;
157 m_Rect = c.m_Rect;
158 }
159
162 {
163 m_Name = c.m_Name;
164 m_Caption = c.m_Caption;
165 m_Window = c.m_Window;
166 m_Frame = c.m_Frame;
167 m_State = c.m_State;
168 m_DockDirection = c.m_DockDirection;
169 m_DockLayer = c.m_DockLayer;
170 m_DockRow = c.m_DockRow;
171 m_DockPos = c.m_DockPos;
172 m_BestSize = c.m_BestSize;
173 m_MinSize = c.m_MinSize;
174 m_MaxSize = c.m_MaxSize;
175 m_FloatingPos = c.m_FloatingPos;
176 m_FloatingSize = c.m_FloatingSize;
177 m_DockProportion = c.m_DockProportion;
178 m_Buttons = c.m_Buttons;
179 m_Rect = c.m_Rect;
180 return *this;
181 }
182
184 bool IsOk() const { return (m_Window != NULL) ? true : false; }
186 bool IsFixed() const { return !HasFlag(optionResizable); }
188 bool IsResizable() const { return HasFlag(optionResizable); }
190 bool IsShown() const { return !HasFlag(optionHidden); }
192 bool IsFloating() const { return HasFlag(optionFloating); }
194 bool IsDocked() const { return !HasFlag(optionFloating); }
196 bool IsToolbar() const { return HasFlag(optionToolbar); }
198 bool IsTopDockable() const { return HasFlag(optionTopDockable); }
200 bool IsBottomDockable() const { return HasFlag(optionBottomDockable); }
202 bool IsLeftDockable() const { return HasFlag(optionLeftDockable); }
204 bool IsRightDockable() const { return HasFlag(optionRightDockable); }
206 bool IsFloatable() const { return HasFlag(optionFloatable); }
208 bool IsMovable() const { return HasFlag(optionMovable); }
210 bool HasCaption() const { return HasFlag(optionCaption); }
212 bool HasGripper() const { return HasFlag(optionGripper); }
214 bool HasBorder() const { return HasFlag(optionPaneBorder); }
216 bool HasCloseButton() const { return HasFlag(buttonClose); }
218 bool HasMaximizeButton() const { return HasFlag(buttonMaximize); }
220 bool HasMinimizeButton() const { return HasFlag(buttonMinimize); }
222 bool HasPinButton() const { return HasFlag(buttonPin); }
223
225 wxPaneInfo& Window(wxWindow* w) { m_Window = w; return *this; }
227 wxPaneInfo& Name(const wxString& n) { m_Name = n; return *this; }
229 wxPaneInfo& Caption(const wxString& c) { m_Caption = c; return *this; }
231 wxPaneInfo& Left() { m_DockDirection = wxAUI_DOCK_LEFT; return *this; }
233 wxPaneInfo& Right() { m_DockDirection = wxAUI_DOCK_RIGHT; return *this; }
235 wxPaneInfo& Top() { m_DockDirection = wxAUI_DOCK_TOP; return *this; }
237 wxPaneInfo& Bottom() { m_DockDirection = wxAUI_DOCK_BOTTOM; return *this; }
239 wxPaneInfo& Center() { m_DockDirection = wxAUI_DOCK_CENTER; return *this; }
241 wxPaneInfo& Centre() { m_DockDirection = wxAUI_DOCK_CENTRE; return *this; }
243 wxPaneInfo& Direction(int direction) { m_DockDirection = direction; return *this; }
245 wxPaneInfo& Layer(int layer) { m_DockLayer = layer; return *this; }
247 wxPaneInfo& Row(int row) { m_DockRow = row; return *this; }
249 wxPaneInfo& Position(int pos) { m_DockPos = pos; return *this; }
251 wxPaneInfo& BestSize(const wxSize& size) { m_BestSize = size; return *this; }
253 wxPaneInfo& MinSize(const wxSize& size) { m_MinSize = size; return *this; }
255 wxPaneInfo& MaxSize(const wxSize& size) { m_MaxSize = size; return *this; }
257 wxPaneInfo& BestSize(int x, int y) { m_BestSize.Set(x,y); return *this; }
259 wxPaneInfo& MinSize(int x, int y) { m_MinSize.Set(x,y); return *this; }
261 wxPaneInfo& MaxSize(int x, int y) { m_MaxSize.Set(x,y); return *this; }
263 wxPaneInfo& FloatingPosition(const wxPoint& pos) { m_FloatingPos = pos; return *this; }
265 wxPaneInfo& FloatingPosition(int x, int y) { m_FloatingPos.x = x; m_FloatingPos.y = y; return *this; }
267 wxPaneInfo& FloatingSize(const wxSize& size) { m_FloatingSize = size; return *this; }
269 wxPaneInfo& FloatingSize(int x, int y) { m_FloatingSize.Set(x,y); return *this; }
271 wxPaneInfo& Fixed() { return SetFlag(optionResizable, false); }
273 wxPaneInfo& Resizable(bool resizable = true) { return SetFlag(optionResizable, resizable); }
275 wxPaneInfo& Dock() { return SetFlag(optionFloating, false); }
277 wxPaneInfo& Float() { return SetFlag(optionFloating, true); }
279 wxPaneInfo& Hide() { return SetFlag(optionHidden, true); }
281 wxPaneInfo& Show(bool show = true) { return SetFlag(optionHidden, !show); }
283 wxPaneInfo& CaptionVisible(bool visible = true) { return SetFlag(optionCaption, visible); }
285 wxPaneInfo& PaneBorder(bool visible = true) { return SetFlag(optionPaneBorder, visible); }
287 wxPaneInfo& Gripper(bool visible = true) { return SetFlag(optionGripper, visible); }
289 wxPaneInfo& CloseButton(bool visible = true) { return SetFlag(buttonClose, visible); }
291 wxPaneInfo& MaximizeButton(bool visible = true) { return SetFlag(buttonMaximize, visible); }
293 wxPaneInfo& MinimizeButton(bool visible = true) { return SetFlag(buttonMinimize, visible); }
295 wxPaneInfo& PinButton(bool visible = true) { return SetFlag(buttonPin, visible); }
297 wxPaneInfo& DestroyOnClose(bool b = true) { return SetFlag(optionDestroyOnClose, b); }
299 wxPaneInfo& TopDockable(bool b = true) { return SetFlag(optionTopDockable, b); }
301 wxPaneInfo& BottomDockable(bool b = true) { return SetFlag(optionBottomDockable, b); }
303 wxPaneInfo& LeftDockable(bool b = true) { return SetFlag(optionLeftDockable, b); }
305 wxPaneInfo& RightDockable(bool b = true) { return SetFlag(optionRightDockable, b); }
307 wxPaneInfo& Floatable(bool b = true) { return SetFlag(optionFloatable, b); }
309 wxPaneInfo& Movable(bool b = true) { return SetFlag(optionMovable, b); }
311 wxPaneInfo& Dockable(bool b = true)
312 {
313 return TopDockable(b).BottomDockable(b).LeftDockable(b).RightDockable(b);
314 }
315
318 {
319 m_State |= optionTopDockable | optionBottomDockable |
320 optionLeftDockable | optionRightDockable |
321 optionFloatable | optionMovable | optionResizable |
322 optionCaption | optionPaneBorder | buttonClose;
323 return *this;
324 }
325
327 wxPaneInfo& CentrePane() { return CenterPane(); }
330 {
331 m_State = 0;
332 return Center().PaneBorder().Resizable();
333 }
334
337 {
338 DefaultPane();
339 m_State |= (optionToolbar | optionGripper);
340 m_State &= ~(optionResizable | optionCaption);
341 if (m_DockLayer == 0)
342 m_DockLayer = 10;
343 return *this;
344 }
345
347 wxPaneInfo& SetFlag(unsigned int flag, bool option_state)
348 {
349 if (option_state)
350 m_State |= flag;
351 else
352 m_State &= ~flag;
353 return *this;
354 }
355
357 bool HasFlag(unsigned int flag) const
358 {
359 return (m_State & flag) ? true:false;
360 }
361
362public:
363
365 {
366 optionFloating = 1 << 0,
367 optionHidden = 1 << 1,
368 optionLeftDockable = 1 << 2,
369 optionRightDockable = 1 << 3,
370 optionTopDockable = 1 << 4,
371 optionBottomDockable = 1 << 5,
372 optionFloatable = 1 << 6,
373 optionMovable = 1 << 7,
374 optionResizable = 1 << 8,
375 optionPaneBorder = 1 << 9,
376 optionCaption = 1 << 10,
377 optionGripper = 1 << 11,
378 optionDestroyOnClose = 1 << 12,
379 optionToolbar = 1 << 13,
380 optionActive = 1 << 14,
381
382 buttonClose = 1 << 24,
383 buttonMaximize = 1 << 25,
384 buttonMinimize = 1 << 26,
385 buttonPin = 1 << 27,
386 buttonCustom1 = 1 << 28,
387 buttonCustom2 = 1 << 29,
388 buttonCustom3 = 1 << 30,
389 actionPane = 1 << 31 // used internally
390 };
391
392public:
393 wxString m_Name; // name of the pane
394 wxString m_Caption; // caption displayed on the window
395
396 wxWindow* m_Window; // window that is in this pane
397 wxWindow* m_Frame; // floating frame window that holds the pane
398 unsigned int m_State; // a combination of wxPaneState values
399
400 int m_DockDirection; // dock direction (top, bottom, left, right, center)
401 int m_DockLayer; // layer number (0 = innermost layer)
402 int m_DockRow; // row number on the docking bar (0 = first row)
403 int m_DockPos; // position inside the row (0 = first position)
404
405 wxSize m_BestSize; // size that the layout engine will prefer
406 wxSize m_MinSize; // minimum size the pane window can tolerate
407 wxSize m_MaxSize; // maximum size the pane window can tolerate
408
409 wxPoint m_FloatingPos; // position while floating
410 wxSize m_FloatingSize; // size while floating
411 int m_DockProportion; // proportion while docked
412
413 wxPaneButtonArray m_Buttons; // buttons on the pane
414
415 wxRect m_Rect; // current rectangle (populated by wxAUI)
416};
417
418
419
420
425class ALBA_EXPORT wxFrameManager : public wxEvtHandler
426{
427friend class wxFloatingPane;
428
429public:
430
432 wxFrameManager(wxFrame* frame = NULL,
433 unsigned int flags = wxAUI_MGR_DEFAULT);
437 void UnInit();
438
440 void SetFlags(unsigned int flags);
442 unsigned int GetFlags() const;
443
445 void SetFrame(wxFrame* frame);
447 wxFrame* GetFrame() const;
448
450 void SetArtProvider(wxDockArt* art_provider);
453
455 wxPaneInfo& GetPane(wxWindow* window);
457 wxPaneInfo& GetPane(const wxString& name);
459 wxPaneInfoArray& GetAllPanes();
460
462 virtual bool AddPane(wxWindow* window,
463 const wxPaneInfo& pane_info);
464
466 virtual bool AddPane(wxWindow* window,
467 int direction = wxLEFT,
468 const wxString& caption = wxEmptyString);
470 bool InsertPane(wxWindow* window,
471 const wxPaneInfo& pane_info,
472 int insert_level = wxAUI_INSERT_PANE);
473
475 bool DetachPane(wxWindow* window);
476
478 wxString SavePerspective();
479
481 bool LoadPerspective(const wxString& perspective,
482 bool update = true);
483
485 virtual void Update();
486
487private:
489 void DrawHintRect(wxWindow* pane_window,
490 const wxPoint& pt,
491 const wxPoint& offset);
497 void DoFrameLayout();
498
500 void LayoutAddPane(wxSizer* container,
501 wxDockInfo& dock,
502 wxPaneInfo& pane,
503 wxDockUIPartArray& uiparts,
504 bool spacer_only);
506 void LayoutAddDock(wxSizer* container,
507 wxDockInfo& dock,
508 wxDockUIPartArray& uiparts,
509 bool spacer_only);
512 wxSizer* LayoutAll(wxPaneInfoArray& panes,
513 wxDockInfoArray& docks,
514 wxDockUIPartArray& uiparts,
515 bool spacer_only = false);
517 bool DoDrop(wxDockInfoArray& docks,
518 wxPaneInfoArray& panes,
519 wxPaneInfo& drop,
520 const wxPoint& pt,
521 const wxPoint& action_offset = wxPoint(0,0));
522
524 wxPaneInfo& LookupPane(wxWindow* window);
526 wxPaneInfo& LookupPane(const wxString& name);
530 wxDockUIPart* HitTest(int x, int y);
532 wxDockUIPart* GetPanePart(wxWindow* pane);
536 int GetDockPixelOffset(wxPaneInfo& test);
538 void OnFloatingPaneMoveStart(wxWindow* window);
540 void OnFloatingPaneMoving(wxWindow* window);
542 void OnFloatingPaneMoved(wxWindow* window);
544 void OnFloatingPaneActivated(wxWindow* window);
546 void OnFloatingPaneClosed(wxWindow* window);
548 void OnFloatingPaneResized(wxWindow* window, const wxSize& size);
550 void Render(wxDC* dc);
552 void Repaint(wxDC* dc = NULL);
554 void ProcessMgrEvent(wxFrameManagerEvent& event);
556 void UpdateButtonOnScreen(wxDockUIPart* button_ui_part,
557 const wxMouseEvent& event);
559 void GetPanePositionsAndSizes(wxDockInfo& dock,
560 wxArrayInt& positions,
561 wxArrayInt& sizes);
563 void ShowHint(const wxRect& rect);
565 void HideHint();
567 void RemoveHint();
568
569private:
570
572 void OnPaint(wxPaintEvent& event);
574 void OnEraseBackground(wxEraseEvent& event);
576 void OnSize(wxSizeEvent& event);
578 void OnSetCursor(wxSetCursorEvent& event);
580 void OnLeftDown(wxMouseEvent& event);
582 void OnLeftUp(wxMouseEvent& event);
584 void OnMotion(wxMouseEvent& event);
586 void OnLeaveWindow(wxMouseEvent& event);
588 virtual void OnPaneButton(wxFrameManagerEvent& event);
590 void OnChildFocus(wxChildFocusEvent& event);
592 void OnHintFadeTimer(wxTimerEvent& event);
593
594private:
595
596 enum
597 {
598 actionNone = 0,
599 actionResize,
600 actionClickButton,
601 actionClickCaption,
602 actionDragToolbarPane,
603 actionDragFloatingPane
604 };
605
606protected:
607
608 wxFrame* m_Frame; // the frame being managed
609 wxDockArt* m_Art; // dock art object which does all drawing
610 unsigned int m_Flags; // manager flags wxAUI_MGR_*
611
612 wxPaneInfoArray m_PanesArray; // array of panes structures
613 wxDockInfoArray m_Docks; // array of docks structures
614 wxDockUIPartArray m_UIParts; // array of UI parts (captions, buttons, etc)
615
616 int m_Action; // current mouse action
617 wxPoint m_ActionStart; // position where the action click started
618 wxPoint m_ActionOffset; // offset from upper left of the item clicked
619 wxDockUIPart* m_ActionPart; // ptr to the part the action happened to
620 wxWindow* m_ActionWindow; // action frame or window (NULL if none)
621 wxRect m_ActionHintRect; // hint rectangle for the action
622 wxDockUIPart* m_HoverButton;// button ui part being hovered over
623 wxRect m_LastHint; // last hint rectangle
624 wxPoint m_LastMouseMove; // last mouse move position (see OnMotion)
625
626 wxWindow* m_HintWnd; // transparent hint window (for now, only msw)
627 wxTimer m_HintFadeTimer; // transparent fade timer (for now, only msw)
628 int m_HintFadeAmount; // transparent fade amount (for now, only msw)
629
631 DECLARE_EVENT_TABLE()
632};
633
634
639class ALBA_EXPORT wxFrameManagerEvent : public wxEvent
640{
641public:
643 wxFrameManagerEvent(wxEventType type) : wxEvent(0, type)
644 {
645 m_Pane = NULL;
646 m_Button = 0;
647 }
648
651 {
652 m_Pane = c.m_Pane;
653 m_Button = c.m_Button;
654 }
655
657 wxEvent *Clone() const { return new wxFrameManagerEvent(*this); }
658
660 void SetPane(wxPaneInfo* p) { m_Pane = p; }
662 void SetButton(int b) { m_Button = b; }
664 wxPaneInfo* GetPane() { return m_Pane; }
666 int GetButton() { return m_Button; }
667
668public:
671};
672
673
674
675
682class ALBA_EXPORT wxDockArt
683{
684public:
688 virtual ~wxDockArt() { }
689
691 virtual int GetMetric(int id) = 0;
693 virtual void SetMetric(int id, int new_val) = 0;
695 virtual void SetFont(int id, const wxFont& font) = 0;
697 virtual wxFont GetFont(int id) = 0;
699 virtual wxColour GetColour(int id) = 0;
701 virtual void SetColour(int id, const wxColor& colour) = 0;
703 wxColor GetColor(int id) { return GetColour(id); }
705 void SetColor(int id, const wxColor& color) { SetColour(id, color); }
706
708 virtual void DrawSash(wxDC& dc,
709 int orientation,
710 const wxRect& rect) = 0;
712 virtual void DrawBackground(wxDC& dc,
713 int orientation,
714 const wxRect& rect) = 0;
716 virtual void DrawCaption(wxDC& dc,
717 const wxString& text,
718 const wxRect& rect,
719 wxPaneInfo& pane) = 0;
721 virtual void DrawGripper(wxDC& dc,
722 const wxRect& rect,
723 wxPaneInfo& pane) = 0;
725 virtual void DrawBorder(wxDC& dc,
726 const wxRect& rect,
727 wxPaneInfo& pane) = 0;
728
730 virtual void DrawPaneButton(wxDC& dc,
731 int button,
732 int button_state,
733 const wxRect& rect,
734 wxPaneInfo& pane) = 0;
735};
736
737
744class ALBA_EXPORT wxDefaultDockArt : public wxDockArt
745{
746public:
749
751 int GetMetric(int metric_id);
753 void SetMetric(int metric_id, int new_val);
755 wxColour GetColour(int id);
757 void SetColour(int id, const wxColor& colour);
759 void SetFont(int id, const wxFont& font);
761 wxFont GetFont(int id);
762
764 void DrawSash(wxDC& dc,
765 int orientation,
766 const wxRect& rect);
768 void DrawBackground(wxDC& dc,
769 int orientation,
770 const wxRect& rect);
772 void DrawCaption(wxDC& dc,
773 const wxString& text,
774 const wxRect& rect,
775 wxPaneInfo& pane);
777 void DrawGripper(wxDC& dc,
778 const wxRect& rect,
779 wxPaneInfo& pane);
780
782 void DrawBorder(wxDC& dc,
783 const wxRect& rect,
784 wxPaneInfo& pane);
786 void DrawPaneButton(wxDC& dc,
787 int button,
788 int button_state,
789 const wxRect& rect,
790 wxPaneInfo& pane);
791
792protected:
794 void DrawCaptionBackground(wxDC& dc, const wxRect& rect, bool active);
795
796protected:
797
799 wxBrush m_SashBrush;
822};
823
828class ALBA_EXPORT wxDockInfo
829{
830public:
833 {
834 m_DockDirection = 0;
835 m_DockLayer = 0;
836 m_DockRow = 0;
837 m_Size = 0;
838 m_MinSize = 0;
839 m_Resizable = true;
840 m_Fixed = false;
841 m_Toolbar = false;
842 }
845 {
846 m_DockDirection = c.m_DockDirection;
847 m_DockLayer = c.m_DockLayer;
848 m_DockRow = c.m_DockRow;
849 m_Size = c.m_Size;
850 m_MinSize = c.m_MinSize;
851 m_Resizable = c.m_Resizable;
852 m_Fixed = c.m_Fixed;
853 m_Toolbar = c.m_Toolbar;
854 m_Panes = c.m_Panes;
855 m_Rect = c.m_Rect;
856 }
859 {
860 m_DockDirection = c.m_DockDirection;
861 m_DockLayer = c.m_DockLayer;
862 m_DockRow = c.m_DockRow;
863 m_Size = c.m_Size;
864 m_MinSize = c.m_MinSize;
865 m_Resizable = c.m_Resizable;
866 m_Fixed = c.m_Fixed;
867 m_Toolbar = c.m_Toolbar;
868 m_Panes = c.m_Panes;
869 m_Rect = c.m_Rect;
870 return *this;
871 }
873 bool IsOk() const { return (m_DockDirection != 0) ? true : false; }
875 bool IsHorizontal() const { return (m_DockDirection == wxAUI_DOCK_TOP ||
876 m_DockDirection == wxAUI_DOCK_BOTTOM) ? true:false; }
878 bool IsVertical() const { return (m_DockDirection == wxAUI_DOCK_LEFT ||
879 m_DockDirection == wxAUI_DOCK_RIGHT ||
880 m_DockDirection == wxAUI_DOCK_CENTER) ? true:false; }
881public:
882 wxPaneInfoPtrArray m_Panes; // array of panes
883 wxRect m_Rect; // current rectangle
884 int m_DockDirection; // dock direction (top, bottom, left, right, center)
885 int m_DockLayer; // layer number (0 = innermost layer)
886 int m_DockRow; // row number on the docking bar (0 = first row)
887 int m_Size; // size of the dock
888 int m_MinSize; // minimum size of a dock (0 if there is no min)
889 bool m_Resizable; // flag indicating whether the dock is resizable
890 bool m_Toolbar; // flag indicating dock contains only toolbars
891 bool m_Fixed; // flag indicating that the dock operates on
892 // absolute coordinates as opposed to proportional
893};
894
899class ALBA_EXPORT wxDockUIPart
900{
901public:
902 enum
903 {
913 };
914
915 int m_Type; // ui part type (see enum above)
916 int m_Orientation; // orientation (either wxHORIZONTAL or wxVERTICAL)
917 wxDockInfo* m_Dock; // which dock the item is associated with
918 wxPaneInfo* m_Pane; // which pane the item is associated with
919 wxPaneButton* m_Button; // which pane button the item is associated with
920 wxSizer* m_ContSizer; // the part's containing sizer
921 wxSizerItem* m_SizerItem; // the sizer item of the part
922 wxRect m_Rect; // client coord rectangle of the part itself
923};
924
929class ALBA_EXPORT wxPaneButton
930{
931public:
932 int m_ButtonId; // id of the button (e.g. buttonClose)
933};
934
935
936
937
938// wx event machinery
939
940
941// right now the only event that works is wxEVT_AUI_PANEBUTTON. A full
942// spectrum of events will be implemented in the next incremental version
943
944BEGIN_DECLARE_EVENT_TYPES()
945 DECLARE_EXPORTED_EVENT_TYPE(ALBA_EXPORT,wxEVT_AUI_PANEBUTTON, 0)
946END_DECLARE_EVENT_TYPES()
947
948typedef void (wxEvtHandler::*wxFrameManagerEventFunction)(wxFrameManagerEvent&);
949
950#define wxFrameManagerEventHandler(func) \
951 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxFrameManagerEventFunction, &func)
952
953#define EVT_AUI_PANEBUTTON(func) \
954 wx__DECLARE_EVT0(wxEVT_AUI_PANEBUTTON, wxFrameManagerEventHandler(func))
955
956
957
958
959
964class ALBA_EXPORT albaGUIDockManager : public wxFrameManager
965{
966public:
968 virtual bool AddPane(wxWindow* window,const wxPaneInfo& pane_info, const wxString &menu = _("&View"), const wxString &subMenu = wxEmptyString);
970 virtual bool AddPane(wxWindow* window,int direction = wxLEFT,const wxString& caption = wxEmptyString);
972 virtual void Update();
973protected:
975 void AddMenuItem(wxWindow* window,const wxString& caption = wxEmptyString, const wxString &menu = _("&View"), const wxString &subMenu = wxEmptyString );
978};
979
980
981#endif //__albaGUIDockManager__
WX_DEFINE_ARRAY_PTR(wxPaneInfo *, wxPaneInfoPtrArray)
wxPaneInsertLevel
@ wxAUI_INSERT_ROW
@ wxAUI_INSERT_PANE
@ wxAUI_INSERT_DOCK
wxPaneButtonState
@ wxAUI_BUTTON_STATE_PRESSED
@ wxAUI_BUTTON_STATE_HOVER
@ wxAUI_BUTTON_STATE_NORMAL
wxPaneDockArtGradients
@ wxAUI_GRADIENT_HORIZONTAL
@ wxAUI_GRADIENT_NONE
@ wxAUI_GRADIENT_VERTICAL
WX_DECLARE_OBJARRAY_WITH_DECL(wxDockInfo, wxDockInfoArray, class ALBA_EXPORT)
wxFrameManagerDock
@ wxAUI_DOCK_TOP
@ wxAUI_DOCK_RIGHT
@ wxAUI_DOCK_CENTER
@ wxAUI_DOCK_LEFT
@ wxAUI_DOCK_NONE
@ wxAUI_DOCK_CENTRE
@ wxAUI_DOCK_BOTTOM
wxPaneDockArtSetting
@ wxAUI_ART_ACTIVE_CAPTION_COLOUR
@ wxAUI_ART_PANE_BORDER_SIZE
@ wxAUI_ART_ACTIVE_CAPTION_TEXT_COLOUR
@ wxAUI_ART_CAPTION_SIZE
@ wxAUI_ART_INACTIVE_CAPTION_GRADIENT_COLOUR
@ wxAUI_ART_GRIPPER_SIZE
@ wxAUI_ART_INACTIVE_CAPTION_TEXT_COLOUR
@ wxAUI_ART_SASH_SIZE
@ wxAUI_ART_ACTIVE_CAPTION_GRADIENT_COLOUR
@ wxAUI_ART_SASH_COLOUR
@ wxAUI_ART_INACTIVE_CAPTION_COLOUR
@ wxAUI_ART_BORDER_COLOUR
@ wxAUI_ART_CAPTION_FONT
@ wxAUI_ART_PANE_BUTTON_SIZE
@ wxAUI_ART_GRADIENT_TYPE
@ wxAUI_ART_GRIPPER_COLOUR
@ wxAUI_ART_BACKGROUND_COLOUR
void(wxEvtHandler::* wxFrameManagerEventFunction)(wxFrameManagerEvent &)
ALBA_EXPORT wxDockInfo wxNullDockInfo
ALBA_EXPORT wxPaneInfo wxNullPaneInfo
wxFrameManagerOption
@ wxAUI_MGR_ALLOW_ACTIVE_PANE
@ wxAUI_MGR_TRANSPARENT_DRAG
@ wxAUI_MGR_TRANSPARENT_HINT_FADE
@ wxAUI_MGR_TRANSPARENT_HINT
@ wxAUI_MGR_DEFAULT
@ wxAUI_MGR_ALLOW_FLOATING
class name: albaGUIDockManager Represent a frame manager for gui dock elements.
virtual bool AddPane(wxWindow *window, const wxPaneInfo &pane_info, const wxString &menu=_("&View"), const wxString &subMenu=wxEmptyString)
add pane
virtual void Update()
update
virtual bool AddPane(wxWindow *window, int direction=wxLEFT, const wxString &caption=wxEmptyString)
add pane overload
void UpdateMenuItems()
update menu items
void AddMenuItem(wxWindow *window, const wxString &caption=wxEmptyString, const wxString &menu=_("&View"), const wxString &subMenu=wxEmptyString)
add menu item
class name: wxDefaultDockArt this is the default art provider for wxFrameManager.
void DrawBackground(wxDC &dc, int orientation, const wxRect &rect)
Draw Background.
wxDefaultDockArt()
constructor
wxFont GetFont(int id)
get font
wxColour GetColour(int id)
get colour
wxColour m_ActiveCaptionTextColour
void DrawCaption(wxDC &dc, const wxString &text, const wxRect &rect, wxPaneInfo &pane)
Draw Caption.
void DrawCaptionBackground(wxDC &dc, const wxRect &rect, bool active)
Draw Caption Background.
void DrawSash(wxDC &dc, int orientation, const wxRect &rect)
Draw Sash.
void DrawBorder(wxDC &dc, const wxRect &rect, wxPaneInfo &pane)
Draw Border.
wxColour m_InactiveCaptionColour
wxColour m_ActiveCaptionGradientColour
void DrawGripper(wxDC &dc, const wxRect &rect, wxPaneInfo &pane)
Draw Gripper.
wxColour m_ActiveCaptionColour
wxColour m_InactiveCaptionGradientColour
wxBitmap m_InactiveCloseBitmap
void SetFont(int id, const wxFont &font)
set font
wxColour m_InactiveCaptionTextColour
int GetMetric(int metric_id)
get metric
void DrawPaneButton(wxDC &dc, int button, int button_state, const wxRect &rect, wxPaneInfo &pane)
Draw Pane Button.
void SetColour(int id, const wxColor &colour)
set colour
void SetMetric(int metric_id, int new_val)
set metric
class name: wxDockArt dock art provider code - a dock provider provides all drawing functionality to ...
virtual void DrawBorder(wxDC &dc, const wxRect &rect, wxPaneInfo &pane)=0
draw border
wxDockArt()
constructor
virtual void DrawSash(wxDC &dc, int orientation, const wxRect &rect)=0
draw sash
virtual void SetMetric(int id, int new_val)=0
set metric
virtual void DrawPaneButton(wxDC &dc, int button, int button_state, const wxRect &rect, wxPaneInfo &pane)=0
draw pane button
virtual void SetFont(int id, const wxFont &font)=0
set font
void SetColor(int id, const wxColor &color)
set colour
virtual void DrawBackground(wxDC &dc, int orientation, const wxRect &rect)=0
draw background
virtual ~wxDockArt()
destructor
virtual void DrawGripper(wxDC &dc, const wxRect &rect, wxPaneInfo &pane)=0
draw gripper
virtual wxColour GetColour(int id)=0
get colour
virtual wxFont GetFont(int id)=0
get font
virtual void DrawCaption(wxDC &dc, const wxString &text, const wxRect &rect, wxPaneInfo &pane)=0
draw caption
wxColor GetColor(int id)
get colour
virtual int GetMetric(int id)=0
get metric
virtual void SetColour(int id, const wxColor &colour)=0
set colour
class name: wxDockInfo This class define properties of a dock.
wxPaneInfoPtrArray m_Panes
wxDockInfo & operator=(const wxDockInfo &c)
assignment operator
wxDockInfo(const wxDockInfo &c)
copy constructor
bool IsOk() const
retrieve if dock direction is active
wxDockInfo()
constructor
bool IsVertical() const
retrieve if dock direction is left , rigth or center
bool IsHorizontal() const
retrieve if dock direction is top or bottom
class name: wxDockUIPart This class define a UI part of a dock.
wxSizer * m_ContSizer
wxPaneButton * m_Button
wxDockInfo * m_Dock
wxPaneInfo * m_Pane
wxSizerItem * m_SizerItem
class name: wxFrameManagerEvent Event handled by frame manager
wxFrameManagerEvent(const wxFrameManagerEvent &c)
constructor
wxPaneInfo * GetPane()
retrieve pane
wxEvent * Clone() const
clone the event and retrieve the new instance
wxFrameManagerEvent(wxEventType type)
constructor
void SetPane(wxPaneInfo *p)
set pane member
void SetButton(int b)
set button member
int GetButton()
retrieve button
class name: wxFrameManager Manager for dockabale panels; it can manage flags, attach/detach panes.
wxPaneInfo & GetPane(const wxString &name)
retrieve pane from name
virtual void Update()
update
void UnInit()
remove event handler
wxDockUIPart * m_ActionPart
virtual ~wxFrameManager()
destructor
wxDockUIPart * m_HoverButton
unsigned int GetFlags() const
retrieve flags
bool LoadPerspective(const wxString &perspective, bool update=true)
load perspective from a string
void SetArtProvider(wxDockArt *art_provider)
set art provider
unsigned int m_Flags
wxDockUIPartArray m_UIParts
wxDockArt * GetArtProvider() const
retrieve art provider
wxPaneInfoArray & GetAllPanes()
retrieve all panes
wxWindow * m_ActionWindow
void SetFlags(unsigned int flags)
set flags
wxPaneInfoArray m_PanesArray
wxFrameManager(wxFrame *frame=NULL, unsigned int flags=wxAUI_MGR_DEFAULT)
constructor
wxFrame * GetFrame() const
retrieve frame
wxPaneInfo & GetPane(wxWindow *window)
retrieve pane from window
wxString SavePerspective()
saves all pane information as a single string
void SetFrame(wxFrame *frame)
set frame
virtual bool AddPane(wxWindow *window, const wxPaneInfo &pane_info)
add pane
wxDockInfoArray m_Docks
bool InsertPane(wxWindow *window, const wxPaneInfo &pane_info, int insert_level=wxAUI_INSERT_PANE)
insert pane, shifting the panes around, depending on the insert level
virtual bool AddPane(wxWindow *window, int direction=wxLEFT, const wxString &caption=wxEmptyString)
add pane
bool DetachPane(wxWindow *window)
detach pane
class name: wxPaneButton This class define a button of a pane.
class name: wxPaneInfo This class define properties of a pane.
wxPaneInfo & ToolbarPane()
set optionToolbar optionGripper , remove optionResizable and optionCaption and retrieve this pointer
wxPaneInfo & TopDockable(bool b=true)
set flag optionTopDockable and retrieve this pointer
wxPaneInfo & Dockable(bool b=true)
set TopDockable BottomDockable LeftDockable RightDockable and retrieve this pointer
wxPaneInfo & MinSize(const wxSize &size)
set min size and retrieve this pointer
wxPaneInfo & FloatingPosition(int x, int y)
set floating position and retrieve this pointer
bool IsFixed() const
check flag optionResizable
wxPaneInfo & Resizable(bool resizable=true)
set flag optionResizable and retrieve this pointer
wxPaneInfo & DestroyOnClose(bool b=true)
set flag optionDestroyOnClose and retrieve this pointer
bool HasCloseButton() const
check flag buttonClose
wxPaneInfo & Bottom()
set dock direction to bottom and retrieve this pointer
bool IsFloating() const
check flag optionFloating
wxPaneInfo & MinSize(int x, int y)
set min size and retrieve this pointer
bool HasFlag(unsigned int flag) const
check if flag is active
wxPaneInfo & FloatingPosition(const wxPoint &pos)
set floating position and retrieve this pointer
wxPaneInfo & Direction(int direction)
set dock direction and retrieve this pointer
wxPaneInfo & Centre()
set dock direction to center and retrieve this pointer
bool IsMovable() const
check flag optionMovable
bool IsResizable() const
check flag optionResizable
wxPaneInfo & CaptionVisible(bool visible=true)
set flag optionCaption and retrieve this pointer
wxPaneInfo & Movable(bool b=true)
set flag optionMovable and retrieve this pointer
wxPaneInfo & BestSize(int x, int y)
set best size and retrieve this pointer
wxPaneInfo & MaximizeButton(bool visible=true)
set flag buttonMaximize and retrieve this pointer
wxPaneInfo & Top()
set dock direction to top and retrieve this pointer
wxPaneInfo & operator=(const wxPaneInfo &c)
assignment operator
wxPaneInfo & Floatable(bool b=true)
set flag optionFloatable and retrieve this pointer
wxPaneInfo & Left()
set dock direction to left and retrieve this pointer
bool IsTopDockable() const
check flag optionTopDockable
wxPaneInfo & Center()
set dock direction to center and retrieve this pointer
wxPaneInfo & BottomDockable(bool b=true)
set flag optionBottomDockable and retrieve this pointer
wxPaneInfo & FloatingSize(const wxSize &size)
set floating size and retrieve this pointer
wxPaneInfo & Right()
set dock direction to right and retrieve this pointer
wxPaneInfo & BestSize(const wxSize &size)
set best size and retrieve this pointer
wxPaneInfo & Show(bool show=true)
set flag optionHidden and retrieve this pointer
unsigned int m_State
bool HasPinButton() const
check flag buttonPin
bool IsDocked() const
check flag optionFloating
wxPaneInfo & Row(int row)
set row and retrieve this pointer
wxPaneInfo & Float()
set flag optionFloating and retrieve this pointer
wxPaneInfo & DefaultPane()
initialize pane flags and retrieve this pointer
bool IsToolbar() const
check flag optionToolbar
wxPaneInfo & Gripper(bool visible=true)
set flag optionGripper and retrieve this pointer
wxPaneInfo & Position(int pos)
set position and retrieve this pointer
bool HasBorder() const
check flag optionPaneBorder
wxPaneInfo & CenterPane()
set Center PaneBorder Resizable and retrieve this pointer
wxPaneInfo & MaxSize(int x, int y)
set max size and retrieve this pointer
wxPaneInfo()
constructor
wxPaneInfo & MinimizeButton(bool visible=true)
set flag buttonMinimize and retrieve this pointer
bool HasCaption() const
check flag optionCaption
bool HasMinimizeButton() const
check flag buttonMinimize
wxPaneButtonArray m_Buttons
wxPaneInfo & Hide()
set flag optionHidden and retrieve this pointer
wxWindow * m_Frame
wxPaneInfo & FloatingSize(int x, int y)
set floating size and retrieve this pointer
wxPaneInfo & PinButton(bool visible=true)
set flag buttonPin and retrieve this pointer
bool IsFloatable() const
check flag optionFloatable
wxPaneInfo & CloseButton(bool visible=true)
set flag buttonClose and retrieve this pointer
wxPaneInfo & LeftDockable(bool b=true)
set flag optionLeftDockable and retrieve this pointer
bool IsOk() const
retrive if the pane exist
bool IsLeftDockable() const
check flag optionLeftDockable
wxPaneInfo & Window(wxWindow *w)
set window and retrieve this pointer
wxPaneInfo & Dock()
set flag optionFloating and retrieve this pointer
wxString m_Caption
wxPaneInfo & PaneBorder(bool visible=true)
set flag optionPaneBorder and retrieve this pointer
wxPaneInfo & Caption(const wxString &c)
set caption and retrieve this pointer
wxPaneInfo & RightDockable(bool b=true)
set flag optionRightDockable and retrieve this pointer
wxPaneInfo & Fixed()
set flag optionResizable and retrieve this pointer
wxWindow * m_Window
wxPaneInfo & CentrePane()
set Center PaneBorder Resizable and retrieve this pointer
bool HasGripper() const
check flag optionGripper
bool IsRightDockable() const
check flag optionRightDockable
bool HasMaximizeButton() const
check flag buttonMaximize
bool IsShown() const
check flag optionHidden
wxPaneInfo & Layer(int layer)
set layer and retrieve this pointer
wxPoint m_FloatingPos
wxPaneInfo & MaxSize(const wxSize &size)
set max size and retrieve this pointer
wxPaneInfo & SetFlag(unsigned int flag, bool option_state)
set generic flag and retrieve this pointer
wxPaneInfo & Name(const wxString &n)
set name and retrieve this pointer
wxPaneInfo(const wxPaneInfo &c)
copy constructor
bool IsBottomDockable() const
check flag optionBottomDockable