X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3b36f093d9f130c3e869611be2fcf13a290d62b9..7344108e8a129a3f9b4df5ab0f98a1713db03b89:/interface/wx/platinfo.h diff --git a/interface/wx/platinfo.h b/interface/wx/platinfo.h index 88b6a68d86..e586b84b04 100644 --- a/interface/wx/platinfo.h +++ b/interface/wx/platinfo.h @@ -3,7 +3,7 @@ // Purpose: interface of wxPlatformInfo // Author: wxWidgets team // RCS-ID: $Id$ -// Licence: wxWindows license +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -12,7 +12,12 @@ whose version can be detected at run-time. The values of the constants are chosen so that they can be combined as flags; - this allows to check for operating system families like e.g. wxOS_MAC and wxOS_UNIX. + this allows to check for operating system families like e.g. @c wxOS_MAC and @c wxOS_UNIX. + + Note that you can obtain more detailed informations about the current OS + version in use by checking the major and minor version numbers returned + by ::wxGetOsVersion() or by wxPlatformInfo::GetOSMajorVersion(), + wxPlatformInfo::GetOSMinorVersion(). */ enum wxOperatingSystemId { @@ -20,12 +25,16 @@ enum wxOperatingSystemId wxOS_MAC_OS = 1 << 0, //!< Apple Mac OS 8/9/X with Mac paths wxOS_MAC_OSX_DARWIN = 1 << 1, //!< Apple Mac OS X with Unix paths + + //! A combination of all @c wxOS_MAC_* values previously listed. wxOS_MAC = wxOS_MAC_OS|wxOS_MAC_OSX_DARWIN, wxOS_WINDOWS_9X = 1 << 2, //!< Windows 9x family (95/98/ME) - wxOS_WINDOWS_NT = 1 << 3, //!< Windows NT family (NT/2000/XP) + wxOS_WINDOWS_NT = 1 << 3, //!< Windows NT family (NT/2000/XP/Vista/7) wxOS_WINDOWS_MICRO = 1 << 4, //!< MicroWindows wxOS_WINDOWS_CE = 1 << 5, //!< Windows CE (Window Mobile) + + //! A combination of all @c wxOS_WINDOWS_* values previously listed. wxOS_WINDOWS = wxOS_WINDOWS_9X | wxOS_WINDOWS_NT | wxOS_WINDOWS_MICRO | @@ -38,6 +47,8 @@ enum wxOperatingSystemId wxOS_UNIX_SOLARIS = 1 << 10, //!< SunOS wxOS_UNIX_AIX = 1 << 11, //!< AIX wxOS_UNIX_HPUX = 1 << 12, //!< HP/UX + + //! A combination of all @c wxOS_UNIX_* values previously listed. wxOS_UNIX = wxOS_UNIX_LINUX | wxOS_UNIX_FREEBSD | wxOS_UNIX_OPENBSD | @@ -66,20 +77,18 @@ enum wxPortId wxPORT_MSW = 1 << 1, //!< wxMSW, native toolkit is Windows API wxPORT_MOTIF = 1 << 2, //!< wxMotif, using [Open]Motif or Lesstif wxPORT_GTK = 1 << 3, //!< wxGTK, using GTK+ 1.x, 2.x, GPE or Maemo - wxPORT_MGL = 1 << 4, //!< wxMGL, using wxUniversal + wxPORT_DFB = 1 << 4, //!< wxDFB, using wxUniversal wxPORT_X11 = 1 << 5, //!< wxX11, using wxUniversal wxPORT_OS2 = 1 << 6, //!< wxOS2, using OS/2 Presentation Manager wxPORT_MAC = 1 << 7, //!< wxMac, using Carbon or Classic Mac 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 - wxPORT_DFB = 1 << 11 //!< wxDFB, using wxUniversal + wxPORT_WINCE = 1 << 9 //!< wxWinCE, toolkit is WinCE SDK API }; /** The architecture of the operating system - (regardless of the build environment of wxWidgets library - see ::wxIsPlatform64bit() + (regardless of the build environment of wxWidgets library - see ::wxIsPlatform64Bit() documentation for more info). */ enum wxArchitecture @@ -107,6 +116,24 @@ enum wxEndianness wxENDIAN_MAX }; +/** + A structure containing informations about a Linux distribution as returned + by the @c lsb_release utility. + + See wxGetLinuxDistributionInfo() or wxPlatformInfo::GetLinuxDistributionInfo() + for more info. +*/ +struct wxLinuxDistributionInfo +{ + wxString Id; //!< The id of the distribution; e.g. "Ubuntu" + wxString Release; //!< The version of the distribution; e.g. "9.04" + wxString CodeName; //!< The code name of the distribution; e.g. "jaunty" + wxString Description; //!< The description of the distribution; e.g. "Ubuntu 9.04" + + bool operator==(const wxLinuxDistributionInfo& ldi) const; + bool operator!=(const wxLinuxDistributionInfo& ldi) const; +}; + /** @class wxPlatformInfo @@ -117,8 +144,16 @@ enum wxEndianness This class does not only have @e getters for the informations above, it also has @e setters. This allows you to e.g. save the current platform informations in a data file (maybe in string form) so that when you later load it, you can easily - retrieve (see the static getters for string->enum conversion functions) the - signature of the system which generated it. + retrieve (see the static getters for string->enum conversion functions) and store + inside a wxPlatformInfo instance (using its setters) the signature of the system + which generated it. + + In general however you only need to use the static Get() function and then + access the various informations for the current platform: + @code + wxLogMessage("This application is running under %s.", + wxPlatformInfo::Get().GetOperatingSystemIdName()); + @endcode @library{wxbase} @category{cfg} @@ -126,7 +161,7 @@ enum wxEndianness @see ::wxGetOsVersion(), wxIsPlatformLittleEndian(), wxIsPlatform64Bit(), wxAppTraits, @ref group_funcmacro_networkuseros */ -class wxPlatformInfo : public wxObject +class wxPlatformInfo { public: @@ -144,7 +179,7 @@ public: /** Initializes the object using given values. */ - wxPlatformInfo(wxPortId pid = wxPORT_UNKNOWN, + wxPlatformInfo(wxPortId pid, int tkMajor = -1, int tkMinor = -1, wxOperatingSystemId id = wxOS_UNKNOWN, @@ -285,6 +320,13 @@ public: static wxString GetPortIdShortName(wxPortId port, bool usingUniversal); + /** + Returns the operating system directory. + + See wxGetOSDirectory() for more info. + */ + static wxString GetOperatingSystemDirectory(); + //@} @@ -321,13 +363,36 @@ public: /** Returns the operating system ID of this wxPlatformInfo instance. + + See wxGetOsVersion() for more info. */ wxOperatingSystemId GetOperatingSystemId() const; + + /** + Returns the description of the operating system of this wxPlatformInfo instance. + + See wxGetOSDescription() for more info. + */ + wxString GetOperatingSystemDescription() const; /** Returns the wxWidgets port ID associated with this wxPlatformInfo instance. */ wxPortId GetPortId() const; + + /** + Returns the Linux distribution info associated with this wxPlatformInfo instance. + + See wxGetLinuxDistributionInfo() for more info. + */ + wxLinuxDistributionInfo GetLinuxDistributionInfo() const; + + /** + Returns the desktop environment associated with this wxPlatformInfo instance. + + See wxAppTraits::GetDesktopEnvironment() for more info. + */ + wxString GetDesktopEnvironment() const; /** Returns the run-time major version of the toolkit associated with this @@ -436,8 +501,22 @@ public: Sets the version of the toolkit associated with this wxPlatformInfo instance. */ void SetToolkitVersion(int major, int minor); + + /** + Sets the operating system description associated with this wxPlatformInfo instance. + */ + void SetOperatingSystemDescription(const wxString& desc); + + /** + Sets the desktop environment associated with this wxPlatformInfo instance. + */ + void SetDesktopEnvironment(const wxString& de); - //@} + /** + Sets the linux distribution info associated with this wxPlatformInfo instance. + */ + void SetLinuxDistributionInfo(const wxLinuxDistributionInfo& di); + //@} };