* Event types
*
*/
-enum {
+
+enum wxEventType {
+ wxEVT_NULL = 0,
wxEVT_FIRST = 10000,
// New names
wxEVT_COMMAND_TEXT_UPDATED,
wxEVT_COMMAND_TEXT_ENTER,
wxEVT_COMMAND_MENU_SELECTED,
+ wxEVT_COMMAND_TOOL_CLICKED = wxEVT_COMMAND_MENU_SELECTED,
wxEVT_COMMAND_SLIDER_UPDATED,
wxEVT_COMMAND_RADIOBOX_SELECTED,
wxEVT_COMMAND_RADIOBUTTON_SELECTED,
wxEVT_COMMAND_SCROLLBAR_UPDATED,
wxEVT_COMMAND_VLBOX_SELECTED,
wxEVT_COMMAND_COMBOBOX_SELECTED,
- wxEVT_COMMAND_TOOL_CLICKED,
wxEVT_COMMAND_TOOL_RCLICKED,
wxEVT_COMMAND_TOOL_ENTER,
wxEVT_SET_FOCUS,
/* Character input event type */
wxEVT_CHAR,
+ wxEVT_NAVIGATION_KEY,
/*
* Scrollbar event identifiers
wxEVT_COMMAND_TREE_SET_INFO,
wxEVT_COMMAND_TREE_ITEM_EXPANDED,
wxEVT_COMMAND_TREE_ITEM_EXPANDING,
+ wxEVT_COMMAND_TREE_ITEM_COLLAPSED,
+ wxEVT_COMMAND_TREE_ITEM_COLLAPSING,
wxEVT_COMMAND_TREE_SEL_CHANGED,
wxEVT_COMMAND_TREE_SEL_CHANGING,
wxEVT_COMMAND_TREE_KEY_DOWN,
wxEVT_COMMAND_LIST_INSERT_ITEM,
wxEVT_COMMAND_LIST_COL_CLICK,
- /* Tab control event types */
+ /* Tab and notebook control event types */
wxEVT_COMMAND_TAB_SEL_CHANGED,
- wxEVT_COMMAND_TAB_SEL_CHANGING
+ wxEVT_COMMAND_TAB_SEL_CHANGING,
+ wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
+ wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING,
+ /* System misc. */
+ wxEVT_END_PROCESS = wxEVT_FIRST + 300
};
// Compatibility
wxEvent(int id = 0);
inline ~wxEvent(void) {}
- inline void SetEventType(WXTYPE typ) { m_eventType = typ; }
- inline WXTYPE GetEventType(void) const { return m_eventType; }
+ inline void SetEventType(wxEventType typ) { m_eventType = typ; }
+ inline wxEventType GetEventType(void) const { return m_eventType; }
inline wxObject *GetEventObject(void) const { return m_eventObject; }
inline void SetEventObject(wxObject *obj) { m_eventObject = obj; }
inline long GetTimestamp(void) const { return m_timeStamp; }
// Can instruct event processor that we wish to ignore this event
// (treat as if the event table entry had not been found)
- inline void Skip(const bool skip = TRUE) { m_skipped = skip; }
+ inline void Skip(bool skip = TRUE) { m_skipped = skip; }
inline bool GetSkipped(void) const { return m_skipped; };
public:
bool m_skipped;
wxObject* m_eventObject;
char* m_eventHandle; // Handle of an underlying windowing system event
- WXTYPE m_eventType;
+ wxEventType m_eventType;
long m_timeStamp;
int m_id;
wxObject* m_callbackUserData;
{
DECLARE_DYNAMIC_CLASS(wxCommandEvent)
- wxCommandEvent(WXTYPE commandType = 0, int id = 0);
+ wxCommandEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
inline ~wxCommandEvent(void) {}
/*
DECLARE_DYNAMIC_CLASS(wxScrollEvent)
public:
- wxScrollEvent(WXTYPE commandType = 0, int id = 0, int pos = 0, int orient = 0);
+ wxScrollEvent(wxEventType commandType = wxEVT_NULL, int id = 0, int pos = 0, int orient = 0);
inline ~wxScrollEvent(void) {}
/*
DECLARE_DYNAMIC_CLASS(wxMouseEvent)
public:
- wxMouseEvent(WXTYPE mouseType = 0);
+ wxMouseEvent(wxEventType mouseType = wxEVT_NULL);
// Was it a button event? (*doesn't* mean: is any button *down*?)
inline bool IsButton(void) const { return Button(-1); }
DECLARE_DYNAMIC_CLASS(wxKeyEvent)
public:
- wxKeyEvent(WXTYPE keyType = 0);
+ wxKeyEvent(wxEventType keyType = wxEVT_NULL);
// Find state of shift/control keys
inline bool ControlDown(void) const { return m_controlDown; }
DECLARE_DYNAMIC_CLASS(wxFocusEvent)
public:
- inline wxFocusEvent(WXTYPE type = 0, int Id = 0) { m_eventType = type; m_id = Id; }
+ inline wxFocusEvent(wxEventType type = wxEVT_NULL, int Id = 0) { m_eventType = type; m_id = Id; }
};
// Activate event class
public:
bool m_active;
- inline wxActivateEvent(WXTYPE type = 0, bool active = TRUE, int Id = 0) { m_eventType = type; m_active = active; m_id = Id; }
+ inline wxActivateEvent(wxEventType type = wxEVT_NULL, bool active = TRUE, int Id = 0) { m_eventType = type; m_active = active; m_id = Id; }
inline bool GetActive(void) const { return m_active; }
};
public:
int m_menuId;
- inline wxMenuEvent(WXTYPE type = 0, int id = 0) { m_eventType = type; m_menuId = id; }
+ inline wxMenuEvent(wxEventType type = wxEVT_NULL, int id = 0) { m_eventType = type; m_menuId = id; }
inline int GetMenuId(void) const { return m_menuId; }
};
DECLARE_DYNAMIC_CLASS(wxCloseEvent)
public:
- inline wxCloseEvent(WXTYPE type = 0, int id = 0)
+ inline wxCloseEvent(wxEventType type = wxEVT_NULL, int id = 0)
{ m_eventType = type; m_sessionEnding = TRUE; m_loggingOff = TRUE; m_veto = FALSE;
m_id = id; m_force = FALSE; }
int m_buttonState; // Which buttons are down?
int m_joyStick; // Which joystick?
- inline wxJoystickEvent(WXTYPE type = 0, int state = 0, int joystick = wxJOYSTICK1, int change = 0)
+ inline wxJoystickEvent(wxEventType type = wxEVT_NULL, int state = 0, int joystick = wxJOYSTICK1, int change = 0)
{ m_eventType = type; m_buttonState = state; m_pos = wxPoint(0,0); m_zPosition = 0;
m_joyStick = joystick; m_buttonChange = change; }
wxPoint m_pos;
wxString* m_files; // Memory (de)allocated by code calling ProcessEvent
- inline wxDropFilesEvent(WXTYPE type = 0, int noFiles = 0, wxString *files = NULL)
+ inline wxDropFilesEvent(wxEventType type = wxEVT_NULL, int noFiles = 0, wxString *files = NULL)
{ m_eventType = type; m_noFiles = noFiles; m_files = files; }
inline wxPoint GetPosition(void) const { return m_pos; }
{ m_eventType = wxEVT_SYS_COLOUR_CHANGED; }
};
-/* TODO, apart from events for individual controls...
+/*
+ Event generated by dialog navigation keys
+ wxEVT_NAVIGATION_KEY
+ */
+// must derive from command event to be propagated to the parent
+class WXDLLEXPORT wxNavigationKeyEvent : public wxCommandEvent
+{
+ DECLARE_DYNAMIC_CLASS(wxNavigationKeyEvent)
+
+public:
+ wxNavigationKeyEvent() : wxCommandEvent(wxEVT_NAVIGATION_KEY) { }
+
+ // direction: forward (true) or backward (false)
+ bool GetDirection() const { return m_commandInt == 1; }
+ void SetDirection(bool bForward) { m_commandInt = bForward; }
+
+ // it may be a window change event (MDI, notebook pages...) or a control
+ // change event
+ bool IsWindowChange() const { return m_extraLong == 1; }
+ void SetWindowChange(bool bIs) { m_extraLong = bIs; }
+
+ // the child which has the focus currently (may be NULL - use
+ // wxWindow::FindFocus then)
+ wxWindow* GetCurrentFocus() const { return (wxWindow *)m_clientData; }
+ void SetCurrentFocus(wxWindow *win) { m_clientData = (char *)win; }
+};
+
+/* TODO
wxEVT_POWER,
wxEVT_CREATE,
wxEVT_DESTROY,
- wxEVT_SHOW,
wxEVT_MOUSE_CAPTURE_CHANGED,
wxEVT_SETTING_CHANGED, // WM_WININICHANGE (NT) / WM_SETTINGCHANGE (Win95)
wxEVT_QUERY_NEW_PALETTE,
struct WXDLLEXPORT wxEventTableEntry
{
- int m_eventType; // main event type
- int m_id; // control/menu/toolbar id
- int m_lastId; // used for ranges of ids
+ // For some reason, this can't be wxEventType, or VC++ complains.
+ int m_eventType; // main event type
+ int m_id; // control/menu/toolbar id
+ int m_lastId; // used for ranges of ids
wxObjectEventFunction m_fn; // function to call: not wxEventFunction, because
// of dependency problems
wxObject* m_callbackUserData;
// callback function
// Default behaviour
virtual long Default(void) { if (GetNextHandler()) return GetNextHandler()->Default(); else return 0; };
-#if WXWIN_COMPATIBILITY
- virtual void OldOnMenuCommand(int WXUNUSED(cmd));
- virtual void OldOnMenuSelect(int WXUNUSED(cmd));
- virtual void OldOnInitMenuPopup(int WXUNUSED(pos));
- virtual void OldOnScroll(wxCommandEvent& WXUNUSED(event));
- virtual void OldOnPaint(void);
- virtual void OldOnSize(int WXUNUSED(width), int WXUNUSED(height));
- virtual void OldOnMove(int WXUNUSED(x), int WXUNUSED(y));
- virtual void OldOnMouseEvent(wxMouseEvent& WXUNUSED(event));
- virtual void OldOnChar(wxKeyEvent& WXUNUSED(event));
- // Under Windows, we can intercept character input per dialog or frame
- virtual bool OldOnCharHook(wxKeyEvent& WXUNUSED(event));
- virtual void OldOnActivate(bool WXUNUSED(active));
- virtual void OldOnSetFocus(void);
- virtual void OldOnKillFocus(void);
- virtual bool OldOnSysColourChange(void);
- virtual void OldOnDropFiles(int n, char *files[], int x, int y);
-#endif
virtual bool OnClose(void);
- virtual void OnDefaultAction(wxControl *WXUNUSED(initiatingItem)) {};
- virtual void OnChangeFocus(wxControl *WXUNUSED(from), wxControl *WXUNUSED(to)) {};
- virtual bool OnFunctionKey(wxKeyEvent &WXUNUSED(event)) { return FALSE; };
inline char *GetClientData(void) const { return m_clientData; }
inline void SetClientData(char *clientData) { m_clientData = clientData; }
virtual bool ProcessEvent(wxEvent& event);
virtual bool SearchEventTable(wxEventTable& table, wxEvent& event);
- void Connect( const int id, const int lastId,
- const int eventType,
+ void Connect( int id, int lastId,
+ int eventType,
wxObjectEventFunction func,
wxObject *userData = NULL );
#define EVT_SHOW(func) { wxEVT_SHOW, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxShowEventFunction) & func, NULL },
#define EVT_MAXIMIZE(func) { wxEVT_MAXIMIZE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMaximizeEventFunction) & func, NULL },
#define EVT_ICONIZE(func) { wxEVT_ICONIZE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxIconizeEventFunction) & func, NULL },
+#define EVT_NAVIGATION_KEY(func) { wxEVT_NAVIGATION_KEY, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & func, NULL },
// Mouse events
#define EVT_LEFT_DOWN(func) { wxEVT_LEFT_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, NULL },
{ wxEVT_MOTION, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, NULL },\
{ wxEVT_LEFT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, NULL },\
{ wxEVT_MIDDLE_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, NULL },\
- { wxEVT_RIGHT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, NULL },
+ { wxEVT_RIGHT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, NULL },\
+ { wxEVT_ENTER_WINDOW, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, NULL },\
+ { wxEVT_LEAVE_WINDOW, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, NULL },
// EVT_COMMAND
#define EVT_COMMAND(id, cmd, fn) { cmd, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, NULL },
#define EVT_CHECKBOX(id, fn) { wxEVT_COMMAND_CHECKBOX_CLICKED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, NULL },
#define EVT_CHOICE(id, fn) { wxEVT_COMMAND_CHOICE_SELECTED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, NULL },
#define EVT_LISTBOX(id, fn) { wxEVT_COMMAND_LISTBOX_SELECTED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, NULL },
+#define EVT_LISTBOX_DCLICK(id, fn) { wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, NULL },
#define EVT_TEXT(id, fn) { wxEVT_COMMAND_TEXT_UPDATED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, NULL },
#define EVT_TEXT_ENTER(id, fn) { wxEVT_COMMAND_TEXT_ENTER, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, NULL },
#define EVT_MENU(id, fn) { wxEVT_COMMAND_MENU_SELECTED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, NULL },
#define EVT_VLBOX(id, fn) { wxEVT_COMMAND_VLBOX_SELECTED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, NULL },
#define EVT_COMBOBOX(id, fn) { wxEVT_COMMAND_COMBOBOX_SELECTED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, NULL },
#define EVT_TOOL(id, fn) { wxEVT_COMMAND_TOOL_CLICKED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, NULL },
+#define EVT_TOOL_RANGE(id1, id2, fn) { wxEVT_COMMAND_TOOL_CLICKED, id1, id2, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, NULL },
#define EVT_TOOL_RCLICKED(id, fn) { wxEVT_COMMAND_TOOL_RCLICKED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, NULL },
+#define EVT_TOOL_RCLICKED_RANGE(id1, id2, fn) { wxEVT_COMMAND_TOOL_RCLICKED, id1, id2, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, NULL },
#define EVT_TOOL_ENTER(id, fn) { wxEVT_COMMAND_TOOL_ENTER, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, NULL },
+#define EVT_TOOL_ENTER_RANGE(id1, id2, fn) { wxEVT_COMMAND_TOOL_ENTER, id1, id2, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, NULL },
#define EVT_CHECKLISTBOX(id, fn) { wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, NULL },
// Generic command events