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