git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58480
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
need to review them as wxDC doesn't have any virtual methods any longer and
uses delegation instead of inheritance to present different behaviours.
need to review them as wxDC doesn't have any virtual methods any longer and
uses delegation instead of inheritance to present different behaviours.
+- wxWindow::ProcessEvent() has been made protected to prevent wrongly using it
+ instead of correct GetEventHandler()->ProcessEvent(). New ProcessWindowEvent()
+ was added for convenience.
+
- Return type of wxString::operator[] and wxString::iterator::operator* is no
longer wxChar (i.e. char or wchar_t), but wxUniChar. This is not a problem
in vast majority of cases because of conversion operators, but it can break
- Return type of wxString::operator[] and wxString::iterator::operator* is no
longer wxChar (i.e. char or wchar_t), but wxUniChar. This is not a problem
in vast majority of cases because of conversion operators, but it can break
// be there)
bool RemoveEventHandler(wxEvtHandler *handler);
// be there)
bool RemoveEventHandler(wxEvtHandler *handler);
+ // Process an event by calling GetEventHandler()->ProcessEvent(): this
+ // is a straightforward replacement for ProcessEvent() itself which
+ // shouldn't be used directly with windows as it doesn't take into
+ // account any event handlers associated with the window
+ bool ProcessWindowEvent(wxEvent& event)
+ { return GetEventHandler()->ProcessEvent(event); }
+
// Process an event by calling GetEventHandler()->ProcessEvent() and
// handling any exceptions thrown by event handlers. It's mostly useful
// when processing wx events when called from C code (e.g. in GTK+
// Process an event by calling GetEventHandler()->ProcessEvent() and
// handling any exceptions thrown by event handlers. It's mostly useful
// when processing wx events when called from C code (e.g. in GTK+
@code
GetEventHandler()->SafelyProcessEvent(event);
@endcode
@code
GetEventHandler()->SafelyProcessEvent(event);
@endcode
+
+ @see ProcessWindowEvent()
*/
bool HandleWindowEvent(wxEvent& event) const;
*/
bool HandleWindowEvent(wxEvent& event) const;
+ /**
+ Convenient wrapper for ProcessEvent().
+
+ This is the same as writing @code GetEventHandler()->ProcessEvent(event);
+ @endcode but more convenient. Notice that ProcessEvent() itself can't
+ be called for wxWindow objects as it ignores the event handlers
+ associated with the window, use this function instead.
+ */
+ bool ProcessWindowEvent(wxEvent& event);
+
/**
Removes and returns the top-most event handler on the event handler stack.
/**
Removes and returns the top-most event handler on the event handler stack.
- 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.
+ These functions are public in wxEvtHandler but 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.
+
+ For convenience, a ProcessWindowEvent() method is provided as a synonym
+ for @code GetEventHandler()->ProcessEvent() @endcode.
Note that it's still possible to call these functions directly on the
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.
+ wxWindow object (e.g. casting 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 bool ProcessEvent(wxEvent& event);
bool SafelyProcessEvent(wxEvent& event);
void wxPopupComboWindow::OnKeyDown(wxKeyEvent& event)
{
void wxPopupComboWindow::OnKeyDown(wxKeyEvent& event)
{
- m_combo->ProcessEvent(event);
+ m_combo->ProcessWindowEvent(event);
}
#endif // wxUSE_COMBOBOX && defined(__WXUNIVERSAL__)
}
#endif // wxUSE_COMBOBOX && defined(__WXUNIVERSAL__)
m_childHandler = m_currentChild;
wxON_BLOCK_EXIT_NULL(m_childHandler);
m_childHandler = m_currentChild;
wxON_BLOCK_EXIT_NULL(m_childHandler);
- if ( m_currentChild->ProcessEvent(event) )
+ if ( m_currentChild->ProcessWindowEvent(event) )
void wxNotebook::OnNavigationKey(wxNavigationKeyEvent& event)
{
void wxNotebook::OnNavigationKey(wxNavigationKeyEvent& event)
{
- if ( event.IsWindowChange() ) {
+ if ( event.IsWindowChange() )
+ {
// change pages
AdvanceSelection(event.GetDirection());
}
else {
// pass to the parent
// change pages
AdvanceSelection(event.GetDirection());
}
else {
// pass to the parent
event.SetCurrentFocus(this);
event.SetCurrentFocus(this);
- GetParent()->ProcessEvent(event);
+ GetParent()->ProcessWindowEvent(event);
wxCommandEvent evt(wxEVT_COMMAND_COMBOBOX_SELECTED,m_combo->GetId());
evt.SetInt(wxListBox::GetSelection());
evt.SetEventObject(m_combo);
wxCommandEvent evt(wxEVT_COMMAND_COMBOBOX_SELECTED,m_combo->GetId());
evt.SetInt(wxListBox::GetSelection());
evt.SetEventObject(m_combo);
- m_combo->ProcessEvent(evt);
+ m_combo->ProcessWindowEvent(evt);