]> git.saurik.com Git - wxWidgets.git/blame - include/wx/private/socketevtdispatch.h
wxDFB's wxICON and wxBITMAP should use embedded XPMs, too
[wxWidgets.git] / include / wx / private / socketevtdispatch.h
CommitLineData
6b44a335
VS
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/private/socketevtdispatch.h
3// Purpose: wxSocketEventDispatcher class
4// Authors: Angel Vidal
5// Modified by:
6// Created: August 2006
7// Copyright: (c) Angel Vidal
8// RCS-ID: $Id$
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_PRIVATE_SOCKETEVTDISPATCH_H_
13#define _WX_PRIVATE_SOCKETEVTDISPATCH_H_
14
15#include "wx/defs.h"
16
17#if wxUSE_SOCKETS
18
19#include "wx/hash.h"
20
21// forward declarations
22class wxSocketEventDispatcherEntry;
23class GSocket;
24
25enum wxSocketEventDispatcherType
26{
27 wxSocketEventDispatcherInput,
28 wxSocketEventDispatcherOutput
29};
30
31class WXDLLIMPEXP_CORE wxSocketEventDispatcher : public wxHashTable
32{
33protected:
34 wxSocketEventDispatcher() : wxHashTable(wxKEY_INTEGER) {}
35
36public:
37 // returns instance of the table
38 static wxSocketEventDispatcher& Get();
39
40 virtual ~wxSocketEventDispatcher()
41 {
42 WX_CLEAR_HASH_TABLE(*this)
43 }
44
45 void RegisterCallback(int fd, wxSocketEventDispatcherType socketType,
46 GSocket* socket);
47
48 void UnregisterCallback(int fd, wxSocketEventDispatcherType socketType);
49
50 void RunLoop(int timeout = 0);
51
52private:
53 void AddEvents(fd_set* readset, fd_set* writeset);
54
55 int FillSets(fd_set* readset, fd_set* writeset);
56
57 wxSocketEventDispatcherEntry* FindEntry(int fd);
58
59private:
60 static wxSocketEventDispatcher *ms_instance;
61
62 friend class wxSocketEventDispatcherModule;
63};
64
65#endif // wxUSE_SOCKETS
66
67#endif // _WX_PRIVATE_SOCKETEVTDISPATCH_H_