X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d2c52078dc8bf1f6f69b9f1693860d6345686767..bf7d7ee7062f7f6028df40e43745235658e38b4d:/include/wx/event.h diff --git a/include/wx/event.h b/include/wx/event.h index f7bddba9b7..4f64c38725 100644 --- a/include/wx/event.h +++ b/include/wx/event.h @@ -419,7 +419,7 @@ public: void CopyObject(wxObject& obj) const; -#ifdef WXWIN_COMPATIBILITY_2 +#if WXWIN_COMPATIBILITY_2 bool Checked() const { return IsChecked(); } #endif // WXWIN_COMPATIBILITY_2 @@ -506,8 +506,6 @@ public: class WXDLLEXPORT wxScrollWinEvent : public wxEvent { - DECLARE_DYNAMIC_CLASS(wxScrollWinEvent) - public: wxScrollWinEvent(wxEventType commandType = wxEVT_NULL, int pos = 0, int orient = 0); @@ -523,9 +521,12 @@ public: void SetPosition(int pos) { m_commandInt = pos; } void CopyObject(wxObject& object_dest) const; + public: int m_commandInt; // Additional information long m_extraLong; + + DECLARE_DYNAMIC_CLASS(wxScrollWinEvent) }; // Mouse event class @@ -559,8 +560,6 @@ public: class WXDLLEXPORT wxMouseEvent : public wxEvent { - DECLARE_DYNAMIC_CLASS(wxMouseEvent) - public: wxMouseEvent(wxEventType mouseType = wxEVT_NULL); @@ -582,6 +581,9 @@ public: // Was the given button 1,2,3 or any in Down state? bool ButtonIsDown(int but) const; + // Get the button which is changing state (-1 if none) + int GetButton() const; + // Find state of shift/control keys bool ControlDown() const { return m_controlDown; } bool MetaDown() const { return m_metaDown; } @@ -706,6 +708,9 @@ public: int m_wheelRotation; int m_wheelDelta; int m_linesPerAction; + +private: + DECLARE_DYNAMIC_CLASS(wxMouseEvent) }; // Cursor set event @@ -886,6 +891,15 @@ public: #endif // debug }; +class WXDLLEXPORT wxNcPaintEvent : public wxEvent +{ +public: + wxNcPaintEvent(int id = 0) : wxEvent(id) { SetEventType(wxEVT_NC_PAINT); } + +private: + DECLARE_DYNAMIC_CLASS(wxNcPaintEvent) +}; + // Erase background event class /* wxEVT_ERASE_BACKGROUND @@ -913,11 +927,22 @@ public: class WXDLLEXPORT wxFocusEvent : public wxEvent { - DECLARE_DYNAMIC_CLASS(wxFocusEvent) - public: - wxFocusEvent(wxEventType type = wxEVT_NULL, int Id = 0) - { m_eventType = type; m_id = Id; } + wxFocusEvent(wxEventType type = wxEVT_NULL, int id = 0) + { m_eventType = type; m_id = id; m_win = NULL; } + + // the window associated with this event is the window which had focus + // before for SET event and the window which will have focus for the KILL + // one + // + // NB: it may be NULL in both cases! + wxWindow *GetWindow() const { return m_win; } + void SetWindow(wxWindow *win) { m_win = win; } + +private: + wxWindow *m_win; + + DECLARE_DYNAMIC_CLASS(wxFocusEvent) }; // Activate event class @@ -961,7 +986,6 @@ public: wxEVT_MENU_INIT, wxEVT_MENU_HIGHLIGHT, wxEVT_POPUP_MENU_INIT, - wxEVT_CONTEXT_MENU, */ class WXDLLEXPORT wxMenuEvent : public wxEvent @@ -1044,10 +1068,7 @@ protected: class WXDLLEXPORT wxShowEvent : public wxEvent { - DECLARE_DYNAMIC_CLASS(wxShowEvent) - public: - wxShowEvent(int id = 0, bool show = FALSE) { m_eventType = wxEVT_SHOW; m_id = id; m_show = show; } @@ -1058,6 +1079,8 @@ public: protected: bool m_show; + + DECLARE_DYNAMIC_CLASS(wxShowEvent) }; /* @@ -1066,11 +1089,17 @@ protected: class WXDLLEXPORT wxIconizeEvent : public wxEvent { - DECLARE_DYNAMIC_CLASS(wxIconizeEvent) - public: - wxIconizeEvent(int id = 0) - { m_eventType = wxEVT_ICONIZE; m_id = id; } + wxIconizeEvent(int id = 0, bool iconized = TRUE) + { m_eventType = wxEVT_ICONIZE; m_id = id; m_iconized = iconized; } + + // return true if the frame was iconized, false if restored + bool Iconized() const { return m_iconized; } + +protected: + bool m_iconized; + + DECLARE_DYNAMIC_CLASS(wxIconizeEvent) }; /* @@ -1079,11 +1108,11 @@ public: class WXDLLEXPORT wxMaximizeEvent : public wxEvent { - DECLARE_DYNAMIC_CLASS(wxMaximizeEvent) - public: - wxMaximizeEvent(int id = 0) - { m_eventType = wxEVT_MAXIMIZE; m_id = id; } + wxMaximizeEvent(int id = 0) + { m_eventType = wxEVT_MAXIMIZE; m_id = id; } + + DECLARE_DYNAMIC_CLASS(wxMaximizeEvent) }; // Joystick event class @@ -1425,6 +1454,37 @@ private: DECLARE_DYNAMIC_CLASS(wxHelpEvent) }; +// 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 +// Under other systems it may have to be generated from a right click event +/* + wxEVT_CONTEXT_MENU +*/ + +class WXDLLEXPORT wxContextMenuEvent : public wxCommandEvent +{ +public: + wxContextMenuEvent(wxEventType type = wxEVT_NULL, + wxWindowID id = 0, + const wxPoint& pt = wxDefaultPosition) + { + m_eventType = type; + m_id = id; + m_pos = pt; + } + + // Position of event (in screen coordinates) + const wxPoint& GetPosition() const { return m_pos; } + void SetPosition(const wxPoint& pos) { m_pos = pos; } + +protected: + wxPoint m_pos; + +private: + DECLARE_DYNAMIC_CLASS(wxContextMenuEvent) +}; + #endif // wxUSE_GUI // Idle event @@ -1705,6 +1765,7 @@ typedef void (wxEvtHandler::*wxWindowDestroyEventFunction)(wxWindowDestroyEvent& typedef void (wxEvtHandler::*wxSetCursorEventFunction)(wxSetCursorEvent&); typedef void (wxEvtHandler::*wxNotifyEventFunction)(wxNotifyEvent&); typedef void (wxEvtHandler::*wxHelpEventFunction)(wxHelpEvent&); +typedef void (wxEvtHandler::*wxContextMenuEventFunction)(wxContextMenuEvent&); #endif // wxUSE_GUI // N.B. In GNU-WIN32, you *have* to take the address of a member function @@ -1741,6 +1802,7 @@ typedef void (wxEvtHandler::*wxHelpEventFunction)(wxHelpEvent&); #define EVT_END_SESSION(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_END_SESSION, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxCloseEventFunction) & func, (wxObject *) NULL ), #define EVT_QUERY_END_SESSION(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_QUERY_END_SESSION, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxCloseEventFunction) & func, (wxObject *) NULL ), #define EVT_PAINT(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_PAINT, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxPaintEventFunction) & func, (wxObject *) NULL ), +#define EVT_NC_PAINT(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_NC_PAINT, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxPaintEventFunction) & func, (wxObject *) NULL ), #define EVT_ERASE_BACKGROUND(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_ERASE_BACKGROUND, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxEraseEventFunction) & func, (wxObject *) NULL ), #define EVT_CHAR(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_CHAR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxCharEventFunction) & func, (wxObject *) NULL ), #define EVT_KEY_DOWN(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_KEY_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxCharEventFunction) & func, (wxObject *) NULL ), @@ -1935,6 +1997,10 @@ typedef void (wxEvtHandler::*wxHelpEventFunction)(wxHelpEvent&); #define EVT_DETAILED_HELP_RANGE(id1, id2, func) \ DECLARE_EVENT_TABLE_ENTRY( wxEVT_DETAILED_HELP, id1, id2, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxHelpEventFunction) & func, (wxObject *) NULL ), +// Context Menu Events +#define EVT_CONTEXT_MENU(func) \ + DECLARE_EVENT_TABLE_ENTRY(wxEVT_CONTEXT_MENU, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxContextMenuEventFunction) & func, (wxObject *) NULL ), + // ---------------------------------------------------------------------------- // Global data // ----------------------------------------------------------------------------