]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/os2/sockpm.cpp
no changes, just remove trailing whitespace
[wxWidgets.git] / src / os2 / sockpm.cpp
... / ...
CommitLineData
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///////////////////////////////////////////////////////////////////////////////
10
11// For compilers that support precompilation, includes "wx.h".
12#include "wx/wxprec.h"
13
14#if wxUSE_SOCKETS
15
16#include <stdlib.h>
17#include "wx/private/socket.h"
18#include "wx/app.h"
19#include "wx/apptrait.h"
20
21#define wxSockReadMask 0x01
22#define wxSockWriteMask 0x02
23
24static void wxSocket_PM_Input(void *data)
25{
26 wxFDIOHandler *handler = static_cast<wxFDIOHandler *>(data);
27
28 handler->OnReadWaiting();
29}
30
31static void wxSocket_PM_Output(void *data)
32{
33 wxFDIOHandler *handler = static_cast<wxFDIOHandler *>(data);
34
35 handler->OnWriteWaiting();
36}
37
38class PMSocketManager : public wxSocketInputBasedManager
39{
40public:
41 virtual int AddInput(wxFDIOHandler *handler, int fd, SocketDir d)
42 {
43 if (d == FD_OUTPUT)
44 return wxTheApp->AddSocketHandler(fd, wxSockWriteMask,
45 wxSocket_PM_Output, handler);
46 else
47 return wxTheApp->AddSocketHandler(fd, wxSockReadMask,
48 wxSocket_PM_Input, handler);
49 }
50
51 virtual void RemoveInput(int fd)
52 {
53 wxTheApp->RemoveSocketHandler(fd);
54 }
55};
56
57wxSocketManager *wxGUIAppTraits::GetSocketManager()
58{
59 static PMSocketManager s_manager;
60 return &s_manager;
61}
62
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 */