Real C++(ish) code

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28595 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Elliott
2004-08-03 03:37:32 +00:00
parent 52a4b53fe1
commit c90cc42e98
2 changed files with 290 additions and 306 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -109,6 +109,8 @@ wxCreateHiddenWindow(LPCTSTR *pclassname, LPCTSTR classname, WNDPROC wndproc);
typedef int (PASCAL *WSAAsyncSelectFunc)(SOCKET,HWND,u_int,long); typedef int (PASCAL *WSAAsyncSelectFunc)(SOCKET,HWND,u_int,long);
LRESULT CALLBACK _GSocket_Internal_WinProc(HWND, UINT, WPARAM, LPARAM);
/* Global variables */ /* Global variables */
extern HINSTANCE INSTANCE; extern HINSTANCE INSTANCE;
@@ -119,9 +121,12 @@ static int firstAvailable;
static WSAAsyncSelectFunc gs_WSAAsyncSelect = NULL; static WSAAsyncSelectFunc gs_WSAAsyncSelect = NULL;
static HMODULE gs_wsock32dll = 0; static HMODULE gs_wsock32dll = 0;
bool GSocketGUIFunctionsTableConcrete::CanUseEventLoop()
{ return true; }
/* Global initializers */ /* Global initializers */
int _GSocket_GUI_Init(void) bool GSocketGUIFunctionsTableConcrete::OnInit()
{ {
static LPCTSTR pclassname = NULL; static LPCTSTR pclassname = NULL;
int i; int i;
@@ -129,7 +134,7 @@ int _GSocket_GUI_Init(void)
/* Create internal window for event notifications */ /* Create internal window for event notifications */
hWin = wxCreateHiddenWindow(&pclassname, CLASSNAME, _GSocket_Internal_WinProc); hWin = wxCreateHiddenWindow(&pclassname, CLASSNAME, _GSocket_Internal_WinProc);
if (!hWin) if (!hWin)
return FALSE; return false;
/* Initialize socket list */ /* Initialize socket list */
InitializeCriticalSection(&critical); InitializeCriticalSection(&critical);
@@ -145,16 +150,16 @@ int _GSocket_GUI_Init(void)
sockets): */ sockets): */
gs_wsock32dll = LoadLibraryA("wsock32.dll"); gs_wsock32dll = LoadLibraryA("wsock32.dll");
if (!gs_wsock32dll) if (!gs_wsock32dll)
return FALSE; return false;
gs_WSAAsyncSelect =(WSAAsyncSelectFunc)GetProcAddress(gs_wsock32dll, gs_WSAAsyncSelect =(WSAAsyncSelectFunc)GetProcAddress(gs_wsock32dll,
"WSAAsyncSelect"); "WSAAsyncSelect");
if (!gs_WSAAsyncSelect) if (!gs_WSAAsyncSelect)
return FALSE; return false;
return TRUE; return true;
} }
void _GSocket_GUI_Cleanup(void) void GSocketGUIFunctionsTableConcrete::OnExit()
{ {
/* Destroy internal window */ /* Destroy internal window */
DestroyWindow(hWin); DestroyWindow(hWin);
@@ -173,7 +178,7 @@ void _GSocket_GUI_Cleanup(void)
/* Per-socket GUI initialization / cleanup */ /* Per-socket GUI initialization / cleanup */
int _GSocket_GUI_Init_Socket(GSocket *socket) bool GSocketGUIFunctionsTableConcrete::Init_Socket(GSocket *socket)
{ {
int i; int i;
@@ -188,7 +193,7 @@ int _GSocket_GUI_Init_Socket(GSocket *socket)
if (i == firstAvailable) /* abort! */ if (i == firstAvailable) /* abort! */
{ {
LeaveCriticalSection(&critical); LeaveCriticalSection(&critical);
return FALSE; return false;
} }
} }
socketList[i] = socket; socketList[i] = socket;
@@ -197,10 +202,10 @@ int _GSocket_GUI_Init_Socket(GSocket *socket)
LeaveCriticalSection(&critical); LeaveCriticalSection(&critical);
return TRUE; return true;
} }
void _GSocket_GUI_Destroy_Socket(GSocket *socket) void GSocketGUIFunctionsTableConcrete::Destroy_Socket(GSocket *socket)
{ {
/* Remove the socket from the list */ /* Remove the socket from the list */
EnterCriticalSection(&critical); EnterCriticalSection(&critical);
@@ -284,7 +289,7 @@ LRESULT CALLBACK _GSocket_Internal_WinProc(HWND hWnd,
* events for internal processing, but we will only notify users * events for internal processing, but we will only notify users
* when an appropiate callback function has been installed. * when an appropiate callback function has been installed.
*/ */
void _GSocket_Enable_Events(GSocket *socket) void GSocketGUIFunctionsTableConcrete::Enable_Events(GSocket *socket)
{ {
assert (socket != NULL); assert (socket != NULL);
@@ -303,7 +308,7 @@ void _GSocket_Enable_Events(GSocket *socket)
/* _GSocket_Disable_Events: /* _GSocket_Disable_Events:
* Disable event notifications (when shutdowning the socket) * Disable event notifications (when shutdowning the socket)
*/ */
void _GSocket_Disable_Events(GSocket *socket) void GSocketGUIFunctionsTableConcrete::Disable_Events(GSocket *socket)
{ {
assert (socket != NULL); assert (socket != NULL);