]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/socket.h
Implemented CharHook events.
[wxWidgets.git] / include / wx / socket.h
index a8a9ff7c021ad67cdec304cd36320342c0d667f1..7b540329f8468f6334442bd45e6beb12b7b69f57 100644 (file)
@@ -185,6 +185,11 @@ public:
   void SetNotify(wxSocketEventFlags flags);
   void Notify(bool notify);
 
+  // initialize/shutdown the sockets (usually called automatically)
+  static bool IsInitialized();
+  static bool Initialize();
+  static void Shutdown();
+
   // callbacks are deprecated, use events instead
 #if WXWIN_COMPATIBILITY
   wxSockCbk Callback(wxSockCbk cbk_);
@@ -247,6 +252,9 @@ private:
   bool          m_notify;           // notify events to users?
   wxSocketEventFlags  m_eventmask;  // which events to notify?
 
+  // the initialization count, GSocket is initialized if > 0
+  static size_t m_countInit;
+
   // callbacks are deprecated, use events instead
 #if WXWIN_COMPATIBILITY
   wxSockCbk     m_cbk;              // callback
@@ -323,10 +331,11 @@ public:
 
 class WXDLLEXPORT wxSocketEvent : public wxEvent
 {
-  DECLARE_DYNAMIC_CLASS(wxSocketEvent)
-
 public:
-  wxSocketEvent(int id = 0);
+  wxSocketEvent(int id = 0)
+      : wxEvent(id, wxEVT_SOCKET)
+      {
+      }
 
   wxSocketNotify  GetSocketEvent() const { return m_event; }
   wxSocketBase   *GetSocket() const      { return (wxSocketBase *) GetEventObject(); }
@@ -338,19 +347,24 @@ public:
   wxSocketBase   *Socket() const         { return (wxSocketBase *) GetEventObject(); }
 #endif // WXWIN_COMPATIBILITY_2
 
-  void CopyObject(wxObject& object_dest) const;
+  virtual wxEvent *Clone() const { return new wxSocketEvent(*this); }
 
 public:
   wxSocketNotify  m_event;
   void           *m_clientData;
+
+  DECLARE_DYNAMIC_CLASS(wxSocketEvent)
 };
 
 
 typedef void (wxEvtHandler::*wxSocketEventFunction)(wxSocketEvent&);
 
-#define EVT_SOCKET(id, func) wxEventTableEntry( wxEVT_SOCKET, id, -1, \
-  (wxObjectEventFunction) (wxEventFunction) (wxSocketEventFunction) & func, \
-  (wxObject *) NULL ),
+#define EVT_SOCKET(id, func) \
+    DECLARE_EVENT_TABLE_ENTRY( wxEVT_SOCKET, id, -1, \
+                              (wxObjectEventFunction) \
+                              (wxEventFunction) \
+                              (wxSocketEventFunction) & func, \
+                              (wxObject *) NULL ),
 
 
 #endif