DECLARE_EVENT_TYPE(wxEVT_MOVING, 442)
DECLARE_EVENT_TYPE(wxEVT_HIBERNATE, 443)
+ // Clipboard events
+ DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_COPY, 444)
+ DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_CUT, 445)
+ DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_PASTE, 446)
+
// Generic command events
// Note: a click is a higher-level event than button down/up
DECLARE_EVENT_TYPE(wxEVT_COMMAND_LEFT_CLICK, 500)
long GetExtraLong() const { return m_extraLong; }
void SetInt(int i) { m_commandInt = i; }
- long GetInt() const { return m_commandInt; }
+ int GetInt() const { return m_commandInt; }
virtual wxEvent *Clone() const { return new wxCommandEvent(*this); }
wxKeyEvent(wxEventType keyType = wxEVT_NULL);
wxKeyEvent(const wxKeyEvent& evt);
+ // can be used check if the key event has exactly the given modifiers:
+ // "GetModifiers() = wxMOD_CONTROL" is easier to write than "ControlDown()
+ // && !MetaDown() && !AltDown() && !ShiftDown()"
+ int GetModifiers() const
+ {
+ return (m_controlDown ? wxMOD_CONTROL : 0) |
+ (m_shiftDown ? wxMOD_SHIFT : 0) |
+ (m_metaDown ? wxMOD_META : 0) |
+ (m_altDown ? wxMOD_ALT : 0);
+ }
+
// Find state of shift/control keys
bool ControlDown() const { return m_controlDown; }
+ bool ShiftDown() const { return m_shiftDown; }
bool MetaDown() const { return m_metaDown; }
bool AltDown() const { return m_altDown; }
- bool ShiftDown() const { return m_shiftDown; }
// "Cmd" is a pseudo key which is Control for PC and Unix platforms but
// Apple ("Command") key under Macs: it makes often sense to use it instead
// Get Y position
wxCoord GetY() const { return m_y; }
+#if WXWIN_COMPATIBILITY_2_6
// deprecated, Use GetKeyCode instead.
wxDEPRECATED( long KeyCode() const );
+#endif // WXWIN_COMPATIBILITY_2_6
virtual wxEvent *Clone() const { return new wxKeyEvent(*this); }
long m_keyCode;
+ // TODO: replace those with a single m_modifiers bitmask of wxMOD_XXX?
bool m_controlDown;
bool m_shiftDown;
bool m_altDown;
bool m_metaDown;
+
+ // FIXME: what is this for? relation to m_rawXXX?
bool m_scanCode;
#if wxUSE_UNICODE
{
m_checked =
m_enabled =
+ m_shown =
m_setEnabled =
+ m_setShown =
m_setText =
m_setChecked = false;
}
: wxCommandEvent(event),
m_checked(event.m_checked),
m_enabled(event.m_enabled),
+ m_shown(event.m_shown),
m_setEnabled(event.m_setEnabled),
+ m_setShown(event.m_setShown),
m_setText(event.m_setText),
m_setChecked(event.m_setChecked),
m_text(event.m_text)
bool GetChecked() const { return m_checked; }
bool GetEnabled() const { return m_enabled; }
+ bool GetShown() const { return m_shown; }
wxString GetText() const { return m_text; }
bool GetSetText() const { return m_setText; }
bool GetSetChecked() const { return m_setChecked; }
bool GetSetEnabled() const { return m_setEnabled; }
+ bool GetSetShown() const { return m_setShown; }
void Check(bool check) { m_checked = check; m_setChecked = true; }
void Enable(bool enable) { m_enabled = enable; m_setEnabled = true; }
+ void Show(bool show) { m_shown = show; m_setShown = true; }
void SetText(const wxString& text) { m_text = text; m_setText = true; }
// Sets the interval between updates in milliseconds.
protected:
bool m_checked;
bool m_enabled;
+ bool m_shown;
bool m_setEnabled;
+ bool m_setShown;
bool m_setText;
bool m_setChecked;
wxString m_text;
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxHelpEvent)
};
+// 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)
+ { }
+ wxClipboardTextEvent(const wxClipboardTextEvent & event)
+ : wxCommandEvent(event)
+ { }
+
+ virtual wxEvent *Clone() const { return new wxClipboardTextEvent(*this); }
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxClipboardTextEvent)
+};
+
// 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
typedef void (wxEvtHandler::*wxHelpEventFunction)(wxHelpEvent&);
typedef void (wxEvtHandler::*wxContextMenuEventFunction)(wxContextMenuEvent&);
typedef void (wxEvtHandler::*wxMouseCaptureChangedEventFunction)(wxMouseCaptureChangedEvent&);
+typedef void (wxEvtHandler::*wxClipboardTextEventFunction)(wxClipboardTextEvent&);
// these typedefs don't have the same name structure as the others, keep for
// backwards compatibility only
(wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxContextMenuEventFunction, &func)
#define wxMouseCaptureChangedEventHandler(func) \
(wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxMouseCaptureChangedEventFunction, &func)
+#define wxClipboardTextEventHandler(func) \
+ (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxClipboardTextEventFunction, &func)
#endif // wxUSE_GUI
{ return theClass::sm_eventHashTable; } \
const wxEventTableEntry theClass::sm_eventTableEntries[] = { \
+#define BEGIN_EVENT_TABLE_TEMPLATE1(theClass, baseClass, T1) \
+ 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[] = { \
+
+#define BEGIN_EVENT_TABLE_TEMPLATE2(theClass, baseClass, T1, T2) \
+ 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[] = { \
+
+#define BEGIN_EVENT_TABLE_TEMPLATE3(theClass, baseClass, T1, T2, T3) \
+ 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[] = { \
+
+#define BEGIN_EVENT_TABLE_TEMPLATE4(theClass, baseClass, T1, T2, T3, T4) \
+ 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[] = { \
+
+#define BEGIN_EVENT_TABLE_TEMPLATE5(theClass, baseClass, T1, T2, T3, T4, T5) \
+ 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[] = { \
+
+#define BEGIN_EVENT_TABLE_TEMPLATE7(theClass, baseClass, T1, T2, T3, T4, T5, T6, T7) \
+ 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[] = { \
+
+#define BEGIN_EVENT_TABLE_TEMPLATE8(theClass, baseClass, T1, T2, T3, T4, T5, T6, T7, T8) \
+ 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[] = { \
+
#define END_EVENT_TABLE() DECLARE_EVENT_TABLE_ENTRY( wxEVT_NULL, 0, 0, 0, 0 ) };
/*
EVT_COMMAND_SCROLL_THUMBRELEASE(winid, func) \
EVT_COMMAND_SCROLL_CHANGED(winid, func)
-// compatibility macros for the old name, to be 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
+#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
// Convenience macros for commonly-used commands
#define EVT_CHECKBOX(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_CHECKBOX_CLICKED, winid, wxCommandEventHandler(func))
#define EVT_CONTEXT_MENU(func) wx__DECLARE_EVT0(wxEVT_CONTEXT_MENU, wxContextMenuEventHandler(func))
#define EVT_COMMAND_CONTEXT_MENU(winid, func) wx__DECLARE_EVT1(wxEVT_CONTEXT_MENU, winid, wxContextMenuEventHandler(func))
+// 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))
+
// ----------------------------------------------------------------------------
// Global data
// ----------------------------------------------------------------------------
#endif // wxUSE_GUI
#endif // _WX_EVENT_H__
-