X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f4ada568223b79c8a5769cc351c36a8e2ccd7841..594542b1280021f45dcaff54a8e26a93113f8884:/include/wx/socket.h diff --git a/include/wx/socket.h b/include/wx/socket.h index a65b4683cd..9037f92c7b 100644 --- a/include/wx/socket.h +++ b/include/wx/socket.h @@ -8,11 +8,12 @@ // Copyright: (c) Guilhem Lavaux // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// + #ifndef _WX_NETWORK_SOCKET_H #define _WX_NETWORK_SOCKET_H #ifdef __GNUG__ -#pragma interface +#pragma interface "socket.h" #endif // --------------------------------------------------------------------------- @@ -79,6 +80,12 @@ class WXDLLEXPORT wxSocketHandler; class WXDLLEXPORT wxSocketBase : public wxEvtHandler { DECLARE_CLASS(wxSocketBase) +#ifdef __WXMAC__ + friend void wxMacSocketOnRequestProc(void *refcon , short event) ; +#endif +#if defined(__WXGTK__) && defined(WXSOCK_INTERNAL) + friend void wxPrereadSocket(wxSocketBase *sock); +#endif public: enum wxSockFlags { NONE=0, NOWAIT=1, WAITALL=2, SPEED=4 }; @@ -162,7 +169,7 @@ public: inline size_t LastCount() const { return m_lcount; } inline int LastError() const { return m_error; } - inline void SetFlags(wxSockFlags _flags); + void SetFlags(wxSockFlags _flags); inline void SetTimeout(unsigned long sec) { m_timeout = sec; } // seconds = -1 means infinite wait @@ -207,7 +214,15 @@ protected: friend class wxSocketServer; friend class wxSocketHandler; +#ifdef __SALFORDC__ +public: +#endif + wxSocketBase(wxSockFlags flags, wxSockType type); + +#ifdef __SALFORDC__ +protected: +#endif bool _Wait(long seconds, long microseconds, int type); @@ -258,7 +273,7 @@ public: virtual bool Connect(wxSockAddress& addr_man, bool wait = TRUE); - bool WaitOnConnect(long seconds = -1); + bool WaitOnConnect(long seconds = -1, long microseconds = 0); virtual void OnRequest(wxRequestEvent flags); }; @@ -269,7 +284,6 @@ class WXDLLEXPORT wxSocketHandler : public wxObject { DECLARE_CLASS(wxSocketHandler) protected: - static wxSocketHandler *master; #if defined(__WINDOWS__) wxList *smsg_list; struct wxSockHandlerInternal *internal; @@ -279,6 +293,7 @@ protected: public: enum SockStatus { SOCK_NONE, SOCK_DATA, SOCK_CONNECT, SOCK_DISCONNECT, SOCK_ERROR }; + static wxSocketHandler *master; wxSocketHandler(); virtual ~wxSocketHandler(); @@ -302,8 +317,7 @@ public: (wxSocketBase::wxSockFlags flags = wxSocketBase::NONE); // Create or reuse a socket handler - static wxSocketHandler& Master() - { return *((master) ? (master) : (master = new wxSocketHandler())); } + static wxSocketHandler& Master() { return *master; } #if defined(WXSOCK_INTERNAL) && defined(__WINDOWS__) @@ -331,6 +345,8 @@ typedef void (wxEvtHandler::*wxSocketEventFunction)(wxSocketEvent&); #define wxEVT_SOCKET wxEVT_FIRST+301 -#define EVT_SOCKET(id, func) { wxEVT_SOCKET, id, 0, (wxObjectEventFunction) (wxEventFunction) (wxSocketEventFunction) & func }, +#define EVT_SOCKET(id, func) { wxEVT_SOCKET, id, 0, \ + (wxObjectEventFunction) (wxEventFunction) (wxSocketEventFunction) & func, \ + (wxObject *) NULL }, #endif