X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b483f5fed274a9152faab05b0ebb4e5f5158c506..75ce4cb180dfbe5f6ee1ad6927929b43d04edcd1:/include/wx/event.h diff --git a/include/wx/event.h b/include/wx/event.h index f7e28edb76..f86816198d 100644 --- a/include/wx/event.h +++ b/include/wx/event.h @@ -155,9 +155,12 @@ BEGIN_DECLARE_EVENT_TYPES() DECLARE_EVENT_TYPE(wxEVT_COMMAND_TOOL_ENTER, 17) DECLARE_EVENT_TYPE(wxEVT_COMMAND_SPINCTRL_UPDATED, 18) + // Toolbar dropdown arrows + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TOOL_DROPDOWN_CLICKED, 19) + // Sockets and timers send events, too DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_BASE, wxEVT_SOCKET, 50) - DECLARE_EVENT_TYPE(wxEVT_TIMER , 80) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_BASE, wxEVT_TIMER , 80) // Mouse event types DECLARE_EVENT_TYPE(wxEVT_LEFT_DOWN, 100) @@ -353,7 +356,7 @@ public: // to allow the event processing by the base classes (calling event.Skip() // is the analog of calling the base class version of a virtual function) void Skip(bool skip = true) { m_skipped = skip; } - bool GetSkipped() const { return m_skipped; }; + bool GetSkipped() const { return m_skipped; } // this function is used to create a copy of the event polymorphically and // all derived classes must implement it because otherwise wxPostEvent() @@ -384,11 +387,7 @@ public: m_propagationLevel = propagationLevel; } -#if WXWIN_COMPATIBILITY_2_4 -public: -#else protected: -#endif wxObject* m_eventObject; wxEventType m_eventType; long m_timeStamp; @@ -406,11 +405,7 @@ protected: // backwards compatibility as it is new int m_propagationLevel; -#if WXWIN_COMPATIBILITY_2_4 -public: -#else protected: -#endif bool m_skipped; bool m_isCommandEvent; @@ -492,26 +487,6 @@ private: wxEVT_COMMAND_TOGGLEBUTTON_CLICKED */ -#if WXWIN_COMPATIBILITY_2_4 -// Backwards compatibility for wxCommandEvent::m_commandString, will lead to compilation errors in some cases of usage -class WXDLLIMPEXP_CORE wxCommandEvent; - -class WXDLLIMPEXP_CORE wxCommandEventStringHelper -{ -public: - wxCommandEventStringHelper(wxCommandEvent * evt) - : m_evt(evt) - { } - - void operator=(const wxString &str); - operator wxString(); - const wxChar* c_str() const; - -private: - wxCommandEvent* m_evt; -}; -#endif - class WXDLLIMPEXP_CORE wxCommandEvent : public wxEvent { public: @@ -519,9 +494,6 @@ public: wxCommandEvent(const wxCommandEvent& event) : wxEvent(event), -#if WXWIN_COMPATIBILITY_2_4 - m_commandString(this), -#endif m_cmdString(event.m_cmdString), m_commandInt(event.m_commandInt), m_extraLong(event.m_extraLong), @@ -558,12 +530,7 @@ public: virtual wxEvent *Clone() const { return new wxCommandEvent(*this); } -#if WXWIN_COMPATIBILITY_2_4 -public: - wxCommandEventStringHelper m_commandString; -#else protected: -#endif wxString m_cmdString; // String event argument int m_commandInt; long m_extraLong; // Additional information (e.g. select/deselect) @@ -574,23 +541,6 @@ private: DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCommandEvent) }; -#if WXWIN_COMPATIBILITY_2_4 -inline void wxCommandEventStringHelper::operator=(const wxString &str) -{ - m_evt->SetString(str); -} - -inline wxCommandEventStringHelper::operator wxString() -{ - return m_evt->GetString(); -} - -inline const wxChar* wxCommandEventStringHelper::c_str() const -{ - return m_evt->GetString().c_str(); -} -#endif - // this class adds a possibility to react (from the user) code to a control // notification: allow or veto the operation being reported. class WXDLLIMPEXP_CORE wxNotifyEvent : public wxCommandEvent @@ -682,11 +632,7 @@ public: virtual wxEvent *Clone() const { return new wxScrollWinEvent(*this); } -#if WXWIN_COMPATIBILITY_2_4 -public: -#else protected: -#endif int m_commandInt; long m_extraLong; @@ -1148,11 +1094,7 @@ public: virtual wxEvent *Clone() const { return new wxMoveEvent(*this); } -#if WXWIN_COMPATIBILITY_2_4 -public: -#else protected: -#endif wxPoint m_pos; wxRect m_rect; @@ -1240,11 +1182,7 @@ public: virtual wxEvent *Clone() const { return new wxEraseEvent(*this); } -#if WXWIN_COMPATIBILITY_2_4 -public: -#else protected: -#endif wxDC *m_dc; private: @@ -1530,11 +1468,7 @@ enum class WXDLLIMPEXP_CORE wxJoystickEvent : public wxEvent { -#if WXWIN_COMPATIBILITY_2_4 -public: -#else protected: -#endif wxPoint m_pos; int m_zPosition; int m_buttonChange; // Which button changed? @@ -1797,7 +1731,7 @@ public: virtual wxEvent *Clone() const { return new wxMouseCaptureChangedEvent(*this); } - wxWindow* GetCapturedWindow() const { return m_gainedCapture; }; + wxWindow* GetCapturedWindow() const { return m_gainedCapture; } private: wxWindow* m_gainedCapture; @@ -2134,6 +2068,8 @@ private: DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxContextMenuEvent) }; +#endif // wxUSE_GUI + // Idle event /* wxEVT_IDLE @@ -2153,7 +2089,7 @@ enum wxIdleMode wxIDLE_PROCESS_SPECIFIED }; -class WXDLLIMPEXP_CORE wxIdleEvent : public wxEvent +class WXDLLIMPEXP_BASE wxIdleEvent : public wxEvent { public: wxIdleEvent() @@ -2178,9 +2114,6 @@ public: // Returns the idle event mode static wxIdleMode GetMode() { return sm_idleMode; } - // Can we send an idle event? - static bool CanSend(wxWindow* win); - protected: bool m_requestMore; static wxIdleMode sm_idleMode; @@ -2189,8 +2122,6 @@ private: DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxIdleEvent) }; -#endif // wxUSE_GUI - /* TODO wxEVT_MOUSE_CAPTURE_CHANGED, wxEVT_SETTING_CHANGED, // WM_WININICHANGE (NT) / WM_SETTINGCHANGE (Win95) @@ -2354,8 +2285,10 @@ public: // Clear table void Clear(); +#if defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING // Clear all tables static void ClearAll(); +#endif // __WXDEBUG__ && wxUSE_MEMORY_TRACING protected: // Init the hash table with the entries of the static event table. @@ -2404,12 +2337,12 @@ public: virtual bool ProcessEvent(wxEvent& event); // add an event to be processed later - void AddPendingEvent(wxEvent& event); + virtual void AddPendingEvent(const wxEvent& event); void ProcessPendingEvents(); #if wxUSE_THREADS - bool ProcessThreadEvent(wxEvent& event); + bool ProcessThreadEvent(const wxEvent& event); #endif // Dynamic association of a member function handler with the event handler, @@ -2565,7 +2498,7 @@ private: // Post a message to the given eventhandler which will be processed during the // next event loop iteration -inline void wxPostEvent(wxEvtHandler *dest, wxEvent& event) +inline void wxPostEvent(wxEvtHandler *dest, const wxEvent& event) { wxCHECK_RET( dest, wxT("need an object to post event to in wxPostEvent") ); @@ -2641,13 +2574,6 @@ typedef void (wxEvtHandler::*wxMouseCaptureChangedEventFunction)(wxMouseCaptureC typedef void (wxEvtHandler::*wxMouseCaptureLostEventFunction)(wxMouseCaptureLostEvent&); typedef void (wxEvtHandler::*wxClipboardTextEventFunction)(wxClipboardTextEvent&); -// these typedefs don't have the same name structure as the others, keep for -// backwards compatibility only -#if WXWIN_COMPATIBILITY_2_4 - typedef wxSysColourChangedEventFunction wxSysColourChangedFunction; - typedef wxDisplayChangedEventFunction wxDisplayChangedFunction; -#endif // WXWIN_COMPATIBILITY_2_4 - #define wxCommandEventHandler(func) \ (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxCommandEventFunction, &func) @@ -3064,6 +2990,7 @@ typedef void (wxEvtHandler::*wxClipboardTextEventFunction)(wxClipboardTextEvent& #define EVT_VLBOX(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_VLBOX_SELECTED, winid, wxCommandEventHandler(func)) #define EVT_COMBOBOX(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_COMBOBOX_SELECTED, winid, wxCommandEventHandler(func)) #define EVT_TOOL(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_TOOL_CLICKED, winid, wxCommandEventHandler(func)) +#define EVT_TOOL_DROPDOWN(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_TOOL_DROPDOWN_CLICKED, winid, wxCommandEventHandler(func)) #define EVT_TOOL_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_COMMAND_TOOL_CLICKED, id1, id2, wxCommandEventHandler(func)) #define EVT_TOOL_RCLICKED(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_TOOL_RCLICKED, winid, wxCommandEventHandler(func)) #define EVT_TOOL_RCLICKED_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_COMMAND_TOOL_RCLICKED, id1, id2, wxCommandEventHandler(func)) @@ -3086,12 +3013,6 @@ typedef void (wxEvtHandler::*wxClipboardTextEventFunction)(wxClipboardTextEvent& #define EVT_JOY_MOVE(func) wx__DECLARE_EVT0(wxEVT_JOY_MOVE, wxJoystickEventHandler(func)) #define EVT_JOY_ZMOVE(func) wx__DECLARE_EVT0(wxEVT_JOY_ZMOVE, wxJoystickEventHandler(func)) -// These are obsolete, see _BUTTON_ events -#if WXWIN_COMPATIBILITY_2_4 - #define EVT_JOY_DOWN(func) EVT_JOY_BUTTON_DOWN(func) - #define EVT_JOY_UP(func) EVT_JOY_BUTTON_UP(func) -#endif // WXWIN_COMPATIBILITY_2_4 - // All joystick events #define EVT_JOYSTICK_EVENTS(func) \ EVT_JOY_BUTTON_DOWN(func) \