fixed wxBase and GUI separation for sockets code

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@22668 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2003-08-07 12:26:17 +00:00
parent 698ec18272
commit 38bb138f09
19 changed files with 542 additions and 253 deletions

View File

@@ -24,6 +24,8 @@ class WXDLLIMPEXP_BASE wxMessageOutput;
class WXDLLEXPORT wxRendererNative;
class WXDLLIMPEXP_BASE wxString;
extern "C" struct GSocketGUIFunctionsTable;
// ----------------------------------------------------------------------------
// toolkit information
// ----------------------------------------------------------------------------
@@ -105,6 +107,11 @@ public:
// wxBase
virtual void RemoveFromPendingDelete(wxObject *object) = 0;
#if wxUSE_SOCKETS
// return table of GUI callbacks for GSocket code or NULL in wxBase
virtual GSocketGUIFunctionsTable* GetSocketGUIFunctionsTable() = 0;
#endif
// return information about what toolkit is running; we need for two things
// that are both contained in wxBase:
@@ -154,6 +161,9 @@ public:
virtual wxFontMapper *CreateFontMapper();
#endif // wxUSE_FONTMAP
virtual wxRendererNative *CreateRenderer();
#if wxUSE_SOCKETS
virtual GSocketGUIFunctionsTable* GetSocketGUIFunctionsTable();
#endif
#ifdef __WXDEBUG__
virtual bool ShowAssertDialog(const wxString& msg);
@@ -181,6 +191,9 @@ public:
virtual wxFontMapper *CreateFontMapper();
#endif // wxUSE_FONTMAP
virtual wxRendererNative *CreateRenderer();
#if wxUSE_SOCKETS
virtual GSocketGUIFunctionsTable* GetSocketGUIFunctionsTable();
#endif
#ifdef __WXDEBUG__
virtual bool ShowAssertDialog(const wxString& msg);

View File

@@ -95,8 +95,37 @@ typedef void (*GSocketCallback)(GSocket *socket, GSocketEvent event,
char *cdata);
/* Functions tables for internal use by GSocket code: */
#ifndef __WINDOWS__
struct GSocketBaseFunctionsTable
{
void (*Detected_Read)(GSocket *socket);
void (*Detected_Write)(GSocket *socket);
};
#endif
struct GSocketGUIFunctionsTable
{
int (*GUI_Init)(void);
void (*GUI_Cleanup)(void);
int (*GUI_Init_Socket)(GSocket *socket);
void (*GUI_Destroy_Socket)(GSocket *socket);
#ifndef __WINDOWS__
void (*Install_Callback)(GSocket *socket, GSocketEvent event);
void (*Uninstall_Callback)(GSocket *socket, GSocketEvent event);
#endif
void (*Enable_Events)(GSocket *socket);
void (*Disable_Events)(GSocket *socket);
};
/* Global initializers */
/* Sets GUI functions callbacks. Must be called *before* GSocket_Init
if the app uses async sockets. */
void GSocket_SetGUIFunctions(struct GSocketGUIFunctionsTable *guifunc);
/* GSocket_Init() must be called at the beginning */
int GSocket_Init(void);

View File

@@ -83,8 +83,10 @@ int _GSocket_Send_Dgram(GSocket *socket, const char *buffer, int size);
/* Callbacks */
int _GSocket_GUI_Init(GSocket *socket);
void _GSocket_GUI_Destroy(GSocket *socket);
int _GSocket_GUI_Init(void);
void _GSocket_GUI_Cleanup(void);
int _GSocket_GUI_Init_Socket(GSocket *socket);
void _GSocket_GUI_Destroy_Socket(GSocket *socket);
LRESULT CALLBACK _GSocket_Internal_WinProc(HWND, UINT, WPARAM, LPARAM);

View File

@@ -56,6 +56,9 @@ struct _GSocket
char *m_data[GSOCK_MAX_EVENT];
char *m_gui_dependent;
/* Function pointers */
struct GSocketBaseFunctionsTable *m_functions;
};
/* Definition of GAddress */
@@ -81,8 +84,11 @@ int _GSocket_Send_Dgram(GSocket *socket, const char *buffer, int size);
/* Callbacks */
int _GSocket_GUI_Init(GSocket *socket);
void _GSocket_GUI_Destroy(GSocket *socket);
int _GSocket_GUI_Init(void);
void _GSocket_GUI_Cleanup(void);
int _GSocket_GUI_Init_Socket(GSocket *socket);
void _GSocket_GUI_Destroy_Socket(GSocket *socket);
void _GSocket_Enable_Events(GSocket *socket);
void _GSocket_Disable_Events(GSocket *socket);