wxFrameManager::Render() now fires a new event, called wxEVT_AUI_RENDER, which allows all main window drawing operations to be overridden to provide custom drawing behavior

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40070 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Benjamin Williams
2006-07-11 15:24:25 +00:00
parent a2cccbc3f3
commit 673727f39c
2 changed files with 48 additions and 14 deletions

View File

@@ -464,20 +464,25 @@ protected:
virtual void ShowHint(const wxRect& rect); virtual void ShowHint(const wxRect& rect);
virtual void HideHint(); virtual void HideHint();
public:
// public events (which can be invoked externally)
void OnRender(wxFrameManagerEvent& evt);
void OnPaneButton(wxFrameManagerEvent& evt);
protected: protected:
// events // protected events
void OnPaint(wxPaintEvent& event); void OnPaint(wxPaintEvent& evt);
void OnEraseBackground(wxEraseEvent& event); void OnEraseBackground(wxEraseEvent& evt);
void OnSize(wxSizeEvent& event); void OnSize(wxSizeEvent& evt);
void OnSetCursor(wxSetCursorEvent& event); void OnSetCursor(wxSetCursorEvent& evt);
void OnLeftDown(wxMouseEvent& event); void OnLeftDown(wxMouseEvent& evt);
void OnLeftUp(wxMouseEvent& event); void OnLeftUp(wxMouseEvent& evt);
void OnMotion(wxMouseEvent& event); void OnMotion(wxMouseEvent& evt);
void OnLeaveWindow(wxMouseEvent& event); void OnLeaveWindow(wxMouseEvent& evt);
void OnPaneButton(wxFrameManagerEvent& event); void OnChildFocus(wxChildFocusEvent& evt);
void OnChildFocus(wxChildFocusEvent& event); void OnHintFadeTimer(wxTimerEvent& evt);
void OnHintFadeTimer(wxTimerEvent& event);
protected: protected:
@@ -533,6 +538,7 @@ public:
button = 0; button = 0;
veto_flag = false; veto_flag = false;
canveto_flag = true; canveto_flag = true;
dc = NULL;
} }
#ifndef SWIG #ifndef SWIG
wxFrameManagerEvent(const wxFrameManagerEvent& c) : wxEvent(c) wxFrameManagerEvent(const wxFrameManagerEvent& c) : wxEvent(c)
@@ -541,14 +547,18 @@ public:
button = c.button; button = c.button;
veto_flag = c.veto_flag; veto_flag = c.veto_flag;
canveto_flag = c.canveto_flag; canveto_flag = c.canveto_flag;
dc = c.dc;
} }
#endif #endif
wxEvent *Clone() const { return new wxFrameManagerEvent(*this); } wxEvent *Clone() const { return new wxFrameManagerEvent(*this); }
void SetPane(wxPaneInfo* p) { pane = p; } void SetPane(wxPaneInfo* p) { pane = p; }
void SetButton(int b) { button = b; } void SetButton(int b) { button = b; }
void SetDC(wxDC* pdc) { dc = pdc; }
wxPaneInfo* GetPane() { return pane; } wxPaneInfo* GetPane() { return pane; }
int GetButton() { return button; } int GetButton() { return button; }
wxDC* GetDC() { 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; }
@@ -560,6 +570,7 @@ public:
int button; int button;
bool veto_flag; bool veto_flag;
bool canveto_flag; bool canveto_flag;
wxDC* dc;
#ifndef SWIG #ifndef SWIG
private: private:
@@ -676,6 +687,7 @@ public:
BEGIN_DECLARE_EVENT_TYPES() BEGIN_DECLARE_EVENT_TYPES()
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_AUI_PANEBUTTON, 0) DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_AUI_PANEBUTTON, 0)
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_AUI_PANECLOSE, 0) DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_AUI_PANECLOSE, 0)
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_AUI_RENDER, 0)
END_DECLARE_EVENT_TYPES() END_DECLARE_EVENT_TYPES()
typedef void (wxEvtHandler::*wxFrameManagerEventFunction)(wxFrameManagerEvent&); typedef void (wxEvtHandler::*wxFrameManagerEventFunction)(wxFrameManagerEvent&);
@@ -687,15 +699,19 @@ typedef void (wxEvtHandler::*wxFrameManagerEventFunction)(wxFrameManagerEvent&);
wx__DECLARE_EVT0(wxEVT_AUI_PANEBUTTON, wxFrameManagerEventHandler(func)) wx__DECLARE_EVT0(wxEVT_AUI_PANEBUTTON, wxFrameManagerEventHandler(func))
#define EVT_AUI_PANECLOSE(func) \ #define EVT_AUI_PANECLOSE(func) \
wx__DECLARE_EVT0(wxEVT_AUI_PANECLOSE, wxFrameManagerEventHandler(func)) wx__DECLARE_EVT0(wxEVT_AUI_PANECLOSE, wxFrameManagerEventHandler(func))
#define EVT_AUI_RENDER(func) \
wx__DECLARE_EVT0(wxEVT_AUI_RENDER, wxFrameManagerEventHandler(func))
#else #else
%constant wxEventType wxEVT_AUI_PANEBUTTON; %constant wxEventType wxEVT_AUI_PANEBUTTON;
%constant wxEventType wxEVT_AUI_PANECLOSE; %constant wxEventType wxEVT_AUI_PANECLOSE;
%constant wxEventType wxEVT_AUI_RENDER;
%pythoncode { %pythoncode {
EVT_AUI_PANEBUTTON = wx.PyEventBinder( wxEVT_AUI_PANEBUTTON ) EVT_AUI_PANEBUTTON = wx.PyEventBinder( wxEVT_AUI_PANEBUTTON )
EVT_AUI_PANECLOSE = wx.PyEventBinder( wxEVT_AUI_PANECLOSE ) EVT_AUI_PANECLOSE = wx.PyEventBinder( wxEVT_AUI_PANECLOSE )
EVT_AUI_RENDER = wx.PyEventBinder( wxEVT_AUI_RENDER )
} }
#endif // SWIG #endif // SWIG

