]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/event.h
MSW compilation fixes
[wxWidgets.git] / include / wx / event.h
index c74f328aae0ecb96f655dc7beccaa506c9c9df05..6bd1e2f7ff3f9c5f3eb5fe4a751268ac8e818efb 100644 (file)
@@ -19,6 +19,9 @@
 #include "wx/defs.h"
 #include "wx/object.h"
 #include "wx/gdicmn.h"
+#if wxUSE_THREADS
+#include "wx/thread.h"
+#endif
 
 /*
  * Event types
@@ -287,6 +290,8 @@ public:
     // exists only for optimization purposes
     bool IsCommandEvent() const { return m_isCommandEvent; }
 
+    void CopyObject(wxObject& object_dest) const;
+
 public:
     bool              m_skipped;
     wxObject*         m_eventObject;
@@ -346,8 +351,8 @@ public:
     int GetSelection() const { return m_commandInt; }
 
     // Set/Get listbox/choice selection string
-    void SetString(char* s) { m_commandString = s; }
-    char *GetString() const { return m_commandString; }
+    void SetString(const wxString& s) { m_commandString = s; }
+    wxString GetString() const { return m_commandString; }
 
     // Get checkbox value
     bool Checked() const { return (m_commandInt != 0); }
@@ -361,8 +366,10 @@ public:
     void SetInt(int i) { m_commandInt = i; }
     long GetInt() const { return m_commandInt ; }
 
+    void CopyObject(wxObject& obj) const;
+
 public:
-    char*             m_commandString; // String event argument
+    wxString          m_commandString; // String event argument
     int               m_commandInt;
     long              m_extraLong;     // Additional information (e.g. select/deselect)
     void*             m_clientData;    // Arbitrary client data
@@ -517,6 +524,7 @@ public:
     bool Leaving() const { return (m_eventType == wxEVT_LEAVE_WINDOW); }
 
     // Find the position of the event
+    void GetPosition(long *xpos, long *ypos) const { *xpos = m_x; *ypos = m_y; }
     void Position(long *xpos, long *ypos) const { *xpos = m_x; *ypos = m_y; }
 
     // Find the position of the event
@@ -539,6 +547,8 @@ public:
     // Get Y position
     long GetY() const { return m_y; }
 
+    void CopyObject(wxObject& obj) const;
+
 public:
     long          m_x;
     long          m_y;
@@ -575,18 +585,20 @@ public:
     bool ShiftDown() const { return m_shiftDown; }
     long KeyCode() const { return m_keyCode; }
 
-#if WXWIN_COMPATIBILITY
     // Find the position of the event
-    void Position(float *xpos, float *ypos) const
-        { *xpos = (float)m_x; *ypos = (float)m_y; }
+    void GetPosition(long *xpos, long *ypos) const
+        { *xpos = m_x; *ypos = m_y; }
+
+    wxPoint GetPosition() const
+        { return wxPoint(m_x, m_y); }
 
     // Get X position
-    float GetX() const { return (float)m_x; }
+    long GetX() const { return m_x; }
 
     // Get Y position
-    float GetY() const { return (float)m_y; }
+    long GetY() const { return m_y; }
 
-#endif // WXWIN_COMPATIBILITY
+    void CopyObject(wxObject& obj) const;
 
 public:
     long          m_x;
@@ -616,6 +628,8 @@ public:
         { m_eventType = wxEVT_SIZE; m_id = id; }
 
     wxSize GetSize() const { return m_size; }
+
+    void CopyObject(wxObject& obj) const;
 };
 
 // Move event class
@@ -637,6 +651,8 @@ public:
         { m_eventType = wxEVT_MOVE; m_id = id; }
 
     wxPoint GetPosition() const { return m_pos; }
+
+    void CopyObject(wxObject& obj) const;
 };
 
 // Paint event class
@@ -670,6 +686,8 @@ public:
     wxEraseEvent(int Id = 0, wxDC *dc = (wxDC *) NULL)
         { m_eventType = wxEVT_ERASE_BACKGROUND; m_id = Id; m_dc = dc; }
     wxDC *GetDC() const { return m_dc; }
+
+    void CopyObject(wxObject& obj) const;
 };
 
 // Focus event class
@@ -702,6 +720,8 @@ public:
         { m_eventType = type; m_active = active; m_id = Id; }
     bool GetActive() const { return m_active; }
 
+    void CopyObject(wxObject& obj) const;
+
 private:
     bool m_active;
 };
@@ -734,13 +754,14 @@ class WXDLLEXPORT wxMenuEvent : public wxEvent
     DECLARE_DYNAMIC_CLASS(wxMenuEvent)
 
 public:
-  wxMenuEvent(wxEventType type = wxEVT_NULL, int id = 0)
-    { m_eventType = type; m_menuId = id; }
+    wxMenuEvent(wxEventType type = wxEVT_NULL, int id = 0)
+      { m_eventType = type; m_menuId = id; }
 
-  int GetMenuId() const { return m_menuId; }
+    int GetMenuId() const { return m_menuId; }
 
+    void CopyObject(wxObject& obj) const;
 private:
-  int m_menuId;
+    int m_menuId;
 };
 
 // Window close or session close event class
@@ -774,7 +795,7 @@ public:
     {
         // GetVeto() will return FALSE anyhow...
         wxCHECK_RET( m_canVeto,
-                     "call to Veto() ignored (can't veto this event)" );
+                     _T("call to Veto() ignored (can't veto this event)") );
 
         m_veto = veto;
     }
@@ -791,6 +812,8 @@ public:
     bool GetForce() const { return m_force; }
 #endif
 
+    void CopyObject(wxObject& obj) const;
+
 protected:
     bool m_loggingOff;
     bool m_veto, m_canVeto;
@@ -816,6 +839,8 @@ public:
     void SetShow(bool show) { m_show = show; }
     bool GetShow() const { return m_show; }
 
+    void CopyObject(wxObject& obj) const;
+
 protected:
     bool m_show;
 };
@@ -1169,6 +1194,10 @@ public:
     virtual bool OnClose();
 #endif
 
+#if wxUSE_THREADS
+    bool ProcessThreadEvent(wxEvent& event);
+    void ProcessPendingEvents();
+#endif
     virtual bool ProcessEvent(wxEvent& event);
     virtual bool SearchEventTable(wxEventTable& table, wxEvent& event);
 
@@ -1186,6 +1215,10 @@ public:
 
     bool SearchDynamicEventTable( wxEvent& event );
 
+#if wxUSE_THREADS
+    void ClearEventLocker() { delete m_eventsLocker; m_eventsLocker = NULL; };
+#endif
+
 private:
     static const wxEventTableEntry         sm_eventTableEntries[];
 
@@ -1195,14 +1228,18 @@ protected:
     virtual const wxEventTable *GetEventTable() const;
 
 protected:
-    wxEvtHandler*     m_nextHandler;
-    wxEvtHandler*     m_previousHandler;
-    bool              m_enabled;           // Is event handler enabled?
-    wxList*           m_dynamicEvents;
+    wxEvtHandler*       m_nextHandler;
+    wxEvtHandler*       m_previousHandler;
+    bool                m_enabled;           // Is event handler enabled?
+    wxList*             m_dynamicEvents;
+    wxList*                m_pendingEvents;
+#if wxUSE_THREADS
+    wxCriticalSection*  m_eventsLocker;
+#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;
+    bool                m_isWindow;
 };
 
 typedef void (wxEvtHandler::*wxEventFunction)(wxEvent&);
@@ -1415,5 +1452,13 @@ const wxEventTableEntry theClass::sm_eventTableEntries[] = { \
 #define EVT_UPDATE_UI(id, func) \
  { wxEVT_UPDATE_UI, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxUpdateUIEventFunction) & func, (wxObject *) NULL },\
 
+/*
+ * Helper functions
+ */
+
+// Find a window with the focus, that is also a descendant of the given window.
+// This is used to determine the window to initially send commands to.
+wxWindow* wxFindFocusDescendant(wxWindow* ancestor);
+
 #endif
         // _WX_EVENTH__