X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7ead72f2ff8cec4984279c1709d2f19daf95982d..85d03040fc18f7e403720c77ce758e1f12e14292:/include/wx/event.h diff --git a/include/wx/event.h b/include/wx/event.h index b4bdcd15cf..1a594944db 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 */ @@ -264,6 +268,29 @@ enum wxEVT_CALENDAR_DOUBLECLICKED = wxEVT_FIRST + 954, wxEVT_CALENDAR_WEEKDAY_CLICKED = wxEVT_FIRST + 955, + /* Plot events */ + wxEVT_PLOT_SEL_CHANGING = wxEVT_FIRST + 1000, + wxEVT_PLOT_SEL_CHANGED = wxEVT_FIRST + 1001, + wxEVT_PLOT_CLICKED = wxEVT_FIRST + 1002, + wxEVT_PLOT_DOUBLECLICKED = wxEVT_FIRST + 1003, + wxEVT_PLOT_ZOOM_IN = wxEVT_FIRST + 1004, + wxEVT_PLOT_ZOOM_OUT = wxEVT_FIRST + 1005, + wxEVT_PLOT_VALUE_SEL_CREATING = wxEVT_FIRST + 1010, + wxEVT_PLOT_VALUE_SEL_CREATED = wxEVT_FIRST + 1011, + wxEVT_PLOT_VALUE_SEL_CHANGING = wxEVT_FIRST + 1012, + wxEVT_PLOT_VALUE_SEL_CHANGED = wxEVT_FIRST + 1013, + wxEVT_PLOT_AREA_SEL_CREATING = wxEVT_FIRST + 1014, + wxEVT_PLOT_AREA_SEL_CREATED = wxEVT_FIRST + 1015, + wxEVT_PLOT_AREA_SEL_CHANGING = wxEVT_FIRST + 1016, + wxEVT_PLOT_AREA_SEL_CHANGED = wxEVT_FIRST + 1017, + wxEVT_PLOT_BEGIN_X_LABEL_EDIT = wxEVT_FIRST + 1020, + wxEVT_PLOT_END_X_LABEL_EDIT = wxEVT_FIRST + 1021, + wxEVT_PLOT_BEGIN_Y_LABEL_EDIT = wxEVT_FIRST + 1022, + wxEVT_PLOT_END_Y_LABEL_EDIT = wxEVT_FIRST + 1023, + wxEVT_PLOT_BEGIN_TITLE_EDIT = wxEVT_FIRST + 1024, + wxEVT_PLOT_END_TITLE_EDIT = wxEVT_FIRST + 1025, + wxEVT_PLOT_AREA_CREATE = wxEVT_FIRST + 1026, + wxEVT_USER_FIRST = wxEVT_FIRST + 2000 }; @@ -671,10 +698,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; @@ -691,6 +718,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 /* @@ -712,7 +768,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 @@ -740,6 +800,9 @@ public: void CopyObject(wxObject& obj) const; + // deprecated + long KeyCode() const { return m_keyCode; } + public: wxCoord m_x, m_y; @@ -1313,7 +1376,7 @@ private: wxEVT_DESTROY */ -class WXDLLEXPORT wxWindowCreateEvent : public wxEvent +class WXDLLEXPORT wxWindowCreateEvent : public wxCommandEvent { DECLARE_DYNAMIC_CLASS(wxWindowCreateEvent) @@ -1323,7 +1386,7 @@ public: wxWindow *GetWindow() const { return (wxWindow *)GetEventObject(); } }; -class WXDLLEXPORT wxWindowDestroyEvent : public wxEvent +class WXDLLEXPORT wxWindowDestroyEvent : public wxCommandEvent { DECLARE_DYNAMIC_CLASS(wxWindowDestroyEvent) @@ -1532,6 +1595,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 @@ -1590,8 +1657,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 },