#include "wx/defs.h"
#include "wx/object.h"
+#include "wx/clntdata.h"
#if wxUSE_GUI
#include "wx/gdicmn.h"
class WXDLLEXPORT wxList;
#if wxUSE_GUI
- class WXDLLEXPORT wxClientData;
class WXDLLEXPORT wxDC;
class WXDLLEXPORT wxMenu;
class WXDLLEXPORT wxWindow;
#define DECLARE_EVENT_TYPE(name, value) name = wxEVT_FIRST + value,
#define DECLARE_LOCAL_EVENT_TYPE(name, value) name = wxEVT_FIRST + value,
#define DEFINE_EVENT_TYPE(name)
+#define DEFINE_LOCAL_EVENT_TYPE(name)
#else // !WXWIN_COMPATIBILITY_EVENT_TYPES
extern const wxEventType WXDLLEXPORT name;
#define DECLARE_LOCAL_EVENT_TYPE(name, value) extern const wxEventType name;
#define DEFINE_EVENT_TYPE(name) const wxEventType name = wxNewEventType();
+#define DEFINE_LOCAL_EVENT_TYPE(name) const wxEventType name = wxNewEventType();
// generate a new unique event type
extern WXDLLEXPORT wxEventType wxNewEventType();
DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_UPDATED, 7)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_ENTER, 8)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_URL, 13)
+ DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_MAXLEN, 14)
#endif // WXWIN_COMPATIBILITY_EVENT_TYPES
DECLARE_EVENT_TYPE(wxEVT_COMMAND_MENU_SELECTED, 9)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_SLIDER_UPDATED, 10)
bool AltDown() const { return m_altDown; }
bool ShiftDown() const { return m_shiftDown; }
- bool HasModifiers() const { return ControlDown() || AltDown() || MetaDown(); }
+ // exclude MetaDown() from HasModifiers() because NumLock under X is often
+ // configured as mod2 modifier, yet the key events even when it is pressed
+ // should be processed normally, not like Ctrl- or Alt-key
+ bool HasModifiers() const { return ControlDown() || AltDown(); }
// get the key code: an ASCII7 char or an element of wxKeyCode enum
int GetKeyCode() const { return (int)m_keyCode; }
DECLARE_DYNAMIC_CLASS(wxContextMenuEvent)
};
-#endif // wxUSE_GUI
-
// Idle event
/*
wxEVT_IDLE
bool m_requestMore;
};
+#endif // wxUSE_GUI
+
/* TODO
wxEVT_POWER,
wxEVT_MOUSE_CAPTURE_CHANGED,
wxEVT_COMPARE_ITEM
*/
+
// ============================================================================
// event handler and related classes
// ============================================================================
wxObject *userData = (wxObject *) NULL )
{ return Disconnect(id, -1, eventType, func, userData); }
+
+ // 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(); }
+
+
// implementation from now on
virtual bool SearchEventTable(wxEventTable& table, wxEvent& event);
bool SearchDynamicEventTable( wxEvent& event );
// Is event handler enabled?
bool m_enabled;
+
+ // 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;
+
+
private:
DECLARE_DYNAMIC_CLASS(wxEvtHandler)
};