+#include "wx/thread.h"
+
+// ----------------------------------------------------------------------------
+// forward declarations
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxList;
+
+#if wxUSE_GUI
+ class WXDLLEXPORT wxClientData;
+ class WXDLLEXPORT wxDC;
+ class WXDLLEXPORT wxMenu;
+ class WXDLLEXPORT wxWindow;
+#endif // wxUSE_GUI
+
+// ----------------------------------------------------------------------------
+// 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 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) \
+ wxEventTableEntry(type, id, idLast, fn, obj)
+
+#define BEGIN_DECLARE_EVENT_TYPES()
+#define END_DECLARE_EVENT_TYPES()
+#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
+extern WXDLLEXPORT wxEventType wxNewEventType();
+
+#endif // WXWIN_COMPATIBILITY_EVENT_TYPES/!WXWIN_COMPATIBILITY_EVENT_TYPES
+
+BEGIN_DECLARE_EVENT_TYPES()
+
+#if WXWIN_COMPATIBILITY_EVENT_TYPES
+ wxEVT_NULL = 0,
+ wxEVT_FIRST = 10000,
+ wxEVT_USER_FIRST = wxEVT_FIRST + 2000,
+#else // !WXWIN_COMPATIBILITY_EVENT_TYPES
+ // it is important to still have these as constants to avoid
+ // initialization order related problems
+ 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_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)
+ // now they are in wx/textctrl.h
+#if WXWIN_COMPATIBILITY_EVENT_TYPES
+ DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_UPDATED, 7)
+ DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_ENTER, 8)
+ DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_URL, 13)
+ DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_MAXLEN, 14)
+#endif // WXWIN_COMPATIBILITY_EVENT_TYPES
+ 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)
+ DECLARE_EVENT_TYPE(wxEVT_CHILD_FOCUS, 114)
+ DECLARE_EVENT_TYPE(wxEVT_MOUSEWHEEL, 115)
+
+ // 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)
+
+ // 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)
+
+ // Help events
+ DECLARE_EVENT_TYPE(wxEVT_HELP, 1050)
+ DECLARE_EVENT_TYPE(wxEVT_DETAILED_HELP, 1051)
+
+END_DECLARE_EVENT_TYPES()
+
+// these 2 events are the same
+#define wxEVT_COMMAND_TOOL_CLICKED wxEVT_COMMAND_MENU_SELECTED
+
+// ----------------------------------------------------------------------------