Add micro version to toolkit version functions
Support micro versions in wxAppTraits::GetToolkitVersion and wxPlatformInfo functions related to toolkit versions.
This commit is contained in:
committed by
Tobias Taschner
parent
ea439c278b
commit
1e78bf639e
@@ -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; }
|
||||
|
@@ -198,15 +198,17 @@ public:
|
||||
{ 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(),
|
||||
0,
|
||||
GetToolkitMicroVersion(),
|
||||
major,
|
||||
minor,
|
||||
0);
|
||||
micro);
|
||||
}
|
||||
|
||||
bool IsUsingUniversalWidgets() const
|
||||
@@ -260,8 +262,12 @@ public:
|
||||
m_osVersionMicro = micro;
|
||||
}
|
||||
|
||||
void SetToolkitVersion(int major, int minor)
|
||||
{ m_tkVersionMajor=major; m_tkVersionMinor=minor; }
|
||||
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; }
|
||||
@@ -290,6 +296,7 @@ public:
|
||||
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;
|
||||
@@ -340,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;
|
||||
|
@@ -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.
|
||||
|
@@ -185,13 +185,12 @@ public:
|
||||
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.
|
||||
@@ -417,6 +416,21 @@ public:
|
||||
*/
|
||||
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;
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
@@ -497,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.
|
||||
|
@@ -139,6 +139,7 @@ wxPlatformInfo::wxPlatformInfo(wxPortId pid, int tkMajor, int tkMinor,
|
||||
|
||||
m_tkVersionMajor = tkMajor;
|
||||
m_tkVersionMinor = tkMinor;
|
||||
m_tkVersionMicro = -1;
|
||||
m_port = pid;
|
||||
m_usingUniversal = usingUniversal;
|
||||
|
||||
@@ -155,6 +156,7 @@ bool wxPlatformInfo::operator==(const wxPlatformInfo &t) const
|
||||
{
|
||||
return m_tkVersionMajor == t.m_tkVersionMajor &&
|
||||
m_tkVersionMinor == t.m_tkVersionMinor &&
|
||||
m_tkVersionMicro == t.m_tkVersionMicro &&
|
||||
m_osVersionMajor == t.m_osVersionMajor &&
|
||||
m_osVersionMinor == t.m_osVersionMinor &&
|
||||
m_osVersionMicro == t.m_osVersionMicro &&
|
||||
@@ -181,11 +183,12 @@ void wxPlatformInfo::InitForCurrentPlatform()
|
||||
m_port = wxPORT_UNKNOWN;
|
||||
m_usingUniversal = false;
|
||||
m_tkVersionMajor =
|
||||
m_tkVersionMinor = 0;
|
||||
m_tkVersionMinor = m_tkVersionMicro = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_port = traits->GetToolkitVersion(&m_tkVersionMajor, &m_tkVersionMinor);
|
||||
m_port = traits->GetToolkitVersion(&m_tkVersionMajor, &m_tkVersionMinor,
|
||||
&m_tkVersionMicro);
|
||||
m_usingUniversal = traits->IsUsingUniversalWidgets();
|
||||
m_desktopEnv = traits->GetDesktopEnvironment();
|
||||
}
|
||||
|
@@ -30,10 +30,13 @@
|
||||
// toolkit info
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxPortId wxGUIAppTraits::GetToolkitVersion(int *verMaj, int *verMin) const
|
||||
wxPortId wxGUIAppTraits::GetToolkitVersion(int *verMaj,
|
||||
int *verMin,
|
||||
int *verMicro) const
|
||||
{
|
||||
if ( verMaj ) *verMaj = DIRECTFB_MAJOR_VERSION;
|
||||
if ( verMin ) *verMaj = DIRECTFB_MINOR_VERSION;
|
||||
if ( verMicro ) *verMicro = DIRECTFB_MICRO_VERSION;
|
||||
|
||||
return wxPORT_DFB;
|
||||
}
|
||||
|
@@ -183,12 +183,16 @@ const gchar *wx_pango_version_check (int major, int minor, int micro)
|
||||
// wxPlatformInfo-related
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxPortId wxGUIAppTraits::GetToolkitVersion(int *verMaj, int *verMin) const
|
||||
wxPortId wxGUIAppTraits::GetToolkitVersion(int *verMaj,
|
||||
int *verMin,
|
||||
int *verMicro) const
|
||||
{
|
||||
if ( verMaj )
|
||||
*verMaj = gtk_major_version;
|
||||
if ( verMin )
|
||||
*verMin = gtk_minor_version;
|
||||
if ( verMicro )
|
||||
*verMicro = gtk_micro_version;
|
||||
|
||||
return wxPORT_GTK;
|
||||
}
|
||||
|
@@ -136,12 +136,16 @@ wxTimerImpl* wxGUIAppTraits::CreateTimerImpl(wxTimer *timer)
|
||||
// wxPlatformInfo-related
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxPortId wxGUIAppTraits::GetToolkitVersion(int *verMaj, int *verMin) const
|
||||
wxPortId wxGUIAppTraits::GetToolkitVersion(int *verMaj,
|
||||
int *verMin,
|
||||
int *verMicro) const
|
||||
{
|
||||
if ( verMaj )
|
||||
*verMaj = gtk_major_version;
|
||||
if ( verMin )
|
||||
*verMin = gtk_minor_version;
|
||||
if ( verMicro )
|
||||
*verMicro = gtk_micro_version;
|
||||
|
||||
return wxPORT_GTK;
|
||||
}
|
||||
|
@@ -176,13 +176,17 @@ void wxBell()
|
||||
XBell (wxGlobalDisplay(), 0);
|
||||
}
|
||||
|
||||
wxPortId wxGUIAppTraits::GetToolkitVersion(int *verMaj, int *verMin) const
|
||||
wxPortId wxGUIAppTraits::GetToolkitVersion(int *verMaj,
|
||||
int *verMin,
|
||||
int *verMicro) const
|
||||
{
|
||||
// XmVERSION and XmREVISION are defined in Xm/Xm.h
|
||||
if ( verMaj )
|
||||
*verMaj = XmVERSION;
|
||||
if ( verMin )
|
||||
*verMin = XmREVISION;
|
||||
if ( verMicro )
|
||||
*verMicro = 0;
|
||||
|
||||
return wxPORT_MOTIF;
|
||||
}
|
||||
|
@@ -238,11 +238,13 @@ WXDWORD wxGUIAppTraits::WaitForThread(WXHANDLE hThread, int flags)
|
||||
}
|
||||
#endif // wxUSE_THREADS
|
||||
|
||||
wxPortId wxGUIAppTraits::GetToolkitVersion(int *majVer, int *minVer) const
|
||||
wxPortId wxGUIAppTraits::GetToolkitVersion(int *majVer,
|
||||
int *minVer,
|
||||
int *microVer) const
|
||||
{
|
||||
// on Windows, the toolkit version is the same of the OS version
|
||||
// as Windows integrates the OS kernel with the GUI toolkit.
|
||||
wxGetOsVersion(majVer, minVer);
|
||||
wxGetOsVersion(majVer, minVer, microVer);
|
||||
|
||||
return wxPORT_MSW;
|
||||
}
|
||||
|
@@ -169,10 +169,12 @@ void wxDisplaySizeMM(int *width, int *height)
|
||||
}
|
||||
|
||||
|
||||
wxPortId wxGUIAppTraits::GetToolkitVersion(int *verMaj, int *verMin) const
|
||||
wxPortId wxGUIAppTraits::GetToolkitVersion(int *verMaj,
|
||||
int *verMin,
|
||||
int *verMicro) const
|
||||
{
|
||||
// We suppose that toolkit version is the same as OS version under Mac
|
||||
wxGetOsVersion(verMaj, verMin);
|
||||
wxGetOsVersion(verMaj, verMin, verMicro);
|
||||
|
||||
return wxPORT_OSX;
|
||||
}
|
||||
|
@@ -39,12 +39,16 @@ wxTimerImpl *wxGUIAppTraits::CreateTimerImpl(wxTimer *timer)
|
||||
|
||||
// #endif
|
||||
|
||||
wxPortId wxGUIAppTraits::GetToolkitVersion(int *majVer, int *minVer) const
|
||||
wxPortId wxGUIAppTraits::GetToolkitVersion(int *majVer,
|
||||
int *minVer,
|
||||
int *microVer) const
|
||||
{
|
||||
if ( majVer )
|
||||
*majVer = QT_VERSION >> 16;
|
||||
if ( minVer )
|
||||
*minVer = (QT_VERSION >> 8) & 0xFF;
|
||||
if ( microVer )
|
||||
*microVer = QT_VERSION & 0xFF;
|
||||
|
||||
return wxPORT_QT;
|
||||
}
|
||||
|
@@ -100,7 +100,9 @@ void wxBell()
|
||||
XBell ((Display*) wxGetDisplay(), 0);
|
||||
}
|
||||
|
||||
wxPortId wxGUIAppTraits::GetToolkitVersion(int *verMaj, int *verMin) const
|
||||
wxPortId wxGUIAppTraits::GetToolkitVersion(int *verMaj,
|
||||
int *verMin,
|
||||
int *verMicro) const
|
||||
{
|
||||
// get X protocol version
|
||||
Display *display = wxGlobalDisplay();
|
||||
@@ -110,6 +112,8 @@ wxPortId wxGUIAppTraits::GetToolkitVersion(int *verMaj, int *verMin) const
|
||||
*verMaj = ProtocolVersion (display);
|
||||
if ( verMin )
|
||||
*verMin = ProtocolRevision (display);
|
||||
if ( verMicro )
|
||||
*verMicro = 0;
|
||||
}
|
||||
|
||||
return wxPORT_X11;
|
||||
|
Reference in New Issue
Block a user