+ // shortcut masks
+
+ // this category groups those events which are emitted in response to
+ // events of the native toolkit and which typically are not-"delayable".
+ wxEVT_CATEGORY_NATIVE_EVENTS = wxEVT_CATEGORY_UI|wxEVT_CATEGORY_USER_INPUT,
+
+ // used in wxEventLoopBase::YieldFor to specify all event categories should be processed:
+ wxEVT_CATEGORY_ALL =
+ wxEVT_CATEGORY_UI|wxEVT_CATEGORY_USER_INPUT|wxEVT_CATEGORY_SOCKET| \
+ wxEVT_CATEGORY_TIMER|wxEVT_CATEGORY_THREAD|wxEVT_CATEGORY_UNKNOWN| \
+ wxEVT_CATEGORY_CLIPBOARD
+};
+
+/*
+ * wxWidgets events, covering all interesting things that might happen
+ * (button clicking, resizing, setting text in widgets, etc.).
+ *
+ * For each completely new event type, derive a new event class.
+ * An event CLASS represents a C++ class defining a range of similar event TYPES;
+ * examples are canvas events, panel item command events.
+ * An event TYPE is a unique identifier for a particular system event,
+ * such as a button press or a listbox deselection.
+ *
+ */
+
+class WXDLLIMPEXP_BASE wxEvent : public wxObject
+{
+public:
+ wxEvent(int winid = 0, wxEventType commandType = wxEVT_NULL );
+
+ void SetEventType(wxEventType typ) { m_eventType = typ; }
+ wxEventType GetEventType() const { return m_eventType; }
+
+ wxObject *GetEventObject() const { return m_eventObject; }
+ void SetEventObject(wxObject *obj) { m_eventObject = obj; }
+
+ long GetTimestamp() const { return m_timeStamp; }
+ void SetTimestamp(long ts = 0) { m_timeStamp = ts; }
+
+ int GetId() const { return m_id; }
+ void SetId(int Id) { m_id = Id; }
+
+ // Returns the user data optionally associated with the event handler when
+ // using Connect() or Bind().
+ wxObject *GetEventUserData() const { return m_callbackUserData; }
+
+ // Can instruct event processor that we wish to ignore this event
+ // (treat as if the event table entry had not been found): this must be done
+ // 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; }
+
+ // This function is used to create a copy of the event polymorphically and
+ // all derived classes must implement it because otherwise wxPostEvent()
+ // for them wouldn't work (it needs to do a copy of the event)
+ virtual wxEvent *Clone() const = 0;
+
+ // this function is used to selectively process events in wxEventLoopBase::YieldFor
+ // NOTE: by default it returns wxEVT_CATEGORY_UI just because the major
+ // part of wxWidgets events belong to that category.
+ virtual wxEventCategory GetEventCategory() const
+ { return wxEVT_CATEGORY_UI; }
+
+ // Implementation only: this test is explicitly anti OO and this function
+ // exists only for optimization purposes.
+ bool IsCommandEvent() const { return m_isCommandEvent; }
+
+ // Determine if this event should be propagating to the parent window.
+ bool ShouldPropagate() const
+ { return m_propagationLevel != wxEVENT_PROPAGATE_NONE; }
+
+ // Stop an event from propagating to its parent window, returns the old
+ // propagation level value
+ int StopPropagation()
+ {
+ int propagationLevel = m_propagationLevel;
+ m_propagationLevel = wxEVENT_PROPAGATE_NONE;
+ return propagationLevel;
+ }
+
+ // Resume the event propagation by restoring the propagation level
+ // (returned by StopPropagation())
+ void ResumePropagation(int propagationLevel)
+ {
+ m_propagationLevel = propagationLevel;
+ }
+
+
+ // This is for internal use only and is only called by
+ // wxEvtHandler::ProcessEvent() to check whether it's the first time this
+ // event is being processed
+ bool WasProcessed()
+ {
+ if ( m_wasProcessed )
+ return true;
+
+ m_wasProcessed = true;
+
+ return false;
+ }
+
+ // This is for internal use only and is used for setting, testing and
+ // resetting of m_willBeProcessedAgain flag.
+ void SetWillBeProcessedAgain()
+ {
+ m_willBeProcessedAgain = true;
+ }
+
+ bool WillBeProcessedAgain()
+ {
+ if ( m_willBeProcessedAgain )
+ {
+ m_willBeProcessedAgain = false;
+ return true;
+ }
+
+ return false;
+ }
+
+ // This is also used only internally by ProcessEvent() to check if it
+ // should process the event normally or only restrict the search for the
+ // event handler to this object itself.
+ bool ShouldProcessOnlyIn(wxEvtHandler *h) const
+ {
+ return h == m_handlerToProcessOnlyIn;
+ }
+
+ // Called to indicate that the result of ShouldProcessOnlyIn() wasn't taken
+ // into account. The existence of this function may seem counterintuitive
+ // but unfortunately it's needed by wxScrollHelperEvtHandler, see comments
+ // there. Don't even think of using this in your own code, this is a gross
+ // hack and is only needed because of wx complicated history and should
+ // never be used anywhere else.
+ void DidntHonourProcessOnlyIn()
+ {
+ m_handlerToProcessOnlyIn = NULL;
+ }
+
+protected:
+ wxObject* m_eventObject;
+ wxEventType m_eventType;
+ long m_timeStamp;
+ int m_id;
+
+public:
+ // m_callbackUserData is for internal usage only
+ wxObject* m_callbackUserData;
+
+private:
+ // If this handler
+ wxEvtHandler *m_handlerToProcessOnlyIn;
+
+protected:
+ // the propagation level: while it is positive, we propagate the event to
+ // the parent window (if any)
+ int m_propagationLevel;
+
+ bool m_skipped;
+ bool m_isCommandEvent;
+
+ // initially false but becomes true as soon as WasProcessed() is called for
+ // the first time, as this is done only by ProcessEvent() it explains the
+ // variable name: it becomes true after ProcessEvent() was called at least
+ // once for this event
+ bool m_wasProcessed;
+
+ // This one is initially false too, but can be set to true to indicate that
+ // the event will be passed to another handler if it's not processed in
+ // this one.
+ bool m_willBeProcessedAgain;
+
+protected:
+ wxEvent(const wxEvent&); // for implementing Clone()
+ wxEvent& operator=(const wxEvent&); // for derived classes operator=()
+
+private:
+ // it needs to access our m_propagationLevel
+ friend class WXDLLIMPEXP_FWD_BASE wxPropagateOnce;
+
+ // and this one needs to access our m_handlerToProcessOnlyIn
+ friend class WXDLLIMPEXP_FWD_BASE wxEventProcessInHandlerOnly;
+
+
+ DECLARE_ABSTRACT_CLASS(wxEvent)
+};
+
+/*
+ * Helper class to temporarily change an event not to propagate.
+ */
+class WXDLLIMPEXP_BASE wxPropagationDisabler
+{
+public:
+ wxPropagationDisabler(wxEvent& event) : m_event(event)
+ {
+ m_propagationLevelOld = m_event.StopPropagation();
+ }
+
+ ~wxPropagationDisabler()
+ {
+ m_event.ResumePropagation(m_propagationLevelOld);
+ }
+
+private:
+ wxEvent& m_event;
+ int m_propagationLevelOld;
+
+ wxDECLARE_NO_COPY_CLASS(wxPropagationDisabler);
+};
+
+/*
+ * Another one to temporarily lower propagation level.
+ */
+class WXDLLIMPEXP_BASE wxPropagateOnce
+{
+public:
+ wxPropagateOnce(wxEvent& event) : m_event(event)
+ {
+ wxASSERT_MSG( m_event.m_propagationLevel > 0,
+ wxT("shouldn't be used unless ShouldPropagate()!") );
+
+ m_event.m_propagationLevel--;
+ }
+
+ ~wxPropagateOnce()
+ {
+ m_event.m_propagationLevel++;
+ }
+
+private:
+ wxEvent& m_event;
+
+ wxDECLARE_NO_COPY_CLASS(wxPropagateOnce);
+};
+
+// A helper object used to temporarily make wxEvent::ShouldProcessOnlyIn()
+// return true for the handler passed to its ctor.
+class wxEventProcessInHandlerOnly
+{
+public:
+ wxEventProcessInHandlerOnly(wxEvent& event, wxEvtHandler *handler)
+ : m_event(event),
+ m_handlerToProcessOnlyInOld(event.m_handlerToProcessOnlyIn)
+ {
+ m_event.m_handlerToProcessOnlyIn = handler;
+ }
+
+ ~wxEventProcessInHandlerOnly()
+ {
+ m_event.m_handlerToProcessOnlyIn = m_handlerToProcessOnlyInOld;
+ }
+
+private:
+ wxEvent& m_event;
+ wxEvtHandler * const m_handlerToProcessOnlyInOld;
+
+ wxDECLARE_NO_COPY_CLASS(wxEventProcessInHandlerOnly);
+};
+
+
+class WXDLLIMPEXP_BASE wxEventBasicPayloadMixin
+{
+public:
+ wxEventBasicPayloadMixin()
+ : m_commandInt(0),
+ m_extraLong(0)
+ {
+ }
+
+ void SetString(const wxString& s) { m_cmdString = s; }
+ const wxString& GetString() const { return m_cmdString; }
+
+ void SetInt(int i) { m_commandInt = i; }
+ int GetInt() const { return m_commandInt; }
+
+ void SetExtraLong(long extraLong) { m_extraLong = extraLong; }
+ long GetExtraLong() const { return m_extraLong; }
+
+protected:
+ // Note: these variables have "cmd" or "command" in their name for backward compatibility:
+ // they used to be part of wxCommandEvent, not this mixin.
+ wxString m_cmdString; // String event argument
+ int m_commandInt;
+ long m_extraLong; // Additional information (e.g. select/deselect)
+
+ wxDECLARE_NO_ASSIGN_CLASS(wxEventBasicPayloadMixin);
+};
+
+class WXDLLIMPEXP_BASE wxEventAnyPayloadMixin : public wxEventBasicPayloadMixin
+{
+public:
+ wxEventAnyPayloadMixin() : wxEventBasicPayloadMixin() {}
+
+#if wxUSE_ANY && (!defined(__VISUALC__) || wxCHECK_VISUALC_VERSION(7))
+ template<typename T>
+ void SetPayload(const T& payload)
+ {
+ m_payload = payload;
+ }
+
+ template<typename T>
+ T GetPayload() const
+ {
+ return m_payload.As<T>();
+ }
+
+protected:
+ wxAny m_payload;
+#endif // wxUSE_ANY && (!defined(__VISUALC__) || wxCHECK_VISUALC_VERSION(7))
+
+ wxDECLARE_NO_ASSIGN_CLASS(wxEventBasicPayloadMixin);
+};
+
+
+// Idle event
+/*
+ wxEVT_IDLE
+ */
+
+// Whether to always send idle events to windows, or
+// to only send update events to those with the
+// wxWS_EX_PROCESS_IDLE style.
+
+enum wxIdleMode
+{
+ // Send idle events to all windows
+ wxIDLE_PROCESS_ALL,
+
+ // Send idle events to windows that have
+ // the wxWS_EX_PROCESS_IDLE flag specified
+ wxIDLE_PROCESS_SPECIFIED
+};
+
+class WXDLLIMPEXP_BASE wxIdleEvent : public wxEvent
+{
+public:
+ wxIdleEvent()
+ : 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; }
+
+ virtual wxEvent *Clone() const { return new wxIdleEvent(*this); }
+
+ // Specify how wxWidgets will send idle events: to
+ // all windows, or only to those which specify that they
+ // will process the events.
+ static void SetMode(wxIdleMode mode) { sm_idleMode = mode; }
+
+ // Returns the idle event mode
+ static wxIdleMode GetMode() { return sm_idleMode; }
+
+protected:
+ bool m_requestMore;
+ static wxIdleMode sm_idleMode;
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxIdleEvent)
+};
+
+
+// Thread event
+
+class WXDLLIMPEXP_BASE wxThreadEvent : public wxEvent,
+ public wxEventAnyPayloadMixin
+{
+public:
+ wxThreadEvent(wxEventType eventType = wxEVT_THREAD, int id = wxID_ANY)
+ : wxEvent(id, eventType)
+ { }
+
+ wxThreadEvent(const wxThreadEvent& event)
+ : wxEvent(event),
+ wxEventAnyPayloadMixin(event)
+ {
+ // make sure our string member (which uses COW, aka refcounting) is not
+ // shared by other wxString instances:
+ SetString(GetString().Clone());
+ }
+
+ virtual wxEvent *Clone() const
+ {
+ return new wxThreadEvent(*this);
+ }
+
+ // this is important to avoid that calling wxEventLoopBase::YieldFor thread events
+ // gets processed when this is unwanted:
+ virtual wxEventCategory GetEventCategory() const
+ { return wxEVT_CATEGORY_THREAD; }
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxThreadEvent)
+};
+
+
+// Asynchronous method call events: these event are processed by wxEvtHandler
+// itself and result in a call to its Execute() method which simply calls the
+// specified method. The difference with a simple method call is that this is
+// done asynchronously, i.e. at some later time, instead of immediately when
+// the event object is constructed.
+
+#ifdef wxHAS_CALL_AFTER
+
+// This is a base class used to process all method calls.
+class wxAsyncMethodCallEvent : public wxEvent
+{
+public:
+ wxAsyncMethodCallEvent(wxObject* object)
+ : wxEvent(wxID_ANY, wxEVT_ASYNC_METHOD_CALL)
+ {
+ SetEventObject(object);
+ }
+
+ wxAsyncMethodCallEvent(const wxAsyncMethodCallEvent& other)
+ : wxEvent(other)
+ {
+ }
+
+ virtual void Execute() = 0;
+};
+
+// This is a version for calling methods without parameters.
+template <typename T>
+class wxAsyncMethodCallEvent0 : public wxAsyncMethodCallEvent
+{
+public:
+ typedef T ObjectType;
+ typedef void (ObjectType::*MethodType)();
+
+ wxAsyncMethodCallEvent0(ObjectType* object,
+ MethodType method)
+ : wxAsyncMethodCallEvent(object),
+ m_object(object),
+ m_method(method)
+ {
+ }
+
+ wxAsyncMethodCallEvent0(const wxAsyncMethodCallEvent0& other)
+ : wxAsyncMethodCallEvent(other),
+ m_object(other.m_object),
+ m_method(other.m_method)
+ {
+ }
+
+ virtual wxEvent *Clone() const
+ {
+ return new wxAsyncMethodCallEvent0(*this);
+ }
+
+ virtual void Execute()
+ {
+ (m_object->*m_method)();
+ }
+
+private:
+ ObjectType* const m_object;
+ const MethodType m_method;
+};
+
+// This is a version for calling methods with a single parameter.
+template <typename T, typename T1>
+class wxAsyncMethodCallEvent1 : public wxAsyncMethodCallEvent
+{
+public:
+ typedef T ObjectType;
+ typedef void (ObjectType::*MethodType)(T1 x1);
+ typedef typename wxRemoveRef<T1>::type ParamType1;
+
+ wxAsyncMethodCallEvent1(ObjectType* object,
+ MethodType method,
+ const ParamType1& x1)
+ : wxAsyncMethodCallEvent(object),
+ m_object(object),
+ m_method(method),
+ m_param1(x1)
+ {
+ }
+
+ wxAsyncMethodCallEvent1(const wxAsyncMethodCallEvent1& other)
+ : wxAsyncMethodCallEvent(other),
+ m_object(other.m_object),
+ m_method(other.m_method),
+ m_param1(other.m_param1)
+ {
+ }
+
+ virtual wxEvent *Clone() const
+ {
+ return new wxAsyncMethodCallEvent1(*this);
+ }
+
+ virtual void Execute()
+ {
+ (m_object->*m_method)(m_param1);
+ }
+
+private:
+ ObjectType* const m_object;
+ const MethodType m_method;
+ const ParamType1 m_param1;
+};
+
+// This is a version for calling methods with two parameters.
+template <typename T, typename T1, typename T2>
+class wxAsyncMethodCallEvent2 : public wxAsyncMethodCallEvent
+{
+public:
+ typedef T ObjectType;
+ typedef void (ObjectType::*MethodType)(T1 x1, T2 x2);
+ typedef typename wxRemoveRef<T1>::type ParamType1;
+ typedef typename wxRemoveRef<T2>::type ParamType2;
+
+ wxAsyncMethodCallEvent2(ObjectType* object,
+ MethodType method,
+ const ParamType1& x1,
+ const ParamType2& x2)
+ : wxAsyncMethodCallEvent(object),
+ m_object(object),
+ m_method(method),
+ m_param1(x1),
+ m_param2(x2)
+ {
+ }
+
+ wxAsyncMethodCallEvent2(const wxAsyncMethodCallEvent2& other)
+ : wxAsyncMethodCallEvent(other),
+ m_object(other.m_object),
+ m_method(other.m_method),
+ m_param1(other.m_param1),
+ m_param2(other.m_param2)
+ {
+ }
+
+ virtual wxEvent *Clone() const
+ {
+ return new wxAsyncMethodCallEvent2(*this);
+ }
+
+ virtual void Execute()
+ {
+ (m_object->*m_method)(m_param1, m_param2);
+ }
+
+private:
+ ObjectType* const m_object;
+ const MethodType m_method;
+ const ParamType1 m_param1;
+ const ParamType2 m_param2;
+};
+
+#endif // wxHAS_CALL_AFTER
+
+
+#if wxUSE_GUI
+
+
+// Item or menu event class
+/*
+ wxEVT_BUTTON
+ wxEVT_CHECKBOX
+ wxEVT_CHOICE
+ wxEVT_LISTBOX
+ wxEVT_LISTBOX_DCLICK
+ wxEVT_TEXT
+ wxEVT_TEXT_ENTER
+ wxEVT_MENU
+ wxEVT_SLIDER
+ wxEVT_RADIOBOX
+ wxEVT_RADIOBUTTON
+ wxEVT_SCROLLBAR
+ wxEVT_VLBOX
+ wxEVT_COMBOBOX
+ wxEVT_TOGGLEBUTTON
+*/
+
+class WXDLLIMPEXP_CORE wxCommandEvent : public wxEvent,
+ public wxEventBasicPayloadMixin
+{
+public:
+ wxCommandEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
+
+ wxCommandEvent(const wxCommandEvent& event)
+ : wxEvent(event),
+ wxEventBasicPayloadMixin(event),
+ m_clientData(event.m_clientData),
+ m_clientObject(event.m_clientObject)
+ {
+ // Because GetString() can retrieve the string text only on demand, we
+ // need to copy it explicitly.
+ if ( m_cmdString.empty() )
+ m_cmdString = event.GetString();
+ }
+
+ // Set/Get client data from controls
+ void SetClientData(void* clientData) { m_clientData = clientData; }
+ void *GetClientData() const { return m_clientData; }
+
+ // Set/Get client object from controls
+ void SetClientObject(wxClientData* clientObject) { m_clientObject = clientObject; }
+ wxClientData *GetClientObject() const { return m_clientObject; }
+
+ // Note: this shadows wxEventBasicPayloadMixin::GetString(), because it does some
+ // GUI-specific hacks
+ wxString GetString() const;
+
+ // Get listbox selection if single-choice
+ int GetSelection() const { return m_commandInt; }
+
+ // Get checkbox value
+ bool IsChecked() const { return m_commandInt != 0; }
+
+ // true if the listbox event was a selection.
+ bool IsSelection() const { return (m_extraLong != 0); }
+
+ virtual wxEvent *Clone() const { return new wxCommandEvent(*this); }
+ virtual wxEventCategory GetEventCategory() const { return wxEVT_CATEGORY_USER_INPUT; }
+
+protected:
+ void* m_clientData; // Arbitrary client data
+ wxClientData* m_clientObject; // Arbitrary client object
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCommandEvent)
+};
+
+// 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
+{
+public:
+ wxNotifyEvent(wxEventType commandType = wxEVT_NULL, int winid = 0)
+ : wxCommandEvent(commandType, winid)
+ { m_bAllow = true; }
+
+ wxNotifyEvent(const wxNotifyEvent& event)
+ : wxCommandEvent(event)
+ { m_bAllow = event.m_bAllow; }
+
+ // veto the operation (usually it's allowed by default)
+ void Veto() { m_bAllow = false; }
+
+ // allow the operation if it was disabled by default
+ void Allow() { m_bAllow = true; }
+
+ // for implementation code only: is the operation allowed?
+ bool IsAllowed() const { return m_bAllow; }
+
+ virtual wxEvent *Clone() const { return new wxNotifyEvent(*this); }
+
+private:
+ bool m_bAllow;
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxNotifyEvent)
+};
+
+
+// Scroll event class, derived form wxCommandEvent. wxScrollEvents are
+// sent by wxSlider and wxScrollBar.
+/*
+ wxEVT_SCROLL_TOP
+ wxEVT_SCROLL_BOTTOM
+ wxEVT_SCROLL_LINEUP
+ wxEVT_SCROLL_LINEDOWN
+ wxEVT_SCROLL_PAGEUP
+ wxEVT_SCROLL_PAGEDOWN
+ wxEVT_SCROLL_THUMBTRACK
+ wxEVT_SCROLL_THUMBRELEASE
+ wxEVT_SCROLL_CHANGED
+*/
+
+class WXDLLIMPEXP_CORE wxScrollEvent : public wxCommandEvent
+{
+public:
+ wxScrollEvent(wxEventType commandType = wxEVT_NULL,
+ int winid = 0, int pos = 0, int orient = 0);
+
+ int GetOrientation() const { return (int) m_extraLong; }
+ int GetPosition() const { return m_commandInt; }
+ void SetOrientation(int orient) { m_extraLong = (long) orient; }
+ void SetPosition(int pos) { m_commandInt = pos; }
+
+ virtual wxEvent *Clone() const { return new wxScrollEvent(*this); }
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxScrollEvent)
+};
+
+// ScrollWin event class, derived fom wxEvent. wxScrollWinEvents
+// are sent by wxWindow.
+/*
+ wxEVT_SCROLLWIN_TOP
+ wxEVT_SCROLLWIN_BOTTOM
+ wxEVT_SCROLLWIN_LINEUP
+ wxEVT_SCROLLWIN_LINEDOWN
+ wxEVT_SCROLLWIN_PAGEUP
+ wxEVT_SCROLLWIN_PAGEDOWN
+ wxEVT_SCROLLWIN_THUMBTRACK
+ wxEVT_SCROLLWIN_THUMBRELEASE
+*/
+
+class WXDLLIMPEXP_CORE 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; }
+ void SetOrientation(int orient) { m_extraLong = (long) orient; }
+ void SetPosition(int pos) { m_commandInt = pos; }
+
+ virtual wxEvent *Clone() const { return new wxScrollWinEvent(*this); }
+
+protected:
+ int m_commandInt;
+ long m_extraLong;
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxScrollWinEvent)
+};
+
+
+
+// Mouse event class
+
+/*
+ wxEVT_LEFT_DOWN
+ wxEVT_LEFT_UP
+ wxEVT_MIDDLE_DOWN
+ wxEVT_MIDDLE_UP
+ wxEVT_RIGHT_DOWN
+ wxEVT_RIGHT_UP
+ wxEVT_MOTION
+ wxEVT_ENTER_WINDOW
+ wxEVT_LEAVE_WINDOW
+ wxEVT_LEFT_DCLICK
+ wxEVT_MIDDLE_DCLICK
+ wxEVT_RIGHT_DCLICK
+*/
+
+enum wxMouseWheelAxis
+{
+ wxMOUSE_WHEEL_VERTICAL,
+ wxMOUSE_WHEEL_HORIZONTAL
+};
+
+class WXDLLIMPEXP_CORE wxMouseEvent : public wxEvent,
+ public wxMouseState
+{
+public:
+ wxMouseEvent(wxEventType mouseType = wxEVT_NULL);
+ wxMouseEvent(const wxMouseEvent& event)
+ : wxEvent(event),
+ wxMouseState(event)
+ {
+ Assign(event);
+ }
+
+ // Was it a button event? (*doesn't* mean: is any button *down*?)
+ bool IsButton() const { return Button(wxMOUSE_BTN_ANY); }
+
+ // Was it a down event from this (or any) button?
+ bool ButtonDown(int but = wxMOUSE_BTN_ANY) const;
+
+ // Was it a dclick event from this (or any) button?
+ bool ButtonDClick(int but = wxMOUSE_BTN_ANY) const;
+
+ // Was it a up event from this (or any) button?
+ bool ButtonUp(int but = wxMOUSE_BTN_ANY) const;
+
+ // Was this event generated by the given button?
+ bool Button(int but) const;
+
+ // Get the button which is changing state (wxMOUSE_BTN_NONE if none)
+ int GetButton() const;
+
+ // Find which event was just generated
+ bool LeftDown() const { return (m_eventType == wxEVT_LEFT_DOWN); }
+ bool MiddleDown() const { return (m_eventType == wxEVT_MIDDLE_DOWN); }
+ bool RightDown() const { return (m_eventType == wxEVT_RIGHT_DOWN); }
+ bool Aux1Down() const { return (m_eventType == wxEVT_AUX1_DOWN); }
+ bool Aux2Down() const { return (m_eventType == wxEVT_AUX2_DOWN); }
+
+ bool LeftUp() const { return (m_eventType == wxEVT_LEFT_UP); }
+ bool MiddleUp() const { return (m_eventType == wxEVT_MIDDLE_UP); }
+ bool RightUp() const { return (m_eventType == wxEVT_RIGHT_UP); }
+ bool Aux1Up() const { return (m_eventType == wxEVT_AUX1_UP); }
+ bool Aux2Up() const { return (m_eventType == wxEVT_AUX2_UP); }
+
+ bool LeftDClick() const { return (m_eventType == wxEVT_LEFT_DCLICK); }
+ bool MiddleDClick() const { return (m_eventType == wxEVT_MIDDLE_DCLICK); }
+ bool RightDClick() const { return (m_eventType == wxEVT_RIGHT_DCLICK); }
+ bool Aux1DClick() const { return (m_eventType == wxEVT_AUX1_DCLICK); }
+ bool Aux2DClick() const { return (m_eventType == wxEVT_AUX2_DCLICK); }
+
+ // True if a button is down and the mouse is moving
+ bool Dragging() const
+ {
+ return (m_eventType == wxEVT_MOTION) && ButtonIsDown(wxMOUSE_BTN_ANY);
+ }
+
+ // True if the mouse is moving, and no button is down
+ bool Moving() const
+ {
+ return (m_eventType == wxEVT_MOTION) && !ButtonIsDown(wxMOUSE_BTN_ANY);
+ }
+
+ // True if the mouse is just entering the window
+ bool Entering() const { return (m_eventType == wxEVT_ENTER_WINDOW); }
+
+ // True if the mouse is just leaving the window
+ bool Leaving() const { return (m_eventType == wxEVT_LEAVE_WINDOW); }
+
+ // Returns the number of mouse clicks associated with this event.
+ int GetClickCount() const { return m_clickCount; }
+
+ // Find the logical position of the event given the DC
+ wxPoint GetLogicalPosition(const wxDC& dc) const;
+
+ // Get wheel rotation, positive or negative indicates direction of
+ // rotation. Current devices all send an event when rotation is equal to
+ // +/-WheelDelta, but this allows for finer resolution devices to be
+ // created in the future. Because of this you shouldn't assume that one
+ // event is equal to 1 line or whatever, but you should be able to either
+ // do partial line scrolling or wait until +/-WheelDelta rotation values
+ // have been accumulated before scrolling.
+ int GetWheelRotation() const { return m_wheelRotation; }
+
+ // Get wheel delta, normally 120. This is the threshold for action to be
+ // taken, and one such action (for example, scrolling one increment)
+ // should occur for each delta.
+ int GetWheelDelta() const { return m_wheelDelta; }
+
+ // Gets the axis the wheel operation concerns; wxMOUSE_WHEEL_VERTICAL
+ // (most common case) or wxMOUSE_WHEEL_HORIZONTAL (for horizontal scrolling
+ // using e.g. a trackpad).
+ wxMouseWheelAxis GetWheelAxis() const { return m_wheelAxis; }
+
+ // Returns the configured number of lines (or whatever) to be scrolled per
+ // wheel action. Defaults to three.
+ int GetLinesPerAction() const { return m_linesPerAction; }
+
+ // Returns the configured number of columns (or whatever) to be scrolled per
+ // wheel action. Defaults to three.
+ int GetColumnsPerAction() const { return m_columnsPerAction; }
+
+ // 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); }
+ virtual wxEventCategory GetEventCategory() const { return wxEVT_CATEGORY_USER_INPUT; }
+
+ wxMouseEvent& operator=(const wxMouseEvent& event)
+ {
+ if (&event != this)
+ Assign(event);
+ return *this;
+ }
+
+public:
+ int m_clickCount;
+
+ wxMouseWheelAxis m_wheelAxis;
+ int m_wheelRotation;
+ int m_wheelDelta;
+ int m_linesPerAction;
+ int m_columnsPerAction;
+
+protected:
+ void Assign(const wxMouseEvent& evt);
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxMouseEvent)
+};
+
+// Cursor set event
+
+/*
+ wxEVT_SET_CURSOR
+ */
+
+class WXDLLIMPEXP_CORE wxSetCursorEvent : public wxEvent
+{
+public:
+ wxSetCursorEvent(wxCoord x = 0, wxCoord y = 0)
+ : wxEvent(0, wxEVT_SET_CURSOR),
+ 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; }
+
+ void SetCursor(const wxCursor& cursor) { m_cursor = cursor; }
+ const wxCursor& GetCursor() const { return m_cursor; }
+ bool HasCursor() const { return m_cursor.IsOk(); }
+
+ virtual wxEvent *Clone() const { return new wxSetCursorEvent(*this); }
+
+private:
+ wxCoord m_x, m_y;
+ wxCursor m_cursor;
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSetCursorEvent)
+};
+
+// Keyboard input event class
+
+/*
+ wxEVT_CHAR
+ wxEVT_CHAR_HOOK
+ wxEVT_KEY_DOWN
+ wxEVT_KEY_UP
+ wxEVT_HOTKEY
+ */
+
+// key categories: the bit flags for IsKeyInCategory() function
+//
+// the enum values used may change in future version of wx
+// use the named constants only, or bitwise combinations thereof
+enum wxKeyCategoryFlags
+{
+ // arrow keys, on and off numeric keypads
+ WXK_CATEGORY_ARROW = 1,
+
+ // page up and page down keys, on and off numeric keypads
+ WXK_CATEGORY_PAGING = 2,
+
+ // home and end keys, on and off numeric keypads
+ WXK_CATEGORY_JUMP = 4,
+
+ // tab key, on and off numeric keypads
+ WXK_CATEGORY_TAB = 8,
+
+ // backspace and delete keys, on and off numeric keypads
+ WXK_CATEGORY_CUT = 16,
+
+ // all keys usually used for navigation
+ WXK_CATEGORY_NAVIGATION = WXK_CATEGORY_ARROW |
+ WXK_CATEGORY_PAGING |
+ WXK_CATEGORY_JUMP
+};
+
+class WXDLLIMPEXP_CORE wxKeyEvent : public wxEvent,
+ public wxKeyboardState
+{
+public:
+ wxKeyEvent(wxEventType keyType = wxEVT_NULL);
+
+ // Normal copy ctor and a ctor creating a new event for the same key as the
+ // given one but a different event type (this is used in implementation
+ // code only, do not use outside of the library).
+ wxKeyEvent(const wxKeyEvent& evt);
+ wxKeyEvent(wxEventType eventType, const wxKeyEvent& evt);
+
+ // get the key code: an ASCII7 char or an element of wxKeyCode enum
+ int GetKeyCode() const { return (int)m_keyCode; }
+
+ // returns true iff this event's key code is of a certain type
+ bool IsKeyInCategory(int category) const;
+
+#if wxUSE_UNICODE
+ // get the Unicode character corresponding to this key
+ wxChar GetUnicodeKey() const { return m_uniChar; }
+#endif // wxUSE_UNICODE
+
+ // get the raw key code (platform-dependent)
+ wxUint32 GetRawKeyCode() const { return m_rawCode; }
+
+ // get the raw key flags (platform-dependent)
+ wxUint32 GetRawKeyFlags() const { return m_rawFlags; }
+
+ // Find the position of the event
+ void GetPosition(wxCoord *xpos, wxCoord *ypos) const
+ {
+ if (xpos)
+ *xpos = GetX();
+ if (ypos)
+ *ypos = GetY();
+ }
+
+ // This version if provided only for backwards compatiblity, don't use.
+ void GetPosition(long *xpos, long *ypos) const
+ {
+ if (xpos)
+ *xpos = GetX();
+ if (ypos)
+ *ypos = GetY();
+ }
+
+ wxPoint GetPosition() const
+ { return wxPoint(GetX(), GetY()); }
+
+ // Get X position
+ wxCoord GetX() const;
+
+ // Get Y position
+ wxCoord GetY() const;
+
+ // Can be called from wxEVT_CHAR_HOOK handler to allow generation of normal
+ // key events even though the event had been handled (by default they would
+ // not be generated in this case).
+ void DoAllowNextEvent() { m_allowNext = true; }
+
+ // Return the value of the "allow next" flag, for internal use only.
+ bool IsNextEventAllowed() const { return m_allowNext; }
+
+
+ virtual wxEvent *Clone() const { return new wxKeyEvent(*this); }
+ virtual wxEventCategory GetEventCategory() const { return wxEVT_CATEGORY_USER_INPUT; }
+
+ // we do need to copy wxKeyEvent sometimes (in wxTreeCtrl code, for
+ // example)
+ wxKeyEvent& operator=(const wxKeyEvent& evt)
+ {
+ if ( &evt != this )
+ {
+ wxEvent::operator=(evt);
+
+ // Borland C++ 5.82 doesn't compile an explicit call to an
+ // implicitly defined operator=() so need to do it this way:
+ *static_cast<wxKeyboardState *>(this) = evt;
+
+ DoAssignMembers(evt);
+ }
+ return *this;
+ }
+
+public:
+ // Do not use these fields directly, they are initialized on demand, so
+ // call GetX() and GetY() or GetPosition() instead.
+ wxCoord m_x, m_y;
+
+ long m_keyCode;
+
+#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;
+
+private:
+ // Set the event to propagate if necessary, i.e. if it's of wxEVT_CHAR_HOOK
+ // type. This is used by all ctors.
+ void InitPropagation()
+ {
+ if ( m_eventType == wxEVT_CHAR_HOOK )
+ m_propagationLevel = wxEVENT_PROPAGATE_MAX;
+
+ m_allowNext = false;
+ }
+
+ // Copy only the event data present in this class, this is used by
+ // AssignKeyData() and copy ctor.
+ void DoAssignMembers(const wxKeyEvent& evt)
+ {
+ m_x = evt.m_x;
+ m_y = evt.m_y;
+ m_hasPosition = evt.m_hasPosition;
+
+ m_keyCode = evt.m_keyCode;
+
+ m_rawCode = evt.m_rawCode;
+ m_rawFlags = evt.m_rawFlags;
+#if wxUSE_UNICODE
+ m_uniChar = evt.m_uniChar;
+#endif
+ }
+
+ // Initialize m_x and m_y using the current mouse cursor position if
+ // necessary.
+ void InitPositionIfNecessary() const;
+
+ // If this flag is true, the normal key events should still be generated
+ // even if wxEVT_CHAR_HOOK had been handled. By default it is false as
+ // handling wxEVT_CHAR_HOOK suppresses all the subsequent events.
+ bool m_allowNext;
+
+ // If true, m_x and m_y were already initialized. If false, try to get them
+ // when they're requested.
+ bool m_hasPosition;
+
+ DECLARE_DYNAMIC_CLASS(wxKeyEvent)
+};
+
+// Size event class
+/*
+ wxEVT_SIZE
+ */
+
+class WXDLLIMPEXP_CORE wxSizeEvent : public wxEvent
+{
+public:
+ wxSizeEvent() : wxEvent(0, wxEVT_SIZE)
+ { }
+ wxSizeEvent(const wxSize& sz, int winid = 0)
+ : wxEvent(winid, wxEVT_SIZE),
+ m_size(sz)
+ { }
+ wxSizeEvent(const wxSizeEvent& event)
+ : wxEvent(event),
+ m_size(event.m_size), m_rect(event.m_rect)
+ { }
+ wxSizeEvent(const wxRect& rect, int id = 0)
+ : m_size(rect.GetSize()), m_rect(rect)
+ { m_eventType = wxEVT_SIZING; m_id = id; }
+
+ wxSize GetSize() const { return m_size; }
+ void SetSize(wxSize size) { m_size = size; }
+ wxRect GetRect() const { return m_rect; }
+ void SetRect(const wxRect& rect) { m_rect = rect; }
+
+ virtual wxEvent *Clone() const { return new wxSizeEvent(*this); }
+
+public:
+ // For internal usage only. Will be converted to protected members.
+ wxSize m_size;
+ wxRect m_rect; // Used for wxEVT_SIZING
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSizeEvent)
+};
+
+// Move event class
+
+/*
+ wxEVT_MOVE
+ */
+
+class WXDLLIMPEXP_CORE wxMoveEvent : public wxEvent
+{
+public:
+ wxMoveEvent()
+ : wxEvent(0, wxEVT_MOVE)
+ { }
+ wxMoveEvent(const wxPoint& pos, int winid = 0)
+ : wxEvent(winid, wxEVT_MOVE),
+ m_pos(pos)
+ { }
+ wxMoveEvent(const wxMoveEvent& event)
+ : wxEvent(event),
+ m_pos(event.m_pos)
+ { }
+ wxMoveEvent(const wxRect& rect, int id = 0)
+ : m_pos(rect.GetPosition()), m_rect(rect)
+ { m_eventType = wxEVT_MOVING; m_id = id; }
+
+ wxPoint GetPosition() const { return m_pos; }
+ void SetPosition(const wxPoint& pos) { m_pos = pos; }
+ wxRect GetRect() const { return m_rect; }
+ void SetRect(const wxRect& rect) { m_rect = rect; }
+
+ virtual wxEvent *Clone() const { return new wxMoveEvent(*this); }
+
+protected:
+ wxPoint m_pos;
+ wxRect m_rect;
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMoveEvent)
+};
+
+// Paint event class
+/*
+ wxEVT_PAINT
+ wxEVT_NC_PAINT
+ */
+
+#if wxDEBUG_LEVEL && (defined(__WXMSW__) || defined(__WXPM__))
+ #define wxHAS_PAINT_DEBUG
+
+ // see comments in src/msw|os2/dcclient.cpp where g_isPainting is defined
+ extern WXDLLIMPEXP_CORE int g_isPainting;
+#endif // debug
+
+class WXDLLIMPEXP_CORE wxPaintEvent : public wxEvent
+{
+public:
+ wxPaintEvent(int Id = 0)
+ : wxEvent(Id, wxEVT_PAINT)
+ {
+#ifdef wxHAS_PAINT_DEBUG
+ // set the internal flag for the duration of redrawing
+ g_isPainting++;
+#endif // debug
+ }
+
+ // default copy ctor and dtor are normally fine, we only need them to keep
+ // g_isPainting updated in debug build
+#ifdef wxHAS_PAINT_DEBUG
+ wxPaintEvent(const wxPaintEvent& event)
+ : wxEvent(event)
+ {
+ g_isPainting++;
+ }
+
+ virtual ~wxPaintEvent()
+ {
+ g_isPainting--;
+ }
+#endif // debug
+
+ virtual wxEvent *Clone() const { return new wxPaintEvent(*this); }
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxPaintEvent)
+};
+
+class WXDLLIMPEXP_CORE wxNcPaintEvent : public wxEvent
+{
+public:
+ wxNcPaintEvent(int winid = 0)
+ : wxEvent(winid, wxEVT_NC_PAINT)
+ { }
+
+ virtual wxEvent *Clone() const { return new wxNcPaintEvent(*this); }
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxNcPaintEvent)
+};
+
+// Erase background event class
+/*
+ wxEVT_ERASE_BACKGROUND
+ */
+
+class WXDLLIMPEXP_CORE wxEraseEvent : public wxEvent
+{
+public:
+ wxEraseEvent(int Id = 0, wxDC *dc = NULL)
+ : wxEvent(Id, wxEVT_ERASE_BACKGROUND),
+ m_dc(dc)
+ { }
+
+ wxEraseEvent(const wxEraseEvent& event)
+ : wxEvent(event),
+ m_dc(event.m_dc)
+ { }
+
+ wxDC *GetDC() const { return m_dc; }
+
+ virtual wxEvent *Clone() const { return new wxEraseEvent(*this); }
+
+protected:
+ wxDC *m_dc;
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxEraseEvent)
+};
+
+// Focus event class
+/*
+ wxEVT_SET_FOCUS
+ wxEVT_KILL_FOCUS
+ */
+
+class WXDLLIMPEXP_CORE wxFocusEvent : public wxEvent
+{
+public:
+ wxFocusEvent(wxEventType type = wxEVT_NULL, int winid = 0)
+ : wxEvent(winid, type)
+ { m_win = NULL; }
+
+ wxFocusEvent(const wxFocusEvent& event)
+ : wxEvent(event)
+ { m_win = event.m_win; }
+
+ // 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; }
+
+ virtual wxEvent *Clone() const { return new wxFocusEvent(*this); }
+
+private:
+ wxWindow *m_win;
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxFocusEvent)
+};
+
+// wxChildFocusEvent notifies the parent that a child has got the focus: unlike
+// wxFocusEvent it is propagated upwards the window chain
+class WXDLLIMPEXP_CORE wxChildFocusEvent : public wxCommandEvent
+{
+public:
+ wxChildFocusEvent(wxWindow *win = NULL);
+
+ wxWindow *GetWindow() const { return (wxWindow *)GetEventObject(); }
+
+ virtual wxEvent *Clone() const { return new wxChildFocusEvent(*this); }
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxChildFocusEvent)
+};
+
+// Activate event class
+/*
+ wxEVT_ACTIVATE
+ wxEVT_ACTIVATE_APP
+ wxEVT_HIBERNATE
+ */
+
+class WXDLLIMPEXP_CORE wxActivateEvent : public wxEvent
+{
+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; }
+
+ virtual wxEvent *Clone() const { return new wxActivateEvent(*this); }
+
+private:
+ bool m_active;
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxActivateEvent)
+};
+
+// InitDialog event class
+/*
+ wxEVT_INIT_DIALOG
+ */
+
+class WXDLLIMPEXP_CORE wxInitDialogEvent : public wxEvent
+{
+public:
+ wxInitDialogEvent(int Id = 0)
+ : wxEvent(Id, wxEVT_INIT_DIALOG)
+ { }
+
+ virtual wxEvent *Clone() const { return new wxInitDialogEvent(*this); }
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxInitDialogEvent)
+};
+
+// Miscellaneous menu event class
+/*
+ wxEVT_MENU_OPEN,
+ wxEVT_MENU_CLOSE,
+ wxEVT_MENU_HIGHLIGHT,
+*/
+
+class WXDLLIMPEXP_CORE wxMenuEvent : public wxEvent
+{
+public:
+ wxMenuEvent(wxEventType type = wxEVT_NULL, int winid = 0, wxMenu* menu = NULL)
+ : wxEvent(winid, type)
+ { m_menuId = winid; m_menu = menu; }
+ wxMenuEvent(const wxMenuEvent& event)
+ : wxEvent(event)
+ { m_menuId = event.m_menuId; m_menu = event.m_menu; }
+
+ // only for wxEVT_MENU_HIGHLIGHT
+ int GetMenuId() const { return m_menuId; }
+
+ // only for wxEVT_MENU_OPEN/CLOSE
+ bool IsPopup() const { return m_menuId == wxID_ANY; }
+
+ // only for wxEVT_MENU_OPEN/CLOSE
+ wxMenu* GetMenu() const { return m_menu; }
+
+ virtual wxEvent *Clone() const { return new wxMenuEvent(*this); }
+
+private:
+ int m_menuId;
+ wxMenu* m_menu;
+
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMenuEvent)
+};
+
+// Window close or session close event class
+/*
+ wxEVT_CLOSE_WINDOW,
+ wxEVT_END_SESSION,
+ wxEVT_QUERY_END_SESSION
+ */
+
+class WXDLLIMPEXP_CORE wxCloseEvent : public wxEvent
+{
+public:
+ wxCloseEvent(wxEventType type = wxEVT_NULL, int winid = 0)
+ : wxEvent(winid, type),
+ m_loggingOff(true),
+ m_veto(false), // should be false by default
+ m_canVeto(true) {}
+
+ wxCloseEvent(const wxCloseEvent& event)
+ : wxEvent(event),
+ m_loggingOff(event.m_loggingOff),
+ m_veto(event.m_veto),
+ m_canVeto(event.m_canVeto) {}
+
+ void SetLoggingOff(bool logOff) { m_loggingOff = logOff; }
+ bool GetLoggingOff() const
+ {
+ // m_loggingOff flag is only used by wxEVT_[QUERY_]END_SESSION, it
+ // doesn't make sense for wxEVT_CLOSE_WINDOW
+ wxASSERT_MSG( m_eventType != wxEVT_CLOSE_WINDOW,
+ wxT("this flag is for end session events only") );
+
+ return m_loggingOff;
+ }
+
+ void Veto(bool veto = true)
+ {
+ // GetVeto() will return false anyhow...
+ wxCHECK_RET( m_canVeto,
+ wxT("call to Veto() ignored (can't veto this event)") );
+
+ m_veto = veto;
+ }
+ void SetCanVeto(bool canVeto) { m_canVeto = canVeto; }
+ bool CanVeto() const { return m_canVeto; }
+ bool GetVeto() const { return m_canVeto && m_veto; }
+
+ virtual wxEvent *Clone() const { return new wxCloseEvent(*this); }
+
+protected:
+ bool m_loggingOff,
+ m_veto,
+ m_canVeto;
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCloseEvent)
+};
+
+/*
+ wxEVT_SHOW
+ */
+
+class WXDLLIMPEXP_CORE wxShowEvent : public wxEvent
+{
+public:
+ wxShowEvent(int winid = 0, bool show = false)
+ : wxEvent(winid, wxEVT_SHOW)
+ { m_show = show; }
+ wxShowEvent(const wxShowEvent& event)
+ : wxEvent(event)
+ { m_show = event.m_show; }
+
+ void SetShow(bool show) { m_show = show; }
+
+ // return true if the window was shown, false if hidden
+ bool IsShown() const { return m_show; }
+
+#if WXWIN_COMPATIBILITY_2_8
+ wxDEPRECATED( bool GetShow() const { return IsShown(); } )
+#endif
+
+ virtual wxEvent *Clone() const { return new wxShowEvent(*this); }
+
+protected:
+ bool m_show;
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxShowEvent)
+};
+
+/*
+ wxEVT_ICONIZE
+ */
+
+class WXDLLIMPEXP_CORE wxIconizeEvent : public wxEvent
+{
+public:
+ wxIconizeEvent(int winid = 0, bool iconized = true)
+ : wxEvent(winid, wxEVT_ICONIZE)
+ { m_iconized = iconized; }
+ wxIconizeEvent(const wxIconizeEvent& event)
+ : wxEvent(event)
+ { m_iconized = event.m_iconized; }
+
+#if WXWIN_COMPATIBILITY_2_8
+ wxDEPRECATED( bool Iconized() const { return IsIconized(); } )
+#endif
+ // return true if the frame was iconized, false if restored
+ bool IsIconized() const { return m_iconized; }
+
+ virtual wxEvent *Clone() const { return new wxIconizeEvent(*this); }
+
+protected:
+ bool m_iconized;
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxIconizeEvent)
+};
+/*
+ wxEVT_MAXIMIZE
+ */
+
+class WXDLLIMPEXP_CORE wxMaximizeEvent : public wxEvent
+{
+public:
+ wxMaximizeEvent(int winid = 0)
+ : wxEvent(winid, wxEVT_MAXIMIZE)
+ { }
+
+ virtual wxEvent *Clone() const { return new wxMaximizeEvent(*this); }
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMaximizeEvent)
+};
+
+// Joystick event class
+/*
+ wxEVT_JOY_BUTTON_DOWN,
+ wxEVT_JOY_BUTTON_UP,
+ wxEVT_JOY_MOVE,
+ wxEVT_JOY_ZMOVE
+*/
+
+// Which joystick? Same as Windows ids so no conversion necessary.
+enum
+{
+ wxJOYSTICK1,
+ wxJOYSTICK2
+};
+
+// Which button is down?
+enum
+{
+ wxJOY_BUTTON_ANY = -1,
+ wxJOY_BUTTON1 = 1,
+ wxJOY_BUTTON2 = 2,
+ wxJOY_BUTTON3 = 4,
+ wxJOY_BUTTON4 = 8
+};
+
+class WXDLLIMPEXP_CORE wxJoystickEvent : public wxEvent
+{
+protected:
+ wxPoint m_pos;
+ int m_zPosition;
+ int m_buttonChange; // Which button changed?
+ int m_buttonState; // Which buttons are down?
+ int m_joyStick; // Which joystick?
+
+public:
+ wxJoystickEvent(wxEventType type = wxEVT_NULL,
+ int state = 0,
+ int joystick = wxJOYSTICK1,
+ int change = 0)
+ : wxEvent(0, type),
+ m_pos(),
+ m_zPosition(0),
+ m_buttonChange(change),
+ m_buttonState(state),
+ 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; }
+ int GetButtonState() const { return m_buttonState; }
+ int GetButtonChange() const { return m_buttonChange; }
+ int GetJoystick() const { return m_joyStick; }
+
+ void SetJoystick(int stick) { m_joyStick = stick; }
+ void SetButtonState(int state) { m_buttonState = state; }
+ void SetButtonChange(int change) { m_buttonChange = change; }
+ void SetPosition(const wxPoint& pos) { m_pos = pos; }
+ void SetZPosition(int zPos) { m_zPosition = zPos; }
+
+ // Was it a button event? (*doesn't* mean: is any button *down*?)
+ bool IsButton() const { return ((GetEventType() == wxEVT_JOY_BUTTON_DOWN) ||
+ (GetEventType() == wxEVT_JOY_BUTTON_UP)); }
+
+ // Was it a move event?
+ bool IsMove() const { return (GetEventType() == wxEVT_JOY_MOVE); }
+
+ // Was it a zmove event?
+ bool IsZMove() const { return (GetEventType() == wxEVT_JOY_ZMOVE); }
+
+ // Was it a down event from button 1, 2, 3, 4 or any?
+ bool ButtonDown(int but = wxJOY_BUTTON_ANY) const
+ { return ((GetEventType() == wxEVT_JOY_BUTTON_DOWN) &&
+ ((but == wxJOY_BUTTON_ANY) || (but == m_buttonChange))); }
+
+ // Was it a up event from button 1, 2, 3 or any?
+ bool ButtonUp(int but = wxJOY_BUTTON_ANY) const
+ { return ((GetEventType() == wxEVT_JOY_BUTTON_UP) &&
+ ((but == wxJOY_BUTTON_ANY) || (but == m_buttonChange))); }
+
+ // Was the given button 1,2,3,4 or any in Down state?
+ bool ButtonIsDown(int but = wxJOY_BUTTON_ANY) const
+ { return (((but == wxJOY_BUTTON_ANY) && (m_buttonState != 0)) ||
+ ((m_buttonState & but) == but)); }
+
+ virtual wxEvent *Clone() const { return new wxJoystickEvent(*this); }
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxJoystickEvent)
+};
+
+// Drop files event class
+/*
+ wxEVT_DROP_FILES
+ */
+
+class WXDLLIMPEXP_CORE wxDropFilesEvent : public wxEvent
+{
+public:
+ int m_noFiles;
+ wxPoint m_pos;
+ wxString* m_files;
+
+ wxDropFilesEvent(wxEventType type = wxEVT_NULL,
+ int noFiles = 0,
+ wxString *files = NULL)
+ : wxEvent(0, type),
+ m_noFiles(noFiles),
+ m_pos(),
+ m_files(files)
+ { }
+
+ // we need a copy ctor to avoid deleting m_files pointer twice
+ wxDropFilesEvent(const wxDropFilesEvent& other)
+ : wxEvent(other),
+ m_noFiles(other.m_noFiles),
+ m_pos(other.m_pos),
+ m_files(NULL)
+ {
+ m_files = new wxString[m_noFiles];
+ for ( int n = 0; n < m_noFiles; n++ )
+ {
+ m_files[n] = other.m_files[n];
+ }
+ }
+
+ virtual ~wxDropFilesEvent()
+ {
+ delete [] m_files;
+ }
+
+ wxPoint GetPosition() const { return m_pos; }
+ int GetNumberOfFiles() const { return m_noFiles; }
+ wxString *GetFiles() const { return m_files; }
+
+ virtual wxEvent *Clone() const { return new wxDropFilesEvent(*this); }
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDropFilesEvent)
+};
+
+// Update UI event
+/*
+ wxEVT_UPDATE_UI
+ */
+
+// Whether to always send update events to windows, or
+// to only send update events to those with the
+// wxWS_EX_PROCESS_UI_UPDATES style.
+
+enum wxUpdateUIMode
+{
+ // Send UI update events to all windows
+ wxUPDATE_UI_PROCESS_ALL,
+
+ // Send UI update events to windows that have
+ // the wxWS_EX_PROCESS_UI_UPDATES flag specified
+ wxUPDATE_UI_PROCESS_SPECIFIED
+};
+
+class WXDLLIMPEXP_CORE wxUpdateUIEvent : public wxCommandEvent
+{
+public:
+ wxUpdateUIEvent(wxWindowID commandId = 0)
+ : wxCommandEvent(wxEVT_UPDATE_UI, commandId)
+ {
+ m_checked =
+ m_enabled =
+ m_shown =
+ m_setEnabled =
+ m_setShown =
+ m_setText =
+ m_setChecked = false;
+ }
+ wxUpdateUIEvent(const wxUpdateUIEvent& event)
+ : wxCommandEvent(event),
+ m_checked(event.m_checked),
+ m_enabled(event.m_enabled),
+ m_shown(event.m_shown),
+ m_setEnabled(event.m_setEnabled),
+ m_setShown(event.m_setShown),
+ 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; }
+ bool GetShown() const { return m_shown; }
+ wxString GetText() const { return m_text; }
+ bool GetSetText() const { return m_setText; }
+ bool GetSetChecked() const { return m_setChecked; }
+ bool GetSetEnabled() const { return m_setEnabled; }
+ bool GetSetShown() const { return m_setShown; }
+
+ void Check(bool check) { m_checked = check; m_setChecked = true; }
+ void Enable(bool enable) { m_enabled = enable; m_setEnabled = true; }
+ void Show(bool show) { m_shown = show; m_setShown = true; }
+ void SetText(const wxString& text) { m_text = text; m_setText = true; }
+
+ // Sets the interval between updates in milliseconds.
+ // Set to -1 to disable updates, or to 0 to update as frequently as possible.
+ static void SetUpdateInterval(long updateInterval) { sm_updateInterval = updateInterval; }
+
+ // Returns the current interval between updates in milliseconds
+ static long GetUpdateInterval() { return sm_updateInterval; }
+
+ // Can we update this window?
+ static bool CanUpdate(wxWindowBase *win);
+
+ // Reset the update time to provide a delay until the next
+ // time we should update
+ static void ResetUpdateTime();
+
+ // Specify how wxWidgets will send update events: to
+ // all windows, or only to those which specify that they
+ // will process the events.
+ static void SetMode(wxUpdateUIMode mode) { sm_updateMode = mode; }
+
+ // Returns the UI update mode
+ static wxUpdateUIMode GetMode() { return sm_updateMode; }
+
+ virtual wxEvent *Clone() const { return new wxUpdateUIEvent(*this); }
+
+protected:
+ bool m_checked;
+ bool m_enabled;
+ bool m_shown;
+ bool m_setEnabled;
+ bool m_setShown;
+ bool m_setText;
+ bool m_setChecked;
+ wxString m_text;
+#if wxUSE_LONGLONG
+ static wxLongLong sm_lastUpdate;
+#endif
+ static long sm_updateInterval;
+ static wxUpdateUIMode sm_updateMode;
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxUpdateUIEvent)
+};
+
+/*
+ wxEVT_SYS_COLOUR_CHANGED
+ */
+
+// TODO: shouldn't all events record the window ID?
+class WXDLLIMPEXP_CORE wxSysColourChangedEvent : public wxEvent
+{
+public:
+ wxSysColourChangedEvent()
+ : wxEvent(0, wxEVT_SYS_COLOUR_CHANGED)
+ { }
+
+ virtual wxEvent *Clone() const { return new wxSysColourChangedEvent(*this); }