From 621ccd8a82647e094bdf539501b648df5de7efab Mon Sep 17 00:00:00 2001 From: Stefan Neis Date: Sun, 31 Aug 2003 18:15:10 +0000 Subject: [PATCH] Fixed AppTraits handling on OS/2. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23322 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- build/bakefiles/files.bkl | 1 - include/wx/apptrait.h | 17 ++++++++++++----- src/os2/utils.cpp | 29 ++++++++++++++++++----------- src/os2/utilsgui.cpp | 26 ++++++++++++++++++++++++++ 4 files changed, 56 insertions(+), 17 deletions(-) diff --git a/build/bakefiles/files.bkl b/build/bakefiles/files.bkl index cc8ba0b4c4..c8edd533e3 100644 --- a/build/bakefiles/files.bkl +++ b/build/bakefiles/files.bkl @@ -119,7 +119,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! - src/unix/baseunix.cpp src/os2/dir.cpp src/os2/mimetype.cpp src/os2/thread.cpp diff --git a/include/wx/apptrait.h b/include/wx/apptrait.h index 8a2b8c265e..1f3e30f3b7 100644 --- a/include/wx/apptrait.h +++ b/include/wx/apptrait.h @@ -134,7 +134,7 @@ public: // Unix code (and otherwise __UNIX__ wouldn't be defined) #if defined(__WXMSW__) #include "wx/msw/apptbase.h" -#elif defined(__UNIX__) +#elif defined(__UNIX__) && !defined(__EMX__) #include "wx/unix/apptbase.h" #elif defined(__WXMAC__) #include "wx/mac/apptbase.h" @@ -215,15 +215,22 @@ public: #if defined(__WXMSW__) #include "wx/msw/apptrait.h" -#elif defined(__UNIX__) +#elif defined(__UNIX__) && !defined(__EMX__) #include "wx/unix/apptrait.h" #elif defined(__WXMAC__) #include "wx/mac/apptrait.h" -#else // no platform-specific methods to add to wxAppTraits +#else + // at least, we need an implementation of GetToolkitInfo ! #if wxUSE_GUI - typedef wxGUIAppTraitsBase wxGUIAppTraits; + class wxGUIAppTraits : public wxGUIAppTraitsBase + { + virtual wxToolkitInfo& GetToolkitInfo(); + }; #endif // wxUSE_GUI - typedef wxConsoleAppTraitsBase wxConsoleAppTraits; + class wxConsoleAppTraits: public wxConsoleAppTraitsBase + { + virtual wxToolkitInfo& GetToolkitInfo(); + }; #endif // platform #endif // _WX_APPTRAIT_H_ diff --git a/src/os2/utils.cpp b/src/os2/utils.cpp index 68b0e3e6af..f6c06af949 100644 --- a/src/os2/utils.cpp +++ b/src/os2/utils.cpp @@ -343,15 +343,14 @@ void wxBell() { DosBeep(1000,1000); // 1kHz during 1 sec. } -#if 0 -int wxGUIAppTraits::GetOSVersion( - int* pMajorVsn -, int* pMinorVsn -) + +wxToolkitInfo & wxConsoleAppTraits::GetToolkitInfo() { + static wxToolkitInfo vInfo; ULONG ulSysInfo[QSV_MAX] = {0}; APIRET ulrc; + vInfo.name = _T("wxBase"); ulrc = ::DosQuerySysInfo( 1L ,QSV_MAX ,(PVOID)ulSysInfo @@ -359,14 +358,13 @@ int wxGUIAppTraits::GetOSVersion( ); if (ulrc == 0L) { - *pMajorVsn = ulSysInfo[QSV_VERSION_MAJOR]; - *pMajorVsn = *pMajorVsn/10; - *pMinorVsn = ulSysInfo[QSV_VERSION_MINOR]; - return wxWINDOWS_OS2; + vInfo.versionMajor = ulSysInfo[QSV_VERSION_MAJOR] / 10; + vInfo.versionMinor = ulSysInfo[QSV_VERSION_MINOR]; } - return wxWINDOWS; // error if we get here, return generic value + vInfo.os = wxOS2_PM; + return vInfo; } -#endif + // --------------------------------------------------------------------------- const wxChar* wxGetHomeDir( wxString* pStr @@ -501,3 +499,12 @@ wxString WXDLLEXPORT wxPMErrorToStr( } return(sError); } // end of wxPMErrorToStr + +// replacement for implementation in unix/utilsunx.cpp, +// to be used by all X11 based ports. +struct wxEndProcessData; + +void wxHandleProcessTermination(wxEndProcessData *proc_data) +{ + // For now, just do nothing. To be filled in as needed. +} diff --git a/src/os2/utilsgui.cpp b/src/os2/utilsgui.cpp index 492cfa2e61..f77d16db2c 100644 --- a/src/os2/utilsgui.cpp +++ b/src/os2/utilsgui.cpp @@ -470,6 +470,32 @@ void wxClientDisplayRect(int *x, int *y, int *width, int *height) wxDisplaySize(width, height); } +wxToolkitInfo & wxGUIAppTraits::GetToolkitInfo() +{ + static wxToolkitInfo vInfo; + ULONG ulSysInfo[QSV_MAX] = {0}; + APIRET ulrc; + + vInfo.shortName = _T("PM"); + vInfo.name = _T("wxOS2"); +#ifdef __WXUNIVERSAL__ + vInfo.shortName << _T("univ"); + vInfo.name << _T("/wxUniversal"); +#endif + ulrc = ::DosQuerySysInfo( 1L + ,QSV_MAX + ,(PVOID)ulSysInfo + ,sizeof(ULONG) * QSV_MAX + ); + if (ulrc == 0L) + { + vInfo.versionMajor = ulSysInfo[QSV_VERSION_MAJOR] / 10; + vInfo.versionMinor = ulSysInfo[QSV_VERSION_MINOR]; + } + vInfo.os = wxOS2_PM; + return vInfo; +} + // --------------------------------------------------------------------------- // window information functions // --------------------------------------------------------------------------- -- 2.45.2