X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a24db82d6879160a2e31e8f87ffe18037998eb45..43ff861df48f0837dac98005dd397c5f127ca136:/include/wx/platinfo.h?ds=sidebyside diff --git a/include/wx/platinfo.h b/include/wx/platinfo.h index 2065e01a7f..b58fb3ac64 100644 --- a/include/wx/platinfo.h +++ b/include/wx/platinfo.h @@ -6,7 +6,7 @@ // Created: 07.07.2006 (based on wxToolkitInfo) // RCS-ID: $Id$ // Copyright: (c) 2006 Francesco Montorsi -// License: wxWindows license +// Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// #ifndef _WX_PLATINFO_H_ @@ -15,7 +15,7 @@ #include "wx/string.h" // ---------------------------------------------------------------------------- -// wxPlatformInfo +// wxPlatformInfo enums & structs // ---------------------------------------------------------------------------- // VERY IMPORTANT: when changing these enum values, also change the relative @@ -58,7 +58,11 @@ enum wxOperatingSystemId // 1<<13 and 1<<14 available for other Unix flavours wxOS_DOS = 1 << 15, // Microsoft DOS - wxOS_OS2 = 1 << 16 // OS/2 + wxOS_OS2 = 1 << 16, // OS/2 + + wxOS_PALM_OS = 1 << 17, // Pure Palm OS + wxOS_PALM_LINUX = 1 << 18, // Palm over linux + wxOS_PALM = wxOS_PALM_OS | wxOS_PALM_LINUX }; // list of wxWidgets ports - some of them can be used with more than @@ -76,7 +80,8 @@ enum wxPortId wxPORT_X11 = 1 << 5, // wxX11, using wxUniversal wxPORT_PM = 1 << 6, // wxOS2, using OS/2 Presentation Manager wxPORT_OS2 = wxPORT_PM, // wxOS2, using OS/2 Presentation Manager - wxPORT_MAC = 1 << 7, // wxMac, using Carbon or Classic Mac API + wxPORT_MAC = 1 << 7, // wxOSX (former wxMac), using Cocoa, Carbon or iPhone API + wxPORT_OSX = wxPORT_MAC, // wxOSX, using Cocoa, Carbon or iPhone API wxPORT_COCOA = 1 << 8, // wxCocoa, using Cocoa NextStep/Mac API wxPORT_WINCE = 1 << 9, // wxWinCE, toolkit is WinCE SDK API wxPORT_PALMOS = 1 << 10, // wxPalmOS, toolkit is PalmOS API @@ -109,6 +114,31 @@ enum wxEndianness wxENDIAN_MAX }; +// informations about a linux distro returned by the lsb_release utility +struct wxLinuxDistributionInfo +{ + wxString Id; + wxString Release; + wxString CodeName; + wxString Description; + + bool operator==(const wxLinuxDistributionInfo& ldi) const + { + return Id == ldi.Id && + Release == ldi.Release && + CodeName == ldi.CodeName && + Description == ldi.Description; + } + + bool operator!=(const wxLinuxDistributionInfo& ldi) const + { return !(*this == ldi); } +}; + + +// ---------------------------------------------------------------------------- +// wxPlatformInfo +// ---------------------------------------------------------------------------- + // Information about the toolkit that the app is running under and some basic // platform and architecture info class WXDLLIMPEXP_BASE wxPlatformInfo @@ -130,6 +160,11 @@ public: bool operator!=(const wxPlatformInfo &t) const { return !(*this == t); } + // Gets a wxPlatformInfo already initialized with the values for + // the currently running platform. + static const wxPlatformInfo& Get(); + + // string -> enum conversions // --------------------------------- @@ -151,6 +186,7 @@ public: static wxString GetArchName(wxArchitecture arch); static wxString GetEndiannessName(wxEndianness end); + // getters // ----------------- @@ -186,6 +222,8 @@ public: wxOperatingSystemId GetOperatingSystemId() const { return m_os; } + wxLinuxDistributionInfo GetLinuxDistributionInfo() const + { return m_ldi; } wxPortId GetPortId() const { return m_port; } wxArchitecture GetArchitecture() const @@ -209,6 +247,16 @@ public: { return GetArchName(m_arch); } wxString GetEndiannessName() const { return GetEndiannessName(m_endian); } + wxString GetOperatingSystemDescription() const + { return m_osDesc; } + wxString GetDesktopEnvironment() const + { return m_desktopEnv; } + + static wxString GetOperatingSystemDirectory(); + // doesn't make sense to store inside wxPlatformInfo the OS directory, + // thus this function is static; note that this function simply calls + // wxGetOSDirectory() and is here just to make it easier for the user to + // find it that feature (global functions can be difficult to find in the docs) // setters // ----------------- @@ -220,6 +268,8 @@ public: void SetOperatingSystemId(wxOperatingSystemId n) { m_os = n; } + void SetOperatingSystemDescription(const wxString& desc) + { m_osDesc = desc; } void SetPortId(wxPortId n) { m_port = n; } void SetArchitecture(wxArchitecture n) @@ -227,6 +277,12 @@ public: void SetEndianness(wxEndianness n) { m_endian = n; } + void SetDesktopEnvironment(const wxString& de) + { m_desktopEnv = de; } + void SetLinuxDistributionInfo(const wxLinuxDistributionInfo& di) + { m_ldi = di; } + + // miscellaneous // ----------------- @@ -234,9 +290,13 @@ public: { return m_osVersionMajor != -1 && m_osVersionMinor != -1 && m_os != wxOS_UNKNOWN && + !m_osDesc.IsEmpty() && m_tkVersionMajor != -1 && m_tkVersionMinor != -1 && m_port != wxPORT_UNKNOWN && - m_arch != wxARCH_INVALID && m_endian != wxENDIAN_INVALID; + m_arch != wxARCH_INVALID && + m_endian != wxENDIAN_INVALID; + + // do not check linux-specific info; it's ok to have them empty } @@ -246,6 +306,9 @@ protected: return majorCur > major || (majorCur == major && minorCur >= minor); } + void InitForCurrentPlatform(); + + // OS stuff // ----------------- @@ -257,6 +320,16 @@ protected: // Operating system ID. wxOperatingSystemId m_os; + // Operating system description. + wxString m_osDesc; + + + // linux-specific + // ----------------- + + wxString m_desktopEnv; + wxLinuxDistributionInfo m_ldi; + // toolkit // ----------------- @@ -275,7 +348,7 @@ protected: // others // ----------------- - // architecture of the OS + // architecture of the OS/machine wxArchitecture m_arch; // endianness of the machine