1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/common/event.cpp
3 // Purpose: Event classes
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 // For compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
28 #include "wx/evtloop.h"
34 #include "wx/stopwatch.h"
35 #include "wx/module.h"
38 #include "wx/window.h"
39 #include "wx/control.h"
41 #include "wx/textctrl.h"
42 #include "wx/validate.h"
46 #include "wx/thread.h"
48 // ----------------------------------------------------------------------------
50 // ----------------------------------------------------------------------------
53 IMPLEMENT_DYNAMIC_CLASS(wxEvtHandler
, wxObject
)
54 IMPLEMENT_ABSTRACT_CLASS(wxEvent
, wxObject
)
55 IMPLEMENT_DYNAMIC_CLASS(wxIdleEvent
, wxEvent
)
59 IMPLEMENT_DYNAMIC_CLASS(wxCommandEvent
, wxEvent
)
60 IMPLEMENT_DYNAMIC_CLASS(wxNotifyEvent
, wxCommandEvent
)
61 IMPLEMENT_DYNAMIC_CLASS(wxScrollEvent
, wxCommandEvent
)
62 IMPLEMENT_DYNAMIC_CLASS(wxScrollWinEvent
, wxEvent
)
63 IMPLEMENT_DYNAMIC_CLASS(wxMouseEvent
, wxEvent
)
64 IMPLEMENT_DYNAMIC_CLASS(wxKeyEvent
, wxEvent
)
65 IMPLEMENT_DYNAMIC_CLASS(wxSizeEvent
, wxEvent
)
66 IMPLEMENT_DYNAMIC_CLASS(wxPaintEvent
, wxEvent
)
67 IMPLEMENT_DYNAMIC_CLASS(wxNcPaintEvent
, wxEvent
)
68 IMPLEMENT_DYNAMIC_CLASS(wxEraseEvent
, wxEvent
)
69 IMPLEMENT_DYNAMIC_CLASS(wxMoveEvent
, wxEvent
)
70 IMPLEMENT_DYNAMIC_CLASS(wxFocusEvent
, wxEvent
)
71 IMPLEMENT_DYNAMIC_CLASS(wxChildFocusEvent
, wxCommandEvent
)
72 IMPLEMENT_DYNAMIC_CLASS(wxCloseEvent
, wxEvent
)
73 IMPLEMENT_DYNAMIC_CLASS(wxShowEvent
, wxEvent
)
74 IMPLEMENT_DYNAMIC_CLASS(wxMaximizeEvent
, wxEvent
)
75 IMPLEMENT_DYNAMIC_CLASS(wxIconizeEvent
, wxEvent
)
76 IMPLEMENT_DYNAMIC_CLASS(wxMenuEvent
, wxEvent
)
77 IMPLEMENT_DYNAMIC_CLASS(wxJoystickEvent
, wxEvent
)
78 IMPLEMENT_DYNAMIC_CLASS(wxDropFilesEvent
, wxEvent
)
79 IMPLEMENT_DYNAMIC_CLASS(wxActivateEvent
, wxEvent
)
80 IMPLEMENT_DYNAMIC_CLASS(wxInitDialogEvent
, wxEvent
)
81 IMPLEMENT_DYNAMIC_CLASS(wxSetCursorEvent
, wxEvent
)
82 IMPLEMENT_DYNAMIC_CLASS(wxSysColourChangedEvent
, wxEvent
)
83 IMPLEMENT_DYNAMIC_CLASS(wxDisplayChangedEvent
, wxEvent
)
84 IMPLEMENT_DYNAMIC_CLASS(wxUpdateUIEvent
, wxCommandEvent
)
85 IMPLEMENT_DYNAMIC_CLASS(wxNavigationKeyEvent
, wxEvent
)
86 IMPLEMENT_DYNAMIC_CLASS(wxPaletteChangedEvent
, wxEvent
)
87 IMPLEMENT_DYNAMIC_CLASS(wxQueryNewPaletteEvent
, wxEvent
)
88 IMPLEMENT_DYNAMIC_CLASS(wxWindowCreateEvent
, wxEvent
)
89 IMPLEMENT_DYNAMIC_CLASS(wxWindowDestroyEvent
, wxEvent
)
90 IMPLEMENT_DYNAMIC_CLASS(wxHelpEvent
, wxCommandEvent
)
91 IMPLEMENT_DYNAMIC_CLASS(wxContextMenuEvent
, wxCommandEvent
)
92 IMPLEMENT_DYNAMIC_CLASS(wxMouseCaptureChangedEvent
, wxEvent
)
93 IMPLEMENT_DYNAMIC_CLASS(wxMouseCaptureLostEvent
, wxEvent
)
94 IMPLEMENT_DYNAMIC_CLASS(wxClipboardTextEvent
, wxCommandEvent
)
99 const wxEventTable
*wxEvtHandler::GetEventTable() const
100 { return &wxEvtHandler::sm_eventTable
; }
102 const wxEventTable
wxEvtHandler::sm_eventTable
=
103 { (const wxEventTable
*)NULL
, &wxEvtHandler::sm_eventTableEntries
[0] };
105 wxEventHashTable
&wxEvtHandler::GetEventHashTable() const
106 { return wxEvtHandler::sm_eventHashTable
; }
108 wxEventHashTable
wxEvtHandler::sm_eventHashTable(wxEvtHandler::sm_eventTable
);
110 const wxEventTableEntry
wxEvtHandler::sm_eventTableEntries
[] =
111 { DECLARE_EVENT_TABLE_ENTRY(wxEVT_NULL
, 0, 0, (wxObjectEventFunction
)NULL
, NULL
) };
114 // wxUSE_MEMORY_TRACING considers memory freed from the static objects dtors
115 // leaked, so we need to manually clean up all event tables before checking for
116 // the memory leaks when using it, however this breaks re-initializing the
117 // library (i.e. repeated calls to wxInitialize/wxUninitialize) because the
118 // event tables won't be rebuilt the next time, so disable this by default
119 #if defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING
121 class wxEventTableEntryModule
: public wxModule
124 wxEventTableEntryModule() { }
125 virtual bool OnInit() { return true; }
126 virtual void OnExit() { wxEventHashTable::ClearAll(); }
128 DECLARE_DYNAMIC_CLASS(wxEventTableEntryModule
)
131 IMPLEMENT_DYNAMIC_CLASS(wxEventTableEntryModule
, wxModule
)
133 #endif // __WXDEBUG__ && wxUSE_MEMORY_TRACING
135 // ----------------------------------------------------------------------------
137 // ----------------------------------------------------------------------------
139 // To put pending event handlers
140 wxList
*wxPendingEvents
= (wxList
*)NULL
;
143 // protects wxPendingEvents list
144 wxCriticalSection
*wxPendingEventsLocker
= (wxCriticalSection
*)NULL
;
147 // common event types are defined here, other event types are defined by the
148 // components which use them
150 const wxEventType wxEVT_FIRST
= 10000;
151 const wxEventType wxEVT_USER_FIRST
= wxEVT_FIRST
+ 2000;
153 DEFINE_EVENT_TYPE(wxEVT_NULL
)
154 DEFINE_EVENT_TYPE(wxEVT_IDLE
)
155 DEFINE_EVENT_TYPE(wxEVT_SOCKET
)
156 DEFINE_EVENT_TYPE(wxEVT_TIMER
)
162 DEFINE_EVENT_TYPE(wxEVT_COMMAND_BUTTON_CLICKED
)
163 DEFINE_EVENT_TYPE(wxEVT_COMMAND_CHECKBOX_CLICKED
)
164 DEFINE_EVENT_TYPE(wxEVT_COMMAND_CHOICE_SELECTED
)
165 DEFINE_EVENT_TYPE(wxEVT_COMMAND_LISTBOX_SELECTED
)
166 DEFINE_EVENT_TYPE(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED
)
167 DEFINE_EVENT_TYPE(wxEVT_COMMAND_CHECKLISTBOX_TOGGLED
)
168 DEFINE_EVENT_TYPE(wxEVT_COMMAND_MENU_SELECTED
)
169 DEFINE_EVENT_TYPE(wxEVT_COMMAND_SLIDER_UPDATED
)
170 DEFINE_EVENT_TYPE(wxEVT_COMMAND_RADIOBOX_SELECTED
)
171 DEFINE_EVENT_TYPE(wxEVT_COMMAND_RADIOBUTTON_SELECTED
)
172 DEFINE_EVENT_TYPE(wxEVT_COMMAND_SCROLLBAR_UPDATED
)
173 DEFINE_EVENT_TYPE(wxEVT_COMMAND_VLBOX_SELECTED
)
174 DEFINE_EVENT_TYPE(wxEVT_COMMAND_COMBOBOX_SELECTED
)
175 DEFINE_EVENT_TYPE(wxEVT_COMMAND_TOOL_RCLICKED
)
176 DEFINE_EVENT_TYPE(wxEVT_COMMAND_TOOL_ENTER
)
177 DEFINE_EVENT_TYPE(wxEVT_COMMAND_SPINCTRL_UPDATED
)
178 DEFINE_EVENT_TYPE(wxEVT_COMMAND_TOOL_DROPDOWN_CLICKED
)
181 DEFINE_EVENT_TYPE(wxEVT_LEFT_DOWN
)
182 DEFINE_EVENT_TYPE(wxEVT_LEFT_UP
)
183 DEFINE_EVENT_TYPE(wxEVT_MIDDLE_DOWN
)
184 DEFINE_EVENT_TYPE(wxEVT_MIDDLE_UP
)
185 DEFINE_EVENT_TYPE(wxEVT_RIGHT_DOWN
)
186 DEFINE_EVENT_TYPE(wxEVT_RIGHT_UP
)
187 DEFINE_EVENT_TYPE(wxEVT_MOTION
)
188 DEFINE_EVENT_TYPE(wxEVT_ENTER_WINDOW
)
189 DEFINE_EVENT_TYPE(wxEVT_LEAVE_WINDOW
)
190 DEFINE_EVENT_TYPE(wxEVT_LEFT_DCLICK
)
191 DEFINE_EVENT_TYPE(wxEVT_MIDDLE_DCLICK
)
192 DEFINE_EVENT_TYPE(wxEVT_RIGHT_DCLICK
)
193 DEFINE_EVENT_TYPE(wxEVT_SET_FOCUS
)
194 DEFINE_EVENT_TYPE(wxEVT_KILL_FOCUS
)
195 DEFINE_EVENT_TYPE(wxEVT_CHILD_FOCUS
)
196 DEFINE_EVENT_TYPE(wxEVT_MOUSEWHEEL
)
197 DEFINE_EVENT_TYPE(wxEVT_AUX1_DOWN
)
198 DEFINE_EVENT_TYPE(wxEVT_AUX1_UP
)
199 DEFINE_EVENT_TYPE(wxEVT_AUX1_DCLICK
)
200 DEFINE_EVENT_TYPE(wxEVT_AUX2_DOWN
)
201 DEFINE_EVENT_TYPE(wxEVT_AUX2_UP
)
202 DEFINE_EVENT_TYPE(wxEVT_AUX2_DCLICK
)
204 // Non-client mouse events
205 DEFINE_EVENT_TYPE(wxEVT_NC_LEFT_DOWN
)
206 DEFINE_EVENT_TYPE(wxEVT_NC_LEFT_UP
)
207 DEFINE_EVENT_TYPE(wxEVT_NC_MIDDLE_DOWN
)
208 DEFINE_EVENT_TYPE(wxEVT_NC_MIDDLE_UP
)
209 DEFINE_EVENT_TYPE(wxEVT_NC_RIGHT_DOWN
)
210 DEFINE_EVENT_TYPE(wxEVT_NC_RIGHT_UP
)
211 DEFINE_EVENT_TYPE(wxEVT_NC_MOTION
)
212 DEFINE_EVENT_TYPE(wxEVT_NC_ENTER_WINDOW
)
213 DEFINE_EVENT_TYPE(wxEVT_NC_LEAVE_WINDOW
)
214 DEFINE_EVENT_TYPE(wxEVT_NC_LEFT_DCLICK
)
215 DEFINE_EVENT_TYPE(wxEVT_NC_MIDDLE_DCLICK
)
216 DEFINE_EVENT_TYPE(wxEVT_NC_RIGHT_DCLICK
)
218 // Character input event type
219 DEFINE_EVENT_TYPE(wxEVT_CHAR
)
220 DEFINE_EVENT_TYPE(wxEVT_CHAR_HOOK
)
221 DEFINE_EVENT_TYPE(wxEVT_NAVIGATION_KEY
)
222 DEFINE_EVENT_TYPE(wxEVT_KEY_DOWN
)
223 DEFINE_EVENT_TYPE(wxEVT_KEY_UP
)
225 DEFINE_EVENT_TYPE(wxEVT_HOTKEY
)
229 DEFINE_EVENT_TYPE(wxEVT_SET_CURSOR
)
231 // wxScrollbar and wxSlider event identifiers
232 DEFINE_EVENT_TYPE(wxEVT_SCROLL_TOP
)
233 DEFINE_EVENT_TYPE(wxEVT_SCROLL_BOTTOM
)
234 DEFINE_EVENT_TYPE(wxEVT_SCROLL_LINEUP
)
235 DEFINE_EVENT_TYPE(wxEVT_SCROLL_LINEDOWN
)
236 DEFINE_EVENT_TYPE(wxEVT_SCROLL_PAGEUP
)
237 DEFINE_EVENT_TYPE(wxEVT_SCROLL_PAGEDOWN
)
238 DEFINE_EVENT_TYPE(wxEVT_SCROLL_THUMBTRACK
)
239 DEFINE_EVENT_TYPE(wxEVT_SCROLL_THUMBRELEASE
)
240 DEFINE_EVENT_TYPE(wxEVT_SCROLL_CHANGED
)
242 // Scroll events from wxWindow
243 DEFINE_EVENT_TYPE(wxEVT_SCROLLWIN_TOP
)
244 DEFINE_EVENT_TYPE(wxEVT_SCROLLWIN_BOTTOM
)
245 DEFINE_EVENT_TYPE(wxEVT_SCROLLWIN_LINEUP
)
246 DEFINE_EVENT_TYPE(wxEVT_SCROLLWIN_LINEDOWN
)
247 DEFINE_EVENT_TYPE(wxEVT_SCROLLWIN_PAGEUP
)
248 DEFINE_EVENT_TYPE(wxEVT_SCROLLWIN_PAGEDOWN
)
249 DEFINE_EVENT_TYPE(wxEVT_SCROLLWIN_THUMBTRACK
)
250 DEFINE_EVENT_TYPE(wxEVT_SCROLLWIN_THUMBRELEASE
)
253 DEFINE_EVENT_TYPE(wxEVT_SIZE
)
254 DEFINE_EVENT_TYPE(wxEVT_SIZING
)
255 DEFINE_EVENT_TYPE(wxEVT_MOVE
)
256 DEFINE_EVENT_TYPE(wxEVT_MOVING
)
257 DEFINE_EVENT_TYPE(wxEVT_MOVE_START
)
258 DEFINE_EVENT_TYPE(wxEVT_MOVE_END
)
259 DEFINE_EVENT_TYPE(wxEVT_CLOSE_WINDOW
)
260 DEFINE_EVENT_TYPE(wxEVT_END_SESSION
)
261 DEFINE_EVENT_TYPE(wxEVT_QUERY_END_SESSION
)
262 DEFINE_EVENT_TYPE(wxEVT_HIBERNATE
)
263 DEFINE_EVENT_TYPE(wxEVT_ACTIVATE_APP
)
264 DEFINE_EVENT_TYPE(wxEVT_ACTIVATE
)
265 DEFINE_EVENT_TYPE(wxEVT_CREATE
)
266 DEFINE_EVENT_TYPE(wxEVT_DESTROY
)
267 DEFINE_EVENT_TYPE(wxEVT_SHOW
)
268 DEFINE_EVENT_TYPE(wxEVT_ICONIZE
)
269 DEFINE_EVENT_TYPE(wxEVT_MAXIMIZE
)
270 DEFINE_EVENT_TYPE(wxEVT_MOUSE_CAPTURE_CHANGED
)
271 DEFINE_EVENT_TYPE(wxEVT_MOUSE_CAPTURE_LOST
)
272 DEFINE_EVENT_TYPE(wxEVT_PAINT
)
273 DEFINE_EVENT_TYPE(wxEVT_ERASE_BACKGROUND
)
274 DEFINE_EVENT_TYPE(wxEVT_NC_PAINT
)
275 DEFINE_EVENT_TYPE(wxEVT_PAINT_ICON
)
276 DEFINE_EVENT_TYPE(wxEVT_MENU_OPEN
)
277 DEFINE_EVENT_TYPE(wxEVT_MENU_CLOSE
)
278 DEFINE_EVENT_TYPE(wxEVT_MENU_HIGHLIGHT
)
279 DEFINE_EVENT_TYPE(wxEVT_CONTEXT_MENU
)
280 DEFINE_EVENT_TYPE(wxEVT_SYS_COLOUR_CHANGED
)
281 DEFINE_EVENT_TYPE(wxEVT_DISPLAY_CHANGED
)
282 DEFINE_EVENT_TYPE(wxEVT_SETTING_CHANGED
)
283 DEFINE_EVENT_TYPE(wxEVT_QUERY_NEW_PALETTE
)
284 DEFINE_EVENT_TYPE(wxEVT_PALETTE_CHANGED
)
285 DEFINE_EVENT_TYPE(wxEVT_JOY_BUTTON_DOWN
)
286 DEFINE_EVENT_TYPE(wxEVT_JOY_BUTTON_UP
)
287 DEFINE_EVENT_TYPE(wxEVT_JOY_MOVE
)
288 DEFINE_EVENT_TYPE(wxEVT_JOY_ZMOVE
)
289 DEFINE_EVENT_TYPE(wxEVT_DROP_FILES
)
290 DEFINE_EVENT_TYPE(wxEVT_DRAW_ITEM
)
291 DEFINE_EVENT_TYPE(wxEVT_MEASURE_ITEM
)
292 DEFINE_EVENT_TYPE(wxEVT_COMPARE_ITEM
)
293 DEFINE_EVENT_TYPE(wxEVT_INIT_DIALOG
)
294 DEFINE_EVENT_TYPE(wxEVT_UPDATE_UI
)
297 DEFINE_EVENT_TYPE(wxEVT_COMMAND_TEXT_COPY
)
298 DEFINE_EVENT_TYPE(wxEVT_COMMAND_TEXT_CUT
)
299 DEFINE_EVENT_TYPE(wxEVT_COMMAND_TEXT_PASTE
)
301 // Generic command events
302 // Note: a click is a higher-level event than button down/up
303 DEFINE_EVENT_TYPE(wxEVT_COMMAND_LEFT_CLICK
)
304 DEFINE_EVENT_TYPE(wxEVT_COMMAND_LEFT_DCLICK
)
305 DEFINE_EVENT_TYPE(wxEVT_COMMAND_RIGHT_CLICK
)
306 DEFINE_EVENT_TYPE(wxEVT_COMMAND_RIGHT_DCLICK
)
307 DEFINE_EVENT_TYPE(wxEVT_COMMAND_SET_FOCUS
)
308 DEFINE_EVENT_TYPE(wxEVT_COMMAND_KILL_FOCUS
)
309 DEFINE_EVENT_TYPE(wxEVT_COMMAND_ENTER
)
312 DEFINE_EVENT_TYPE(wxEVT_HELP
)
313 DEFINE_EVENT_TYPE(wxEVT_DETAILED_HELP
)
319 wxIdleMode
wxIdleEvent::sm_idleMode
= wxIDLE_PROCESS_ALL
;
321 // ============================================================================
323 // ============================================================================
325 // ----------------------------------------------------------------------------
326 // event initialization
327 // ----------------------------------------------------------------------------
332 static int s_lastUsedEventType
= wxEVT_FIRST
;
334 return s_lastUsedEventType
++;
337 // ----------------------------------------------------------------------------
339 // ----------------------------------------------------------------------------
342 * General wxWidgets events, covering
343 * all interesting things that might happen (button clicking, resizing,
344 * setting text in widgets, etc.).
346 * For each completely new event type, derive a new event class.
350 wxEvent::wxEvent(int theId
, wxEventType commandType
)
352 m_eventType
= commandType
;
353 m_eventObject
= (wxObject
*) NULL
;
357 m_callbackUserData
= (wxObject
*) NULL
;
358 m_isCommandEvent
= false;
359 m_propagationLevel
= wxEVENT_PROPAGATE_NONE
;
362 wxEvent::wxEvent(const wxEvent
&src
)
364 , m_eventObject(src
.m_eventObject
)
365 , m_eventType(src
.m_eventType
)
366 , m_timeStamp(src
.m_timeStamp
)
368 , m_callbackUserData(src
.m_callbackUserData
)
369 , m_propagationLevel(src
.m_propagationLevel
)
370 , m_skipped(src
.m_skipped
)
371 , m_isCommandEvent(src
.m_isCommandEvent
)
385 // 'this' : used in base member initializer list (for m_commandString)
386 #pragma warning(disable:4355)
389 wxCommandEvent::wxCommandEvent(wxEventType commandType
, int theId
)
390 : wxEvent(theId
, commandType
)
392 m_clientData
= (char *) NULL
;
393 m_clientObject
= (wxClientData
*) NULL
;
396 m_isCommandEvent
= true;
398 // the command events are propagated upwards by default
399 m_propagationLevel
= wxEVENT_PROPAGATE_MAX
;
403 #pragma warning(default:4355)
406 wxString
wxCommandEvent::GetString() const
408 if(m_eventType
!= wxEVT_COMMAND_TEXT_UPDATED
|| !m_eventObject
)
413 wxTextCtrl
*txt
= wxDynamicCast(m_eventObject
, wxTextCtrl
);
415 return txt
->GetValue();
417 #endif // wxUSE_TEXTCTRL
427 wxLongLong
wxUpdateUIEvent::sm_lastUpdate
= 0;
430 long wxUpdateUIEvent::sm_updateInterval
= 0;
432 wxUpdateUIMode
wxUpdateUIEvent::sm_updateMode
= wxUPDATE_UI_PROCESS_ALL
;
435 bool wxUpdateUIEvent::CanUpdate(wxWindowBase
*win
)
437 // Don't update if we've switched global updating off
438 // and this window doesn't support updates.
440 (GetMode() == wxUPDATE_UI_PROCESS_SPECIFIED
&&
441 ((win
->GetExtraStyle() & wxWS_EX_PROCESS_UI_UPDATES
) == 0)))
444 if (sm_updateInterval
== -1)
447 if (sm_updateInterval
== 0)
450 #if wxUSE_STOPWATCH && wxUSE_LONGLONG
451 wxLongLong now
= wxGetLocalTimeMillis();
452 if (now
> (sm_lastUpdate
+ sm_updateInterval
))
459 // If we don't have wxStopWatch or wxLongLong, we
460 // should err on the safe side and update now anyway.
465 // Reset the update time to provide a delay until the next
466 // time we should update
467 void wxUpdateUIEvent::ResetUpdateTime()
469 #if wxUSE_STOPWATCH && wxUSE_LONGLONG
470 if (sm_updateInterval
> 0)
472 wxLongLong now
= wxGetLocalTimeMillis();
473 if (now
> (sm_lastUpdate
+ sm_updateInterval
))
485 wxScrollEvent::wxScrollEvent(wxEventType commandType
,
489 : wxCommandEvent(commandType
, id
)
491 m_extraLong
= orient
;
499 wxScrollWinEvent::wxScrollWinEvent(wxEventType commandType
,
503 m_eventType
= commandType
;
504 m_extraLong
= orient
;
513 wxMouseEvent::wxMouseEvent(wxEventType commandType
)
515 m_eventType
= commandType
;
521 m_middleDown
= false;
526 m_controlDown
= false;
535 m_linesPerAction
= 0;
539 void wxMouseEvent::Assign(const wxMouseEvent
& event
)
541 m_eventType
= event
.m_eventType
;
546 m_leftDown
= event
.m_leftDown
;
547 m_middleDown
= event
.m_middleDown
;
548 m_rightDown
= event
.m_rightDown
;
549 m_aux1Down
= event
.m_aux1Down
;
550 m_aux2Down
= event
.m_aux2Down
;
552 m_controlDown
= event
.m_controlDown
;
553 m_shiftDown
= event
.m_shiftDown
;
554 m_altDown
= event
.m_altDown
;
555 m_metaDown
= event
.m_metaDown
;
557 m_wheelRotation
= event
.m_wheelRotation
;
558 m_wheelDelta
= event
.m_wheelDelta
;
559 m_linesPerAction
= event
.m_linesPerAction
;
560 m_wheelAxis
= event
.m_wheelAxis
;
563 // return true if was a button dclick event
564 bool wxMouseEvent::ButtonDClick(int but
) const
569 wxFAIL_MSG(wxT("invalid parameter in wxMouseEvent::ButtonDClick"));
572 case wxMOUSE_BTN_ANY
:
573 return (LeftDClick() || MiddleDClick() || RightDClick() ||
574 Aux1DClick() || Aux2DClick());
576 case wxMOUSE_BTN_LEFT
:
579 case wxMOUSE_BTN_MIDDLE
:
580 return MiddleDClick();
582 case wxMOUSE_BTN_RIGHT
:
583 return RightDClick();
585 case wxMOUSE_BTN_AUX1
:
588 case wxMOUSE_BTN_AUX2
:
593 // return true if was a button down event
594 bool wxMouseEvent::ButtonDown(int but
) const
599 wxFAIL_MSG(wxT("invalid parameter in wxMouseEvent::ButtonDown"));
602 case wxMOUSE_BTN_ANY
:
603 return (LeftDown() || MiddleDown() || RightDown() ||
604 Aux1Down() || Aux2Down());
606 case wxMOUSE_BTN_LEFT
:
609 case wxMOUSE_BTN_MIDDLE
:
612 case wxMOUSE_BTN_RIGHT
:
615 case wxMOUSE_BTN_AUX1
:
618 case wxMOUSE_BTN_AUX2
:
623 // return true if was a button up event
624 bool wxMouseEvent::ButtonUp(int but
) const
629 wxFAIL_MSG(wxT("invalid parameter in wxMouseEvent::ButtonUp"));
632 case wxMOUSE_BTN_ANY
:
633 return (LeftUp() || MiddleUp() || RightUp() ||
634 Aux1Up() || Aux2Up());
636 case wxMOUSE_BTN_LEFT
:
639 case wxMOUSE_BTN_MIDDLE
:
642 case wxMOUSE_BTN_RIGHT
:
645 case wxMOUSE_BTN_AUX1
:
648 case wxMOUSE_BTN_AUX2
:
653 // return true if the given button is currently changing state
654 bool wxMouseEvent::Button(int but
) const
659 wxFAIL_MSG(wxT("invalid parameter in wxMouseEvent::Button"));
662 case wxMOUSE_BTN_ANY
:
663 return ButtonUp(wxMOUSE_BTN_ANY
) ||
664 ButtonDown(wxMOUSE_BTN_ANY
) ||
665 ButtonDClick(wxMOUSE_BTN_ANY
);
667 case wxMOUSE_BTN_LEFT
:
668 return LeftDown() || LeftUp() || LeftDClick();
670 case wxMOUSE_BTN_MIDDLE
:
671 return MiddleDown() || MiddleUp() || MiddleDClick();
673 case wxMOUSE_BTN_RIGHT
:
674 return RightDown() || RightUp() || RightDClick();
676 case wxMOUSE_BTN_AUX1
:
677 return Aux1Down() || Aux1Up() || Aux1DClick();
679 case wxMOUSE_BTN_AUX2
:
680 return Aux2Down() || Aux2Up() || Aux2DClick();
684 bool wxMouseEvent::ButtonIsDown(int but
) const
689 wxFAIL_MSG(wxT("invalid parameter in wxMouseEvent::ButtonIsDown"));
692 case wxMOUSE_BTN_ANY
:
693 return LeftIsDown() || MiddleIsDown() || RightIsDown() || Aux1Down() || Aux2Down();
695 case wxMOUSE_BTN_LEFT
:
698 case wxMOUSE_BTN_MIDDLE
:
699 return MiddleIsDown();
701 case wxMOUSE_BTN_RIGHT
:
702 return RightIsDown();
704 case wxMOUSE_BTN_AUX1
:
707 case wxMOUSE_BTN_AUX2
:
712 int wxMouseEvent::GetButton() const
714 for ( int i
= 1; i
< wxMOUSE_BTN_MAX
; i
++ )
722 return wxMOUSE_BTN_NONE
;
725 // Find the logical position of the event given the DC
726 wxPoint
wxMouseEvent::GetLogicalPosition(const wxDC
& dc
) const
728 wxPoint
pt(dc
.DeviceToLogicalX(m_x
), dc
.DeviceToLogicalY(m_y
));
738 wxKeyEvent::wxKeyEvent(wxEventType type
)
742 m_controlDown
= false;
752 wxKeyEvent::wxKeyEvent(const wxKeyEvent
& evt
)
758 m_keyCode
= evt
.m_keyCode
;
760 m_controlDown
= evt
.m_controlDown
;
761 m_shiftDown
= evt
.m_shiftDown
;
762 m_altDown
= evt
.m_altDown
;
763 m_metaDown
= evt
.m_metaDown
;
764 m_scanCode
= evt
.m_scanCode
;
765 m_rawCode
= evt
.m_rawCode
;
766 m_rawFlags
= evt
.m_rawFlags
;
769 m_uniChar
= evt
.m_uniChar
;
773 wxWindowCreateEvent::wxWindowCreateEvent(wxWindow
*win
)
775 SetEventType(wxEVT_CREATE
);
779 wxWindowDestroyEvent::wxWindowDestroyEvent(wxWindow
*win
)
781 SetEventType(wxEVT_DESTROY
);
785 wxChildFocusEvent::wxChildFocusEvent(wxWindow
*win
)
786 : wxCommandEvent(wxEVT_CHILD_FOCUS
)
791 // ----------------------------------------------------------------------------
793 // ----------------------------------------------------------------------------
796 wxHelpEvent::Origin
wxHelpEvent::GuessOrigin(Origin origin
)
798 if ( origin
== Origin_Unknown
)
800 // assume that the event comes from the help button if it's not from
801 // keyboard and that pressing F1 always results in the help event
802 origin
= wxGetKeyState(WXK_F1
) ? Origin_Keyboard
: Origin_HelpButton
;
813 // ----------------------------------------------------------------------------
815 // ----------------------------------------------------------------------------
817 static const int EVENT_TYPE_TABLE_INIT_SIZE
= 31; // Not too big not too small...
819 wxEventHashTable
* wxEventHashTable::sm_first
= NULL
;
821 wxEventHashTable::wxEventHashTable(const wxEventTable
&table
)
825 AllocEventTypeTable(EVENT_TYPE_TABLE_INIT_SIZE
);
829 m_next
->m_previous
= this;
833 wxEventHashTable::~wxEventHashTable()
836 m_next
->m_previous
= m_previous
;
838 m_previous
->m_next
= m_next
;
839 if (sm_first
== this)
845 void wxEventHashTable::Clear()
847 for ( size_t i
= 0; i
< m_size
; i
++ )
849 EventTypeTablePointer eTTnode
= m_eventTypeTable
[i
];
853 delete[] m_eventTypeTable
;
854 m_eventTypeTable
= NULL
;
859 #if defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING
862 void wxEventHashTable::ClearAll()
864 wxEventHashTable
* table
= sm_first
;
868 table
= table
->m_next
;
872 #endif // __WXDEBUG__ && wxUSE_MEMORY_TRACING
874 bool wxEventHashTable::HandleEvent(wxEvent
&event
, wxEvtHandler
*self
)
879 m_rebuildHash
= false;
882 if (!m_eventTypeTable
)
885 // Find all entries for the given event type.
886 wxEventType eventType
= event
.GetEventType();
887 const EventTypeTablePointer eTTnode
= m_eventTypeTable
[eventType
% m_size
];
888 if (eTTnode
&& eTTnode
->eventType
== eventType
)
890 // Now start the search for an event handler
891 // that can handle an event with the given ID.
892 const wxEventTableEntryPointerArray
&
893 eventEntryTable
= eTTnode
->eventEntryTable
;
895 const size_t count
= eventEntryTable
.GetCount();
896 for (size_t n
= 0; n
< count
; n
++)
899 ProcessEventIfMatches(*eventEntryTable
[n
], self
, event
) )
909 void wxEventHashTable::InitHashTable()
911 // Loop over the event tables and all its base tables.
912 const wxEventTable
*table
= &m_table
;
915 // Retrieve all valid event handler entries
916 const wxEventTableEntry
*entry
= table
->entries
;
917 while (entry
->m_fn
!= 0)
919 // Add the event entry in the Hash.
925 table
= table
->baseTable
;
928 // Lets free some memory.
930 for(i
= 0; i
< m_size
; i
++)
932 EventTypeTablePointer eTTnode
= m_eventTypeTable
[i
];
935 eTTnode
->eventEntryTable
.Shrink();
940 void wxEventHashTable::AddEntry(const wxEventTableEntry
&entry
)
942 // This might happen 'accidentally' as the app is exiting
943 if (!m_eventTypeTable
)
946 EventTypeTablePointer
*peTTnode
= &m_eventTypeTable
[entry
.m_eventType
% m_size
];
947 EventTypeTablePointer eTTnode
= *peTTnode
;
951 if (eTTnode
->eventType
!= entry
.m_eventType
)
954 GrowEventTypeTable();
955 // Try again to add it.
962 eTTnode
= new EventTypeTable
;
963 eTTnode
->eventType
= entry
.m_eventType
;
967 // Fill all hash entries between entry.m_id and entry.m_lastId...
968 eTTnode
->eventEntryTable
.Add(&entry
);
971 void wxEventHashTable::AllocEventTypeTable(size_t size
)
973 m_eventTypeTable
= new EventTypeTablePointer
[size
];
974 memset((void *)m_eventTypeTable
, 0, sizeof(EventTypeTablePointer
)*size
);
978 void wxEventHashTable::GrowEventTypeTable()
980 size_t oldSize
= m_size
;
981 EventTypeTablePointer
*oldEventTypeTable
= m_eventTypeTable
;
983 // TODO: Search the most optimal grow sequence
984 AllocEventTypeTable(/* GetNextPrime(oldSize) */oldSize
*2+1);
986 for ( size_t i
= 0; i
< oldSize
; /* */ )
988 EventTypeTablePointer eTToldNode
= oldEventTypeTable
[i
];
991 EventTypeTablePointer
*peTTnode
= &m_eventTypeTable
[eTToldNode
->eventType
% m_size
];
992 EventTypeTablePointer eTTnode
= *peTTnode
;
994 // Check for collision, we don't want any.
997 GrowEventTypeTable();
998 continue; // Don't increment the counter,
999 // as we still need to add this element.
1003 // Get the old value and put it in the new table.
1004 *peTTnode
= oldEventTypeTable
[i
];
1011 delete[] oldEventTypeTable
;
1015 // ----------------------------------------------------------------------------
1017 // ----------------------------------------------------------------------------
1023 wxEvtHandler::wxEvtHandler()
1025 m_nextHandler
= (wxEvtHandler
*) NULL
;
1026 m_previousHandler
= (wxEvtHandler
*) NULL
;
1028 m_dynamicEvents
= (wxList
*) NULL
;
1029 m_pendingEvents
= (wxList
*) NULL
;
1031 # if !defined(__VISAGECPP__)
1032 m_eventsLocker
= new wxCriticalSection
;
1036 // no client data (yet)
1037 m_clientData
= NULL
;
1038 m_clientDataType
= wxClientData_None
;
1041 wxEvtHandler::~wxEvtHandler()
1043 // Takes itself out of the list of handlers
1044 if (m_previousHandler
)
1045 m_previousHandler
->m_nextHandler
= m_nextHandler
;
1048 m_nextHandler
->m_previousHandler
= m_previousHandler
;
1050 if (m_dynamicEvents
)
1052 for ( wxList::iterator it
= m_dynamicEvents
->begin(),
1053 end
= m_dynamicEvents
->end();
1057 wxDynamicEventTableEntry
*entry
= (wxDynamicEventTableEntry
*)*it
;
1059 if (entry
->m_callbackUserData
)
1060 delete entry
->m_callbackUserData
;
1063 delete m_dynamicEvents
;
1066 if (m_pendingEvents
)
1067 m_pendingEvents
->DeleteContents(true);
1068 delete m_pendingEvents
;
1071 # if !defined(__VISAGECPP__)
1072 delete m_eventsLocker
;
1075 // Remove us from wxPendingEvents if necessary.
1076 if(wxPendingEventsLocker
)
1077 wxENTER_CRIT_SECT(*wxPendingEventsLocker
);
1078 if ( wxPendingEvents
)
1080 // Delete all occurences of this from the list of pending events
1081 while (wxPendingEvents
->DeleteObject(this)) { } // Do nothing
1083 if(wxPendingEventsLocker
)
1084 wxLEAVE_CRIT_SECT(*wxPendingEventsLocker
);
1087 // we only delete object data, not untyped
1088 if ( m_clientDataType
== wxClientData_Object
)
1089 delete m_clientObject
;
1094 bool wxEvtHandler::ProcessThreadEvent(const wxEvent
& event
)
1096 // check that we are really in a child thread
1097 wxASSERT_MSG( !wxThread::IsMain(),
1098 wxT("use ProcessEvent() in main thread") );
1100 AddPendingEvent(event
);
1105 void wxEvtHandler::ClearEventLocker()
1107 #if !defined(__VISAGECPP__)
1108 delete m_eventsLocker
;
1109 m_eventsLocker
= NULL
;
1113 #endif // wxUSE_THREADS
1115 void wxEvtHandler::AddPendingEvent(const wxEvent
& event
)
1117 // 1) Add event to list of pending events of this event handler
1119 wxEvent
*eventCopy
= event
.Clone();
1121 // we must be able to copy the events here so the event class must
1122 // implement Clone() properly instead of just providing a NULL stab for it
1123 wxCHECK_RET( eventCopy
,
1124 _T("events of this type aren't supposed to be posted") );
1126 wxENTER_CRIT_SECT( Lock() );
1128 if ( !m_pendingEvents
)
1129 m_pendingEvents
= new wxList
;
1131 m_pendingEvents
->Append(eventCopy
);
1133 wxLEAVE_CRIT_SECT( Lock() );
1135 // 2) Add this event handler to list of event handlers that
1136 // have pending events.
1138 wxENTER_CRIT_SECT(*wxPendingEventsLocker
);
1140 if ( !wxPendingEvents
)
1141 wxPendingEvents
= new wxList
;
1142 wxPendingEvents
->Append(this);
1144 wxLEAVE_CRIT_SECT(*wxPendingEventsLocker
);
1146 // 3) Inform the system that new pending events are somewhere,
1147 // and that these should be processed in idle time.
1151 void wxEvtHandler::ProcessPendingEvents()
1153 // this method is only called by wxApp if this handler does have
1155 wxCHECK_RET( m_pendingEvents
,
1156 wxT("Please call wxApp::ProcessPendingEvents() instead") );
1158 wxENTER_CRIT_SECT( Lock() );
1160 // we leave the loop once we have processed all events that were present at
1161 // the start of ProcessPendingEvents because otherwise we could get into
1162 // infinite loop if the pending event handler execution resulted in another
1163 // event being posted
1164 size_t n
= m_pendingEvents
->size();
1165 for ( wxList::compatibility_iterator node
= m_pendingEvents
->GetFirst();
1167 node
= m_pendingEvents
->GetFirst() )
1169 wxEvent
*event
= (wxEvent
*)node
->GetData();
1171 // It's importan we remove event from list before processing it.
1172 // Else a nested event loop, for example from a modal dialog, might
1173 // process the same event again.
1175 m_pendingEvents
->Erase(node
);
1177 wxLEAVE_CRIT_SECT( Lock() );
1179 ProcessEvent(*event
);
1183 wxENTER_CRIT_SECT( Lock() );
1189 wxLEAVE_CRIT_SECT( Lock() );
1196 wxEvtHandler::ProcessEventIfMatches(const wxEventTableEntryBase
& entry
,
1197 wxEvtHandler
*handler
,
1200 int tableId1
= entry
.m_id
,
1201 tableId2
= entry
.m_lastId
;
1203 // match only if the event type is the same and the id is either -1 in
1204 // the event table (meaning "any") or the event id matches the id
1205 // specified in the event table either exactly or by falling into
1206 // range between first and last
1207 if ((tableId1
== wxID_ANY
) ||
1208 (tableId2
== wxID_ANY
&& tableId1
== event
.GetId()) ||
1209 (tableId2
!= wxID_ANY
&&
1210 (event
.GetId() >= tableId1
&& event
.GetId() <= tableId2
)))
1213 event
.m_callbackUserData
= entry
.m_callbackUserData
;
1215 #if wxUSE_EXCEPTIONS
1218 // call the handler via wxApp method which allows the user to catch
1219 // any exceptions which may be thrown by any handler in the program
1221 wxTheApp
->HandleEvent(handler
, (wxEventFunction
)entry
.m_fn
, event
);
1224 #endif // wxUSE_EXCEPTIONS
1226 // no need for an extra virtual function call
1227 (handler
->*((wxEventFunction
) (entry
.m_fn
)))(event
);
1230 if (!event
.GetSkipped())
1237 bool wxEvtHandler::TryParent(wxEvent
& event
)
1239 if ( wxTheApp
&& (this != wxTheApp
) )
1241 // Special case: don't pass wxEVT_IDLE to wxApp, since it'll always
1242 // swallow it. wxEVT_IDLE is sent explicitly to wxApp so it will be
1243 // processed appropriately via SearchEventTable.
1244 if ( event
.GetEventType() != wxEVT_IDLE
)
1246 if ( wxTheApp
->ProcessEvent(event
) )
1254 bool wxEvtHandler::ProcessEvent(wxEvent
& event
)
1256 // allow the application to hook into event processing
1259 int rc
= wxTheApp
->FilterEvent(event
);
1262 wxASSERT_MSG( rc
== 1 || rc
== 0,
1263 _T("unexpected wxApp::FilterEvent return value") );
1267 //else: proceed normally
1270 // An event handler can be enabled or disabled
1271 if ( GetEvtHandlerEnabled() )
1273 // if we have a validator, it has higher priority than our own event
1275 if ( TryValidator(event
) )
1278 // Handle per-instance dynamic event tables first
1279 if ( m_dynamicEvents
&& SearchDynamicEventTable(event
) )
1282 // Then static per-class event tables
1283 if ( GetEventHashTable().HandleEvent(event
, this) )
1287 // Try going down the event handler chain
1288 if ( GetNextHandler() )
1290 // notice that we shouldn't let the parent have the event even if the
1291 // next handler does not process it because it will have already passed
1292 // it to the parent in this case
1293 return GetNextHandler()->ProcessEvent(event
);
1296 // Finally propagate the event upwards the window chain and/or to the
1297 // application object as necessary
1298 return TryParent(event
);
1301 bool wxEvtHandler::SafelyProcessEvent(wxEvent
& event
)
1303 #if wxUSE_EXCEPTIONS
1307 return ProcessEvent(event
);
1308 #if wxUSE_EXCEPTIONS
1312 wxEventLoopBase
*loop
= wxEventLoopBase::GetActive();
1315 if ( !wxTheApp
|| !wxTheApp
->OnExceptionInMainLoop() )
1320 //else: continue running current event loop
1326 // OnExceptionInMainLoop() threw, possibly rethrowing the same
1327 // exception again: very good, but we still need Exit() to
1334 #endif // wxUSE_EXCEPTIONS
1338 bool wxEvtHandler::SearchEventTable(wxEventTable
& table
, wxEvent
& event
)
1340 const wxEventType eventType
= event
.GetEventType();
1341 for ( int i
= 0; table
.entries
[i
].m_fn
!= 0; i
++ )
1343 const wxEventTableEntry
& entry
= table
.entries
[i
];
1344 if ( eventType
== entry
.m_eventType
)
1346 if ( ProcessEventIfMatches(entry
, this, event
) )
1354 void wxEvtHandler::Connect( int id
, int lastId
,
1356 wxObjectEventFunction func
,
1358 wxEvtHandler
* eventSink
)
1360 wxDynamicEventTableEntry
*entry
=
1361 new wxDynamicEventTableEntry(eventType
, id
, lastId
, func
, userData
, eventSink
);
1363 if (!m_dynamicEvents
)
1364 m_dynamicEvents
= new wxList
;
1366 // Insert at the front of the list so most recent additions are found first
1367 m_dynamicEvents
->Insert( (wxObject
*) entry
);
1370 bool wxEvtHandler::Disconnect( int id
, int lastId
, wxEventType eventType
,
1371 wxObjectEventFunction func
,
1373 wxEvtHandler
* eventSink
)
1375 if (!m_dynamicEvents
)
1378 wxList::compatibility_iterator node
= m_dynamicEvents
->GetFirst();
1381 wxDynamicEventTableEntry
*entry
= (wxDynamicEventTableEntry
*)node
->GetData();
1383 if ((entry
->m_id
== id
) &&
1384 ((entry
->m_lastId
== lastId
) || (lastId
== wxID_ANY
)) &&
1385 ((entry
->m_eventType
== eventType
) || (eventType
== wxEVT_NULL
)) &&
1386 ((entry
->m_fn
== func
) || (func
== (wxObjectEventFunction
)NULL
)) &&
1387 ((entry
->m_eventSink
== eventSink
) || (eventSink
== (wxEvtHandler
*)NULL
)) &&
1388 ((entry
->m_callbackUserData
== userData
) || (userData
== (wxObject
*)NULL
)))
1390 if (entry
->m_callbackUserData
)
1391 delete entry
->m_callbackUserData
;
1392 m_dynamicEvents
->Erase( node
);
1396 node
= node
->GetNext();
1401 bool wxEvtHandler::SearchDynamicEventTable( wxEvent
& event
)
1403 wxCHECK_MSG( m_dynamicEvents
, false,
1404 wxT("caller should check that we have dynamic events") );
1406 wxList::compatibility_iterator node
= m_dynamicEvents
->GetFirst();
1409 wxDynamicEventTableEntry
*entry
= (wxDynamicEventTableEntry
*)node
->GetData();
1411 // get next node before (maybe) calling the event handler as it could
1412 // call Disconnect() invalidating the current node
1413 node
= node
->GetNext();
1415 if ((event
.GetEventType() == entry
->m_eventType
) && (entry
->m_fn
!= 0))
1417 wxEvtHandler
*handler
= entry
->m_eventSink
? entry
->m_eventSink
1419 if ( ProcessEventIfMatches(*entry
, handler
, event
) )
1427 void wxEvtHandler::DoSetClientObject( wxClientData
*data
)
1429 wxASSERT_MSG( m_clientDataType
!= wxClientData_Void
,
1430 wxT("can't have both object and void client data") );
1432 if ( m_clientObject
)
1433 delete m_clientObject
;
1435 m_clientObject
= data
;
1436 m_clientDataType
= wxClientData_Object
;
1439 wxClientData
*wxEvtHandler::DoGetClientObject() const
1441 // it's not an error to call GetClientObject() on a window which doesn't
1442 // have client data at all - NULL will be returned
1443 wxASSERT_MSG( m_clientDataType
!= wxClientData_Void
,
1444 wxT("this window doesn't have object client data") );
1446 return m_clientObject
;
1449 void wxEvtHandler::DoSetClientData( void *data
)
1451 wxASSERT_MSG( m_clientDataType
!= wxClientData_Object
,
1452 wxT("can't have both object and void client data") );
1454 m_clientData
= data
;
1455 m_clientDataType
= wxClientData_Void
;
1458 void *wxEvtHandler::DoGetClientData() const
1460 // it's not an error to call GetClientData() on a window which doesn't have
1461 // client data at all - NULL will be returned
1462 wxASSERT_MSG( m_clientDataType
!= wxClientData_Object
,
1463 wxT("this window doesn't have void client data") );
1465 return m_clientData
;
1468 #endif // wxUSE_BASE
1472 // Find a window with the focus, that is also a descendant of the given window.
1473 // This is used to determine the window to initially send commands to.
1474 wxWindow
* wxFindFocusDescendant(wxWindow
* ancestor
)
1476 // Process events starting with the window with the focus, if any.
1477 wxWindow
* focusWin
= wxWindow::FindFocus();
1478 wxWindow
* win
= focusWin
;
1480 // Check if this is a descendant of this frame.
1481 // If not, win will be set to NULL.
1484 if (win
== ancestor
)
1487 win
= win
->GetParent();
1489 if (win
== (wxWindow
*) NULL
)
1490 focusWin
= (wxWindow
*) NULL
;
1495 // ----------------------------------------------------------------------------
1497 // ----------------------------------------------------------------------------
1499 wxEventBlocker::wxEventBlocker(wxWindow
*win
, wxEventType type
)
1501 wxCHECK_RET(win
, wxT("Null window given to wxEventBlocker"));
1506 m_window
->PushEventHandler(this);
1509 wxEventBlocker::~wxEventBlocker()
1511 wxEvtHandler
*popped
= m_window
->PopEventHandler(false);
1512 wxCHECK_RET(popped
== this,
1513 wxT("Don't push other event handlers into a window managed by wxEventBlocker!"));
1516 bool wxEventBlocker::ProcessEvent(wxEvent
& event
)
1518 // should this event be blocked?
1519 for ( size_t i
= 0; i
< m_eventsToBlock
.size(); i
++ )
1521 wxEventType t
= (wxEventType
)m_eventsToBlock
[i
];
1522 if ( t
== wxEVT_ANY
|| t
== event
.GetEventType() )
1523 return true; // yes, it should: mark this event as processed