1 /////////////////////////////////////////////////////////////////////////////
2 // Name:        wx/event.h
3 // Purpose:     Event classes
4 // Author:      Julian Smart
5 // Modified by:
6 // Created:     01/02/97
7 // Copyright:   (c) wxWidgets team
8 // Licence:     wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10 
11 #ifndef _WX_EVENT_H_
12 #define _WX_EVENT_H_
13 
14 #include "wx/defs.h"
15 #include "wx/cpp.h"
16 #include "wx/object.h"
17 #include "wx/clntdata.h"
18 
19 #if wxUSE_GUI
20     #include "wx/gdicmn.h"
21     #include "wx/cursor.h"
22     #include "wx/mousestate.h"
23 #endif
24 
25 #include "wx/dynarray.h"
26 #include "wx/thread.h"
27 #include "wx/tracker.h"
28 #include "wx/typeinfo.h"
29 #include "wx/any.h"
30 
31 #ifdef wxHAS_EVENT_BIND
32     #include "wx/meta/convertible.h"
33 #endif
34 
35 // Currently VC6 and VC7 are known to not be able to compile CallAfter() code,
36 // so disable it for them.
37 #if !defined(__VISUALC__) || wxCHECK_VISUALC_VERSION(8)
38     #include "wx/meta/removeref.h"
39 
40     #define wxHAS_CALL_AFTER
41 #endif
42 
43 // ----------------------------------------------------------------------------
44 // forward declarations
45 // ----------------------------------------------------------------------------
46 
47 class WXDLLIMPEXP_FWD_BASE wxList;
48 class WXDLLIMPEXP_FWD_BASE wxEvent;
49 class WXDLLIMPEXP_FWD_BASE wxEventFilter;
50 #if wxUSE_GUI
51     class WXDLLIMPEXP_FWD_CORE wxDC;
52     class WXDLLIMPEXP_FWD_CORE wxMenu;
53     class WXDLLIMPEXP_FWD_CORE wxWindow;
54     class WXDLLIMPEXP_FWD_CORE wxWindowBase;
55 #endif // wxUSE_GUI
56 
57 // We operate with pointer to members of wxEvtHandler (such functions are used
58 // as event handlers in the event tables or as arguments to Connect()) but by
59 // default MSVC uses a restricted (but more efficient) representation of
60 // pointers to members which can't deal with multiple base classes. To avoid
61 // mysterious (as the compiler is not good enough to detect this and give a
62 // sensible error message) errors in the user code as soon as it defines
63 // classes inheriting from both wxEvtHandler (possibly indirectly, e.g. via
64 // wxWindow) and something else (including our own wxTrackable but not limited
65 // to it), we use the special MSVC keyword telling the compiler to use a more
66 // general pointer to member representation for the classes inheriting from
67 // wxEvtHandler.
68 #ifdef __VISUALC__
69     #define wxMSVC_FWD_MULTIPLE_BASES __multiple_inheritance
70 #else
71     #define wxMSVC_FWD_MULTIPLE_BASES
72 #endif
73 
74 class WXDLLIMPEXP_FWD_BASE wxMSVC_FWD_MULTIPLE_BASES wxEvtHandler;
75 class wxEventConnectionRef;
76 
77 // ----------------------------------------------------------------------------
78 // Event types
79 // ----------------------------------------------------------------------------
80 
81 typedef int wxEventType;
82 
83 #define wxEVT_ANY           ((wxEventType)-1)
84 
85 // this is used to make the event table entry type safe, so that for an event
86 // handler only a function with proper parameter list can be given. See also
87 // the wxEVENT_HANDLER_CAST-macro.
88 #define wxStaticCastEvent(type, val) static_cast<type>(val)
89 
90 #define wxDECLARE_EVENT_TABLE_ENTRY(type, winid, idLast, fn, obj) \
91     wxEventTableEntry(type, winid, idLast, wxNewEventTableFunctor(type, fn), obj)
92 
93 #define wxDECLARE_EVENT_TABLE_TERMINATOR() \
94     wxEventTableEntry(wxEVT_NULL, 0, 0, 0, 0)
95 
96 // generate a new unique event type
97 extern WXDLLIMPEXP_BASE wxEventType wxNewEventType();
98 
99 // define macros to create new event types:
100 #ifdef wxHAS_EVENT_BIND
101     // events are represented by an instance of wxEventTypeTag and the
102     // corresponding type must be specified for type-safety checks
103 
104     // define a new custom event type, can be used alone or after event
105     // declaration in the header using one of the macros below
106     #define wxDEFINE_EVENT( name, type ) \
107         const wxEventTypeTag< type > name( wxNewEventType() )
108 
109     // the general version allowing exporting the event type from DLL, used by
110     // wxWidgets itself
111     #define wxDECLARE_EXPORTED_EVENT( expdecl, name, type ) \
112         extern const expdecl wxEventTypeTag< type > name
113 
114     // this is the version which will normally be used in the user code
115     #define wxDECLARE_EVENT( name, type ) \
116         wxDECLARE_EXPORTED_EVENT( wxEMPTY_PARAMETER_VALUE, name, type )
117 
118 
119     // these macros are only used internally for backwards compatibility and
120     // allow to define an alias for an existing event type (this is used by
121     // wxEVT_SPIN_XXX)
122     #define wxDEFINE_EVENT_ALIAS( name, type, value ) \
123         const wxEventTypeTag< type > name( value )
124 
125     #define wxDECLARE_EXPORTED_EVENT_ALIAS( expdecl, name, type ) \
126         extern const expdecl wxEventTypeTag< type > name
127 #else // !wxHAS_EVENT_BIND
128     // the macros are the same ones as above but defined differently as we only
129     // use the integer event type values to identify events in this case
130 
131     #define wxDEFINE_EVENT( name, type ) \
132         const wxEventType name( wxNewEventType() )
133 
134     #define wxDECLARE_EXPORTED_EVENT( expdecl, name, type ) \
135         extern const expdecl wxEventType name
136     #define wxDECLARE_EVENT( name, type ) \
137         wxDECLARE_EXPORTED_EVENT( wxEMPTY_PARAMETER_VALUE, name, type )
138 
139     #define wxDEFINE_EVENT_ALIAS( name, type, value ) \
140         const wxEventType name = value
141     #define wxDECLARE_EXPORTED_EVENT_ALIAS( expdecl, name, type ) \
142         extern const expdecl wxEventType name
143 #endif // wxHAS_EVENT_BIND/!wxHAS_EVENT_BIND
144 
145 // The type-erased method signature used for event handling.
146 typedef void (wxEvtHandler::*wxEventFunction)(wxEvent&);
147 
148 template <typename T>
wxEventFunctionCast(void (wxEvtHandler::* func)(T &))149 inline wxEventFunction wxEventFunctionCast(void (wxEvtHandler::*func)(T&))
150 {
151     // There is no going around the cast here: we do rely calling the event
152     // handler method, which takes a reference to an object of a class derived
153     // from wxEvent, as if it took wxEvent itself. On all platforms supported
154     // by wxWidgets, this cast is harmless, but it's not a valid cast in C++
155     // and gcc 8 started giving warnings about this (with -Wextra), so suppress
156     // them locally to avoid generating hundreds of them when compiling any
157     // code using event table macros.
158 
159     wxGCC_WARNING_SUPPRESS_CAST_FUNCTION_TYPE()
160 
161     return reinterpret_cast<wxEventFunction>(func);
162 
163     wxGCC_WARNING_RESTORE_CAST_FUNCTION_TYPE()
164 }
165 
166 // Try to cast the given event handler to the correct handler type:
167 
168 #define wxEVENT_HANDLER_CAST( functype, func ) \
169     wxEventFunctionCast(static_cast<functype>(&func))
170 
171 
172 #ifdef wxHAS_EVENT_BIND
173 
174 // The tag is a type associated to the event type (which is an integer itself,
175 // in spite of its name) value. It exists in order to be used as a template
176 // parameter and provide a mapping between the event type values and their
177 // corresponding wxEvent-derived classes.
178 template <typename T>
179 class wxEventTypeTag
180 {
181 public:
182     // The class of wxEvent-derived class carried by the events of this type.
183     typedef T EventClass;
184 
wxEventTypeTag(wxEventType type)185     wxEventTypeTag(wxEventType type) { m_type = type; }
186 
187     // Return a wxEventType reference for the initialization of the static
188     // event tables. See wxEventTableEntry::m_eventType for a more thorough
189     // explanation.
190     operator const wxEventType&() const { return m_type; }
191 
192 private:
193     wxEventType m_type;
194 };
195 
196 #endif // wxHAS_EVENT_BIND
197 
198 // These are needed for the functor definitions
199 typedef void (wxEvtHandler::*wxEventFunction)(wxEvent&);
200 
201 // We had some trouble (specifically with eVC for ARM WinCE build) with using
202 // wxEventFunction in the past so we had introduced wxObjectEventFunction which
203 // used to be a typedef for a member of wxObject and not wxEvtHandler to work
204 // around this but as eVC is not really supported any longer we now only keep
205 // this for backwards compatibility and, despite its name, this is a typedef
206 // for wxEvtHandler member now -- but if we have the same problem with another
207 // compiler we can restore its old definition for it.
208 typedef wxEventFunction wxObjectEventFunction;
209 
210 // The event functor which is stored in the static and dynamic event tables:
211 class WXDLLIMPEXP_BASE wxEventFunctor
212 {
213 public:
214     virtual ~wxEventFunctor();
215 
216     // Invoke the actual event handler:
217     virtual void operator()(wxEvtHandler *, wxEvent&) = 0;
218 
219     // this function tests whether this functor is matched, for the purpose of
220     // finding it in an event table in Unbind(), by the given functor:
221     virtual bool IsMatching(const wxEventFunctor& functor) const = 0;
222 
223     // If the functor holds an wxEvtHandler, then get access to it and track
224     // its lifetime with wxEventConnectionRef:
GetEvtHandler()225     virtual wxEvtHandler *GetEvtHandler() const
226         { return NULL; }
227 
228     // This is only used to maintain backward compatibility in
229     // wxAppConsoleBase::CallEventHandler and ensures that an overwritten
230     // wxAppConsoleBase::HandleEvent is still called for functors which hold an
231     // wxEventFunction:
GetEvtMethod()232     virtual wxEventFunction GetEvtMethod() const
233         { return NULL; }
234 
235 private:
236     WX_DECLARE_ABSTRACT_TYPEINFO(wxEventFunctor)
237 };
238 
239 // A plain method functor for the untyped legacy event types:
240 class WXDLLIMPEXP_BASE wxObjectEventFunctor : public wxEventFunctor
241 {
242 public:
wxObjectEventFunctor(wxObjectEventFunction method,wxEvtHandler * handler)243     wxObjectEventFunctor(wxObjectEventFunction method, wxEvtHandler *handler)
244         : m_handler( handler ), m_method( method )
245         { }
246 
247     virtual void operator()(wxEvtHandler *handler, wxEvent& event);
248 
IsMatching(const wxEventFunctor & functor)249     virtual bool IsMatching(const wxEventFunctor& functor) const
250     {
251         if ( wxTypeId(functor) == wxTypeId(*this) )
252         {
253             const wxObjectEventFunctor &other =
254                 static_cast< const wxObjectEventFunctor & >( functor );
255 
256             // FIXME-VC6: amazing but true: replacing "m_method == 0" here
257             // with "!m_method" makes VC6 crash with an ICE in DLL build (only!)
258             // Also notice that using "NULL" instead of "0" results in warnings
259             // about "using NULL in arithmetics" from arm-linux-androideabi-g++
260             // 4.4.3 used for wxAndroid build.
261 
262             return ( m_method == other.m_method || other.m_method == 0 ) &&
263                    ( m_handler == other.m_handler || other.m_handler == NULL );
264         }
265         else
266             return false;
267     }
268 
GetEvtHandler()269     virtual wxEvtHandler *GetEvtHandler() const
270         { return m_handler; }
271 
GetEvtMethod()272     virtual wxEventFunction GetEvtMethod() const
273         { return m_method; }
274 
275 private:
276     wxEvtHandler *m_handler;
277     wxEventFunction m_method;
278 
279     // Provide a dummy default ctor for type info purposes
wxObjectEventFunctor()280     wxObjectEventFunctor() { }
281 
282     WX_DECLARE_TYPEINFO_INLINE(wxObjectEventFunctor)
283 };
284 
285 // Create a functor for the legacy events: used by Connect()
286 inline wxObjectEventFunctor *
wxNewEventFunctor(const wxEventType & WXUNUSED (evtType),wxObjectEventFunction method,wxEvtHandler * handler)287 wxNewEventFunctor(const wxEventType& WXUNUSED(evtType),
288                   wxObjectEventFunction method,
289                   wxEvtHandler *handler)
290 {
291     return new wxObjectEventFunctor(method, handler);
292 }
293 
294 // This version is used by wxDECLARE_EVENT_TABLE_ENTRY()
295 inline wxObjectEventFunctor *
wxNewEventTableFunctor(const wxEventType & WXUNUSED (evtType),wxObjectEventFunction method)296 wxNewEventTableFunctor(const wxEventType& WXUNUSED(evtType),
297                        wxObjectEventFunction method)
298 {
299     return new wxObjectEventFunctor(method, NULL);
300 }
301 
302 inline wxObjectEventFunctor
wxMakeEventFunctor(const wxEventType & WXUNUSED (evtType),wxObjectEventFunction method,wxEvtHandler * handler)303 wxMakeEventFunctor(const wxEventType& WXUNUSED(evtType),
304                         wxObjectEventFunction method,
305                         wxEvtHandler *handler)
306 {
307     return wxObjectEventFunctor(method, handler);
308 }
309 
310 #ifdef wxHAS_EVENT_BIND
311 
312 namespace wxPrivate
313 {
314 
315 // helper template defining nested "type" typedef as the event class
316 // corresponding to the given event type
317 template <typename T> struct EventClassOf;
318 
319 // the typed events provide the information about the class of the events they
320 // carry themselves:
321 template <typename T>
322 struct EventClassOf< wxEventTypeTag<T> >
323 {
324     typedef typename wxEventTypeTag<T>::EventClass type;
325 };
326 
327 // for the old untyped events we don't have information about the exact event
328 // class carried by them
329 template <>
330 struct EventClassOf<wxEventType>
331 {
332     typedef wxEvent type;
333 };
334 
335 
336 // helper class defining operations different for method functors using an
337 // object of wxEvtHandler-derived class as handler and the others
338 template <typename T, typename A, bool> struct HandlerImpl;
339 
340 // specialization for handlers deriving from wxEvtHandler
341 template <typename T, typename A>
342 struct HandlerImpl<T, A, true>
343 {
344     static bool IsEvtHandler()
345         { return true; }
346     static T *ConvertFromEvtHandler(wxEvtHandler *p)
347         { return static_cast<T *>(p); }
348     static wxEvtHandler *ConvertToEvtHandler(T *p)
349         { return p; }
350     static wxEventFunction ConvertToEvtMethod(void (T::*f)(A&))
351         { return wxEventFunctionCast(
352                     static_cast<void (wxEvtHandler::*)(A&)>(f)); }
353 };
354 
355 // specialization for handlers not deriving from wxEvtHandler
356 template <typename T, typename A>
357 struct HandlerImpl<T, A, false>
358 {
359     static bool IsEvtHandler()
360         { return false; }
361     static T *ConvertFromEvtHandler(wxEvtHandler *)
362         { return NULL; }
363     static wxEvtHandler *ConvertToEvtHandler(T *)
364         { return NULL; }
365     static wxEventFunction ConvertToEvtMethod(void (T::*)(A&))
366         { return NULL; }
367 };
368 
369 } // namespace wxPrivate
370 
371 // functor forwarding the event to a method of the given object
372 //
373 // notice that the object class may be different from the class in which the
374 // method is defined but it must be convertible to this class
375 //
376 // also, the type of the handler parameter doesn't need to be exactly the same
377 // as EventTag::EventClass but it must be its base class -- this is explicitly
378 // allowed to handle different events in the same handler taking wxEvent&, for
379 // example
380 template
381   <typename EventTag, typename Class, typename EventArg, typename EventHandler>
382 class wxEventFunctorMethod
383     : public wxEventFunctor,
384       private wxPrivate::HandlerImpl
385               <
386                 Class,
387                 EventArg,
388                 wxConvertibleTo<Class, wxEvtHandler>::value != 0
389               >
390 {
391 private:
392     static void CheckHandlerArgument(EventArg *) { }
393 
394 public:
395     // the event class associated with the given event tag
396     typedef typename wxPrivate::EventClassOf<EventTag>::type EventClass;
397 
398 
399     wxEventFunctorMethod(void (Class::*method)(EventArg&), EventHandler *handler)
400         : m_handler( handler ), m_method( method )
401     {
402         wxASSERT_MSG( handler || this->IsEvtHandler(),
403                       "handlers defined in non-wxEvtHandler-derived classes "
404                       "must be connected with a valid sink object" );
405 
406         // if you get an error here it means that the signature of the handler
407         // you're trying to use is not compatible with (i.e. is not the same as
408         // or a base class of) the real event class used for this event type
409         CheckHandlerArgument(static_cast<EventClass *>(NULL));
410     }
411 
412     virtual void operator()(wxEvtHandler *handler, wxEvent& event)
413     {
414         Class * realHandler = m_handler;
415         if ( !realHandler )
416         {
417             realHandler = this->ConvertFromEvtHandler(handler);
418 
419             // this is not supposed to happen but check for it nevertheless
420             wxCHECK_RET( realHandler, "invalid event handler" );
421         }
422 
423         // the real (run-time) type of event is EventClass and we checked in
424         // the ctor that EventClass can be converted to EventArg, so this cast
425         // is always valid
426         (realHandler->*m_method)(static_cast<EventArg&>(event));
427     }
428 
429     virtual bool IsMatching(const wxEventFunctor& functor) const
430     {
431         if ( wxTypeId(functor) != wxTypeId(*this) )
432             return false;
433 
434         typedef wxEventFunctorMethod<EventTag, Class, EventArg, EventHandler>
435             ThisFunctor;
436 
437         // the cast is valid because wxTypeId()s matched above
438         const ThisFunctor& other = static_cast<const ThisFunctor &>(functor);
439 
440         return (m_method == other.m_method || other.m_method == NULL) &&
441                (m_handler == other.m_handler || other.m_handler == NULL);
442     }
443 
444     virtual wxEvtHandler *GetEvtHandler() const
445         { return this->ConvertToEvtHandler(m_handler); }
446 
447     virtual wxEventFunction GetEvtMethod() const
448         { return this->ConvertToEvtMethod(m_method); }
449 
450 private:
451     EventHandler *m_handler;
452     void (Class::*m_method)(EventArg&);
453 
454     // Provide a dummy default ctor for type info purposes
455     wxEventFunctorMethod() { }
456 
457     typedef wxEventFunctorMethod<EventTag, Class,
458                                  EventArg, EventHandler> thisClass;
459     WX_DECLARE_TYPEINFO_INLINE(thisClass)
460 };
461 
462 
463 // functor forwarding the event to function (function, static method)
464 template <typename EventTag, typename EventArg>
465 class wxEventFunctorFunction : public wxEventFunctor
466 {
467 private:
468     static void CheckHandlerArgument(EventArg *) { }
469 
470 public:
471     // the event class associated with the given event tag
472     typedef typename wxPrivate::EventClassOf<EventTag>::type EventClass;
473 
474     wxEventFunctorFunction( void ( *handler )( EventArg & ))
475         : m_handler( handler )
476     {
477         // if you get an error here it means that the signature of the handler
478         // you're trying to use is not compatible with (i.e. is not the same as
479         // or a base class of) the real event class used for this event type
480         CheckHandlerArgument(static_cast<EventClass *>(NULL));
481     }
482 
483     virtual void operator()(wxEvtHandler *WXUNUSED(handler), wxEvent& event)
484     {
485         // If you get an error here like "must use .* or ->* to call
486         // pointer-to-member function" then you probably tried to call
487         // Bind/Unbind with a method pointer but without a handler pointer or
488         // NULL as a handler e.g.:
489         // Unbind( wxEVT_XXX, &EventHandler::method );
490         // or
491         // Unbind( wxEVT_XXX, &EventHandler::method, NULL )
492         m_handler(static_cast<EventArg&>(event));
493     }
494 
495     virtual bool IsMatching(const wxEventFunctor &functor) const
496     {
497         if ( wxTypeId(functor) != wxTypeId(*this) )
498             return false;
499 
500         typedef wxEventFunctorFunction<EventTag, EventArg> ThisFunctor;
501 
502         const ThisFunctor& other = static_cast<const ThisFunctor&>( functor );
503 
504         return m_handler == other.m_handler;
505     }
506 
507 private:
508     void (*m_handler)(EventArg&);
509 
510     // Provide a dummy default ctor for type info purposes
511     wxEventFunctorFunction() { }
512 
513     typedef wxEventFunctorFunction<EventTag, EventArg> thisClass;
514     WX_DECLARE_TYPEINFO_INLINE(thisClass)
515 };
516 
517 
518 template <typename EventTag, typename Functor>
519 class wxEventFunctorFunctor : public wxEventFunctor
520 {
521 public:
522     typedef typename EventTag::EventClass EventArg;
523 
524     wxEventFunctorFunctor(const Functor& handler)
525         : m_handler(handler), m_handlerAddr(&handler)
526         { }
527 
528     virtual void operator()(wxEvtHandler *WXUNUSED(handler), wxEvent& event)
529     {
530         // If you get an error here like "must use '.*' or '->*' to call
531         // pointer-to-member function" then you probably tried to call
532         // Bind/Unbind with a method pointer but without a handler pointer or
533         // NULL as a handler e.g.:
534         // Unbind( wxEVT_XXX, &EventHandler::method );
535         // or
536         // Unbind( wxEVT_XXX, &EventHandler::method, NULL )
537         m_handler(static_cast<EventArg&>(event));
538     }
539 
540     virtual bool IsMatching(const wxEventFunctor &functor) const
541     {
542         if ( wxTypeId(functor) != wxTypeId(*this) )
543             return false;
544 
545         typedef wxEventFunctorFunctor<EventTag, Functor> FunctorThis;
546 
547         const FunctorThis& other = static_cast<const FunctorThis&>(functor);
548 
549         // The only reliable/portable way to compare two functors is by
550         // identity:
551         return m_handlerAddr == other.m_handlerAddr;
552     }
553 
554 private:
555     // Store a copy of the functor to prevent using/calling an already
556     // destroyed instance:
557     Functor m_handler;
558 
559     // Use the address of the original functor for comparison in IsMatching:
560     const void *m_handlerAddr;
561 
562     // Provide a dummy default ctor for type info purposes
563     wxEventFunctorFunctor() { }
564 
565     typedef wxEventFunctorFunctor<EventTag, Functor> thisClass;
566     WX_DECLARE_TYPEINFO_INLINE(thisClass)
567 };
568 
569 // Create functors for the templatized events, either allocated on the heap for
570 // wxNewXXX() variants (this is needed in wxEvtHandler::Bind<>() to store them
571 // in dynamic event table) or just by returning them as temporary objects (this
572 // is enough for Unbind<>() and we avoid unnecessary heap allocation like this).
573 
574 
575 // Create functors wrapping functions:
576 template <typename EventTag, typename EventArg>
577 inline wxEventFunctorFunction<EventTag, EventArg> *
578 wxNewEventFunctor(const EventTag&, void (*func)(EventArg &))
579 {
580     return new wxEventFunctorFunction<EventTag, EventArg>(func);
581 }
582 
583 template <typename EventTag, typename EventArg>
584 inline wxEventFunctorFunction<EventTag, EventArg>
585 wxMakeEventFunctor(const EventTag&, void (*func)(EventArg &))
586 {
587     return wxEventFunctorFunction<EventTag, EventArg>(func);
588 }
589 
590 // Create functors wrapping other functors:
591 template <typename EventTag, typename Functor>
592 inline wxEventFunctorFunctor<EventTag, Functor> *
593 wxNewEventFunctor(const EventTag&, const Functor &func)
594 {
595     return new wxEventFunctorFunctor<EventTag, Functor>(func);
596 }
597 
598 template <typename EventTag, typename Functor>
599 inline wxEventFunctorFunctor<EventTag, Functor>
600 wxMakeEventFunctor(const EventTag&, const Functor &func)
601 {
602     return wxEventFunctorFunctor<EventTag, Functor>(func);
603 }
604 
605 // Create functors wrapping methods:
606 template
607   <typename EventTag, typename Class, typename EventArg, typename EventHandler>
608 inline wxEventFunctorMethod<EventTag, Class, EventArg, EventHandler> *
609 wxNewEventFunctor(const EventTag&,
610                   void (Class::*method)(EventArg&),
611                   EventHandler *handler)
612 {
613     return new wxEventFunctorMethod<EventTag, Class, EventArg, EventHandler>(
614                 method, handler);
615 }
616 
617 template
618     <typename EventTag, typename Class, typename EventArg, typename EventHandler>
619 inline wxEventFunctorMethod<EventTag, Class, EventArg, EventHandler>
620 wxMakeEventFunctor(const EventTag&,
621                    void (Class::*method)(EventArg&),
622                    EventHandler *handler)
623 {
624     return wxEventFunctorMethod<EventTag, Class, EventArg, EventHandler>(
625                 method, handler);
626 }
627 
628 // Create an event functor for the event table via wxDECLARE_EVENT_TABLE_ENTRY:
629 // in this case we don't have the handler (as it's always the same as the
630 // object which generated the event) so we must use Class as its type
631 template <typename EventTag, typename Class, typename EventArg>
632 inline wxEventFunctorMethod<EventTag, Class, EventArg, Class> *
633 wxNewEventTableFunctor(const EventTag&, void (Class::*method)(EventArg&))
634 {
635     return new wxEventFunctorMethod<EventTag, Class, EventArg, Class>(
636                     method, NULL);
637 }
638 
639 #endif // wxHAS_EVENT_BIND
640 
641 
642 // many, but not all, standard event types
643 
644     // some generic events
645 extern WXDLLIMPEXP_BASE const wxEventType wxEVT_NULL;
646 extern WXDLLIMPEXP_BASE const wxEventType wxEVT_FIRST;
647 extern WXDLLIMPEXP_BASE const wxEventType wxEVT_USER_FIRST;
648 
649     // Need events declared to do this
650 class WXDLLIMPEXP_FWD_BASE wxIdleEvent;
651 class WXDLLIMPEXP_FWD_BASE wxThreadEvent;
652 class WXDLLIMPEXP_FWD_BASE wxAsyncMethodCallEvent;
653 class WXDLLIMPEXP_FWD_CORE wxCommandEvent;
654 class WXDLLIMPEXP_FWD_CORE wxMouseEvent;
655 class WXDLLIMPEXP_FWD_CORE wxFocusEvent;
656 class WXDLLIMPEXP_FWD_CORE wxChildFocusEvent;
657 class WXDLLIMPEXP_FWD_CORE wxKeyEvent;
658 class WXDLLIMPEXP_FWD_CORE wxNavigationKeyEvent;
659 class WXDLLIMPEXP_FWD_CORE wxSetCursorEvent;
660 class WXDLLIMPEXP_FWD_CORE wxScrollEvent;
661 class WXDLLIMPEXP_FWD_CORE wxSpinEvent;
662 class WXDLLIMPEXP_FWD_CORE wxScrollWinEvent;
663 class WXDLLIMPEXP_FWD_CORE wxSizeEvent;
664 class WXDLLIMPEXP_FWD_CORE wxMoveEvent;
665 class WXDLLIMPEXP_FWD_CORE wxCloseEvent;
666 class WXDLLIMPEXP_FWD_CORE wxActivateEvent;
667 class WXDLLIMPEXP_FWD_CORE wxWindowCreateEvent;
668 class WXDLLIMPEXP_FWD_CORE wxWindowDestroyEvent;
669 class WXDLLIMPEXP_FWD_CORE wxShowEvent;
670 class WXDLLIMPEXP_FWD_CORE wxIconizeEvent;
671 class WXDLLIMPEXP_FWD_CORE wxMaximizeEvent;
672 class WXDLLIMPEXP_FWD_CORE wxMouseCaptureChangedEvent;
673 class WXDLLIMPEXP_FWD_CORE wxMouseCaptureLostEvent;
674 class WXDLLIMPEXP_FWD_CORE wxPaintEvent;
675 class WXDLLIMPEXP_FWD_CORE wxEraseEvent;
676 class WXDLLIMPEXP_FWD_CORE wxNcPaintEvent;
677 class WXDLLIMPEXP_FWD_CORE wxMenuEvent;
678 class WXDLLIMPEXP_FWD_CORE wxContextMenuEvent;
679 class WXDLLIMPEXP_FWD_CORE wxSysColourChangedEvent;
680 class WXDLLIMPEXP_FWD_CORE wxDisplayChangedEvent;
681 class WXDLLIMPEXP_FWD_CORE wxQueryNewPaletteEvent;
682 class WXDLLIMPEXP_FWD_CORE wxPaletteChangedEvent;
683 class WXDLLIMPEXP_FWD_CORE wxJoystickEvent;
684 class WXDLLIMPEXP_FWD_CORE wxDropFilesEvent;
685 class WXDLLIMPEXP_FWD_CORE wxInitDialogEvent;
686 class WXDLLIMPEXP_FWD_CORE wxUpdateUIEvent;
687 class WXDLLIMPEXP_FWD_CORE wxClipboardTextEvent;
688 class WXDLLIMPEXP_FWD_CORE wxHelpEvent;
689 
690 
691     // Command events
692 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_BUTTON, wxCommandEvent);
693 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CHECKBOX, wxCommandEvent);
694 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CHOICE, wxCommandEvent);
695 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_LISTBOX, wxCommandEvent);
696 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_LISTBOX_DCLICK, wxCommandEvent);
697 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CHECKLISTBOX, wxCommandEvent);
698 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MENU, wxCommandEvent);
699 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SLIDER, wxCommandEvent);
700 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_RADIOBOX, wxCommandEvent);
701 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_RADIOBUTTON, wxCommandEvent);
702 
703 // wxEVT_SCROLLBAR is deprecated, use wxEVT_SCROLL... events
704 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLBAR, wxCommandEvent);
705 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_VLBOX, wxCommandEvent);
706 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMBOBOX, wxCommandEvent);
707 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_TOOL_RCLICKED, wxCommandEvent);
708 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_TOOL_DROPDOWN, wxCommandEvent);
709 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_TOOL_ENTER, wxCommandEvent);
710 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMBOBOX_DROPDOWN, wxCommandEvent);
711 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMBOBOX_CLOSEUP, wxCommandEvent);
712 
713     // Thread and asynchronous method call events
714 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_BASE, wxEVT_THREAD, wxThreadEvent);
715 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_BASE, wxEVT_ASYNC_METHOD_CALL, wxAsyncMethodCallEvent);
716 
717     // Mouse event types
718 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_LEFT_DOWN, wxMouseEvent);
719 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_LEFT_UP, wxMouseEvent);
720 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MIDDLE_DOWN, wxMouseEvent);
721 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MIDDLE_UP, wxMouseEvent);
722 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_RIGHT_DOWN, wxMouseEvent);
723 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_RIGHT_UP, wxMouseEvent);
724 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOTION, wxMouseEvent);
725 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_ENTER_WINDOW, wxMouseEvent);
726 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_LEAVE_WINDOW, wxMouseEvent);
727 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_LEFT_DCLICK, wxMouseEvent);
728 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MIDDLE_DCLICK, wxMouseEvent);
729 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_RIGHT_DCLICK, wxMouseEvent);
730 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SET_FOCUS, wxFocusEvent);
731 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_KILL_FOCUS, wxFocusEvent);
732 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CHILD_FOCUS, wxChildFocusEvent);
733 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOUSEWHEEL, wxMouseEvent);
734 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX1_DOWN, wxMouseEvent);
735 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX1_UP, wxMouseEvent);
736 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX1_DCLICK, wxMouseEvent);
737 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX2_DOWN, wxMouseEvent);
738 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX2_UP, wxMouseEvent);
739 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX2_DCLICK, wxMouseEvent);
740 
741     // Character input event type
742 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CHAR, wxKeyEvent);
743 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CHAR_HOOK, wxKeyEvent);
744 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_NAVIGATION_KEY, wxNavigationKeyEvent);
745 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_KEY_DOWN, wxKeyEvent);
746 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_KEY_UP, wxKeyEvent);
747 #if wxUSE_HOTKEY
748 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_HOTKEY, wxKeyEvent);
749 #endif
750 // This is a private event used by wxMSW code only and subject to change or
751 // disappear in the future. Don't use.
752 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AFTER_CHAR, wxKeyEvent);
753 
754     // Set cursor event
755 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SET_CURSOR, wxSetCursorEvent);
756 
757     // wxScrollBar and wxSlider event identifiers
758 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_TOP, wxScrollEvent);
759 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_BOTTOM, wxScrollEvent);
760 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_LINEUP, wxScrollEvent);
761 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_LINEDOWN, wxScrollEvent);
762 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_PAGEUP, wxScrollEvent);
763 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_PAGEDOWN, wxScrollEvent);
764 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_THUMBTRACK, wxScrollEvent);
765 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_THUMBRELEASE, wxScrollEvent);
766 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_CHANGED, wxScrollEvent);
767 
768 // Due to a bug in older wx versions, wxSpinEvents were being sent with type of
769 // wxEVT_SCROLL_LINEUP, wxEVT_SCROLL_LINEDOWN and wxEVT_SCROLL_THUMBTRACK. But
770 // with the type-safe events in place, these event types are associated with
771 // wxScrollEvent. To allow handling of spin events, new event types have been
772 // defined in spinbutt.h/spinnbuttcmn.cpp. To maintain backward compatibility
773 // the spin event types are being initialized with the scroll event types.
774 
775 #if wxUSE_SPINBTN
776 
777 wxDECLARE_EXPORTED_EVENT_ALIAS( WXDLLIMPEXP_CORE, wxEVT_SPIN_UP,   wxSpinEvent );
778 wxDECLARE_EXPORTED_EVENT_ALIAS( WXDLLIMPEXP_CORE, wxEVT_SPIN_DOWN, wxSpinEvent );
779 wxDECLARE_EXPORTED_EVENT_ALIAS( WXDLLIMPEXP_CORE, wxEVT_SPIN,      wxSpinEvent );
780 
781 #endif
782 
783     // Scroll events from wxWindow
784 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_TOP, wxScrollWinEvent);
785 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_BOTTOM, wxScrollWinEvent);
786 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_LINEUP, wxScrollWinEvent);
787 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_LINEDOWN, wxScrollWinEvent);
788 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_PAGEUP, wxScrollWinEvent);
789 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_PAGEDOWN, wxScrollWinEvent);
790 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_THUMBTRACK, wxScrollWinEvent);
791 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_THUMBRELEASE, wxScrollWinEvent);
792 
793     // System events
794 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SIZE, wxSizeEvent);
795 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOVE, wxMoveEvent);
796 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CLOSE_WINDOW, wxCloseEvent);
797 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_END_SESSION, wxCloseEvent);
798 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_QUERY_END_SESSION, wxCloseEvent);
799 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_ACTIVATE_APP, wxActivateEvent);
800 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_ACTIVATE, wxActivateEvent);
801 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CREATE, wxWindowCreateEvent);
802 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_DESTROY, wxWindowDestroyEvent);
803 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SHOW, wxShowEvent);
804 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_ICONIZE, wxIconizeEvent);
805 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MAXIMIZE, wxMaximizeEvent);
806 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOUSE_CAPTURE_CHANGED, wxMouseCaptureChangedEvent);
807 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOUSE_CAPTURE_LOST, wxMouseCaptureLostEvent);
808 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_PAINT, wxPaintEvent);
809 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_ERASE_BACKGROUND, wxEraseEvent);
810 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_NC_PAINT, wxNcPaintEvent);
811 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MENU_OPEN, wxMenuEvent);
812 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MENU_CLOSE, wxMenuEvent);
813 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MENU_HIGHLIGHT, wxMenuEvent);
814 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CONTEXT_MENU, wxContextMenuEvent);
815 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SYS_COLOUR_CHANGED, wxSysColourChangedEvent);
816 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_DISPLAY_CHANGED, wxDisplayChangedEvent);
817 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_QUERY_NEW_PALETTE, wxQueryNewPaletteEvent);
818 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_PALETTE_CHANGED, wxPaletteChangedEvent);
819 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_JOY_BUTTON_DOWN, wxJoystickEvent);
820 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_JOY_BUTTON_UP, wxJoystickEvent);
821 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_JOY_MOVE, wxJoystickEvent);
822 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_JOY_ZMOVE, wxJoystickEvent);
823 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_DROP_FILES, wxDropFilesEvent);
824 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_INIT_DIALOG, wxInitDialogEvent);
825 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_BASE, wxEVT_IDLE, wxIdleEvent);
826 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_UPDATE_UI, wxUpdateUIEvent);
827 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SIZING, wxSizeEvent);
828 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOVING, wxMoveEvent);
829 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOVE_START, wxMoveEvent);
830 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOVE_END, wxMoveEvent);
831 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_HIBERNATE, wxActivateEvent);
832 
833     // Clipboard events
834 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_TEXT_COPY, wxClipboardTextEvent);
835 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_TEXT_CUT, wxClipboardTextEvent);
836 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_TEXT_PASTE, wxClipboardTextEvent);
837 
838     // Generic command events
839     // Note: a click is a higher-level event than button down/up
840 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_LEFT_CLICK, wxCommandEvent);
841 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_LEFT_DCLICK, wxCommandEvent);
842 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_RIGHT_CLICK, wxCommandEvent);
843 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_RIGHT_DCLICK, wxCommandEvent);
844 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_SET_FOCUS, wxCommandEvent);
845 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_KILL_FOCUS, wxCommandEvent);
846 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_ENTER, wxCommandEvent);
847 
848     // Help events
849 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_HELP, wxHelpEvent);
850 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_DETAILED_HELP, wxHelpEvent);
851 
852 // these 2 events are the same
853 #define wxEVT_TOOL wxEVT_MENU
854 
855 // ----------------------------------------------------------------------------
856 // Compatibility
857 // ----------------------------------------------------------------------------
858 
859 // this event is also used by wxComboBox and wxSpinCtrl which don't include
860 // wx/textctrl.h in all ports [yet], so declare it here as well
861 //
862 // still, any new code using it should include wx/textctrl.h explicitly
863 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_TEXT, wxCommandEvent);
864 
865 
866 // ----------------------------------------------------------------------------
867 // wxEvent(-derived) classes
868 // ----------------------------------------------------------------------------
869 
870 // the predefined constants for the number of times we propagate event
871 // upwards window child-parent chain
872 enum wxEventPropagation
873 {
874     // don't propagate it at all
875     wxEVENT_PROPAGATE_NONE = 0,
876 
877     // propagate it until it is processed
878     wxEVENT_PROPAGATE_MAX = INT_MAX
879 };
880 
881 // The different categories for a wxEvent; see wxEvent::GetEventCategory.
882 // NOTE: they are used as OR-combinable flags by wxEventLoopBase::YieldFor
883 enum wxEventCategory
884 {
885     // this is the category for those events which are generated to update
886     // the appearance of the GUI but which (usually) do not comport data
887     // processing, i.e. which do not provide input or output data
888     // (e.g. size events, scroll events, etc).
889     // They are events NOT directly generated by the user's input devices.
890     wxEVT_CATEGORY_UI = 1,
891 
892     // this category groups those events which are generated directly from the
893     // user through input devices like mouse and keyboard and usually result in
894     // data to be processed from the application.
895     // (e.g. mouse clicks, key presses, etc)
896     wxEVT_CATEGORY_USER_INPUT = 2,
897 
898     // this category is for wxSocketEvent
899     wxEVT_CATEGORY_SOCKET = 4,
900 
901     // this category is for wxTimerEvent
902     wxEVT_CATEGORY_TIMER = 8,
903 
904     // this category is for any event used to send notifications from the
905     // secondary threads to the main one or in general for notifications among
906     // different threads (which may or may not be user-generated)
907     wxEVT_CATEGORY_THREAD = 16,
908 
909 
910     // implementation only
911 
912     // used in the implementations of wxEventLoopBase::YieldFor
913     wxEVT_CATEGORY_UNKNOWN = 32,
914 
915     // a special category used as an argument to wxEventLoopBase::YieldFor to indicate that
916     // Yield() should leave all wxEvents on the queue while emptying the native event queue
917     // (native events will be processed but the wxEvents they generate will be queued)
918     wxEVT_CATEGORY_CLIPBOARD = 64,
919 
920 
921     // shortcut masks
922 
923     // this category groups those events which are emitted in response to
924     // events of the native toolkit and which typically are not-"delayable".
925     wxEVT_CATEGORY_NATIVE_EVENTS = wxEVT_CATEGORY_UI|wxEVT_CATEGORY_USER_INPUT,
926 
927     // used in wxEventLoopBase::YieldFor to specify all event categories should be processed:
928     wxEVT_CATEGORY_ALL =
929         wxEVT_CATEGORY_UI|wxEVT_CATEGORY_USER_INPUT|wxEVT_CATEGORY_SOCKET| \
930         wxEVT_CATEGORY_TIMER|wxEVT_CATEGORY_THREAD|wxEVT_CATEGORY_UNKNOWN| \
931         wxEVT_CATEGORY_CLIPBOARD
932 };
933 
934 /*
935  * wxWidgets events, covering all interesting things that might happen
936  * (button clicking, resizing, setting text in widgets, etc.).
937  *
938  * For each completely new event type, derive a new event class.
939  * An event CLASS represents a C++ class defining a range of similar event TYPES;
940  * examples are canvas events, panel item command events.
941  * An event TYPE is a unique identifier for a particular system event,
942  * such as a button press or a listbox deselection.
943  *
944  */
945 
946 class WXDLLIMPEXP_BASE wxEvent : public wxObject
947 {
948 public:
949     wxEvent(int winid = 0, wxEventType commandType = wxEVT_NULL );
950 
951     void SetEventType(wxEventType typ) { m_eventType = typ; }
952     wxEventType GetEventType() const { return m_eventType; }
953 
954     wxObject *GetEventObject() const { return m_eventObject; }
955     void SetEventObject(wxObject *obj) { m_eventObject = obj; }
956 
957     long GetTimestamp() const { return m_timeStamp; }
958     void SetTimestamp(long ts = 0) { m_timeStamp = ts; }
959 
960     int GetId() const { return m_id; }
961     void SetId(int Id) { m_id = Id; }
962 
963     // Returns the user data optionally associated with the event handler when
964     // using Connect() or Bind().
965     wxObject *GetEventUserData() const { return m_callbackUserData; }
966 
967     // Can instruct event processor that we wish to ignore this event
968     // (treat as if the event table entry had not been found): this must be done
969     // to allow the event processing by the base classes (calling event.Skip()
970     // is the analog of calling the base class version of a virtual function)
971     void Skip(bool skip = true) { m_skipped = skip; }
972     bool GetSkipped() const { return m_skipped; }
973 
974     // This function is used to create a copy of the event polymorphically and
975     // all derived classes must implement it because otherwise wxPostEvent()
976     // for them wouldn't work (it needs to do a copy of the event)
977     virtual wxEvent *Clone() const = 0;
978 
979     // this function is used to selectively process events in wxEventLoopBase::YieldFor
980     // NOTE: by default it returns wxEVT_CATEGORY_UI just because the major
981     //       part of wxWidgets events belong to that category.
982     virtual wxEventCategory GetEventCategory() const
983         { return wxEVT_CATEGORY_UI; }
984 
985     // Implementation only: this test is explicitly anti OO and this function
986     // exists only for optimization purposes.
987     bool IsCommandEvent() const { return m_isCommandEvent; }
988 
989     // Determine if this event should be propagating to the parent window.
990     bool ShouldPropagate() const
991         { return m_propagationLevel != wxEVENT_PROPAGATE_NONE; }
992 
993     // Stop an event from propagating to its parent window, returns the old
994     // propagation level value
995     int StopPropagation()
996     {
997         int propagationLevel = m_propagationLevel;
998         m_propagationLevel = wxEVENT_PROPAGATE_NONE;
999         return propagationLevel;
1000     }
1001 
1002     // Resume the event propagation by restoring the propagation level
1003     // (returned by StopPropagation())
1004     void ResumePropagation(int propagationLevel)
1005     {
1006         m_propagationLevel = propagationLevel;
1007     }
1008 
1009     // This method is for internal use only and allows to get the object that
1010     // is propagating this event upwards the window hierarchy, if any.
1011     wxEvtHandler* GetPropagatedFrom() const { return m_propagatedFrom; }
1012 
1013     // This is for internal use only and is only called by
1014     // wxEvtHandler::ProcessEvent() to check whether it's the first time this
1015     // event is being processed
1016     bool WasProcessed()
1017     {
1018         if ( m_wasProcessed )
1019             return true;
1020 
1021         m_wasProcessed = true;
1022 
1023         return false;
1024     }
1025 
1026     // This is for internal use only and is used for setting, testing and
1027     // resetting of m_willBeProcessedAgain flag.
1028     void SetWillBeProcessedAgain()
1029     {
1030         m_willBeProcessedAgain = true;
1031     }
1032 
1033     bool WillBeProcessedAgain()
1034     {
1035         if ( m_willBeProcessedAgain )
1036         {
1037             m_willBeProcessedAgain = false;
1038             return true;
1039         }
1040 
1041         return false;
1042     }
1043 
1044     // This is also used only internally by ProcessEvent() to check if it
1045     // should process the event normally or only restrict the search for the
1046     // event handler to this object itself.
1047     bool ShouldProcessOnlyIn(wxEvtHandler *h) const
1048     {
1049         return h == m_handlerToProcessOnlyIn;
1050     }
1051 
1052     // Called to indicate that the result of ShouldProcessOnlyIn() wasn't taken
1053     // into account. The existence of this function may seem counterintuitive
1054     // but unfortunately it's needed by wxScrollHelperEvtHandler, see comments
1055     // there. Don't even think of using this in your own code, this is a gross
1056     // hack and is only needed because of wx complicated history and should
1057     // never be used anywhere else.
1058     void DidntHonourProcessOnlyIn()
1059     {
1060         m_handlerToProcessOnlyIn = NULL;
1061     }
1062 
1063 protected:
1064     wxObject*         m_eventObject;
1065     wxEventType       m_eventType;
1066     long              m_timeStamp;
1067     int               m_id;
1068 
1069 public:
1070     // m_callbackUserData is for internal usage only
1071     wxObject*         m_callbackUserData;
1072 
1073 private:
1074     // If this handler
1075     wxEvtHandler *m_handlerToProcessOnlyIn;
1076 
1077 protected:
1078     // the propagation level: while it is positive, we propagate the event to
1079     // the parent window (if any)
1080     int               m_propagationLevel;
1081 
1082     // The object that the event is being propagated from, initially NULL and
1083     // only set by wxPropagateOnce.
1084     wxEvtHandler*     m_propagatedFrom;
1085 
1086     bool              m_skipped;
1087     bool              m_isCommandEvent;
1088 
1089     // initially false but becomes true as soon as WasProcessed() is called for
1090     // the first time, as this is done only by ProcessEvent() it explains the
1091     // variable name: it becomes true after ProcessEvent() was called at least
1092     // once for this event
1093     bool m_wasProcessed;
1094 
1095     // This one is initially false too, but can be set to true to indicate that
1096     // the event will be passed to another handler if it's not processed in
1097     // this one.
1098     bool m_willBeProcessedAgain;
1099 
1100 protected:
1101     wxEvent(const wxEvent&);            // for implementing Clone()
1102     wxEvent& operator=(const wxEvent&); // for derived classes operator=()
1103 
1104 private:
1105     // It needs to access our m_propagationLevel and m_propagatedFrom fields.
1106     friend class WXDLLIMPEXP_FWD_BASE wxPropagateOnce;
1107 
1108     // and this one needs to access our m_handlerToProcessOnlyIn
1109     friend class WXDLLIMPEXP_FWD_BASE wxEventProcessInHandlerOnly;
1110 
1111 
1112     DECLARE_ABSTRACT_CLASS(wxEvent)
1113 };
1114 
1115 /*
1116  * Helper class to temporarily change an event not to propagate.
1117  */
1118 class WXDLLIMPEXP_BASE wxPropagationDisabler
1119 {
1120 public:
1121     wxPropagationDisabler(wxEvent& event) : m_event(event)
1122     {
1123         m_propagationLevelOld = m_event.StopPropagation();
1124     }
1125 
1126     ~wxPropagationDisabler()
1127     {
1128         m_event.ResumePropagation(m_propagationLevelOld);
1129     }
1130 
1131 private:
1132     wxEvent& m_event;
1133     int m_propagationLevelOld;
1134 
1135     wxDECLARE_NO_COPY_CLASS(wxPropagationDisabler);
1136 };
1137 
1138 /*
1139  * Helper used to indicate that an event is propagated upwards the window
1140  * hierarchy by the given window.
1141  */
1142 class WXDLLIMPEXP_BASE wxPropagateOnce
1143 {
1144 public:
1145     // The handler argument should normally be non-NULL to allow the parent
1146     // event handler to know that it's being used to process an event coming
1147     // from the child, it's only NULL by default for backwards compatibility.
1148     wxPropagateOnce(wxEvent& event, wxEvtHandler* handler = NULL)
1149         : m_event(event),
1150           m_propagatedFromOld(event.m_propagatedFrom)
1151     {
1152         wxASSERT_MSG( m_event.m_propagationLevel > 0,
1153                         wxT("shouldn't be used unless ShouldPropagate()!") );
1154 
1155         m_event.m_propagationLevel--;
1156         m_event.m_propagatedFrom = handler;
1157     }
1158 
1159     ~wxPropagateOnce()
1160     {
1161         m_event.m_propagatedFrom = m_propagatedFromOld;
1162         m_event.m_propagationLevel++;
1163     }
1164 
1165 private:
1166     wxEvent& m_event;
1167     wxEvtHandler* const m_propagatedFromOld;
1168 
1169     wxDECLARE_NO_COPY_CLASS(wxPropagateOnce);
1170 };
1171 
1172 // A helper object used to temporarily make wxEvent::ShouldProcessOnlyIn()
1173 // return true for the handler passed to its ctor.
1174 class wxEventProcessInHandlerOnly
1175 {
1176 public:
1177     wxEventProcessInHandlerOnly(wxEvent& event, wxEvtHandler *handler)
1178         : m_event(event),
1179           m_handlerToProcessOnlyInOld(event.m_handlerToProcessOnlyIn)
1180     {
1181         m_event.m_handlerToProcessOnlyIn = handler;
1182     }
1183 
1184     ~wxEventProcessInHandlerOnly()
1185     {
1186         m_event.m_handlerToProcessOnlyIn = m_handlerToProcessOnlyInOld;
1187     }
1188 
1189 private:
1190     wxEvent& m_event;
1191     wxEvtHandler * const m_handlerToProcessOnlyInOld;
1192 
1193     wxDECLARE_NO_COPY_CLASS(wxEventProcessInHandlerOnly);
1194 };
1195 
1196 
1197 class WXDLLIMPEXP_BASE wxEventBasicPayloadMixin
1198 {
1199 public:
1200     wxEventBasicPayloadMixin()
1201         : m_commandInt(0),
1202           m_extraLong(0)
1203     {
1204     }
1205 
1206     void SetString(const wxString& s) { m_cmdString = s; }
1207     const wxString& GetString() const { return m_cmdString; }
1208 
1209     void SetInt(int i) { m_commandInt = i; }
1210     int GetInt() const { return m_commandInt; }
1211 
1212     void SetExtraLong(long extraLong) { m_extraLong = extraLong; }
1213     long GetExtraLong() const { return m_extraLong; }
1214 
1215 protected:
1216     // Note: these variables have "cmd" or "command" in their name for backward compatibility:
1217     //       they used to be part of wxCommandEvent, not this mixin.
1218     wxString          m_cmdString;     // String event argument
1219     int               m_commandInt;
1220     long              m_extraLong;     // Additional information (e.g. select/deselect)
1221 
1222     wxDECLARE_NO_ASSIGN_CLASS(wxEventBasicPayloadMixin);
1223 };
1224 
1225 class WXDLLIMPEXP_BASE wxEventAnyPayloadMixin : public wxEventBasicPayloadMixin
1226 {
1227 public:
1228     wxEventAnyPayloadMixin() : wxEventBasicPayloadMixin() {}
1229 
1230 #if wxUSE_ANY && (!defined(__VISUALC__) || wxCHECK_VISUALC_VERSION(7))
1231     template<typename T>
1232     void SetPayload(const T& payload)
1233     {
1234         m_payload = payload;
1235     }
1236 
1237     template<typename T>
1238     T GetPayload() const
1239     {
1240         return m_payload.As<T>();
1241     }
1242 
1243 protected:
1244     wxAny m_payload;
1245 #endif // wxUSE_ANY && (!defined(__VISUALC__) || wxCHECK_VISUALC_VERSION(7))
1246 
1247     wxDECLARE_NO_ASSIGN_CLASS(wxEventBasicPayloadMixin);
1248 };
1249 
1250 
1251 // Idle event
1252 /*
1253  wxEVT_IDLE
1254  */
1255 
1256 // Whether to always send idle events to windows, or
1257 // to only send update events to those with the
1258 // wxWS_EX_PROCESS_IDLE style.
1259 
1260 enum wxIdleMode
1261 {
1262         // Send idle events to all windows
1263     wxIDLE_PROCESS_ALL,
1264 
1265         // Send idle events to windows that have
1266         // the wxWS_EX_PROCESS_IDLE flag specified
1267     wxIDLE_PROCESS_SPECIFIED
1268 };
1269 
1270 class WXDLLIMPEXP_BASE wxIdleEvent : public wxEvent
1271 {
1272 public:
1273     wxIdleEvent()
1274         : wxEvent(0, wxEVT_IDLE),
1275           m_requestMore(false)
1276         { }
1277     wxIdleEvent(const wxIdleEvent& event)
1278         : wxEvent(event),
1279           m_requestMore(event.m_requestMore)
1280     { }
1281 
1282     void RequestMore(bool needMore = true) { m_requestMore = needMore; }
1283     bool MoreRequested() const { return m_requestMore; }
1284 
1285     virtual wxEvent *Clone() const { return new wxIdleEvent(*this); }
1286 
1287     // Specify how wxWidgets will send idle events: to
1288     // all windows, or only to those which specify that they
1289     // will process the events.
1290     static void SetMode(wxIdleMode mode) { sm_idleMode = mode; }
1291 
1292     // Returns the idle event mode
1293     static wxIdleMode GetMode() { return sm_idleMode; }
1294 
1295 protected:
1296     bool m_requestMore;
1297     static wxIdleMode sm_idleMode;
1298 
1299 private:
1300     DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxIdleEvent)
1301 };
1302 
1303 
1304 // Thread event
1305 
1306 class WXDLLIMPEXP_BASE wxThreadEvent : public wxEvent,
1307                                        public wxEventAnyPayloadMixin
1308 {
1309 public:
1310     wxThreadEvent(wxEventType eventType = wxEVT_THREAD, int id = wxID_ANY)
1311         : wxEvent(id, eventType)
1312         { }
1313 
1314     wxThreadEvent(const wxThreadEvent& event)
1315         : wxEvent(event),
1316           wxEventAnyPayloadMixin(event)
1317     {
1318         // make sure our string member (which uses COW, aka refcounting) is not
1319         // shared by other wxString instances:
1320         SetString(GetString().Clone());
1321     }
1322 
1323     virtual wxEvent *Clone() const
1324     {
1325         return new wxThreadEvent(*this);
1326     }
1327 
1328     // this is important to avoid that calling wxEventLoopBase::YieldFor thread events
1329     // gets processed when this is unwanted:
1330     virtual wxEventCategory GetEventCategory() const
1331         { return wxEVT_CATEGORY_THREAD; }
1332 
1333 private:
1334     DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxThreadEvent)
1335 };
1336 
1337 
1338 // Asynchronous method call events: these event are processed by wxEvtHandler
1339 // itself and result in a call to its Execute() method which simply calls the
1340 // specified method. The difference with a simple method call is that this is
1341 // done asynchronously, i.e. at some later time, instead of immediately when
1342 // the event object is constructed.
1343 
1344 #ifdef wxHAS_CALL_AFTER
1345 
1346 // This is a base class used to process all method calls.
1347 class wxAsyncMethodCallEvent : public wxEvent
1348 {
1349 public:
1350     wxAsyncMethodCallEvent(wxObject* object)
1351         : wxEvent(wxID_ANY, wxEVT_ASYNC_METHOD_CALL)
1352     {
1353         SetEventObject(object);
1354     }
1355 
1356     wxAsyncMethodCallEvent(const wxAsyncMethodCallEvent& other)
1357         : wxEvent(other)
1358     {
1359     }
1360 
1361     virtual void Execute() = 0;
1362 };
1363 
1364 // This is a version for calling methods without parameters.
1365 template <typename T>
1366 class wxAsyncMethodCallEvent0 : public wxAsyncMethodCallEvent
1367 {
1368 public:
1369     typedef T ObjectType;
1370     typedef void (ObjectType::*MethodType)();
1371 
1372     wxAsyncMethodCallEvent0(ObjectType* object,
1373                             MethodType method)
1374         : wxAsyncMethodCallEvent(object),
1375           m_object(object),
1376           m_method(method)
1377     {
1378     }
1379 
1380     wxAsyncMethodCallEvent0(const wxAsyncMethodCallEvent0& other)
1381         : wxAsyncMethodCallEvent(other),
1382           m_object(other.m_object),
1383           m_method(other.m_method)
1384     {
1385     }
1386 
1387     virtual wxEvent *Clone() const
1388     {
1389         return new wxAsyncMethodCallEvent0(*this);
1390     }
1391 
1392     virtual void Execute()
1393     {
1394         (m_object->*m_method)();
1395     }
1396 
1397 private:
1398     ObjectType* const m_object;
1399     const MethodType m_method;
1400 };
1401 
1402 // This is a version for calling methods with a single parameter.
1403 template <typename T, typename T1>
1404 class wxAsyncMethodCallEvent1 : public wxAsyncMethodCallEvent
1405 {
1406 public:
1407     typedef T ObjectType;
1408     typedef void (ObjectType::*MethodType)(T1 x1);
1409     typedef typename wxRemoveRef<T1>::type ParamType1;
1410 
1411     wxAsyncMethodCallEvent1(ObjectType* object,
1412                             MethodType method,
1413                             const ParamType1& x1)
1414         : wxAsyncMethodCallEvent(object),
1415           m_object(object),
1416           m_method(method),
1417           m_param1(x1)
1418     {
1419     }
1420 
1421     wxAsyncMethodCallEvent1(const wxAsyncMethodCallEvent1& other)
1422         : wxAsyncMethodCallEvent(other),
1423           m_object(other.m_object),
1424           m_method(other.m_method),
1425           m_param1(other.m_param1)
1426     {
1427     }
1428 
1429     virtual wxEvent *Clone() const
1430     {
1431         return new wxAsyncMethodCallEvent1(*this);
1432     }
1433 
1434     virtual void Execute()
1435     {
1436         (m_object->*m_method)(m_param1);
1437     }
1438 
1439 private:
1440     ObjectType* const m_object;
1441     const MethodType m_method;
1442     const ParamType1 m_param1;
1443 };
1444 
1445 // This is a version for calling methods with two parameters.
1446 template <typename T, typename T1, typename T2>
1447 class wxAsyncMethodCallEvent2 : public wxAsyncMethodCallEvent
1448 {
1449 public:
1450     typedef T ObjectType;
1451     typedef void (ObjectType::*MethodType)(T1 x1, T2 x2);
1452     typedef typename wxRemoveRef<T1>::type ParamType1;
1453     typedef typename wxRemoveRef<T2>::type ParamType2;
1454 
1455     wxAsyncMethodCallEvent2(ObjectType* object,
1456                             MethodType method,
1457                             const ParamType1& x1,
1458                             const ParamType2& x2)
1459         : wxAsyncMethodCallEvent(object),
1460           m_object(object),
1461           m_method(method),
1462           m_param1(x1),
1463           m_param2(x2)
1464     {
1465     }
1466 
1467     wxAsyncMethodCallEvent2(const wxAsyncMethodCallEvent2& other)
1468         : wxAsyncMethodCallEvent(other),
1469           m_object(other.m_object),
1470           m_method(other.m_method),
1471           m_param1(other.m_param1),
1472           m_param2(other.m_param2)
1473     {
1474     }
1475 
1476     virtual wxEvent *Clone() const
1477     {
1478         return new wxAsyncMethodCallEvent2(*this);
1479     }
1480 
1481     virtual void Execute()
1482     {
1483         (m_object->*m_method)(m_param1, m_param2);
1484     }
1485 
1486 private:
1487     ObjectType* const m_object;
1488     const MethodType m_method;
1489     const ParamType1 m_param1;
1490     const ParamType2 m_param2;
1491 };
1492 
1493 // This is a version for calling any functors
1494 template <typename T>
1495 class wxAsyncMethodCallEventFunctor : public wxAsyncMethodCallEvent
1496 {
1497 public:
1498     typedef T FunctorType;
1499 
1500     wxAsyncMethodCallEventFunctor(wxObject *object, const FunctorType& fn)
1501         : wxAsyncMethodCallEvent(object),
1502           m_fn(fn)
1503     {
1504     }
1505 
1506     wxAsyncMethodCallEventFunctor(const wxAsyncMethodCallEventFunctor& other)
1507         : wxAsyncMethodCallEvent(other),
1508           m_fn(other.m_fn)
1509     {
1510     }
1511 
1512     virtual wxEvent *Clone() const
1513     {
1514         return new wxAsyncMethodCallEventFunctor(*this);
1515     }
1516 
1517     virtual void Execute()
1518     {
1519         m_fn();
1520     }
1521 
1522 private:
1523     FunctorType m_fn;
1524 };
1525 
1526 #endif // wxHAS_CALL_AFTER
1527 
1528 
1529 #if wxUSE_GUI
1530 
1531 
1532 // Item or menu event class
1533 /*
1534  wxEVT_BUTTON
1535  wxEVT_CHECKBOX
1536  wxEVT_CHOICE
1537  wxEVT_LISTBOX
1538  wxEVT_LISTBOX_DCLICK
1539  wxEVT_TEXT
1540  wxEVT_TEXT_ENTER
1541  wxEVT_MENU
1542  wxEVT_SLIDER
1543  wxEVT_RADIOBOX
1544  wxEVT_RADIOBUTTON
1545  wxEVT_SCROLLBAR
1546  wxEVT_VLBOX
1547  wxEVT_COMBOBOX
1548  wxEVT_TOGGLEBUTTON
1549 */
1550 
1551 class WXDLLIMPEXP_CORE wxCommandEvent : public wxEvent,
1552                                         public wxEventBasicPayloadMixin
1553 {
1554 public:
1555     wxCommandEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
1556 
1557     wxCommandEvent(const wxCommandEvent& event)
1558         : wxEvent(event),
1559           wxEventBasicPayloadMixin(event),
1560           m_clientData(event.m_clientData),
1561           m_clientObject(event.m_clientObject)
1562     {
1563         // Because GetString() can retrieve the string text only on demand, we
1564         // need to copy it explicitly.
1565         if ( m_cmdString.empty() )
1566             m_cmdString = event.GetString();
1567     }
1568 
1569     // Set/Get client data from controls
1570     void SetClientData(void* clientData) { m_clientData = clientData; }
1571     void *GetClientData() const { return m_clientData; }
1572 
1573     // Set/Get client object from controls
1574     void SetClientObject(wxClientData* clientObject) { m_clientObject = clientObject; }
1575     wxClientData *GetClientObject() const { return m_clientObject; }
1576 
1577     // Note: this shadows wxEventBasicPayloadMixin::GetString(), because it does some
1578     // GUI-specific hacks
1579     wxString GetString() const;
1580 
1581     // Get listbox selection if single-choice
1582     int GetSelection() const { return m_commandInt; }
1583 
1584     // Get checkbox value
1585     bool IsChecked() const { return m_commandInt != 0; }
1586 
1587     // true if the listbox event was a selection.
1588     bool IsSelection() const { return (m_extraLong != 0); }
1589 
1590     virtual wxEvent *Clone() const { return new wxCommandEvent(*this); }
1591     virtual wxEventCategory GetEventCategory() const { return wxEVT_CATEGORY_USER_INPUT; }
1592 
1593 protected:
1594     void*             m_clientData;    // Arbitrary client data
1595     wxClientData*     m_clientObject;  // Arbitrary client object
1596 
1597 private:
1598     DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCommandEvent)
1599 };
1600 
1601 // this class adds a possibility to react (from the user) code to a control
1602 // notification: allow or veto the operation being reported.
1603 class WXDLLIMPEXP_CORE wxNotifyEvent  : public wxCommandEvent
1604 {
1605 public:
1606     wxNotifyEvent(wxEventType commandType = wxEVT_NULL, int winid = 0)
1607         : wxCommandEvent(commandType, winid)
1608         { m_bAllow = true; }
1609 
1610     wxNotifyEvent(const wxNotifyEvent& event)
1611         : wxCommandEvent(event)
1612         { m_bAllow = event.m_bAllow; }
1613 
1614     // veto the operation (usually it's allowed by default)
1615     void Veto() { m_bAllow = false; }
1616 
1617     // allow the operation if it was disabled by default
1618     void Allow() { m_bAllow = true; }
1619 
1620     // for implementation code only: is the operation allowed?
1621     bool IsAllowed() const { return m_bAllow; }
1622 
1623     virtual wxEvent *Clone() const { return new wxNotifyEvent(*this); }
1624 
1625 private:
1626     bool m_bAllow;
1627 
1628 private:
1629     DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxNotifyEvent)
1630 };
1631 
1632 
1633 // Scroll event class, derived form wxCommandEvent. wxScrollEvents are
1634 // sent by wxSlider and wxScrollBar.
1635 /*
1636  wxEVT_SCROLL_TOP
1637  wxEVT_SCROLL_BOTTOM
1638  wxEVT_SCROLL_LINEUP
1639  wxEVT_SCROLL_LINEDOWN
1640  wxEVT_SCROLL_PAGEUP
1641  wxEVT_SCROLL_PAGEDOWN
1642  wxEVT_SCROLL_THUMBTRACK
1643  wxEVT_SCROLL_THUMBRELEASE
1644  wxEVT_SCROLL_CHANGED
1645 */
1646 
1647 class WXDLLIMPEXP_CORE wxScrollEvent : public wxCommandEvent
1648 {
1649 public:
1650     wxScrollEvent(wxEventType commandType = wxEVT_NULL,
1651                   int winid = 0, int pos = 0, int orient = 0);
1652 
1653     int GetOrientation() const { return (int) m_extraLong; }
1654     int GetPosition() const { return m_commandInt; }
1655     void SetOrientation(int orient) { m_extraLong = (long) orient; }
1656     void SetPosition(int pos) { m_commandInt = pos; }
1657 
1658     virtual wxEvent *Clone() const { return new wxScrollEvent(*this); }
1659 
1660 private:
1661     DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxScrollEvent)
1662 };
1663 
1664 // ScrollWin event class, derived fom wxEvent. wxScrollWinEvents
1665 // are sent by wxWindow.
1666 /*
1667  wxEVT_SCROLLWIN_TOP
1668  wxEVT_SCROLLWIN_BOTTOM
1669  wxEVT_SCROLLWIN_LINEUP
1670  wxEVT_SCROLLWIN_LINEDOWN
1671  wxEVT_SCROLLWIN_PAGEUP
1672  wxEVT_SCROLLWIN_PAGEDOWN
1673  wxEVT_SCROLLWIN_THUMBTRACK
1674  wxEVT_SCROLLWIN_THUMBRELEASE
1675 */
1676 
1677 class WXDLLIMPEXP_CORE wxScrollWinEvent : public wxEvent
1678 {
1679 public:
1680     wxScrollWinEvent(wxEventType commandType = wxEVT_NULL,
1681                      int pos = 0, int orient = 0);
1682     wxScrollWinEvent(const wxScrollWinEvent& event) : wxEvent(event)
1683         {    m_commandInt = event.m_commandInt;
1684             m_extraLong = event.m_extraLong;    }
1685 
1686     int GetOrientation() const { return (int) m_extraLong; }
1687     int GetPosition() const { return m_commandInt; }
1688     void SetOrientation(int orient) { m_extraLong = (long) orient; }
1689     void SetPosition(int pos) { m_commandInt = pos; }
1690 
1691     virtual wxEvent *Clone() const { return new wxScrollWinEvent(*this); }
1692 
1693 protected:
1694     int               m_commandInt;
1695     long              m_extraLong;
1696 
1697 private:
1698     DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxScrollWinEvent)
1699 };
1700 
1701 
1702 
1703 // Mouse event class
1704 
1705 /*
1706  wxEVT_LEFT_DOWN
1707  wxEVT_LEFT_UP
1708  wxEVT_MIDDLE_DOWN
1709  wxEVT_MIDDLE_UP
1710  wxEVT_RIGHT_DOWN
1711  wxEVT_RIGHT_UP
1712  wxEVT_MOTION
1713  wxEVT_ENTER_WINDOW
1714  wxEVT_LEAVE_WINDOW
1715  wxEVT_LEFT_DCLICK
1716  wxEVT_MIDDLE_DCLICK
1717  wxEVT_RIGHT_DCLICK
1718 */
1719 
1720 enum wxMouseWheelAxis
1721 {
1722     wxMOUSE_WHEEL_VERTICAL,
1723     wxMOUSE_WHEEL_HORIZONTAL
1724 };
1725 
1726 class WXDLLIMPEXP_CORE wxMouseEvent : public wxEvent,
1727                                       public wxMouseState
1728 {
1729 public:
1730     wxMouseEvent(wxEventType mouseType = wxEVT_NULL);
1731     wxMouseEvent(const wxMouseEvent& event)
1732         : wxEvent(event),
1733           wxMouseState(event)
1734     {
1735         Assign(event);
1736     }
1737 
1738     // Was it a button event? (*doesn't* mean: is any button *down*?)
1739     bool IsButton() const { return Button(wxMOUSE_BTN_ANY); }
1740 
1741     // Was it a down event from this (or any) button?
1742     bool ButtonDown(int but = wxMOUSE_BTN_ANY) const;
1743 
1744     // Was it a dclick event from this (or any) button?
1745     bool ButtonDClick(int but = wxMOUSE_BTN_ANY) const;
1746 
1747     // Was it a up event from this (or any) button?
1748     bool ButtonUp(int but = wxMOUSE_BTN_ANY) const;
1749 
1750     // Was this event generated by the given button?
1751     bool Button(int but) const;
1752 
1753     // Get the button which is changing state (wxMOUSE_BTN_NONE if none)
1754     int GetButton() const;
1755 
1756     // Find which event was just generated
1757     bool LeftDown() const { return (m_eventType == wxEVT_LEFT_DOWN); }
1758     bool MiddleDown() const { return (m_eventType == wxEVT_MIDDLE_DOWN); }
1759     bool RightDown() const { return (m_eventType == wxEVT_RIGHT_DOWN); }
1760     bool Aux1Down() const { return (m_eventType == wxEVT_AUX1_DOWN); }
1761     bool Aux2Down() const { return (m_eventType == wxEVT_AUX2_DOWN); }
1762 
1763     bool LeftUp() const { return (m_eventType == wxEVT_LEFT_UP); }
1764     bool MiddleUp() const { return (m_eventType == wxEVT_MIDDLE_UP); }
1765     bool RightUp() const { return (m_eventType == wxEVT_RIGHT_UP); }
1766     bool Aux1Up() const { return (m_eventType == wxEVT_AUX1_UP); }
1767     bool Aux2Up() const { return (m_eventType == wxEVT_AUX2_UP); }
1768 
1769     bool LeftDClick() const { return (m_eventType == wxEVT_LEFT_DCLICK); }
1770     bool MiddleDClick() const { return (m_eventType == wxEVT_MIDDLE_DCLICK); }
1771     bool RightDClick() const { return (m_eventType == wxEVT_RIGHT_DCLICK); }
1772     bool Aux1DClick() const { return (m_eventType == wxEVT_AUX1_DCLICK); }
1773     bool Aux2DClick() const { return (m_eventType == wxEVT_AUX2_DCLICK); }
1774 
1775     // True if a button is down and the mouse is moving
1776     bool Dragging() const
1777     {
1778         return (m_eventType == wxEVT_MOTION) && ButtonIsDown(wxMOUSE_BTN_ANY);
1779     }
1780 
1781     // True if the mouse is moving, and no button is down
1782     bool Moving() const
1783     {
1784         return (m_eventType == wxEVT_MOTION) && !ButtonIsDown(wxMOUSE_BTN_ANY);
1785     }
1786 
1787     // True if the mouse is just entering the window
1788     bool Entering() const { return (m_eventType == wxEVT_ENTER_WINDOW); }
1789 
1790     // True if the mouse is just leaving the window
1791     bool Leaving() const { return (m_eventType == wxEVT_LEAVE_WINDOW); }
1792 
1793     // Returns the number of mouse clicks associated with this event.
1794     int GetClickCount() const { return m_clickCount; }
1795 
1796     // Find the logical position of the event given the DC
1797     wxPoint GetLogicalPosition(const wxDC& dc) const;
1798 
1799     // Get wheel rotation, positive or negative indicates direction of
1800     // rotation.  Current devices all send an event when rotation is equal to
1801     // +/-WheelDelta, but this allows for finer resolution devices to be
1802     // created in the future.  Because of this you shouldn't assume that one
1803     // event is equal to 1 line or whatever, but you should be able to either
1804     // do partial line scrolling or wait until +/-WheelDelta rotation values
1805     // have been accumulated before scrolling.
1806     int GetWheelRotation() const { return m_wheelRotation; }
1807 
1808     // Get wheel delta, normally 120.  This is the threshold for action to be
1809     // taken, and one such action (for example, scrolling one increment)
1810     // should occur for each delta.
1811     int GetWheelDelta() const { return m_wheelDelta; }
1812 
1813     // Gets the axis the wheel operation concerns; wxMOUSE_WHEEL_VERTICAL
1814     // (most common case) or wxMOUSE_WHEEL_HORIZONTAL (for horizontal scrolling
1815     // using e.g. a trackpad).
1816     wxMouseWheelAxis GetWheelAxis() const { return m_wheelAxis; }
1817 
1818     // Returns the configured number of lines (or whatever) to be scrolled per
1819     // wheel action. Defaults to three.
1820     int GetLinesPerAction() const { return m_linesPerAction; }
1821 
1822     // Returns the configured number of columns (or whatever) to be scrolled per
1823     // wheel action. Defaults to three.
1824     int GetColumnsPerAction() const { return m_columnsPerAction; }
1825 
1826     // Is the system set to do page scrolling?
1827     bool IsPageScroll() const { return ((unsigned int)m_linesPerAction == UINT_MAX); }
1828 
1829     virtual wxEvent *Clone() const { return new wxMouseEvent(*this); }
1830     virtual wxEventCategory GetEventCategory() const { return wxEVT_CATEGORY_USER_INPUT; }
1831 
1832     wxMouseEvent& operator=(const wxMouseEvent& event)
1833     {
1834         if (&event != this)
1835             Assign(event);
1836         return *this;
1837     }
1838 
1839 public:
1840     int           m_clickCount;
1841 
1842     wxMouseWheelAxis m_wheelAxis;
1843     int           m_wheelRotation;
1844     int           m_wheelDelta;
1845     int           m_linesPerAction;
1846     int           m_columnsPerAction;
1847 
1848 protected:
1849     void Assign(const wxMouseEvent& evt);
1850 
1851 private:
1852     DECLARE_DYNAMIC_CLASS(wxMouseEvent)
1853 };
1854 
1855 // Cursor set event
1856 
1857 /*
1858    wxEVT_SET_CURSOR
1859  */
1860 
1861 class WXDLLIMPEXP_CORE wxSetCursorEvent : public wxEvent
1862 {
1863 public:
1864     wxSetCursorEvent(wxCoord x = 0, wxCoord y = 0)
1865         : wxEvent(0, wxEVT_SET_CURSOR),
1866           m_x(x), m_y(y), m_cursor()
1867         { }
1868 
1869     wxSetCursorEvent(const wxSetCursorEvent& event)
1870         : wxEvent(event),
1871           m_x(event.m_x),
1872           m_y(event.m_y),
1873           m_cursor(event.m_cursor)
1874         { }
1875 
1876     wxCoord GetX() const { return m_x; }
1877     wxCoord GetY() const { return m_y; }
1878 
1879     void SetCursor(const wxCursor& cursor) { m_cursor = cursor; }
1880     const wxCursor& GetCursor() const { return m_cursor; }
1881     bool HasCursor() const { return m_cursor.IsOk(); }
1882 
1883     virtual wxEvent *Clone() const { return new wxSetCursorEvent(*this); }
1884 
1885 private:
1886     wxCoord  m_x, m_y;
1887     wxCursor m_cursor;
1888 
1889 private:
1890     DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSetCursorEvent)
1891 };
1892 
1893 // Keyboard input event class
1894 
1895 /*
1896  wxEVT_CHAR
1897  wxEVT_CHAR_HOOK
1898  wxEVT_KEY_DOWN
1899  wxEVT_KEY_UP
1900  wxEVT_HOTKEY
1901  */
1902 
1903 // key categories: the bit flags for IsKeyInCategory() function
1904 //
1905 // the enum values used may change in future version of wx
1906 // use the named constants only, or bitwise combinations thereof
1907 enum wxKeyCategoryFlags
1908 {
1909     // arrow keys, on and off numeric keypads
1910     WXK_CATEGORY_ARROW  = 1,
1911 
1912     // page up and page down keys, on and off numeric keypads
1913     WXK_CATEGORY_PAGING = 2,
1914 
1915     // home and end keys, on and off numeric keypads
1916     WXK_CATEGORY_JUMP   = 4,
1917 
1918     // tab key, on and off numeric keypads
1919     WXK_CATEGORY_TAB    = 8,
1920 
1921     // backspace and delete keys, on and off numeric keypads
1922     WXK_CATEGORY_CUT    = 16,
1923 
1924     // all keys usually used for navigation
1925     WXK_CATEGORY_NAVIGATION = WXK_CATEGORY_ARROW |
1926                               WXK_CATEGORY_PAGING |
1927                               WXK_CATEGORY_JUMP
1928 };
1929 
1930 class WXDLLIMPEXP_CORE wxKeyEvent : public wxEvent,
1931                                     public wxKeyboardState
1932 {
1933 public:
1934     wxKeyEvent(wxEventType keyType = wxEVT_NULL);
1935 
1936     // Normal copy ctor and a ctor creating a new event for the same key as the
1937     // given one but a different event type (this is used in implementation
1938     // code only, do not use outside of the library).
1939     wxKeyEvent(const wxKeyEvent& evt);
1940     wxKeyEvent(wxEventType eventType, const wxKeyEvent& evt);
1941 
1942     // get the key code: an ASCII7 char or an element of wxKeyCode enum
1943     int GetKeyCode() const { return (int)m_keyCode; }
1944 
1945     // returns true iff this event's key code is of a certain type
1946     bool IsKeyInCategory(int category) const;
1947 
1948 #if wxUSE_UNICODE
1949     // get the Unicode character corresponding to this key
1950     wxChar GetUnicodeKey() const { return m_uniChar; }
1951 #endif // wxUSE_UNICODE
1952 
1953     // get the raw key code (platform-dependent)
1954     wxUint32 GetRawKeyCode() const { return m_rawCode; }
1955 
1956     // get the raw key flags (platform-dependent)
1957     wxUint32 GetRawKeyFlags() const { return m_rawFlags; }
1958 
1959     // Find the position of the event
1960     void GetPosition(wxCoord *xpos, wxCoord *ypos) const
1961     {
1962         if (xpos)
1963             *xpos = GetX();
1964         if (ypos)
1965             *ypos = GetY();
1966     }
1967 
1968     // This version if provided only for backwards compatiblity, don't use.
1969     void GetPosition(long *xpos, long *ypos) const
1970     {
1971         if (xpos)
1972             *xpos = GetX();
1973         if (ypos)
1974             *ypos = GetY();
1975     }
1976 
1977     wxPoint GetPosition() const
1978         { return wxPoint(GetX(), GetY()); }
1979 
1980     // Get X position
1981     wxCoord GetX() const;
1982 
1983     // Get Y position
1984     wxCoord GetY() const;
1985 
1986     // Can be called from wxEVT_CHAR_HOOK handler to allow generation of normal
1987     // key events even though the event had been handled (by default they would
1988     // not be generated in this case).
1989     void DoAllowNextEvent() { m_allowNext = true; }
1990 
1991     // Return the value of the "allow next" flag, for internal use only.
1992     bool IsNextEventAllowed() const { return m_allowNext; }
1993 
1994 
1995     virtual wxEvent *Clone() const { return new wxKeyEvent(*this); }
1996     virtual wxEventCategory GetEventCategory() const { return wxEVT_CATEGORY_USER_INPUT; }
1997 
1998     // we do need to copy wxKeyEvent sometimes (in wxTreeCtrl code, for
1999     // example)
2000     wxKeyEvent& operator=(const wxKeyEvent& evt)
2001     {
2002         if ( &evt != this )
2003         {
2004             wxEvent::operator=(evt);
2005 
2006             // Borland C++ 5.82 doesn't compile an explicit call to an
2007             // implicitly defined operator=() so need to do it this way:
2008             *static_cast<wxKeyboardState *>(this) = evt;
2009 
2010             DoAssignMembers(evt);
2011         }
2012         return *this;
2013     }
2014 
2015 public:
2016     // Do not use these fields directly, they are initialized on demand, so
2017     // call GetX() and GetY() or GetPosition() instead.
2018     wxCoord       m_x, m_y;
2019 
2020     long          m_keyCode;
2021 
2022 #if wxUSE_UNICODE
2023     // This contains the full Unicode character
2024     // in a character events in Unicode mode
2025     wxChar        m_uniChar;
2026 #endif
2027 
2028     // these fields contain the platform-specific information about
2029     // key that was pressed
2030     wxUint32      m_rawCode;
2031     wxUint32      m_rawFlags;
2032 
2033 private:
2034     // Set the event to propagate if necessary, i.e. if it's of wxEVT_CHAR_HOOK
2035     // type. This is used by all ctors.
2036     void InitPropagation()
2037     {
2038         if ( m_eventType == wxEVT_CHAR_HOOK )
2039             m_propagationLevel = wxEVENT_PROPAGATE_MAX;
2040 
2041         m_allowNext = false;
2042     }
2043 
2044     // Copy only the event data present in this class, this is used by
2045     // AssignKeyData() and copy ctor.
2046     void DoAssignMembers(const wxKeyEvent& evt)
2047     {
2048         m_x = evt.m_x;
2049         m_y = evt.m_y;
2050         m_hasPosition = evt.m_hasPosition;
2051 
2052         m_keyCode = evt.m_keyCode;
2053 
2054         m_rawCode = evt.m_rawCode;
2055         m_rawFlags = evt.m_rawFlags;
2056 #if wxUSE_UNICODE
2057         m_uniChar = evt.m_uniChar;
2058 #endif
2059     }
2060 
2061     // Initialize m_x and m_y using the current mouse cursor position if
2062     // necessary.
2063     void InitPositionIfNecessary() const;
2064 
2065     // If this flag is true, the normal key events should still be generated
2066     // even if wxEVT_CHAR_HOOK had been handled. By default it is false as
2067     // handling wxEVT_CHAR_HOOK suppresses all the subsequent events.
2068     bool m_allowNext;
2069 
2070     // If true, m_x and m_y were already initialized. If false, try to get them
2071     // when they're requested.
2072     bool m_hasPosition;
2073 
2074     DECLARE_DYNAMIC_CLASS(wxKeyEvent)
2075 };
2076 
2077 // Size event class
2078 /*
2079  wxEVT_SIZE
2080  */
2081 
2082 class WXDLLIMPEXP_CORE wxSizeEvent : public wxEvent
2083 {
2084 public:
2085     wxSizeEvent() : wxEvent(0, wxEVT_SIZE)
2086         { }
2087     wxSizeEvent(const wxSize& sz, int winid = 0)
2088         : wxEvent(winid, wxEVT_SIZE),
2089           m_size(sz)
2090         { }
2091     wxSizeEvent(const wxSizeEvent& event)
2092         : wxEvent(event),
2093           m_size(event.m_size), m_rect(event.m_rect)
2094         { }
2095     wxSizeEvent(const wxRect& rect, int id = 0)
2096         : m_size(rect.GetSize()), m_rect(rect)
2097         { m_eventType = wxEVT_SIZING; m_id = id; }
2098 
2099     wxSize GetSize() const { return m_size; }
2100     void SetSize(wxSize size) { m_size = size; }
2101     wxRect GetRect() const { return m_rect; }
2102     void SetRect(const wxRect& rect) { m_rect = rect; }
2103 
2104     virtual wxEvent *Clone() const { return new wxSizeEvent(*this); }
2105 
2106 public:
2107     // For internal usage only. Will be converted to protected members.
2108     wxSize m_size;
2109     wxRect m_rect; // Used for wxEVT_SIZING
2110 
2111 private:
2112     DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSizeEvent)
2113 };
2114 
2115 // Move event class
2116 
2117 /*
2118  wxEVT_MOVE
2119  */
2120 
2121 class WXDLLIMPEXP_CORE wxMoveEvent : public wxEvent
2122 {
2123 public:
2124     wxMoveEvent()
2125         : wxEvent(0, wxEVT_MOVE)
2126         { }
2127     wxMoveEvent(const wxPoint& pos, int winid = 0)
2128         : wxEvent(winid, wxEVT_MOVE),
2129           m_pos(pos)
2130         { }
2131     wxMoveEvent(const wxMoveEvent& event)
2132         : wxEvent(event),
2133           m_pos(event.m_pos)
2134     { }
2135     wxMoveEvent(const wxRect& rect, int id = 0)
2136         : m_pos(rect.GetPosition()), m_rect(rect)
2137         { m_eventType = wxEVT_MOVING; m_id = id; }
2138 
2139     wxPoint GetPosition() const { return m_pos; }
2140     void SetPosition(const wxPoint& pos) { m_pos = pos; }
2141     wxRect GetRect() const { return m_rect; }
2142     void SetRect(const wxRect& rect) { m_rect = rect; }
2143 
2144     virtual wxEvent *Clone() const { return new wxMoveEvent(*this); }
2145 
2146 protected:
2147     wxPoint m_pos;
2148     wxRect m_rect;
2149 
2150 private:
2151     DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMoveEvent)
2152 };
2153 
2154 // Paint event class
2155 /*
2156  wxEVT_PAINT
2157  wxEVT_NC_PAINT
2158  */
2159 
2160 #if wxDEBUG_LEVEL && (defined(__WXMSW__) || defined(__WXPM__))
2161     #define wxHAS_PAINT_DEBUG
2162 
2163     // see comments in src/msw|os2/dcclient.cpp where g_isPainting is defined
2164     extern WXDLLIMPEXP_CORE int g_isPainting;
2165 #endif // debug
2166 
2167 class WXDLLIMPEXP_CORE wxPaintEvent : public wxEvent
2168 {
2169 public:
2170     wxPaintEvent(int Id = 0)
2171         : wxEvent(Id, wxEVT_PAINT)
2172     {
2173 #ifdef wxHAS_PAINT_DEBUG
2174         // set the internal flag for the duration of redrawing
2175         g_isPainting++;
2176 #endif // debug
2177     }
2178 
2179     // default copy ctor and dtor are normally fine, we only need them to keep
2180     // g_isPainting updated in debug build
2181 #ifdef wxHAS_PAINT_DEBUG
2182     wxPaintEvent(const wxPaintEvent& event)
2183             : wxEvent(event)
2184     {
2185         g_isPainting++;
2186     }
2187 
2188     virtual ~wxPaintEvent()
2189     {
2190         g_isPainting--;
2191     }
2192 #endif // debug
2193 
2194     virtual wxEvent *Clone() const { return new wxPaintEvent(*this); }
2195 
2196 private:
2197     DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxPaintEvent)
2198 };
2199 
2200 class WXDLLIMPEXP_CORE wxNcPaintEvent : public wxEvent
2201 {
2202 public:
2203     wxNcPaintEvent(int winid = 0)
2204         : wxEvent(winid, wxEVT_NC_PAINT)
2205         { }
2206 
2207     virtual wxEvent *Clone() const { return new wxNcPaintEvent(*this); }
2208 
2209 private:
2210     DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxNcPaintEvent)
2211 };
2212 
2213 // Erase background event class
2214 /*
2215  wxEVT_ERASE_BACKGROUND
2216  */
2217 
2218 class WXDLLIMPEXP_CORE wxEraseEvent : public wxEvent
2219 {
2220 public:
2221     wxEraseEvent(int Id = 0, wxDC *dc = NULL)
2222         : wxEvent(Id, wxEVT_ERASE_BACKGROUND),
2223           m_dc(dc)
2224         { }
2225 
2226     wxEraseEvent(const wxEraseEvent& event)
2227         : wxEvent(event),
2228           m_dc(event.m_dc)
2229         { }
2230 
2231     wxDC *GetDC() const { return m_dc; }
2232 
2233     virtual wxEvent *Clone() const { return new wxEraseEvent(*this); }
2234 
2235 protected:
2236     wxDC *m_dc;
2237 
2238 private:
2239     DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxEraseEvent)
2240 };
2241 
2242 // Focus event class
2243 /*
2244  wxEVT_SET_FOCUS
2245  wxEVT_KILL_FOCUS
2246  */
2247 
2248 class WXDLLIMPEXP_CORE wxFocusEvent : public wxEvent
2249 {
2250 public:
2251     wxFocusEvent(wxEventType type = wxEVT_NULL, int winid = 0)
2252         : wxEvent(winid, type)
2253         { m_win = NULL; }
2254 
2255     wxFocusEvent(const wxFocusEvent& event)
2256         : wxEvent(event)
2257         { m_win = event.m_win; }
2258 
2259     // The window associated with this event is the window which had focus
2260     // before for SET event and the window which will have focus for the KILL
2261     // one. NB: it may be NULL in both cases!
2262     wxWindow *GetWindow() const { return m_win; }
2263     void SetWindow(wxWindow *win) { m_win = win; }
2264 
2265     virtual wxEvent *Clone() const { return new wxFocusEvent(*this); }
2266 
2267 private:
2268     wxWindow *m_win;
2269 
2270 private:
2271     DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxFocusEvent)
2272 };
2273 
2274 // wxChildFocusEvent notifies the parent that a child has got the focus: unlike
2275 // wxFocusEvent it is propagated upwards the window chain
2276 class WXDLLIMPEXP_CORE wxChildFocusEvent : public wxCommandEvent
2277 {
2278 public:
2279     wxChildFocusEvent(wxWindow *win = NULL);
2280 
2281     wxWindow *GetWindow() const { return (wxWindow *)GetEventObject(); }
2282 
2283     virtual wxEvent *Clone() const { return new wxChildFocusEvent(*this); }
2284 
2285 private:
2286     DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxChildFocusEvent)
2287 };
2288 
2289 // Activate event class
2290 /*
2291  wxEVT_ACTIVATE
2292  wxEVT_ACTIVATE_APP
2293  wxEVT_HIBERNATE
2294  */
2295 
2296 class WXDLLIMPEXP_CORE wxActivateEvent : public wxEvent
2297 {
2298 public:
2299     // Type of activation. For now we can only detect if it was by mouse or by
2300     // some other method and even this is only available under wxMSW.
2301     enum Reason
2302     {
2303         Reason_Mouse,
2304         Reason_Unknown
2305     };
2306 
2307     wxActivateEvent(wxEventType type = wxEVT_NULL, bool active = true,
2308                     int Id = 0, Reason activationReason = Reason_Unknown)
2309         : wxEvent(Id, type),
2310         m_activationReason(activationReason)
2311     {
2312         m_active = active;
2313     }
2314     wxActivateEvent(const wxActivateEvent& event)
2315         : wxEvent(event)
2316     {
2317         m_active = event.m_active;
2318         m_activationReason = event.m_activationReason;
2319     }
2320 
2321     bool GetActive() const { return m_active; }
2322     Reason GetActivationReason() const { return m_activationReason;}
2323 
2324     virtual wxEvent *Clone() const { return new wxActivateEvent(*this); }
2325 
2326 private:
2327     bool m_active;
2328     Reason m_activationReason;
2329 
2330 private:
2331     DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxActivateEvent)
2332 };
2333 
2334 // InitDialog event class
2335 /*
2336  wxEVT_INIT_DIALOG
2337  */
2338 
2339 class WXDLLIMPEXP_CORE wxInitDialogEvent : public wxEvent
2340 {
2341 public:
2342     wxInitDialogEvent(int Id = 0)
2343         : wxEvent(Id, wxEVT_INIT_DIALOG)
2344         { }
2345 
2346     virtual wxEvent *Clone() const { return new wxInitDialogEvent(*this); }
2347 
2348 private:
2349     DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxInitDialogEvent)
2350 };
2351 
2352 // Miscellaneous menu event class
2353 /*
2354  wxEVT_MENU_OPEN,
2355  wxEVT_MENU_CLOSE,
2356  wxEVT_MENU_HIGHLIGHT,
2357 */
2358 
2359 class WXDLLIMPEXP_CORE wxMenuEvent : public wxEvent
2360 {
2361 public:
2362     wxMenuEvent(wxEventType type = wxEVT_NULL, int winid = 0, wxMenu* menu = NULL)
2363         : wxEvent(winid, type)
2364         { m_menuId = winid; m_menu = menu; }
2365     wxMenuEvent(const wxMenuEvent& event)
2366         : wxEvent(event)
2367     { m_menuId = event.m_menuId; m_menu = event.m_menu; }
2368 
2369     // only for wxEVT_MENU_HIGHLIGHT
2370     int GetMenuId() const { return m_menuId; }
2371 
2372     // only for wxEVT_MENU_OPEN/CLOSE
2373     bool IsPopup() const { return m_menuId == wxID_ANY; }
2374 
2375     // only for wxEVT_MENU_OPEN/CLOSE
2376     wxMenu* GetMenu() const { return m_menu; }
2377 
2378     virtual wxEvent *Clone() const { return new wxMenuEvent(*this); }
2379 
2380 private:
2381     int     m_menuId;
2382     wxMenu* m_menu;
2383 
2384     DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMenuEvent)
2385 };
2386 
2387 // Window close or session close event class
2388 /*
2389  wxEVT_CLOSE_WINDOW,
2390  wxEVT_END_SESSION,
2391  wxEVT_QUERY_END_SESSION
2392  */
2393 
2394 class WXDLLIMPEXP_CORE wxCloseEvent : public wxEvent
2395 {
2396 public:
2397     wxCloseEvent(wxEventType type = wxEVT_NULL, int winid = 0)
2398         : wxEvent(winid, type),
2399           m_loggingOff(true),
2400           m_veto(false),      // should be false by default
2401           m_canVeto(true) {}
2402 
2403     wxCloseEvent(const wxCloseEvent& event)
2404         : wxEvent(event),
2405         m_loggingOff(event.m_loggingOff),
2406         m_veto(event.m_veto),
2407         m_canVeto(event.m_canVeto) {}
2408 
2409     void SetLoggingOff(bool logOff) { m_loggingOff = logOff; }
2410     bool GetLoggingOff() const
2411     {
2412         // m_loggingOff flag is only used by wxEVT_[QUERY_]END_SESSION, it
2413         // doesn't make sense for wxEVT_CLOSE_WINDOW
2414         wxASSERT_MSG( m_eventType != wxEVT_CLOSE_WINDOW,
2415                       wxT("this flag is for end session events only") );
2416 
2417         return m_loggingOff;
2418     }
2419 
2420     void Veto(bool veto = true)
2421     {
2422         // GetVeto() will return false anyhow...
2423         wxCHECK_RET( m_canVeto,
2424                      wxT("call to Veto() ignored (can't veto this event)") );
2425 
2426         m_veto = veto;
2427     }
2428     void SetCanVeto(bool canVeto) { m_canVeto = canVeto; }
2429     bool CanVeto() const { return m_canVeto; }
2430     bool GetVeto() const { return m_canVeto && m_veto; }
2431 
2432     virtual wxEvent *Clone() const { return new wxCloseEvent(*this); }
2433 
2434 protected:
2435     bool m_loggingOff,
2436          m_veto,
2437          m_canVeto;
2438 
2439 private:
2440     DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCloseEvent)
2441 };
2442 
2443 /*
2444  wxEVT_SHOW
2445  */
2446 
2447 class WXDLLIMPEXP_CORE wxShowEvent : public wxEvent
2448 {
2449 public:
2450     wxShowEvent(int winid = 0, bool show = false)
2451         : wxEvent(winid, wxEVT_SHOW)
2452         { m_show = show; }
2453     wxShowEvent(const wxShowEvent& event)
2454         : wxEvent(event)
2455     { m_show = event.m_show; }
2456 
2457     void SetShow(bool show) { m_show = show; }
2458 
2459     // return true if the window was shown, false if hidden
2460     bool IsShown() const { return m_show; }
2461 
2462 #if WXWIN_COMPATIBILITY_2_8
2463     wxDEPRECATED( bool GetShow() const { return IsShown(); } )
2464 #endif
2465 
2466     virtual wxEvent *Clone() const { return new wxShowEvent(*this); }
2467 
2468 protected:
2469     bool m_show;
2470 
2471 private:
2472     DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxShowEvent)
2473 };
2474 
2475 /*
2476  wxEVT_ICONIZE
2477  */
2478 
2479 class WXDLLIMPEXP_CORE wxIconizeEvent : public wxEvent
2480 {
2481 public:
2482     wxIconizeEvent(int winid = 0, bool iconized = true)
2483         : wxEvent(winid, wxEVT_ICONIZE)
2484         { m_iconized = iconized; }
2485     wxIconizeEvent(const wxIconizeEvent& event)
2486         : wxEvent(event)
2487     { m_iconized = event.m_iconized; }
2488 
2489 #if WXWIN_COMPATIBILITY_2_8
2490     wxDEPRECATED( bool Iconized() const { return IsIconized(); } )
2491 #endif
2492     // return true if the frame was iconized, false if restored
2493     bool IsIconized() const { return m_iconized; }
2494 
2495     virtual wxEvent *Clone() const { return new wxIconizeEvent(*this); }
2496 
2497 protected:
2498     bool m_iconized;
2499 
2500 private:
2501     DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxIconizeEvent)
2502 };
2503 /*
2504  wxEVT_MAXIMIZE
2505  */
2506 
2507 class WXDLLIMPEXP_CORE wxMaximizeEvent : public wxEvent
2508 {
2509 public:
2510     wxMaximizeEvent(int winid = 0)
2511         : wxEvent(winid, wxEVT_MAXIMIZE)
2512         { }
2513 
2514     virtual wxEvent *Clone() const { return new wxMaximizeEvent(*this); }
2515 
2516 private:
2517     DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMaximizeEvent)
2518 };
2519 
2520 // Joystick event class
2521 /*
2522  wxEVT_JOY_BUTTON_DOWN,
2523  wxEVT_JOY_BUTTON_UP,
2524  wxEVT_JOY_MOVE,
2525  wxEVT_JOY_ZMOVE
2526 */
2527 
2528 // Which joystick? Same as Windows ids so no conversion necessary.
2529 enum
2530 {
2531     wxJOYSTICK1,
2532     wxJOYSTICK2
2533 };
2534 
2535 // Which button is down?
2536 enum
2537 {
2538     wxJOY_BUTTON_ANY = -1,
2539     wxJOY_BUTTON1    = 1,
2540     wxJOY_BUTTON2    = 2,
2541     wxJOY_BUTTON3    = 4,
2542     wxJOY_BUTTON4    = 8
2543 };
2544 
2545 class WXDLLIMPEXP_CORE wxJoystickEvent : public wxEvent
2546 {
2547 protected:
2548     wxPoint   m_pos;
2549     int       m_zPosition;
2550     int       m_buttonChange;   // Which button changed?
2551     int       m_buttonState;    // Which buttons are down?
2552     int       m_joyStick;       // Which joystick?
2553 
2554 public:
2555     wxJoystickEvent(wxEventType type = wxEVT_NULL,
2556                     int state = 0,
2557                     int joystick = wxJOYSTICK1,
2558                     int change = 0)
2559         : wxEvent(0, type),
2560           m_pos(),
2561           m_zPosition(0),
2562           m_buttonChange(change),
2563           m_buttonState(state),
2564           m_joyStick(joystick)
2565     {
2566     }
2567     wxJoystickEvent(const wxJoystickEvent& event)
2568         : wxEvent(event),
2569           m_pos(event.m_pos),
2570           m_zPosition(event.m_zPosition),
2571           m_buttonChange(event.m_buttonChange),
2572           m_buttonState(event.m_buttonState),
2573           m_joyStick(event.m_joyStick)
2574     { }
2575 
2576     wxPoint GetPosition() const { return m_pos; }
2577     int GetZPosition() const { return m_zPosition; }
2578     int GetButtonState() const { return m_buttonState; }
2579     int GetButtonChange() const { return m_buttonChange; }
2580     int GetJoystick() const { return m_joyStick; }
2581 
2582     void SetJoystick(int stick) { m_joyStick = stick; }
2583     void SetButtonState(int state) { m_buttonState = state; }
2584     void SetButtonChange(int change) { m_buttonChange = change; }
2585     void SetPosition(const wxPoint& pos) { m_pos = pos; }
2586     void SetZPosition(int zPos) { m_zPosition = zPos; }
2587 
2588     // Was it a button event? (*doesn't* mean: is any button *down*?)
2589     bool IsButton() const { return ((GetEventType() == wxEVT_JOY_BUTTON_DOWN) ||
2590             (GetEventType() == wxEVT_JOY_BUTTON_UP)); }
2591 
2592     // Was it a move event?
2593     bool IsMove() const { return (GetEventType() == wxEVT_JOY_MOVE); }
2594 
2595     // Was it a zmove event?
2596     bool IsZMove() const { return (GetEventType() == wxEVT_JOY_ZMOVE); }
2597 
2598     // Was it a down event from button 1, 2, 3, 4 or any?
2599     bool ButtonDown(int but = wxJOY_BUTTON_ANY) const
2600     { return ((GetEventType() == wxEVT_JOY_BUTTON_DOWN) &&
2601             ((but == wxJOY_BUTTON_ANY) || (but == m_buttonChange))); }
2602 
2603     // Was it a up event from button 1, 2, 3 or any?
2604     bool ButtonUp(int but = wxJOY_BUTTON_ANY) const
2605     { return ((GetEventType() == wxEVT_JOY_BUTTON_UP) &&
2606             ((but == wxJOY_BUTTON_ANY) || (but == m_buttonChange))); }
2607 
2608     // Was the given button 1,2,3,4 or any in Down state?
2609     bool ButtonIsDown(int but =  wxJOY_BUTTON_ANY) const
2610     { return (((but == wxJOY_BUTTON_ANY) && (m_buttonState != 0)) ||
2611             ((m_buttonState & but) == but)); }
2612 
2613     virtual wxEvent *Clone() const { return new wxJoystickEvent(*this); }
2614 
2615 private:
2616     DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxJoystickEvent)
2617 };
2618 
2619 // Drop files event class
2620 /*
2621  wxEVT_DROP_FILES
2622  */
2623 
2624 class WXDLLIMPEXP_CORE wxDropFilesEvent : public wxEvent
2625 {
2626 public:
2627     int       m_noFiles;
2628     wxPoint   m_pos;
2629     wxString* m_files;
2630 
2631     wxDropFilesEvent(wxEventType type = wxEVT_NULL,
2632                      int noFiles = 0,
2633                      wxString *files = NULL)
2634         : wxEvent(0, type),
2635           m_noFiles(noFiles),
2636           m_pos(),
2637           m_files(files)
2638         { }
2639 
2640     // we need a copy ctor to avoid deleting m_files pointer twice
2641     wxDropFilesEvent(const wxDropFilesEvent& other)
2642         : wxEvent(other),
2643           m_noFiles(other.m_noFiles),
2644           m_pos(other.m_pos),
2645           m_files(NULL)
2646     {
2647         m_files = new wxString[m_noFiles];
2648         for ( int n = 0; n < m_noFiles; n++ )
2649         {
2650             m_files[n] = other.m_files[n];
2651         }
2652     }
2653 
2654     virtual ~wxDropFilesEvent()
2655     {
2656         delete [] m_files;
2657     }
2658 
2659     wxPoint GetPosition() const { return m_pos; }
2660     int GetNumberOfFiles() const { return m_noFiles; }
2661     wxString *GetFiles() const { return m_files; }
2662 
2663     virtual wxEvent *Clone() const { return new wxDropFilesEvent(*this); }
2664 
2665 private:
2666     DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDropFilesEvent)
2667 };
2668 
2669 // Update UI event
2670 /*
2671  wxEVT_UPDATE_UI
2672  */
2673 
2674 // Whether to always send update events to windows, or
2675 // to only send update events to those with the
2676 // wxWS_EX_PROCESS_UI_UPDATES style.
2677 
2678 enum wxUpdateUIMode
2679 {
2680         // Send UI update events to all windows
2681     wxUPDATE_UI_PROCESS_ALL,
2682 
2683         // Send UI update events to windows that have
2684         // the wxWS_EX_PROCESS_UI_UPDATES flag specified
2685     wxUPDATE_UI_PROCESS_SPECIFIED
2686 };
2687 
2688 class WXDLLIMPEXP_CORE wxUpdateUIEvent : public wxCommandEvent
2689 {
2690 public:
2691     wxUpdateUIEvent(wxWindowID commandId = 0)
2692         : wxCommandEvent(wxEVT_UPDATE_UI, commandId)
2693     {
2694         m_checked =
2695         m_enabled =
2696         m_shown =
2697         m_setEnabled =
2698         m_setShown =
2699         m_setText =
2700         m_setChecked = false;
2701     }
2702     wxUpdateUIEvent(const wxUpdateUIEvent& event)
2703         : wxCommandEvent(event),
2704           m_checked(event.m_checked),
2705           m_enabled(event.m_enabled),
2706           m_shown(event.m_shown),
2707           m_setEnabled(event.m_setEnabled),
2708           m_setShown(event.m_setShown),
2709           m_setText(event.m_setText),
2710           m_setChecked(event.m_setChecked),
2711           m_text(event.m_text)
2712     { }
2713 
2714     bool GetChecked() const { return m_checked; }
2715     bool GetEnabled() const { return m_enabled; }
2716     bool GetShown() const { return m_shown; }
2717     wxString GetText() const { return m_text; }
2718     bool GetSetText() const { return m_setText; }
2719     bool GetSetChecked() const { return m_setChecked; }
2720     bool GetSetEnabled() const { return m_setEnabled; }
2721     bool GetSetShown() const { return m_setShown; }
2722 
2723     void Check(bool check) { m_checked = check; m_setChecked = true; }
2724     void Enable(bool enable) { m_enabled = enable; m_setEnabled = true; }
2725     void Show(bool show) { m_shown = show; m_setShown = true; }
2726     void SetText(const wxString& text) { m_text = text; m_setText = true; }
2727 
2728     // Sets the interval between updates in milliseconds.
2729     // Set to -1 to disable updates, or to 0 to update as frequently as possible.
2730     static void SetUpdateInterval(long updateInterval) { sm_updateInterval = updateInterval; }
2731 
2732     // Returns the current interval between updates in milliseconds
2733     static long GetUpdateInterval() { return sm_updateInterval; }
2734 
2735     // Can we update this window?
2736     static bool CanUpdate(wxWindowBase *win);
2737 
2738     // Reset the update time to provide a delay until the next
2739     // time we should update
2740     static void ResetUpdateTime();
2741 
2742     // Specify how wxWidgets will send update events: to
2743     // all windows, or only to those which specify that they
2744     // will process the events.
2745     static void SetMode(wxUpdateUIMode mode) { sm_updateMode = mode; }
2746 
2747     // Returns the UI update mode
2748     static wxUpdateUIMode GetMode() { return sm_updateMode; }
2749 
2750     virtual wxEvent *Clone() const { return new wxUpdateUIEvent(*this); }
2751 
2752 protected:
2753     bool          m_checked;
2754     bool          m_enabled;
2755     bool          m_shown;
2756     bool          m_setEnabled;
2757     bool          m_setShown;
2758     bool          m_setText;
2759     bool          m_setChecked;
2760     wxString      m_text;
2761 #if wxUSE_LONGLONG
2762     static wxLongLong       sm_lastUpdate;
2763 #endif
2764     static long             sm_updateInterval;
2765     static wxUpdateUIMode   sm_updateMode;
2766 
2767 private:
2768     DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxUpdateUIEvent)
2769 };
2770 
2771 /*
2772  wxEVT_SYS_COLOUR_CHANGED
2773  */
2774 
2775 // TODO: shouldn't all events record the window ID?
2776 class WXDLLIMPEXP_CORE wxSysColourChangedEvent : public wxEvent
2777 {
2778 public:
2779     wxSysColourChangedEvent()
2780         : wxEvent(0, wxEVT_SYS_COLOUR_CHANGED)
2781         { }
2782 
2783     virtual wxEvent *Clone() const { return new wxSysColourChangedEvent(*this); }
2784 
2785 private:
2786     DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSysColourChangedEvent)
2787 };
2788 
2789 /*
2790  wxEVT_MOUSE_CAPTURE_CHANGED
2791  The window losing the capture receives this message
2792  (even if it released the capture itself).
2793  */
2794 
2795 class WXDLLIMPEXP_CORE wxMouseCaptureChangedEvent : public wxEvent
2796 {
2797 public:
2798     wxMouseCaptureChangedEvent(wxWindowID winid = 0, wxWindow* gainedCapture = NULL)
2799         : wxEvent(winid, wxEVT_MOUSE_CAPTURE_CHANGED),
2800           m_gainedCapture(gainedCapture)
2801         { }
2802 
2803     wxMouseCaptureChangedEvent(const wxMouseCaptureChangedEvent& event)
2804         : wxEvent(event),
2805           m_gainedCapture(event.m_gainedCapture)
2806         { }
2807 
2808     virtual wxEvent *Clone() const { return new wxMouseCaptureChangedEvent(*this); }
2809 
2810     wxWindow* GetCapturedWindow() const { return m_gainedCapture; }
2811 
2812 private:
2813     wxWindow* m_gainedCapture;
2814 
2815     DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMouseCaptureChangedEvent)
2816 };
2817 
2818 /*
2819  wxEVT_MOUSE_CAPTURE_LOST
2820  The window losing the capture receives this message, unless it released it
2821  it itself or unless wxWindow::CaptureMouse was called on another window
2822  (and so capture will be restored when the new capturer releases it).
2823  */
2824 
2825 class WXDLLIMPEXP_CORE wxMouseCaptureLostEvent : public wxEvent
2826 {
2827 public:
2828     wxMouseCaptureLostEvent(wxWindowID winid = 0)
2829         : wxEvent(winid, wxEVT_MOUSE_CAPTURE_LOST)
2830     {}
2831 
2832     wxMouseCaptureLostEvent(const wxMouseCaptureLostEvent& event)
2833         : wxEvent(event)
2834     {}
2835 
2836     virtual wxEvent *Clone() const { return new wxMouseCaptureLostEvent(*this); }
2837 
2838     DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMouseCaptureLostEvent)
2839 };
2840 
2841 /*
2842  wxEVT_DISPLAY_CHANGED
2843  */
2844 class WXDLLIMPEXP_CORE wxDisplayChangedEvent : public wxEvent
2845 {
2846 private:
2847     DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDisplayChangedEvent)
2848 
2849 public:
2850     wxDisplayChangedEvent()
2851         : wxEvent(0, wxEVT_DISPLAY_CHANGED)
2852         { }
2853 
2854     virtual wxEvent *Clone() const { return new wxDisplayChangedEvent(*this); }
2855 };
2856 
2857 /*
2858  wxEVT_PALETTE_CHANGED
2859  */
2860 
2861 class WXDLLIMPEXP_CORE wxPaletteChangedEvent : public wxEvent
2862 {
2863 public:
2864     wxPaletteChangedEvent(wxWindowID winid = 0)
2865         : wxEvent(winid, wxEVT_PALETTE_CHANGED),
2866           m_changedWindow(NULL)
2867         { }
2868 
2869     wxPaletteChangedEvent(const wxPaletteChangedEvent& event)
2870         : wxEvent(event),
2871           m_changedWindow(event.m_changedWindow)
2872         { }
2873 
2874     void SetChangedWindow(wxWindow* win) { m_changedWindow = win; }
2875     wxWindow* GetChangedWindow() const { return m_changedWindow; }
2876 
2877     virtual wxEvent *Clone() const { return new wxPaletteChangedEvent(*this); }
2878 
2879 protected:
2880     wxWindow*     m_changedWindow;
2881 
2882 private:
2883     DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxPaletteChangedEvent)
2884 };
2885 
2886 /*
2887  wxEVT_QUERY_NEW_PALETTE
2888  Indicates the window is getting keyboard focus and should re-do its palette.
2889  */
2890 
2891 class WXDLLIMPEXP_CORE wxQueryNewPaletteEvent : public wxEvent
2892 {
2893 public:
2894     wxQueryNewPaletteEvent(wxWindowID winid = 0)
2895         : wxEvent(winid, wxEVT_QUERY_NEW_PALETTE),
2896           m_paletteRealized(false)
2897         { }
2898     wxQueryNewPaletteEvent(const wxQueryNewPaletteEvent& event)
2899         : wxEvent(event),
2900         m_paletteRealized(event.m_paletteRealized)
2901     { }
2902 
2903     // App sets this if it changes the palette.
2904     void SetPaletteRealized(bool realized) { m_paletteRealized = realized; }
2905     bool GetPaletteRealized() const { return m_paletteRealized; }
2906 
2907     virtual wxEvent *Clone() const { return new wxQueryNewPaletteEvent(*this); }
2908 
2909 protected:
2910     bool m_paletteRealized;
2911 
2912 private:
2913     DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxQueryNewPaletteEvent)
2914 };
2915 
2916 /*
2917  Event generated by dialog navigation keys
2918  wxEVT_NAVIGATION_KEY
2919  */
2920 // NB: don't derive from command event to avoid being propagated to the parent
2921 class WXDLLIMPEXP_CORE wxNavigationKeyEvent : public wxEvent
2922 {
2923 public:
2924     wxNavigationKeyEvent()
2925         : wxEvent(0, wxEVT_NAVIGATION_KEY),
2926           m_flags(IsForward | FromTab),    // defaults are for TAB
2927           m_focus(NULL)
2928         {
2929             m_propagationLevel = wxEVENT_PROPAGATE_NONE;
2930         }
2931 
2932     wxNavigationKeyEvent(const wxNavigationKeyEvent& event)
2933         : wxEvent(event),
2934           m_flags(event.m_flags),
2935           m_focus(event.m_focus)
2936         { }
2937 
2938     // direction: forward (true) or backward (false)
2939     bool GetDirection() const
2940         { return (m_flags & IsForward) != 0; }
2941     void SetDirection(bool bForward)
2942         { if ( bForward ) m_flags |= IsForward; else m_flags &= ~IsForward; }
2943 
2944     // it may be a window change event (MDI, notebook pages...) or a control
2945     // change event
2946     bool IsWindowChange() const
2947         { return (m_flags & WinChange) != 0; }
2948     void SetWindowChange(bool bIs)
2949         { if ( bIs ) m_flags |= WinChange; else m_flags &= ~WinChange; }
2950 
2951     // Set to true under MSW if the event was generated using the tab key.
2952     // This is required for proper navogation over radio buttons
2953     bool IsFromTab() const
2954         { return (m_flags & FromTab) != 0; }
2955     void SetFromTab(bool bIs)
2956         { if ( bIs ) m_flags |= FromTab; else m_flags &= ~FromTab; }
2957 
2958     // the child which has the focus currently (may be NULL - use
2959     // wxWindow::FindFocus then)
2960     wxWindow* GetCurrentFocus() const { return m_focus; }
2961     void SetCurrentFocus(wxWindow *win) { m_focus = win; }
2962 
2963     // Set flags
2964     void SetFlags(long flags) { m_flags = flags; }
2965 
2966     virtual wxEvent *Clone() const { return new wxNavigationKeyEvent(*this); }
2967 
2968     enum wxNavigationKeyEventFlags
2969     {
2970         IsBackward = 0x0000,
2971         IsForward = 0x0001,
2972         WinChange = 0x0002,
2973         FromTab = 0x0004
2974     };
2975 
2976     long m_flags;
2977     wxWindow *m_focus;
2978 
2979 private:
2980     DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxNavigationKeyEvent)
2981 };
2982 
2983 // Window creation/destruction events: the first is sent as soon as window is
2984 // created (i.e. the underlying GUI object exists), but when the C++ object is
2985 // fully initialized (so virtual functions may be called). The second,
2986 // wxEVT_DESTROY, is sent right before the window is destroyed - again, it's
2987 // still safe to call virtual functions at this moment
2988 /*
2989  wxEVT_CREATE
2990  wxEVT_DESTROY
2991  */
2992 
2993 class WXDLLIMPEXP_CORE wxWindowCreateEvent : public wxCommandEvent
2994 {
2995 public:
2996     wxWindowCreateEvent(wxWindow *win = NULL);
2997 
2998     wxWindow *GetWindow() const { return (wxWindow *)GetEventObject(); }
2999 
3000     virtual wxEvent *Clone() const { return new wxWindowCreateEvent(*this); }
3001 
3002 private:
3003     DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxWindowCreateEvent)
3004 };
3005 
3006 class WXDLLIMPEXP_CORE wxWindowDestroyEvent : public wxCommandEvent
3007 {
3008 public:
3009     wxWindowDestroyEvent(wxWindow *win = NULL);
3010 
3011     wxWindow *GetWindow() const { return (wxWindow *)GetEventObject(); }
3012 
3013     virtual wxEvent *Clone() const { return new wxWindowDestroyEvent(*this); }
3014 
3015 private:
3016     DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxWindowDestroyEvent)
3017 };
3018 
3019 // A help event is sent when the user clicks on a window in context-help mode.
3020 /*
3021  wxEVT_HELP
3022  wxEVT_DETAILED_HELP
3023 */
3024 
3025 class WXDLLIMPEXP_CORE wxHelpEvent : public wxCommandEvent
3026 {
3027 public:
3028     // how was this help event generated?
3029     enum Origin
3030     {
3031         Origin_Unknown,    // unrecognized event source
3032         Origin_Keyboard,   // event generated from F1 key press
3033         Origin_HelpButton  // event from [?] button on the title bar (Windows)
3034     };
3035 
3036     wxHelpEvent(wxEventType type = wxEVT_NULL,
3037                 wxWindowID winid = 0,
3038                 const wxPoint& pt = wxDefaultPosition,
3039                 Origin origin = Origin_Unknown)
3040         : wxCommandEvent(type, winid),
3041           m_pos(pt),
3042           m_origin(GuessOrigin(origin))
3043     { }
3044     wxHelpEvent(const wxHelpEvent& event)
3045         : wxCommandEvent(event),
3046           m_pos(event.m_pos),
3047           m_target(event.m_target),
3048           m_link(event.m_link),
3049           m_origin(event.m_origin)
3050     { }
3051 
3052     // Position of event (in screen coordinates)
3053     const wxPoint& GetPosition() const { return m_pos; }
3054     void SetPosition(const wxPoint& pos) { m_pos = pos; }
3055 
3056     // Optional link to further help
3057     const wxString& GetLink() const { return m_link; }
3058     void SetLink(const wxString& link) { m_link = link; }
3059 
3060     // Optional target to display help in. E.g. a window specification
3061     const wxString& GetTarget() const { return m_target; }
3062     void SetTarget(const wxString& target) { m_target = target; }
3063 
3064     virtual wxEvent *Clone() const { return new wxHelpEvent(*this); }
3065 
3066     // optional indication of the event source
3067     Origin GetOrigin() const { return m_origin; }
3068     void SetOrigin(Origin origin) { m_origin = origin; }
3069 
3070 protected:
3071     wxPoint   m_pos;
3072     wxString  m_target;
3073     wxString  m_link;
3074     Origin    m_origin;
3075 
3076     // we can try to guess the event origin ourselves, even if none is
3077     // specified in the ctor
3078     static Origin GuessOrigin(Origin origin);
3079 
3080 private:
3081     DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxHelpEvent)
3082 };
3083 
3084 // A Clipboard Text event is sent when a window intercepts text copy/cut/paste
3085 // message, i.e. the user has cut/copied/pasted data from/into a text control
3086 // via ctrl-C/X/V, ctrl/shift-del/insert, a popup menu command, etc.
3087 // NOTE : under windows these events are *NOT* generated automatically
3088 // for a Rich Edit text control.
3089 /*
3090 wxEVT_TEXT_COPY
3091 wxEVT_TEXT_CUT
3092 wxEVT_TEXT_PASTE
3093 */
3094 
3095 class WXDLLIMPEXP_CORE wxClipboardTextEvent : public wxCommandEvent
3096 {
3097 public:
3098     wxClipboardTextEvent(wxEventType type = wxEVT_NULL,
3099                      wxWindowID winid = 0)
3100         : wxCommandEvent(type, winid)
3101     { }
3102     wxClipboardTextEvent(const wxClipboardTextEvent& event)
3103         : wxCommandEvent(event)
3104     { }
3105 
3106     virtual wxEvent *Clone() const { return new wxClipboardTextEvent(*this); }
3107 
3108 private:
3109     DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxClipboardTextEvent)
3110 };
3111 
3112 // A Context event is sent when the user right clicks on a window or
3113 // presses Shift-F10
3114 // NOTE : Under windows this is a repackaged WM_CONTETXMENU message
3115 //        Under other systems it may have to be generated from a right click event
3116 /*
3117  wxEVT_CONTEXT_MENU
3118 */
3119 
3120 class WXDLLIMPEXP_CORE wxContextMenuEvent : public wxCommandEvent
3121 {
3122 public:
3123     wxContextMenuEvent(wxEventType type = wxEVT_NULL,
3124                        wxWindowID winid = 0,
3125                        const wxPoint& pt = wxDefaultPosition)
3126         : wxCommandEvent(type, winid),
3127           m_pos(pt)
3128     { }
3129     wxContextMenuEvent(const wxContextMenuEvent& event)
3130         : wxCommandEvent(event),
3131         m_pos(event.m_pos)
3132     { }
3133 
3134     // Position of event (in screen coordinates)
3135     const wxPoint& GetPosition() const { return m_pos; }
3136     void SetPosition(const wxPoint& pos) { m_pos = pos; }
3137 
3138     virtual wxEvent *Clone() const { return new wxContextMenuEvent(*this); }
3139 
3140 protected:
3141     wxPoint   m_pos;
3142 
3143 private:
3144     DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxContextMenuEvent)
3145 };
3146 
3147 
3148 /* TODO
3149  wxEVT_MOUSE_CAPTURE_CHANGED,
3150  wxEVT_SETTING_CHANGED, // WM_WININICHANGE (NT) / WM_SETTINGCHANGE (Win95)
3151 // wxEVT_FONT_CHANGED,  // WM_FONTCHANGE: roll into wxEVT_SETTING_CHANGED, but remember to propagate
3152                         // wxEVT_FONT_CHANGED to all other windows (maybe).
3153  wxEVT_DRAW_ITEM, // Leave these three as virtual functions in wxControl?? Platform-specific.
3154  wxEVT_MEASURE_ITEM,
3155  wxEVT_COMPARE_ITEM
3156 */
3157 
3158 #endif // wxUSE_GUI
3159 
3160 
3161 // ============================================================================
3162 // event handler and related classes
3163 // ============================================================================
3164 
3165 
3166 // struct containing the members common to static and dynamic event tables
3167 // entries
3168 struct WXDLLIMPEXP_BASE wxEventTableEntryBase
3169 {
3170     wxEventTableEntryBase(int winid, int idLast,
3171                           wxEventFunctor* fn, wxObject *data)
3172         : m_id(winid),
3173           m_lastId(idLast),
3174           m_fn(fn),
3175           m_callbackUserData(data)
3176     {
3177         wxASSERT_MSG( idLast == wxID_ANY || winid <= idLast,
3178                       "invalid IDs range: lower bound > upper bound" );
3179     }
3180 
3181     wxEventTableEntryBase( const wxEventTableEntryBase &entry )
3182         : m_id( entry.m_id ),
3183           m_lastId( entry.m_lastId ),
3184           m_fn( entry.m_fn ),
3185           m_callbackUserData( entry.m_callbackUserData )
3186     {
3187         // This is a 'hack' to ensure that only one instance tries to delete
3188         // the functor pointer. It is safe as long as the only place where the
3189         // copy constructor is being called is when the static event tables are
3190         // being initialized (a temporary instance is created and then this
3191         // constructor is called).
3192 
3193         const_cast<wxEventTableEntryBase&>( entry ).m_fn = NULL;
3194     }
3195 
3196     ~wxEventTableEntryBase()
3197     {
3198         delete m_fn;
3199     }
3200 
3201     // the range of ids for this entry: if m_lastId == wxID_ANY, the range
3202     // consists only of m_id, otherwise it is m_id..m_lastId inclusive
3203     int m_id,
3204         m_lastId;
3205 
3206     // function/method/functor to call
3207     wxEventFunctor* m_fn;
3208 
3209     // arbitrary user data associated with the callback
3210     wxObject* m_callbackUserData;
3211 
3212 private:
3213     wxDECLARE_NO_ASSIGN_CLASS(wxEventTableEntryBase);
3214 };
3215 
3216 // an entry from a static event table
3217 struct WXDLLIMPEXP_BASE wxEventTableEntry : public wxEventTableEntryBase
3218 {
3219     wxEventTableEntry(const int& evType, int winid, int idLast,
3220                       wxEventFunctor* fn, wxObject *data)
3221         : wxEventTableEntryBase(winid, idLast, fn, data),
3222         m_eventType(evType)
3223     { }
3224 
3225     // the reference to event type: this allows us to not care about the
3226     // (undefined) order in which the event table entries and the event types
3227     // are initialized: initially the value of this reference might be
3228     // invalid, but by the time it is used for the first time, all global
3229     // objects will have been initialized (including the event type constants)
3230     // and so it will have the correct value when it is needed
3231     const int& m_eventType;
3232 
3233 private:
3234     wxDECLARE_NO_ASSIGN_CLASS(wxEventTableEntry);
3235 };
3236 
3237 // an entry used in dynamic event table managed by wxEvtHandler::Connect()
3238 struct WXDLLIMPEXP_BASE wxDynamicEventTableEntry : public wxEventTableEntryBase
3239 {
3240     wxDynamicEventTableEntry(int evType, int winid, int idLast,
3241                              wxEventFunctor* fn, wxObject *data)
3242         : wxEventTableEntryBase(winid, idLast, fn, data),
3243           m_eventType(evType)
3244     { }
3245 
3246     // not a reference here as we can't keep a reference to a temporary int
3247     // created to wrap the constant value typically passed to Connect() - nor
3248     // do we need it
3249     int m_eventType;
3250 
3251 private:
3252     wxDECLARE_NO_ASSIGN_CLASS(wxDynamicEventTableEntry);
3253 };
3254 
3255 // ----------------------------------------------------------------------------
3256 // wxEventTable: an array of event entries terminated with {0, 0, 0, 0, 0}
3257 // ----------------------------------------------------------------------------
3258 
3259 struct WXDLLIMPEXP_BASE wxEventTable
3260 {
3261     const wxEventTable *baseTable;    // base event table (next in chain)
3262     const wxEventTableEntry *entries; // bottom of entry array
3263 };
3264 
3265 // ----------------------------------------------------------------------------
3266 // wxEventHashTable: a helper of wxEvtHandler to speed up wxEventTable lookups.
3267 // ----------------------------------------------------------------------------
3268 
3269 WX_DEFINE_ARRAY_PTR(const wxEventTableEntry*, wxEventTableEntryPointerArray);
3270 
3271 class WXDLLIMPEXP_BASE wxEventHashTable
3272 {
3273 private:
3274     // Internal data structs
3275     struct EventTypeTable
3276     {
3277         wxEventType                   eventType;
3278         wxEventTableEntryPointerArray eventEntryTable;
3279     };
3280     typedef EventTypeTable* EventTypeTablePointer;
3281 
3282 public:
3283     // Constructor, needs the event table it needs to hash later on.
3284     // Note: hashing of the event table is not done in the constructor as it
3285     //       can be that the event table is not yet full initialize, the hash
3286     //       will gets initialized when handling the first event look-up request.
3287     wxEventHashTable(const wxEventTable &table);
3288     // Destructor.
3289     ~wxEventHashTable();
3290 
3291     // Handle the given event, in other words search the event table hash
3292     // and call self->ProcessEvent() if a match was found.
3293     bool HandleEvent(wxEvent& event, wxEvtHandler *self);
3294 
3295     // Clear table
3296     void Clear();
3297 
3298 #if wxUSE_MEMORY_TRACING
3299     // Clear all tables: only used to work around problems in memory tracing
3300     // code
3301     static void ClearAll();
3302 #endif // wxUSE_MEMORY_TRACING
3303 
3304 protected:
3305     // Init the hash table with the entries of the static event table.
3306     void InitHashTable();
3307     // Helper function of InitHashTable() to insert 1 entry into the hash table.
3308     void AddEntry(const wxEventTableEntry &entry);
3309     // Allocate and init with null pointers the base hash table.
3310     void AllocEventTypeTable(size_t size);
3311     // Grow the hash table in size and transfer all items currently
3312     // in the table to the correct location in the new table.
3313     void GrowEventTypeTable();
3314 
3315 protected:
3316     const wxEventTable    &m_table;
3317     bool                   m_rebuildHash;
3318 
3319     size_t                 m_size;
3320     EventTypeTablePointer *m_eventTypeTable;
3321 
3322     static wxEventHashTable* sm_first;
3323     wxEventHashTable* m_previous;
3324     wxEventHashTable* m_next;
3325 
3326     wxDECLARE_NO_COPY_CLASS(wxEventHashTable);
3327 };
3328 
3329 // ----------------------------------------------------------------------------
3330 // wxEvtHandler: the base class for all objects handling wxWidgets events
3331 // ----------------------------------------------------------------------------
3332 
3333 class WXDLLIMPEXP_BASE wxEvtHandler : public wxObject
3334                                     , public wxTrackable
3335 {
3336 public:
3337     wxEvtHandler();
3338     virtual ~wxEvtHandler();
3339 
3340 
3341     // Event handler chain
3342     // -------------------
3343 
3344     wxEvtHandler *GetNextHandler() const { return m_nextHandler; }
3345     wxEvtHandler *GetPreviousHandler() const { return m_previousHandler; }
3346     virtual void SetNextHandler(wxEvtHandler *handler) { m_nextHandler = handler; }
3347     virtual void SetPreviousHandler(wxEvtHandler *handler) { m_previousHandler = handler; }
3348 
3349     void SetEvtHandlerEnabled(bool enabled) { m_enabled = enabled; }
3350     bool GetEvtHandlerEnabled() const { return m_enabled; }
3351 
3352     void Unlink();
3353     bool IsUnlinked() const;
3354 
3355 
3356     // Global event filters
3357     // --------------------
3358 
3359     // Add an event filter whose FilterEvent() method will be called for each
3360     // and every event processed by wxWidgets. The filters are called in LIFO
3361     // order and wxApp is registered as an event filter by default. The pointer
3362     // must remain valid until it's removed with RemoveFilter() and is not
3363     // deleted by wxEvtHandler.
3364     static void AddFilter(wxEventFilter* filter);
3365 
3366     // Remove a filter previously installed with AddFilter().
3367     static void RemoveFilter(wxEventFilter* filter);
3368 
3369 
3370     // Event queuing and processing
3371     // ----------------------------
3372 
3373     // Process an event right now: this can only be called from the main
3374     // thread, use QueueEvent() for scheduling the events for
3375     // processing from other threads.
3376     virtual bool ProcessEvent(wxEvent& event);
3377 
3378     // Process an event by calling ProcessEvent and handling any exceptions
3379     // thrown by event handlers. It's mostly useful when processing wx events
3380     // when called from C code (e.g. in GTK+ callback) when the exception
3381     // wouldn't correctly propagate to wxEventLoop.
3382     bool SafelyProcessEvent(wxEvent& event);
3383         // NOTE: uses ProcessEvent()
3384 
3385     // This method tries to process the event in this event handler, including
3386     // any preprocessing done by TryBefore() and all the handlers chained to
3387     // it, but excluding the post-processing done in TryAfter().
3388     //
3389     // It is meant to be called from ProcessEvent() only and is not virtual,
3390     // additional event handlers can be hooked into the normal event processing
3391     // logic using TryBefore() and TryAfter() hooks.
3392     //
3393     // You can also call it yourself to forward an event to another handler but
3394     // without propagating it upwards if it's unhandled (this is usually
3395     // unwanted when forwarding as the original handler would already do it if
3396     // needed normally).
3397     bool ProcessEventLocally(wxEvent& event);
3398 
3399     // Schedule the given event to be processed later. It takes ownership of
3400     // the event pointer, i.e. it will be deleted later. This is safe to call
3401     // from multiple threads although you still need to ensure that wxString
3402     // fields of the event object are deep copies and not use the same string
3403     // buffer as other wxString objects in this thread.
3404     virtual void QueueEvent(wxEvent *event);
3405 
3406     // Add an event to be processed later: notice that this function is not
3407     // safe to call from threads other than main, use QueueEvent()
3408     virtual void AddPendingEvent(const wxEvent& event)
3409     {
3410         // notice that the thread-safety problem comes from the fact that
3411         // Clone() doesn't make deep copies of wxString fields of wxEvent
3412         // object and so the same wxString could be used from both threads when
3413         // the event object is destroyed in this one -- QueueEvent() avoids
3414         // this problem as the event pointer is not used any more in this
3415         // thread at all after it is called.
3416         QueueEvent(event.Clone());
3417     }
3418 
3419     void ProcessPendingEvents();
3420         // NOTE: uses ProcessEvent()
3421 
3422     void DeletePendingEvents();
3423 
3424 #if wxUSE_THREADS
3425     bool ProcessThreadEvent(const wxEvent& event);
3426         // NOTE: uses AddPendingEvent(); call only from secondary threads
3427 #endif
3428 
3429 #ifdef wxHAS_CALL_AFTER
3430     // Asynchronous method calls: these methods schedule the given method
3431     // pointer for a later call (during the next idle event loop iteration).
3432     //
3433     // Notice that the method is called on this object itself, so the object
3434     // CallAfter() is called on must have the correct dynamic type.
3435     //
3436     // These method can be used from another thread.
3437 
3438     template <typename T>
3439     void CallAfter(void (T::*method)())
3440     {
3441         QueueEvent(
3442             new wxAsyncMethodCallEvent0<T>(static_cast<T*>(this), method)
3443         );
3444     }
3445 
3446     // Notice that we use P1 and not T1 for the parameter to allow passing
3447     // parameters that are convertible to the type taken by the method
3448     // instead of being exactly the same, to be closer to the usual method call
3449     // semantics.
3450     template <typename T, typename T1, typename P1>
3451     void CallAfter(void (T::*method)(T1 x1), P1 x1)
3452     {
3453         QueueEvent(
3454             new wxAsyncMethodCallEvent1<T, T1>(
3455                 static_cast<T*>(this), method, x1)
3456         );
3457     }
3458 
3459     template <typename T, typename T1, typename T2, typename P1, typename P2>
3460     void CallAfter(void (T::*method)(T1 x1, T2 x2), P1 x1, P2 x2)
3461     {
3462         QueueEvent(
3463             new wxAsyncMethodCallEvent2<T, T1, T2>(
3464                 static_cast<T*>(this), method, x1, x2)
3465         );
3466     }
3467 
3468     template <typename T>
3469     void CallAfter(const T& fn)
3470     {
3471         QueueEvent(new wxAsyncMethodCallEventFunctor<T>(this, fn));
3472     }
3473 #endif // wxHAS_CALL_AFTER
3474 
3475 
3476     // Connecting and disconnecting
3477     // ----------------------------
3478 
3479     // These functions are used for old, untyped, event handlers and don't
3480     // check that the type of the function passed to them actually matches the
3481     // type of the event. They also only allow connecting events to methods of
3482     // wxEvtHandler-derived classes.
3483     //
3484     // The template Connect() methods below are safer and allow connecting
3485     // events to arbitrary functions or functors -- but require compiler
3486     // support for templates.
3487 
3488     // Dynamic association of a member function handler with the event handler,
3489     // winid and event type
3490     void Connect(int winid,
3491                  int lastId,
3492                  wxEventType eventType,
3493                  wxObjectEventFunction func,
3494                  wxObject *userData = NULL,
3495                  wxEvtHandler *eventSink = NULL)
3496     {
3497         DoBind(winid, lastId, eventType,
3498                   wxNewEventFunctor(eventType, func, eventSink),
3499                   userData);
3500     }
3501 
3502     // Convenience function: take just one id
3503     void Connect(int winid,
3504                  wxEventType eventType,
3505                  wxObjectEventFunction func,
3506                  wxObject *userData = NULL,
3507                  wxEvtHandler *eventSink = NULL)
3508         { Connect(winid, wxID_ANY, eventType, func, userData, eventSink); }
3509 
3510     // Even more convenient: without id (same as using id of wxID_ANY)
3511     void Connect(wxEventType eventType,
3512                  wxObjectEventFunction func,
3513                  wxObject *userData = NULL,
3514                  wxEvtHandler *eventSink = NULL)
3515         { Connect(wxID_ANY, wxID_ANY, eventType, func, userData, eventSink); }
3516 
3517     bool Disconnect(int winid,
3518                     int lastId,
3519                     wxEventType eventType,
3520                     wxObjectEventFunction func = NULL,
3521                     wxObject *userData = NULL,
3522                     wxEvtHandler *eventSink = NULL)
3523     {
3524         return DoUnbind(winid, lastId, eventType,
3525                             wxMakeEventFunctor(eventType, func, eventSink),
3526                             userData );
3527     }
3528 
3529     bool Disconnect(int winid = wxID_ANY,
3530                     wxEventType eventType = wxEVT_NULL,
3531                     wxObjectEventFunction func = NULL,
3532                     wxObject *userData = NULL,
3533                     wxEvtHandler *eventSink = NULL)
3534         { return Disconnect(winid, wxID_ANY, eventType, func, userData, eventSink); }
3535 
3536     bool Disconnect(wxEventType eventType,
3537                     wxObjectEventFunction func,
3538                     wxObject *userData = NULL,
3539                     wxEvtHandler *eventSink = NULL)
3540         { return Disconnect(wxID_ANY, eventType, func, userData, eventSink); }
3541 
3542 #ifdef wxHAS_EVENT_BIND
3543     // Bind functions to an event:
3544     template <typename EventTag, typename EventArg>
3545     void Bind(const EventTag& eventType,
3546               void (*function)(EventArg &),
3547               int winid = wxID_ANY,
3548               int lastId = wxID_ANY,
3549               wxObject *userData = NULL)
3550     {
3551         DoBind(winid, lastId, eventType,
3552                   wxNewEventFunctor(eventType, function),
3553                   userData);
3554     }
3555 
3556 
3557     template <typename EventTag, typename EventArg>
3558     bool Unbind(const EventTag& eventType,
3559                 void (*function)(EventArg &),
3560                 int winid = wxID_ANY,
3561                 int lastId = wxID_ANY,
3562                 wxObject *userData = NULL)
3563     {
3564         return DoUnbind(winid, lastId, eventType,
3565                             wxMakeEventFunctor(eventType, function),
3566                             userData);
3567     }
3568 
3569     // Bind functors to an event:
3570     template <typename EventTag, typename Functor>
3571     void Bind(const EventTag& eventType,
3572               const Functor &functor,
3573               int winid = wxID_ANY,
3574               int lastId = wxID_ANY,
3575               wxObject *userData = NULL)
3576     {
3577         DoBind(winid, lastId, eventType,
3578                   wxNewEventFunctor(eventType, functor),
3579                   userData);
3580     }
3581 
3582 
3583     template <typename EventTag, typename Functor>
3584     bool Unbind(const EventTag& eventType,
3585                 const Functor &functor,
3586                 int winid = wxID_ANY,
3587                 int lastId = wxID_ANY,
3588                 wxObject *userData = NULL)
3589     {
3590         return DoUnbind(winid, lastId, eventType,
3591                             wxMakeEventFunctor(eventType, functor),
3592                             userData);
3593     }
3594 
3595 
3596     // Bind a method of a class (called on the specified handler which must
3597     // be convertible to this class) object to an event:
3598 
3599     template <typename EventTag, typename Class, typename EventArg, typename EventHandler>
3600     void Bind(const EventTag &eventType,
3601               void (Class::*method)(EventArg &),
3602               EventHandler *handler,
3603               int winid = wxID_ANY,
3604               int lastId = wxID_ANY,
3605               wxObject *userData = NULL)
3606     {
3607         DoBind(winid, lastId, eventType,
3608                   wxNewEventFunctor(eventType, method, handler),
3609                   userData);
3610     }
3611 
3612     template <typename EventTag, typename Class, typename EventArg, typename EventHandler>
3613     bool Unbind(const EventTag &eventType,
3614                 void (Class::*method)(EventArg&),
3615                 EventHandler *handler,
3616                 int winid = wxID_ANY,
3617                 int lastId = wxID_ANY,
3618                 wxObject *userData = NULL )
3619     {
3620         return DoUnbind(winid, lastId, eventType,
3621                             wxMakeEventFunctor(eventType, method, handler),
3622                             userData);
3623     }
3624 #endif // wxHAS_EVENT_BIND
3625 
3626     wxList* GetDynamicEventTable() const { return m_dynamicEvents ; }
3627 
3628     // User data can be associated with each wxEvtHandler
3629     void SetClientObject( wxClientData *data ) { DoSetClientObject(data); }
3630     wxClientData *GetClientObject() const { return DoGetClientObject(); }
3631 
3632     void SetClientData( void *data ) { DoSetClientData(data); }
3633     void *GetClientData() const { return DoGetClientData(); }
3634 
3635 
3636     // implementation from now on
3637     // --------------------------
3638 
3639     // check if the given event table entry matches this event by id (the check
3640     // for the event type should be done by caller) and call the handler if it
3641     // does
3642     //
3643     // return true if the event was processed, false otherwise (no match or the
3644     // handler decided to skip the event)
3645     static bool ProcessEventIfMatchesId(const wxEventTableEntryBase& tableEntry,
3646                                         wxEvtHandler *handler,
3647                                         wxEvent& event);
3648 
3649     virtual bool SearchEventTable(wxEventTable& table, wxEvent& event);
3650     bool SearchDynamicEventTable( wxEvent& event );
3651 
3652     // Avoid problems at exit by cleaning up static hash table gracefully
3653     void ClearEventHashTable() { GetEventHashTable().Clear(); }
3654     void OnSinkDestroyed( wxEvtHandler *sink );
3655 
3656 
3657 private:
3658     void DoBind(int winid,
3659                    int lastId,
3660                    wxEventType eventType,
3661                    wxEventFunctor *func,
3662                    wxObject* userData = NULL);
3663 
3664     bool DoUnbind(int winid,
3665                       int lastId,
3666                       wxEventType eventType,
3667                       const wxEventFunctor& func,
3668                       wxObject *userData = NULL);
3669 
3670     static const wxEventTableEntry sm_eventTableEntries[];
3671 
3672 protected:
3673     // hooks for wxWindow used by ProcessEvent()
3674     // -----------------------------------------
3675 
3676     // this one is called before trying our own event table to allow plugging
3677     // in the event handlers overriding the default logic, this is used by e.g.
3678     // validators.
3679     virtual bool TryBefore(wxEvent& event);
3680 
3681     // This one is not a hook but just a helper which looks up the handler in
3682     // this object itself.
3683     //
3684     // It is called from ProcessEventLocally() and normally shouldn't be called
3685     // directly as doing it would ignore any chained event handlers
3686     bool TryHereOnly(wxEvent& event);
3687 
3688     // Another helper which simply calls pre-processing hook and then tries to
3689     // handle the event at this handler level.
3690     bool TryBeforeAndHere(wxEvent& event)
3691     {
3692         return TryBefore(event) || TryHereOnly(event);
3693     }
3694 
3695     // this one is called after failing to find the event handle in our own
3696     // table to give a chance to the other windows to process it
3697     //
3698     // base class implementation passes the event to wxTheApp
3699     virtual bool TryAfter(wxEvent& event);
3700 
3701 #if WXWIN_COMPATIBILITY_2_8
3702     // deprecated method: override TryBefore() instead of this one
3703     wxDEPRECATED_BUT_USED_INTERNALLY_INLINE(
3704         virtual bool TryValidator(wxEvent& WXUNUSED(event)), return false; )
3705 
3706     wxDEPRECATED_BUT_USED_INTERNALLY_INLINE(
3707         virtual bool TryParent(wxEvent& event), return DoTryApp(event); )
3708 #endif // WXWIN_COMPATIBILITY_2_8
3709 
3710 
3711     static const wxEventTable sm_eventTable;
3712     virtual const wxEventTable *GetEventTable() const;
3713 
3714     static wxEventHashTable   sm_eventHashTable;
3715     virtual wxEventHashTable& GetEventHashTable() const;
3716 
3717     wxEvtHandler*       m_nextHandler;
3718     wxEvtHandler*       m_previousHandler;
3719     wxList*             m_dynamicEvents;
3720     wxList*             m_pendingEvents;
3721 
3722 #if wxUSE_THREADS
3723     // critical section protecting m_pendingEvents
3724     wxCriticalSection m_pendingEventsLock;
3725 #endif // wxUSE_THREADS
3726 
3727     // Is event handler enabled?
3728     bool                m_enabled;
3729 
3730 
3731     // The user data: either an object which will be deleted by the container
3732     // when it's deleted or some raw pointer which we do nothing with - only
3733     // one type of data can be used with the given window (i.e. you cannot set
3734     // the void data and then associate the container with wxClientData or vice
3735     // versa)
3736     union
3737     {
3738         wxClientData *m_clientObject;
3739         void         *m_clientData;
3740     };
3741 
3742     // what kind of data do we have?
3743     wxClientDataType m_clientDataType;
3744 
3745     // client data accessors
3746     virtual void DoSetClientObject( wxClientData *data );
3747     virtual wxClientData *DoGetClientObject() const;
3748 
3749     virtual void DoSetClientData( void *data );
3750     virtual void *DoGetClientData() const;
3751 
3752     // Search tracker objects for event connection with this sink
3753     wxEventConnectionRef *FindRefInTrackerList(wxEvtHandler *handler);
3754 
3755 private:
3756     // pass the event to wxTheApp instance, called from TryAfter()
3757     bool DoTryApp(wxEvent& event);
3758 
3759     // try to process events in all handlers chained to this one
3760     bool DoTryChain(wxEvent& event);
3761 
3762     // Head of the event filter linked list.
3763     static wxEventFilter* ms_filterList;
3764 
3765     DECLARE_DYNAMIC_CLASS_NO_COPY(wxEvtHandler)
3766 };
3767 
3768 WX_DEFINE_ARRAY_WITH_DECL_PTR(wxEvtHandler *, wxEvtHandlerArray, class WXDLLIMPEXP_BASE);
3769 
3770 
3771 // Define an inline method of wxObjectEventFunctor which couldn't be defined
3772 // before wxEvtHandler declaration: at least Sun CC refuses to compile function
3773 // calls through pointer to member for forward-declared classes (see #12452).
3774 inline void wxObjectEventFunctor::operator()(wxEvtHandler *handler, wxEvent& event)
3775 {
3776     wxEvtHandler * const realHandler = m_handler ? m_handler : handler;
3777 
3778     (realHandler->*m_method)(event);
3779 }
3780 
3781 // ----------------------------------------------------------------------------
3782 // wxEventConnectionRef represents all connections between two event handlers
3783 // and enables automatic disconnect when an event handler sink goes out of
3784 // scope. Each connection/disconnect increases/decreases ref count, and
3785 // when it reaches zero the node goes out of scope.
3786 // ----------------------------------------------------------------------------
3787 
3788 class wxEventConnectionRef : public wxTrackerNode
3789 {
3790 public:
3791     wxEventConnectionRef() : m_src(NULL), m_sink(NULL), m_refCount(0) { }
3792     wxEventConnectionRef(wxEvtHandler *src, wxEvtHandler *sink)
3793         : m_src(src), m_sink(sink), m_refCount(1)
3794     {
3795         m_sink->AddNode(this);
3796     }
3797 
3798     // The sink is being destroyed
3799     virtual void OnObjectDestroy( )
3800     {
3801         if ( m_src )
3802             m_src->OnSinkDestroyed( m_sink );
3803         delete this;
3804     }
3805 
3806     virtual wxEventConnectionRef *ToEventConnection() { return this; }
3807 
3808     void IncRef() { m_refCount++; }
3809     void DecRef()
3810     {
3811         if ( !--m_refCount )
3812         {
3813             // The sink holds the only external pointer to this object
3814             if ( m_sink )
3815                 m_sink->RemoveNode(this);
3816             delete this;
3817         }
3818     }
3819 
3820 private:
3821     wxEvtHandler *m_src,
3822                  *m_sink;
3823     int m_refCount;
3824 
3825     friend class wxEvtHandler;
3826 
3827     wxDECLARE_NO_ASSIGN_CLASS(wxEventConnectionRef);
3828 };
3829 
3830 // Post a message to the given event handler which will be processed during the
3831 // next event loop iteration.
3832 //
3833 // Notice that this one is not thread-safe, use wxQueueEvent()
3834 inline void wxPostEvent(wxEvtHandler *dest, const wxEvent& event)
3835 {
3836     wxCHECK_RET( dest, "need an object to post event to" );
3837 
3838     dest->AddPendingEvent(event);
3839 }
3840 
3841 // Wrapper around wxEvtHandler::QueueEvent(): adds an event for later
3842 // processing, unlike wxPostEvent it is safe to use from different thread even
3843 // for events with wxString members
3844 inline void wxQueueEvent(wxEvtHandler *dest, wxEvent *event)
3845 {
3846     wxCHECK_RET( dest, "need an object to queue event for" );
3847 
3848     dest->QueueEvent(event);
3849 }
3850 
3851 typedef void (wxEvtHandler::*wxEventFunction)(wxEvent&);
3852 typedef void (wxEvtHandler::*wxIdleEventFunction)(wxIdleEvent&);
3853 typedef void (wxEvtHandler::*wxThreadEventFunction)(wxThreadEvent&);
3854 
3855 #define wxEventHandler(func) \
3856     wxEVENT_HANDLER_CAST(wxEventFunction, func)
3857 #define wxIdleEventHandler(func) \
3858     wxEVENT_HANDLER_CAST(wxIdleEventFunction, func)
3859 #define wxThreadEventHandler(func) \
3860     wxEVENT_HANDLER_CAST(wxThreadEventFunction, func)
3861 
3862 #if wxUSE_GUI
3863 
3864 // ----------------------------------------------------------------------------
3865 // wxEventBlocker: helper class to temporarily disable event handling for a window
3866 // ----------------------------------------------------------------------------
3867 
3868 class WXDLLIMPEXP_CORE wxEventBlocker : public wxEvtHandler
3869 {
3870 public:
3871     wxEventBlocker(wxWindow *win, wxEventType type = wxEVT_ANY);
3872     virtual ~wxEventBlocker();
3873 
3874     void Block(wxEventType type)
3875     {
3876         m_eventsToBlock.push_back(type);
3877     }
3878 
3879     virtual bool ProcessEvent(wxEvent& event);
3880 
3881 protected:
3882     wxArrayInt m_eventsToBlock;
3883     wxWindow *m_window;
3884 
3885     wxDECLARE_NO_COPY_CLASS(wxEventBlocker);
3886 };
3887 
3888 typedef void (wxEvtHandler::*wxCommandEventFunction)(wxCommandEvent&);
3889 typedef void (wxEvtHandler::*wxScrollEventFunction)(wxScrollEvent&);
3890 typedef void (wxEvtHandler::*wxScrollWinEventFunction)(wxScrollWinEvent&);
3891 typedef void (wxEvtHandler::*wxSizeEventFunction)(wxSizeEvent&);
3892 typedef void (wxEvtHandler::*wxMoveEventFunction)(wxMoveEvent&);
3893 typedef void (wxEvtHandler::*wxPaintEventFunction)(wxPaintEvent&);
3894 typedef void (wxEvtHandler::*wxNcPaintEventFunction)(wxNcPaintEvent&);
3895 typedef void (wxEvtHandler::*wxEraseEventFunction)(wxEraseEvent&);
3896 typedef void (wxEvtHandler::*wxMouseEventFunction)(wxMouseEvent&);
3897 typedef void (wxEvtHandler::*wxCharEventFunction)(wxKeyEvent&);
3898 typedef void (wxEvtHandler::*wxFocusEventFunction)(wxFocusEvent&);
3899 typedef void (wxEvtHandler::*wxChildFocusEventFunction)(wxChildFocusEvent&);
3900 typedef void (wxEvtHandler::*wxActivateEventFunction)(wxActivateEvent&);
3901 typedef void (wxEvtHandler::*wxMenuEventFunction)(wxMenuEvent&);
3902 typedef void (wxEvtHandler::*wxJoystickEventFunction)(wxJoystickEvent&);
3903 typedef void (wxEvtHandler::*wxDropFilesEventFunction)(wxDropFilesEvent&);
3904 typedef void (wxEvtHandler::*wxInitDialogEventFunction)(wxInitDialogEvent&);
3905 typedef void (wxEvtHandler::*wxSysColourChangedEventFunction)(wxSysColourChangedEvent&);
3906 typedef void (wxEvtHandler::*wxDisplayChangedEventFunction)(wxDisplayChangedEvent&);
3907 typedef void (wxEvtHandler::*wxUpdateUIEventFunction)(wxUpdateUIEvent&);
3908 typedef void (wxEvtHandler::*wxCloseEventFunction)(wxCloseEvent&);
3909 typedef void (wxEvtHandler::*wxShowEventFunction)(wxShowEvent&);
3910 typedef void (wxEvtHandler::*wxIconizeEventFunction)(wxIconizeEvent&);
3911 typedef void (wxEvtHandler::*wxMaximizeEventFunction)(wxMaximizeEvent&);
3912 typedef void (wxEvtHandler::*wxNavigationKeyEventFunction)(wxNavigationKeyEvent&);
3913 typedef void (wxEvtHandler::*wxPaletteChangedEventFunction)(wxPaletteChangedEvent&);
3914 typedef void (wxEvtHandler::*wxQueryNewPaletteEventFunction)(wxQueryNewPaletteEvent&);
3915 typedef void (wxEvtHandler::*wxWindowCreateEventFunction)(wxWindowCreateEvent&);
3916 typedef void (wxEvtHandler::*wxWindowDestroyEventFunction)(wxWindowDestroyEvent&);
3917 typedef void (wxEvtHandler::*wxSetCursorEventFunction)(wxSetCursorEvent&);
3918 typedef void (wxEvtHandler::*wxNotifyEventFunction)(wxNotifyEvent&);
3919 typedef void (wxEvtHandler::*wxHelpEventFunction)(wxHelpEvent&);
3920 typedef void (wxEvtHandler::*wxContextMenuEventFunction)(wxContextMenuEvent&);
3921 typedef void (wxEvtHandler::*wxMouseCaptureChangedEventFunction)(wxMouseCaptureChangedEvent&);
3922 typedef void (wxEvtHandler::*wxMouseCaptureLostEventFunction)(wxMouseCaptureLostEvent&);
3923 typedef void (wxEvtHandler::*wxClipboardTextEventFunction)(wxClipboardTextEvent&);
3924 
3925 
3926 #define wxCommandEventHandler(func) \
3927     wxEVENT_HANDLER_CAST(wxCommandEventFunction, func)
3928 #define wxScrollEventHandler(func) \
3929     wxEVENT_HANDLER_CAST(wxScrollEventFunction, func)
3930 #define wxScrollWinEventHandler(func) \
3931     wxEVENT_HANDLER_CAST(wxScrollWinEventFunction, func)
3932 #define wxSizeEventHandler(func) \
3933     wxEVENT_HANDLER_CAST(wxSizeEventFunction, func)
3934 #define wxMoveEventHandler(func) \
3935     wxEVENT_HANDLER_CAST(wxMoveEventFunction, func)
3936 #define wxPaintEventHandler(func) \
3937     wxEVENT_HANDLER_CAST(wxPaintEventFunction, func)
3938 #define wxNcPaintEventHandler(func) \
3939     wxEVENT_HANDLER_CAST(wxNcPaintEventFunction, func)
3940 #define wxEraseEventHandler(func) \
3941     wxEVENT_HANDLER_CAST(wxEraseEventFunction, func)
3942 #define wxMouseEventHandler(func) \
3943     wxEVENT_HANDLER_CAST(wxMouseEventFunction, func)
3944 #define wxCharEventHandler(func) \
3945     wxEVENT_HANDLER_CAST(wxCharEventFunction, func)
3946 #define wxKeyEventHandler(func) wxCharEventHandler(func)
3947 #define wxFocusEventHandler(func) \
3948     wxEVENT_HANDLER_CAST(wxFocusEventFunction, func)
3949 #define wxChildFocusEventHandler(func) \
3950     wxEVENT_HANDLER_CAST(wxChildFocusEventFunction, func)
3951 #define wxActivateEventHandler(func) \
3952     wxEVENT_HANDLER_CAST(wxActivateEventFunction, func)
3953 #define wxMenuEventHandler(func) \
3954     wxEVENT_HANDLER_CAST(wxMenuEventFunction, func)
3955 #define wxJoystickEventHandler(func) \
3956     wxEVENT_HANDLER_CAST(wxJoystickEventFunction, func)
3957 #define wxDropFilesEventHandler(func) \
3958     wxEVENT_HANDLER_CAST(wxDropFilesEventFunction, func)
3959 #define wxInitDialogEventHandler(func) \
3960     wxEVENT_HANDLER_CAST(wxInitDialogEventFunction, func)
3961 #define wxSysColourChangedEventHandler(func) \
3962     wxEVENT_HANDLER_CAST(wxSysColourChangedEventFunction, func)
3963 #define wxDisplayChangedEventHandler(func) \
3964     wxEVENT_HANDLER_CAST(wxDisplayChangedEventFunction, func)
3965 #define wxUpdateUIEventHandler(func) \
3966     wxEVENT_HANDLER_CAST(wxUpdateUIEventFunction, func)
3967 #define wxCloseEventHandler(func) \
3968     wxEVENT_HANDLER_CAST(wxCloseEventFunction, func)
3969 #define wxShowEventHandler(func) \
3970     wxEVENT_HANDLER_CAST(wxShowEventFunction, func)
3971 #define wxIconizeEventHandler(func) \
3972     wxEVENT_HANDLER_CAST(wxIconizeEventFunction, func)
3973 #define wxMaximizeEventHandler(func) \
3974     wxEVENT_HANDLER_CAST(wxMaximizeEventFunction, func)
3975 #define wxNavigationKeyEventHandler(func) \
3976     wxEVENT_HANDLER_CAST(wxNavigationKeyEventFunction, func)
3977 #define wxPaletteChangedEventHandler(func) \
3978     wxEVENT_HANDLER_CAST(wxPaletteChangedEventFunction, func)
3979 #define wxQueryNewPaletteEventHandler(func) \
3980     wxEVENT_HANDLER_CAST(wxQueryNewPaletteEventFunction, func)
3981 #define wxWindowCreateEventHandler(func) \
3982     wxEVENT_HANDLER_CAST(wxWindowCreateEventFunction, func)
3983 #define wxWindowDestroyEventHandler(func) \
3984     wxEVENT_HANDLER_CAST(wxWindowDestroyEventFunction, func)
3985 #define wxSetCursorEventHandler(func) \
3986     wxEVENT_HANDLER_CAST(wxSetCursorEventFunction, func)
3987 #define wxNotifyEventHandler(func) \
3988     wxEVENT_HANDLER_CAST(wxNotifyEventFunction, func)
3989 #define wxHelpEventHandler(func) \
3990     wxEVENT_HANDLER_CAST(wxHelpEventFunction, func)
3991 #define wxContextMenuEventHandler(func) \
3992     wxEVENT_HANDLER_CAST(wxContextMenuEventFunction, func)
3993 #define wxMouseCaptureChangedEventHandler(func) \
3994     wxEVENT_HANDLER_CAST(wxMouseCaptureChangedEventFunction, func)
3995 #define wxMouseCaptureLostEventHandler(func) \
3996     wxEVENT_HANDLER_CAST(wxMouseCaptureLostEventFunction, func)
3997 #define wxClipboardTextEventHandler(func) \
3998     wxEVENT_HANDLER_CAST(wxClipboardTextEventFunction, func)
3999 
4000 #endif // wxUSE_GUI
4001 
4002 // N.B. In GNU-WIN32, you *have* to take the address of a member function
4003 // (use &) or the compiler crashes...
4004 
4005 #define wxDECLARE_EVENT_TABLE()                                         \
4006     private:                                                            \
4007         static const wxEventTableEntry sm_eventTableEntries[];          \
4008     protected:                                                          \
4009         static const wxEventTable        sm_eventTable;                 \
4010         virtual const wxEventTable*      GetEventTable() const;         \
4011         static wxEventHashTable          sm_eventHashTable;             \
4012         virtual wxEventHashTable&        GetEventHashTable() const
4013 
4014 // N.B.: when building DLL with Borland C++ 5.5 compiler, you must initialize
4015 //       sm_eventTable before using it in GetEventTable() or the compiler gives
4016 //       E2233 (see http://groups.google.com/groups?selm=397dcc8a%241_2%40dnews)
4017 
4018 #define wxBEGIN_EVENT_TABLE(theClass, baseClass) \
4019     const wxEventTable theClass::sm_eventTable = \
4020         { &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \
4021     const wxEventTable *theClass::GetEventTable() const \
4022         { return &theClass::sm_eventTable; } \
4023     wxEventHashTable theClass::sm_eventHashTable(theClass::sm_eventTable); \
4024     wxEventHashTable &theClass::GetEventHashTable() const \
4025         { return theClass::sm_eventHashTable; } \
4026     const wxEventTableEntry theClass::sm_eventTableEntries[] = { \
4027 
4028 #define wxBEGIN_EVENT_TABLE_TEMPLATE1(theClass, baseClass, T1) \
4029     template<typename T1> \
4030     const wxEventTable theClass<T1>::sm_eventTable = \
4031         { &baseClass::sm_eventTable, &theClass<T1>::sm_eventTableEntries[0] }; \
4032     template<typename T1> \
4033     const wxEventTable *theClass<T1>::GetEventTable() const \
4034         { return &theClass<T1>::sm_eventTable; } \
4035     template<typename T1> \
4036     wxEventHashTable theClass<T1>::sm_eventHashTable(theClass<T1>::sm_eventTable); \
4037     template<typename T1> \
4038     wxEventHashTable &theClass<T1>::GetEventHashTable() const \
4039         { return theClass<T1>::sm_eventHashTable; } \
4040     template<typename T1> \
4041     const wxEventTableEntry theClass<T1>::sm_eventTableEntries[] = { \
4042 
4043 #define wxBEGIN_EVENT_TABLE_TEMPLATE2(theClass, baseClass, T1, T2) \
4044     template<typename T1, typename T2> \
4045     const wxEventTable theClass<T1, T2>::sm_eventTable = \
4046         { &baseClass::sm_eventTable, &theClass<T1, T2>::sm_eventTableEntries[0] }; \
4047     template<typename T1, typename T2> \
4048     const wxEventTable *theClass<T1, T2>::GetEventTable() const \
4049         { return &theClass<T1, T2>::sm_eventTable; } \
4050     template<typename T1, typename T2> \
4051     wxEventHashTable theClass<T1, T2>::sm_eventHashTable(theClass<T1, T2>::sm_eventTable); \
4052     template<typename T1, typename T2> \
4053     wxEventHashTable &theClass<T1, T2>::GetEventHashTable() const \
4054         { return theClass<T1, T2>::sm_eventHashTable; } \
4055     template<typename T1, typename T2> \
4056     const wxEventTableEntry theClass<T1, T2>::sm_eventTableEntries[] = { \
4057 
4058 #define wxBEGIN_EVENT_TABLE_TEMPLATE3(theClass, baseClass, T1, T2, T3) \
4059     template<typename T1, typename T2, typename T3> \
4060     const wxEventTable theClass<T1, T2, T3>::sm_eventTable = \
4061         { &baseClass::sm_eventTable, &theClass<T1, T2, T3>::sm_eventTableEntries[0] }; \
4062     template<typename T1, typename T2, typename T3> \
4063     const wxEventTable *theClass<T1, T2, T3>::GetEventTable() const \
4064         { return &theClass<T1, T2, T3>::sm_eventTable; } \
4065     template<typename T1, typename T2, typename T3> \
4066     wxEventHashTable theClass<T1, T2, T3>::sm_eventHashTable(theClass<T1, T2, T3>::sm_eventTable); \
4067     template<typename T1, typename T2, typename T3> \
4068     wxEventHashTable &theClass<T1, T2, T3>::GetEventHashTable() const \
4069         { return theClass<T1, T2, T3>::sm_eventHashTable; } \
4070     template<typename T1, typename T2, typename T3> \
4071     const wxEventTableEntry theClass<T1, T2, T3>::sm_eventTableEntries[] = { \
4072 
4073 #define wxBEGIN_EVENT_TABLE_TEMPLATE4(theClass, baseClass, T1, T2, T3, T4) \
4074     template<typename T1, typename T2, typename T3, typename T4> \
4075     const wxEventTable theClass<T1, T2, T3, T4>::sm_eventTable = \
4076         { &baseClass::sm_eventTable, &theClass<T1, T2, T3, T4>::sm_eventTableEntries[0] }; \
4077     template<typename T1, typename T2, typename T3, typename T4> \
4078     const wxEventTable *theClass<T1, T2, T3, T4>::GetEventTable() const \
4079         { return &theClass<T1, T2, T3, T4>::sm_eventTable; } \
4080     template<typename T1, typename T2, typename T3, typename T4> \
4081     wxEventHashTable theClass<T1, T2, T3, T4>::sm_eventHashTable(theClass<T1, T2, T3, T4>::sm_eventTable); \
4082     template<typename T1, typename T2, typename T3, typename T4> \
4083     wxEventHashTable &theClass<T1, T2, T3, T4>::GetEventHashTable() const \
4084         { return theClass<T1, T2, T3, T4>::sm_eventHashTable; } \
4085     template<typename T1, typename T2, typename T3, typename T4> \
4086     const wxEventTableEntry theClass<T1, T2, T3, T4>::sm_eventTableEntries[] = { \
4087 
4088 #define wxBEGIN_EVENT_TABLE_TEMPLATE5(theClass, baseClass, T1, T2, T3, T4, T5) \
4089     template<typename T1, typename T2, typename T3, typename T4, typename T5> \
4090     const wxEventTable theClass<T1, T2, T3, T4, T5>::sm_eventTable = \
4091         { &baseClass::sm_eventTable, &theClass<T1, T2, T3, T4, T5>::sm_eventTableEntries[0] }; \
4092     template<typename T1, typename T2, typename T3, typename T4, typename T5> \
4093     const wxEventTable *theClass<T1, T2, T3, T4, T5>::GetEventTable() const \
4094         { return &theClass<T1, T2, T3, T4, T5>::sm_eventTable; } \
4095     template<typename T1, typename T2, typename T3, typename T4, typename T5> \
4096     wxEventHashTable theClass<T1, T2, T3, T4, T5>::sm_eventHashTable(theClass<T1, T2, T3, T4, T5>::sm_eventTable); \
4097     template<typename T1, typename T2, typename T3, typename T4, typename T5> \
4098     wxEventHashTable &theClass<T1, T2, T3, T4, T5>::GetEventHashTable() const \
4099         { return theClass<T1, T2, T3, T4, T5>::sm_eventHashTable; } \
4100     template<typename T1, typename T2, typename T3, typename T4, typename T5> \
4101     const wxEventTableEntry theClass<T1, T2, T3, T4, T5>::sm_eventTableEntries[] = { \
4102 
4103 #define wxBEGIN_EVENT_TABLE_TEMPLATE7(theClass, baseClass, T1, T2, T3, T4, T5, T6, T7) \
4104     template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> \
4105     const wxEventTable theClass<T1, T2, T3, T4, T5, T6, T7>::sm_eventTable = \
4106         { &baseClass::sm_eventTable, &theClass<T1, T2, T3, T4, T5, T6, T7>::sm_eventTableEntries[0] }; \
4107     template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> \
4108     const wxEventTable *theClass<T1, T2, T3, T4, T5, T6, T7>::GetEventTable() const \
4109         { return &theClass<T1, T2, T3, T4, T5, T6, T7>::sm_eventTable; } \
4110     template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> \
4111     wxEventHashTable theClass<T1, T2, T3, T4, T5, T6, T7>::sm_eventHashTable(theClass<T1, T2, T3, T4, T5, T6, T7>::sm_eventTable); \
4112     template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> \
4113     wxEventHashTable &theClass<T1, T2, T3, T4, T5, T6, T7>::GetEventHashTable() const \
4114         { return theClass<T1, T2, T3, T4, T5, T6, T7>::sm_eventHashTable; } \
4115     template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> \
4116     const wxEventTableEntry theClass<T1, T2, T3, T4, T5, T6, T7>::sm_eventTableEntries[] = { \
4117 
4118 #define wxBEGIN_EVENT_TABLE_TEMPLATE8(theClass, baseClass, T1, T2, T3, T4, T5, T6, T7, T8) \
4119     template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> \
4120     const wxEventTable theClass<T1, T2, T3, T4, T5, T6, T7, T8>::sm_eventTable = \
4121         { &baseClass::sm_eventTable, &theClass<T1, T2, T3, T4, T5, T6, T7, T8>::sm_eventTableEntries[0] }; \
4122     template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> \
4123     const wxEventTable *theClass<T1, T2, T3, T4, T5, T6, T7, T8>::GetEventTable() const \
4124         { return &theClass<T1, T2, T3, T4, T5, T6, T7, T8>::sm_eventTable; } \
4125     template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> \
4126     wxEventHashTable theClass<T1, T2, T3, T4, T5, T6, T7, T8>::sm_eventHashTable(theClass<T1, T2, T3, T4, T5, T6, T7, T8>::sm_eventTable); \
4127     template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> \
4128     wxEventHashTable &theClass<T1, T2, T3, T4, T5, T6, T7, T8>::GetEventHashTable() const \
4129         { return theClass<T1, T2, T3, T4, T5, T6, T7, T8>::sm_eventHashTable; } \
4130     template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> \
4131     const wxEventTableEntry theClass<T1, T2, T3, T4, T5, T6, T7, T8>::sm_eventTableEntries[] = { \
4132 
4133 #define wxEND_EVENT_TABLE() \
4134     wxDECLARE_EVENT_TABLE_TERMINATOR() };
4135 
4136 /*
4137  * Event table macros
4138  */
4139 
4140 // helpers for writing shorter code below: declare an event macro taking 2, 1
4141 // or none ids (the missing ids default to wxID_ANY)
4142 //
4143 // macro arguments:
4144 //  - evt one of wxEVT_XXX constants
4145 //  - id1, id2 ids of the first/last id
4146 //  - fn the function (should be cast to the right type)
4147 #define wx__DECLARE_EVT2(evt, id1, id2, fn) \
4148     wxDECLARE_EVENT_TABLE_ENTRY(evt, id1, id2, fn, NULL),
4149 #define wx__DECLARE_EVT1(evt, id, fn) \
4150     wx__DECLARE_EVT2(evt, id, wxID_ANY, fn)
4151 #define wx__DECLARE_EVT0(evt, fn) \
4152     wx__DECLARE_EVT1(evt, wxID_ANY, fn)
4153 
4154 
4155 // Generic events
4156 #define EVT_CUSTOM(event, winid, func) \
4157     wx__DECLARE_EVT1(event, winid, wxEventHandler(func))
4158 #define EVT_CUSTOM_RANGE(event, id1, id2, func) \
4159     wx__DECLARE_EVT2(event, id1, id2, wxEventHandler(func))
4160 
4161 // EVT_COMMAND
4162 #define EVT_COMMAND(winid, event, func) \
4163     wx__DECLARE_EVT1(event, winid, wxCommandEventHandler(func))
4164 
4165 #define EVT_COMMAND_RANGE(id1, id2, event, func) \
4166     wx__DECLARE_EVT2(event, id1, id2, wxCommandEventHandler(func))
4167 
4168 #define EVT_NOTIFY(event, winid, func) \
4169     wx__DECLARE_EVT1(event, winid, wxNotifyEventHandler(func))
4170 
4171 #define EVT_NOTIFY_RANGE(event, id1, id2, func) \
4172     wx__DECLARE_EVT2(event, id1, id2, wxNotifyEventHandler(func))
4173 
4174 // Miscellaneous
4175 #define EVT_SIZE(func)  wx__DECLARE_EVT0(wxEVT_SIZE, wxSizeEventHandler(func))
4176 #define EVT_SIZING(func)  wx__DECLARE_EVT0(wxEVT_SIZING, wxSizeEventHandler(func))
4177 #define EVT_MOVE(func)  wx__DECLARE_EVT0(wxEVT_MOVE, wxMoveEventHandler(func))
4178 #define EVT_MOVING(func)  wx__DECLARE_EVT0(wxEVT_MOVING, wxMoveEventHandler(func))
4179 #define EVT_MOVE_START(func)  wx__DECLARE_EVT0(wxEVT_MOVE_START, wxMoveEventHandler(func))
4180 #define EVT_MOVE_END(func)  wx__DECLARE_EVT0(wxEVT_MOVE_END, wxMoveEventHandler(func))
4181 #define EVT_CLOSE(func)  wx__DECLARE_EVT0(wxEVT_CLOSE_WINDOW, wxCloseEventHandler(func))
4182 #define EVT_END_SESSION(func)  wx__DECLARE_EVT0(wxEVT_END_SESSION, wxCloseEventHandler(func))
4183 #define EVT_QUERY_END_SESSION(func)  wx__DECLARE_EVT0(wxEVT_QUERY_END_SESSION, wxCloseEventHandler(func))
4184 #define EVT_PAINT(func)  wx__DECLARE_EVT0(wxEVT_PAINT, wxPaintEventHandler(func))
4185 #define EVT_NC_PAINT(func)  wx__DECLARE_EVT0(wxEVT_NC_PAINT, wxNcPaintEventHandler(func))
4186 #define EVT_ERASE_BACKGROUND(func)  wx__DECLARE_EVT0(wxEVT_ERASE_BACKGROUND, wxEraseEventHandler(func))
4187 #define EVT_CHAR(func)  wx__DECLARE_EVT0(wxEVT_CHAR, wxCharEventHandler(func))
4188 #define EVT_KEY_DOWN(func)  wx__DECLARE_EVT0(wxEVT_KEY_DOWN, wxKeyEventHandler(func))
4189 #define EVT_KEY_UP(func)  wx__DECLARE_EVT0(wxEVT_KEY_UP, wxKeyEventHandler(func))
4190 #if wxUSE_HOTKEY
4191 #define EVT_HOTKEY(winid, func)  wx__DECLARE_EVT1(wxEVT_HOTKEY, winid, wxCharEventHandler(func))
4192 #endif
4193 #define EVT_CHAR_HOOK(func)  wx__DECLARE_EVT0(wxEVT_CHAR_HOOK, wxCharEventHandler(func))
4194 #define EVT_MENU_OPEN(func)  wx__DECLARE_EVT0(wxEVT_MENU_OPEN, wxMenuEventHandler(func))
4195 #define EVT_MENU_CLOSE(func)  wx__DECLARE_EVT0(wxEVT_MENU_CLOSE, wxMenuEventHandler(func))
4196 #define EVT_MENU_HIGHLIGHT(winid, func)  wx__DECLARE_EVT1(wxEVT_MENU_HIGHLIGHT, winid, wxMenuEventHandler(func))
4197 #define EVT_MENU_HIGHLIGHT_ALL(func)  wx__DECLARE_EVT0(wxEVT_MENU_HIGHLIGHT, wxMenuEventHandler(func))
4198 #define EVT_SET_FOCUS(func)  wx__DECLARE_EVT0(wxEVT_SET_FOCUS, wxFocusEventHandler(func))
4199 #define EVT_KILL_FOCUS(func)  wx__DECLARE_EVT0(wxEVT_KILL_FOCUS, wxFocusEventHandler(func))
4200 #define EVT_CHILD_FOCUS(func)  wx__DECLARE_EVT0(wxEVT_CHILD_FOCUS, wxChildFocusEventHandler(func))
4201 #define EVT_ACTIVATE(func)  wx__DECLARE_EVT0(wxEVT_ACTIVATE, wxActivateEventHandler(func))
4202 #define EVT_ACTIVATE_APP(func)  wx__DECLARE_EVT0(wxEVT_ACTIVATE_APP, wxActivateEventHandler(func))
4203 #define EVT_HIBERNATE(func)  wx__DECLARE_EVT0(wxEVT_HIBERNATE, wxActivateEventHandler(func))
4204 #define EVT_END_SESSION(func)  wx__DECLARE_EVT0(wxEVT_END_SESSION, wxCloseEventHandler(func))
4205 #define EVT_QUERY_END_SESSION(func)  wx__DECLARE_EVT0(wxEVT_QUERY_END_SESSION, wxCloseEventHandler(func))
4206 #define EVT_DROP_FILES(func)  wx__DECLARE_EVT0(wxEVT_DROP_FILES, wxDropFilesEventHandler(func))
4207 #define EVT_INIT_DIALOG(func)  wx__DECLARE_EVT0(wxEVT_INIT_DIALOG, wxInitDialogEventHandler(func))
4208 #define EVT_SYS_COLOUR_CHANGED(func) wx__DECLARE_EVT0(wxEVT_SYS_COLOUR_CHANGED, wxSysColourChangedEventHandler(func))
4209 #define EVT_DISPLAY_CHANGED(func)  wx__DECLARE_EVT0(wxEVT_DISPLAY_CHANGED, wxDisplayChangedEventHandler(func))
4210 #define EVT_SHOW(func) wx__DECLARE_EVT0(wxEVT_SHOW, wxShowEventHandler(func))
4211 #define EVT_MAXIMIZE(func) wx__DECLARE_EVT0(wxEVT_MAXIMIZE, wxMaximizeEventHandler(func))
4212 #define EVT_ICONIZE(func) wx__DECLARE_EVT0(wxEVT_ICONIZE, wxIconizeEventHandler(func))
4213 #define EVT_NAVIGATION_KEY(func) wx__DECLARE_EVT0(wxEVT_NAVIGATION_KEY, wxNavigationKeyEventHandler(func))
4214 #define EVT_PALETTE_CHANGED(func) wx__DECLARE_EVT0(wxEVT_PALETTE_CHANGED, wxPaletteChangedEventHandler(func))
4215 #define EVT_QUERY_NEW_PALETTE(func) wx__DECLARE_EVT0(wxEVT_QUERY_NEW_PALETTE, wxQueryNewPaletteEventHandler(func))
4216 #define EVT_WINDOW_CREATE(func) wx__DECLARE_EVT0(wxEVT_CREATE, wxWindowCreateEventHandler(func))
4217 #define EVT_WINDOW_DESTROY(func) wx__DECLARE_EVT0(wxEVT_DESTROY, wxWindowDestroyEventHandler(func))
4218 #define EVT_SET_CURSOR(func) wx__DECLARE_EVT0(wxEVT_SET_CURSOR, wxSetCursorEventHandler(func))
4219 #define EVT_MOUSE_CAPTURE_CHANGED(func) wx__DECLARE_EVT0(wxEVT_MOUSE_CAPTURE_CHANGED, wxMouseCaptureChangedEventHandler(func))
4220 #define EVT_MOUSE_CAPTURE_LOST(func) wx__DECLARE_EVT0(wxEVT_MOUSE_CAPTURE_LOST, wxMouseCaptureLostEventHandler(func))
4221 
4222 // Mouse events
4223 #define EVT_LEFT_DOWN(func) wx__DECLARE_EVT0(wxEVT_LEFT_DOWN, wxMouseEventHandler(func))
4224 #define EVT_LEFT_UP(func) wx__DECLARE_EVT0(wxEVT_LEFT_UP, wxMouseEventHandler(func))
4225 #define EVT_MIDDLE_DOWN(func) wx__DECLARE_EVT0(wxEVT_MIDDLE_DOWN, wxMouseEventHandler(func))
4226 #define EVT_MIDDLE_UP(func) wx__DECLARE_EVT0(wxEVT_MIDDLE_UP, wxMouseEventHandler(func))
4227 #define EVT_RIGHT_DOWN(func) wx__DECLARE_EVT0(wxEVT_RIGHT_DOWN, wxMouseEventHandler(func))
4228 #define EVT_RIGHT_UP(func) wx__DECLARE_EVT0(wxEVT_RIGHT_UP, wxMouseEventHandler(func))
4229 #define EVT_MOTION(func) wx__DECLARE_EVT0(wxEVT_MOTION, wxMouseEventHandler(func))
4230 #define EVT_LEFT_DCLICK(func) wx__DECLARE_EVT0(wxEVT_LEFT_DCLICK, wxMouseEventHandler(func))
4231 #define EVT_MIDDLE_DCLICK(func) wx__DECLARE_EVT0(wxEVT_MIDDLE_DCLICK, wxMouseEventHandler(func))
4232 #define EVT_RIGHT_DCLICK(func) wx__DECLARE_EVT0(wxEVT_RIGHT_DCLICK, wxMouseEventHandler(func))
4233 #define EVT_LEAVE_WINDOW(func) wx__DECLARE_EVT0(wxEVT_LEAVE_WINDOW, wxMouseEventHandler(func))
4234 #define EVT_ENTER_WINDOW(func) wx__DECLARE_EVT0(wxEVT_ENTER_WINDOW, wxMouseEventHandler(func))
4235 #define EVT_MOUSEWHEEL(func) wx__DECLARE_EVT0(wxEVT_MOUSEWHEEL, wxMouseEventHandler(func))
4236 #define EVT_MOUSE_AUX1_DOWN(func) wx__DECLARE_EVT0(wxEVT_AUX1_DOWN, wxMouseEventHandler(func))
4237 #define EVT_MOUSE_AUX1_UP(func) wx__DECLARE_EVT0(wxEVT_AUX1_UP, wxMouseEventHandler(func))
4238 #define EVT_MOUSE_AUX1_DCLICK(func) wx__DECLARE_EVT0(wxEVT_AUX1_DCLICK, wxMouseEventHandler(func))
4239 #define EVT_MOUSE_AUX2_DOWN(func) wx__DECLARE_EVT0(wxEVT_AUX2_DOWN, wxMouseEventHandler(func))
4240 #define EVT_MOUSE_AUX2_UP(func) wx__DECLARE_EVT0(wxEVT_AUX2_UP, wxMouseEventHandler(func))
4241 #define EVT_MOUSE_AUX2_DCLICK(func) wx__DECLARE_EVT0(wxEVT_AUX2_DCLICK, wxMouseEventHandler(func))
4242 
4243 // All mouse events
4244 #define EVT_MOUSE_EVENTS(func) \
4245     EVT_LEFT_DOWN(func) \
4246     EVT_LEFT_UP(func) \
4247     EVT_LEFT_DCLICK(func) \
4248     EVT_MIDDLE_DOWN(func) \
4249     EVT_MIDDLE_UP(func) \
4250     EVT_MIDDLE_DCLICK(func) \
4251     EVT_RIGHT_DOWN(func) \
4252     EVT_RIGHT_UP(func) \
4253     EVT_RIGHT_DCLICK(func) \
4254     EVT_MOUSE_AUX1_DOWN(func) \
4255     EVT_MOUSE_AUX1_UP(func) \
4256     EVT_MOUSE_AUX1_DCLICK(func) \
4257     EVT_MOUSE_AUX2_DOWN(func) \
4258     EVT_MOUSE_AUX2_UP(func) \
4259     EVT_MOUSE_AUX2_DCLICK(func) \
4260     EVT_MOTION(func) \
4261     EVT_LEAVE_WINDOW(func) \
4262     EVT_ENTER_WINDOW(func) \
4263     EVT_MOUSEWHEEL(func)
4264 
4265 // Scrolling from wxWindow (sent to wxScrolledWindow)
4266 #define EVT_SCROLLWIN_TOP(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_TOP, wxScrollWinEventHandler(func))
4267 #define EVT_SCROLLWIN_BOTTOM(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_BOTTOM, wxScrollWinEventHandler(func))
4268 #define EVT_SCROLLWIN_LINEUP(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_LINEUP, wxScrollWinEventHandler(func))
4269 #define EVT_SCROLLWIN_LINEDOWN(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_LINEDOWN, wxScrollWinEventHandler(func))
4270 #define EVT_SCROLLWIN_PAGEUP(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_PAGEUP, wxScrollWinEventHandler(func))
4271 #define EVT_SCROLLWIN_PAGEDOWN(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_PAGEDOWN, wxScrollWinEventHandler(func))
4272 #define EVT_SCROLLWIN_THUMBTRACK(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_THUMBTRACK, wxScrollWinEventHandler(func))
4273 #define EVT_SCROLLWIN_THUMBRELEASE(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_THUMBRELEASE, wxScrollWinEventHandler(func))
4274 
4275 #define EVT_SCROLLWIN(func) \
4276     EVT_SCROLLWIN_TOP(func) \
4277     EVT_SCROLLWIN_BOTTOM(func) \
4278     EVT_SCROLLWIN_LINEUP(func) \
4279     EVT_SCROLLWIN_LINEDOWN(func) \
4280     EVT_SCROLLWIN_PAGEUP(func) \
4281     EVT_SCROLLWIN_PAGEDOWN(func) \
4282     EVT_SCROLLWIN_THUMBTRACK(func) \
4283     EVT_SCROLLWIN_THUMBRELEASE(func)
4284 
4285 // Scrolling from wxSlider and wxScrollBar
4286 #define EVT_SCROLL_TOP(func) wx__DECLARE_EVT0(wxEVT_SCROLL_TOP, wxScrollEventHandler(func))
4287 #define EVT_SCROLL_BOTTOM(func) wx__DECLARE_EVT0(wxEVT_SCROLL_BOTTOM, wxScrollEventHandler(func))
4288 #define EVT_SCROLL_LINEUP(func) wx__DECLARE_EVT0(wxEVT_SCROLL_LINEUP, wxScrollEventHandler(func))
4289 #define EVT_SCROLL_LINEDOWN(func) wx__DECLARE_EVT0(wxEVT_SCROLL_LINEDOWN, wxScrollEventHandler(func))
4290 #define EVT_SCROLL_PAGEUP(func) wx__DECLARE_EVT0(wxEVT_SCROLL_PAGEUP, wxScrollEventHandler(func))
4291 #define EVT_SCROLL_PAGEDOWN(func) wx__DECLARE_EVT0(wxEVT_SCROLL_PAGEDOWN, wxScrollEventHandler(func))
4292 #define EVT_SCROLL_THUMBTRACK(func) wx__DECLARE_EVT0(wxEVT_SCROLL_THUMBTRACK, wxScrollEventHandler(func))
4293 #define EVT_SCROLL_THUMBRELEASE(func) wx__DECLARE_EVT0(wxEVT_SCROLL_THUMBRELEASE, wxScrollEventHandler(func))
4294 #define EVT_SCROLL_CHANGED(func) wx__DECLARE_EVT0(wxEVT_SCROLL_CHANGED, wxScrollEventHandler(func))
4295 
4296 #define EVT_SCROLL(func) \
4297     EVT_SCROLL_TOP(func) \
4298     EVT_SCROLL_BOTTOM(func) \
4299     EVT_SCROLL_LINEUP(func) \
4300     EVT_SCROLL_LINEDOWN(func) \
4301     EVT_SCROLL_PAGEUP(func) \
4302     EVT_SCROLL_PAGEDOWN(func) \
4303     EVT_SCROLL_THUMBTRACK(func) \
4304     EVT_SCROLL_THUMBRELEASE(func) \
4305     EVT_SCROLL_CHANGED(func)
4306 
4307 // Scrolling from wxSlider and wxScrollBar, with an id
4308 #define EVT_COMMAND_SCROLL_TOP(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_TOP, winid, wxScrollEventHandler(func))
4309 #define EVT_COMMAND_SCROLL_BOTTOM(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_BOTTOM, winid, wxScrollEventHandler(func))
4310 #define EVT_COMMAND_SCROLL_LINEUP(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_LINEUP, winid, wxScrollEventHandler(func))
4311 #define EVT_COMMAND_SCROLL_LINEDOWN(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_LINEDOWN, winid, wxScrollEventHandler(func))
4312 #define EVT_COMMAND_SCROLL_PAGEUP(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_PAGEUP, winid, wxScrollEventHandler(func))
4313 #define EVT_COMMAND_SCROLL_PAGEDOWN(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_PAGEDOWN, winid, wxScrollEventHandler(func))
4314 #define EVT_COMMAND_SCROLL_THUMBTRACK(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_THUMBTRACK, winid, wxScrollEventHandler(func))
4315 #define EVT_COMMAND_SCROLL_THUMBRELEASE(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_THUMBRELEASE, winid, wxScrollEventHandler(func))
4316 #define EVT_COMMAND_SCROLL_CHANGED(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_CHANGED, winid, wxScrollEventHandler(func))
4317 
4318 #define EVT_COMMAND_SCROLL(winid, func) \
4319     EVT_COMMAND_SCROLL_TOP(winid, func) \
4320     EVT_COMMAND_SCROLL_BOTTOM(winid, func) \
4321     EVT_COMMAND_SCROLL_LINEUP(winid, func) \
4322     EVT_COMMAND_SCROLL_LINEDOWN(winid, func) \
4323     EVT_COMMAND_SCROLL_PAGEUP(winid, func) \
4324     EVT_COMMAND_SCROLL_PAGEDOWN(winid, func) \
4325     EVT_COMMAND_SCROLL_THUMBTRACK(winid, func) \
4326     EVT_COMMAND_SCROLL_THUMBRELEASE(winid, func) \
4327     EVT_COMMAND_SCROLL_CHANGED(winid, func)
4328 
4329 #if WXWIN_COMPATIBILITY_2_6
4330     // compatibility macros for the old name, deprecated in 2.8
4331     #define wxEVT_SCROLL_ENDSCROLL wxEVT_SCROLL_CHANGED
4332     #define EVT_COMMAND_SCROLL_ENDSCROLL EVT_COMMAND_SCROLL_CHANGED
4333     #define EVT_SCROLL_ENDSCROLL EVT_SCROLL_CHANGED
4334 #endif // WXWIN_COMPATIBILITY_2_6
4335 
4336 // Convenience macros for commonly-used commands
4337 #define EVT_CHECKBOX(winid, func) wx__DECLARE_EVT1(wxEVT_CHECKBOX, winid, wxCommandEventHandler(func))
4338 #define EVT_CHOICE(winid, func) wx__DECLARE_EVT1(wxEVT_CHOICE, winid, wxCommandEventHandler(func))
4339 #define EVT_LISTBOX(winid, func) wx__DECLARE_EVT1(wxEVT_LISTBOX, winid, wxCommandEventHandler(func))
4340 #define EVT_LISTBOX_DCLICK(winid, func) wx__DECLARE_EVT1(wxEVT_LISTBOX_DCLICK, winid, wxCommandEventHandler(func))
4341 #define EVT_MENU(winid, func) wx__DECLARE_EVT1(wxEVT_MENU, winid, wxCommandEventHandler(func))
4342 #define EVT_MENU_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_MENU, id1, id2, wxCommandEventHandler(func))
4343 #if defined(__SMARTPHONE__)
4344 #  define EVT_BUTTON(winid, func) EVT_MENU(winid, func)
4345 #else
4346 #  define EVT_BUTTON(winid, func) wx__DECLARE_EVT1(wxEVT_BUTTON, winid, wxCommandEventHandler(func))
4347 #endif
4348 #define EVT_SLIDER(winid, func) wx__DECLARE_EVT1(wxEVT_SLIDER, winid, wxCommandEventHandler(func))
4349 #define EVT_RADIOBOX(winid, func) wx__DECLARE_EVT1(wxEVT_RADIOBOX, winid, wxCommandEventHandler(func))
4350 #define EVT_RADIOBUTTON(winid, func) wx__DECLARE_EVT1(wxEVT_RADIOBUTTON, winid, wxCommandEventHandler(func))
4351 // EVT_SCROLLBAR is now obsolete since we use EVT_COMMAND_SCROLL... events
4352 #define EVT_SCROLLBAR(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLLBAR, winid, wxCommandEventHandler(func))
4353 #define EVT_VLBOX(winid, func) wx__DECLARE_EVT1(wxEVT_VLBOX, winid, wxCommandEventHandler(func))
4354 #define EVT_COMBOBOX(winid, func) wx__DECLARE_EVT1(wxEVT_COMBOBOX, winid, wxCommandEventHandler(func))
4355 #define EVT_TOOL(winid, func) wx__DECLARE_EVT1(wxEVT_TOOL, winid, wxCommandEventHandler(func))
4356 #define EVT_TOOL_DROPDOWN(winid, func) wx__DECLARE_EVT1(wxEVT_TOOL_DROPDOWN, winid, wxCommandEventHandler(func))
4357 #define EVT_TOOL_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_TOOL, id1, id2, wxCommandEventHandler(func))
4358 #define EVT_TOOL_RCLICKED(winid, func) wx__DECLARE_EVT1(wxEVT_TOOL_RCLICKED, winid, wxCommandEventHandler(func))
4359 #define EVT_TOOL_RCLICKED_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_TOOL_RCLICKED, id1, id2, wxCommandEventHandler(func))
4360 #define EVT_TOOL_ENTER(winid, func) wx__DECLARE_EVT1(wxEVT_TOOL_ENTER, winid, wxCommandEventHandler(func))
4361 #define EVT_CHECKLISTBOX(winid, func) wx__DECLARE_EVT1(wxEVT_CHECKLISTBOX, winid, wxCommandEventHandler(func))
4362 #define EVT_COMBOBOX_DROPDOWN(winid, func) wx__DECLARE_EVT1(wxEVT_COMBOBOX_DROPDOWN, winid, wxCommandEventHandler(func))
4363 #define EVT_COMBOBOX_CLOSEUP(winid, func) wx__DECLARE_EVT1(wxEVT_COMBOBOX_CLOSEUP, winid, wxCommandEventHandler(func))
4364 
4365 // Generic command events
4366 #define EVT_COMMAND_LEFT_CLICK(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_LEFT_CLICK, winid, wxCommandEventHandler(func))
4367 #define EVT_COMMAND_LEFT_DCLICK(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_LEFT_DCLICK, winid, wxCommandEventHandler(func))
4368 #define EVT_COMMAND_RIGHT_CLICK(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_RIGHT_CLICK, winid, wxCommandEventHandler(func))
4369 #define EVT_COMMAND_RIGHT_DCLICK(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_RIGHT_DCLICK, winid, wxCommandEventHandler(func))
4370 #define EVT_COMMAND_SET_FOCUS(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_SET_FOCUS, winid, wxCommandEventHandler(func))
4371 #define EVT_COMMAND_KILL_FOCUS(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_KILL_FOCUS, winid, wxCommandEventHandler(func))
4372 #define EVT_COMMAND_ENTER(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_ENTER, winid, wxCommandEventHandler(func))
4373 
4374 // Joystick events
4375 
4376 #define EVT_JOY_BUTTON_DOWN(func) wx__DECLARE_EVT0(wxEVT_JOY_BUTTON_DOWN, wxJoystickEventHandler(func))
4377 #define EVT_JOY_BUTTON_UP(func) wx__DECLARE_EVT0(wxEVT_JOY_BUTTON_UP, wxJoystickEventHandler(func))
4378 #define EVT_JOY_MOVE(func) wx__DECLARE_EVT0(wxEVT_JOY_MOVE, wxJoystickEventHandler(func))
4379 #define EVT_JOY_ZMOVE(func) wx__DECLARE_EVT0(wxEVT_JOY_ZMOVE, wxJoystickEventHandler(func))
4380 
4381 // All joystick events
4382 #define EVT_JOYSTICK_EVENTS(func) \
4383     EVT_JOY_BUTTON_DOWN(func) \
4384     EVT_JOY_BUTTON_UP(func) \
4385     EVT_JOY_MOVE(func) \
4386     EVT_JOY_ZMOVE(func)
4387 
4388 // Idle event
4389 #define EVT_IDLE(func) wx__DECLARE_EVT0(wxEVT_IDLE, wxIdleEventHandler(func))
4390 
4391 // Update UI event
4392 #define EVT_UPDATE_UI(winid, func) wx__DECLARE_EVT1(wxEVT_UPDATE_UI, winid, wxUpdateUIEventHandler(func))
4393 #define EVT_UPDATE_UI_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_UPDATE_UI, id1, id2, wxUpdateUIEventHandler(func))
4394 
4395 // Help events
4396 #define EVT_HELP(winid, func) wx__DECLARE_EVT1(wxEVT_HELP, winid, wxHelpEventHandler(func))
4397 #define EVT_HELP_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_HELP, id1, id2, wxHelpEventHandler(func))
4398 #define EVT_DETAILED_HELP(winid, func) wx__DECLARE_EVT1(wxEVT_DETAILED_HELP, winid, wxHelpEventHandler(func))
4399 #define EVT_DETAILED_HELP_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_DETAILED_HELP, id1, id2, wxHelpEventHandler(func))
4400 
4401 // Context Menu Events
4402 #define EVT_CONTEXT_MENU(func) wx__DECLARE_EVT0(wxEVT_CONTEXT_MENU, wxContextMenuEventHandler(func))
4403 #define EVT_COMMAND_CONTEXT_MENU(winid, func) wx__DECLARE_EVT1(wxEVT_CONTEXT_MENU, winid, wxContextMenuEventHandler(func))
4404 
4405 // Clipboard text Events
4406 #define EVT_TEXT_CUT(winid, func) wx__DECLARE_EVT1(wxEVT_TEXT_CUT, winid, wxClipboardTextEventHandler(func))
4407 #define EVT_TEXT_COPY(winid, func) wx__DECLARE_EVT1(wxEVT_TEXT_COPY, winid, wxClipboardTextEventHandler(func))
4408 #define EVT_TEXT_PASTE(winid, func) wx__DECLARE_EVT1(wxEVT_TEXT_PASTE, winid, wxClipboardTextEventHandler(func))
4409 
4410 // Thread events
4411 #define EVT_THREAD(id, func)  wx__DECLARE_EVT1(wxEVT_THREAD, id, wxThreadEventHandler(func))
4412 
4413 // ----------------------------------------------------------------------------
4414 // Helper functions
4415 // ----------------------------------------------------------------------------
4416 
4417 // This is an ugly hack to allow the use of Bind() instead of Connect() inside
4418 // the library code if the library was built with support for it, here is how
4419 // it is used:
4420 //
4421 // class SomeEventHandlingClass : wxBIND_OR_CONNECT_HACK_BASE_CLASS
4422 //                                public SomeBaseClass
4423 // {
4424 // public:
4425 //     SomeEventHandlingClass(wxWindow *win)
4426 //     {
4427 //         // connect to the event for the given window
4428 //         wxBIND_OR_CONNECT_HACK(win, wxEVT_SOMETHING, wxSomeEventHandler,
4429 //                                SomeEventHandlingClass::OnSomeEvent, this);
4430 //     }
4431 //
4432 // private:
4433 //     void OnSomeEvent(wxSomeEvent&) { ... }
4434 // };
4435 //
4436 // This is *not* meant to be used by library users, it is only defined here
4437 // (and not in a private header) because the base class must be visible from
4438 // other public headers, please do NOT use this in your code, it will be
4439 // removed from future wx versions without warning.
4440 #ifdef wxHAS_EVENT_BIND
4441     #define wxBIND_OR_CONNECT_HACK_BASE_CLASS
4442     #define wxBIND_OR_CONNECT_HACK_ONLY_BASE_CLASS
4443     #define wxBIND_OR_CONNECT_HACK(win, evt, handler, func, obj) \
4444         win->Bind(evt, &func, obj)
4445 #else // wxHAS_EVENT_BIND
4446     #define wxBIND_OR_CONNECT_HACK_BASE_CLASS public wxEvtHandler,
4447     #define wxBIND_OR_CONNECT_HACK_ONLY_BASE_CLASS : public wxEvtHandler
4448     #define wxBIND_OR_CONNECT_HACK(win, evt, handler, func, obj) \
4449         win->Connect(evt, handler(func), NULL, obj)
4450 #endif // wxHAS_EVENT_BIND
4451 
4452 #if wxUSE_GUI
4453 
4454 // Find a window with the focus, that is also a descendant of the given window.
4455 // This is used to determine the window to initially send commands to.
4456 WXDLLIMPEXP_CORE wxWindow* wxFindFocusDescendant(wxWindow* ancestor);
4457 
4458 #endif // wxUSE_GUI
4459 
4460 
4461 // ----------------------------------------------------------------------------
4462 // Compatibility macro aliases
4463 // ----------------------------------------------------------------------------
4464 
4465 // deprecated variants _not_ requiring a semicolon after them and without wx prefix
4466 // (note that also some wx-prefixed macro do _not_ require a semicolon because
4467 //  it's not always possible to force the compire to require it)
4468 
4469 #define DECLARE_EVENT_TABLE_ENTRY(type, winid, idLast, fn, obj) \
4470     wxDECLARE_EVENT_TABLE_ENTRY(type, winid, idLast, fn, obj)
4471 #define DECLARE_EVENT_TABLE_TERMINATOR()               wxDECLARE_EVENT_TABLE_TERMINATOR()
4472 #define DECLARE_EVENT_TABLE()                          wxDECLARE_EVENT_TABLE();
4473 #define BEGIN_EVENT_TABLE(a,b)                         wxBEGIN_EVENT_TABLE(a,b)
4474 #define BEGIN_EVENT_TABLE_TEMPLATE1(a,b,c)             wxBEGIN_EVENT_TABLE_TEMPLATE1(a,b,c)
4475 #define BEGIN_EVENT_TABLE_TEMPLATE2(a,b,c,d)           wxBEGIN_EVENT_TABLE_TEMPLATE2(a,b,c,d)
4476 #define BEGIN_EVENT_TABLE_TEMPLATE3(a,b,c,d,e)         wxBEGIN_EVENT_TABLE_TEMPLATE3(a,b,c,d,e)
4477 #define BEGIN_EVENT_TABLE_TEMPLATE4(a,b,c,d,e,f)       wxBEGIN_EVENT_TABLE_TEMPLATE4(a,b,c,d,e,f)
4478 #define BEGIN_EVENT_TABLE_TEMPLATE5(a,b,c,d,e,f,g)     wxBEGIN_EVENT_TABLE_TEMPLATE5(a,b,c,d,e,f,g)
4479 #define BEGIN_EVENT_TABLE_TEMPLATE6(a,b,c,d,e,f,g,h)   wxBEGIN_EVENT_TABLE_TEMPLATE6(a,b,c,d,e,f,g,h)
4480 #define END_EVENT_TABLE()                              wxEND_EVENT_TABLE()
4481 
4482 // other obsolete event declaration/definition macros; we don't need them any longer
4483 // but we keep them for compatibility as it doesn't cost us anything anyhow
4484 #define BEGIN_DECLARE_EVENT_TYPES()
4485 #define END_DECLARE_EVENT_TYPES()
4486 #define DECLARE_EXPORTED_EVENT_TYPE(expdecl, name, value) \
4487     extern expdecl const wxEventType name;
4488 #define DECLARE_EVENT_TYPE(name, value) \
4489     DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_CORE, name, value)
4490 #define DECLARE_LOCAL_EVENT_TYPE(name, value) \
4491     DECLARE_EXPORTED_EVENT_TYPE(wxEMPTY_PARAMETER_VALUE, name, value)
4492 #define DEFINE_EVENT_TYPE(name) const wxEventType name = wxNewEventType();
4493 #define DEFINE_LOCAL_EVENT_TYPE(name) DEFINE_EVENT_TYPE(name)
4494 
4495 // alias for backward compatibility with 2.9.0:
4496 #define wxEVT_COMMAND_THREAD                  wxEVT_THREAD
4497 // other old wxEVT_COMMAND_* constants
4498 #define wxEVT_COMMAND_BUTTON_CLICKED          wxEVT_BUTTON
4499 #define wxEVT_COMMAND_CHECKBOX_CLICKED        wxEVT_CHECKBOX
4500 #define wxEVT_COMMAND_CHOICE_SELECTED         wxEVT_CHOICE
4501 #define wxEVT_COMMAND_LISTBOX_SELECTED        wxEVT_LISTBOX
4502 #define wxEVT_COMMAND_LISTBOX_DOUBLECLICKED   wxEVT_LISTBOX_DCLICK
4503 #define wxEVT_COMMAND_CHECKLISTBOX_TOGGLED    wxEVT_CHECKLISTBOX
4504 #define wxEVT_COMMAND_MENU_SELECTED           wxEVT_MENU
4505 #define wxEVT_COMMAND_TOOL_CLICKED            wxEVT_TOOL
4506 #define wxEVT_COMMAND_SLIDER_UPDATED          wxEVT_SLIDER
4507 #define wxEVT_COMMAND_RADIOBOX_SELECTED       wxEVT_RADIOBOX
4508 #define wxEVT_COMMAND_RADIOBUTTON_SELECTED    wxEVT_RADIOBUTTON
4509 #define wxEVT_COMMAND_SCROLLBAR_UPDATED       wxEVT_SCROLLBAR
4510 #define wxEVT_COMMAND_VLBOX_SELECTED          wxEVT_VLBOX
4511 #define wxEVT_COMMAND_COMBOBOX_SELECTED       wxEVT_COMBOBOX
4512 #define wxEVT_COMMAND_TOOL_RCLICKED           wxEVT_TOOL_RCLICKED
4513 #define wxEVT_COMMAND_TOOL_DROPDOWN_CLICKED   wxEVT_TOOL_DROPDOWN
4514 #define wxEVT_COMMAND_TOOL_ENTER              wxEVT_TOOL_ENTER
4515 #define wxEVT_COMMAND_COMBOBOX_DROPDOWN       wxEVT_COMBOBOX_DROPDOWN
4516 #define wxEVT_COMMAND_COMBOBOX_CLOSEUP        wxEVT_COMBOBOX_CLOSEUP
4517 #define wxEVT_COMMAND_TEXT_COPY               wxEVT_TEXT_COPY
4518 #define wxEVT_COMMAND_TEXT_CUT                wxEVT_TEXT_CUT
4519 #define wxEVT_COMMAND_TEXT_PASTE              wxEVT_TEXT_PASTE
4520 #define wxEVT_COMMAND_TEXT_UPDATED            wxEVT_TEXT
4521 
4522 #endif // _WX_EVENT_H_
4523