X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7fa03f04345b620d1a14529b05961116b20a1297..020e385d47a4a76f1d7246a9751c35e1001db38b:/include/wx/event.h diff --git a/include/wx/event.h b/include/wx/event.h index cf5f041bc0..be29607ecb 100644 --- a/include/wx/event.h +++ b/include/wx/event.h @@ -12,17 +12,6 @@ #ifndef _WX_EVENT_H__ #define _WX_EVENT_H__ -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) && !defined(__EMX__) -// Some older compilers (such as EMX) cannot handle -// #pragma interface/implementation correctly, iff -// #pragma implementation is used in _two_ translation -// units (as created by e.g. event.cpp compiled for -// libwx_base and event.cpp compiled for libwx_gui_core). -// So we must not use those pragmas for those compilers in -// such files. - #pragma interface "event.h" -#endif - #include "wx/defs.h" #include "wx/object.h" #include "wx/clntdata.h" @@ -49,6 +38,8 @@ class WXDLLIMPEXP_BASE wxList; class WXDLLIMPEXP_CORE wxWindowBase; #endif // wxUSE_GUI +class WXDLLIMPEXP_BASE wxEvtHandler; + // ---------------------------------------------------------------------------- // Event types // ---------------------------------------------------------------------------- @@ -76,9 +67,12 @@ typedef int wxEventType; // 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. +// as 1 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. +#ifndef WXWIN_COMPATIBILITY_EVENT_TYPES + #define WXWIN_COMPATIBILITY_EVENT_TYPES 0 +#endif #if WXWIN_COMPATIBILITY_EVENT_TYPES @@ -217,7 +211,7 @@ BEGIN_DECLARE_EVENT_TYPES() DECLARE_EVENT_TYPE(wxEVT_SCROLL_PAGEDOWN, 305) DECLARE_EVENT_TYPE(wxEVT_SCROLL_THUMBTRACK, 306) DECLARE_EVENT_TYPE(wxEVT_SCROLL_THUMBRELEASE, 307) - DECLARE_EVENT_TYPE(wxEVT_SCROLL_ENDSCROLL, 308) + DECLARE_EVENT_TYPE(wxEVT_SCROLL_CHANGED, 308) // Scroll events from wxWindow DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_TOP, 320) @@ -271,6 +265,7 @@ BEGIN_DECLARE_EVENT_TYPES() DECLARE_EVENT_TYPE(wxEVT_UPDATE_UI, 440) DECLARE_EVENT_TYPE(wxEVT_SIZING, 441) DECLARE_EVENT_TYPE(wxEVT_MOVING, 442) + DECLARE_EVENT_TYPE(wxEVT_HIBERNATE, 443) // Generic command events // Note: a click is a higher-level event than button down/up @@ -509,11 +504,6 @@ private: }; #endif -#ifdef __VISUALC__ - // 'this' : used in base member initializer list (for m_commandString) - #pragma warning(disable:4355) -#endif - class WXDLLIMPEXP_CORE wxCommandEvent : public wxEvent { public: @@ -576,10 +566,6 @@ private: DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCommandEvent) }; -#ifdef __VISUALC__ - #pragma warning(default:4355) -#endif - #if WXWIN_COMPATIBILITY_2_4 inline void wxCommandEventStringHelper::operator=(const wxString &str) { @@ -639,7 +625,7 @@ private: wxEVT_SCROLL_PAGEDOWN wxEVT_SCROLL_THUMBTRACK wxEVT_SCROLL_THUMBRELEASE - wxEVT_SCROLL_ENDSCROLL + wxEVT_SCROLL_CHANGED */ class WXDLLIMPEXP_CORE wxScrollEvent : public wxCommandEvent @@ -949,11 +935,22 @@ public: wxKeyEvent(wxEventType keyType = wxEVT_NULL); wxKeyEvent(const wxKeyEvent& evt); + // can be used check if the key event has exactly the given modifiers: + // "GetModifiers() = wxMOD_CONTROL" is easier to write than "ControlDown() + // && !MetaDown() && !AltDown() && !ShiftDown()" + int GetModifiers() const + { + return (m_controlDown ? wxMOD_CONTROL : 0) | + (m_shiftDown ? wxMOD_SHIFT : 0) | + (m_metaDown ? wxMOD_META : 0) | + (m_altDown ? wxMOD_ALT : 0); + } + // Find state of shift/control keys bool ControlDown() const { return m_controlDown; } + bool ShiftDown() const { return m_shiftDown; } bool MetaDown() const { return m_metaDown; } bool AltDown() const { return m_altDown; } - bool ShiftDown() const { return m_shiftDown; } // "Cmd" is a pseudo key which is Control for PC and Unix platforms but // Apple ("Command") key under Macs: it makes often sense to use it instead @@ -1043,10 +1040,13 @@ public: long m_keyCode; + // TODO: replace those with a single m_modifiers bitmask of wxMOD_XXX? bool m_controlDown; bool m_shiftDown; bool m_altDown; bool m_metaDown; + + // FIXME: what is this for? relation to m_rawXXX? bool m_scanCode; #if wxUSE_UNICODE @@ -1088,7 +1088,7 @@ public: wxSize GetSize() const { return m_size; } wxRect GetRect() const { return m_rect; } - void SetRect(wxRect rect) { m_rect = rect; } + void SetRect(const wxRect& rect) { m_rect = rect; } virtual wxEvent *Clone() const { return new wxSizeEvent(*this); } @@ -1128,7 +1128,7 @@ public: wxPoint GetPosition() const { return m_pos; } void SetPosition(const wxPoint& pos) { m_pos = pos; } wxRect GetRect() const { return m_rect; } - void SetRect(wxRect rect) { m_rect = rect; } + void SetRect(const wxRect& rect) { m_rect = rect; } virtual wxEvent *Clone() const { return new wxMoveEvent(*this); } @@ -1286,6 +1286,7 @@ private: /* wxEVT_ACTIVATE wxEVT_ACTIVATE_APP + wxEVT_HIBERNATE */ class WXDLLIMPEXP_CORE wxActivateEvent : public wxEvent @@ -1385,7 +1386,15 @@ public: m_canVeto(event.m_canVeto) {} void SetLoggingOff(bool logOff) { m_loggingOff = logOff; } - bool GetLoggingOff() const { return m_loggingOff; } + bool GetLoggingOff() const + { + // m_loggingOff flag is only used by wxEVT_[QUERY_]END_SESSION, it + // doesn't make sense for wxEVT_CLOSE_WINDOW + wxASSERT_MSG( m_eventType != wxEVT_CLOSE_WINDOW, + _T("this flag is for end session events only") ); + + return m_loggingOff; + } void Veto(bool veto = true) { @@ -1396,19 +1405,18 @@ public: m_veto = veto; } void SetCanVeto(bool canVeto) { m_canVeto = canVeto; } - // No more asserts here please, the one you put here was wrong. bool CanVeto() const { return m_canVeto; } bool GetVeto() const { return m_canVeto && m_veto; } virtual wxEvent *Clone() const { return new wxCloseEvent(*this); } protected: - bool m_loggingOff; - bool m_veto, m_canVeto; + bool m_loggingOff, + m_veto, + m_canVeto; private: DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCloseEvent) - }; /* @@ -1659,7 +1667,9 @@ public: { m_checked = m_enabled = + m_shown = m_setEnabled = + m_setShown = m_setText = m_setChecked = false; } @@ -1667,7 +1677,9 @@ public: : wxCommandEvent(event), m_checked(event.m_checked), m_enabled(event.m_enabled), + m_shown(event.m_shown), m_setEnabled(event.m_setEnabled), + m_setShown(event.m_setShown), m_setText(event.m_setText), m_setChecked(event.m_setChecked), m_text(event.m_text) @@ -1675,13 +1687,16 @@ public: bool GetChecked() const { return m_checked; } bool GetEnabled() const { return m_enabled; } + bool GetShown() const { return m_shown; } wxString GetText() const { return m_text; } bool GetSetText() const { return m_setText; } bool GetSetChecked() const { return m_setChecked; } bool GetSetEnabled() const { return m_setEnabled; } + bool GetSetShown() const { return m_setShown; } void Check(bool check) { m_checked = check; m_setChecked = true; } void Enable(bool enable) { m_enabled = enable; m_setEnabled = true; } + void Show(bool show) { m_shown = show; m_setShown = true; } void SetText(const wxString& text) { m_text = text; m_setText = true; } // Sets the interval between updates in milliseconds. @@ -1711,7 +1726,9 @@ public: protected: bool m_checked; bool m_enabled; + bool m_shown; bool m_setEnabled; + bool m_setShown; bool m_setText; bool m_setChecked; wxString m_text; @@ -1857,7 +1874,7 @@ class WXDLLIMPEXP_CORE wxNavigationKeyEvent : public wxEvent public: wxNavigationKeyEvent() : wxEvent(0, wxEVT_NAVIGATION_KEY), - m_flags(IsForward), // defaults are for TAB + m_flags(IsForward | FromTab), // defaults are for TAB m_focus((wxWindow *)NULL) { m_propagationLevel = wxEVENT_PROPAGATE_NONE; @@ -1882,6 +1899,13 @@ public: void SetWindowChange(bool bIs) { if ( bIs ) m_flags |= WinChange; else m_flags &= ~WinChange; } + // Set to true under MSW if the event was generated using the tab key. + // This is required for proper navogation over radio buttons + bool IsFromTab() const + { return (m_flags & FromTab) != 0; } + void SetFromTab(bool bIs) + { if ( bIs ) m_flags |= FromTab; else m_flags &= ~FromTab; } + // the child which has the focus currently (may be NULL - use // wxWindow::FindFocus then) wxWindow* GetCurrentFocus() const { return m_focus; } @@ -1896,7 +1920,8 @@ public: { IsBackward = 0x0000, IsForward = 0x0001, - WinChange = 0x0002 + WinChange = 0x0002, + FromTab = 0x0004 }; long m_flags; @@ -2095,6 +2120,9 @@ private: // event handler and related classes // ============================================================================ +// for backwards compatibility and to prevent eVC 4 for ARM from crashing with +// internal compiler error when compiling wx, we define wxObjectEventFunction +// as a wxObject method even though it can only be a wxEvtHandler one typedef void (wxObject::*wxObjectEventFunction)(wxEvent&); // we can't have ctors nor base struct in backwards compatibility mode or @@ -2172,8 +2200,6 @@ private: wxEventTableEntry& operator=(const wxEventTableEntry&); }; -class WXDLLIMPEXP_BASE wxEvtHandler; - // an entry used in dynamic event table managed by wxEvtHandler::Connect() struct WXDLLIMPEXP_BASE wxDynamicEventTableEntry : public wxEventTableEntryBase { @@ -2214,7 +2240,6 @@ struct WXDLLIMPEXP_BASE wxEventTable // ---------------------------------------------------------------------------- WX_DEFINE_ARRAY_PTR(const wxEventTableEntry*, wxEventTableEntryPointerArray); -class WXDLLIMPEXP_BASE wxEvtHandler; class WXDLLIMPEXP_BASE wxEventHashTable { @@ -2333,19 +2358,18 @@ public: wxObject *userData = (wxObject *) NULL, wxEvtHandler *eventSink = (wxEvtHandler *) NULL); - bool Disconnect(int winid, + bool Disconnect(int winid = wxID_ANY, wxEventType eventType = wxEVT_NULL, wxObjectEventFunction func = NULL, wxObject *userData = (wxObject *) NULL, wxEvtHandler *eventSink = (wxEvtHandler *) NULL) { return Disconnect(winid, wxID_ANY, eventType, func, userData, eventSink); } - bool Disconnect(wxEventType eventType = wxEVT_NULL, - wxObjectEventFunction func = NULL, + bool Disconnect(wxEventType eventType, + wxObjectEventFunction func, wxObject *userData = (wxObject *) NULL, - wxEvtHandler *eventSink = (wxEvtHandler *) NULL ) - { return Disconnect(wxID_ANY, wxID_ANY, eventType, func, userData, eventSink); } - + wxEvtHandler *eventSink = (wxEvtHandler *) NULL) + { return Disconnect(wxID_ANY, eventType, func, userData, eventSink); } wxList* GetDynamicEventTable() const { return m_dynamicEvents ; } @@ -2389,7 +2413,7 @@ protected: // NB: This method is intentionally *not* inside wxUSE_VALIDATORS! // It is part of wxBase which doesn't use validators and the code // is compiled out when building wxBase w/o GUI classes, which affects - // binary compatiblity and wxBase library can't be used by GUI + // binary compatibility and wxBase library can't be used by GUI // ports. virtual bool TryValidator(wxEvent& WXUNUSED(event)) { return false; } @@ -2413,8 +2437,14 @@ protected: #if wxUSE_THREADS #if defined (__VISAGECPP__) + const wxCriticalSection& Lock() const { return m_eventsLocker; } + wxCriticalSection& Lock() { return m_eventsLocker; } + wxCriticalSection m_eventsLocker; # else + const wxCriticalSection& Lock() const { return *m_eventsLocker; } + wxCriticalSection& Lock() { return *m_eventsLocker; } + wxCriticalSection* m_eventsLocker; # endif #endif @@ -2509,76 +2539,76 @@ typedef void (wxEvtHandler::*wxMouseCaptureChangedEventFunction)(wxMouseCaptureC #define wxCommandEventHandler(func) \ - (wxObjectEventFunction)wxStaticCastEvent(wxCommandEventFunction, &func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxCommandEventFunction, &func) #define wxScrollEventHandler(func) \ - (wxObjectEventFunction)wxStaticCastEvent(wxScrollEventFunction, &func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxScrollEventFunction, &func) #define wxScrollWinEventHandler(func) \ - (wxObjectEventFunction)wxStaticCastEvent(wxScrollWinEventFunction, &func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxScrollWinEventFunction, &func) #define wxSizeEventHandler(func) \ - (wxObjectEventFunction)wxStaticCastEvent(wxSizeEventFunction, &func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxSizeEventFunction, &func) #define wxMoveEventHandler(func) \ - (wxObjectEventFunction)wxStaticCastEvent(wxMoveEventFunction, &func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxMoveEventFunction, &func) #define wxPaintEventHandler(func) \ - (wxObjectEventFunction)wxStaticCastEvent(wxPaintEventFunction, &func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxPaintEventFunction, &func) #define wxNcPaintEventHandler(func) \ - (wxObjectEventFunction)wxStaticCastEvent(wxNcPaintEventFunction, &func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxNcPaintEventFunction, &func) #define wxEraseEventHandler(func) \ - (wxObjectEventFunction)wxStaticCastEvent(wxEraseEventFunction, &func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxEraseEventFunction, &func) #define wxMouseEventHandler(func) \ - (wxObjectEventFunction)wxStaticCastEvent(wxMouseEventFunction, &func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxMouseEventFunction, &func) #define wxCharEventHandler(func) \ - (wxObjectEventFunction)wxStaticCastEvent(wxCharEventFunction, &func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxCharEventFunction, &func) #define wxKeyEventHandler(func) wxCharEventHandler(func) #define wxFocusEventHandler(func) \ - (wxObjectEventFunction)wxStaticCastEvent(wxFocusEventFunction, &func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxFocusEventFunction, &func) #define wxChildFocusEventHandler(func) \ - (wxObjectEventFunction)wxStaticCastEvent(wxChildFocusEventFunction, &func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxChildFocusEventFunction, &func) #define wxActivateEventHandler(func) \ - (wxObjectEventFunction)wxStaticCastEvent(wxActivateEventFunction, &func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxActivateEventFunction, &func) #define wxMenuEventHandler(func) \ - (wxObjectEventFunction)wxStaticCastEvent(wxMenuEventFunction, &func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxMenuEventFunction, &func) #define wxJoystickEventHandler(func) \ - (wxObjectEventFunction)wxStaticCastEvent(wxJoystickEventFunction, &func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxJoystickEventFunction, &func) #define wxDropFilesEventHandler(func) \ - (wxObjectEventFunction)wxStaticCastEvent(wxDropFilesEventFunction, &func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxDropFilesEventFunction, &func) #define wxInitDialogEventHandler(func) \ - (wxObjectEventFunction)wxStaticCastEvent(wxInitDialogEventFunction, &func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxInitDialogEventFunction, &func) #define wxSysColourChangedEventHandler(func) \ - (wxObjectEventFunction)wxStaticCastEvent(wxSysColourChangedEventFunction, &func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxSysColourChangedEventFunction, &func) #define wxDisplayChangedEventHandler(func) \ - (wxObjectEventFunction)wxStaticCastEvent(wxDisplayChangedEventFunction, &func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxDisplayChangedEventFunction, &func) #define wxUpdateUIEventHandler(func) \ - (wxObjectEventFunction)wxStaticCastEvent(wxUpdateUIEventFunction, &func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxUpdateUIEventFunction, &func) #define wxIdleEventHandler(func) \ - (wxObjectEventFunction)wxStaticCastEvent(wxIdleEventFunction, &func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxIdleEventFunction, &func) #define wxCloseEventHandler(func) \ - (wxObjectEventFunction)wxStaticCastEvent(wxCloseEventFunction, &func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxCloseEventFunction, &func) #define wxShowEventHandler(func) \ - (wxObjectEventFunction)wxStaticCastEvent(wxShowEventFunction, &func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxShowEventFunction, &func) #define wxIconizeEventHandler(func) \ - (wxObjectEventFunction)wxStaticCastEvent(wxIconizeEventFunction, &func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxIconizeEventFunction, &func) #define wxMaximizeEventHandler(func) \ - (wxObjectEventFunction)wxStaticCastEvent(wxMaximizeEventFunction, &func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxMaximizeEventFunction, &func) #define wxNavigationKeyEventHandler(func) \ - (wxObjectEventFunction)wxStaticCastEvent(wxNavigationKeyEventFunction, &func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxNavigationKeyEventFunction, &func) #define wxPaletteChangedEventHandler(func) \ - (wxObjectEventFunction)wxStaticCastEvent(wxPaletteChangedEventFunction, &func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxPaletteChangedEventFunction, &func) #define wxQueryNewPaletteEventHandler(func) \ - (wxObjectEventFunction)wxStaticCastEvent(wxQueryNewPaletteEventFunction, &func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxQueryNewPaletteEventFunction, &func) #define wxWindowCreateEventHandler(func) \ - (wxObjectEventFunction)wxStaticCastEvent(wxWindowCreateEventFunction, &func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxWindowCreateEventFunction, &func) #define wxWindowDestroyEventHandler(func) \ - (wxObjectEventFunction)wxStaticCastEvent(wxWindowDestroyEventFunction, &func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxWindowDestroyEventFunction, &func) #define wxSetCursorEventHandler(func) \ - (wxObjectEventFunction)wxStaticCastEvent(wxSetCursorEventFunction, &func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxSetCursorEventFunction, &func) #define wxNotifyEventHandler(func) \ - (wxObjectEventFunction)wxStaticCastEvent(wxNotifyEventFunction, &func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxNotifyEventFunction, &func) #define wxHelpEventHandler(func) \ - (wxObjectEventFunction)wxStaticCastEvent(wxHelpEventFunction, &func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxHelpEventFunction, &func) #define wxContextMenuEventHandler(func) \ - (wxObjectEventFunction)wxStaticCastEvent(wxContextMenuEventFunction, &func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxContextMenuEventFunction, &func) #define wxMouseCaptureChangedEventHandler(func) \ - (wxObjectEventFunction)wxStaticCastEvent(wxMouseCaptureChangedEventFunction, &func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxMouseCaptureChangedEventFunction, &func) #endif // wxUSE_GUI @@ -2608,6 +2638,111 @@ typedef void (wxEvtHandler::*wxMouseCaptureChangedEventFunction)(wxMouseCaptureC { return theClass::sm_eventHashTable; } \ const wxEventTableEntry theClass::sm_eventTableEntries[] = { \ +#define BEGIN_EVENT_TABLE_TEMPLATE1(theClass, baseClass, T1) \ + template \ + const wxEventTable theClass::sm_eventTable = \ + { &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \ + template \ + const wxEventTable *theClass::GetEventTable() const \ + { return &theClass::sm_eventTable; } \ + template \ + wxEventHashTable theClass::sm_eventHashTable(theClass::sm_eventTable); \ + template \ + wxEventHashTable &theClass::GetEventHashTable() const \ + { return theClass::sm_eventHashTable; } \ + template \ + const wxEventTableEntry theClass::sm_eventTableEntries[] = { \ + +#define BEGIN_EVENT_TABLE_TEMPLATE2(theClass, baseClass, T1, T2) \ + template \ + const wxEventTable theClass::sm_eventTable = \ + { &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \ + template \ + const wxEventTable *theClass::GetEventTable() const \ + { return &theClass::sm_eventTable; } \ + template \ + wxEventHashTable theClass::sm_eventHashTable(theClass::sm_eventTable); \ + template \ + wxEventHashTable &theClass::GetEventHashTable() const \ + { return theClass::sm_eventHashTable; } \ + template \ + const wxEventTableEntry theClass::sm_eventTableEntries[] = { \ + +#define BEGIN_EVENT_TABLE_TEMPLATE3(theClass, baseClass, T1, T2, T3) \ + template \ + const wxEventTable theClass::sm_eventTable = \ + { &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \ + template \ + const wxEventTable *theClass::GetEventTable() const \ + { return &theClass::sm_eventTable; } \ + template \ + wxEventHashTable theClass::sm_eventHashTable(theClass::sm_eventTable); \ + template \ + wxEventHashTable &theClass::GetEventHashTable() const \ + { return theClass::sm_eventHashTable; } \ + template \ + const wxEventTableEntry theClass::sm_eventTableEntries[] = { \ + +#define BEGIN_EVENT_TABLE_TEMPLATE4(theClass, baseClass, T1, T2, T3, T4) \ + template \ + const wxEventTable theClass::sm_eventTable = \ + { &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \ + template \ + const wxEventTable *theClass::GetEventTable() const \ + { return &theClass::sm_eventTable; } \ + template \ + wxEventHashTable theClass::sm_eventHashTable(theClass::sm_eventTable); \ + template \ + wxEventHashTable &theClass::GetEventHashTable() const \ + { return theClass::sm_eventHashTable; } \ + template \ + const wxEventTableEntry theClass::sm_eventTableEntries[] = { \ + +#define BEGIN_EVENT_TABLE_TEMPLATE5(theClass, baseClass, T1, T2, T3, T4, T5) \ + template \ + const wxEventTable theClass::sm_eventTable = \ + { &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \ + template \ + const wxEventTable *theClass::GetEventTable() const \ + { return &theClass::sm_eventTable; } \ + template \ + wxEventHashTable theClass::sm_eventHashTable(theClass::sm_eventTable); \ + template \ + wxEventHashTable &theClass::GetEventHashTable() const \ + { return theClass::sm_eventHashTable; } \ + template \ + const wxEventTableEntry theClass::sm_eventTableEntries[] = { \ + +#define BEGIN_EVENT_TABLE_TEMPLATE7(theClass, baseClass, T1, T2, T3, T4, T5, T6, T7) \ + template \ + const wxEventTable theClass::sm_eventTable = \ + { &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \ + template \ + const wxEventTable *theClass::GetEventTable() const \ + { return &theClass::sm_eventTable; } \ + template \ + wxEventHashTable theClass::sm_eventHashTable(theClass::sm_eventTable); \ + template \ + wxEventHashTable &theClass::GetEventHashTable() const \ + { return theClass::sm_eventHashTable; } \ + template \ + const wxEventTableEntry theClass::sm_eventTableEntries[] = { \ + +#define BEGIN_EVENT_TABLE_TEMPLATE8(theClass, baseClass, T1, T2, T3, T4, T5, T6, T7, T8) \ + template \ + const wxEventTable theClass::sm_eventTable = \ + { &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \ + template \ + const wxEventTable *theClass::GetEventTable() const \ + { return &theClass::sm_eventTable; } \ + template \ + wxEventHashTable theClass::sm_eventHashTable(theClass::sm_eventTable); \ + template \ + wxEventHashTable &theClass::GetEventHashTable() const \ + { return theClass::sm_eventHashTable; } \ + template \ + const wxEventTableEntry theClass::sm_eventTableEntries[] = { \ + #define END_EVENT_TABLE() DECLARE_EVENT_TABLE_ENTRY( wxEVT_NULL, 0, 0, 0, 0 ) }; /* @@ -2636,9 +2771,9 @@ typedef void (wxEvtHandler::*wxMouseCaptureChangedEventFunction)(wxMouseCaptureC wx__DECLARE_EVT2(event, id1, id2, wxEventHandler(func)) // EVT_COMMAND -#define EVT_COMMAND(winid, event, fn) \ +#define EVT_COMMAND(winid, event, func) \ wx__DECLARE_EVT1(event, winid, wxCommandEventHandler(func)) -#define EVT_COMMAND_RANGE(id1, id2, event, fn) \ +#define EVT_COMMAND_RANGE(id1, id2, event, func) \ wx__DECLARE_EVT2(event, id1, id2, wxCommandEventHandler(func)) #define EVT_NOTIFY(event, winid, func) \ @@ -2673,6 +2808,7 @@ typedef void (wxEvtHandler::*wxMouseCaptureChangedEventFunction)(wxMouseCaptureC #define EVT_CHILD_FOCUS(func) wx__DECLARE_EVT0(wxEVT_CHILD_FOCUS, wxChildFocusEventHandler(func)) #define EVT_ACTIVATE(func) wx__DECLARE_EVT0(wxEVT_ACTIVATE, wxActivateEventHandler(func)) #define EVT_ACTIVATE_APP(func) wx__DECLARE_EVT0(wxEVT_ACTIVATE_APP, wxActivateEventHandler(func)) +#define EVT_HIBERNATE(func) wx__DECLARE_EVT0(wxEVT_HIBERNATE, wxActivateEventHandler(func)) #define EVT_END_SESSION(func) wx__DECLARE_EVT0(wxEVT_END_SESSION, wxCloseEventHandler(func)) #define EVT_QUERY_END_SESSION(func) wx__DECLARE_EVT0(wxEVT_QUERY_END_SESSION, wxCloseEventHandler(func)) #define EVT_DROP_FILES(func) wx__DECLARE_EVT0(wxEVT_DROP_FILES, wxDropFilesEventHandler(func)) @@ -2750,7 +2886,7 @@ typedef void (wxEvtHandler::*wxMouseCaptureChangedEventFunction)(wxMouseCaptureC #define EVT_SCROLL_PAGEDOWN(func) wx__DECLARE_EVT0(wxEVT_SCROLL_PAGEDOWN, wxScrollEventHandler(func)) #define EVT_SCROLL_THUMBTRACK(func) wx__DECLARE_EVT0(wxEVT_SCROLL_THUMBTRACK, wxScrollEventHandler(func)) #define EVT_SCROLL_THUMBRELEASE(func) wx__DECLARE_EVT0(wxEVT_SCROLL_THUMBRELEASE, wxScrollEventHandler(func)) -#define EVT_SCROLL_ENDSCROLL(func) wx__DECLARE_EVT0(wxEVT_SCROLL_ENDSCROLL, wxScrollEventHandler(func)) +#define EVT_SCROLL_CHANGED(func) wx__DECLARE_EVT0(wxEVT_SCROLL_CHANGED, wxScrollEventHandler(func)) #define EVT_SCROLL(func) \ EVT_SCROLL_TOP(func) \ @@ -2760,7 +2896,8 @@ typedef void (wxEvtHandler::*wxMouseCaptureChangedEventFunction)(wxMouseCaptureC EVT_SCROLL_PAGEUP(func) \ EVT_SCROLL_PAGEDOWN(func) \ EVT_SCROLL_THUMBTRACK(func) \ - EVT_SCROLL_THUMBRELEASE(func) + EVT_SCROLL_THUMBRELEASE(func) \ + EVT_SCROLL_CHANGED(func) // Scrolling from wxSlider and wxScrollBar, with an id #define EVT_COMMAND_SCROLL_TOP(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_TOP, winid, wxScrollEventHandler(func)) @@ -2771,7 +2908,7 @@ typedef void (wxEvtHandler::*wxMouseCaptureChangedEventFunction)(wxMouseCaptureC #define EVT_COMMAND_SCROLL_PAGEDOWN(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_PAGEDOWN, winid, wxScrollEventHandler(func)) #define EVT_COMMAND_SCROLL_THUMBTRACK(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_THUMBTRACK, winid, wxScrollEventHandler(func)) #define EVT_COMMAND_SCROLL_THUMBRELEASE(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_THUMBRELEASE, winid, wxScrollEventHandler(func)) -#define EVT_COMMAND_SCROLL_ENDSCROLL(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_ENDSCROLL, winid, wxScrollEventHandler(func)) +#define EVT_COMMAND_SCROLL_CHANGED(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_CHANGED, winid, wxScrollEventHandler(func)) #define EVT_COMMAND_SCROLL(winid, func) \ EVT_COMMAND_SCROLL_TOP(winid, func) \ @@ -2781,7 +2918,13 @@ typedef void (wxEvtHandler::*wxMouseCaptureChangedEventFunction)(wxMouseCaptureC EVT_COMMAND_SCROLL_PAGEUP(winid, func) \ EVT_COMMAND_SCROLL_PAGEDOWN(winid, func) \ EVT_COMMAND_SCROLL_THUMBTRACK(winid, func) \ - EVT_COMMAND_SCROLL_THUMBRELEASE(winid, func) + EVT_COMMAND_SCROLL_THUMBRELEASE(winid, func) \ + EVT_COMMAND_SCROLL_CHANGED(winid, func) + +// compatibility macros for the old name, to be deprecated in 2.8 +#define wxEVT_SCROLL_ENDSCROLL wxEVT_SCROLL_CHANGED +#define EVT_COMMAND_SCROLL_ENDSCROLL EVT_COMMAND_SCROLL_CHANGED +#define EVT_SCROLL_ENDSCROLL EVT_SCROLL_CHANGED // Convenience macros for commonly-used commands #define EVT_CHECKBOX(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_CHECKBOX_CLICKED, winid, wxCommandEventHandler(func)) @@ -2853,6 +2996,7 @@ typedef void (wxEvtHandler::*wxMouseCaptureChangedEventFunction)(wxMouseCaptureC // Context Menu Events #define EVT_CONTEXT_MENU(func) wx__DECLARE_EVT0(wxEVT_CONTEXT_MENU, wxContextMenuEventHandler(func)) +#define EVT_COMMAND_CONTEXT_MENU(winid, func) wx__DECLARE_EVT1(wxEVT_CONTEXT_MENU, winid, wxContextMenuEventHandler(func)) // ---------------------------------------------------------------------------- // Global data @@ -2873,7 +3017,7 @@ extern WXDLLIMPEXP_BASE wxList *wxPendingEvents; // Find a window with the focus, that is also a descendant of the given window. // This is used to determine the window to initially send commands to. -wxWindow* wxFindFocusDescendant(wxWindow* ancestor); +WXDLLIMPEXP_CORE wxWindow* wxFindFocusDescendant(wxWindow* ancestor); #endif // wxUSE_GUI