m_method = method;
}
- virtual void operator()(wxEvtHandler *handler, wxEvent& event)
- {
- wxEvtHandler * const realHandler = m_handler ? m_handler : handler;
-
- (realHandler->*m_method)(event);
- }
+ virtual void operator()(wxEvtHandler *handler, wxEvent& event);
virtual bool Matches(const wxEventFunctor& func) const
{
<
Class,
EventArg,
- wxConvertibleTo<Class, wxEvtHandler>::value
+ wxConvertibleTo<Class, wxEvtHandler>::value != 0
>
{
private:
};
// The different categories for a wxEvent; see wxEvent::GetEventCategory.
-// NOTE: they are used as OR-combinable flags by wxApp::Yield
+// NOTE: they are used as OR-combinable flags by wxEventLoopBase::YieldFor
enum wxEventCategory
{
// this is the category for those events which are generated to update
// implementation only
- // used in the implementations of DoYield()
+ // used in the implementations of wxEventLoopBase::YieldFor
wxEVT_CATEGORY_UNKNOWN = 32,
- // a special category used as an argument to wxApp::Yield() to indicate that
+ // a special category used as an argument to wxEventLoopBase::YieldFor to indicate that
// Yield() should leave all wxEvents on the queue while emptying the native event queue
// (native events will be processed but the wxEvents they generate will be queued)
wxEVT_CATEGORY_CLIPBOARD = 64,
// events of the native toolkit and which typically are not-"delayable".
wxEVT_CATEGORY_NATIVE_EVENTS = wxEVT_CATEGORY_UI|wxEVT_CATEGORY_USER_INPUT,
- // used in wxApp::Yield to specify all event categories should be processed:
+ // 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
// for them wouldn't work (it needs to do a copy of the event)
virtual wxEvent *Clone() const = 0;
- // this function is used to selectively process events in wxApp::YieldFor
+ // this function is used to selectively process events in wxEventLoopBase::YieldFor
// NOTE: by default it returns wxEVT_CATEGORY_UI just because the major
// part of wxWidgets events belong to that category.
virtual wxEventCategory GetEventCategory() const
: wxCommandEvent(eventType, id)
{ }
+ wxThreadEvent(const wxThreadEvent& event)
+ : wxCommandEvent(event)
+ {
+ // make sure our string member (which uses COW, aka refcounting) is not
+ // shared by other wxString instances:
+ SetString(GetString().c_str());
+ }
+
virtual wxEvent *Clone() const
{
wxThreadEvent* ev = new wxThreadEvent(*this);
return ev;
}
- // this is important to avoid that calling wxApp::Yield() thread events
+ // this is important to avoid that calling wxEventLoopBase::YieldFor thread events
// gets processed when this is unwanted:
virtual wxEventCategory GetEventCategory() const
{ return wxEVT_CATEGORY_THREAD; }
m_keyCode = evt.m_keyCode;
- m_scanCode = evt.m_scanCode;
m_rawCode = evt.m_rawCode;
m_rawFlags = evt.m_rawFlags;
#if wxUSE_UNICODE
long m_keyCode;
- // FIXME: what is this for? relation to m_rawXXX?
- bool m_scanCode;
-
#if wxUSE_UNICODE
// This contains the full Unicode character
// in a character events in Unicode mode
virtual wxEvent *Clone() const { return new wxNavigationKeyEvent(*this); }
- enum
+ enum wxNavigationKeyEventFlags
{
IsBackward = 0x0000,
IsForward = 0x0001,
wxDECLARE_NO_ASSIGN_CLASS(wxEventConnectionRef);
};
+inline void wxObjectEventFunctor::operator()(wxEvtHandler *handler, wxEvent& event)
+{
+ wxEvtHandler * const realHandler = m_handler ? m_handler : handler;
+
+ (realHandler->*m_method)(event);
+}
+
// Post a message to the given event handler which will be processed during the
// next event loop iteration.
//
// Thread events
#define EVT_THREAD(id, func) wx__DECLARE_EVT1(wxEVT_COMMAND_THREAD, id, wxThreadEventHandler(func))
-// ----------------------------------------------------------------------------
-// Global data
-// ----------------------------------------------------------------------------
-
-// list containing event handlers with pending events for them
-//
-// notice that each event handler should occur at most once in this list
-extern WXDLLIMPEXP_BASE wxList *wxHandlersWithPendingEvents;
-extern WXDLLIMPEXP_BASE wxList *wxHandlersWithPendingDelayedEvents;
-#if wxUSE_THREADS
- // this critical section protectes both the lists above
- extern WXDLLIMPEXP_BASE wxCriticalSection *wxHandlersWithPendingEventsLocker;
-#endif
-
-// old list names:
-#define wxPendingEvents wxHandlersWithPendingEvents
-#define wxPendingEventsLocker wxHandlersWithPendingEventsLocker
-
// ----------------------------------------------------------------------------
// Helper functions
// ----------------------------------------------------------------------------