]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/event.h
Document wxKill(wxSIGTERM) reliance on having an open window in wxMSW.
[wxWidgets.git] / include / wx / event.h
index 874d42e2746cf96859ed1b93d86c1bdd826f8e08..1bad23740bd971a75f78bbd2d00fee68b65739b5 100644 (file)
@@ -1470,6 +1470,39 @@ private:
     const ParamType2 m_param2;
 };
 
+// This is a version for calling any functors
+template <typename T>
+class wxAsyncMethodCallEventFunctor : public wxAsyncMethodCallEvent
+{
+public:
+    typedef T FunctorType;
+
+    wxAsyncMethodCallEventFunctor(wxObject *object, const FunctorType& fn)
+        : wxAsyncMethodCallEvent(object),
+          m_fn(fn)
+    {
+    }
+
+    wxAsyncMethodCallEventFunctor(const wxAsyncMethodCallEventFunctor& other)
+        : wxAsyncMethodCallEvent(other),
+          m_fn(other.m_fn)
+    {
+    }
+
+    virtual wxEvent *Clone() const
+    {
+        return new wxAsyncMethodCallEventFunctor(*this);
+    }
+
+    virtual void Execute()
+    {
+        m_fn();
+    }
+
+private:
+    FunctorType m_fn;
+};
+
 #endif // wxHAS_CALL_AFTER
 
 
@@ -3394,6 +3427,12 @@ public:
                 static_cast<T*>(this), method, x1, x2)
         );
     }
+
+    template <typename T>
+    void CallAfter(const T& fn)
+    {
+        QueueEvent(new wxAsyncMethodCallEventFunctor<T>(this, fn));
+    }
 #endif // wxHAS_CALL_AFTER