]> git.saurik.com Git - wxWidgets.git/commitdiff
Add wxVersionInfo and functions returning it for 3rd party libraries.
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 25 Nov 2010 00:53:44 +0000 (00:53 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 25 Nov 2010 00:53:44 +0000 (00:53 +0000)
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

33 files changed:
Makefile.in
build/bakefiles/files.bkl
build/msw/wx_base.dsp
build/msw/wx_vc7_base.vcproj
build/msw/wx_vc8_base.vcproj
build/msw/wx_vc9_base.vcproj
docs/changes.txt
include/wx/imagjpeg.h
include/wx/imagpng.h
include/wx/imagtiff.h
include/wx/stc/stc.h
include/wx/utils.h
include/wx/versioninfo.h [new file with mode: 0644]
include/wx/xml/xml.h
include/wx/zstream.h
interface/wx/image.h
interface/wx/stc/stc.h
interface/wx/utils.h
interface/wx/versioninfo.h [new file with mode: 0644]
interface/wx/xml/xml.h
samples/image/image.cpp
src/common/imagjpeg.cpp
src/common/imagpng.cpp
src/common/imagtiff.cpp
src/common/utilscmn.cpp
src/common/zstream.cpp
src/stc/stc.cpp
src/stc/stc.cpp.in
src/stc/stc.h.in
src/xml/xml.cpp
wxGTK.spec
wxMotif.spec
wxX11.spec

index dfca390d0bb49a66dce4a7381ad5b7b21ba3fcf7..b1a6785731db95706bd781d3fcf24c3924f3fcec 100644 (file)
@@ -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 \
index e5fe973509e299e3d19a2e0d28f30cc3028529a9..8e2a3d0e46db7b83622e757f33ea09e9d8c04f97 100644 (file)
@@ -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
index d54d2231b6062ad042b20db34a4434c3eb46d500..a8b526d99690e10eb1659df520014982c876bda6 100644 (file)
@@ -1607,6 +1607,10 @@ SOURCE=..\..\include\wx\version.h
 # End Source File\r
 # Begin Source File\r
 \r
+SOURCE=..\..\include\wx\versioninfo.h\r
+# End Source File\r
+# Begin Source File\r
+\r
 SOURCE=..\..\include\wx\volume.h\r
 # End Source File\r
 # Begin Source File\r
index 13751544266cb3e72a6d8ee20584b942d15fd0b0..5a0cb518e044cea0e14b196292e889220b7cd5b3 100644 (file)
                        <File\r
                                RelativePath="..\..\include\wx\version.h">\r
                        </File>\r
+                       <File\r
+                               RelativePath="..\..\include\wx\versioninfo.h">\r
+                       </File>\r
                        <File\r
                                RelativePath="..\..\include\wx\volume.h">\r
                        </File>\r
index 25a26257d69f3ca2f33c3e6406df9acd1a9cfb7f..bc510ea6ecaed60914826f391aeab53ef412f8eb 100644 (file)
                                RelativePath="..\..\include\wx\version.h"\r
                                >\r
                        </File>\r
+                       <File\r
+                               RelativePath="..\..\include\wx\versioninfo.h"\r
+                               >\r
+                       </File>\r
                        <File\r
                                RelativePath="..\..\include\wx\volume.h"\r
                                >\r
index a27d75d72b07f64ac5d8c0d2a3810c41cccf0002..ebbe7e76690af3abca26cdf99d4903037052e0d2 100644 (file)
                                RelativePath="..\..\include\wx\version.h"\r
                                >\r
                        </File>\r
+                       <File\r
+                               RelativePath="..\..\include\wx\versioninfo.h"\r
+                               >\r
+                       </File>\r
                        <File\r
                                RelativePath="..\..\include\wx\volume.h"\r
                                >\r
index e9cf61edaa5b71584915aa038c0814c6859d6489..05ca1fdecb2b0285daae3c82e2035658833af096 100644 (file)
@@ -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:
 
index 873942e00ad07716a3df9327d56b68c92bfaad04..98eb3b03836cd0a8a82330f5f66635f52a40736d 100644 (file)
@@ -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 );
index 27d0237be940047aa33d4afc22613a8b2ded5b0b..e7ba4646d67053b92518407d3d628ce0e510a81d 100644 (file)
@@ -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 );
index 734bef514c093d60a3d88bf9328c40798c10f5ce..2c90bb5e577238703651d46e384429a3d223aca7 100644 (file)
@@ -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 );
index a8210a812fd5e00b9b6a76624d6275707cfc69dc..fbd65e7badaf41de414db16eb1250bbdea500f77 100644 (file)
@@ -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; }
index 6f7cb56dde32b9954a1be86b3e1be64610e47a91..ce6951c2dbc7d03be295561d1c449620ffe90983 100644 (file)
@@ -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 (file)
index 0000000..40bd5a1
--- /dev/null
@@ -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_
index 95fa3cfb2cf509c52070ee26e2ea3bb772b313f6..6cac2aac77a24d2ff3c0ed55cfd29e0960488c75 100644 (file)
@@ -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;
index 5a895ab5a8d4fbab6f0281fe6aae4e00f58173bc..51f8b86ef3f965e1df8790832ee7a2f273b84651 100644 (file)
@@ -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
 
