Merge support for OS and toolkit micro versions

Closes https://github.com/wxWidgets/wxWidgets/pull/234
This commit is contained in:
Vadim Zeitlin
2016-03-03 23:32:44 +01:00
21 changed files with 230 additions and 94 deletions

View File

@@ -100,8 +100,8 @@ public:
/**
Returns the wxWidgets port ID used by the running program and eventually
fills the given pointers with the values of the major and minor digits
of the native toolkit currently used.
fills the given pointers with the values of the major, minor, and micro
digits of the native toolkit currently used.
The version numbers returned are thus detected at run-time and not compile-time
(except when this is not possible e.g. wxMotif).
@@ -109,8 +109,12 @@ public:
E.g. if your program is using wxGTK port this function will return wxPORT_GTK
and put in given pointers the versions of the GTK library in use.
See wxPlatformInfo for more details.
If a micro version is not available it will have a value of 0.
*/
virtual wxPortId GetToolkitVersion(int* major = NULL, int* minor = NULL) const = 0;
virtual wxPortId GetToolkitVersion(int* major = NULL,
int* minor = NULL,
int* micro = NULL) const = 0;
/**
Returns @true if @c fprintf(stderr) goes somewhere, @false otherwise.

View File

@@ -12,11 +12,11 @@
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. @c wxOS_MAC and @c wxOS_UNIX.
Note that you can obtain more detailed information about the current OS
version in use by checking the major and minor version numbers returned
by ::wxGetOsVersion() or by wxPlatformInfo::GetOSMajorVersion(),
wxPlatformInfo::GetOSMinorVersion().
version in use by checking the major, minor, and micro version numbers
returned by ::wxGetOsVersion() or by wxPlatformInfo::GetOSMajorVersion(),
wxPlatformInfo::GetOSMinorVersion(), and wxPlatformInfo::GetOSMicroVersion().
*/
enum wxOperatingSystemId
{
@@ -177,21 +177,20 @@ public:
/**
Returns @true if the OS version is at least @c major.minor.
Returns @true if the OS version is at least @c major.minor.micro.
@see GetOSMajorVersion(), GetOSMinorVersion(),
@see GetOSMajorVersion(), GetOSMinorVersion(), GetOSMicroVersion(),
CheckToolkitVersion()
*/
bool CheckOSVersion(int major, int minor) const;
bool CheckOSVersion(int major, int minor, int micro = 0) const;
/**
Returns @true if the toolkit version is at least @c major.minor.
Returns @true if the toolkit version is at least @c major.minor.micro.
@see GetToolkitMajorVersion(),
GetToolkitMinorVersion(), CheckOSVersion()
@see GetToolkitMajorVersion(), GetToolkitMinorVersion(),
GetToolkitMicroVersion(), CheckOSVersion()
*/
bool CheckToolkitVersion(int major, int minor) const;
bool CheckToolkitVersion(int major, int minor, int micro = 0) const;
/**
Returns @true if this instance is fully initialized with valid values.
@@ -348,6 +347,16 @@ public:
*/
int GetOSMinorVersion() const;
/**
Returns the run-time micro version of the OS associated with this
wxPlatformInfo instance.
@see ::wxGetOsVersion(), CheckOSVersion()
@since 3.1.1
*/
int GetOSMicroVersion() const;
/**
Returns the operating system ID of this wxPlatformInfo instance.
@@ -406,7 +415,22 @@ public:
@see CheckToolkitVersion()
*/
int GetToolkitMinorVersion() const;
/**
Returns the run-time micro version of the toolkit associated with this
wxPlatformInfo instance.
Note that if GetPortId() returns @c wxPORT_BASE, then this value is zero
(unless externally modified with SetToolkitVersion()); that is, no native
toolkit is in use.
See wxAppTraits::GetToolkitVersion() for more info.
@see CheckToolkitVersion()
@since 3.1.1
*/
int GetToolkitMicroVersion() const;
//@}
@@ -472,7 +496,7 @@ public:
Sets the version of the operating system associated with this wxPlatformInfo
instance.
*/
void SetOSVersion(int major, int minor);
void SetOSVersion(int major, int minor, int micro = 0);
/**
Sets the operating system associated with this wxPlatformInfo instance.
@@ -487,7 +511,7 @@ public:
/**
Sets the version of the toolkit associated with this wxPlatformInfo instance.
*/
void SetToolkitVersion(int major, int minor);
void SetToolkitVersion(int major, int minor, int micro = 0);
/**
Sets the operating system description associated with this wxPlatformInfo instance.

View File

@@ -842,16 +842,23 @@ wxString wxGetOsDescription();
/**
Gets the version and the operating system ID for currently running OS.
The returned wxOperatingSystemId value can be used for a basic categorization
of the OS family; the major and minor version numbers allows to detect a specific
system.
For Unix-like systems (@c wxOS_UNIX) the major and minor version integers will
contain the kernel major and minor version numbers (as returned by the
'uname -r' command); e.g. "4" and "1" if the machine is using kernel 4.1.4.
of the OS family; the major, minor, and micro version numbers allows to
detect a specific system.
If on Unix-like systems the version can't be detected all three version
numbers will have a value of -1.
On systems where only the micro version can't be detected or doesn't make
sense such as Windows, it will have a value of 0.
For Unix-like systems (@c wxOS_UNIX) the major, minor, and micro version
integers will contain the kernel's major, minor, and micro version
numbers (as returned by the 'uname -r' command); e.g. "4", "1", and "4" if
the machine is using kernel 4.1.4.
For OS X systems (@c wxOS_MAC) the major and minor version integers are the
natural version numbers associated with the OS; e.g. "10" and "11" if the machine
is using OS X El Capitan.
natural version numbers associated with the OS; e.g. "10", "11" and "2" if
the machine is using OS X El Capitan 10.11.2.
For Windows-like systems (@c wxOS_WINDOWS) the major and minor version integers will
contain the following values:
@@ -878,7 +885,7 @@ wxString wxGetOsDescription();
@header{wx/utils.h}
*/
wxOperatingSystemId wxGetOsVersion(int* major = NULL, int* minor = NULL);
wxOperatingSystemId wxGetOsVersion(int* major = NULL, int* minor = NULL, int* micro = NULL);
/**
Returns @true if the version of the operating system on which the program
@@ -890,7 +897,7 @@ wxOperatingSystemId wxGetOsVersion(int* major = NULL, int* minor = NULL);
@header{wx/utils.h}
*/
bool wxCheckOsVersion(int majorVsn, int minorVsn = 0);
bool wxCheckOsVersion(int majorVsn, int minorVsn = 0, int microVsn = 0);
/**
Returns @true if the operating system the program is running under is 64