framemanager.h

Go to the documentation of this file.
00001 
00002 // Name:        wx/aui/framemanager.h
00003 // Purpose:     wxaui: wx advanced user interface - docking window manager
00004 // Author:      Benjamin I. Williams
00005 // Modified by:
00006 // Created:     2005-05-17
00007 // RCS-ID:      $Id: framemanager.h,v 1.8 2006/07/05 16:37:55 BIW Exp $
00008 // Copyright:   (C) Copyright 2005, Kirix Corporation, All Rights Reserved.
00009 // Licence:     wxWindows Library Licence, Version 3.1
00011 
00012 #ifndef _WXXTRA_FRAMEMANAGER_H_
00013 #define _WXXTRA_FRAMEMANAGER_H_
00014 
00015 // ----------------------------------------------------------------------------
00016 // headers
00017 // ----------------------------------------------------------------------------
00018 
00019 #include <wx/wx.h>
00020 
00021 #if wxUSE_AUI
00022 #undef wxXTRA_AUI
00023 #include <wx/aui/framemanager.h>
00024 #else
00025 #define wxXTRA_AUI 1
00026 
00027 #include <wx/dynarray.h>
00028 #include <wx/gdicmn.h>
00029 #include <wx/window.h>
00030 #include <wx/timer.h>
00031 #include <wx/sizer.h>
00032 
00033 #define WXDLLIMPEXP_AUI WXDLLEXPORT
00034 
00035 enum wxAuiManagerDock
00036 {
00037     wxAUI_DOCK_NONE = 0,
00038     wxAUI_DOCK_TOP = 1,
00039     wxAUI_DOCK_RIGHT = 2,
00040     wxAUI_DOCK_BOTTOM = 3,
00041     wxAUI_DOCK_LEFT = 4,
00042     wxAUI_DOCK_CENTER = 5,
00043     wxAUI_DOCK_CENTRE = wxAUI_DOCK_CENTER
00044 };
00045 
00046 enum wxAuiManagerOption
00047 {
00048     wxAUI_MGR_ALLOW_FLOATING        = 1 << 0,
00049     wxAUI_MGR_ALLOW_ACTIVE_PANE     = 1 << 1,
00050     wxAUI_MGR_TRANSPARENT_DRAG      = 1 << 2,
00051     wxAUI_MGR_TRANSPARENT_HINT      = 1 << 3,
00052     wxAUI_MGR_TRANSPARENT_HINT_FADE = 1 << 4,
00053     // The venetian blind effect is ONLY used when the wxAUI_MGR_TRANSPARENT_HINT has been used, but
00054     // at runtime we determine we cannot use transparency (because, for instance, the OS does not support it).
00055     // setting this flag drops back in such circumstances (only) to the behaviour without wxAUI_MGR_TRANSPARENT_HINT
00056     wxAUI_MGR_DISABLE_VENETIAN_BLINDS = 1 << 5,
00057     wxAUI_MGR_DISABLE_VENETIAN_BLINDS_FADE = 1 << 6,
00058 
00059     wxAUI_MGR_DEFAULT = wxAUI_MGR_ALLOW_FLOATING |
00060                         wxAUI_MGR_TRANSPARENT_HINT |
00061                         wxAUI_MGR_TRANSPARENT_HINT_FADE |
00062                         wxAUI_MGR_DISABLE_VENETIAN_BLINDS_FADE
00063 };
00064 
00065 enum wxAuiPaneDockArtSetting
00066 {
00067     wxAUI_ART_SASH_SIZE = 0,
00068     wxAUI_ART_CAPTION_SIZE = 1,
00069     wxAUI_ART_GRIPPER_SIZE = 2,
00070     wxAUI_ART_PANE_BORDER_SIZE = 3,
00071     wxAUI_ART_PANE_BUTTON_SIZE = 4,
00072     wxAUI_ART_BACKGROUND_COLOUR = 5,
00073     wxAUI_ART_SASH_COLOUR = 6,
00074     wxAUI_ART_ACTIVE_CAPTION_COLOUR = 7,
00075     wxAUI_ART_ACTIVE_CAPTION_GRADIENT_COLOUR = 8,
00076     wxAUI_ART_INACTIVE_CAPTION_COLOUR = 9,
00077     wxAUI_ART_INACTIVE_CAPTION_GRADIENT_COLOUR = 10,
00078     wxAUI_ART_ACTIVE_CAPTION_TEXT_COLOUR = 11,
00079     wxAUI_ART_INACTIVE_CAPTION_TEXT_COLOUR = 12,
00080     wxAUI_ART_BORDER_COLOUR = 13,
00081     wxAUI_ART_GRIPPER_COLOUR = 14,
00082     wxAUI_ART_CAPTION_FONT = 15,
00083     wxAUI_ART_GRADIENT_TYPE = 16
00084 };
00085 
00086 enum wxAuiPaneDockArtGradients
00087 {
00088     wxAUI_GRADIENT_NONE = 0,
00089     wxAUI_GRADIENT_VERTICAL = 1,
00090     wxAUI_GRADIENT_HORIZONTAL = 2
00091 };
00092 
00093 enum wxAuiPaneButtonState
00094 {
00095     wxAUI_BUTTON_STATE_NORMAL = 0,
00096     wxAUI_BUTTON_STATE_HOVER = 1,
00097     wxAUI_BUTTON_STATE_PRESSED = 2
00098 };
00099 
00100 enum wxAuiPaneInsertLevel
00101 {
00102     wxAUI_INSERT_PANE = 0,
00103     wxAUI_INSERT_ROW = 1,
00104     wxAUI_INSERT_DOCK = 2
00105 };
00106 
00107 
00108 
00109 // forwards and array declarations
00110 class wxAuiDockUIPart;
00111 class wxAuiPaneButton;
00112 class wxAuiPaneInfo;
00113 class wxAuiDockInfo;
00114 class wxAuiDockArt;
00115 class wxAuiManagerEvent;
00116 
00117 #ifndef SWIG
00118 WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiDockInfo, wxAuiDockInfoArray, WXDLLIMPEXP_AUI);
00119 WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiDockUIPart, wxAuiDockUIPartArray, WXDLLIMPEXP_AUI);
00120 WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiPaneButton, wxAuiPaneButtonArray, WXDLLIMPEXP_AUI);
00121 WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiPaneInfo, wxAuiPaneInfoArray, WXDLLIMPEXP_AUI);
00122 WX_DEFINE_ARRAY_PTR(wxAuiPaneInfo*, wxAuiPaneInfoPtrArray);
00123 WX_DEFINE_ARRAY_PTR(wxAuiDockInfo*, wxAuiDockInfoPtrArray);
00124 #endif // SWIG
00125 
00126 extern WXDLLIMPEXP_AUI wxAuiDockInfo wxAuiNullDockInfo;
00127 extern WXDLLIMPEXP_AUI wxAuiPaneInfo wxAuiNullPaneInfo;
00128 
00129 
00130 
00131 class WXDLLIMPEXP_AUI wxAuiPaneInfo
00132 {
00133 public:
00134 
00135     wxAuiPaneInfo()
00136     {
00137         window = NULL;
00138         frame = NULL;
00139         state = 0;
00140         dock_direction = wxAUI_DOCK_LEFT;
00141         dock_layer = 0;
00142         dock_row = 0;
00143         dock_pos = 0;
00144         floating_pos = wxDefaultPosition;
00145         floating_size = wxDefaultSize;
00146         best_size = wxDefaultSize;
00147         min_size = wxDefaultSize;
00148         max_size = wxDefaultSize;
00149         dock_proportion = 0;
00150 
00151         DefaultPane();
00152     }
00153 
00154     ~wxAuiPaneInfo() {}
00155     
00156 #ifndef SWIG
00157     wxAuiPaneInfo(const wxAuiPaneInfo& c)
00158     {
00159         name = c.name;
00160         caption = c.caption;
00161         window = c.window;
00162         frame = c.frame;
00163         state = c.state;
00164         dock_direction = c.dock_direction;
00165         dock_layer = c.dock_layer;
00166         dock_row = c.dock_row;
00167         dock_pos = c.dock_pos;
00168         best_size = c.best_size;
00169         min_size = c.min_size;
00170         max_size = c.max_size;
00171         floating_pos = c.floating_pos;
00172         floating_size = c.floating_size;
00173         dock_proportion = c.dock_proportion;
00174         buttons = c.buttons;
00175         rect = c.rect;
00176     }
00177 
00178     wxAuiPaneInfo& operator=(const wxAuiPaneInfo& c)
00179     {
00180         name = c.name;
00181         caption = c.caption;
00182         window = c.window;
00183         frame = c.frame;
00184         state = c.state;
00185         dock_direction = c.dock_direction;
00186         dock_layer = c.dock_layer;
00187         dock_row = c.dock_row;
00188         dock_pos = c.dock_pos;
00189         best_size = c.best_size;
00190         min_size = c.min_size;
00191         max_size = c.max_size;
00192         floating_pos = c.floating_pos;
00193         floating_size = c.floating_size;
00194         dock_proportion = c.dock_proportion;
00195         buttons = c.buttons;
00196         rect = c.rect;
00197         return *this;
00198     }
00199 #endif // SWIG
00200 
00201     // Write the safe parts of a newly loaded AuiPaneInfo structure "source" into "this"
00202     // used on loading perspectives etc.
00203     void SafeSet(wxAuiPaneInfo source)
00204     {
00205         // note source is not passed by reference so we can overwrite, to keep the
00206         // unsafe bits of "dest"
00207         source.window = window;
00208         source.frame = frame;
00209         source.buttons = buttons;
00210         // now assign
00211         *this = source;
00212     }
00213 
00214     bool IsOk() const { return (window != NULL) ? true : false; }
00215     bool IsFixed() const { return !HasFlag(optionResizable); }
00216     bool IsResizable() const { return HasFlag(optionResizable); }
00217     bool IsShown() const { return !HasFlag(optionHidden); }
00218     bool IsFloating() const { return HasFlag(optionFloating); }
00219     bool IsDocked() const { return !HasFlag(optionFloating); }
00220     bool IsToolbar() const { return HasFlag(optionToolbar); }
00221     bool IsTopDockable() const { return HasFlag(optionTopDockable); }
00222     bool IsBottomDockable() const { return HasFlag(optionBottomDockable); }
00223     bool IsLeftDockable() const { return HasFlag(optionLeftDockable); }
00224     bool IsRightDockable() const { return HasFlag(optionRightDockable); }
00225     bool IsFloatable() const { return HasFlag(optionFloatable); }
00226     bool IsMovable() const { return HasFlag(optionMovable); }
00227     bool HasCaption() const { return HasFlag(optionCaption); }
00228     bool HasGripper() const { return HasFlag(optionGripper); }
00229     bool HasBorder() const { return HasFlag(optionPaneBorder); }
00230     bool HasCloseButton() const { return HasFlag(buttonClose); }
00231     bool HasMaximizeButton() const { return HasFlag(buttonMaximize); }
00232     bool HasMinimizeButton() const { return HasFlag(buttonMinimize); }
00233     bool HasPinButton() const { return HasFlag(buttonPin); }
00234     bool HasGripperTop() const { return HasFlag(optionGripperTop); }
00235 
00236 #ifdef SWIG
00237     %typemap(out) wxAuiPaneInfo& { $result = $self; Py_INCREF($result); }
00238 #endif
00239     wxAuiPaneInfo& Window(wxWindow* w) { window = w; return *this; }
00240     wxAuiPaneInfo& Name(const wxString& n) { name = n; return *this; }
00241     wxAuiPaneInfo& Caption(const wxString& c) { caption = c; return *this; }
00242     wxAuiPaneInfo& Left() { dock_direction = wxAUI_DOCK_LEFT; return *this; }
00243     wxAuiPaneInfo& Right() { dock_direction = wxAUI_DOCK_RIGHT; return *this; }
00244     wxAuiPaneInfo& Top() { dock_direction = wxAUI_DOCK_TOP; return *this; }
00245     wxAuiPaneInfo& Bottom() { dock_direction = wxAUI_DOCK_BOTTOM; return *this; }
00246     wxAuiPaneInfo& Center() { dock_direction = wxAUI_DOCK_CENTER; return *this; }
00247     wxAuiPaneInfo& Centre() { dock_direction = wxAUI_DOCK_CENTRE; return *this; }
00248     wxAuiPaneInfo& Direction(int direction) { dock_direction = direction; return *this; }
00249     wxAuiPaneInfo& Layer(int layer) { dock_layer = layer; return *this; }
00250     wxAuiPaneInfo& Row(int row) { dock_row = row; return *this; }
00251     wxAuiPaneInfo& Position(int pos) { dock_pos = pos; return *this; }
00252     wxAuiPaneInfo& BestSize(const wxSize& size) { best_size = size; return *this; }
00253     wxAuiPaneInfo& MinSize(const wxSize& size) { min_size = size; return *this; }
00254     wxAuiPaneInfo& MaxSize(const wxSize& size) { max_size = size; return *this; }
00255     wxAuiPaneInfo& BestSize(int x, int y) { best_size.Set(x,y); return *this; }
00256     wxAuiPaneInfo& MinSize(int x, int y) { min_size.Set(x,y); return *this; }
00257     wxAuiPaneInfo& MaxSize(int x, int y) { max_size.Set(x,y); return *this; }
00258     wxAuiPaneInfo& FloatingPosition(const wxPoint& pos) { floating_pos = pos; return *this; }
00259     wxAuiPaneInfo& FloatingPosition(int x, int y) { floating_pos.x = x; floating_pos.y = y; return *this; }
00260     wxAuiPaneInfo& FloatingSize(const wxSize& size) { floating_size = size; return *this; }
00261     wxAuiPaneInfo& FloatingSize(int x, int y) { floating_size.Set(x,y); return *this; }
00262     wxAuiPaneInfo& Fixed() { return SetFlag(optionResizable, false); }
00263     wxAuiPaneInfo& Resizable(bool resizable = true) { return SetFlag(optionResizable, resizable); }
00264     wxAuiPaneInfo& Dock() { return SetFlag(optionFloating, false); }
00265     wxAuiPaneInfo& Float() { return SetFlag(optionFloating, true); }
00266     wxAuiPaneInfo& Hide() { return SetFlag(optionHidden, true); }
00267     wxAuiPaneInfo& Show(bool show = true) { return SetFlag(optionHidden, !show); }
00268     wxAuiPaneInfo& CaptionVisible(bool visible = true) { return SetFlag(optionCaption, visible); }
00269     wxAuiPaneInfo& PaneBorder(bool visible = true) { return SetFlag(optionPaneBorder, visible); }
00270     wxAuiPaneInfo& Gripper(bool visible = true) { return SetFlag(optionGripper, visible); }
00271     wxAuiPaneInfo& GripperTop(bool attop = true) { return SetFlag(optionGripperTop, attop); }
00272     wxAuiPaneInfo& CloseButton(bool visible = true) { return SetFlag(buttonClose, visible); }
00273     wxAuiPaneInfo& MaximizeButton(bool visible = true) { return SetFlag(buttonMaximize, visible); }
00274     wxAuiPaneInfo& MinimizeButton(bool visible = true) { return SetFlag(buttonMinimize, visible); }
00275     wxAuiPaneInfo& PinButton(bool visible = true) { return SetFlag(buttonPin, visible); }
00276     wxAuiPaneInfo& DestroyOnClose(bool b = true) { return SetFlag(optionDestroyOnClose, b); }
00277     wxAuiPaneInfo& TopDockable(bool b = true) { return SetFlag(optionTopDockable, b); }
00278     wxAuiPaneInfo& BottomDockable(bool b = true) { return SetFlag(optionBottomDockable, b); }
00279     wxAuiPaneInfo& LeftDockable(bool b = true) { return SetFlag(optionLeftDockable, b); }
00280     wxAuiPaneInfo& RightDockable(bool b = true) { return SetFlag(optionRightDockable, b); }
00281     wxAuiPaneInfo& Floatable(bool b = true) { return SetFlag(optionFloatable, b); }
00282     wxAuiPaneInfo& Movable(bool b = true) { return SetFlag(optionMovable, b); }
00283     wxAuiPaneInfo& Dockable(bool b = true)
00284     {
00285         return TopDockable(b).BottomDockable(b).LeftDockable(b).RightDockable(b);
00286     }
00287 
00288     wxAuiPaneInfo& DefaultPane()
00289     {
00290         state |= optionTopDockable | optionBottomDockable |
00291                  optionLeftDockable | optionRightDockable |
00292                  optionFloatable | optionMovable | optionResizable |
00293                  optionCaption | optionPaneBorder | buttonClose;
00294         return *this;
00295     }
00296 
00297     wxAuiPaneInfo& CentrePane() { return CenterPane(); }
00298     wxAuiPaneInfo& CenterPane()
00299     {
00300         state = 0;
00301         return Center().PaneBorder().Resizable();
00302     }
00303 
00304     wxAuiPaneInfo& ToolbarPane()
00305     {
00306         DefaultPane();
00307         state |= (optionToolbar | optionGripper);
00308         state &= ~(optionResizable | optionCaption);
00309         if (dock_layer == 0)
00310             dock_layer = 10;
00311         return *this;
00312     }
00313 
00314     wxAuiPaneInfo& SetFlag(unsigned int flag, bool option_state)
00315     {
00316         if (option_state)
00317             state |= flag;
00318              else
00319             state &= ~flag;
00320         return *this;
00321     }
00322 
00323     bool HasFlag(unsigned int flag) const
00324     {
00325         return (state & flag) ? true:false;
00326     }
00327 
00328 #ifdef SWIG
00329     %typemap(out) wxAuiPaneInfo& ;
00330 #endif
00331     
00332 public:
00333 
00334     enum wxAuiPaneState
00335     {
00336         optionFloating        = 1 << 0,
00337         optionHidden          = 1 << 1,
00338         optionLeftDockable    = 1 << 2,
00339         optionRightDockable   = 1 << 3,
00340         optionTopDockable     = 1 << 4,
00341         optionBottomDockable  = 1 << 5,
00342         optionFloatable       = 1 << 6,
00343         optionMovable         = 1 << 7,
00344         optionResizable       = 1 << 8,
00345         optionPaneBorder      = 1 << 9,
00346         optionCaption         = 1 << 10,
00347         optionGripper         = 1 << 11,
00348         optionDestroyOnClose  = 1 << 12,
00349         optionToolbar         = 1 << 13,
00350         optionActive          = 1 << 14,
00351         optionGripperTop      = 1 << 15,
00352 
00353         buttonClose           = 1 << 24,
00354         buttonMaximize        = 1 << 25,
00355         buttonMinimize        = 1 << 26,
00356         buttonPin             = 1 << 27,
00357         buttonCustom1         = 1 << 28,
00358         buttonCustom2         = 1 << 29,
00359         buttonCustom3         = 1 << 30,
00360         actionPane            = 1 << 31  // used internally
00361     };
00362 
00363 public:
00364     wxString name;        // name of the pane
00365     wxString caption;     // caption displayed on the window
00366 
00367     wxWindow* window;     // window that is in this pane
00368     wxFrame* frame;       // floating frame window that holds the pane
00369     unsigned int state;   // a combination of wxAuiPaneState values
00370 
00371     int dock_direction;   // dock direction (top, bottom, left, right, center)
00372     int dock_layer;       // layer number (0 = innermost layer)
00373     int dock_row;         // row number on the docking bar (0 = first row)
00374     int dock_pos;         // position inside the row (0 = first position)
00375 
00376     wxSize best_size;     // size that the layout engine will prefer
00377     wxSize min_size;      // minimum size the pane window can tolerate
00378     wxSize max_size;      // maximum size the pane window can tolerate
00379 
00380     wxPoint floating_pos; // position while floating
00381     wxSize floating_size; // size while floating
00382     int dock_proportion;  // proportion while docked
00383 
00384     wxAuiPaneButtonArray buttons; // buttons on the pane
00385 
00386     wxRect rect;              // current rectangle (populated by wxAUI)
00387 };
00388 
00389 
00390 
00391 
00392 
00393 class WXDLLIMPEXP_AUI wxAuiManager : public wxEvtHandler
00394 {
00395 friend class wxAuiFloatingFrame;
00396 
00397 public:
00398 
00399     wxAuiManager(wxWindow* managed_wnd = NULL,
00400                    unsigned int flags = wxAUI_MGR_DEFAULT);
00401     virtual ~wxAuiManager();
00402     void UnInit();
00403 
00404     void SetFlags(unsigned int flags);
00405     unsigned int GetFlags() const;
00406 
00407     void SetManagedWindow(wxWindow* managed_wnd);
00408     wxWindow* GetManagedWindow() const;
00409 
00410 #ifdef SWIG
00411     %disownarg( wxAuiDockArt* art_provider );
00412 #endif
00413     void SetArtProvider(wxAuiDockArt* art_provider);
00414     wxAuiDockArt* GetArtProvider() const;
00415 
00416     wxAuiPaneInfo& GetPane(wxWindow* window);
00417     wxAuiPaneInfo& GetPane(const wxString& name);
00418     wxAuiPaneInfoArray& GetAllPanes();
00419 
00420     bool AddPane(wxWindow* window,
00421                  const wxAuiPaneInfo& pane_info);
00422                  
00423     bool AddPane(wxWindow* window,
00424                  const wxAuiPaneInfo& pane_info,
00425                  const wxPoint& drop_pos);
00426 
00427     bool AddPane(wxWindow* window,
00428                  int direction = wxLEFT,
00429                  const wxString& caption = wxEmptyString);
00430 
00431     bool InsertPane(wxWindow* window,
00432                  const wxAuiPaneInfo& insert_location,
00433                  int insert_level = wxAUI_INSERT_PANE);
00434 
00435     bool DetachPane(wxWindow* window);
00436 
00437     wxString SavePaneInfo(wxAuiPaneInfo& pane);
00438     void LoadPaneInfo(wxString pane_part, wxAuiPaneInfo &pane);
00439 
00440     wxString SavePerspective();
00441 
00442     bool LoadPerspective(const wxString& perspective,
00443                  bool update = true);
00444 
00445     void Update();
00446 
00447 
00448 public:
00449 
00450     void DrawHintRect(wxWindow* pane_window,
00451                        const wxPoint& pt,
00452                        const wxPoint& offset);
00453     virtual void ShowHint(const wxRect& rect);
00454     virtual void HideHint();
00455 
00456 public:
00457 
00458     // deprecated -- please use SetManagedWindow() and
00459     // and GetManagedWindow() instead
00460     
00461     wxDEPRECATED( void SetFrame(wxFrame* frame) );
00462     wxDEPRECATED( wxFrame* GetFrame() const );
00463     
00464 protected:
00465 
00466 
00467     
00468     void DoFrameLayout();
00469 
00470     void LayoutAddPane(wxSizer* container,
00471                        wxAuiDockInfo& dock,
00472                        wxAuiPaneInfo& pane,
00473                        wxAuiDockUIPartArray& uiparts,
00474                        bool spacer_only);
00475 
00476     void LayoutAddDock(wxSizer* container,
00477                        wxAuiDockInfo& dock,
00478                        wxAuiDockUIPartArray& uiparts,
00479                        bool spacer_only);
00480 
00481     wxSizer* LayoutAll(wxAuiPaneInfoArray& panes,
00482                        wxAuiDockInfoArray& docks,
00483                        wxAuiDockUIPartArray& uiparts,
00484                        bool spacer_only = false);
00485 
00486     virtual bool ProcessDockResult(wxAuiPaneInfo& target,
00487                                    const wxAuiPaneInfo& new_pos);
00488 
00489     bool DoDrop(wxAuiDockInfoArray& docks,
00490                 wxAuiPaneInfoArray& panes,
00491                 wxAuiPaneInfo& drop,
00492                 const wxPoint& pt,
00493                 const wxPoint& action_offset = wxPoint(0,0));
00494 
00495     wxAuiPaneInfo& LookupPane(wxWindow* window);
00496     wxAuiPaneInfo& LookupPane(const wxString& name);
00497     wxAuiDockUIPart* HitTest(int x, int y);
00498     wxAuiDockUIPart* GetPanePart(wxWindow* pane);
00499     int GetDockPixelOffset(wxAuiPaneInfo& test);
00500     void OnFloatingPaneMoveStart(wxWindow* window);
00501     void OnFloatingPaneMoving(wxWindow* window);
00502     void OnFloatingPaneMoved(wxWindow* window);
00503     void OnFloatingPaneActivated(wxWindow* window);
00504     void OnFloatingPaneClosed(wxWindow* window, wxCloseEvent& evt);
00505     void OnFloatingPaneResized(wxWindow* window, const wxSize& size);
00506     void Render(wxDC* dc);
00507     void Repaint(wxDC* dc = NULL);
00508     void ProcessMgrEvent(wxAuiManagerEvent& event);
00509     void UpdateButtonOnScreen(wxAuiDockUIPart* button_ui_part,
00510                               const wxMouseEvent& event);
00511     void GetPanePositionsAndSizes(wxAuiDockInfo& dock,
00512                               wxArrayInt& positions,
00513                               wxArrayInt& sizes);
00514 
00515 
00516 public:
00517 
00518     // public events (which can be invoked externally)
00519     void OnRender(wxAuiManagerEvent& evt);
00520     void OnPaneButton(wxAuiManagerEvent& evt);
00521 
00522 protected:
00523 
00524     // protected events
00525     void OnPaint(wxPaintEvent& evt);
00526     void OnEraseBackground(wxEraseEvent& evt);
00527     void OnSize(wxSizeEvent& evt);
00528     void OnSetCursor(wxSetCursorEvent& evt);
00529     void OnLeftDown(wxMouseEvent& evt);
00530     void OnLeftUp(wxMouseEvent& evt);
00531     void OnMotion(wxMouseEvent& evt);
00532     void OnLeaveWindow(wxMouseEvent& evt);
00533     void OnChildFocus(wxChildFocusEvent& evt);
00534     void OnHintFadeTimer(wxTimerEvent& evt);
00535 
00536 protected:
00537 
00538     enum
00539     {
00540         actionNone = 0,
00541         actionResize,
00542         actionClickButton,
00543         actionClickCaption,
00544         actionDragToolbarPane,
00545         actionDragFloatingPane
00546     };
00547 
00548 protected:
00549 
00550     wxWindow* m_frame;           // the window being managed
00551     wxAuiDockArt* m_art;            // dock art object which does all drawing
00552     unsigned int m_flags;        // manager flags wxAUI_MGR_*
00553 
00554     wxAuiPaneInfoArray m_panes;     // array of panes structures
00555     wxAuiDockInfoArray m_docks;     // array of docks structures
00556     wxAuiDockUIPartArray m_uiparts; // array of UI parts (captions, buttons, etc)
00557 
00558     int m_action;                // current mouse action
00559     wxPoint m_action_start;      // position where the action click started
00560     wxPoint m_action_offset;     // offset from upper left of the item clicked
00561     wxAuiDockUIPart* m_action_part; // ptr to the part the action happened to
00562     wxWindow* m_action_window;   // action frame or window (NULL if none)
00563     wxRect m_action_hintrect;    // hint rectangle for the action
00564     wxAuiDockUIPart* m_hover_button;// button uipart being hovered over
00565     wxRect m_last_hint;          // last hint rectangle
00566     wxPoint m_last_mouse_move;   // last mouse move position (see OnMotion)
00567 
00568     wxFrame* m_hint_wnd;         // transparent hint window, if supported by platform
00569     wxTimer m_hint_fadetimer;    // transparent fade timer
00570     wxByte m_hint_fadeamt;       // transparent fade amount
00571     wxByte m_hint_fademax;       // maximum value of hint fade
00572 
00573 #ifndef SWIG
00574     DECLARE_EVENT_TABLE()
00575 #endif // SWIG
00576 };
00577 
00578 
00579 
00580 // event declarations/classes
00581 
00582 class WXDLLIMPEXP_AUI wxAuiManagerEvent : public wxEvent
00583 {
00584 public:
00585     wxAuiManagerEvent(wxEventType type=wxEVT_NULL) : wxEvent(0, type)
00586     {
00587         pane = NULL;
00588         button = 0;
00589         veto_flag = false;
00590         canveto_flag = true;
00591         dc = NULL;
00592     }
00593 #ifndef SWIG
00594     wxAuiManagerEvent(const wxAuiManagerEvent& c) : wxEvent(c)
00595     {
00596         pane = c.pane;
00597         button = c.button;
00598         veto_flag = c.veto_flag;
00599         canveto_flag = c.canveto_flag;
00600         dc = c.dc;
00601     }
00602 #endif
00603     wxEvent *Clone() const { return new wxAuiManagerEvent(*this); }
00604 
00605     void SetPane(wxAuiPaneInfo* p) { pane = p; }
00606     void SetButton(int b) { button = b; }
00607     void SetDC(wxDC* pdc) { dc = pdc; }
00608  
00609     wxAuiPaneInfo* GetPane() { return pane; }
00610     int GetButton() { return button; }
00611     wxDC* GetDC() { return dc; }
00612     
00613     void Veto(bool veto = true) { veto_flag = veto; }
00614     bool GetVeto() const { return veto_flag; }
00615     void SetCanVeto(bool can_veto) { canveto_flag = can_veto; }
00616     bool CanVeto() const { return  canveto_flag && veto_flag; }
00617     
00618 public:
00619     wxAuiPaneInfo* pane;
00620     int button;
00621     bool veto_flag;
00622     bool canveto_flag;
00623     wxDC* dc;
00624 
00625 #ifndef SWIG
00626 private:
00627     DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxAuiManagerEvent)
00628 #endif
00629 };
00630 
00631 
00632 class WXDLLIMPEXP_AUI wxAuiDockInfo
00633 {
00634 public:
00635     wxAuiDockInfo()
00636     {
00637         dock_direction = 0;
00638         dock_layer = 0;
00639         dock_row = 0;
00640         size = 0;
00641         min_size = 0;
00642         resizable = true;
00643         fixed = false;
00644         toolbar = false;
00645     }
00646 
00647 #ifndef SWIG
00648     wxAuiDockInfo(const wxAuiDockInfo& c)
00649     {
00650         dock_direction = c.dock_direction;
00651         dock_layer = c.dock_layer;
00652         dock_row = c.dock_row;
00653         size = c.size;
00654         min_size = c.min_size;
00655         resizable = c.resizable;
00656         fixed = c.fixed;
00657         toolbar = c.toolbar;
00658         panes = c.panes;
00659         rect = c.rect;
00660     }
00661 
00662     wxAuiDockInfo& operator=(const wxAuiDockInfo& c)
00663     {
00664         dock_direction = c.dock_direction;
00665         dock_layer = c.dock_layer;
00666         dock_row = c.dock_row;
00667         size = c.size;
00668         min_size = c.min_size;
00669         resizable = c.resizable;
00670         fixed = c.fixed;
00671         toolbar = c.toolbar;
00672         panes = c.panes;
00673         rect = c.rect;
00674         return *this;
00675     }
00676 #endif // SWIG
00677 
00678     bool IsOk() const { return (dock_direction != 0) ? true : false; }
00679     bool IsHorizontal() const { return (dock_direction == wxAUI_DOCK_TOP ||
00680                              dock_direction == wxAUI_DOCK_BOTTOM) ? true:false; }
00681     bool IsVertical() const { return (dock_direction == wxAUI_DOCK_LEFT ||
00682                              dock_direction == wxAUI_DOCK_RIGHT ||
00683                              dock_direction == wxAUI_DOCK_CENTER) ? true:false; }
00684 public:
00685     wxAuiPaneInfoPtrArray panes; // array of panes
00686     wxRect rect;              // current rectangle
00687     int dock_direction;       // dock direction (top, bottom, left, right, center)
00688     int dock_layer;           // layer number (0 = innermost layer)
00689     int dock_row;             // row number on the docking bar (0 = first row)
00690     int size;                 // size of the dock
00691     int min_size;             // minimum size of a dock (0 if there is no min)
00692     bool resizable;           // flag indicating whether the dock is resizable
00693     bool toolbar;             // flag indicating dock contains only toolbars
00694     bool fixed;               // flag indicating that the dock operates on
00695                               // absolute coordinates as opposed to proportional
00696 };
00697 
00698 
00699 class WXDLLIMPEXP_AUI wxAuiDockUIPart
00700 {
00701 public:
00702     enum
00703     {
00704         typeCaption,
00705         typeGripper,
00706         typeDock,
00707         typeDockSizer,
00708         typePane,
00709         typePaneSizer,
00710         typeBackground,
00711         typePaneBorder,
00712         typePaneButton
00713     };
00714 
00715     int type;                // ui part type (see enum above)
00716     int orientation;         // orientation (either wxHORIZONTAL or wxVERTICAL)
00717     wxAuiDockInfo* dock;        // which dock the item is associated with
00718     wxAuiPaneInfo* pane;        // which pane the item is associated with
00719     wxAuiPaneButton* button;    // which pane button the item is associated with
00720     wxSizer* cont_sizer;     // the part's containing sizer
00721     wxSizerItem* sizer_item; // the sizer item of the part
00722     wxRect rect;             // client coord rectangle of the part itself
00723 };
00724 
00725 
00726 class WXDLLIMPEXP_AUI wxAuiPaneButton
00727 {
00728 public:
00729     int button_id;        // id of the button (e.g. buttonClose)
00730 };
00731 
00732 
00733 
00734 #ifndef SWIG
00735 // wx event machinery
00736 
00737 BEGIN_DECLARE_EVENT_TYPES()
00738     DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_AUI_PANE_BUTTON, 0)
00739     DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_AUI_PANE_CLOSE, 0)
00740     DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_AUI_RENDER, 0)
00741 END_DECLARE_EVENT_TYPES()
00742 
00743 typedef void (wxEvtHandler::*wxAuiManagerEventFunction)(wxAuiManagerEvent&);
00744 
00745 #define wxAuiManagerEventHandler(func) \
00746     (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxAuiManagerEventFunction, &func)
00747 
00748 #define EVT_AUI_PANE_BUTTON(func) \
00749    wx__DECLARE_EVT0(wxEVT_AUI_PANE_BUTTON, wxAuiManagerEventHandler(func))
00750 #define EVT_AUI_PANE_CLOSE(func) \
00751    wx__DECLARE_EVT0(wxEVT_AUI_PANE_CLOSE, wxAuiManagerEventHandler(func))
00752 #define EVT_AUI_RENDER(func) \
00753    wx__DECLARE_EVT0(wxEVT_AUI_RENDER, wxAuiManagerEventHandler(func))
00754 
00755 #else
00756 
00757 %constant wxEventType wxEVT_AUI_PANE_BUTTON;
00758 %constant wxEventType wxEVT_AUI_PANE_CLOSE;
00759 %constant wxEventType wxEVT_AUI_RENDER;
00760 
00761 %pythoncode {
00762     EVT_AUI_PANE_BUTTON = wx.PyEventBinder( wxEVT_AUI_PANE_BUTTON )
00763     EVT_AUI_PANE_CLOSE = wx.PyEventBinder( wxEVT_AUI_PANE_CLOSE )
00764     EVT_AUI_RENDER = wx.PyEventBinder( wxEVT_AUI_RENDER )
00765 }
00766 #endif // SWIG
00767 
00768 
00769 #endif // wxUSE_AUI
00770 #endif //_WX_FRAMEMANAGER_H_
00771 

Generated on Sat Nov 10 03:49:01 2007 for Camelot by  doxygen 1.4.4