wx/variant.h \
wx/vector.h \
wx/version.h \
+ wx/versioninfo.h \
wx/volume.h \
wx/weakref.h \
wx/wfstream.h \
wx/variant.h \
wx/vector.h \
wx/version.h \
+ wx/versioninfo.h \
wx/volume.h \
wx/weakref.h \
wx/wfstream.h \
wx/variant.h
wx/vector.h
wx/version.h
+ wx/versioninfo.h
wx/volume.h
wx/weakref.h
wx/wfstream.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
<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
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
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
- 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:
#if wxUSE_LIBJPEG
#include "wx/image.h"
+#include "wx/versioninfo.h"
class WXDLLIMPEXP_CORE wxJPEGHandler: public wxImageHandler
{
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 );
#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")
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 );
#if wxUSE_LIBTIFF
#include "wx/image.h"
+#include "wx/versioninfo.h"
// defines for wxImage::SetOption
#define wxIMAGE_OPTION_BITSPERSAMPLE wxString(wxT("BitsPerSample"))
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 );
return wxTextAreaBase::HitTest(pt, col, row);
}
+ static wxVersionInfo GetLibraryVersionInfo();
+
protected:
virtual wxString DoGetValue() const { return GetText(); }
virtual wxWindow *GetEditableWindow() { return this; }
#include "wx/list.h"
#include "wx/filefn.h"
#include "wx/hashmap.h"
+#include "wx/versioninfo.h"
#include "wx/meta/implicitconversion.h"
#if wxUSE_GUI
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();
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// 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_
#include "wx/string.h"
#include "wx/object.h"
#include "wx/list.h"
+#include "wx/versioninfo.h"
#ifdef WXMAKINGDLL_XML
#define WXDLLIMPEXP_XML WXEXPORT
class WXDLLIMPEXP_FWD_BASE wxInputStream;
class WXDLLIMPEXP_FWD_BASE wxOutputStream;
-
// Represents XML node type.
enum wxXmlNodeType
{
void SetEncoding(const wxString& enc) { m_encoding = enc; }
#endif
+ static wxVersionInfo GetLibraryVersionInfo();
+
private:
wxString m_version;
wxString m_fileEncoding;
#if wxUSE_ZLIB && wxUSE_STREAMS
#include "wx/stream.h"
+#include "wx/versioninfo.h"
// Compression level
enum wxZlibCompressionLevels {
DECLARE_DYNAMIC_CLASS(wxGzipClassFactory)
};
+WXDLLIMPEXP_BASE wxVersionInfo wxGetZlibVersionInfo();
+
#endif
// wxUSE_ZLIB && wxUSE_STREAMS
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();
};
*/
void SwapMainAnchorCaret();
+ /**
+ Get Scintilla library version information.
+
+ @since 2.9.2
+ @see wxVersionInfo
+ */
+ static wxVersionInfo GetLibraryVersionInfo();
};
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();
//@}
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// 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;
+};
+
+//@}
Deep copies the given document.
*/
wxXmlDocument& operator=(const wxXmlDocument& doc);
+
+ /**
+ Get expat library version information.
+
+ @since 2.9.2
+ @see wxVersionInfo
+ */
+ static wxVersionInfo GetLibraryVersionInfo();
};
#include "wx/wfstream.h"
#include "wx/quantize.h"
#include "wx/stopwatch.h"
+#include "wx/versioninfo.h"
#if wxUSE_CLIPBOARD
#include "wx/dataobj.h"
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"));
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 );
}
#if wxUSE_IMAGE && wxUSE_LIBJPEG
#include "wx/imagjpeg.h"
+#include "wx/versioninfo.h"
#ifndef WX_PRECOMP
#include "wx/log.h"
#endif // wxUSE_STREAMS
+/*static*/ wxVersionInfo wxJPEGHandler::GetLibraryVersionInfo()
+{
+ return wxVersionInfo("libjpeg", JPEG_LIB_VERSION/10, JPEG_LIB_VERSION%10);
+}
+
#endif // wxUSE_LIBJPEG
#if wxUSE_IMAGE && wxUSE_LIBPNG
#include "wx/imagpng.h"
+#include "wx/versioninfo.h"
#ifndef WX_PRECOMP
#include "wx/log.h"
#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
#if wxUSE_IMAGE && wxUSE_LIBTIFF
#include "wx/imagtiff.h"
+#include "wx/versioninfo.h"
#ifndef WX_PRECOMP
#include "wx/log.h"
#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
#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"
return wxCANCEL;
}
-void wxInfoMessageBox(wxWindow* parent)
+wxVersionInfo wxGetLibraryVersionInfo()
{
// don't translate these strings, they're for diagnostics purposes only
wxString msg;
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,
#if wxUSE_ZLIB && wxUSE_STREAMS
#include "wx/zstream.h"
+#include "wx/versioninfo.h"
#ifndef WX_PRECOMP
#include "wx/intl.h"
};
+wxVersionInfo wxGetZlibVersionInfo()
+{
+ return wxVersionInfo("zlib",
+ ZLIB_VERNUM >> 12,
+ (ZLIB_VERNUM >> 8) & 0x0F,
+ (ZLIB_VERNUM & 0xFF) / 0x10);
+}
+
/////////////////////////////////////////////////////////////////////////////
// Zlib Class factory
//----------------------------------------------------------------------
//----------------------------------------------------------------------
+/*static*/ wxVersionInfo wxStyledTextCtrl::GetLibraryVersionInfo()
+{
+ return wxVersionInfo("Scintilla", 2, 3);
+}
+
#endif // wxUSE_STC
//----------------------------------------------------------------------
//----------------------------------------------------------------------
+/*static*/ wxVersionInfo wxStyledTextCtrl::GetLibraryVersionInfo()
+{
+ return wxVersionInfo("Scintilla", 2, 3);
+}
+
#endif // wxUSE_STC
#include "wx/control.h"
#include "wx/dnd.h"
#include "wx/stopwatch.h"
+#include "wx/versioninfo.h"
#include "wx/textentry.h"
#if wxUSE_TEXTCTRL
return wxTextAreaBase::HitTest(pt, col, row);
}
+ static wxVersionInfo GetLibraryVersionInfo();
+
protected:
virtual wxString DoGetValue() const { return GetText(); }
virtual wxWindow *GetEditableWindow() { return this; }
#include "wx/zstream.h"
#include "wx/strconv.h"
#include "wx/scopedptr.h"
+#include "wx/versioninfo.h"
#include "expat.h" // from Expat
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
wx/variant.h
wx/vector.h
wx/version.h
+wx/versioninfo.h
wx/volume.h
wx/weakref.h
wx/wfstream.h
wx/variant.h
wx/vector.h
wx/version.h
+wx/versioninfo.h
wx/volume.h
wx/weakref.h
wx/wfstream.h
wx/variant.h
wx/vector.h
wx/version.h
+wx/versioninfo.h
wx/volume.h
wx/weakref.h
wx/wfstream.h