View File

@@ -53,6 +53,7 @@ wxPaneInfo wxNullPaneInfo;
wxDockInfo wxNullDockInfo; wxDockInfo wxNullDockInfo;
DEFINE_EVENT_TYPE(wxEVT_AUI_PANEBUTTON) DEFINE_EVENT_TYPE(wxEVT_AUI_PANEBUTTON)
DEFINE_EVENT_TYPE(wxEVT_AUI_PANECLOSE) DEFINE_EVENT_TYPE(wxEVT_AUI_PANECLOSE)
DEFINE_EVENT_TYPE(wxEVT_AUI_RENDER)
#ifdef __WXMAC__ #ifdef __WXMAC__
// a few defines to avoid nameclashes // a few defines to avoid nameclashes
@@ -376,6 +377,7 @@ static int PaneSortFunc(wxPaneInfo** p1, wxPaneInfo** p2)
BEGIN_EVENT_TABLE(wxFrameManager, wxEvtHandler) BEGIN_EVENT_TABLE(wxFrameManager, wxEvtHandler)
EVT_AUI_PANEBUTTON(wxFrameManager::OnPaneButton) EVT_AUI_PANEBUTTON(wxFrameManager::OnPaneButton)
EVT_AUI_RENDER(wxFrameManager::OnRender)
EVT_PAINT(wxFrameManager::OnPaint) EVT_PAINT(wxFrameManager::OnPaint)
EVT_ERASE_BACKGROUND(wxFrameManager::OnEraseBackground) EVT_ERASE_BACKGROUND(wxFrameManager::OnEraseBackground)
EVT_SIZE(wxFrameManager::OnSize) EVT_SIZE(wxFrameManager::OnSize)
@@ -2842,12 +2844,14 @@ void wxFrameManager::OnFloatingPaneActivated(wxWindow* wnd)
} }
} }
// Render() draws all of the pane captions, sashes, // OnRender() draws all of the pane captions, sashes,
// backgrounds, captions, grippers, pane borders and buttons. // backgrounds, captions, grippers, pane borders and buttons.
// It renders the entire user interface. // It renders the entire user interface.
void wxFrameManager::Render(wxDC* dc) void wxFrameManager::OnRender(wxFrameManagerEvent& evt)
{ {
wxDC* dc = evt.GetDC();
#ifdef __WXMAC__ #ifdef __WXMAC__
dc->Clear() ; dc->Clear() ;
#endif #endif
@@ -2887,6 +2891,20 @@ void wxFrameManager::Render(wxDC* dc)
} }
} }
// Render() fire a render event, which is normally handled by
// wxFrameManager::OnRender(). This allows the render function to
// be overridden via the render event. This can be useful for paintin
// custom graphics in the main window. Default behavior can be
// invoked in the overridden function by calling OnRender()
void wxFrameManager::Render(wxDC* dc)
{
wxFrameManagerEvent e(wxEVT_AUI_RENDER);
e.SetDC(dc);
ProcessMgrEvent(e);
}
void wxFrameManager::Repaint(wxDC* dc) void wxFrameManager::Repaint(wxDC* dc)
{ {
#ifdef __WXMAC__ #ifdef __WXMAC__