Change in wxWindow the access specifier of the wxEvtHandler event processing and queuing functions

from public to protected. Adapt wxWidgets code and wxWidgets samples to always use wxWindow::GetEventHandler()
when calling such functions on a wxWindow rather than directly using wxWindow::ProcessEvent, etc.
This enables correct event dispatching to the event handlers which have been pushed (with PushEventHandler) on the 
windows.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58381 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Francesco Montorsi
2009-01-25 11:58:39 +00:00
parent 838ab05ede
commit 004867dbc5
17 changed files with 76 additions and 32 deletions

View File

@@ -61,7 +61,7 @@ public:
void SetArtProvider(wxAuiTabArt* provider);
wxAuiTabArt* GetArtProvider();
wxAuiNotebook* GetNotebook() const;
#if wxUSE_MENUS
wxMenu* GetWindowMenu() const { return m_pWindowMenu; }
void SetWindowMenu(wxMenu* pMenu);
@@ -71,8 +71,6 @@ public:
void SetChildMenuBar(wxAuiMDIChildFrame *pChild);
virtual bool ProcessEvent(wxEvent& event);
wxAuiMDIChildFrame *GetActiveChild() const;
void SetActiveChild(wxAuiMDIChildFrame* pChildFrame);
@@ -105,6 +103,8 @@ protected:
void DoHandleMenu(wxCommandEvent &event);
#endif // wxUSE_MENUS
virtual bool ProcessEvent(wxEvent& event);
virtual void DoGetClientSize(int *width, int *height) const;
private:
@@ -147,7 +147,7 @@ public:
virtual void SetIcons(const wxIconBundle& icons);
virtual const wxIconBundle& GetIcons() const;
virtual void SetIcon(const wxIcon& icon);
virtual const wxIcon& GetIcon() const;
@@ -196,7 +196,7 @@ public:
void SetMDIParentFrame(wxAuiMDIParentFrame* parent);
wxAuiMDIParentFrame* GetMDIParentFrame() const;
protected:
void Init();
virtual void DoSetSize(int x, int y, int width, int height, int size_flags);

View File

@@ -78,8 +78,6 @@ public:
virtual void SetMenuBar(wxMenuBar *pMenuBar);
#endif // wxUSE_MENUS
virtual bool ProcessEvent(wxEvent& event);
virtual wxGenericMDIClientWindow *OnCreateGenericClient();
@@ -112,6 +110,8 @@ private:
void OnWindowMenu(wxCommandEvent& event);
#endif // wxUSE_MENUS
virtual bool ProcessEvent(wxEvent& event);
void OnClose(wxCloseEvent& event);
// return the client window, may be NULL if we hadn't been created yet

View File

@@ -166,7 +166,7 @@ public:
// override this if some events should never be consumed by wxWidgets but
// but have to be left for the native control
//
// base version just does GetEventHandler()->ProcessEvent()
// base version just calls HandleWindowEvent()
virtual bool GTKProcessEvent(wxEvent& event) const;
// Map GTK widget direction of the given widget to/from wxLayoutDirection
@@ -178,7 +178,7 @@ public:
// there is also the exception of wxMenuBar)
virtual bool GTKNeedsParent() const { return !IsTopLevel(); }
// This is called when capture is taken from the window. It will
// This is called when capture is taken from the window. It will
// fire off capture lost events.
void GTKReleaseMouseAndNotify();
@@ -256,7 +256,7 @@ public:
// this widget will be queried for GTK's focus events
GtkWidget *m_focusWidget;
void GTKDisableFocusOutEvent();
void GTKEnableFocusOutEvent();

View File

@@ -634,7 +634,6 @@ public:
#ifndef SWIG
virtual bool ProcessEvent( wxEvent& event );
//
// Event handlers
//
@@ -707,6 +706,8 @@ protected:
virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle) const;
#endif*/
virtual bool ProcessEvent( wxEvent& event );
/** Recalculates new positions for components, according to the
given size.
*/

View File

@@ -817,6 +817,26 @@ public:
virtual void SetNextHandler(wxEvtHandler *handler);
virtual void SetPreviousHandler(wxEvtHandler *handler);
protected:
// NOTE: we change the access specifier of the following wxEvtHandler functions
// so that the user won't be able to call them directly.
// Calling wxWindow::ProcessEvent in fact only works when there are NO
// event handlers pushed on the window.
// To ensure correct operation, instead of wxWindow::ProcessEvent
// you must always call wxWindow::GetEventHandler()->ProcessEvent()
// or HandleWindowEvent().
// The same holds for all other wxEvtHandler functions.
wxEvtHandler::ProcessEvent;
wxEvtHandler::ProcessThreadEvent;
wxEvtHandler::SafelyProcessEvent;
wxEvtHandler::ProcessPendingEvents;
wxEvtHandler::AddPendingEvent;
wxEvtHandler::QueueEvent;
public:
// validators
// ----------