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
This commit is contained in:
Julian Smart
2007-08-21 11:04:48 +00:00
parent 6757b667fd
commit 858a3a7a45
2 changed files with 27 additions and 19 deletions

View File

@@ -166,7 +166,7 @@ public:
} }
~wxAuiPaneInfo() {} ~wxAuiPaneInfo() {}
#ifndef SWIG #ifndef SWIG
wxAuiPaneInfo(const wxAuiPaneInfo& c) wxAuiPaneInfo(const wxAuiPaneInfo& c)
{ {
@@ -347,12 +347,12 @@ public:
#ifdef SWIG #ifdef SWIG
%typemap(out) wxAuiPaneInfo& ; %typemap(out) wxAuiPaneInfo& ;
#endif #endif
public: public:
// NOTE: You can add and subtract flags from this list, // NOTE: You can add and subtract flags from this list,
// but do not change the values of the flags, because // 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 // perspective string. If you really need to change the
// values around, you'll have to ensure backwards-compatibility // values around, you'll have to ensure backwards-compatibility
// in the perspective loading code. // in the perspective loading code.
@@ -380,11 +380,11 @@ public:
buttonMaximize = 1 << 22, buttonMaximize = 1 << 22,
buttonMinimize = 1 << 23, buttonMinimize = 1 << 23,
buttonPin = 1 << 24, buttonPin = 1 << 24,
buttonCustom1 = 1 << 26, buttonCustom1 = 1 << 26,
buttonCustom2 = 1 << 27, buttonCustom2 = 1 << 27,
buttonCustom3 = 1 << 28, buttonCustom3 = 1 << 28,
savedHiddenState = 1 << 30, // used internally savedHiddenState = 1 << 30, // used internally
actionPane = 1 << 31 // used internally actionPane = 1 << 31 // used internally
}; };
@@ -450,7 +450,7 @@ public:
bool AddPane(wxWindow* window, bool AddPane(wxWindow* window,
const wxAuiPaneInfo& pane_info); const wxAuiPaneInfo& pane_info);
bool AddPane(wxWindow* window, bool AddPane(wxWindow* window,
const wxAuiPaneInfo& pane_info, const wxAuiPaneInfo& pane_info,
const wxPoint& drop_pos); const wxPoint& drop_pos);
@@ -464,7 +464,7 @@ public:
int insert_level = wxAUI_INSERT_PANE); int insert_level = wxAUI_INSERT_PANE);
bool DetachPane(wxWindow* window); bool DetachPane(wxWindow* window);
void Update(); void Update();
wxString SavePaneInfo(wxAuiPaneInfo& pane); wxString SavePaneInfo(wxAuiPaneInfo& pane);
@@ -474,7 +474,7 @@ public:
void SetDockSizeConstraint(double width_pct, double height_pct); void SetDockSizeConstraint(double width_pct, double height_pct);
void GetDockSizeConstraint(double* width_pct, double* height_pct) const; void GetDockSizeConstraint(double* width_pct, double* height_pct) const;
void ClosePane(wxAuiPaneInfo& pane_info); void ClosePane(wxAuiPaneInfo& pane_info);
void MaximizePane(wxAuiPaneInfo& pane_info); void MaximizePane(wxAuiPaneInfo& pane_info);
void RestorePane(wxAuiPaneInfo& pane_info); void RestorePane(wxAuiPaneInfo& pane_info);
@@ -483,6 +483,7 @@ public:
public: public:
virtual wxAuiFloatingFrame* CreateFloatingFrame(wxWindow* parent, const wxAuiPaneInfo& p); virtual wxAuiFloatingFrame* CreateFloatingFrame(wxWindow* parent, const wxAuiPaneInfo& p);
virtual bool CanDockPanel(const wxAuiPaneInfo & p);
void StartPaneDrag( void StartPaneDrag(
wxWindow* pane_window, wxWindow* pane_window,
@@ -492,12 +493,12 @@ public:
wxWindow* pane_window, wxWindow* pane_window,
const wxPoint& pt, const wxPoint& pt,
const wxPoint& offset); const wxPoint& offset);
void DrawHintRect( void DrawHintRect(
wxWindow* pane_window, wxWindow* pane_window,
const wxPoint& pt, const wxPoint& pt,
const wxPoint& offset); const wxPoint& offset);
virtual void ShowHint(const wxRect& rect); virtual void ShowHint(const wxRect& rect);
virtual void HideHint(); virtual void HideHint();
@@ -505,14 +506,14 @@ public:
// deprecated -- please use SetManagedWindow() and // deprecated -- please use SetManagedWindow() and
// and GetManagedWindow() instead // and GetManagedWindow() instead
wxDEPRECATED( void SetFrame(wxFrame* frame) ); wxDEPRECATED( void SetFrame(wxFrame* frame) );
wxDEPRECATED( wxFrame* GetFrame() const ); wxDEPRECATED( wxFrame* GetFrame() const );
protected: protected:
void UpdateHintWindowConfig(); void UpdateHintWindowConfig();
void DoFrameLayout(); void DoFrameLayout();
void LayoutAddPane(wxSizer* container, void LayoutAddPane(wxSizer* container,
@@ -622,7 +623,7 @@ protected:
wxTimer m_hint_fadetimer; // transparent fade timer wxTimer m_hint_fadetimer; // transparent fade timer
wxByte m_hint_fadeamt; // transparent fade amount wxByte m_hint_fadeamt; // transparent fade amount
wxByte m_hint_fademax; // maximum value of hint fade wxByte m_hint_fademax; // maximum value of hint fade
void* m_reserved; void* m_reserved;
#ifndef SWIG #ifndef SWIG
@@ -664,17 +665,17 @@ public:
void SetPane(wxAuiPaneInfo* p) { pane = p; } void SetPane(wxAuiPaneInfo* p) { pane = p; }
void SetButton(int b) { button = b; } void SetButton(int b) { button = b; }
void SetDC(wxDC* pdc) { dc = pdc; } void SetDC(wxDC* pdc) { dc = pdc; }
wxAuiManager* GetManager() const { return manager; } wxAuiManager* GetManager() const { return manager; }
wxAuiPaneInfo* GetPane() const { return pane; } wxAuiPaneInfo* GetPane() const { return pane; }
int GetButton() const { return button; } int GetButton() const { return button; }
wxDC* GetDC() const { return dc; } wxDC* GetDC() const { return dc; }
void Veto(bool veto = true) { veto_flag = veto; } void Veto(bool veto = true) { veto_flag = veto; }
bool GetVeto() const { return veto_flag; } bool GetVeto() const { return veto_flag; }
void SetCanVeto(bool can_veto) { canveto_flag = can_veto; } void SetCanVeto(bool can_veto) { canveto_flag = can_veto; }
bool CanVeto() const { return canveto_flag && veto_flag; } bool CanVeto() const { return canveto_flag && veto_flag; }
public: public:
wxAuiManager* manager; wxAuiManager* manager;
wxAuiPaneInfo* pane; wxAuiPaneInfo* pane;

View File

@@ -529,6 +529,13 @@ wxAuiFloatingFrame* wxAuiManager::CreateFloatingFrame(wxWindow* parent,
return new wxAuiFloatingFrame(parent, this, pane_info); 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 // GetPane() looks up a wxAuiPaneInfo structure based
// on the supplied window pointer. Upon failure, GetPane() // on the supplied window pointer. Upon failure, GetPane()
// returns an empty wxAuiPaneInfo, a condition which can be checked // 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, // if a key modifier is pressed while dragging the frame,
// don't dock the window // don't dock the window
if (wxGetKeyState(WXK_CONTROL) || wxGetKeyState(WXK_ALT)) if (!CanDockPanel(pane))
{ {
HideHint(); HideHint();
return; return;
@@ -3467,7 +3474,7 @@ void wxAuiManager::OnFloatingPaneMoved(wxWindow* wnd, wxDirection dir)
// if a key modifier is pressed while dragging the frame, // if a key modifier is pressed while dragging the frame,
// don't dock the window // don't dock the window
if (!wxGetKeyState(WXK_CONTROL) && !wxGetKeyState(WXK_ALT)) if (CanDockPanel(pane))
{ {
// do the drop calculation // do the drop calculation
DoDrop(m_docks, m_panes, pane, client_pt, action_offset); DoDrop(m_docks, m_panes, pane, client_pt, action_offset);