From ccec90930cfc38bd4347a97f46481242d9fd23cd Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 25 Nov 2010 00:53:44 +0000 Subject: [PATCH] Add wxVersionInfo and functions returning it for 3rd party libraries. Add simple wxVersionInfo class holding the version information. Also add GetLibraryVersionInfo() static method to wx{JPEG,PNG,TIFF}Handler, wxStyledTextCtrl and wxXmlDocument classes and wxGetZlibVersionInfo() and wxGetLibraryVersionInfo() global functions using it. Closes #12690. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66259 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- Makefile.in | 2 + build/bakefiles/files.bkl | 1 + build/msw/wx_base.dsp | 4 ++ build/msw/wx_vc7_base.vcproj | 3 + build/msw/wx_vc8_base.vcproj | 4 ++ build/msw/wx_vc9_base.vcproj | 4 ++ docs/changes.txt | 1 + include/wx/imagjpeg.h | 3 + include/wx/imagpng.h | 3 + include/wx/imagtiff.h | 3 + include/wx/stc/stc.h | 2 + include/wx/utils.h | 3 + include/wx/versioninfo.h | 78 +++++++++++++++++++++ include/wx/xml/xml.h | 4 +- include/wx/zstream.h | 3 + interface/wx/image.h | 14 ++++ interface/wx/stc/stc.h | 7 ++ interface/wx/utils.h | 11 ++- interface/wx/versioninfo.h | 130 +++++++++++++++++++++++++++++++++++ interface/wx/xml/xml.h | 8 +++ samples/image/image.cpp | 33 +++++++-- src/common/imagjpeg.cpp | 6 ++ src/common/imagpng.cpp | 15 ++++ src/common/imagtiff.cpp | 24 +++++++ src/common/utilscmn.cpp | 18 ++++- src/common/zstream.cpp | 9 +++ src/stc/stc.cpp | 5 ++ src/stc/stc.cpp.in | 5 ++ src/stc/stc.h.in | 3 + src/xml/xml.cpp | 9 +++ wxGTK.spec | 1 + wxMotif.spec | 1 + wxX11.spec | 1 + 33 files changed, 410 insertions(+), 8 deletions(-) create mode 100644 include/wx/versioninfo.h create mode 100644 interface/wx/versioninfo.h diff --git a/Makefile.in b/Makefile.in index dfca390d0b..b1a6785731 100644 --- a/Makefile.in +++ b/Makefile.in @@ -453,6 +453,7 @@ ALL_BASE_HEADERS = \ wx/variant.h \ wx/vector.h \ wx/version.h \ + wx/versioninfo.h \ wx/volume.h \ wx/weakref.h \ wx/wfstream.h \ @@ -623,6 +624,7 @@ ALL_PORTS_BASE_HEADERS = \ wx/variant.h \ wx/vector.h \ wx/version.h \ + wx/versioninfo.h \ wx/volume.h \ wx/weakref.h \ wx/wfstream.h \ diff --git a/build/bakefiles/files.bkl b/build/bakefiles/files.bkl index e5fe973509..8e2a3d0e46 100644 --- a/build/bakefiles/files.bkl +++ b/build/bakefiles/files.bkl @@ -538,6 +538,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! wx/variant.h wx/vector.h wx/version.h + wx/versioninfo.h wx/volume.h wx/weakref.h wx/wfstream.h diff --git a/build/msw/wx_base.dsp b/build/msw/wx_base.dsp index d54d2231b6..a8b526d996 100644 --- a/build/msw/wx_base.dsp +++ b/build/msw/wx_base.dsp @@ -1607,6 +1607,10 @@ SOURCE=..\..\include\wx\version.h # End Source File # Begin Source File +SOURCE=..\..\include\wx\versioninfo.h +# End Source File +# Begin Source File + SOURCE=..\..\include\wx\volume.h # End Source File # Begin Source File diff --git a/build/msw/wx_vc7_base.vcproj b/build/msw/wx_vc7_base.vcproj index 1375154426..5a0cb518e0 100644 --- a/build/msw/wx_vc7_base.vcproj +++ b/build/msw/wx_vc7_base.vcproj @@ -1637,6 +1637,9 @@ + + diff --git a/build/msw/wx_vc8_base.vcproj b/build/msw/wx_vc8_base.vcproj index 25a26257d6..bc510ea6ec 100644 --- a/build/msw/wx_vc8_base.vcproj +++ b/build/msw/wx_vc8_base.vcproj @@ -2201,6 +2201,10 @@ RelativePath="..\..\include\wx\version.h" > + + diff --git a/build/msw/wx_vc9_base.vcproj b/build/msw/wx_vc9_base.vcproj index a27d75d72b..ebbe7e7669 100644 --- a/build/msw/wx_vc9_base.vcproj +++ b/build/msw/wx_vc9_base.vcproj @@ -2197,6 +2197,10 @@ RelativePath="..\..\include\wx\version.h" > + + diff --git a/docs/changes.txt b/docs/changes.txt index e9cf61edaa..05ca1fdecb 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -416,6 +416,7 @@ All: - Added wxThread::OnKill() and OnDelete() callbacks. - Added wxFile::GetLastError() and ClearLastError() (ryazanov). - Added negatable command line switches (Armel Asselin). +- Added wxVersionInfo and various GetLibraryVersionInfo() functions (troelsk). Unix: diff --git a/include/wx/imagjpeg.h b/include/wx/imagjpeg.h index 873942e00a..98eb3b0383 100644 --- a/include/wx/imagjpeg.h +++ b/include/wx/imagjpeg.h @@ -19,6 +19,7 @@ #if wxUSE_LIBJPEG #include "wx/image.h" +#include "wx/versioninfo.h" class WXDLLIMPEXP_CORE wxJPEGHandler: public wxImageHandler { @@ -33,6 +34,8 @@ public: m_mime = wxT("image/jpeg"); } + static wxVersionInfo GetLibraryVersionInfo(); + #if wxUSE_STREAMS virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ); virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ); diff --git a/include/wx/imagpng.h b/include/wx/imagpng.h index 27d0237be9..e7ba4646d6 100644 --- a/include/wx/imagpng.h +++ b/include/wx/imagpng.h @@ -19,6 +19,7 @@ #if wxUSE_LIBPNG #include "wx/image.h" +#include "wx/versioninfo.h" #define wxIMAGE_OPTION_PNG_FORMAT wxT("PngFormat") #define wxIMAGE_OPTION_PNG_BITDEPTH wxT("PngBitDepth") @@ -46,6 +47,8 @@ public: m_mime = wxT("image/png"); } + static wxVersionInfo GetLibraryVersionInfo(); + #if wxUSE_STREAMS virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ); virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ); diff --git a/include/wx/imagtiff.h b/include/wx/imagtiff.h index 734bef514c..2c90bb5e57 100644 --- a/include/wx/imagtiff.h +++ b/include/wx/imagtiff.h @@ -19,6 +19,7 @@ #if wxUSE_LIBTIFF #include "wx/image.h" +#include "wx/versioninfo.h" // defines for wxImage::SetOption #define wxIMAGE_OPTION_BITSPERSAMPLE wxString(wxT("BitsPerSample")) @@ -31,6 +32,8 @@ class WXDLLIMPEXP_CORE wxTIFFHandler: public wxImageHandler public: wxTIFFHandler(); + static wxVersionInfo GetLibraryVersionInfo(); + #if wxUSE_STREAMS virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ); virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ); diff --git a/include/wx/stc/stc.h b/include/wx/stc/stc.h index a8210a812f..fbd65e7bad 100644 --- a/include/wx/stc/stc.h +++ b/include/wx/stc/stc.h @@ -4240,6 +4240,8 @@ public: return wxTextAreaBase::HitTest(pt, col, row); } + static wxVersionInfo GetLibraryVersionInfo(); + protected: virtual wxString DoGetValue() const { return GetText(); } virtual wxWindow *GetEditableWindow() { return this; } diff --git a/include/wx/utils.h b/include/wx/utils.h index 6f7cb56dde..ce6951c2db 100644 --- a/include/wx/utils.h +++ b/include/wx/utils.h @@ -20,6 +20,7 @@ #include "wx/list.h" #include "wx/filefn.h" #include "wx/hashmap.h" +#include "wx/versioninfo.h" #include "wx/meta/implicitconversion.h" #if wxUSE_GUI @@ -140,6 +141,8 @@ WXDLLIMPEXP_BASE void wxBell(); WXDLLIMPEXP_CORE void wxInfoMessageBox(wxWindow* parent); #endif // wxUSE_MSGDLG +WXDLLIMPEXP_BASE wxVersionInfo wxGetLibraryVersionInfo(); + // Get OS description as a user-readable string WXDLLIMPEXP_BASE wxString wxGetOsDescription(); diff --git a/include/wx/versioninfo.h b/include/wx/versioninfo.h new file mode 100644 index 0000000000..40bd5a1e25 --- /dev/null +++ b/include/wx/versioninfo.h @@ -0,0 +1,78 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/versioninfo.h +// Purpose: declaration of wxVersionInfo class +// Author: Troels K +// Created: 2010-11-22 +// RCS-ID: $Id:$ +// Copyright: (c) 2010 wxWidgets team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_VERSIONINFO_H_ +#define _WX_VERSIONINFO_H_ + +#include "wx/string.h" + +// ---------------------------------------------------------------------------- +// wxVersionInfo: represents version information +// ---------------------------------------------------------------------------- + +class wxVersionInfo +{ +public: + wxVersionInfo(const wxString& name, + int major, + int minor, + int micro = 0, + const wxString& description = wxString(), + const wxString& copyright = wxString()) + { + m_name = name; + m_major = major; + m_minor = minor; + m_micro = micro; + m_description = description; + m_copyright = copyright; + } + + // Default copy ctor, assignment operator and dtor are ok. + + + const wxString& GetName() const { return m_name; } + + int GetMajor() const { return m_major; } + int GetMinor() const { return m_minor; } + int GetMicro() const { return m_micro; } + + wxString ToString() const + { + return HasDescription() ? GetDescription() : GetVersionString(); + } + + wxString GetVersionString() const + { + wxString str; + str << m_name << ' ' << GetMajor() << '.' << GetMinor(); + if ( GetMicro() ) + str << '.' << GetMicro(); + + return str; + } + + bool HasDescription() const { return !m_description.empty(); } + const wxString& GetDescription() const { return m_description; } + + bool HasCopyright() const { return !m_copyright.empty(); } + const wxString& GetCopyright() const { return m_copyright; } + +private: + wxString m_name, + m_description, + m_copyright; + + int m_major, + m_minor, + m_micro; +}; + +#endif // _WX_VERSIONINFO_H_ diff --git a/include/wx/xml/xml.h b/include/wx/xml/xml.h index 95fa3cfb2c..6cac2aac77 100644 --- a/include/wx/xml/xml.h +++ b/include/wx/xml/xml.h @@ -19,6 +19,7 @@ #include "wx/string.h" #include "wx/object.h" #include "wx/list.h" +#include "wx/versioninfo.h" #ifdef WXMAKINGDLL_XML #define WXDLLIMPEXP_XML WXEXPORT @@ -35,7 +36,6 @@ class WXDLLIMPEXP_FWD_XML wxXmlIOHandler; class WXDLLIMPEXP_FWD_BASE wxInputStream; class WXDLLIMPEXP_FWD_BASE wxOutputStream; - // Represents XML node type. enum wxXmlNodeType { @@ -299,6 +299,8 @@ public: void SetEncoding(const wxString& enc) { m_encoding = enc; } #endif + static wxVersionInfo GetLibraryVersionInfo(); + private: wxString m_version; wxString m_fileEncoding; diff --git a/include/wx/zstream.h b/include/wx/zstream.h index 5a895ab5a8..51f8b86ef3 100644 --- a/include/wx/zstream.h +++ b/include/wx/zstream.h @@ -16,6 +16,7 @@ #if wxUSE_ZLIB && wxUSE_STREAMS #include "wx/stream.h" +#include "wx/versioninfo.h" // Compression level enum wxZlibCompressionLevels { @@ -138,6 +139,8 @@ private: DECLARE_DYNAMIC_CLASS(wxGzipClassFactory) }; +WXDLLIMPEXP_BASE wxVersionInfo wxGetZlibVersionInfo(); + #endif // wxUSE_ZLIB && wxUSE_STREAMS diff --git a/interface/wx/image.h b/interface/wx/image.h index fa58c8cf25..5efb33a5d6 100644 --- a/interface/wx/image.h +++ b/interface/wx/image.h @@ -254,6 +254,20 @@ public: Handler name. */ void SetName(const wxString& name); + + /** + Retrieve the version information about the image library used by this + handler. + + This method is not present in wxImageHandler class itself but is + present in a few of the classes deriving from it, currently + wxJPEGHandler, wxPNGHandler and wxTIFFHandler. It returns the + information about the version of the image library being used for the + corresponding handler implementation. + + @since 2.9.2 + */ + static wxVersionInfo GetLibraryVersionInfo(); }; diff --git a/interface/wx/stc/stc.h b/interface/wx/stc/stc.h index a41789acb4..7349daf012 100644 --- a/interface/wx/stc/stc.h +++ b/interface/wx/stc/stc.h @@ -3153,5 +3153,12 @@ public: */ void SwapMainAnchorCaret(); + /** + Get Scintilla library version information. + + @since 2.9.2 + @see wxVersionInfo + */ + static wxVersionInfo GetLibraryVersionInfo(); }; diff --git a/interface/wx/utils.h b/interface/wx/utils.h index d62ddf1e92..de5aae9748 100644 --- a/interface/wx/utils.h +++ b/interface/wx/utils.h @@ -145,10 +145,19 @@ void wxBell(); doesn't otherwise handle this event. @since 2.9.0 + @see wxGetLibraryVersionInfo() + @header{wx/utils.h} +*/ +void wxInfoMessageBox(wxWindow* parent); +/** + Get wxWidgets version information. + + @since 2.9.2 + @see wxVersionInfo @header{wx/utils.h} */ -void wxInfoMessageBox(wxWindow parent = NULL); +wxVersionInfo wxGetLibraryVersionInfo(); //@} diff --git a/interface/wx/versioninfo.h b/interface/wx/versioninfo.h new file mode 100644 index 0000000000..5be8e01306 --- /dev/null +++ b/interface/wx/versioninfo.h @@ -0,0 +1,130 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: versioninfo.h +// Purpose: interface of wxVersionInfo +// Author: Troels K +// RCS-ID: $Id: versioninfo.h +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +/** + @class wxVersionInfo + + wxVersionInfo contains version information. + + This class is used by wxWidgets to provide version information about the + libraries it uses and itself, but you can also apply it in user space, to + provide version information about your own libraries, or other libraries + that you use. + + @library{wxbase} + @category{data} + @header{wx/versioninfo.h} + + @since 2.9.2 +*/ +class wxVersionInfo +{ +public: + /** + Constructor. + + The version information objects need to be initialized with this + constructor and are immutable once they are created. + + @param name The name of the library or other entity that this object + pertains to. + @param major The major version component. + @param minor The minor version component. + @param micro The micro version component, 0 by default. + @param description Free form description of this version, none by + default. + @param copyright Copyright string, none by default. + */ + wxVersionInfo(const wxString& name, + int major, + int minor, + int micro = 0, + const wxString& description = wxString(), + const wxString& copyright = wxString()); + + /** + Get the name of the object (library). + + @return Name string. + */ + const wxString& GetName() const; + + /** + Get the major version number. + + @return Major version number. + */ + int GetMajor() const; + + /** + Get the minor version number. + + @return Minor version number. + */ + int GetMinor() const; + + /** + Get the micro version, or release number. + + @return Micro version, or release number. + */ + int GetMicro() const; + + /** + Get the string representation of this version object. + + This function returns the description if it is non-empty or + GetVersionString() if there is no description. + + @see GetDescription(), GetVersionString() + */ + wxString ToString() const; + + /** + Get the string representation. + + The micro component of the version is ignored/not used if it is 0. + + @return The version string in the form "name major.minor[.micro]". + */ + wxString GetVersionString() const + + /** + Return @true if a description string has been specified. + + @see GetDescription() + */ + bool HasDescription() const; + + /** + Get the description string. + + The description may be empty. + + @return The description string, free-form. + */ + const wxString& GetDescription(); + + /** + Returns @true if a copyright string has been specified. + + @see GetCopyright() + */ + bool HasCopyright() const; + + /** + Get the copyright string. + + The copyright string may be empty. + + @return The copyright string. + */ + const wxString& GetCopyright() const; +}; + +//@} diff --git a/interface/wx/xml/xml.h b/interface/wx/xml/xml.h index 514fa1a508..397c747806 100644 --- a/interface/wx/xml/xml.h +++ b/interface/wx/xml/xml.h @@ -645,5 +645,13 @@ public: Deep copies the given document. */ wxXmlDocument& operator=(const wxXmlDocument& doc); + + /** + Get expat library version information. + + @since 2.9.2 + @see wxVersionInfo + */ + static wxVersionInfo GetLibraryVersionInfo(); }; diff --git a/samples/image/image.cpp b/samples/image/image.cpp index 826cad7686..9ba854ebe6 100644 --- a/samples/image/image.cpp +++ b/samples/image/image.cpp @@ -28,6 +28,7 @@ #include "wx/wfstream.h" #include "wx/quantize.h" #include "wx/stopwatch.h" +#include "wx/versioninfo.h" #if wxUSE_CLIPBOARD #include "wx/dataobj.h" @@ -654,7 +655,7 @@ MyFrame::MyFrame() menuImage->Append( ID_SHOWTHUMBNAIL, wxT("Test &thumbnail...\tCtrl-T"), "Test scaling the image during load (try with JPEG)"); menuImage->AppendSeparator(); - menuImage->Append( ID_ABOUT, wxT("&About...")); + menuImage->Append( ID_ABOUT, wxT("&About...\tF1")); menuImage->AppendSeparator(); menuImage->Append( ID_QUIT, wxT("E&xit\tCtrl-Q")); menu_bar->Append(menuImage, wxT("&Image")); @@ -686,11 +687,35 @@ void MyFrame::OnQuit( wxCommandEvent &WXUNUSED(event) ) Close( true ); } +#if wxUSE_ZLIB && wxUSE_STREAMS +#include "wx/zstream.h" +#endif + void MyFrame::OnAbout( wxCommandEvent &WXUNUSED(event) ) { - (void)wxMessageBox( "wxImage demo\n" - "(c) Robert Roebling 1998-2005" - "(c) Vadim Zeitlin 2005-2009", + wxArrayString array; + + array.Add("wxImage demo"); + array.Add("(c) Robert Roebling 1998-2005"); + array.Add("(c) Vadim Zeitlin 2005-2009"); + + array.Add(wxEmptyString); + array.Add("Version of the libraries used:"); + +#if wxUSE_LIBPNG + array.Add(wxPNGHandler::GetLibraryVersionInfo().ToString()); +#endif +#if wxUSE_LIBJPEG + array.Add(wxJPEGHandler::GetLibraryVersionInfo().ToString()); +#endif +#if wxUSE_LIBTIFF + array.Add(wxTIFFHandler::GetLibraryVersionInfo().ToString()); +#endif +#if wxUSE_ZLIB && wxUSE_STREAMS + // zlib is used by libpng + array.Add(wxGetZlibVersionInfo().ToString()); +#endif + (void)wxMessageBox( wxJoin(array, '\n'), "About wxImage Demo", wxICON_INFORMATION | wxOK ); } diff --git a/src/common/imagjpeg.cpp b/src/common/imagjpeg.cpp index 1f3ed86da6..51ba2d1e9c 100644 --- a/src/common/imagjpeg.cpp +++ b/src/common/imagjpeg.cpp @@ -17,6 +17,7 @@ #if wxUSE_IMAGE && wxUSE_LIBJPEG #include "wx/imagjpeg.h" +#include "wx/versioninfo.h" #ifndef WX_PRECOMP #include "wx/log.h" @@ -491,4 +492,9 @@ bool wxJPEGHandler::DoCanRead( wxInputStream& stream ) #endif // wxUSE_STREAMS +/*static*/ wxVersionInfo wxJPEGHandler::GetLibraryVersionInfo() +{ + return wxVersionInfo("libjpeg", JPEG_LIB_VERSION/10, JPEG_LIB_VERSION%10); +} + #endif // wxUSE_LIBJPEG diff --git a/src/common/imagpng.cpp b/src/common/imagpng.cpp index 14fd9eddb1..32845b9afe 100644 --- a/src/common/imagpng.cpp +++ b/src/common/imagpng.cpp @@ -25,6 +25,7 @@ #if wxUSE_IMAGE && wxUSE_LIBPNG #include "wx/imagpng.h" +#include "wx/versioninfo.h" #ifndef WX_PRECOMP #include "wx/log.h" @@ -902,4 +903,18 @@ bool wxPNGHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbos #endif // wxUSE_STREAMS +/*static*/ wxVersionInfo wxPNGHandler::GetLibraryVersionInfo() +{ + // The version string seems to always have a leading space and a trailing + // new line, get rid of them both. + wxString str = png_get_header_version(NULL) + 1; + str.Replace("\n", ""); + + return wxVersionInfo("libpng", + PNG_LIBPNG_VER_MAJOR, + PNG_LIBPNG_VER_MINOR, + PNG_LIBPNG_VER_RELEASE, + str); +} + #endif // wxUSE_LIBPNG diff --git a/src/common/imagtiff.cpp b/src/common/imagtiff.cpp index 0e90db2a5f..5a5c6cb5f9 100644 --- a/src/common/imagtiff.cpp +++ b/src/common/imagtiff.cpp @@ -25,6 +25,7 @@ #if wxUSE_IMAGE && wxUSE_LIBTIFF #include "wx/imagtiff.h" +#include "wx/versioninfo.h" #ifndef WX_PRECOMP #include "wx/log.h" @@ -627,4 +628,27 @@ bool wxTIFFHandler::DoCanRead( wxInputStream& stream ) #endif // wxUSE_STREAMS +/*static*/ wxVersionInfo wxTIFFHandler::GetLibraryVersionInfo() +{ + int major, + minor, + micro; + + const wxString ver(::TIFFGetVersion()); + if ( wxSscanf(ver, "LIBTIFF, Version %d.%d.%d", &major, µ, µ) != 3 ) + { + wxLogDebug("Unrecognized libtiff version string \"%s\"", ver); + + major = + minor = + micro = 0; + } + + wxString copyright; + const wxString desc = ver.BeforeFirst('\n', ©right); + copyright.Replace("\n", ""); + + return wxVersionInfo("libtiff", major, minor, micro, desc, copyright); +} + #endif // wxUSE_LIBTIFF diff --git a/src/common/utilscmn.cpp b/src/common/utilscmn.cpp index 8b593c3091..837e2c2239 100644 --- a/src/common/utilscmn.cpp +++ b/src/common/utilscmn.cpp @@ -52,6 +52,7 @@ #include "wx/uri.h" #include "wx/mimetype.h" #include "wx/config.h" +#include "wx/versioninfo.h" #if defined(__WXWINCE__) && wxUSE_DATETIME #include "wx/datetime.h" @@ -1356,7 +1357,7 @@ int wxMessageBox(const wxString& message, const wxString& caption, long style, return wxCANCEL; } -void wxInfoMessageBox(wxWindow* parent) +wxVersionInfo wxGetLibraryVersionInfo() { // don't translate these strings, they're for diagnostics purposes only wxString msg; @@ -1389,7 +1390,20 @@ void wxInfoMessageBox(wxWindow* parent) GTK_MICRO_VERSION); #endif // __WXGTK__ - msg += wxS("\nCopyright (c) 1995-2010 wxWidgets team"); + return wxVersionInfo(wxS("wxWidgets"), + wxMAJOR_VERSION, + wxMINOR_VERSION, + wxRELEASE_NUMBER, + msg, + wxS("Copyright (c) 1995-2010 wxWidgets team")); +} + +void wxInfoMessageBox(wxWindow* parent) +{ + wxVersionInfo info = wxGetLibraryVersionInfo(); + wxString msg = info.ToString(); + + msg << wxS("\n") << info.GetCopyright(); wxMessageBox(msg, wxT("wxWidgets information"), wxICON_INFORMATION | wxOK, diff --git a/src/common/zstream.cpp b/src/common/zstream.cpp index c293548a04..739a58e836 100644 --- a/src/common/zstream.cpp +++ b/src/common/zstream.cpp @@ -19,6 +19,7 @@ #if wxUSE_ZLIB && wxUSE_STREAMS #include "wx/zstream.h" +#include "wx/versioninfo.h" #ifndef WX_PRECOMP #include "wx/intl.h" @@ -44,6 +45,14 @@ enum { }; +wxVersionInfo wxGetZlibVersionInfo() +{ + return wxVersionInfo("zlib", + ZLIB_VERNUM >> 12, + (ZLIB_VERNUM >> 8) & 0x0F, + (ZLIB_VERNUM & 0xFF) / 0x10); +} + ///////////////////////////////////////////////////////////////////////////// // Zlib Class factory diff --git a/src/stc/stc.cpp b/src/stc/stc.cpp index 5905e2eb00..0e8c6206ac 100644 --- a/src/stc/stc.cpp +++ b/src/stc/stc.cpp @@ -4618,4 +4618,9 @@ wxStyledTextEvent::wxStyledTextEvent(const wxStyledTextEvent& event): //---------------------------------------------------------------------- //---------------------------------------------------------------------- +/*static*/ wxVersionInfo wxStyledTextCtrl::GetLibraryVersionInfo() +{ + return wxVersionInfo("Scintilla", 2, 3); +} + #endif // wxUSE_STC diff --git a/src/stc/stc.cpp.in b/src/stc/stc.cpp.in index eb6c021027..f5c8d79620 100644 --- a/src/stc/stc.cpp.in +++ b/src/stc/stc.cpp.in @@ -1118,4 +1118,9 @@ wxStyledTextEvent::wxStyledTextEvent(const wxStyledTextEvent& event): //---------------------------------------------------------------------- //---------------------------------------------------------------------- +/*static*/ wxVersionInfo wxStyledTextCtrl::GetLibraryVersionInfo() +{ + return wxVersionInfo("Scintilla", 2, 3); +} + #endif // wxUSE_STC diff --git a/src/stc/stc.h.in b/src/stc/stc.h.in index b0e44da888..12d998ada8 100644 --- a/src/stc/stc.h.in +++ b/src/stc/stc.h.in @@ -38,6 +38,7 @@ #include "wx/control.h" #include "wx/dnd.h" #include "wx/stopwatch.h" +#include "wx/versioninfo.h" #include "wx/textentry.h" #if wxUSE_TEXTCTRL @@ -438,6 +439,8 @@ public: return wxTextAreaBase::HitTest(pt, col, row); } + static wxVersionInfo GetLibraryVersionInfo(); + protected: virtual wxString DoGetValue() const { return GetText(); } virtual wxWindow *GetEditableWindow() { return this; } diff --git a/src/xml/xml.cpp b/src/xml/xml.cpp index 3767c9dc30..922332b1d6 100644 --- a/src/xml/xml.cpp +++ b/src/xml/xml.cpp @@ -30,6 +30,7 @@ #include "wx/zstream.h" #include "wx/strconv.h" #include "wx/scopedptr.h" +#include "wx/versioninfo.h" #include "expat.h" // from Expat @@ -1035,4 +1036,12 @@ bool wxXmlDocument::Save(wxOutputStream& stream, int indentstep) const OutputString(stream, wxS("\n"), convMem.get(), convFile.get()); } +/*static*/ wxVersionInfo wxXmlDocument::GetLibraryVersionInfo() +{ + return wxVersionInfo("expat", + XML_MAJOR_VERSION, + XML_MINOR_VERSION, + XML_MICRO_VERSION); +} + #endif // wxUSE_XML diff --git a/wxGTK.spec b/wxGTK.spec index 0e70b001f4..d78748de00 100644 --- a/wxGTK.spec +++ b/wxGTK.spec @@ -318,6 +318,7 @@ wx/utils.h wx/variant.h wx/vector.h wx/version.h +wx/versioninfo.h wx/volume.h wx/weakref.h wx/wfstream.h diff --git a/wxMotif.spec b/wxMotif.spec index e14aca3086..06cd566c7e 100644 --- a/wxMotif.spec +++ b/wxMotif.spec @@ -220,6 +220,7 @@ wx/utils.h wx/variant.h wx/vector.h wx/version.h +wx/versioninfo.h wx/volume.h wx/weakref.h wx/wfstream.h diff --git a/wxX11.spec b/wxX11.spec index b773560799..3c1ba58527 100644 --- a/wxX11.spec +++ b/wxX11.spec @@ -244,6 +244,7 @@ wx/utils.h wx/variant.h wx/vector.h wx/version.h +wx/versioninfo.h wx/volume.h wx/weakref.h wx/wfstream.h -- 2.47.2