#define BEGIN_DECLARE_EVENT_TYPES() enum {
#define END_DECLARE_EVENT_TYPES() };
#define DECLARE_EVENT_TYPE(name, value) name = wxEVT_FIRST + value,
+#define DECLARE_LOCAL_EVENT_TYPE(name, value) name = wxEVT_FIRST + value,
#define DEFINE_EVENT_TYPE(name)
+
#else // !WXWIN_COMPATIBILITY_EVENT_TYPES
#define DECLARE_EVENT_TABLE_ENTRY(type, id, idLast, fn, obj) \
#define BEGIN_DECLARE_EVENT_TYPES()
#define END_DECLARE_EVENT_TYPES()
-#define DECLARE_EVENT_TYPE(name, value) extern const wxEventType name;
+#define DECLARE_EVENT_TYPE(name, value) \
+ extern const wxEventType WXDLLEXPORT name;
+#define DECLARE_LOCAL_EVENT_TYPE(name, value) extern const wxEventType name;
#define DEFINE_EVENT_TYPE(name) const wxEventType name = wxNewEventType();
// generate a new unique event type
#else // !WXWIN_COMPATIBILITY_EVENT_TYPES
// it is important to still have these as constants to avoid
// initialization order related problems
- const wxEventType wxEVT_NULL = 0;
+ DECLARE_EVENT_TYPE(wxEVT_NULL,0);
const wxEventType wxEVT_FIRST = 10000;
const wxEventType wxEVT_USER_FIRST = wxEVT_FIRST + 2000;
#endif // WXWIN_COMPATIBILITY_EVENT_TYPES/!WXWIN_COMPATIBILITY_EVENT_TYPES
DECLARE_EVENT_TYPE(wxEVT_RIGHT_DCLICK, 111)
DECLARE_EVENT_TYPE(wxEVT_SET_FOCUS, 112)
DECLARE_EVENT_TYPE(wxEVT_KILL_FOCUS, 113)
+ DECLARE_EVENT_TYPE(wxEVT_MOUSEWHEEL, 114)
// Non-client mouse events
DECLARE_EVENT_TYPE(wxEVT_NC_LEFT_DOWN, 200)
wxEVT_COMMAND_SCROLLBAR_UPDATED
wxEVT_COMMAND_VLBOX_SELECTED
wxEVT_COMMAND_COMBOBOX_SELECTED
+ wxEVT_COMMAND_TOGGLEBUTTON_CLICKED
*/
class WXDLLEXPORT wxCommandEvent : public wxEvent
void CopyObject(wxObject& obj) const;
-#ifdef WXWIN_COMPATIBILITY_2
+#if WXWIN_COMPATIBILITY_2
bool Checked() const { return IsChecked(); }
#endif // WXWIN_COMPATIBILITY_2
class WXDLLEXPORT wxScrollWinEvent : public wxEvent
{
- DECLARE_DYNAMIC_CLASS(wxScrollWinEvent)
-
public:
wxScrollWinEvent(wxEventType commandType = wxEVT_NULL,
int pos = 0, int orient = 0);
void SetPosition(int pos) { m_commandInt = pos; }
void CopyObject(wxObject& object_dest) const;
+
public:
int m_commandInt; // Additional information
long m_extraLong;
+
+ DECLARE_DYNAMIC_CLASS(wxScrollWinEvent)
};
// Mouse event class
class WXDLLEXPORT wxMouseEvent : public wxEvent
{
- DECLARE_DYNAMIC_CLASS(wxMouseEvent)
-
public:
wxMouseEvent(wxEventType mouseType = wxEVT_NULL);
// Was the given button 1,2,3 or any in Down state?
bool ButtonIsDown(int but) const;
+ // Get the button which is changing state (-1 if none)
+ int GetButton() const;
+
// Find state of shift/control keys
bool ControlDown() const { return m_controlDown; }
bool MetaDown() const { return m_metaDown; }
// Get Y position
wxCoord GetY() const { return m_y; }
+ // 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; }
+
+ // Returns the configured number of lines (or whatever) to be scrolled per
+ // wheel action. Defaults to one.
+ int GetLinesPerAction() const { return m_linesPerAction; }
+
+
void CopyObject(wxObject& obj) const;
public:
bool m_shiftDown;
bool m_altDown;
bool m_metaDown;
+
+ int m_wheelRotation;
+ int m_wheelDelta;
+ int m_linesPerAction;
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxMouseEvent)
};
// Cursor set event
#endif // debug
};
+class WXDLLEXPORT wxNcPaintEvent : public wxEvent
+{
+public:
+ wxNcPaintEvent(int id = 0) : wxEvent(id) { SetEventType(wxEVT_NC_PAINT); }
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxNcPaintEvent)
+};
+
// Erase background event class
/*
wxEVT_ERASE_BACKGROUND
class WXDLLEXPORT wxFocusEvent : public wxEvent
{
- DECLARE_DYNAMIC_CLASS(wxFocusEvent)
-
public:
- wxFocusEvent(wxEventType type = wxEVT_NULL, int Id = 0)
- { m_eventType = type; m_id = Id; }
+ wxFocusEvent(wxEventType type = wxEVT_NULL, int id = 0)
+ { m_eventType = type; m_id = id; m_win = NULL; }
+
+ // the window associated with this event is the window which had focus
+ // before for SET event and the window which will have focus for the KILL
+ // one
+ //
+ // NB: it may be NULL in both cases!
+ wxWindow *GetWindow() const { return m_win; }
+ void SetWindow(wxWindow *win) { m_win = win; }
+
+private:
+ wxWindow *m_win;
+
+ DECLARE_DYNAMIC_CLASS(wxFocusEvent)
};
// Activate event class
wxEVT_MENU_INIT,
wxEVT_MENU_HIGHLIGHT,
wxEVT_POPUP_MENU_INIT,
- wxEVT_CONTEXT_MENU,
*/
class WXDLLEXPORT wxMenuEvent : public wxEvent
class WXDLLEXPORT wxShowEvent : public wxEvent
{
- DECLARE_DYNAMIC_CLASS(wxShowEvent)
-
public:
-
wxShowEvent(int id = 0, bool show = FALSE)
{ m_eventType = wxEVT_SHOW; m_id = id; m_show = show; }
protected:
bool m_show;
+
+ DECLARE_DYNAMIC_CLASS(wxShowEvent)
};
/*
class WXDLLEXPORT wxIconizeEvent : public wxEvent
{
- DECLARE_DYNAMIC_CLASS(wxIconizeEvent)
-
public:
- wxIconizeEvent(int id = 0)
- { m_eventType = wxEVT_ICONIZE; m_id = id; }
+ wxIconizeEvent(int id = 0, bool iconized = TRUE)
+ { m_eventType = wxEVT_ICONIZE; m_id = id; m_iconized = iconized; }
+
+ // return true if the frame was iconized, false if restored
+ bool Iconized() const { return m_iconized; }
+
+protected:
+ bool m_iconized;
+
+ DECLARE_DYNAMIC_CLASS(wxIconizeEvent)
};
/*
class WXDLLEXPORT wxMaximizeEvent : public wxEvent
{
- DECLARE_DYNAMIC_CLASS(wxMaximizeEvent)
-
public:
- wxMaximizeEvent(int id = 0)
- { m_eventType = wxEVT_MAXIMIZE; m_id = id; }
+ wxMaximizeEvent(int id = 0)
+ { m_eventType = wxEVT_MAXIMIZE; m_id = id; }
+
+ DECLARE_DYNAMIC_CLASS(wxMaximizeEvent)
};
// Joystick event class
DECLARE_DYNAMIC_CLASS(wxHelpEvent)
};
+// A Context event is sent when the user right clicks on a window or
+// presses Shift-F10
+// NOTE : Under windows this is a repackaged WM_CONTETXMENU message
+// Under other systems it may have to be generated from a right click event
+/*
+ wxEVT_CONTEXT_MENU
+*/
+
+class WXDLLEXPORT wxContextMenuEvent : public wxCommandEvent
+{
+public:
+ wxContextMenuEvent(wxEventType type = wxEVT_NULL,
+ wxWindowID id = 0,
+ const wxPoint& pt = wxDefaultPosition)
+ {
+ m_eventType = type;
+ m_id = id;
+ m_pos = pt;
+ }
+
+ // Position of event (in screen coordinates)
+ const wxPoint& GetPosition() const { return m_pos; }
+ void SetPosition(const wxPoint& pos) { m_pos = pos; }
+
+protected:
+ wxPoint m_pos;
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxContextMenuEvent)
+};
+
#endif // wxUSE_GUI
// Idle event
wxObject *userData = (wxObject *) NULL )
{ Connect(id, -1, eventType, func, userData); }
- bool Disconnect( int id, int lastId = -1, wxEventType eventType = wxEVT_NULL,
+ bool Disconnect( int id, int lastId, wxEventType eventType,
wxObjectEventFunction func = NULL,
wxObject *userData = (wxObject *) NULL );
typedef void (wxEvtHandler::*wxSetCursorEventFunction)(wxSetCursorEvent&);
typedef void (wxEvtHandler::*wxNotifyEventFunction)(wxNotifyEvent&);
typedef void (wxEvtHandler::*wxHelpEventFunction)(wxHelpEvent&);
+typedef void (wxEvtHandler::*wxContextMenuEventFunction)(wxContextMenuEvent&);
#endif // wxUSE_GUI
// N.B. In GNU-WIN32, you *have* to take the address of a member function
{ &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \
const wxEventTableEntry theClass::sm_eventTableEntries[] = { \
-#define END_EVENT_TABLE() DECLARE_EVENT_TABLE_ENTRY( 0, 0, 0, 0, 0 ) };
+#define END_EVENT_TABLE() DECLARE_EVENT_TABLE_ENTRY( wxEVT_NULL, 0, 0, 0, 0 ) };
/*
* Event table macros
#define EVT_END_SESSION(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_END_SESSION, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxCloseEventFunction) & func, (wxObject *) NULL ),
#define EVT_QUERY_END_SESSION(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_QUERY_END_SESSION, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxCloseEventFunction) & func, (wxObject *) NULL ),
#define EVT_PAINT(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_PAINT, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxPaintEventFunction) & func, (wxObject *) NULL ),
+#define EVT_NC_PAINT(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_NC_PAINT, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxPaintEventFunction) & func, (wxObject *) NULL ),
#define EVT_ERASE_BACKGROUND(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_ERASE_BACKGROUND, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxEraseEventFunction) & func, (wxObject *) NULL ),
#define EVT_CHAR(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_CHAR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxCharEventFunction) & func, (wxObject *) NULL ),
#define EVT_KEY_DOWN(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_KEY_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxCharEventFunction) & func, (wxObject *) NULL ),
#define EVT_RIGHT_DCLICK(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_RIGHT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, (wxObject *) NULL ),
#define EVT_LEAVE_WINDOW(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_LEAVE_WINDOW, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, (wxObject *) NULL ),
#define EVT_ENTER_WINDOW(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_ENTER_WINDOW, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, (wxObject *) NULL ),
+#define EVT_MOUSEWHEEL(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_MOUSEWHEEL, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, (wxObject *) NULL ),
// All mouse events
#define EVT_MOUSE_EVENTS(func) \
DECLARE_EVENT_TABLE_ENTRY( wxEVT_MIDDLE_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, (wxObject *) NULL ),\
DECLARE_EVENT_TABLE_ENTRY( wxEVT_RIGHT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, (wxObject *) NULL ),\
DECLARE_EVENT_TABLE_ENTRY( wxEVT_ENTER_WINDOW, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, (wxObject *) NULL ),\
- DECLARE_EVENT_TABLE_ENTRY( wxEVT_LEAVE_WINDOW, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, (wxObject *) NULL ),
+ DECLARE_EVENT_TABLE_ENTRY( wxEVT_LEAVE_WINDOW, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, (wxObject *) NULL ),\
+ DECLARE_EVENT_TABLE_ENTRY( wxEVT_MOUSEWHEEL, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, (wxObject *) NULL ),
// EVT_COMMAND
#define EVT_COMMAND(id, event, fn) DECLARE_EVENT_TABLE_ENTRY( event, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL ),
#define EVT_DETAILED_HELP_RANGE(id1, id2, func) \
DECLARE_EVENT_TABLE_ENTRY( wxEVT_DETAILED_HELP, id1, id2, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxHelpEventFunction) & func, (wxObject *) NULL ),
+// Context Menu Events
+#define EVT_CONTEXT_MENU(func) \
+ DECLARE_EVENT_TABLE_ENTRY(wxEVT_CONTEXT_MENU, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxContextMenuEventFunction) & func, (wxObject *) NULL ),
+
// ----------------------------------------------------------------------------
// Global data
// ----------------------------------------------------------------------------