added wxAuiManager::GetManager() call

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43467 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Benjamin Williams
2006-11-17 13:07:01 +00:00
parent 28f9f58ca0
commit 4dc79cfb52
4 changed files with 69 additions and 8 deletions

View File

@@ -42,6 +42,7 @@ public:
);
virtual ~wxAuiFloatingFrame();
void SetPaneWindow(const wxAuiPaneInfo& pane);
wxAuiManager* GetOwnerManager() const;
protected:
virtual void OnMoveStart();
@@ -55,6 +56,7 @@ private:
void OnIdle(wxIdleEvent& event);
void OnActivate(wxActivateEvent& event);
static bool isMouseDown();
private:
wxWindow* m_pane_window; // pane window being managed
bool m_solid_drag; // true if system uses solid window drag
@@ -70,7 +72,7 @@ private:
#ifndef SWIG
DECLARE_EVENT_TABLE()
DECLARE_CLASS(wxAuiFloatingFrameBaseClass)
DECLARE_CLASS(wxAuiFloatingFrame)
#endif // SWIG
};

View File

@@ -431,6 +431,8 @@ public:
void SetManagedWindow(wxWindow* managed_wnd);
wxWindow* GetManagedWindow() const;
static wxAuiManager* GetManager(wxWindow* window);
#ifdef SWIG
%disownarg( wxAuiDockArt* art_provider );
#endif
@@ -473,7 +475,6 @@ public:
void Update();
public:
virtual wxAuiFloatingFrame* CreateFloatingFrame(wxWindow* parent, const wxAuiPaneInfo& p);
@@ -567,6 +568,7 @@ protected:
void OnLeaveWindow(wxMouseEvent& evt);
void OnChildFocus(wxChildFocusEvent& evt);
void OnHintFadeTimer(wxTimerEvent& evt);
void OnFindManager(wxAuiManagerEvent& evt);
protected:
@@ -610,6 +612,7 @@ protected:
#ifndef SWIG
DECLARE_EVENT_TABLE()
DECLARE_CLASS(wxAuiManager)
#endif // SWIG
};
@@ -622,6 +625,7 @@ class WXDLLIMPEXP_AUI wxAuiManagerEvent : public wxEvent
public:
wxAuiManagerEvent(wxEventType type=wxEVT_NULL) : wxEvent(0, type)
{
manager = NULL;
pane = NULL;
button = 0;
veto_flag = false;
@@ -631,6 +635,7 @@ public:
#ifndef SWIG
wxAuiManagerEvent(const wxAuiManagerEvent& c) : wxEvent(c)
{
manager = c.manager;
pane = c.pane;
button = c.button;
veto_flag = c.veto_flag;
@@ -640,13 +645,15 @@ public:
#endif
wxEvent *Clone() const { return new wxAuiManagerEvent(*this); }
void SetManager(wxAuiManager* mgr) { manager = mgr; }
void SetPane(wxAuiPaneInfo* p) { pane = p; }
void SetButton(int b) { button = b; }
void SetDC(wxDC* pdc) { dc = pdc; }
wxAuiPaneInfo* GetPane() { return pane; }
int GetButton() { return button; }
wxDC* GetDC() { return dc; }
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; }
@@ -654,6 +661,7 @@ public:
bool CanVeto() const { return canveto_flag && veto_flag; }
public:
wxAuiManager* manager;
wxAuiPaneInfo* pane;
int button;
bool veto_flag;
@@ -778,6 +786,7 @@ BEGIN_DECLARE_EVENT_TYPES()
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_AUI_PANEMAXIMIZE, 0)
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_AUI_PANERESTORE, 0)
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_AUI_RENDER, 0)
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_AUI_FINDMANAGER, 0)
END_DECLARE_EVENT_TYPES()
typedef void (wxEvtHandler::*wxAuiManagerEventFunction)(wxAuiManagerEvent&);
@@ -795,6 +804,8 @@ typedef void (wxEvtHandler::*wxAuiManagerEventFunction)(wxAuiManagerEvent&);
wx__DECLARE_EVT0(wxEVT_AUI_PANERESTORE, wxAuiManagerEventHandler(func))
#define EVT_AUI_RENDER(func) \
wx__DECLARE_EVT0(wxEVT_AUI_RENDER, wxAuiManagerEventHandler(func))
#define EVT_AUI_FINDMANAGER(func) \
wx__DECLARE_EVT0(wxEVT_AUI_FINDMANAGER, wxAuiManagerEventHandler(func))
#else
@@ -803,6 +814,7 @@ typedef void (wxEvtHandler::*wxAuiManagerEventFunction)(wxAuiManagerEvent&);
%constant wxEventType wxEVT_AUI_PANEMAXIMIZE;
%constant wxEventType wxEVT_AUI_PANERESTORE;
%constant wxEventType wxEVT_AUI_RENDER;
%constant wxEventType wxEVT_AUI_FINDMANAGER;
%pythoncode {
EVT_AUI_PANEBUTTON = wx.PyEventBinder( wxEVT_AUI_PANEBUTTON )
@@ -810,6 +822,7 @@ typedef void (wxEvtHandler::*wxAuiManagerEventFunction)(wxAuiManagerEvent&);
EVT_AUI_PANEMAXIMIZE = wx.PyEventBinder( wxEVT_AUI_PANEMAXIMIZE )
EVT_AUI_PANERESTORE = wx.PyEventBinder( wxEVT_AUI_PANERESTORE )
EVT_AUI_RENDER = wx.PyEventBinder( wxEVT_AUI_RENDER )
EVT_AUI_FINDMANAGER = wx.PyEventBinder( wxEVT_AUI_FINDMANAGER )
}
#endif // SWIG

