// used in wxEventLoopBase::YieldFor to specify all event categories should be processed:
wxEVT_CATEGORY_ALL =
wxEVT_CATEGORY_UI|wxEVT_CATEGORY_USER_INPUT|wxEVT_CATEGORY_SOCKET| \
- wxEVT_CATEGORY_TIMER|wxEVT_CATEGORY_THREAD
+ wxEVT_CATEGORY_TIMER|wxEVT_CATEGORY_THREAD|wxEVT_CATEGORY_UNKNOWN| \
+ wxEVT_CATEGORY_CLIPBOARD
};
/*
// Event queuing and processing
// ----------------------------
-
// Process an event right now: this can only be called from the main
// thread, use QueueEvent() for scheduling the events for
// processing from other threads.
void ProcessPendingEvents();
// NOTE: uses ProcessEvent()
+ void DeletePendingEvents();
+
#if wxUSE_THREADS
bool ProcessThreadEvent(const wxEvent& event);
- // NOTE: uses AddPendingEvent()
+ // NOTE: uses AddPendingEvent(); call only from secondary threads
#endif
//
// It is meant to be called from ProcessEvent() only and is not virtual,
// additional event handlers can be hooked into the normal event processing
- // logic using TryValidator() hook.
+ // logic using TryBefore() and TryAfter() hooks.
bool ProcessEventHere(wxEvent& event);
// hooks for wxWindow used by ProcessEvent()
// -----------------------------------------
- // This one is called before trying our own event table to allow plugging
- // in the validators.
- //
- // 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 compatibility and wxBase library can't be used by GUI
- // ports.
- virtual bool TryValidator(wxEvent& WXUNUSED(event)) { return false; }
+ // this one is called before trying our own event table to allow plugging
+ // in the event handlers overriding the default logic, this is used by e.g.
+ // validators.
+ virtual bool TryBefore(wxEvent& event);
// 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);
+ virtual bool TryAfter(wxEvent& event);
+
+#ifdef WXWIN_COMPATIBILITY_2_8
+ // deprecated method: override TryBefore() instead of this one
+ wxDEPRECATED_BUT_USED_INTERNALLY_INLINE(
+ virtual bool TryValidator(wxEvent& WXUNUSED(event)), return false; )
+
+ wxDEPRECATED_BUT_USED_INTERNALLY_INLINE(
+ virtual bool TryParent(wxEvent& event), return DoTryApp(event); )
+#endif // WXWIN_COMPATIBILITY_2_8
static const wxEventTable sm_eventTable;
wxEventConnectionRef *FindRefInTrackerList(wxEvtHandler *eventSink);
private:
+ // pass the event to wxTheApp instance, called from TryAfter()
+ bool DoTryApp(wxEvent& event);
+
DECLARE_DYNAMIC_CLASS_NO_COPY(wxEvtHandler)
};
// Helper functions
// ----------------------------------------------------------------------------
+// This is an ugly hack to allow the use of Bind() instead of Connect() inside
+// the library code if the library was built with support for it, here is how
+// it is used:
+//
+// class SomeEventHandlingClass : wxBIND_OR_CONNECT_HACK_BASE_CLASS
+// public SomeBaseClass
+// {
+// public:
+// SomeEventHandlingClass(wxWindow *win)
+// {
+// // connect to the event for the given window
+// wxBIND_OR_CONNECT_HACK(win, wxEVT_SOMETHING, wxSomeEventHandler,
+// SomeEventHandlingClass::OnSomeEvent, this);
+// }
+//
+// private:
+// void OnSomeEvent(wxSomeEvent&) { ... }
+// };
+//
+// This is *not* meant to be used by library users, it is only defined here
+// (and not in a private header) because the base class must be visible from
+// other public headers, please do NOT use this in your code, it will be
+// removed from future wx versions without warning.
+#if wxEVENTS_COMPATIBILITY_2_8
+ #define wxBIND_OR_CONNECT_HACK_BASE_CLASS public wxEvtHandler,
+ #define wxBIND_OR_CONNECT_HACK_ONLY_BASE_CLASS : public wxEvtHandler
+ #define wxBIND_OR_CONNECT_HACK(w, evt, handler, func, obj) \
+ win->Connect(evt, handler(func), NULL, obj)
+#else // wxEVENTS_COMPATIBILITY_2_8
+ #define wxBIND_OR_CONNECT_HACK_BASE_CLASS
+ #define wxBIND_OR_CONNECT_HACK_ONLY_BASE_CLASS
+ #define wxBIND_OR_CONNECT_HACK(w, evt, handler, func, obj) \
+ win->Bind(evt, &func, obj)
+#endif // wxEVENTS_COMPATIBILITY_2_8/!wxEVENTS_COMPATIBILITY_2_8
+
#if wxUSE_GUI
// Find a window with the focus, that is also a descendant of the given window.