]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/event.h
add public wxLog::Log() to avoid ugly casts needed in order to call DoLog() from...
[wxWidgets.git] / include / wx / event.h
index 073fef666a40294d9ebea3c4e662f53fd3deccda..b18f39bed8d536ff33af05d2e3ff6220fb65220f 100644 (file)
@@ -237,12 +237,7 @@ public:
         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
     {
@@ -397,7 +392,7 @@ class wxEventFunctorMethod
               <
                 Class,
                 EventArg,
-                wxConvertibleTo<Class, wxEvtHandler>::value
+                wxConvertibleTo<Class, wxEvtHandler>::value != 0
               >
 {
 private:
@@ -772,7 +767,7 @@ enum wxEventPropagation
 };
 
 // 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
@@ -802,10 +797,10 @@ enum wxEventCategory
 
     // 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,
@@ -817,7 +812,7 @@ enum wxEventCategory
     // 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
@@ -864,7 +859,7 @@ public:
     // 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
@@ -1110,6 +1105,14 @@ public:
         : 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);
@@ -1120,7 +1123,7 @@ public:
         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; }
@@ -1524,7 +1527,6 @@ public:
 
             m_keyCode = evt.m_keyCode;
 
-            m_scanCode = evt.m_scanCode;
             m_rawCode = evt.m_rawCode;
             m_rawFlags = evt.m_rawFlags;
 #if wxUSE_UNICODE
@@ -1539,9 +1541,6 @@ public:
 
     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
@@ -2429,7 +2428,7 @@ public:
 
     virtual wxEvent *Clone() const { return new wxNavigationKeyEvent(*this); }
 
-    enum
+    enum wxNavigationKeyEventFlags
     {
         IsBackward = 0x0000,
         IsForward = 0x0001,
@@ -3405,6 +3404,13 @@ private:
     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.
 //
@@ -3985,24 +3991,6 @@ typedef void (wxEvtHandler::*wxClipboardTextEventFunction)(wxClipboardTextEvent&
 // 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
 // ----------------------------------------------------------------------------