From 49bcad62198be60888dacf02edcbe9278b465fca Mon Sep 17 00:00:00 2001 From: David Elliott Date: Sun, 18 Jan 2004 21:35:00 +0000 Subject: [PATCH] Added wxAppTraits::CreateGSocket() as well as implementations for wxBase and wxGUI. This method should return a new derived instance of GSocketBSD which implements the EventLoop_ pure virtual functions appropriately. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25236 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/apptrait.h | 11 +++++++++++ src/common/appbase.cpp | 14 ++++++++++++++ src/common/appcmn.cpp | 9 +++++++++ 3 files changed, 34 insertions(+) diff --git a/include/wx/apptrait.h b/include/wx/apptrait.h index dcc488e1e2..2d8e282c99 100644 --- a/include/wx/apptrait.h +++ b/include/wx/apptrait.h @@ -29,6 +29,9 @@ extern "C" struct GSocketGUIFunctionsTable; } +// FIXME: Eventually unify Mac OS 9 +class GSocketBSD; + // ---------------------------------------------------------------------------- // toolkit information // ---------------------------------------------------------------------------- @@ -113,6 +116,10 @@ public: #if wxUSE_SOCKETS // return table of GUI callbacks for GSocket code or NULL in wxBase virtual GSocketGUIFunctionsTable* GetSocketGUIFunctionsTable() = 0; + + // return a new GSocket with the EventLoop_* stuff implemented. + // or at least stubbed (i.e. wxBase) + virtual GSocketBSD* CreateGSocket() = 0; #endif @@ -168,6 +175,7 @@ public: virtual wxRendererNative *CreateRenderer(); #if wxUSE_SOCKETS virtual GSocketGUIFunctionsTable* GetSocketGUIFunctionsTable(); + virtual GSocketBSD* CreateGSocket(); #endif #ifdef __WXDEBUG__ @@ -198,6 +206,9 @@ public: virtual wxRendererNative *CreateRenderer(); #if wxUSE_SOCKETS virtual GSocketGUIFunctionsTable* GetSocketGUIFunctionsTable(); + // return a new GSocket with the EventLoop_* stuff implemented. + // TODO: Remove this because each GUI should implement it separately + virtual GSocketBSD* CreateGSocket(); #endif #ifdef __WXDEBUG__ diff --git a/src/common/appbase.cpp b/src/common/appbase.cpp index 706c1c97c8..941c8aa71b 100644 --- a/src/common/appbase.cpp +++ b/src/common/appbase.cpp @@ -53,6 +53,10 @@ #include "wx/fontmap.h" #endif // wxUSE_FONTMAP +#if wxUSE_SOCKETS + #include "wx/gsocket.h" +#endif // wxUSE_SOCKETS + #if defined(__WXMAC__) // VZ: MacTypes.h is enough under Mac OS X (where I could test it) but // I don't know which headers are needed under earlier systems so @@ -475,6 +479,16 @@ GSocketGUIFunctionsTable* wxConsoleAppTraitsBase::GetSocketGUIFunctionsTable() { return NULL; } + +// TODO: Use a different class that only stubs out the event loop functions +GSocketBSD* wxConsoleAppTraitsBase::CreateGSocket() +{ +#ifdef wxUSE_GSOCKET_CPLUSPLUS + return new GSocketBSDGUIShim(); +#else + return NULL; +#endif +} #endif // ---------------------------------------------------------------------------- diff --git a/src/common/appcmn.cpp b/src/common/appcmn.cpp index c6e0fc945b..5bfa14b7f6 100644 --- a/src/common/appcmn.cpp +++ b/src/common/appcmn.cpp @@ -605,5 +605,14 @@ GSocketGUIFunctionsTable* wxGUIAppTraitsBase::GetSocketGUIFunctionsTable() #endif // !__WXMAC__ || __DARWIN__ } +GSocketBSD* wxGUIAppTraitsBase::CreateGSocket() +{ +#ifdef wxUSE_GSOCKET_CPLUSPLUS + return new GSocketBSDGUIShim(); +#else + return NULL; +#endif +} + #endif -- 2.45.2