]> git.saurik.com Git - wxWidgets.git/commitdiff
added CheckOS/ToolkitVersion()
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 16 Sep 2006 00:38:36 +0000 (00:38 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 16 Sep 2006 00:38:36 +0000 (00:38 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41243 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/latex/wx/platinfo.tex
include/wx/platinfo.h

index 1d0e09a74d1c15519b21cc4d58c43812d5259c94..b1223be50bbe91b3660f0da91e004a290082ca72 100644 (file)
@@ -142,6 +142,32 @@ Initializes the object using given values.
 
 
 
 
 
 
+\membersection{wxPlatformInfo::CheckOSVersion}\label{wxplatforminfocheckosversion}
+
+\constfunc{bool}{CheckOSVersion}{\param{int major}, \param{int minor}}
+
+Returns \true if the OS version is at least \texttt{major.minor}.
+
+\wxheading{See also}
+
+\helpref{GetOSMajorVersion}{wxplatforminfogetosmajorversion},
+\helpref{GetOSMinorVersion}{wxplatforminfogetosminorversion},
+\helpref{CheckToolkitVersion}{wxplatforminfochecktoolkitversion}
+
+
+\membersection{wxPlatformInfo::CheckToolkitVersion}\label{wxplatforminfochecktoolkitversion}
+
+\constfunc{bool}{CheckToolkitVersion}{\param{int major}, \param{int minor}}
+
+Returns \true if the toolkit version is at least \texttt{major.minor}.
+
+\wxheading{See also}
+
+\helpref{GetToolkitMajorVersion}{wxplatforminfogettoolkitmajorversion},
+\helpref{GetToolkitMinorVersion}{wxplatforminfogettoolkitminorversion},
+\helpref{CheckOSVersion}{wxplatforminfocheckosversion}
+
+
 
 \membersection{wxPlatformInfo::GetArch}\label{wxplatforminfogetarch}
 
 
 \membersection{wxPlatformInfo::GetArch}\label{wxplatforminfogetarch}
 
@@ -204,12 +230,18 @@ Returns the name for the endianness of this wxPlatformInfo instance.
 
 Returns the major version of the OS associated with this wxPlatformInfo instance.
 
 
 Returns the major version of the OS associated with this wxPlatformInfo instance.
 
+\wxheading{See also}
+
+\helpref{CheckOSVersion}{wxplatforminfocheckosversion}
+
+
 \membersection{wxPlatformInfo::GetOSMinorVersion}\label{wxplatforminfogetosminorversion}
 
 \constfunc{int}{GetOSMinorVersion}{\void}
 
 Returns the minor version of the OS associated with this wxPlatformInfo instance.
 
 \membersection{wxPlatformInfo::GetOSMinorVersion}\label{wxplatforminfogetosminorversion}
 
 \constfunc{int}{GetOSMinorVersion}{\void}
 
 Returns the minor version of the OS associated with this wxPlatformInfo instance.
 
+\helpref{CheckOSVersion}{wxplatforminfocheckosversion}
 
 
 
 
 
 
@@ -311,6 +343,11 @@ Returns the short name of the wxWidgets port ID associated with this wxPlatformI
 Returns the major version of the toolkit associated with this wxPlatformInfo instance.
 Note that if {GetPortId}{wxplatforminfogetportid} returns wxPORT\_BASE, then this value is zero (unless externally modified with SetToolkitVersion); that is, no native toolkit is in use.
 
 Returns the major version of the toolkit associated with this wxPlatformInfo instance.
 Note that if {GetPortId}{wxplatforminfogetportid} returns wxPORT\_BASE, then this value is zero (unless externally modified with SetToolkitVersion); that is, no native toolkit is in use.
 
+\wxheading{See also}
+
+\helpref{CheckToolkitVersion}{wxplatforminfochecktoolkitversion}
+
+
 \membersection{wxPlatformInfo::GetToolkitMinorVersion}\label{wxplatforminfogettoolkitminorversion}
 
 \constfunc{int}{GetToolkitMinorVersion}{\void}
 \membersection{wxPlatformInfo::GetToolkitMinorVersion}\label{wxplatforminfogettoolkitminorversion}
 
 \constfunc{int}{GetToolkitMinorVersion}{\void}
@@ -318,6 +355,10 @@ Note that if {GetPortId}{wxplatforminfogetportid} returns wxPORT\_BASE, then thi
 Returns the minor version of the toolkit associated with this wxPlatformInfo instance.
 Note that if {GetPortId}{wxplatforminfogetportid} returns wxPORT\_BASE, then this value is zero (unless externally modified with SetToolkitVersion); that is, no native toolkit is in use.
 
 Returns the minor version of the toolkit associated with this wxPlatformInfo instance.
 Note that if {GetPortId}{wxplatforminfogetportid} returns wxPORT\_BASE, then this value is zero (unless externally modified with SetToolkitVersion); that is, no native toolkit is in use.
 
+\wxheading{See also}
+
+\helpref{CheckToolkitVersion}{wxplatforminfochecktoolkitversion}
+
 
 
 
 
 
 
index f094a4ce30657632ce11f48f12be7dd0e62dfd1c..2065e01a7fc9f452c08788ea0b3a0dbe1c8c7504 100644 (file)
@@ -159,11 +159,28 @@ public:
     int GetOSMinorVersion() const
         { return m_osVersionMinor; }
 
     int GetOSMinorVersion() const
         { return m_osVersionMinor; }
 
+    // return true if the OS version >= major.minor
+    bool CheckOSVersion(int major, int minor) const
+    {
+        return DoCheckVersion(GetOSMajorVersion(),
+                              GetOSMinorVersion(),
+                              major,
+                              minor);
+    }
+
     int GetToolkitMajorVersion() const
         { return m_tkVersionMajor; }
     int GetToolkitMinorVersion() const
         { return m_tkVersionMinor; }
 
     int GetToolkitMajorVersion() const
         { return m_tkVersionMajor; }
     int GetToolkitMinorVersion() const
         { return m_tkVersionMinor; }
 
+    bool CheckToolkitVersion(int major, int minor) const
+    {
+        return DoCheckVersion(GetToolkitMajorVersion(),
+                              GetToolkitMinorVersion(),
+                              major,
+                              minor);
+    }
+
     bool IsUsingUniversalWidgets() const
         { return m_usingUniversal; }
 
     bool IsUsingUniversalWidgets() const
         { return m_usingUniversal; }
 
@@ -202,13 +219,13 @@ public:
         { m_tkVersionMajor=major; m_tkVersionMinor=minor; }
 
     void SetOperatingSystemId(wxOperatingSystemId n)
         { m_tkVersionMajor=major; m_tkVersionMinor=minor; }
 
     void SetOperatingSystemId(wxOperatingSystemId n)
-        { m_os=n; }
+        { m_os = n; }
     void SetPortId(wxPortId n)
     void SetPortId(wxPortId n)
-        { m_port=n; }
+        { m_port = n; }
     void SetArchitecture(wxArchitecture n)
     void SetArchitecture(wxArchitecture n)
-        { m_arch=n; }
+        { m_arch = n; }
     void SetEndianness(wxEndianness n)
     void SetEndianness(wxEndianness n)
-        { m_endian=n; }
+        { m_endian = n; }
 
     // miscellaneous
     // -----------------
 
     // miscellaneous
     // -----------------
@@ -224,12 +241,18 @@ public:
 
 
 protected:
 
 
 protected:
+    static bool DoCheckVersion(int majorCur, int minorCur, int major, int minor)
+    {
+        return majorCur > major || (majorCur == major && minorCur >= minor);
+    }
+
     // OS stuff
     // -----------------
 
     // Version of the OS; valid if m_os != wxOS_UNKNOWN
     // (-1 means not initialized yet).
     // OS stuff
     // -----------------
 
     // Version of the OS; valid if m_os != wxOS_UNKNOWN
     // (-1 means not initialized yet).
-    int m_osVersionMajor, m_osVersionMinor;
+    int m_osVersionMajor,
+        m_osVersionMinor;
 
     // Operating system ID.
     wxOperatingSystemId m_os;
 
     // Operating system ID.
     wxOperatingSystemId m_os;