-/* Table of GUI-related functions. We must call them indirectly because
- * of wxBase and GUI separation: */
-
-static struct GSocketGUIFunctionsTable *gs_gui_functions;
-
-#define USE_GUI() (gs_gui_functions != NULL)
-
-/* Define macros to simplify indirection: */
-#define _GSocket_GUI_Init() \
- if (gs_gui_functions) gs_gui_functions->GUI_Init()
-#define _GSocket_GUI_Cleanup() \
- if (gs_gui_functions) gs_gui_functions->GUI_Cleanup()
-#define _GSocket_GUI_Init_Socket(socket) \
- (gs_gui_functions ? gs_gui_functions->GUI_Init_Socket(socket) : 1)
-#define _GSocket_GUI_Destroy_Socket(socket) \
- if (gs_gui_functions) gs_gui_functions->GUI_Destroy_Socket(socket)
-#define _GSocket_Enable_Events(socket) \
- if (gs_gui_functions) gs_gui_functions->Enable_Events(socket)
-#define _GSocket_Disable_Events(socket) \
- if (gs_gui_functions) gs_gui_functions->Disable_Events(socket)
-#define _GSocket_Install_Callback(socket, event) \
- if (gs_gui_functions) gs_gui_functions->Install_Callback(socket, event)
-#define _GSocket_Uninstall_Callback(socket, event) \
- if (gs_gui_functions) gs_gui_functions->Uninstall_Callback(socket, event)
+///////////////////////////////////////////////////////////////////////////
+// GSocketBSDGUIShim
+struct GSocketGUIFunctionsTable *GSocketBSDGUIShim::ms_gui_functions = NULL;
+
+void GSocket_SetGUIFunctions(struct GSocketGUIFunctionsTable *guifunc)
+{
+ GSocketBSDGUIShim::ms_gui_functions = guifunc;
+}
+
+inline bool GSocketBSDGUIShim::UseGUI()
+{
+ return ms_gui_functions;
+}
+
+inline bool GSocketBSDGUIShim::GUI_Init()
+{
+ return (ms_gui_functions)?ms_gui_functions->GUI_Init():true;
+}
+
+inline void GSocketBSDGUIShim::GUI_Cleanup()
+{
+ if (ms_gui_functions) ms_gui_functions->GUI_Cleanup();
+}
+
+GSocketBSDGUIShim::GSocketBSDGUIShim()
+{
+ m_ok = (ms_gui_functions ? ms_gui_functions->GUI_Init_Socket(this) : true);
+}
+
+GSocketBSDGUIShim::~GSocketBSDGUIShim()
+{
+ if (ms_gui_functions) ms_gui_functions->GUI_Destroy_Socket(this);
+}
+
+void GSocketBSDGUIShim::EventLoop_Enable_Events()
+{
+ if (ms_gui_functions) ms_gui_functions->Enable_Events(this);
+}
+
+void GSocketBSDGUIShim::EventLoop_Disable_Events()
+{
+ if (ms_gui_functions) ms_gui_functions->Disable_Events(this);
+}
+
+void GSocketBSDGUIShim::EventLoop_Install_Callback(GSocketEvent event)
+{
+ if (ms_gui_functions) ms_gui_functions->Install_Callback(this, event);
+}
+
+void GSocketBSDGUIShim::EventLoop_Uninstall_Callback(GSocketEvent event)
+{
+ if (ms_gui_functions) ms_gui_functions->Uninstall_Callback(this, event);
+}
+
+///////////////////////////////////////////////////////////////////////////
+// GSocketBSD