void SetArtProvider(wxAuiTabArt* provider);
wxAuiTabArt* GetArtProvider();
wxAuiNotebook* GetNotebook() const;
-
+
#if wxUSE_MENUS
wxMenu* GetWindowMenu() const { return m_pWindowMenu; }
void SetWindowMenu(wxMenu* pMenu);
void SetChildMenuBar(wxAuiMDIChildFrame *pChild);
- virtual bool ProcessEvent(wxEvent& event);
-
wxAuiMDIChildFrame *GetActiveChild() const;
void SetActiveChild(wxAuiMDIChildFrame* pChildFrame);
void DoHandleMenu(wxCommandEvent &event);
#endif // wxUSE_MENUS
+ virtual bool ProcessEvent(wxEvent& event);
+
virtual void DoGetClientSize(int *width, int *height) const;
private:
virtual void SetIcons(const wxIconBundle& icons);
virtual const wxIconBundle& GetIcons() const;
-
+
virtual void SetIcon(const wxIcon& icon);
virtual const wxIcon& GetIcon() const;
void SetMDIParentFrame(wxAuiMDIParentFrame* parent);
wxAuiMDIParentFrame* GetMDIParentFrame() const;
-
+
protected:
void Init();
virtual void DoSetSize(int x, int y, int width, int height, int size_flags);
virtual void SetMenuBar(wxMenuBar *pMenuBar);
#endif // wxUSE_MENUS
- virtual bool ProcessEvent(wxEvent& event);
-
virtual wxGenericMDIClientWindow *OnCreateGenericClient();
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
// 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
// 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();
// this widget will be queried for GTK's focus events
GtkWidget *m_focusWidget;
-
+
void GTKDisableFocusOutEvent();
void GTKEnableFocusOutEvent();
#ifndef SWIG
- virtual bool ProcessEvent( wxEvent& event );
//
// Event handlers
//
virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle) const;
#endif*/
+ virtual bool ProcessEvent( wxEvent& event );
+
/** Recalculates new positions for components, according to the
given size.
*/
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
// ----------
explanations of when you might want to do it.
*/
void SendDestroyEvent();
+
+ //@{
+ /**
+ This function is public in wxEvtHandler but is protected in wxWindow because
+ for wxWindows you should always use this function on the pointer returned
+ by GetEventHandler() and not on the wxWindow object itself.
+
+ Note that it's still possible to call these functions directly on the
+ wxWindow object (e.g. downcasting it to wxEvtHandler) but doing that
+ will create subtle bugs when windows with event handlers pushed on them
+ are involved.
+ */
+ virtual bool ProcessEvent(wxEvent& event);
+ bool SafelyProcessEvent(wxEvent& event);
+ virtual void QueueEvent(wxEvent *event);
+ virtual void AddPendingEvent(const wxEvent& event);
+ void ProcessPendingEvents();
+ bool ProcessThreadEvent(const wxEvent& event);
+ //@}
};
void OnHandleCrash(wxCommandEvent& event);
#endif
+protected:
+
// 1st-level exception handling: we overload ProcessEvent() to be able to
// catch exceptions which occur in MyFrame methods here
virtual bool ProcessEvent(wxEvent& event);
void OnPreview(wxCommandEvent& event);
void OnPageSetup(wxCommandEvent& event);
+protected:
+
// Forward command events to the current rich text control, if any
bool ProcessEvent(wxEvent& event);
s_id = event.GetId();
wxWindow* focusWin = wxFindFocusDescendant(this);
- if (focusWin && focusWin->ProcessEvent(event))
+ if (focusWin && focusWin->GetEventHandler()->ProcessEvent(event))
{
//s_command = NULL;
s_eventType = 0;
// edit events
void AppFrame::OnEdit (wxCommandEvent &event) {
- if (m_edit) m_edit->ProcessEvent (event);
+ if (m_edit) m_edit->GetEventHandler()->ProcessEvent (event);
}
// private functions
e.SetEventObject(this);
e.SetToolId(-1);
e.SetClickPoint(wxPoint(evt.GetX(), evt.GetY()));
- bool processed = ProcessEvent(e);
+ bool processed = GetEventHandler()->ProcessEvent(e);
if (processed)
{
{
wxCommandEvent e(wxEVT_COMMAND_MENU_SELECTED, res);
e.SetEventObject(this);
- GetParent()->ProcessEvent(e);
+ GetParent()->GetEventHandler()->ProcessEvent(e);
}
}
e.SetClickPoint(evt.GetPosition());
e.SetItemRect(rect);
- ProcessEvent(e);
+ GetEventHandler()->ProcessEvent(e);
DoIdleUpdate();
}
}
wxCommandEvent e(wxEVT_COMMAND_MENU_SELECTED, m_action_item->id);
e.SetEventObject(this);
- ProcessEvent(e);
+ GetEventHandler()->ProcessEvent(e);
DoIdleUpdate();
}
else
{
wxCommandEvent e(wxEVT_COMMAND_MENU_SELECTED, m_action_item->id);
e.SetEventObject(this);
- ProcessEvent(e);
+ GetEventHandler()->ProcessEvent(e);
DoIdleUpdate();
}
}
e.SetEventObject(this);
e.SetToolId(m_action_item->id);
e.SetClickPoint(m_action_pos);
- ProcessEvent(e);
+ GetEventHandler()->ProcessEvent(e);
DoIdleUpdate();
}
}
e.SetEventObject(this);
e.SetToolId(-1);
e.SetClickPoint(m_action_pos);
- ProcessEvent(e);
+ GetEventHandler()->ProcessEvent(e);
DoIdleUpdate();
}
e.SetEventObject(this);
e.SetToolId(m_action_item->id);
e.SetClickPoint(m_action_pos);
- ProcessEvent(e);
+ GetEventHandler()->ProcessEvent(e);
DoIdleUpdate();
}
}
wxAuiToolBarEvent e(wxEVT_COMMAND_AUITOOLBAR_BEGIN_DRAG, GetId());
e.SetEventObject(this);
e.SetToolId(m_action_item->id);
- ProcessEvent(e);
+ GetEventHandler()->ProcessEvent(e);
DoIdleUpdate();
return;
}
wxAuiManagerEvent evt(wxEVT_AUI_FIND_MANAGER);
evt.SetManager(NULL);
evt.ResumePropagation(wxEVENT_PROPAGATE_MAX);
- if (!window->ProcessEvent(evt))
+ if (!window->GetEventHandler()->ProcessEvent(evt))
return NULL;
return evt.GetManager();
// first, give the owner frame a chance to override
if (m_frame)
{
- if (m_frame->ProcessEvent(event))
+ if (m_frame->GetEventHandler()->ProcessEvent(event))
return;
}
void wxChoiceBase::Command(wxCommandEvent& event)
{
SetSelection(event.GetInt());
- (void)ProcessEvent(event);
+ (void)GetEventHandler()->ProcessEvent(event);
}
#endif // wxUSE_CHOICE
wxWindowList children = m_combo->GetPopupWindow()->GetChildren();
wxWindowList::iterator node = children.begin();
wxWindow* child = (wxWindow*)*node;
- child->AddPendingEvent(event);
+ child->GetEventHandler()->AddPendingEvent(event);
}
#if USES_WXDIALOG
m_btn->Enable(enable);
if ( m_text )
m_text->Enable(enable);
-
+
Refresh();
return true;
if ( IsPopupShown() )
{
// pass it to the popped up control
- GetPopupControl()->GetControl()->AddPendingEvent(event);
+ GetPopupControl()->GetControl()->GetEventHandler()->AddPendingEvent(event);
}
else // no popup
{
void wxListBoxBase::Command(wxCommandEvent& event)
{
SetSelection(event.GetInt(), event.GetExtraLong() != 0);
- (void)ProcessEvent(event);
+ (void)GetEventHandler()->ProcessEvent(event);
}
// ----------------------------------------------------------------------------
// Reduce flicker by updating the splitter pane sizes before the
// frame is shown
wxSizeEvent sizeEvent(GetSize(), GetId());
- ProcessEvent(sizeEvent);
+ GetEventHandler()->ProcessEvent(sizeEvent);
if (m_Splitter)
m_Splitter->UpdateSize();
jwx_event.SetEventObject(m_catchwin);
if (m_catchwin)
- m_catchwin->AddPendingEvent(jwx_event);
+ m_catchwin->GetEventHandler()->AddPendingEvent(jwx_event);
}
void* wxJoystickThread::Entry()
TestWindow * const child = new TestWindow(parent, 'c');
- child->ProcessEvent(event);
+ child->GetEventHandler()->ProcessEvent(event);
CPPUNIT_ASSERT_EQUAL( "acpA", g_str );
}