From 324899f6c5fa0e052dc718b9b37fc6f557dc78ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Sat, 2 Aug 2003 15:39:26 +0000 Subject: [PATCH] return wxToolkitInfo by reference and not by pointer git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@22492 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/apptrait.h | 3 +-- include/wx/mac/apptrait.h | 4 ++-- include/wx/msw/apptbase.h | 2 +- include/wx/msw/apptrait.h | 2 +- include/wx/unix/apptrait.h | 4 ++-- src/common/dynlib.cpp | 2 +- src/common/utilscmn.cpp | 8 ++++---- src/gtk/utilsgtk.cpp | 4 ++-- src/gtk1/utilsgtk.cpp | 4 ++-- src/mac/carbon/utils.cpp | 8 ++++---- src/mac/utils.cpp | 8 ++++---- src/motif/utils.cpp | 4 ++-- src/msw/app.cpp | 12 ++++++------ src/msw/utils.cpp | 4 ++-- src/unix/baseunix.cpp | 4 ++-- src/x11/utils.cpp | 4 ++-- 16 files changed, 38 insertions(+), 39 deletions(-) diff --git a/include/wx/apptrait.h b/include/wx/apptrait.h index 7d81b46bee..164f042bd7 100644 --- a/include/wx/apptrait.h +++ b/include/wx/apptrait.h @@ -23,7 +23,6 @@ class WXDLLIMPEXP_BASE wxLog; class WXDLLIMPEXP_BASE wxMessageOutput; class WXDLLEXPORT wxRendererNative; class WXDLLIMPEXP_BASE wxString; -struct WXDLLIMPEXP_BASE wxToolkitInfo; // ---------------------------------------------------------------------------- // toolkit information @@ -114,7 +113,7 @@ public: // and in the latter -- about the OS, so we need to virtualize it // - wxDynamicLibrary::CanonicalizePluginName() must embed toolkit // signature in DLL name - virtual wxToolkitInfo *GetToolkitInfo() = 0; + virtual wxToolkitInfo& GetToolkitInfo() = 0; }; // ---------------------------------------------------------------------------- diff --git a/include/wx/mac/apptrait.h b/include/wx/mac/apptrait.h index 7cae381e37..9fb81de3ff 100644 --- a/include/wx/mac/apptrait.h +++ b/include/wx/mac/apptrait.h @@ -22,7 +22,7 @@ public: // other miscellaneous helpers // --------------------------- - virtual wxToolkitInfo *GetToolkitInfo(); + virtual owxToolkitInfo& GetToolkitInfo(); }; #if wxUSE_GUI @@ -33,7 +33,7 @@ public: // other miscellaneous helpers // --------------------------- - virtual wxToolkitInfo *GetToolkitInfo(); + virtual wxToolkitInfo& GetToolkitInfo(); }; #endif // wxUSE_GUI diff --git a/include/wx/msw/apptbase.h b/include/wx/msw/apptbase.h index ef8db45012..d6843d738d 100644 --- a/include/wx/msw/apptbase.h +++ b/include/wx/msw/apptbase.h @@ -47,7 +47,7 @@ public: // under MSW this function returns same version for both console and GUI // applications so we can implement it directly in the base class and only // override it wxGUIAppTraits to fill in toolkit information - virtual wxToolkitInfo *GetToolkitInfo(); + virtual wxToolkitInfo& GetToolkitInfo(); }; #endif // _WX_MSW_APPTBASE_H_ diff --git a/include/wx/msw/apptrait.h b/include/wx/msw/apptrait.h index 41789eda05..8d01b30662 100644 --- a/include/wx/msw/apptrait.h +++ b/include/wx/msw/apptrait.h @@ -36,7 +36,7 @@ public: virtual void AfterChildWaitLoop(void *data); virtual bool DoMessageFromThreadWait(); - virtual wxToolkitInfo *GetToolkitInfo(); + virtual wxToolkitInfo& GetToolkitInfo(); }; #endif // wxUSE_GUI diff --git a/include/wx/unix/apptrait.h b/include/wx/unix/apptrait.h index 598b4b4d80..c0524a2e24 100644 --- a/include/wx/unix/apptrait.h +++ b/include/wx/unix/apptrait.h @@ -24,7 +24,7 @@ public: virtual void DetachWriteFDOfEndProcessPipe(wxExecuteData& execData); virtual int WaitForChild(wxExecuteData& execData); - virtual wxToolkitInfo *GetToolkitInfo(); + virtual wxToolkitInfo& GetToolkitInfo(); }; #if wxUSE_GUI @@ -37,7 +37,7 @@ public: virtual void DetachWriteFDOfEndProcessPipe(wxExecuteData& execData); virtual int WaitForChild(wxExecuteData& execData); - virtual wxToolkitInfo *GetToolkitInfo(); + virtual wxToolkitInfo& GetToolkitInfo(); }; #endif // wxUSE_GUI diff --git a/src/common/dynlib.cpp b/src/common/dynlib.cpp index 1ba9660c9f..234406e898 100644 --- a/src/common/dynlib.cpp +++ b/src/common/dynlib.cpp @@ -415,7 +415,7 @@ wxString wxDynamicLibrary::CanonicalizePluginName(const wxString& name, wxAppConsole::GetInstance()->GetTraits() : NULL; wxASSERT_MSG( traits, _("can't query for GUI plugins name in console applications") ); - suffix = traits->GetToolkitInfo()->shortName; + suffix = traits->GetToolkitInfo().shortName; } #if wxUSE_UNICODE suffix << _T('u'); diff --git a/src/common/utilscmn.cpp b/src/common/utilscmn.cpp index f6195cfeb2..4d111eaf53 100644 --- a/src/common/utilscmn.cpp +++ b/src/common/utilscmn.cpp @@ -293,12 +293,12 @@ int wxGetOsVersion(int *verMaj, int *verMin) if ( ! traits ) traits = &traitsConsole; - wxToolkitInfo *info = traits->GetToolkitInfo(); + wxToolkitInfo& info = traits->GetToolkitInfo(); if ( verMaj ) - *verMaj = info->versionMajor; + *verMaj = info.versionMajor; if ( verMin ) - *verMin = info->versionMinor; - return info->os; + *verMin = info.versionMinor; + return info.os; } // ---------------------------------------------------------------------------- diff --git a/src/gtk/utilsgtk.cpp b/src/gtk/utilsgtk.cpp index 1e0d4dccc1..89dfaec185 100644 --- a/src/gtk/utilsgtk.cpp +++ b/src/gtk/utilsgtk.cpp @@ -122,7 +122,7 @@ int wxDisplayDepth() return gdk_window_get_visual( wxGetRootWindow()->window )->depth; } -wxToolkitInfo *wxGUIAppTraits::GetToolkitInfo() +wxToolkitInfo& wxGUIAppTraits::GetToolkitInfo() { static wxToolkitInfo info; #ifdef __WXGTK20__ @@ -138,7 +138,7 @@ wxToolkitInfo *wxGUIAppTraits::GetToolkitInfo() info.versionMajor = GTK_MAJOR_VERSION; info.versionMinor = GTK_MINOR_VERSION; info.os = wxGTK; - return &info; + return info; } wxWindow* wxFindWindowAtPoint(const wxPoint& pt) diff --git a/src/gtk1/utilsgtk.cpp b/src/gtk1/utilsgtk.cpp index 1e0d4dccc1..89dfaec185 100644 --- a/src/gtk1/utilsgtk.cpp +++ b/src/gtk1/utilsgtk.cpp @@ -122,7 +122,7 @@ int wxDisplayDepth() return gdk_window_get_visual( wxGetRootWindow()->window )->depth; } -wxToolkitInfo *wxGUIAppTraits::GetToolkitInfo() +wxToolkitInfo& wxGUIAppTraits::GetToolkitInfo() { static wxToolkitInfo info; #ifdef __WXGTK20__ @@ -138,7 +138,7 @@ wxToolkitInfo *wxGUIAppTraits::GetToolkitInfo() info.versionMajor = GTK_MAJOR_VERSION; info.versionMinor = GTK_MINOR_VERSION; info.os = wxGTK; - return &info; + return info; } wxWindow* wxFindWindowAtPoint(const wxPoint& pt) diff --git a/src/mac/carbon/utils.cpp b/src/mac/carbon/utils.cpp index 6e1bd0d1b4..24ebec8676 100644 --- a/src/mac/carbon/utils.cpp +++ b/src/mac/carbon/utils.cpp @@ -218,19 +218,19 @@ static int DoGetOSVersion(int *majorVsn, int *minorVsn) #endif } -wxToolkitInfo *wxConsoleAppTraits::GetToolkitInfo() +wxToolkitInfo& wxConsoleAppTraits::GetToolkitInfo() { static wxToolkitInfo info; info.os = DoGetOSVersion(&info.majorVersion, &info.minorVersion); info.name = _T("wxBase"); - return &info; + return info; } #endif // wxUSE_BASE #if wxUSE_GUI -wxToolkitInfo *wxGUIAppTraits::GetToolkitInfo() +wxToolkitInfo& wxGUIAppTraits::GetToolkitInfo() { static wxToolkitInfo info; info.os = DoGetOSVersion(&info.majorVersion, &info.minorVersion); @@ -240,7 +240,7 @@ wxToolkitInfo *wxGUIAppTraits::GetToolkitInfo() info.shortName << _T("univ"); info.name << _T("/wxUniversal"); #endif - return &info; + return info; } // Reading and writing resources (eg WIN.INI, .Xdefaults) diff --git a/src/mac/utils.cpp b/src/mac/utils.cpp index 6e1bd0d1b4..24ebec8676 100644 --- a/src/mac/utils.cpp +++ b/src/mac/utils.cpp @@ -218,19 +218,19 @@ static int DoGetOSVersion(int *majorVsn, int *minorVsn) #endif } -wxToolkitInfo *wxConsoleAppTraits::GetToolkitInfo() +wxToolkitInfo& wxConsoleAppTraits::GetToolkitInfo() { static wxToolkitInfo info; info.os = DoGetOSVersion(&info.majorVersion, &info.minorVersion); info.name = _T("wxBase"); - return &info; + return info; } #endif // wxUSE_BASE #if wxUSE_GUI -wxToolkitInfo *wxGUIAppTraits::GetToolkitInfo() +wxToolkitInfo& wxGUIAppTraits::GetToolkitInfo() { static wxToolkitInfo info; info.os = DoGetOSVersion(&info.majorVersion, &info.minorVersion); @@ -240,7 +240,7 @@ wxToolkitInfo *wxGUIAppTraits::GetToolkitInfo() info.shortName << _T("univ"); info.name << _T("/wxUniversal"); #endif - return &info; + return info; } // Reading and writing resources (eg WIN.INI, .Xdefaults) diff --git a/src/motif/utils.cpp b/src/motif/utils.cpp index ab645457b2..413b8266fb 100644 --- a/src/motif/utils.cpp +++ b/src/motif/utils.cpp @@ -133,7 +133,7 @@ void wxBell() XBell (wxGlobalDisplay(), 0); } -wxToolkitInfo *wxGUIAppTraits::GetToolkitInfo() +wxToolkitInfo& wxGUIAppTraits::GetToolkitInfo() { wxToolkitInfo info; info.shortName = _T("motif"); @@ -150,7 +150,7 @@ wxToolkitInfo *wxGUIAppTraits::GetToolkitInfo() info.versionMajor = ProtocolVersion (display); info.versionMinor = ProtocolRevision (display); info.os = wxMOTIF_X; - return &info; + return info; } // ---------------------------------------------------------------------------- diff --git a/src/msw/app.cpp b/src/msw/app.cpp index 8d2c220f95..007b5241e4 100644 --- a/src/msw/app.cpp +++ b/src/msw/app.cpp @@ -229,20 +229,20 @@ bool wxGUIAppTraits::DoMessageFromThreadWait() return !wxTheApp || wxTheApp->DoMessage(); } -wxToolkitInfo *wxGUIAppTraits::GetToolkitInfo() +wxToolkitInfo& wxGUIAppTraits::GetToolkitInfo() { static wxToolkitInfo info; - wxToolkitInfo *baseInfo = wxAppTraits::GetToolkitInfo(); - info.versionMajor = baseInfo->versionMajor; - info.versionMinor = baseInfo->versionMinor; - info.os = baseInfo->os; + wxToolkitInfo& baseInfo = wxAppTraits::GetToolkitInfo(); + info.versionMajor = baseInfo.versionMajor; + info.versionMinor = baseInfo.versionMinor; + info.os = baseInfo.os; info.shortName = _T("msw"); info.name = _T("wxMSW"); #ifdef __WXUNIVERSAL__ info.shortName << _T("univ"); info.name << _T("/wxUniversal"); #endif - return &info; + return info; } // =========================================================================== diff --git a/src/msw/utils.cpp b/src/msw/utils.cpp index 3a3f03a76c..fae0cb322d 100644 --- a/src/msw/utils.cpp +++ b/src/msw/utils.cpp @@ -1012,7 +1012,7 @@ wxString wxGetOsDescription() #endif // Win32/16 } -wxToolkitInfo *wxAppTraits::GetToolkitInfo() +wxToolkitInfo& wxAppTraits::GetToolkitInfo() { // cache the version info, it's not going to change // @@ -1061,7 +1061,7 @@ wxToolkitInfo *wxAppTraits::GetToolkitInfo() info.versionMinor = s_minor; info.os = s_ver; info.name = _T("wxBase"); - return &info; + return info; } // ---------------------------------------------------------------------------- diff --git a/src/unix/baseunix.cpp b/src/unix/baseunix.cpp index 630ad555a0..bd40653d6f 100644 --- a/src/unix/baseunix.cpp +++ b/src/unix/baseunix.cpp @@ -88,7 +88,7 @@ wxConsoleAppTraits::WaitForChild(wxExecuteData& execData) // this is in mac/utils.cpp under Mac #ifndef __WXMAC__ -wxToolkitInfo *wxConsoleAppTraits::GetToolkitInfo() +wxToolkitInfo& wxConsoleAppTraits::GetToolkitInfo() { static wxToolkitInfo info; int major, minor; @@ -106,7 +106,7 @@ wxToolkitInfo *wxConsoleAppTraits::GetToolkitInfo() info.name = _T("wxBase"); info.os = wxUNIX; - return &info; + return info; } #endif // __WXMAC__ diff --git a/src/x11/utils.cpp b/src/x11/utils.cpp index 0bdd4ed3dc..22d3476ac8 100644 --- a/src/x11/utils.cpp +++ b/src/x11/utils.cpp @@ -98,7 +98,7 @@ void wxBell() XBell ((Display*) wxGetDisplay(), 0); } -wxToolkitInfo *wxGUIAppTraits::GetToolkitInfo() +wxToolkitInfo& wxGUIAppTraits::GetToolkitInfo() { static wxToolkitInfo info; info.shortName = _T("x11univ"); @@ -106,7 +106,7 @@ wxToolkitInfo *wxGUIAppTraits::GetToolkitInfo() info.versionMajor = 0; info.versionMinor = 0; info.os = wxX11; - return &info; + return info; } // ----------------------------------------------------------------------------