From 858a3a7a456d362339752e320bb2e8a50610dfdc Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Tue, 21 Aug 2007 11:04:48 +0000 Subject: [PATCH] Applied [ 1708971 ] Make a virtual function to enable/disable docking git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48276 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/aui/framemanager.h | 35 ++++++++++++++++++----------------- src/aui/framemanager.cpp | 11 +++++++++-- 2 files changed, 27 insertions(+), 19 deletions(-) diff --git a/include/wx/aui/framemanager.h b/include/wx/aui/framemanager.h index ec1af11fcc..801c64f44f 100644 --- a/include/wx/aui/framemanager.h +++ b/include/wx/aui/framemanager.h @@ -166,7 +166,7 @@ public: } ~wxAuiPaneInfo() {} - + #ifndef SWIG wxAuiPaneInfo(const wxAuiPaneInfo& c) { @@ -347,12 +347,12 @@ public: #ifdef SWIG %typemap(out) wxAuiPaneInfo& ; #endif - + public: // NOTE: You can add and subtract flags from this list, // but do not change the values of the flags, because - // they are stored in a binary integer format in the + // they are stored in a binary integer format in the // perspective string. If you really need to change the // values around, you'll have to ensure backwards-compatibility // in the perspective loading code. @@ -380,11 +380,11 @@ public: buttonMaximize = 1 << 22, buttonMinimize = 1 << 23, buttonPin = 1 << 24, - + buttonCustom1 = 1 << 26, buttonCustom2 = 1 << 27, buttonCustom3 = 1 << 28, - + savedHiddenState = 1 << 30, // used internally actionPane = 1 << 31 // used internally }; @@ -450,7 +450,7 @@ public: bool AddPane(wxWindow* window, const wxAuiPaneInfo& pane_info); - + bool AddPane(wxWindow* window, const wxAuiPaneInfo& pane_info, const wxPoint& drop_pos); @@ -464,7 +464,7 @@ public: int insert_level = wxAUI_INSERT_PANE); bool DetachPane(wxWindow* window); - + void Update(); wxString SavePaneInfo(wxAuiPaneInfo& pane); @@ -474,7 +474,7 @@ public: void SetDockSizeConstraint(double width_pct, double height_pct); void GetDockSizeConstraint(double* width_pct, double* height_pct) const; - + void ClosePane(wxAuiPaneInfo& pane_info); void MaximizePane(wxAuiPaneInfo& pane_info); void RestorePane(wxAuiPaneInfo& pane_info); @@ -483,6 +483,7 @@ public: public: virtual wxAuiFloatingFrame* CreateFloatingFrame(wxWindow* parent, const wxAuiPaneInfo& p); + virtual bool CanDockPanel(const wxAuiPaneInfo & p); void StartPaneDrag( wxWindow* pane_window, @@ -492,12 +493,12 @@ public: wxWindow* pane_window, const wxPoint& pt, const wxPoint& offset); - + void DrawHintRect( wxWindow* pane_window, const wxPoint& pt, const wxPoint& offset); - + virtual void ShowHint(const wxRect& rect); virtual void HideHint(); @@ -505,14 +506,14 @@ public: // deprecated -- please use SetManagedWindow() and // and GetManagedWindow() instead - + wxDEPRECATED( void SetFrame(wxFrame* frame) ); wxDEPRECATED( wxFrame* GetFrame() const ); - + protected: void UpdateHintWindowConfig(); - + void DoFrameLayout(); void LayoutAddPane(wxSizer* container, @@ -622,7 +623,7 @@ protected: wxTimer m_hint_fadetimer; // transparent fade timer wxByte m_hint_fadeamt; // transparent fade amount wxByte m_hint_fademax; // maximum value of hint fade - + void* m_reserved; #ifndef SWIG @@ -664,17 +665,17 @@ public: void SetPane(wxAuiPaneInfo* p) { pane = p; } void SetButton(int b) { button = b; } void SetDC(wxDC* pdc) { dc = pdc; } - + wxAuiManager* GetManager() const { return manager; } wxAuiPaneInfo* GetPane() const { return pane; } int GetButton() const { return button; } wxDC* GetDC() const { return dc; } - + void Veto(bool veto = true) { veto_flag = veto; } bool GetVeto() const { return veto_flag; } void SetCanVeto(bool can_veto) { canveto_flag = can_veto; } bool CanVeto() const { return canveto_flag && veto_flag; } - + public: wxAuiManager* manager; wxAuiPaneInfo* pane; diff --git a/src/aui/framemanager.cpp b/src/aui/framemanager.cpp index 19315ef73a..6195560341 100644 --- a/src/aui/framemanager.cpp +++ b/src/aui/framemanager.cpp @@ -529,6 +529,13 @@ wxAuiFloatingFrame* wxAuiManager::CreateFloatingFrame(wxWindow* parent, return new wxAuiFloatingFrame(parent, this, pane_info); } +bool wxAuiManager::CanDockPanel(const wxAuiPaneInfo & WXUNUSED(p)) +{ + // if a key modifier is pressed while dragging the frame, + // don't dock the window + return !(wxGetKeyState(WXK_CONTROL) || wxGetKeyState(WXK_ALT)); +} + // GetPane() looks up a wxAuiPaneInfo structure based // on the supplied window pointer. Upon failure, GetPane() // returns an empty wxAuiPaneInfo, a condition which can be checked @@ -3392,7 +3399,7 @@ void wxAuiManager::OnFloatingPaneMoving(wxWindow* wnd, wxDirection dir) // if a key modifier is pressed while dragging the frame, // don't dock the window - if (wxGetKeyState(WXK_CONTROL) || wxGetKeyState(WXK_ALT)) + if (!CanDockPanel(pane)) { HideHint(); return; @@ -3467,7 +3474,7 @@ void wxAuiManager::OnFloatingPaneMoved(wxWindow* wnd, wxDirection dir) // if a key modifier is pressed while dragging the frame, // don't dock the window - if (!wxGetKeyState(WXK_CONTROL) && !wxGetKeyState(WXK_ALT)) + if (CanDockPanel(pane)) { // do the drop calculation DoDrop(m_docks, m_panes, pane, client_pt, action_offset);