1998-05-20 14:01:55 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2000-09-10 12:43:37 +00:00
|
|
|
// Name: wx/event.h
|
1998-05-20 14:01:55 +00:00
|
|
|
// Purpose: Event classes
|
|
|
|
// Author: Julian Smart
|
|
|
|
// Modified by:
|
|
|
|
// Created: 01/02/97
|
|
|
|
// RCS-ID: $Id$
|
2004-05-23 14:56:36 +00:00
|
|
|
// Copyright: (c) wxWidgets team
|
2004-05-23 20:53:33 +00:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 14:01:55 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2007-12-03 02:55:14 +00:00
|
|
|
#ifndef _WX_EVENT_H_
|
|
|
|
#define _WX_EVENT_H_
|
1998-05-20 14:01:55 +00:00
|
|
|
|
|
|
|
#include "wx/defs.h"
|
2006-11-03 21:06:57 +00:00
|
|
|
#include "wx/cpp.h"
|
1998-05-20 14:01:55 +00:00
|
|
|
#include "wx/object.h"
|
2004-07-12 21:49:30 +00:00
|
|
|
#include "wx/clntdata.h"
|
1999-10-04 20:15:38 +00:00
|
|
|
|
|
|
|
#if wxUSE_GUI
|
|
|
|
#include "wx/gdicmn.h"
|
2000-03-14 00:45:54 +00:00
|
|
|
#include "wx/cursor.h"
|
2008-09-19 18:41:41 +00:00
|
|
|
#include "wx/mousestate.h"
|
1999-10-04 20:15:38 +00:00
|
|
|
#endif
|
1999-05-19 00:53:27 +00:00
|
|
|
|
2003-07-17 23:59:49 +00:00
|
|
|
#include "wx/dynarray.h"
|
2008-01-05 19:07:52 +00:00
|
|
|
#include "wx/thread.h"
|
2008-01-08 17:57:27 +00:00
|
|
|
#include "wx/tracker.h"
|
2009-11-19 21:16:10 +00:00
|
|
|
#include "wx/typeinfo.h"
|
2010-01-19 13:01:40 +00:00
|
|
|
#include "wx/any.h"
|
2003-07-17 23:59:49 +00:00
|
|
|
|
2009-05-02 12:52:54 +00:00
|
|
|
#ifdef wxHAS_EVENT_BIND
|
2009-02-02 20:38:56 +00:00
|
|
|
#include "wx/meta/convertible.h"
|
|
|
|
#endif
|
|
|
|
|
1999-10-04 20:15:38 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// forward declarations
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2007-07-09 10:09:52 +00:00
|
|
|
class WXDLLIMPEXP_FWD_BASE wxList;
|
2009-01-12 14:26:13 +00:00
|
|
|
class WXDLLIMPEXP_FWD_BASE wxEvent;
|
1999-10-04 20:15:38 +00:00
|
|
|
#if wxUSE_GUI
|
2007-07-09 10:09:52 +00:00
|
|
|
class WXDLLIMPEXP_FWD_CORE wxDC;
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxMenu;
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxWindow;
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxWindowBase;
|
1999-10-04 20:15:38 +00:00
|
|
|
#endif // wxUSE_GUI
|
|
|
|
|
2008-06-11 14:22:21 +00:00
|
|
|
// We operate with pointer to members of wxEvtHandler (such functions are used
|
|
|
|
// as event handlers in the event tables or as arguments to Connect()) but by
|
|
|
|
// default MSVC uses a restricted (but more efficient) representation of
|
|
|
|
// pointers to members which can't deal with multiple base classes. To avoid
|
|
|
|
// mysterious (as the compiler is not good enough to detect this and give a
|
|
|
|
// sensible error message) errors in the user code as soon as it defines
|
|
|
|
// classes inheriting from both wxEvtHandler (possibly indirectly, e.g. via
|
|
|
|
// wxWindow) and something else (including our own wxTrackable but not limited
|
|
|
|
// to it), we use the special MSVC keyword telling the compiler to use a more
|
|
|
|
// general pointer to member representation for the classes inheriting from
|
|
|
|
// wxEvtHandler.
|
|
|
|
#ifdef __VISUALC__
|
|
|
|
#define wxMSVC_FWD_MULTIPLE_BASES __multiple_inheritance
|
|
|
|
#else
|
|
|
|
#define wxMSVC_FWD_MULTIPLE_BASES
|
|
|
|
#endif
|
|
|
|
|
|
|
|
class WXDLLIMPEXP_FWD_BASE wxMSVC_FWD_MULTIPLE_BASES wxEvtHandler;
|
2008-01-13 01:12:13 +00:00
|
|
|
class wxEventConnectionRef;
|
2005-02-16 18:02:48 +00:00
|
|
|
|
1999-10-04 20:15:38 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// Event types
|
|
|
|
// ----------------------------------------------------------------------------
|
1998-06-26 20:19:48 +00:00
|
|
|
|
2001-01-27 20:16:02 +00:00
|
|
|
typedef int wxEventType;
|
|
|
|
|
2007-02-04 00:12:50 +00:00
|
|
|
#define wxEVT_ANY ((wxEventType)-1)
|
|
|
|
|
2004-02-10 22:15:19 +00:00
|
|
|
// this is used to make the event table entry type safe, so that for an event
|
2009-02-01 22:10:52 +00:00
|
|
|
// handler only a function with proper parameter list can be given. See also
|
|
|
|
// the wxEVENT_HANDLER_CAST-macro.
|
2008-11-02 02:39:52 +00:00
|
|
|
#define wxStaticCastEvent(type, val) static_cast<type>(val)
|
2004-02-10 22:15:19 +00:00
|
|
|
|
2010-06-09 14:28:08 +00:00
|
|
|
#define wxDECLARE_EVENT_TABLE_ENTRY(type, winid, idLast, fn, obj) \
|
2009-04-16 21:23:28 +00:00
|
|
|
wxEventTableEntry(type, winid, idLast, wxNewEventTableFunctor(type, fn), obj)
|
2009-01-12 14:26:13 +00:00
|
|
|
|
2010-06-09 14:28:08 +00:00
|
|
|
#define wxDECLARE_EVENT_TABLE_TERMINATOR() \
|
2009-01-12 14:26:13 +00:00
|
|
|
wxEventTableEntry(wxEVT_NULL, 0, 0, 0, 0)
|
2001-01-27 20:16:02 +00:00
|
|
|
|
|
|
|
// generate a new unique event type
|
2003-07-02 01:59:24 +00:00
|
|
|
extern WXDLLIMPEXP_BASE wxEventType wxNewEventType();
|
2001-01-27 20:16:02 +00:00
|
|
|
|
2009-05-03 07:43:28 +00:00
|
|
|
// define macros to create new event types:
|
|
|
|
#ifdef wxHAS_EVENT_BIND
|
|
|
|
// events are represented by an instance of wxEventTypeTag and the
|
|
|
|
// corresponding type must be specified for type-safety checks
|
2009-02-01 22:10:52 +00:00
|
|
|
|
2009-05-03 07:43:28 +00:00
|
|
|
// define a new custom event type, can be used alone or after event
|
|
|
|
// declaration in the header using one of the macros below
|
2009-01-12 14:26:13 +00:00
|
|
|
#define wxDEFINE_EVENT( name, type ) \
|
2009-05-03 07:43:28 +00:00
|
|
|
const wxEventTypeTag< type > name( wxNewEventType() )
|
2009-01-12 14:26:13 +00:00
|
|
|
|
2009-05-03 07:43:28 +00:00
|
|
|
// the general version allowing exporting the event type from DLL, used by
|
|
|
|
// wxWidgets itself
|
2009-01-12 14:26:13 +00:00
|
|
|
#define wxDECLARE_EXPORTED_EVENT( expdecl, name, type ) \
|
2009-05-03 07:43:28 +00:00
|
|
|
extern const expdecl wxEventTypeTag< type > name
|
2009-02-01 22:10:52 +00:00
|
|
|
|
2009-05-03 07:43:28 +00:00
|
|
|
// this is the version which will normally be used in the user code
|
2009-02-07 15:29:52 +00:00
|
|
|
#define wxDECLARE_EVENT( name, type ) \
|
2009-04-14 12:47:46 +00:00
|
|
|
wxDECLARE_EXPORTED_EVENT( wxEMPTY_PARAMETER_VALUE, name, type )
|
2009-01-12 14:26:13 +00:00
|
|
|
|
2009-02-01 22:10:52 +00:00
|
|
|
|
2009-05-03 07:43:28 +00:00
|
|
|
// these macros are only used internally for backwards compatibility and
|
|
|
|
// allow to define an alias for an existing event type (this is used by
|
|
|
|
// wxEVT_SPIN_XXX)
|
2009-01-23 00:30:41 +00:00
|
|
|
#define wxDEFINE_EVENT_ALIAS( name, type, value ) \
|
2009-02-07 18:59:25 +00:00
|
|
|
const wxEventTypeTag< type > name( value )
|
2009-01-12 14:26:13 +00:00
|
|
|
|
2009-01-23 00:30:41 +00:00
|
|
|
#define wxDECLARE_EXPORTED_EVENT_ALIAS( expdecl, name, type ) \
|
2009-02-07 18:59:25 +00:00
|
|
|
extern const expdecl wxEventTypeTag< type > name
|
2009-05-03 07:43:28 +00:00
|
|
|
#else // !wxHAS_EVENT_BIND
|
|
|
|
// the macros are the same ones as above but defined differently as we only
|
|
|
|
// use the integer event type values to identify events in this case
|
2009-01-12 14:26:13 +00:00
|
|
|
|
2009-05-03 07:43:28 +00:00
|
|
|
#define wxDEFINE_EVENT( name, type ) \
|
|
|
|
const wxEventType name( wxNewEventType() )
|
2009-02-01 22:10:52 +00:00
|
|
|
|
2009-05-03 07:43:28 +00:00
|
|
|
#define wxDECLARE_EXPORTED_EVENT( expdecl, name, type ) \
|
|
|
|
extern const expdecl wxEventType name
|
2009-02-07 15:29:52 +00:00
|
|
|
#define wxDECLARE_EVENT( name, type ) \
|
2009-04-14 12:47:46 +00:00
|
|
|
wxDECLARE_EXPORTED_EVENT( wxEMPTY_PARAMETER_VALUE, name, type )
|
2009-01-12 14:26:13 +00:00
|
|
|
|
2009-05-03 07:43:28 +00:00
|
|
|
#define wxDEFINE_EVENT_ALIAS( name, type, value ) \
|
|
|
|
const wxEventType name = value
|
|
|
|
#define wxDECLARE_EXPORTED_EVENT_ALIAS( expdecl, name, type ) \
|
|
|
|
extern const expdecl wxEventType name
|
|
|
|
#endif // wxHAS_EVENT_BIND/!wxHAS_EVENT_BIND
|
2009-01-12 14:26:13 +00:00
|
|
|
|
2009-02-25 17:43:22 +00:00
|
|
|
// Try to cast the given event handler to the correct handler type:
|
|
|
|
|
|
|
|
#define wxEVENT_HANDLER_CAST( functype, func ) \
|
|
|
|
( wxObjectEventFunction )( wxEventFunction )wxStaticCastEvent( functype, &func )
|
|
|
|
|
2009-01-12 14:26:13 +00:00
|
|
|
|
2009-05-02 12:52:54 +00:00
|
|
|
#ifdef wxHAS_EVENT_BIND
|
2009-01-12 14:26:13 +00:00
|
|
|
|
2009-02-02 20:38:56 +00:00
|
|
|
// The tag is a type associated to the event type (which is an integer itself,
|
|
|
|
// in spite of its name) value. It exists in order to be used as a template
|
|
|
|
// parameter and provide a mapping between the event type values and their
|
|
|
|
// corresponding wxEvent-derived classes.
|
|
|
|
template <typename T>
|
|
|
|
class wxEventTypeTag
|
2009-01-12 14:26:13 +00:00
|
|
|
{
|
|
|
|
public:
|
2009-02-02 20:38:56 +00:00
|
|
|
// The class of wxEvent-derived class carried by the events of this type.
|
|
|
|
typedef T EventClass;
|
2009-01-12 14:26:13 +00:00
|
|
|
|
2009-02-02 20:38:56 +00:00
|
|
|
wxEventTypeTag(wxEventType type) { m_type = type; }
|
2009-01-12 14:26:13 +00:00
|
|
|
|
2009-02-01 22:10:52 +00:00
|
|
|
// Return a wxEventType reference for the initialization of the static
|
|
|
|
// event tables. See wxEventTableEntry::m_eventType for a more thorough
|
|
|
|
// explanation.
|
2009-01-12 14:26:13 +00:00
|
|
|
operator const wxEventType&() const { return m_type; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
wxEventType m_type;
|
|
|
|
};
|
|
|
|
|
2009-05-02 12:52:54 +00:00
|
|
|
#endif // wxHAS_EVENT_BIND
|
2009-01-12 14:26:13 +00:00
|
|
|
|
|
|
|
// These are needed for the functor definitions
|
|
|
|
typedef void (wxEvtHandler::*wxEventFunction)(wxEvent&);
|
|
|
|
|
|
|
|
// We had some trouble (specifically with eVC for ARM WinCE build) with using
|
|
|
|
// wxEventFunction in the past so we had introduced wxObjectEventFunction which
|
|
|
|
// used to be a typedef for a member of wxObject and not wxEvtHandler to work
|
|
|
|
// around this but as eVC is not really supported any longer we now only keep
|
|
|
|
// this for backwards compatibility and, despite its name, this is a typedef
|
|
|
|
// for wxEvtHandler member now -- but if we have the same problem with another
|
|
|
|
// compiler we can restore its old definition for it.
|
|
|
|
typedef wxEventFunction wxObjectEventFunction;
|
|
|
|
|
2009-02-01 22:10:52 +00:00
|
|
|
// The event functor which is stored in the static and dynamic event tables:
|
2009-01-12 14:26:13 +00:00
|
|
|
class WXDLLIMPEXP_BASE wxEventFunctor
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual ~wxEventFunctor();
|
|
|
|
|
2009-02-01 22:10:52 +00:00
|
|
|
// Invoke the actual event handler:
|
2009-02-02 20:38:56 +00:00
|
|
|
virtual void operator()(wxEvtHandler *, wxEvent&) = 0;
|
2009-01-12 14:26:13 +00:00
|
|
|
|
2009-01-12 16:51:14 +00:00
|
|
|
// this function tests whether this functor is matched, for the purpose of
|
2009-05-02 12:52:54 +00:00
|
|
|
// finding it in an event table in Unbind(), by the given functor:
|
|
|
|
virtual bool IsMatching(const wxEventFunctor& functor) const = 0;
|
2009-01-12 14:26:13 +00:00
|
|
|
|
2009-05-02 12:52:54 +00:00
|
|
|
// If the functor holds an wxEvtHandler, then get access to it and track
|
|
|
|
// its lifetime with wxEventConnectionRef:
|
|
|
|
virtual wxEvtHandler *GetEvtHandler() const
|
|
|
|
{ return NULL; }
|
|
|
|
|
|
|
|
// This is only used to maintain backward compatibility in
|
|
|
|
// wxAppConsoleBase::CallEventHandler and ensures that an overwritten
|
|
|
|
// wxAppConsoleBase::HandleEvent is still called for functors which hold an
|
|
|
|
// wxEventFunction:
|
|
|
|
virtual wxEventFunction GetEvtMethod() const
|
|
|
|
{ return NULL; }
|
2009-11-19 19:27:24 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
WX_DECLARE_ABSTRACT_TYPEINFO(wxEventFunctor)
|
2009-01-12 14:26:13 +00:00
|
|
|
};
|
|
|
|
|
2009-05-02 12:52:54 +00:00
|
|
|
// A plain method functor for the untyped legacy event types:
|
2009-01-12 14:26:13 +00:00
|
|
|
class WXDLLIMPEXP_BASE wxObjectEventFunctor : public wxEventFunctor
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxObjectEventFunctor(wxObjectEventFunction method, wxEvtHandler *handler)
|
2009-05-02 12:52:54 +00:00
|
|
|
: m_handler( handler ), m_method( method )
|
|
|
|
{ }
|
|
|
|
|
2010-09-27 12:55:22 +00:00
|
|
|
virtual void operator()(wxEvtHandler *handler, wxEvent& event);
|
2009-01-12 14:26:13 +00:00
|
|
|
|
2009-05-02 12:52:54 +00:00
|
|
|
virtual bool IsMatching(const wxEventFunctor& functor) const
|
2009-01-12 14:26:13 +00:00
|
|
|
{
|
2009-11-19 19:27:24 +00:00
|
|
|
if ( wxTypeId(functor) == wxTypeId(*this) )
|
2009-05-02 12:52:54 +00:00
|
|
|
{
|
|
|
|
const wxObjectEventFunctor &other =
|
|
|
|
static_cast< const wxObjectEventFunctor & >( functor );
|
2009-01-12 14:26:13 +00:00
|
|
|
|
2009-05-02 12:52:54 +00:00
|
|
|
// FIXME-VC6: amazing but true: replacing "method == NULL" here
|
|
|
|
// with "!method" makes VC6 crash with an ICE in DLL build (only!)
|
2009-02-02 21:44:36 +00:00
|
|
|
|
2009-05-02 12:52:54 +00:00
|
|
|
return ( m_method == other.m_method || other.m_method == NULL ) &&
|
|
|
|
( m_handler == other.m_handler || other.m_handler == NULL );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return false;
|
2009-01-12 14:26:13 +00:00
|
|
|
}
|
|
|
|
|
2009-05-02 12:52:54 +00:00
|
|
|
virtual wxEvtHandler *GetEvtHandler() const
|
|
|
|
{ return m_handler; }
|
|
|
|
|
|
|
|
virtual wxEventFunction GetEvtMethod() const
|
|
|
|
{ return m_method; }
|
2009-01-12 14:26:13 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
wxEvtHandler *m_handler;
|
2009-02-02 21:44:36 +00:00
|
|
|
wxEventFunction m_method;
|
2009-01-12 14:26:13 +00:00
|
|
|
|
2009-11-19 19:27:24 +00:00
|
|
|
// Provide a dummy default ctor for type info purposes
|
|
|
|
wxObjectEventFunctor() { }
|
|
|
|
|
|
|
|
WX_DECLARE_TYPEINFO_INLINE(wxObjectEventFunctor)
|
2009-05-02 12:52:54 +00:00
|
|
|
};
|
2009-02-02 20:38:56 +00:00
|
|
|
|
2009-04-16 22:41:52 +00:00
|
|
|
// Create a functor for the legacy events: used by Connect()
|
2009-01-12 16:51:14 +00:00
|
|
|
inline wxObjectEventFunctor *
|
2009-01-18 19:30:23 +00:00
|
|
|
wxNewEventFunctor(const wxEventType& WXUNUSED(evtType),
|
2009-01-12 16:51:14 +00:00
|
|
|
wxObjectEventFunction method,
|
2009-04-16 22:41:52 +00:00
|
|
|
wxEvtHandler *handler)
|
2009-01-12 16:51:14 +00:00
|
|
|
{
|
|
|
|
return new wxObjectEventFunctor(method, handler);
|
|
|
|
}
|
|
|
|
|
2010-06-09 14:28:08 +00:00
|
|
|
// This version is used by wxDECLARE_EVENT_TABLE_ENTRY()
|
2009-04-16 22:41:52 +00:00
|
|
|
inline wxObjectEventFunctor *
|
2009-04-17 00:35:58 +00:00
|
|
|
wxNewEventTableFunctor(const wxEventType& WXUNUSED(evtType),
|
|
|
|
wxObjectEventFunction method)
|
2009-04-16 22:41:52 +00:00
|
|
|
{
|
|
|
|
return new wxObjectEventFunctor(method, NULL);
|
|
|
|
}
|
|
|
|
|
2009-01-12 16:51:14 +00:00
|
|
|
inline wxObjectEventFunctor
|
2009-02-02 20:38:56 +00:00
|
|
|
wxMakeEventFunctor(const wxEventType& WXUNUSED(evtType),
|
2009-01-12 16:51:14 +00:00
|
|
|
wxObjectEventFunction method,
|
|
|
|
wxEvtHandler *handler)
|
|
|
|
{
|
|
|
|
return wxObjectEventFunctor(method, handler);
|
|
|
|
}
|
|
|
|
|
2009-05-02 12:52:54 +00:00
|
|
|
#ifdef wxHAS_EVENT_BIND
|
2009-02-02 20:38:56 +00:00
|
|
|
|
|
|
|
namespace wxPrivate
|
|
|
|
{
|
|
|
|
|
2009-02-06 18:33:01 +00:00
|
|
|
// helper template defining nested "type" typedef as the event class
|
|
|
|
// corresponding to the given event type
|
|
|
|
template <typename T> struct EventClassOf;
|
|
|
|
|
|
|
|
// the typed events provide the information about the class of the events they
|
|
|
|
// carry themselves:
|
|
|
|
template <typename T>
|
|
|
|
struct EventClassOf< wxEventTypeTag<T> >
|
|
|
|
{
|
|
|
|
typedef typename wxEventTypeTag<T>::EventClass type;
|
|
|
|
};
|
|
|
|
|
|
|
|
// for the old untyped events we don't have information about the exact event
|
|
|
|
// class carried by them
|
|
|
|
template <>
|
|
|
|
struct EventClassOf<wxEventType>
|
|
|
|
{
|
|
|
|
typedef wxEvent type;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// helper class defining operations different for method functors using an
|
|
|
|
// object of wxEvtHandler-derived class as handler and the others
|
2009-02-02 20:38:56 +00:00
|
|
|
template <typename T, typename A, bool> struct HandlerImpl;
|
|
|
|
|
|
|
|
// specialization for handlers deriving from wxEvtHandler
|
|
|
|
template <typename T, typename A>
|
|
|
|
struct HandlerImpl<T, A, true>
|
|
|
|
{
|
|
|
|
static bool IsEvtHandler()
|
|
|
|
{ return true; }
|
|
|
|
static T *ConvertFromEvtHandler(wxEvtHandler *p)
|
|
|
|
{ return static_cast<T *>(p); }
|
|
|
|
static wxEvtHandler *ConvertToEvtHandler(T *p)
|
|
|
|
{ return p; }
|
2009-05-02 12:52:54 +00:00
|
|
|
static wxEventFunction ConvertToEvtMethod(void (T::*f)(A&))
|
2009-02-06 18:33:01 +00:00
|
|
|
{ return static_cast<wxEventFunction>(
|
|
|
|
reinterpret_cast<void (T::*)(wxEvent&)>(f)); }
|
2009-01-12 14:26:13 +00:00
|
|
|
};
|
|
|
|
|
2009-02-02 20:38:56 +00:00
|
|
|
// specialization for handlers not deriving from wxEvtHandler
|
|
|
|
template <typename T, typename A>
|
|
|
|
struct HandlerImpl<T, A, false>
|
|
|
|
{
|
|
|
|
static bool IsEvtHandler()
|
|
|
|
{ return false; }
|
|
|
|
static T *ConvertFromEvtHandler(wxEvtHandler *)
|
|
|
|
{ return NULL; }
|
|
|
|
static wxEvtHandler *ConvertToEvtHandler(T *)
|
|
|
|
{ return NULL; }
|
2009-05-02 12:52:54 +00:00
|
|
|
static wxEventFunction ConvertToEvtMethod(void (T::*)(A&))
|
2009-02-02 20:38:56 +00:00
|
|
|
{ return NULL; }
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace wxPrivate
|
2009-01-12 14:26:13 +00:00
|
|
|
|
2009-02-02 20:38:56 +00:00
|
|
|
// functor forwarding the event to a method of the given object
|
|
|
|
//
|
|
|
|
// notice that the object class may be different from the class in which the
|
|
|
|
// method is defined but it must be convertible to this class
|
2009-02-06 18:33:01 +00:00
|
|
|
//
|
|
|
|
// also, the type of the handler parameter doesn't need to be exactly the same
|
|
|
|
// as EventTag::EventClass but it must be its base class -- this is explicitly
|
|
|
|
// allowed to handle different events in the same handler taking wxEvent&, for
|
|
|
|
// example
|
|
|
|
template
|
2009-03-29 12:38:53 +00:00
|
|
|
<typename EventTag, typename Class, typename EventArg, typename EventHandler>
|
2009-02-02 20:38:56 +00:00
|
|
|
class wxEventFunctorMethod
|
|
|
|
: public wxEventFunctor,
|
|
|
|
private wxPrivate::HandlerImpl
|
|
|
|
<
|
|
|
|
Class,
|
2009-02-06 18:33:01 +00:00
|
|
|
EventArg,
|
2009-02-18 18:02:53 +00:00
|
|
|
wxConvertibleTo<Class, wxEvtHandler>::value != 0
|
2009-02-02 20:38:56 +00:00
|
|
|
>
|
2009-01-12 14:26:13 +00:00
|
|
|
{
|
2009-02-06 18:33:01 +00:00
|
|
|
private:
|
|
|
|
static void CheckHandlerArgument(EventArg *) { }
|
|
|
|
|
2009-01-12 14:26:13 +00:00
|
|
|
public:
|
2009-02-06 18:33:01 +00:00
|
|
|
// the event class associated with the given event tag
|
|
|
|
typedef typename wxPrivate::EventClassOf<EventTag>::type EventClass;
|
|
|
|
|
2009-02-02 20:38:56 +00:00
|
|
|
|
2009-03-29 12:38:53 +00:00
|
|
|
wxEventFunctorMethod(void (Class::*method)(EventArg&), EventHandler *handler)
|
2009-05-02 12:52:54 +00:00
|
|
|
: m_handler( handler ), m_method( method )
|
2009-01-12 14:26:13 +00:00
|
|
|
{
|
2009-02-02 21:09:08 +00:00
|
|
|
wxASSERT_MSG( handler || this->IsEvtHandler(),
|
2009-02-02 20:38:56 +00:00
|
|
|
"handlers defined in non-wxEvtHandler-derived classes "
|
|
|
|
"must be connected with a valid sink object" );
|
|
|
|
|
2009-02-06 18:33:01 +00:00
|
|
|
// if you get an error here it means that the signature of the handler
|
|
|
|
// you're trying to use is not compatible with (i.e. is not the same as
|
|
|
|
// or a base class of) the real event class used for this event type
|
|
|
|
CheckHandlerArgument(static_cast<EventClass *>(NULL));
|
2009-01-12 14:26:13 +00:00
|
|
|
}
|
|
|
|
|
2009-02-02 20:38:56 +00:00
|
|
|
virtual void operator()(wxEvtHandler *handler, wxEvent& event)
|
2009-01-12 14:26:13 +00:00
|
|
|
{
|
2009-02-02 20:38:56 +00:00
|
|
|
Class * realHandler = m_handler;
|
|
|
|
if ( !realHandler )
|
2009-01-12 14:26:13 +00:00
|
|
|
{
|
2009-02-02 21:09:08 +00:00
|
|
|
realHandler = this->ConvertFromEvtHandler(handler);
|
2009-01-12 14:26:13 +00:00
|
|
|
|
2009-02-02 20:38:56 +00:00
|
|
|
// this is not supposed to happen but check for it nevertheless
|
|
|
|
wxCHECK_RET( realHandler, "invalid event handler" );
|
2009-01-12 14:26:13 +00:00
|
|
|
}
|
|
|
|
|
2009-02-06 18:33:01 +00:00
|
|
|
// the real (run-time) type of event is EventClass and we checked in
|
|
|
|
// the ctor that EventClass can be converted to EventArg, so this cast
|
|
|
|
// is always valid
|
2009-02-02 20:38:56 +00:00
|
|
|
(realHandler->*m_method)(static_cast<EventArg&>(event));
|
2009-01-12 14:26:13 +00:00
|
|
|
}
|
|
|
|
|
2009-05-02 12:52:54 +00:00
|
|
|
virtual bool IsMatching(const wxEventFunctor& functor) const
|
2009-01-12 14:26:13 +00:00
|
|
|
{
|
2009-11-19 19:27:24 +00:00
|
|
|
if ( wxTypeId(functor) != wxTypeId(*this) )
|
2009-02-02 20:38:56 +00:00
|
|
|
return false;
|
2009-01-12 14:26:13 +00:00
|
|
|
|
2009-05-02 12:52:54 +00:00
|
|
|
typedef wxEventFunctorMethod<EventTag, Class, EventArg, EventHandler>
|
|
|
|
ThisFunctor;
|
|
|
|
|
2009-11-19 19:27:24 +00:00
|
|
|
// the cast is valid because wxTypeId()s matched above
|
2009-05-02 12:52:54 +00:00
|
|
|
const ThisFunctor& other = static_cast<const ThisFunctor &>(functor);
|
|
|
|
|
|
|
|
return (m_method == other.m_method || other.m_method == NULL) &&
|
|
|
|
(m_handler == other.m_handler || other.m_handler == NULL);
|
2009-01-12 14:26:13 +00:00
|
|
|
}
|
|
|
|
|
2009-05-02 12:52:54 +00:00
|
|
|
virtual wxEvtHandler *GetEvtHandler() const
|
|
|
|
{ return this->ConvertToEvtHandler(m_handler); }
|
|
|
|
|
|
|
|
virtual wxEventFunction GetEvtMethod() const
|
|
|
|
{ return this->ConvertToEvtMethod(m_method); }
|
|
|
|
|
|
|
|
private:
|
|
|
|
EventHandler *m_handler;
|
|
|
|
void (Class::*m_method)(EventArg&);
|
|
|
|
|
2009-11-19 19:27:24 +00:00
|
|
|
// Provide a dummy default ctor for type info purposes
|
|
|
|
wxEventFunctorMethod() { }
|
|
|
|
|
|
|
|
typedef wxEventFunctorMethod<EventTag, Class,
|
|
|
|
EventArg, EventHandler> thisClass;
|
|
|
|
WX_DECLARE_TYPEINFO_INLINE(thisClass)
|
2009-05-02 12:52:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// functor forwarding the event to function (function, static method)
|
|
|
|
template <typename EventTag, typename EventArg>
|
|
|
|
class wxEventFunctorFunction : public wxEventFunctor
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
static void CheckHandlerArgument(EventArg *) { }
|
|
|
|
|
|
|
|
public:
|
|
|
|
// the event class associated with the given event tag
|
|
|
|
typedef typename wxPrivate::EventClassOf<EventTag>::type EventClass;
|
|
|
|
|
|
|
|
wxEventFunctorFunction( void ( *handler )( EventArg & ))
|
|
|
|
: m_handler( handler )
|
2009-01-12 14:26:13 +00:00
|
|
|
{
|
2009-05-02 12:52:54 +00:00
|
|
|
// if you get an error here it means that the signature of the handler
|
|
|
|
// you're trying to use is not compatible with (i.e. is not the same as
|
|
|
|
// or a base class of) the real event class used for this event type
|
|
|
|
CheckHandlerArgument(static_cast<EventClass *>(NULL));
|
2009-01-12 14:26:13 +00:00
|
|
|
}
|
|
|
|
|
2009-05-02 12:52:54 +00:00
|
|
|
virtual void operator()(wxEvtHandler *WXUNUSED(handler), wxEvent& event)
|
2009-01-12 14:26:13 +00:00
|
|
|
{
|
2009-05-02 12:52:54 +00:00
|
|
|
// If you get an error here like "must use .* or ->* to call
|
|
|
|
// pointer-to-member function" then you probably tried to call
|
|
|
|
// Bind/Unbind with a method pointer but without a handler pointer or
|
|
|
|
// NULL as a handler e.g.:
|
|
|
|
// Unbind( wxEVT_XXX, &EventHandler::method );
|
|
|
|
// or
|
|
|
|
// Unbind( wxEVT_XXX, &EventHandler::method, NULL )
|
|
|
|
m_handler(static_cast<EventArg&>(event));
|
2009-02-02 20:38:56 +00:00
|
|
|
}
|
|
|
|
|
2009-05-02 12:52:54 +00:00
|
|
|
virtual bool IsMatching(const wxEventFunctor &functor) const
|
2009-02-02 20:38:56 +00:00
|
|
|
{
|
2009-11-19 19:27:24 +00:00
|
|
|
if ( wxTypeId(functor) != wxTypeId(*this) )
|
2009-05-02 12:52:54 +00:00
|
|
|
return false;
|
|
|
|
|
|
|
|
typedef wxEventFunctorFunction<EventTag, EventArg> ThisFunctor;
|
|
|
|
|
|
|
|
const ThisFunctor& other = static_cast<const ThisFunctor&>( functor );
|
|
|
|
|
|
|
|
return m_handler == other.m_handler;
|
2009-01-12 14:26:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2009-05-02 12:52:54 +00:00
|
|
|
void (*m_handler)(EventArg&);
|
|
|
|
|
2009-11-19 19:27:24 +00:00
|
|
|
// Provide a dummy default ctor for type info purposes
|
|
|
|
wxEventFunctorFunction() { }
|
|
|
|
|
|
|
|
typedef wxEventFunctorFunction<EventTag, EventArg> thisClass;
|
|
|
|
WX_DECLARE_TYPEINFO_INLINE(thisClass)
|
2009-01-12 14:26:13 +00:00
|
|
|
};
|
|
|
|
|
2009-02-02 20:38:56 +00:00
|
|
|
|
2009-05-02 12:52:54 +00:00
|
|
|
template <typename EventTag, typename Functor>
|
|
|
|
class wxEventFunctorFunctor : public wxEventFunctor
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
typedef typename EventTag::EventClass EventArg;
|
|
|
|
|
2009-05-02 15:28:16 +00:00
|
|
|
wxEventFunctorFunctor(const Functor& handler)
|
2009-05-02 12:52:54 +00:00
|
|
|
: m_handler(handler), m_handlerAddr(&handler)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
virtual void operator()(wxEvtHandler *WXUNUSED(handler), wxEvent& event)
|
|
|
|
{
|
|
|
|
// If you get an error here like "must use '.*' or '->*' to call
|
|
|
|
// pointer-to-member function" then you probably tried to call
|
|
|
|
// Bind/Unbind with a method pointer but without a handler pointer or
|
|
|
|
// NULL as a handler e.g.:
|
|
|
|
// Unbind( wxEVT_XXX, &EventHandler::method );
|
|
|
|
// or
|
|
|
|
// Unbind( wxEVT_XXX, &EventHandler::method, NULL )
|
|
|
|
m_handler(static_cast<EventArg&>(event));
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual bool IsMatching(const wxEventFunctor &functor) const
|
|
|
|
{
|
2009-11-19 19:27:24 +00:00
|
|
|
if ( wxTypeId(functor) != wxTypeId(*this) )
|
2009-05-02 12:52:54 +00:00
|
|
|
return false;
|
|
|
|
|
|
|
|
typedef wxEventFunctorFunctor<EventTag, Functor> FunctorThis;
|
|
|
|
|
|
|
|
const FunctorThis& other = static_cast<const FunctorThis&>(functor);
|
|
|
|
|
|
|
|
// The only reliable/portable way to compare two functors is by
|
|
|
|
// identity:
|
|
|
|
return m_handlerAddr == other.m_handlerAddr;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
// Store a copy of the functor to prevent using/calling an already
|
|
|
|
// destroyed instance:
|
|
|
|
Functor m_handler;
|
|
|
|
|
|
|
|
// Use the address of the original functor for comparison in IsMatching:
|
|
|
|
const void *m_handlerAddr;
|
|
|
|
|
2009-11-19 19:27:24 +00:00
|
|
|
// Provide a dummy default ctor for type info purposes
|
|
|
|
wxEventFunctorFunctor() { }
|
|
|
|
|
|
|
|
typedef wxEventFunctorFunctor<EventTag, Functor> thisClass;
|
|
|
|
WX_DECLARE_TYPEINFO_INLINE(thisClass)
|
2009-05-02 12:52:54 +00:00
|
|
|
};
|
|
|
|
|
2009-02-02 20:38:56 +00:00
|
|
|
// Create functors for the templatized events, either allocated on the heap for
|
2009-03-18 09:30:08 +00:00
|
|
|
// wxNewXXX() variants (this is needed in wxEvtHandler::Bind<>() to store them
|
2009-08-21 18:46:32 +00:00
|
|
|
// in dynamic event table) or just by returning them as temporary objects (this
|
2009-03-18 09:30:08 +00:00
|
|
|
// is enough for Unbind<>() and we avoid unnecessary heap allocation like this).
|
2009-01-12 14:26:13 +00:00
|
|
|
|
|
|
|
|
2009-05-02 12:52:54 +00:00
|
|
|
// Create functors wrapping functions:
|
|
|
|
template <typename EventTag, typename EventArg>
|
|
|
|
inline wxEventFunctorFunction<EventTag, EventArg> *
|
|
|
|
wxNewEventFunctor(const EventTag&, void (*func)(EventArg &))
|
2009-01-12 14:26:13 +00:00
|
|
|
{
|
2009-05-02 12:52:54 +00:00
|
|
|
return new wxEventFunctorFunction<EventTag, EventArg>(func);
|
2009-01-12 14:26:13 +00:00
|
|
|
}
|
|
|
|
|
2009-05-02 12:52:54 +00:00
|
|
|
template <typename EventTag, typename EventArg>
|
|
|
|
inline wxEventFunctorFunction<EventTag, EventArg>
|
|
|
|
wxMakeEventFunctor(const EventTag&, void (*func)(EventArg &))
|
|
|
|
{
|
|
|
|
return wxEventFunctorFunction<EventTag, EventArg>(func);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Create functors wrapping other functors:
|
2009-02-02 20:38:56 +00:00
|
|
|
template <typename EventTag, typename Functor>
|
2009-05-02 12:52:54 +00:00
|
|
|
inline wxEventFunctorFunctor<EventTag, Functor> *
|
2009-05-02 15:28:16 +00:00
|
|
|
wxNewEventFunctor(const EventTag&, const Functor &func)
|
2009-01-12 14:26:13 +00:00
|
|
|
{
|
2009-05-02 12:52:54 +00:00
|
|
|
return new wxEventFunctorFunctor<EventTag, Functor>(func);
|
2009-01-12 14:26:13 +00:00
|
|
|
}
|
|
|
|
|
2009-05-02 12:52:54 +00:00
|
|
|
template <typename EventTag, typename Functor>
|
|
|
|
inline wxEventFunctorFunctor<EventTag, Functor>
|
2009-05-02 15:28:16 +00:00
|
|
|
wxMakeEventFunctor(const EventTag&, const Functor &func)
|
2009-05-02 12:52:54 +00:00
|
|
|
{
|
|
|
|
return wxEventFunctorFunctor<EventTag, Functor>(func);
|
|
|
|
}
|
2009-01-12 14:26:13 +00:00
|
|
|
|
2009-05-02 12:52:54 +00:00
|
|
|
// Create functors wrapping methods:
|
2009-02-02 20:38:56 +00:00
|
|
|
template
|
2009-03-29 12:38:53 +00:00
|
|
|
<typename EventTag, typename Class, typename EventArg, typename EventHandler>
|
|
|
|
inline wxEventFunctorMethod<EventTag, Class, EventArg, EventHandler> *
|
2009-02-02 20:38:56 +00:00
|
|
|
wxNewEventFunctor(const EventTag&,
|
|
|
|
void (Class::*method)(EventArg&),
|
2009-03-29 12:38:53 +00:00
|
|
|
EventHandler *handler)
|
2009-01-12 14:26:13 +00:00
|
|
|
{
|
2009-03-29 12:38:53 +00:00
|
|
|
return new wxEventFunctorMethod<EventTag, Class, EventArg, EventHandler>(
|
2009-02-06 18:33:01 +00:00
|
|
|
method, handler);
|
2009-01-12 14:26:13 +00:00
|
|
|
}
|
|
|
|
|
2009-02-02 20:38:56 +00:00
|
|
|
template
|
2009-03-29 12:38:53 +00:00
|
|
|
<typename EventTag, typename Class, typename EventArg, typename EventHandler>
|
|
|
|
inline wxEventFunctorMethod<EventTag, Class, EventArg, EventHandler>
|
2009-02-02 20:38:56 +00:00
|
|
|
wxMakeEventFunctor(const EventTag&,
|
|
|
|
void (Class::*method)(EventArg&),
|
2009-03-29 12:38:53 +00:00
|
|
|
EventHandler *handler)
|
2009-01-12 14:26:13 +00:00
|
|
|
{
|
2009-03-29 12:38:53 +00:00
|
|
|
return wxEventFunctorMethod<EventTag, Class, EventArg, EventHandler>(
|
2009-02-06 18:33:01 +00:00
|
|
|
method, handler);
|
2009-01-12 14:26:13 +00:00
|
|
|
}
|
|
|
|
|
2010-06-09 14:28:08 +00:00
|
|
|
// Create an event functor for the event table via wxDECLARE_EVENT_TABLE_ENTRY:
|
2009-04-16 21:23:28 +00:00
|
|
|
// in this case we don't have the handler (as it's always the same as the
|
|
|
|
// object which generated the event) so we must use Class as its type
|
2009-02-02 20:38:56 +00:00
|
|
|
template <typename EventTag, typename Class, typename EventArg>
|
2009-02-06 18:33:01 +00:00
|
|
|
inline wxEventFunctorMethod<EventTag, Class, EventArg, Class> *
|
2009-04-16 21:23:28 +00:00
|
|
|
wxNewEventTableFunctor(const EventTag&, void (Class::*method)(EventArg&))
|
2009-01-12 14:26:13 +00:00
|
|
|
{
|
2009-02-06 18:33:01 +00:00
|
|
|
return new wxEventFunctorMethod<EventTag, Class, EventArg, Class>(
|
|
|
|
method, NULL);
|
2009-01-12 14:26:13 +00:00
|
|
|
}
|
|
|
|
|
2009-05-02 12:52:54 +00:00
|
|
|
#endif // wxHAS_EVENT_BIND
|
2009-01-12 14:26:13 +00:00
|
|
|
|
2009-02-02 20:38:56 +00:00
|
|
|
|
2008-01-27 13:21:39 +00:00
|
|
|
// many, but not all, standard event types
|
|
|
|
|
|
|
|
// some generic events
|
|
|
|
extern WXDLLIMPEXP_BASE const wxEventType wxEVT_NULL;
|
|
|
|
extern WXDLLIMPEXP_BASE const wxEventType wxEVT_FIRST;
|
|
|
|
extern WXDLLIMPEXP_BASE const wxEventType wxEVT_USER_FIRST;
|
|
|
|
|
2009-01-12 14:26:13 +00:00
|
|
|
// Need events declared to do this
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxCommandEvent;
|
2009-02-04 17:49:22 +00:00
|
|
|
class WXDLLIMPEXP_FWD_CORE wxThreadEvent;
|
2009-01-12 14:26:13 +00:00
|
|
|
class WXDLLIMPEXP_FWD_CORE wxMouseEvent;
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxFocusEvent;
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxChildFocusEvent;
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxKeyEvent;
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxNavigationKeyEvent;
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxSetCursorEvent;
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxScrollEvent;
|
2009-01-23 00:30:41 +00:00
|
|
|
class WXDLLIMPEXP_FWD_CORE wxSpinEvent;
|
2009-01-12 14:26:13 +00:00
|
|
|
class WXDLLIMPEXP_FWD_CORE wxScrollWinEvent;
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxSizeEvent;
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxMoveEvent;
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxCloseEvent;
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxActivateEvent;
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxWindowCreateEvent;
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxWindowDestroyEvent;
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxShowEvent;
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxIconizeEvent;
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxMaximizeEvent;
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxMouseCaptureChangedEvent;
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxMouseCaptureLostEvent;
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxPaintEvent;
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxEraseEvent;
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxNcPaintEvent;
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxMenuEvent;
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxContextMenuEvent;
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxSysColourChangedEvent;
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxDisplayChangedEvent;
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxQueryNewPaletteEvent;
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxPaletteChangedEvent;
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxJoystickEvent;
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxDropFilesEvent;
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxInitDialogEvent;
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxIdleEvent;
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxUpdateUIEvent;
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxClipboardTextEvent;
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxHelpEvent;
|
|
|
|
|
|
|
|
|
2008-01-27 13:21:39 +00:00
|
|
|
// Command events
|
2009-02-07 18:59:25 +00:00
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, wxCommandEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, wxCommandEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_MENU_SELECTED, wxCommandEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_SLIDER_UPDATED, wxCommandEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEvent);
|
2008-01-27 13:21:39 +00:00
|
|
|
|
|
|
|
// wxEVT_COMMAND_SCROLLBAR_UPDATED is deprecated, use wxEVT_SCROLL... events
|
2009-02-07 18:59:25 +00:00
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_SCROLLBAR_UPDATED, wxCommandEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_VLBOX_SELECTED, wxCommandEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_TOOL_RCLICKED, wxCommandEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_TOOL_DROPDOWN_CLICKED, wxCommandEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_TOOL_ENTER, wxCommandEvent);
|
2009-03-18 10:42:58 +00:00
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_COMBOBOX_DROPDOWN, wxCommandEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_COMBOBOX_CLOSEUP, wxCommandEvent);
|
2008-01-27 13:21:39 +00:00
|
|
|
|
2009-02-04 17:42:28 +00:00
|
|
|
// Thread events
|
2009-02-07 18:59:25 +00:00
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_THREAD, wxThreadEvent);
|
2009-02-04 17:42:28 +00:00
|
|
|
|
2008-01-27 13:21:39 +00:00
|
|
|
// Mouse event types
|
2009-02-07 18:59:25 +00:00
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_LEFT_DOWN, wxMouseEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_LEFT_UP, wxMouseEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MIDDLE_DOWN, wxMouseEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MIDDLE_UP, wxMouseEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_RIGHT_DOWN, wxMouseEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_RIGHT_UP, wxMouseEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOTION, wxMouseEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_ENTER_WINDOW, wxMouseEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_LEAVE_WINDOW, wxMouseEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_LEFT_DCLICK, wxMouseEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MIDDLE_DCLICK, wxMouseEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_RIGHT_DCLICK, wxMouseEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SET_FOCUS, wxFocusEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_KILL_FOCUS, wxFocusEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CHILD_FOCUS, wxChildFocusEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOUSEWHEEL, wxMouseEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX1_DOWN, wxMouseEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX1_UP, wxMouseEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX1_DCLICK, wxMouseEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX2_DOWN, wxMouseEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX2_UP, wxMouseEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX2_DCLICK, wxMouseEvent);
|
2008-01-27 13:21:39 +00:00
|
|
|
|
|
|
|
// Character input event type
|
2009-02-07 18:59:25 +00:00
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CHAR, wxKeyEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CHAR_HOOK, wxKeyEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_NAVIGATION_KEY, wxNavigationKeyEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_KEY_DOWN, wxKeyEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_KEY_UP, wxKeyEvent);
|
2003-07-10 09:16:00 +00:00
|
|
|
#if wxUSE_HOTKEY
|
2009-02-07 18:59:25 +00:00
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_HOTKEY, wxKeyEvent);
|
2003-07-10 09:16:00 +00:00
|
|
|
#endif
|
2008-01-27 13:21:39 +00:00
|
|
|
// Set cursor event
|
2009-02-07 18:59:25 +00:00
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SET_CURSOR, wxSetCursorEvent);
|
2008-01-27 13:21:39 +00:00
|
|
|
|
|
|
|
// wxScrollBar and wxSlider event identifiers
|
2009-02-07 18:59:25 +00:00
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_TOP, wxScrollEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_BOTTOM, wxScrollEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_LINEUP, wxScrollEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_LINEDOWN, wxScrollEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_PAGEUP, wxScrollEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_PAGEDOWN, wxScrollEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_THUMBTRACK, wxScrollEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_THUMBRELEASE, wxScrollEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_CHANGED, wxScrollEvent);
|
2008-01-27 13:21:39 +00:00
|
|
|
|
2009-01-23 00:30:41 +00:00
|
|
|
// Due to a bug in older wx versions, wxSpinEvents were being sent with type of
|
|
|
|
// wxEVT_SCROLL_LINEUP, wxEVT_SCROLL_LINEDOWN and wxEVT_SCROLL_THUMBTRACK. But
|
|
|
|
// with the type-safe events in place, these event types are associated with
|
|
|
|
// wxScrollEvent. To allow handling of spin events, new event types have been
|
|
|
|
// defined in spinbutt.h/spinnbuttcmn.cpp. To maintain backward compatibility
|
|
|
|
// the spin event types are being initialized with the scroll event types.
|
|
|
|
|
|
|
|
#if wxUSE_SPINBTN
|
|
|
|
|
2009-02-07 18:59:25 +00:00
|
|
|
wxDECLARE_EXPORTED_EVENT_ALIAS( WXDLLIMPEXP_CORE, wxEVT_SPIN_UP, wxSpinEvent );
|
|
|
|
wxDECLARE_EXPORTED_EVENT_ALIAS( WXDLLIMPEXP_CORE, wxEVT_SPIN_DOWN, wxSpinEvent );
|
|
|
|
wxDECLARE_EXPORTED_EVENT_ALIAS( WXDLLIMPEXP_CORE, wxEVT_SPIN, wxSpinEvent );
|
2009-01-23 00:30:41 +00:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2008-01-27 13:21:39 +00:00
|
|
|
// Scroll events from wxWindow
|
2009-02-07 18:59:25 +00:00
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_TOP, wxScrollWinEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_BOTTOM, wxScrollWinEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_LINEUP, wxScrollWinEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_LINEDOWN, wxScrollWinEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_PAGEUP, wxScrollWinEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_PAGEDOWN, wxScrollWinEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_THUMBTRACK, wxScrollWinEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_THUMBRELEASE, wxScrollWinEvent);
|
2008-01-27 13:21:39 +00:00
|
|
|
|
|
|
|
// System events
|
2009-02-07 18:59:25 +00:00
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SIZE, wxSizeEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOVE, wxMoveEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CLOSE_WINDOW, wxCloseEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_END_SESSION, wxCloseEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_QUERY_END_SESSION, wxCloseEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_ACTIVATE_APP, wxActivateEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_ACTIVATE, wxActivateEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CREATE, wxWindowCreateEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_DESTROY, wxWindowDestroyEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SHOW, wxShowEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_ICONIZE, wxIconizeEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MAXIMIZE, wxMaximizeEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOUSE_CAPTURE_CHANGED, wxMouseCaptureChangedEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOUSE_CAPTURE_LOST, wxMouseCaptureLostEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_PAINT, wxPaintEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_ERASE_BACKGROUND, wxEraseEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_NC_PAINT, wxNcPaintEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MENU_OPEN, wxMenuEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MENU_CLOSE, wxMenuEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MENU_HIGHLIGHT, wxMenuEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CONTEXT_MENU, wxContextMenuEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SYS_COLOUR_CHANGED, wxSysColourChangedEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_DISPLAY_CHANGED, wxDisplayChangedEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_QUERY_NEW_PALETTE, wxQueryNewPaletteEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_PALETTE_CHANGED, wxPaletteChangedEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_JOY_BUTTON_DOWN, wxJoystickEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_JOY_BUTTON_UP, wxJoystickEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_JOY_MOVE, wxJoystickEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_JOY_ZMOVE, wxJoystickEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_DROP_FILES, wxDropFilesEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_INIT_DIALOG, wxInitDialogEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_BASE, wxEVT_IDLE, wxIdleEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_UPDATE_UI, wxUpdateUIEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SIZING, wxSizeEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOVING, wxMoveEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOVE_START, wxMoveEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOVE_END, wxMoveEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_HIBERNATE, wxActivateEvent);
|
2008-01-27 13:21:39 +00:00
|
|
|
|
|
|
|
// Clipboard events
|
2009-02-07 18:59:25 +00:00
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_TEXT_COPY, wxClipboardTextEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_TEXT_CUT, wxClipboardTextEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_TEXT_PASTE, wxClipboardTextEvent);
|
2008-01-27 13:21:39 +00:00
|
|
|
|
|
|
|
// Generic command events
|
|
|
|
// Note: a click is a higher-level event than button down/up
|
2009-02-07 18:59:25 +00:00
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_LEFT_CLICK, wxCommandEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_LEFT_DCLICK, wxCommandEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_RIGHT_CLICK, wxCommandEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_RIGHT_DCLICK, wxCommandEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_SET_FOCUS, wxCommandEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_KILL_FOCUS, wxCommandEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_ENTER, wxCommandEvent);
|
2008-01-27 13:21:39 +00:00
|
|
|
|
|
|
|
// Help events
|
2009-02-07 18:59:25 +00:00
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_HELP, wxHelpEvent);
|
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_DETAILED_HELP, wxHelpEvent);
|
2001-01-27 12:38:09 +00:00
|
|
|
|
2001-01-27 20:16:02 +00:00
|
|
|
// these 2 events are the same
|
|
|
|
#define wxEVT_COMMAND_TOOL_CLICKED wxEVT_COMMAND_MENU_SELECTED
|
2001-01-27 12:38:09 +00:00
|
|
|
|
2001-07-31 17:56:45 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
2001-01-25 18:30:30 +00:00
|
|
|
// Compatibility
|
2001-07-31 17:56:45 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// this event is also used by wxComboBox and wxSpinCtrl which don't include
|
|
|
|
// wx/textctrl.h in all ports [yet], so declare it here as well
|
|
|
|
//
|
|
|
|
// still, any new code using it should include wx/textctrl.h explicitly
|
2009-02-07 18:59:25 +00:00
|
|
|
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_TEXT_UPDATED, wxCommandEvent);
|
1998-05-20 14:01:55 +00:00
|
|
|
|
2009-02-04 17:42:28 +00:00
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// wxEvent(-derived) classes
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2003-07-18 00:39:05 +00:00
|
|
|
// the predefined constants for the number of times we propagate event
|
|
|
|
// upwards window child-parent chain
|
2009-02-04 17:42:28 +00:00
|
|
|
enum wxEventPropagation
|
2003-07-18 00:39:05 +00:00
|
|
|
{
|
|
|
|
// don't propagate it at all
|
|
|
|
wxEVENT_PROPAGATE_NONE = 0,
|
|
|
|
|
|
|
|
// propagate it until it is processed
|
|
|
|
wxEVENT_PROPAGATE_MAX = INT_MAX
|
|
|
|
};
|
|
|
|
|
2009-02-04 17:42:28 +00:00
|
|
|
// The different categories for a wxEvent; see wxEvent::GetEventCategory.
|
2009-02-15 14:25:08 +00:00
|
|
|
// NOTE: they are used as OR-combinable flags by wxEventLoopBase::YieldFor
|
2009-02-04 17:42:28 +00:00
|
|
|
enum wxEventCategory
|
|
|
|
{
|
|
|
|
// this is the category for those events which are generated to update
|
|
|
|
// the appearance of the GUI but which (usually) do not comport data
|
|
|
|
// processing, i.e. which do not provide input or output data
|
|
|
|
// (e.g. size events, scroll events, etc).
|
|
|
|
// They are events NOT directly generated by the user's input devices.
|
|
|
|
wxEVT_CATEGORY_UI = 1,
|
|
|
|
|
|
|
|
// this category groups those events which are generated directly from the
|
|
|
|
// user through input devices like mouse and keyboard and usually result in
|
|
|
|
// data to be processed from the application.
|
|
|
|
// (e.g. mouse clicks, key presses, etc)
|
|
|
|
wxEVT_CATEGORY_USER_INPUT = 2,
|
|
|
|
|
|
|
|
// this category is for wxSocketEvent
|
|
|
|
wxEVT_CATEGORY_SOCKET = 4,
|
|
|
|
|
|
|
|
// this category is for wxTimerEvent
|
|
|
|
wxEVT_CATEGORY_TIMER = 8,
|
|
|
|
|
|
|
|
// this category is for any event used to send notifications from the
|
|
|
|
// secondary threads to the main one or in general for notifications among
|
|
|
|
// different threads (which may or may not be user-generated)
|
|
|
|
wxEVT_CATEGORY_THREAD = 16,
|
|
|
|
|
|
|
|
|
|
|
|
// implementation only
|
|
|
|
|
2009-02-15 14:25:08 +00:00
|
|
|
// used in the implementations of wxEventLoopBase::YieldFor
|
2009-02-04 17:42:28 +00:00
|
|
|
wxEVT_CATEGORY_UNKNOWN = 32,
|
|
|
|
|
2009-02-15 14:25:08 +00:00
|
|
|
// a special category used as an argument to wxEventLoopBase::YieldFor to indicate that
|
2009-02-04 17:42:28 +00:00
|
|
|
// Yield() should leave all wxEvents on the queue while emptying the native event queue
|
|
|
|
// (native events will be processed but the wxEvents they generate will be queued)
|
|
|
|
wxEVT_CATEGORY_CLIPBOARD = 64,
|
|
|
|
|
|
|
|
|
|
|
|
// shortcut masks
|
|
|
|
|
|
|
|
// this category groups those events which are emitted in response to
|
|
|
|
// events of the native toolkit and which typically are not-"delayable".
|
|
|
|
wxEVT_CATEGORY_NATIVE_EVENTS = wxEVT_CATEGORY_UI|wxEVT_CATEGORY_USER_INPUT,
|
|
|
|
|
2009-02-15 14:25:08 +00:00
|
|
|
// used in wxEventLoopBase::YieldFor to specify all event categories should be processed:
|
2009-02-04 17:42:28 +00:00
|
|
|
wxEVT_CATEGORY_ALL =
|
|
|
|
wxEVT_CATEGORY_UI|wxEVT_CATEGORY_USER_INPUT|wxEVT_CATEGORY_SOCKET| \
|
2009-03-14 19:20:03 +00:00
|
|
|
wxEVT_CATEGORY_TIMER|wxEVT_CATEGORY_THREAD|wxEVT_CATEGORY_UNKNOWN| \
|
|
|
|
wxEVT_CATEGORY_CLIPBOARD
|
2009-02-04 17:42:28 +00:00
|
|
|
};
|
|
|
|
|
1998-05-20 14:01:55 +00:00
|
|
|
/*
|
2004-05-23 14:56:36 +00:00
|
|
|
* wxWidgets events, covering all interesting things that might happen
|
1998-05-20 14:01:55 +00:00
|
|
|
* (button clicking, resizing, setting text in widgets, etc.).
|
|
|
|
*
|
|
|
|
* For each completely new event type, derive a new event class.
|
|
|
|
* An event CLASS represents a C++ class defining a range of similar event TYPES;
|
|
|
|
* examples are canvas events, panel item command events.
|
|
|
|
* An event TYPE is a unique identifier for a particular system event,
|
|
|
|
* such as a button press or a listbox deselection.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2003-07-02 01:59:24 +00:00
|
|
|
class WXDLLIMPEXP_BASE wxEvent : public wxObject
|
1998-05-20 14:01:55 +00:00
|
|
|
{
|
|
|
|
public:
|
2003-03-21 02:58:55 +00:00
|
|
|
wxEvent(int winid = 0, wxEventType commandType = wxEVT_NULL );
|
1999-02-05 14:26:48 +00:00
|
|
|
|
|
|
|
void SetEventType(wxEventType typ) { m_eventType = typ; }
|
|
|
|
wxEventType GetEventType() const { return m_eventType; }
|
2009-02-04 17:42:28 +00:00
|
|
|
|
1999-02-05 14:26:48 +00:00
|
|
|
wxObject *GetEventObject() const { return m_eventObject; }
|
|
|
|
void SetEventObject(wxObject *obj) { m_eventObject = obj; }
|
2009-02-04 17:42:28 +00:00
|
|
|
|
1999-02-05 14:26:48 +00:00
|
|
|
long GetTimestamp() const { return m_timeStamp; }
|
|
|
|
void SetTimestamp(long ts = 0) { m_timeStamp = ts; }
|
2009-02-04 17:42:28 +00:00
|
|
|
|
1999-02-05 14:26:48 +00:00
|
|
|
int GetId() const { return m_id; }
|
|
|
|
void SetId(int Id) { m_id = Id; }
|
|
|
|
|
|
|
|
// Can instruct event processor that we wish to ignore this event
|
|
|
|
// (treat as if the event table entry had not been found): this must be done
|
|
|
|
// to allow the event processing by the base classes (calling event.Skip()
|
2004-09-04 01:26:40 +00:00
|
|
|
// is the analog of calling the base class version of a virtual function)
|
|
|
|
void Skip(bool skip = true) { m_skipped = skip; }
|
2007-04-14 09:58:37 +00:00
|
|
|
bool GetSkipped() const { return m_skipped; }
|
1998-05-20 14:01:55 +00:00
|
|
|
|
2009-01-16 16:07:16 +00:00
|
|
|
// This function is used to create a copy of the event polymorphically and
|
2001-11-21 21:44:52 +00:00
|
|
|
// all derived classes must implement it because otherwise wxPostEvent()
|
|
|
|
// for them wouldn't work (it needs to do a copy of the event)
|
|
|
|
virtual wxEvent *Clone() const = 0;
|
1999-04-26 18:16:56 +00:00
|
|
|
|
2009-02-15 14:25:08 +00:00
|
|
|
// this function is used to selectively process events in wxEventLoopBase::YieldFor
|
2009-02-04 17:42:28 +00:00
|
|
|
// NOTE: by default it returns wxEVT_CATEGORY_UI just because the major
|
|
|
|
// part of wxWidgets events belong to that category.
|
|
|
|
virtual wxEventCategory GetEventCategory() const
|
|
|
|
{ return wxEVT_CATEGORY_UI; }
|
|
|
|
|
2004-07-04 11:19:47 +00:00
|
|
|
// Implementation only: this test is explicitly anti OO and this function
|
2003-07-18 00:39:05 +00:00
|
|
|
// exists only for optimization purposes.
|
|
|
|
bool IsCommandEvent() const { return m_isCommandEvent; }
|
|
|
|
|
|
|
|
// Determine if this event should be propagating to the parent window.
|
|
|
|
bool ShouldPropagate() const
|
|
|
|
{ return m_propagationLevel != wxEVENT_PROPAGATE_NONE; }
|
|
|
|
|
|
|
|
// Stop an event from propagating to its parent window, returns the old
|
|
|
|
// propagation level value
|
|
|
|
int StopPropagation()
|
|
|
|
{
|
|
|
|
int propagationLevel = m_propagationLevel;
|
|
|
|
m_propagationLevel = wxEVENT_PROPAGATE_NONE;
|
|
|
|
return propagationLevel;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Resume the event propagation by restoring the propagation level
|
|
|
|
// (returned by StopPropagation())
|
|
|
|
void ResumePropagation(int propagationLevel)
|
|
|
|
{
|
|
|
|
m_propagationLevel = propagationLevel;
|
|
|
|
}
|
|
|
|
|
2009-01-16 16:07:16 +00:00
|
|
|
|
|
|
|
// This is for internal use only and is only called by
|
|
|
|
// wxEvtHandler::ProcessEvent() to check whether it's the first time this
|
|
|
|
// event is being processed
|
|
|
|
bool WasProcessed()
|
|
|
|
{
|
|
|
|
if ( m_wasProcessed )
|
|
|
|
return true;
|
|
|
|
|
|
|
|
m_wasProcessed = true;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2010-05-09 14:55:28 +00:00
|
|
|
// This is also used only internally by ProcessEvent() to check if it
|
|
|
|
// should process the event normally or only restrict the search for the
|
|
|
|
// event handler to this object itself.
|
2010-06-02 11:58:31 +00:00
|
|
|
bool ShouldProcessOnlyIn(wxEvtHandler *h) const
|
|
|
|
{
|
|
|
|
return h == m_handlerToProcessOnlyIn;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Called to indicate that the result of ShouldProcessOnlyIn() wasn't taken
|
|
|
|
// into account. The existence of this function may seem counterintuitive
|
|
|
|
// but unfortunately it's needed by wxScrollHelperEvtHandler, see comments
|
|
|
|
// there. Don't even think of using this in your own code, this is a gross
|
|
|
|
// hack and is only needed because of wx complicated history and should
|
|
|
|
// never be used anywhere else.
|
|
|
|
void DidntHonourProcessOnlyIn()
|
|
|
|
{
|
|
|
|
m_handlerToProcessOnlyIn = NULL;
|
|
|
|
}
|
2010-05-09 14:55:28 +00:00
|
|
|
|
2005-01-18 15:12:53 +00:00
|
|
|
protected:
|
1999-02-05 14:26:48 +00:00
|
|
|
wxObject* m_eventObject;
|
|
|
|
wxEventType m_eventType;
|
|
|
|
long m_timeStamp;
|
|
|
|
int m_id;
|
2005-01-18 15:12:53 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
// m_callbackUserData is for internal usage only
|
1999-02-05 14:26:48 +00:00
|
|
|
wxObject* m_callbackUserData;
|
2003-07-18 00:39:05 +00:00
|
|
|
|
2010-06-02 11:58:31 +00:00
|
|
|
private:
|
|
|
|
// If this handler
|
|
|
|
wxEvtHandler *m_handlerToProcessOnlyIn;
|
|
|
|
|
2003-07-18 00:39:05 +00:00
|
|
|
protected:
|
|
|
|
// the propagation level: while it is positive, we propagate the event to
|
|
|
|
// the parent window (if any)
|
|
|
|
int m_propagationLevel;
|
|
|
|
|
1999-05-19 00:53:27 +00:00
|
|
|
bool m_skipped;
|
1999-02-23 22:41:37 +00:00
|
|
|
bool m_isCommandEvent;
|
2003-09-17 23:35:36 +00:00
|
|
|
|
2009-01-16 16:07:16 +00:00
|
|
|
// initially false but becomes true as soon as WasProcessed() is called for
|
|
|
|
// the first time, as this is done only by ProcessEvent() it explains the
|
|
|
|
// variable name: it becomes true after ProcessEvent() was called at least
|
|
|
|
// once for this event
|
|
|
|
bool m_wasProcessed;
|
|
|
|
|
2008-09-19 18:41:41 +00:00
|
|
|
protected:
|
|
|
|
wxEvent(const wxEvent&); // for implementing Clone()
|
|
|
|
wxEvent& operator=(const wxEvent&); // for derived classes operator=()
|
|
|
|
|
2001-11-18 12:42:45 +00:00
|
|
|
private:
|
2003-07-18 00:39:05 +00:00
|
|
|
// it needs to access our m_propagationLevel
|
2007-07-09 10:09:52 +00:00
|
|
|
friend class WXDLLIMPEXP_FWD_BASE wxPropagateOnce;
|
2003-07-18 00:39:05 +00:00
|
|
|
|
2010-06-02 11:58:31 +00:00
|
|
|
// and this one needs to access our m_handlerToProcessOnlyIn
|
|
|
|
friend class WXDLLIMPEXP_FWD_BASE wxEventProcessInHandlerOnly;
|
2010-05-09 14:55:28 +00:00
|
|
|
|
|
|
|
|
2001-11-18 12:42:45 +00:00
|
|
|
DECLARE_ABSTRACT_CLASS(wxEvent)
|
1998-05-20 14:01:55 +00:00
|
|
|
};
|
|
|
|
|
2003-07-18 00:39:05 +00:00
|
|
|
/*
|
|
|
|
* Helper class to temporarily change an event not to propagate.
|
|
|
|
*/
|
|
|
|
class WXDLLIMPEXP_BASE wxPropagationDisabler
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxPropagationDisabler(wxEvent& event) : m_event(event)
|
|
|
|
{
|
|
|
|
m_propagationLevelOld = m_event.StopPropagation();
|
|
|
|
}
|
|
|
|
|
|
|
|
~wxPropagationDisabler()
|
|
|
|
{
|
|
|
|
m_event.ResumePropagation(m_propagationLevelOld);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
wxEvent& m_event;
|
|
|
|
int m_propagationLevelOld;
|
2003-07-22 00:24:07 +00:00
|
|
|
|
2009-02-08 11:45:59 +00:00
|
|
|
wxDECLARE_NO_COPY_CLASS(wxPropagationDisabler);
|
2003-07-18 00:39:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Another one to temporarily lower propagation level.
|
|
|
|
*/
|
|
|
|
class WXDLLIMPEXP_BASE wxPropagateOnce
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxPropagateOnce(wxEvent& event) : m_event(event)
|
|
|
|
{
|
|
|
|
wxASSERT_MSG( m_event.m_propagationLevel > 0,
|
2009-07-23 20:30:22 +00:00
|
|
|
wxT("shouldn't be used unless ShouldPropagate()!") );
|
2003-07-18 00:39:05 +00:00
|
|
|
|
|
|
|
m_event.m_propagationLevel--;
|
|
|
|
}
|
|
|
|
|
|
|
|
~wxPropagateOnce()
|
|
|
|
{
|
|
|
|
m_event.m_propagationLevel++;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
wxEvent& m_event;
|
2003-07-22 00:24:07 +00:00
|
|
|
|
2009-02-08 11:45:59 +00:00
|
|
|
wxDECLARE_NO_COPY_CLASS(wxPropagateOnce);
|
2003-07-18 00:39:05 +00:00
|
|
|
};
|
|
|
|
|
2010-06-02 11:58:31 +00:00
|
|
|
// A helper object used to temporarily make wxEvent::ShouldProcessOnlyIn()
|
|
|
|
// return true for the handler passed to its ctor.
|
|
|
|
class wxEventProcessInHandlerOnly
|
2010-05-09 14:55:28 +00:00
|
|
|
{
|
|
|
|
public:
|
2010-06-02 11:58:31 +00:00
|
|
|
wxEventProcessInHandlerOnly(wxEvent& event, wxEvtHandler *handler)
|
|
|
|
: m_event(event),
|
|
|
|
m_handlerToProcessOnlyInOld(event.m_handlerToProcessOnlyIn)
|
2010-05-09 14:55:28 +00:00
|
|
|
{
|
2010-06-02 11:58:31 +00:00
|
|
|
m_event.m_handlerToProcessOnlyIn = handler;
|
2010-05-09 14:55:28 +00:00
|
|
|
}
|
|
|
|
|
2010-06-02 11:58:31 +00:00
|
|
|
~wxEventProcessInHandlerOnly()
|
2010-05-09 14:55:28 +00:00
|
|
|
{
|
2010-06-02 11:58:31 +00:00
|
|
|
m_event.m_handlerToProcessOnlyIn = m_handlerToProcessOnlyInOld;
|
2010-05-09 14:55:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
wxEvent& m_event;
|
2010-06-02 11:58:31 +00:00
|
|
|
wxEvtHandler * const m_handlerToProcessOnlyInOld;
|
2010-05-09 14:55:28 +00:00
|
|
|
|
2010-06-02 11:58:31 +00:00
|
|
|
wxDECLARE_NO_COPY_CLASS(wxEventProcessInHandlerOnly);
|
2010-05-09 14:55:28 +00:00
|
|
|
};
|
2007-02-04 00:12:50 +00:00
|
|
|
|
1999-10-04 20:15:38 +00:00
|
|
|
#if wxUSE_GUI
|
|
|
|
|
2003-07-18 00:39:05 +00:00
|
|
|
|
1998-05-20 14:01:55 +00:00
|
|
|
// Item or menu event class
|
|
|
|
/*
|
|
|
|
wxEVT_COMMAND_BUTTON_CLICKED
|
|
|
|
wxEVT_COMMAND_CHECKBOX_CLICKED
|
|
|
|
wxEVT_COMMAND_CHOICE_SELECTED
|
|
|
|
wxEVT_COMMAND_LISTBOX_SELECTED
|
|
|
|
wxEVT_COMMAND_LISTBOX_DOUBLECLICKED
|
|
|
|
wxEVT_COMMAND_TEXT_UPDATED
|
|
|
|
wxEVT_COMMAND_TEXT_ENTER
|
|
|
|
wxEVT_COMMAND_MENU_SELECTED
|
|
|
|
wxEVT_COMMAND_SLIDER_UPDATED
|
|
|
|
wxEVT_COMMAND_RADIOBOX_SELECTED
|
|
|
|
wxEVT_COMMAND_RADIOBUTTON_SELECTED
|
|
|
|
wxEVT_COMMAND_SCROLLBAR_UPDATED
|
|
|
|
wxEVT_COMMAND_VLBOX_SELECTED
|
|
|
|
wxEVT_COMMAND_COMBOBOX_SELECTED
|
2001-02-08 18:57:23 +00:00
|
|
|
wxEVT_COMMAND_TOGGLEBUTTON_CLICKED
|
1998-05-20 14:01:55 +00:00
|
|
|
*/
|
|
|
|
|
2003-07-02 01:59:24 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxCommandEvent : public wxEvent
|
1998-05-20 14:01:55 +00:00
|
|
|
{
|
1999-02-05 14:26:48 +00:00
|
|
|
public:
|
2003-03-21 02:58:55 +00:00
|
|
|
wxCommandEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
|
1998-05-20 14:01:55 +00:00
|
|
|
|
2002-05-08 21:13:51 +00:00
|
|
|
wxCommandEvent(const wxCommandEvent& event)
|
2002-07-03 16:25:22 +00:00
|
|
|
: wxEvent(event),
|
2008-04-28 18:49:42 +00:00
|
|
|
m_cmdString(event.m_cmdString),
|
2002-07-03 16:25:22 +00:00
|
|
|
m_commandInt(event.m_commandInt),
|
|
|
|
m_extraLong(event.m_extraLong),
|
|
|
|
m_clientData(event.m_clientData),
|
|
|
|
m_clientObject(event.m_clientObject)
|
2002-05-08 21:13:51 +00:00
|
|
|
{ }
|
|
|
|
|
1999-02-05 14:26:48 +00:00
|
|
|
// Set/Get client data from controls
|
|
|
|
void SetClientData(void* clientData) { m_clientData = clientData; }
|
|
|
|
void *GetClientData() const { return m_clientData; }
|
1998-05-20 14:01:55 +00:00
|
|
|
|
1999-02-05 14:26:48 +00:00
|
|
|
// Set/Get client object from controls
|
|
|
|
void SetClientObject(wxClientData* clientObject) { m_clientObject = clientObject; }
|
2004-04-15 23:10:08 +00:00
|
|
|
wxClientData *GetClientObject() const { return m_clientObject; }
|
1998-11-06 13:13:43 +00:00
|
|
|
|
1999-02-05 14:26:48 +00:00
|
|
|
// Get listbox selection if single-choice
|
|
|
|
int GetSelection() const { return m_commandInt; }
|
1998-05-20 14:01:55 +00:00
|
|
|
|
1999-02-05 14:26:48 +00:00
|
|
|
// Set/Get listbox/choice selection string
|
2005-01-18 15:12:53 +00:00
|
|
|
void SetString(const wxString& s) { m_cmdString = s; }
|
|
|
|
wxString GetString() const;
|
1998-05-20 14:01:55 +00:00
|
|
|
|
1999-02-05 14:26:48 +00:00
|
|
|
// Get checkbox value
|
2000-08-08 06:11:51 +00:00
|
|
|
bool IsChecked() const { return m_commandInt != 0; }
|
1998-05-20 14:01:55 +00:00
|
|
|
|
2004-09-04 01:26:40 +00:00
|
|
|
// true if the listbox event was a selection.
|
1999-02-05 14:26:48 +00:00
|
|
|
bool IsSelection() const { return (m_extraLong != 0); }
|
1998-05-20 14:01:55 +00:00
|
|
|
|
1999-02-05 14:26:48 +00:00
|
|
|
void SetExtraLong(long extraLong) { m_extraLong = extraLong; }
|
2003-08-02 00:12:39 +00:00
|
|
|
long GetExtraLong() const { return m_extraLong; }
|
1998-05-20 14:01:55 +00:00
|
|
|
|
1999-02-05 14:26:48 +00:00
|
|
|
void SetInt(int i) { m_commandInt = i; }
|
2006-04-21 00:53:59 +00:00
|
|
|
int GetInt() const { return m_commandInt; }
|
1998-05-20 14:01:55 +00:00
|
|
|
|
2001-11-18 12:42:45 +00:00
|
|
|
virtual wxEvent *Clone() const { return new wxCommandEvent(*this); }
|
2009-02-04 17:42:28 +00:00
|
|
|
virtual wxEventCategory GetEventCategory() const { return wxEVT_CATEGORY_USER_INPUT; }
|
1999-05-07 18:34:32 +00:00
|
|
|
|
2005-01-18 15:12:53 +00:00
|
|
|
protected:
|
|
|
|
wxString m_cmdString; // String event argument
|
1999-02-05 14:26:48 +00:00
|
|
|
int m_commandInt;
|
|
|
|
long m_extraLong; // Additional information (e.g. select/deselect)
|
|
|
|
void* m_clientData; // Arbitrary client data
|
|
|
|
wxClientData* m_clientObject; // Arbitrary client object
|
2001-11-18 23:08:00 +00:00
|
|
|
|
2001-11-18 12:42:45 +00:00
|
|
|
private:
|
2003-07-22 00:24:07 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCommandEvent)
|
1998-05-20 14:01:55 +00:00
|
|
|
};
|
|
|
|
|
1998-11-24 23:30:50 +00:00
|
|
|
// this class adds a possibility to react (from the user) code to a control
|
|
|
|
// notification: allow or veto the operation being reported.
|
2003-07-02 01:59:24 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxNotifyEvent : public wxCommandEvent
|
1998-11-24 23:30:50 +00:00
|
|
|
{
|
|
|
|
public:
|
2003-03-21 02:58:55 +00:00
|
|
|
wxNotifyEvent(wxEventType commandType = wxEVT_NULL, int winid = 0)
|
|
|
|
: wxCommandEvent(commandType, winid)
|
2004-09-04 01:26:40 +00:00
|
|
|
{ m_bAllow = true; }
|
2002-05-08 21:13:51 +00:00
|
|
|
|
|
|
|
wxNotifyEvent(const wxNotifyEvent& event)
|
|
|
|
: wxCommandEvent(event)
|
2002-07-03 16:25:22 +00:00
|
|
|
{ m_bAllow = event.m_bAllow; }
|
1998-11-24 23:30:50 +00:00
|
|
|
|
2000-02-15 00:05:36 +00:00
|
|
|
// veto the operation (usually it's allowed by default)
|
2004-09-04 01:26:40 +00:00
|
|
|
void Veto() { m_bAllow = false; }
|
1998-11-24 23:30:50 +00:00
|
|
|
|
2000-02-15 00:05:36 +00:00
|
|
|
// allow the operation if it was disabled by default
|
2004-09-04 01:26:40 +00:00
|
|
|
void Allow() { m_bAllow = true; }
|
2000-02-15 00:05:36 +00:00
|
|
|
|
1998-11-24 23:30:50 +00:00
|
|
|
// for implementation code only: is the operation allowed?
|
|
|
|
bool IsAllowed() const { return m_bAllow; }
|
|
|
|
|
2001-11-18 12:42:45 +00:00
|
|
|
virtual wxEvent *Clone() const { return new wxNotifyEvent(*this); }
|
1999-12-29 17:16:55 +00:00
|
|
|
|
1998-11-24 23:30:50 +00:00
|
|
|
private:
|
|
|
|
bool m_bAllow;
|
|
|
|
|
2001-11-18 12:42:45 +00:00
|
|
|
private:
|
2003-07-22 00:24:07 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxNotifyEvent)
|
1998-11-24 23:30:50 +00:00
|
|
|
};
|
|
|
|
|
2009-02-04 17:42:28 +00:00
|
|
|
|
|
|
|
// Thread event
|
|
|
|
|
2009-02-04 19:25:09 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxThreadEvent : public wxCommandEvent
|
2009-02-04 17:42:28 +00:00
|
|
|
{
|
|
|
|
public:
|
2009-02-04 19:44:55 +00:00
|
|
|
wxThreadEvent(wxEventType eventType = wxEVT_COMMAND_THREAD, int id = wxID_ANY)
|
|
|
|
: wxCommandEvent(eventType, id)
|
2009-02-04 17:42:28 +00:00
|
|
|
{ }
|
|
|
|
|
2009-02-20 12:02:09 +00:00
|
|
|
wxThreadEvent(const wxThreadEvent& event)
|
|
|
|
: wxCommandEvent(event)
|
|
|
|
{
|
|
|
|
// make sure our string member (which uses COW, aka refcounting) is not
|
|
|
|
// shared by other wxString instances:
|
|
|
|
SetString(GetString().c_str());
|
2010-01-19 13:01:40 +00:00
|
|
|
|
|
|
|
#if wxUSE_ANY && (!defined(__VISUALC__) || wxCHECK_VISUALC_VERSION(7))
|
|
|
|
m_payload = event.m_payload;
|
|
|
|
#endif
|
2009-02-20 12:02:09 +00:00
|
|
|
}
|
|
|
|
|
2009-02-04 17:42:28 +00:00
|
|
|
virtual wxEvent *Clone() const
|
|
|
|
{
|
2010-01-19 13:01:33 +00:00
|
|
|
return new wxThreadEvent(*this);
|
2009-02-04 17:42:28 +00:00
|
|
|
}
|
|
|
|
|
2009-02-15 14:25:08 +00:00
|
|
|
// this is important to avoid that calling wxEventLoopBase::YieldFor thread events
|
2009-02-04 17:42:28 +00:00
|
|
|
// gets processed when this is unwanted:
|
|
|
|
virtual wxEventCategory GetEventCategory() const
|
|
|
|
{ return wxEVT_CATEGORY_THREAD; }
|
|
|
|
|
2010-01-19 13:01:40 +00:00
|
|
|
#if wxUSE_ANY && (!defined(__VISUALC__) || wxCHECK_VISUALC_VERSION(7))
|
|
|
|
template<typename T>
|
|
|
|
void SetPayload(const T& payload)
|
|
|
|
{
|
|
|
|
m_payload = payload;
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
T GetPayload() const
|
|
|
|
{
|
|
|
|
return m_payload.As<T>();
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
wxAny m_payload;
|
|
|
|
#endif // wxUSE_ANY && (!defined(__VISUALC__) || wxCHECK_VISUALC_VERSION(7))
|
|
|
|
|
2009-02-04 17:42:28 +00:00
|
|
|
private:
|
|
|
|
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxThreadEvent)
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
1999-05-12 09:31:02 +00:00
|
|
|
// Scroll event class, derived form wxCommandEvent. wxScrollEvents are
|
2002-07-09 23:33:28 +00:00
|
|
|
// sent by wxSlider and wxScrollBar.
|
1998-05-20 14:01:55 +00:00
|
|
|
/*
|
|
|
|
wxEVT_SCROLL_TOP
|
|
|
|
wxEVT_SCROLL_BOTTOM
|
|
|
|
wxEVT_SCROLL_LINEUP
|
|
|
|
wxEVT_SCROLL_LINEDOWN
|
|
|
|
wxEVT_SCROLL_PAGEUP
|
|
|
|
wxEVT_SCROLL_PAGEDOWN
|
|
|
|
wxEVT_SCROLL_THUMBTRACK
|
2000-02-11 17:55:28 +00:00
|
|
|
wxEVT_SCROLL_THUMBRELEASE
|
2005-05-31 15:22:10 +00:00
|
|
|
wxEVT_SCROLL_CHANGED
|
1998-05-20 14:01:55 +00:00
|
|
|
*/
|
|
|
|
|
2003-07-02 01:59:24 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxScrollEvent : public wxCommandEvent
|
1998-05-20 14:01:55 +00:00
|
|
|
{
|
1999-02-05 14:26:48 +00:00
|
|
|
public:
|
|
|
|
wxScrollEvent(wxEventType commandType = wxEVT_NULL,
|
2003-03-21 02:58:55 +00:00
|
|
|
int winid = 0, int pos = 0, int orient = 0);
|
1999-02-05 14:26:48 +00:00
|
|
|
|
2003-08-02 00:12:39 +00:00
|
|
|
int GetOrientation() const { return (int) m_extraLong; }
|
|
|
|
int GetPosition() const { return m_commandInt; }
|
1999-02-05 14:26:48 +00:00
|
|
|
void SetOrientation(int orient) { m_extraLong = (long) orient; }
|
|
|
|
void SetPosition(int pos) { m_commandInt = pos; }
|
2001-11-18 23:08:00 +00:00
|
|
|
|
2001-11-18 12:42:45 +00:00
|
|
|
virtual wxEvent *Clone() const { return new wxScrollEvent(*this); }
|
2001-11-18 23:08:00 +00:00
|
|
|
|
2001-11-18 12:42:45 +00:00
|
|
|
private:
|
2003-07-22 00:24:07 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxScrollEvent)
|
1998-05-20 14:01:55 +00:00
|
|
|
};
|
|
|
|
|
1999-05-12 09:31:02 +00:00
|
|
|
// ScrollWin event class, derived fom wxEvent. wxScrollWinEvents
|
|
|
|
// are sent by wxWindow.
|
|
|
|
/*
|
|
|
|
wxEVT_SCROLLWIN_TOP
|
|
|
|
wxEVT_SCROLLWIN_BOTTOM
|
|
|
|
wxEVT_SCROLLWIN_LINEUP
|
|
|
|
wxEVT_SCROLLWIN_LINEDOWN
|
|
|
|
wxEVT_SCROLLWIN_PAGEUP
|
|
|
|
wxEVT_SCROLLWIN_PAGEDOWN
|
|
|
|
wxEVT_SCROLLWIN_THUMBTRACK
|
2000-02-11 17:55:28 +00:00
|
|
|
wxEVT_SCROLLWIN_THUMBRELEASE
|
1999-05-12 09:31:02 +00:00
|
|
|
*/
|
|
|
|
|
2003-07-02 01:59:24 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxScrollWinEvent : public wxEvent
|
1999-05-12 09:31:02 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxScrollWinEvent(wxEventType commandType = wxEVT_NULL,
|
|
|
|
int pos = 0, int orient = 0);
|
2009-02-02 20:38:56 +00:00
|
|
|
wxScrollWinEvent(const wxScrollWinEvent& event) : wxEvent(event)
|
2003-01-12 22:30:51 +00:00
|
|
|
{ m_commandInt = event.m_commandInt;
|
|
|
|
m_extraLong = event.m_extraLong; }
|
1999-05-12 09:31:02 +00:00
|
|
|
|
2003-08-02 00:12:39 +00:00
|
|
|
int GetOrientation() const { return (int) m_extraLong; }
|
|
|
|
int GetPosition() const { return m_commandInt; }
|
1999-05-12 09:31:02 +00:00
|
|
|
void SetOrientation(int orient) { m_extraLong = (long) orient; }
|
|
|
|
void SetPosition(int pos) { m_commandInt = pos; }
|
|
|
|
|
2001-11-18 12:42:45 +00:00
|
|
|
virtual wxEvent *Clone() const { return new wxScrollWinEvent(*this); }
|
2001-06-26 20:59:19 +00:00
|
|
|
|
2005-01-18 15:12:53 +00:00
|
|
|
protected:
|
2001-11-18 12:42:45 +00:00
|
|
|
int m_commandInt;
|
1999-11-22 05:27:57 +00:00
|
|
|
long m_extraLong;
|
2001-06-26 20:59:19 +00:00
|
|
|
|
2001-11-18 12:42:45 +00:00
|
|
|
private:
|
2003-07-22 00:24:07 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxScrollWinEvent)
|
1999-05-12 09:31:02 +00:00
|
|
|
};
|
|
|
|
|
2009-02-04 17:42:28 +00:00
|
|
|
|
|
|
|
|
1998-05-20 14:01:55 +00:00
|
|
|
// Mouse event class
|
|
|
|
|
|
|
|
/*
|
|
|
|
wxEVT_LEFT_DOWN
|
|
|
|
wxEVT_LEFT_UP
|
|
|
|
wxEVT_MIDDLE_DOWN
|
|
|
|
wxEVT_MIDDLE_UP
|
|
|
|
wxEVT_RIGHT_DOWN
|
|
|
|
wxEVT_RIGHT_UP
|
|
|
|
wxEVT_MOTION
|
|
|
|
wxEVT_ENTER_WINDOW
|
|
|
|
wxEVT_LEAVE_WINDOW
|
|
|
|
wxEVT_LEFT_DCLICK
|
|
|
|
wxEVT_MIDDLE_DCLICK
|
|
|
|
wxEVT_RIGHT_DCLICK
|
|
|
|
wxEVT_NC_LEFT_DOWN
|
|
|
|
wxEVT_NC_LEFT_UP,
|
|
|
|
wxEVT_NC_MIDDLE_DOWN,
|
|
|
|
wxEVT_NC_MIDDLE_UP,
|
|
|
|
wxEVT_NC_RIGHT_DOWN,
|
|
|
|
wxEVT_NC_RIGHT_UP,
|
|
|
|
wxEVT_NC_MOTION,
|
|
|
|
wxEVT_NC_ENTER_WINDOW,
|
|
|
|
wxEVT_NC_LEAVE_WINDOW,
|
|
|
|
wxEVT_NC_LEFT_DCLICK,
|
|
|
|
wxEVT_NC_MIDDLE_DCLICK,
|
|
|
|
wxEVT_NC_RIGHT_DCLICK,
|
|
|
|
*/
|
|
|
|
|
2008-09-19 18:41:41 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxMouseEvent : public wxEvent,
|
|
|
|
public wxMouseState
|
1998-05-20 14:01:55 +00:00
|
|
|
{
|
1999-02-05 14:26:48 +00:00
|
|
|
public:
|
|
|
|
wxMouseEvent(wxEventType mouseType = wxEVT_NULL);
|
2008-09-19 18:41:41 +00:00
|
|
|
wxMouseEvent(const wxMouseEvent& event)
|
|
|
|
: wxEvent(event),
|
|
|
|
wxMouseState(event)
|
|
|
|
{
|
|
|
|
Assign(event);
|
|
|
|
}
|
1998-05-20 14:01:55 +00:00
|
|
|
|
1999-02-05 14:26:48 +00:00
|
|
|
// Was it a button event? (*doesn't* mean: is any button *down*?)
|
2002-07-03 16:25:22 +00:00
|
|
|
bool IsButton() const { return Button(wxMOUSE_BTN_ANY); }
|
1998-05-20 14:01:55 +00:00
|
|
|
|
2003-10-03 22:22:59 +00:00
|
|
|
// Was it a down event from this (or any) button?
|
2002-07-03 16:25:22 +00:00
|
|
|
bool ButtonDown(int but = wxMOUSE_BTN_ANY) const;
|
1998-05-20 14:01:55 +00:00
|
|
|
|
2003-10-03 22:22:59 +00:00
|
|
|
// Was it a dclick event from this (or any) button?
|
2002-07-03 16:25:22 +00:00
|
|
|
bool ButtonDClick(int but = wxMOUSE_BTN_ANY) const;
|
1998-05-20 14:01:55 +00:00
|
|
|
|
2003-10-03 22:22:59 +00:00
|
|
|
// Was it a up event from this (or any) button?
|
2002-07-03 16:25:22 +00:00
|
|
|
bool ButtonUp(int but = wxMOUSE_BTN_ANY) const;
|
1998-05-20 14:01:55 +00:00
|
|
|
|
2009-04-29 21:42:30 +00:00
|
|
|
// Was this event generated by the given button?
|
1999-02-05 14:26:48 +00:00
|
|
|
bool Button(int but) const;
|
1998-05-20 14:01:55 +00:00
|
|
|
|
2002-07-03 16:25:22 +00:00
|
|
|
// Get the button which is changing state (wxMOUSE_BTN_NONE if none)
|
2001-06-26 20:59:19 +00:00
|
|
|
int GetButton() const;
|
|
|
|
|
1999-02-05 14:26:48 +00:00
|
|
|
// Find which event was just generated
|
|
|
|
bool LeftDown() const { return (m_eventType == wxEVT_LEFT_DOWN); }
|
|
|
|
bool MiddleDown() const { return (m_eventType == wxEVT_MIDDLE_DOWN); }
|
|
|
|
bool RightDown() const { return (m_eventType == wxEVT_RIGHT_DOWN); }
|
2007-07-29 01:04:33 +00:00
|
|
|
bool Aux1Down() const { return (m_eventType == wxEVT_AUX1_DOWN); }
|
|
|
|
bool Aux2Down() const { return (m_eventType == wxEVT_AUX2_DOWN); }
|
1998-05-20 14:01:55 +00:00
|
|
|
|
1999-02-05 14:26:48 +00:00
|
|
|
bool LeftUp() const { return (m_eventType == wxEVT_LEFT_UP); }
|
|
|
|
bool MiddleUp() const { return (m_eventType == wxEVT_MIDDLE_UP); }
|
|
|
|
bool RightUp() const { return (m_eventType == wxEVT_RIGHT_UP); }
|
2007-07-29 01:04:33 +00:00
|
|
|
bool Aux1Up() const { return (m_eventType == wxEVT_AUX1_UP); }
|
|
|
|
bool Aux2Up() const { return (m_eventType == wxEVT_AUX2_UP); }
|
1998-05-20 14:01:55 +00:00
|
|
|
|
1999-02-05 14:26:48 +00:00
|
|
|
bool LeftDClick() const { return (m_eventType == wxEVT_LEFT_DCLICK); }
|
|
|
|
bool MiddleDClick() const { return (m_eventType == wxEVT_MIDDLE_DCLICK); }
|
|
|
|
bool RightDClick() const { return (m_eventType == wxEVT_RIGHT_DCLICK); }
|
2007-07-29 01:04:33 +00:00
|
|
|
bool Aux1DClick() const { return (m_eventType == wxEVT_AUX1_UP); }
|
|
|
|
bool Aux2DClick() const { return (m_eventType == wxEVT_AUX2_UP); }
|
1998-05-20 14:01:55 +00:00
|
|
|
|
1999-02-05 14:26:48 +00:00
|
|
|
// True if a button is down and the mouse is moving
|
|
|
|
bool Dragging() const
|
|
|
|
{
|
2003-10-16 15:05:32 +00:00
|
|
|
return (m_eventType == wxEVT_MOTION) && ButtonIsDown(wxMOUSE_BTN_ANY);
|
1999-02-05 14:26:48 +00:00
|
|
|
}
|
1998-05-20 14:01:55 +00:00
|
|
|
|
1999-02-05 14:26:48 +00:00
|
|
|
// True if the mouse is moving, and no button is down
|
2003-10-16 07:55:25 +00:00
|
|
|
bool Moving() const
|
|
|
|
{
|
2003-10-16 15:05:32 +00:00
|
|
|
return (m_eventType == wxEVT_MOTION) && !ButtonIsDown(wxMOUSE_BTN_ANY);
|
2003-10-16 07:55:25 +00:00
|
|
|
}
|
1998-05-20 14:01:55 +00:00
|
|
|
|
1999-02-05 14:26:48 +00:00
|
|
|
// True if the mouse is just entering the window
|
|
|
|
bool Entering() const { return (m_eventType == wxEVT_ENTER_WINDOW); }
|
1998-05-20 14:01:55 +00:00
|
|
|
|
1999-02-05 14:26:48 +00:00
|
|
|
// True if the mouse is just leaving the window
|
|
|
|
bool Leaving() const { return (m_eventType == wxEVT_LEAVE_WINDOW); }
|
1998-05-20 14:01:55 +00:00
|
|
|
|
2007-10-29 22:31:18 +00:00
|
|
|
// Returns the number of mouse clicks associated with this event.
|
|
|
|
int GetClickCount() const { return m_clickCount; }
|
|
|
|
|
1999-02-05 14:26:48 +00:00
|
|
|
// Find the logical position of the event given the DC
|
2003-08-02 00:12:39 +00:00
|
|
|
wxPoint GetLogicalPosition(const wxDC& dc) const;
|
1998-05-20 14:01:55 +00:00
|
|
|
|
2001-05-04 07:26:30 +00:00
|
|
|
// Get wheel rotation, positive or negative indicates direction of
|
|
|
|
// rotation. Current devices all send an event when rotation is equal to
|
|
|
|
// +/-WheelDelta, but this allows for finer resolution devices to be
|
|
|
|
// created in the future. Because of this you shouldn't assume that one
|
|
|
|
// event is equal to 1 line or whatever, but you should be able to either
|
|
|
|
// do partial line scrolling or wait until +/-WheelDelta rotation values
|
|
|
|
// have been accumulated before scrolling.
|
|
|
|
int GetWheelRotation() const { return m_wheelRotation; }
|
|
|
|
|
|
|
|
// Get wheel delta, normally 120. This is the threshold for action to be
|
|
|
|
// taken, and one such action (for example, scrolling one increment)
|
|
|
|
// should occur for each delta.
|
|
|
|
int GetWheelDelta() const { return m_wheelDelta; }
|
|
|
|
|
2007-02-04 06:24:28 +00:00
|
|
|
// Gets the axis the wheel operation concerns, 0 being the y axis as on
|
|
|
|
// most mouse wheels, 1 is the x axis for things like MightyMouse scrolls
|
|
|
|
// or horizontal trackpad scrolling
|
|
|
|
int GetWheelAxis() const { return m_wheelAxis; }
|
|
|
|
|
2001-05-04 07:26:30 +00:00
|
|
|
// Returns the configured number of lines (or whatever) to be scrolled per
|
|
|
|
// wheel action. Defaults to one.
|
|
|
|
int GetLinesPerAction() const { return m_linesPerAction; }
|
2007-08-01 15:34:48 +00:00
|
|
|
|
2002-07-19 21:11:31 +00:00
|
|
|
// Is the system set to do page scrolling?
|
2002-07-20 02:06:47 +00:00
|
|
|
bool IsPageScroll() const { return ((unsigned int)m_linesPerAction == UINT_MAX); }
|
2002-07-19 21:11:31 +00:00
|
|
|
|
2001-11-18 12:42:45 +00:00
|
|
|
virtual wxEvent *Clone() const { return new wxMouseEvent(*this); }
|
2009-02-04 17:42:28 +00:00
|
|
|
virtual wxEventCategory GetEventCategory() const { return wxEVT_CATEGORY_USER_INPUT; }
|
1999-05-07 18:34:32 +00:00
|
|
|
|
2008-09-19 18:41:41 +00:00
|
|
|
wxMouseEvent& operator=(const wxMouseEvent& event)
|
|
|
|
{
|
|
|
|
if (&event != this)
|
|
|
|
Assign(event);
|
|
|
|
return *this;
|
|
|
|
}
|
2002-07-21 17:34:06 +00:00
|
|
|
|
1998-05-20 14:01:55 +00:00
|
|
|
public:
|
2007-10-29 22:31:18 +00:00
|
|
|
int m_clickCount;
|
|
|
|
|
2007-02-04 06:24:28 +00:00
|
|
|
int m_wheelAxis;
|
2001-05-04 07:26:30 +00:00
|
|
|
int m_wheelRotation;
|
|
|
|
int m_wheelDelta;
|
|
|
|
int m_linesPerAction;
|
2001-06-26 20:59:19 +00:00
|
|
|
|
2002-05-23 21:25:06 +00:00
|
|
|
protected:
|
|
|
|
void Assign(const wxMouseEvent& evt);
|
|
|
|
|
2001-06-26 20:59:19 +00:00
|
|
|
private:
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxMouseEvent)
|
1998-05-20 14:01:55 +00:00
|
|
|
};
|
|
|
|
|
2000-03-14 00:45:54 +00:00
|
|
|
// Cursor set event
|
|
|
|
|
|
|
|
/*
|
|
|
|
wxEVT_SET_CURSOR
|
|
|
|
*/
|
|
|
|
|
2003-07-02 01:59:24 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxSetCursorEvent : public wxEvent
|
2000-03-14 00:45:54 +00:00
|
|
|
{
|
|
|
|
public:
|
2001-11-18 12:42:45 +00:00
|
|
|
wxSetCursorEvent(wxCoord x = 0, wxCoord y = 0)
|
2002-07-03 16:25:22 +00:00
|
|
|
: wxEvent(0, wxEVT_SET_CURSOR),
|
|
|
|
m_x(x), m_y(y), m_cursor()
|
2002-05-08 21:13:51 +00:00
|
|
|
{ }
|
2000-03-14 00:45:54 +00:00
|
|
|
|
2009-02-02 20:38:56 +00:00
|
|
|
wxSetCursorEvent(const wxSetCursorEvent& event)
|
2003-01-12 22:30:51 +00:00
|
|
|
: wxEvent(event),
|
|
|
|
m_x(event.m_x),
|
|
|
|
m_y(event.m_y),
|
|
|
|
m_cursor(event.m_cursor)
|
|
|
|
{ }
|
2002-07-19 19:43:55 +00:00
|
|
|
|
2000-03-14 00:45:54 +00:00
|
|
|
wxCoord GetX() const { return m_x; }
|
|
|
|
wxCoord GetY() const { return m_y; }
|
|
|
|
|
|
|
|
void SetCursor(const wxCursor& cursor) { m_cursor = cursor; }
|
|
|
|
const wxCursor& GetCursor() const { return m_cursor; }
|
|
|
|
bool HasCursor() const { return m_cursor.Ok(); }
|
|
|
|
|
2001-11-18 12:42:45 +00:00
|
|
|
virtual wxEvent *Clone() const { return new wxSetCursorEvent(*this); }
|
2001-11-18 23:08:00 +00:00
|
|
|
|
2000-03-14 00:45:54 +00:00
|
|
|
private:
|
|
|
|
wxCoord m_x, m_y;
|
|
|
|
wxCursor m_cursor;
|
2001-11-18 23:08:00 +00:00
|
|
|
|
2001-11-18 12:42:45 +00:00
|
|
|
private:
|
2003-07-22 00:24:07 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSetCursorEvent)
|
2000-03-14 00:45:54 +00:00
|
|
|
};
|
|
|
|
|
1998-05-20 14:01:55 +00:00
|
|
|
// Keyboard input event class
|
|
|
|
|
|
|
|
/*
|
|
|
|
wxEVT_CHAR
|
|
|
|
wxEVT_CHAR_HOOK
|
1999-01-14 11:23:37 +00:00
|
|
|
wxEVT_KEY_DOWN
|
1998-05-20 14:01:55 +00:00
|
|
|
wxEVT_KEY_UP
|
2003-07-10 09:16:00 +00:00
|
|
|
wxEVT_HOTKEY
|
1998-05-20 14:01:55 +00:00
|
|
|
*/
|
|
|
|
|
2009-08-23 00:32:17 +00:00
|
|
|
// key categories: the bit flags for IsKeyInCategory() function
|
|
|
|
//
|
|
|
|
// the enum values used may change in future version of wx
|
|
|
|
// use the named constants only, or bitwise combinations thereof
|
|
|
|
enum wxKeyCategoryFlags
|
|
|
|
{
|
|
|
|
// arrow keys, on and off numeric keypads
|
|
|
|
WXK_CATEGORY_ARROW = 1,
|
|
|
|
|
|
|
|
// page up and page down keys, on and off numeric keypads
|
|
|
|
WXK_CATEGORY_PAGING = 2,
|
|
|
|
|
|
|
|
// home and end keys, on and off numeric keypads
|
|
|
|
WXK_CATEGORY_JUMP = 4,
|
|
|
|
|
2009-08-23 21:39:32 +00:00
|
|
|
// tab key, on and off numeric keypads
|
2009-08-23 00:32:17 +00:00
|
|
|
WXK_CATEGORY_TAB = 8,
|
|
|
|
|
|
|
|
// backspace and delete keys, on and off numeric keypads
|
|
|
|
WXK_CATEGORY_CUT = 16,
|
|
|
|
|
|
|
|
// all keys usually used for navigation
|
|
|
|
WXK_CATEGORY_NAVIGATION = WXK_CATEGORY_ARROW |
|
|
|
|
WXK_CATEGORY_PAGING |
|
|
|
|
WXK_CATEGORY_JUMP
|
|
|
|
};
|
|
|
|
|
2008-09-19 18:41:41 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxKeyEvent : public wxEvent,
|
|
|
|
public wxKeyboardState
|
1998-05-20 14:01:55 +00:00
|
|
|
{
|
|
|
|
public:
|
1999-02-05 14:26:48 +00:00
|
|
|
wxKeyEvent(wxEventType keyType = wxEVT_NULL);
|
2003-01-12 22:30:51 +00:00
|
|
|
wxKeyEvent(const wxKeyEvent& evt);
|
1998-05-20 14:01:55 +00:00
|
|
|
|
2000-07-15 19:51:35 +00:00
|
|
|
// get the key code: an ASCII7 char or an element of wxKeyCode enum
|
|
|
|
int GetKeyCode() const { return (int)m_keyCode; }
|
1998-05-20 14:01:55 +00:00
|
|
|
|
2009-08-23 00:32:17 +00:00
|
|
|
// returns true iff this event's key code is of a certain type
|
|
|
|
bool IsKeyInCategory(int category) const;
|
|
|
|
|
2004-06-26 13:34:15 +00:00
|
|
|
#if wxUSE_UNICODE
|
|
|
|
// get the Unicode character corresponding to this key
|
|
|
|
wxChar GetUnicodeKey() const { return m_uniChar; }
|
|
|
|
#endif // wxUSE_UNICODE
|
|
|
|
|
2002-04-07 21:06:59 +00:00
|
|
|
// get the raw key code (platform-dependent)
|
|
|
|
wxUint32 GetRawKeyCode() const { return m_rawCode; }
|
|
|
|
|
|
|
|
// get the raw key flags (platform-dependent)
|
|
|
|
wxUint32 GetRawKeyFlags() const { return m_rawFlags; }
|
|
|
|
|
1999-02-05 14:26:48 +00:00
|
|
|
// Find the position of the event
|
1999-11-02 18:41:23 +00:00
|
|
|
void GetPosition(wxCoord *xpos, wxCoord *ypos) const
|
|
|
|
{
|
1999-11-22 05:27:57 +00:00
|
|
|
if (xpos) *xpos = m_x;
|
1999-11-02 18:41:23 +00:00
|
|
|
if (ypos) *ypos = m_y;
|
|
|
|
}
|
|
|
|
|
1999-11-02 18:46:33 +00:00
|
|
|
void GetPosition(long *xpos, long *ypos) const
|
1999-11-02 18:41:23 +00:00
|
|
|
{
|
1999-11-22 05:27:57 +00:00
|
|
|
if (xpos) *xpos = (long)m_x;
|
1999-11-02 18:46:33 +00:00
|
|
|
if (ypos) *ypos = (long)m_y;
|
1999-11-02 18:41:23 +00:00
|
|
|
}
|
1999-03-02 16:21:27 +00:00
|
|
|
|
|
|
|
wxPoint GetPosition() const
|
|
|
|
{ return wxPoint(m_x, m_y); }
|
1998-05-20 14:01:55 +00:00
|
|
|
|
1999-02-05 14:26:48 +00:00
|
|
|
// Get X position
|
1999-11-02 18:41:23 +00:00
|
|
|
wxCoord GetX() const { return m_x; }
|
1998-05-20 14:01:55 +00:00
|
|
|
|
1999-02-05 14:26:48 +00:00
|
|
|
// Get Y position
|
1999-11-02 18:41:23 +00:00
|
|
|
wxCoord GetY() const { return m_y; }
|
1998-05-20 14:01:55 +00:00
|
|
|
|
2001-11-18 12:42:45 +00:00
|
|
|
virtual wxEvent *Clone() const { return new wxKeyEvent(*this); }
|
2009-02-04 17:42:28 +00:00
|
|
|
virtual wxEventCategory GetEventCategory() const { return wxEVT_CATEGORY_USER_INPUT; }
|
2001-11-18 23:08:00 +00:00
|
|
|
|
|
|
|
// we do need to copy wxKeyEvent sometimes (in wxTreeCtrl code, for
|
|
|
|
// example)
|
|
|
|
wxKeyEvent& operator=(const wxKeyEvent& evt)
|
|
|
|
{
|
2008-10-20 09:00:19 +00:00
|
|
|
if ( &evt != this )
|
2008-01-09 04:08:33 +00:00
|
|
|
{
|
2008-09-19 18:41:41 +00:00
|
|
|
wxEvent::operator=(evt);
|
2008-10-20 09:00:19 +00:00
|
|
|
|
|
|
|
// Borland C++ 5.82 doesn't compile an explicit call to an
|
|
|
|
// implicitly defined operator=() so need to do it this way:
|
|
|
|
*static_cast<wxKeyboardState *>(this) = evt;
|
2008-09-19 18:41:41 +00:00
|
|
|
|
2008-01-09 04:08:33 +00:00
|
|
|
m_x = evt.m_x;
|
|
|
|
m_y = evt.m_y;
|
|
|
|
|
|
|
|
m_keyCode = evt.m_keyCode;
|
|
|
|
|
|
|
|
m_rawCode = evt.m_rawCode;
|
|
|
|
m_rawFlags = evt.m_rawFlags;
|
2004-10-28 08:18:52 +00:00
|
|
|
#if wxUSE_UNICODE
|
2008-01-09 04:08:33 +00:00
|
|
|
m_uniChar = evt.m_uniChar;
|
2004-10-28 08:18:52 +00:00
|
|
|
#endif
|
2008-01-09 04:08:33 +00:00
|
|
|
}
|
2001-11-18 23:08:00 +00:00
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
1999-02-05 14:26:48 +00:00
|
|
|
public:
|
1999-11-02 18:41:23 +00:00
|
|
|
wxCoord m_x, m_y;
|
|
|
|
|
1999-02-05 14:26:48 +00:00
|
|
|
long m_keyCode;
|
1999-11-02 18:41:23 +00:00
|
|
|
|
2002-12-04 14:11:26 +00:00
|
|
|
#if wxUSE_UNICODE
|
|
|
|
// This contains the full Unicode character
|
|
|
|
// in a character events in Unicode mode
|
|
|
|
wxChar m_uniChar;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// these fields contain the platform-specific information about
|
|
|
|
// key that was pressed
|
2002-04-07 21:06:59 +00:00
|
|
|
wxUint32 m_rawCode;
|
|
|
|
wxUint32 m_rawFlags;
|
|
|
|
|
2001-11-18 12:42:45 +00:00
|
|
|
private:
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxKeyEvent)
|
1998-05-20 14:01:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Size event class
|
|
|
|
/*
|
|
|
|
wxEVT_SIZE
|
|
|
|
*/
|
|
|
|
|
2003-07-02 01:59:24 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxSizeEvent : public wxEvent
|
1998-05-20 14:01:55 +00:00
|
|
|
{
|
1999-02-05 14:26:48 +00:00
|
|
|
public:
|
2002-07-03 16:25:22 +00:00
|
|
|
wxSizeEvent() : wxEvent(0, wxEVT_SIZE)
|
2002-05-08 21:13:51 +00:00
|
|
|
{ }
|
2003-03-21 02:58:55 +00:00
|
|
|
wxSizeEvent(const wxSize& sz, int winid = 0)
|
|
|
|
: wxEvent(winid, wxEVT_SIZE),
|
2002-07-03 16:25:22 +00:00
|
|
|
m_size(sz)
|
2002-05-08 21:13:51 +00:00
|
|
|
{ }
|
2009-02-02 20:38:56 +00:00
|
|
|
wxSizeEvent(const wxSizeEvent& event)
|
2003-01-12 22:30:51 +00:00
|
|
|
: wxEvent(event),
|
2003-06-01 14:37:28 +00:00
|
|
|
m_size(event.m_size), m_rect(event.m_rect)
|
2003-01-12 22:30:51 +00:00
|
|
|
{ }
|
2003-06-01 14:37:28 +00:00
|
|
|
wxSizeEvent(const wxRect& rect, int id = 0)
|
2003-06-01 20:47:50 +00:00
|
|
|
: m_size(rect.GetSize()), m_rect(rect)
|
2003-06-01 14:37:28 +00:00
|
|
|
{ m_eventType = wxEVT_SIZING; m_id = id; }
|
2002-07-20 02:06:47 +00:00
|
|
|
|
1999-02-05 14:26:48 +00:00
|
|
|
wxSize GetSize() const { return m_size; }
|
2010-11-19 07:51:15 +00:00
|
|
|
void SetSize(wxSize size) { m_size = size; }
|
2003-06-01 14:37:28 +00:00
|
|
|
wxRect GetRect() const { return m_rect; }
|
2005-09-24 21:43:15 +00:00
|
|
|
void SetRect(const wxRect& rect) { m_rect = rect; }
|
1999-05-07 18:34:32 +00:00
|
|
|
|
2001-11-18 12:42:45 +00:00
|
|
|
virtual wxEvent *Clone() const { return new wxSizeEvent(*this); }
|
|
|
|
|
|
|
|
public:
|
2005-01-18 15:12:53 +00:00
|
|
|
// For internal usage only. Will be converted to protected members.
|
2001-11-18 12:42:45 +00:00
|
|
|
wxSize m_size;
|
2003-06-01 14:37:28 +00:00
|
|
|
wxRect m_rect; // Used for wxEVT_SIZING
|
2001-11-18 12:42:45 +00:00
|
|
|
|
2001-11-18 23:08:00 +00:00
|
|
|
private:
|
2003-07-22 00:24:07 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSizeEvent)
|
1998-05-20 14:01:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Move event class
|
|
|
|
|
|
|
|
/*
|
|
|
|
wxEVT_MOVE
|
|
|
|
*/
|
|
|
|
|
2003-07-02 01:59:24 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxMoveEvent : public wxEvent
|
1998-05-20 14:01:55 +00:00
|
|
|
{
|
1999-02-05 14:26:48 +00:00
|
|
|
public:
|
2002-05-08 21:13:51 +00:00
|
|
|
wxMoveEvent()
|
|
|
|
: wxEvent(0, wxEVT_MOVE)
|
|
|
|
{ }
|
2003-03-21 02:58:55 +00:00
|
|
|
wxMoveEvent(const wxPoint& pos, int winid = 0)
|
|
|
|
: wxEvent(winid, wxEVT_MOVE),
|
2002-07-03 16:25:22 +00:00
|
|
|
m_pos(pos)
|
2002-05-08 21:13:51 +00:00
|
|
|
{ }
|
2002-07-19 19:43:55 +00:00
|
|
|
wxMoveEvent(const wxMoveEvent& event)
|
|
|
|
: wxEvent(event),
|
2003-01-12 22:30:51 +00:00
|
|
|
m_pos(event.m_pos)
|
|
|
|
{ }
|
2003-06-01 14:37:28 +00:00
|
|
|
wxMoveEvent(const wxRect& rect, int id = 0)
|
|
|
|
: m_pos(rect.GetPosition()), m_rect(rect)
|
|
|
|
{ m_eventType = wxEVT_MOVING; m_id = id; }
|
2002-07-20 02:06:47 +00:00
|
|
|
|
1999-02-05 14:26:48 +00:00
|
|
|
wxPoint GetPosition() const { return m_pos; }
|
2005-01-21 20:25:38 +00:00
|
|
|
void SetPosition(const wxPoint& pos) { m_pos = pos; }
|
2003-06-01 14:37:28 +00:00
|
|
|
wxRect GetRect() const { return m_rect; }
|
2005-09-24 21:43:15 +00:00
|
|
|
void SetRect(const wxRect& rect) { m_rect = rect; }
|
1999-05-07 18:34:32 +00:00
|
|
|
|
2001-11-18 12:42:45 +00:00
|
|
|
virtual wxEvent *Clone() const { return new wxMoveEvent(*this); }
|
2001-11-18 23:08:00 +00:00
|
|
|
|
2005-01-18 15:12:53 +00:00
|
|
|
protected:
|
2001-11-18 12:42:45 +00:00
|
|
|
wxPoint m_pos;
|
2003-06-01 14:37:28 +00:00
|
|
|
wxRect m_rect;
|
2001-11-18 23:08:00 +00:00
|
|
|
|
2001-11-18 12:42:45 +00:00
|
|
|
private:
|
2003-07-22 00:24:07 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMoveEvent)
|
1998-05-20 14:01:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Paint event class
|
|
|
|
/*
|
|
|
|
wxEVT_PAINT
|
|
|
|
wxEVT_NC_PAINT
|
|
|
|
wxEVT_PAINT_ICON
|
|
|
|
*/
|
|
|
|
|
2009-03-21 23:36:37 +00:00
|
|
|
#if wxDEBUG_LEVEL && (defined(__WXMSW__) || defined(__WXPM__))
|
|
|
|
#define wxHAS_PAINT_DEBUG
|
|
|
|
|
2000-10-23 06:26:19 +00:00
|
|
|
// see comments in src/msw|os2/dcclient.cpp where g_isPainting is defined
|
2003-07-02 01:59:24 +00:00
|
|
|
extern WXDLLIMPEXP_CORE int g_isPainting;
|
1999-06-17 21:21:52 +00:00
|
|
|
#endif // debug
|
|
|
|
|
2003-07-02 01:59:24 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxPaintEvent : public wxEvent
|
1998-05-20 14:01:55 +00:00
|
|
|
{
|
1999-02-05 14:26:48 +00:00
|
|
|
public:
|
1999-06-17 21:21:52 +00:00
|
|
|
wxPaintEvent(int Id = 0)
|
2002-05-08 21:13:51 +00:00
|
|
|
: wxEvent(Id, wxEVT_PAINT)
|
1999-06-17 21:21:52 +00:00
|
|
|
{
|
2009-03-21 23:36:37 +00:00
|
|
|
#ifdef wxHAS_PAINT_DEBUG
|
|
|
|
// set the internal flag for the duration of redrawing
|
1999-06-17 21:21:52 +00:00
|
|
|
g_isPainting++;
|
|
|
|
#endif // debug
|
|
|
|
}
|
|
|
|
|
2004-10-20 22:10:35 +00:00
|
|
|
// default copy ctor and dtor are normally fine, we only need them to keep
|
|
|
|
// g_isPainting updated in debug build
|
2009-03-21 23:36:37 +00:00
|
|
|
#ifdef wxHAS_PAINT_DEBUG
|
2004-10-20 22:10:35 +00:00
|
|
|
wxPaintEvent(const wxPaintEvent& event)
|
|
|
|
: wxEvent(event)
|
|
|
|
{
|
|
|
|
g_isPainting++;
|
|
|
|
}
|
|
|
|
|
2006-09-05 20:47:48 +00:00
|
|
|
virtual ~wxPaintEvent()
|
1999-06-17 21:21:52 +00:00
|
|
|
{
|
|
|
|
g_isPainting--;
|
|
|
|
}
|
|
|
|
#endif // debug
|
2001-11-18 12:42:45 +00:00
|
|
|
|
|
|
|
virtual wxEvent *Clone() const { return new wxPaintEvent(*this); }
|
2001-11-18 23:08:00 +00:00
|
|
|
|
2001-11-18 12:42:45 +00:00
|
|
|
private:
|
2003-07-22 00:24:07 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxPaintEvent)
|
1998-05-20 14:01:55 +00:00
|
|
|
};
|
|
|
|
|
2003-07-02 01:59:24 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxNcPaintEvent : public wxEvent
|
2001-06-26 20:59:19 +00:00
|
|
|
{
|
|
|
|
public:
|
2003-03-21 02:58:55 +00:00
|
|
|
wxNcPaintEvent(int winid = 0)
|
|
|
|
: wxEvent(winid, wxEVT_NC_PAINT)
|
2002-05-08 21:13:51 +00:00
|
|
|
{ }
|
2001-11-18 23:08:00 +00:00
|
|
|
|
2001-11-18 12:42:45 +00:00
|
|
|
virtual wxEvent *Clone() const { return new wxNcPaintEvent(*this); }
|
2001-06-26 20:59:19 +00:00
|
|
|
|
|
|
|
private:
|
2003-07-22 00:24:07 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxNcPaintEvent)
|
2001-06-26 20:59:19 +00:00
|
|
|
};
|
|
|
|
|
1998-05-20 14:01:55 +00:00
|
|
|
// Erase background event class
|
|
|
|
/*
|
|
|
|
wxEVT_ERASE_BACKGROUND
|
|
|
|
*/
|
|
|
|
|
2003-07-02 01:59:24 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxEraseEvent : public wxEvent
|
1998-05-20 14:01:55 +00:00
|
|
|
{
|
1999-02-05 14:26:48 +00:00
|
|
|
public:
|
2009-01-12 16:51:14 +00:00
|
|
|
wxEraseEvent(int Id = 0, wxDC *dc = NULL)
|
2002-07-03 16:25:22 +00:00
|
|
|
: wxEvent(Id, wxEVT_ERASE_BACKGROUND),
|
|
|
|
m_dc(dc)
|
2002-05-08 21:13:51 +00:00
|
|
|
{ }
|
|
|
|
|
|
|
|
wxEraseEvent(const wxEraseEvent& event)
|
2002-07-03 16:25:22 +00:00
|
|
|
: wxEvent(event),
|
|
|
|
m_dc(event.m_dc)
|
2002-05-08 21:13:51 +00:00
|
|
|
{ }
|
2001-11-18 23:08:00 +00:00
|
|
|
|
1999-02-05 14:26:48 +00:00
|
|
|
wxDC *GetDC() const { return m_dc; }
|
1999-05-07 18:34:32 +00:00
|
|
|
|
2001-11-18 12:42:45 +00:00
|
|
|
virtual wxEvent *Clone() const { return new wxEraseEvent(*this); }
|
2001-11-18 23:08:00 +00:00
|
|
|
|
2005-01-18 15:12:53 +00:00
|
|
|
protected:
|
2001-11-18 12:42:45 +00:00
|
|
|
wxDC *m_dc;
|
|
|
|
|
|
|
|
private:
|
2003-07-22 00:24:07 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxEraseEvent)
|
1998-05-20 14:01:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Focus event class
|
|
|
|
/*
|
|
|
|
wxEVT_SET_FOCUS
|
|
|
|
wxEVT_KILL_FOCUS
|
|
|
|
*/
|
|
|
|
|
2003-07-02 01:59:24 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxFocusEvent : public wxEvent
|
1998-05-20 14:01:55 +00:00
|
|
|
{
|
1999-02-05 14:26:48 +00:00
|
|
|
public:
|
2003-03-21 02:58:55 +00:00
|
|
|
wxFocusEvent(wxEventType type = wxEVT_NULL, int winid = 0)
|
|
|
|
: wxEvent(winid, type)
|
2002-07-03 16:25:22 +00:00
|
|
|
{ m_win = NULL; }
|
2002-05-08 21:13:51 +00:00
|
|
|
|
|
|
|
wxFocusEvent(const wxFocusEvent& event)
|
|
|
|
: wxEvent(event)
|
2002-07-03 16:25:22 +00:00
|
|
|
{ m_win = event.m_win; }
|
2001-06-26 20:59:19 +00:00
|
|
|
|
2001-11-18 12:42:45 +00:00
|
|
|
// The window associated with this event is the window which had focus
|
2001-06-26 20:59:19 +00:00
|
|
|
// before for SET event and the window which will have focus for the KILL
|
2001-11-18 12:42:45 +00:00
|
|
|
// one. NB: it may be NULL in both cases!
|
2001-06-26 20:59:19 +00:00
|
|
|
wxWindow *GetWindow() const { return m_win; }
|
|
|
|
void SetWindow(wxWindow *win) { m_win = win; }
|
|
|
|
|
2001-11-18 12:42:45 +00:00
|
|
|
virtual wxEvent *Clone() const { return new wxFocusEvent(*this); }
|
2001-11-18 23:08:00 +00:00
|
|
|
|
2001-06-26 20:59:19 +00:00
|
|
|
private:
|
|
|
|
wxWindow *m_win;
|
|
|
|
|
2001-11-18 12:42:45 +00:00
|
|
|
private:
|
2003-07-22 00:24:07 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxFocusEvent)
|
1998-05-20 14:01:55 +00:00
|
|
|
};
|
|
|
|
|
2001-08-06 00:49:59 +00:00
|
|
|
// wxChildFocusEvent notifies the parent that a child has got the focus: unlike
|
2003-07-18 00:39:05 +00:00
|
|
|
// wxFocusEvent it is propagated upwards the window chain
|
2003-07-02 01:59:24 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxChildFocusEvent : public wxCommandEvent
|
2001-08-06 00:49:59 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxChildFocusEvent(wxWindow *win = NULL);
|
|
|
|
|
|
|
|
wxWindow *GetWindow() const { return (wxWindow *)GetEventObject(); }
|
|
|
|
|
2001-11-18 12:42:45 +00:00
|
|
|
virtual wxEvent *Clone() const { return new wxChildFocusEvent(*this); }
|
2001-11-18 23:08:00 +00:00
|
|
|
|
2001-11-18 12:42:45 +00:00
|
|
|
private:
|
2003-07-22 00:24:07 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxChildFocusEvent)
|
2001-08-06 00:49:59 +00:00
|
|
|
};
|
|
|
|
|
1998-05-20 14:01:55 +00:00
|
|
|
// Activate event class
|
|
|
|
/*
|
|
|
|
wxEVT_ACTIVATE
|
|
|
|
wxEVT_ACTIVATE_APP
|
2005-03-18 14:26:57 +00:00
|
|
|
wxEVT_HIBERNATE
|
1998-05-20 14:01:55 +00:00
|
|
|
*/
|
|
|
|
|
2003-07-02 01:59:24 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxActivateEvent : public wxEvent
|
1998-05-20 14:01:55 +00:00
|
|
|
{
|
1999-02-05 14:26:48 +00:00
|
|
|
public:
|
2004-09-04 01:26:40 +00:00
|
|
|
wxActivateEvent(wxEventType type = wxEVT_NULL, bool active = true, int Id = 0)
|
2002-05-08 21:13:51 +00:00
|
|
|
: wxEvent(Id, type)
|
2002-07-03 16:25:22 +00:00
|
|
|
{ m_active = active; }
|
2002-07-19 19:43:55 +00:00
|
|
|
wxActivateEvent(const wxActivateEvent& event)
|
|
|
|
: wxEvent(event)
|
2003-01-12 22:30:51 +00:00
|
|
|
{ m_active = event.m_active; }
|
2002-07-20 02:06:47 +00:00
|
|
|
|
1999-02-05 14:26:48 +00:00
|
|
|
bool GetActive() const { return m_active; }
|
1998-05-20 14:01:55 +00:00
|
|
|
|
2001-11-18 12:42:45 +00:00
|
|
|
virtual wxEvent *Clone() const { return new wxActivateEvent(*this); }
|
1999-05-07 18:34:32 +00:00
|
|
|
|
1999-02-05 14:26:48 +00:00
|
|
|
private:
|
|
|
|
bool m_active;
|
2001-11-18 12:42:45 +00:00
|
|
|
|
|
|
|
private:
|
2003-07-22 00:24:07 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxActivateEvent)
|
1998-05-20 14:01:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// InitDialog event class
|
|
|
|
/*
|
|
|
|
wxEVT_INIT_DIALOG
|
|
|
|
*/
|
|
|
|
|
2003-07-02 01:59:24 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxInitDialogEvent : public wxEvent
|
1998-05-20 14:01:55 +00:00
|
|
|
{
|
1999-02-05 14:26:48 +00:00
|
|
|
public:
|
|
|
|
wxInitDialogEvent(int Id = 0)
|
2002-05-08 21:13:51 +00:00
|
|
|
: wxEvent(Id, wxEVT_INIT_DIALOG)
|
|
|
|
{ }
|
2001-11-18 12:42:45 +00:00
|
|
|
|
|
|
|
virtual wxEvent *Clone() const { return new wxInitDialogEvent(*this); }
|
2001-11-18 23:08:00 +00:00
|
|
|
|
|
|
|
private:
|
2003-07-22 00:24:07 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxInitDialogEvent)
|
1998-05-20 14:01:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Miscellaneous menu event class
|
|
|
|
/*
|
2002-02-23 23:16:32 +00:00
|
|
|
wxEVT_MENU_OPEN,
|
|
|
|
wxEVT_MENU_CLOSE,
|
1998-05-20 14:01:55 +00:00
|
|
|
wxEVT_MENU_HIGHLIGHT,
|
|
|
|
*/
|
|
|
|
|
2003-07-02 01:59:24 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxMenuEvent : public wxEvent
|
1998-05-20 14:01:55 +00:00
|
|
|
{
|
|
|
|
public:
|
2003-07-12 23:09:04 +00:00
|
|
|
wxMenuEvent(wxEventType type = wxEVT_NULL, int winid = 0, wxMenu* menu = NULL)
|
2003-03-21 02:58:55 +00:00
|
|
|
: wxEvent(winid, type)
|
2003-07-22 00:24:07 +00:00
|
|
|
{ m_menuId = winid; m_menu = menu; }
|
2009-02-02 20:38:56 +00:00
|
|
|
wxMenuEvent(const wxMenuEvent& event)
|
2002-07-19 19:43:55 +00:00
|
|
|
: wxEvent(event)
|
2003-07-12 23:09:04 +00:00
|
|
|
{ m_menuId = event.m_menuId; m_menu = event.m_menu; }
|
2002-07-20 02:06:47 +00:00
|
|
|
|
2002-02-23 23:16:32 +00:00
|
|
|
// only for wxEVT_MENU_HIGHLIGHT
|
1999-05-07 18:34:32 +00:00
|
|
|
int GetMenuId() const { return m_menuId; }
|
1998-05-20 14:01:55 +00:00
|
|
|
|
2002-02-23 23:16:32 +00:00
|
|
|
// only for wxEVT_MENU_OPEN/CLOSE
|
2004-09-13 18:03:44 +00:00
|
|
|
bool IsPopup() const { return m_menuId == wxID_ANY; }
|
2002-02-23 23:16:32 +00:00
|
|
|
|
2003-07-12 23:09:04 +00:00
|
|
|
// only for wxEVT_MENU_OPEN/CLOSE
|
|
|
|
wxMenu* GetMenu() const { return m_menu; }
|
|
|
|
|
2001-11-18 12:42:45 +00:00
|
|
|
virtual wxEvent *Clone() const { return new wxMenuEvent(*this); }
|
2001-11-18 23:08:00 +00:00
|
|
|
|
1999-02-05 14:26:48 +00:00
|
|
|
private:
|
2003-07-12 23:09:04 +00:00
|
|
|
int m_menuId;
|
|
|
|
wxMenu* m_menu;
|
2001-11-18 23:08:00 +00:00
|
|
|
|
2003-07-22 00:24:07 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMenuEvent)
|
1998-05-20 14:01:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Window close or session close event class
|
|
|
|
/*
|
|
|
|
wxEVT_CLOSE_WINDOW,
|
|
|
|
wxEVT_END_SESSION,
|
|
|
|
wxEVT_QUERY_END_SESSION
|
|
|
|
*/
|
|
|
|
|
2003-07-02 01:59:24 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxCloseEvent : public wxEvent
|
1998-05-20 14:01:55 +00:00
|
|
|
{
|
|
|
|
public:
|
2003-03-21 02:58:55 +00:00
|
|
|
wxCloseEvent(wxEventType type = wxEVT_NULL, int winid = 0)
|
|
|
|
: wxEvent(winid, type),
|
2004-09-04 01:26:40 +00:00
|
|
|
m_loggingOff(true),
|
|
|
|
m_veto(false), // should be false by default
|
|
|
|
m_canVeto(true) {}
|
2003-08-17 12:50:53 +00:00
|
|
|
|
2009-02-02 20:38:56 +00:00
|
|
|
wxCloseEvent(const wxCloseEvent& event)
|
2002-07-19 19:43:55 +00:00
|
|
|
: wxEvent(event),
|
2003-01-12 22:30:51 +00:00
|
|
|
m_loggingOff(event.m_loggingOff),
|
|
|
|
m_veto(event.m_veto),
|
2003-08-17 12:50:53 +00:00
|
|
|
m_canVeto(event.m_canVeto) {}
|
2002-07-20 02:06:47 +00:00
|
|
|
|
1999-02-05 14:26:48 +00:00
|
|
|
void SetLoggingOff(bool logOff) { m_loggingOff = logOff; }
|
2005-05-22 11:21:21 +00:00
|
|
|
bool GetLoggingOff() const
|
|
|
|
{
|
|
|
|
// m_loggingOff flag is only used by wxEVT_[QUERY_]END_SESSION, it
|
|
|
|
// doesn't make sense for wxEVT_CLOSE_WINDOW
|
|
|
|
wxASSERT_MSG( m_eventType != wxEVT_CLOSE_WINDOW,
|
2009-07-23 20:30:22 +00:00
|
|
|
wxT("this flag is for end session events only") );
|
2005-05-22 11:21:21 +00:00
|
|
|
|
|
|
|
return m_loggingOff;
|
|
|
|
}
|
1999-02-05 14:26:48 +00:00
|
|
|
|
2004-09-04 01:26:40 +00:00
|
|
|
void Veto(bool veto = true)
|
1999-02-05 16:12:43 +00:00
|
|
|
{
|
2004-09-04 01:26:40 +00:00
|
|
|
// GetVeto() will return false anyhow...
|
1999-02-05 16:12:43 +00:00
|
|
|
wxCHECK_RET( m_canVeto,
|
1999-10-08 14:35:56 +00:00
|
|
|
wxT("call to Veto() ignored (can't veto this event)") );
|
1999-02-05 16:12:43 +00:00
|
|
|
|
|
|
|
m_veto = veto;
|
|
|
|
}
|
1999-02-05 14:26:48 +00:00
|
|
|
void SetCanVeto(bool canVeto) { m_canVeto = canVeto; }
|
|
|
|
bool CanVeto() const { return m_canVeto; }
|
1999-02-05 16:12:43 +00:00
|
|
|
bool GetVeto() const { return m_canVeto && m_veto; }
|
1998-05-20 14:01:55 +00:00
|
|
|
|
2001-11-18 12:42:45 +00:00
|
|
|
virtual wxEvent *Clone() const { return new wxCloseEvent(*this); }
|
1999-05-07 18:34:32 +00:00
|
|
|
|
1999-02-05 14:26:48 +00:00
|
|
|
protected:
|
2005-05-22 11:21:21 +00:00
|
|
|
bool m_loggingOff,
|
|
|
|
m_veto,
|
|
|
|
m_canVeto;
|
1999-02-05 14:26:48 +00:00
|
|
|
|
2001-11-18 12:42:45 +00:00
|
|
|
private:
|
2003-07-22 00:24:07 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCloseEvent)
|
1998-05-20 14:01:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
wxEVT_SHOW
|
|
|
|
*/
|
|
|
|
|
2003-07-02 01:59:24 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxShowEvent : public wxEvent
|
1998-05-20 14:01:55 +00:00
|
|
|
{
|
|
|
|
public:
|
2004-09-04 01:26:40 +00:00
|
|
|
wxShowEvent(int winid = 0, bool show = false)
|
2003-03-21 02:58:55 +00:00
|
|
|
: wxEvent(winid, wxEVT_SHOW)
|
2002-07-03 16:25:22 +00:00
|
|
|
{ m_show = show; }
|
2009-02-02 20:38:56 +00:00
|
|
|
wxShowEvent(const wxShowEvent& event)
|
2002-07-19 19:43:55 +00:00
|
|
|
: wxEvent(event)
|
2003-01-12 22:30:51 +00:00
|
|
|
{ m_show = event.m_show; }
|
2002-07-20 02:06:47 +00:00
|
|
|
|
1999-02-05 14:26:48 +00:00
|
|
|
void SetShow(bool show) { m_show = show; }
|
2008-06-21 16:17:13 +00:00
|
|
|
|
|
|
|
// return true if the window was shown, false if hidden
|
|
|
|
bool IsShown() const { return m_show; }
|
|
|
|
|
2008-06-26 11:16:40 +00:00
|
|
|
#if WXWIN_COMPATIBILITY_2_8
|
2008-06-21 16:17:13 +00:00
|
|
|
wxDEPRECATED( bool GetShow() const { return IsShown(); } )
|
|
|
|
#endif
|
1998-05-20 14:01:55 +00:00
|
|
|
|
2001-11-18 12:42:45 +00:00
|
|
|
virtual wxEvent *Clone() const { return new wxShowEvent(*this); }
|
1999-05-07 18:34:32 +00:00
|
|
|
|
1998-05-20 14:01:55 +00:00
|
|
|
protected:
|
1999-02-05 14:26:48 +00:00
|
|
|
bool m_show;
|
2001-05-31 14:32:06 +00:00
|
|
|
|
2001-11-18 12:42:45 +00:00
|
|
|
private:
|
2003-07-22 00:24:07 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxShowEvent)
|
1998-05-20 14:01:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
wxEVT_ICONIZE
|
|
|
|
*/
|
|
|
|
|
2003-07-02 01:59:24 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxIconizeEvent : public wxEvent
|
1998-05-20 14:01:55 +00:00
|
|
|
{
|
1999-02-05 14:26:48 +00:00
|
|
|
public:
|
2004-09-04 01:26:40 +00:00
|
|
|
wxIconizeEvent(int winid = 0, bool iconized = true)
|
2003-03-21 02:58:55 +00:00
|
|
|
: wxEvent(winid, wxEVT_ICONIZE)
|
2002-07-03 16:25:22 +00:00
|
|
|
{ m_iconized = iconized; }
|
2009-02-02 20:38:56 +00:00
|
|
|
wxIconizeEvent(const wxIconizeEvent& event)
|
2002-07-19 19:43:55 +00:00
|
|
|
: wxEvent(event)
|
2003-01-12 22:30:51 +00:00
|
|
|
{ m_iconized = event.m_iconized; }
|
2002-07-20 02:06:47 +00:00
|
|
|
|
2008-06-26 11:16:40 +00:00
|
|
|
#if WXWIN_COMPATIBILITY_2_8
|
2008-06-21 16:17:13 +00:00
|
|
|
wxDEPRECATED( bool Iconized() const { return IsIconized(); } )
|
|
|
|
#endif
|
2001-05-31 14:32:06 +00:00
|
|
|
// return true if the frame was iconized, false if restored
|
2008-06-21 16:17:13 +00:00
|
|
|
bool IsIconized() const { return m_iconized; }
|
2001-05-31 14:32:06 +00:00
|
|
|
|
2001-11-18 12:42:45 +00:00
|
|
|
virtual wxEvent *Clone() const { return new wxIconizeEvent(*this); }
|
2001-11-18 23:08:00 +00:00
|
|
|
|
2001-05-31 14:32:06 +00:00
|
|
|
protected:
|
|
|
|
bool m_iconized;
|
|
|
|
|
2001-11-18 12:42:45 +00:00
|
|
|
private:
|
2003-07-22 00:24:07 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxIconizeEvent)
|
1998-05-20 14:01:55 +00:00
|
|
|
};
|
|
|
|
/*
|
|
|
|
wxEVT_MAXIMIZE
|
|
|
|
*/
|
|
|
|
|
2003-07-02 01:59:24 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxMaximizeEvent : public wxEvent
|
1998-05-20 14:01:55 +00:00
|
|
|
{
|
1999-02-05 14:26:48 +00:00
|
|
|
public:
|
2003-03-21 02:58:55 +00:00
|
|
|
wxMaximizeEvent(int winid = 0)
|
|
|
|
: wxEvent(winid, wxEVT_MAXIMIZE)
|
2002-05-08 21:13:51 +00:00
|
|
|
{ }
|
2001-05-31 14:32:06 +00:00
|
|
|
|
2001-11-18 12:42:45 +00:00
|
|
|
virtual wxEvent *Clone() const { return new wxMaximizeEvent(*this); }
|
2001-11-18 23:08:00 +00:00
|
|
|
|
2001-11-18 12:42:45 +00:00
|
|
|
private:
|
2003-07-22 00:24:07 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMaximizeEvent)
|
1998-05-20 14:01:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Joystick event class
|
|
|
|
/*
|
|
|
|
wxEVT_JOY_BUTTON_DOWN,
|
|
|
|
wxEVT_JOY_BUTTON_UP,
|
|
|
|
wxEVT_JOY_MOVE,
|
|
|
|
wxEVT_JOY_ZMOVE
|
|
|
|
*/
|
|
|
|
|
|
|
|
// Which joystick? Same as Windows ids so no conversion necessary.
|
2002-07-03 16:25:22 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
wxJOYSTICK1,
|
|
|
|
wxJOYSTICK2
|
|
|
|
};
|
1998-05-20 14:01:55 +00:00
|
|
|
|
|
|
|
// Which button is down?
|
2002-07-03 16:25:22 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
wxJOY_BUTTON_ANY = -1,
|
|
|
|
wxJOY_BUTTON1 = 1,
|
|
|
|
wxJOY_BUTTON2 = 2,
|
|
|
|
wxJOY_BUTTON3 = 4,
|
|
|
|
wxJOY_BUTTON4 = 8
|
|
|
|
};
|
1998-05-20 14:01:55 +00:00
|
|
|
|
2003-07-02 01:59:24 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxJoystickEvent : public wxEvent
|
1998-05-20 14:01:55 +00:00
|
|
|
{
|
2005-01-18 15:12:53 +00:00
|
|
|
protected:
|
1999-02-05 14:26:48 +00:00
|
|
|
wxPoint m_pos;
|
|
|
|
int m_zPosition;
|
2002-07-03 16:25:22 +00:00
|
|
|
int m_buttonChange; // Which button changed?
|
|
|
|
int m_buttonState; // Which buttons are down?
|
|
|
|
int m_joyStick; // Which joystick?
|
1999-02-05 14:26:48 +00:00
|
|
|
|
2005-01-18 15:12:53 +00:00
|
|
|
public:
|
1999-02-05 14:26:48 +00:00
|
|
|
wxJoystickEvent(wxEventType type = wxEVT_NULL,
|
|
|
|
int state = 0,
|
|
|
|
int joystick = wxJOYSTICK1,
|
|
|
|
int change = 0)
|
2002-07-03 16:25:22 +00:00
|
|
|
: wxEvent(0, type),
|
2005-02-11 10:42:05 +00:00
|
|
|
m_pos(),
|
2002-07-03 16:25:22 +00:00
|
|
|
m_zPosition(0),
|
|
|
|
m_buttonChange(change),
|
|
|
|
m_buttonState(state),
|
|
|
|
m_joyStick(joystick)
|
1999-02-05 14:26:48 +00:00
|
|
|
{
|
|
|
|
}
|
2009-02-02 20:38:56 +00:00
|
|
|
wxJoystickEvent(const wxJoystickEvent& event)
|
2003-01-12 22:30:51 +00:00
|
|
|
: wxEvent(event),
|
|
|
|
m_pos(event.m_pos),
|
|
|
|
m_zPosition(event.m_zPosition),
|
|
|
|
m_buttonChange(event.m_buttonChange),
|
|
|
|
m_buttonState(event.m_buttonState),
|
|
|
|
m_joyStick(event.m_joyStick)
|
2002-07-19 19:43:55 +00:00
|
|
|
{ }
|
2002-07-20 02:06:47 +00:00
|
|
|
|
1999-02-05 14:26:48 +00:00
|
|
|
wxPoint GetPosition() const { return m_pos; }
|
|
|
|
int GetZPosition() const { return m_zPosition; }
|
|
|
|
int GetButtonState() const { return m_buttonState; }
|
|
|
|
int GetButtonChange() const { return m_buttonChange; }
|
|
|
|
int GetJoystick() const { return m_joyStick; }
|
|
|
|
|
|
|
|
void SetJoystick(int stick) { m_joyStick = stick; }
|
|
|
|
void SetButtonState(int state) { m_buttonState = state; }
|
|
|
|
void SetButtonChange(int change) { m_buttonChange = change; }
|
|
|
|
void SetPosition(const wxPoint& pos) { m_pos = pos; }
|
|
|
|
void SetZPosition(int zPos) { m_zPosition = zPos; }
|
|
|
|
|
|
|
|
// Was it a button event? (*doesn't* mean: is any button *down*?)
|
|
|
|
bool IsButton() const { return ((GetEventType() == wxEVT_JOY_BUTTON_DOWN) ||
|
1999-09-08 08:29:49 +00:00
|
|
|
(GetEventType() == wxEVT_JOY_BUTTON_UP)); }
|
1999-02-05 14:26:48 +00:00
|
|
|
|
|
|
|
// Was it a move event?
|
2003-08-02 00:12:39 +00:00
|
|
|
bool IsMove() const { return (GetEventType() == wxEVT_JOY_MOVE); }
|
1999-02-05 14:26:48 +00:00
|
|
|
|
|
|
|
// Was it a zmove event?
|
2003-08-02 00:12:39 +00:00
|
|
|
bool IsZMove() const { return (GetEventType() == wxEVT_JOY_ZMOVE); }
|
1999-02-05 14:26:48 +00:00
|
|
|
|
|
|
|
// Was it a down event from button 1, 2, 3, 4 or any?
|
|
|
|
bool ButtonDown(int but = wxJOY_BUTTON_ANY) const
|
1998-05-20 14:01:55 +00:00
|
|
|
{ return ((GetEventType() == wxEVT_JOY_BUTTON_DOWN) &&
|
1999-02-05 14:26:48 +00:00
|
|
|
((but == wxJOY_BUTTON_ANY) || (but == m_buttonChange))); }
|
1998-05-20 14:01:55 +00:00
|
|
|
|
1999-02-05 14:26:48 +00:00
|
|
|
// Was it a up event from button 1, 2, 3 or any?
|
|
|
|
bool ButtonUp(int but = wxJOY_BUTTON_ANY) const
|
1998-05-20 14:01:55 +00:00
|
|
|
{ return ((GetEventType() == wxEVT_JOY_BUTTON_UP) &&
|
1999-02-05 14:26:48 +00:00
|
|
|
((but == wxJOY_BUTTON_ANY) || (but == m_buttonChange))); }
|
1998-05-20 14:01:55 +00:00
|
|
|
|
1999-02-05 14:26:48 +00:00
|
|
|
// Was the given button 1,2,3,4 or any in Down state?
|
|
|
|
bool ButtonIsDown(int but = wxJOY_BUTTON_ANY) const
|
1998-05-20 14:01:55 +00:00
|
|
|
{ return (((but == wxJOY_BUTTON_ANY) && (m_buttonState != 0)) ||
|
1999-02-05 14:26:48 +00:00
|
|
|
((m_buttonState & but) == but)); }
|
1999-05-13 15:24:59 +00:00
|
|
|
|
2001-11-18 12:42:45 +00:00
|
|
|
virtual wxEvent *Clone() const { return new wxJoystickEvent(*this); }
|
2001-11-18 23:08:00 +00:00
|
|
|
|
2001-11-18 12:42:45 +00:00
|
|
|
private:
|
2003-07-22 00:24:07 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxJoystickEvent)
|
1998-05-20 14:01:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Drop files event class
|
|
|
|
/*
|
|
|
|
wxEVT_DROP_FILES
|
|
|
|
*/
|
|
|
|
|
2003-07-02 01:59:24 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxDropFilesEvent : public wxEvent
|
1998-05-20 14:01:55 +00:00
|
|
|
{
|
1999-02-05 14:26:48 +00:00
|
|
|
public:
|
|
|
|
int m_noFiles;
|
|
|
|
wxPoint m_pos;
|
2001-11-21 23:48:49 +00:00
|
|
|
wxString* m_files;
|
1999-02-05 14:26:48 +00:00
|
|
|
|
|
|
|
wxDropFilesEvent(wxEventType type = wxEVT_NULL,
|
|
|
|
int noFiles = 0,
|
2009-01-12 16:51:14 +00:00
|
|
|
wxString *files = NULL)
|
2002-07-03 16:25:22 +00:00
|
|
|
: wxEvent(0, type),
|
|
|
|
m_noFiles(noFiles),
|
|
|
|
m_pos(),
|
|
|
|
m_files(files)
|
2002-05-08 21:13:51 +00:00
|
|
|
{ }
|
1999-02-05 14:26:48 +00:00
|
|
|
|
2001-11-21 23:48:49 +00:00
|
|
|
// we need a copy ctor to avoid deleting m_files pointer twice
|
|
|
|
wxDropFilesEvent(const wxDropFilesEvent& other)
|
2002-07-03 16:25:22 +00:00
|
|
|
: wxEvent(other),
|
|
|
|
m_noFiles(other.m_noFiles),
|
|
|
|
m_pos(other.m_pos),
|
|
|
|
m_files(NULL)
|
2001-11-21 23:48:49 +00:00
|
|
|
{
|
|
|
|
m_files = new wxString[m_noFiles];
|
|
|
|
for ( int n = 0; n < m_noFiles; n++ )
|
|
|
|
{
|
|
|
|
m_files[n] = other.m_files[n];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual ~wxDropFilesEvent()
|
|
|
|
{
|
|
|
|
delete [] m_files;
|
|
|
|
}
|
|
|
|
|
1999-02-05 14:26:48 +00:00
|
|
|
wxPoint GetPosition() const { return m_pos; }
|
|
|
|
int GetNumberOfFiles() const { return m_noFiles; }
|
|
|
|
wxString *GetFiles() const { return m_files; }
|
1999-05-13 15:24:59 +00:00
|
|
|
|
2001-11-21 23:48:49 +00:00
|
|
|
virtual wxEvent *Clone() const { return new wxDropFilesEvent(*this); }
|
2001-11-18 23:08:00 +00:00
|
|
|
|
2001-11-18 12:42:45 +00:00
|
|
|
private:
|
2003-07-22 00:24:07 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDropFilesEvent)
|
1998-05-20 14:01:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Update UI event
|
|
|
|
/*
|
|
|
|
wxEVT_UPDATE_UI
|
|
|
|
*/
|
|
|
|
|
2003-07-09 10:15:21 +00:00
|
|
|
// Whether to always send update events to windows, or
|
|
|
|
// to only send update events to those with the
|
|
|
|
// wxWS_EX_PROCESS_UI_UPDATES style.
|
|
|
|
|
|
|
|
enum wxUpdateUIMode
|
|
|
|
{
|
|
|
|
// Send UI update events to all windows
|
|
|
|
wxUPDATE_UI_PROCESS_ALL,
|
|
|
|
|
|
|
|
// Send UI update events to windows that have
|
|
|
|
// the wxWS_EX_PROCESS_UI_UPDATES flag specified
|
|
|
|
wxUPDATE_UI_PROCESS_SPECIFIED
|
|
|
|
};
|
|
|
|
|
2003-07-02 01:59:24 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxUpdateUIEvent : public wxCommandEvent
|
1998-05-20 14:01:55 +00:00
|
|
|
{
|
1999-02-05 14:26:48 +00:00
|
|
|
public:
|
|
|
|
wxUpdateUIEvent(wxWindowID commandId = 0)
|
2002-05-08 21:13:51 +00:00
|
|
|
: wxCommandEvent(wxEVT_UPDATE_UI, commandId)
|
2002-07-03 16:25:22 +00:00
|
|
|
{
|
|
|
|
m_checked =
|
|
|
|
m_enabled =
|
2006-02-12 16:32:50 +00:00
|
|
|
m_shown =
|
2002-07-03 16:25:22 +00:00
|
|
|
m_setEnabled =
|
2006-02-12 16:32:50 +00:00
|
|
|
m_setShown =
|
2002-07-19 21:11:31 +00:00
|
|
|
m_setText =
|
2004-09-04 01:26:40 +00:00
|
|
|
m_setChecked = false;
|
2002-07-03 16:25:22 +00:00
|
|
|
}
|
2009-02-02 20:38:56 +00:00
|
|
|
wxUpdateUIEvent(const wxUpdateUIEvent& event)
|
2002-07-19 19:43:55 +00:00
|
|
|
: wxCommandEvent(event),
|
2003-01-12 22:30:51 +00:00
|
|
|
m_checked(event.m_checked),
|
|
|
|
m_enabled(event.m_enabled),
|
2006-02-12 16:32:50 +00:00
|
|
|
m_shown(event.m_shown),
|
2003-01-12 22:30:51 +00:00
|
|
|
m_setEnabled(event.m_setEnabled),
|
2006-02-12 16:32:50 +00:00
|
|
|
m_setShown(event.m_setShown),
|
2003-01-12 22:30:51 +00:00
|
|
|
m_setText(event.m_setText),
|
|
|
|
m_setChecked(event.m_setChecked),
|
|
|
|
m_text(event.m_text)
|
|
|
|
{ }
|
2002-07-20 02:06:47 +00:00
|
|
|
|
1999-02-05 14:26:48 +00:00
|
|
|
bool GetChecked() const { return m_checked; }
|
|
|
|
bool GetEnabled() const { return m_enabled; }
|
2006-02-12 16:32:50 +00:00
|
|
|
bool GetShown() const { return m_shown; }
|
1999-02-05 14:26:48 +00:00
|
|
|
wxString GetText() const { return m_text; }
|
|
|
|
bool GetSetText() const { return m_setText; }
|
|
|
|
bool GetSetChecked() const { return m_setChecked; }
|
|
|
|
bool GetSetEnabled() const { return m_setEnabled; }
|
2006-02-12 16:32:50 +00:00
|
|
|
bool GetSetShown() const { return m_setShown; }
|
1999-02-05 14:26:48 +00:00
|
|
|
|
2004-09-04 01:26:40 +00:00
|
|
|
void Check(bool check) { m_checked = check; m_setChecked = true; }
|
|
|
|
void Enable(bool enable) { m_enabled = enable; m_setEnabled = true; }
|
2006-02-12 16:32:50 +00:00
|
|
|
void Show(bool show) { m_shown = show; m_setShown = true; }
|
2004-09-04 01:26:40 +00:00
|
|
|
void SetText(const wxString& text) { m_text = text; m_setText = true; }
|
1998-05-20 14:01:55 +00:00
|
|
|
|
2003-07-07 16:21:44 +00:00
|
|
|
// Sets the interval between updates in milliseconds.
|
|
|
|
// Set to -1 to disable updates, or to 0 to update as frequently as possible.
|
2003-07-09 10:15:21 +00:00
|
|
|
static void SetUpdateInterval(long updateInterval) { sm_updateInterval = updateInterval; }
|
2003-07-07 16:21:44 +00:00
|
|
|
|
|
|
|
// Returns the current interval between updates in milliseconds
|
2003-08-02 00:12:39 +00:00
|
|
|
static long GetUpdateInterval() { return sm_updateInterval; }
|
2003-07-07 16:21:44 +00:00
|
|
|
|
2003-07-09 10:15:21 +00:00
|
|
|
// Can we update this window?
|
2003-08-02 00:12:39 +00:00
|
|
|
static bool CanUpdate(wxWindowBase *win);
|
2003-07-07 16:21:44 +00:00
|
|
|
|
|
|
|
// Reset the update time to provide a delay until the next
|
|
|
|
// time we should update
|
2003-08-02 00:12:39 +00:00
|
|
|
static void ResetUpdateTime();
|
2003-07-07 16:21:44 +00:00
|
|
|
|
2004-05-23 14:56:36 +00:00
|
|
|
// Specify how wxWidgets will send update events: to
|
2003-07-09 10:15:21 +00:00
|
|
|
// all windows, or only to those which specify that they
|
|
|
|
// will process the events.
|
|
|
|
static void SetMode(wxUpdateUIMode mode) { sm_updateMode = mode; }
|
|
|
|
|
|
|
|
// Returns the UI update mode
|
2003-08-02 00:12:39 +00:00
|
|
|
static wxUpdateUIMode GetMode() { return sm_updateMode; }
|
2003-07-09 10:15:21 +00:00
|
|
|
|
2001-11-18 12:42:45 +00:00
|
|
|
virtual wxEvent *Clone() const { return new wxUpdateUIEvent(*this); }
|
1999-05-13 15:24:59 +00:00
|
|
|
|
1999-02-05 14:26:48 +00:00
|
|
|
protected:
|
|
|
|
bool m_checked;
|
|
|
|
bool m_enabled;
|
2006-02-12 16:32:50 +00:00
|
|
|
bool m_shown;
|
1999-02-05 14:26:48 +00:00
|
|
|
bool m_setEnabled;
|
2006-02-12 16:32:50 +00:00
|
|
|
bool m_setShown;
|
1999-02-05 14:26:48 +00:00
|
|
|
bool m_setText;
|
|
|
|
bool m_setChecked;
|
|
|
|
wxString m_text;
|
2003-07-07 16:21:44 +00:00
|
|
|
#if wxUSE_LONGLONG
|
2003-07-09 10:15:21 +00:00
|
|
|
static wxLongLong sm_lastUpdate;
|
2003-07-07 16:21:44 +00:00
|
|
|
#endif
|
2003-07-09 10:15:21 +00:00
|
|
|
static long sm_updateInterval;
|
|
|
|
static wxUpdateUIMode sm_updateMode;
|
2001-11-18 23:08:00 +00:00
|
|
|
|
2001-11-18 12:42:45 +00:00
|
|
|
private:
|
2003-07-22 00:24:07 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxUpdateUIEvent)
|
1998-05-20 14:01:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
wxEVT_SYS_COLOUR_CHANGED
|
|
|
|
*/
|
|
|
|
|
|
|
|
// TODO: shouldn't all events record the window ID?
|
2003-07-02 01:59:24 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxSysColourChangedEvent : public wxEvent
|
1998-05-20 14:01:55 +00:00
|
|
|
{
|
1999-02-05 14:26:48 +00:00
|
|
|
public:
|
|
|
|
wxSysColourChangedEvent()
|
2002-05-08 21:13:51 +00:00
|
|
|
: wxEvent(0, wxEVT_SYS_COLOUR_CHANGED)
|
|
|
|
{ }
|
2001-11-18 23:08:00 +00:00
|
|
|
|
2001-11-18 12:42:45 +00:00
|
|
|
virtual wxEvent *Clone() const { return new wxSysColourChangedEvent(*this); }
|
2001-11-18 23:08:00 +00:00
|
|
|
|
2001-11-18 12:42:45 +00:00
|
|
|
private:
|
2003-07-22 00:24:07 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSysColourChangedEvent)
|
1998-05-20 14:01:55 +00:00
|
|
|
};
|
|
|
|
|
2002-04-12 20:26:43 +00:00
|
|
|
/*
|
|
|
|
wxEVT_MOUSE_CAPTURE_CHANGED
|
|
|
|
The window losing the capture receives this message
|
|
|
|
(even if it released the capture itself).
|
|
|
|
*/
|
|
|
|
|
2003-07-02 01:59:24 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxMouseCaptureChangedEvent : public wxEvent
|
2002-04-12 20:26:43 +00:00
|
|
|
{
|
|
|
|
public:
|
2003-03-21 02:58:55 +00:00
|
|
|
wxMouseCaptureChangedEvent(wxWindowID winid = 0, wxWindow* gainedCapture = NULL)
|
|
|
|
: wxEvent(winid, wxEVT_MOUSE_CAPTURE_CHANGED),
|
2002-07-03 16:25:22 +00:00
|
|
|
m_gainedCapture(gainedCapture)
|
2002-05-08 21:13:51 +00:00
|
|
|
{ }
|
|
|
|
|
|
|
|
wxMouseCaptureChangedEvent(const wxMouseCaptureChangedEvent& event)
|
2002-07-03 16:25:22 +00:00
|
|
|
: wxEvent(event),
|
|
|
|
m_gainedCapture(event.m_gainedCapture)
|
2002-05-08 21:13:51 +00:00
|
|
|
{ }
|
2002-04-12 20:26:43 +00:00
|
|
|
|
|
|
|
virtual wxEvent *Clone() const { return new wxMouseCaptureChangedEvent(*this); }
|
|
|
|
|
2007-04-14 09:58:37 +00:00
|
|
|
wxWindow* GetCapturedWindow() const { return m_gainedCapture; }
|
2002-04-12 20:26:43 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
wxWindow* m_gainedCapture;
|
2003-07-22 00:24:07 +00:00
|
|
|
|
|
|
|
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMouseCaptureChangedEvent)
|
2002-04-12 20:26:43 +00:00
|
|
|
};
|
|
|
|
|
2006-07-31 09:27:54 +00:00
|
|
|
/*
|
|
|
|
wxEVT_MOUSE_CAPTURE_LOST
|
|
|
|
The window losing the capture receives this message, unless it released it
|
|
|
|
it itself or unless wxWindow::CaptureMouse was called on another window
|
|
|
|
(and so capture will be restored when the new capturer releases it).
|
|
|
|
*/
|
|
|
|
|
|
|
|
class WXDLLIMPEXP_CORE wxMouseCaptureLostEvent : public wxEvent
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxMouseCaptureLostEvent(wxWindowID winid = 0)
|
|
|
|
: wxEvent(winid, wxEVT_MOUSE_CAPTURE_LOST)
|
|
|
|
{}
|
|
|
|
|
|
|
|
wxMouseCaptureLostEvent(const wxMouseCaptureLostEvent& event)
|
|
|
|
: wxEvent(event)
|
|
|
|
{}
|
|
|
|
|
|
|
|
virtual wxEvent *Clone() const { return new wxMouseCaptureLostEvent(*this); }
|
|
|
|
|
|
|
|
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMouseCaptureLostEvent)
|
|
|
|
};
|
|
|
|
|
2002-02-07 18:46:31 +00:00
|
|
|
/*
|
|
|
|
wxEVT_DISPLAY_CHANGED
|
|
|
|
*/
|
2003-07-02 01:59:24 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxDisplayChangedEvent : public wxEvent
|
2002-02-07 18:46:31 +00:00
|
|
|
{
|
|
|
|
private:
|
2003-07-22 00:24:07 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDisplayChangedEvent)
|
2002-02-07 18:46:31 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
wxDisplayChangedEvent()
|
2002-05-08 21:13:51 +00:00
|
|
|
: wxEvent(0, wxEVT_DISPLAY_CHANGED)
|
|
|
|
{ }
|
2002-02-07 18:46:31 +00:00
|
|
|
|
|
|
|
virtual wxEvent *Clone() const { return new wxDisplayChangedEvent(*this); }
|
|
|
|
};
|
|
|
|
|
1998-07-29 06:51:33 +00:00
|
|
|
/*
|
|
|
|
wxEVT_PALETTE_CHANGED
|
|
|
|
*/
|
|
|
|
|
2003-07-02 01:59:24 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxPaletteChangedEvent : public wxEvent
|
1998-07-29 06:51:33 +00:00
|
|
|
{
|
|
|
|
public:
|
2003-03-21 02:58:55 +00:00
|
|
|
wxPaletteChangedEvent(wxWindowID winid = 0)
|
|
|
|
: wxEvent(winid, wxEVT_PALETTE_CHANGED),
|
2009-01-12 16:51:14 +00:00
|
|
|
m_changedWindow(NULL)
|
2002-07-03 16:25:22 +00:00
|
|
|
{ }
|
2002-05-08 21:13:51 +00:00
|
|
|
|
|
|
|
wxPaletteChangedEvent(const wxPaletteChangedEvent& event)
|
2002-07-03 16:25:22 +00:00
|
|
|
: wxEvent(event),
|
|
|
|
m_changedWindow(event.m_changedWindow)
|
2002-05-08 21:13:51 +00:00
|
|
|
{ }
|
1998-07-29 06:51:33 +00:00
|
|
|
|
1999-02-05 14:26:48 +00:00
|
|
|
void SetChangedWindow(wxWindow* win) { m_changedWindow = win; }
|
|
|
|
wxWindow* GetChangedWindow() const { return m_changedWindow; }
|
1998-07-29 06:51:33 +00:00
|
|
|
|
2001-11-18 12:42:45 +00:00
|
|
|
virtual wxEvent *Clone() const { return new wxPaletteChangedEvent(*this); }
|
1999-05-13 15:24:59 +00:00
|
|
|
|
1998-07-29 06:51:33 +00:00
|
|
|
protected:
|
1999-02-05 14:26:48 +00:00
|
|
|
wxWindow* m_changedWindow;
|
2001-11-18 12:42:45 +00:00
|
|
|
|
|
|
|
private:
|
2003-07-22 00:24:07 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxPaletteChangedEvent)
|
1998-07-29 06:51:33 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
wxEVT_QUERY_NEW_PALETTE
|
|
|
|
Indicates the window is getting keyboard focus and should re-do its palette.
|
|
|
|
*/
|
|
|
|
|
2003-07-02 01:59:24 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxQueryNewPaletteEvent : public wxEvent
|
1998-07-29 06:51:33 +00:00
|
|
|
{
|
|
|
|
public:
|
2003-03-21 02:58:55 +00:00
|
|
|
wxQueryNewPaletteEvent(wxWindowID winid = 0)
|
|
|
|
: wxEvent(winid, wxEVT_QUERY_NEW_PALETTE),
|
2004-09-04 01:26:40 +00:00
|
|
|
m_paletteRealized(false)
|
2002-05-08 21:13:51 +00:00
|
|
|
{ }
|
2009-02-02 20:38:56 +00:00
|
|
|
wxQueryNewPaletteEvent(const wxQueryNewPaletteEvent& event)
|
2002-07-19 19:43:55 +00:00
|
|
|
: wxEvent(event),
|
2003-01-12 22:30:51 +00:00
|
|
|
m_paletteRealized(event.m_paletteRealized)
|
|
|
|
{ }
|
2002-07-20 02:06:47 +00:00
|
|
|
|
1999-02-05 14:26:48 +00:00
|
|
|
// App sets this if it changes the palette.
|
|
|
|
void SetPaletteRealized(bool realized) { m_paletteRealized = realized; }
|
|
|
|
bool GetPaletteRealized() const { return m_paletteRealized; }
|
1998-07-29 06:51:33 +00:00
|
|
|
|
2001-11-18 12:42:45 +00:00
|
|
|
virtual wxEvent *Clone() const { return new wxQueryNewPaletteEvent(*this); }
|
1999-05-13 15:24:59 +00:00
|
|
|
|
1998-07-29 06:51:33 +00:00
|
|
|
protected:
|
1999-02-05 14:26:48 +00:00
|
|
|
bool m_paletteRealized;
|
2001-11-18 23:08:00 +00:00
|
|
|
|
2001-11-18 12:42:45 +00:00
|
|
|
private:
|
2003-07-22 00:24:07 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxQueryNewPaletteEvent)
|
1998-07-29 06:51:33 +00:00
|
|
|
};
|
|
|
|
|
1998-07-08 22:16:19 +00:00
|
|
|
/*
|
|
|
|
Event generated by dialog navigation keys
|
|
|
|
wxEVT_NAVIGATION_KEY
|
|
|
|
*/
|
2000-01-23 03:05:24 +00:00
|
|
|
// NB: don't derive from command event to avoid being propagated to the parent
|
2003-07-02 01:59:24 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxNavigationKeyEvent : public wxEvent
|
1998-07-08 22:16:19 +00:00
|
|
|
{
|
|
|
|
public:
|
2000-01-23 03:05:24 +00:00
|
|
|
wxNavigationKeyEvent()
|
2002-07-03 16:25:22 +00:00
|
|
|
: wxEvent(0, wxEVT_NAVIGATION_KEY),
|
2005-02-19 21:59:21 +00:00
|
|
|
m_flags(IsForward | FromTab), // defaults are for TAB
|
2009-01-12 16:51:14 +00:00
|
|
|
m_focus(NULL)
|
2003-09-30 12:49:56 +00:00
|
|
|
{
|
|
|
|
m_propagationLevel = wxEVENT_PROPAGATE_NONE;
|
|
|
|
}
|
2000-01-23 03:05:24 +00:00
|
|
|
|
2002-05-08 21:13:51 +00:00
|
|
|
wxNavigationKeyEvent(const wxNavigationKeyEvent& event)
|
2002-07-03 16:25:22 +00:00
|
|
|
: wxEvent(event),
|
|
|
|
m_flags(event.m_flags),
|
|
|
|
m_focus(event.m_focus)
|
2002-05-08 21:13:51 +00:00
|
|
|
{ }
|
1998-07-08 22:16:19 +00:00
|
|
|
|
1999-02-05 14:26:48 +00:00
|
|
|
// direction: forward (true) or backward (false)
|
2000-01-23 03:05:24 +00:00
|
|
|
bool GetDirection() const
|
|
|
|
{ return (m_flags & IsForward) != 0; }
|
|
|
|
void SetDirection(bool bForward)
|
|
|
|
{ if ( bForward ) m_flags |= IsForward; else m_flags &= ~IsForward; }
|
1998-07-08 22:16:19 +00:00
|
|
|
|
1999-02-05 14:26:48 +00:00
|
|
|
// it may be a window change event (MDI, notebook pages...) or a control
|
|
|
|
// change event
|
2000-01-23 03:05:24 +00:00
|
|
|
bool IsWindowChange() const
|
|
|
|
{ return (m_flags & WinChange) != 0; }
|
|
|
|
void SetWindowChange(bool bIs)
|
|
|
|
{ if ( bIs ) m_flags |= WinChange; else m_flags &= ~WinChange; }
|
|
|
|
|
2005-02-19 21:59:21 +00:00
|
|
|
// Set to true under MSW if the event was generated using the tab key.
|
|
|
|
// This is required for proper navogation over radio buttons
|
|
|
|
bool IsFromTab() const
|
|
|
|
{ return (m_flags & FromTab) != 0; }
|
|
|
|
void SetFromTab(bool bIs)
|
|
|
|
{ if ( bIs ) m_flags |= FromTab; else m_flags &= ~FromTab; }
|
|
|
|
|
1999-02-05 14:26:48 +00:00
|
|
|
// the child which has the focus currently (may be NULL - use
|
|
|
|
// wxWindow::FindFocus then)
|
2000-01-23 03:05:24 +00:00
|
|
|
wxWindow* GetCurrentFocus() const { return m_focus; }
|
|
|
|
void SetCurrentFocus(wxWindow *win) { m_focus = win; }
|
|
|
|
|
2004-06-15 22:24:49 +00:00
|
|
|
// Set flags
|
|
|
|
void SetFlags(long flags) { m_flags = flags; }
|
|
|
|
|
2001-11-18 12:42:45 +00:00
|
|
|
virtual wxEvent *Clone() const { return new wxNavigationKeyEvent(*this); }
|
|
|
|
|
2009-02-20 12:02:09 +00:00
|
|
|
enum wxNavigationKeyEventFlags
|
2000-01-23 03:05:24 +00:00
|
|
|
{
|
2004-07-09 10:42:14 +00:00
|
|
|
IsBackward = 0x0000,
|
2000-01-23 03:05:24 +00:00
|
|
|
IsForward = 0x0001,
|
2005-02-19 21:59:21 +00:00
|
|
|
WinChange = 0x0002,
|
|
|
|
FromTab = 0x0004
|
2000-01-23 03:05:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
long m_flags;
|
|
|
|
wxWindow *m_focus;
|
|
|
|
|
2001-11-18 12:42:45 +00:00
|
|
|
private:
|
2003-07-22 00:24:07 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxNavigationKeyEvent)
|
1998-07-08 22:16:19 +00:00
|
|
|
};
|
|
|
|
|
1999-05-19 00:53:27 +00:00
|
|
|
// Window creation/destruction events: the first is sent as soon as window is
|
|
|
|
// created (i.e. the underlying GUI object exists), but when the C++ object is
|
|
|
|
// fully initialized (so virtual functions may be called). The second,
|
|
|
|
// wxEVT_DESTROY, is sent right before the window is destroyed - again, it's
|
|
|
|
// still safe to call virtual functions at this moment
|
|
|
|
/*
|
|
|
|
wxEVT_CREATE
|
|
|
|
wxEVT_DESTROY
|
|
|
|
*/
|
|
|
|
|
2003-07-02 01:59:24 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxWindowCreateEvent : public wxCommandEvent
|
1999-05-19 00:53:27 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxWindowCreateEvent(wxWindow *win = NULL);
|
|
|
|
|
|
|
|
wxWindow *GetWindow() const { return (wxWindow *)GetEventObject(); }
|
2001-11-18 23:08:00 +00:00
|
|
|
|
2001-11-18 12:42:45 +00:00
|
|
|
virtual wxEvent *Clone() const { return new wxWindowCreateEvent(*this); }
|
2001-11-18 23:08:00 +00:00
|
|
|
|
2001-11-18 12:42:45 +00:00
|
|
|
private:
|
2003-07-22 00:24:07 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxWindowCreateEvent)
|
1999-05-19 00:53:27 +00:00
|
|
|
};
|
|
|
|
|
2003-07-02 01:59:24 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxWindowDestroyEvent : public wxCommandEvent
|
1999-05-19 00:53:27 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxWindowDestroyEvent(wxWindow *win = NULL);
|
|
|
|
|
|
|
|
wxWindow *GetWindow() const { return (wxWindow *)GetEventObject(); }
|
2001-11-18 23:08:00 +00:00
|
|
|
|
2001-11-18 12:42:45 +00:00
|
|
|
virtual wxEvent *Clone() const { return new wxWindowDestroyEvent(*this); }
|
|
|
|
|
|
|
|
private:
|
2003-07-22 00:24:07 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxWindowDestroyEvent)
|
1999-05-19 00:53:27 +00:00
|
|
|
};
|
|
|
|
|
2000-09-10 12:43:37 +00:00
|
|
|
// A help event is sent when the user clicks on a window in context-help mode.
|
2000-09-06 09:45:24 +00:00
|
|
|
/*
|
2000-09-10 12:43:37 +00:00
|
|
|
wxEVT_HELP
|
|
|
|
wxEVT_DETAILED_HELP
|
|
|
|
*/
|
2000-09-06 09:45:24 +00:00
|
|
|
|
2003-07-02 01:59:24 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxHelpEvent : public wxCommandEvent
|
2000-09-06 09:45:24 +00:00
|
|
|
{
|
|
|
|
public:
|
2006-05-26 02:21:38 +00:00
|
|
|
// how was this help event generated?
|
|
|
|
enum Origin
|
|
|
|
{
|
|
|
|
Origin_Unknown, // unrecognized event source
|
|
|
|
Origin_Keyboard, // event generated from F1 key press
|
|
|
|
Origin_HelpButton // event from [?] button on the title bar (Windows)
|
|
|
|
};
|
|
|
|
|
2000-09-10 12:43:37 +00:00
|
|
|
wxHelpEvent(wxEventType type = wxEVT_NULL,
|
2003-03-21 02:58:55 +00:00
|
|
|
wxWindowID winid = 0,
|
2006-05-26 02:21:38 +00:00
|
|
|
const wxPoint& pt = wxDefaultPosition,
|
|
|
|
Origin origin = Origin_Unknown)
|
2003-03-21 02:58:55 +00:00
|
|
|
: wxCommandEvent(type, winid),
|
2006-05-26 02:21:38 +00:00
|
|
|
m_pos(pt),
|
|
|
|
m_origin(GuessOrigin(origin))
|
2002-05-08 21:13:51 +00:00
|
|
|
{ }
|
2009-02-02 20:38:56 +00:00
|
|
|
wxHelpEvent(const wxHelpEvent& event)
|
2002-07-19 19:43:55 +00:00
|
|
|
: wxCommandEvent(event),
|
2003-01-12 22:30:51 +00:00
|
|
|
m_pos(event.m_pos),
|
|
|
|
m_target(event.m_target),
|
2006-05-26 02:21:38 +00:00
|
|
|
m_link(event.m_link),
|
|
|
|
m_origin(event.m_origin)
|
2002-07-19 19:43:55 +00:00
|
|
|
{ }
|
2002-07-20 02:06:47 +00:00
|
|
|
|
2000-09-10 12:43:37 +00:00
|
|
|
// Position of event (in screen coordinates)
|
|
|
|
const wxPoint& GetPosition() const { return m_pos; }
|
|
|
|
void SetPosition(const wxPoint& pos) { m_pos = pos; }
|
2000-09-06 09:45:24 +00:00
|
|
|
|
2000-09-10 12:43:37 +00:00
|
|
|
// Optional link to further help
|
|
|
|
const wxString& GetLink() const { return m_link; }
|
|
|
|
void SetLink(const wxString& link) { m_link = link; }
|
2000-09-08 10:49:39 +00:00
|
|
|
|
2000-09-10 12:43:37 +00:00
|
|
|
// Optional target to display help in. E.g. a window specification
|
|
|
|
const wxString& GetTarget() const { return m_target; }
|
|
|
|
void SetTarget(const wxString& target) { m_target = target; }
|
2000-09-08 10:49:39 +00:00
|
|
|
|
2001-11-18 12:42:45 +00:00
|
|
|
virtual wxEvent *Clone() const { return new wxHelpEvent(*this); }
|
2001-11-18 23:08:00 +00:00
|
|
|
|
2006-05-26 02:21:38 +00:00
|
|
|
// optional indication of the event source
|
|
|
|
Origin GetOrigin() const { return m_origin; }
|
|
|
|
void SetOrigin(Origin origin) { m_origin = origin; }
|
|
|
|
|
2000-09-10 12:43:37 +00:00
|
|
|
protected:
|
|
|
|
wxPoint m_pos;
|
|
|
|
wxString m_target;
|
|
|
|
wxString m_link;
|
2006-05-26 02:21:38 +00:00
|
|
|
Origin m_origin;
|
|
|
|
|
|
|
|
// we can try to guess the event origin ourselves, even if none is
|
|
|
|
// specified in the ctor
|
|
|
|
static Origin GuessOrigin(Origin origin);
|
2000-09-10 12:43:37 +00:00
|
|
|
|
|
|
|
private:
|
2003-07-22 00:24:07 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxHelpEvent)
|
2000-09-06 09:45:24 +00:00
|
|
|
};
|
|
|
|
|
2006-05-12 15:21:41 +00:00
|
|
|
// A Clipboard Text event is sent when a window intercepts text copy/cut/paste
|
|
|
|
// message, i.e. the user has cut/copied/pasted data from/into a text control
|
|
|
|
// via ctrl-C/X/V, ctrl/shift-del/insert, a popup menu command, etc.
|
|
|
|
// NOTE : under windows these events are *NOT* generated automatically
|
|
|
|
// for a Rich Edit text control.
|
|
|
|
/*
|
|
|
|
wxEVT_COMMAND_TEXT_COPY
|
|
|
|
wxEVT_COMMAND_TEXT_CUT
|
|
|
|
wxEVT_COMMAND_TEXT_PASTE
|
|
|
|
*/
|
|
|
|
|
|
|
|
class WXDLLIMPEXP_CORE wxClipboardTextEvent : public wxCommandEvent
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxClipboardTextEvent(wxEventType type = wxEVT_NULL,
|
|
|
|
wxWindowID winid = 0)
|
|
|
|
: wxCommandEvent(type, winid)
|
|
|
|
{ }
|
2009-02-02 20:38:56 +00:00
|
|
|
wxClipboardTextEvent(const wxClipboardTextEvent& event)
|
2006-05-12 15:21:41 +00:00
|
|
|
: wxCommandEvent(event)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
virtual wxEvent *Clone() const { return new wxClipboardTextEvent(*this); }
|
|
|
|
|
|
|
|
private:
|
|
|
|
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxClipboardTextEvent)
|
|
|
|
};
|
|
|
|
|
2001-05-16 11:32:21 +00:00
|
|
|
// A Context event is sent when the user right clicks on a window or
|
|
|
|
// presses Shift-F10
|
|
|
|
// NOTE : Under windows this is a repackaged WM_CONTETXMENU message
|
|
|
|
// Under other systems it may have to be generated from a right click event
|
|
|
|
/*
|
|
|
|
wxEVT_CONTEXT_MENU
|
|
|
|
*/
|
|
|
|
|
2003-07-02 01:59:24 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxContextMenuEvent : public wxCommandEvent
|
2001-05-16 11:32:21 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxContextMenuEvent(wxEventType type = wxEVT_NULL,
|
2003-03-21 02:58:55 +00:00
|
|
|
wxWindowID winid = 0,
|
2002-05-08 21:13:51 +00:00
|
|
|
const wxPoint& pt = wxDefaultPosition)
|
2003-03-21 02:58:55 +00:00
|
|
|
: wxCommandEvent(type, winid),
|
2002-07-03 16:25:22 +00:00
|
|
|
m_pos(pt)
|
2002-05-08 21:13:51 +00:00
|
|
|
{ }
|
2009-02-02 20:38:56 +00:00
|
|
|
wxContextMenuEvent(const wxContextMenuEvent& event)
|
2002-07-19 19:43:55 +00:00
|
|
|
: wxCommandEvent(event),
|
2003-01-12 22:30:51 +00:00
|
|
|
m_pos(event.m_pos)
|
2002-07-19 19:43:55 +00:00
|
|
|
{ }
|
2002-07-20 02:06:47 +00:00
|
|
|
|
2001-05-16 11:32:21 +00:00
|
|
|
// Position of event (in screen coordinates)
|
|
|
|
const wxPoint& GetPosition() const { return m_pos; }
|
|
|
|
void SetPosition(const wxPoint& pos) { m_pos = pos; }
|
|
|
|
|
2001-11-18 12:42:45 +00:00
|
|
|
virtual wxEvent *Clone() const { return new wxContextMenuEvent(*this); }
|
2001-11-18 23:08:00 +00:00
|
|
|
|
2001-05-16 11:32:21 +00:00
|
|
|
protected:
|
|
|
|
wxPoint m_pos;
|
|
|
|
|
|
|
|
private:
|
2003-07-22 00:24:07 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxContextMenuEvent)
|
2001-05-16 11:32:21 +00:00
|
|
|
};
|
|
|
|
|
2007-05-14 23:43:39 +00:00
|
|
|
#endif // wxUSE_GUI
|
|
|
|
|
1999-10-04 20:15:38 +00:00
|
|
|
// Idle event
|
|
|
|
/*
|
|
|
|
wxEVT_IDLE
|
|
|
|
*/
|
|
|
|
|
2003-07-09 10:15:21 +00:00
|
|
|
// Whether to always send idle events to windows, or
|
|
|
|
// to only send update events to those with the
|
|
|
|
// wxWS_EX_PROCESS_IDLE style.
|
|
|
|
|
|
|
|
enum wxIdleMode
|
|
|
|
{
|
|
|
|
// Send idle events to all windows
|
|
|
|
wxIDLE_PROCESS_ALL,
|
|
|
|
|
|
|
|
// Send idle events to windows that have
|
|
|
|
// the wxWS_EX_PROCESS_IDLE flag specified
|
|
|
|
wxIDLE_PROCESS_SPECIFIED
|
|
|
|
};
|
|
|
|
|
2007-05-14 23:43:39 +00:00
|
|
|
class WXDLLIMPEXP_BASE wxIdleEvent : public wxEvent
|
1999-10-04 20:15:38 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxIdleEvent()
|
2002-07-03 16:25:22 +00:00
|
|
|
: wxEvent(0, wxEVT_IDLE),
|
2004-09-04 01:26:40 +00:00
|
|
|
m_requestMore(false)
|
2002-05-08 21:13:51 +00:00
|
|
|
{ }
|
2009-02-02 20:38:56 +00:00
|
|
|
wxIdleEvent(const wxIdleEvent& event)
|
2002-07-19 19:43:55 +00:00
|
|
|
: wxEvent(event),
|
2003-01-12 22:30:51 +00:00
|
|
|
m_requestMore(event.m_requestMore)
|
|
|
|
{ }
|
2002-07-20 02:06:47 +00:00
|
|
|
|
2004-09-04 01:26:40 +00:00
|
|
|
void RequestMore(bool needMore = true) { m_requestMore = needMore; }
|
1999-10-04 20:15:38 +00:00
|
|
|
bool MoreRequested() const { return m_requestMore; }
|
|
|
|
|
2001-11-18 12:42:45 +00:00
|
|
|
virtual wxEvent *Clone() const { return new wxIdleEvent(*this); }
|
1999-10-04 20:15:38 +00:00
|
|
|
|
2004-05-23 14:56:36 +00:00
|
|
|
// Specify how wxWidgets will send idle events: to
|
2003-07-09 10:15:21 +00:00
|
|
|
// all windows, or only to those which specify that they
|
|
|
|
// will process the events.
|
|
|
|
static void SetMode(wxIdleMode mode) { sm_idleMode = mode; }
|
|
|
|
|
|
|
|
// Returns the idle event mode
|
2003-08-02 00:12:39 +00:00
|
|
|
static wxIdleMode GetMode() { return sm_idleMode; }
|
2003-07-09 10:15:21 +00:00
|
|
|
|
1999-10-04 20:15:38 +00:00
|
|
|
protected:
|
|
|
|
bool m_requestMore;
|
2003-07-09 10:15:21 +00:00
|
|
|
static wxIdleMode sm_idleMode;
|
2001-11-18 23:08:00 +00:00
|
|
|
|
2001-11-18 12:42:45 +00:00
|
|
|
private:
|
2003-07-22 00:24:07 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxIdleEvent)
|
1999-10-04 20:15:38 +00:00
|
|
|
};
|
|
|
|
|
1998-06-14 20:53:26 +00:00
|
|
|
/* TODO
|
1998-05-20 14:01:55 +00:00
|
|
|
wxEVT_MOUSE_CAPTURE_CHANGED,
|
|
|
|
wxEVT_SETTING_CHANGED, // WM_WININICHANGE (NT) / WM_SETTINGCHANGE (Win95)
|
|
|
|
// wxEVT_FONT_CHANGED, // WM_FONTCHANGE: roll into wxEVT_SETTING_CHANGED, but remember to propagate
|
|
|
|
// wxEVT_FONT_CHANGED to all other windows (maybe).
|
|
|
|
wxEVT_DRAW_ITEM, // Leave these three as virtual functions in wxControl?? Platform-specific.
|
|
|
|
wxEVT_MEASURE_ITEM,
|
|
|
|
wxEVT_COMPARE_ITEM
|
|
|
|
*/
|
|
|
|
|
2001-10-09 22:50:33 +00:00
|
|
|
|
2009-02-04 17:42:28 +00:00
|
|
|
|
1999-10-17 01:18:49 +00:00
|
|
|
// ============================================================================
|
|
|
|
// event handler and related classes
|
|
|
|
// ============================================================================
|
|
|
|
|
1998-05-20 14:01:55 +00:00
|
|
|
|
2001-01-31 16:00:00 +00:00
|
|
|
// struct containing the members common to static and dynamic event tables
|
|
|
|
// entries
|
2003-07-02 01:59:24 +00:00
|
|
|
struct WXDLLIMPEXP_BASE wxEventTableEntryBase
|
2001-01-25 18:30:30 +00:00
|
|
|
{
|
2003-03-21 02:58:55 +00:00
|
|
|
wxEventTableEntryBase(int winid, int idLast,
|
2009-01-12 14:26:13 +00:00
|
|
|
wxEventFunctor* fn, wxObject *data)
|
2003-03-21 02:58:55 +00:00
|
|
|
: m_id(winid),
|
2002-07-03 16:25:22 +00:00
|
|
|
m_lastId(idLast),
|
|
|
|
m_fn(fn),
|
|
|
|
m_callbackUserData(data)
|
2009-11-11 17:18:49 +00:00
|
|
|
{
|
|
|
|
wxASSERT_MSG( idLast == wxID_ANY || winid <= idLast,
|
|
|
|
"invalid IDs range: lower bound > upper bound" );
|
|
|
|
}
|
2002-05-08 21:13:51 +00:00
|
|
|
|
2009-01-12 14:26:13 +00:00
|
|
|
wxEventTableEntryBase( const wxEventTableEntryBase &entry )
|
|
|
|
: m_id( entry.m_id ),
|
|
|
|
m_lastId( entry.m_lastId ),
|
|
|
|
m_fn( entry.m_fn ),
|
|
|
|
m_callbackUserData( entry.m_callbackUserData )
|
|
|
|
{
|
|
|
|
// This is a 'hack' to ensure that only one instance tries to delete
|
|
|
|
// the functor pointer. It is safe as long as the only place where the
|
|
|
|
// copy constructor is being called is when the static event tables are
|
|
|
|
// being initialized (a temporary instance is created and then this
|
|
|
|
// constructor is called).
|
|
|
|
|
2009-02-02 20:38:56 +00:00
|
|
|
const_cast<wxEventTableEntryBase&>( entry ).m_fn = NULL;
|
2009-01-12 14:26:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
~wxEventTableEntryBase()
|
|
|
|
{
|
2009-01-12 14:33:43 +00:00
|
|
|
delete m_fn;
|
2009-01-12 14:26:13 +00:00
|
|
|
}
|
2001-01-31 16:00:00 +00:00
|
|
|
|
2002-07-03 16:25:22 +00:00
|
|
|
// the range of ids for this entry: if m_lastId == wxID_ANY, the range
|
|
|
|
// consists only of m_id, otherwise it is m_id..m_lastId inclusive
|
|
|
|
int m_id,
|
|
|
|
m_lastId;
|
2001-01-26 17:35:36 +00:00
|
|
|
|
2009-01-12 14:26:13 +00:00
|
|
|
// function/method/functor to call
|
|
|
|
wxEventFunctor* m_fn;
|
2001-01-25 18:30:30 +00:00
|
|
|
|
2009-01-12 14:26:13 +00:00
|
|
|
// arbitrary user data associated with the callback
|
2001-01-25 18:30:30 +00:00
|
|
|
wxObject* m_callbackUserData;
|
2009-01-12 14:26:13 +00:00
|
|
|
|
|
|
|
private:
|
2009-02-08 11:45:59 +00:00
|
|
|
wxDECLARE_NO_ASSIGN_CLASS(wxEventTableEntryBase);
|
2001-01-25 18:30:30 +00:00
|
|
|
};
|
|
|
|
|
2001-01-31 16:00:00 +00:00
|
|
|
// an entry from a static event table
|
2003-07-02 01:59:24 +00:00
|
|
|
struct WXDLLIMPEXP_BASE wxEventTableEntry : public wxEventTableEntryBase
|
1998-05-20 14:01:55 +00:00
|
|
|
{
|
2003-03-21 02:58:55 +00:00
|
|
|
wxEventTableEntry(const int& evType, int winid, int idLast,
|
2009-01-12 14:26:13 +00:00
|
|
|
wxEventFunctor* fn, wxObject *data)
|
2003-03-21 02:58:55 +00:00
|
|
|
: wxEventTableEntryBase(winid, idLast, fn, data),
|
2002-05-08 21:13:51 +00:00
|
|
|
m_eventType(evType)
|
|
|
|
{ }
|
2001-01-31 16:00:00 +00:00
|
|
|
|
|
|
|
// the reference to event type: this allows us to not care about the
|
|
|
|
// (undefined) order in which the event table entries and the event types
|
|
|
|
// are initialized: initially the value of this reference might be
|
|
|
|
// invalid, but by the time it is used for the first time, all global
|
|
|
|
// objects will have been initialized (including the event type constants)
|
|
|
|
// and so it will have the correct value when it is needed
|
|
|
|
const int& m_eventType;
|
2003-07-22 00:24:07 +00:00
|
|
|
|
|
|
|
private:
|
2009-02-08 11:45:59 +00:00
|
|
|
wxDECLARE_NO_ASSIGN_CLASS(wxEventTableEntry);
|
2001-01-31 16:00:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// an entry used in dynamic event table managed by wxEvtHandler::Connect()
|
2003-07-02 01:59:24 +00:00
|
|
|
struct WXDLLIMPEXP_BASE wxDynamicEventTableEntry : public wxEventTableEntryBase
|
2001-01-31 16:00:00 +00:00
|
|
|
{
|
2003-03-21 02:58:55 +00:00
|
|
|
wxDynamicEventTableEntry(int evType, int winid, int idLast,
|
2009-01-12 14:26:13 +00:00
|
|
|
wxEventFunctor* fn, wxObject *data)
|
2003-03-21 02:58:55 +00:00
|
|
|
: wxEventTableEntryBase(winid, idLast, fn, data),
|
2009-01-12 14:26:13 +00:00
|
|
|
m_eventType(evType)
|
2002-05-08 21:13:51 +00:00
|
|
|
{ }
|
2001-01-31 16:00:00 +00:00
|
|
|
|
|
|
|
// not a reference here as we can't keep a reference to a temporary int
|
|
|
|
// created to wrap the constant value typically passed to Connect() - nor
|
|
|
|
// do we need it
|
|
|
|
int m_eventType;
|
2003-06-30 13:11:51 +00:00
|
|
|
|
2009-01-12 14:26:13 +00:00
|
|
|
private:
|
2009-02-08 11:45:59 +00:00
|
|
|
wxDECLARE_NO_ASSIGN_CLASS(wxDynamicEventTableEntry);
|
1998-05-20 14:01:55 +00:00
|
|
|
};
|
|
|
|
|
2001-01-31 17:16:40 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// wxEventTable: an array of event entries terminated with {0, 0, 0, 0, 0}
|
|
|
|
// ----------------------------------------------------------------------------
|
2003-07-02 01:41:23 +00:00
|
|
|
|
2003-07-02 01:59:24 +00:00
|
|
|
struct WXDLLIMPEXP_BASE wxEventTable
|
1998-05-20 14:01:55 +00:00
|
|
|
{
|
2001-01-26 18:58:14 +00:00
|
|
|
const wxEventTable *baseTable; // base event table (next in chain)
|
|
|
|
const wxEventTableEntry *entries; // bottom of entry array
|
1998-05-20 14:01:55 +00:00
|
|
|
};
|
|
|
|
|
2003-07-17 23:59:49 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// wxEventHashTable: a helper of wxEvtHandler to speed up wxEventTable lookups.
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2003-10-08 22:13:14 +00:00
|
|
|
WX_DEFINE_ARRAY_PTR(const wxEventTableEntry*, wxEventTableEntryPointerArray);
|
2003-07-17 23:59:49 +00:00
|
|
|
|
|
|
|
class WXDLLIMPEXP_BASE wxEventHashTable
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
// Internal data structs
|
|
|
|
struct EventTypeTable
|
|
|
|
{
|
|
|
|
wxEventType eventType;
|
|
|
|
wxEventTableEntryPointerArray eventEntryTable;
|
|
|
|
};
|
|
|
|
typedef EventTypeTable* EventTypeTablePointer;
|
|
|
|
|
|
|
|
public:
|
|
|
|
// Constructor, needs the event table it needs to hash later on.
|
2003-09-17 23:35:36 +00:00
|
|
|
// Note: hashing of the event table is not done in the constructor as it
|
|
|
|
// can be that the event table is not yet full initialize, the hash
|
2003-07-17 23:59:49 +00:00
|
|
|
// will gets initialized when handling the first event look-up request.
|
|
|
|
wxEventHashTable(const wxEventTable &table);
|
|
|
|
// Destructor.
|
|
|
|
~wxEventHashTable();
|
|
|
|
|
2003-09-17 23:35:36 +00:00
|
|
|
// Handle the given event, in other words search the event table hash
|
2003-07-17 23:59:49 +00:00
|
|
|
// and call self->ProcessEvent() if a match was found.
|
2009-02-02 20:38:56 +00:00
|
|
|
bool HandleEvent(wxEvent& event, wxEvtHandler *self);
|
2003-07-17 23:59:49 +00:00
|
|
|
|
2003-09-26 10:50:58 +00:00
|
|
|
// Clear table
|
|
|
|
void Clear();
|
|
|
|
|
2009-03-21 23:36:37 +00:00
|
|
|
#if wxUSE_MEMORY_TRACING
|
|
|
|
// Clear all tables: only used to work around problems in memory tracing
|
|
|
|
// code
|
2003-09-26 10:50:58 +00:00
|
|
|
static void ClearAll();
|
2009-03-21 23:36:37 +00:00
|
|
|
#endif // wxUSE_MEMORY_TRACING
|
2003-09-26 10:50:58 +00:00
|
|
|
|
2003-07-17 23:59:49 +00:00
|
|
|
protected:
|
|
|
|
// Init the hash table with the entries of the static event table.
|
|
|
|
void InitHashTable();
|
|
|
|
// Helper funtion of InitHashTable() to insert 1 entry into the hash table.
|
|
|
|
void AddEntry(const wxEventTableEntry &entry);
|
|
|
|
// Allocate and init with null pointers the base hash table.
|
|
|
|
void AllocEventTypeTable(size_t size);
|
2003-09-17 23:35:36 +00:00
|
|
|
// Grow the hash table in size and transfer all items currently
|
2003-07-17 23:59:49 +00:00
|
|
|
// in the table to the correct location in the new table.
|
|
|
|
void GrowEventTypeTable();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
const wxEventTable &m_table;
|
|
|
|
bool m_rebuildHash;
|
|
|
|
|
|
|
|
size_t m_size;
|
|
|
|
EventTypeTablePointer *m_eventTypeTable;
|
2003-07-22 00:24:07 +00:00
|
|
|
|
2003-09-26 10:50:58 +00:00
|
|
|
static wxEventHashTable* sm_first;
|
|
|
|
wxEventHashTable* m_previous;
|
|
|
|
wxEventHashTable* m_next;
|
|
|
|
|
2009-02-08 11:45:59 +00:00
|
|
|
wxDECLARE_NO_COPY_CLASS(wxEventHashTable);
|
2003-07-17 23:59:49 +00:00
|
|
|
};
|
|
|
|
|
2001-01-31 16:00:00 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
2004-05-23 14:56:36 +00:00
|
|
|
// wxEvtHandler: the base class for all objects handling wxWidgets events
|
2001-01-31 16:00:00 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2008-02-09 14:40:26 +00:00
|
|
|
class WXDLLIMPEXP_BASE wxEvtHandler : public wxObject
|
|
|
|
, public wxTrackable
|
1998-05-20 14:01:55 +00:00
|
|
|
{
|
1999-02-05 14:26:48 +00:00
|
|
|
public:
|
|
|
|
wxEvtHandler();
|
2001-01-31 16:00:00 +00:00
|
|
|
virtual ~wxEvtHandler();
|
1999-02-05 14:26:48 +00:00
|
|
|
|
2009-01-22 11:53:09 +00:00
|
|
|
|
|
|
|
// Event handler chain
|
|
|
|
// -------------------
|
|
|
|
|
1999-02-05 14:26:48 +00:00
|
|
|
wxEvtHandler *GetNextHandler() const { return m_nextHandler; }
|
|
|
|
wxEvtHandler *GetPreviousHandler() const { return m_previousHandler; }
|
2009-01-22 11:53:09 +00:00
|
|
|
virtual void SetNextHandler(wxEvtHandler *handler) { m_nextHandler = handler; }
|
|
|
|
virtual void SetPreviousHandler(wxEvtHandler *handler) { m_previousHandler = handler; }
|
1999-02-05 14:26:48 +00:00
|
|
|
|
1999-10-17 01:18:49 +00:00
|
|
|
void SetEvtHandlerEnabled(bool enabled) { m_enabled = enabled; }
|
1999-02-05 14:26:48 +00:00
|
|
|
bool GetEvtHandlerEnabled() const { return m_enabled; }
|
|
|
|
|
2009-01-22 11:53:09 +00:00
|
|
|
void Unlink();
|
|
|
|
bool IsUnlinked() const;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Event queuing and processing
|
|
|
|
// ----------------------------
|
|
|
|
|
2008-04-28 18:49:42 +00:00
|
|
|
// Process an event right now: this can only be called from the main
|
|
|
|
// thread, use QueueEvent() for scheduling the events for
|
|
|
|
// processing from other threads.
|
1999-10-17 01:18:49 +00:00
|
|
|
virtual bool ProcessEvent(wxEvent& event);
|
1999-02-05 14:26:48 +00:00
|
|
|
|
2007-11-29 17:00:58 +00:00
|
|
|
// Process an event by calling ProcessEvent and handling any exceptions
|
|
|
|
// thrown by event handlers. It's mostly useful when processing wx events
|
|
|
|
// when called from C code (e.g. in GTK+ callback) when the exception
|
|
|
|
// wouldn't correctly propagate to wxEventLoop.
|
|
|
|
bool SafelyProcessEvent(wxEvent& event);
|
2009-01-22 11:53:09 +00:00
|
|
|
// NOTE: uses ProcessEvent()
|
2007-11-29 17:00:58 +00:00
|
|
|
|
2010-05-09 14:55:28 +00:00
|
|
|
// This method tries to process the event in this event handler, including
|
|
|
|
// any preprocessing done by TryBefore() and all the handlers chained to
|
|
|
|
// it, but excluding the post-processing done in TryAfter().
|
|
|
|
//
|
|
|
|
// It is meant to be called from ProcessEvent() only and is not virtual,
|
|
|
|
// additional event handlers can be hooked into the normal event processing
|
|
|
|
// logic using TryBefore() and TryAfter() hooks.
|
|
|
|
//
|
|
|
|
// You can also call it yourself to forward an event to another handler but
|
|
|
|
// without propagating it upwards if it's unhandled (this is usually
|
|
|
|
// unwanted when forwarding as the original handler would already do it if
|
|
|
|
// needed normally).
|
|
|
|
bool ProcessEventLocally(wxEvent& event);
|
|
|
|
|
2008-04-28 18:49:42 +00:00
|
|
|
// Schedule the given event to be processed later. It takes ownership of
|
|
|
|
// the event pointer, i.e. it will be deleted later. This is safe to call
|
|
|
|
// from multiple threads although you still need to ensure that wxString
|
|
|
|
// fields of the event object are deep copies and not use the same string
|
|
|
|
// buffer as other wxString objects in this thread.
|
|
|
|
virtual void QueueEvent(wxEvent *event);
|
|
|
|
|
|
|
|
// Add an event to be processed later: notice that this function is not
|
|
|
|
// safe to call from threads other than main, use QueueEvent()
|
|
|
|
virtual void AddPendingEvent(const wxEvent& event)
|
|
|
|
{
|
|
|
|
// notice that the thread-safety problem comes from the fact that
|
|
|
|
// Clone() doesn't make deep copies of wxString fields of wxEvent
|
|
|
|
// object and so the same wxString could be used from both threads when
|
|
|
|
// the event object is destroyed in this one -- QueueEvent() avoids
|
|
|
|
// this problem as the event pointer is not used any more in this
|
|
|
|
// thread at all after it is called.
|
|
|
|
QueueEvent(event.Clone());
|
|
|
|
}
|
1999-02-05 14:26:48 +00:00
|
|
|
|
1999-10-17 01:18:49 +00:00
|
|
|
void ProcessPendingEvents();
|
2009-01-22 11:53:09 +00:00
|
|
|
// NOTE: uses ProcessEvent()
|
1999-02-05 14:26:48 +00:00
|
|
|
|
2009-03-08 12:58:24 +00:00
|
|
|
void DeletePendingEvents();
|
|
|
|
|
1999-03-27 18:50:54 +00:00
|
|
|
#if wxUSE_THREADS
|
2007-06-21 21:56:50 +00:00
|
|
|
bool ProcessThreadEvent(const wxEvent& event);
|
2009-03-08 12:58:24 +00:00
|
|
|
// NOTE: uses AddPendingEvent(); call only from secondary threads
|
1999-03-27 18:50:54 +00:00
|
|
|
#endif
|
1999-02-05 14:26:48 +00:00
|
|
|
|
2009-01-22 11:53:09 +00:00
|
|
|
|
|
|
|
// Connecting and disconnecting
|
|
|
|
// ----------------------------
|
|
|
|
|
2009-02-02 20:38:56 +00:00
|
|
|
// These functions are used for old, untyped, event handlers and don't
|
|
|
|
// check that the type of the function passed to them actually matches the
|
|
|
|
// type of the event. They also only allow connecting events to methods of
|
|
|
|
// wxEvtHandler-derived classes.
|
|
|
|
//
|
|
|
|
// The template Connect() methods below are safer and allow connecting
|
|
|
|
// events to arbitrary functions or functors -- but require compiler
|
|
|
|
// support for templates.
|
|
|
|
|
1999-02-05 14:26:48 +00:00
|
|
|
// Dynamic association of a member function handler with the event handler,
|
2003-03-21 02:58:55 +00:00
|
|
|
// winid and event type
|
2005-02-14 23:53:48 +00:00
|
|
|
void Connect(int winid,
|
|
|
|
int lastId,
|
2008-11-09 16:44:56 +00:00
|
|
|
wxEventType eventType,
|
2005-02-14 23:53:48 +00:00
|
|
|
wxObjectEventFunction func,
|
2009-01-12 16:51:14 +00:00
|
|
|
wxObject *userData = NULL,
|
|
|
|
wxEvtHandler *eventSink = NULL)
|
2009-01-12 14:26:13 +00:00
|
|
|
{
|
2009-05-02 12:52:54 +00:00
|
|
|
DoBind(winid, lastId, eventType,
|
2009-02-02 20:38:56 +00:00
|
|
|
wxNewEventFunctor(eventType, func, eventSink),
|
|
|
|
userData);
|
2009-01-12 14:26:13 +00:00
|
|
|
}
|
1999-02-05 14:26:48 +00:00
|
|
|
|
|
|
|
// Convenience function: take just one id
|
2005-02-14 23:53:48 +00:00
|
|
|
void Connect(int winid,
|
2008-11-09 16:44:56 +00:00
|
|
|
wxEventType eventType,
|
2005-02-14 23:53:48 +00:00
|
|
|
wxObjectEventFunction func,
|
2009-01-12 16:51:14 +00:00
|
|
|
wxObject *userData = NULL,
|
|
|
|
wxEvtHandler *eventSink = NULL)
|
2003-06-30 13:11:51 +00:00
|
|
|
{ Connect(winid, wxID_ANY, eventType, func, userData, eventSink); }
|
1999-02-05 14:26:48 +00:00
|
|
|
|
2005-02-14 23:53:48 +00:00
|
|
|
// Even more convenient: without id (same as using id of wxID_ANY)
|
2008-11-09 16:44:56 +00:00
|
|
|
void Connect(wxEventType eventType,
|
2005-02-14 23:53:48 +00:00
|
|
|
wxObjectEventFunction func,
|
2009-01-12 16:51:14 +00:00
|
|
|
wxObject *userData = NULL,
|
|
|
|
wxEvtHandler *eventSink = NULL)
|
2005-02-14 23:53:48 +00:00
|
|
|
{ Connect(wxID_ANY, wxID_ANY, eventType, func, userData, eventSink); }
|
|
|
|
|
|
|
|
bool Disconnect(int winid,
|
|
|
|
int lastId,
|
|
|
|
wxEventType eventType,
|
|
|
|
wxObjectEventFunction func = NULL,
|
2009-01-12 16:51:14 +00:00
|
|
|
wxObject *userData = NULL,
|
|
|
|
wxEvtHandler *eventSink = NULL)
|
2009-01-12 14:26:13 +00:00
|
|
|
{
|
2009-05-02 12:52:54 +00:00
|
|
|
return DoUnbind(winid, lastId, eventType,
|
2009-02-02 20:38:56 +00:00
|
|
|
wxMakeEventFunctor(eventType, func, eventSink),
|
|
|
|
userData );
|
2009-01-12 14:26:13 +00:00
|
|
|
}
|
2005-02-14 23:53:48 +00:00
|
|
|
|
2005-02-15 12:04:53 +00:00
|
|
|
bool Disconnect(int winid = wxID_ANY,
|
2005-02-14 23:53:48 +00:00
|
|
|
wxEventType eventType = wxEVT_NULL,
|
|
|
|
wxObjectEventFunction func = NULL,
|
2009-01-12 16:51:14 +00:00
|
|
|
wxObject *userData = NULL,
|
|
|
|
wxEvtHandler *eventSink = NULL)
|
2003-06-30 13:11:51 +00:00
|
|
|
{ return Disconnect(winid, wxID_ANY, eventType, func, userData, eventSink); }
|
2000-10-07 02:38:05 +00:00
|
|
|
|
2005-05-18 22:40:09 +00:00
|
|
|
bool Disconnect(wxEventType eventType,
|
2005-05-19 17:37:59 +00:00
|
|
|
wxObjectEventFunction func,
|
2009-01-12 16:51:14 +00:00
|
|
|
wxObject *userData = NULL,
|
|
|
|
wxEvtHandler *eventSink = NULL)
|
2005-05-18 22:40:09 +00:00
|
|
|
{ return Disconnect(wxID_ANY, eventType, func, userData, eventSink); }
|
2009-02-02 20:38:56 +00:00
|
|
|
|
2009-05-02 12:52:54 +00:00
|
|
|
#ifdef wxHAS_EVENT_BIND
|
|
|
|
// Bind functions to an event:
|
|
|
|
template <typename EventTag, typename EventArg>
|
|
|
|
void Bind(const EventTag& eventType,
|
|
|
|
void (*function)(EventArg &),
|
|
|
|
int winid = wxID_ANY,
|
|
|
|
int lastId = wxID_ANY,
|
|
|
|
wxObject *userData = NULL)
|
|
|
|
{
|
|
|
|
DoBind(winid, lastId, eventType,
|
|
|
|
wxNewEventFunctor(eventType, function),
|
|
|
|
userData);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
template <typename EventTag, typename EventArg>
|
|
|
|
bool Unbind(const EventTag& eventType,
|
|
|
|
void (*function)(EventArg &),
|
|
|
|
int winid = wxID_ANY,
|
|
|
|
int lastId = wxID_ANY,
|
|
|
|
wxObject *userData = NULL)
|
|
|
|
{
|
|
|
|
return DoUnbind(winid, lastId, eventType,
|
|
|
|
wxMakeEventFunctor(eventType, function),
|
|
|
|
userData);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Bind functors to an event:
|
2009-02-02 20:38:56 +00:00
|
|
|
template <typename EventTag, typename Functor>
|
2009-02-25 17:43:22 +00:00
|
|
|
void Bind(const EventTag& eventType,
|
2009-05-02 15:28:16 +00:00
|
|
|
const Functor &functor,
|
2009-02-25 17:43:22 +00:00
|
|
|
int winid = wxID_ANY,
|
|
|
|
int lastId = wxID_ANY,
|
|
|
|
wxObject *userData = NULL)
|
2009-02-02 20:38:56 +00:00
|
|
|
{
|
2009-05-02 12:52:54 +00:00
|
|
|
DoBind(winid, lastId, eventType,
|
2009-03-18 09:30:08 +00:00
|
|
|
wxNewEventFunctor(eventType, functor),
|
2009-02-02 20:38:56 +00:00
|
|
|
userData);
|
2009-02-01 22:10:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-02-25 17:43:22 +00:00
|
|
|
template <typename EventTag, typename Functor>
|
|
|
|
bool Unbind(const EventTag& eventType,
|
2009-05-02 15:28:16 +00:00
|
|
|
const Functor &functor,
|
2009-02-25 17:43:22 +00:00
|
|
|
int winid = wxID_ANY,
|
|
|
|
int lastId = wxID_ANY,
|
|
|
|
wxObject *userData = NULL)
|
2009-01-12 14:26:13 +00:00
|
|
|
{
|
2009-05-02 12:52:54 +00:00
|
|
|
return DoUnbind(winid, lastId, eventType,
|
2009-03-18 09:30:08 +00:00
|
|
|
wxMakeEventFunctor(eventType, functor),
|
2009-02-02 20:38:56 +00:00
|
|
|
userData);
|
2009-01-12 14:26:13 +00:00
|
|
|
}
|
|
|
|
|
2009-02-02 20:38:56 +00:00
|
|
|
|
2009-03-29 12:38:53 +00:00
|
|
|
// Bind a method of a class (called on the specified handler which must
|
2009-02-25 17:43:22 +00:00
|
|
|
// be convertible to this class) object to an event:
|
2009-01-12 14:26:13 +00:00
|
|
|
|
2009-03-29 12:38:53 +00:00
|
|
|
template <typename EventTag, typename Class, typename EventArg, typename EventHandler>
|
2009-02-25 17:43:22 +00:00
|
|
|
void Bind(const EventTag &eventType,
|
2009-03-18 09:30:08 +00:00
|
|
|
void (Class::*method)(EventArg &),
|
2009-03-29 12:38:53 +00:00
|
|
|
EventHandler *handler,
|
2009-02-25 17:43:22 +00:00
|
|
|
int winid = wxID_ANY,
|
|
|
|
int lastId = wxID_ANY,
|
|
|
|
wxObject *userData = NULL)
|
2009-02-02 20:38:56 +00:00
|
|
|
{
|
2009-05-02 12:52:54 +00:00
|
|
|
DoBind(winid, lastId, eventType,
|
2009-03-29 12:38:53 +00:00
|
|
|
wxNewEventFunctor(eventType, method, handler),
|
2009-02-02 20:38:56 +00:00
|
|
|
userData);
|
2009-01-12 14:26:13 +00:00
|
|
|
}
|
|
|
|
|
2009-03-29 12:38:53 +00:00
|
|
|
template <typename EventTag, typename Class, typename EventArg, typename EventHandler>
|
2009-02-25 17:43:22 +00:00
|
|
|
bool Unbind(const EventTag &eventType,
|
2009-03-18 09:30:08 +00:00
|
|
|
void (Class::*method)(EventArg&),
|
2009-03-29 12:38:53 +00:00
|
|
|
EventHandler *handler,
|
2009-02-25 17:43:22 +00:00
|
|
|
int winid = wxID_ANY,
|
|
|
|
int lastId = wxID_ANY,
|
|
|
|
wxObject *userData = NULL )
|
2009-02-02 20:38:56 +00:00
|
|
|
{
|
2009-05-02 12:52:54 +00:00
|
|
|
return DoUnbind(winid, lastId, eventType,
|
2009-03-29 12:38:53 +00:00
|
|
|
wxMakeEventFunctor(eventType, method, handler),
|
2009-02-02 20:38:56 +00:00
|
|
|
userData);
|
|
|
|
}
|
2009-05-02 12:52:54 +00:00
|
|
|
#endif // wxHAS_EVENT_BIND
|
2009-01-12 14:26:13 +00:00
|
|
|
|
2003-08-09 08:17:07 +00:00
|
|
|
wxList* GetDynamicEventTable() const { return m_dynamicEvents ; }
|
2001-10-12 03:18:35 +00:00
|
|
|
|
|
|
|
// User data can be associated with each wxEvtHandler
|
|
|
|
void SetClientObject( wxClientData *data ) { DoSetClientObject(data); }
|
|
|
|
wxClientData *GetClientObject() const { return DoGetClientObject(); }
|
|
|
|
|
|
|
|
void SetClientData( void *data ) { DoSetClientData(data); }
|
|
|
|
void *GetClientData() const { return DoGetClientData(); }
|
|
|
|
|
2008-09-22 00:08:28 +00:00
|
|
|
|
|
|
|
// implementation from now on
|
|
|
|
// --------------------------
|
|
|
|
|
2009-01-12 16:51:14 +00:00
|
|
|
// check if the given event table entry matches this event by id (the check
|
|
|
|
// for the event type should be done by caller) and call the handler if it
|
|
|
|
// does
|
2003-09-17 23:35:36 +00:00
|
|
|
//
|
|
|
|
// return true if the event was processed, false otherwise (no match or the
|
|
|
|
// handler decided to skip the event)
|
2009-01-12 16:51:14 +00:00
|
|
|
static bool ProcessEventIfMatchesId(const wxEventTableEntryBase& tableEntry,
|
|
|
|
wxEvtHandler *handler,
|
|
|
|
wxEvent& event);
|
2001-10-12 03:18:35 +00:00
|
|
|
|
1999-10-17 01:18:49 +00:00
|
|
|
virtual bool SearchEventTable(wxEventTable& table, wxEvent& event);
|
1999-02-05 14:26:48 +00:00
|
|
|
bool SearchDynamicEventTable( wxEvent& event );
|
1998-05-20 14:01:55 +00:00
|
|
|
|
2003-09-26 10:50:58 +00:00
|
|
|
// Avoid problems at exit by cleaning up static hash table gracefully
|
|
|
|
void ClearEventHashTable() { GetEventHashTable().Clear(); }
|
2008-01-08 17:57:27 +00:00
|
|
|
void OnSinkDestroyed( wxEvtHandler *sink );
|
2003-09-26 10:50:58 +00:00
|
|
|
|
2008-09-22 00:08:28 +00:00
|
|
|
|
1998-05-20 14:01:55 +00:00
|
|
|
private:
|
2009-05-02 12:52:54 +00:00
|
|
|
void DoBind(int winid,
|
2009-01-12 14:26:13 +00:00
|
|
|
int lastId,
|
|
|
|
wxEventType eventType,
|
|
|
|
wxEventFunctor *func,
|
2009-02-02 20:38:56 +00:00
|
|
|
wxObject* userData = NULL);
|
2009-01-12 14:26:13 +00:00
|
|
|
|
2009-05-02 12:52:54 +00:00
|
|
|
bool DoUnbind(int winid,
|
2009-02-02 20:38:56 +00:00
|
|
|
int lastId,
|
|
|
|
wxEventType eventType,
|
|
|
|
const wxEventFunctor& func,
|
|
|
|
wxObject *userData = NULL);
|
2009-01-12 14:26:13 +00:00
|
|
|
|
1999-10-17 01:18:49 +00:00
|
|
|
static const wxEventTableEntry sm_eventTableEntries[];
|
1999-02-05 14:26:48 +00:00
|
|
|
|
1998-05-20 14:01:55 +00:00
|
|
|
protected:
|
2003-06-26 00:44:55 +00:00
|
|
|
// hooks for wxWindow used by ProcessEvent()
|
|
|
|
// -----------------------------------------
|
|
|
|
|
2009-02-26 16:16:31 +00:00
|
|
|
// this one is called before trying our own event table to allow plugging
|
|
|
|
// in the event handlers overriding the default logic, this is used by e.g.
|
|
|
|
// validators.
|
2009-02-27 10:21:38 +00:00
|
|
|
virtual bool TryBefore(wxEvent& event);
|
2003-06-26 00:44:55 +00:00
|
|
|
|
2010-07-18 11:53:08 +00:00
|
|
|
// This one is not a hook but just a helper which looks up the handler in
|
|
|
|
// this object itself.
|
|
|
|
//
|
|
|
|
// It is called from ProcessEventLocally() and normally shouldn't be called
|
|
|
|
// directly as doing it would ignore any chained event handlers
|
|
|
|
bool TryHereOnly(wxEvent& event);
|
|
|
|
|
|
|
|
// Another helper which simply calls pre-processing hook and then tries to
|
|
|
|
// handle the event at this handler level.
|
|
|
|
bool TryBeforeAndHere(wxEvent& event)
|
|
|
|
{
|
|
|
|
return TryBefore(event) || TryHereOnly(event);
|
|
|
|
}
|
2010-05-09 14:55:46 +00:00
|
|
|
|
2003-06-26 00:44:55 +00:00
|
|
|
// this one is called after failing to find the event handle in our own
|
|
|
|
// table to give a chance to the other windows to process it
|
|
|
|
//
|
|
|
|
// base class implementation passes the event to wxTheApp
|
2009-02-27 10:21:38 +00:00
|
|
|
virtual bool TryAfter(wxEvent& event);
|
2009-02-26 16:16:31 +00:00
|
|
|
|
|
|
|
#ifdef WXWIN_COMPATIBILITY_2_8
|
|
|
|
// deprecated method: override TryBefore() instead of this one
|
|
|
|
wxDEPRECATED_BUT_USED_INTERNALLY_INLINE(
|
|
|
|
virtual bool TryValidator(wxEvent& WXUNUSED(event)), return false; )
|
|
|
|
|
|
|
|
wxDEPRECATED_BUT_USED_INTERNALLY_INLINE(
|
|
|
|
virtual bool TryParent(wxEvent& event), return DoTryApp(event); )
|
|
|
|
#endif // WXWIN_COMPATIBILITY_2_8
|
2003-06-26 00:44:55 +00:00
|
|
|
|
|
|
|
|
2003-09-17 23:35:36 +00:00
|
|
|
static const wxEventTable sm_eventTable;
|
1999-02-23 22:41:37 +00:00
|
|
|
virtual const wxEventTable *GetEventTable() const;
|
|
|
|
|
2003-07-17 23:59:49 +00:00
|
|
|
static wxEventHashTable sm_eventHashTable;
|
|
|
|
virtual wxEventHashTable& GetEventHashTable() const;
|
|
|
|
|
1999-04-19 10:14:51 +00:00
|
|
|
wxEvtHandler* m_nextHandler;
|
|
|
|
wxEvtHandler* m_previousHandler;
|
|
|
|
wxList* m_dynamicEvents;
|
1999-05-19 00:53:27 +00:00
|
|
|
wxList* m_pendingEvents;
|
2001-01-31 16:00:00 +00:00
|
|
|
|
1999-03-27 18:50:54 +00:00
|
|
|
#if wxUSE_THREADS
|
2008-01-05 19:07:52 +00:00
|
|
|
// critical section protecting m_pendingEvents
|
|
|
|
wxCriticalSection m_pendingEventsLock;
|
|
|
|
#endif // wxUSE_THREADS
|
1999-02-23 22:41:37 +00:00
|
|
|
|
1999-10-17 01:18:49 +00:00
|
|
|
// Is event handler enabled?
|
|
|
|
bool m_enabled;
|
2001-01-31 16:00:00 +00:00
|
|
|
|
2001-10-12 03:18:35 +00:00
|
|
|
|
|
|
|
// The user data: either an object which will be deleted by the container
|
|
|
|
// when it's deleted or some raw pointer which we do nothing with - only
|
|
|
|
// one type of data can be used with the given window (i.e. you cannot set
|
|
|
|
// the void data and then associate the container with wxClientData or vice
|
|
|
|
// versa)
|
|
|
|
union
|
|
|
|
{
|
|
|
|
wxClientData *m_clientObject;
|
|
|
|
void *m_clientData;
|
|
|
|
};
|
|
|
|
|
|
|
|
// what kind of data do we have?
|
|
|
|
wxClientDataType m_clientDataType;
|
|
|
|
|
|
|
|
// client data accessors
|
|
|
|
virtual void DoSetClientObject( wxClientData *data );
|
|
|
|
virtual wxClientData *DoGetClientObject() const;
|
|
|
|
|
|
|
|
virtual void DoSetClientData( void *data );
|
|
|
|
virtual void *DoGetClientData() const;
|
|
|
|
|
2008-01-08 17:57:27 +00:00
|
|
|
// Search tracker objects for event connection with this sink
|
2009-03-29 12:38:53 +00:00
|
|
|
wxEventConnectionRef *FindRefInTrackerList(wxEvtHandler *handler);
|
2008-01-08 17:57:27 +00:00
|
|
|
|
2001-01-31 16:00:00 +00:00
|
|
|
private:
|
2009-02-26 16:16:31 +00:00
|
|
|
// pass the event to wxTheApp instance, called from TryAfter()
|
|
|
|
bool DoTryApp(wxEvent& event);
|
|
|
|
|
2010-05-09 14:55:28 +00:00
|
|
|
// try to process events in all handlers chained to this one
|
|
|
|
bool DoTryChain(wxEvent& event);
|
|
|
|
|
2003-07-22 00:24:07 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_COPY(wxEvtHandler)
|
1998-05-20 14:01:55 +00:00
|
|
|
};
|
|
|
|
|
2009-02-25 21:12:47 +00:00
|
|
|
WX_DEFINE_ARRAY_WITH_DECL_PTR(wxEvtHandler *, wxEvtHandlerArray, class WXDLLIMPEXP_BASE);
|
2009-02-04 17:42:28 +00:00
|
|
|
|
2010-09-27 12:55:22 +00:00
|
|
|
|
|
|
|
// Define an inline method of wxObjectEventFunctor which couldn't be defined
|
|
|
|
// before wxEvtHandler declaration: at least Sun CC refuses to compile function
|
|
|
|
// calls through pointer to member for forward-declared classes (see #12452).
|
|
|
|
inline void wxObjectEventFunctor::operator()(wxEvtHandler *handler, wxEvent& event)
|
|
|
|
{
|
|
|
|
wxEvtHandler * const realHandler = m_handler ? m_handler : handler;
|
|
|
|
|
|
|
|
(realHandler->*m_method)(event);
|
|
|
|
}
|
|
|
|
|
2008-01-13 01:12:13 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// wxEventConnectionRef represents all connections between two event handlers
|
|
|
|
// and enables automatic disconnect when an event handler sink goes out of
|
|
|
|
// scope. Each connection/disconnect increases/decreases ref count, and
|
|
|
|
// when it reaches zero the node goes out of scope.
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class wxEventConnectionRef : public wxTrackerNode
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxEventConnectionRef() : m_src(NULL), m_sink(NULL), m_refCount(0) { }
|
|
|
|
wxEventConnectionRef(wxEvtHandler *src, wxEvtHandler *sink)
|
|
|
|
: m_src(src), m_sink(sink), m_refCount(1)
|
|
|
|
{
|
|
|
|
m_sink->AddNode(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
// The sink is being destroyed
|
|
|
|
virtual void OnObjectDestroy( )
|
|
|
|
{
|
|
|
|
if ( m_src )
|
|
|
|
m_src->OnSinkDestroyed( m_sink );
|
|
|
|
delete this;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual wxEventConnectionRef *ToEventConnection() { return this; }
|
|
|
|
|
|
|
|
void IncRef() { m_refCount++; }
|
|
|
|
void DecRef()
|
|
|
|
{
|
|
|
|
if ( !--m_refCount )
|
|
|
|
{
|
|
|
|
// The sink holds the only external pointer to this object
|
|
|
|
if ( m_sink )
|
|
|
|
m_sink->RemoveNode(this);
|
|
|
|
delete this;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
wxEvtHandler *m_src,
|
|
|
|
*m_sink;
|
|
|
|
int m_refCount;
|
|
|
|
|
|
|
|
friend class wxEvtHandler;
|
|
|
|
|
2009-02-08 11:45:59 +00:00
|
|
|
wxDECLARE_NO_ASSIGN_CLASS(wxEventConnectionRef);
|
2008-01-13 01:12:13 +00:00
|
|
|
};
|
|
|
|
|
2008-04-28 18:49:42 +00:00
|
|
|
// Post a message to the given event handler which will be processed during the
|
|
|
|
// next event loop iteration.
|
|
|
|
//
|
|
|
|
// Notice that this one is not thread-safe, use wxQueueEvent()
|
2007-06-21 21:56:50 +00:00
|
|
|
inline void wxPostEvent(wxEvtHandler *dest, const wxEvent& event)
|
2003-06-24 00:56:19 +00:00
|
|
|
{
|
2008-04-28 18:49:42 +00:00
|
|
|
wxCHECK_RET( dest, "need an object to post event to" );
|
2003-06-24 00:56:19 +00:00
|
|
|
|
|
|
|
dest->AddPendingEvent(event);
|
|
|
|
}
|
|
|
|
|
2008-04-28 18:49:42 +00:00
|
|
|
// Wrapper around wxEvtHandler::QueueEvent(): adds an event for later
|
|
|
|
// processing, unlike wxPostEvent it is safe to use from different thread even
|
|
|
|
// for events with wxString members
|
|
|
|
inline void wxQueueEvent(wxEvtHandler *dest, wxEvent *event)
|
|
|
|
{
|
|
|
|
wxCHECK_RET( dest, "need an object to queue event for" );
|
|
|
|
|
|
|
|
dest->QueueEvent(event);
|
|
|
|
}
|
|
|
|
|
2005-06-21 09:56:18 +00:00
|
|
|
typedef void (wxEvtHandler::*wxEventFunction)(wxEvent&);
|
2008-02-03 14:08:01 +00:00
|
|
|
typedef void (wxEvtHandler::*wxIdleEventFunction)(wxIdleEvent&);
|
2005-06-21 09:56:18 +00:00
|
|
|
|
2005-02-14 23:53:48 +00:00
|
|
|
#define wxEventHandler(func) \
|
2009-01-12 14:26:13 +00:00
|
|
|
wxEVENT_HANDLER_CAST(wxEventFunction, func)
|
2008-02-03 14:08:01 +00:00
|
|
|
#define wxIdleEventHandler(func) \
|
2009-01-12 14:26:13 +00:00
|
|
|
wxEVENT_HANDLER_CAST(wxIdleEventFunction, func)
|
2005-02-14 23:53:48 +00:00
|
|
|
|
1999-10-04 20:15:38 +00:00
|
|
|
#if wxUSE_GUI
|
2005-02-14 23:53:48 +00:00
|
|
|
|
2007-02-04 00:12:50 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// wxEventBlocker: helper class to temporarily disable event handling for a window
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2007-02-05 18:19:32 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxEventBlocker : public wxEvtHandler
|
2007-02-04 00:12:50 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxEventBlocker(wxWindow *win, wxEventType type = wxEVT_ANY);
|
|
|
|
virtual ~wxEventBlocker();
|
|
|
|
|
|
|
|
void Block(wxEventType type)
|
|
|
|
{
|
|
|
|
m_eventsToBlock.push_back(type);
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual bool ProcessEvent(wxEvent& event);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
wxArrayInt m_eventsToBlock;
|
|
|
|
wxWindow *m_window;
|
|
|
|
|
2009-02-08 11:45:59 +00:00
|
|
|
wxDECLARE_NO_COPY_CLASS(wxEventBlocker);
|
2007-02-04 00:12:50 +00:00
|
|
|
};
|
|
|
|
|
1998-05-20 14:01:55 +00:00
|
|
|
typedef void (wxEvtHandler::*wxCommandEventFunction)(wxCommandEvent&);
|
2009-02-04 17:42:28 +00:00
|
|
|
typedef void (wxEvtHandler::*wxThreadEventFunction)(wxThreadEvent&);
|
1998-05-20 14:01:55 +00:00
|
|
|
typedef void (wxEvtHandler::*wxScrollEventFunction)(wxScrollEvent&);
|
1999-05-17 19:17:28 +00:00
|
|
|
typedef void (wxEvtHandler::*wxScrollWinEventFunction)(wxScrollWinEvent&);
|
1998-05-20 14:01:55 +00:00
|
|
|
typedef void (wxEvtHandler::*wxSizeEventFunction)(wxSizeEvent&);
|
|
|
|
typedef void (wxEvtHandler::*wxMoveEventFunction)(wxMoveEvent&);
|
|
|
|
typedef void (wxEvtHandler::*wxPaintEventFunction)(wxPaintEvent&);
|
2004-02-11 00:18:21 +00:00
|
|
|
typedef void (wxEvtHandler::*wxNcPaintEventFunction)(wxNcPaintEvent&);
|
1998-05-20 14:01:55 +00:00
|
|
|
typedef void (wxEvtHandler::*wxEraseEventFunction)(wxEraseEvent&);
|
|
|
|
typedef void (wxEvtHandler::*wxMouseEventFunction)(wxMouseEvent&);
|
|
|
|
typedef void (wxEvtHandler::*wxCharEventFunction)(wxKeyEvent&);
|
|
|
|
typedef void (wxEvtHandler::*wxFocusEventFunction)(wxFocusEvent&);
|
2001-08-06 00:49:59 +00:00
|
|
|
typedef void (wxEvtHandler::*wxChildFocusEventFunction)(wxChildFocusEvent&);
|
1998-05-20 14:01:55 +00:00
|
|
|
typedef void (wxEvtHandler::*wxActivateEventFunction)(wxActivateEvent&);
|
|
|
|
typedef void (wxEvtHandler::*wxMenuEventFunction)(wxMenuEvent&);
|
|
|
|
typedef void (wxEvtHandler::*wxJoystickEventFunction)(wxJoystickEvent&);
|
|
|
|
typedef void (wxEvtHandler::*wxDropFilesEventFunction)(wxDropFilesEvent&);
|
|
|
|
typedef void (wxEvtHandler::*wxInitDialogEventFunction)(wxInitDialogEvent&);
|
2005-02-14 23:53:48 +00:00
|
|
|
typedef void (wxEvtHandler::*wxSysColourChangedEventFunction)(wxSysColourChangedEvent&);
|
|
|
|
typedef void (wxEvtHandler::*wxDisplayChangedEventFunction)(wxDisplayChangedEvent&);
|
1998-05-20 14:01:55 +00:00
|
|
|
typedef void (wxEvtHandler::*wxUpdateUIEventFunction)(wxUpdateUIEvent&);
|
|
|
|
typedef void (wxEvtHandler::*wxCloseEventFunction)(wxCloseEvent&);
|
|
|
|
typedef void (wxEvtHandler::*wxShowEventFunction)(wxShowEvent&);
|
2002-08-11 20:11:01 +00:00
|
|
|
typedef void (wxEvtHandler::*wxIconizeEventFunction)(wxIconizeEvent&);
|
2002-08-12 11:10:28 +00:00
|
|
|
typedef void (wxEvtHandler::*wxMaximizeEventFunction)(wxMaximizeEvent&);
|
1998-07-27 09:47:57 +00:00
|
|
|
typedef void (wxEvtHandler::*wxNavigationKeyEventFunction)(wxNavigationKeyEvent&);
|
1998-07-29 06:51:33 +00:00
|
|
|
typedef void (wxEvtHandler::*wxPaletteChangedEventFunction)(wxPaletteChangedEvent&);
|
|
|
|
typedef void (wxEvtHandler::*wxQueryNewPaletteEventFunction)(wxQueryNewPaletteEvent&);
|
2000-03-14 00:45:54 +00:00
|
|
|
typedef void (wxEvtHandler::*wxWindowCreateEventFunction)(wxWindowCreateEvent&);
|
|
|
|
typedef void (wxEvtHandler::*wxWindowDestroyEventFunction)(wxWindowDestroyEvent&);
|
|
|
|
typedef void (wxEvtHandler::*wxSetCursorEventFunction)(wxSetCursorEvent&);
|
2000-03-15 18:52:23 +00:00
|
|
|
typedef void (wxEvtHandler::*wxNotifyEventFunction)(wxNotifyEvent&);
|
2000-09-06 09:45:24 +00:00
|
|
|
typedef void (wxEvtHandler::*wxHelpEventFunction)(wxHelpEvent&);
|
2001-05-16 11:32:21 +00:00
|
|
|
typedef void (wxEvtHandler::*wxContextMenuEventFunction)(wxContextMenuEvent&);
|
2002-04-12 20:26:43 +00:00
|
|
|
typedef void (wxEvtHandler::*wxMouseCaptureChangedEventFunction)(wxMouseCaptureChangedEvent&);
|
2006-07-31 09:27:54 +00:00
|
|
|
typedef void (wxEvtHandler::*wxMouseCaptureLostEventFunction)(wxMouseCaptureLostEvent&);
|
2006-05-12 15:21:41 +00:00
|
|
|
typedef void (wxEvtHandler::*wxClipboardTextEventFunction)(wxClipboardTextEvent&);
|
2005-02-14 23:53:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
#define wxCommandEventHandler(func) \
|
2009-01-12 14:26:13 +00:00
|
|
|
wxEVENT_HANDLER_CAST(wxCommandEventFunction, func)
|
2009-02-04 17:42:28 +00:00
|
|
|
#define wxThreadEventHandler(func) \
|
|
|
|
wxEVENT_HANDLER_CAST(wxThreadEventFunction, func)
|
2005-02-14 23:53:48 +00:00
|
|
|
#define wxScrollEventHandler(func) \
|
2009-01-12 14:26:13 +00:00
|
|
|
wxEVENT_HANDLER_CAST(wxScrollEventFunction, func)
|
2005-02-14 23:53:48 +00:00
|
|
|
#define wxScrollWinEventHandler(func) \
|
2009-01-12 14:26:13 +00:00
|
|
|
wxEVENT_HANDLER_CAST(wxScrollWinEventFunction, func)
|
2005-02-14 23:53:48 +00:00
|
|
|
#define wxSizeEventHandler(func) \
|
2009-01-12 14:26:13 +00:00
|
|
|
wxEVENT_HANDLER_CAST(wxSizeEventFunction, func)
|
2005-02-14 23:53:48 +00:00
|
|
|
#define wxMoveEventHandler(func) \
|
2009-01-12 14:26:13 +00:00
|
|
|
wxEVENT_HANDLER_CAST(wxMoveEventFunction, func)
|
2005-02-14 23:53:48 +00:00
|
|
|
#define wxPaintEventHandler(func) \
|
2009-01-12 14:26:13 +00:00
|
|
|
wxEVENT_HANDLER_CAST(wxPaintEventFunction, func)
|
2005-02-14 23:53:48 +00:00
|
|
|
#define wxNcPaintEventHandler(func) \
|
2009-01-12 14:26:13 +00:00
|
|
|
wxEVENT_HANDLER_CAST(wxNcPaintEventFunction, func)
|
2005-02-14 23:53:48 +00:00
|
|
|
#define wxEraseEventHandler(func) \
|
2009-01-12 14:26:13 +00:00
|
|
|
wxEVENT_HANDLER_CAST(wxEraseEventFunction, func)
|
2005-02-14 23:53:48 +00:00
|
|
|
#define wxMouseEventHandler(func) \
|
2009-01-12 14:26:13 +00:00
|
|
|
wxEVENT_HANDLER_CAST(wxMouseEventFunction, func)
|
2005-02-14 23:53:48 +00:00
|
|
|
#define wxCharEventHandler(func) \
|
2009-01-12 14:26:13 +00:00
|
|
|
wxEVENT_HANDLER_CAST(wxCharEventFunction, func)
|
2005-02-14 23:53:48 +00:00
|
|
|
#define wxKeyEventHandler(func) wxCharEventHandler(func)
|
|
|
|
#define wxFocusEventHandler(func) \
|
2009-01-12 14:26:13 +00:00
|
|
|
wxEVENT_HANDLER_CAST(wxFocusEventFunction, func)
|
2005-02-14 23:53:48 +00:00
|
|
|
#define wxChildFocusEventHandler(func) \
|
2009-01-12 14:26:13 +00:00
|
|
|
wxEVENT_HANDLER_CAST(wxChildFocusEventFunction, func)
|
2005-02-14 23:53:48 +00:00
|
|
|
#define wxActivateEventHandler(func) \
|
2009-01-12 14:26:13 +00:00
|
|
|
wxEVENT_HANDLER_CAST(wxActivateEventFunction, func)
|
2005-02-14 23:53:48 +00:00
|
|
|
#define wxMenuEventHandler(func) \
|
2009-01-12 14:26:13 +00:00
|
|
|
wxEVENT_HANDLER_CAST(wxMenuEventFunction, func)
|
2005-02-14 23:53:48 +00:00
|
|
|
#define wxJoystickEventHandler(func) \
|
2009-01-12 14:26:13 +00:00
|
|
|
wxEVENT_HANDLER_CAST(wxJoystickEventFunction, func)
|
2005-02-14 23:53:48 +00:00
|
|
|
#define wxDropFilesEventHandler(func) \
|
2009-01-12 14:26:13 +00:00
|
|
|
wxEVENT_HANDLER_CAST(wxDropFilesEventFunction, func)
|
2005-02-14 23:53:48 +00:00
|
|
|
#define wxInitDialogEventHandler(func) \
|
2009-01-12 14:26:13 +00:00
|
|
|
wxEVENT_HANDLER_CAST(wxInitDialogEventFunction, func)
|
2005-02-14 23:53:48 +00:00
|
|
|
#define wxSysColourChangedEventHandler(func) \
|
2009-01-12 14:26:13 +00:00
|
|
|
wxEVENT_HANDLER_CAST(wxSysColourChangedEventFunction, func)
|
2005-02-14 23:53:48 +00:00
|
|
|
#define wxDisplayChangedEventHandler(func) \
|
2009-01-12 14:26:13 +00:00
|
|
|
wxEVENT_HANDLER_CAST(wxDisplayChangedEventFunction, func)
|
2005-02-14 23:53:48 +00:00
|
|
|
#define wxUpdateUIEventHandler(func) \
|
2009-01-12 14:26:13 +00:00
|
|
|
wxEVENT_HANDLER_CAST(wxUpdateUIEventFunction, func)
|
2005-02-14 23:53:48 +00:00
|
|
|
#define wxCloseEventHandler(func) \
|
2009-01-12 14:26:13 +00:00
|
|
|
wxEVENT_HANDLER_CAST(wxCloseEventFunction, func)
|
2005-02-14 23:53:48 +00:00
|
|
|
#define wxShowEventHandler(func) \
|
2009-01-12 14:26:13 +00:00
|
|
|
wxEVENT_HANDLER_CAST(wxShowEventFunction, func)
|
2005-02-14 23:53:48 +00:00
|
|
|
#define wxIconizeEventHandler(func) \
|
2009-01-12 14:26:13 +00:00
|
|
|
wxEVENT_HANDLER_CAST(wxIconizeEventFunction, func)
|
2005-02-14 23:53:48 +00:00
|
|
|
#define wxMaximizeEventHandler(func) \
|
2009-01-12 14:26:13 +00:00
|
|
|
wxEVENT_HANDLER_CAST(wxMaximizeEventFunction, func)
|
2005-02-14 23:53:48 +00:00
|
|
|
#define wxNavigationKeyEventHandler(func) \
|
2009-01-12 14:26:13 +00:00
|
|
|
wxEVENT_HANDLER_CAST(wxNavigationKeyEventFunction, func)
|
2005-02-14 23:53:48 +00:00
|
|
|
#define wxPaletteChangedEventHandler(func) \
|
2009-01-12 14:26:13 +00:00
|
|
|
wxEVENT_HANDLER_CAST(wxPaletteChangedEventFunction, func)
|
2005-02-14 23:53:48 +00:00
|
|
|
#define wxQueryNewPaletteEventHandler(func) \
|
2009-01-12 14:26:13 +00:00
|
|
|
wxEVENT_HANDLER_CAST(wxQueryNewPaletteEventFunction, func)
|
2005-02-14 23:53:48 +00:00
|
|
|
#define wxWindowCreateEventHandler(func) \
|
2009-01-12 14:26:13 +00:00
|
|
|
wxEVENT_HANDLER_CAST(wxWindowCreateEventFunction, func)
|
2005-02-14 23:53:48 +00:00
|
|
|
#define wxWindowDestroyEventHandler(func) \
|
2009-01-12 14:26:13 +00:00
|
|
|
wxEVENT_HANDLER_CAST(wxWindowDestroyEventFunction, func)
|
2005-02-14 23:53:48 +00:00
|
|
|
#define wxSetCursorEventHandler(func) \
|
2009-01-12 14:26:13 +00:00
|
|
|
wxEVENT_HANDLER_CAST(wxSetCursorEventFunction, func)
|
2005-02-14 23:53:48 +00:00
|
|
|
#define wxNotifyEventHandler(func) \
|
2009-01-12 14:26:13 +00:00
|
|
|
wxEVENT_HANDLER_CAST(wxNotifyEventFunction, func)
|
2005-02-14 23:53:48 +00:00
|
|
|
#define wxHelpEventHandler(func) \
|
2009-01-12 14:26:13 +00:00
|
|
|
wxEVENT_HANDLER_CAST(wxHelpEventFunction, func)
|
2005-02-14 23:53:48 +00:00
|
|
|
#define wxContextMenuEventHandler(func) \
|
2009-01-12 14:26:13 +00:00
|
|
|
wxEVENT_HANDLER_CAST(wxContextMenuEventFunction, func)
|
2005-02-14 23:53:48 +00:00
|
|
|
#define wxMouseCaptureChangedEventHandler(func) \
|
2009-01-12 14:26:13 +00:00
|
|
|
wxEVENT_HANDLER_CAST(wxMouseCaptureChangedEventFunction, func)
|
2006-07-31 09:27:54 +00:00
|
|
|
#define wxMouseCaptureLostEventHandler(func) \
|
2009-01-12 14:26:13 +00:00
|
|
|
wxEVENT_HANDLER_CAST(wxMouseCaptureLostEventFunction, func)
|
2006-05-12 15:21:41 +00:00
|
|
|
#define wxClipboardTextEventHandler(func) \
|
2009-01-12 14:26:13 +00:00
|
|
|
wxEVENT_HANDLER_CAST(wxClipboardTextEventFunction, func)
|
2005-02-14 23:53:48 +00:00
|
|
|
|
1999-10-04 20:15:38 +00:00
|
|
|
#endif // wxUSE_GUI
|
1998-05-20 14:01:55 +00:00
|
|
|
|
|
|
|
// N.B. In GNU-WIN32, you *have* to take the address of a member function
|
|
|
|
// (use &) or the compiler crashes...
|
|
|
|
|
2010-06-09 14:28:08 +00:00
|
|
|
#define wxDECLARE_EVENT_TABLE() \
|
|
|
|
private: \
|
|
|
|
static const wxEventTableEntry sm_eventTableEntries[]; \
|
|
|
|
protected: \
|
|
|
|
static const wxEventTable sm_eventTable; \
|
|
|
|
virtual const wxEventTable* GetEventTable() const; \
|
|
|
|
static wxEventHashTable sm_eventHashTable; \
|
|
|
|
virtual wxEventHashTable& GetEventHashTable() const
|
1998-05-20 14:01:55 +00:00
|
|
|
|
2003-07-03 16:43:16 +00:00
|
|
|
// N.B.: when building DLL with Borland C++ 5.5 compiler, you must initialize
|
|
|
|
// sm_eventTable before using it in GetEventTable() or the compiler gives
|
|
|
|
// E2233 (see http://groups.google.com/groups?selm=397dcc8a%241_2%40dnews)
|
2003-07-17 23:59:49 +00:00
|
|
|
|
2010-06-09 14:28:08 +00:00
|
|
|
#define wxBEGIN_EVENT_TABLE(theClass, baseClass) \
|
2001-01-31 17:16:40 +00:00
|
|
|
const wxEventTable theClass::sm_eventTable = \
|
|
|
|
{ &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \
|
2003-07-03 16:43:16 +00:00
|
|
|
const wxEventTable *theClass::GetEventTable() const \
|
|
|
|
{ return &theClass::sm_eventTable; } \
|
2003-07-17 23:59:49 +00:00
|
|
|
wxEventHashTable theClass::sm_eventHashTable(theClass::sm_eventTable); \
|
|
|
|
wxEventHashTable &theClass::GetEventHashTable() const \
|
|
|
|
{ return theClass::sm_eventHashTable; } \
|
2001-01-31 17:16:40 +00:00
|
|
|
const wxEventTableEntry theClass::sm_eventTableEntries[] = { \
|
1998-05-20 14:01:55 +00:00
|
|
|
|
2010-06-09 14:28:08 +00:00
|
|
|
#define wxBEGIN_EVENT_TABLE_TEMPLATE1(theClass, baseClass, T1) \
|
2006-01-19 09:42:54 +00:00
|
|
|
template<typename T1> \
|
|
|
|
const wxEventTable theClass<T1>::sm_eventTable = \
|
|
|
|
{ &baseClass::sm_eventTable, &theClass<T1>::sm_eventTableEntries[0] }; \
|
|
|
|
template<typename T1> \
|
|
|
|
const wxEventTable *theClass<T1>::GetEventTable() const \
|
|
|
|
{ return &theClass<T1>::sm_eventTable; } \
|
|
|
|
template<typename T1> \
|
|
|
|
wxEventHashTable theClass<T1>::sm_eventHashTable(theClass<T1>::sm_eventTable); \
|
|
|
|
template<typename T1> \
|
|
|
|
wxEventHashTable &theClass<T1>::GetEventHashTable() const \
|
|
|
|
{ return theClass<T1>::sm_eventHashTable; } \
|
|
|
|
template<typename T1> \
|
|
|
|
const wxEventTableEntry theClass<T1>::sm_eventTableEntries[] = { \
|
|
|
|
|
2010-06-09 14:28:08 +00:00
|
|
|
#define wxBEGIN_EVENT_TABLE_TEMPLATE2(theClass, baseClass, T1, T2) \
|
2006-01-19 09:42:54 +00:00
|
|
|
template<typename T1, typename T2> \
|
|
|
|
const wxEventTable theClass<T1, T2>::sm_eventTable = \
|
|
|
|
{ &baseClass::sm_eventTable, &theClass<T1, T2>::sm_eventTableEntries[0] }; \
|
|
|
|
template<typename T1, typename T2> \
|
|
|
|
const wxEventTable *theClass<T1, T2>::GetEventTable() const \
|
|
|
|
{ return &theClass<T1, T2>::sm_eventTable; } \
|
|
|
|
template<typename T1, typename T2> \
|
|
|
|
wxEventHashTable theClass<T1, T2>::sm_eventHashTable(theClass<T1, T2>::sm_eventTable); \
|
|
|
|
template<typename T1, typename T2> \
|
|
|
|
wxEventHashTable &theClass<T1, T2>::GetEventHashTable() const \
|
|
|
|
{ return theClass<T1, T2>::sm_eventHashTable; } \
|
|
|
|
template<typename T1, typename T2> \
|
|
|
|
const wxEventTableEntry theClass<T1, T2>::sm_eventTableEntries[] = { \
|
|
|
|
|
2010-06-09 14:28:08 +00:00
|
|
|
#define wxBEGIN_EVENT_TABLE_TEMPLATE3(theClass, baseClass, T1, T2, T3) \
|
2006-01-19 09:42:54 +00:00
|
|
|
template<typename T1, typename T2, typename T3> \
|
|
|
|
const wxEventTable theClass<T1, T2, T3>::sm_eventTable = \
|
|
|
|
{ &baseClass::sm_eventTable, &theClass<T1, T2, T3>::sm_eventTableEntries[0] }; \
|
|
|
|
template<typename T1, typename T2, typename T3> \
|
|
|
|
const wxEventTable *theClass<T1, T2, T3>::GetEventTable() const \
|
|
|
|
{ return &theClass<T1, T2, T3>::sm_eventTable; } \
|
|
|
|
template<typename T1, typename T2, typename T3> \
|
|
|
|
wxEventHashTable theClass<T1, T2, T3>::sm_eventHashTable(theClass<T1, T2, T3>::sm_eventTable); \
|
|
|
|
template<typename T1, typename T2, typename T3> \
|
|
|
|
wxEventHashTable &theClass<T1, T2, T3>::GetEventHashTable() const \
|
|
|
|
{ return theClass<T1, T2, T3>::sm_eventHashTable; } \
|
|
|
|
template<typename T1, typename T2, typename T3> \
|
|
|
|
const wxEventTableEntry theClass<T1, T2, T3>::sm_eventTableEntries[] = { \
|
|
|
|
|
2010-06-09 14:28:08 +00:00
|
|
|
#define wxBEGIN_EVENT_TABLE_TEMPLATE4(theClass, baseClass, T1, T2, T3, T4) \
|
2006-01-19 09:42:54 +00:00
|
|
|
template<typename T1, typename T2, typename T3, typename T4> \
|
|
|
|
const wxEventTable theClass<T1, T2, T3, T4>::sm_eventTable = \
|
|
|
|
{ &baseClass::sm_eventTable, &theClass<T1, T2, T3, T4>::sm_eventTableEntries[0] }; \
|
|
|
|
template<typename T1, typename T2, typename T3, typename T4> \
|
|
|
|
const wxEventTable *theClass<T1, T2, T3, T4>::GetEventTable() const \
|
|
|
|
{ return &theClass<T1, T2, T3, T4>::sm_eventTable; } \
|
|
|
|
template<typename T1, typename T2, typename T3, typename T4> \
|
|
|
|
wxEventHashTable theClass<T1, T2, T3, T4>::sm_eventHashTable(theClass<T1, T2, T3, T4>::sm_eventTable); \
|
|
|
|
template<typename T1, typename T2, typename T3, typename T4> \
|
|
|
|
wxEventHashTable &theClass<T1, T2, T3, T4>::GetEventHashTable() const \
|
|
|
|
{ return theClass<T1, T2, T3, T4>::sm_eventHashTable; } \
|
|
|
|
template<typename T1, typename T2, typename T3, typename T4> \
|
|
|
|
const wxEventTableEntry theClass<T1, T2, T3, T4>::sm_eventTableEntries[] = { \
|
|
|
|
|
2010-06-09 14:28:08 +00:00
|
|
|
#define wxBEGIN_EVENT_TABLE_TEMPLATE5(theClass, baseClass, T1, T2, T3, T4, T5) \
|
2006-01-19 09:42:54 +00:00
|
|
|
template<typename T1, typename T2, typename T3, typename T4, typename T5> \
|
|
|
|
const wxEventTable theClass<T1, T2, T3, T4, T5>::sm_eventTable = \
|
|
|
|
{ &baseClass::sm_eventTable, &theClass<T1, T2, T3, T4, T5>::sm_eventTableEntries[0] }; \
|
|
|
|
template<typename T1, typename T2, typename T3, typename T4, typename T5> \
|
|
|
|
const wxEventTable *theClass<T1, T2, T3, T4, T5>::GetEventTable() const \
|
|
|
|
{ return &theClass<T1, T2, T3, T4, T5>::sm_eventTable; } \
|
|
|
|
template<typename T1, typename T2, typename T3, typename T4, typename T5> \
|
|
|
|
wxEventHashTable theClass<T1, T2, T3, T4, T5>::sm_eventHashTable(theClass<T1, T2, T3, T4, T5>::sm_eventTable); \
|
|
|
|
template<typename T1, typename T2, typename T3, typename T4, typename T5> \
|
|
|
|
wxEventHashTable &theClass<T1, T2, T3, T4, T5>::GetEventHashTable() const \
|
|
|
|
{ return theClass<T1, T2, T3, T4, T5>::sm_eventHashTable; } \
|
|
|
|
template<typename T1, typename T2, typename T3, typename T4, typename T5> \
|
|
|
|
const wxEventTableEntry theClass<T1, T2, T3, T4, T5>::sm_eventTableEntries[] = { \
|
|
|
|
|
2010-06-09 14:28:08 +00:00
|
|
|
#define wxBEGIN_EVENT_TABLE_TEMPLATE7(theClass, baseClass, T1, T2, T3, T4, T5, T6, T7) \
|
2006-01-19 09:42:54 +00:00
|
|
|
template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> \
|
|
|
|
const wxEventTable theClass<T1, T2, T3, T4, T5, T6, T7>::sm_eventTable = \
|
|
|
|
{ &baseClass::sm_eventTable, &theClass<T1, T2, T3, T4, T5, T6, T7>::sm_eventTableEntries[0] }; \
|
|
|
|
template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> \
|
|
|
|
const wxEventTable *theClass<T1, T2, T3, T4, T5, T6, T7>::GetEventTable() const \
|
|
|
|
{ return &theClass<T1, T2, T3, T4, T5, T6, T7>::sm_eventTable; } \
|
|
|
|
template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> \
|
|
|
|
wxEventHashTable theClass<T1, T2, T3, T4, T5, T6, T7>::sm_eventHashTable(theClass<T1, T2, T3, T4, T5, T6, T7>::sm_eventTable); \
|
|
|
|
template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> \
|
|
|
|
wxEventHashTable &theClass<T1, T2, T3, T4, T5, T6, T7>::GetEventHashTable() const \
|
|
|
|
{ return theClass<T1, T2, T3, T4, T5, T6, T7>::sm_eventHashTable; } \
|
|
|
|
template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> \
|
|
|
|
const wxEventTableEntry theClass<T1, T2, T3, T4, T5, T6, T7>::sm_eventTableEntries[] = { \
|
|
|
|
|
2010-06-09 14:28:08 +00:00
|
|
|
#define wxBEGIN_EVENT_TABLE_TEMPLATE8(theClass, baseClass, T1, T2, T3, T4, T5, T6, T7, T8) \
|
2006-01-19 09:42:54 +00:00
|
|
|
template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> \
|
|
|
|
const wxEventTable theClass<T1, T2, T3, T4, T5, T6, T7, T8>::sm_eventTable = \
|
|
|
|
{ &baseClass::sm_eventTable, &theClass<T1, T2, T3, T4, T5, T6, T7, T8>::sm_eventTableEntries[0] }; \
|
|
|
|
template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> \
|
|
|
|
const wxEventTable *theClass<T1, T2, T3, T4, T5, T6, T7, T8>::GetEventTable() const \
|
|
|
|
{ return &theClass<T1, T2, T3, T4, T5, T6, T7, T8>::sm_eventTable; } \
|
|
|
|
template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> \
|
|
|
|
wxEventHashTable theClass<T1, T2, T3, T4, T5, T6, T7, T8>::sm_eventHashTable(theClass<T1, T2, T3, T4, T5, T6, T7, T8>::sm_eventTable); \
|
|
|
|
template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> \
|
|
|
|
wxEventHashTable &theClass<T1, T2, T3, T4, T5, T6, T7, T8>::GetEventHashTable() const \
|
|
|
|
{ return theClass<T1, T2, T3, T4, T5, T6, T7, T8>::sm_eventHashTable; } \
|
|
|
|
template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> \
|
|
|
|
const wxEventTableEntry theClass<T1, T2, T3, T4, T5, T6, T7, T8>::sm_eventTableEntries[] = { \
|
|
|
|
|
2010-06-09 14:28:08 +00:00
|
|
|
#define wxEND_EVENT_TABLE() \
|
|
|
|
wxDECLARE_EVENT_TABLE_TERMINATOR() };
|
1999-02-05 14:26:48 +00:00
|
|
|
|
1998-05-20 14:01:55 +00:00
|
|
|
/*
|
|
|
|
* Event table macros
|
|
|
|
*/
|
|
|
|
|
2005-02-14 23:53:48 +00:00
|
|
|
// helpers for writing shorter code below: declare an event macro taking 2, 1
|
|
|
|
// or none ids (the missing ids default to wxID_ANY)
|
|
|
|
//
|
|
|
|
// macro arguments:
|
|
|
|
// - evt one of wxEVT_XXX constants
|
|
|
|
// - id1, id2 ids of the first/last id
|
|
|
|
// - fn the function (should be cast to the right type)
|
|
|
|
#define wx__DECLARE_EVT2(evt, id1, id2, fn) \
|
2010-06-09 14:28:08 +00:00
|
|
|
wxDECLARE_EVENT_TABLE_ENTRY(evt, id1, id2, fn, NULL),
|
2005-02-14 23:53:48 +00:00
|
|
|
#define wx__DECLARE_EVT1(evt, id, fn) \
|
|
|
|
wx__DECLARE_EVT2(evt, id, wxID_ANY, fn)
|
|
|
|
#define wx__DECLARE_EVT0(evt, fn) \
|
|
|
|
wx__DECLARE_EVT1(evt, wxID_ANY, fn)
|
|
|
|
|
|
|
|
|
1998-05-20 14:01:55 +00:00
|
|
|
// Generic events
|
2005-02-14 23:53:48 +00:00
|
|
|
#define EVT_CUSTOM(event, winid, func) \
|
|
|
|
wx__DECLARE_EVT1(event, winid, wxEventHandler(func))
|
|
|
|
#define EVT_CUSTOM_RANGE(event, id1, id2, func) \
|
|
|
|
wx__DECLARE_EVT2(event, id1, id2, wxEventHandler(func))
|
1998-05-20 14:01:55 +00:00
|
|
|
|
2004-12-05 16:30:54 +00:00
|
|
|
// EVT_COMMAND
|
2005-02-17 16:56:35 +00:00
|
|
|
#define EVT_COMMAND(winid, event, func) \
|
2005-02-14 23:53:48 +00:00
|
|
|
wx__DECLARE_EVT1(event, winid, wxCommandEventHandler(func))
|
2009-01-12 14:26:13 +00:00
|
|
|
|
2005-02-17 16:56:35 +00:00
|
|
|
#define EVT_COMMAND_RANGE(id1, id2, event, func) \
|
2005-02-14 23:53:48 +00:00
|
|
|
wx__DECLARE_EVT2(event, id1, id2, wxCommandEventHandler(func))
|
2004-12-05 16:30:54 +00:00
|
|
|
|
2005-02-14 23:53:48 +00:00
|
|
|
#define EVT_NOTIFY(event, winid, func) \
|
|
|
|
wx__DECLARE_EVT1(event, winid, wxNotifyEventHandler(func))
|
2009-01-12 14:26:13 +00:00
|
|
|
|
2005-02-14 23:53:48 +00:00
|
|
|
#define EVT_NOTIFY_RANGE(event, id1, id2, func) \
|
|
|
|
wx__DECLARE_EVT2(event, id1, id2, wxNotifyEventHandler(func))
|
2004-12-05 16:30:54 +00:00
|
|
|
|
1998-05-20 14:01:55 +00:00
|
|
|
// Miscellaneous
|
2005-02-14 23:53:48 +00:00
|
|
|
#define EVT_SIZE(func) wx__DECLARE_EVT0(wxEVT_SIZE, wxSizeEventHandler(func))
|
|
|
|
#define EVT_SIZING(func) wx__DECLARE_EVT0(wxEVT_SIZING, wxSizeEventHandler(func))
|
|
|
|
#define EVT_MOVE(func) wx__DECLARE_EVT0(wxEVT_MOVE, wxMoveEventHandler(func))
|
|
|
|
#define EVT_MOVING(func) wx__DECLARE_EVT0(wxEVT_MOVING, wxMoveEventHandler(func))
|
2007-08-01 15:34:48 +00:00
|
|
|
#define EVT_MOVE_START(func) wx__DECLARE_EVT0(wxEVT_MOVE_START, wxMoveEventHandler(func))
|
|
|
|
#define EVT_MOVE_END(func) wx__DECLARE_EVT0(wxEVT_MOVE_END, wxMoveEventHandler(func))
|
2005-02-14 23:53:48 +00:00
|
|
|
#define EVT_CLOSE(func) wx__DECLARE_EVT0(wxEVT_CLOSE_WINDOW, wxCloseEventHandler(func))
|
|
|
|
#define EVT_END_SESSION(func) wx__DECLARE_EVT0(wxEVT_END_SESSION, wxCloseEventHandler(func))
|
|
|
|
#define EVT_QUERY_END_SESSION(func) wx__DECLARE_EVT0(wxEVT_QUERY_END_SESSION, wxCloseEventHandler(func))
|
|
|
|
#define EVT_PAINT(func) wx__DECLARE_EVT0(wxEVT_PAINT, wxPaintEventHandler(func))
|
|
|
|
#define EVT_NC_PAINT(func) wx__DECLARE_EVT0(wxEVT_NC_PAINT, wxNcPaintEventHandler(func))
|
|
|
|
#define EVT_ERASE_BACKGROUND(func) wx__DECLARE_EVT0(wxEVT_ERASE_BACKGROUND, wxEraseEventHandler(func))
|
|
|
|
#define EVT_CHAR(func) wx__DECLARE_EVT0(wxEVT_CHAR, wxCharEventHandler(func))
|
|
|
|
#define EVT_KEY_DOWN(func) wx__DECLARE_EVT0(wxEVT_KEY_DOWN, wxKeyEventHandler(func))
|
|
|
|
#define EVT_KEY_UP(func) wx__DECLARE_EVT0(wxEVT_KEY_UP, wxKeyEventHandler(func))
|
2003-07-10 09:16:00 +00:00
|
|
|
#if wxUSE_HOTKEY
|
2005-02-14 23:53:48 +00:00
|
|
|
#define EVT_HOTKEY(winid, func) wx__DECLARE_EVT1(wxEVT_HOTKEY, winid, wxCharEventHandler(func))
|
2003-07-10 09:16:00 +00:00
|
|
|
#endif
|
2005-02-14 23:53:48 +00:00
|
|
|
#define EVT_CHAR_HOOK(func) wx__DECLARE_EVT0(wxEVT_CHAR_HOOK, wxCharEventHandler(func))
|
|
|
|
#define EVT_MENU_OPEN(func) wx__DECLARE_EVT0(wxEVT_MENU_OPEN, wxMenuEventHandler(func))
|
|
|
|
#define EVT_MENU_CLOSE(func) wx__DECLARE_EVT0(wxEVT_MENU_CLOSE, wxMenuEventHandler(func))
|
|
|
|
#define EVT_MENU_HIGHLIGHT(winid, func) wx__DECLARE_EVT1(wxEVT_MENU_HIGHLIGHT, winid, wxMenuEventHandler(func))
|
|
|
|
#define EVT_MENU_HIGHLIGHT_ALL(func) wx__DECLARE_EVT0(wxEVT_MENU_HIGHLIGHT, wxMenuEventHandler(func))
|
|
|
|
#define EVT_SET_FOCUS(func) wx__DECLARE_EVT0(wxEVT_SET_FOCUS, wxFocusEventHandler(func))
|
|
|
|
#define EVT_KILL_FOCUS(func) wx__DECLARE_EVT0(wxEVT_KILL_FOCUS, wxFocusEventHandler(func))
|
|
|
|
#define EVT_CHILD_FOCUS(func) wx__DECLARE_EVT0(wxEVT_CHILD_FOCUS, wxChildFocusEventHandler(func))
|
|
|
|
#define EVT_ACTIVATE(func) wx__DECLARE_EVT0(wxEVT_ACTIVATE, wxActivateEventHandler(func))
|
|
|
|
#define EVT_ACTIVATE_APP(func) wx__DECLARE_EVT0(wxEVT_ACTIVATE_APP, wxActivateEventHandler(func))
|
2005-03-18 14:26:57 +00:00
|
|
|
#define EVT_HIBERNATE(func) wx__DECLARE_EVT0(wxEVT_HIBERNATE, wxActivateEventHandler(func))
|
2005-02-14 23:53:48 +00:00
|
|
|
#define EVT_END_SESSION(func) wx__DECLARE_EVT0(wxEVT_END_SESSION, wxCloseEventHandler(func))
|
|
|
|
#define EVT_QUERY_END_SESSION(func) wx__DECLARE_EVT0(wxEVT_QUERY_END_SESSION, wxCloseEventHandler(func))
|
|
|
|
#define EVT_DROP_FILES(func) wx__DECLARE_EVT0(wxEVT_DROP_FILES, wxDropFilesEventHandler(func))
|
|
|
|
#define EVT_INIT_DIALOG(func) wx__DECLARE_EVT0(wxEVT_INIT_DIALOG, wxInitDialogEventHandler(func))
|
|
|
|
#define EVT_SYS_COLOUR_CHANGED(func) wx__DECLARE_EVT0(wxEVT_SYS_COLOUR_CHANGED, wxSysColourChangedEventHandler(func))
|
|
|
|
#define EVT_DISPLAY_CHANGED(func) wx__DECLARE_EVT0(wxEVT_DISPLAY_CHANGED, wxDisplayChangedEventHandler(func))
|
|
|
|
#define EVT_SHOW(func) wx__DECLARE_EVT0(wxEVT_SHOW, wxShowEventHandler(func))
|
|
|
|
#define EVT_MAXIMIZE(func) wx__DECLARE_EVT0(wxEVT_MAXIMIZE, wxMaximizeEventHandler(func))
|
|
|
|
#define EVT_ICONIZE(func) wx__DECLARE_EVT0(wxEVT_ICONIZE, wxIconizeEventHandler(func))
|
|
|
|
#define EVT_NAVIGATION_KEY(func) wx__DECLARE_EVT0(wxEVT_NAVIGATION_KEY, wxNavigationKeyEventHandler(func))
|
|
|
|
#define EVT_PALETTE_CHANGED(func) wx__DECLARE_EVT0(wxEVT_PALETTE_CHANGED, wxPaletteChangedEventHandler(func))
|
|
|
|
#define EVT_QUERY_NEW_PALETTE(func) wx__DECLARE_EVT0(wxEVT_QUERY_NEW_PALETTE, wxQueryNewPaletteEventHandler(func))
|
|
|
|
#define EVT_WINDOW_CREATE(func) wx__DECLARE_EVT0(wxEVT_CREATE, wxWindowCreateEventHandler(func))
|
|
|
|
#define EVT_WINDOW_DESTROY(func) wx__DECLARE_EVT0(wxEVT_DESTROY, wxWindowDestroyEventHandler(func))
|
|
|
|
#define EVT_SET_CURSOR(func) wx__DECLARE_EVT0(wxEVT_SET_CURSOR, wxSetCursorEventHandler(func))
|
|
|
|
#define EVT_MOUSE_CAPTURE_CHANGED(func) wx__DECLARE_EVT0(wxEVT_MOUSE_CAPTURE_CHANGED, wxMouseCaptureChangedEventHandler(func))
|
2006-07-31 09:27:54 +00:00
|
|
|
#define EVT_MOUSE_CAPTURE_LOST(func) wx__DECLARE_EVT0(wxEVT_MOUSE_CAPTURE_LOST, wxMouseCaptureLostEventHandler(func))
|
1998-05-20 14:01:55 +00:00
|
|
|
|
|
|
|
// Mouse events
|
2005-02-14 23:53:48 +00:00
|
|
|
#define EVT_LEFT_DOWN(func) wx__DECLARE_EVT0(wxEVT_LEFT_DOWN, wxMouseEventHandler(func))
|
|
|
|
#define EVT_LEFT_UP(func) wx__DECLARE_EVT0(wxEVT_LEFT_UP, wxMouseEventHandler(func))
|
|
|
|
#define EVT_MIDDLE_DOWN(func) wx__DECLARE_EVT0(wxEVT_MIDDLE_DOWN, wxMouseEventHandler(func))
|
|
|
|
#define EVT_MIDDLE_UP(func) wx__DECLARE_EVT0(wxEVT_MIDDLE_UP, wxMouseEventHandler(func))
|
|
|
|
#define EVT_RIGHT_DOWN(func) wx__DECLARE_EVT0(wxEVT_RIGHT_DOWN, wxMouseEventHandler(func))
|
|
|
|
#define EVT_RIGHT_UP(func) wx__DECLARE_EVT0(wxEVT_RIGHT_UP, wxMouseEventHandler(func))
|
|
|
|
#define EVT_MOTION(func) wx__DECLARE_EVT0(wxEVT_MOTION, wxMouseEventHandler(func))
|
|
|
|
#define EVT_LEFT_DCLICK(func) wx__DECLARE_EVT0(wxEVT_LEFT_DCLICK, wxMouseEventHandler(func))
|
|
|
|
#define EVT_MIDDLE_DCLICK(func) wx__DECLARE_EVT0(wxEVT_MIDDLE_DCLICK, wxMouseEventHandler(func))
|
|
|
|
#define EVT_RIGHT_DCLICK(func) wx__DECLARE_EVT0(wxEVT_RIGHT_DCLICK, wxMouseEventHandler(func))
|
|
|
|
#define EVT_LEAVE_WINDOW(func) wx__DECLARE_EVT0(wxEVT_LEAVE_WINDOW, wxMouseEventHandler(func))
|
|
|
|
#define EVT_ENTER_WINDOW(func) wx__DECLARE_EVT0(wxEVT_ENTER_WINDOW, wxMouseEventHandler(func))
|
|
|
|
#define EVT_MOUSEWHEEL(func) wx__DECLARE_EVT0(wxEVT_MOUSEWHEEL, wxMouseEventHandler(func))
|
2007-07-29 01:04:33 +00:00
|
|
|
#define EVT_MOUSE_AUX1_DOWN(func) wx__DECLARE_EVT0(wxEVT_AUX1_DOWN, wxMouseEventHandler(func))
|
|
|
|
#define EVT_MOUSE_AUX1_UP(func) wx__DECLARE_EVT0(wxEVT_AUX1_UP, wxMouseEventHandler(func))
|
|
|
|
#define EVT_MOUSE_AUX1_DCLICK(func) wx__DECLARE_EVT0(wxEVT_AUX1_DCLICK, wxMouseEventHandler(func))
|
|
|
|
#define EVT_MOUSE_AUX2_DOWN(func) wx__DECLARE_EVT0(wxEVT_AUX2_DOWN, wxMouseEventHandler(func))
|
|
|
|
#define EVT_MOUSE_AUX2_UP(func) wx__DECLARE_EVT0(wxEVT_AUX2_UP, wxMouseEventHandler(func))
|
|
|
|
#define EVT_MOUSE_AUX2_DCLICK(func) wx__DECLARE_EVT0(wxEVT_AUX2_DCLICK, wxMouseEventHandler(func))
|
1998-05-20 14:01:55 +00:00
|
|
|
|
|
|
|
// All mouse events
|
|
|
|
#define EVT_MOUSE_EVENTS(func) \
|
2005-02-14 23:53:48 +00:00
|
|
|
EVT_LEFT_DOWN(func) \
|
|
|
|
EVT_LEFT_UP(func) \
|
2007-07-29 01:04:33 +00:00
|
|
|
EVT_LEFT_DCLICK(func) \
|
2005-02-14 23:53:48 +00:00
|
|
|
EVT_MIDDLE_DOWN(func) \
|
|
|
|
EVT_MIDDLE_UP(func) \
|
2007-07-29 01:04:33 +00:00
|
|
|
EVT_MIDDLE_DCLICK(func) \
|
2005-02-14 23:53:48 +00:00
|
|
|
EVT_RIGHT_DOWN(func) \
|
|
|
|
EVT_RIGHT_UP(func) \
|
|
|
|
EVT_RIGHT_DCLICK(func) \
|
2007-07-29 01:04:33 +00:00
|
|
|
EVT_MOUSE_AUX1_DOWN(func) \
|
|
|
|
EVT_MOUSE_AUX1_UP(func) \
|
|
|
|
EVT_MOUSE_AUX1_DCLICK(func) \
|
|
|
|
EVT_MOUSE_AUX2_DOWN(func) \
|
|
|
|
EVT_MOUSE_AUX2_UP(func) \
|
|
|
|
EVT_MOUSE_AUX2_DCLICK(func) \
|
|
|
|
EVT_MOTION(func) \
|
2005-02-14 23:53:48 +00:00
|
|
|
EVT_LEAVE_WINDOW(func) \
|
|
|
|
EVT_ENTER_WINDOW(func) \
|
|
|
|
EVT_MOUSEWHEEL(func)
|
1998-05-20 14:01:55 +00:00
|
|
|
|
1999-05-17 19:17:28 +00:00
|
|
|
// Scrolling from wxWindow (sent to wxScrolledWindow)
|
2005-02-14 23:53:48 +00:00
|
|
|
#define EVT_SCROLLWIN_TOP(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_TOP, wxScrollWinEventHandler(func))
|
|
|
|
#define EVT_SCROLLWIN_BOTTOM(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_BOTTOM, wxScrollWinEventHandler(func))
|
|
|
|
#define EVT_SCROLLWIN_LINEUP(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_LINEUP, wxScrollWinEventHandler(func))
|
|
|
|
#define EVT_SCROLLWIN_LINEDOWN(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_LINEDOWN, wxScrollWinEventHandler(func))
|
|
|
|
#define EVT_SCROLLWIN_PAGEUP(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_PAGEUP, wxScrollWinEventHandler(func))
|
|
|
|
#define EVT_SCROLLWIN_PAGEDOWN(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_PAGEDOWN, wxScrollWinEventHandler(func))
|
|
|
|
#define EVT_SCROLLWIN_THUMBTRACK(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_THUMBTRACK, wxScrollWinEventHandler(func))
|
|
|
|
#define EVT_SCROLLWIN_THUMBRELEASE(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_THUMBRELEASE, wxScrollWinEventHandler(func))
|
|
|
|
|
1999-05-17 19:17:28 +00:00
|
|
|
#define EVT_SCROLLWIN(func) \
|
2005-02-14 23:53:48 +00:00
|
|
|
EVT_SCROLLWIN_TOP(func) \
|
|
|
|
EVT_SCROLLWIN_BOTTOM(func) \
|
|
|
|
EVT_SCROLLWIN_LINEUP(func) \
|
|
|
|
EVT_SCROLLWIN_LINEDOWN(func) \
|
|
|
|
EVT_SCROLLWIN_PAGEUP(func) \
|
|
|
|
EVT_SCROLLWIN_PAGEDOWN(func) \
|
|
|
|
EVT_SCROLLWIN_THUMBTRACK(func) \
|
|
|
|
EVT_SCROLLWIN_THUMBRELEASE(func)
|
1999-05-17 19:17:28 +00:00
|
|
|
|
|
|
|
// Scrolling from wxSlider and wxScrollBar
|
2005-02-14 23:53:48 +00:00
|
|
|
#define EVT_SCROLL_TOP(func) wx__DECLARE_EVT0(wxEVT_SCROLL_TOP, wxScrollEventHandler(func))
|
|
|
|
#define EVT_SCROLL_BOTTOM(func) wx__DECLARE_EVT0(wxEVT_SCROLL_BOTTOM, wxScrollEventHandler(func))
|
|
|
|
#define EVT_SCROLL_LINEUP(func) wx__DECLARE_EVT0(wxEVT_SCROLL_LINEUP, wxScrollEventHandler(func))
|
|
|
|
#define EVT_SCROLL_LINEDOWN(func) wx__DECLARE_EVT0(wxEVT_SCROLL_LINEDOWN, wxScrollEventHandler(func))
|
|
|
|
#define EVT_SCROLL_PAGEUP(func) wx__DECLARE_EVT0(wxEVT_SCROLL_PAGEUP, wxScrollEventHandler(func))
|
|
|
|
#define EVT_SCROLL_PAGEDOWN(func) wx__DECLARE_EVT0(wxEVT_SCROLL_PAGEDOWN, wxScrollEventHandler(func))
|
|
|
|
#define EVT_SCROLL_THUMBTRACK(func) wx__DECLARE_EVT0(wxEVT_SCROLL_THUMBTRACK, wxScrollEventHandler(func))
|
|
|
|
#define EVT_SCROLL_THUMBRELEASE(func) wx__DECLARE_EVT0(wxEVT_SCROLL_THUMBRELEASE, wxScrollEventHandler(func))
|
2005-05-31 15:22:10 +00:00
|
|
|
#define EVT_SCROLL_CHANGED(func) wx__DECLARE_EVT0(wxEVT_SCROLL_CHANGED, wxScrollEventHandler(func))
|
2005-02-14 23:53:48 +00:00
|
|
|
|
1998-05-20 14:01:55 +00:00
|
|
|
#define EVT_SCROLL(func) \
|
2005-02-14 23:53:48 +00:00
|
|
|
EVT_SCROLL_TOP(func) \
|
|
|
|
EVT_SCROLL_BOTTOM(func) \
|
|
|
|
EVT_SCROLL_LINEUP(func) \
|
|
|
|
EVT_SCROLL_LINEDOWN(func) \
|
|
|
|
EVT_SCROLL_PAGEUP(func) \
|
|
|
|
EVT_SCROLL_PAGEDOWN(func) \
|
|
|
|
EVT_SCROLL_THUMBTRACK(func) \
|
2005-05-30 00:17:57 +00:00
|
|
|
EVT_SCROLL_THUMBRELEASE(func) \
|
2005-09-25 20:23:30 +00:00
|
|
|
EVT_SCROLL_CHANGED(func)
|
1998-05-20 14:01:55 +00:00
|
|
|
|
1999-05-17 19:17:28 +00:00
|
|
|
// Scrolling from wxSlider and wxScrollBar, with an id
|
2005-02-14 23:53:48 +00:00
|
|
|
#define EVT_COMMAND_SCROLL_TOP(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_TOP, winid, wxScrollEventHandler(func))
|
|
|
|
#define EVT_COMMAND_SCROLL_BOTTOM(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_BOTTOM, winid, wxScrollEventHandler(func))
|
|
|
|
#define EVT_COMMAND_SCROLL_LINEUP(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_LINEUP, winid, wxScrollEventHandler(func))
|
|
|
|
#define EVT_COMMAND_SCROLL_LINEDOWN(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_LINEDOWN, winid, wxScrollEventHandler(func))
|
|
|
|
#define EVT_COMMAND_SCROLL_PAGEUP(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_PAGEUP, winid, wxScrollEventHandler(func))
|
|
|
|
#define EVT_COMMAND_SCROLL_PAGEDOWN(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_PAGEDOWN, winid, wxScrollEventHandler(func))
|
|
|
|
#define EVT_COMMAND_SCROLL_THUMBTRACK(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_THUMBTRACK, winid, wxScrollEventHandler(func))
|
|
|
|
#define EVT_COMMAND_SCROLL_THUMBRELEASE(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_THUMBRELEASE, winid, wxScrollEventHandler(func))
|
2005-05-31 15:22:10 +00:00
|
|
|
#define EVT_COMMAND_SCROLL_CHANGED(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_CHANGED, winid, wxScrollEventHandler(func))
|
2005-02-14 23:53:48 +00:00
|
|
|
|
2003-03-21 02:58:55 +00:00
|
|
|
#define EVT_COMMAND_SCROLL(winid, func) \
|
2005-02-14 23:53:48 +00:00
|
|
|
EVT_COMMAND_SCROLL_TOP(winid, func) \
|
|
|
|
EVT_COMMAND_SCROLL_BOTTOM(winid, func) \
|
|
|
|
EVT_COMMAND_SCROLL_LINEUP(winid, func) \
|
|
|
|
EVT_COMMAND_SCROLL_LINEDOWN(winid, func) \
|
|
|
|
EVT_COMMAND_SCROLL_PAGEUP(winid, func) \
|
|
|
|
EVT_COMMAND_SCROLL_PAGEDOWN(winid, func) \
|
|
|
|
EVT_COMMAND_SCROLL_THUMBTRACK(winid, func) \
|
2005-05-30 00:17:57 +00:00
|
|
|
EVT_COMMAND_SCROLL_THUMBRELEASE(winid, func) \
|
2005-09-25 20:23:30 +00:00
|
|
|
EVT_COMMAND_SCROLL_CHANGED(winid, func)
|
2005-05-31 15:22:10 +00:00
|
|
|
|
2006-03-30 14:04:17 +00:00
|
|
|
#if WXWIN_COMPATIBILITY_2_6
|
|
|
|
// compatibility macros for the old name, deprecated in 2.8
|
|
|
|
#define wxEVT_SCROLL_ENDSCROLL wxEVT_SCROLL_CHANGED
|
|
|
|
#define EVT_COMMAND_SCROLL_ENDSCROLL EVT_COMMAND_SCROLL_CHANGED
|
|
|
|
#define EVT_SCROLL_ENDSCROLL EVT_SCROLL_CHANGED
|
|
|
|
#endif // WXWIN_COMPATIBILITY_2_6
|
1998-05-20 14:01:55 +00:00
|
|
|
|
|
|
|
// Convenience macros for commonly-used commands
|
2005-02-14 23:53:48 +00:00
|
|
|
#define EVT_CHECKBOX(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_CHECKBOX_CLICKED, winid, wxCommandEventHandler(func))
|
|
|
|
#define EVT_CHOICE(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_CHOICE_SELECTED, winid, wxCommandEventHandler(func))
|
|
|
|
#define EVT_LISTBOX(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_LISTBOX_SELECTED, winid, wxCommandEventHandler(func))
|
|
|
|
#define EVT_LISTBOX_DCLICK(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, winid, wxCommandEventHandler(func))
|
|
|
|
#define EVT_MENU(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_MENU_SELECTED, winid, wxCommandEventHandler(func))
|
|
|
|
#define EVT_MENU_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_COMMAND_MENU_SELECTED, id1, id2, wxCommandEventHandler(func))
|
2004-06-23 10:44:16 +00:00
|
|
|
#if defined(__SMARTPHONE__)
|
2005-02-14 23:53:48 +00:00
|
|
|
# define EVT_BUTTON(winid, func) EVT_MENU(winid, func)
|
2004-06-23 10:44:16 +00:00
|
|
|
#else
|
2005-02-14 23:53:48 +00:00
|
|
|
# define EVT_BUTTON(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_BUTTON_CLICKED, winid, wxCommandEventHandler(func))
|
2004-06-23 10:44:16 +00:00
|
|
|
#endif
|
2005-02-14 23:53:48 +00:00
|
|
|
#define EVT_SLIDER(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_SLIDER_UPDATED, winid, wxCommandEventHandler(func))
|
|
|
|
#define EVT_RADIOBOX(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_RADIOBOX_SELECTED, winid, wxCommandEventHandler(func))
|
|
|
|
#define EVT_RADIOBUTTON(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_RADIOBUTTON_SELECTED, winid, wxCommandEventHandler(func))
|
1998-05-20 14:01:55 +00:00
|
|
|
// EVT_SCROLLBAR is now obsolete since we use EVT_COMMAND_SCROLL... events
|
2005-02-14 23:53:48 +00:00
|
|
|
#define EVT_SCROLLBAR(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_SCROLLBAR_UPDATED, winid, wxCommandEventHandler(func))
|
|
|
|
#define EVT_VLBOX(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_VLBOX_SELECTED, winid, wxCommandEventHandler(func))
|
|
|
|
#define EVT_COMBOBOX(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_COMBOBOX_SELECTED, winid, wxCommandEventHandler(func))
|
|
|
|
#define EVT_TOOL(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_TOOL_CLICKED, winid, wxCommandEventHandler(func))
|
2007-05-11 23:35:49 +00:00
|
|
|
#define EVT_TOOL_DROPDOWN(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_TOOL_DROPDOWN_CLICKED, winid, wxCommandEventHandler(func))
|
2005-02-14 23:53:48 +00:00
|
|
|
#define EVT_TOOL_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_COMMAND_TOOL_CLICKED, id1, id2, wxCommandEventHandler(func))
|
|
|
|
#define EVT_TOOL_RCLICKED(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_TOOL_RCLICKED, winid, wxCommandEventHandler(func))
|
|
|
|
#define EVT_TOOL_RCLICKED_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_COMMAND_TOOL_RCLICKED, id1, id2, wxCommandEventHandler(func))
|
|
|
|
#define EVT_TOOL_ENTER(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_TOOL_ENTER, winid, wxCommandEventHandler(func))
|
|
|
|
#define EVT_CHECKLISTBOX(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, winid, wxCommandEventHandler(func))
|
2009-03-18 10:42:58 +00:00
|
|
|
#define EVT_COMBOBOX_DROPDOWN(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_COMBOBOX_DROPDOWN, winid, wxCommandEventHandler(func))
|
|
|
|
#define EVT_COMBOBOX_CLOSEUP(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_COMBOBOX_CLOSEUP, winid, wxCommandEventHandler(func))
|
1998-05-20 14:01:55 +00:00
|
|
|
|
|
|
|
// Generic command events
|
2005-02-14 23:53:48 +00:00
|
|
|
#define EVT_COMMAND_LEFT_CLICK(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_LEFT_CLICK, winid, wxCommandEventHandler(func))
|
|
|
|
#define EVT_COMMAND_LEFT_DCLICK(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_LEFT_DCLICK, winid, wxCommandEventHandler(func))
|
|
|
|
#define EVT_COMMAND_RIGHT_CLICK(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_RIGHT_CLICK, winid, wxCommandEventHandler(func))
|
|
|
|
#define EVT_COMMAND_RIGHT_DCLICK(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_RIGHT_DCLICK, winid, wxCommandEventHandler(func))
|
|
|
|
#define EVT_COMMAND_SET_FOCUS(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_SET_FOCUS, winid, wxCommandEventHandler(func))
|
|
|
|
#define EVT_COMMAND_KILL_FOCUS(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_KILL_FOCUS, winid, wxCommandEventHandler(func))
|
|
|
|
#define EVT_COMMAND_ENTER(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_ENTER, winid, wxCommandEventHandler(func))
|
1998-05-20 14:01:55 +00:00
|
|
|
|
|
|
|
// Joystick events
|
2002-08-19 16:09:40 +00:00
|
|
|
|
2005-02-14 23:53:48 +00:00
|
|
|
#define EVT_JOY_BUTTON_DOWN(func) wx__DECLARE_EVT0(wxEVT_JOY_BUTTON_DOWN, wxJoystickEventHandler(func))
|
|
|
|
#define EVT_JOY_BUTTON_UP(func) wx__DECLARE_EVT0(wxEVT_JOY_BUTTON_UP, wxJoystickEventHandler(func))
|
|
|
|
#define EVT_JOY_MOVE(func) wx__DECLARE_EVT0(wxEVT_JOY_MOVE, wxJoystickEventHandler(func))
|
|
|
|
#define EVT_JOY_ZMOVE(func) wx__DECLARE_EVT0(wxEVT_JOY_ZMOVE, wxJoystickEventHandler(func))
|
1998-05-20 14:01:55 +00:00
|
|
|
|
|
|
|
// All joystick events
|
|
|
|
#define EVT_JOYSTICK_EVENTS(func) \
|
2005-02-14 23:53:48 +00:00
|
|
|
EVT_JOY_BUTTON_DOWN(func) \
|
|
|
|
EVT_JOY_BUTTON_UP(func) \
|
|
|
|
EVT_JOY_MOVE(func) \
|
|
|
|
EVT_JOY_ZMOVE(func)
|
1998-05-20 14:01:55 +00:00
|
|
|
|
|
|
|
// Idle event
|
2005-02-14 23:53:48 +00:00
|
|
|
#define EVT_IDLE(func) wx__DECLARE_EVT0(wxEVT_IDLE, wxIdleEventHandler(func))
|
1998-05-20 14:01:55 +00:00
|
|
|
|
|
|
|
// Update UI event
|
2005-02-14 23:53:48 +00:00
|
|
|
#define EVT_UPDATE_UI(winid, func) wx__DECLARE_EVT1(wxEVT_UPDATE_UI, winid, wxUpdateUIEventHandler(func))
|
|
|
|
#define EVT_UPDATE_UI_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_UPDATE_UI, id1, id2, wxUpdateUIEventHandler(func))
|
1998-05-20 14:01:55 +00:00
|
|
|
|
2000-09-06 09:45:24 +00:00
|
|
|
// Help events
|
2005-02-14 23:53:48 +00:00
|
|
|
#define EVT_HELP(winid, func) wx__DECLARE_EVT1(wxEVT_HELP, winid, wxHelpEventHandler(func))
|
|
|
|
#define EVT_HELP_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_HELP, id1, id2, wxHelpEventHandler(func))
|
|
|
|
#define EVT_DETAILED_HELP(winid, func) wx__DECLARE_EVT1(wxEVT_DETAILED_HELP, winid, wxHelpEventHandler(func))
|
|
|
|
#define EVT_DETAILED_HELP_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_DETAILED_HELP, id1, id2, wxHelpEventHandler(func))
|
2000-09-08 10:49:39 +00:00
|
|
|
|
2001-05-16 11:32:21 +00:00
|
|
|
// Context Menu Events
|
2005-02-14 23:53:48 +00:00
|
|
|
#define EVT_CONTEXT_MENU(func) wx__DECLARE_EVT0(wxEVT_CONTEXT_MENU, wxContextMenuEventHandler(func))
|
2005-02-15 09:28:00 +00:00
|
|
|
#define EVT_COMMAND_CONTEXT_MENU(winid, func) wx__DECLARE_EVT1(wxEVT_CONTEXT_MENU, winid, wxContextMenuEventHandler(func))
|
2001-05-16 11:32:21 +00:00
|
|
|
|
2006-05-12 15:21:41 +00:00
|
|
|
// Clipboard text Events
|
|
|
|
#define EVT_TEXT_CUT(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_TEXT_CUT, winid, wxClipboardTextEventHandler(func))
|
|
|
|
#define EVT_TEXT_COPY(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_TEXT_COPY, winid, wxClipboardTextEventHandler(func))
|
|
|
|
#define EVT_TEXT_PASTE(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_TEXT_PASTE, winid, wxClipboardTextEventHandler(func))
|
|
|
|
|
2009-02-04 17:42:28 +00:00
|
|
|
// Thread events
|
|
|
|
#define EVT_THREAD(id, func) wx__DECLARE_EVT1(wxEVT_COMMAND_THREAD, id, wxThreadEventHandler(func))
|
|
|
|
|
1999-10-04 20:15:38 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// Helper functions
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2009-03-02 12:10:40 +00:00
|
|
|
// This is an ugly hack to allow the use of Bind() instead of Connect() inside
|
|
|
|
// the library code if the library was built with support for it, here is how
|
|
|
|
// it is used:
|
|
|
|
//
|
|
|
|
// class SomeEventHandlingClass : wxBIND_OR_CONNECT_HACK_BASE_CLASS
|
|
|
|
// public SomeBaseClass
|
|
|
|
// {
|
|
|
|
// public:
|
|
|
|
// SomeEventHandlingClass(wxWindow *win)
|
|
|
|
// {
|
|
|
|
// // connect to the event for the given window
|
|
|
|
// wxBIND_OR_CONNECT_HACK(win, wxEVT_SOMETHING, wxSomeEventHandler,
|
|
|
|
// SomeEventHandlingClass::OnSomeEvent, this);
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// private:
|
|
|
|
// void OnSomeEvent(wxSomeEvent&) { ... }
|
|
|
|
// };
|
|
|
|
//
|
|
|
|
// This is *not* meant to be used by library users, it is only defined here
|
|
|
|
// (and not in a private header) because the base class must be visible from
|
|
|
|
// other public headers, please do NOT use this in your code, it will be
|
|
|
|
// removed from future wx versions without warning.
|
2009-05-03 07:43:28 +00:00
|
|
|
#ifdef wxHAS_EVENT_BIND
|
2009-03-02 12:10:40 +00:00
|
|
|
#define wxBIND_OR_CONNECT_HACK_BASE_CLASS
|
|
|
|
#define wxBIND_OR_CONNECT_HACK_ONLY_BASE_CLASS
|
2009-12-25 08:39:11 +00:00
|
|
|
#define wxBIND_OR_CONNECT_HACK(win, evt, handler, func, obj) \
|
2009-03-02 12:10:40 +00:00
|
|
|
win->Bind(evt, &func, obj)
|
2009-05-03 07:43:28 +00:00
|
|
|
#else // wxHAS_EVENT_BIND
|
|
|
|
#define wxBIND_OR_CONNECT_HACK_BASE_CLASS public wxEvtHandler,
|
|
|
|
#define wxBIND_OR_CONNECT_HACK_ONLY_BASE_CLASS : public wxEvtHandler
|
2009-12-25 08:39:11 +00:00
|
|
|
#define wxBIND_OR_CONNECT_HACK(win, evt, handler, func, obj) \
|
2009-05-03 07:43:28 +00:00
|
|
|
win->Connect(evt, handler(func), NULL, obj)
|
2009-05-02 12:52:54 +00:00
|
|
|
#endif // wxHAS_EVENT_BIND
|
2009-03-02 12:10:40 +00:00
|
|
|
|
1999-10-04 20:15:38 +00:00
|
|
|
#if wxUSE_GUI
|
1999-04-07 21:33:22 +00:00
|
|
|
|
|
|
|
// Find a window with the focus, that is also a descendant of the given window.
|
|
|
|
// This is used to determine the window to initially send commands to.
|
2005-10-23 22:16:33 +00:00
|
|
|
WXDLLIMPEXP_CORE wxWindow* wxFindFocusDescendant(wxWindow* ancestor);
|
1999-04-07 21:33:22 +00:00
|
|
|
|
1999-10-04 20:15:38 +00:00
|
|
|
#endif // wxUSE_GUI
|
|
|
|
|
2010-06-09 14:28:08 +00:00
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// Compatibility macro aliases
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// deprecated variants _not_ requiring a semicolon after them and without wx prefix
|
|
|
|
// (note that also some wx-prefixed macro do _not_ require a semicolon because
|
|
|
|
// it's not always possible to force the compire to require it)
|
|
|
|
|
|
|
|
#define DECLARE_EVENT_TABLE_ENTRY(type, winid, idLast, fn, obj) \
|
|
|
|
wxDECLARE_EVENT_TABLE_ENTRY(type, winid, idLast, fn, obj)
|
|
|
|
#define DECLARE_EVENT_TABLE_TERMINATOR() wxDECLARE_EVENT_TABLE_TERMINATOR()
|
|
|
|
#define DECLARE_EVENT_TABLE() wxDECLARE_EVENT_TABLE();
|
|
|
|
#define BEGIN_EVENT_TABLE(a,b) wxBEGIN_EVENT_TABLE(a,b)
|
|
|
|
#define BEGIN_EVENT_TABLE_TEMPLATE1(a,b,c) wxBEGIN_EVENT_TABLE_TEMPLATE1(a,b,c)
|
|
|
|
#define BEGIN_EVENT_TABLE_TEMPLATE2(a,b,c,d) wxBEGIN_EVENT_TABLE_TEMPLATE1(a,b,c,d)
|
|
|
|
#define BEGIN_EVENT_TABLE_TEMPLATE3(a,b,c,d,e) wxBEGIN_EVENT_TABLE_TEMPLATE1(a,b,c,d,e)
|
|
|
|
#define BEGIN_EVENT_TABLE_TEMPLATE4(a,b,c,d,e,f) wxBEGIN_EVENT_TABLE_TEMPLATE1(a,b,c,d,e,f)
|
|
|
|
#define BEGIN_EVENT_TABLE_TEMPLATE5(a,b,c,d,e,f,g) wxBEGIN_EVENT_TABLE_TEMPLATE1(a,b,c,d,e,f,g)
|
|
|
|
#define BEGIN_EVENT_TABLE_TEMPLATE6(a,b,c,d,e,f,g,h) wxBEGIN_EVENT_TABLE_TEMPLATE1(a,b,c,d,e,f,g,h)
|
|
|
|
#define END_EVENT_TABLE() wxEND_EVENT_TABLE()
|
|
|
|
|
|
|
|
// other obsolete event declaration/definition macros; we don't need them any longer
|
|
|
|
// but we keep them for compatibility as it doesn't cost us anything anyhow
|
|
|
|
#define BEGIN_DECLARE_EVENT_TYPES()
|
|
|
|
#define END_DECLARE_EVENT_TYPES()
|
|
|
|
#define DECLARE_EXPORTED_EVENT_TYPE(expdecl, name, value) \
|
|
|
|
extern expdecl const wxEventType name;
|
|
|
|
#define DECLARE_EVENT_TYPE(name, value) \
|
|
|
|
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_CORE, name, value)
|
|
|
|
#define DECLARE_LOCAL_EVENT_TYPE(name, value) \
|
|
|
|
DECLARE_EXPORTED_EVENT_TYPE(wxEMPTY_PARAMETER_VALUE, name, value)
|
|
|
|
#define DEFINE_EVENT_TYPE(name) const wxEventType name = wxNewEventType();
|
|
|
|
#define DEFINE_LOCAL_EVENT_TYPE(name) DEFINE_EVENT_TYPE(name)
|
|
|
|
|
2007-12-03 02:55:14 +00:00
|
|
|
#endif // _WX_EVENT_H_
|