Merge support for OS and toolkit micro versions
Closes https://github.com/wxWidgets/wxWidgets/pull/234
This commit is contained in:
@@ -130,7 +130,9 @@ public:
|
||||
// runtime (not compile-time) version.
|
||||
// returns wxPORT_BASE for console applications and one of the remaining
|
||||
// wxPORT_* values for GUI applications.
|
||||
virtual wxPortId GetToolkitVersion(int *majVer = NULL, int *minVer = NULL) const = 0;
|
||||
virtual wxPortId GetToolkitVersion(int *majVer = NULL,
|
||||
int *minVer = NULL,
|
||||
int *microVer = NULL) const = 0;
|
||||
|
||||
// return true if the port is using wxUniversal for the GUI, false if not
|
||||
virtual bool IsUsingUniversalWidgets() const = 0;
|
||||
@@ -209,13 +211,16 @@ public:
|
||||
virtual bool HasStderr() wxOVERRIDE;
|
||||
|
||||
// the GetToolkitVersion for console application is always the same
|
||||
virtual wxPortId GetToolkitVersion(int *verMaj = NULL, int *verMin = NULL) const wxOVERRIDE
|
||||
wxPortId GetToolkitVersion(int *verMaj = NULL,
|
||||
int *verMin = NULL,
|
||||
int *verMicro = NULL) const wxOVERRIDE
|
||||
{
|
||||
// no toolkits (wxBase is for console applications without GUI support)
|
||||
// NB: zero means "no toolkit", -1 means "not initialized yet"
|
||||
// so we must use zero here!
|
||||
if (verMaj) *verMaj = 0;
|
||||
if (verMin) *verMin = 0;
|
||||
if (verMicro) *verMicro = 0;
|
||||
return wxPORT_BASE;
|
||||
}
|
||||
|
||||
|
@@ -49,7 +49,9 @@ public:
|
||||
virtual bool DoMessageFromThreadWait();
|
||||
virtual WXDWORD WaitForThread(WXHANDLE hThread, int flags);
|
||||
#endif // wxUSE_THREADS
|
||||
virtual wxPortId GetToolkitVersion(int *majVer = NULL, int *minVer = NULL) const;
|
||||
wxPortId GetToolkitVersion(int *majVer = NULL,
|
||||
int *minVer = NULL,
|
||||
int *microVer = NULL) const wxOVERRIDE;
|
||||
|
||||
virtual bool CanUseStderr();
|
||||
virtual bool WriteToStderr(const wxString& text);
|
||||
@@ -77,7 +79,9 @@ public:
|
||||
virtual WXDWORD WaitForThread(WXHANDLE hThread, int WXUNUSED(flags))
|
||||
{ return DoSimpleWaitForThread(hThread); }
|
||||
#endif // wxUSE_THREADS
|
||||
virtual wxPortId GetToolkitVersion(int *majVer = NULL, int *minVer = NULL) const;
|
||||
virtual wxPortId GetToolkitVersion(int *majVer = NULL,
|
||||
int *minVer = NULL,
|
||||
int *microVer = NULL) const;
|
||||
|
||||
virtual bool CanUseStderr() { return false; }
|
||||
virtual bool WriteToStderr(const wxString& WXUNUSED(text)) { return false; }
|
||||
|
@@ -188,21 +188,27 @@ public:
|
||||
{ return m_osVersionMajor; }
|
||||
int GetOSMinorVersion() const
|
||||
{ return m_osVersionMinor; }
|
||||
int GetOSMicroVersion() const
|
||||
{ return m_osVersionMicro; }
|
||||
|
||||
// return true if the OS version >= major.minor
|
||||
bool CheckOSVersion(int major, int minor) const;
|
||||
bool CheckOSVersion(int major, int minor, int micro = 0) const;
|
||||
|
||||
int GetToolkitMajorVersion() const
|
||||
{ return m_tkVersionMajor; }
|
||||
int GetToolkitMinorVersion() const
|
||||
{ return m_tkVersionMinor; }
|
||||
int GetToolkitMicroVersion() const
|
||||
{ return m_tkVersionMicro; }
|
||||
|
||||
bool CheckToolkitVersion(int major, int minor) const
|
||||
bool CheckToolkitVersion(int major, int minor, int micro = 0) const
|
||||
{
|
||||
return DoCheckVersion(GetToolkitMajorVersion(),
|
||||
GetToolkitMinorVersion(),
|
||||
GetToolkitMicroVersion(),
|
||||
major,
|
||||
minor);
|
||||
minor,
|
||||
micro);
|
||||
}
|
||||
|
||||
bool IsUsingUniversalWidgets() const
|
||||
@@ -249,10 +255,19 @@ public:
|
||||
// setters
|
||||
// -----------------
|
||||
|
||||
void SetOSVersion(int major, int minor)
|
||||
{ m_osVersionMajor=major; m_osVersionMinor=minor; }
|
||||
void SetToolkitVersion(int major, int minor)
|
||||
{ m_tkVersionMajor=major; m_tkVersionMinor=minor; }
|
||||
void SetOSVersion(int major, int minor, int micro = 0)
|
||||
{
|
||||
m_osVersionMajor = major;
|
||||
m_osVersionMinor = minor;
|
||||
m_osVersionMicro = micro;
|
||||
}
|
||||
|
||||
void SetToolkitVersion(int major, int minor, int micro = 0)
|
||||
{
|
||||
m_tkVersionMajor = major;
|
||||
m_tkVersionMinor = minor;
|
||||
m_tkVersionMicro = micro;
|
||||
}
|
||||
|
||||
void SetOperatingSystemId(wxOperatingSystemId n)
|
||||
{ m_os = n; }
|
||||
@@ -277,9 +292,11 @@ public:
|
||||
bool IsOk() const
|
||||
{
|
||||
return m_osVersionMajor != -1 && m_osVersionMinor != -1 &&
|
||||
m_osVersionMicro != -1 &&
|
||||
m_os != wxOS_UNKNOWN &&
|
||||
!m_osDesc.IsEmpty() &&
|
||||
m_tkVersionMajor != -1 && m_tkVersionMinor != -1 &&
|
||||
m_tkVersionMicro != -1 &&
|
||||
m_port != wxPORT_UNKNOWN &&
|
||||
m_arch != wxARCH_INVALID &&
|
||||
m_endian != wxENDIAN_INVALID;
|
||||
@@ -289,9 +306,12 @@ public:
|
||||
|
||||
|
||||
protected:
|
||||
static bool DoCheckVersion(int majorCur, int minorCur, int major, int minor)
|
||||
static bool DoCheckVersion(int majorCur, int minorCur, int microCur,
|
||||
int major, int minor, int micro)
|
||||
{
|
||||
return majorCur > major || (majorCur == major && minorCur >= minor);
|
||||
return majorCur > major
|
||||
|| (majorCur == major && minorCur > minor)
|
||||
|| (majorCur == major && minorCur == minor && microCur >= micro);
|
||||
}
|
||||
|
||||
bool m_initializedForCurrentPlatform;
|
||||
@@ -305,7 +325,8 @@ protected:
|
||||
// Version of the OS; valid if m_os != wxOS_UNKNOWN
|
||||
// (-1 means not initialized yet).
|
||||
int m_osVersionMajor,
|
||||
m_osVersionMinor;
|
||||
m_osVersionMinor,
|
||||
m_osVersionMicro;
|
||||
|
||||
// Operating system ID.
|
||||
wxOperatingSystemId m_os;
|
||||
@@ -326,7 +347,7 @@ protected:
|
||||
|
||||
// Version of the underlying toolkit
|
||||
// (-1 means not initialized yet; zero means no toolkit).
|
||||
int m_tkVersionMajor, m_tkVersionMinor;
|
||||
int m_tkVersionMajor, m_tkVersionMinor, m_tkVersionMicro;
|
||||
|
||||
// name of the wxWidgets port
|
||||
wxPortId m_port;
|
||||
|
@@ -61,7 +61,9 @@ public:
|
||||
#if defined(__WXMAC__) && wxUSE_STDPATHS
|
||||
virtual wxStandardPaths& GetStandardPaths() wxOVERRIDE;
|
||||
#endif
|
||||
virtual wxPortId GetToolkitVersion(int *majVer = NULL, int *minVer = NULL) const wxOVERRIDE;
|
||||
wxPortId GetToolkitVersion(int *majVer = NULL,
|
||||
int *minVer = NULL,
|
||||
int *microVer = NULL) const wxOVERRIDE;
|
||||
|
||||
#ifdef __WXGTK20__
|
||||
virtual wxString GetDesktopEnvironment() const wxOVERRIDE;
|
||||
|
@@ -140,11 +140,12 @@ WXDLLIMPEXP_CORE wxVersionInfo wxGetLibraryVersionInfo();
|
||||
WXDLLIMPEXP_BASE wxString wxGetOsDescription();
|
||||
|
||||
// Get OS version
|
||||
WXDLLIMPEXP_BASE wxOperatingSystemId wxGetOsVersion(int *majorVsn = NULL,
|
||||
int *minorVsn = NULL);
|
||||
WXDLLIMPEXP_BASE wxOperatingSystemId wxGetOsVersion(int *verMaj = NULL,
|
||||
int *verMin = NULL,
|
||||
int *verMicro = NULL);
|
||||
|
||||
// Check is OS version is at least the specified major and minor version
|
||||
WXDLLIMPEXP_BASE bool wxCheckOsVersion(int majorVsn, int minorVsn = 0);
|
||||
WXDLLIMPEXP_BASE bool wxCheckOsVersion(int majorVsn, int minorVsn = 0, int microVsn = 0);
|
||||
|
||||
// Get platform endianness
|
||||
WXDLLIMPEXP_BASE bool wxIsPlatformLittleEndian();
|
||||
|
Reference in New Issue
Block a user