diff --git a/include/wx/apptrait.h b/include/wx/apptrait.h index f459bbe908..d69a7b964c 100644 --- a/include/wx/apptrait.h +++ b/include/wx/apptrait.h @@ -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; } diff --git a/include/wx/msw/apptrait.h b/include/wx/msw/apptrait.h index 6a968fe1ab..d7466482a6 100644 --- a/include/wx/msw/apptrait.h +++ b/include/wx/msw/apptrait.h @@ -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; } diff --git a/include/wx/platinfo.h b/include/wx/platinfo.h index 178e3c6898..cc13959567 100644 --- a/include/wx/platinfo.h +++ b/include/wx/platinfo.h @@ -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; diff --git a/include/wx/unix/apptrait.h b/include/wx/unix/apptrait.h index 509007c51b..dc96980526 100644 --- a/include/wx/unix/apptrait.h +++ b/include/wx/unix/apptrait.h @@ -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; diff --git a/interface/wx/apptrait.h b/interface/wx/apptrait.h index d4f8ff10d3..9eff45d838 100644 --- a/interface/wx/apptrait.h +++ b/interface/wx/apptrait.h @@ -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. diff --git a/interface/wx/platinfo.h b/interface/wx/platinfo.h index c3bf10d507..7df238c535 100644 --- a/interface/wx/platinfo.h +++ b/interface/wx/platinfo.h @@ -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. diff --git a/src/common/platinfo.cpp b/src/common/platinfo.cpp index 0bbbf1fb61..cd6f4862eb 100644 --- a/src/common/platinfo.cpp +++ b/src/common/platinfo.cpp @@ -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(); } diff --git a/src/dfb/utils.cpp b/src/dfb/utils.cpp index 4c9c853275..57e9a3d1a1 100644 --- a/src/dfb/utils.cpp +++ b/src/dfb/utils.cpp @@ -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; } diff --git a/src/gtk/utilsgtk.cpp b/src/gtk/utilsgtk.cpp index 36c5013722..a4e3895ffb 100644 --- a/src/gtk/utilsgtk.cpp +++ b/src/gtk/utilsgtk.cpp @@ -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; } diff --git a/src/gtk1/utilsgtk.cpp b/src/gtk1/utilsgtk.cpp index 4b1b170f74..c912fc9a9a 100644 --- a/src/gtk1/utilsgtk.cpp +++ b/src/gtk1/utilsgtk.cpp @@ -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; } diff --git a/src/motif/utils.cpp b/src/motif/utils.cpp index 4700c3c329..d440bb0887 100644 --- a/src/motif/utils.cpp +++ b/src/motif/utils.cpp @@ -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; } diff --git a/src/msw/app.cpp b/src/msw/app.cpp index 860bde87e3..e808d98e97 100644 --- a/src/msw/app.cpp +++ b/src/msw/app.cpp @@ -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; } diff --git a/src/osx/utils_osx.cpp b/src/osx/utils_osx.cpp index 70e2c66096..d71457c676 100644 --- a/src/osx/utils_osx.cpp +++ b/src/osx/utils_osx.cpp @@ -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; } diff --git a/src/qt/apptraits.cpp b/src/qt/apptraits.cpp index 1c9dfdd55d..2f747d7fb9 100644 --- a/src/qt/apptraits.cpp +++ b/src/qt/apptraits.cpp @@ -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; } diff --git a/src/x11/utils.cpp b/src/x11/utils.cpp index 6bbb103242..bd80ba5769 100644 --- a/src/x11/utils.cpp +++ b/src/x11/utils.cpp @@ -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;