// forward declarations
// ----------------------------------------------------------------------------
-class WXDLLEXPORT wxList;
+class WXDLLIMPEXP_BASE wxList;
#if wxUSE_GUI
- class WXDLLEXPORT wxDC;
- class WXDLLEXPORT wxMenu;
- class WXDLLEXPORT wxWindow;
+ class WXDLLIMPEXP_CORE wxDC;
+ class WXDLLIMPEXP_CORE wxMenu;
+ class WXDLLIMPEXP_CORE wxWindow;
#endif // wxUSE_GUI
// ----------------------------------------------------------------------------
#define END_DECLARE_EVENT_TYPES() };
#define DECLARE_EVENT_TYPE(name, value) name = wxEVT_FIRST + value,
#define DECLARE_LOCAL_EVENT_TYPE(name, value) name = wxEVT_USER_FIRST + value,
+#define DECLARE_EXPORTED_EVENT_TYPE(expdecl, name, value) \
+ DECLARE_LOCAL_EVENT_TYPE(name, value)
#define DEFINE_EVENT_TYPE(name)
#define DEFINE_LOCAL_EVENT_TYPE(name)
#define BEGIN_DECLARE_EVENT_TYPES()
#define END_DECLARE_EVENT_TYPES()
+#define DECLARE_EXPORTED_EVENT_TYPE(expdecl, name, value) \
+ extern expdecl 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 DECLARE_EXPORTED_LOCAL_EVENT_TYPE(usergoo, name, value) extern const wxEventType usergoo name;
+ DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_CORE, name, value)
+#define DECLARE_LOCAL_EVENT_TYPE(name, value) \
+ DECLARE_EXPORTED_EVENT_TYPE(/* */, name, value)
#define DEFINE_EVENT_TYPE(name) const wxEventType name = wxNewEventType();
-#define DEFINE_LOCAL_EVENT_TYPE(name) const wxEventType name = wxNewEventType();
+#define DEFINE_LOCAL_EVENT_TYPE(name) DEFINE_EVENT_TYPE(name)
// generate a new unique event type
-extern WXDLLEXPORT wxEventType wxNewEventType();
+extern WXDLLIMPEXP_BASE wxEventType wxNewEventType();
#endif // WXWIN_COMPATIBILITY_EVENT_TYPES/!WXWIN_COMPATIBILITY_EVENT_TYPES
#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;
+ DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_BASE, wxEVT_NULL, 0)
+ DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_BASE, wxEVT_FIRST, 10000)
+ DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_BASE, 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_SPINCTRL_UPDATED, 18)
// Sockets and timers send events, too
- DECLARE_EVENT_TYPE(wxEVT_SOCKET, 50)
+ DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_BASE, wxEVT_SOCKET, 50)
DECLARE_EVENT_TYPE(wxEVT_TIMER , 80)
// Mouse event types
DECLARE_EVENT_TYPE(wxEVT_MEASURE_ITEM, 436)
DECLARE_EVENT_TYPE(wxEVT_COMPARE_ITEM, 437)
DECLARE_EVENT_TYPE(wxEVT_INIT_DIALOG, 438)
- DECLARE_EVENT_TYPE(wxEVT_IDLE, 439)
+ DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_BASE, wxEVT_IDLE, 439)
DECLARE_EVENT_TYPE(wxEVT_UPDATE_UI, 440)
DECLARE_EVENT_TYPE(wxEVT_SIZING, 441)
DECLARE_EVENT_TYPE(wxEVT_MOVING, 4442)
//
// still, any new code using it should include wx/textctrl.h explicitly
#if !WXWIN_COMPATIBILITY_EVENT_TYPES
- extern const wxEventType WXDLLEXPORT wxEVT_COMMAND_TEXT_UPDATED;
+ extern const wxEventType WXDLLIMPEXP_CORE wxEVT_COMMAND_TEXT_UPDATED;
#endif
#if WXWIN_COMPATIBILITY
*
*/
-class WXDLLEXPORT wxEvent : public wxObject
+class WXDLLIMPEXP_BASE wxEvent : public wxObject
{
private:
wxEvent& operator=(const wxEvent&);
wxEVT_COMMAND_TOGGLEBUTTON_CLICKED
*/
-class WXDLLEXPORT wxCommandEvent : public wxEvent
+class WXDLLIMPEXP_CORE wxCommandEvent : public wxEvent
{
private:
wxCommandEvent& operator=(const wxCommandEvent& event);
// this class adds a possibility to react (from the user) code to a control
// notification: allow or veto the operation being reported.
-class WXDLLEXPORT wxNotifyEvent : public wxCommandEvent
+class WXDLLIMPEXP_CORE wxNotifyEvent : public wxCommandEvent
{
public:
wxNotifyEvent(wxEventType commandType = wxEVT_NULL, int winid = 0)
wxEVT_SCROLL_ENDSCROLL
*/
-class WXDLLEXPORT wxScrollEvent : public wxCommandEvent
+class WXDLLIMPEXP_CORE wxScrollEvent : public wxCommandEvent
{
public:
wxScrollEvent(wxEventType commandType = wxEVT_NULL,
wxEVT_SCROLLWIN_THUMBRELEASE
*/
-class WXDLLEXPORT wxScrollWinEvent : public wxEvent
+class WXDLLIMPEXP_CORE wxScrollWinEvent : public wxEvent
{
public:
wxScrollWinEvent(wxEventType commandType = wxEVT_NULL,
wxMOUSE_BTN_RIGHT = 2
};
-class WXDLLEXPORT wxMouseEvent : public wxEvent
+class WXDLLIMPEXP_CORE wxMouseEvent : public wxEvent
{
public:
wxMouseEvent(wxEventType mouseType = wxEVT_NULL);
wxEVT_SET_CURSOR
*/
-class WXDLLEXPORT wxSetCursorEvent : public wxEvent
+class WXDLLIMPEXP_CORE wxSetCursorEvent : public wxEvent
{
public:
wxSetCursorEvent(wxCoord x = 0, wxCoord y = 0)
wxEVT_KEY_UP
*/
-class WXDLLEXPORT wxKeyEvent : public wxEvent
+class WXDLLIMPEXP_CORE wxKeyEvent : public wxEvent
{
public:
wxKeyEvent(wxEventType keyType = wxEVT_NULL);
wxEVT_SIZE
*/
-class WXDLLEXPORT wxSizeEvent : public wxEvent
+class WXDLLIMPEXP_CORE wxSizeEvent : public wxEvent
{
public:
wxSizeEvent() : wxEvent(0, wxEVT_SIZE)
wxEVT_MOVE
*/
-class WXDLLEXPORT wxMoveEvent : public wxEvent
+class WXDLLIMPEXP_CORE wxMoveEvent : public wxEvent
{
public:
wxMoveEvent()
#if defined(__WXDEBUG__) && (defined(__WXMSW__) || defined(__WXPM__))
// see comments in src/msw|os2/dcclient.cpp where g_isPainting is defined
- extern WXDLLEXPORT int g_isPainting;
+ extern WXDLLIMPEXP_CORE int g_isPainting;
#endif // debug
-class WXDLLEXPORT wxPaintEvent : public wxEvent
+class WXDLLIMPEXP_CORE wxPaintEvent : public wxEvent
{
public:
wxPaintEvent(int Id = 0)
DECLARE_DYNAMIC_CLASS(wxPaintEvent)
};
-class WXDLLEXPORT wxNcPaintEvent : public wxEvent
+class WXDLLIMPEXP_CORE wxNcPaintEvent : public wxEvent
{
public:
wxNcPaintEvent(int winid = 0)
wxEVT_ERASE_BACKGROUND
*/
-class WXDLLEXPORT wxEraseEvent : public wxEvent
+class WXDLLIMPEXP_CORE wxEraseEvent : public wxEvent
{
private:
wxEraseEvent& operator=(const wxEraseEvent& event);
wxEVT_KILL_FOCUS
*/
-class WXDLLEXPORT wxFocusEvent : public wxEvent
+class WXDLLIMPEXP_CORE wxFocusEvent : public wxEvent
{
private:
wxFocusEvent& operator=(const wxFocusEvent& event);
// wxChildFocusEvent notifies the parent that a child has got the focus: unlike
// wxFocusEvent it is propgated upwards the window chain
-class WXDLLEXPORT wxChildFocusEvent : public wxCommandEvent
+class WXDLLIMPEXP_CORE wxChildFocusEvent : public wxCommandEvent
{
public:
wxChildFocusEvent(wxWindow *win = NULL);
wxEVT_ACTIVATE_APP
*/
-class WXDLLEXPORT wxActivateEvent : public wxEvent
+class WXDLLIMPEXP_CORE wxActivateEvent : public wxEvent
{
public:
wxActivateEvent(wxEventType type = wxEVT_NULL, bool active = TRUE, int Id = 0)
wxEVT_INIT_DIALOG
*/
-class WXDLLEXPORT wxInitDialogEvent : public wxEvent
+class WXDLLIMPEXP_CORE wxInitDialogEvent : public wxEvent
{
public:
wxInitDialogEvent(int Id = 0)
wxEVT_MENU_HIGHLIGHT,
*/
-class WXDLLEXPORT wxMenuEvent : public wxEvent
+class WXDLLIMPEXP_CORE wxMenuEvent : public wxEvent
{
public:
wxMenuEvent(wxEventType type = wxEVT_NULL, int winid = 0)
wxEVT_QUERY_END_SESSION
*/
-class WXDLLEXPORT wxCloseEvent : public wxEvent
+class WXDLLIMPEXP_CORE wxCloseEvent : public wxEvent
{
public:
wxCloseEvent(wxEventType type = wxEVT_NULL, int winid = 0)
wxEVT_SHOW
*/
-class WXDLLEXPORT wxShowEvent : public wxEvent
+class WXDLLIMPEXP_CORE wxShowEvent : public wxEvent
{
public:
wxShowEvent(int winid = 0, bool show = FALSE)
wxEVT_ICONIZE
*/
-class WXDLLEXPORT wxIconizeEvent : public wxEvent
+class WXDLLIMPEXP_CORE wxIconizeEvent : public wxEvent
{
public:
wxIconizeEvent(int winid = 0, bool iconized = TRUE)
wxEVT_MAXIMIZE
*/
-class WXDLLEXPORT wxMaximizeEvent : public wxEvent
+class WXDLLIMPEXP_CORE wxMaximizeEvent : public wxEvent
{
public:
wxMaximizeEvent(int winid = 0)
wxJOY_BUTTON4 = 8
};
-class WXDLLEXPORT wxJoystickEvent : public wxEvent
+class WXDLLIMPEXP_CORE wxJoystickEvent : public wxEvent
{
public:
wxPoint m_pos;
wxEVT_DROP_FILES
*/
-class WXDLLEXPORT wxDropFilesEvent : public wxEvent
+class WXDLLIMPEXP_CORE wxDropFilesEvent : public wxEvent
{
private:
wxDropFilesEvent& operator=(const wxDropFilesEvent& event);
wxEVT_UPDATE_UI
*/
-class WXDLLEXPORT wxUpdateUIEvent : public wxCommandEvent
+class WXDLLIMPEXP_CORE wxUpdateUIEvent : public wxCommandEvent
{
public:
wxUpdateUIEvent(wxWindowID commandId = 0)
*/
// TODO: shouldn't all events record the window ID?
-class WXDLLEXPORT wxSysColourChangedEvent : public wxEvent
+class WXDLLIMPEXP_CORE wxSysColourChangedEvent : public wxEvent
{
public:
wxSysColourChangedEvent()
(even if it released the capture itself).
*/
-class WXDLLEXPORT wxMouseCaptureChangedEvent : public wxEvent
+class WXDLLIMPEXP_CORE wxMouseCaptureChangedEvent : public wxEvent
{
private:
wxMouseCaptureChangedEvent operator=(const wxMouseCaptureChangedEvent& event);
/*
wxEVT_DISPLAY_CHANGED
*/
-class WXDLLEXPORT wxDisplayChangedEvent : public wxEvent
+class WXDLLIMPEXP_CORE wxDisplayChangedEvent : public wxEvent
{
private:
DECLARE_DYNAMIC_CLASS(wxDisplayChangedEvent)
wxEVT_PALETTE_CHANGED
*/
-class WXDLLEXPORT wxPaletteChangedEvent : public wxEvent
+class WXDLLIMPEXP_CORE wxPaletteChangedEvent : public wxEvent
{
private:
wxPaletteChangedEvent& operator=(const wxPaletteChangedEvent& event);
Indicates the window is getting keyboard focus and should re-do its palette.
*/
-class WXDLLEXPORT wxQueryNewPaletteEvent : public wxEvent
+class WXDLLIMPEXP_CORE wxQueryNewPaletteEvent : public wxEvent
{
public:
wxQueryNewPaletteEvent(wxWindowID winid = 0)
wxEVT_NAVIGATION_KEY
*/
// NB: don't derive from command event to avoid being propagated to the parent
-class WXDLLEXPORT wxNavigationKeyEvent : public wxEvent
+class WXDLLIMPEXP_CORE wxNavigationKeyEvent : public wxEvent
{
private:
wxNavigationKeyEvent& operator=(const wxNavigationKeyEvent& event);
wxEVT_DESTROY
*/
-class WXDLLEXPORT wxWindowCreateEvent : public wxCommandEvent
+class WXDLLIMPEXP_CORE wxWindowCreateEvent : public wxCommandEvent
{
public:
wxWindowCreateEvent(wxWindow *win = NULL);
DECLARE_DYNAMIC_CLASS(wxWindowCreateEvent)
};
-class WXDLLEXPORT wxWindowDestroyEvent : public wxCommandEvent
+class WXDLLIMPEXP_CORE wxWindowDestroyEvent : public wxCommandEvent
{
public:
wxWindowDestroyEvent(wxWindow *win = NULL);
wxEVT_DETAILED_HELP
*/
-class WXDLLEXPORT wxHelpEvent : public wxCommandEvent
+class WXDLLIMPEXP_CORE wxHelpEvent : public wxCommandEvent
{
public:
wxHelpEvent(wxEventType type = wxEVT_NULL,
wxEVT_CONTEXT_MENU
*/
-class WXDLLEXPORT wxContextMenuEvent : public wxCommandEvent
+class WXDLLIMPEXP_CORE wxContextMenuEvent : public wxCommandEvent
{
public:
wxContextMenuEvent(wxEventType type = wxEVT_NULL,
wxEVT_IDLE
*/
-class WXDLLEXPORT wxIdleEvent : public wxEvent
+class WXDLLIMPEXP_CORE wxIdleEvent : public wxEvent
{
public:
wxIdleEvent()
// we have to keep both versions
#if WXWIN_COMPATIBILITY_EVENT_TYPES
-struct WXDLLEXPORT wxEventTableEntry
+struct WXDLLIMPEXP_BASE wxEventTableEntry
{
// For some reason, this can't be wxEventType, or VC++ complains.
int m_eventType; // main event type
// struct containing the members common to static and dynamic event tables
// entries
-struct WXDLLEXPORT wxEventTableEntryBase
+struct WXDLLIMPEXP_BASE wxEventTableEntryBase
{
private:
wxEventTableEntryBase& operator=(const wxEventTableEntryBase& event);
};
// an entry from a static event table
-struct WXDLLEXPORT wxEventTableEntry : public wxEventTableEntryBase
+struct WXDLLIMPEXP_BASE wxEventTableEntry : public wxEventTableEntryBase
{
wxEventTableEntry(const int& evType, int winid, int idLast,
wxObjectEventFunction fn, wxObject *data)
const int& m_eventType;
};
+class WXDLLIMPEXP_BASE wxEvtHandler;
+
// an entry used in dynamic event table managed by wxEvtHandler::Connect()
-struct WXDLLEXPORT wxDynamicEventTableEntry : public wxEventTableEntryBase
+struct WXDLLIMPEXP_BASE wxDynamicEventTableEntry : public wxEventTableEntryBase
{
wxDynamicEventTableEntry(int evType, int winid, int idLast,
- wxObjectEventFunction fn, wxObject *data)
+ wxObjectEventFunction fn, wxObject *data, wxEvtHandler* eventSink)
: wxEventTableEntryBase(winid, idLast, fn, data),
- m_eventType(evType)
+ m_eventType(evType),
+ m_eventSink(eventSink)
{ }
// not a reference here as we can't keep a reference to a temporary int
// created to wrap the constant value typically passed to Connect() - nor
// do we need it
int m_eventType;
+
+ // Pointer to object whose function is fn - so we don't assume the
+ // EventFunction is always a member of the EventHandler receiving the
+ // message
+ wxEvtHandler* m_eventSink;
};
#endif // !WXWIN_COMPATIBILITY_EVENT_TYPES
// ----------------------------------------------------------------------------
// wxEventTable: an array of event entries terminated with {0, 0, 0, 0, 0}
// ----------------------------------------------------------------------------
-struct WXDLLEXPORT wxEventTable
+
+struct WXDLLIMPEXP_BASE wxEventTable
{
const wxEventTable *baseTable; // base event table (next in chain)
const wxEventTableEntry *entries; // bottom of entry array
// wxEvtHandler: the base class for all objects handling wxWindows events
// ----------------------------------------------------------------------------
-class WXDLLEXPORT wxEvtHandler : public wxObject
+class WXDLLIMPEXP_BASE wxEvtHandler : public wxObject
{
public:
wxEvtHandler();
// winid and event type
void Connect( int winid, int lastId, int eventType,
wxObjectEventFunction func,
- wxObject *userData = (wxObject *) NULL );
+ wxObject *userData = (wxObject *) NULL,
+ wxEvtHandler *eventSink = (wxEvtHandler *) NULL );
// Convenience function: take just one id
void Connect( int winid, int eventType,
wxObjectEventFunction func,
- wxObject *userData = (wxObject *) NULL )
- { Connect(winid, wxID_ANY, eventType, func, userData); }
+ wxObject *userData = (wxObject *) NULL,
+ wxEvtHandler *eventSink = (wxEvtHandler *) NULL )
+ { Connect(winid, wxID_ANY, eventType, func, userData, eventSink); }
bool Disconnect( int winid, int lastId, wxEventType eventType,
wxObjectEventFunction func = NULL,
- wxObject *userData = (wxObject *) NULL );
+ wxObject *userData = (wxObject *) NULL,
+ wxEvtHandler *eventSink = (wxEvtHandler *) NULL );
// Convenience function: take just one id
bool Disconnect( int winid, wxEventType eventType = wxEVT_NULL,
wxObjectEventFunction func = NULL,
- wxObject *userData = (wxObject *) NULL )
- { return Disconnect(winid, wxID_ANY, eventType, func, userData); }
+ wxObject *userData = (wxObject *) NULL,
+ wxEvtHandler *eventSink = (wxEvtHandler *) NULL )
+ { return Disconnect(winid, wxID_ANY, eventType, func, userData, eventSink); }
// User data can be associated with each wxEvtHandler
static const wxEventTableEntry sm_eventTableEntries[];
protected:
+ // hooks for wxWindow used by ProcessEvent()
+ // -----------------------------------------
+
+ // this one is called before trying our own event table to allow plugging
+ // in the validators
+#if wxUSE_VALIDATORS
+ virtual bool TryValidator(wxEvent& WXUNUSED(event)) { return false; }
+#endif // wxUSE_VALIDATORS
+
+ // this one is called after failing to find the event handle in our own
+ // table to give a chance to the other windows to process it
+ //
+ // base class implementation passes the event to wxTheApp
+ virtual bool TryParent(wxEvent& event);
+
+
static const wxEventTable sm_eventTable;
virtual const wxEventTable *GetEventTable() const;
# endif
#endif
- // optimization: instead of using costly IsKindOf() to decide whether we're
- // a window (which is true in 99% of cases), use this flag
- bool m_isWindow;
-
// Is event handler enabled?
bool m_enabled;
static const wxEventTable sm_eventTable; \
virtual const wxEventTable* GetEventTable() const;
+// N.B.: when building DLL with Borland C++ 5.5 compiler, you must initialize
+// sm_eventTable before using it in GetEventTable() or the compiler gives
+// E2233 (see http://groups.google.com/groups?selm=397dcc8a%241_2%40dnews)
#define BEGIN_EVENT_TABLE(theClass, baseClass) \
- const wxEventTable *theClass::GetEventTable() const \
- { return &theClass::sm_eventTable; } \
const wxEventTable theClass::sm_eventTable = \
{ &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \
+ const wxEventTable *theClass::GetEventTable() const \
+ { return &theClass::sm_eventTable; } \
const wxEventTableEntry theClass::sm_eventTableEntries[] = { \
#define END_EVENT_TABLE() DECLARE_EVENT_TABLE_ENTRY( wxEVT_NULL, 0, 0, 0, 0 ) };
// for pending event processing - notice that there is intentionally no
// WXDLLEXPORT here
-extern wxList *wxPendingEvents;
+extern WXDLLIMPEXP_BASE wxList *wxPendingEvents;
#if wxUSE_THREADS
- extern wxCriticalSection *wxPendingEventsLocker;
+ extern WXDLLIMPEXP_BASE wxCriticalSection *wxPendingEventsLocker;
#endif
// ----------------------------------------------------------------------------