]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/platinfo.h
added macros to avoid code repetition when defining comparison operators; use them...
[wxWidgets.git] / include / wx / platinfo.h
index f094a4ce30657632ce11f48f12be7dd0e62dfd1c..809a3146735668bd5a9330f419ae0fb0bc6cf740 100644 (file)
@@ -130,6 +130,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
     // ---------------------------------
@@ -159,11 +164,28 @@ public:
     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; }
 
+    bool CheckToolkitVersion(int major, int minor) const
+    {
+        return DoCheckVersion(GetToolkitMajorVersion(),
+                              GetToolkitMinorVersion(),
+                              major,
+                              minor);
+    }
+
     bool IsUsingUniversalWidgets() const
         { return m_usingUniversal; }
 
@@ -202,13 +224,13 @@ public:
         { m_tkVersionMajor=major; m_tkVersionMinor=minor; }
 
     void SetOperatingSystemId(wxOperatingSystemId n)
-        { m_os=n; }
+        { m_os = n; }
     void SetPortId(wxPortId n)
-        { m_port=n; }
+        { m_port = n; }
     void SetArchitecture(wxArchitecture n)
-        { m_arch=n; }
+        { m_arch = n; }
     void SetEndianness(wxEndianness n)
-        { m_endian=n; }
+        { m_endian = n; }
 
     // miscellaneous
     // -----------------
@@ -224,12 +246,21 @@ public:
 
 
 protected:
+    static bool DoCheckVersion(int majorCur, int minorCur, int major, int minor)
+    {
+        return majorCur > major || (majorCur == major && minorCur >= minor);
+    }
+
+    void InitForCurrentPlatform();
+
+
     // 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;