+template <typename EventTag, typename Functor>
+inline wxEventFunctorFunctor<EventTag, Functor>
+wxMakeEventFunctor(const EventTag&, const Functor &func)
+{
+ return wxEventFunctorFunctor<EventTag, Functor>(func);
+}
+
+// Create functors wrapping methods:
+template
+ <typename EventTag, typename Class, typename EventArg, typename EventHandler>
+inline wxEventFunctorMethod<EventTag, Class, EventArg, EventHandler> *
+wxNewEventFunctor(const EventTag&,
+ void (Class::*method)(EventArg&),
+ EventHandler *handler)
+{
+ return new wxEventFunctorMethod<EventTag, Class, EventArg, EventHandler>(
+ method, handler);
+}
+
+template
+ <typename EventTag, typename Class, typename EventArg, typename EventHandler>
+inline wxEventFunctorMethod<EventTag, Class, EventArg, EventHandler>
+wxMakeEventFunctor(const EventTag&,
+ void (Class::*method)(EventArg&),
+ EventHandler *handler)
+{
+ return wxEventFunctorMethod<EventTag, Class, EventArg, EventHandler>(
+ method, handler);
+}
+
+// Create an event functor for the event table via wxDECLARE_EVENT_TABLE_ENTRY:
+// in this case we don't have the handler (as it's always the same as the
+// object which generated the event) so we must use Class as its type
+template <typename EventTag, typename Class, typename EventArg>
+inline wxEventFunctorMethod<EventTag, Class, EventArg, Class> *
+wxNewEventTableFunctor(const EventTag&, void (Class::*method)(EventArg&))
+{
+ return new wxEventFunctorMethod<EventTag, Class, EventArg, Class>(
+ method, NULL);
+}
+
+#endif // wxHAS_EVENT_BIND
+
+
+// many, but not all, standard event types
+
+ // some generic events
+extern WXDLLIMPEXP_BASE const wxEventType wxEVT_NULL;
+extern WXDLLIMPEXP_BASE const wxEventType wxEVT_FIRST;
+extern WXDLLIMPEXP_BASE const wxEventType wxEVT_USER_FIRST;
+
+ // Need events declared to do this
+class WXDLLIMPEXP_FWD_BASE wxIdleEvent;
+class WXDLLIMPEXP_FWD_BASE wxThreadEvent;
+class WXDLLIMPEXP_FWD_BASE wxAsyncMethodCallEvent;
+class WXDLLIMPEXP_FWD_CORE wxCommandEvent;
+class WXDLLIMPEXP_FWD_CORE wxMouseEvent;
+class WXDLLIMPEXP_FWD_CORE wxFocusEvent;
+class WXDLLIMPEXP_FWD_CORE wxChildFocusEvent;
+class WXDLLIMPEXP_FWD_CORE wxKeyEvent;
+class WXDLLIMPEXP_FWD_CORE wxNavigationKeyEvent;
+class WXDLLIMPEXP_FWD_CORE wxSetCursorEvent;
+class WXDLLIMPEXP_FWD_CORE wxScrollEvent;
+class WXDLLIMPEXP_FWD_CORE wxSpinEvent;
+class WXDLLIMPEXP_FWD_CORE wxScrollWinEvent;
+class WXDLLIMPEXP_FWD_CORE wxSizeEvent;
+class WXDLLIMPEXP_FWD_CORE wxMoveEvent;
+class WXDLLIMPEXP_FWD_CORE wxCloseEvent;
+class WXDLLIMPEXP_FWD_CORE wxActivateEvent;
+class WXDLLIMPEXP_FWD_CORE wxWindowCreateEvent;
+class WXDLLIMPEXP_FWD_CORE wxWindowDestroyEvent;
+class WXDLLIMPEXP_FWD_CORE wxShowEvent;
+class WXDLLIMPEXP_FWD_CORE wxIconizeEvent;
+class WXDLLIMPEXP_FWD_CORE wxMaximizeEvent;
+class WXDLLIMPEXP_FWD_CORE wxMouseCaptureChangedEvent;
+class WXDLLIMPEXP_FWD_CORE wxMouseCaptureLostEvent;
+class WXDLLIMPEXP_FWD_CORE wxPaintEvent;
+class WXDLLIMPEXP_FWD_CORE wxEraseEvent;
+class WXDLLIMPEXP_FWD_CORE wxNcPaintEvent;
+class WXDLLIMPEXP_FWD_CORE wxMenuEvent;
+class WXDLLIMPEXP_FWD_CORE wxContextMenuEvent;
+class WXDLLIMPEXP_FWD_CORE wxSysColourChangedEvent;
+class WXDLLIMPEXP_FWD_CORE wxDisplayChangedEvent;
+class WXDLLIMPEXP_FWD_CORE wxQueryNewPaletteEvent;
+class WXDLLIMPEXP_FWD_CORE wxPaletteChangedEvent;
+class WXDLLIMPEXP_FWD_CORE wxJoystickEvent;
+class WXDLLIMPEXP_FWD_CORE wxDropFilesEvent;
+class WXDLLIMPEXP_FWD_CORE wxInitDialogEvent;
+class WXDLLIMPEXP_FWD_CORE wxUpdateUIEvent;
+class WXDLLIMPEXP_FWD_CORE wxClipboardTextEvent;
+class WXDLLIMPEXP_FWD_CORE wxHelpEvent;
+
+
+ // Command events
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_BUTTON, wxCommandEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CHECKBOX, wxCommandEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CHOICE, wxCommandEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_LISTBOX, wxCommandEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_LISTBOX_DCLICK, wxCommandEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CHECKLISTBOX, wxCommandEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MENU, wxCommandEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SLIDER, wxCommandEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_RADIOBOX, wxCommandEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_RADIOBUTTON, wxCommandEvent);
+
+// wxEVT_SCROLLBAR is deprecated, use wxEVT_SCROLL... events
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLBAR, wxCommandEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_VLBOX, wxCommandEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMBOBOX, wxCommandEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_TOOL_RCLICKED, wxCommandEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_TOOL_DROPDOWN, wxCommandEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_TOOL_ENTER, wxCommandEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMBOBOX_DROPDOWN, wxCommandEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMBOBOX_CLOSEUP, wxCommandEvent);
+
+ // Thread and asynchronous method call events
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_BASE, wxEVT_THREAD, wxThreadEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_BASE, wxEVT_ASYNC_METHOD_CALL, wxAsyncMethodCallEvent);
+
+ // Mouse event types
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_LEFT_DOWN, wxMouseEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_LEFT_UP, wxMouseEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MIDDLE_DOWN, wxMouseEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MIDDLE_UP, wxMouseEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_RIGHT_DOWN, wxMouseEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_RIGHT_UP, wxMouseEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOTION, wxMouseEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_ENTER_WINDOW, wxMouseEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_LEAVE_WINDOW, wxMouseEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_LEFT_DCLICK, wxMouseEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MIDDLE_DCLICK, wxMouseEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_RIGHT_DCLICK, wxMouseEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SET_FOCUS, wxFocusEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_KILL_FOCUS, wxFocusEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CHILD_FOCUS, wxChildFocusEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOUSEWHEEL, wxMouseEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX1_DOWN, wxMouseEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX1_UP, wxMouseEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX1_DCLICK, wxMouseEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX2_DOWN, wxMouseEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX2_UP, wxMouseEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX2_DCLICK, wxMouseEvent);
+
+ // Character input event type
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CHAR, wxKeyEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CHAR_HOOK, wxKeyEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_NAVIGATION_KEY, wxNavigationKeyEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_KEY_DOWN, wxKeyEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_KEY_UP, wxKeyEvent);
+#if wxUSE_HOTKEY
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_HOTKEY, wxKeyEvent);
+#endif
+// This is a private event used by wxMSW code only and subject to change or
+// disappear in the future. Don't use.
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AFTER_CHAR, wxKeyEvent);
+
+ // Set cursor event
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SET_CURSOR, wxSetCursorEvent);
+
+ // wxScrollBar and wxSlider event identifiers
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_TOP, wxScrollEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_BOTTOM, wxScrollEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_LINEUP, wxScrollEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_LINEDOWN, wxScrollEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_PAGEUP, wxScrollEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_PAGEDOWN, wxScrollEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_THUMBTRACK, wxScrollEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_THUMBRELEASE, wxScrollEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_CHANGED, wxScrollEvent);
+
+// Due to a bug in older wx versions, wxSpinEvents were being sent with type of
+// wxEVT_SCROLL_LINEUP, wxEVT_SCROLL_LINEDOWN and wxEVT_SCROLL_THUMBTRACK. But
+// with the type-safe events in place, these event types are associated with
+// wxScrollEvent. To allow handling of spin events, new event types have been
+// defined in spinbutt.h/spinnbuttcmn.cpp. To maintain backward compatibility
+// the spin event types are being initialized with the scroll event types.
+
+#if wxUSE_SPINBTN
+
+wxDECLARE_EXPORTED_EVENT_ALIAS( WXDLLIMPEXP_CORE, wxEVT_SPIN_UP, wxSpinEvent );
+wxDECLARE_EXPORTED_EVENT_ALIAS( WXDLLIMPEXP_CORE, wxEVT_SPIN_DOWN, wxSpinEvent );
+wxDECLARE_EXPORTED_EVENT_ALIAS( WXDLLIMPEXP_CORE, wxEVT_SPIN, wxSpinEvent );
+
+#endif
+
+ // Scroll events from wxWindow
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_TOP, wxScrollWinEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_BOTTOM, wxScrollWinEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_LINEUP, wxScrollWinEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_LINEDOWN, wxScrollWinEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_PAGEUP, wxScrollWinEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_PAGEDOWN, wxScrollWinEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_THUMBTRACK, wxScrollWinEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_THUMBRELEASE, wxScrollWinEvent);
+
+ // System events
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SIZE, wxSizeEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOVE, wxMoveEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CLOSE_WINDOW, wxCloseEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_END_SESSION, wxCloseEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_QUERY_END_SESSION, wxCloseEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_ACTIVATE_APP, wxActivateEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_ACTIVATE, wxActivateEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CREATE, wxWindowCreateEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_DESTROY, wxWindowDestroyEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SHOW, wxShowEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_ICONIZE, wxIconizeEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MAXIMIZE, wxMaximizeEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOUSE_CAPTURE_CHANGED, wxMouseCaptureChangedEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOUSE_CAPTURE_LOST, wxMouseCaptureLostEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_PAINT, wxPaintEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_ERASE_BACKGROUND, wxEraseEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_NC_PAINT, wxNcPaintEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MENU_OPEN, wxMenuEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MENU_CLOSE, wxMenuEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MENU_HIGHLIGHT, wxMenuEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CONTEXT_MENU, wxContextMenuEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SYS_COLOUR_CHANGED, wxSysColourChangedEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_DISPLAY_CHANGED, wxDisplayChangedEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_QUERY_NEW_PALETTE, wxQueryNewPaletteEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_PALETTE_CHANGED, wxPaletteChangedEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_JOY_BUTTON_DOWN, wxJoystickEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_JOY_BUTTON_UP, wxJoystickEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_JOY_MOVE, wxJoystickEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_JOY_ZMOVE, wxJoystickEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_DROP_FILES, wxDropFilesEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_INIT_DIALOG, wxInitDialogEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_BASE, wxEVT_IDLE, wxIdleEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_UPDATE_UI, wxUpdateUIEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SIZING, wxSizeEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOVING, wxMoveEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOVE_START, wxMoveEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOVE_END, wxMoveEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_HIBERNATE, wxActivateEvent);
+
+ // Clipboard events
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_TEXT_COPY, wxClipboardTextEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_TEXT_CUT, wxClipboardTextEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_TEXT_PASTE, wxClipboardTextEvent);
+
+ // Generic command events
+ // Note: a click is a higher-level event than button down/up
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_LEFT_CLICK, wxCommandEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_LEFT_DCLICK, wxCommandEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_RIGHT_CLICK, wxCommandEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_RIGHT_DCLICK, wxCommandEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_SET_FOCUS, wxCommandEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_KILL_FOCUS, wxCommandEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_ENTER, wxCommandEvent);
+
+ // Help events
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_HELP, wxHelpEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_DETAILED_HELP, wxHelpEvent);
+
+// these 2 events are the same
+#define wxEVT_TOOL wxEVT_MENU
+
+// ----------------------------------------------------------------------------
+// Compatibility
+// ----------------------------------------------------------------------------
+
+// this event is also used by wxComboBox and wxSpinCtrl which don't include
+// wx/textctrl.h in all ports [yet], so declare it here as well
+//
+// still, any new code using it should include wx/textctrl.h explicitly
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_TEXT, wxCommandEvent);
+
+
+// ----------------------------------------------------------------------------
+// wxEvent(-derived) classes
+// ----------------------------------------------------------------------------
+
+// the predefined constants for the number of times we propagate event
+// upwards window child-parent chain
+enum wxEventPropagation
+{
+ // don't propagate it at all
+ wxEVENT_PROPAGATE_NONE = 0,
+
+ // propagate it until it is processed
+ wxEVENT_PROPAGATE_MAX = INT_MAX
+};
+
+// The different categories for a wxEvent; see wxEvent::GetEventCategory.
+// NOTE: they are used as OR-combinable flags by wxEventLoopBase::YieldFor
+enum wxEventCategory
+{
+ // this is the category for those events which are generated to update
+ // the appearance of the GUI but which (usually) do not comport data
+ // processing, i.e. which do not provide input or output data
+ // (e.g. size events, scroll events, etc).
+ // They are events NOT directly generated by the user's input devices.
+ wxEVT_CATEGORY_UI = 1,
+
+ // this category groups those events which are generated directly from the
+ // user through input devices like mouse and keyboard and usually result in
+ // data to be processed from the application.
+ // (e.g. mouse clicks, key presses, etc)
+ wxEVT_CATEGORY_USER_INPUT = 2,
+
+ // this category is for wxSocketEvent
+ wxEVT_CATEGORY_SOCKET = 4,
+
+ // this category is for wxTimerEvent
+ wxEVT_CATEGORY_TIMER = 8,
+
+ // this category is for any event used to send notifications from the
+ // secondary threads to the main one or in general for notifications among
+ // different threads (which may or may not be user-generated)
+ wxEVT_CATEGORY_THREAD = 16,
+
+
+ // implementation only
+
+ // used in the implementations of wxEventLoopBase::YieldFor
+ wxEVT_CATEGORY_UNKNOWN = 32,
+
+ // a special category used as an argument to wxEventLoopBase::YieldFor to indicate that
+ // Yield() should leave all wxEvents on the queue while emptying the native event queue
+ // (native events will be processed but the wxEvents they generate will be queued)
+ wxEVT_CATEGORY_CLIPBOARD = 64,
+
+
+ // 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