X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/19141178ecd7156fe5254c524d1d25cd40c06a2a..d11bb14faace68d2c69e9e94b2ba6824f43a2d59:/include/wx/event.h diff --git a/include/wx/event.h b/include/wx/event.h index 0b8f245e82..aaa172a39c 100644 --- a/include/wx/event.h +++ b/include/wx/event.h @@ -21,6 +21,7 @@ #if wxUSE_GUI #include "wx/gdicmn.h" + #include "wx/cursor.h" #endif #include "wx/thread.h" @@ -118,6 +119,9 @@ enum wxEVT_KEY_DOWN = wxEVT_FIRST + 215, wxEVT_KEY_UP = wxEVT_FIRST + 216, + /* Set cursor event */ + wxEVT_SET_CURSOR = wxEVT_FIRST + 230, + /* * wxScrollbar and wxSlider event identifiers */ @@ -439,7 +443,7 @@ public: wxString GetString() const { return m_commandString; } // Get checkbox value - bool Checked() const { return (m_commandInt != 0); } + bool IsChecked() const { return m_commandInt != 0; } // TRUE if the listbox event was a selection. bool IsSelection() const { return (m_extraLong != 0); } @@ -452,6 +456,10 @@ public: void CopyObject(wxObject& obj) const; +#ifdef WXWIN_COMPATIBILITY_2 + bool Checked() const { return IsChecked(); } +#endif // WXWIN_COMPATIBILITY_2 + public: wxString m_commandString; // String event argument int m_commandInt; @@ -694,10 +702,10 @@ public: #endif // WXWIN_COMPATIBILITY // Get X position - long GetX() const { return m_x; } + wxCoord GetX() const { return m_x; } // Get Y position - long GetY() const { return m_y; } + wxCoord GetY() const { return m_y; } void CopyObject(wxObject& obj) const; @@ -714,6 +722,35 @@ public: bool m_metaDown; }; +// Cursor set event + +/* + wxEVT_SET_CURSOR + */ + +class WXDLLEXPORT wxSetCursorEvent : public wxEvent +{ +public: + wxSetCursorEvent(wxCoord x, wxCoord y) + { + m_eventType = wxEVT_SET_CURSOR; + + m_x = x; + m_y = y; + } + + 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(); } + +private: + wxCoord m_x, m_y; + wxCursor m_cursor; +}; + // Keyboard input event class /* @@ -735,7 +772,11 @@ public: bool MetaDown() const { return m_metaDown; } bool AltDown() const { return m_altDown; } bool ShiftDown() const { return m_shiftDown; } - long KeyCode() const { return m_keyCode; } + + bool HasModifiers() const { return ControlDown() || AltDown() || MetaDown(); } + + // get the key code: an ASCII7 char or an element of wxKeyCode enum + int GetKeyCode() const { return (int)m_keyCode; } // Find the position of the event void GetPosition(wxCoord *xpos, wxCoord *ypos) const @@ -763,6 +804,9 @@ public: void CopyObject(wxObject& obj) const; + // deprecated + long KeyCode() const { return m_keyCode; } + public: wxCoord m_x, m_y; @@ -1336,7 +1380,7 @@ private: wxEVT_DESTROY */ -class WXDLLEXPORT wxWindowCreateEvent : public wxEvent +class WXDLLEXPORT wxWindowCreateEvent : public wxCommandEvent { DECLARE_DYNAMIC_CLASS(wxWindowCreateEvent) @@ -1346,7 +1390,7 @@ public: wxWindow *GetWindow() const { return (wxWindow *)GetEventObject(); } }; -class WXDLLEXPORT wxWindowDestroyEvent : public wxEvent +class WXDLLEXPORT wxWindowDestroyEvent : public wxCommandEvent { DECLARE_DYNAMIC_CLASS(wxWindowDestroyEvent) @@ -1555,6 +1599,10 @@ typedef void (wxEvtHandler::*wxMaximizeEventFunction)(wxShowEvent&); typedef void (wxEvtHandler::*wxNavigationKeyEventFunction)(wxNavigationKeyEvent&); typedef void (wxEvtHandler::*wxPaletteChangedEventFunction)(wxPaletteChangedEvent&); typedef void (wxEvtHandler::*wxQueryNewPaletteEventFunction)(wxQueryNewPaletteEvent&); +typedef void (wxEvtHandler::*wxWindowCreateEventFunction)(wxWindowCreateEvent&); +typedef void (wxEvtHandler::*wxWindowDestroyEventFunction)(wxWindowDestroyEvent&); +typedef void (wxEvtHandler::*wxSetCursorEventFunction)(wxSetCursorEvent&); +typedef void (wxEvtHandler::*wxNotifyEventFunction)(wxNotifyEvent&); #endif // wxUSE_GUI // N.B. In GNU-WIN32, you *have* to take the address of a member function @@ -1613,8 +1661,9 @@ const wxEventTableEntry theClass::sm_eventTableEntries[] = { \ #define EVT_NAVIGATION_KEY(func) { wxEVT_NAVIGATION_KEY, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNavigationKeyEventFunction) & func, (wxObject *) NULL }, #define EVT_PALETTE_CHANGED(func) { wxEVT_PALETTE_CHANGED, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxPaletteChangedEventFunction) & func, (wxObject *) NULL }, #define EVT_QUERY_NEW_PALETTE(func) { wxEVT_QUERY_NEW_PALETTE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxQueryNewPaletteEventFunction) & func, (wxObject *) NULL }, -#define EVT_WINDOW_CREATE(func) { wxEVT_CREATE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxQueryNewPaletteEventFunction) & func, (wxObject *) NULL }, -#define EVT_WINDOW_DESTROY(func) { wxEVT_DESTROY, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxQueryNewPaletteEventFunction) & func, (wxObject *) NULL }, +#define EVT_WINDOW_CREATE(func) { wxEVT_CREATE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxWindowCreateEventFunction) & func, (wxObject *) NULL }, +#define EVT_WINDOW_DESTROY(func) { wxEVT_DESTROY, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxWindowDestroyEventFunction) & func, (wxObject *) NULL }, +#define EVT_SET_CURSOR(func) { wxEVT_SET_CURSOR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxSetCursorEventFunction) & func, (wxObject *) NULL }, // Mouse events #define EVT_LEFT_DOWN(func) { wxEVT_LEFT_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, (wxObject *) NULL }, @@ -1757,15 +1806,17 @@ const wxEventTableEntry theClass::sm_eventTableEntries[] = { \ { wxEVT_JOY_BUTTON_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxJoystickEventFunction) & func, (wxObject *) NULL },\ { wxEVT_JOY_BUTTON_UP, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxJoystickEventFunction) & func, (wxObject *) NULL },\ { wxEVT_JOY_MOVE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxJoystickEventFunction) & func, (wxObject *) NULL },\ - { wxEVT_JOY_ZMOVE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxJoystickEventFunction) & func, (wxObject *) NULL },\ + { wxEVT_JOY_ZMOVE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxJoystickEventFunction) & func, (wxObject *) NULL }, // Idle event #define EVT_IDLE(func) \ - { wxEVT_IDLE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxIdleEventFunction) & func, (wxObject *) NULL },\ + { wxEVT_IDLE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxIdleEventFunction) & func, (wxObject *) NULL }, // Update UI event #define EVT_UPDATE_UI(id, func) \ - { wxEVT_UPDATE_UI, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxUpdateUIEventFunction) & func, (wxObject *) NULL },\ + { wxEVT_UPDATE_UI, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxUpdateUIEventFunction) & func, (wxObject *) NULL }, +#define EVT_UPDATE_UI_RANGE(id1, id2, func) \ + { wxEVT_UPDATE_UI, id1, id2, (wxObjectEventFunction)(wxEventFunction)(wxUpdateUIEventFunction)&func, (wxObject *) NULL }, // ---------------------------------------------------------------------------- // Global data