View File

@@ -36,7 +36,7 @@
#include "wx/msw/private.h"
#endif
IMPLEMENT_CLASS( wxAuiFloatingFrame, wxAuiFloatingFrameBaseClass )
IMPLEMENT_CLASS(wxAuiFloatingFrame, wxAuiFloatingFrameBaseClass)
wxAuiFloatingFrame::wxAuiFloatingFrame(wxWindow* parent,
wxAuiManager* owner_mgr,
@@ -73,7 +73,8 @@ wxAuiFloatingFrame::wxAuiFloatingFrame(wxWindow* parent,
wxAuiFloatingFrame::~wxAuiFloatingFrame()
{
// if we do not do this, then we can crash...
if(m_owner_mgr && m_owner_mgr->m_action_window == this) {
if(m_owner_mgr && m_owner_mgr->m_action_window == this)
{
m_owner_mgr->m_action_window = NULL;
}
m_mgr.UnInit();
@@ -131,6 +132,12 @@ void wxAuiFloatingFrame::SetPaneWindow(const wxAuiPaneInfo& pane)
}
}
wxAuiManager* wxAuiFloatingFrame::GetOwnerManager() const
{
return m_owner_mgr;
}
void wxAuiFloatingFrame::OnSize(wxSizeEvent& event)
{
m_owner_mgr->OnFloatingPaneResized(m_pane_window, event.GetSize());

View File

@@ -57,6 +57,7 @@ DEFINE_EVENT_TYPE(wxEVT_AUI_PANECLOSE)
DEFINE_EVENT_TYPE(wxEVT_AUI_PANEMAXIMIZE)
DEFINE_EVENT_TYPE(wxEVT_AUI_PANERESTORE)
DEFINE_EVENT_TYPE(wxEVT_AUI_RENDER)
DEFINE_EVENT_TYPE(wxEVT_AUI_FINDMANAGER)
#ifdef __WXMAC__
// a few defines to avoid nameclashes
@@ -66,7 +67,7 @@ DEFINE_EVENT_TYPE(wxEVT_AUI_RENDER)
#endif
IMPLEMENT_DYNAMIC_CLASS(wxAuiManagerEvent, wxEvent)
IMPLEMENT_CLASS(wxAuiManager, wxEvtHandler)
// private manager flags (not yet on the public API)
enum wxAuiPrivateManagerOption
@@ -485,6 +486,7 @@ BEGIN_EVENT_TABLE(wxAuiManager, wxEvtHandler)
EVT_MOTION(wxAuiManager::OnMotion)
EVT_LEAVE_WINDOW(wxAuiManager::OnLeaveWindow)
EVT_CHILD_FOCUS(wxAuiManager::OnChildFocus)
EVT_AUI_FINDMANAGER(wxAuiManager::OnFindManager)
EVT_TIMER(101, wxAuiManager::OnHintFadeTimer)
END_EVENT_TABLE()
@@ -635,6 +637,22 @@ wxFrame* wxAuiManager::GetFrame() const
}
// this function will return the aui manager for a given
// window. The |window| parameter should be any child window
// or grand-child window (and so on) of the frame/window
// managed by wxAuiManager. The |window| parameter does not
// need to be managed by the manager itself.
wxAuiManager* wxAuiManager::GetManager(wxWindow* window)
{
wxAuiManagerEvent evt(wxEVT_AUI_FINDMANAGER);
evt.ResumePropagation(wxEVENT_PROPAGATE_MAX);
if (!window->ProcessEvent(evt))
return NULL;
return evt.GetManager();
}
void wxAuiManager::UpdateHintWindowConfig()
{
// find out if the the system can do transparent frames
@@ -3535,6 +3553,27 @@ void wxAuiManager::OnSize(wxSizeEvent& event)
event.Skip();
}
void wxAuiManager::OnFindManager(wxAuiManagerEvent& evt)
{
// get the window we are managing, if none, return NULL
wxWindow* window = GetManagedWindow();
if (!window)
{
evt.SetManager(NULL);
return;
}
// if we are managing a child frame, get the 'real' manager
if (window->IsKindOf(CLASSINFO(wxAuiFloatingFrame)))
{
wxAuiFloatingFrame* float_frame = static_cast<wxAuiFloatingFrame*>(window);
evt.SetManager(float_frame->GetOwnerManager());
return;
}
// return pointer to ourself
evt.SetManager(this);
}
void wxAuiManager::OnSetCursor(wxSetCursorEvent& event)
{