1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Event classes
4 // Author: Julian Smart
8 // Copyright: (c) wxWidgets team
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
17 #include "wx/object.h"
18 #include "wx/clntdata.h"
21 #include "wx/gdicmn.h"
22 #include "wx/cursor.h"
23 #include "wx/mousestate.h"
26 #include "wx/dynarray.h"
27 #include "wx/thread.h"
28 #include "wx/tracker.h"
30 // ----------------------------------------------------------------------------
31 // forward declarations
32 // ----------------------------------------------------------------------------
34 class WXDLLIMPEXP_FWD_BASE wxList
;
35 class WXDLLIMPEXP_FWD_BASE wxEvent
;
37 class WXDLLIMPEXP_FWD_CORE wxDC
;
38 class WXDLLIMPEXP_FWD_CORE wxMenu
;
39 class WXDLLIMPEXP_FWD_CORE wxWindow
;
40 class WXDLLIMPEXP_FWD_CORE wxWindowBase
;
43 // We operate with pointer to members of wxEvtHandler (such functions are used
44 // as event handlers in the event tables or as arguments to Connect()) but by
45 // default MSVC uses a restricted (but more efficient) representation of
46 // pointers to members which can't deal with multiple base classes. To avoid
47 // mysterious (as the compiler is not good enough to detect this and give a
48 // sensible error message) errors in the user code as soon as it defines
49 // classes inheriting from both wxEvtHandler (possibly indirectly, e.g. via
50 // wxWindow) and something else (including our own wxTrackable but not limited
51 // to it), we use the special MSVC keyword telling the compiler to use a more
52 // general pointer to member representation for the classes inheriting from
55 #define wxMSVC_FWD_MULTIPLE_BASES __multiple_inheritance
57 #define wxMSVC_FWD_MULTIPLE_BASES
60 class WXDLLIMPEXP_FWD_BASE wxMSVC_FWD_MULTIPLE_BASES wxEvtHandler
;
61 class wxEventConnectionRef
;
63 // ----------------------------------------------------------------------------
65 // ----------------------------------------------------------------------------
67 typedef int wxEventType
;
69 #define wxEVT_ANY ((wxEventType)-1)
71 // this is used to make the event table entry type safe, so that for an event
72 // handler only a function with proper parameter list can be given. See also
73 // the wxEVENT_HANDLER_CAST-macro.
74 #define wxStaticCastEvent(type, val) static_cast<type>(val)
76 #define DECLARE_EVENT_TABLE_ENTRY(type, winid, idLast, fn, obj) \
77 wxEventTableEntry(type, winid, idLast, wxNewEventFunctor(type, fn), obj)
79 #define DECLARE_EVENT_TABLE_TERMINATOR() \
80 wxEventTableEntry(wxEVT_NULL, 0, 0, 0, 0)
82 // obsolete event declaration/definition macros, we don't need them any longer
83 // but we keep them for compatibility as it doesn't cost us anything anyhow
84 #define BEGIN_DECLARE_EVENT_TYPES()
85 #define END_DECLARE_EVENT_TYPES()
86 #define DECLARE_EXPORTED_EVENT_TYPE(expdecl, name, value) \
87 extern expdecl const wxEventType name;
88 #define DECLARE_EVENT_TYPE(name, value) \
89 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_CORE, name, value)
90 #define DECLARE_LOCAL_EVENT_TYPE(name, value) \
91 DECLARE_EXPORTED_EVENT_TYPE(wxEMPTY_PARAMETER_VALUE, name, value)
92 #define DEFINE_EVENT_TYPE(name) const wxEventType name = wxNewEventType();
93 #define DEFINE_LOCAL_EVENT_TYPE(name) DEFINE_EVENT_TYPE(name)
95 // generate a new unique event type
96 extern WXDLLIMPEXP_BASE wxEventType
wxNewEventType();
98 // FIXME: currently the new events code is disabled because it creates too
99 // many problems, it should be reenabled a.s.a.p. or removed
100 #undef wxEVENTS_COMPATIBILITY_2_8
101 #define wxEVENTS_COMPATIBILITY_2_8 1
103 // New macros to create templatized event types:
105 #if wxEVENTS_COMPATIBILITY_2_8
107 // Define/Declare a wxEventType-based event type:
109 #define wxDEFINE_EVENT( name, type ) \
110 const wxEventType name( wxNewEventType() );
112 #define wxDECLARE_EXPORTED_EVENT( expdecl, name, type ) \
113 extern const expdecl wxEventType name;
115 // Define/Declare a wxEventType-based event type and initialize it with a
116 // predefined event type. (Only used for wxEVT_SPIN_XXX for backward
119 #define wxDEFINE_EVENT_ALIAS( name, type, value ) \
120 const wxEventType name = value;
122 #define wxDECLARE_EXPORTED_EVENT_ALIAS( expdecl, name, type ) \
123 extern const expdecl wxEventType name;
125 // Declare a local (not exported) wxEventType-based event type:
127 #define wxDECLARE_LOCAL_EVENT( name, type ) \
128 wxDECLARE_EXPORTED_EVENT( wxEMPTY_PARAMETER_VALUE, name, type )
130 // Try to cast the given event handler to the correct handler type:
132 #define wxEVENT_HANDLER_CAST( functype, func ) \
133 ( wxObjectEventFunction )( wxEventFunction )wxStaticCastEvent( functype, &func )
135 // Define/Declare a templatized event type with the corresponding event as
138 #define wxDEFINE_EVENT( name, type ) \
139 const wxTypedEventType< type > name( wxNewEventType() );
141 #define wxDECLARE_EXPORTED_EVENT( expdecl, name, type ) \
142 extern const expdecl wxTypedEventType< type > name;
144 // Define/Declare a templatized event type and initialize it with a
145 // predefined event type. (Only used for wxEVT_SPIN_XXX for backward
148 #define wxDEFINE_EVENT_ALIAS( name, type, value ) \
149 const wxTypedEventType< type > name( value );
151 #define wxDECLARE_EXPORTED_EVENT_ALIAS( expdecl, name, type ) \
152 extern const expdecl wxTypedEventType< type > name;
154 // Declare a local (not exported) templatized event type:
156 #define wxDECLARE_LOCAL_EVENT( name, type ) \
157 wxDECLARE_EXPORTED_EVENT( wxEMPTY_PARAMETER_VALUE, name, type )
159 // Don't cast the given event handler so that wxEvtHandler::Connect() sees
162 #define wxEVENT_HANDLER_CAST( functype, func ) \
166 // Template which associates the correct event object with the event type
168 #if !wxEVENTS_COMPATIBILITY_2_8
170 template <typename Event
>
171 class WXDLLIMPEXP_BASE wxTypedEventType
174 typedef Event CorrespondingEvent
;
176 wxTypedEventType(wxEventType type
) { m_type
= type
; }
178 // Return a wxEventType reference for the initialization of the static
179 // event tables. See wxEventTableEntry::m_eventType for a more thorough
181 operator const wxEventType
&() const { return m_type
; }
187 #endif // !wxEVENTS_COMPATIBILITY_2_8
189 // These are needed for the functor definitions
190 typedef void (wxEvtHandler::*wxEventFunction
)(wxEvent
&);
192 // We had some trouble (specifically with eVC for ARM WinCE build) with using
193 // wxEventFunction in the past so we had introduced wxObjectEventFunction which
194 // used to be a typedef for a member of wxObject and not wxEvtHandler to work
195 // around this but as eVC is not really supported any longer we now only keep
196 // this for backwards compatibility and, despite its name, this is a typedef
197 // for wxEvtHandler member now -- but if we have the same problem with another
198 // compiler we can restore its old definition for it.
199 typedef wxEventFunction wxObjectEventFunction
;
202 // The event functor which is stored in the static and dynamic event tables:
203 class WXDLLIMPEXP_BASE wxEventFunctor
206 virtual ~wxEventFunctor();
208 // Invoke the actual event handler:
209 virtual void operator()(wxEvtHandler
*, wxEvent
&) = 0;
211 // this function tests whether this functor is matched, for the purpose of
212 // finding it in an event table in Disconnect(), by the given func
213 virtual bool Matches(const wxEventFunctor
& func
) const = 0;
215 virtual wxEvtHandler
*GetHandler() const { return NULL
; }
217 virtual wxObjectEventFunction
GetMethod() const { return NULL
; }
220 // A plain method functor
221 class WXDLLIMPEXP_BASE wxObjectEventFunctor
: public wxEventFunctor
224 wxObjectEventFunctor(wxObjectEventFunction method
, wxEvtHandler
*handler
)
230 virtual void operator()(wxEvtHandler
*handler
, wxEvent
& event
)
232 wxEvtHandler
* const realHandler
= m_handler
? m_handler
: handler
;
234 (realHandler
->*m_method
)(event
);
237 virtual bool Matches(const wxEventFunctor
& other
) const
239 wxEvtHandler
* const handler
= other
.GetHandler();
241 return (m_handler
== handler
|| !handler
) &&
242 (m_method
== other
.GetMethod());
245 virtual wxEvtHandler
*GetHandler() const { return m_handler
; }
246 virtual wxObjectEventFunction
GetMethod() const { return m_method
; }
249 wxEvtHandler
*m_handler
;
250 wxObjectEventFunction m_method
;
253 // Create a functor for the legacy events: handler can be NULL and its default
254 // value is used by the event table macros
256 inline wxObjectEventFunctor
*
257 wxNewEventFunctor(const wxEventType
& WXUNUSED(evtType
),
258 wxObjectEventFunction method
,
259 wxEvtHandler
*handler
= NULL
)
261 return new wxObjectEventFunctor(method
, handler
);
264 inline wxObjectEventFunctor
265 wxConstructEventFunctor(const wxEventType
& WXUNUSED(evtType
),
266 wxObjectEventFunction method
,
267 wxEvtHandler
*handler
)
269 return wxObjectEventFunctor(method
, handler
);
272 #if !wxEVENTS_COMPATIBILITY_2_8
274 template <typename EventType
>
275 class WXDLLIMPEXP_BASE wxEventFunctorFunction
: public wxEventFunctor
278 wxEventFunctorFunction(void (*handler
)(typename
EventType::CorrespondingEvent
&))
283 virtual void operator()(wxEvtHandler
*WXUNUSED(handler
), wxEvent
& event
)
285 // Protect against wrong event i.e. wxMouseEvent evt(wxEVT_PAINT):
286 wxASSERT( dynamic_cast< typename
EventType::CorrespondingEvent
* >( &event
) != NULL
);
288 // Will throw a std::bad_cast exception in release build:
289 ( *m_handler
)( dynamic_cast< typename
EventType::CorrespondingEvent
& >( event
));
292 virtual bool Matches( const wxEventFunctor
&right
) const
294 wxEventFunctorFunction
const &other
= dynamic_cast< wxEventFunctorFunction
const & >( right
);
296 return m_handler
== other
.m_handler
|| other
.m_handler
== NULL
;
300 void ( *m_handler
)( typename
EventType::CorrespondingEvent
& );
304 template <typename EventType
, typename Class
, typename Derived
>
305 class WXDLLIMPEXP_BASE wxEventFunctorMethod
: public wxEventFunctor
308 wxEventFunctorMethod( void ( Class::*method
)( typename
EventType::CorrespondingEvent
& ),
315 virtual void operator () ( wxEvtHandler
*handler
, wxEvent
&event
)
317 // Compile-time type check 1: This requires Derived to derive from or
318 // be of the same type as Class
319 Class
*realHandler
= m_handler
;
321 if( m_handler
== NULL
)
323 // Verify that the handler does indeed derive from the class
324 // containing the handler method
325 wxASSERT( dynamic_cast< Class
* >( handler
) != NULL
);
327 realHandler
= dynamic_cast< Class
* >( handler
);
330 // Protect against wrong event i.e. wxMouseEvent evt(wxEVT_PAINT):
331 wxASSERT( dynamic_cast< typename
EventType::CorrespondingEvent
* >( &event
) != NULL
);
333 // Will throw a std::bad_cast exception in release build:
334 ( realHandler
->*m_method
)( dynamic_cast< typename
EventType::CorrespondingEvent
& >( event
));
337 virtual bool Matches( const wxEventFunctor
&right
) const
339 wxEventFunctorMethod
const &other
= dynamic_cast< wxEventFunctorMethod
const & >( right
);
341 return (( m_handler
== other
.m_handler
|| other
.m_handler
== NULL
) &&
342 ( m_method
== other
.m_method
|| other
.m_method
== NULL
));
345 virtual wxEvtHandler
*GetHandler() const
347 // This makes sure Derived derives from wxEvtHandler (it is still
348 // possible and even ok if Class does not derive from wxEvtHandler. In
349 // this case Derived would end up using multiple inheritance: class
350 // Derived : public wxEvtHandler, public Class { } where Class contains
351 // the method to call, but wxEvtHandler contains the wxTrackable and
352 // code for weak ref support
356 virtual wxObjectEventFunction
GetMethod() const
358 return reinterpret_cast<wxObjectEventFunction
>(m_method
);
363 void (Class::*m_method
)(typename
EventType::CorrespondingEvent
&);
367 template <typename EventType
, typename Functor
>
368 class WXDLLIMPEXP_BASE wxEventFunctorAdapter
: public wxEventFunctor
371 wxEventFunctorAdapter( Functor
&functor
)
376 virtual void operator () ( wxEvtHandler
*WXUNUSED( handler
), wxEvent
&event
)
378 // Protect against wrong event i.e. wxMouseEvent evt(wxEVT_PAINT):
379 wxASSERT( dynamic_cast< typename
EventType::CorrespondingEvent
* >( &event
) != NULL
);
381 // Will throw a std::bad_cast exception in release build:
382 m_functor( dynamic_cast< typename
EventType::CorrespondingEvent
& >( event
));
385 virtual bool Matches( const wxEventFunctor
&right
) const
387 wxEventFunctorAdapter
const &other
= dynamic_cast< wxEventFunctorAdapter
const & >( right
);
389 return m_functor
== other
.m_functor
;
397 // Create functors for the templatized events (needed in wxEvtHandler::Connect):
400 // Create a functor for functions:
402 template <typename EventType
>
403 inline wxEventFunctorFunction
<EventType
> *
404 wxNewEventFunctor(const EventType
&,
405 void (*function
)(typename
EventType::CorrespondingEvent
&))
407 return new wxEventFunctorFunction
<EventType
>(function
);
410 // Create a functor for methods:
412 template <typename EventType
, typename Class
>
413 inline wxEventFunctorMethod
<EventType
, Class
, Class
> *
414 wxNewEventFunctor(const EventType
&,
415 void (Class::*method
)(typename
EventType::CorrespondingEvent
&))
417 return new wxEventFunctorMethod
<EventType
, Class
, Class
>(method
, NULL
);
420 template <typename EventType
, typename Class
, typename Derived
>
421 inline wxEventFunctorMethod
<EventType
, Class
, Derived
> *
422 wxNewEventFunctor(const EventType
&,
423 void (Class::*method
)(typename
EventType::CorrespondingEvent
&),
426 return new wxEventFunctorMethod
<EventType
, Class
, Derived
>(method
, handler
);
429 // Create a functor for arbitrary functors (like boost::function):
430 template <typename EventType
, typename Functor
>
431 inline wxEventFunctorAdapter
<EventType
, Functor
> *
432 wxNewEventFunctor(const EventType
&,
435 return new wxEventFunctorAdapter
<EventType
, Functor
>(functor
);
439 // Construct functors for the templatized events (needed in wxEvtHandler::Disconnect):
442 // Construct a functor for functions:
444 template <typename EventType
>
445 inline wxEventFunctorFunction
<EventType
>
446 wxConstructEventFunctor(const EventType
&,
447 void (*function
)(typename
EventType::CorrespondingEvent
&))
449 return wxEventFunctorFunction
<EventType
>(function
);
452 // Construct a functor for methods:
454 template <typename EventType
, typename Class
>
455 inline wxEventFunctorMethod
<EventType
, Class
, Class
>
456 wxConstructEventFunctor(const EventType
&,
457 void (Class::*method
)(typename
EventType::CorrespondingEvent
&))
459 return wxEventFunctorMethod
<EventType
, Class
, Class
>(method
, NULL
);
462 template <typename EventType
, typename Class
, typename Derived
>
463 inline wxEventFunctorMethod
<EventType
, Class
, Derived
>
464 wxConstructEventFunctor(const EventType
&,
465 void (Class::*method
)(typename
EventType::CorrespondingEvent
&),
468 return wxEventFunctorMethod
<EventType
, Class
, Derived
>(method
, handler
);
471 // Construct a functor for arbitrary functors (like boost:function):
473 template <typename EventType
, typename Functor
>
474 inline wxEventFunctorAdapter
<EventType
, Functor
>
475 wxConstructEventFunctor(const EventType
&,
478 return wxEventFunctorAdapter
<EventType
, Functor
>(functor
);
481 #endif // !wxEVENTS_COMPATIBILITY_2_8
483 // many, but not all, standard event types
485 // some generic events
486 extern WXDLLIMPEXP_BASE
const wxEventType wxEVT_NULL
;
487 extern WXDLLIMPEXP_BASE
const wxEventType wxEVT_FIRST
;
488 extern WXDLLIMPEXP_BASE
const wxEventType wxEVT_USER_FIRST
;
490 // Need events declared to do this
491 class WXDLLIMPEXP_FWD_CORE wxCommandEvent
;
492 class WXDLLIMPEXP_FWD_CORE wxMouseEvent
;
493 class WXDLLIMPEXP_FWD_CORE wxFocusEvent
;
494 class WXDLLIMPEXP_FWD_CORE wxChildFocusEvent
;
495 class WXDLLIMPEXP_FWD_CORE wxKeyEvent
;
496 class WXDLLIMPEXP_FWD_CORE wxNavigationKeyEvent
;
497 class WXDLLIMPEXP_FWD_CORE wxSetCursorEvent
;
498 class WXDLLIMPEXP_FWD_CORE wxScrollEvent
;
499 class WXDLLIMPEXP_FWD_CORE wxSpinEvent
;
500 class WXDLLIMPEXP_FWD_CORE wxScrollWinEvent
;
501 class WXDLLIMPEXP_FWD_CORE wxSizeEvent
;
502 class WXDLLIMPEXP_FWD_CORE wxMoveEvent
;
503 class WXDLLIMPEXP_FWD_CORE wxCloseEvent
;
504 class WXDLLIMPEXP_FWD_CORE wxActivateEvent
;
505 class WXDLLIMPEXP_FWD_CORE wxWindowCreateEvent
;
506 class WXDLLIMPEXP_FWD_CORE wxWindowDestroyEvent
;
507 class WXDLLIMPEXP_FWD_CORE wxShowEvent
;
508 class WXDLLIMPEXP_FWD_CORE wxIconizeEvent
;
509 class WXDLLIMPEXP_FWD_CORE wxMaximizeEvent
;
510 class WXDLLIMPEXP_FWD_CORE wxMouseCaptureChangedEvent
;
511 class WXDLLIMPEXP_FWD_CORE wxMouseCaptureLostEvent
;
512 class WXDLLIMPEXP_FWD_CORE wxPaintEvent
;
513 class WXDLLIMPEXP_FWD_CORE wxEraseEvent
;
514 class WXDLLIMPEXP_FWD_CORE wxNcPaintEvent
;
515 class WXDLLIMPEXP_FWD_CORE wxMenuEvent
;
516 class WXDLLIMPEXP_FWD_CORE wxContextMenuEvent
;
517 class WXDLLIMPEXP_FWD_CORE wxSysColourChangedEvent
;
518 class WXDLLIMPEXP_FWD_CORE wxDisplayChangedEvent
;
519 class WXDLLIMPEXP_FWD_CORE wxQueryNewPaletteEvent
;
520 class WXDLLIMPEXP_FWD_CORE wxPaletteChangedEvent
;
521 class WXDLLIMPEXP_FWD_CORE wxJoystickEvent
;
522 class WXDLLIMPEXP_FWD_CORE wxDropFilesEvent
;
523 class WXDLLIMPEXP_FWD_CORE wxInitDialogEvent
;
524 class WXDLLIMPEXP_FWD_CORE wxIdleEvent
;
525 class WXDLLIMPEXP_FWD_CORE wxUpdateUIEvent
;
526 class WXDLLIMPEXP_FWD_CORE wxClipboardTextEvent
;
527 class WXDLLIMPEXP_FWD_CORE wxHelpEvent
;
531 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_COMMAND_BUTTON_CLICKED
, wxCommandEvent
)
532 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_COMMAND_CHECKBOX_CLICKED
, wxCommandEvent
)
533 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_COMMAND_CHOICE_SELECTED
, wxCommandEvent
)
534 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_COMMAND_LISTBOX_SELECTED
, wxCommandEvent
)
535 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_COMMAND_LISTBOX_DOUBLECLICKED
, wxCommandEvent
)
536 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_COMMAND_CHECKLISTBOX_TOGGLED
, wxCommandEvent
)
537 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_COMMAND_MENU_SELECTED
, wxCommandEvent
)
538 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_COMMAND_SLIDER_UPDATED
, wxCommandEvent
)
539 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_COMMAND_RADIOBOX_SELECTED
, wxCommandEvent
)
540 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_COMMAND_RADIOBUTTON_SELECTED
, wxCommandEvent
)
542 // wxEVT_COMMAND_SCROLLBAR_UPDATED is deprecated, use wxEVT_SCROLL... events
543 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_COMMAND_SCROLLBAR_UPDATED
, wxCommandEvent
)
544 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_COMMAND_VLBOX_SELECTED
, wxCommandEvent
)
545 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_COMMAND_COMBOBOX_SELECTED
, wxCommandEvent
)
546 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_COMMAND_TOOL_RCLICKED
, wxCommandEvent
)
547 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_COMMAND_TOOL_DROPDOWN_CLICKED
, wxCommandEvent
)
548 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_COMMAND_TOOL_ENTER
, wxCommandEvent
)
551 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_LEFT_DOWN
, wxMouseEvent
)
552 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_LEFT_UP
, wxMouseEvent
)
553 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_MIDDLE_DOWN
, wxMouseEvent
)
554 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_MIDDLE_UP
, wxMouseEvent
)
555 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_RIGHT_DOWN
, wxMouseEvent
)
556 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_RIGHT_UP
, wxMouseEvent
)
557 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_MOTION
, wxMouseEvent
)
558 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_ENTER_WINDOW
, wxMouseEvent
)
559 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_LEAVE_WINDOW
, wxMouseEvent
)
560 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_LEFT_DCLICK
, wxMouseEvent
)
561 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_MIDDLE_DCLICK
, wxMouseEvent
)
562 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_RIGHT_DCLICK
, wxMouseEvent
)
563 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_SET_FOCUS
, wxFocusEvent
)
564 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_KILL_FOCUS
, wxFocusEvent
)
565 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_CHILD_FOCUS
, wxChildFocusEvent
)
566 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_MOUSEWHEEL
, wxMouseEvent
)
567 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_AUX1_DOWN
, wxMouseEvent
)
568 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_AUX1_UP
, wxMouseEvent
)
569 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_AUX1_DCLICK
, wxMouseEvent
)
570 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_AUX2_DOWN
, wxMouseEvent
)
571 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_AUX2_UP
, wxMouseEvent
)
572 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_AUX2_DCLICK
, wxMouseEvent
)
574 // Character input event type
575 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_CHAR
, wxKeyEvent
)
576 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_CHAR_HOOK
, wxKeyEvent
)
577 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_NAVIGATION_KEY
, wxNavigationKeyEvent
)
578 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_KEY_DOWN
, wxKeyEvent
)
579 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_KEY_UP
, wxKeyEvent
)
581 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_HOTKEY
, wxKeyEvent
)
584 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_SET_CURSOR
, wxSetCursorEvent
)
586 // wxScrollBar and wxSlider event identifiers
587 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_SCROLL_TOP
, wxScrollEvent
)
588 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_SCROLL_BOTTOM
, wxScrollEvent
)
589 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_SCROLL_LINEUP
, wxScrollEvent
)
590 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_SCROLL_LINEDOWN
, wxScrollEvent
)
591 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_SCROLL_PAGEUP
, wxScrollEvent
)
592 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_SCROLL_PAGEDOWN
, wxScrollEvent
)
593 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_SCROLL_THUMBTRACK
, wxScrollEvent
)
594 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_SCROLL_THUMBRELEASE
, wxScrollEvent
)
595 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_SCROLL_CHANGED
, wxScrollEvent
)
597 // Due to a bug in older wx versions, wxSpinEvents were being sent with type of
598 // wxEVT_SCROLL_LINEUP, wxEVT_SCROLL_LINEDOWN and wxEVT_SCROLL_THUMBTRACK. But
599 // with the type-safe events in place, these event types are associated with
600 // wxScrollEvent. To allow handling of spin events, new event types have been
601 // defined in spinbutt.h/spinnbuttcmn.cpp. To maintain backward compatibility
602 // the spin event types are being initialized with the scroll event types.
606 wxDECLARE_EXPORTED_EVENT_ALIAS( WXDLLIMPEXP_CORE
, wxEVT_SPIN_UP
, wxSpinEvent
)
607 wxDECLARE_EXPORTED_EVENT_ALIAS( WXDLLIMPEXP_CORE
, wxEVT_SPIN_DOWN
, wxSpinEvent
)
608 wxDECLARE_EXPORTED_EVENT_ALIAS( WXDLLIMPEXP_CORE
, wxEVT_SPIN
, wxSpinEvent
)
612 // Scroll events from wxWindow
613 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_SCROLLWIN_TOP
, wxScrollWinEvent
)
614 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_SCROLLWIN_BOTTOM
, wxScrollWinEvent
)
615 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_SCROLLWIN_LINEUP
, wxScrollWinEvent
)
616 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_SCROLLWIN_LINEDOWN
, wxScrollWinEvent
)
617 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_SCROLLWIN_PAGEUP
, wxScrollWinEvent
)
618 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_SCROLLWIN_PAGEDOWN
, wxScrollWinEvent
)
619 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_SCROLLWIN_THUMBTRACK
, wxScrollWinEvent
)
620 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_SCROLLWIN_THUMBRELEASE
, wxScrollWinEvent
)
623 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_SIZE
, wxSizeEvent
)
624 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_MOVE
, wxMoveEvent
)
625 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_CLOSE_WINDOW
, wxCloseEvent
)
626 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_END_SESSION
, wxCloseEvent
)
627 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_QUERY_END_SESSION
, wxCloseEvent
)
628 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_ACTIVATE_APP
, wxActivateEvent
)
629 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_ACTIVATE
, wxActivateEvent
)
630 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_CREATE
, wxWindowCreateEvent
)
631 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_DESTROY
, wxWindowDestroyEvent
)
632 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_SHOW
, wxShowEvent
)
633 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_ICONIZE
, wxIconizeEvent
)
634 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_MAXIMIZE
, wxMaximizeEvent
)
635 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_MOUSE_CAPTURE_CHANGED
, wxMouseCaptureChangedEvent
)
636 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_MOUSE_CAPTURE_LOST
, wxMouseCaptureLostEvent
)
637 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_PAINT
, wxPaintEvent
)
638 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_ERASE_BACKGROUND
, wxEraseEvent
)
639 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_NC_PAINT
, wxNcPaintEvent
)
640 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_MENU_OPEN
, wxMenuEvent
)
641 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_MENU_CLOSE
, wxMenuEvent
)
642 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_MENU_HIGHLIGHT
, wxMenuEvent
)
643 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_CONTEXT_MENU
, wxContextMenuEvent
)
644 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_SYS_COLOUR_CHANGED
, wxSysColourChangedEvent
)
645 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_DISPLAY_CHANGED
, wxDisplayChangedEvent
)
646 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_QUERY_NEW_PALETTE
, wxQueryNewPaletteEvent
)
647 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_PALETTE_CHANGED
, wxPaletteChangedEvent
)
648 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_JOY_BUTTON_DOWN
, wxJoystickEvent
)
649 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_JOY_BUTTON_UP
, wxJoystickEvent
)
650 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_JOY_MOVE
, wxJoystickEvent
)
651 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_JOY_ZMOVE
, wxJoystickEvent
)
652 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_DROP_FILES
, wxDropFilesEvent
)
653 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_INIT_DIALOG
, wxInitDialogEvent
)
654 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_BASE
, wxEVT_IDLE
, wxIdleEvent
)
655 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_UPDATE_UI
, wxUpdateUIEvent
)
656 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_SIZING
, wxSizeEvent
)
657 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_MOVING
, wxMoveEvent
)
658 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_MOVE_START
, wxMoveEvent
)
659 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_MOVE_END
, wxMoveEvent
)
660 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_HIBERNATE
, wxActivateEvent
)
663 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_COMMAND_TEXT_COPY
, wxClipboardTextEvent
)
664 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_COMMAND_TEXT_CUT
, wxClipboardTextEvent
)
665 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_COMMAND_TEXT_PASTE
, wxClipboardTextEvent
)
667 // Generic command events
668 // Note: a click is a higher-level event than button down/up
669 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_COMMAND_LEFT_CLICK
, wxCommandEvent
)
670 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_COMMAND_LEFT_DCLICK
, wxCommandEvent
)
671 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_COMMAND_RIGHT_CLICK
, wxCommandEvent
)
672 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_COMMAND_RIGHT_DCLICK
, wxCommandEvent
)
673 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_COMMAND_SET_FOCUS
, wxCommandEvent
)
674 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_COMMAND_KILL_FOCUS
, wxCommandEvent
)
675 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_COMMAND_ENTER
, wxCommandEvent
)
678 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_HELP
, wxHelpEvent
)
679 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_DETAILED_HELP
, wxHelpEvent
)
681 // these 2 events are the same
682 #define wxEVT_COMMAND_TOOL_CLICKED wxEVT_COMMAND_MENU_SELECTED
684 // ----------------------------------------------------------------------------
686 // ----------------------------------------------------------------------------
688 // this event is also used by wxComboBox and wxSpinCtrl which don't include
689 // wx/textctrl.h in all ports [yet], so declare it here as well
691 // still, any new code using it should include wx/textctrl.h explicitly
692 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_COMMAND_TEXT_UPDATED
, wxCommandEvent
)
694 // the predefined constants for the number of times we propagate event
695 // upwards window child-parent chain
696 enum Propagation_state
698 // don't propagate it at all
699 wxEVENT_PROPAGATE_NONE
= 0,
701 // propagate it until it is processed
702 wxEVENT_PROPAGATE_MAX
= INT_MAX
706 * wxWidgets events, covering all interesting things that might happen
707 * (button clicking, resizing, setting text in widgets, etc.).
709 * For each completely new event type, derive a new event class.
710 * An event CLASS represents a C++ class defining a range of similar event TYPES;
711 * examples are canvas events, panel item command events.
712 * An event TYPE is a unique identifier for a particular system event,
713 * such as a button press or a listbox deselection.
717 class WXDLLIMPEXP_BASE wxEvent
: public wxObject
720 wxEvent(int winid
= 0, wxEventType commandType
= wxEVT_NULL
);
722 void SetEventType(wxEventType typ
) { m_eventType
= typ
; }
723 wxEventType
GetEventType() const { return m_eventType
; }
724 wxObject
*GetEventObject() const { return m_eventObject
; }
725 void SetEventObject(wxObject
*obj
) { m_eventObject
= obj
; }
726 long GetTimestamp() const { return m_timeStamp
; }
727 void SetTimestamp(long ts
= 0) { m_timeStamp
= ts
; }
728 int GetId() const { return m_id
; }
729 void SetId(int Id
) { m_id
= Id
; }
731 // Can instruct event processor that we wish to ignore this event
732 // (treat as if the event table entry had not been found): this must be done
733 // to allow the event processing by the base classes (calling event.Skip()
734 // is the analog of calling the base class version of a virtual function)
735 void Skip(bool skip
= true) { m_skipped
= skip
; }
736 bool GetSkipped() const { return m_skipped
; }
738 // This function is used to create a copy of the event polymorphically and
739 // all derived classes must implement it because otherwise wxPostEvent()
740 // for them wouldn't work (it needs to do a copy of the event)
741 virtual wxEvent
*Clone() const = 0;
743 // Implementation only: this test is explicitly anti OO and this function
744 // exists only for optimization purposes.
745 bool IsCommandEvent() const { return m_isCommandEvent
; }
747 // Determine if this event should be propagating to the parent window.
748 bool ShouldPropagate() const
749 { return m_propagationLevel
!= wxEVENT_PROPAGATE_NONE
; }
751 // Stop an event from propagating to its parent window, returns the old
752 // propagation level value
753 int StopPropagation()
755 int propagationLevel
= m_propagationLevel
;
756 m_propagationLevel
= wxEVENT_PROPAGATE_NONE
;
757 return propagationLevel
;
760 // Resume the event propagation by restoring the propagation level
761 // (returned by StopPropagation())
762 void ResumePropagation(int propagationLevel
)
764 m_propagationLevel
= propagationLevel
;
768 // This is for internal use only and is only called by
769 // wxEvtHandler::ProcessEvent() to check whether it's the first time this
770 // event is being processed
773 if ( m_wasProcessed
)
776 m_wasProcessed
= true;
782 wxObject
* m_eventObject
;
783 wxEventType m_eventType
;
788 // m_callbackUserData is for internal usage only
789 wxObject
* m_callbackUserData
;
792 // the propagation level: while it is positive, we propagate the event to
793 // the parent window (if any)
795 // this one doesn't have to be public, we don't have to worry about
796 // backwards compatibility as it is new
797 int m_propagationLevel
;
800 bool m_isCommandEvent
;
802 // initially false but becomes true as soon as WasProcessed() is called for
803 // the first time, as this is done only by ProcessEvent() it explains the
804 // variable name: it becomes true after ProcessEvent() was called at least
805 // once for this event
809 wxEvent(const wxEvent
&); // for implementing Clone()
810 wxEvent
& operator=(const wxEvent
&); // for derived classes operator=()
813 // it needs to access our m_propagationLevel
814 friend class WXDLLIMPEXP_FWD_BASE wxPropagateOnce
;
816 DECLARE_ABSTRACT_CLASS(wxEvent
)
820 * Helper class to temporarily change an event not to propagate.
822 class WXDLLIMPEXP_BASE wxPropagationDisabler
825 wxPropagationDisabler(wxEvent
& event
) : m_event(event
)
827 m_propagationLevelOld
= m_event
.StopPropagation();
830 ~wxPropagationDisabler()
832 m_event
.ResumePropagation(m_propagationLevelOld
);
837 int m_propagationLevelOld
;
839 DECLARE_NO_COPY_CLASS(wxPropagationDisabler
)
843 * Another one to temporarily lower propagation level.
845 class WXDLLIMPEXP_BASE wxPropagateOnce
848 wxPropagateOnce(wxEvent
& event
) : m_event(event
)
850 wxASSERT_MSG( m_event
.m_propagationLevel
> 0,
851 _T("shouldn't be used unless ShouldPropagate()!") );
853 m_event
.m_propagationLevel
--;
858 m_event
.m_propagationLevel
++;
864 DECLARE_NO_COPY_CLASS(wxPropagateOnce
)
871 // Item or menu event class
873 wxEVT_COMMAND_BUTTON_CLICKED
874 wxEVT_COMMAND_CHECKBOX_CLICKED
875 wxEVT_COMMAND_CHOICE_SELECTED
876 wxEVT_COMMAND_LISTBOX_SELECTED
877 wxEVT_COMMAND_LISTBOX_DOUBLECLICKED
878 wxEVT_COMMAND_TEXT_UPDATED
879 wxEVT_COMMAND_TEXT_ENTER
880 wxEVT_COMMAND_MENU_SELECTED
881 wxEVT_COMMAND_SLIDER_UPDATED
882 wxEVT_COMMAND_RADIOBOX_SELECTED
883 wxEVT_COMMAND_RADIOBUTTON_SELECTED
884 wxEVT_COMMAND_SCROLLBAR_UPDATED
885 wxEVT_COMMAND_VLBOX_SELECTED
886 wxEVT_COMMAND_COMBOBOX_SELECTED
887 wxEVT_COMMAND_TOGGLEBUTTON_CLICKED
890 class WXDLLIMPEXP_CORE wxCommandEvent
: public wxEvent
893 wxCommandEvent(wxEventType commandType
= wxEVT_NULL
, int winid
= 0);
895 wxCommandEvent(const wxCommandEvent
& event
)
897 m_cmdString(event
.m_cmdString
),
898 m_commandInt(event
.m_commandInt
),
899 m_extraLong(event
.m_extraLong
),
900 m_clientData(event
.m_clientData
),
901 m_clientObject(event
.m_clientObject
)
904 // Set/Get client data from controls
905 void SetClientData(void* clientData
) { m_clientData
= clientData
; }
906 void *GetClientData() const { return m_clientData
; }
908 // Set/Get client object from controls
909 void SetClientObject(wxClientData
* clientObject
) { m_clientObject
= clientObject
; }
910 wxClientData
*GetClientObject() const { return m_clientObject
; }
912 // Get listbox selection if single-choice
913 int GetSelection() const { return m_commandInt
; }
915 // Set/Get listbox/choice selection string
916 void SetString(const wxString
& s
) { m_cmdString
= s
; }
917 wxString
GetString() const;
919 // Get checkbox value
920 bool IsChecked() const { return m_commandInt
!= 0; }
922 // true if the listbox event was a selection.
923 bool IsSelection() const { return (m_extraLong
!= 0); }
925 void SetExtraLong(long extraLong
) { m_extraLong
= extraLong
; }
926 long GetExtraLong() const { return m_extraLong
; }
928 void SetInt(int i
) { m_commandInt
= i
; }
929 int GetInt() const { return m_commandInt
; }
931 virtual wxEvent
*Clone() const { return new wxCommandEvent(*this); }
934 wxString m_cmdString
; // String event argument
936 long m_extraLong
; // Additional information (e.g. select/deselect)
937 void* m_clientData
; // Arbitrary client data
938 wxClientData
* m_clientObject
; // Arbitrary client object
941 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCommandEvent
)
944 // this class adds a possibility to react (from the user) code to a control
945 // notification: allow or veto the operation being reported.
946 class WXDLLIMPEXP_CORE wxNotifyEvent
: public wxCommandEvent
949 wxNotifyEvent(wxEventType commandType
= wxEVT_NULL
, int winid
= 0)
950 : wxCommandEvent(commandType
, winid
)
953 wxNotifyEvent(const wxNotifyEvent
& event
)
954 : wxCommandEvent(event
)
955 { m_bAllow
= event
.m_bAllow
; }
957 // veto the operation (usually it's allowed by default)
958 void Veto() { m_bAllow
= false; }
960 // allow the operation if it was disabled by default
961 void Allow() { m_bAllow
= true; }
963 // for implementation code only: is the operation allowed?
964 bool IsAllowed() const { return m_bAllow
; }
966 virtual wxEvent
*Clone() const { return new wxNotifyEvent(*this); }
972 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxNotifyEvent
)
975 // Scroll event class, derived form wxCommandEvent. wxScrollEvents are
976 // sent by wxSlider and wxScrollBar.
981 wxEVT_SCROLL_LINEDOWN
983 wxEVT_SCROLL_PAGEDOWN
984 wxEVT_SCROLL_THUMBTRACK
985 wxEVT_SCROLL_THUMBRELEASE
989 class WXDLLIMPEXP_CORE wxScrollEvent
: public wxCommandEvent
992 wxScrollEvent(wxEventType commandType
= wxEVT_NULL
,
993 int winid
= 0, int pos
= 0, int orient
= 0);
995 int GetOrientation() const { return (int) m_extraLong
; }
996 int GetPosition() const { return m_commandInt
; }
997 void SetOrientation(int orient
) { m_extraLong
= (long) orient
; }
998 void SetPosition(int pos
) { m_commandInt
= pos
; }
1000 virtual wxEvent
*Clone() const { return new wxScrollEvent(*this); }
1003 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxScrollEvent
)
1006 // ScrollWin event class, derived fom wxEvent. wxScrollWinEvents
1007 // are sent by wxWindow.
1010 wxEVT_SCROLLWIN_BOTTOM
1011 wxEVT_SCROLLWIN_LINEUP
1012 wxEVT_SCROLLWIN_LINEDOWN
1013 wxEVT_SCROLLWIN_PAGEUP
1014 wxEVT_SCROLLWIN_PAGEDOWN
1015 wxEVT_SCROLLWIN_THUMBTRACK
1016 wxEVT_SCROLLWIN_THUMBRELEASE
1019 class WXDLLIMPEXP_CORE wxScrollWinEvent
: public wxEvent
1022 wxScrollWinEvent(wxEventType commandType
= wxEVT_NULL
,
1023 int pos
= 0, int orient
= 0);
1024 wxScrollWinEvent(const wxScrollWinEvent
& event
) : wxEvent(event
)
1025 { m_commandInt
= event
.m_commandInt
;
1026 m_extraLong
= event
.m_extraLong
; }
1028 int GetOrientation() const { return (int) m_extraLong
; }
1029 int GetPosition() const { return m_commandInt
; }
1030 void SetOrientation(int orient
) { m_extraLong
= (long) orient
; }
1031 void SetPosition(int pos
) { m_commandInt
= pos
; }
1033 virtual wxEvent
*Clone() const { return new wxScrollWinEvent(*this); }
1040 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxScrollWinEvent
)
1043 // Mouse event class
1060 wxEVT_NC_MIDDLE_DOWN,
1062 wxEVT_NC_RIGHT_DOWN,
1065 wxEVT_NC_ENTER_WINDOW,
1066 wxEVT_NC_LEAVE_WINDOW,
1067 wxEVT_NC_LEFT_DCLICK,
1068 wxEVT_NC_MIDDLE_DCLICK,
1069 wxEVT_NC_RIGHT_DCLICK,
1072 // the symbolic names for the mouse buttons
1075 wxMOUSE_BTN_ANY
= -1,
1076 wxMOUSE_BTN_NONE
= 0,
1077 wxMOUSE_BTN_LEFT
= 1,
1078 wxMOUSE_BTN_MIDDLE
= 2,
1079 wxMOUSE_BTN_RIGHT
= 3,
1080 wxMOUSE_BTN_AUX1
= 4,
1081 wxMOUSE_BTN_AUX2
= 5,
1085 class WXDLLIMPEXP_CORE wxMouseEvent
: public wxEvent
,
1089 wxMouseEvent(wxEventType mouseType
= wxEVT_NULL
);
1090 wxMouseEvent(const wxMouseEvent
& event
)
1097 // Was it a button event? (*doesn't* mean: is any button *down*?)
1098 bool IsButton() const { return Button(wxMOUSE_BTN_ANY
); }
1100 // Was it a down event from this (or any) button?
1101 bool ButtonDown(int but
= wxMOUSE_BTN_ANY
) const;
1103 // Was it a dclick event from this (or any) button?
1104 bool ButtonDClick(int but
= wxMOUSE_BTN_ANY
) const;
1106 // Was it a up event from this (or any) button?
1107 bool ButtonUp(int but
= wxMOUSE_BTN_ANY
) const;
1109 // Was the given button?
1110 bool Button(int but
) const;
1112 // Was the given button in Down state?
1113 bool ButtonIsDown(int but
) const;
1115 // Get the button which is changing state (wxMOUSE_BTN_NONE if none)
1116 int GetButton() const;
1118 // Find which event was just generated
1119 bool LeftDown() const { return (m_eventType
== wxEVT_LEFT_DOWN
); }
1120 bool MiddleDown() const { return (m_eventType
== wxEVT_MIDDLE_DOWN
); }
1121 bool RightDown() const { return (m_eventType
== wxEVT_RIGHT_DOWN
); }
1122 bool Aux1Down() const { return (m_eventType
== wxEVT_AUX1_DOWN
); }
1123 bool Aux2Down() const { return (m_eventType
== wxEVT_AUX2_DOWN
); }
1125 bool LeftUp() const { return (m_eventType
== wxEVT_LEFT_UP
); }
1126 bool MiddleUp() const { return (m_eventType
== wxEVT_MIDDLE_UP
); }
1127 bool RightUp() const { return (m_eventType
== wxEVT_RIGHT_UP
); }
1128 bool Aux1Up() const { return (m_eventType
== wxEVT_AUX1_UP
); }
1129 bool Aux2Up() const { return (m_eventType
== wxEVT_AUX2_UP
); }
1131 bool LeftDClick() const { return (m_eventType
== wxEVT_LEFT_DCLICK
); }
1132 bool MiddleDClick() const { return (m_eventType
== wxEVT_MIDDLE_DCLICK
); }
1133 bool RightDClick() const { return (m_eventType
== wxEVT_RIGHT_DCLICK
); }
1134 bool Aux1DClick() const { return (m_eventType
== wxEVT_AUX1_UP
); }
1135 bool Aux2DClick() const { return (m_eventType
== wxEVT_AUX2_UP
); }
1137 // Find the current state of the mouse buttons (regardless
1138 // of current event type)
1139 bool LeftIsDown() const { return m_leftDown
; }
1140 bool MiddleIsDown() const { return m_middleDown
; }
1141 bool RightIsDown() const { return m_rightDown
; }
1142 bool Aux1IsDown() const { return m_aux1Down
; }
1143 bool Aux2IsDown() const { return m_aux2Down
; }
1145 // True if a button is down and the mouse is moving
1146 bool Dragging() const
1148 return (m_eventType
== wxEVT_MOTION
) && ButtonIsDown(wxMOUSE_BTN_ANY
);
1151 // True if the mouse is moving, and no button is down
1154 return (m_eventType
== wxEVT_MOTION
) && !ButtonIsDown(wxMOUSE_BTN_ANY
);
1157 // True if the mouse is just entering the window
1158 bool Entering() const { return (m_eventType
== wxEVT_ENTER_WINDOW
); }
1160 // True if the mouse is just leaving the window
1161 bool Leaving() const { return (m_eventType
== wxEVT_LEAVE_WINDOW
); }
1163 // Returns the number of mouse clicks associated with this event.
1164 int GetClickCount() const { return m_clickCount
; }
1167 // Find the position of the event
1168 void GetPosition(wxCoord
*xpos
, wxCoord
*ypos
) const
1176 void GetPosition(long *xpos
, long *ypos
) const
1184 // Find the position of the event
1185 wxPoint
GetPosition() const { return wxPoint(m_x
, m_y
); }
1187 // Find the logical position of the event given the DC
1188 wxPoint
GetLogicalPosition(const wxDC
& dc
) const;
1191 wxCoord
GetX() const { return m_x
; }
1194 wxCoord
GetY() const { return m_y
; }
1196 // Get wheel rotation, positive or negative indicates direction of
1197 // rotation. Current devices all send an event when rotation is equal to
1198 // +/-WheelDelta, but this allows for finer resolution devices to be
1199 // created in the future. Because of this you shouldn't assume that one
1200 // event is equal to 1 line or whatever, but you should be able to either
1201 // do partial line scrolling or wait until +/-WheelDelta rotation values
1202 // have been accumulated before scrolling.
1203 int GetWheelRotation() const { return m_wheelRotation
; }
1205 // Get wheel delta, normally 120. This is the threshold for action to be
1206 // taken, and one such action (for example, scrolling one increment)
1207 // should occur for each delta.
1208 int GetWheelDelta() const { return m_wheelDelta
; }
1210 // Gets the axis the wheel operation concerns, 0 being the y axis as on
1211 // most mouse wheels, 1 is the x axis for things like MightyMouse scrolls
1212 // or horizontal trackpad scrolling
1213 int GetWheelAxis() const { return m_wheelAxis
; }
1215 // Returns the configured number of lines (or whatever) to be scrolled per
1216 // wheel action. Defaults to one.
1217 int GetLinesPerAction() const { return m_linesPerAction
; }
1219 // Is the system set to do page scrolling?
1220 bool IsPageScroll() const { return ((unsigned int)m_linesPerAction
== UINT_MAX
); }
1222 virtual wxEvent
*Clone() const { return new wxMouseEvent(*this); }
1224 wxMouseEvent
& operator=(const wxMouseEvent
& event
)
1243 int m_wheelRotation
;
1245 int m_linesPerAction
;
1248 void Assign(const wxMouseEvent
& evt
);
1251 DECLARE_DYNAMIC_CLASS(wxMouseEvent
)
1260 class WXDLLIMPEXP_CORE wxSetCursorEvent
: public wxEvent
1263 wxSetCursorEvent(wxCoord x
= 0, wxCoord y
= 0)
1264 : wxEvent(0, wxEVT_SET_CURSOR
),
1265 m_x(x
), m_y(y
), m_cursor()
1268 wxSetCursorEvent(const wxSetCursorEvent
& event
)
1272 m_cursor(event
.m_cursor
)
1275 wxCoord
GetX() const { return m_x
; }
1276 wxCoord
GetY() const { return m_y
; }
1278 void SetCursor(const wxCursor
& cursor
) { m_cursor
= cursor
; }
1279 const wxCursor
& GetCursor() const { return m_cursor
; }
1280 bool HasCursor() const { return m_cursor
.Ok(); }
1282 virtual wxEvent
*Clone() const { return new wxSetCursorEvent(*this); }
1289 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSetCursorEvent
)
1292 // Keyboard input event class
1302 class WXDLLIMPEXP_CORE wxKeyEvent
: public wxEvent
,
1303 public wxKeyboardState
1306 wxKeyEvent(wxEventType keyType
= wxEVT_NULL
);
1307 wxKeyEvent(const wxKeyEvent
& evt
);
1309 // get the key code: an ASCII7 char or an element of wxKeyCode enum
1310 int GetKeyCode() const { return (int)m_keyCode
; }
1313 // get the Unicode character corresponding to this key
1314 wxChar
GetUnicodeKey() const { return m_uniChar
; }
1315 #endif // wxUSE_UNICODE
1317 // get the raw key code (platform-dependent)
1318 wxUint32
GetRawKeyCode() const { return m_rawCode
; }
1320 // get the raw key flags (platform-dependent)
1321 wxUint32
GetRawKeyFlags() const { return m_rawFlags
; }
1323 // Find the position of the event
1324 void GetPosition(wxCoord
*xpos
, wxCoord
*ypos
) const
1326 if (xpos
) *xpos
= m_x
;
1327 if (ypos
) *ypos
= m_y
;
1330 void GetPosition(long *xpos
, long *ypos
) const
1332 if (xpos
) *xpos
= (long)m_x
;
1333 if (ypos
) *ypos
= (long)m_y
;
1336 wxPoint
GetPosition() const
1337 { return wxPoint(m_x
, m_y
); }
1340 wxCoord
GetX() const { return m_x
; }
1343 wxCoord
GetY() const { return m_y
; }
1345 virtual wxEvent
*Clone() const { return new wxKeyEvent(*this); }
1347 // we do need to copy wxKeyEvent sometimes (in wxTreeCtrl code, for
1349 wxKeyEvent
& operator=(const wxKeyEvent
& evt
)
1353 wxEvent::operator=(evt
);
1355 // Borland C++ 5.82 doesn't compile an explicit call to an
1356 // implicitly defined operator=() so need to do it this way:
1357 *static_cast<wxKeyboardState
*>(this) = evt
;
1362 m_keyCode
= evt
.m_keyCode
;
1364 m_scanCode
= evt
.m_scanCode
;
1365 m_rawCode
= evt
.m_rawCode
;
1366 m_rawFlags
= evt
.m_rawFlags
;
1368 m_uniChar
= evt
.m_uniChar
;
1379 // FIXME: what is this for? relation to m_rawXXX?
1383 // This contains the full Unicode character
1384 // in a character events in Unicode mode
1388 // these fields contain the platform-specific information about
1389 // key that was pressed
1391 wxUint32 m_rawFlags
;
1394 DECLARE_DYNAMIC_CLASS(wxKeyEvent
)
1402 class WXDLLIMPEXP_CORE wxSizeEvent
: public wxEvent
1405 wxSizeEvent() : wxEvent(0, wxEVT_SIZE
)
1407 wxSizeEvent(const wxSize
& sz
, int winid
= 0)
1408 : wxEvent(winid
, wxEVT_SIZE
),
1411 wxSizeEvent(const wxSizeEvent
& event
)
1413 m_size(event
.m_size
), m_rect(event
.m_rect
)
1415 wxSizeEvent(const wxRect
& rect
, int id
= 0)
1416 : m_size(rect
.GetSize()), m_rect(rect
)
1417 { m_eventType
= wxEVT_SIZING
; m_id
= id
; }
1419 wxSize
GetSize() const { return m_size
; }
1420 wxRect
GetRect() const { return m_rect
; }
1421 void SetRect(const wxRect
& rect
) { m_rect
= rect
; }
1423 virtual wxEvent
*Clone() const { return new wxSizeEvent(*this); }
1426 // For internal usage only. Will be converted to protected members.
1428 wxRect m_rect
; // Used for wxEVT_SIZING
1431 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSizeEvent
)
1440 class WXDLLIMPEXP_CORE wxMoveEvent
: public wxEvent
1444 : wxEvent(0, wxEVT_MOVE
)
1446 wxMoveEvent(const wxPoint
& pos
, int winid
= 0)
1447 : wxEvent(winid
, wxEVT_MOVE
),
1450 wxMoveEvent(const wxMoveEvent
& event
)
1454 wxMoveEvent(const wxRect
& rect
, int id
= 0)
1455 : m_pos(rect
.GetPosition()), m_rect(rect
)
1456 { m_eventType
= wxEVT_MOVING
; m_id
= id
; }
1458 wxPoint
GetPosition() const { return m_pos
; }
1459 void SetPosition(const wxPoint
& pos
) { m_pos
= pos
; }
1460 wxRect
GetRect() const { return m_rect
; }
1461 void SetRect(const wxRect
& rect
) { m_rect
= rect
; }
1463 virtual wxEvent
*Clone() const { return new wxMoveEvent(*this); }
1470 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMoveEvent
)
1473 // Paint event class
1480 #if defined(__WXDEBUG__) && (defined(__WXMSW__) || defined(__WXPM__))
1481 // see comments in src/msw|os2/dcclient.cpp where g_isPainting is defined
1482 extern WXDLLIMPEXP_CORE
int g_isPainting
;
1485 class WXDLLIMPEXP_CORE wxPaintEvent
: public wxEvent
1488 wxPaintEvent(int Id
= 0)
1489 : wxEvent(Id
, wxEVT_PAINT
)
1491 #if defined(__WXDEBUG__) && (defined(__WXMSW__) || defined(__WXPM__))
1492 // set the internal flag for the duration of processing of WM_PAINT
1497 // default copy ctor and dtor are normally fine, we only need them to keep
1498 // g_isPainting updated in debug build
1499 #if defined(__WXDEBUG__) && (defined(__WXMSW__) || defined(__WXPM__))
1500 wxPaintEvent(const wxPaintEvent
& event
)
1506 virtual ~wxPaintEvent()
1512 virtual wxEvent
*Clone() const { return new wxPaintEvent(*this); }
1515 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxPaintEvent
)
1518 class WXDLLIMPEXP_CORE wxNcPaintEvent
: public wxEvent
1521 wxNcPaintEvent(int winid
= 0)
1522 : wxEvent(winid
, wxEVT_NC_PAINT
)
1525 virtual wxEvent
*Clone() const { return new wxNcPaintEvent(*this); }
1528 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxNcPaintEvent
)
1531 // Erase background event class
1533 wxEVT_ERASE_BACKGROUND
1536 class WXDLLIMPEXP_CORE wxEraseEvent
: public wxEvent
1539 wxEraseEvent(int Id
= 0, wxDC
*dc
= NULL
)
1540 : wxEvent(Id
, wxEVT_ERASE_BACKGROUND
),
1544 wxEraseEvent(const wxEraseEvent
& event
)
1549 wxDC
*GetDC() const { return m_dc
; }
1551 virtual wxEvent
*Clone() const { return new wxEraseEvent(*this); }
1557 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxEraseEvent
)
1560 // Focus event class
1566 class WXDLLIMPEXP_CORE wxFocusEvent
: public wxEvent
1569 wxFocusEvent(wxEventType type
= wxEVT_NULL
, int winid
= 0)
1570 : wxEvent(winid
, type
)
1573 wxFocusEvent(const wxFocusEvent
& event
)
1575 { m_win
= event
.m_win
; }
1577 // The window associated with this event is the window which had focus
1578 // before for SET event and the window which will have focus for the KILL
1579 // one. NB: it may be NULL in both cases!
1580 wxWindow
*GetWindow() const { return m_win
; }
1581 void SetWindow(wxWindow
*win
) { m_win
= win
; }
1583 virtual wxEvent
*Clone() const { return new wxFocusEvent(*this); }
1589 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxFocusEvent
)
1592 // wxChildFocusEvent notifies the parent that a child has got the focus: unlike
1593 // wxFocusEvent it is propagated upwards the window chain
1594 class WXDLLIMPEXP_CORE wxChildFocusEvent
: public wxCommandEvent
1597 wxChildFocusEvent(wxWindow
*win
= NULL
);
1599 wxWindow
*GetWindow() const { return (wxWindow
*)GetEventObject(); }
1601 virtual wxEvent
*Clone() const { return new wxChildFocusEvent(*this); }
1604 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxChildFocusEvent
)
1607 // Activate event class
1614 class WXDLLIMPEXP_CORE wxActivateEvent
: public wxEvent
1617 wxActivateEvent(wxEventType type
= wxEVT_NULL
, bool active
= true, int Id
= 0)
1619 { m_active
= active
; }
1620 wxActivateEvent(const wxActivateEvent
& event
)
1622 { m_active
= event
.m_active
; }
1624 bool GetActive() const { return m_active
; }
1626 virtual wxEvent
*Clone() const { return new wxActivateEvent(*this); }
1632 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxActivateEvent
)
1635 // InitDialog event class
1640 class WXDLLIMPEXP_CORE wxInitDialogEvent
: public wxEvent
1643 wxInitDialogEvent(int Id
= 0)
1644 : wxEvent(Id
, wxEVT_INIT_DIALOG
)
1647 virtual wxEvent
*Clone() const { return new wxInitDialogEvent(*this); }
1650 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxInitDialogEvent
)
1653 // Miscellaneous menu event class
1657 wxEVT_MENU_HIGHLIGHT,
1660 class WXDLLIMPEXP_CORE wxMenuEvent
: public wxEvent
1663 wxMenuEvent(wxEventType type
= wxEVT_NULL
, int winid
= 0, wxMenu
* menu
= NULL
)
1664 : wxEvent(winid
, type
)
1665 { m_menuId
= winid
; m_menu
= menu
; }
1666 wxMenuEvent(const wxMenuEvent
& event
)
1668 { m_menuId
= event
.m_menuId
; m_menu
= event
.m_menu
; }
1670 // only for wxEVT_MENU_HIGHLIGHT
1671 int GetMenuId() const { return m_menuId
; }
1673 // only for wxEVT_MENU_OPEN/CLOSE
1674 bool IsPopup() const { return m_menuId
== wxID_ANY
; }
1676 // only for wxEVT_MENU_OPEN/CLOSE
1677 wxMenu
* GetMenu() const { return m_menu
; }
1679 virtual wxEvent
*Clone() const { return new wxMenuEvent(*this); }
1685 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMenuEvent
)
1688 // Window close or session close event class
1692 wxEVT_QUERY_END_SESSION
1695 class WXDLLIMPEXP_CORE wxCloseEvent
: public wxEvent
1698 wxCloseEvent(wxEventType type
= wxEVT_NULL
, int winid
= 0)
1699 : wxEvent(winid
, type
),
1701 m_veto(false), // should be false by default
1704 wxCloseEvent(const wxCloseEvent
& event
)
1706 m_loggingOff(event
.m_loggingOff
),
1707 m_veto(event
.m_veto
),
1708 m_canVeto(event
.m_canVeto
) {}
1710 void SetLoggingOff(bool logOff
) { m_loggingOff
= logOff
; }
1711 bool GetLoggingOff() const
1713 // m_loggingOff flag is only used by wxEVT_[QUERY_]END_SESSION, it
1714 // doesn't make sense for wxEVT_CLOSE_WINDOW
1715 wxASSERT_MSG( m_eventType
!= wxEVT_CLOSE_WINDOW
,
1716 _T("this flag is for end session events only") );
1718 return m_loggingOff
;
1721 void Veto(bool veto
= true)
1723 // GetVeto() will return false anyhow...
1724 wxCHECK_RET( m_canVeto
,
1725 wxT("call to Veto() ignored (can't veto this event)") );
1729 void SetCanVeto(bool canVeto
) { m_canVeto
= canVeto
; }
1730 bool CanVeto() const { return m_canVeto
; }
1731 bool GetVeto() const { return m_canVeto
&& m_veto
; }
1733 virtual wxEvent
*Clone() const { return new wxCloseEvent(*this); }
1741 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCloseEvent
)
1748 class WXDLLIMPEXP_CORE wxShowEvent
: public wxEvent
1751 wxShowEvent(int winid
= 0, bool show
= false)
1752 : wxEvent(winid
, wxEVT_SHOW
)
1754 wxShowEvent(const wxShowEvent
& event
)
1756 { m_show
= event
.m_show
; }
1758 void SetShow(bool show
) { m_show
= show
; }
1760 // return true if the window was shown, false if hidden
1761 bool IsShown() const { return m_show
; }
1763 #if WXWIN_COMPATIBILITY_2_8
1764 wxDEPRECATED( bool GetShow() const { return IsShown(); } )
1767 virtual wxEvent
*Clone() const { return new wxShowEvent(*this); }
1773 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxShowEvent
)
1780 class WXDLLIMPEXP_CORE wxIconizeEvent
: public wxEvent
1783 wxIconizeEvent(int winid
= 0, bool iconized
= true)
1784 : wxEvent(winid
, wxEVT_ICONIZE
)
1785 { m_iconized
= iconized
; }
1786 wxIconizeEvent(const wxIconizeEvent
& event
)
1788 { m_iconized
= event
.m_iconized
; }
1790 #if WXWIN_COMPATIBILITY_2_8
1791 wxDEPRECATED( bool Iconized() const { return IsIconized(); } )
1793 // return true if the frame was iconized, false if restored
1794 bool IsIconized() const { return m_iconized
; }
1796 virtual wxEvent
*Clone() const { return new wxIconizeEvent(*this); }
1802 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxIconizeEvent
)
1808 class WXDLLIMPEXP_CORE wxMaximizeEvent
: public wxEvent
1811 wxMaximizeEvent(int winid
= 0)
1812 : wxEvent(winid
, wxEVT_MAXIMIZE
)
1815 virtual wxEvent
*Clone() const { return new wxMaximizeEvent(*this); }
1818 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMaximizeEvent
)
1821 // Joystick event class
1823 wxEVT_JOY_BUTTON_DOWN,
1824 wxEVT_JOY_BUTTON_UP,
1829 // Which joystick? Same as Windows ids so no conversion necessary.
1836 // Which button is down?
1839 wxJOY_BUTTON_ANY
= -1,
1846 class WXDLLIMPEXP_CORE wxJoystickEvent
: public wxEvent
1851 int m_buttonChange
; // Which button changed?
1852 int m_buttonState
; // Which buttons are down?
1853 int m_joyStick
; // Which joystick?
1856 wxJoystickEvent(wxEventType type
= wxEVT_NULL
,
1858 int joystick
= wxJOYSTICK1
,
1863 m_buttonChange(change
),
1864 m_buttonState(state
),
1865 m_joyStick(joystick
)
1868 wxJoystickEvent(const wxJoystickEvent
& event
)
1871 m_zPosition(event
.m_zPosition
),
1872 m_buttonChange(event
.m_buttonChange
),
1873 m_buttonState(event
.m_buttonState
),
1874 m_joyStick(event
.m_joyStick
)
1877 wxPoint
GetPosition() const { return m_pos
; }
1878 int GetZPosition() const { return m_zPosition
; }
1879 int GetButtonState() const { return m_buttonState
; }
1880 int GetButtonChange() const { return m_buttonChange
; }
1881 int GetJoystick() const { return m_joyStick
; }
1883 void SetJoystick(int stick
) { m_joyStick
= stick
; }
1884 void SetButtonState(int state
) { m_buttonState
= state
; }
1885 void SetButtonChange(int change
) { m_buttonChange
= change
; }
1886 void SetPosition(const wxPoint
& pos
) { m_pos
= pos
; }
1887 void SetZPosition(int zPos
) { m_zPosition
= zPos
; }
1889 // Was it a button event? (*doesn't* mean: is any button *down*?)
1890 bool IsButton() const { return ((GetEventType() == wxEVT_JOY_BUTTON_DOWN
) ||
1891 (GetEventType() == wxEVT_JOY_BUTTON_UP
)); }
1893 // Was it a move event?
1894 bool IsMove() const { return (GetEventType() == wxEVT_JOY_MOVE
); }
1896 // Was it a zmove event?
1897 bool IsZMove() const { return (GetEventType() == wxEVT_JOY_ZMOVE
); }
1899 // Was it a down event from button 1, 2, 3, 4 or any?
1900 bool ButtonDown(int but
= wxJOY_BUTTON_ANY
) const
1901 { return ((GetEventType() == wxEVT_JOY_BUTTON_DOWN
) &&
1902 ((but
== wxJOY_BUTTON_ANY
) || (but
== m_buttonChange
))); }
1904 // Was it a up event from button 1, 2, 3 or any?
1905 bool ButtonUp(int but
= wxJOY_BUTTON_ANY
) const
1906 { return ((GetEventType() == wxEVT_JOY_BUTTON_UP
) &&
1907 ((but
== wxJOY_BUTTON_ANY
) || (but
== m_buttonChange
))); }
1909 // Was the given button 1,2,3,4 or any in Down state?
1910 bool ButtonIsDown(int but
= wxJOY_BUTTON_ANY
) const
1911 { return (((but
== wxJOY_BUTTON_ANY
) && (m_buttonState
!= 0)) ||
1912 ((m_buttonState
& but
) == but
)); }
1914 virtual wxEvent
*Clone() const { return new wxJoystickEvent(*this); }
1917 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxJoystickEvent
)
1920 // Drop files event class
1925 class WXDLLIMPEXP_CORE wxDropFilesEvent
: public wxEvent
1932 wxDropFilesEvent(wxEventType type
= wxEVT_NULL
,
1934 wxString
*files
= NULL
)
1941 // we need a copy ctor to avoid deleting m_files pointer twice
1942 wxDropFilesEvent(const wxDropFilesEvent
& other
)
1944 m_noFiles(other
.m_noFiles
),
1948 m_files
= new wxString
[m_noFiles
];
1949 for ( int n
= 0; n
< m_noFiles
; n
++ )
1951 m_files
[n
] = other
.m_files
[n
];
1955 virtual ~wxDropFilesEvent()
1960 wxPoint
GetPosition() const { return m_pos
; }
1961 int GetNumberOfFiles() const { return m_noFiles
; }
1962 wxString
*GetFiles() const { return m_files
; }
1964 virtual wxEvent
*Clone() const { return new wxDropFilesEvent(*this); }
1967 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDropFilesEvent
)
1975 // Whether to always send update events to windows, or
1976 // to only send update events to those with the
1977 // wxWS_EX_PROCESS_UI_UPDATES style.
1981 // Send UI update events to all windows
1982 wxUPDATE_UI_PROCESS_ALL
,
1984 // Send UI update events to windows that have
1985 // the wxWS_EX_PROCESS_UI_UPDATES flag specified
1986 wxUPDATE_UI_PROCESS_SPECIFIED
1989 class WXDLLIMPEXP_CORE wxUpdateUIEvent
: public wxCommandEvent
1992 wxUpdateUIEvent(wxWindowID commandId
= 0)
1993 : wxCommandEvent(wxEVT_UPDATE_UI
, commandId
)
2001 m_setChecked
= false;
2003 wxUpdateUIEvent(const wxUpdateUIEvent
& event
)
2004 : wxCommandEvent(event
),
2005 m_checked(event
.m_checked
),
2006 m_enabled(event
.m_enabled
),
2007 m_shown(event
.m_shown
),
2008 m_setEnabled(event
.m_setEnabled
),
2009 m_setShown(event
.m_setShown
),
2010 m_setText(event
.m_setText
),
2011 m_setChecked(event
.m_setChecked
),
2012 m_text(event
.m_text
)
2015 bool GetChecked() const { return m_checked
; }
2016 bool GetEnabled() const { return m_enabled
; }
2017 bool GetShown() const { return m_shown
; }
2018 wxString
GetText() const { return m_text
; }
2019 bool GetSetText() const { return m_setText
; }
2020 bool GetSetChecked() const { return m_setChecked
; }
2021 bool GetSetEnabled() const { return m_setEnabled
; }
2022 bool GetSetShown() const { return m_setShown
; }
2024 void Check(bool check
) { m_checked
= check
; m_setChecked
= true; }
2025 void Enable(bool enable
) { m_enabled
= enable
; m_setEnabled
= true; }
2026 void Show(bool show
) { m_shown
= show
; m_setShown
= true; }
2027 void SetText(const wxString
& text
) { m_text
= text
; m_setText
= true; }
2029 // Sets the interval between updates in milliseconds.
2030 // Set to -1 to disable updates, or to 0 to update as frequently as possible.
2031 static void SetUpdateInterval(long updateInterval
) { sm_updateInterval
= updateInterval
; }
2033 // Returns the current interval between updates in milliseconds
2034 static long GetUpdateInterval() { return sm_updateInterval
; }
2036 // Can we update this window?
2037 static bool CanUpdate(wxWindowBase
*win
);
2039 // Reset the update time to provide a delay until the next
2040 // time we should update
2041 static void ResetUpdateTime();
2043 // Specify how wxWidgets will send update events: to
2044 // all windows, or only to those which specify that they
2045 // will process the events.
2046 static void SetMode(wxUpdateUIMode mode
) { sm_updateMode
= mode
; }
2048 // Returns the UI update mode
2049 static wxUpdateUIMode
GetMode() { return sm_updateMode
; }
2051 virtual wxEvent
*Clone() const { return new wxUpdateUIEvent(*this); }
2063 static wxLongLong sm_lastUpdate
;
2065 static long sm_updateInterval
;
2066 static wxUpdateUIMode sm_updateMode
;
2069 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxUpdateUIEvent
)
2073 wxEVT_SYS_COLOUR_CHANGED
2076 // TODO: shouldn't all events record the window ID?
2077 class WXDLLIMPEXP_CORE wxSysColourChangedEvent
: public wxEvent
2080 wxSysColourChangedEvent()
2081 : wxEvent(0, wxEVT_SYS_COLOUR_CHANGED
)
2084 virtual wxEvent
*Clone() const { return new wxSysColourChangedEvent(*this); }
2087 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSysColourChangedEvent
)
2091 wxEVT_MOUSE_CAPTURE_CHANGED
2092 The window losing the capture receives this message
2093 (even if it released the capture itself).
2096 class WXDLLIMPEXP_CORE wxMouseCaptureChangedEvent
: public wxEvent
2099 wxMouseCaptureChangedEvent(wxWindowID winid
= 0, wxWindow
* gainedCapture
= NULL
)
2100 : wxEvent(winid
, wxEVT_MOUSE_CAPTURE_CHANGED
),
2101 m_gainedCapture(gainedCapture
)
2104 wxMouseCaptureChangedEvent(const wxMouseCaptureChangedEvent
& event
)
2106 m_gainedCapture(event
.m_gainedCapture
)
2109 virtual wxEvent
*Clone() const { return new wxMouseCaptureChangedEvent(*this); }
2111 wxWindow
* GetCapturedWindow() const { return m_gainedCapture
; }
2114 wxWindow
* m_gainedCapture
;
2116 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMouseCaptureChangedEvent
)
2120 wxEVT_MOUSE_CAPTURE_LOST
2121 The window losing the capture receives this message, unless it released it
2122 it itself or unless wxWindow::CaptureMouse was called on another window
2123 (and so capture will be restored when the new capturer releases it).
2126 class WXDLLIMPEXP_CORE wxMouseCaptureLostEvent
: public wxEvent
2129 wxMouseCaptureLostEvent(wxWindowID winid
= 0)
2130 : wxEvent(winid
, wxEVT_MOUSE_CAPTURE_LOST
)
2133 wxMouseCaptureLostEvent(const wxMouseCaptureLostEvent
& event
)
2137 virtual wxEvent
*Clone() const { return new wxMouseCaptureLostEvent(*this); }
2139 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMouseCaptureLostEvent
)
2143 wxEVT_DISPLAY_CHANGED
2145 class WXDLLIMPEXP_CORE wxDisplayChangedEvent
: public wxEvent
2148 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDisplayChangedEvent
)
2151 wxDisplayChangedEvent()
2152 : wxEvent(0, wxEVT_DISPLAY_CHANGED
)
2155 virtual wxEvent
*Clone() const { return new wxDisplayChangedEvent(*this); }
2159 wxEVT_PALETTE_CHANGED
2162 class WXDLLIMPEXP_CORE wxPaletteChangedEvent
: public wxEvent
2165 wxPaletteChangedEvent(wxWindowID winid
= 0)
2166 : wxEvent(winid
, wxEVT_PALETTE_CHANGED
),
2167 m_changedWindow(NULL
)
2170 wxPaletteChangedEvent(const wxPaletteChangedEvent
& event
)
2172 m_changedWindow(event
.m_changedWindow
)
2175 void SetChangedWindow(wxWindow
* win
) { m_changedWindow
= win
; }
2176 wxWindow
* GetChangedWindow() const { return m_changedWindow
; }
2178 virtual wxEvent
*Clone() const { return new wxPaletteChangedEvent(*this); }
2181 wxWindow
* m_changedWindow
;
2184 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxPaletteChangedEvent
)
2188 wxEVT_QUERY_NEW_PALETTE
2189 Indicates the window is getting keyboard focus and should re-do its palette.
2192 class WXDLLIMPEXP_CORE wxQueryNewPaletteEvent
: public wxEvent
2195 wxQueryNewPaletteEvent(wxWindowID winid
= 0)
2196 : wxEvent(winid
, wxEVT_QUERY_NEW_PALETTE
),
2197 m_paletteRealized(false)
2199 wxQueryNewPaletteEvent(const wxQueryNewPaletteEvent
& event
)
2201 m_paletteRealized(event
.m_paletteRealized
)
2204 // App sets this if it changes the palette.
2205 void SetPaletteRealized(bool realized
) { m_paletteRealized
= realized
; }
2206 bool GetPaletteRealized() const { return m_paletteRealized
; }
2208 virtual wxEvent
*Clone() const { return new wxQueryNewPaletteEvent(*this); }
2211 bool m_paletteRealized
;
2214 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxQueryNewPaletteEvent
)
2218 Event generated by dialog navigation keys
2219 wxEVT_NAVIGATION_KEY
2221 // NB: don't derive from command event to avoid being propagated to the parent
2222 class WXDLLIMPEXP_CORE wxNavigationKeyEvent
: public wxEvent
2225 wxNavigationKeyEvent()
2226 : wxEvent(0, wxEVT_NAVIGATION_KEY
),
2227 m_flags(IsForward
| FromTab
), // defaults are for TAB
2230 m_propagationLevel
= wxEVENT_PROPAGATE_NONE
;
2233 wxNavigationKeyEvent(const wxNavigationKeyEvent
& event
)
2235 m_flags(event
.m_flags
),
2236 m_focus(event
.m_focus
)
2239 // direction: forward (true) or backward (false)
2240 bool GetDirection() const
2241 { return (m_flags
& IsForward
) != 0; }
2242 void SetDirection(bool bForward
)
2243 { if ( bForward
) m_flags
|= IsForward
; else m_flags
&= ~IsForward
; }
2245 // it may be a window change event (MDI, notebook pages...) or a control
2247 bool IsWindowChange() const
2248 { return (m_flags
& WinChange
) != 0; }
2249 void SetWindowChange(bool bIs
)
2250 { if ( bIs
) m_flags
|= WinChange
; else m_flags
&= ~WinChange
; }
2252 // Set to true under MSW if the event was generated using the tab key.
2253 // This is required for proper navogation over radio buttons
2254 bool IsFromTab() const
2255 { return (m_flags
& FromTab
) != 0; }
2256 void SetFromTab(bool bIs
)
2257 { if ( bIs
) m_flags
|= FromTab
; else m_flags
&= ~FromTab
; }
2259 // the child which has the focus currently (may be NULL - use
2260 // wxWindow::FindFocus then)
2261 wxWindow
* GetCurrentFocus() const { return m_focus
; }
2262 void SetCurrentFocus(wxWindow
*win
) { m_focus
= win
; }
2265 void SetFlags(long flags
) { m_flags
= flags
; }
2267 virtual wxEvent
*Clone() const { return new wxNavigationKeyEvent(*this); }
2271 IsBackward
= 0x0000,
2281 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxNavigationKeyEvent
)
2284 // Window creation/destruction events: the first is sent as soon as window is
2285 // created (i.e. the underlying GUI object exists), but when the C++ object is
2286 // fully initialized (so virtual functions may be called). The second,
2287 // wxEVT_DESTROY, is sent right before the window is destroyed - again, it's
2288 // still safe to call virtual functions at this moment
2294 class WXDLLIMPEXP_CORE wxWindowCreateEvent
: public wxCommandEvent
2297 wxWindowCreateEvent(wxWindow
*win
= NULL
);
2299 wxWindow
*GetWindow() const { return (wxWindow
*)GetEventObject(); }
2301 virtual wxEvent
*Clone() const { return new wxWindowCreateEvent(*this); }
2304 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxWindowCreateEvent
)
2307 class WXDLLIMPEXP_CORE wxWindowDestroyEvent
: public wxCommandEvent
2310 wxWindowDestroyEvent(wxWindow
*win
= NULL
);
2312 wxWindow
*GetWindow() const { return (wxWindow
*)GetEventObject(); }
2314 virtual wxEvent
*Clone() const { return new wxWindowDestroyEvent(*this); }
2317 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxWindowDestroyEvent
)
2320 // A help event is sent when the user clicks on a window in context-help mode.
2326 class WXDLLIMPEXP_CORE wxHelpEvent
: public wxCommandEvent
2329 // how was this help event generated?
2332 Origin_Unknown
, // unrecognized event source
2333 Origin_Keyboard
, // event generated from F1 key press
2334 Origin_HelpButton
// event from [?] button on the title bar (Windows)
2337 wxHelpEvent(wxEventType type
= wxEVT_NULL
,
2338 wxWindowID winid
= 0,
2339 const wxPoint
& pt
= wxDefaultPosition
,
2340 Origin origin
= Origin_Unknown
)
2341 : wxCommandEvent(type
, winid
),
2343 m_origin(GuessOrigin(origin
))
2345 wxHelpEvent(const wxHelpEvent
& event
)
2346 : wxCommandEvent(event
),
2348 m_target(event
.m_target
),
2349 m_link(event
.m_link
),
2350 m_origin(event
.m_origin
)
2353 // Position of event (in screen coordinates)
2354 const wxPoint
& GetPosition() const { return m_pos
; }
2355 void SetPosition(const wxPoint
& pos
) { m_pos
= pos
; }
2357 // Optional link to further help
2358 const wxString
& GetLink() const { return m_link
; }
2359 void SetLink(const wxString
& link
) { m_link
= link
; }
2361 // Optional target to display help in. E.g. a window specification
2362 const wxString
& GetTarget() const { return m_target
; }
2363 void SetTarget(const wxString
& target
) { m_target
= target
; }
2365 virtual wxEvent
*Clone() const { return new wxHelpEvent(*this); }
2367 // optional indication of the event source
2368 Origin
GetOrigin() const { return m_origin
; }
2369 void SetOrigin(Origin origin
) { m_origin
= origin
; }
2377 // we can try to guess the event origin ourselves, even if none is
2378 // specified in the ctor
2379 static Origin
GuessOrigin(Origin origin
);
2382 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxHelpEvent
)
2385 // A Clipboard Text event is sent when a window intercepts text copy/cut/paste
2386 // message, i.e. the user has cut/copied/pasted data from/into a text control
2387 // via ctrl-C/X/V, ctrl/shift-del/insert, a popup menu command, etc.
2388 // NOTE : under windows these events are *NOT* generated automatically
2389 // for a Rich Edit text control.
2391 wxEVT_COMMAND_TEXT_COPY
2392 wxEVT_COMMAND_TEXT_CUT
2393 wxEVT_COMMAND_TEXT_PASTE
2396 class WXDLLIMPEXP_CORE wxClipboardTextEvent
: public wxCommandEvent
2399 wxClipboardTextEvent(wxEventType type
= wxEVT_NULL
,
2400 wxWindowID winid
= 0)
2401 : wxCommandEvent(type
, winid
)
2403 wxClipboardTextEvent(const wxClipboardTextEvent
& event
)
2404 : wxCommandEvent(event
)
2407 virtual wxEvent
*Clone() const { return new wxClipboardTextEvent(*this); }
2410 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxClipboardTextEvent
)
2413 // A Context event is sent when the user right clicks on a window or
2414 // presses Shift-F10
2415 // NOTE : Under windows this is a repackaged WM_CONTETXMENU message
2416 // Under other systems it may have to be generated from a right click event
2421 class WXDLLIMPEXP_CORE wxContextMenuEvent
: public wxCommandEvent
2424 wxContextMenuEvent(wxEventType type
= wxEVT_NULL
,
2425 wxWindowID winid
= 0,
2426 const wxPoint
& pt
= wxDefaultPosition
)
2427 : wxCommandEvent(type
, winid
),
2430 wxContextMenuEvent(const wxContextMenuEvent
& event
)
2431 : wxCommandEvent(event
),
2435 // Position of event (in screen coordinates)
2436 const wxPoint
& GetPosition() const { return m_pos
; }
2437 void SetPosition(const wxPoint
& pos
) { m_pos
= pos
; }
2439 virtual wxEvent
*Clone() const { return new wxContextMenuEvent(*this); }
2445 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxContextMenuEvent
)
2455 // Whether to always send idle events to windows, or
2456 // to only send update events to those with the
2457 // wxWS_EX_PROCESS_IDLE style.
2461 // Send idle events to all windows
2464 // Send idle events to windows that have
2465 // the wxWS_EX_PROCESS_IDLE flag specified
2466 wxIDLE_PROCESS_SPECIFIED
2469 class WXDLLIMPEXP_BASE wxIdleEvent
: public wxEvent
2473 : wxEvent(0, wxEVT_IDLE
),
2474 m_requestMore(false)
2476 wxIdleEvent(const wxIdleEvent
& event
)
2478 m_requestMore(event
.m_requestMore
)
2481 void RequestMore(bool needMore
= true) { m_requestMore
= needMore
; }
2482 bool MoreRequested() const { return m_requestMore
; }
2484 virtual wxEvent
*Clone() const { return new wxIdleEvent(*this); }
2486 // Specify how wxWidgets will send idle events: to
2487 // all windows, or only to those which specify that they
2488 // will process the events.
2489 static void SetMode(wxIdleMode mode
) { sm_idleMode
= mode
; }
2491 // Returns the idle event mode
2492 static wxIdleMode
GetMode() { return sm_idleMode
; }
2496 static wxIdleMode sm_idleMode
;
2499 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxIdleEvent
)
2503 wxEVT_MOUSE_CAPTURE_CHANGED,
2504 wxEVT_SETTING_CHANGED, // WM_WININICHANGE (NT) / WM_SETTINGCHANGE (Win95)
2505 // wxEVT_FONT_CHANGED, // WM_FONTCHANGE: roll into wxEVT_SETTING_CHANGED, but remember to propagate
2506 // wxEVT_FONT_CHANGED to all other windows (maybe).
2507 wxEVT_DRAW_ITEM, // Leave these three as virtual functions in wxControl?? Platform-specific.
2513 // ============================================================================
2514 // event handler and related classes
2515 // ============================================================================
2518 // struct containing the members common to static and dynamic event tables
2520 struct WXDLLIMPEXP_BASE wxEventTableEntryBase
2522 wxEventTableEntryBase(int winid
, int idLast
,
2523 wxEventFunctor
* fn
, wxObject
*data
)
2527 m_callbackUserData(data
)
2530 wxEventTableEntryBase( const wxEventTableEntryBase
&entry
)
2531 : m_id( entry
.m_id
),
2532 m_lastId( entry
.m_lastId
),
2534 m_callbackUserData( entry
.m_callbackUserData
)
2536 // This is a 'hack' to ensure that only one instance tries to delete
2537 // the functor pointer. It is safe as long as the only place where the
2538 // copy constructor is being called is when the static event tables are
2539 // being initialized (a temporary instance is created and then this
2540 // constructor is called).
2542 const_cast< wxEventTableEntryBase
& >( entry
).m_fn
= NULL
;
2545 ~wxEventTableEntryBase()
2550 // the range of ids for this entry: if m_lastId == wxID_ANY, the range
2551 // consists only of m_id, otherwise it is m_id..m_lastId inclusive
2555 // function/method/functor to call
2556 wxEventFunctor
* m_fn
;
2558 // arbitrary user data associated with the callback
2559 wxObject
* m_callbackUserData
;
2562 wxEventTableEntryBase
&operator = ( const wxEventTableEntryBase
& );
2565 // an entry from a static event table
2566 struct WXDLLIMPEXP_BASE wxEventTableEntry
: public wxEventTableEntryBase
2568 wxEventTableEntry(const int& evType
, int winid
, int idLast
,
2569 wxEventFunctor
* fn
, wxObject
*data
)
2570 : wxEventTableEntryBase(winid
, idLast
, fn
, data
),
2574 // the reference to event type: this allows us to not care about the
2575 // (undefined) order in which the event table entries and the event types
2576 // are initialized: initially the value of this reference might be
2577 // invalid, but by the time it is used for the first time, all global
2578 // objects will have been initialized (including the event type constants)
2579 // and so it will have the correct value when it is needed
2580 const int& m_eventType
;
2583 wxEventTableEntry
&operator = ( const wxEventTableEntry
& );
2586 // an entry used in dynamic event table managed by wxEvtHandler::Connect()
2587 struct WXDLLIMPEXP_BASE wxDynamicEventTableEntry
: public wxEventTableEntryBase
2589 wxDynamicEventTableEntry(int evType
, int winid
, int idLast
,
2590 wxEventFunctor
* fn
, wxObject
*data
)
2591 : wxEventTableEntryBase(winid
, idLast
, fn
, data
),
2595 // not a reference here as we can't keep a reference to a temporary int
2596 // created to wrap the constant value typically passed to Connect() - nor
2601 wxDynamicEventTableEntry
&operator = ( const wxDynamicEventTableEntry
& );
2604 // ----------------------------------------------------------------------------
2605 // wxEventTable: an array of event entries terminated with {0, 0, 0, 0, 0}
2606 // ----------------------------------------------------------------------------
2608 struct WXDLLIMPEXP_BASE wxEventTable
2610 const wxEventTable
*baseTable
; // base event table (next in chain)
2611 const wxEventTableEntry
*entries
; // bottom of entry array
2614 // ----------------------------------------------------------------------------
2615 // wxEventHashTable: a helper of wxEvtHandler to speed up wxEventTable lookups.
2616 // ----------------------------------------------------------------------------
2618 WX_DEFINE_ARRAY_PTR(const wxEventTableEntry
*, wxEventTableEntryPointerArray
);
2620 class WXDLLIMPEXP_BASE wxEventHashTable
2623 // Internal data structs
2624 struct EventTypeTable
2626 wxEventType eventType
;
2627 wxEventTableEntryPointerArray eventEntryTable
;
2629 typedef EventTypeTable
* EventTypeTablePointer
;
2632 // Constructor, needs the event table it needs to hash later on.
2633 // Note: hashing of the event table is not done in the constructor as it
2634 // can be that the event table is not yet full initialize, the hash
2635 // will gets initialized when handling the first event look-up request.
2636 wxEventHashTable(const wxEventTable
&table
);
2638 ~wxEventHashTable();
2640 // Handle the given event, in other words search the event table hash
2641 // and call self->ProcessEvent() if a match was found.
2642 bool HandleEvent(wxEvent
&event
, wxEvtHandler
*self
);
2647 #if defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING
2649 static void ClearAll();
2650 #endif // __WXDEBUG__ && wxUSE_MEMORY_TRACING
2653 // Init the hash table with the entries of the static event table.
2654 void InitHashTable();
2655 // Helper funtion of InitHashTable() to insert 1 entry into the hash table.
2656 void AddEntry(const wxEventTableEntry
&entry
);
2657 // Allocate and init with null pointers the base hash table.
2658 void AllocEventTypeTable(size_t size
);
2659 // Grow the hash table in size and transfer all items currently
2660 // in the table to the correct location in the new table.
2661 void GrowEventTypeTable();
2664 const wxEventTable
&m_table
;
2668 EventTypeTablePointer
*m_eventTypeTable
;
2670 static wxEventHashTable
* sm_first
;
2671 wxEventHashTable
* m_previous
;
2672 wxEventHashTable
* m_next
;
2674 DECLARE_NO_COPY_CLASS(wxEventHashTable
)
2677 // ----------------------------------------------------------------------------
2678 // wxEvtHandler: the base class for all objects handling wxWidgets events
2679 // ----------------------------------------------------------------------------
2681 class WXDLLIMPEXP_BASE wxEvtHandler
: public wxObject
2682 , public wxTrackable
2686 virtual ~wxEvtHandler();
2689 // Event handler chain
2690 // -------------------
2692 wxEvtHandler
*GetNextHandler() const { return m_nextHandler
; }
2693 wxEvtHandler
*GetPreviousHandler() const { return m_previousHandler
; }
2694 virtual void SetNextHandler(wxEvtHandler
*handler
) { m_nextHandler
= handler
; }
2695 virtual void SetPreviousHandler(wxEvtHandler
*handler
) { m_previousHandler
= handler
; }
2697 void SetEvtHandlerEnabled(bool enabled
) { m_enabled
= enabled
; }
2698 bool GetEvtHandlerEnabled() const { return m_enabled
; }
2701 bool IsUnlinked() const;
2705 // Event queuing and processing
2706 // ----------------------------
2709 // Process an event right now: this can only be called from the main
2710 // thread, use QueueEvent() for scheduling the events for
2711 // processing from other threads.
2712 virtual bool ProcessEvent(wxEvent
& event
);
2714 // Process an event by calling ProcessEvent and handling any exceptions
2715 // thrown by event handlers. It's mostly useful when processing wx events
2716 // when called from C code (e.g. in GTK+ callback) when the exception
2717 // wouldn't correctly propagate to wxEventLoop.
2718 bool SafelyProcessEvent(wxEvent
& event
);
2719 // NOTE: uses ProcessEvent()
2721 // Schedule the given event to be processed later. It takes ownership of
2722 // the event pointer, i.e. it will be deleted later. This is safe to call
2723 // from multiple threads although you still need to ensure that wxString
2724 // fields of the event object are deep copies and not use the same string
2725 // buffer as other wxString objects in this thread.
2726 virtual void QueueEvent(wxEvent
*event
);
2728 // Add an event to be processed later: notice that this function is not
2729 // safe to call from threads other than main, use QueueEvent()
2730 virtual void AddPendingEvent(const wxEvent
& event
)
2732 // notice that the thread-safety problem comes from the fact that
2733 // Clone() doesn't make deep copies of wxString fields of wxEvent
2734 // object and so the same wxString could be used from both threads when
2735 // the event object is destroyed in this one -- QueueEvent() avoids
2736 // this problem as the event pointer is not used any more in this
2737 // thread at all after it is called.
2738 QueueEvent(event
.Clone());
2741 void ProcessPendingEvents();
2742 // NOTE: uses ProcessEvent()
2745 bool ProcessThreadEvent(const wxEvent
& event
);
2746 // NOTE: uses AddPendingEvent()
2750 // Connecting and disconnecting
2751 // ----------------------------
2753 // Dynamic association of a member function handler with the event handler,
2754 // winid and event type
2755 void Connect(int winid
,
2757 wxEventType eventType
,
2758 wxObjectEventFunction func
,
2759 wxObject
*userData
= NULL
,
2760 wxEvtHandler
*eventSink
= NULL
)
2762 wxObjectEventFunctor
*functor
= wxNewEventFunctor( eventType
, func
, eventSink
);
2764 Subscribe( winid
, lastId
, eventType
, functor
, userData
);
2767 // Convenience function: take just one id
2768 void Connect(int winid
,
2769 wxEventType eventType
,
2770 wxObjectEventFunction func
,
2771 wxObject
*userData
= NULL
,
2772 wxEvtHandler
*eventSink
= NULL
)
2773 { Connect(winid
, wxID_ANY
, eventType
, func
, userData
, eventSink
); }
2775 // Even more convenient: without id (same as using id of wxID_ANY)
2776 void Connect(wxEventType eventType
,
2777 wxObjectEventFunction func
,
2778 wxObject
*userData
= NULL
,
2779 wxEvtHandler
*eventSink
= NULL
)
2780 { Connect(wxID_ANY
, wxID_ANY
, eventType
, func
, userData
, eventSink
); }
2782 bool Disconnect(int winid
,
2784 wxEventType eventType
,
2785 wxObjectEventFunction func
= NULL
,
2786 wxObject
*userData
= NULL
,
2787 wxEvtHandler
*eventSink
= NULL
)
2789 wxObjectEventFunctor functor
= wxConstructEventFunctor( eventType
, func
, eventSink
);
2791 return Unsubscribe( winid
, lastId
, eventType
, functor
, userData
);
2794 bool Disconnect(int winid
= wxID_ANY
,
2795 wxEventType eventType
= wxEVT_NULL
,
2796 wxObjectEventFunction func
= NULL
,
2797 wxObject
*userData
= NULL
,
2798 wxEvtHandler
*eventSink
= NULL
)
2799 { return Disconnect(winid
, wxID_ANY
, eventType
, func
, userData
, eventSink
); }
2801 bool Disconnect(wxEventType eventType
,
2802 wxObjectEventFunction func
,
2803 wxObject
*userData
= NULL
,
2804 wxEvtHandler
*eventSink
= NULL
)
2805 { return Disconnect(wxID_ANY
, eventType
, func
, userData
, eventSink
); }
2806 #if !wxEVENTS_COMPATIBILITY_2_8
2808 // Connect a method to an event:
2811 template <typename EventType
, typename Class
>
2812 void Connect( int winid
,
2814 const EventType
&eventType
,
2815 void ( Class::*func
)( typename
EventType::CorrespondingEvent
& ),
2816 wxObject
*userData
= NULL
)
2818 wxEventFunctorMethod
< EventType
, Class
, Class
> *functor
=
2819 wxNewEventFunctor( eventType
, func
, static_cast< Class
* const >( this ));
2821 Subscribe( winid
, lastId
, eventType
, functor
, userData
);
2824 template <typename EventType
, typename Class
>
2825 void Connect( int winid
,
2826 const EventType
&eventType
,
2827 void ( Class::*func
)( typename
EventType::CorrespondingEvent
& ),
2828 wxObject
*userData
= NULL
)
2829 { Connect( winid
, wxID_ANY
, eventType
, func
, userData
); }
2831 template <typename EventType
, typename Class
>
2832 void Connect( const EventType
&eventType
,
2833 void ( Class::*func
)( typename
EventType::CorrespondingEvent
& ),
2834 wxObject
*userData
= NULL
)
2835 { Connect( wxID_ANY
, wxID_ANY
, eventType
, func
, userData
); }
2837 template <typename EventType
, typename Class
, typename Derived
>
2838 void Connect( int winid
,
2840 const EventType
&eventType
,
2841 void ( Class::*func
)( typename
EventType::CorrespondingEvent
& ),
2842 wxObject
*userData
= NULL
,
2843 Derived
*eventSink
= NULL
)
2845 wxEventFunctorMethod
< EventType
, Class
, Derived
> *functor
=
2846 wxNewEventFunctor( eventType
, func
, eventSink
);
2848 Subscribe( winid
, lastId
, eventType
, functor
, userData
);
2851 template <typename EventType
, typename Class
, typename Derived
>
2852 void Connect( int winid
,
2853 const EventType
&eventType
,
2854 void ( Class::*func
)( typename
EventType::CorrespondingEvent
& ),
2855 wxObject
*userData
= NULL
,
2856 Derived
*eventSink
= NULL
)
2857 { Connect( winid
, wxID_ANY
, eventType
, func
, userData
, eventSink
); }
2859 template <typename EventType
, typename Class
, typename Derived
>
2860 void Connect( const EventType
&eventType
,
2861 void ( Class::*func
)( typename
EventType::CorrespondingEvent
& ),
2862 wxObject
*userData
= NULL
,
2863 Derived
*eventSink
= NULL
)
2864 { Connect( wxID_ANY
, wxID_ANY
, eventType
, func
, userData
, eventSink
); }
2866 template <typename Sender
, typename EventType
, typename Class
, typename Derived
>
2867 static void Connect( Sender
*sender
,
2870 const EventType
&eventType
,
2871 void ( Class::*func
)( typename
EventType::CorrespondingEvent
& ),
2872 wxObject
*userData
= NULL
,
2873 Derived
*eventSink
= NULL
)
2875 wxEventFunctorMethod
< EventType
, Class
, Derived
> *functor
=
2876 wxNewEventFunctor( eventType
, func
, eventSink
);
2878 sender
->Subscribe( winid
, lastId
, eventType
, functor
, userData
);
2881 template <typename Sender
, typename EventType
, typename Class
, typename Derived
>
2882 static void Connect( Sender
*sender
,
2884 const EventType
&eventType
,
2885 void ( Class::*func
)( typename
EventType::CorrespondingEvent
& ),
2886 wxObject
*userData
= NULL
,
2887 Derived
*eventSink
= NULL
)
2888 { Connect( sender
, winid
, wxID_ANY
, eventType
, func
, userData
, eventSink
); }
2890 template <typename Sender
, typename EventType
, typename Class
, typename Derived
>
2891 static void Connect( Sender
*sender
,
2892 const EventType
&eventType
,
2893 void ( Class::*func
)( typename
EventType::CorrespondingEvent
& ),
2894 wxObject
*userData
= NULL
,
2895 Derived
*eventSink
= NULL
)
2896 { Connect( sender
, wxID_ANY
, wxID_ANY
, eventType
, func
, userData
, eventSink
); }
2899 // Connect a function to an event:
2901 template <typename EventType
>
2902 void Connect(int winid
,
2904 const EventType
&eventType
,
2905 void (*func
)(typename
EventType::CorrespondingEvent
&),
2906 wxObject
* userData
= NULL
)
2908 wxEventFunctorFunction
< EventType
> *functor
= wxNewEventFunctor( eventType
, func
);
2910 Subscribe( winid
, lastId
, eventType
, functor
, userData
);
2913 template <typename EventType
>
2914 void Connect( int winid
,
2915 const EventType
&eventType
,
2916 void ( *func
)( typename
EventType::CorrespondingEvent
& ),
2917 wxObject
* userData
= NULL
)
2918 { Connect( winid
, wxID_ANY
, eventType
, func
, userData
); }
2920 template <typename EventType
>
2921 void Connect( const EventType
&eventType
,
2922 void ( *func
)( typename
EventType::CorrespondingEvent
& ),
2923 wxObject
* userData
= NULL
)
2924 { Connect( wxID_ANY
, wxID_ANY
, eventType
, func
, userData
); }
2927 // Connect an arbitrary functor to an event:
2930 template <typename EventType
, typename Functor
>
2931 void Connect( int winid
,
2933 const EventType
&eventType
,
2935 wxObject
* userData
= NULL
)
2937 wxEventFunctorAdapter
< EventType
, Functor
> *adapter
=
2938 wxNewEventFunctor( eventType
, functor
);
2940 Subscribe( winid
, lastId
, eventType
, adapter
, userData
);
2942 template <typename EventType
, typename Functor
>
2943 void Connect( int winid
,
2944 const EventType
&eventType
,
2946 wxObject
* userData
= NULL
)
2947 { Connect( winid
, wxID_ANY
, eventType
, functor
, userData
); }
2949 template <typename EventType
, typename Functor
>
2950 void Connect( const EventType
&eventType
,
2952 wxObject
* userData
= NULL
)
2953 { Connect( wxID_ANY
, wxID_ANY
, eventType
, functor
, userData
); }
2956 // Disconnect a function from an event:
2959 template <typename EventType
>
2960 bool Disconnect( int winid
,
2962 const EventType
&eventType
,
2963 void ( *func
)( typename
EventType::CorrespondingEvent
& ),
2964 wxObject
* userData
= NULL
)
2966 wxEventFunctorFunction
< EventType
> functor
= wxConstructEventFunctor( eventType
, func
);
2968 return Unsubscribe( winid
, lastId
, eventType
, functor
, userData
);
2971 template <typename EventType
>
2972 bool Disconnect( int winid
,
2973 const EventType
&eventType
,
2974 void ( *func
)( typename
EventType::CorrespondingEvent
& ),
2975 wxObject
* userData
= NULL
)
2976 { return Disconnect( winid
, wxID_ANY
, eventType
, func
, userData
); }
2978 template <typename EventType
>
2979 bool Disconnect( const EventType
&eventType
,
2980 void ( *func
)( typename
EventType::CorrespondingEvent
& ),
2981 wxObject
* userData
= NULL
)
2982 { return Disconnect( wxID_ANY
, wxID_ANY
, eventType
, func
, userData
); }
2985 // Disconnect a method from an event:
2988 template <typename EventType
, typename Class
>
2989 bool Disconnect( int winid
,
2991 const EventType
&eventType
,
2992 void ( Class::*func
)( typename
EventType::CorrespondingEvent
& ),
2993 wxObject
*userData
= NULL
)
2995 wxEventFunctorMethod
< EventType
, Class
, Class
> functor
=
2996 wxConstructEventFunctor( eventType
, func
, static_cast< Class
* const >( this ));
2998 return Unsubscribe( winid
, lastId
, eventType
, functor
, userData
);
3001 template <typename EventType
, typename Class
>
3002 bool Disconnect( int winid
,
3003 const EventType
&eventType
,
3004 void ( Class::*func
)( typename
EventType::CorrespondingEvent
& ),
3005 wxObject
*userData
= NULL
)
3006 { return Disconnect( winid
, wxID_ANY
, eventType
, func
, userData
); }
3008 template <typename EventType
, typename Class
>
3009 bool Disconnect( const EventType
&eventType
,
3010 void ( Class::*func
)( typename
EventType::CorrespondingEvent
& ),
3011 wxObject
*userData
= NULL
)
3012 { return Disconnect( wxID_ANY
, wxID_ANY
, eventType
, func
, userData
); }
3014 template <typename EventType
, typename Class
, typename Derived
>
3015 bool Disconnect( int winid
,
3017 const EventType
&eventType
,
3018 void ( Class::*func
)( typename
EventType::CorrespondingEvent
& ),
3019 wxObject
*userData
= NULL
,
3020 Derived
*eventSink
= NULL
)
3022 wxEventFunctorMethod
< EventType
, Class
, Derived
> functor
=
3023 wxConstructEventFunctor( eventType
, func
, eventSink
);
3025 return Unsubscribe( winid
, lastId
, eventType
, functor
, userData
);
3028 template <typename EventType
, typename Class
, typename Derived
>
3029 bool Disconnect( int winid
,
3030 const EventType
&eventType
,
3031 void ( Class::*func
)( typename
EventType::CorrespondingEvent
& ),
3032 wxObject
*userData
= NULL
,
3033 Derived
*eventSink
= NULL
)
3034 { return Disconnect( winid
, wxID_ANY
, eventType
, func
, userData
, eventSink
); }
3036 template <typename EventType
, typename Class
, typename Derived
>
3037 bool Disconnect( const EventType
&eventType
,
3038 void ( Class::*func
)( typename
EventType::CorrespondingEvent
& ),
3039 wxObject
*userData
= NULL
,
3040 Derived
*eventSink
= NULL
)
3041 { return Disconnect( wxID_ANY
, wxID_ANY
, eventType
, func
, userData
, eventSink
); }
3043 template <typename Sender
, typename EventType
, typename Class
, typename Derived
>
3044 static bool Disconnect( Sender
*sender
,
3047 const EventType
&eventType
,
3048 void ( Class::*func
)( typename
EventType::CorrespondingEvent
& ),
3049 wxObject
*userData
= NULL
,
3050 Derived
*eventSink
= NULL
)
3052 wxEventFunctorMethod
< EventType
, Class
, Derived
> functor
=
3053 wxConstructEventFunctor( eventType
, func
, eventSink
);
3055 return sender
->Unsubscribe( winid
, lastId
, eventType
, functor
, userData
);
3058 template <typename Sender
, typename EventType
, typename Class
, typename Derived
>
3059 static bool Disconnect( Sender
*sender
,
3061 const EventType
&eventType
,
3062 void ( Class::*func
)( typename
EventType::CorrespondingEvent
& ),
3063 wxObject
*userData
= NULL
,
3064 Derived
*eventSink
= NULL
)
3065 { return Disconnect( sender
, winid
, wxID_ANY
, eventType
, func
, userData
, eventSink
); }
3067 template <typename Sender
, typename EventType
, typename Class
, typename Derived
>
3068 static bool Disconnect( Sender
*sender
,
3069 const EventType
&eventType
,
3070 void ( Class::*func
)( typename
EventType::CorrespondingEvent
& ),
3071 wxObject
*userData
= NULL
,
3072 Derived
*eventSink
= NULL
)
3073 { return Disconnect( sender
, wxID_ANY
, wxID_ANY
, eventType
, func
, userData
, eventSink
); }
3076 // Disconnect an arbitrary functor from an event:
3079 template <typename EventType
, typename Functor
>
3080 bool Disconnect( int winid
,
3082 const EventType
&eventType
,
3084 wxObject
* userData
= NULL
)
3086 wxEventFunctorAdapter
< EventType
, Functor
> adapter
=
3087 wxConstructEventFunctor( eventType
, functor
);
3089 return Unsubscribe( winid
, lastId
, eventType
, adapter
, userData
);
3092 template <typename EventType
, typename Functor
>
3093 bool Disconnect( int winid
,
3094 const EventType
&eventType
,
3096 wxObject
* userData
= NULL
)
3097 { return Disconnect( winid
, wxID_ANY
, eventType
, functor
, userData
); }
3099 template <typename EventType
, typename Functor
>
3100 bool Disconnect( const EventType
&eventType
,
3102 wxObject
* userData
= NULL
)
3103 { return Disconnect( wxID_ANY
, wxID_ANY
, eventType
, functor
, userData
); }
3105 #endif // !wxEVENTS_COMPATIBILITY_2_8
3108 wxList
* GetDynamicEventTable() const { return m_dynamicEvents
; }
3110 // User data can be associated with each wxEvtHandler
3111 void SetClientObject( wxClientData
*data
) { DoSetClientObject(data
); }
3112 wxClientData
*GetClientObject() const { return DoGetClientObject(); }
3114 void SetClientData( void *data
) { DoSetClientData(data
); }
3115 void *GetClientData() const { return DoGetClientData(); }
3118 // implementation from now on
3119 // --------------------------
3121 // check if the given event table entry matches this event by id (the check
3122 // for the event type should be done by caller) and call the handler if it
3125 // return true if the event was processed, false otherwise (no match or the
3126 // handler decided to skip the event)
3127 static bool ProcessEventIfMatchesId(const wxEventTableEntryBase
& tableEntry
,
3128 wxEvtHandler
*handler
,
3131 virtual bool SearchEventTable(wxEventTable
& table
, wxEvent
& event
);
3132 bool SearchDynamicEventTable( wxEvent
& event
);
3134 // Avoid problems at exit by cleaning up static hash table gracefully
3135 void ClearEventHashTable() { GetEventHashTable().Clear(); }
3136 void OnSinkDestroyed( wxEvtHandler
*sink
);
3139 // The method tries to process the event in this event handler.
3141 // It is meant to be called from ProcessEvent() only and is not virtual,
3142 // additional event handlers can be hooked into the normal event processing
3143 // logic using TryValidator() hook.
3144 bool ProcessEventHere(wxEvent
& event
);
3148 void Subscribe(int winid
,
3150 wxEventType eventType
,
3151 wxEventFunctor
*func
,
3152 wxObject
* userData
);
3154 bool Unsubscribe(int winid
,
3156 wxEventType eventType
,
3157 const wxEventFunctor
&func
,
3158 wxObject
*userData
);
3160 static const wxEventTableEntry sm_eventTableEntries
[];
3163 // hooks for wxWindow used by ProcessEvent()
3164 // -----------------------------------------
3166 // This one is called before trying our own event table to allow plugging
3167 // in the validators.
3169 // NB: This method is intentionally *not* inside wxUSE_VALIDATORS!
3170 // It is part of wxBase which doesn't use validators and the code
3171 // is compiled out when building wxBase w/o GUI classes, which affects
3172 // binary compatibility and wxBase library can't be used by GUI
3174 virtual bool TryValidator(wxEvent
& WXUNUSED(event
)) { return false; }
3176 // this one is called after failing to find the event handle in our own
3177 // table to give a chance to the other windows to process it
3179 // base class implementation passes the event to wxTheApp
3180 virtual bool TryParent(wxEvent
& event
);
3183 static const wxEventTable sm_eventTable
;
3184 virtual const wxEventTable
*GetEventTable() const;
3186 static wxEventHashTable sm_eventHashTable
;
3187 virtual wxEventHashTable
& GetEventHashTable() const;
3189 wxEvtHandler
* m_nextHandler
;
3190 wxEvtHandler
* m_previousHandler
;
3191 wxList
* m_dynamicEvents
;
3192 wxList
* m_pendingEvents
;
3195 // critical section protecting m_pendingEvents
3196 wxCriticalSection m_pendingEventsLock
;
3197 #endif // wxUSE_THREADS
3199 // Is event handler enabled?
3203 // The user data: either an object which will be deleted by the container
3204 // when it's deleted or some raw pointer which we do nothing with - only
3205 // one type of data can be used with the given window (i.e. you cannot set
3206 // the void data and then associate the container with wxClientData or vice
3210 wxClientData
*m_clientObject
;
3214 // what kind of data do we have?
3215 wxClientDataType m_clientDataType
;
3217 // client data accessors
3218 virtual void DoSetClientObject( wxClientData
*data
);
3219 virtual wxClientData
*DoGetClientObject() const;
3221 virtual void DoSetClientData( void *data
);
3222 virtual void *DoGetClientData() const;
3224 // Search tracker objects for event connection with this sink
3225 wxEventConnectionRef
*FindRefInTrackerList(wxEvtHandler
*eventSink
);
3228 DECLARE_DYNAMIC_CLASS_NO_COPY(wxEvtHandler
)
3231 // ----------------------------------------------------------------------------
3232 // wxEventConnectionRef represents all connections between two event handlers
3233 // and enables automatic disconnect when an event handler sink goes out of
3234 // scope. Each connection/disconnect increases/decreases ref count, and
3235 // when it reaches zero the node goes out of scope.
3236 // ----------------------------------------------------------------------------
3238 class wxEventConnectionRef
: public wxTrackerNode
3241 wxEventConnectionRef() : m_src(NULL
), m_sink(NULL
), m_refCount(0) { }
3242 wxEventConnectionRef(wxEvtHandler
*src
, wxEvtHandler
*sink
)
3243 : m_src(src
), m_sink(sink
), m_refCount(1)
3245 m_sink
->AddNode(this);
3248 // The sink is being destroyed
3249 virtual void OnObjectDestroy( )
3252 m_src
->OnSinkDestroyed( m_sink
);
3256 virtual wxEventConnectionRef
*ToEventConnection() { return this; }
3258 void IncRef() { m_refCount
++; }
3261 if ( !--m_refCount
)
3263 // The sink holds the only external pointer to this object
3265 m_sink
->RemoveNode(this);
3271 wxEvtHandler
*m_src
,
3275 friend class wxEvtHandler
;
3277 DECLARE_NO_ASSIGN_CLASS(wxEventConnectionRef
)
3280 // Post a message to the given event handler which will be processed during the
3281 // next event loop iteration.
3283 // Notice that this one is not thread-safe, use wxQueueEvent()
3284 inline void wxPostEvent(wxEvtHandler
*dest
, const wxEvent
& event
)
3286 wxCHECK_RET( dest
, "need an object to post event to" );
3288 dest
->AddPendingEvent(event
);
3291 // Wrapper around wxEvtHandler::QueueEvent(): adds an event for later
3292 // processing, unlike wxPostEvent it is safe to use from different thread even
3293 // for events with wxString members
3294 inline void wxQueueEvent(wxEvtHandler
*dest
, wxEvent
*event
)
3296 wxCHECK_RET( dest
, "need an object to queue event for" );
3298 dest
->QueueEvent(event
);
3301 typedef void (wxEvtHandler::*wxEventFunction
)(wxEvent
&);
3302 typedef void (wxEvtHandler::*wxIdleEventFunction
)(wxIdleEvent
&);
3304 #define wxEventHandler(func) \
3305 wxEVENT_HANDLER_CAST(wxEventFunction, func)
3306 #define wxIdleEventHandler(func) \
3307 wxEVENT_HANDLER_CAST(wxIdleEventFunction, func)
3311 // ----------------------------------------------------------------------------
3312 // wxEventBlocker: helper class to temporarily disable event handling for a window
3313 // ----------------------------------------------------------------------------
3315 class WXDLLIMPEXP_CORE wxEventBlocker
: public wxEvtHandler
3318 wxEventBlocker(wxWindow
*win
, wxEventType type
= wxEVT_ANY
);
3319 virtual ~wxEventBlocker();
3321 void Block(wxEventType type
)
3323 m_eventsToBlock
.push_back(type
);
3326 virtual bool ProcessEvent(wxEvent
& event
);
3329 wxArrayInt m_eventsToBlock
;
3332 DECLARE_NO_COPY_CLASS(wxEventBlocker
)
3335 typedef void (wxEvtHandler::*wxCommandEventFunction
)(wxCommandEvent
&);
3336 typedef void (wxEvtHandler::*wxScrollEventFunction
)(wxScrollEvent
&);
3337 typedef void (wxEvtHandler::*wxScrollWinEventFunction
)(wxScrollWinEvent
&);
3338 typedef void (wxEvtHandler::*wxSizeEventFunction
)(wxSizeEvent
&);
3339 typedef void (wxEvtHandler::*wxMoveEventFunction
)(wxMoveEvent
&);
3340 typedef void (wxEvtHandler::*wxPaintEventFunction
)(wxPaintEvent
&);
3341 typedef void (wxEvtHandler::*wxNcPaintEventFunction
)(wxNcPaintEvent
&);
3342 typedef void (wxEvtHandler::*wxEraseEventFunction
)(wxEraseEvent
&);
3343 typedef void (wxEvtHandler::*wxMouseEventFunction
)(wxMouseEvent
&);
3344 typedef void (wxEvtHandler::*wxCharEventFunction
)(wxKeyEvent
&);
3345 typedef void (wxEvtHandler::*wxFocusEventFunction
)(wxFocusEvent
&);
3346 typedef void (wxEvtHandler::*wxChildFocusEventFunction
)(wxChildFocusEvent
&);
3347 typedef void (wxEvtHandler::*wxActivateEventFunction
)(wxActivateEvent
&);
3348 typedef void (wxEvtHandler::*wxMenuEventFunction
)(wxMenuEvent
&);
3349 typedef void (wxEvtHandler::*wxJoystickEventFunction
)(wxJoystickEvent
&);
3350 typedef void (wxEvtHandler::*wxDropFilesEventFunction
)(wxDropFilesEvent
&);
3351 typedef void (wxEvtHandler::*wxInitDialogEventFunction
)(wxInitDialogEvent
&);
3352 typedef void (wxEvtHandler::*wxSysColourChangedEventFunction
)(wxSysColourChangedEvent
&);
3353 typedef void (wxEvtHandler::*wxDisplayChangedEventFunction
)(wxDisplayChangedEvent
&);
3354 typedef void (wxEvtHandler::*wxUpdateUIEventFunction
)(wxUpdateUIEvent
&);
3355 typedef void (wxEvtHandler::*wxCloseEventFunction
)(wxCloseEvent
&);
3356 typedef void (wxEvtHandler::*wxShowEventFunction
)(wxShowEvent
&);
3357 typedef void (wxEvtHandler::*wxIconizeEventFunction
)(wxIconizeEvent
&);
3358 typedef void (wxEvtHandler::*wxMaximizeEventFunction
)(wxMaximizeEvent
&);
3359 typedef void (wxEvtHandler::*wxNavigationKeyEventFunction
)(wxNavigationKeyEvent
&);
3360 typedef void (wxEvtHandler::*wxPaletteChangedEventFunction
)(wxPaletteChangedEvent
&);
3361 typedef void (wxEvtHandler::*wxQueryNewPaletteEventFunction
)(wxQueryNewPaletteEvent
&);
3362 typedef void (wxEvtHandler::*wxWindowCreateEventFunction
)(wxWindowCreateEvent
&);
3363 typedef void (wxEvtHandler::*wxWindowDestroyEventFunction
)(wxWindowDestroyEvent
&);
3364 typedef void (wxEvtHandler::*wxSetCursorEventFunction
)(wxSetCursorEvent
&);
3365 typedef void (wxEvtHandler::*wxNotifyEventFunction
)(wxNotifyEvent
&);
3366 typedef void (wxEvtHandler::*wxHelpEventFunction
)(wxHelpEvent
&);
3367 typedef void (wxEvtHandler::*wxContextMenuEventFunction
)(wxContextMenuEvent
&);
3368 typedef void (wxEvtHandler::*wxMouseCaptureChangedEventFunction
)(wxMouseCaptureChangedEvent
&);
3369 typedef void (wxEvtHandler::*wxMouseCaptureLostEventFunction
)(wxMouseCaptureLostEvent
&);
3370 typedef void (wxEvtHandler::*wxClipboardTextEventFunction
)(wxClipboardTextEvent
&);
3373 #define wxCommandEventHandler(func) \
3374 wxEVENT_HANDLER_CAST(wxCommandEventFunction, func)
3375 #define wxScrollEventHandler(func) \
3376 wxEVENT_HANDLER_CAST(wxScrollEventFunction, func)
3377 #define wxScrollWinEventHandler(func) \
3378 wxEVENT_HANDLER_CAST(wxScrollWinEventFunction, func)
3379 #define wxSizeEventHandler(func) \
3380 wxEVENT_HANDLER_CAST(wxSizeEventFunction, func)
3381 #define wxMoveEventHandler(func) \
3382 wxEVENT_HANDLER_CAST(wxMoveEventFunction, func)
3383 #define wxPaintEventHandler(func) \
3384 wxEVENT_HANDLER_CAST(wxPaintEventFunction, func)
3385 #define wxNcPaintEventHandler(func) \
3386 wxEVENT_HANDLER_CAST(wxNcPaintEventFunction, func)
3387 #define wxEraseEventHandler(func) \
3388 wxEVENT_HANDLER_CAST(wxEraseEventFunction, func)
3389 #define wxMouseEventHandler(func) \
3390 wxEVENT_HANDLER_CAST(wxMouseEventFunction, func)
3391 #define wxCharEventHandler(func) \
3392 wxEVENT_HANDLER_CAST(wxCharEventFunction, func)
3393 #define wxKeyEventHandler(func) wxCharEventHandler(func)
3394 #define wxFocusEventHandler(func) \
3395 wxEVENT_HANDLER_CAST(wxFocusEventFunction, func)
3396 #define wxChildFocusEventHandler(func) \
3397 wxEVENT_HANDLER_CAST(wxChildFocusEventFunction, func)
3398 #define wxActivateEventHandler(func) \
3399 wxEVENT_HANDLER_CAST(wxActivateEventFunction, func)
3400 #define wxMenuEventHandler(func) \
3401 wxEVENT_HANDLER_CAST(wxMenuEventFunction, func)
3402 #define wxJoystickEventHandler(func) \
3403 wxEVENT_HANDLER_CAST(wxJoystickEventFunction, func)
3404 #define wxDropFilesEventHandler(func) \
3405 wxEVENT_HANDLER_CAST(wxDropFilesEventFunction, func)
3406 #define wxInitDialogEventHandler(func) \
3407 wxEVENT_HANDLER_CAST(wxInitDialogEventFunction, func)
3408 #define wxSysColourChangedEventHandler(func) \
3409 wxEVENT_HANDLER_CAST(wxSysColourChangedEventFunction, func)
3410 #define wxDisplayChangedEventHandler(func) \
3411 wxEVENT_HANDLER_CAST(wxDisplayChangedEventFunction, func)
3412 #define wxUpdateUIEventHandler(func) \
3413 wxEVENT_HANDLER_CAST(wxUpdateUIEventFunction, func)
3414 #define wxCloseEventHandler(func) \
3415 wxEVENT_HANDLER_CAST(wxCloseEventFunction, func)
3416 #define wxShowEventHandler(func) \
3417 wxEVENT_HANDLER_CAST(wxShowEventFunction, func)
3418 #define wxIconizeEventHandler(func) \
3419 wxEVENT_HANDLER_CAST(wxIconizeEventFunction, func)
3420 #define wxMaximizeEventHandler(func) \
3421 wxEVENT_HANDLER_CAST(wxMaximizeEventFunction, func)
3422 #define wxNavigationKeyEventHandler(func) \
3423 wxEVENT_HANDLER_CAST(wxNavigationKeyEventFunction, func)
3424 #define wxPaletteChangedEventHandler(func) \
3425 wxEVENT_HANDLER_CAST(wxPaletteChangedEventFunction, func)
3426 #define wxQueryNewPaletteEventHandler(func) \
3427 wxEVENT_HANDLER_CAST(wxQueryNewPaletteEventFunction, func)
3428 #define wxWindowCreateEventHandler(func) \
3429 wxEVENT_HANDLER_CAST(wxWindowCreateEventFunction, func)
3430 #define wxWindowDestroyEventHandler(func) \
3431 wxEVENT_HANDLER_CAST(wxWindowDestroyEventFunction, func)
3432 #define wxSetCursorEventHandler(func) \
3433 wxEVENT_HANDLER_CAST(wxSetCursorEventFunction, func)
3434 #define wxNotifyEventHandler(func) \
3435 wxEVENT_HANDLER_CAST(wxNotifyEventFunction, func)
3436 #define wxHelpEventHandler(func) \
3437 wxEVENT_HANDLER_CAST(wxHelpEventFunction, func)
3438 #define wxContextMenuEventHandler(func) \
3439 wxEVENT_HANDLER_CAST(wxContextMenuEventFunction, func)
3440 #define wxMouseCaptureChangedEventHandler(func) \
3441 wxEVENT_HANDLER_CAST(wxMouseCaptureChangedEventFunction, func)
3442 #define wxMouseCaptureLostEventHandler(func) \
3443 wxEVENT_HANDLER_CAST(wxMouseCaptureLostEventFunction, func)
3444 #define wxClipboardTextEventHandler(func) \
3445 wxEVENT_HANDLER_CAST(wxClipboardTextEventFunction, func)
3449 // N.B. In GNU-WIN32, you *have* to take the address of a member function
3450 // (use &) or the compiler crashes...
3452 #define DECLARE_EVENT_TABLE() \
3454 static const wxEventTableEntry sm_eventTableEntries[]; \
3456 static const wxEventTable sm_eventTable; \
3457 virtual const wxEventTable* GetEventTable() const; \
3458 static wxEventHashTable sm_eventHashTable; \
3459 virtual wxEventHashTable& GetEventHashTable() const;
3461 // N.B.: when building DLL with Borland C++ 5.5 compiler, you must initialize
3462 // sm_eventTable before using it in GetEventTable() or the compiler gives
3463 // E2233 (see http://groups.google.com/groups?selm=397dcc8a%241_2%40dnews)
3465 #define BEGIN_EVENT_TABLE(theClass, baseClass) \
3466 const wxEventTable theClass::sm_eventTable = \
3467 { &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \
3468 const wxEventTable *theClass::GetEventTable() const \
3469 { return &theClass::sm_eventTable; } \
3470 wxEventHashTable theClass::sm_eventHashTable(theClass::sm_eventTable); \
3471 wxEventHashTable &theClass::GetEventHashTable() const \
3472 { return theClass::sm_eventHashTable; } \
3473 const wxEventTableEntry theClass::sm_eventTableEntries[] = { \
3475 #define BEGIN_EVENT_TABLE_TEMPLATE1(theClass, baseClass, T1) \
3476 template<typename T1> \
3477 const wxEventTable theClass<T1>::sm_eventTable = \
3478 { &baseClass::sm_eventTable, &theClass<T1>::sm_eventTableEntries[0] }; \
3479 template<typename T1> \
3480 const wxEventTable *theClass<T1>::GetEventTable() const \
3481 { return &theClass<T1>::sm_eventTable; } \
3482 template<typename T1> \
3483 wxEventHashTable theClass<T1>::sm_eventHashTable(theClass<T1>::sm_eventTable); \
3484 template<typename T1> \
3485 wxEventHashTable &theClass<T1>::GetEventHashTable() const \
3486 { return theClass<T1>::sm_eventHashTable; } \
3487 template<typename T1> \
3488 const wxEventTableEntry theClass<T1>::sm_eventTableEntries[] = { \
3490 #define BEGIN_EVENT_TABLE_TEMPLATE2(theClass, baseClass, T1, T2) \
3491 template<typename T1, typename T2> \
3492 const wxEventTable theClass<T1, T2>::sm_eventTable = \
3493 { &baseClass::sm_eventTable, &theClass<T1, T2>::sm_eventTableEntries[0] }; \
3494 template<typename T1, typename T2> \
3495 const wxEventTable *theClass<T1, T2>::GetEventTable() const \
3496 { return &theClass<T1, T2>::sm_eventTable; } \
3497 template<typename T1, typename T2> \
3498 wxEventHashTable theClass<T1, T2>::sm_eventHashTable(theClass<T1, T2>::sm_eventTable); \
3499 template<typename T1, typename T2> \
3500 wxEventHashTable &theClass<T1, T2>::GetEventHashTable() const \
3501 { return theClass<T1, T2>::sm_eventHashTable; } \
3502 template<typename T1, typename T2> \
3503 const wxEventTableEntry theClass<T1, T2>::sm_eventTableEntries[] = { \
3505 #define BEGIN_EVENT_TABLE_TEMPLATE3(theClass, baseClass, T1, T2, T3) \
3506 template<typename T1, typename T2, typename T3> \
3507 const wxEventTable theClass<T1, T2, T3>::sm_eventTable = \
3508 { &baseClass::sm_eventTable, &theClass<T1, T2, T3>::sm_eventTableEntries[0] }; \
3509 template<typename T1, typename T2, typename T3> \
3510 const wxEventTable *theClass<T1, T2, T3>::GetEventTable() const \
3511 { return &theClass<T1, T2, T3>::sm_eventTable; } \
3512 template<typename T1, typename T2, typename T3> \
3513 wxEventHashTable theClass<T1, T2, T3>::sm_eventHashTable(theClass<T1, T2, T3>::sm_eventTable); \
3514 template<typename T1, typename T2, typename T3> \
3515 wxEventHashTable &theClass<T1, T2, T3>::GetEventHashTable() const \
3516 { return theClass<T1, T2, T3>::sm_eventHashTable; } \
3517 template<typename T1, typename T2, typename T3> \
3518 const wxEventTableEntry theClass<T1, T2, T3>::sm_eventTableEntries[] = { \
3520 #define BEGIN_EVENT_TABLE_TEMPLATE4(theClass, baseClass, T1, T2, T3, T4) \
3521 template<typename T1, typename T2, typename T3, typename T4> \
3522 const wxEventTable theClass<T1, T2, T3, T4>::sm_eventTable = \
3523 { &baseClass::sm_eventTable, &theClass<T1, T2, T3, T4>::sm_eventTableEntries[0] }; \
3524 template<typename T1, typename T2, typename T3, typename T4> \
3525 const wxEventTable *theClass<T1, T2, T3, T4>::GetEventTable() const \
3526 { return &theClass<T1, T2, T3, T4>::sm_eventTable; } \
3527 template<typename T1, typename T2, typename T3, typename T4> \
3528 wxEventHashTable theClass<T1, T2, T3, T4>::sm_eventHashTable(theClass<T1, T2, T3, T4>::sm_eventTable); \
3529 template<typename T1, typename T2, typename T3, typename T4> \
3530 wxEventHashTable &theClass<T1, T2, T3, T4>::GetEventHashTable() const \
3531 { return theClass<T1, T2, T3, T4>::sm_eventHashTable; } \
3532 template<typename T1, typename T2, typename T3, typename T4> \
3533 const wxEventTableEntry theClass<T1, T2, T3, T4>::sm_eventTableEntries[] = { \
3535 #define BEGIN_EVENT_TABLE_TEMPLATE5(theClass, baseClass, T1, T2, T3, T4, T5) \
3536 template<typename T1, typename T2, typename T3, typename T4, typename T5> \
3537 const wxEventTable theClass<T1, T2, T3, T4, T5>::sm_eventTable = \
3538 { &baseClass::sm_eventTable, &theClass<T1, T2, T3, T4, T5>::sm_eventTableEntries[0] }; \
3539 template<typename T1, typename T2, typename T3, typename T4, typename T5> \
3540 const wxEventTable *theClass<T1, T2, T3, T4, T5>::GetEventTable() const \
3541 { return &theClass<T1, T2, T3, T4, T5>::sm_eventTable; } \
3542 template<typename T1, typename T2, typename T3, typename T4, typename T5> \
3543 wxEventHashTable theClass<T1, T2, T3, T4, T5>::sm_eventHashTable(theClass<T1, T2, T3, T4, T5>::sm_eventTable); \
3544 template<typename T1, typename T2, typename T3, typename T4, typename T5> \
3545 wxEventHashTable &theClass<T1, T2, T3, T4, T5>::GetEventHashTable() const \
3546 { return theClass<T1, T2, T3, T4, T5>::sm_eventHashTable; } \
3547 template<typename T1, typename T2, typename T3, typename T4, typename T5> \
3548 const wxEventTableEntry theClass<T1, T2, T3, T4, T5>::sm_eventTableEntries[] = { \
3550 #define BEGIN_EVENT_TABLE_TEMPLATE7(theClass, baseClass, T1, T2, T3, T4, T5, T6, T7) \
3551 template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> \
3552 const wxEventTable theClass<T1, T2, T3, T4, T5, T6, T7>::sm_eventTable = \
3553 { &baseClass::sm_eventTable, &theClass<T1, T2, T3, T4, T5, T6, T7>::sm_eventTableEntries[0] }; \
3554 template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> \
3555 const wxEventTable *theClass<T1, T2, T3, T4, T5, T6, T7>::GetEventTable() const \
3556 { return &theClass<T1, T2, T3, T4, T5, T6, T7>::sm_eventTable; } \
3557 template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> \
3558 wxEventHashTable theClass<T1, T2, T3, T4, T5, T6, T7>::sm_eventHashTable(theClass<T1, T2, T3, T4, T5, T6, T7>::sm_eventTable); \
3559 template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> \
3560 wxEventHashTable &theClass<T1, T2, T3, T4, T5, T6, T7>::GetEventHashTable() const \
3561 { return theClass<T1, T2, T3, T4, T5, T6, T7>::sm_eventHashTable; } \
3562 template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> \
3563 const wxEventTableEntry theClass<T1, T2, T3, T4, T5, T6, T7>::sm_eventTableEntries[] = { \
3565 #define BEGIN_EVENT_TABLE_TEMPLATE8(theClass, baseClass, T1, T2, T3, T4, T5, T6, T7, T8) \
3566 template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> \
3567 const wxEventTable theClass<T1, T2, T3, T4, T5, T6, T7, T8>::sm_eventTable = \
3568 { &baseClass::sm_eventTable, &theClass<T1, T2, T3, T4, T5, T6, T7, T8>::sm_eventTableEntries[0] }; \
3569 template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> \
3570 const wxEventTable *theClass<T1, T2, T3, T4, T5, T6, T7, T8>::GetEventTable() const \
3571 { return &theClass<T1, T2, T3, T4, T5, T6, T7, T8>::sm_eventTable; } \
3572 template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> \
3573 wxEventHashTable theClass<T1, T2, T3, T4, T5, T6, T7, T8>::sm_eventHashTable(theClass<T1, T2, T3, T4, T5, T6, T7, T8>::sm_eventTable); \
3574 template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> \
3575 wxEventHashTable &theClass<T1, T2, T3, T4, T5, T6, T7, T8>::GetEventHashTable() const \
3576 { return theClass<T1, T2, T3, T4, T5, T6, T7, T8>::sm_eventHashTable; } \
3577 template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> \
3578 const wxEventTableEntry theClass<T1, T2, T3, T4, T5, T6, T7, T8>::sm_eventTableEntries[] = { \
3580 #define END_EVENT_TABLE() DECLARE_EVENT_TABLE_TERMINATOR() };
3583 * Event table macros
3586 // helpers for writing shorter code below: declare an event macro taking 2, 1
3587 // or none ids (the missing ids default to wxID_ANY)
3590 // - evt one of wxEVT_XXX constants
3591 // - id1, id2 ids of the first/last id
3592 // - fn the function (should be cast to the right type)
3593 #define wx__DECLARE_EVT2(evt, id1, id2, fn) \
3594 DECLARE_EVENT_TABLE_ENTRY(evt, id1, id2, fn, NULL),
3595 #define wx__DECLARE_EVT1(evt, id, fn) \
3596 wx__DECLARE_EVT2(evt, id, wxID_ANY, fn)
3597 #define wx__DECLARE_EVT0(evt, fn) \
3598 wx__DECLARE_EVT1(evt, wxID_ANY, fn)
3602 #define EVT_CUSTOM(event, winid, func) \
3603 wx__DECLARE_EVT1(event, winid, wxEventHandler(func))
3604 #define EVT_CUSTOM_RANGE(event, id1, id2, func) \
3605 wx__DECLARE_EVT2(event, id1, id2, wxEventHandler(func))
3608 #define EVT_COMMAND(winid, event, func) \
3609 wx__DECLARE_EVT1(event, winid, wxCommandEventHandler(func))
3611 #define EVT_COMMAND_RANGE(id1, id2, event, func) \
3612 wx__DECLARE_EVT2(event, id1, id2, wxCommandEventHandler(func))
3614 #define EVT_NOTIFY(event, winid, func) \
3615 wx__DECLARE_EVT1(event, winid, wxNotifyEventHandler(func))
3617 #define EVT_NOTIFY_RANGE(event, id1, id2, func) \
3618 wx__DECLARE_EVT2(event, id1, id2, wxNotifyEventHandler(func))
3621 #define EVT_SIZE(func) wx__DECLARE_EVT0(wxEVT_SIZE, wxSizeEventHandler(func))
3622 #define EVT_SIZING(func) wx__DECLARE_EVT0(wxEVT_SIZING, wxSizeEventHandler(func))
3623 #define EVT_MOVE(func) wx__DECLARE_EVT0(wxEVT_MOVE, wxMoveEventHandler(func))
3624 #define EVT_MOVING(func) wx__DECLARE_EVT0(wxEVT_MOVING, wxMoveEventHandler(func))
3625 #define EVT_MOVE_START(func) wx__DECLARE_EVT0(wxEVT_MOVE_START, wxMoveEventHandler(func))
3626 #define EVT_MOVE_END(func) wx__DECLARE_EVT0(wxEVT_MOVE_END, wxMoveEventHandler(func))
3627 #define EVT_CLOSE(func) wx__DECLARE_EVT0(wxEVT_CLOSE_WINDOW, wxCloseEventHandler(func))
3628 #define EVT_END_SESSION(func) wx__DECLARE_EVT0(wxEVT_END_SESSION, wxCloseEventHandler(func))
3629 #define EVT_QUERY_END_SESSION(func) wx__DECLARE_EVT0(wxEVT_QUERY_END_SESSION, wxCloseEventHandler(func))
3630 #define EVT_PAINT(func) wx__DECLARE_EVT0(wxEVT_PAINT, wxPaintEventHandler(func))
3631 #define EVT_NC_PAINT(func) wx__DECLARE_EVT0(wxEVT_NC_PAINT, wxNcPaintEventHandler(func))
3632 #define EVT_ERASE_BACKGROUND(func) wx__DECLARE_EVT0(wxEVT_ERASE_BACKGROUND, wxEraseEventHandler(func))
3633 #define EVT_CHAR(func) wx__DECLARE_EVT0(wxEVT_CHAR, wxCharEventHandler(func))
3634 #define EVT_KEY_DOWN(func) wx__DECLARE_EVT0(wxEVT_KEY_DOWN, wxKeyEventHandler(func))
3635 #define EVT_KEY_UP(func) wx__DECLARE_EVT0(wxEVT_KEY_UP, wxKeyEventHandler(func))
3637 #define EVT_HOTKEY(winid, func) wx__DECLARE_EVT1(wxEVT_HOTKEY, winid, wxCharEventHandler(func))
3639 #define EVT_CHAR_HOOK(func) wx__DECLARE_EVT0(wxEVT_CHAR_HOOK, wxCharEventHandler(func))
3640 #define EVT_MENU_OPEN(func) wx__DECLARE_EVT0(wxEVT_MENU_OPEN, wxMenuEventHandler(func))
3641 #define EVT_MENU_CLOSE(func) wx__DECLARE_EVT0(wxEVT_MENU_CLOSE, wxMenuEventHandler(func))
3642 #define EVT_MENU_HIGHLIGHT(winid, func) wx__DECLARE_EVT1(wxEVT_MENU_HIGHLIGHT, winid, wxMenuEventHandler(func))
3643 #define EVT_MENU_HIGHLIGHT_ALL(func) wx__DECLARE_EVT0(wxEVT_MENU_HIGHLIGHT, wxMenuEventHandler(func))
3644 #define EVT_SET_FOCUS(func) wx__DECLARE_EVT0(wxEVT_SET_FOCUS, wxFocusEventHandler(func))
3645 #define EVT_KILL_FOCUS(func) wx__DECLARE_EVT0(wxEVT_KILL_FOCUS, wxFocusEventHandler(func))
3646 #define EVT_CHILD_FOCUS(func) wx__DECLARE_EVT0(wxEVT_CHILD_FOCUS, wxChildFocusEventHandler(func))
3647 #define EVT_ACTIVATE(func) wx__DECLARE_EVT0(wxEVT_ACTIVATE, wxActivateEventHandler(func))
3648 #define EVT_ACTIVATE_APP(func) wx__DECLARE_EVT0(wxEVT_ACTIVATE_APP, wxActivateEventHandler(func))
3649 #define EVT_HIBERNATE(func) wx__DECLARE_EVT0(wxEVT_HIBERNATE, wxActivateEventHandler(func))
3650 #define EVT_END_SESSION(func) wx__DECLARE_EVT0(wxEVT_END_SESSION, wxCloseEventHandler(func))
3651 #define EVT_QUERY_END_SESSION(func) wx__DECLARE_EVT0(wxEVT_QUERY_END_SESSION, wxCloseEventHandler(func))
3652 #define EVT_DROP_FILES(func) wx__DECLARE_EVT0(wxEVT_DROP_FILES, wxDropFilesEventHandler(func))
3653 #define EVT_INIT_DIALOG(func) wx__DECLARE_EVT0(wxEVT_INIT_DIALOG, wxInitDialogEventHandler(func))
3654 #define EVT_SYS_COLOUR_CHANGED(func) wx__DECLARE_EVT0(wxEVT_SYS_COLOUR_CHANGED, wxSysColourChangedEventHandler(func))
3655 #define EVT_DISPLAY_CHANGED(func) wx__DECLARE_EVT0(wxEVT_DISPLAY_CHANGED, wxDisplayChangedEventHandler(func))
3656 #define EVT_SHOW(func) wx__DECLARE_EVT0(wxEVT_SHOW, wxShowEventHandler(func))
3657 #define EVT_MAXIMIZE(func) wx__DECLARE_EVT0(wxEVT_MAXIMIZE, wxMaximizeEventHandler(func))
3658 #define EVT_ICONIZE(func) wx__DECLARE_EVT0(wxEVT_ICONIZE, wxIconizeEventHandler(func))
3659 #define EVT_NAVIGATION_KEY(func) wx__DECLARE_EVT0(wxEVT_NAVIGATION_KEY, wxNavigationKeyEventHandler(func))
3660 #define EVT_PALETTE_CHANGED(func) wx__DECLARE_EVT0(wxEVT_PALETTE_CHANGED, wxPaletteChangedEventHandler(func))
3661 #define EVT_QUERY_NEW_PALETTE(func) wx__DECLARE_EVT0(wxEVT_QUERY_NEW_PALETTE, wxQueryNewPaletteEventHandler(func))
3662 #define EVT_WINDOW_CREATE(func) wx__DECLARE_EVT0(wxEVT_CREATE, wxWindowCreateEventHandler(func))
3663 #define EVT_WINDOW_DESTROY(func) wx__DECLARE_EVT0(wxEVT_DESTROY, wxWindowDestroyEventHandler(func))
3664 #define EVT_SET_CURSOR(func) wx__DECLARE_EVT0(wxEVT_SET_CURSOR, wxSetCursorEventHandler(func))
3665 #define EVT_MOUSE_CAPTURE_CHANGED(func) wx__DECLARE_EVT0(wxEVT_MOUSE_CAPTURE_CHANGED, wxMouseCaptureChangedEventHandler(func))
3666 #define EVT_MOUSE_CAPTURE_LOST(func) wx__DECLARE_EVT0(wxEVT_MOUSE_CAPTURE_LOST, wxMouseCaptureLostEventHandler(func))
3669 #define EVT_LEFT_DOWN(func) wx__DECLARE_EVT0(wxEVT_LEFT_DOWN, wxMouseEventHandler(func))
3670 #define EVT_LEFT_UP(func) wx__DECLARE_EVT0(wxEVT_LEFT_UP, wxMouseEventHandler(func))
3671 #define EVT_MIDDLE_DOWN(func) wx__DECLARE_EVT0(wxEVT_MIDDLE_DOWN, wxMouseEventHandler(func))
3672 #define EVT_MIDDLE_UP(func) wx__DECLARE_EVT0(wxEVT_MIDDLE_UP, wxMouseEventHandler(func))
3673 #define EVT_RIGHT_DOWN(func) wx__DECLARE_EVT0(wxEVT_RIGHT_DOWN, wxMouseEventHandler(func))
3674 #define EVT_RIGHT_UP(func) wx__DECLARE_EVT0(wxEVT_RIGHT_UP, wxMouseEventHandler(func))
3675 #define EVT_MOTION(func) wx__DECLARE_EVT0(wxEVT_MOTION, wxMouseEventHandler(func))
3676 #define EVT_LEFT_DCLICK(func) wx__DECLARE_EVT0(wxEVT_LEFT_DCLICK, wxMouseEventHandler(func))
3677 #define EVT_MIDDLE_DCLICK(func) wx__DECLARE_EVT0(wxEVT_MIDDLE_DCLICK, wxMouseEventHandler(func))
3678 #define EVT_RIGHT_DCLICK(func) wx__DECLARE_EVT0(wxEVT_RIGHT_DCLICK, wxMouseEventHandler(func))
3679 #define EVT_LEAVE_WINDOW(func) wx__DECLARE_EVT0(wxEVT_LEAVE_WINDOW, wxMouseEventHandler(func))
3680 #define EVT_ENTER_WINDOW(func) wx__DECLARE_EVT0(wxEVT_ENTER_WINDOW, wxMouseEventHandler(func))
3681 #define EVT_MOUSEWHEEL(func) wx__DECLARE_EVT0(wxEVT_MOUSEWHEEL, wxMouseEventHandler(func))
3682 #define EVT_MOUSE_AUX1_DOWN(func) wx__DECLARE_EVT0(wxEVT_AUX1_DOWN, wxMouseEventHandler(func))
3683 #define EVT_MOUSE_AUX1_UP(func) wx__DECLARE_EVT0(wxEVT_AUX1_UP, wxMouseEventHandler(func))
3684 #define EVT_MOUSE_AUX1_DCLICK(func) wx__DECLARE_EVT0(wxEVT_AUX1_DCLICK, wxMouseEventHandler(func))
3685 #define EVT_MOUSE_AUX2_DOWN(func) wx__DECLARE_EVT0(wxEVT_AUX2_DOWN, wxMouseEventHandler(func))
3686 #define EVT_MOUSE_AUX2_UP(func) wx__DECLARE_EVT0(wxEVT_AUX2_UP, wxMouseEventHandler(func))
3687 #define EVT_MOUSE_AUX2_DCLICK(func) wx__DECLARE_EVT0(wxEVT_AUX2_DCLICK, wxMouseEventHandler(func))
3690 #define EVT_MOUSE_EVENTS(func) \
3691 EVT_LEFT_DOWN(func) \
3693 EVT_LEFT_DCLICK(func) \
3694 EVT_MIDDLE_DOWN(func) \
3695 EVT_MIDDLE_UP(func) \
3696 EVT_MIDDLE_DCLICK(func) \
3697 EVT_RIGHT_DOWN(func) \
3698 EVT_RIGHT_UP(func) \
3699 EVT_RIGHT_DCLICK(func) \
3700 EVT_MOUSE_AUX1_DOWN(func) \
3701 EVT_MOUSE_AUX1_UP(func) \
3702 EVT_MOUSE_AUX1_DCLICK(func) \
3703 EVT_MOUSE_AUX2_DOWN(func) \
3704 EVT_MOUSE_AUX2_UP(func) \
3705 EVT_MOUSE_AUX2_DCLICK(func) \
3707 EVT_LEAVE_WINDOW(func) \
3708 EVT_ENTER_WINDOW(func) \
3709 EVT_MOUSEWHEEL(func)
3711 // Scrolling from wxWindow (sent to wxScrolledWindow)
3712 #define EVT_SCROLLWIN_TOP(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_TOP, wxScrollWinEventHandler(func))
3713 #define EVT_SCROLLWIN_BOTTOM(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_BOTTOM, wxScrollWinEventHandler(func))
3714 #define EVT_SCROLLWIN_LINEUP(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_LINEUP, wxScrollWinEventHandler(func))
3715 #define EVT_SCROLLWIN_LINEDOWN(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_LINEDOWN, wxScrollWinEventHandler(func))
3716 #define EVT_SCROLLWIN_PAGEUP(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_PAGEUP, wxScrollWinEventHandler(func))
3717 #define EVT_SCROLLWIN_PAGEDOWN(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_PAGEDOWN, wxScrollWinEventHandler(func))
3718 #define EVT_SCROLLWIN_THUMBTRACK(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_THUMBTRACK, wxScrollWinEventHandler(func))
3719 #define EVT_SCROLLWIN_THUMBRELEASE(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_THUMBRELEASE, wxScrollWinEventHandler(func))
3721 #define EVT_SCROLLWIN(func) \
3722 EVT_SCROLLWIN_TOP(func) \
3723 EVT_SCROLLWIN_BOTTOM(func) \
3724 EVT_SCROLLWIN_LINEUP(func) \
3725 EVT_SCROLLWIN_LINEDOWN(func) \
3726 EVT_SCROLLWIN_PAGEUP(func) \
3727 EVT_SCROLLWIN_PAGEDOWN(func) \
3728 EVT_SCROLLWIN_THUMBTRACK(func) \
3729 EVT_SCROLLWIN_THUMBRELEASE(func)
3731 // Scrolling from wxSlider and wxScrollBar
3732 #define EVT_SCROLL_TOP(func) wx__DECLARE_EVT0(wxEVT_SCROLL_TOP, wxScrollEventHandler(func))
3733 #define EVT_SCROLL_BOTTOM(func) wx__DECLARE_EVT0(wxEVT_SCROLL_BOTTOM, wxScrollEventHandler(func))
3734 #define EVT_SCROLL_LINEUP(func) wx__DECLARE_EVT0(wxEVT_SCROLL_LINEUP, wxScrollEventHandler(func))
3735 #define EVT_SCROLL_LINEDOWN(func) wx__DECLARE_EVT0(wxEVT_SCROLL_LINEDOWN, wxScrollEventHandler(func))
3736 #define EVT_SCROLL_PAGEUP(func) wx__DECLARE_EVT0(wxEVT_SCROLL_PAGEUP, wxScrollEventHandler(func))
3737 #define EVT_SCROLL_PAGEDOWN(func) wx__DECLARE_EVT0(wxEVT_SCROLL_PAGEDOWN, wxScrollEventHandler(func))
3738 #define EVT_SCROLL_THUMBTRACK(func) wx__DECLARE_EVT0(wxEVT_SCROLL_THUMBTRACK, wxScrollEventHandler(func))
3739 #define EVT_SCROLL_THUMBRELEASE(func) wx__DECLARE_EVT0(wxEVT_SCROLL_THUMBRELEASE, wxScrollEventHandler(func))
3740 #define EVT_SCROLL_CHANGED(func) wx__DECLARE_EVT0(wxEVT_SCROLL_CHANGED, wxScrollEventHandler(func))
3742 #define EVT_SCROLL(func) \
3743 EVT_SCROLL_TOP(func) \
3744 EVT_SCROLL_BOTTOM(func) \
3745 EVT_SCROLL_LINEUP(func) \
3746 EVT_SCROLL_LINEDOWN(func) \
3747 EVT_SCROLL_PAGEUP(func) \
3748 EVT_SCROLL_PAGEDOWN(func) \
3749 EVT_SCROLL_THUMBTRACK(func) \
3750 EVT_SCROLL_THUMBRELEASE(func) \
3751 EVT_SCROLL_CHANGED(func)
3753 // Scrolling from wxSlider and wxScrollBar, with an id
3754 #define EVT_COMMAND_SCROLL_TOP(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_TOP, winid, wxScrollEventHandler(func))
3755 #define EVT_COMMAND_SCROLL_BOTTOM(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_BOTTOM, winid, wxScrollEventHandler(func))
3756 #define EVT_COMMAND_SCROLL_LINEUP(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_LINEUP, winid, wxScrollEventHandler(func))
3757 #define EVT_COMMAND_SCROLL_LINEDOWN(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_LINEDOWN, winid, wxScrollEventHandler(func))
3758 #define EVT_COMMAND_SCROLL_PAGEUP(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_PAGEUP, winid, wxScrollEventHandler(func))
3759 #define EVT_COMMAND_SCROLL_PAGEDOWN(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_PAGEDOWN, winid, wxScrollEventHandler(func))
3760 #define EVT_COMMAND_SCROLL_THUMBTRACK(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_THUMBTRACK, winid, wxScrollEventHandler(func))
3761 #define EVT_COMMAND_SCROLL_THUMBRELEASE(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_THUMBRELEASE, winid, wxScrollEventHandler(func))
3762 #define EVT_COMMAND_SCROLL_CHANGED(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_CHANGED, winid, wxScrollEventHandler(func))
3764 #define EVT_COMMAND_SCROLL(winid, func) \
3765 EVT_COMMAND_SCROLL_TOP(winid, func) \
3766 EVT_COMMAND_SCROLL_BOTTOM(winid, func) \
3767 EVT_COMMAND_SCROLL_LINEUP(winid, func) \
3768 EVT_COMMAND_SCROLL_LINEDOWN(winid, func) \
3769 EVT_COMMAND_SCROLL_PAGEUP(winid, func) \
3770 EVT_COMMAND_SCROLL_PAGEDOWN(winid, func) \
3771 EVT_COMMAND_SCROLL_THUMBTRACK(winid, func) \
3772 EVT_COMMAND_SCROLL_THUMBRELEASE(winid, func) \
3773 EVT_COMMAND_SCROLL_CHANGED(winid, func)
3775 #if WXWIN_COMPATIBILITY_2_6
3776 // compatibility macros for the old name, deprecated in 2.8
3777 #define wxEVT_SCROLL_ENDSCROLL wxEVT_SCROLL_CHANGED
3778 #define EVT_COMMAND_SCROLL_ENDSCROLL EVT_COMMAND_SCROLL_CHANGED
3779 #define EVT_SCROLL_ENDSCROLL EVT_SCROLL_CHANGED
3780 #endif // WXWIN_COMPATIBILITY_2_6
3782 // Convenience macros for commonly-used commands
3783 #define EVT_CHECKBOX(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_CHECKBOX_CLICKED, winid, wxCommandEventHandler(func))
3784 #define EVT_CHOICE(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_CHOICE_SELECTED, winid, wxCommandEventHandler(func))
3785 #define EVT_LISTBOX(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_LISTBOX_SELECTED, winid, wxCommandEventHandler(func))
3786 #define EVT_LISTBOX_DCLICK(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, winid, wxCommandEventHandler(func))
3787 #define EVT_MENU(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_MENU_SELECTED, winid, wxCommandEventHandler(func))
3788 #define EVT_MENU_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_COMMAND_MENU_SELECTED, id1, id2, wxCommandEventHandler(func))
3789 #if defined(__SMARTPHONE__)
3790 # define EVT_BUTTON(winid, func) EVT_MENU(winid, func)
3792 # define EVT_BUTTON(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_BUTTON_CLICKED, winid, wxCommandEventHandler(func))
3794 #define EVT_SLIDER(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_SLIDER_UPDATED, winid, wxCommandEventHandler(func))
3795 #define EVT_RADIOBOX(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_RADIOBOX_SELECTED, winid, wxCommandEventHandler(func))
3796 #define EVT_RADIOBUTTON(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_RADIOBUTTON_SELECTED, winid, wxCommandEventHandler(func))
3797 // EVT_SCROLLBAR is now obsolete since we use EVT_COMMAND_SCROLL... events
3798 #define EVT_SCROLLBAR(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_SCROLLBAR_UPDATED, winid, wxCommandEventHandler(func))
3799 #define EVT_VLBOX(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_VLBOX_SELECTED, winid, wxCommandEventHandler(func))
3800 #define EVT_COMBOBOX(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_COMBOBOX_SELECTED, winid, wxCommandEventHandler(func))
3801 #define EVT_TOOL(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_TOOL_CLICKED, winid, wxCommandEventHandler(func))
3802 #define EVT_TOOL_DROPDOWN(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_TOOL_DROPDOWN_CLICKED, winid, wxCommandEventHandler(func))
3803 #define EVT_TOOL_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_COMMAND_TOOL_CLICKED, id1, id2, wxCommandEventHandler(func))
3804 #define EVT_TOOL_RCLICKED(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_TOOL_RCLICKED, winid, wxCommandEventHandler(func))
3805 #define EVT_TOOL_RCLICKED_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_COMMAND_TOOL_RCLICKED, id1, id2, wxCommandEventHandler(func))
3806 #define EVT_TOOL_ENTER(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_TOOL_ENTER, winid, wxCommandEventHandler(func))
3807 #define EVT_CHECKLISTBOX(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, winid, wxCommandEventHandler(func))
3809 // Generic command events
3810 #define EVT_COMMAND_LEFT_CLICK(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_LEFT_CLICK, winid, wxCommandEventHandler(func))
3811 #define EVT_COMMAND_LEFT_DCLICK(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_LEFT_DCLICK, winid, wxCommandEventHandler(func))
3812 #define EVT_COMMAND_RIGHT_CLICK(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_RIGHT_CLICK, winid, wxCommandEventHandler(func))
3813 #define EVT_COMMAND_RIGHT_DCLICK(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_RIGHT_DCLICK, winid, wxCommandEventHandler(func))
3814 #define EVT_COMMAND_SET_FOCUS(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_SET_FOCUS, winid, wxCommandEventHandler(func))
3815 #define EVT_COMMAND_KILL_FOCUS(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_KILL_FOCUS, winid, wxCommandEventHandler(func))
3816 #define EVT_COMMAND_ENTER(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_ENTER, winid, wxCommandEventHandler(func))
3820 #define EVT_JOY_BUTTON_DOWN(func) wx__DECLARE_EVT0(wxEVT_JOY_BUTTON_DOWN, wxJoystickEventHandler(func))
3821 #define EVT_JOY_BUTTON_UP(func) wx__DECLARE_EVT0(wxEVT_JOY_BUTTON_UP, wxJoystickEventHandler(func))
3822 #define EVT_JOY_MOVE(func) wx__DECLARE_EVT0(wxEVT_JOY_MOVE, wxJoystickEventHandler(func))
3823 #define EVT_JOY_ZMOVE(func) wx__DECLARE_EVT0(wxEVT_JOY_ZMOVE, wxJoystickEventHandler(func))
3825 // All joystick events
3826 #define EVT_JOYSTICK_EVENTS(func) \
3827 EVT_JOY_BUTTON_DOWN(func) \
3828 EVT_JOY_BUTTON_UP(func) \
3829 EVT_JOY_MOVE(func) \
3833 #define EVT_IDLE(func) wx__DECLARE_EVT0(wxEVT_IDLE, wxIdleEventHandler(func))
3836 #define EVT_UPDATE_UI(winid, func) wx__DECLARE_EVT1(wxEVT_UPDATE_UI, winid, wxUpdateUIEventHandler(func))
3837 #define EVT_UPDATE_UI_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_UPDATE_UI, id1, id2, wxUpdateUIEventHandler(func))
3840 #define EVT_HELP(winid, func) wx__DECLARE_EVT1(wxEVT_HELP, winid, wxHelpEventHandler(func))
3841 #define EVT_HELP_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_HELP, id1, id2, wxHelpEventHandler(func))
3842 #define EVT_DETAILED_HELP(winid, func) wx__DECLARE_EVT1(wxEVT_DETAILED_HELP, winid, wxHelpEventHandler(func))
3843 #define EVT_DETAILED_HELP_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_DETAILED_HELP, id1, id2, wxHelpEventHandler(func))
3845 // Context Menu Events
3846 #define EVT_CONTEXT_MENU(func) wx__DECLARE_EVT0(wxEVT_CONTEXT_MENU, wxContextMenuEventHandler(func))
3847 #define EVT_COMMAND_CONTEXT_MENU(winid, func) wx__DECLARE_EVT1(wxEVT_CONTEXT_MENU, winid, wxContextMenuEventHandler(func))
3849 // Clipboard text Events
3850 #define EVT_TEXT_CUT(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_TEXT_CUT, winid, wxClipboardTextEventHandler(func))
3851 #define EVT_TEXT_COPY(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_TEXT_COPY, winid, wxClipboardTextEventHandler(func))
3852 #define EVT_TEXT_PASTE(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_TEXT_PASTE, winid, wxClipboardTextEventHandler(func))
3854 // ----------------------------------------------------------------------------
3856 // ----------------------------------------------------------------------------
3858 // list containing event handlers with pending events for them
3860 // notice that each event handler should occur at most once in this list
3861 extern WXDLLIMPEXP_BASE wxList
*wxHandlersWithPendingEvents
;
3863 extern WXDLLIMPEXP_BASE wxCriticalSection
*wxHandlersWithPendingEventsLocker
;
3866 // ----------------------------------------------------------------------------
3868 // ----------------------------------------------------------------------------
3872 // Find a window with the focus, that is also a descendant of the given window.
3873 // This is used to determine the window to initially send commands to.
3874 WXDLLIMPEXP_CORE wxWindow
* wxFindFocusDescendant(wxWindow
* ancestor
);
3878 #endif // _WX_EVENT_H_