compatibility changes: WXWIN_COMPATIBILITY_EVENT_TYPES and DECLARE_EVENT_TABLE_ENTRY added

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9190 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2001-01-27 20:16:02 +00:00
parent 2e4c3bf87a
commit cbee8f8dc7
2 changed files with 291 additions and 230 deletions

View File

@ -43,236 +43,279 @@ class WXDLLEXPORT wxList;
// Event types
// ----------------------------------------------------------------------------
typedef int wxEventType;
// in previous versions of wxWindows the event types used to be constants
// which created difficulties with custom/user event types definition
//
// starting from wxWindows 2.4 the event types are now dynamically assigned
// using wxNewEventType() which solves this problem, however at price of
// several incompatibilities:
//
// a) event table macros declaration changed, it now uses wxEventTableEntry
// ctor instead of initialisation from an agregate - the macro
// DECLARE_EVENT_TABLE_ENTRY may be used to write code which can compile
// with all versions of wxWindows
//
// b) event types can't be used as switch() cases as they're not really
// constant any more - there is no magic solution here, you just have to
// change the switch()es to if()s
//
// if these are real problems for you, define WXWIN_COMPATIBILITY_EVENT_TYPES
// to get 100% old behaviour, however you won't be able to use the libraries
// using the new dynamic event type allocation in such case, so avoid it if
// possible.
#if WXWIN_COMPATIBILITY_EVENT_TYPES
#define DECLARE_EVENT_TABLE_ENTRY(type, id, idLast, fn, obj) \
{ type, id, idLast, fn, obj }
#define DECLARE_EVENT_TYPE(name, value) name = wxEVT_FIRST + value,
#else // !WXWIN_COMPATIBILITY_EVENT_TYPES
#define DECLARE_EVENT_TABLE_ENTRY(type, id, idLast, fn, obj) \
wxEventTableEntry(type, id, idLast, fn, obj)
#define DECLARE_EVENT_TYPE(name, value) extern wxEventType name;
// generate a new unique event type
extern WXDLLEXPORT wxEventType wxNewEventType();
#endif // WXWIN_COMPATIBILITY_EVENT_TYPES/!WXWIN_COMPATIBILITY_EVENT_TYPES
#if WXWIN_COMPATIBILITY_EVENT_TYPES
enum
{
wxEVT_NULL = 0,
wxEVT_FIRST = 10000,
#else // !WXWIN_COMPATIBILITY_EVENT_TYPES
extern wxEventType wxEVT_NULL;
extern wxEventType wxEVT_FIRST;
#endif // WXWIN_COMPATIBILITY_EVENT_TYPES/!WXWIN_COMPATIBILITY_EVENT_TYPES
DECLARE_EVENT_TYPE(wxEVT_COMMAND_BUTTON_CLICKED, 1)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_CHECKBOX_CLICKED, 2)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_CHOICE_SELECTED, 3)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_LISTBOX_SELECTED, 4)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, 5)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, 6)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_UPDATED, 7)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_ENTER, 8)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_MENU_SELECTED, 9)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_SLIDER_UPDATED, 10)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_RADIOBOX_SELECTED, 11)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_RADIOBUTTON_SELECTED, 12)
// wxEVT_COMMAND_SCROLLBAR_UPDATED is now obsolete since we use
// wxEVT_SCROLL... events
DECLARE_EVENT_TYPE(wxEVT_COMMAND_SCROLLBAR_UPDATED, 13)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_VLBOX_SELECTED, 14)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_COMBOBOX_SELECTED, 15)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_TOOL_RCLICKED, 16)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_TOOL_ENTER, 17)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_SPINCTRL_UPDATED, 18)
// Sockets and timers send events, too
DECLARE_EVENT_TYPE(wxEVT_SOCKET, 50)
DECLARE_EVENT_TYPE(wxEVT_TIMER , 80)
// Mouse event types
DECLARE_EVENT_TYPE(wxEVT_LEFT_DOWN, 100)
DECLARE_EVENT_TYPE(wxEVT_LEFT_UP, 101)
DECLARE_EVENT_TYPE(wxEVT_MIDDLE_DOWN, 102)
DECLARE_EVENT_TYPE(wxEVT_MIDDLE_UP, 103)
DECLARE_EVENT_TYPE(wxEVT_RIGHT_DOWN, 104)
DECLARE_EVENT_TYPE(wxEVT_RIGHT_UP, 105)
DECLARE_EVENT_TYPE(wxEVT_MOTION, 106)
DECLARE_EVENT_TYPE(wxEVT_ENTER_WINDOW, 107)
DECLARE_EVENT_TYPE(wxEVT_LEAVE_WINDOW, 108)
DECLARE_EVENT_TYPE(wxEVT_LEFT_DCLICK, 109)
DECLARE_EVENT_TYPE(wxEVT_MIDDLE_DCLICK, 110)
DECLARE_EVENT_TYPE(wxEVT_RIGHT_DCLICK, 111)
DECLARE_EVENT_TYPE(wxEVT_SET_FOCUS, 112)
DECLARE_EVENT_TYPE(wxEVT_KILL_FOCUS, 113)
// Non-client mouse events
DECLARE_EVENT_TYPE(wxEVT_NC_LEFT_DOWN, 200)
DECLARE_EVENT_TYPE(wxEVT_NC_LEFT_UP, 201)
DECLARE_EVENT_TYPE(wxEVT_NC_MIDDLE_DOWN, 202)
DECLARE_EVENT_TYPE(wxEVT_NC_MIDDLE_UP, 203)
DECLARE_EVENT_TYPE(wxEVT_NC_RIGHT_DOWN, 204)
DECLARE_EVENT_TYPE(wxEVT_NC_RIGHT_UP, 205)
DECLARE_EVENT_TYPE(wxEVT_NC_MOTION, 206)
DECLARE_EVENT_TYPE(wxEVT_NC_ENTER_WINDOW, 207)
DECLARE_EVENT_TYPE(wxEVT_NC_LEAVE_WINDOW, 208)
DECLARE_EVENT_TYPE(wxEVT_NC_LEFT_DCLICK, 209)
DECLARE_EVENT_TYPE(wxEVT_NC_MIDDLE_DCLICK, 210)
DECLARE_EVENT_TYPE(wxEVT_NC_RIGHT_DCLICK, 211)
// Character input event type
DECLARE_EVENT_TYPE(wxEVT_CHAR, 212)
DECLARE_EVENT_TYPE(wxEVT_CHAR_HOOK, 213)
DECLARE_EVENT_TYPE(wxEVT_NAVIGATION_KEY, 214)
DECLARE_EVENT_TYPE(wxEVT_KEY_DOWN, 215)
DECLARE_EVENT_TYPE(wxEVT_KEY_UP, 216)
// Set cursor event
DECLARE_EVENT_TYPE(wxEVT_SET_CURSOR, 230)
// wxScrollbar and wxSlider event identifiers
DECLARE_EVENT_TYPE(wxEVT_SCROLL_TOP, 300)
DECLARE_EVENT_TYPE(wxEVT_SCROLL_BOTTOM, 301)
DECLARE_EVENT_TYPE(wxEVT_SCROLL_LINEUP, 302)
DECLARE_EVENT_TYPE(wxEVT_SCROLL_LINEDOWN, 303)
DECLARE_EVENT_TYPE(wxEVT_SCROLL_PAGEUP, 304)
DECLARE_EVENT_TYPE(wxEVT_SCROLL_PAGEDOWN, 305)
DECLARE_EVENT_TYPE(wxEVT_SCROLL_THUMBTRACK, 306)
DECLARE_EVENT_TYPE(wxEVT_SCROLL_THUMBRELEASE, 307)
// Scroll events from wxWindow
DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_TOP, 320)
DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_BOTTOM, 321)
DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_LINEUP, 322)
DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_LINEDOWN, 323)
DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_PAGEUP, 324)
DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_PAGEDOWN, 325)
DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_THUMBTRACK, 326)
DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_THUMBRELEASE, 327)
// System events
DECLARE_EVENT_TYPE(wxEVT_SIZE, 400)
DECLARE_EVENT_TYPE(wxEVT_MOVE, 401)
DECLARE_EVENT_TYPE(wxEVT_CLOSE_WINDOW, 402)
DECLARE_EVENT_TYPE(wxEVT_END_SESSION, 403)
DECLARE_EVENT_TYPE(wxEVT_QUERY_END_SESSION, 404)
DECLARE_EVENT_TYPE(wxEVT_ACTIVATE_APP, 405)
DECLARE_EVENT_TYPE(wxEVT_POWER, 406)
DECLARE_EVENT_TYPE(wxEVT_ACTIVATE, 409)
DECLARE_EVENT_TYPE(wxEVT_CREATE, 410)
DECLARE_EVENT_TYPE(wxEVT_DESTROY, 411)
DECLARE_EVENT_TYPE(wxEVT_SHOW, 412)
DECLARE_EVENT_TYPE(wxEVT_ICONIZE, 413)
DECLARE_EVENT_TYPE(wxEVT_MAXIMIZE, 414)
DECLARE_EVENT_TYPE(wxEVT_MOUSE_CAPTURE_CHANGED, 415)
DECLARE_EVENT_TYPE(wxEVT_PAINT, 416)
DECLARE_EVENT_TYPE(wxEVT_ERASE_BACKGROUND, 417)
DECLARE_EVENT_TYPE(wxEVT_NC_PAINT, 418)
DECLARE_EVENT_TYPE(wxEVT_PAINT_ICON, 419)
DECLARE_EVENT_TYPE(wxEVT_MENU_CHAR, 420)
DECLARE_EVENT_TYPE(wxEVT_MENU_INIT, 421)
DECLARE_EVENT_TYPE(wxEVT_MENU_HIGHLIGHT, 422)
DECLARE_EVENT_TYPE(wxEVT_POPUP_MENU_INIT, 423)
DECLARE_EVENT_TYPE(wxEVT_CONTEXT_MENU, 424)
DECLARE_EVENT_TYPE(wxEVT_SYS_COLOUR_CHANGED, 425)
DECLARE_EVENT_TYPE(wxEVT_SETTING_CHANGED, 426)
DECLARE_EVENT_TYPE(wxEVT_QUERY_NEW_PALETTE, 427)
DECLARE_EVENT_TYPE(wxEVT_PALETTE_CHANGED, 428)
DECLARE_EVENT_TYPE(wxEVT_JOY_BUTTON_DOWN, 429)
DECLARE_EVENT_TYPE(wxEVT_JOY_BUTTON_UP, 430)
DECLARE_EVENT_TYPE(wxEVT_JOY_MOVE, 431)
DECLARE_EVENT_TYPE(wxEVT_JOY_ZMOVE, 432)
DECLARE_EVENT_TYPE(wxEVT_DROP_FILES, 433)
DECLARE_EVENT_TYPE(wxEVT_DRAW_ITEM, 434)
DECLARE_EVENT_TYPE(wxEVT_MEASURE_ITEM, 435)
DECLARE_EVENT_TYPE(wxEVT_COMPARE_ITEM, 436)
DECLARE_EVENT_TYPE(wxEVT_INIT_DIALOG, 437)
DECLARE_EVENT_TYPE(wxEVT_IDLE, 438)
DECLARE_EVENT_TYPE(wxEVT_UPDATE_UI, 439)
// System misc.
DECLARE_EVENT_TYPE(wxEVT_END_PROCESS, 440)
// Dial up events
DECLARE_EVENT_TYPE(wxEVT_DIALUP_CONNECTED, 450)
DECLARE_EVENT_TYPE(wxEVT_DIALUP_DISCONNECTED, 451)
// Generic command events
// Note: a click is a higher-level event than button down/up
DECLARE_EVENT_TYPE(wxEVT_COMMAND_LEFT_CLICK, 500)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_LEFT_DCLICK, 501)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_RIGHT_CLICK, 502)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_RIGHT_DCLICK, 503)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_SET_FOCUS, 504)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_KILL_FOCUS, 505)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_ENTER, 506)
// Tree control event types
DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_BEGIN_DRAG, 600)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_BEGIN_RDRAG, 601)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT, 602)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_END_LABEL_EDIT, 603)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_DELETE_ITEM, 604)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_GET_INFO, 605)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_SET_INFO, 606)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_EXPANDED, 607)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_EXPANDING, 608)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_COLLAPSED, 609)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_COLLAPSING, 610)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_SEL_CHANGED, 611)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_SEL_CHANGING, 612)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_KEY_DOWN, 613)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_ACTIVATED, 614)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK, 615)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_MIDDLE_CLICK, 616)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_END_DRAG, 617)
// List control event types
DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_BEGIN_DRAG, 700)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_BEGIN_RDRAG, 701)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT, 702)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_END_LABEL_EDIT, 703)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_DELETE_ITEM, 704)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS, 705)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_GET_INFO, 706)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_SET_INFO, 707)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_SELECTED, 708)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_DESELECTED, 709)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_KEY_DOWN, 710)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_INSERT_ITEM, 711)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_COL_CLICK, 712)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK, 713)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK, 714)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_ACTIVATED, 715)
// Tab and notebook control event types
#if defined(__BORLANDC__) && defined(__WIN16__)
// For 16-bit BC++, these 2 would be identical otherwise (truncated)
#define wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED wxEVT_COMMAND_NB_PAGE_CHANGED
#define wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING wxEVT_COMMAND_NB_PAGE_CHANGING
#endif
typedef int wxEventType;
DECLARE_EVENT_TYPE(wxEVT_COMMAND_TAB_SEL_CHANGED, 800)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_TAB_SEL_CHANGING, 801)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, 802)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, 803)
// generate a new unique event type
extern wxEventType wxNewEventType();
// Splitter events
DECLARE_EVENT_TYPE(wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED, 850)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING, 851)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_SPLITTER_DOUBLECLICKED, 852)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_SPLITTER_UNSPLIT, 853)
// the standard event types
extern wxEventType wxEVT_NULL;
extern wxEventType wxEVT_FIRST;
// Wizard events
DECLARE_EVENT_TYPE(wxEVT_WIZARD_PAGE_CHANGED, 900)
DECLARE_EVENT_TYPE(wxEVT_WIZARD_PAGE_CHANGING, 901)
DECLARE_EVENT_TYPE(wxEVT_WIZARD_CANCEL, 902)
extern wxEventType wxEVT_COMMAND_BUTTON_CLICKED;
extern wxEventType wxEVT_COMMAND_CHECKBOX_CLICKED;
extern wxEventType wxEVT_COMMAND_CHOICE_SELECTED;
extern wxEventType wxEVT_COMMAND_LISTBOX_SELECTED;
extern wxEventType wxEVT_COMMAND_LISTBOX_DOUBLECLICKED;
extern wxEventType wxEVT_COMMAND_CHECKLISTBOX_TOGGLED;
extern wxEventType wxEVT_COMMAND_TEXT_UPDATED;
extern wxEventType wxEVT_COMMAND_TEXT_ENTER;
extern wxEventType wxEVT_COMMAND_MENU_SELECTED;
extern wxEventType wxEVT_COMMAND_TOOL_CLICKED;
extern wxEventType wxEVT_COMMAND_SLIDER_UPDATED;
extern wxEventType wxEVT_COMMAND_RADIOBOX_SELECTED;
extern wxEventType wxEVT_COMMAND_RADIOBUTTON_SELECTED;
extern wxEventType wxEVT_COMMAND_SCROLLBAR_UPDATED;
extern wxEventType wxEVT_COMMAND_VLBOX_SELECTED;
extern wxEventType wxEVT_COMMAND_COMBOBOX_SELECTED;
extern wxEventType wxEVT_COMMAND_TOOL_RCLICKED;
extern wxEventType wxEVT_COMMAND_TOOL_ENTER;
extern wxEventType wxEVT_COMMAND_SPINCTRL_UPDATED;
// Calendar events
DECLARE_EVENT_TYPE(wxEVT_CALENDAR_SEL_CHANGED, 950)
DECLARE_EVENT_TYPE(wxEVT_CALENDAR_DAY_CHANGED, 951)
DECLARE_EVENT_TYPE(wxEVT_CALENDAR_MONTH_CHANGED, 952)
DECLARE_EVENT_TYPE(wxEVT_CALENDAR_YEAR_CHANGED, 953)
DECLARE_EVENT_TYPE(wxEVT_CALENDAR_DOUBLECLICKED, 954)
DECLARE_EVENT_TYPE(wxEVT_CALENDAR_WEEKDAY_CLICKED, 955)
// Sockets and timers send events, too
extern wxEventType wxEVT_SOCKET;
extern wxEventType wxEVT_TIMER;
DECLARE_EVENT_TYPE(wxEVT_USER_FIRST, 2000)
// Mouse event types
extern wxEventType wxEVT_LEFT_DOWN;
extern wxEventType wxEVT_LEFT_UP;
extern wxEventType wxEVT_MIDDLE_DOWN;
extern wxEventType wxEVT_MIDDLE_UP;
extern wxEventType wxEVT_RIGHT_DOWN;
extern wxEventType wxEVT_RIGHT_UP;
extern wxEventType wxEVT_MOTION;
extern wxEventType wxEVT_ENTER_WINDOW;
extern wxEventType wxEVT_LEAVE_WINDOW;
extern wxEventType wxEVT_LEFT_DCLICK;
extern wxEventType wxEVT_MIDDLE_DCLICK;
extern wxEventType wxEVT_RIGHT_DCLICK;
extern wxEventType wxEVT_SET_FOCUS;
extern wxEventType wxEVT_KILL_FOCUS;
#if WXWIN_COMPATIBILITY_EVENT_TYPES
};
#endif // WXWIN_COMPATIBILITY_EVENT_TYPES
// Non-client mouse events
extern wxEventType wxEVT_NC_LEFT_DOWN;
extern wxEventType wxEVT_NC_LEFT_UP;
extern wxEventType wxEVT_NC_MIDDLE_DOWN;
extern wxEventType wxEVT_NC_MIDDLE_UP;
extern wxEventType wxEVT_NC_RIGHT_DOWN;
extern wxEventType wxEVT_NC_RIGHT_UP;
extern wxEventType wxEVT_NC_MOTION;
extern wxEventType wxEVT_NC_ENTER_WINDOW;
extern wxEventType wxEVT_NC_LEAVE_WINDOW;
extern wxEventType wxEVT_NC_LEFT_DCLICK;
extern wxEventType wxEVT_NC_MIDDLE_DCLICK;
extern wxEventType wxEVT_NC_RIGHT_DCLICK;
// Character input event type
extern wxEventType wxEVT_CHAR;
extern wxEventType wxEVT_CHAR_HOOK;
extern wxEventType wxEVT_NAVIGATION_KEY;
extern wxEventType wxEVT_KEY_DOWN;
extern wxEventType wxEVT_KEY_UP;
// Set cursor event
extern wxEventType wxEVT_SET_CURSOR;
// wxScrollbar and wxSlider event identifiers
extern wxEventType wxEVT_SCROLL_TOP;
extern wxEventType wxEVT_SCROLL_BOTTOM;
extern wxEventType wxEVT_SCROLL_LINEUP;
extern wxEventType wxEVT_SCROLL_LINEDOWN;
extern wxEventType wxEVT_SCROLL_PAGEUP;
extern wxEventType wxEVT_SCROLL_PAGEDOWN;
extern wxEventType wxEVT_SCROLL_THUMBTRACK;
extern wxEventType wxEVT_SCROLL_THUMBRELEASE;
// Scroll events from wxWindow
extern wxEventType wxEVT_SCROLLWIN_TOP;
extern wxEventType wxEVT_SCROLLWIN_BOTTOM;
extern wxEventType wxEVT_SCROLLWIN_LINEUP;
extern wxEventType wxEVT_SCROLLWIN_LINEDOWN;
extern wxEventType wxEVT_SCROLLWIN_PAGEUP;
extern wxEventType wxEVT_SCROLLWIN_PAGEDOWN;
extern wxEventType wxEVT_SCROLLWIN_THUMBTRACK;
extern wxEventType wxEVT_SCROLLWIN_THUMBRELEASE;
// System events
extern wxEventType wxEVT_SIZE;
extern wxEventType wxEVT_MOVE;
extern wxEventType wxEVT_CLOSE_WINDOW;
extern wxEventType wxEVT_END_SESSION;
extern wxEventType wxEVT_QUERY_END_SESSION;
extern wxEventType wxEVT_ACTIVATE_APP;
extern wxEventType wxEVT_POWER;
extern wxEventType wxEVT_ACTIVATE;
extern wxEventType wxEVT_CREATE;
extern wxEventType wxEVT_DESTROY;
extern wxEventType wxEVT_SHOW;
extern wxEventType wxEVT_ICONIZE;
extern wxEventType wxEVT_MAXIMIZE;
extern wxEventType wxEVT_MOUSE_CAPTURE_CHANGED;
extern wxEventType wxEVT_PAINT;
extern wxEventType wxEVT_ERASE_BACKGROUND;
extern wxEventType wxEVT_NC_PAINT;
extern wxEventType wxEVT_PAINT_ICON;
extern wxEventType wxEVT_MENU_CHAR;
extern wxEventType wxEVT_MENU_INIT;
extern wxEventType wxEVT_MENU_HIGHLIGHT;
extern wxEventType wxEVT_POPUP_MENU_INIT;
extern wxEventType wxEVT_CONTEXT_MENU;
extern wxEventType wxEVT_SYS_COLOUR_CHANGED;
extern wxEventType wxEVT_SETTING_CHANGED;
extern wxEventType wxEVT_QUERY_NEW_PALETTE;
extern wxEventType wxEVT_PALETTE_CHANGED;
extern wxEventType wxEVT_JOY_BUTTON_DOWN;
extern wxEventType wxEVT_JOY_BUTTON_UP;
extern wxEventType wxEVT_JOY_MOVE;
extern wxEventType wxEVT_JOY_ZMOVE;
extern wxEventType wxEVT_DROP_FILES;
extern wxEventType wxEVT_DRAW_ITEM;
extern wxEventType wxEVT_MEASURE_ITEM;
extern wxEventType wxEVT_COMPARE_ITEM;
extern wxEventType wxEVT_INIT_DIALOG;
extern wxEventType wxEVT_IDLE;
extern wxEventType wxEVT_UPDATE_UI;
// System misc.
extern wxEventType wxEVT_END_PROCESS;
// Dial up events
extern wxEventType wxEVT_DIALUP_CONNECTED;
extern wxEventType wxEVT_DIALUP_DISCONNECTED;
// Generic command events
// Note: a click is a higher-level event than button down/up
extern wxEventType wxEVT_COMMAND_LEFT_CLICK;
extern wxEventType wxEVT_COMMAND_LEFT_DCLICK;
extern wxEventType wxEVT_COMMAND_RIGHT_CLICK;
extern wxEventType wxEVT_COMMAND_RIGHT_DCLICK;
extern wxEventType wxEVT_COMMAND_SET_FOCUS;
extern wxEventType wxEVT_COMMAND_KILL_FOCUS;
extern wxEventType wxEVT_COMMAND_ENTER;
// Tree control event types
extern wxEventType wxEVT_COMMAND_TREE_BEGIN_DRAG;
extern wxEventType wxEVT_COMMAND_TREE_BEGIN_RDRAG;
extern wxEventType wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT;
extern wxEventType wxEVT_COMMAND_TREE_END_LABEL_EDIT;
extern wxEventType wxEVT_COMMAND_TREE_DELETE_ITEM;
extern wxEventType wxEVT_COMMAND_TREE_GET_INFO;
extern wxEventType wxEVT_COMMAND_TREE_SET_INFO;
extern wxEventType wxEVT_COMMAND_TREE_ITEM_EXPANDED;
extern wxEventType wxEVT_COMMAND_TREE_ITEM_EXPANDING;
extern wxEventType wxEVT_COMMAND_TREE_ITEM_COLLAPSED;
extern wxEventType wxEVT_COMMAND_TREE_ITEM_COLLAPSING;
extern wxEventType wxEVT_COMMAND_TREE_SEL_CHANGED;
extern wxEventType wxEVT_COMMAND_TREE_SEL_CHANGING;
extern wxEventType wxEVT_COMMAND_TREE_KEY_DOWN;
extern wxEventType wxEVT_COMMAND_TREE_ITEM_ACTIVATED;
extern wxEventType wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK;
extern wxEventType wxEVT_COMMAND_TREE_ITEM_MIDDLE_CLICK;
extern wxEventType wxEVT_COMMAND_TREE_END_DRAG;
// List control event types
extern wxEventType wxEVT_COMMAND_LIST_BEGIN_DRAG;
extern wxEventType wxEVT_COMMAND_LIST_BEGIN_RDRAG;
extern wxEventType wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT;
extern wxEventType wxEVT_COMMAND_LIST_END_LABEL_EDIT;
extern wxEventType wxEVT_COMMAND_LIST_DELETE_ITEM;
extern wxEventType wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS;
extern wxEventType wxEVT_COMMAND_LIST_GET_INFO;
extern wxEventType wxEVT_COMMAND_LIST_SET_INFO;
extern wxEventType wxEVT_COMMAND_LIST_ITEM_SELECTED;
extern wxEventType wxEVT_COMMAND_LIST_ITEM_DESELECTED;
extern wxEventType wxEVT_COMMAND_LIST_KEY_DOWN;
extern wxEventType wxEVT_COMMAND_LIST_INSERT_ITEM;
extern wxEventType wxEVT_COMMAND_LIST_COL_CLICK;
extern wxEventType wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK;
extern wxEventType wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK;
extern wxEventType wxEVT_COMMAND_LIST_ITEM_ACTIVATED;
// Tab and notebook control event types
extern wxEventType wxEVT_COMMAND_TAB_SEL_CHANGED;
extern wxEventType wxEVT_COMMAND_TAB_SEL_CHANGING;
extern wxEventType wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED;
extern wxEventType wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING;
// Splitter events
extern wxEventType wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED;
extern wxEventType wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING;
extern wxEventType wxEVT_COMMAND_SPLITTER_DOUBLECLICKED;
extern wxEventType wxEVT_COMMAND_SPLITTER_UNSPLIT;
// Wizard events
extern wxEventType wxEVT_WIZARD_PAGE_CHANGED;
extern wxEventType wxEVT_WIZARD_PAGE_CHANGING;
extern wxEventType wxEVT_WIZARD_CANCEL;
// Calendar events
extern wxEventType wxEVT_CALENDAR_SEL_CHANGED;
extern wxEventType wxEVT_CALENDAR_DAY_CHANGED;
extern wxEventType wxEVT_CALENDAR_MONTH_CHANGED;
extern wxEventType wxEVT_CALENDAR_YEAR_CHANGED;
extern wxEventType wxEVT_CALENDAR_DOUBLECLICKED;
extern wxEventType wxEVT_CALENDAR_WEEKDAY_CLICKED;
// Help events
extern wxEventType wxEVT_HELP;
extern wxEventType wxEVT_DETAILED_HELP;
#if WXWIN_COMPATIBILITY_2
//
// User events: this is now obsolete, just use wxNewEventType() to get a new
// event
extern wxEventType wxEVT_USER_FIRST;
#endif // WXWIN_COMPATIBILITY_2
// these 2 events are the same
#define wxEVT_COMMAND_TOOL_CLICKED wxEVT_COMMAND_MENU_SELECTED
// Compatibility
@ -1462,8 +1505,10 @@ typedef void (wxObject::*wxObjectEventFunction)(wxEvent&);
struct WXDLLEXPORT wxEventTableEntry
{
#if !WXWIN_COMPATIBILITY_EVENT_TYPES
wxEventTableEntry(int evType, int id, int idLast,
wxObjectEventFunction fn, wxObject *data);
#endif // !WXWIN_COMPATIBILITY_EVENT_TYPES
int m_eventType; // the event type
int m_id; // control/menu/toolbar id
@ -1476,11 +1521,13 @@ struct WXDLLEXPORT wxEventTableEntry
struct WXDLLEXPORT wxDynamicEventTableEntry : public wxEventTableEntry
{
#if !WXWIN_COMPATIBILITY_EVENT_TYPES
wxDynamicEventTableEntry(int evType, int id, int idLast,
wxObjectEventFunction fn, wxObject *data)
: wxEventTableEntry(evType, id, idLast, fn, data)
{
}
#endif // !WXWIN_COMPATIBILITY_EVENT_TYPES
};
struct WXDLLEXPORT wxEventTable

View File

@ -50,12 +50,10 @@
// event constants
// ----------------------------------------------------------------------------
wxEventType wxEVT_NULL = 0;
wxEventType wxEVT_FIRST = 10000;
#if WXWIN_COMPATIBILITY_2
wxEventType wxEVT_USER_FIRST = wxEVT_FIRST + 2000;
#endif // WXWIN_COMPATIBILITY_2
#if !WXWIN_COMPATIBILITY_EVENT_TYPES
wxEventType wxEVT_NULL = 0;
wxEventType wxEVT_FIRST = 10000;
#endif // !WXWIN_COMPATIBILITY_EVENT_TYPES
// ----------------------------------------------------------------------------
// wxWin macros
@ -103,7 +101,7 @@ const wxEventTable wxEvtHandler::sm_eventTable =
{ (const wxEventTable *)NULL, &wxEvtHandler::sm_eventTableEntries[0] };
const wxEventTableEntry wxEvtHandler::sm_eventTableEntries[] =
{ wxEventTableEntry(0, 0, 0, (wxObjectEventFunction)NULL, NULL) };
{ DECLARE_EVENT_TABLE_ENTRY(0, 0, 0, (wxObjectEventFunction)NULL, NULL) };
// ----------------------------------------------------------------------------
// global variables
@ -117,6 +115,8 @@ wxList *wxPendingEvents = (wxList *)NULL;
wxCriticalSection *wxPendingEventsLocker = (wxCriticalSection *)NULL;
#endif
#if !WXWIN_COMPATIBILITY_EVENT_TYPES
wxEventType wxEVT_COMMAND_BUTTON_CLICKED;
wxEventType wxEVT_COMMAND_CHECKBOX_CLICKED;
wxEventType wxEVT_COMMAND_CHOICE_SELECTED;
@ -126,7 +126,6 @@ wxEventType wxEVT_COMMAND_CHECKLISTBOX_TOGGLED;
wxEventType wxEVT_COMMAND_TEXT_UPDATED;
wxEventType wxEVT_COMMAND_TEXT_ENTER;
wxEventType wxEVT_COMMAND_MENU_SELECTED;
wxEventType wxEVT_COMMAND_TOOL_CLICKED;
wxEventType wxEVT_COMMAND_SLIDER_UPDATED;
wxEventType wxEVT_COMMAND_RADIOBOX_SELECTED;
wxEventType wxEVT_COMMAND_RADIOBUTTON_SELECTED;
@ -325,10 +324,6 @@ wxEventType wxEVT_CALENDAR_WEEKDAY_CLICKED;
wxEventType wxEVT_HELP;
wxEventType wxEVT_DETAILED_HELP;
// ============================================================================
// implementation
// ============================================================================
// ----------------------------------------------------------------------------
// event initialization
// ----------------------------------------------------------------------------
@ -338,6 +333,14 @@ int wxNewEventType()
// MT-FIXME
static int s_lastUsedEventType = wxEVT_FIRST;
#if WXWIN_COMPATIBILITY_2
// check that we don't overlap with the user-defined types: if it does
// happen, the best solution is probably to update the existing code to
// use wxNewEventType() instead of wxEVT_USER_FIRST
wxASSERT_MSG( s_lastUsedEventType < wxEVT_USER_FIRST - 1,
_T("possible event type conflict") );
#endif // WXWIN_COMPATIBILITY_2
return s_lastUsedEventType++;
}
@ -585,6 +588,8 @@ wxEventTableEntry::wxEventTableEntry(int evType, int id, int idLast,
m_callbackUserData = data;
}
#endif // WXWIN_COMPATIBILITY_EVENT_TYPES
// ----------------------------------------------------------------------------
// wxEvent
// ----------------------------------------------------------------------------
@ -1317,8 +1322,17 @@ void wxEvtHandler::Connect( int id, int lastId,
wxObjectEventFunction func,
wxObject *userData )
{
#if WXWIN_COMPATIBILITY_EVENT_TYPES
wxDynamicEventTableEntry *entry = new wxDynamicEventTableEntry;
entry->m_eventType = eventType;
entry->m_id = id;
entry->m_lastId = lastId;
entry->m_fn = func;
entry->m_callbackUserData = userData;
#else // !WXWIN_COMPATIBILITY_EVENT_TYPES
wxDynamicEventTableEntry *entry =
new wxDynamicEventTableEntry(eventType, id, lastId, func, userData);
#endif // WXWIN_COMPATIBILITY_EVENT_TYPES/!WXWIN_COMPATIBILITY_EVENT_TYPES
if (!m_dynamicEvents)
m_dynamicEvents = new wxList;