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
This commit is contained in:
@@ -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 );
|
||||
|
@@ -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 );
|
||||
|
@@ -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 );
|
||||
|
@@ -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; }
|
||||
|
@@ -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();
|
||||
|
||||
|
78
include/wx/versioninfo.h
Normal file
78
include/wx/versioninfo.h
Normal file
@@ -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_
|
@@ -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;
|
||||
|
@@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user