]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/os2/gsockpm.cpp
better documentation for wxWindow::SetSizerAndFit()
[wxWidgets.git] / src / os2 / gsockpm.cpp
... / ...
CommitLineData
1/* -------------------------------------------------------------------------
2 * Project: GSocket (Generic Socket) for WX
3 * Name: gsockpm.c
4 * Purpose: GSocket: PM part
5 * Licence: The wxWindows licence
6 * CVSID: $Id$
7 * ------------------------------------------------------------------------- */
8
9// For compilers that support precompilation, includes "wx.h".
10#include "wx/wxprec.h"
11
12#if wxUSE_SOCKETS
13
14#include <stdlib.h>
15#include "wx/unix/gsockunx.h"
16#include "wx/gsocket.h"
17#include "wx/app.h"
18
19#define wxSockReadMask 0x01
20#define wxSockWriteMask 0x02
21
22static void _GSocket_PM_Input(void *data)
23{
24 GSocket *socket = (GSocket *) data;
25 socket->Detected_Read();
26}
27
28static void _GSocket_PM_Output(void *data)
29{
30 GSocket *socket = (GSocket *) data;
31 socket->Detected_Write();
32}
33
34class PMSocketManager : public GSocketInputBasedManager
35{
36public:
37 virtual int AddInput(GSocket *socket, SocketDir d)
38 {
39
40 if (d == FD_OUTPUT)
41 return wxTheApp->AddSocketHandler(socket->m_fd, wxSockWriteMask,
42 _GSocket_PM_Output, (void *)socket);
43 else
44 return wxTheApp->AddSocketHandler(socket->m_fd, wxSockReadMask,
45 _GSocket_PM_Input, (void *)socket);
46 }
47
48 virtual void RemoveInput(int fd)
49 {
50 wxTheApp->RemoveSocketHandler(fd);
51 }
52};
53
54GSocketManager *wxGUIAppTraits::GetSocketManager()
55{
56 static GTKSocketManager s_manager;
57 return &s_manager;
58}
59
60
61#else /* !wxUSE_SOCKETS */
62
63/* some compilers don't like having empty source files */
64static int wxDummyGsockVar = 0;
65
66#endif /* wxUSE_SOCKETS/!wxUSE_SOCKETS */