]> git.saurik.com Git - wxWidgets.git/blame - src/os2/sockpm.cpp
Add space all around std buttons as per Apple HIG (and as the comment in the code...
[wxWidgets.git] / src / os2 / sockpm.cpp
CommitLineData
a9d859df
VZ
1///////////////////////////////////////////////////////////////////////////////
2// Name: os2/sockpm.cpp
3// Purpose: implementation of OS-2-specific handler event handling
4// Author: Guilhem Lavaux, Vadim Zeitlin
5// Created: 1999
6// RCS-ID: $Id$
7// Copyright: (c) 1999-2008 wxWidgets dev team
8// Licence: wxWindows licence
9///////////////////////////////////////////////////////////////////////////////
05a019a2 10
6670f564
WS
11// For compilers that support precompilation, includes "wx.h".
12#include "wx/wxprec.h"
13
05a019a2
DE
14#if wxUSE_SOCKETS
15
16#include <stdlib.h>
60913641 17#include "wx/private/socket.h"
621b4574 18#include "wx/app.h"
cb1e81d4 19#include "wx/apptrait.h"
05a019a2
DE
20
21#define wxSockReadMask 0x01
22#define wxSockWriteMask 0x02
23
51fe4b60 24static void wxSocket_PM_Input(void *data)
05a019a2 25{
a9d859df 26 wxFDIOHandler *handler = static_cast<wxFDIOHandler *>(data);
51fe4b60 27
a9d859df 28 handler->OnReadWaiting();
05a019a2
DE
29}
30
51fe4b60 31static void wxSocket_PM_Output(void *data)
05a019a2 32{
a9d859df 33 wxFDIOHandler *handler = static_cast<wxFDIOHandler *>(data);
51fe4b60 34
a9d859df 35 handler->OnWriteWaiting();
05a019a2
DE
36}
37
51fe4b60 38class PMSocketManager : public wxSocketInputBasedManager
05a019a2 39{
f90913e2 40public:
a9d859df 41 virtual int AddInput(wxFDIOHandler *handler, int fd, SocketDir d)
05a019a2 42 {
f90913e2 43 if (d == FD_OUTPUT)
a9d859df
VZ
44 return wxTheApp->AddSocketHandler(fd, wxSockWriteMask,
45 wxSocket_PM_Output, handler);
f90913e2 46 else
a9d859df
VZ
47 return wxTheApp->AddSocketHandler(fd, wxSockReadMask,
48 wxSocket_PM_Input, handler);
05a019a2 49 }
05a019a2 50
f90913e2 51 virtual void RemoveInput(int fd)
05a019a2 52 {
f90913e2 53 wxTheApp->RemoveSocketHandler(fd);
05a019a2 54 }
f90913e2 55};
05a019a2 56
51fe4b60 57wxSocketManager *wxGUIAppTraits::GetSocketManager()
05a019a2 58{
cb1e81d4 59 static PMSocketManager s_manager;
f90913e2 60 return &s_manager;
05a019a2
DE
61}
62
05a019a2
DE
63
64#else /* !wxUSE_SOCKETS */
65
66/* some compilers don't like having empty source files */
67static int wxDummyGsockVar = 0;
68
69#endif /* wxUSE_SOCKETS/!wxUSE_SOCKETS */