index fa58c8cf25e390a362eb1d360e43f72181281454..5efb33a5d6b86a141fd240742f3ef79b72fb0079 100644 (file)
@@ -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();
 };
 
 
index a41789acb4966b4352fd28cbe5e8bf186ac53454..7349daf01235a2084e2aa3facbd25b188ba9c748 100644 (file)
@@ -3153,5 +3153,12 @@ public:
     */
     void SwapMainAnchorCaret();
     
+    /**
+       Get Scintilla library version information.
+
+       @since 2.9.2
+       @see wxVersionInfo
+    */
+    static wxVersionInfo GetLibraryVersionInfo();
 };
 
index d62ddf1e925ab3678a9c6733e7b383ccc85f5ff2..de5aae9748f04cad17261d0745d987bdadeb2986 100644 (file)
@@ -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 (file)
index 0000000..5be8e01
--- /dev/null
@@ -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;
+};
+
+//@}
index 514fa1a508d7ef1374c2463232db184ae26ec1d0..397c74780660ea7f46220fe0eaf99c961e0735ed 100644 (file)
@@ -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();
 };
 
index 826cad76863e1ec2f9361d9dc9261ae07c9dd546..9ba854ebe6605bb3075678f4f2206793dc216dfd 100644 (file)
@@ -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 );
 }
index 1f3ed86da6fde5051d627921559ce8d042dd636d..51ba2d1e9ce10e7bf5618857182b5c45eda22f3b 100644 (file)
@@ -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
index 14fd9eddb1bae5669b911390af956e76c83d9942..32845b9afec70b471d564cb710e7eaf6070711b1 100644 (file)
@@ -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
index 0e90db2a5f0a7d9a53385376b46cfa0dedb45d92..5a5c6cb5f991c9e9d0dbb1f50ac671a9bc014022 100644 (file)
@@ -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, &micro, &micro) != 3 )
+    {
+        wxLogDebug("Unrecognized libtiff version string \"%s\"", ver);
+
+        major =
+        minor =
+        micro = 0;
+    }
+
+    wxString copyright;
+    const wxString desc = ver.BeforeFirst('\n', &copyright);
+    copyright.Replace("\n", "");
+
+    return wxVersionInfo("libtiff", major, minor, micro, desc, copyright);
+}
+
 #endif  // wxUSE_LIBTIFF
index 8b593c30916fd44f09d6d21750080455f39beb34..837e2c22397c7b42229b6d6eafd8737fba1bb5e6 100644 (file)
@@ -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,
index c293548a040e3538136259e35b0a4e2ace2745d3..739a58e836bbf2c4c0a86b6592add67a910efdc0 100644 (file)
@@ -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
 
index 5905e2eb002339933ea1606bebcabfde2ef63e07..0e8c6206acd55974a6082fba8c41b9b2033edb41 100644 (file)
@@ -4618,4 +4618,9 @@ wxStyledTextEvent::wxStyledTextEvent(const wxStyledTextEvent& event):
 //----------------------------------------------------------------------
 //----------------------------------------------------------------------
 
+/*static*/ wxVersionInfo wxStyledTextCtrl::GetLibraryVersionInfo()
+{
+    return wxVersionInfo("Scintilla", 2, 3);
+}
+
 #endif // wxUSE_STC
index eb6c02102709294c103f7450988134cb312577a1..f5c8d79620374b8f4405419d7e41f76373a0fd6b 100644 (file)
@@ -1118,4 +1118,9 @@ wxStyledTextEvent::wxStyledTextEvent(const wxStyledTextEvent& event):
 //----------------------------------------------------------------------
 //----------------------------------------------------------------------
 
+/*static*/ wxVersionInfo wxStyledTextCtrl::GetLibraryVersionInfo()
+{
+    return wxVersionInfo("Scintilla", 2, 3);
+}
+
 #endif // wxUSE_STC
index b0e44da8880a45163630121da4b7ea7d5ca21913..12d998ada84b72f7463e18b8309d7d580df81775 100644 (file)
@@ -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; }
index 3767c9dc30c1fefad21e4e5a433af6019b56641b..922332b1d623ed20a0d9d770e12daea772d8c6e6 100644 (file)
@@ -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
index 0e70b001f44266296a57f5c4ab337da7db5cebd6..d78748de009d1231104dc09e328d968db9c58f45 100644 (file)
@@ -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
index e14aca3086a7fb62127a9b1d6cc6717dbbbc7478..06cd566c7e72f4ee3b164602cc19a7746518dc5b 100644 (file)
@@ -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
index b773560799a7a947a002c03932b5917b5131fa39..3c1ba585274f88b7bb9bee4694f6fc5a46eacf9e 100644 (file)
@@ -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