X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/497dbbd37b8ea0c3b747860e6ec7c18c815cfcf1..cba5a276e4821a0ae7d1e7a435d6aab38baa0a9f:/include/wx/event.h diff --git a/include/wx/event.h b/include/wx/event.h index cf1181fa51..a8f7d3dccc 100644 --- a/include/wx/event.h +++ b/include/wx/event.h @@ -12,7 +12,7 @@ #ifndef _WX_EVENTH__ #define _WX_EVENTH__ -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(__APPLE__) #pragma interface "event.h" #endif @@ -74,7 +74,7 @@ typedef int wxEventType; #define BEGIN_DECLARE_EVENT_TYPES() enum { #define END_DECLARE_EVENT_TYPES() }; #define DECLARE_EVENT_TYPE(name, value) name = wxEVT_FIRST + value, -#define DECLARE_LOCAL_EVENT_TYPE(name, value) name = wxEVT_FIRST + value, +#define DECLARE_LOCAL_EVENT_TYPE(name, value) name = wxEVT_USER_FIRST + value, #define DEFINE_EVENT_TYPE(name) #define DEFINE_LOCAL_EVENT_TYPE(name) @@ -107,7 +107,7 @@ BEGIN_DECLARE_EVENT_TYPES() #else // !WXWIN_COMPATIBILITY_EVENT_TYPES // it is important to still have these as constants to avoid // initialization order related problems - DECLARE_EVENT_TYPE(wxEVT_NULL,0); + DECLARE_EVENT_TYPE(wxEVT_NULL, 0) const wxEventType wxEVT_FIRST = 10000; const wxEventType wxEVT_USER_FIRST = wxEVT_FIRST + 2000; #endif // WXWIN_COMPATIBILITY_EVENT_TYPES/!WXWIN_COMPATIBILITY_EVENT_TYPES @@ -186,7 +186,7 @@ BEGIN_DECLARE_EVENT_TYPES() // Set cursor event DECLARE_EVENT_TYPE(wxEVT_SET_CURSOR, 230) - // wxScrollbar and wxSlider event identifiers + // wxScrollBar and wxSlider event identifiers DECLARE_EVENT_TYPE(wxEVT_SCROLL_TOP, 300) DECLARE_EVENT_TYPE(wxEVT_SCROLL_BOTTOM, 301) DECLARE_EVENT_TYPE(wxEVT_SCROLL_LINEUP, 302) @@ -195,6 +195,7 @@ BEGIN_DECLARE_EVENT_TYPES() DECLARE_EVENT_TYPE(wxEVT_SCROLL_PAGEDOWN, 305) DECLARE_EVENT_TYPE(wxEVT_SCROLL_THUMBTRACK, 306) DECLARE_EVENT_TYPE(wxEVT_SCROLL_THUMBRELEASE, 307) + DECLARE_EVENT_TYPE(wxEVT_SCROLL_ENDSCROLL, 308) // Scroll events from wxWindow DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_TOP, 320) @@ -318,6 +319,7 @@ END_DECLARE_EVENT_TYPES() #define wxEVENT_TYPE_SCROLL_PAGEUP wxEVT_SCROLL_PAGEUP #define wxEVENT_TYPE_SCROLL_PAGEDOWN wxEVT_SCROLL_PAGEDOWN #define wxEVENT_TYPE_SCROLL_THUMBTRACK wxEVT_SCROLL_THUMBTRACK +#define wxEVENT_TYPE_SCROLL_ENDSCROLL wxEVT_SCROLL_ENDSCROLL #endif // WXWIN_COMPATIBILITY @@ -496,7 +498,7 @@ private: }; // Scroll event class, derived form wxCommandEvent. wxScrollEvents are -// sent by wxSlider and wxScrollbar. +// sent by wxSlider and wxScrollBar. /* wxEVT_SCROLL_TOP wxEVT_SCROLL_BOTTOM @@ -506,6 +508,7 @@ private: wxEVT_SCROLL_PAGEDOWN wxEVT_SCROLL_THUMBTRACK wxEVT_SCROLL_THUMBRELEASE + wxEVT_SCROLL_ENDSCROLL */ class WXDLLEXPORT wxScrollEvent : public wxCommandEvent @@ -543,6 +546,9 @@ class WXDLLEXPORT wxScrollWinEvent : public wxEvent public: wxScrollWinEvent(wxEventType commandType = wxEVT_NULL, int pos = 0, int orient = 0); + wxScrollWinEvent(const wxScrollWinEvent & event) : wxEvent(event) + { m_commandInt = event.m_commandInt; + m_extraLong = event.m_extraLong; } int GetOrientation() const { return (int) m_extraLong ; } int GetPosition() const { return m_commandInt ; } @@ -602,10 +608,8 @@ class WXDLLEXPORT wxMouseEvent : public wxEvent { public: wxMouseEvent(wxEventType mouseType = wxEVT_NULL); - wxMouseEvent(const wxMouseEvent& event) { Assign(event); } - - wxMouseEvent& operator=(const wxMouseEvent& event) - { Assign(event); return *this; } + wxMouseEvent(const wxMouseEvent& event) : wxEvent(event) + { Assign(event); } // Was it a button event? (*doesn't* mean: is any button *down*?) bool IsButton() const { return Button(wxMOUSE_BTN_ANY); } @@ -734,8 +738,13 @@ public: // wheel action. Defaults to one. int GetLinesPerAction() const { return m_linesPerAction; } + // Is the system set to do page scrolling? + bool IsPageScroll() const { return ((unsigned int)m_linesPerAction == UINT_MAX); } + virtual wxEvent *Clone() const { return new wxMouseEvent(*this); } + wxMouseEvent& operator=(const wxMouseEvent& event) { Assign(event); return *this; } + public: wxCoord m_x, m_y; @@ -773,6 +782,13 @@ public: m_x(x), m_y(y), m_cursor() { } + wxSetCursorEvent(const wxSetCursorEvent & event) + : wxEvent(event), + m_x(event.m_x), + m_y(event.m_y), + m_cursor(event.m_cursor) + { } + wxCoord GetX() const { return m_x; } wxCoord GetY() const { return m_y; } @@ -803,6 +819,7 @@ class WXDLLEXPORT wxKeyEvent : public wxEvent { public: wxKeyEvent(wxEventType keyType = wxEVT_NULL); + wxKeyEvent(const wxKeyEvent& evt); // Find state of shift/control keys bool ControlDown() const { return m_controlDown; } @@ -848,8 +865,8 @@ public: // Get Y position wxCoord GetY() const { return m_y; } - // deprecated - long KeyCode() const { return m_keyCode; } + // deprecated, Use GetKeyCode instead. + wxDEPRECATED( long KeyCode() const ); virtual wxEvent *Clone() const { return new wxKeyEvent(*this); } @@ -884,8 +901,14 @@ public: bool m_metaDown; bool m_scanCode; - // these fields contain the platform-specific information about the pressed - // key +#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 wxUint32 m_rawCode; wxUint32 m_rawFlags; @@ -907,6 +930,10 @@ public: : wxEvent(id, wxEVT_SIZE), m_size(sz) { } + wxSizeEvent(const wxSizeEvent & event) + : wxEvent(event), + m_size(event.m_size) + { } wxSize GetSize() const { return m_size; } @@ -935,6 +962,10 @@ public: : wxEvent(id, wxEVT_MOVE), m_pos(pos) { } + wxMoveEvent(const wxMoveEvent& event) + : wxEvent(event), + m_pos(event.m_pos) + { } wxPoint GetPosition() const { return m_pos; } @@ -1089,6 +1120,9 @@ public: wxActivateEvent(wxEventType type = wxEVT_NULL, bool active = TRUE, int Id = 0) : wxEvent(Id, type) { m_active = active; } + wxActivateEvent(const wxActivateEvent& event) + : wxEvent(event) + { m_active = event.m_active; } bool GetActive() const { return m_active; } @@ -1132,6 +1166,9 @@ public: wxMenuEvent(wxEventType type = wxEVT_NULL, int id = 0) : wxEvent(id, type) { m_menuId = id; } + wxMenuEvent(const wxMenuEvent & event) + : wxEvent(event) + { m_menuId = event.m_menuId; } // only for wxEVT_MENU_HIGHLIGHT int GetMenuId() const { return m_menuId; } @@ -1167,6 +1204,16 @@ public: m_force = FALSE; #endif // WXWIN_COMPATIBILITY } + wxCloseEvent(const wxCloseEvent & event) + : wxEvent(event), + m_loggingOff(event.m_loggingOff), + m_veto(event.m_veto), + m_canVeto(event.m_canVeto) + { +#if WXWIN_COMPATIBILITY + m_force = event.m_force; +#endif // WXWIN_COMPATIBILITY + } void SetLoggingOff(bool logOff) { m_loggingOff = logOff; } bool GetLoggingOff() const { return m_loggingOff; } @@ -1217,6 +1264,9 @@ public: wxShowEvent(int id = 0, bool show = FALSE) : wxEvent(id, wxEVT_SHOW) { m_show = show; } + wxShowEvent(const wxShowEvent & event) + : wxEvent(event) + { m_show = event.m_show; } void SetShow(bool show) { m_show = show; } bool GetShow() const { return m_show; } @@ -1240,6 +1290,9 @@ public: wxIconizeEvent(int id = 0, bool iconized = TRUE) : wxEvent(id, wxEVT_ICONIZE) { m_iconized = iconized; } + wxIconizeEvent(const wxIconizeEvent & event) + : wxEvent(event) + { m_iconized = event.m_iconized; } // return true if the frame was iconized, false if restored bool Iconized() const { return m_iconized; } @@ -1315,6 +1368,14 @@ public: m_joyStick(joystick) { } + wxJoystickEvent(const wxJoystickEvent & event) + : 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) + { } wxPoint GetPosition() const { return m_pos; } int GetZPosition() const { return m_zPosition; } @@ -1426,9 +1487,18 @@ public: m_checked = m_enabled = m_setEnabled = - m_setText = + m_setText = m_setChecked = FALSE; } + wxUpdateUIEvent(const wxUpdateUIEvent & event) + : wxCommandEvent(event), + m_checked(event.m_checked), + m_enabled(event.m_enabled), + m_setEnabled(event.m_setEnabled), + 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; } @@ -1564,6 +1634,10 @@ public: : wxEvent(id, wxEVT_QUERY_NEW_PALETTE), m_paletteRealized(FALSE) { } + wxQueryNewPaletteEvent(const wxQueryNewPaletteEvent & event) + : wxEvent(event), + m_paletteRealized(event.m_paletteRealized) + { } // App sets this if it changes the palette. void SetPaletteRealized(bool realized) { m_paletteRealized = realized; } @@ -1695,6 +1769,12 @@ public: : wxCommandEvent(type, id), m_pos(pt), m_target(), m_link() { } + wxHelpEvent(const wxHelpEvent & event) + : wxCommandEvent(event), + m_pos(event.m_pos), + m_target(event.m_target), + m_link(event.m_link) + { } // Position of event (in screen coordinates) const wxPoint& GetPosition() const { return m_pos; } @@ -1736,6 +1816,10 @@ public: : wxCommandEvent(type, id), m_pos(pt) { } + wxContextMenuEvent(const wxContextMenuEvent & event) + : wxCommandEvent(event), + m_pos(event.m_pos) + { } // Position of event (in screen coordinates) const wxPoint& GetPosition() const { return m_pos; } @@ -1762,6 +1846,10 @@ public: : wxEvent(0, wxEVT_IDLE), m_requestMore(FALSE) { } + wxIdleEvent(const wxIdleEvent & event) + : wxEvent(event), + m_requestMore(event.m_requestMore) + { } void RequestMore(bool needMore = TRUE) { m_requestMore = needMore; } bool MoreRequested() const { return m_requestMore; } @@ -2067,8 +2155,8 @@ typedef void (wxEvtHandler::*wxUpdateUIEventFunction)(wxUpdateUIEvent&); typedef void (wxEvtHandler::*wxIdleEventFunction)(wxIdleEvent&); typedef void (wxEvtHandler::*wxCloseEventFunction)(wxCloseEvent&); typedef void (wxEvtHandler::*wxShowEventFunction)(wxShowEvent&); -typedef void (wxEvtHandler::*wxIconizeEventFunction)(wxShowEvent&); -typedef void (wxEvtHandler::*wxMaximizeEventFunction)(wxShowEvent&); +typedef void (wxEvtHandler::*wxIconizeEventFunction)(wxIconizeEvent&); +typedef void (wxEvtHandler::*wxMaximizeEventFunction)(wxMaximizeEvent&); typedef void (wxEvtHandler::*wxNavigationKeyEventFunction)(wxNavigationKeyEvent&); typedef void (wxEvtHandler::*wxPaletteChangedEventFunction)(wxPaletteChangedEvent&); typedef void (wxEvtHandler::*wxQueryNewPaletteEventFunction)(wxQueryNewPaletteEvent&); @@ -2211,7 +2299,8 @@ typedef void (wxEvtHandler::*wxMouseCaptureChangedEventFunction)(wxMouseCaptureC DECLARE_EVENT_TABLE_ENTRY( wxEVT_SCROLL_PAGEUP, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, (wxObject *) NULL ),\ DECLARE_EVENT_TABLE_ENTRY( wxEVT_SCROLL_PAGEDOWN, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, (wxObject *) NULL ),\ DECLARE_EVENT_TABLE_ENTRY( wxEVT_SCROLL_THUMBTRACK, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, (wxObject *) NULL ),\ - DECLARE_EVENT_TABLE_ENTRY( wxEVT_SCROLL_THUMBRELEASE, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, (wxObject *) NULL ), + DECLARE_EVENT_TABLE_ENTRY( wxEVT_SCROLL_THUMBRELEASE, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, (wxObject *) NULL ), \ + DECLARE_EVENT_TABLE_ENTRY( wxEVT_SCROLL_ENDSCROLL, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, (wxObject *) NULL ), #define EVT_SCROLL_TOP(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_SCROLL_TOP, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, (wxObject *) NULL ), #define EVT_SCROLL_BOTTOM(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_SCROLL_BOTTOM, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, (wxObject *) NULL ), @@ -2221,6 +2310,7 @@ typedef void (wxEvtHandler::*wxMouseCaptureChangedEventFunction)(wxMouseCaptureC #define EVT_SCROLL_PAGEDOWN(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_SCROLL_PAGEDOWN, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, (wxObject *) NULL ), #define EVT_SCROLL_THUMBTRACK(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_SCROLL_THUMBTRACK, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, (wxObject *) NULL ), #define EVT_SCROLL_THUMBRELEASE(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_SCROLL_THUMBRELEASE, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, (wxObject *) NULL ), +#define EVT_SCROLL_ENDSCROLL(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_SCROLL_ENDSCROLL, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, (wxObject *) NULL ), // Scrolling from wxSlider and wxScrollBar, with an id #define EVT_COMMAND_SCROLL(id, func) \ @@ -2231,7 +2321,8 @@ typedef void (wxEvtHandler::*wxMouseCaptureChangedEventFunction)(wxMouseCaptureC DECLARE_EVENT_TABLE_ENTRY( wxEVT_SCROLL_PAGEUP, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, (wxObject *) NULL ),\ DECLARE_EVENT_TABLE_ENTRY( wxEVT_SCROLL_PAGEDOWN, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, (wxObject *) NULL ),\ DECLARE_EVENT_TABLE_ENTRY( wxEVT_SCROLL_THUMBTRACK, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, (wxObject *) NULL ),\ - DECLARE_EVENT_TABLE_ENTRY( wxEVT_SCROLL_THUMBRELEASE, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, (wxObject *) NULL ), + DECLARE_EVENT_TABLE_ENTRY( wxEVT_SCROLL_THUMBRELEASE, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, (wxObject *) NULL ), \ + DECLARE_EVENT_TABLE_ENTRY( wxEVT_SCROLL_ENDSCROLL, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, (wxObject *) NULL ), #define EVT_COMMAND_SCROLL_TOP(id, func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_SCROLL_TOP, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, (wxObject *) NULL ), #define EVT_COMMAND_SCROLL_BOTTOM(id, func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_SCROLL_BOTTOM, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, (wxObject *) NULL ), @@ -2241,6 +2332,7 @@ typedef void (wxEvtHandler::*wxMouseCaptureChangedEventFunction)(wxMouseCaptureC #define EVT_COMMAND_SCROLL_PAGEDOWN(id, func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_SCROLL_PAGEDOWN, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, (wxObject *) NULL ), #define EVT_COMMAND_SCROLL_THUMBTRACK(id, func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_SCROLL_THUMBTRACK, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, (wxObject *) NULL ), #define EVT_COMMAND_SCROLL_THUMBRELEASE(id, func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_SCROLL_THUMBRELEASE, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, (wxObject *) NULL ), +#define EVT_COMMAND_SCROLL_ENDSCROLL(id, func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_SCROLL_ENDSCROLL, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, (wxObject *) NULL ), // Convenience macros for commonly-used commands #define EVT_BUTTON(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_BUTTON_CLICKED, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL ), @@ -2274,15 +2366,22 @@ typedef void (wxEvtHandler::*wxMouseCaptureChangedEventFunction)(wxMouseCaptureC #define EVT_COMMAND_ENTER(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_ENTER, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL ), // Joystick events -#define EVT_JOY_DOWN(func) \ + +#define EVT_JOY_BUTTON_DOWN(func) \ DECLARE_EVENT_TABLE_ENTRY( wxEVT_JOY_BUTTON_DOWN, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxJoystickEventFunction) & func, (wxObject *) NULL ), -#define EVT_JOY_UP(func) \ +#define EVT_JOY_BUTTON_UP(func) \ DECLARE_EVENT_TABLE_ENTRY( wxEVT_JOY_BUTTON_UP, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxJoystickEventFunction) & func, (wxObject *) NULL ), #define EVT_JOY_MOVE(func) \ DECLARE_EVENT_TABLE_ENTRY( wxEVT_JOY_MOVE, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxJoystickEventFunction) & func, (wxObject *) NULL ), #define EVT_JOY_ZMOVE(func) \ DECLARE_EVENT_TABLE_ENTRY( wxEVT_JOY_ZMOVE, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxJoystickEventFunction) & func, (wxObject *) NULL ), +// These are obsolete, see _BUTTON_ events +#define EVT_JOY_DOWN(func) \ + DECLARE_EVENT_TABLE_ENTRY( wxEVT_JOY_BUTTON_DOWN, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxJoystickEventFunction) & func, (wxObject *) NULL ), +#define EVT_JOY_UP(func) \ + DECLARE_EVENT_TABLE_ENTRY( wxEVT_JOY_BUTTON_UP, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxJoystickEventFunction) & func, (wxObject *) NULL ), + // All joystick events #define EVT_JOYSTICK_EVENTS(func) \ DECLARE_EVENT_TABLE_ENTRY( wxEVT_JOY_BUTTON_DOWN, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxJoystickEventFunction) & func, (wxObject *) NULL ),\