diff --git a/Source/3rd Party/wx/include/msvc/wx/setup.h b/Source/3rd Party/wx/include/msvc/wx/setup.h index a44838d04..7cc58760b 100644 --- a/Source/3rd Party/wx/include/msvc/wx/setup.h +++ b/Source/3rd Party/wx/include/msvc/wx/setup.h @@ -1,229 +1,249 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: msvc/wx/setup.h +// Name: msvc/wx/msw/setup.h // Purpose: wrapper around the real wx/setup.h for Visual C++ // Author: Vadim Zeitlin // Modified by: // Created: 2004-12-12 -// RCS-ID: $Id$ +// RCS-ID: $Id: setup.h 43687 2006-11-27 15:03:59Z VZ $ // Copyright: (c) 2004 Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifndef _MSC_VER - #error "This file should only be included when using Microsoft Visual C++" -#endif - // VC++ IDE predefines _DEBUG and _UNICODE for the new projects itself, but // the other symbols (WXUSINGDLL, __WXUNIVERSAL__, ...) should be defined // explicitly! -#include "wx/version.h" -#include "wx/cpp.h" - -// notice that wxSUFFIX_DEBUG is a string but wxSUFFIX itself must be an -// identifier as string concatenation is not done inside #include where we -// need it -#ifdef _DEBUG - #define wxSUFFIX_DEBUG "d" +#ifdef _MSC_VER #ifdef _UNICODE - #define wxSUFFIX ud - #else // !_UNICODE - #define wxSUFFIX d - #endif // _UNICODE/!_UNICODE -#else - #define wxSUFFIX_DEBUG "" - #ifdef _UNICODE - #define wxSUFFIX u - #else // !_UNICODE - // don't define wxSUFFIX at all as preprocessor operations don't work - // with empty values so we need to check for this case specially below - #endif // _UNICODE/!_UNICODE -#endif - -// compiler-specific prefix: by default it's always just "vc" for compatibility -// reasons but if you use multiple MSVC versions you probably build them with -// COMPILER_PREFIX=vcXX and in this case you may want to either predefine -// wxMSVC_VERSION as "XX" or define wxMSVC_VERSION_AUTO to use the appropriate -// version depending on the compiler used -#ifdef wxMSVC_VERSION - #define wxCOMPILER_PREFIX wxCONCAT(vc, wxMSVC_VERSION) -#elif defined(wxMSVC_VERSION_AUTO) - #if _MSC_VER == 1200 - #define wxCOMPILER_PREFIX vc60 - #elif _MSC_VER == 1300 - #define wxCOMPILER_PREFIX vc70 - #elif _MSC_VER == 1310 - #define wxCOMPILER_PREFIX vc71 - #elif _MSC_VER == 1400 - #define wxCOMPILER_PREFIX vc80 - #elif _MSC_VER == 1500 - #define wxCOMPILER_PREFIX vc90 - #elif _MSC_VER == 1600 - #define wxCOMPILER_PREFIX vc100 - #elif _MSC_VER == 1700 - #define wxCOMPILER_PREFIX vc110 - #elif _MSC_VER == 1800 - #define wxCOMPILER_PREFIX vc120 - #elif _MSC_VER == 1900 - #define wxCOMPILER_PREFIX vc140 - #else - #error "Unknown MSVC compiler version, please report to wx-dev." - #endif -#else - #define wxCOMPILER_PREFIX vc -#endif - -// architecture-specific part: not used (again, for compatibility), for x86 -#if defined(_M_X64) - #define wxARCH_SUFFIX _x64 -#elif defined(_M_IA64) - #define wxARCH_SUFFIX _ia64 -#else // assume _M_IX86 - #define wxARCH_SUFFIX -#endif - -#ifdef WXUSINGDLL - #define wxLIB_SUBDIR wxCONCAT3(wxCOMPILER_PREFIX, wxARCH_SUFFIX, _dll) -#else // !DLL - #define wxLIB_SUBDIR wxCONCAT3(wxCOMPILER_PREFIX, wxARCH_SUFFIX, _lib) -#endif // DLL/!DLL - -// The user can predefine a different prefix if not using the default MSW port -// with MSVC. -#ifndef wxTOOLKIT_PREFIX - #define wxTOOLKIT_PREFIX msw -#endif // wxTOOLKIT_PREFIX - -// the real setup.h header file we need is in the build-specific directory, -// construct the path to it -#ifdef wxSUFFIX - #define wxSETUPH_PATH \ - wxCONCAT6(../../../lib/, wxLIB_SUBDIR, /, wxTOOLKIT_PREFIX, wxSUFFIX, /wx/setup.h) -#else // suffix is empty - #define wxSETUPH_PATH \ - wxCONCAT5(../../../lib/, wxLIB_SUBDIR, /, wxTOOLKIT_PREFIX, /wx/setup.h) -#endif - -#define wxSETUPH_PATH_STR wxSTRINGIZE(wxSETUPH_PATH) - -#include wxSETUPH_PATH_STR - - -// the library names depend on the build, these macro builds the correct -// library name for the given base name -#ifdef wxSUFFIX - #define wxSUFFIX_STR wxSTRINGIZE(wxSUFFIX) -#else // suffix is empty - #define wxSUFFIX_STR "" -#endif -#define wxSHORT_VERSION_STRING \ - wxSTRINGIZE(wxMAJOR_VERSION) wxSTRINGIZE(wxMINOR_VERSION) - -#define wxWX_LIB_NAME(name, subname) \ - "wx" name wxSHORT_VERSION_STRING wxSUFFIX_STR subname - -#define wxBASE_LIB_NAME(name) wxWX_LIB_NAME("base", "_" name) -#define wxTOOLKIT_LIB_NAME(name) wxWX_LIB_NAME(wxSTRINGIZE(wxTOOLKIT_PREFIX), "_" name) - -// This one is for 3rd party libraries: they don't have the version number -// in their names and usually exist in ANSI version only (except for regex) -// -// 3rd party libraries are also are not linked in when using DLLs as they're -// embedded inside our own DLLs and don't need to be linked with the user code. -#define wx3RD_PARTY_LIB_NAME(name) "wx" name wxSUFFIX_DEBUG - -// special version for regex as it does have a Unicode version -#define wx3RD_PARTY_LIB_NAME_U(name) "wx" name wxSUFFIX_STR - -#pragma comment(lib, wxWX_LIB_NAME("base", "")) - -#ifndef wxNO_NET_LIB - #pragma comment(lib, wxBASE_LIB_NAME("net")) -#endif -#ifndef wxNO_XML_LIB - #pragma comment(lib, wxBASE_LIB_NAME("xml")) -#endif -#if wxUSE_REGEX && !defined(wxNO_REGEX_LIB) && !defined(WXUSINGDLL) - #pragma comment(lib, wx3RD_PARTY_LIB_NAME_U("regex")) -#endif - -#if wxUSE_GUI - #if wxUSE_XML && !defined(wxNO_EXPAT_LIB) && !defined(WXUSINGDLL) - #pragma comment(lib, wx3RD_PARTY_LIB_NAME("expat")) - #endif - #if wxUSE_LIBJPEG && !defined(wxNO_JPEG_LIB) && !defined(WXUSINGDLL) - #pragma comment(lib, wx3RD_PARTY_LIB_NAME("jpeg")) - #endif - #if wxUSE_LIBPNG && !defined(wxNO_PNG_LIB) && !defined(WXUSINGDLL) - #pragma comment(lib, wx3RD_PARTY_LIB_NAME("png")) - #endif - #if wxUSE_LIBTIFF && !defined(wxNO_TIFF_LIB) && !defined(WXUSINGDLL) - #pragma comment(lib, wx3RD_PARTY_LIB_NAME("tiff")) - #endif - #if wxUSE_ZLIB && !defined(wxNO_ZLIB_LIB) && !defined(WXUSINGDLL) - #pragma comment(lib, wx3RD_PARTY_LIB_NAME("zlib")) - #endif - - #pragma comment(lib, wxTOOLKIT_LIB_NAME("core")) - - #ifndef wxNO_ADV_LIB - #pragma comment(lib, wxTOOLKIT_LIB_NAME("adv")) - #endif - - #ifndef wxNO_HTML_LIB - #pragma comment(lib, wxTOOLKIT_LIB_NAME("html")) - #endif - #if wxUSE_GLCANVAS && !defined(wxNO_GL_LIB) - #pragma comment(lib, wxTOOLKIT_LIB_NAME("gl")) - #endif - #if wxUSE_DEBUGREPORT && !defined(wxNO_QA_LIB) - #pragma comment(lib, wxTOOLKIT_LIB_NAME("qa")) - #endif - #if wxUSE_XRC && !defined(wxNO_XRC_LIB) - #pragma comment(lib, wxTOOLKIT_LIB_NAME("xrc")) - #endif - #if wxUSE_AUI && !defined(wxNO_AUI_LIB) - #pragma comment(lib, wxTOOLKIT_LIB_NAME("aui")) - #endif - #if wxUSE_PROPGRID && !defined(wxNO_PROPGRID_LIB) - #pragma comment(lib, wxTOOLKIT_LIB_NAME("propgrid")) - #endif - #if wxUSE_RIBBON && !defined(wxNO_RIBBON_LIB) - #pragma comment(lib, wxTOOLKIT_LIB_NAME("ribbon")) - #endif - #if wxUSE_RICHTEXT && !defined(wxNO_RICHTEXT_LIB) - #pragma comment(lib, wxTOOLKIT_LIB_NAME("richtext")) - #endif - #if wxUSE_MEDIACTRL && !defined(wxNO_MEDIA_LIB) - #pragma comment(lib, wxTOOLKIT_LIB_NAME("media")) - #endif - #if wxUSE_STC && !defined(wxNO_STC_LIB) - #pragma comment(lib, wxTOOLKIT_LIB_NAME("stc")) - #ifndef WXUSINGDLL - #pragma comment(lib, wx3RD_PARTY_LIB_NAME("scintilla")) + #ifdef WXUSINGDLL + #ifdef _DEBUG + #include "../../../lib/vc_dll/mswud/wx/setup.h" + #else + #include "../../../lib/vc_dll/mswu/wx/setup.h" + #endif + #else + #ifdef _DEBUG + #include "../../../lib/vc_lib/mswud/wx/setup.h" + #else + #include "../../../lib/vc_lib/mswu/wx/setup.h" + #endif #endif - #endif -#endif // wxUSE_GUI + #ifdef _DEBUG + #pragma comment(lib,"wxbase28ud") + #pragma comment(lib,"wxbase28ud_net") + #pragma comment(lib,"wxbase28ud_xml") + #if wxUSE_REGEX + #pragma comment(lib,"wxregexud") + #endif + + #if wxUSE_GUI + #if wxUSE_XML + #pragma comment(lib,"wxexpatd") + #endif + #if wxUSE_LIBJPEG + #pragma comment(lib,"wxjpegd") + #endif + #if wxUSE_LIBPNG + #pragma comment(lib,"wxpngd") + #endif + #if wxUSE_LIBTIFF + #pragma comment(lib,"wxtiffd") + #endif + #if wxUSE_ZLIB + #pragma comment(lib,"wxzlibd") + #endif + #pragma comment(lib,"wxmsw28ud_adv") + #pragma comment(lib,"wxmsw28ud_core") + #pragma comment(lib,"wxmsw28ud_html") + #if wxUSE_GLCANVAS + #pragma comment(lib,"wxmsw28ud_gl") + #endif + #if wxUSE_DEBUGREPORT + #pragma comment(lib,"wxmsw28ud_qa") + #endif + #if wxUSE_XRC + #pragma comment(lib,"wxmsw28ud_xrc") + #endif + #if wxUSE_AUI + #pragma comment(lib,"wxmsw28ud_aui") + #endif + #if wxUSE_RICHTEXT + #pragma comment(lib,"wxmsw28ud_richtext") + #endif + #if wxUSE_MEDIACTRL + #pragma comment(lib,"wxmsw28ud_media") + #endif + #if wxUSE_ODBC + #pragma comment(lib,"wxbase28ud_odbc") + #endif + #endif // wxUSE_GUI + #else // release + #pragma comment(lib,"wxbase28u") + #pragma comment(lib,"wxbase28u_net") + #pragma comment(lib,"wxbase28u_xml") + #if wxUSE_REGEX + #pragma comment(lib,"wxregexu") + #endif + + #if wxUSE_GUI + #if wxUSE_XML + #pragma comment(lib,"wxexpat") + #endif + #if wxUSE_LIBJPEG + #pragma comment(lib,"wxjpeg") + #endif + #if wxUSE_LIBPNG + #pragma comment(lib,"wxpng") + #endif + #if wxUSE_LIBTIFF + #pragma comment(lib,"wxtiff") + #endif + #if wxUSE_ZLIB + #pragma comment(lib,"wxzlib") + #endif + #pragma comment(lib,"wxmsw28u_adv") + #pragma comment(lib,"wxmsw28u_core") + #pragma comment(lib,"wxmsw28u_html") + #if wxUSE_GLCANVAS + #pragma comment(lib,"wxmsw28u_gl") + #endif + #if wxUSE_DEBUGREPORT + #pragma comment(lib,"wxmsw28u_qa") + #endif + #if wxUSE_XRC + #pragma comment(lib,"wxmsw28u_xrc") + #endif + #if wxUSE_AUI + #pragma comment(lib,"wxmsw28u_aui") + #endif + #if wxUSE_RICHTEXT + #pragma comment(lib,"wxmsw28u_richtext") + #endif + #if wxUSE_MEDIACTRL + #pragma comment(lib,"wxmsw28u_media") + #endif + #if wxUSE_ODBC + #pragma comment(lib,"wxbase28u_odbc") + #endif + #endif // wxUSE_GUI + #endif // debug/release + #else // !_UNICODE + #ifdef WXUSINGDLL + #ifdef _DEBUG + #include "../../../lib/vc_dll/mswd/wx/setup.h" + #else + #include "../../../lib/vc_dll/msw/wx/setup.h" + #endif + #else // static lib + #ifdef _DEBUG + #include "../../../lib/vc_lib/mswd/wx/setup.h" + #else + #include "../../../lib/vc_lib/msw/wx/setup.h" + #endif + #endif // shared/static + + #ifdef _DEBUG + #pragma comment(lib,"wxbase28d") + #pragma comment(lib,"wxbase28d_net") + #pragma comment(lib,"wxbase28d_xml") + #if wxUSE_REGEX + #pragma comment(lib,"wxregexd") + #endif + + #if wxUSE_GUI + #if wxUSE_XML + #pragma comment(lib,"wxexpatd") + #endif + #if wxUSE_LIBJPEG + #pragma comment(lib,"wxjpegd") + #endif + #if wxUSE_LIBPNG + #pragma comment(lib,"wxpngd") + #endif + #if wxUSE_LIBTIFF + #pragma comment(lib,"wxtiffd") + #endif + #if wxUSE_ZLIB + #pragma comment(lib,"wxzlibd") + #endif + #pragma comment(lib,"wxmsw28d_adv") + #pragma comment(lib,"wxmsw28d_core") + #pragma comment(lib,"wxmsw28d_html") + #if wxUSE_GLCANVAS + #pragma comment(lib,"wxmsw28d_gl") + #endif + #if wxUSE_DEBUGREPORT + #pragma comment(lib,"wxmsw28d_qa") + #endif + #if wxUSE_XRC + #pragma comment(lib,"wxmsw28d_xrc") + #endif + #if wxUSE_AUI + #pragma comment(lib,"wxmsw28d_aui") + #endif + #if wxUSE_RICHTEXT + #pragma comment(lib,"wxmsw28d_richtext") + #endif + #if wxUSE_MEDIACTRL + #pragma comment(lib,"wxmsw28d_media") + #endif + #if wxUSE_ODBC + #pragma comment(lib,"wxbase28d_odbc") + #endif + #endif // wxUSE_GUI + #else // release + #pragma comment(lib,"wxbase28") + #pragma comment(lib,"wxbase28_net") + #pragma comment(lib,"wxbase28_xml") + #if wxUSE_REGEX + #pragma comment(lib,"wxregex") + #endif + + #if wxUSE_GUI + #if wxUSE_XML + #pragma comment(lib,"wxexpat") + #endif + #if wxUSE_LIBJPEG + #pragma comment(lib,"wxjpeg") + #endif + #if wxUSE_LIBPNG + #pragma comment(lib,"wxpng") + #endif + #if wxUSE_LIBTIFF + #pragma comment(lib,"wxtiff") + #endif + #if wxUSE_ZLIB + #pragma comment(lib,"wxzlib") + #endif + #pragma comment(lib,"wxmsw28_adv") + #pragma comment(lib,"wxmsw28_core") + #pragma comment(lib,"wxmsw28_html") + #if wxUSE_GLCANVAS + #pragma comment(lib,"wxmsw28_gl") + #endif + #if wxUSE_DEBUGREPORT + #pragma comment(lib,"wxmsw28_qa") + #endif + #if wxUSE_XRC + #pragma comment(lib,"wxmsw28_xrc") + #endif + #if wxUSE_AUI + #pragma comment(lib,"wxmsw28_aui") + #endif + #if wxUSE_RICHTEXT + #pragma comment(lib,"wxmsw28_richtext") + #endif + #if wxUSE_MEDIACTRL + #pragma comment(lib,"wxmsw28_media") + #endif + #if wxUSE_ODBC + #pragma comment(lib,"wxbase28_odbc") + #endif + #endif // wxUSE_GUI + #endif // debug/release + #endif // _UNICODE/!_UNICODE +#else + #error "This file should only be included when using Microsoft Visual C++" +#endif -#ifndef WXUSINGDLL - // Make sure all required system libraries are added to the linker too when - // using static libraries. - #pragma comment(lib, "kernel32") - #pragma comment(lib, "user32") - #pragma comment(lib, "gdi32") - #pragma comment(lib, "comdlg32") - #pragma comment(lib, "winspool") - #pragma comment(lib, "winmm") - #pragma comment(lib, "shell32") - #pragma comment(lib, "comctl32") - #pragma comment(lib, "ole32") - #pragma comment(lib, "oleaut32") - #pragma comment(lib, "uuid") - #pragma comment(lib, "rpcrt4") - #pragma comment(lib, "advapi32") - #pragma comment(lib, "wsock32") - #if wxUSE_URL_NATIVE - #pragma comment(lib, "wininet") - #endif -#endif // !WXUSINGDLL diff --git a/Source/3rd Party/wx/include/wx/accel.h b/Source/3rd Party/wx/include/wx/accel.h index 8b4aeb60d..49d14ec2a 100644 --- a/Source/3rd Party/wx/include/wx/accel.h +++ b/Source/3rd Party/wx/include/wx/accel.h @@ -4,7 +4,7 @@ // Author: Julian Smart, Robert Roebling, Vadim Zeitlin // Modified by: // Created: 31.05.01 (extracted from other files) -// RCS-ID: $Id$ +// RCS-ID: $Id: accel.h 66927 2011-02-16 23:27:30Z JS $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -27,25 +27,24 @@ class WXDLLIMPEXP_FWD_CORE wxKeyEvent; // ---------------------------------------------------------------------------- // wxAcceleratorEntry flags -enum wxAcceleratorEntryFlags +enum { wxACCEL_NORMAL = 0x0000, // no modifiers wxACCEL_ALT = 0x0001, // hold Alt key down wxACCEL_CTRL = 0x0002, // hold Ctrl key down wxACCEL_SHIFT = 0x0004, // hold Shift key down #if defined(__WXMAC__) || defined(__WXCOCOA__) - wxACCEL_RAW_CTRL= 0x0008, // + wxACCEL_CMD = 0x0008 // Command key on OS X #else - wxACCEL_RAW_CTRL= wxACCEL_CTRL, + wxACCEL_CMD = wxACCEL_CTRL #endif - wxACCEL_CMD = wxACCEL_CTRL }; // ---------------------------------------------------------------------------- // an entry in wxAcceleratorTable corresponds to one accelerator // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxAcceleratorEntry +class WXDLLEXPORT wxAcceleratorEntry { public: wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0, @@ -69,8 +68,7 @@ public: wxAcceleratorEntry& operator=(const wxAcceleratorEntry& entry) { - if (&entry != this) - Set(entry.m_flags, entry.m_keyCode, entry.m_command, entry.m_item); + Set(entry.m_flags, entry.m_keyCode, entry.m_command, entry.m_item); return *this; } @@ -108,7 +106,7 @@ public: bool IsOk() const { - return m_keyCode != 0; + return m_keyCode != 0; } @@ -117,13 +115,8 @@ public: // returns a wxString for the this accelerator. // this function formats it using the - format - // where maybe a hyphen-separated list of "shift|alt|ctrl" - wxString ToString() const { return AsPossiblyLocalizedString(true); } - - // same as above but without translating, useful if the string is meant to - // be stored in a file or otherwise stored, instead of being shown to the - // user - wxString ToRawString() const { return AsPossiblyLocalizedString(false); } + // where maybe a hyphen-separed list of "shift|alt|ctrl" + wxString ToString() const; // returns true if the given string correctly initialized this object // (i.e. if IsOk() returns true after this call) @@ -131,8 +124,6 @@ public: private: - wxString AsPossiblyLocalizedString(bool localized) const; - // common part of Create() and FromString() static bool ParseAccel(const wxString& str, int *flags, int *keycode); @@ -164,14 +155,14 @@ private: #elif defined(__WXGTK__) #include "wx/gtk1/accel.h" #elif defined(__WXMAC__) - #include "wx/osx/accel.h" + #include "wx/mac/accel.h" #elif defined(__WXCOCOA__) #include "wx/generic/accel.h" #elif defined(__WXPM__) #include "wx/os2/accel.h" #endif -extern WXDLLIMPEXP_DATA_CORE(wxAcceleratorTable) wxNullAcceleratorTable; +extern WXDLLEXPORT_DATA(wxAcceleratorTable) wxNullAcceleratorTable; #endif // wxUSE_ACCEL diff --git a/Source/3rd Party/wx/include/wx/affinematrix2d.h b/Source/3rd Party/wx/include/wx/affinematrix2d.h deleted file mode 100644 index e8380eb7c..000000000 --- a/Source/3rd Party/wx/include/wx/affinematrix2d.h +++ /dev/null @@ -1,51 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/affinematrix2d.h -// Purpose: wxAffineMatrix2D class. -// Author: Based on wxTransformMatrix by Chris Breeze, Julian Smart -// Created: 2011-04-05 -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_AFFINEMATRIX2D_H_ -#define _WX_AFFINEMATRIX2D_H_ - -#include "wx/defs.h" - -#if wxUSE_GEOMETRY - -#include "wx/affinematrix2dbase.h" - -// A simple implementation of wxAffineMatrix2DBase interface done entirely in -// wxWidgets. -class WXDLLIMPEXP_CORE wxAffineMatrix2D : public wxAffineMatrix2DBase -{ -public: - wxAffineMatrix2D() : m_11(1), m_12(0), - m_21(0), m_22(1), - m_tx(0), m_ty(0) - { - } - - // Implement base class pure virtual methods. - virtual void Set(const wxMatrix2D& mat2D, const wxPoint2DDouble& tr); - virtual void Get(wxMatrix2D* mat2D, wxPoint2DDouble* tr) const; - virtual void Concat(const wxAffineMatrix2DBase& t); - virtual bool Invert(); - virtual bool IsIdentity() const; - virtual bool IsEqual(const wxAffineMatrix2DBase& t) const; - virtual void Translate(wxDouble dx, wxDouble dy); - virtual void Scale(wxDouble xScale, wxDouble yScale); - virtual void Rotate(wxDouble cRadians); - -protected: - virtual wxPoint2DDouble DoTransformPoint(const wxPoint2DDouble& p) const; - virtual wxPoint2DDouble DoTransformDistance(const wxPoint2DDouble& p) const; - -private: - wxDouble m_11, m_12, m_21, m_22, m_tx, m_ty; -}; - -#endif // wxUSE_GEOMETRY - -#endif // _WX_AFFINEMATRIX2D_H_ diff --git a/Source/3rd Party/wx/include/wx/affinematrix2dbase.h b/Source/3rd Party/wx/include/wx/affinematrix2dbase.h deleted file mode 100644 index d60aced80..000000000 --- a/Source/3rd Party/wx/include/wx/affinematrix2dbase.h +++ /dev/null @@ -1,127 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/affinematrix2dbase.h -// Purpose: Common interface for 2D transformation matrices. -// Author: Catalin Raceanu -// Created: 2011-04-06 -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_AFFINEMATRIX2DBASE_H_ -#define _WX_AFFINEMATRIX2DBASE_H_ - -#include "wx/defs.h" - -#if wxUSE_GEOMETRY - -#include "wx/geometry.h" - -struct wxMatrix2D -{ - wxMatrix2D(wxDouble v11 = 1, - wxDouble v12 = 0, - wxDouble v21 = 0, - wxDouble v22 = 1) - { - m_11 = v11; m_12 = v12; - m_21 = v21; m_22 = v22; - } - - wxDouble m_11, m_12, m_21, m_22; -}; - -// A 2x3 matrix representing an affine 2D transformation. -// -// This is an abstract base class implemented by wxAffineMatrix2D only so far, -// but in the future we also plan to derive wxGraphicsMatrix from it (it should -// also be documented then as currently only wxAffineMatrix2D itself is). -class WXDLLIMPEXP_CORE wxAffineMatrix2DBase -{ -public: - wxAffineMatrix2DBase() {} - virtual ~wxAffineMatrix2DBase() {} - - // sets the matrix to the respective values - virtual void Set(const wxMatrix2D& mat2D, const wxPoint2DDouble& tr) = 0; - - // gets the component valuess of the matrix - virtual void Get(wxMatrix2D* mat2D, wxPoint2DDouble* tr) const = 0; - - // concatenates the matrix - virtual void Concat(const wxAffineMatrix2DBase& t) = 0; - - // makes this the inverse matrix - virtual bool Invert() = 0; - - // return true if this is the identity matrix - virtual bool IsIdentity() const = 0; - - // returns true if the elements of the transformation matrix are equal ? - virtual bool IsEqual(const wxAffineMatrix2DBase& t) const = 0; - bool operator==(const wxAffineMatrix2DBase& t) const { return IsEqual(t); } - bool operator!=(const wxAffineMatrix2DBase& t) const { return !IsEqual(t); } - - - // - // transformations - // - - // add the translation to this matrix - virtual void Translate(wxDouble dx, wxDouble dy) = 0; - - // add the scale to this matrix - virtual void Scale(wxDouble xScale, wxDouble yScale) = 0; - - // add the rotation to this matrix (counter clockwise, radians) - virtual void Rotate(wxDouble ccRadians) = 0; - - // add mirroring to this matrix - void Mirror(int direction = wxHORIZONTAL) - { - wxDouble x = (direction & wxHORIZONTAL) ? -1 : 1; - wxDouble y = (direction & wxVERTICAL) ? -1 : 1; - Scale(x, y); - } - - - // applies that matrix to the point - wxPoint2DDouble TransformPoint(const wxPoint2DDouble& src) const - { - return DoTransformPoint(src); - } - - void TransformPoint(wxDouble* x, wxDouble* y) const - { - wxCHECK_RET( x && y, "Can't be NULL" ); - - const wxPoint2DDouble dst = DoTransformPoint(wxPoint2DDouble(*x, *y)); - *x = dst.m_x; - *y = dst.m_y; - } - - // applies the matrix except for translations - wxPoint2DDouble TransformDistance(const wxPoint2DDouble& src) const - { - return DoTransformDistance(src); - } - - void TransformDistance(wxDouble* dx, wxDouble* dy) const - { - wxCHECK_RET( dx && dy, "Can't be NULL" ); - - const wxPoint2DDouble - dst = DoTransformDistance(wxPoint2DDouble(*dx, *dy)); - *dx = dst.m_x; - *dy = dst.m_y; - } - -protected: - virtual - wxPoint2DDouble DoTransformPoint(const wxPoint2DDouble& p) const = 0; - virtual - wxPoint2DDouble DoTransformDistance(const wxPoint2DDouble& p) const = 0; -}; - -#endif // wxUSE_GEOMETRY - -#endif // _WX_AFFINEMATRIX2DBASE_H_ diff --git a/Source/3rd Party/wx/include/wx/afterstd.h b/Source/3rd Party/wx/include/wx/afterstd.h index d90b49a4a..78d3a7009 100644 --- a/Source/3rd Party/wx/include/wx/afterstd.h +++ b/Source/3rd Party/wx/include/wx/afterstd.h @@ -1,10 +1,10 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: wx/afterstd.h +// Name: include/wx/afterstd.h // Purpose: #include after STL headers // Author: Vadim Zeitlin // Modified by: // Created: 07/07/03 -// RCS-ID: $Id$ +// RCS-ID: $Id: afterstd.h 61871 2009-09-09 22:29:51Z VZ $ // Copyright: (c) 2003 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -13,7 +13,7 @@ See the comments in beforestd.h. */ -#if defined(__WINDOWS__) +#if defined(__WXMSW__) #include "wx/msw/winundef.h" #endif @@ -21,6 +21,13 @@ #if defined(__VISUALC__) && __VISUALC__ <= 1201 // MSVC 5 does not have this #if _MSC_VER > 1100 + // don't restore this one for VC6, it gives it in each try/catch which is a + // bit annoying to say the least + #if _MSC_VER >= 0x1300 + // unreachable code + #pragma warning(default:4702) + #endif // VC++ >= 7 + #pragma warning(pop) #else // 'expression' : signed/unsigned mismatch @@ -39,7 +46,26 @@ #endif #endif -// see beforestd.h for explanation -#if defined(HAVE_VISIBILITY) && defined(HAVE_BROKEN_LIBSTDCXX_VISIBILITY) - #pragma GCC visibility pop -#endif +/* + Redefine _T if we undefined it in wx/beforestd.h (see comment there about + why do we do it) and if we need it (we always do when building wx itself + and might also need when compiling the user code but this must be indicated + by the special wxNEEDS__T macro) + */ +#if defined(__SUNPRO_CC) || defined(__SUNPRO_C) + #if defined(WXBUILDING) || defined(wxNEEDS_T) + /* + Undefine _T in case it was defined in the standard header. + */ + #undef _T + + /* + And define it again in the same way as it's done in wx/wxchar.h. + */ + #if wxUSE_UNICODE + #define _T(x) wxCONCAT_HELPER(L, x) + #else /* !Unicode */ + #define _T(x) x + #endif /* Unicode/!Unicode */ + #endif /* we need _T() to be defined */ +#endif /* defined(__SUNPRO_CC) || defined(__SUNPRO_C) */ diff --git a/Source/3rd Party/wx/include/wx/anidecod.h b/Source/3rd Party/wx/include/wx/anidecod.h index 9183c75e7..6e3847614 100644 --- a/Source/3rd Party/wx/include/wx/anidecod.h +++ b/Source/3rd Party/wx/include/wx/anidecod.h @@ -2,7 +2,7 @@ // Name: wx/anidecod.h // Purpose: wxANIDecoder, ANI reader for wxImage and wxAnimation // Author: Francesco Montorsi -// CVS-ID: $Id$ +// CVS-ID: $Id: anidecod.h 45563 2007-04-21 18:17:50Z VZ $ // Copyright: (c) 2006 Francesco Montorsi // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -12,7 +12,7 @@ #include "wx/defs.h" -#if wxUSE_STREAMS && (wxUSE_ICO_CUR || wxUSE_GIF) +#if wxUSE_STREAMS && wxUSE_ICO_CUR #include "wx/stream.h" #include "wx/image.h" @@ -20,7 +20,7 @@ #include "wx/dynarray.h" -class /*WXDLLIMPEXP_CORE*/ wxANIFrameInfo; // private implementation detail +class /*WXDLLEXPORT*/ wxANIFrameInfo; WX_DECLARE_EXPORTED_OBJARRAY(wxANIFrameInfo, wxANIFrameInfoArray); WX_DECLARE_EXPORTED_OBJARRAY(wxImage, wxImageArray); @@ -29,7 +29,7 @@ WX_DECLARE_EXPORTED_OBJARRAY(wxImage, wxImageArray); // wxANIDecoder class // -------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxANIDecoder : public wxAnimationDecoder +class WXDLLEXPORT wxANIDecoder : public wxAnimationDecoder { public: // constructor, destructor, etc. @@ -44,7 +44,7 @@ public: virtual wxColour GetTransparentColour(unsigned int frame) const; // implementation of wxAnimationDecoder's pure virtuals - + virtual bool CanRead( wxInputStream& stream ) const; virtual bool Load( wxInputStream& stream ); bool ConvertToImage(unsigned int frame, wxImage *image) const; @@ -55,10 +55,6 @@ public: { return wxANIMATION_TYPE_ANI; } private: - // wxAnimationDecoder pure virtual: - virtual bool DoCanRead( wxInputStream& stream ) const; - // modifies current stream position (see wxAnimationDecoder::CanRead) - // frames stored as wxImage(s): ANI files are meant to be used mostly for animated // cursors and thus they do not use any optimization to encode differences between // two frames: they are just a list of images to display sequentially. @@ -72,10 +68,10 @@ private: static wxCURHandler sm_handler; - wxDECLARE_NO_COPY_CLASS(wxANIDecoder); + DECLARE_NO_COPY_CLASS(wxANIDecoder) }; -#endif // wxUSE_STREAMS && (wxUSE_ICO_CUR || wxUSE_GIF) +#endif // wxUSE_STREAM && wxUSE_ICO_CUR #endif // _WX_ANIDECOD_H diff --git a/Source/3rd Party/wx/include/wx/animdecod.h b/Source/3rd Party/wx/include/wx/animdecod.h index 723ffa96a..a1cb15eaa 100644 --- a/Source/3rd Party/wx/include/wx/animdecod.h +++ b/Source/3rd Party/wx/include/wx/animdecod.h @@ -2,7 +2,7 @@ // Name: wx/animdecod.h // Purpose: wxAnimationDecoder // Author: Francesco Montorsi -// CVS-ID: $Id$ +// CVS-ID: $Id: animdecod.h 49563 2007-10-31 20:46:21Z VZ $ // Copyright: (c) 2006 Francesco Montorsi // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -16,9 +16,8 @@ #include "wx/colour.h" #include "wx/gdicmn.h" -#include "wx/log.h" -#include "wx/stream.h" +class WXDLLIMPEXP_FWD_BASE wxInputStream; class WXDLLIMPEXP_FWD_CORE wxImage; /* @@ -31,15 +30,15 @@ class WXDLLIMPEXP_FWD_CORE wxImage; wxAnimationDecoders always load an input stream using some optimized format to store it which is format-depedent. This allows to store a (possibly big) animation using a format which is a good compromise between required memory - and time required to blit it on the screen. + and time required to blit in on the screen. - 2) wxAnimationDecoders contain the animation data in some internal variable. + 2) wxAnimationDecoders contain the animation data in some internal var. That's why they derive from wxObjectRefData: they are data which can be shared. 3) wxAnimationDecoders can be used by a wxImageHandler to retrieve a frame in wxImage format; the viceversa cannot be done. - 4) wxAnimationDecoders are decoders only, thus they do not support save features. + 4) wxAnimationDecoders are decoders only, thus do not support save features. 5) wxAnimationDecoders are directly used by wxAnimation (generic implementation) as wxObjectRefData while they need to be 'wrapped' by a wxImageHandler for @@ -62,11 +61,11 @@ enum wxAnimationDisposal // Do not dispose. The graphic is to be left in place. wxANIM_DONOTREMOVE = 0, - // Restore to background color. The area used by the graphic must be + // Restore to background color. The area used by the graphic must be // restored to the background color. wxANIM_TOBACKGROUND = 1, - // Restore to previous. The decoder is required to restore the area + // Restore to previous. The decoder is required to restore the area // overwritten by the graphic with what was there prior to rendering the graphic. wxANIM_TOPREVIOUS = 2 }; @@ -85,37 +84,19 @@ enum wxAnimationType // wxAnimationDecoder class // -------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxAnimationDecoder : public wxObjectRefData +class WXDLLEXPORT wxAnimationDecoder : public wxObjectRefData { public: wxAnimationDecoder() { + m_background = wxNullColour; m_nFrames = 0; } + virtual ~wxAnimationDecoder() { } + virtual bool Load( wxInputStream& stream ) = 0; - - bool CanRead( wxInputStream& stream ) const - { - // NOTE: this code is the same of wxImageHandler::CallDoCanRead - - if ( !stream.IsSeekable() ) - return false; // can't test unseekable stream - - wxFileOffset posOld = stream.TellI(); - bool ok = DoCanRead(stream); - - // restore the old position to be able to test other formats and so on - if ( stream.SeekI(posOld) == wxInvalidOffset ) - { - wxLogDebug(wxT("Failed to rewind the stream in wxAnimationDecoder!")); - - // reading would fail anyhow as we're not at the right position - return false; - } - - return ok; - } + virtual bool CanRead( wxInputStream& stream ) const = 0; virtual wxAnimationDecoder *Clone() const = 0; virtual wxAnimationType GetType() const = 0; @@ -151,12 +132,6 @@ public: unsigned int GetFrameCount() const { return m_nFrames; } protected: - // checks the signature of the data in the given stream and returns true if it - // appears to be a valid animation format recognized by the animation decoder; - // this function should modify the stream current position without taking care - // of restoring it since CanRead() will do it. - virtual bool DoCanRead(wxInputStream& stream) const = 0; - wxSize m_szAnimation; unsigned int m_nFrames; @@ -165,7 +140,7 @@ protected: wxColour m_background; }; -#endif // wxUSE_STREAMS +#endif // wxUSE_STREAM #endif // _WX_ANIMDECOD_H diff --git a/Source/3rd Party/wx/include/wx/any.h b/Source/3rd Party/wx/include/wx/any.h deleted file mode 100644 index 10e3168bd..000000000 --- a/Source/3rd Party/wx/include/wx/any.h +++ /dev/null @@ -1,1110 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/any.h -// Purpose: wxAny class -// Author: Jaakko Salli -// Modified by: -// Created: 07/05/2009 -// RCS-ID: $Id$ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_ANY_H_ -#define _WX_ANY_H_ - -#include "wx/defs.h" - -#if wxUSE_ANY - -#include // for placement new -#include "wx/string.h" -#include "wx/meta/if.h" -#include "wx/typeinfo.h" -#include "wx/list.h" - -// Size of the wxAny value buffer. -enum -{ - WX_ANY_VALUE_BUFFER_SIZE = 16 -}; - -union wxAnyValueBuffer -{ - union Alignment - { - #if wxHAS_INT64 - wxInt64 m_int64; - #endif - long double m_longDouble; - void ( *m_funcPtr )(void); - void ( wxAnyValueBuffer::*m_mFuncPtr )(void); - } m_alignment; - - void* m_ptr; - wxByte m_buffer[WX_ANY_VALUE_BUFFER_SIZE]; -}; - -// -// wxAnyValueType is base class for value type functionality for C++ data -// types used with wxAny. Usually the default template (wxAnyValueTypeImpl<>) -// will create a satisfactory wxAnyValueType implementation for a data type. -// -class WXDLLIMPEXP_BASE wxAnyValueType -{ - WX_DECLARE_ABSTRACT_TYPEINFO(wxAnyValueType) -public: - /** - Default constructor. - */ - wxAnyValueType() - { - } - - /** - Destructor. - */ - virtual ~wxAnyValueType() - { - } - - /** - This function is used for internal type matching. - */ - virtual bool IsSameType(const wxAnyValueType* otherType) const = 0; - - /** - This function is called every time the data in wxAny - buffer needs to be freed. - */ - virtual void DeleteValue(wxAnyValueBuffer& buf) const = 0; - - /** - Implement this for buffer-to-buffer copy. - - @param src - This is the source data buffer. - - @param dst - This is the destination data buffer that is in either - uninitialized or freed state. - */ - virtual void CopyBuffer(const wxAnyValueBuffer& src, - wxAnyValueBuffer& dst) const = 0; - - /** - Convert value into buffer of different type. Return false if - not possible. - */ - virtual bool ConvertValue(const wxAnyValueBuffer& src, - wxAnyValueType* dstType, - wxAnyValueBuffer& dst) const = 0; - - /** - Use this template function for checking if wxAnyValueType represents - a specific C++ data type. - - @remarks This template function does not work on some older compilers - (such as Visual C++ 6.0). For full compiler compatibility - please use wxANY_VALUE_TYPE_CHECK_TYPE(valueTypePtr, T) macro - instead. - - @see wxAny::CheckType() - */ - // FIXME-VC6: remove this hack when VC6 is no longer supported - template - bool CheckType(T* reserved = NULL) const; - -#if wxUSE_EXTENDED_RTTI - virtual const wxTypeInfo* GetTypeInfo() const = 0; -#endif -private: -}; - - -// -// We need to allocate wxAnyValueType instances in heap, and need to use -// scoped ptr to properly deallocate them in dynamic library use cases. -// Here we have a minimal specialized scoped ptr implementation to deal -// with various compiler-specific problems with template class' static -// member variable of template type with explicit constructor which -// is initialized in global scope. -// -class wxAnyValueTypeScopedPtr -{ -public: - wxAnyValueTypeScopedPtr(wxAnyValueType* ptr) : m_ptr(ptr) { } - ~wxAnyValueTypeScopedPtr() { delete m_ptr; } - wxAnyValueType* get() const { return m_ptr; } -private: - wxAnyValueType* m_ptr; -}; - - -// -// This method of checking the type is compatible with VC6 -#define wxANY_VALUE_TYPE_CHECK_TYPE(valueTypePtr, T) \ - wxAnyValueTypeImpl::IsSameClass(valueTypePtr) - - -/** - Helper macro for defining user value types. - - Even though C++ RTTI would be fully available to use, we'd have to to - facilitate sub-type system which allows, for instance, wxAny with - signed short '15' to be treated equal to wxAny with signed long long '15'. - Having sm_instance is important here. - - NB: We really need to have wxAnyValueType instances allocated - in heap. They are stored as static template member variables, - and with them we just can't be too careful (eg. not allocating - them in heap broke the type identification in GCC). -*/ -#define WX_DECLARE_ANY_VALUE_TYPE(CLS) \ - friend class wxAny; \ - WX_DECLARE_TYPEINFO_INLINE(CLS) \ -public: \ - static bool IsSameClass(const wxAnyValueType* otherType) \ - { \ - return wxTypeId(*sm_instance.get()) == wxTypeId(*otherType); \ - } \ - virtual bool IsSameType(const wxAnyValueType* otherType) const \ - { \ - return IsSameClass(otherType); \ - } \ -private: \ - static wxAnyValueTypeScopedPtr sm_instance; \ -public: \ - static wxAnyValueType* GetInstance() \ - { \ - return sm_instance.get(); \ - } - - -#define WX_IMPLEMENT_ANY_VALUE_TYPE(CLS) \ -wxAnyValueTypeScopedPtr CLS::sm_instance(new CLS()); - - -#ifdef __VISUALC6__ - // "non dll-interface class 'xxx' used as base interface - #pragma warning (push) - #pragma warning (disable:4275) -#endif - -/** - Following are helper classes for the wxAnyValueTypeImplBase. -*/ -namespace wxPrivate -{ - -template -class wxAnyValueTypeOpsInplace -{ -public: - static void DeleteValue(wxAnyValueBuffer& buf) - { - T* value = reinterpret_cast(&buf.m_buffer[0]); - value->~T(); - - // Some compiler may given 'unused variable' warnings without this - wxUnusedVar(value); - } - - static void SetValue(const T& value, - wxAnyValueBuffer& buf) - { - // Use placement new - void* const place = buf.m_buffer; - ::new(place) T(value); - } - - static const T& GetValue(const wxAnyValueBuffer& buf) - { - // Breaking this code into two lines should suppress - // GCC's 'type-punned pointer will break strict-aliasing rules' - // warning. - const T* value = reinterpret_cast(&buf.m_buffer[0]); - return *value; - } -}; - - -template -class wxAnyValueTypeOpsGeneric -{ -public: - template - class DataHolder - { - public: - DataHolder(const T2& value) - { - m_value = value; - } - virtual ~DataHolder() { } - - T2 m_value; - private: - wxDECLARE_NO_COPY_CLASS(DataHolder); - }; - - static void DeleteValue(wxAnyValueBuffer& buf) - { - DataHolder* holder = static_cast*>(buf.m_ptr); - delete holder; - } - - static void SetValue(const T& value, - wxAnyValueBuffer& buf) - { - DataHolder* holder = new DataHolder(value); - buf.m_ptr = holder; - } - - static const T& GetValue(const wxAnyValueBuffer& buf) - { - DataHolder* holder = static_cast*>(buf.m_ptr); - return holder->m_value; - } -}; - -} // namespace wxPrivate - - -/** - Intermediate template for the generic value type implementation. - We can derive from this same value type for multiple actual types - (for instance, we can have wxAnyValueTypeImplInt for all signed - integer types), and also easily implement specialized templates - with specific dynamic type conversion. -*/ -template -class wxAnyValueTypeImplBase : public wxAnyValueType -{ - typedef typename wxIf< sizeof(T) <= WX_ANY_VALUE_BUFFER_SIZE, - wxPrivate::wxAnyValueTypeOpsInplace, - wxPrivate::wxAnyValueTypeOpsGeneric >::value - Ops; - -public: - wxAnyValueTypeImplBase() : wxAnyValueType() { } - virtual ~wxAnyValueTypeImplBase() { } - - virtual void DeleteValue(wxAnyValueBuffer& buf) const - { - Ops::DeleteValue(buf); - } - - virtual void CopyBuffer(const wxAnyValueBuffer& src, - wxAnyValueBuffer& dst) const - { - Ops::SetValue(Ops::GetValue(src), dst); - } - - /** - It is important to reimplement this in any specialized template - classes that inherit from wxAnyValueTypeImplBase. - */ - static void SetValue(const T& value, - wxAnyValueBuffer& buf) - { - Ops::SetValue(value, buf); - } - - /** - It is important to reimplement this in any specialized template - classes that inherit from wxAnyValueTypeImplBase. - */ - static const T& GetValue(const wxAnyValueBuffer& buf) - { - return Ops::GetValue(buf); - } -#if wxUSE_EXTENDED_RTTI - virtual const wxTypeInfo* GetTypeInfo() const - { - return wxGetTypeInfo((T*)NULL); - } -#endif -}; - - -/* - Generic value type template. Note that bulk of the implementation - resides in wxAnyValueTypeImplBase. -*/ -template -class wxAnyValueTypeImpl : public wxAnyValueTypeImplBase -{ - WX_DECLARE_ANY_VALUE_TYPE(wxAnyValueTypeImpl) -public: - wxAnyValueTypeImpl() : wxAnyValueTypeImplBase() { } - virtual ~wxAnyValueTypeImpl() { } - - virtual bool ConvertValue(const wxAnyValueBuffer& src, - wxAnyValueType* dstType, - wxAnyValueBuffer& dst) const - { - wxUnusedVar(src); - wxUnusedVar(dstType); - wxUnusedVar(dst); - return false; - } -}; - -template -wxAnyValueTypeScopedPtr wxAnyValueTypeImpl::sm_instance = new wxAnyValueTypeImpl(); - - -// -// Helper macro for using same base value type implementation for multiple -// actual C++ data types. -// -#define _WX_ANY_DEFINE_SUB_TYPE(T, CLSTYPE) \ -template<> \ -class wxAnyValueTypeImpl : public wxAnyValueTypeImpl##CLSTYPE \ -{ \ - typedef wxAnyBase##CLSTYPE##Type UseDataType; \ -public: \ - wxAnyValueTypeImpl() : wxAnyValueTypeImpl##CLSTYPE() { } \ - virtual ~wxAnyValueTypeImpl() { } \ - static void SetValue(const T& value, wxAnyValueBuffer& buf) \ - { \ - void* voidPtr = reinterpret_cast(&buf.m_buffer[0]); \ - UseDataType* dptr = reinterpret_cast(voidPtr); \ - *dptr = static_cast(value); \ - } \ - static T GetValue(const wxAnyValueBuffer& buf) \ - { \ - const void* voidPtr = \ - reinterpret_cast(&buf.m_buffer[0]); \ - const UseDataType* sptr = \ - reinterpret_cast(voidPtr); \ - return static_cast(*sptr); \ - } - -#if wxUSE_EXTENDED_RTTI -#define WX_ANY_DEFINE_SUB_TYPE(T, CLSTYPE) \ -_WX_ANY_DEFINE_SUB_TYPE(T, CLSTYPE)\ - virtual const wxTypeInfo* GetTypeInfo() const \ - { \ - return wxGetTypeInfo((T*)NULL); \ - } \ -}; -#else -#define WX_ANY_DEFINE_SUB_TYPE(T, CLSTYPE) \ -_WX_ANY_DEFINE_SUB_TYPE(T, CLSTYPE)\ -}; -#endif - -// -// Integer value types -// - -#ifdef wxLongLong_t - typedef wxLongLong_t wxAnyBaseIntType; - typedef wxULongLong_t wxAnyBaseUintType; -#else - typedef long wxAnyBaseIntType; - typedef unsigned long wxAnyBaseUintType; -#endif - - -class WXDLLIMPEXP_BASE wxAnyValueTypeImplInt : - public wxAnyValueTypeImplBase -{ - WX_DECLARE_ANY_VALUE_TYPE(wxAnyValueTypeImplInt) -public: - wxAnyValueTypeImplInt() : - wxAnyValueTypeImplBase() { } - virtual ~wxAnyValueTypeImplInt() { } - - virtual bool ConvertValue(const wxAnyValueBuffer& src, - wxAnyValueType* dstType, - wxAnyValueBuffer& dst) const; -}; - - -class WXDLLIMPEXP_BASE wxAnyValueTypeImplUint : - public wxAnyValueTypeImplBase -{ - WX_DECLARE_ANY_VALUE_TYPE(wxAnyValueTypeImplUint) -public: - wxAnyValueTypeImplUint() : - wxAnyValueTypeImplBase() { } - virtual ~wxAnyValueTypeImplUint() { } - - virtual bool ConvertValue(const wxAnyValueBuffer& src, - wxAnyValueType* dstType, - wxAnyValueBuffer& dst) const; -}; - - -WX_ANY_DEFINE_SUB_TYPE(signed long, Int) -WX_ANY_DEFINE_SUB_TYPE(signed int, Int) -WX_ANY_DEFINE_SUB_TYPE(signed short, Int) -WX_ANY_DEFINE_SUB_TYPE(signed char, Int) -#ifdef wxLongLong_t -WX_ANY_DEFINE_SUB_TYPE(wxLongLong_t, Int) -#endif - -WX_ANY_DEFINE_SUB_TYPE(unsigned long, Uint) -WX_ANY_DEFINE_SUB_TYPE(unsigned int, Uint) -WX_ANY_DEFINE_SUB_TYPE(unsigned short, Uint) -WX_ANY_DEFINE_SUB_TYPE(unsigned char, Uint) -#ifdef wxLongLong_t -WX_ANY_DEFINE_SUB_TYPE(wxULongLong_t, Uint) -#endif - - -// -// This macro is used in header, but then in source file we must have: -// WX_IMPLEMENT_ANY_VALUE_TYPE(wxAnyValueTypeImpl##TYPENAME) -// -#define _WX_ANY_DEFINE_CONVERTIBLE_TYPE(T, TYPENAME, CONVFUNC, GV) \ -class WXDLLIMPEXP_BASE wxAnyValueTypeImpl##TYPENAME : \ - public wxAnyValueTypeImplBase \ -{ \ - WX_DECLARE_ANY_VALUE_TYPE(wxAnyValueTypeImpl##TYPENAME) \ -public: \ - wxAnyValueTypeImpl##TYPENAME() : \ - wxAnyValueTypeImplBase() { } \ - virtual ~wxAnyValueTypeImpl##TYPENAME() { } \ - virtual bool ConvertValue(const wxAnyValueBuffer& src, \ - wxAnyValueType* dstType, \ - wxAnyValueBuffer& dst) const \ - { \ - GV value = GetValue(src); \ - return CONVFUNC(value, dstType, dst); \ - } \ -}; \ -template<> \ -class wxAnyValueTypeImpl : public wxAnyValueTypeImpl##TYPENAME \ -{ \ -public: \ - wxAnyValueTypeImpl() : wxAnyValueTypeImpl##TYPENAME() { } \ - virtual ~wxAnyValueTypeImpl() { } \ -}; - -#define WX_ANY_DEFINE_CONVERTIBLE_TYPE(T, TYPENAME, CONVFUNC, BT) \ -_WX_ANY_DEFINE_CONVERTIBLE_TYPE(T, TYPENAME, CONVFUNC, BT) \ - -#define WX_ANY_DEFINE_CONVERTIBLE_TYPE_BASE(T, TYPENAME, CONVFUNC) \ -_WX_ANY_DEFINE_CONVERTIBLE_TYPE(T, TYPENAME, \ - CONVFUNC, const T&) \ - -// -// String value type -// - -// Convert wxString to destination wxAny value type -extern WXDLLIMPEXP_BASE bool wxAnyConvertString(const wxString& value, - wxAnyValueType* dstType, - wxAnyValueBuffer& dst); - -WX_ANY_DEFINE_CONVERTIBLE_TYPE_BASE(wxString, wxString, wxAnyConvertString) -WX_ANY_DEFINE_CONVERTIBLE_TYPE(const char*, ConstCharPtr, - wxAnyConvertString, wxString) -WX_ANY_DEFINE_CONVERTIBLE_TYPE(const wchar_t*, ConstWchar_tPtr, - wxAnyConvertString, wxString) - -// -// Bool value type -// -template<> -class WXDLLIMPEXP_BASE wxAnyValueTypeImpl : - public wxAnyValueTypeImplBase -{ - WX_DECLARE_ANY_VALUE_TYPE(wxAnyValueTypeImpl) -public: - wxAnyValueTypeImpl() : - wxAnyValueTypeImplBase() { } - virtual ~wxAnyValueTypeImpl() { } - - virtual bool ConvertValue(const wxAnyValueBuffer& src, - wxAnyValueType* dstType, - wxAnyValueBuffer& dst) const; -}; - -// -// Floating point value type -// -class WXDLLIMPEXP_BASE wxAnyValueTypeImplDouble : - public wxAnyValueTypeImplBase -{ - WX_DECLARE_ANY_VALUE_TYPE(wxAnyValueTypeImplDouble) -public: - wxAnyValueTypeImplDouble() : - wxAnyValueTypeImplBase() { } - virtual ~wxAnyValueTypeImplDouble() { } - - virtual bool ConvertValue(const wxAnyValueBuffer& src, - wxAnyValueType* dstType, - wxAnyValueBuffer& dst) const; -}; - -// WX_ANY_DEFINE_SUB_TYPE requires this -typedef double wxAnyBaseDoubleType; - -WX_ANY_DEFINE_SUB_TYPE(float, Double) -WX_ANY_DEFINE_SUB_TYPE(double, Double) - - -// -// Defines a dummy wxAnyValueTypeImpl<> with given export -// declaration. This is needed if a class is used with -// wxAny in both user shared library and application. -// -#define wxDECLARE_ANY_TYPE(CLS, DECL) \ -template<> \ -class DECL wxAnyValueTypeImpl : \ - public wxAnyValueTypeImplBase \ -{ \ - WX_DECLARE_ANY_VALUE_TYPE(wxAnyValueTypeImpl) \ -public: \ - wxAnyValueTypeImpl() : \ - wxAnyValueTypeImplBase() { } \ - virtual ~wxAnyValueTypeImpl() { } \ - \ - virtual bool ConvertValue(const wxAnyValueBuffer& src, \ - wxAnyValueType* dstType, \ - wxAnyValueBuffer& dst) const \ - { \ - wxUnusedVar(src); \ - wxUnusedVar(dstType); \ - wxUnusedVar(dst); \ - return false; \ - } \ -}; - - -// Make sure some of wx's own types get the right wxAnyValueType export -// (this is needed only for types that are referred to from wxBase. -// currently we may not use any of these types from there, but let's -// use the macro on at least one to make sure it compiles since we can't -// really test it properly in unit tests since a separate DLL would -// be needed). -#if wxUSE_DATETIME - #include "wx/datetime.h" - wxDECLARE_ANY_TYPE(wxDateTime, WXDLLIMPEXP_BASE) -#endif - -//#include "wx/object.h" -//wxDECLARE_ANY_TYPE(wxObject*, WXDLLIMPEXP_BASE) - -//#include "wx/arrstr.h" -//wxDECLARE_ANY_TYPE(wxArrayString, WXDLLIMPEXP_BASE) - - -#if wxUSE_VARIANT - -class WXDLLIMPEXP_FWD_BASE wxAnyToVariantRegistration; - -// Because of header inter-dependencies, cannot include this earlier -#include "wx/variant.h" - -// -// wxVariantData* data type implementation. For cases when appropriate -// wxAny<->wxVariant conversion code is missing. -// - -class WXDLLIMPEXP_BASE wxAnyValueTypeImplVariantData : - public wxAnyValueTypeImplBase -{ - WX_DECLARE_ANY_VALUE_TYPE(wxAnyValueTypeImplVariantData) -public: - wxAnyValueTypeImplVariantData() : - wxAnyValueTypeImplBase() { } - virtual ~wxAnyValueTypeImplVariantData() { } - - virtual void DeleteValue(wxAnyValueBuffer& buf) const - { - wxVariantData* data = static_cast(buf.m_ptr); - if ( data ) - data->DecRef(); - } - - virtual void CopyBuffer(const wxAnyValueBuffer& src, - wxAnyValueBuffer& dst) const - { - wxVariantData* data = static_cast(src.m_ptr); - if ( data ) - data->IncRef(); - dst.m_ptr = data; - } - - static void SetValue(wxVariantData* value, - wxAnyValueBuffer& buf) - { - value->IncRef(); - buf.m_ptr = value; - } - - static wxVariantData* GetValue(const wxAnyValueBuffer& buf) - { - return static_cast(buf.m_ptr); - } - - virtual bool ConvertValue(const wxAnyValueBuffer& src, - wxAnyValueType* dstType, - wxAnyValueBuffer& dst) const - { - wxUnusedVar(src); - wxUnusedVar(dstType); - wxUnusedVar(dst); - return false; - } -}; - -template<> -class wxAnyValueTypeImpl : - public wxAnyValueTypeImplVariantData -{ -public: - wxAnyValueTypeImpl() : wxAnyValueTypeImplVariantData() { } - virtual ~wxAnyValueTypeImpl() { } -}; - -#endif // wxUSE_VARIANT - -#ifdef __VISUALC6__ - // Re-enable useless VC6 warnings - #pragma warning (pop) -#endif - - -/* - Let's define a discrete Null value so we don't have to really - ever check if wxAny.m_type pointer is NULL or not. This is an - optimization, mostly. Implementation of this value type is - "hidden" in the source file. -*/ -extern WXDLLIMPEXP_DATA_BASE(wxAnyValueType*) wxAnyNullValueType; - - -// -// We need to implement custom signed/unsigned int equals operators -// for signed/unsigned (eg. wxAny(128UL) == 128L) comparisons to work. -#define WXANY_IMPLEMENT_INT_EQ_OP(TS, TUS) \ -bool operator==(TS value) const \ -{ \ - if ( wxAnyValueTypeImpl::IsSameClass(m_type) ) \ - return (value == static_cast \ - (wxAnyValueTypeImpl::GetValue(m_buffer))); \ - if ( wxAnyValueTypeImpl::IsSameClass(m_type) ) \ - return (value == static_cast \ - (wxAnyValueTypeImpl::GetValue(m_buffer))); \ - return false; \ -} \ -bool operator==(TUS value) const \ -{ \ - if ( wxAnyValueTypeImpl::IsSameClass(m_type) ) \ - return (value == static_cast \ - (wxAnyValueTypeImpl::GetValue(m_buffer))); \ - if ( wxAnyValueTypeImpl::IsSameClass(m_type) ) \ - return (value == static_cast \ - (wxAnyValueTypeImpl::GetValue(m_buffer))); \ - return false; \ -} - - -#if wxUSE_VARIANT - -// Note that the following functions are implemented outside wxAny class -// so that it can reside entirely in header and lack the export declaration. - -// Helper function used to associate wxAnyValueType with a wxVariantData. -extern WXDLLIMPEXP_BASE void -wxPreRegisterAnyToVariant(wxAnyToVariantRegistration* reg); - -// This function performs main wxAny to wxVariant conversion duties. -extern WXDLLIMPEXP_BASE bool -wxConvertAnyToVariant(const wxAny& any, wxVariant* variant); - -#endif // wxUSE_VARIANT - - -// -// The wxAny class represents a container for any type. A variant's value -// can be changed at run time, possibly to a different type of value. -// -// As standard, wxAny can store value of almost any type, in a fairly -// optimal manner even. -// -class wxAny -{ -public: - /** - Default constructor. - */ - wxAny() - { - m_type = wxAnyNullValueType; - } - - /** - Destructor. - */ - ~wxAny() - { - m_type->DeleteValue(m_buffer); - } - - //@{ - /** - Various constructors. - */ - template - wxAny(const T& value) - { - m_type = wxAnyValueTypeImpl::sm_instance.get(); - wxAnyValueTypeImpl::SetValue(value, m_buffer); - } - - // These two constructors are needed to deal with string literals - wxAny(const char* value) - { - m_type = wxAnyValueTypeImpl::sm_instance.get(); - wxAnyValueTypeImpl::SetValue(value, m_buffer); - } - wxAny(const wchar_t* value) - { - m_type = wxAnyValueTypeImpl::sm_instance.get(); - wxAnyValueTypeImpl::SetValue(value, m_buffer); - } - - wxAny(const wxAny& any) - { - m_type = wxAnyNullValueType; - AssignAny(any); - } - -#if wxUSE_VARIANT - wxAny(const wxVariant& variant) - { - m_type = wxAnyNullValueType; - AssignVariant(variant); - } -#endif - - //@} - - /** - Use this template function for checking if this wxAny holds - a specific C++ data type. - - @remarks This template function does not work on some older compilers - (such as Visual C++ 6.0). For full compiler ccompatibility - please use wxANY_CHECK_TYPE(any, T) macro instead. - - @see wxAnyValueType::CheckType() - */ - // FIXME-VC6: remove this hack when VC6 is no longer supported - template - bool CheckType(T* = NULL) const - { - return m_type->CheckType(); - } - - /** - Returns the value type as wxAnyValueType instance. - - @remarks You cannot reliably test whether two wxAnys are of - same value type by simply comparing return values - of wxAny::GetType(). Instead, use wxAny::HasSameType(). - - @see HasSameType() - */ - const wxAnyValueType* GetType() const - { - return m_type; - } - - /** - Returns @true if this and another wxAny have the same - value type. - */ - bool HasSameType(const wxAny& other) const - { - return GetType()->IsSameType(other.GetType()); - } - - /** - Tests if wxAny is null (that is, whether there is no data). - */ - bool IsNull() const - { - return (m_type == wxAnyNullValueType); - } - - /** - Makes wxAny null (that is, clears it). - */ - void MakeNull() - { - m_type->DeleteValue(m_buffer); - m_type = wxAnyNullValueType; - } - - //@{ - /** - Assignment operators. - */ - template - wxAny& operator=(const T &value) - { - m_type->DeleteValue(m_buffer); - m_type = wxAnyValueTypeImpl::sm_instance.get(); - wxAnyValueTypeImpl::SetValue(value, m_buffer); - return *this; - } - - wxAny& operator=(const wxAny &any) - { - if (this != &any) - AssignAny(any); - return *this; - } - -#if wxUSE_VARIANT - wxAny& operator=(const wxVariant &variant) - { - AssignVariant(variant); - return *this; - } -#endif - - // These two operators are needed to deal with string literals - wxAny& operator=(const char* value) - { - Assign(value); - return *this; - } - wxAny& operator=(const wchar_t* value) - { - Assign(value); - return *this; - } - - //@{ - /** - Equality operators. - */ - bool operator==(const wxString& value) const - { - wxString value2; - if ( !GetAs(&value2) ) - return false; - return value == value2; - } - - bool operator==(const char* value) const - { return (*this) == wxString(value); } - bool operator==(const wchar_t* value) const - { return (*this) == wxString(value); } - - // - // We need to implement custom signed/unsigned int equals operators - // for signed/unsigned (eg. wxAny(128UL) == 128L) comparisons to work. - WXANY_IMPLEMENT_INT_EQ_OP(signed char, unsigned char) - WXANY_IMPLEMENT_INT_EQ_OP(signed short, unsigned short) - WXANY_IMPLEMENT_INT_EQ_OP(signed int, unsigned int) - WXANY_IMPLEMENT_INT_EQ_OP(signed long, unsigned long) -#ifdef wxLongLong_t - WXANY_IMPLEMENT_INT_EQ_OP(wxLongLong_t, wxULongLong_t) -#endif - - bool operator==(float value) const - { - if ( !wxAnyValueTypeImpl::IsSameClass(m_type) ) - return false; - - return value == - static_cast - (wxAnyValueTypeImpl::GetValue(m_buffer)); - } - - bool operator==(double value) const - { - if ( !wxAnyValueTypeImpl::IsSameClass(m_type) ) - return false; - - return value == - static_cast - (wxAnyValueTypeImpl::GetValue(m_buffer)); - } - - bool operator==(bool value) const - { - if ( !wxAnyValueTypeImpl::IsSameClass(m_type) ) - return false; - - return value == (wxAnyValueTypeImpl::GetValue(m_buffer)); - } - - //@} - - //@{ - /** - Inequality operators (implement as template). - */ - template - bool operator!=(const T& value) const - { return !((*this) == value); } - //@} - - /** - This template function converts wxAny into given type. In most cases - no type conversion is performed, so if the type is incorrect an - assertion failure will occur. - - @remarks For convenience, conversion is done when T is wxString. This - is useful when a string literal (which are treated as - const char* and const wchar_t*) has been assigned to wxAny. - - This template function may not work properly with Visual C++ - 6. For full compiler compatibility, please use - wxANY_AS(any, T) macro instead. - */ - // FIXME-VC6: remove this hack when VC6 is no longer supported - template - T As(T* = NULL) const - { - if ( !wxAnyValueTypeImpl::IsSameClass(m_type) ) - { - wxFAIL_MSG("Incorrect or non-convertible data type"); - } - - return static_cast(wxAnyValueTypeImpl::GetValue(m_buffer)); - } - - // Allow easy conversion from 'const char *' etc. to wxString - // FIXME-VC6: remove this hack when VC6 is no longer supported - //template<> - wxString As(wxString*) const - { - wxString value; - if ( !GetAs(&value) ) - { - wxFAIL_MSG("Incorrect or non-convertible data type"); - } - return value; - } - -#if wxUSE_EXTENDED_RTTI - const wxTypeInfo* GetTypeInfo() const - { - return m_type->GetTypeInfo(); - } -#endif - /** - Template function that retrieves and converts the value of this - variant to the type that T* value is. - - @return Returns @true if conversion was successful. - */ - template - bool GetAs(T* value) const - { - if ( !wxAnyValueTypeImpl::IsSameClass(m_type) ) - { - wxAnyValueType* otherType = - wxAnyValueTypeImpl::sm_instance.get(); - wxAnyValueBuffer temp_buf; - - if ( !m_type->ConvertValue(m_buffer, otherType, temp_buf) ) - return false; - - *value = - static_cast(wxAnyValueTypeImpl::GetValue(temp_buf)); - otherType->DeleteValue(temp_buf); - - return true; - } - *value = static_cast(wxAnyValueTypeImpl::GetValue(m_buffer)); - return true; - } - -#if wxUSE_VARIANT - // GetAs() wxVariant specialization - bool GetAs(wxVariant* value) const - { - return wxConvertAnyToVariant(*this, value); - } -#endif - -private: - // Assignment functions - void AssignAny(const wxAny& any) - { - // Must delete value - CopyBuffer() never does that - m_type->DeleteValue(m_buffer); - - wxAnyValueType* newType = any.m_type; - - if ( !newType->IsSameType(m_type) ) - m_type = newType; - - newType->CopyBuffer(any.m_buffer, m_buffer); - } - -#if wxUSE_VARIANT - void AssignVariant(const wxVariant& variant) - { - wxVariantData* data = variant.GetData(); - - if ( data && data->GetAsAny(this) ) - return; - - m_type->DeleteValue(m_buffer); - - if ( variant.IsNull() ) - { - // Init as Null - m_type = wxAnyNullValueType; - } - else - { - // If everything else fails, wrap the whole wxVariantData - m_type = wxAnyValueTypeImpl::sm_instance.get(); - wxAnyValueTypeImpl::SetValue(data, m_buffer); - } - } -#endif - - template - void Assign(const T &value) - { - m_type->DeleteValue(m_buffer); - m_type = wxAnyValueTypeImpl::sm_instance.get(); - wxAnyValueTypeImpl::SetValue(value, m_buffer); - } - - // Data - wxAnyValueBuffer m_buffer; - wxAnyValueType* m_type; -}; - - -// -// This method of checking the type is compatible with VC6 -#define wxANY_CHECK_TYPE(any, T) \ - wxANY_VALUE_TYPE_CHECK_TYPE((any).GetType(), T) - - -// -// This method of getting the value is compatible with VC6 -#define wxANY_AS(any, T) \ - (any).As(static_cast(NULL)) - - -template -inline bool wxAnyValueType::CheckType(T* reserved) const -{ - wxUnusedVar(reserved); - return wxAnyValueTypeImpl::IsSameClass(this); -} - -WX_DECLARE_LIST_WITH_DECL(wxAny, wxAnyList, class WXDLLIMPEXP_BASE); - -#endif // wxUSE_ANY - -#endif // _WX_ANY_H_ diff --git a/Source/3rd Party/wx/include/wx/anybutton.h b/Source/3rd Party/wx/include/wx/anybutton.h deleted file mode 100644 index 520f51222..000000000 --- a/Source/3rd Party/wx/include/wx/anybutton.h +++ /dev/null @@ -1,200 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/anybutton.h -// Purpose: wxAnyButtonBase class -// Author: Vadim Zetlin -// Created: 2000-08-15 (extracted from button.h) -// RCS-ID: $Id$ -// Copyright: (c) Vadim Zetlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_ANYBUTTON_H_BASE_ -#define _WX_ANYBUTTON_H_BASE_ - -#include "wx/defs.h" - -#ifdef wxHAS_ANY_BUTTON - -// ---------------------------------------------------------------------------- -// wxAnyButton specific flags -// ---------------------------------------------------------------------------- - -// These flags affect label alignment -#define wxBU_LEFT 0x0040 -#define wxBU_TOP 0x0080 -#define wxBU_RIGHT 0x0100 -#define wxBU_BOTTOM 0x0200 -#define wxBU_ALIGN_MASK ( wxBU_LEFT | wxBU_TOP | wxBU_RIGHT | wxBU_BOTTOM ) - -// These two flags are obsolete -#define wxBU_NOAUTODRAW 0x0000 -#define wxBU_AUTODRAW 0x0004 - -// by default, the buttons will be created with some (system dependent) -// minimal size to make them look nicer, giving this style will make them as -// small as possible -#define wxBU_EXACTFIT 0x0001 - -// this flag can be used to disable using the text label in the button: it is -// mostly useful when creating buttons showing bitmap and having stock id as -// without it both the standard label corresponding to the stock id and the -// bitmap would be shown -#define wxBU_NOTEXT 0x0002 - - -#include "wx/bitmap.h" -#include "wx/control.h" - -// ---------------------------------------------------------------------------- -// wxAnyButton: common button functionality -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxAnyButtonBase : public wxControl -{ -public: - wxAnyButtonBase() { } - - // show the image in the button in addition to the label: this method is - // supported on all (major) platforms - void SetBitmap(const wxBitmap& bitmap, wxDirection dir = wxLEFT) - { - SetBitmapLabel(bitmap); - SetBitmapPosition(dir); - } - - wxBitmap GetBitmap() const { return DoGetBitmap(State_Normal); } - - // Methods for setting individual images for different states: normal, - // selected (meaning pushed or pressed), focused (meaning normal state for - // a focused button), disabled or hover (a.k.a. hot or current). - // - // Remember that SetBitmap() itself must be called before any other - // SetBitmapXXX() methods (except for SetBitmapLabel() which is a synonym - // for it anyhow) and that all bitmaps passed to these functions should be - // of the same size. - void SetBitmapLabel(const wxBitmap& bitmap) - { DoSetBitmap(bitmap, State_Normal); } - void SetBitmapPressed(const wxBitmap& bitmap) - { DoSetBitmap(bitmap, State_Pressed); } - void SetBitmapDisabled(const wxBitmap& bitmap) - { DoSetBitmap(bitmap, State_Disabled); } - void SetBitmapCurrent(const wxBitmap& bitmap) - { DoSetBitmap(bitmap, State_Current); } - void SetBitmapFocus(const wxBitmap& bitmap) - { DoSetBitmap(bitmap, State_Focused); } - - wxBitmap GetBitmapLabel() const { return DoGetBitmap(State_Normal); } - wxBitmap GetBitmapPressed() const { return DoGetBitmap(State_Pressed); } - wxBitmap GetBitmapDisabled() const { return DoGetBitmap(State_Disabled); } - wxBitmap GetBitmapCurrent() const { return DoGetBitmap(State_Current); } - wxBitmap GetBitmapFocus() const { return DoGetBitmap(State_Focused); } - - - // set the margins around the image - void SetBitmapMargins(wxCoord x, wxCoord y) { DoSetBitmapMargins(x, y); } - void SetBitmapMargins(const wxSize& sz) { DoSetBitmapMargins(sz.x, sz.y); } - wxSize GetBitmapMargins() { return DoGetBitmapMargins(); } - - // set the image position relative to the text, i.e. wxLEFT means that the - // image is to the left of the text (this is the default) - void SetBitmapPosition(wxDirection dir); - - - // Buttons on MSW can look bad if they are not native colours, because - // then they become owner-drawn and not theme-drawn. Disable it here - // in wxAnyButtonBase to make it consistent. - virtual bool ShouldInheritColours() const { return false; } - - // wxUniv-compatible and deprecated equivalents to SetBitmapXXX() -#if WXWIN_COMPATIBILITY_2_8 - void SetImageLabel(const wxBitmap& bitmap) { SetBitmap(bitmap); } - void SetImageMargins(wxCoord x, wxCoord y) { SetBitmapMargins(x, y); } -#endif // WXWIN_COMPATIBILITY_2_8 - - // backwards compatible names for pressed/current bitmaps: they're not - // deprecated as there is nothing really wrong with using them and no real - // advantage to using the new names but the new names are still preferred - wxBitmap GetBitmapSelected() const { return GetBitmapPressed(); } - wxBitmap GetBitmapHover() const { return GetBitmapCurrent(); } - - void SetBitmapSelected(const wxBitmap& bitmap) { SetBitmapPressed(bitmap); } - void SetBitmapHover(const wxBitmap& bitmap) { SetBitmapCurrent(bitmap); } - - - // this enum is not part of wx public API, it is public because it is used - // in non wxAnyButton-derived classes internally - // - // also notice that MSW code relies on the values of the enum elements, do - // not change them without revising src/msw/button.cpp - enum State - { - State_Normal, - State_Current, // a.k.a. hot or "hovering" - State_Pressed, // a.k.a. "selected" in public API for some reason - State_Disabled, - State_Focused, - State_Max - }; - - // return true if this button shouldn't show the text label, either because - // it doesn't have it or because it was explicitly disabled with wxBU_NOTEXT - bool DontShowLabel() const - { - return HasFlag(wxBU_NOTEXT) || GetLabel().empty(); - } - - // return true if we do show the label - bool ShowsLabel() const - { - return !DontShowLabel(); - } - -protected: - // choose the default border for this window - virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } - - virtual wxBitmap DoGetBitmap(State WXUNUSED(which)) const - { return wxBitmap(); } - virtual void DoSetBitmap(const wxBitmap& WXUNUSED(bitmap), - State WXUNUSED(which)) - { } - - virtual wxSize DoGetBitmapMargins() const - { return wxSize(0, 0); } - - virtual void DoSetBitmapMargins(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y)) - { } - - virtual void DoSetBitmapPosition(wxDirection WXUNUSED(dir)) - { } - - virtual bool DoGetAuthNeeded() const { return false; } - virtual void DoSetAuthNeeded(bool WXUNUSED(show)) { } - - - wxDECLARE_NO_COPY_CLASS(wxAnyButtonBase); -}; - -#if defined(__WXUNIVERSAL__) - #include "wx/univ/anybutton.h" -#elif defined(__WXMSW__) - #include "wx/msw/anybutton.h" -//#elif defined(__WXMOTIF__) -// #include "wx/motif/anybutton.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/anybutton.h" -//#elif defined(__WXGTK__) -// #include "wx/gtk1/anybutton.h" -#elif defined(__WXMAC__) - #include "wx/osx/anybutton.h" -//#elif defined(__WXCOCOA__) -// #include "wx/cocoa/anybutton.h" -//#elif defined(__WXPM__) -// #include "wx/os2/anybutton.h" -#else - typedef wxAnyButtonBase wxAnyButton; -#endif - -#endif // wxHAS_ANY_BUTTON - -#endif // _WX_ANYBUTTON_H_BASE_ diff --git a/Source/3rd Party/wx/include/wx/anystr.h b/Source/3rd Party/wx/include/wx/anystr.h deleted file mode 100644 index c924304f1..000000000 --- a/Source/3rd Party/wx/include/wx/anystr.h +++ /dev/null @@ -1,140 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/anystr.h -// Purpose: wxAnyStrPtr class declaration -// Author: Vadim Zeitlin -// Created: 2009-03-23 -// RCS-ID: $Id$ -// Copyright: (c) 2008 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_ANYSTR_H_ -#define _WX_ANYSTR_H_ - -#include "wx/string.h" - -// ---------------------------------------------------------------------------- -// wxAnyStrPtr -// -// Notice that this is an internal and intentionally not documented class. It -// is only used by wxWidgets itself to ensure compatibility with previous -// versions and shouldn't be used by user code. When you see a function -// returning it you should just know that you can treat it as a string pointer. -// ---------------------------------------------------------------------------- - -// This is a helper class convertible to either narrow or wide string pointer. -// It is similar to wxCStrData but, unlike it, can be NULL which is required to -// represent the return value of wxDateTime::ParseXXX() methods for example. -// -// NB: this class is fully inline and so doesn't need to be DLL-exported -class wxAnyStrPtr -{ -public: - // ctors: this class must be created from the associated string or using - // its default ctor for an invalid NULL-like object; notice that it is - // immutable after creation. - - // ctor for invalid pointer - wxAnyStrPtr() - : m_str(NULL) - { - } - - // ctor for valid pointer into the given string (whose lifetime must be - // greater than ours and which should remain constant while we're used) - wxAnyStrPtr(const wxString& str, const wxString::const_iterator& iter) - : m_str(&str), - m_iter(iter) - { - } - - // default copy ctor is ok and so is default dtor, in particular we do not - // free the string - - - // various operators meant to make this class look like a superposition of - // char* and wchar_t* - - // this one is needed to allow boolean expressions involving these objects, - // e.g. "if ( FuncReturningAnyStrPtr() && ... )" (unfortunately using - // unspecified_bool_type here wouldn't help with ambiguity between all the - // different conversions to pointers) - operator bool() const { return m_str != NULL; } - - // at least VC6 and VC7 also need this one or they complain about ambiguity - // for !anystr expressions - bool operator!() const { return !((bool)*this); } - - - // and these are the conversions operator which allow to assign the result - // of FuncReturningAnyStrPtr() to either char* or wxChar* (i.e. wchar_t*) - operator const char *() const - { - if ( !m_str ) - return NULL; - - // check if the string is convertible to char at all - // - // notice that this pointer points into wxString internal buffer - // containing its char* representation and so it can be kept for as - // long as wxString is not modified -- which is long enough for our - // needs - const char *p = m_str->c_str().AsChar(); - if ( *p ) - { - // find the offset of the character corresponding to this iterator - // position in bytes: we don't have any direct way to do it so we - // need to redo the conversion again for the part of the string - // before the iterator to find its length in bytes in current - // locale - // - // NB: conversion won't fail as it succeeded for the entire string - p += strlen(wxString(m_str->begin(), m_iter).mb_str()); - } - //else: conversion failed, return "" as we can't do anything else - - return p; - } - - operator const wchar_t *() const - { - if ( !m_str ) - return NULL; - - // no complications with wide strings (as long as we discount - // surrogates as we do for now) - // - // just remember that this works as long as wxString keeps an internal - // buffer with its wide wide char representation, just as with AsChar() - // above - return m_str->c_str().AsWChar() + (m_iter - m_str->begin()); - } - - // Because the objects of this class are only used as return type for - // functions which can return NULL we can skip providing dereferencing - // operators: the code using this class must test it for NULL first and if - // it does anything else with it it has to assign it to either char* or - // wchar_t* itself, before dereferencing. - // - // IOW this - // - // if ( *FuncReturningAnyStrPtr() ) - // - // is invalid because it could crash. And this - // - // const char *p = FuncReturningAnyStrPtr(); - // if ( p && *p ) - // - // already works fine. - -private: - // the original string and the position in it we correspond to, if the - // string is NULL this object is NULL pointer-like - const wxString * const m_str; - const wxString::const_iterator m_iter; - - wxDECLARE_NO_ASSIGN_CLASS(wxAnyStrPtr); -}; - -#endif // _WX_ANYSTR_H_ - diff --git a/Source/3rd Party/wx/include/wx/app.h b/Source/3rd Party/wx/include/wx/app.h index 82a0eaecd..b7d500b12 100644 --- a/Source/3rd Party/wx/include/wx/app.h +++ b/Source/3rd Party/wx/include/wx/app.h @@ -5,7 +5,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: app.h 51592 2008-02-08 08:17:41Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -18,29 +18,21 @@ // ---------------------------------------------------------------------------- #include "wx/event.h" // for the base class -#include "wx/eventfilter.h" // (and another one) #include "wx/build.h" -#include "wx/cmdargs.h" // for wxCmdLineArgsArray used by wxApp::argv #include "wx/init.h" // we must declare wxEntry() #include "wx/intl.h" // for wxLayoutDirection -#include "wx/log.h" // for wxDISABLE_DEBUG_LOGGING_IN_RELEASE_BUILD() class WXDLLIMPEXP_FWD_BASE wxAppConsole; class WXDLLIMPEXP_FWD_BASE wxAppTraits; class WXDLLIMPEXP_FWD_BASE wxCmdLineParser; -class WXDLLIMPEXP_FWD_BASE wxEventLoopBase; +class WXDLLIMPEXP_FWD_BASE wxLog; class WXDLLIMPEXP_FWD_BASE wxMessageOutput; #if wxUSE_GUI + class WXDLLIMPEXP_FWD_BASE wxEventLoop; struct WXDLLIMPEXP_FWD_CORE wxVideoMode; - class WXDLLIMPEXP_FWD_CORE wxWindow; #endif -// this macro should be used in any main() or equivalent functions defined in wx -#define wxDISABLE_DEBUG_SUPPORT() \ - wxDISABLE_ASSERTS_IN_RELEASE_BUILD(); \ - wxDISABLE_DEBUG_LOGGING_IN_RELEASE_BUILD() - // ---------------------------------------------------------------------------- // typedefs // ---------------------------------------------------------------------------- @@ -59,25 +51,15 @@ enum }; // ---------------------------------------------------------------------------- -// global variables +// wxAppConsole: wxApp for non-GUI applications // ---------------------------------------------------------------------------- -// use of this list is strongly deprecated, use wxApp ScheduleForDestruction() -// and IsScheduledForDestruction() methods instead of this list directly, it -// is here for compatibility purposes only -extern WXDLLIMPEXP_DATA_BASE(wxList) wxPendingDelete; - -// ---------------------------------------------------------------------------- -// wxAppConsoleBase: wxApp for non-GUI applications -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxAppConsoleBase : public wxEvtHandler, - public wxEventFilter +class WXDLLIMPEXP_BASE wxAppConsole : public wxEvtHandler { public: // ctor and dtor - wxAppConsoleBase(); - virtual ~wxAppConsoleBase(); + wxAppConsole(); + virtual ~wxAppConsole(); // the virtual functions which may/must be overridden in the derived class @@ -99,25 +81,17 @@ public: // class OnInit() to do it. virtual bool OnInit(); + // this is here only temporary hopefully (FIXME) + virtual bool OnInitGui() { return true; } + // This is the replacement for the normal main(): all program work should // be done here. When OnRun() returns, the programs starts shutting down. - virtual int OnRun(); - - // This is called by wxEventLoopBase::SetActive(): you should put the code - // which needs an active event loop here. - // Note that this function is called whenever an event loop is activated; - // you may want to use wxEventLoopBase::IsMain() to perform initialization - // specific for the app's main event loop. - virtual void OnEventLoopEnter(wxEventLoopBase* WXUNUSED(loop)) {} + virtual int OnRun() = 0; // This is only called if OnInit() returned true so it's a good place to do // any cleanup matching the initializations done there. virtual int OnExit(); - // This is called by wxEventLoopBase::OnExit() for each event loop which - // is exited. - virtual void OnEventLoopExit(wxEventLoopBase* WXUNUSED(loop)) {} - // This is the very last function called on wxApp object before it is // destroyed. If you override it (instead of overriding OnExit() as usual) // do not forget to call the base class version! @@ -143,20 +117,12 @@ public: // be argv[0] // set/get the application name - wxString GetAppName() const; + wxString GetAppName() const + { + return m_appName.empty() ? m_className : m_appName; + } void SetAppName(const wxString& name) { m_appName = name; } - // set/get the application display name: the display name is the name - // shown to the user in titles, reports, etc while the app name is - // used for paths, config, and other places the user doesn't see - // - // by default the display name is the same as app name or a capitalized - // version of the program if app name was not set neither but it's - // usually better to set it explicitly to something nicer - wxString GetAppDisplayName() const; - - void SetAppDisplayName(const wxString& name) { m_appDisplayName = name; } - // set/get the app class name wxString GetClassName() const { return m_className; } void SetClassName(const wxString& name) { m_className = name; } @@ -165,19 +131,6 @@ public: const wxString& GetVendorName() const { return m_vendorName; } void SetVendorName(const wxString& name) { m_vendorName = name; } - // set/get the vendor display name: the display name is shown - // in titles/reports/dialogs to the user, while the vendor name - // is used in some areas such as wxConfig, wxStandardPaths, etc - const wxString& GetVendorDisplayName() const - { - return m_vendorDisplayName.empty() ? GetVendorName() - : m_vendorDisplayName; - } - void SetVendorDisplayName(const wxString& name) - { - m_vendorDisplayName = name; - } - // cmd line parsing stuff // ---------------------- @@ -217,48 +170,40 @@ public: // either should be configurable by the user (then he can change the // default behaviour simply by overriding CreateTraits() and returning his // own traits object) or which is GUI/console dependent as then wxAppTraits - // allows us to abstract the differences behind the common facade + // allows us to abstract the differences behind the common façade wxAppTraits *GetTraits(); - // this function provides safer access to traits object than - // wxTheApp->GetTraits() during startup or termination when the global - // application object itself may be unavailable - // - // of course, it still returns NULL in this case and the caller must check - // for it - static wxAppTraits *GetTraitsIfExists(); + // the functions below shouldn't be used now that we have wxAppTraits +#if WXWIN_COMPATIBILITY_2_4 - // returns the main event loop instance, i.e. the event loop which is started - // by OnRun() and which dispatches all events sent from the native toolkit - // to the application (except when new event loops are temporarily set-up). - // The returned value maybe NULL. Put initialization code which needs a - // non-NULL main event loop into OnEventLoopEnter(). - wxEventLoopBase* GetMainLoop() const - { return m_mainLoop; } +#if wxUSE_LOG + // override this function to create default log target of arbitrary + // user-defined class (default implementation creates a wxLogGui + // object) -- this log object is used by default by all wxLogXXX() + // functions. + wxDEPRECATED( virtual wxLog *CreateLogTarget() ); +#endif // wxUSE_LOG + + // similar to CreateLogTarget() but for the global wxMessageOutput + // object + wxDEPRECATED( virtual wxMessageOutput *CreateMessageOutput() ); + +#endif // WXWIN_COMPATIBILITY_2_4 // event processing functions // -------------------------- - // Implement the inherited wxEventFilter method but just return -1 from it - // to indicate that default processing should take place. + // this method allows to filter all the events processed by the program, so + // you should try to return quickly from it to avoid slowing down the + // program to the crawl + // + // return value should be -1 to continue with the normal event processing, + // or TRUE or FALSE to stop further processing and pretend that the event + // had been already processed or won't be processed at all, respectively virtual int FilterEvent(wxEvent& event); - // return true if we're running event loop, i.e. if the events can - // (already) be dispatched - static bool IsMainLoopRunning(); - #if wxUSE_EXCEPTIONS - // execute the functor to handle the given event - // - // this is a generalization of HandleEvent() below and the base class - // implementation of CallEventHandler() still calls HandleEvent() for - // compatibility for functors which are just wxEventFunctions (i.e. methods - // of wxEvtHandler) - virtual void CallEventHandler(wxEvtHandler *handler, - wxEventFunctor& functor, - wxEvent& event) const; - // call the specified handler on the given object with the given event // // this method only exists to allow catching the exceptions thrown by any @@ -269,112 +214,33 @@ public: wxEvent& event) const; // Called when an unhandled C++ exception occurs inside OnRun(): note that - // the main event loop has already terminated by now and the program will - // exit, if you need to really handle the exceptions you need to override - // OnExceptionInMainLoop() - virtual void OnUnhandledException(); - - // Function called if an uncaught exception is caught inside the main - // event loop: it may return true to continue running the event loop or - // false to stop it (in the latter case it may rethrow the exception as - // well) - virtual bool OnExceptionInMainLoop(); - + // the exception type is lost by now, so if you really want to handle the + // exception you should override OnRun() and put a try/catch around + // MainLoop() call there or use OnExceptionInMainLoop() + virtual void OnUnhandledException() { } #endif // wxUSE_EXCEPTIONS - - // pending events - // -------------- - - // IMPORTANT: all these methods conceptually belong to wxEventLoopBase - // but for many reasons we need to allow queuing of events - // even when there's no event loop (e.g. in wxApp::OnInit); - // this feature is used e.g. to queue events on secondary threads - // or in wxPython to use wx.CallAfter before the GUI is initialized - - // process all events in the m_handlersWithPendingEvents list -- it is necessary - // to call this function to process posted events. This happens during each + // process all events in the wxPendingEvents list -- it is necessary to + // call this function to process posted events. This happens during each // event loop iteration in GUI mode but if there is no main loop, it may be // also called directly. virtual void ProcessPendingEvents(); - // check if there are pending events on global pending event list - bool HasPendingEvents() const; + // doesn't do anything in this class, just a hook for GUI wxApp + virtual bool Yield(bool WXUNUSED(onlyIfNeeded) = false) { return true; } - // temporary suspends processing of the pending events - void SuspendProcessingOfPendingEvents(); + // make sure that idle events are sent again + virtual void WakeUpIdle() { } - // resume processing of the pending events previously stopped because of a - // call to SuspendProcessingOfPendingEvents() - void ResumeProcessingOfPendingEvents(); - - // called by ~wxEvtHandler to (eventually) remove the handler from the list of - // the handlers with pending events - void RemovePendingEventHandler(wxEvtHandler* toRemove); - - // adds an event handler to the list of the handlers with pending events - void AppendPendingEventHandler(wxEvtHandler* toAppend); - - // moves the event handler from the list of the handlers with pending events - //to the list of the handlers with _delayed_ pending events - void DelayPendingEventHandler(wxEvtHandler* toDelay); - - // deletes the current pending events - void DeletePendingEvents(); - - - // delayed destruction - // ------------------- - - // If an object may have pending events for it, it shouldn't be deleted - // immediately as this would result in a crash when trying to handle these - // events: instead, it should be scheduled for destruction and really - // destroyed only after processing all pending events. - // - // Notice that this is only possible if we have a running event loop, - // otherwise the object is just deleted directly by ScheduleForDestruction() - // and IsScheduledForDestruction() always returns false. - - // schedule the object for destruction in the near future - void ScheduleForDestruction(wxObject *object); - - // return true if the object is scheduled for destruction - bool IsScheduledForDestruction(wxObject *object) const; - - - // wxEventLoop-related methods - // --------------------------- - - // all these functions are forwarded to the corresponding methods of the - // currently active event loop -- and do nothing if there is none - virtual bool Pending(); - virtual bool Dispatch(); - - virtual int MainLoop(); - virtual void ExitMainLoop(); - - bool Yield(bool onlyIfNeeded = false); - - virtual void WakeUpIdle(); - - // this method is called by the active event loop when there are no events - // to process - // - // by default it generates the idle events and if you override it in your - // derived class you should call the base class version to ensure that idle - // events are still sent out - virtual bool ProcessIdle(); - - // this virtual function is overridden in GUI wxApp to always return true - // as GUI applications always have an event loop -- but console ones may - // have it or not, so it simply returns true if already have an event loop - // running but false otherwise - virtual bool UsesEventLoop() const; + // this is just a convenience: by providing its implementation here we + // avoid #ifdefs in the code using it + static bool IsMainLoopRunning() { return false; } // debugging support // ----------------- +#ifdef __WXDEBUG__ // this function is called when an assert failure occurs, the base class // version does the normal processing (i.e. shows the usual assert failure // dialog box) @@ -394,12 +260,16 @@ public: int line, const wxChar *cond, const wxChar *msg); +#endif // __WXDEBUG__ // check that the wxBuildOptions object (constructed in the application - // itself, usually the one from wxIMPLEMENT_APP() macro) matches the build + // itself, usually the one from IMPLEMENT_APP() macro) matches the build // options of the library and abort if it doesn't static bool CheckBuildOptions(const char *optionsSignature, const char *componentName); +#if WXWIN_COMPATIBILITY_2_4 + wxDEPRECATED( static bool CheckBuildOptions(const wxBuildOptions& buildOptions) ); +#endif // implementation only from now on // ------------------------------- @@ -419,88 +289,37 @@ public: // command line arguments (public for backwards compatibility) - int argc; - - // this object is implicitly convertible to either "char**" (traditional - // type of argv parameter of main()) or to "wchar_t **" (for compatibility - // with Unicode build in previous wx versions and because the command line - // can, in pr -#if wxUSE_UNICODE - wxCmdLineArgsArray argv; -#else - char **argv; -#endif + int argc; + wxChar **argv; protected: - // delete all objects in wxPendingDelete list - // - // called from ProcessPendingEvents() - void DeletePendingObjects(); - // the function which creates the traits object when GetTraits() needs it // for the first time virtual wxAppTraits *CreateTraits(); + // function used for dynamic wxApp creation static wxAppInitializerFunction ms_appInitFn; // the one and only global application object static wxAppConsole *ms_appInstance; - // create main loop from AppTraits or return NULL if - // there is no main loop implementation - wxEventLoopBase *CreateMainLoop(); // application info (must be set from the user code) - wxString m_vendorName, // vendor name ("acme") - m_vendorDisplayName, // vendor display name (e.g. "ACME Inc") - m_appName, // app name ("myapp") - m_appDisplayName, // app display name ("My Application") - m_className; // class name + wxString m_vendorName, // vendor name (ACME Inc) + m_appName, // app name + m_className; // class name // the class defining the application behaviour, NULL initially and created // by GetTraits() when first needed wxAppTraits *m_traits; - // the main event loop of the application (may be NULL if the loop hasn't - // been started yet or has already terminated) - wxEventLoopBase *m_mainLoop; - - - // pending events management vars: - - // the array of the handlers with pending events which needs to be processed - // inside ProcessPendingEvents() - wxEvtHandlerArray m_handlersWithPendingEvents; - - // helper array used by ProcessPendingEvents() to store the event handlers - // which have pending events but of these events none can be processed right now - // (because of a call to wxEventLoop::YieldFor() which asked to selectively process - // pending events) - wxEvtHandlerArray m_handlersWithPendingDelayedEvents; - -#if wxUSE_THREADS - // this critical section protects both the lists above - wxCriticalSection m_handlersWithPendingEventsLocker; -#endif - - // flag modified by Suspend/ResumeProcessingOfPendingEvents() - bool m_bDoPendingEventProcessing; - - friend class WXDLLIMPEXP_FWD_BASE wxEvtHandler; // the application object is a singleton anyhow, there is no sense in // copying it - wxDECLARE_NO_COPY_CLASS(wxAppConsoleBase); + DECLARE_NO_COPY_CLASS(wxAppConsole) }; -#if defined(__UNIX__) && !defined(__WXMSW__) - #include "wx/unix/app.h" -#else - // this has to be a class and not a typedef as we forward declare it - class wxAppConsole : public wxAppConsoleBase { }; -#endif - // ---------------------------------------------------------------------------- // wxAppBase: the common part of wxApp implementations for all platforms // ---------------------------------------------------------------------------- @@ -548,9 +367,43 @@ public: // the worker functions - usually not used directly by the user code // ----------------------------------------------------------------- - // safer alternatives to Yield(), using wxWindowDisabler - virtual bool SafeYield(wxWindow *win, bool onlyIfNeeded); - virtual bool SafeYieldFor(wxWindow *win, long eventsToProcess); + // return true if we're running main loop, i.e. if the events can + // (already) be dispatched + static bool IsMainLoopRunning() + { + wxAppBase *app = wx_static_cast(wxAppBase *, GetInstance()); + return app && app->m_mainLoop != NULL; + } + + // execute the main GUI loop, the function returns when the loop ends + virtual int MainLoop(); + + // exit the main loop thus terminating the application + virtual void Exit(); + + // exit the main GUI loop during the next iteration (i.e. it does not + // stop the program immediately!) + virtual void ExitMainLoop(); + + // returns true if there are unprocessed events in the event queue + virtual bool Pending(); + + // process the first event in the event queue (blocks until an event + // appears if there are none currently, use Pending() if this is not + // wanted), returns false if the event loop should stop and true + // otherwise + virtual bool Dispatch(); + + // process all currently pending events right now + // + // it is an error to call Yield() recursively unless the value of + // onlyIfNeeded is true + // + // WARNING: this function is dangerous as it can lead to unexpected + // reentrancies (i.e. when called from an event handler it + // may result in calling the same event handler again), use + // with _extreme_ care or, better, don't use at all! + virtual bool Yield(bool onlyIfNeeded = false) = 0; // this virtual function is called in the GUI mode when the application // becomes idle and normally just sends wxIdleEvent to all interested @@ -559,8 +412,18 @@ public: // it should return true if more idle events are needed, false if not virtual bool ProcessIdle(); - // override base class version: GUI apps always use an event loop - virtual bool UsesEventLoop() const { return true; } + // Send idle event to window and all subwindows + // Returns true if more idle time is requested. + virtual bool SendIdleEvents(wxWindow* win, wxIdleEvent& event); + + +#if wxUSE_EXCEPTIONS + // Function called if an uncaught exception is caught inside the main + // event loop: it may return true to continue running the event loop or + // false to stop it (in the latter case it may rethrow the exception as + // well) + virtual bool OnExceptionInMainLoop(); +#endif // wxUSE_EXCEPTIONS // top level window functions @@ -592,15 +455,15 @@ public: // ------------------------------------------------------------------------ // Get display mode that is used use. This is only used in framebuffer - // wxWin ports such as wxDFB. + // wxWin ports (such as wxMGL or wxDFB). virtual wxVideoMode GetDisplayMode() const; // Set display mode to use. This is only used in framebuffer wxWin - // ports such as wxDFB. This method should be called from + // ports (such as wxMGL or wxDFB). This method should be called from // wxApp::OnInitGui virtual bool SetDisplayMode(const wxVideoMode& WXUNUSED(info)) { return true; } // set use of best visual flag (see below) - void SetUseBestVisual( bool flag, bool forceTrueColour = false ) + void SetUseBestVisual( bool flag, bool forceTrueColour = false ) { m_useBestVisual = flag; m_forceTrueColour = forceTrueColour; } bool GetUseBestVisual() const { return m_useBestVisual; } @@ -615,9 +478,6 @@ public: // if it's unknown virtual wxLayoutDirection GetLayoutDirection() const; - // Change the theme used by the application, return true on success. - virtual bool SetNativeTheme(const wxString& WXUNUSED(theme)) { return false; } - // command line parsing (GUI-specific) // ------------------------------------------------------------------------ @@ -642,11 +502,22 @@ public: wxDEPRECATED( bool Initialized() ); #endif // WXWIN_COMPATIBILITY_2_6 + // perform standard OnIdle behaviour, ensure that this is always called + void OnIdle(wxIdleEvent& event); + + protected: + // delete all objects in wxPendingDelete list + void DeletePendingObjects(); + // override base class method to use GUI traits virtual wxAppTraits *CreateTraits(); + // the main event loop of the application (may be NULL if the loop hasn't + // been started yet or has already terminated) + wxEventLoop *m_mainLoop; + // the main top level window (may be NULL) wxWindow *m_topWindow; @@ -670,43 +541,47 @@ protected: // does any of our windows have focus? bool m_isActive; - wxDECLARE_NO_COPY_CLASS(wxAppBase); + + DECLARE_NO_COPY_CLASS(wxAppBase) }; #if WXWIN_COMPATIBILITY_2_6 inline bool wxAppBase::Initialized() { return true; } #endif // WXWIN_COMPATIBILITY_2_6 +#endif // wxUSE_GUI + // ---------------------------------------------------------------------------- // now include the declaration of the real class // ---------------------------------------------------------------------------- -#if defined(__WXMSW__) - #include "wx/msw/app.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/app.h" -#elif defined(__WXDFB__) - #include "wx/dfb/app.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/app.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/app.h" -#elif defined(__WXX11__) - #include "wx/x11/app.h" -#elif defined(__WXMAC__) - #include "wx/osx/app.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/app.h" -#elif defined(__WXPM__) - #include "wx/os2/app.h" -#endif - +#if wxUSE_GUI + #if defined(__WXPALMOS__) + #include "wx/palmos/app.h" + #elif defined(__WXMSW__) + #include "wx/msw/app.h" + #elif defined(__WXMOTIF__) + #include "wx/motif/app.h" + #elif defined(__WXMGL__) + #include "wx/mgl/app.h" + #elif defined(__WXDFB__) + #include "wx/dfb/app.h" + #elif defined(__WXGTK20__) + #include "wx/gtk/app.h" + #elif defined(__WXGTK__) + #include "wx/gtk1/app.h" + #elif defined(__WXX11__) + #include "wx/x11/app.h" + #elif defined(__WXMAC__) + #include "wx/mac/app.h" + #elif defined(__WXCOCOA__) + #include "wx/cocoa/app.h" + #elif defined(__WXPM__) + #include "wx/os2/app.h" + #endif #else // !GUI - -// wxApp is defined in core and we cannot define another one in wxBase, -// so use the preprocessor to allow using wxApp in console programs too -#define wxApp wxAppConsole - + // allow using just wxApp (instead of wxAppConsole) in console programs + typedef wxAppConsole wxApp; #endif // GUI/!GUI // ---------------------------------------------------------------------------- @@ -717,12 +592,12 @@ protected: // object of type wxApp // // note that instead of using of wxTheApp in application code you should -// consider using wxDECLARE_APP() after which you may call wxGetApp() which will +// consider using DECLARE_APP() after which you may call wxGetApp() which will // return the object of the correct type (i.e. MyApp and not wxApp) // // the cast is safe as in GUI build we only use wxApp, not wxAppConsole, and in // console mode it does nothing at all -#define wxTheApp static_cast(wxApp::GetInstance()) +#define wxTheApp wx_static_cast(wxApp*, wxApp::GetInstance()) // ---------------------------------------------------------------------------- // global functions @@ -732,20 +607,20 @@ protected: // ------------------------------------------------------ // Force an exit from main loop -WXDLLIMPEXP_BASE void wxExit(); +extern void WXDLLIMPEXP_BASE wxExit(); -// avoid redeclaring this function here if it had been already declared by +// avoid redeclaring this function here if it had been already declated by // wx/utils.h, this results in warnings from g++ with -Wredundant-decls #ifndef wx_YIELD_DECLARED #define wx_YIELD_DECLARED // Yield to other apps/messages -WXDLLIMPEXP_CORE bool wxYield(); +extern bool WXDLLIMPEXP_BASE wxYield(); #endif // wx_YIELD_DECLARED // Yield to other apps/messages -WXDLLIMPEXP_BASE void wxWakeUpIdle(); +extern void WXDLLIMPEXP_BASE wxWakeUpIdle(); // ---------------------------------------------------------------------------- // macros for dynamic creation of the application object @@ -762,40 +637,34 @@ public: { wxApp::SetInitializerFunction(fn); } }; -// the code below defines a wxIMPLEMENT_WXWIN_MAIN macro which you can use if +// the code below defines a IMPLEMENT_WXWIN_MAIN macro which you can use if // your compiler really, really wants main() to be in your main program (e.g. -// hello.cpp). Now wxIMPLEMENT_APP should add this code if required. +// hello.cpp). Now IMPLEMENT_APP should add this code if required. -#define wxIMPLEMENT_WXWIN_MAIN_CONSOLE \ - int main(int argc, char **argv) \ - { \ - wxDISABLE_DEBUG_SUPPORT(); \ - \ - return wxEntry(argc, argv); \ - } +#define IMPLEMENT_WXWIN_MAIN_CONSOLE \ + int main(int argc, char **argv) { return wxEntry(argc, argv); } // port-specific header could have defined it already in some special way -#ifndef wxIMPLEMENT_WXWIN_MAIN - #define wxIMPLEMENT_WXWIN_MAIN wxIMPLEMENT_WXWIN_MAIN_CONSOLE -#endif // defined(wxIMPLEMENT_WXWIN_MAIN) +#ifndef IMPLEMENT_WXWIN_MAIN + #define IMPLEMENT_WXWIN_MAIN IMPLEMENT_WXWIN_MAIN_CONSOLE +#endif // defined(IMPLEMENT_WXWIN_MAIN) #ifdef __WXUNIVERSAL__ #include "wx/univ/theme.h" #ifdef wxUNIV_DEFAULT_THEME - #define wxIMPLEMENT_WX_THEME_SUPPORT \ + #define IMPLEMENT_WX_THEME_SUPPORT \ WX_USE_THEME(wxUNIV_DEFAULT_THEME); #else - #define wxIMPLEMENT_WX_THEME_SUPPORT + #define IMPLEMENT_WX_THEME_SUPPORT #endif #else - #define wxIMPLEMENT_WX_THEME_SUPPORT + #define IMPLEMENT_WX_THEME_SUPPORT #endif // Use this macro if you want to define your own main() or WinMain() function // and call wxEntry() from there. -#define wxIMPLEMENT_APP_NO_MAIN(appname) \ - appname& wxGetApp() { return *static_cast(wxApp::GetInstance()); } \ +#define IMPLEMENT_APP_NO_MAIN(appname) \ wxAppConsole *wxCreateApp() \ { \ wxAppConsole::CheckBuildOptions(WX_BUILD_OPTIONS_SIGNATURE, \ @@ -803,53 +672,37 @@ public: return new appname; \ } \ wxAppInitializer \ - wxTheAppInitializer((wxAppInitializerFunction) wxCreateApp) + wxTheAppInitializer((wxAppInitializerFunction) wxCreateApp); \ + DECLARE_APP(appname) \ + appname& wxGetApp() { return *wx_static_cast(appname*, wxApp::GetInstance()); } -// Same as wxIMPLEMENT_APP() normally but doesn't include themes support in +// Same as IMPLEMENT_APP() normally but doesn't include themes support in // wxUniversal builds -#define wxIMPLEMENT_APP_NO_THEMES(appname) \ - wxIMPLEMENT_WXWIN_MAIN \ - wxIMPLEMENT_APP_NO_MAIN(appname) +#define IMPLEMENT_APP_NO_THEMES(appname) \ + IMPLEMENT_APP_NO_MAIN(appname) \ + IMPLEMENT_WXWIN_MAIN // Use this macro exactly once, the argument is the name of the wxApp-derived // class which is the class of your application. -#define wxIMPLEMENT_APP(appname) \ - wxIMPLEMENT_WX_THEME_SUPPORT \ - wxIMPLEMENT_APP_NO_THEMES(appname) +#define IMPLEMENT_APP(appname) \ + IMPLEMENT_APP_NO_THEMES(appname) \ + IMPLEMENT_WX_THEME_SUPPORT // Same as IMPLEMENT_APP(), but for console applications. -#define wxIMPLEMENT_APP_CONSOLE(appname) \ - wxIMPLEMENT_WXWIN_MAIN_CONSOLE \ - wxIMPLEMENT_APP_NO_MAIN(appname) +#define IMPLEMENT_APP_CONSOLE(appname) \ + IMPLEMENT_APP_NO_MAIN(appname) \ + IMPLEMENT_WXWIN_MAIN_CONSOLE // this macro can be used multiple times and just allows you to use wxGetApp() // function -#define wxDECLARE_APP(appname) \ - extern appname& wxGetApp() +#define DECLARE_APP(appname) extern appname& wxGetApp(); -// declare the stuff defined by wxIMPLEMENT_APP() macro, it's not really needed +// declare the stuff defined by IMPLEMENT_APP() macro, it's not really needed // anywhere else but at the very least it suppresses icc warnings about // defining extern symbols without prior declaration, and it shouldn't do any // harm extern wxAppConsole *wxCreateApp(); extern wxAppInitializer wxTheAppInitializer; -// ---------------------------------------------------------------------------- -// Compatibility macro aliases -// ---------------------------------------------------------------------------- - -// deprecated variants _not_ requiring a semicolon after them -// (note that also some wx-prefixed macro do _not_ require a semicolon because -// it's not always possible to force the compire to require it) - -#define IMPLEMENT_WXWIN_MAIN_CONSOLE wxIMPLEMENT_WXWIN_MAIN_CONSOLE -#define IMPLEMENT_WXWIN_MAIN wxIMPLEMENT_WXWIN_MAIN -#define IMPLEMENT_WX_THEME_SUPPORT wxIMPLEMENT_WX_THEME_SUPPORT -#define IMPLEMENT_APP_NO_MAIN(app) wxIMPLEMENT_APP_NO_MAIN(app); -#define IMPLEMENT_APP_NO_THEMES(app) wxIMPLEMENT_APP_NO_THEMES(app); -#define IMPLEMENT_APP(app) wxIMPLEMENT_APP(app); -#define IMPLEMENT_APP_CONSOLE(app) wxIMPLEMENT_APP_CONSOLE(app); -#define DECLARE_APP(app) wxDECLARE_APP(app); - #endif // _WX_APP_H_BASE_ diff --git a/Source/3rd Party/wx/include/wx/apptrait.h b/Source/3rd Party/wx/include/wx/apptrait.h index b8e14ab2c..56f36dfea 100644 --- a/Source/3rd Party/wx/include/wx/apptrait.h +++ b/Source/3rd Party/wx/include/wx/apptrait.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 19.06.2003 -// RCS-ID: $Id$ +// RCS-ID: $Id: apptrait.h 49804 2007-11-10 01:09:42Z VZ $ // Copyright: (c) 2003 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -15,44 +15,34 @@ #include "wx/string.h" #include "wx/platinfo.h" -class WXDLLIMPEXP_FWD_BASE wxArrayString; -class WXDLLIMPEXP_FWD_BASE wxConfigBase; -class WXDLLIMPEXP_FWD_BASE wxEventLoopBase; +class WXDLLIMPEXP_FWD_BASE wxObject; +class WXDLLIMPEXP_FWD_BASE wxAppTraits; #if wxUSE_FONTMAP class WXDLLIMPEXP_FWD_CORE wxFontMapper; #endif // wxUSE_FONTMAP class WXDLLIMPEXP_FWD_BASE wxLog; class WXDLLIMPEXP_FWD_BASE wxMessageOutput; -class WXDLLIMPEXP_FWD_BASE wxObject; class WXDLLIMPEXP_FWD_CORE wxRendererNative; -class WXDLLIMPEXP_FWD_BASE wxStandardPaths; class WXDLLIMPEXP_FWD_BASE wxString; -class WXDLLIMPEXP_FWD_BASE wxTimer; -class WXDLLIMPEXP_FWD_BASE wxTimerImpl; -class wxSocketManager; +class GSocketGUIFunctionsTable; // ---------------------------------------------------------------------------- // wxAppTraits: this class defines various configurable aspects of wxApp // ---------------------------------------------------------------------------- +class WXDLLIMPEXP_FWD_BASE wxStandardPathsBase; + class WXDLLIMPEXP_BASE wxAppTraitsBase { public: // needed since this class declares virtual members virtual ~wxAppTraitsBase() { } - // hooks for working with the global objects, may be overridden by the user + // hooks for creating the global objects, may be overridden by the user // ------------------------------------------------------------------------ -#if wxUSE_CONFIG - // create the default configuration object (base class version is - // implemented in config.cpp and creates wxRegConfig for wxMSW and - // wxFileConfig for all the other platforms) - virtual wxConfigBase *CreateConfig(); -#endif // wxUSE_CONFIG - #if wxUSE_LOG // create the default log target virtual wxLog *CreateLogTarget() = 0; @@ -73,20 +63,16 @@ public: // NB: returned pointer will be deleted by the caller virtual wxRendererNative *CreateRenderer() = 0; +#if wxUSE_STDPATHS // wxStandardPaths object is normally the same for wxBase and wxGUI // except in the case of wxMac and wxCocoa - virtual wxStandardPaths& GetStandardPaths(); - -#if wxUSE_INTL - // called during wxApp initialization to set the locale to correspond to - // the user default (i.e. system locale under Windows, LC_ALL under Unix) - virtual void SetLocale(); -#endif // wxUSE_INTL - + virtual wxStandardPathsBase& GetStandardPaths(); +#endif // wxUSE_STDPATHS // functions abstracting differences between GUI and console modes // ------------------------------------------------------------------------ +#ifdef __WXDEBUG__ // show the assert dialog with the specified message in GUI or just print // the string to stderr in console mode // @@ -95,79 +81,53 @@ public: // // return true to suppress subsequent asserts, false to continue as before virtual bool ShowAssertDialog(const wxString& msg) = 0; +#endif // __WXDEBUG__ // return true if fprintf(stderr) goes somewhere, false otherwise virtual bool HasStderr() = 0; + // managing "pending delete" list: in GUI mode we can't immediately delete + // some objects because there may be unprocessed events for them and so we + // only do it during the next idle loop iteration while this is, of course, + // unnecessary in wxBase, so we have a few functions to abstract these + // operations + + // add the object to the pending delete list in GUI, delete it immediately + // in wxBase + virtual void ScheduleForDestroy(wxObject *object) = 0; + + // remove this object from the pending delete list in GUI, do nothing in + // wxBase + virtual void RemoveFromPendingDelete(wxObject *object) = 0; + #if wxUSE_SOCKETS - // this function is used by wxNet library to set the default socket manager - // to use: doing it like this allows us to keep all socket-related code in - // wxNet instead of having to pull it in wxBase itself as we'd have to do - // if we really implemented wxSocketManager here - // - // we don't take ownership of this pointer, it should have a lifetime - // greater than that of any socket (e.g. be a pointer to a static object) - static void SetDefaultSocketManager(wxSocketManager *manager) - { - ms_manager = manager; - } - - // return socket manager: this is usually different for console and GUI - // applications (although some ports use the same implementation for both) - virtual wxSocketManager *GetSocketManager() { return ms_manager; } + // return table of GUI callbacks for GSocket code or NULL in wxBase. This + // is needed because networking classes are in their own library and so + // they can't directly call GUI functions (the same net library can be + // used in both GUI and base apps). To complicate it further, GUI library + // ("wxCore") doesn't depend on networking library and so only a functions + // table can be passed around + virtual GSocketGUIFunctionsTable* GetSocketGUIFunctionsTable() = 0; #endif - // create a new, port specific, instance of the event loop used by wxApp - virtual wxEventLoopBase *CreateEventLoop() = 0; - -#if wxUSE_TIMER - // return platform and toolkit dependent wxTimer implementation - virtual wxTimerImpl *CreateTimerImpl(wxTimer *timer) = 0; -#endif - -#if wxUSE_THREADS - virtual void MutexGuiEnter(); - virtual void MutexGuiLeave(); -#endif - - // functions returning port-specific information - // ------------------------------------------------------------------------ - // return information about the (native) toolkit currently used and its // 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, int *minVer) const = 0; // return true if the port is using wxUniversal for the GUI, false if not virtual bool IsUsingUniversalWidgets() const = 0; // return the name of the Desktop Environment such as // "KDE" or "GNOME". May return an empty string. - virtual wxString GetDesktopEnvironment() const = 0; - - // returns a short string to identify the block of the standard command - // line options parsed automatically by current port: if this string is - // empty, there are no such options, otherwise the function also fills - // passed arrays with the names and the descriptions of those options. - virtual wxString GetStandardCmdLineOptions(wxArrayString& names, - wxArrayString& desc) const - { - wxUnusedVar(names); - wxUnusedVar(desc); - - return wxEmptyString; - } - + virtual wxString GetDesktopEnvironment() const { return wxEmptyString; } protected: -#if wxUSE_STACKWALKER +#if wxUSE_STACKWALKER && defined( __WXDEBUG__ ) // utility function: returns the stack frame as a plain wxString virtual wxString GetAssertStackTrace(); #endif - -private: - static wxSocketManager *ms_manager; }; // ---------------------------------------------------------------------------- @@ -177,10 +137,14 @@ private: // NB: test for __UNIX__ before __WXMAC__ as under Darwin we want to use the // Unix code (and otherwise __UNIX__ wouldn't be defined) // ABX: check __WIN32__ instead of __WXMSW__ for the same MSWBase in any Win32 port -#if defined(__WIN32__) +#if defined(__WXPALMOS__) + #include "wx/palmos/apptbase.h" +#elif defined(__WIN32__) #include "wx/msw/apptbase.h" #elif defined(__UNIX__) && !defined(__EMX__) #include "wx/unix/apptbase.h" +#elif defined(__WXMAC__) + #include "wx/mac/apptbase.h" #elif defined(__OS2__) #include "wx/os2/apptbase.h" #else // no platform-specific methods to add to wxAppTraits @@ -201,10 +165,6 @@ private: class WXDLLIMPEXP_BASE wxConsoleAppTraitsBase : public wxAppTraits { public: -#if !wxUSE_CONSOLE_EVENTLOOP - virtual wxEventLoopBase *CreateEventLoop() { return NULL; } -#endif // !wxUSE_CONSOLE_EVENTLOOP - #if wxUSE_LOG virtual wxLog *CreateLogTarget(); #endif // wxUSE_LOG @@ -213,12 +173,20 @@ public: virtual wxFontMapper *CreateFontMapper(); #endif // wxUSE_FONTMAP virtual wxRendererNative *CreateRenderer(); +#if wxUSE_SOCKETS + virtual GSocketGUIFunctionsTable* GetSocketGUIFunctionsTable(); +#endif +#ifdef __WXDEBUG__ virtual bool ShowAssertDialog(const wxString& msg); +#endif // __WXDEBUG__ virtual bool HasStderr(); + virtual void ScheduleForDestroy(wxObject *object); + virtual void RemoveFromPendingDelete(wxObject *object); + // the GetToolkitVersion for console application is always the same - virtual wxPortId GetToolkitVersion(int *verMaj = NULL, int *verMin = NULL) const + virtual wxPortId GetToolkitVersion(int *verMaj, int *verMin) const { // no toolkits (wxBase is for console applications without GUI support) // NB: zero means "no toolkit", -1 means "not initialized yet" @@ -229,7 +197,6 @@ public: } virtual bool IsUsingUniversalWidgets() const { return false; } - virtual wxString GetDesktopEnvironment() const { return wxEmptyString; } }; // ---------------------------------------------------------------------------- @@ -238,7 +205,7 @@ public: #if wxUSE_GUI -class WXDLLIMPEXP_CORE wxGUIAppTraitsBase : public wxAppTraits +class WXDLLEXPORT wxGUIAppTraitsBase : public wxAppTraits { public: #if wxUSE_LOG @@ -249,10 +216,18 @@ public: virtual wxFontMapper *CreateFontMapper(); #endif // wxUSE_FONTMAP virtual wxRendererNative *CreateRenderer(); +#if wxUSE_SOCKETS + virtual GSocketGUIFunctionsTable* GetSocketGUIFunctionsTable(); +#endif +#ifdef __WXDEBUG__ virtual bool ShowAssertDialog(const wxString& msg); +#endif // __WXDEBUG__ virtual bool HasStderr(); + virtual void ScheduleForDestroy(wxObject *object); + virtual void RemoveFromPendingDelete(wxObject *object); + virtual bool IsUsingUniversalWidgets() const { #ifdef __WXUNIVERSAL__ @@ -261,8 +236,6 @@ public: return false; #endif } - - virtual wxString GetDesktopEnvironment() const { return wxEmptyString; } }; #endif // wxUSE_GUI @@ -272,12 +245,16 @@ public: // ---------------------------------------------------------------------------- // ABX: check __WIN32__ instead of __WXMSW__ for the same MSWBase in any Win32 port -#if defined(__WIN32__) +#if defined(__WXPALMOS__) + #include "wx/palmos/apptrait.h" +#elif defined(__WIN32__) #include "wx/msw/apptrait.h" #elif defined(__OS2__) #include "wx/os2/apptrait.h" #elif defined(__UNIX__) #include "wx/unix/apptrait.h" +#elif defined(__WXMAC__) + #include "wx/mac/apptrait.h" #elif defined(__DOS__) #include "wx/msdos/apptrait.h" #else diff --git a/Source/3rd Party/wx/include/wx/archive.h b/Source/3rd Party/wx/include/wx/archive.h index da27f2958..dbf26c25c 100644 --- a/Source/3rd Party/wx/include/wx/archive.h +++ b/Source/3rd Party/wx/include/wx/archive.h @@ -2,7 +2,7 @@ // Name: wx/archive.h // Purpose: Streams for archive formats // Author: Mike Wetherell -// RCS-ID: $Id$ +// RCS-ID: $Id: archive.h 43445 2006-11-16 14:30:20Z MW $ // Copyright: (c) 2004 Mike Wetherell // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -225,7 +225,7 @@ public: if (it.m_rep) it.m_rep.AddRef(); if (m_rep) - this->m_rep.UnRef(); + m_rep.UnRef(); m_rep = it.m_rep; return *this; } @@ -341,13 +341,11 @@ public: const wxString& name, wxPathFormat format = wxPATH_NATIVE) const = 0; - // FIXME-UTF8: remove these from this file, they are used for ANSI - // build only void SetConv(wxMBConv& conv) { m_pConv = &conv; } wxMBConv& GetConv() const { if (m_pConv) return *m_pConv; else return wxConvLocal; } - static const wxArchiveClassFactory *Find(const wxString& protocol, + static const wxArchiveClassFactory *Find(const wxChar *protocol, wxStreamProtocolType type = wxSTREAM_PROTOCOL); diff --git a/Source/3rd Party/wx/include/wx/arrimpl.cpp b/Source/3rd Party/wx/include/wx/arrimpl.cpp index f7b5efef7..37b26314a 100644 --- a/Source/3rd Party/wx/include/wx/arrimpl.cpp +++ b/Source/3rd Party/wx/include/wx/arrimpl.cpp @@ -4,9 +4,9 @@ // Author: Vadim Zeitlin // Modified by: // Created: 16.10.97 -// RCS-ID: $Id$ +// RCS-ID: $Id: arrimpl.cpp 34241 2005-05-22 12:10:55Z JS $ // Copyright: (c) 1997 Vadim Zeitlin -// Licence: wxWindows licence +// Licence: wxWindows license /////////////////////////////////////////////////////////////////////////////// /***************************************************************************** @@ -98,7 +98,7 @@ int name::Index(const T& Item, bool bFromEnd) const \ size_t ui = size() - 1; \ do { \ if ( (T*)base_array::operator[](ui) == &Item ) \ - return static_cast(ui); \ + return wx_static_cast(int, ui); \ ui--; \ } \ while ( ui != 0 ); \ @@ -107,7 +107,7 @@ int name::Index(const T& Item, bool bFromEnd) const \ else { \ for( size_t ui = 0; ui < size(); ui++ ) { \ if( (T*)base_array::operator[](ui) == &Item ) \ - return static_cast(ui); \ + return wx_static_cast(int, ui); \ } \ } \ \ diff --git a/Source/3rd Party/wx/include/wx/arrstr.h b/Source/3rd Party/wx/include/wx/arrstr.h index 4b2b263cd..299cd00f5 100644 --- a/Source/3rd Party/wx/include/wx/arrstr.h +++ b/Source/3rd Party/wx/include/wx/arrstr.h @@ -1,10 +1,10 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: wx/arrstr.h +// Name: include/wx/arrstr.h // Purpose: wxArrayString class // Author: Mattia Barbon and Vadim Zeitlin // Modified by: // Created: 07/07/03 -// RCS-ID: $Id$ +// RCS-ID: $Id: arrstr.h 61872 2009-09-09 22:37:05Z VZ $ // Copyright: (c) 2003 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -15,20 +15,10 @@ #include "wx/defs.h" #include "wx/string.h" -// these functions are only used in STL build now but we define them in any -// case for compatibility with the existing code outside of the library which -// could be using them -inline int wxCMPFUNC_CONV wxStringSortAscending(wxString* s1, wxString* s2) -{ - return s1->Cmp(*s2); -} +WXDLLIMPEXP_BASE int wxCMPFUNC_CONV wxStringSortAscending(wxString*, wxString*); +WXDLLIMPEXP_BASE int wxCMPFUNC_CONV wxStringSortDescending(wxString*, wxString*); -inline int wxCMPFUNC_CONV wxStringSortDescending(wxString* s1, wxString* s2) -{ - return wxStringSortAscending(s2, s1); -} - -#if wxUSE_STD_CONTAINERS +#if wxUSE_STL #include "wx/dynarray.h" @@ -52,11 +42,10 @@ public: wxArrayString() { } wxArrayString(const wxArrayString& a) : wxArrayStringBase(a) { } - wxArrayString(size_t sz, const char** a); - wxArrayString(size_t sz, const wchar_t** a); + wxArrayString(size_t sz, const wxChar** a); wxArrayString(size_t sz, const wxString* a); - int Index(const wxString& str, bool bCase = true, bool bFromEnd = false) const; + int Index(const wxChar* sz, bool bCase = true, bool bFromEnd = false) const; void Sort(bool reverseOrder = false); void Sort(CompareFunction function); @@ -86,37 +75,25 @@ public: Add(src[n]); } - int Index(const wxString& str, bool bCase = true, bool bFromEnd = false) const; - -private: - void Insert() - { - wxFAIL_MSG( "wxSortedArrayString::Insert() is not to be used" ); - } - - void Sort() - { - wxFAIL_MSG( "wxSortedArrayString::Sort() is not to be used" ); - } + int Index(const wxChar* sz, bool bCase = true, bool bFromEnd = false) const; }; -#else // if !wxUSE_STD_CONTAINERS +#else // if !wxUSE_STL -// this shouldn't be defined for compilers not supporting template methods or -// without std::distance() +// ---------------------------------------------------------------------------- +// The string array uses it's knowledge of internal structure of the wxString +// class to optimize string storage. Normally, we would store pointers to +// string, but as wxString is, in fact, itself a pointer (sizeof(wxString) is +// sizeof(char *)) we store these pointers instead. The cast to "wxString *" is +// really all we need to turn such pointer into a string! // -// FIXME-VC6: currently it's only not defined for VC6 in DLL build as it -// doesn't export template methods from DLL correctly so even though -// it compiles them fine, we get link errors when using wxArrayString -#if !defined(__VISUALC6__) || !(defined(WXMAKINGDLL) || defined(WXUSINGDLL)) - #define wxHAS_VECTOR_TEMPLATE_ASSIGN -#endif - -#ifdef wxHAS_VECTOR_TEMPLATE_ASSIGN - #include "wx/beforestd.h" - #include - #include "wx/afterstd.h" -#endif // wxHAS_VECTOR_TEMPLATE_ASSIGN +// Of course, it can be called a dirty hack, but we use twice less memory and +// this approach is also more speed efficient, so it's probably worth it. +// +// Usage notes: when a string is added/inserted, a new copy of it is created, +// so the original string may be safely deleted. When a string is retrieved +// from the array (operator[] or Item() method), a reference is returned. +// ---------------------------------------------------------------------------- class WXDLLIMPEXP_BASE wxArrayString { @@ -136,14 +113,13 @@ public: // // NB: the reason for using int and not bool is that like this we can avoid // using this ctor for implicit conversions from "const char *" (which - // we'd like to be implicitly converted to wxString instead!). This - // wouldn't be needed if the 'explicit' keyword was supported by all - // compilers, or if this was protected ctor for wxSortedArrayString, - // but we're stuck with it now. - wxEXPLICIT wxArrayString(int autoSort) { Init(autoSort != 0); } + // we'd like to be implicitly converted to wxString instead!) + // + // of course, using explicit would be even better - if all compilers + // supported it... + wxArrayString(int autoSort) { Init(autoSort != 0); } // C string array ctor - wxArrayString(size_t sz, const char** a); - wxArrayString(size_t sz, const wchar_t** a); + wxArrayString(size_t sz, const wxChar** a); // wxString string array ctor wxArrayString(size_t sz, const wxString* a); // copy ctor @@ -173,34 +149,38 @@ public: // items access (range checking is done in debug version) // get item at position uiIndex - wxString& Item(size_t nIndex) + wxString& Item(size_t nIndex) const { wxASSERT_MSG( nIndex < m_nCount, wxT("wxArrayString: index out of bounds") ); - return m_pItems[nIndex]; + return *(wxString *)&(m_pItems[nIndex]); } - const wxString& Item(size_t nIndex) const { return const_cast(this)->Item(nIndex); } // same as Item() - wxString& operator[](size_t nIndex) { return Item(nIndex); } - const wxString& operator[](size_t nIndex) const { return Item(nIndex); } + wxString& operator[](size_t nIndex) const { return Item(nIndex); } // get last item - wxString& Last() + wxString& Last() const { wxASSERT_MSG( !IsEmpty(), wxT("wxArrayString: index out of bounds") ); - return Item(GetCount() - 1); + return Item(Count() - 1); } - const wxString& Last() const { return const_cast(this)->Last(); } + // return a wxString[], useful for the controls which + // take one in their ctor. You must delete[] it yourself + // once you are done with it. Will return NULL if the + // ArrayString was empty. +#if WXWIN_COMPATIBILITY_2_4 + wxDEPRECATED( wxString* GetStringArray() const ); +#endif // item management // Search the element in the array, starting from the beginning if // bFromEnd is false or from end otherwise. If bCase, comparison is case // sensitive (default). Returns index of the first item matched or // wxNOT_FOUND - int Index (const wxString& str, bool bCase = true, bool bFromEnd = false) const; + int Index (const wxChar *sz, bool bCase = true, bool bFromEnd = false) const; // add new element at the end (if the array is not sorted), return its // index size_t Add(const wxString& str, size_t nInsert = 1); @@ -209,15 +189,18 @@ public: // expand the array to have count elements void SetCount(size_t count); // remove first item matching this value - void Remove(const wxString& sz); + void Remove(const wxChar *sz); // remove item by index +#if WXWIN_COMPATIBILITY_2_4 + wxDEPRECATED( void Remove(size_t nIndex, size_t nRemove = 1) ); +#endif void RemoveAt(size_t nIndex, size_t nRemove = 1); // sorting // sort array elements in alphabetical order (or reversed alphabetical // order if reverseOrder parameter is true) void Sort(bool reverseOrder = false); - // sort array elements using specified comparison function + // sort array elements using specified comparaison function void Sort(CompareFunction compareFunction); void Sort(CompareFunction2 compareFunction); @@ -252,7 +235,7 @@ public: public: pointer m_ptr; reverse_iterator() : m_ptr(NULL) { } - wxEXPLICIT reverse_iterator(pointer ptr) : m_ptr(ptr) { } + reverse_iterator(pointer ptr) : m_ptr(ptr) { } reverse_iterator(const itor& it) : m_ptr(it.m_ptr) { } reference operator*() const { return *m_ptr; } pointer operator->() const { return m_ptr; } @@ -278,7 +261,7 @@ public: public: pointer m_ptr; const_reverse_iterator() : m_ptr(NULL) { } - wxEXPLICIT const_reverse_iterator(pointer ptr) : m_ptr(ptr) { } + const_reverse_iterator(pointer ptr) : m_ptr(ptr) { } const_reverse_iterator(const itor& it) : m_ptr(it.m_ptr) { } const_reverse_iterator(const reverse_iterator& it) : m_ptr(it.m_ptr) { } reference operator*() const { return *m_ptr; } @@ -295,32 +278,13 @@ public: wxArrayString(const_iterator first, const_iterator last) { Init(false); assign(first, last); } wxArrayString(size_type n, const_reference v) { Init(false); assign(n, v); } - -#ifdef wxHAS_VECTOR_TEMPLATE_ASSIGN - template - void assign(Iterator first, Iterator last) - { - clear(); - reserve(std::distance(first, last)); - for(; first != last; ++first) - push_back(*first); - } -#else // !wxHAS_VECTOR_TEMPLATE_ASSIGN - void assign(const_iterator first, const_iterator last) - { - clear(); - reserve(last - first); - for(; first != last; ++first) - push_back(*first); - } -#endif // wxHAS_VECTOR_TEMPLATE_ASSIGN/!wxHAS_VECTOR_TEMPLATE_ASSIGN - + void assign(const_iterator first, const_iterator last); void assign(size_type n, const_reference v) { clear(); Add(v, n); } reference back() { return *(end() - 1); } const_reference back() const { return *(end() - 1); } - iterator begin() { return m_pItems; } - const_iterator begin() const { return m_pItems; } + iterator begin() { return (wxString *)&(m_pItems[0]); } + const_iterator begin() const { return (wxString *)&(m_pItems[0]); } size_type capacity() const { return m_nSize; } void clear() { Clear(); } bool empty() const { return IsEmpty(); } @@ -344,21 +308,12 @@ public: void pop_back() { RemoveAt(GetCount() - 1); } void push_back(const_reference v) { Add(v); } reverse_iterator rbegin() { return reverse_iterator(end() - 1); } - const_reverse_iterator rbegin() const - { return const_reverse_iterator(end() - 1); } + const_reverse_iterator rbegin() const; reverse_iterator rend() { return reverse_iterator(begin() - 1); } - const_reverse_iterator rend() const - { return const_reverse_iterator(begin() - 1); } + const_reverse_iterator rend() const; void reserve(size_type n) /* base::reserve*/; void resize(size_type n, value_type v = value_type()); size_type size() const { return GetCount(); } - void swap(wxArrayString& other) - { - wxSwap(m_nSize, other.m_nSize); - wxSwap(m_nCount, other.m_nCount); - wxSwap(m_pItems, other.m_pItems); - wxSwap(m_autoSort, other.m_autoSort); - } protected: void Init(bool autoSort); // common part of all ctors @@ -366,11 +321,14 @@ protected: private: void Grow(size_t nIncrement = 0); // makes array bigger if needed + void Free(); // free all the strings stored + + void DoSort(); // common part of all Sort() variants size_t m_nSize, // current size of the array m_nCount; // current number of elements - wxString *m_pItems; // pointer to data + wxChar **m_pItems; // pointer to data bool m_autoSort; // if true, keep the array always sorted }; @@ -384,7 +342,7 @@ public: { Copy(array); } }; -#endif // !wxUSE_STD_CONTAINERS +#endif // !wxUSE_STL // this class provides a temporary wxString* from a // wxArrayString @@ -407,110 +365,13 @@ public: return m_strings; } - wxString* Release() - { - wxString *r = GetStrings(); - m_strings = NULL; - return r; - } +#if wxABI_VERSION >= 20810 + wxString* Release(); +#endif // wxABI_VERSION >= 20810 private: const wxArrayString& m_array; wxString* m_strings; }; - -// ---------------------------------------------------------------------------- -// helper functions for working with arrays -// ---------------------------------------------------------------------------- - -// by default, these functions use the escape character to escape the -// separators occuring inside the string to be joined, this can be disabled by -// passing '\0' as escape - -WXDLLIMPEXP_BASE wxString wxJoin(const wxArrayString& arr, - const wxChar sep, - const wxChar escape = wxT('\\')); - -WXDLLIMPEXP_BASE wxArrayString wxSplit(const wxString& str, - const wxChar sep, - const wxChar escape = wxT('\\')); - - -// ---------------------------------------------------------------------------- -// This helper class allows to pass both C array of wxStrings or wxArrayString -// using the same interface. -// -// Use it when you have two methods taking wxArrayString or (int, wxString[]), -// that do the same thing. This class lets you iterate over input data in the -// same way whether it is a raw array of strings or wxArrayString. -// -// The object does not take ownership of the data -- internally it keeps -// pointers to the data, therefore the data must be disposed of by user -// and only after this object is destroyed. Usually it is not a problem as -// only temporary objects of this class are used. -// ---------------------------------------------------------------------------- - -class wxArrayStringsAdapter -{ -public: - // construct an adapter from a wxArrayString - wxArrayStringsAdapter(const wxArrayString& strings) - : m_type(wxSTRING_ARRAY), m_size(strings.size()) - { - m_data.array = &strings; - } - - // construct an adapter from a wxString[] - wxArrayStringsAdapter(unsigned int n, const wxString *strings) - : m_type(wxSTRING_POINTER), m_size(n) - { - m_data.ptr = strings; - } - - // construct an adapter from a single wxString - wxArrayStringsAdapter(const wxString& s) - : m_type(wxSTRING_POINTER), m_size(1) - { - m_data.ptr = &s; - } - - // default copy constructor is ok - - // iteration interface - size_t GetCount() const { return m_size; } - bool IsEmpty() const { return GetCount() == 0; } - const wxString& operator[] (unsigned int i) const - { - wxASSERT_MSG( i < GetCount(), wxT("index out of bounds") ); - if(m_type == wxSTRING_POINTER) - return m_data.ptr[i]; - return m_data.array->Item(i); - } - wxArrayString AsArrayString() const - { - if(m_type == wxSTRING_ARRAY) - return *m_data.array; - return wxArrayString(GetCount(), m_data.ptr); - } - -private: - // type of the data being held - enum wxStringContainerType - { - wxSTRING_ARRAY, // wxArrayString - wxSTRING_POINTER // wxString[] - }; - - wxStringContainerType m_type; - size_t m_size; - union - { - const wxString * ptr; - const wxArrayString * array; - } m_data; - - wxDECLARE_NO_ASSIGN_CLASS(wxArrayStringsAdapter); -}; - -#endif // _WX_ARRSTR_H +#endif diff --git a/Source/3rd Party/wx/include/wx/artprov.h b/Source/3rd Party/wx/include/wx/artprov.h index 276f891e3..31f3bd44e 100644 --- a/Source/3rd Party/wx/include/wx/artprov.h +++ b/Source/3rd Party/wx/include/wx/artprov.h @@ -4,7 +4,7 @@ // Author: Vaclav Slavik // Modified by: // Created: 18/03/2002 -// RCS-ID: $Id$ +// RCS-ID: $Id: artprov.h 61872 2009-09-09 22:37:05Z VZ $ // Copyright: (c) Vaclav Slavik // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -15,7 +15,6 @@ #include "wx/string.h" #include "wx/bitmap.h" #include "wx/icon.h" -#include "wx/iconbndl.h" class WXDLLIMPEXP_FWD_CORE wxArtProvidersList; class WXDLLIMPEXP_FWD_CORE wxArtProviderCache; @@ -28,10 +27,10 @@ class wxArtProviderModule; typedef wxString wxArtClient; typedef wxString wxArtID; -#define wxART_MAKE_CLIENT_ID_FROM_STR(id) ((id) + "_C") -#define wxART_MAKE_CLIENT_ID(id) (#id "_C") +#define wxART_MAKE_CLIENT_ID_FROM_STR(id) (id + wxT("_C")) +#define wxART_MAKE_CLIENT_ID(id) wxT(#id) wxT("_C") #define wxART_MAKE_ART_ID_FROM_STR(id) (id) -#define wxART_MAKE_ART_ID(id) (#id) +#define wxART_MAKE_ART_ID(id) wxT(#id) // ---------------------------------------------------------------------------- // Art clients @@ -45,7 +44,6 @@ typedef wxString wxArtID; #define wxART_HELP_BROWSER wxART_MAKE_CLIENT_ID(wxART_HELP_BROWSER) #define wxART_MESSAGE_BOX wxART_MAKE_CLIENT_ID(wxART_MESSAGE_BOX) #define wxART_BUTTON wxART_MAKE_CLIENT_ID(wxART_BUTTON) -#define wxART_LIST wxART_MAKE_CLIENT_ID(wxART_LIST) #define wxART_OTHER wxART_MAKE_CLIENT_ID(wxART_OTHER) @@ -66,8 +64,6 @@ typedef wxString wxArtID; #define wxART_GO_DOWN wxART_MAKE_ART_ID(wxART_GO_DOWN) #define wxART_GO_TO_PARENT wxART_MAKE_ART_ID(wxART_GO_TO_PARENT) #define wxART_GO_HOME wxART_MAKE_ART_ID(wxART_GO_HOME) -#define wxART_GOTO_FIRST wxART_MAKE_ART_ID(wxART_GOTO_FIRST) -#define wxART_GOTO_LAST wxART_MAKE_ART_ID(wxART_GOTO_LAST) #define wxART_FILE_OPEN wxART_MAKE_ART_ID(wxART_FILE_OPEN) #define wxART_FILE_SAVE wxART_MAKE_ART_ID(wxART_FILE_SAVE) #define wxART_FILE_SAVE_AS wxART_MAKE_ART_ID(wxART_FILE_SAVE_AS) @@ -103,10 +99,6 @@ typedef wxString wxArtID; #define wxART_UNDO wxART_MAKE_ART_ID(wxART_UNDO) #define wxART_REDO wxART_MAKE_ART_ID(wxART_REDO) -#define wxART_PLUS wxART_MAKE_ART_ID(wxART_PLUS) -#define wxART_MINUS wxART_MAKE_ART_ID(wxART_MINUS) - -#define wxART_CLOSE wxART_MAKE_ART_ID(wxART_CLOSE) #define wxART_QUIT wxART_MAKE_ART_ID(wxART_QUIT) #define wxART_FIND wxART_MAKE_ART_ID(wxART_FIND) @@ -117,14 +109,12 @@ typedef wxString wxArtID; // wxArtProvider class // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxArtProvider : public wxObject +class WXDLLEXPORT wxArtProvider : public wxObject { public: // Dtor removes the provider from providers stack if it's still on it virtual ~wxArtProvider(); - // Does this platform implement native icons theme? - static bool HasNativeProvider(); // Add new provider to the top of providers stack (i.e. the provider will // be queried first of all). @@ -132,12 +122,11 @@ public: // Add new provider to the bottom of providers stack (i.e. the provider // will be queried as the last one). +#if wxABI_VERSION >= 20810 static void PushBack(wxArtProvider *provider); - -#if WXWIN_COMPATIBILITY_2_8 - // use PushBack(), it's the same thing - static wxDEPRECATED( void Insert(wxArtProvider *provider) ); #endif + // same as PushBack() + static void Insert(wxArtProvider *provider); // Remove latest added provider and delete it. static bool Pop(); @@ -161,54 +150,26 @@ public: const wxArtClient& client = wxART_OTHER, const wxSize& size = wxDefaultSize); - // Helper used by GetMessageBoxIcon(): return the art id corresponding to - // the standard wxICON_INFORMATION/WARNING/ERROR/QUESTION flags (only one - // can be set) - static wxArtID GetMessageBoxIconId(int flags); - - // Helper used by several generic classes: return the icon corresponding to - // the standard wxICON_INFORMATION/WARNING/ERROR/QUESTION flags (only one - // can be set) - static wxIcon GetMessageBoxIcon(int flags) - { - return GetIcon(GetMessageBoxIconId(flags), wxART_MESSAGE_BOX); - } - - // Query the providers for iconbundle with given ID and return it. Return - // wxNullIconBundle if no provider provides it. - static wxIconBundle GetIconBundle(const wxArtID& id, - const wxArtClient& client = wxART_OTHER); - - // Gets native size for given 'client' or wxDefaultSize if it doesn't - // have native equivalent - static wxSize GetNativeSizeHint(const wxArtClient& client); - // Get the size hint of an icon from a specific wxArtClient, queries // the topmost provider if platform_dependent = false static wxSize GetSizeHint(const wxArtClient& client, bool platform_dependent = false); #if WXWIN_COMPATIBILITY_2_6 // use the corresponding methods without redundant "Provider" suffix - static wxDEPRECATED( void PushProvider(wxArtProvider *provider) ); - static wxDEPRECATED( void InsertProvider(wxArtProvider *provider) ); - static wxDEPRECATED( bool PopProvider() ); + wxDEPRECATED( static void PushProvider(wxArtProvider *provider) ); + wxDEPRECATED( static void InsertProvider(wxArtProvider *provider) ); + wxDEPRECATED( static bool PopProvider() ); // use Delete() if this is what you really need, or just delete the // provider pointer, do not use Remove() as it does not delete the pointer // unlike RemoveProvider() which does - static wxDEPRECATED( bool RemoveProvider(wxArtProvider *provider) ); + wxDEPRECATED( static bool RemoveProvider(wxArtProvider *provider) ); #endif // WXWIN_COMPATIBILITY_2_6 protected: friend class wxArtProviderModule; -#if wxUSE_ARTPROVIDER_STD // Initializes default provider static void InitStdProvider(); -#endif // wxUSE_ARTPROVIDER_STD - // Initializes Tango-based icon provider -#if wxUSE_ARTPROVIDER_TANGO - static void InitTangoProvider(); -#endif // wxUSE_ARTPROVIDER_TANGO // Initializes platform's native provider, if available (e.g. GTK2) static void InitNativeProvider(); // Destroy caches & all providers @@ -220,26 +181,15 @@ protected: return GetSizeHint(client, true); } - // Derived classes must override CreateBitmap or CreateIconBundle - // (or both) to create requested art resource. This method is called - // only once per instance's lifetime for each requested wxArtID. + // Derived classes must override this method to create requested + // art resource. This method is called only once per instance's + // lifetime for each requested wxArtID. virtual wxBitmap CreateBitmap(const wxArtID& WXUNUSED(id), const wxArtClient& WXUNUSED(client), - const wxSize& WXUNUSED(size)) - { - return wxNullBitmap; - } - - virtual wxIconBundle CreateIconBundle(const wxArtID& WXUNUSED(id), - const wxArtClient& WXUNUSED(client)) - { - return wxNullIconBundle; - } + const wxSize& WXUNUSED(size)) = 0; private: static void CommonAddingProvider(); - static wxIconBundle DoGetIconBundle(const wxArtID& id, - const wxArtClient& client); private: // list of providers: @@ -251,12 +201,4 @@ private: }; -#if !defined(__WXUNIVERSAL__) && \ - ((defined(__WXGTK__) && defined(__WXGTK20__)) || defined(__WXMSW__) || \ - defined(__WXMAC__)) - // *some* (partial) native implementation of wxArtProvider exists; this is - // not the same as wxArtProvider::HasNativeProvider()! - #define wxHAS_NATIVE_ART_PROVIDER_IMPL -#endif - #endif // _WX_ARTPROV_H_ diff --git a/Source/3rd Party/wx/include/wx/atomic.h b/Source/3rd Party/wx/include/wx/atomic.h deleted file mode 100644 index 107950a3d..000000000 --- a/Source/3rd Party/wx/include/wx/atomic.h +++ /dev/null @@ -1,160 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/atomic.h -// Purpose: functions to manipulate atomically integers and pointers -// Author: Armel Asselin -// Created: 12/13/2006 -// RCS-ID: $Id$ -// Copyright: (c) Armel Asselin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_ATOMIC_H_ -#define _WX_ATOMIC_H_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// get the value of wxUSE_THREADS configuration flag -#include "wx/defs.h" - -// constraints on the various functions: -// - wxAtomicDec must return a zero value if the value is zero once -// decremented else it must return any non-zero value (the true value is OK -// but not necessary). - -#if wxUSE_THREADS - -#if defined(HAVE_GCC_ATOMIC_BUILTINS) - -// NB: we intentionally don't use Linux's asm/atomic.h header, because it's -// an internal kernel header that doesn't always work in userspace: -// http://bugs.mysql.com/bug.php?id=28456 -// http://golubenco.org/blog/atomic-operations/ - -inline void wxAtomicInc (wxUint32 &value) -{ - __sync_fetch_and_add(&value, 1); -} - -inline wxUint32 wxAtomicDec (wxUint32 &value) -{ - return __sync_sub_and_fetch(&value, 1); -} - - -#elif defined(__WINDOWS__) - -// include standard Windows headers -#include "wx/msw/wrapwin.h" - -inline void wxAtomicInc (wxUint32 &value) -{ - InterlockedIncrement ((LONG*)&value); -} - -inline wxUint32 wxAtomicDec (wxUint32 &value) -{ - return InterlockedDecrement ((LONG*)&value); -} - -#elif defined(__WXMAC__) || defined(__DARWIN__) - -#include "libkern/OSAtomic.h" -inline void wxAtomicInc (wxUint32 &value) -{ - OSAtomicIncrement32 ((int32_t*)&value); -} - -inline wxUint32 wxAtomicDec (wxUint32 &value) -{ - return OSAtomicDecrement32 ((int32_t*)&value); -} - -#elif defined (__SOLARIS__) - -#include - -inline void wxAtomicInc (wxUint32 &value) -{ - atomic_add_32 ((uint32_t*)&value, 1); -} - -inline wxUint32 wxAtomicDec (wxUint32 &value) -{ - return atomic_add_32_nv ((uint32_t*)&value, (uint32_t)-1); -} - -#else // unknown platform - -// it will result in inclusion if the generic implementation code a bit later in this page -#define wxNEEDS_GENERIC_ATOMIC_OPS - -#endif // unknown platform - -#else // else of wxUSE_THREADS -// if no threads are used we can safely use simple ++/-- - -inline void wxAtomicInc (wxUint32 &value) { ++value; } -inline wxUint32 wxAtomicDec (wxUint32 &value) { return --value; } - -#endif // !wxUSE_THREADS - -// ---------------------------------------------------------------------------- -// proxies to actual implementations, but for various other types with same -// behaviour -// ---------------------------------------------------------------------------- - -#ifdef wxNEEDS_GENERIC_ATOMIC_OPS - -#include "wx/thread.h" // for wxCriticalSection - -class wxAtomicInt32 -{ -public: - wxAtomicInt32() { } // non initialized for consistency with basic int type - wxAtomicInt32(wxInt32 v) : m_value(v) { } - wxAtomicInt32(const wxAtomicInt32& a) : m_value(a.m_value) {} - - operator wxInt32() const { return m_value; } - operator volatile wxInt32&() { return m_value; } - - wxAtomicInt32& operator=(wxInt32 v) { m_value = v; return *this; } - - void Inc() - { - wxCriticalSectionLocker lock(m_locker); - ++m_value; - } - - wxInt32 Dec() - { - wxCriticalSectionLocker lock(m_locker); - return --m_value; - } - -private: - volatile wxInt32 m_value; - wxCriticalSection m_locker; -}; - -inline void wxAtomicInc(wxAtomicInt32 &value) { value.Inc(); } -inline wxInt32 wxAtomicDec(wxAtomicInt32 &value) { return value.Dec(); } - -#else // !wxNEEDS_GENERIC_ATOMIC_OPS - -#define wxHAS_ATOMIC_OPS - -inline void wxAtomicInc(wxInt32 &value) { wxAtomicInc((wxUint32&)value); } -inline wxInt32 wxAtomicDec(wxInt32 &value) { return wxAtomicDec((wxUint32&)value); } - -typedef wxInt32 wxAtomicInt32; - -#endif // wxNEEDS_GENERIC_ATOMIC_OPS - -// all the native implementations use 32 bits currently -// for a 64 bits implementation we could use (a future) wxAtomicInt64 as -// default type -typedef wxAtomicInt32 wxAtomicInt; - -#endif // _WX_ATOMIC_H_ diff --git a/Source/3rd Party/wx/include/wx/base64.h b/Source/3rd Party/wx/include/wx/base64.h deleted file mode 100644 index 12a5f976f..000000000 --- a/Source/3rd Party/wx/include/wx/base64.h +++ /dev/null @@ -1,122 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/base64.h -// Purpose: declaration of BASE64 encoding/decoding functionality -// Author: Charles Reimers, Vadim Zeitlin -// Created: 2007-06-18 -// RCS-ID: $Id$ -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_BASE64_H_ -#define _WX_BASE64_H_ - -#if wxUSE_BASE64 - -#include "wx/string.h" -#include "wx/buffer.h" - -// ---------------------------------------------------------------------------- -// encoding functions -// ---------------------------------------------------------------------------- - -// return the size needed for the buffer containing the encoded representation -// of a buffer of given length -inline size_t wxBase64EncodedSize(size_t len) { return 4*((len+2)/3); } - -// raw base64 encoding function which encodes the contents of a buffer of the -// specified length into the buffer of the specified size -// -// returns the length of the encoded data or wxCONV_FAILED if the buffer is not -// large enough; to determine the needed size you can either allocate a buffer -// of wxBase64EncodedSize(srcLen) size or call the function with NULL buffer in -// which case the required size will be returned -WXDLLIMPEXP_BASE size_t -wxBase64Encode(char *dst, size_t dstLen, const void *src, size_t srcLen); - -// encode the contents of the given buffer using base64 and return as string -// (there is no error return) -inline wxString wxBase64Encode(const void *src, size_t srcLen) -{ - const size_t dstLen = wxBase64EncodedSize(srcLen); - wxCharBuffer dst(dstLen); - wxBase64Encode(dst.data(), dstLen, src, srcLen); - - return dst; -} - -inline wxString wxBase64Encode(const wxMemoryBuffer& buf) -{ - return wxBase64Encode(buf.GetData(), buf.GetDataLen()); -} - -// ---------------------------------------------------------------------------- -// decoding functions -// ---------------------------------------------------------------------------- - -// elements of this enum specify the possible behaviours of wxBase64Decode() -// when an invalid character is encountered -enum wxBase64DecodeMode -{ - // normal behaviour: stop at any invalid characters - wxBase64DecodeMode_Strict, - - // skip whitespace characters - wxBase64DecodeMode_SkipWS, - - // the most lenient behaviour: simply ignore all invalid characters - wxBase64DecodeMode_Relaxed -}; - -// return the buffer size necessary for decoding a base64 string of the given -// length -inline size_t wxBase64DecodedSize(size_t srcLen) { return 3*srcLen/4; } - -// raw decoding function which decodes the contents of the string of specified -// length (or NUL-terminated by default) into the provided buffer of the given -// size -// -// the function normally stops at any character invalid inside a base64-encoded -// string (i.e. not alphanumeric nor '+' nor '/') but can be made to skip the -// whitespace or all invalid characters using its mode argument -// -// returns the length of the decoded data or wxCONV_FAILED if an error occurs -// such as the buffer is too small or the encoded string is invalid; in the -// latter case the posErr is filled with the position where the decoding -// stopped if it is not NULL -WXDLLIMPEXP_BASE size_t -wxBase64Decode(void *dst, size_t dstLen, - const char *src, size_t srcLen = wxNO_LEN, - wxBase64DecodeMode mode = wxBase64DecodeMode_Strict, - size_t *posErr = NULL); - -inline size_t -wxBase64Decode(void *dst, size_t dstLen, - const wxString& src, - wxBase64DecodeMode mode = wxBase64DecodeMode_Strict, - size_t *posErr = NULL) -{ - // don't use str.length() here as the ASCII buffer is shorter than it for - // strings with embedded NULs - return wxBase64Decode(dst, dstLen, src.ToAscii(), wxNO_LEN, mode, posErr); -} - -// decode the contents of the given string; the returned buffer is empty if an -// error occurs during decoding -WXDLLIMPEXP_BASE wxMemoryBuffer -wxBase64Decode(const char *src, size_t srcLen = wxNO_LEN, - wxBase64DecodeMode mode = wxBase64DecodeMode_Strict, - size_t *posErr = NULL); - -inline wxMemoryBuffer -wxBase64Decode(const wxString& src, - wxBase64DecodeMode mode = wxBase64DecodeMode_Strict, - size_t *posErr = NULL) -{ - // don't use str.length() here as the ASCII buffer is shorter than it for - // strings with embedded NULs - return wxBase64Decode(src.ToAscii(), wxNO_LEN, mode, posErr); -} - -#endif // wxUSE_BASE64 - -#endif // _WX_BASE64_H_ diff --git a/Source/3rd Party/wx/include/wx/beforestd.h b/Source/3rd Party/wx/include/wx/beforestd.h index dc8232e69..7261de803 100644 --- a/Source/3rd Party/wx/include/wx/beforestd.h +++ b/Source/3rd Party/wx/include/wx/beforestd.h @@ -1,10 +1,10 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: wx/beforestd.h +// Name: include/wx/beforestd.h // Purpose: #include before STL headers // Author: Vadim Zeitlin // Modified by: // Created: 07/07/03 -// RCS-ID: $Id$ +// RCS-ID: $Id: beforestd.h 61871 2009-09-09 22:29:51Z VZ $ // Copyright: (c) 2003 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -23,20 +23,6 @@ // VC 7.x isn't as bad as VC6 and doesn't give these warnings but eVC (which // defines _MSC_VER as 1201) does need to be included as it's VC6-like #if defined(__VISUALC__) && __VISUALC__ <= 1201 - // these warning have to be disabled and not just temporarily disabled - // because they will be given at the end of the compilation of the - // current source and there is absolutely nothing we can do about them so - // disable them before warning(push) below - - // 'foo': unreferenced inline function has been removed - #pragma warning(disable:4514) - - // 'function' : function not inlined - #pragma warning(disable:4710) - - // 'id': identifier was truncated to 'num' characters in the debug info - #pragma warning(disable:4786) - // MSVC 5 does not have this #if __VISUALC__ > 1100 // we have to disable (and reenable in afterstd.h) this one because, @@ -62,15 +48,28 @@ // 'identifier' use the following syntax #pragma warning(disable:4663) #endif + + // these warning have to be disabled and not just temporarily disabled + // because they will be given at the end of the compilation of the + // current source and there is absolutely nothing we can do about them + + // 'foo': unreferenced inline function has been removed + #pragma warning(disable:4514) + + // 'function' : function not inlined + #pragma warning(disable:4710) + + // 'id': identifier was truncated to 'num' characters in the debug info + #pragma warning(disable:4786) #endif // VC++ < 7 -/** - GCC's visibility support is broken for libstdc++ in some older versions - (namely Debian/Ubuntu's GCC 4.1, see - https://bugs.launchpad.net/ubuntu/+source/gcc-4.1/+bug/109262). We fix it - here by mimicking newer versions' behaviour of using default visibility - for libstdc++ code. +/* + Recent versions of Sun C++ compiler use _T in their standard headers and + our definition of it in wx/wxchar.h conflicts with them and breaks + compilation, so undefine _T before including them and redefine it back in + wx/afterstd.h if needed. */ -#if defined(HAVE_VISIBILITY) && defined(HAVE_BROKEN_LIBSTDCXX_VISIBILITY) - #pragma GCC visibility push(default) -#endif +#if defined(__SUNPRO_CC) || defined(__SUNPRO_C) + #undef _T +#endif /* SUNCC */ + diff --git a/Source/3rd Party/wx/include/wx/bitmap.h b/Source/3rd Party/wx/include/wx/bitmap.h index 503cc1c8c..bcee14373 100644 --- a/Source/3rd Party/wx/include/wx/bitmap.h +++ b/Source/3rd Party/wx/include/wx/bitmap.h @@ -4,7 +4,7 @@ // Author: Vaclav Slavik // Modified by: // Created: 22.04.01 -// RCS-ID: $Id$ +// RCS-ID: $Id: bitmap.h 49563 2007-10-31 20:46:21Z VZ $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -19,11 +19,11 @@ #include "wx/string.h" #include "wx/gdicmn.h" // for wxBitmapType #include "wx/colour.h" -#include "wx/image.h" class WXDLLIMPEXP_FWD_CORE wxBitmap; class WXDLLIMPEXP_FWD_CORE wxBitmapHandler; class WXDLLIMPEXP_FWD_CORE wxIcon; +class WXDLLIMPEXP_FWD_CORE wxImage; class WXDLLIMPEXP_FWD_CORE wxMask; class WXDLLIMPEXP_FWD_CORE wxPalette; @@ -33,16 +33,14 @@ class WXDLLIMPEXP_FWD_CORE wxPalette; #if wxUSE_VARIANT #include "wx/variant.h" -DECLARE_VARIANT_OBJECT_EXPORTED(wxBitmap,WXDLLIMPEXP_CORE) +DECLARE_VARIANT_OBJECT_EXPORTED(wxBitmap,WXDLLEXPORT) #endif // ---------------------------------------------------------------------------- // wxMask represents the transparent area of the bitmap // ---------------------------------------------------------------------------- -// TODO: all implementation of wxMask, except the generic one, -// do not derive from wxMaskBase,,, they should -class WXDLLIMPEXP_CORE wxMaskBase : public wxObject +class WXDLLEXPORT wxMaskBase : public wxObject { public: // create the mask from bitmap pixels of the given colour @@ -68,7 +66,8 @@ protected: virtual bool InitFromMonoBitmap(const wxBitmap& bitmap) = 0; }; -#if defined(__WXDFB__) || \ +#if defined(__WXMGL__) || \ + defined(__WXDFB__) || \ defined(__WXMAC__) || \ defined(__WXGTK__) || \ defined(__WXCOCOA__) || \ @@ -79,13 +78,8 @@ protected: #define wxUSE_BITMAP_BASE 0 #endif -// a more readable way to tell -#define wxBITMAP_SCREEN_DEPTH (-1) - - -// All ports except wxMSW and wxOS2 use wxBitmapHandler and wxBitmapBase as -// base class for wxBitmapHandler; wxMSW and wxOS2 use wxGDIImageHandler as -// base class since it allows some code reuse there. +// Only used by some ports +// FIXME -- make all ports (but MSW which uses wxGDIImage) use these base classes #if wxUSE_BITMAP_BASE // ---------------------------------------------------------------------------- @@ -93,29 +87,18 @@ protected: // different formats // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxBitmapHandler : public wxObject +class WXDLLEXPORT wxBitmapHandlerBase : public wxObject { public: - wxBitmapHandler() { m_type = wxBITMAP_TYPE_INVALID; } - virtual ~wxBitmapHandler() { } + wxBitmapHandlerBase() { m_type = wxBITMAP_TYPE_INVALID; } + virtual ~wxBitmapHandlerBase() { } - // NOTE: the following functions should be pure virtuals, but they aren't - // because otherwise almost all ports would have to implement - // them as "return false"... - - virtual bool Create(wxBitmap *WXUNUSED(bitmap), const void* WXUNUSED(data), - wxBitmapType WXUNUSED(type), int WXUNUSED(width), int WXUNUSED(height), - int WXUNUSED(depth) = 1) - { return false; } - - virtual bool LoadFile(wxBitmap *WXUNUSED(bitmap), const wxString& WXUNUSED(name), - wxBitmapType WXUNUSED(type), int WXUNUSED(desiredWidth), - int WXUNUSED(desiredHeight)) - { return false; } - - virtual bool SaveFile(const wxBitmap *WXUNUSED(bitmap), const wxString& WXUNUSED(name), - wxBitmapType WXUNUSED(type), const wxPalette *WXUNUSED(palette) = NULL) const - { return false; } + virtual bool Create(wxBitmap *bitmap, const void* data, long flags, + int width, int height, int depth = 1); + virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags, + int desiredWidth, int desiredHeight); + virtual bool SaveFile(const wxBitmap *bitmap, const wxString& name, + int type, const wxPalette *palette = NULL); void SetName(const wxString& name) { m_name = name; } void SetExtension(const wxString& ext) { m_extension = ext; } @@ -129,56 +112,43 @@ private: wxString m_extension; wxBitmapType m_type; - DECLARE_ABSTRACT_CLASS(wxBitmapHandler) + DECLARE_ABSTRACT_CLASS(wxBitmapHandlerBase) }; - -// ---------------------------------------------------------------------------- -// wxBitmap: class which represents platform-dependent bitmap (unlike wxImage) -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxBitmapBase : public wxGDIObject +class WXDLLEXPORT wxBitmapBase : public wxGDIObject { public: /* Derived class must implement these: wxBitmap(); - wxBitmap(const wxBitmap& bmp); + wxBitmap(int width, int height, int depth = -1); wxBitmap(const char bits[], int width, int height, int depth = 1); - wxBitmap(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH); - wxBitmap(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH); wxBitmap(const char* const* bits); wxBitmap(const wxString &filename, wxBitmapType type = wxBITMAP_TYPE_XPM); - wxBitmap(const wxImage& image, int depth = wxBITMAP_SCREEN_DEPTH); + wxBitmap(const wxImage& image, int depth = -1); + + bool Create(int width, int height, int depth = -1); static void InitStandardHandlers(); */ - virtual bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH) = 0; - virtual bool Create(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH) = 0; + virtual bool Ok() const { return IsOk(); } + virtual bool IsOk() const = 0; virtual int GetHeight() const = 0; virtual int GetWidth() const = 0; virtual int GetDepth() const = 0; - wxSize GetSize() const - { return wxSize(GetWidth(), GetHeight()); } - -#if wxUSE_IMAGE virtual wxImage ConvertToImage() const = 0; - // Convert to disabled (dimmed) bitmap. - wxBitmap ConvertToDisabled(unsigned char brightness = 255) const; -#endif // wxUSE_IMAGE - virtual wxMask *GetMask() const = 0; virtual void SetMask(wxMask *mask) = 0; virtual wxBitmap GetSubBitmap(const wxRect& rect) const = 0; virtual bool SaveFile(const wxString &name, wxBitmapType type, - const wxPalette *palette = NULL) const = 0; + const wxPalette *palette = (wxPalette *)NULL) const = 0; virtual bool LoadFile(const wxString &name, wxBitmapType type) = 0; /* @@ -204,8 +174,8 @@ public: // Format handling static inline wxList& GetHandlers() { return sm_handlers; } - static void AddHandler(wxBitmapHandler *handler); - static void InsertHandler(wxBitmapHandler *handler); + static void AddHandler(wxBitmapHandlerBase *handler); + static void InsertHandler(wxBitmapHandlerBase *handler); static bool RemoveHandler(const wxString& name); static wxBitmapHandler *FindHandler(const wxString& name); static wxBitmapHandler *FindHandler(const wxString& extension, wxBitmapType bitmapType); @@ -233,58 +203,32 @@ protected: #endif // wxUSE_BITMAP_BASE - -// the wxBITMAP_DEFAULT_TYPE constant defines the default argument value -// for wxBitmap's ctor and wxBitmap::LoadFile() functions. -#if defined(__WXMSW__) - #define wxBITMAP_DEFAULT_TYPE wxBITMAP_TYPE_BMP_RESOURCE +#if defined(__WXPALMOS__) + #include "wx/palmos/bitmap.h" +#elif defined(__WXMSW__) #include "wx/msw/bitmap.h" #elif defined(__WXMOTIF__) - #define wxBITMAP_DEFAULT_TYPE wxBITMAP_TYPE_XPM #include "wx/x11/bitmap.h" #elif defined(__WXGTK20__) - #ifdef __WINDOWS__ - #define wxBITMAP_DEFAULT_TYPE wxBITMAP_TYPE_BMP_RESOURCE - #else - #define wxBITMAP_DEFAULT_TYPE wxBITMAP_TYPE_XPM - #endif #include "wx/gtk/bitmap.h" #elif defined(__WXGTK__) - #define wxBITMAP_DEFAULT_TYPE wxBITMAP_TYPE_XPM #include "wx/gtk1/bitmap.h" #elif defined(__WXX11__) - #define wxBITMAP_DEFAULT_TYPE wxBITMAP_TYPE_XPM #include "wx/x11/bitmap.h" +#elif defined(__WXMGL__) + #include "wx/mgl/bitmap.h" #elif defined(__WXDFB__) - #define wxBITMAP_DEFAULT_TYPE wxBITMAP_TYPE_BMP_RESOURCE #include "wx/dfb/bitmap.h" #elif defined(__WXMAC__) - #define wxBITMAP_DEFAULT_TYPE wxBITMAP_TYPE_PICT_RESOURCE - #include "wx/osx/bitmap.h" + #include "wx/mac/bitmap.h" #elif defined(__WXCOCOA__) - #define wxBITMAP_DEFAULT_TYPE wxBITMAP_TYPE_BMP_RESOURCE #include "wx/cocoa/bitmap.h" #elif defined(__WXPM__) - #define wxBITMAP_DEFAULT_TYPE wxBITMAP_TYPE_BMP_RESOURCE #include "wx/os2/bitmap.h" #endif -#if wxUSE_IMAGE -inline -wxBitmap -#if wxUSE_BITMAP_BASE -wxBitmapBase:: -#else -wxBitmap:: -#endif -ConvertToDisabled(unsigned char brightness) const -{ - return ConvertToImage().ConvertToDisabled(brightness); -} -#endif // wxUSE_IMAGE - // we must include generic mask.h after wxBitmap definition -#if defined(__WXDFB__) +#if defined(__WXMGL__) || defined(__WXDFB__) #define wxUSE_GENERIC_MASK 1 #else #define wxUSE_GENERIC_MASK 0 diff --git a/Source/3rd Party/wx/include/wx/bmpbuttn.h b/Source/3rd Party/wx/include/wx/bmpbuttn.h index 085e4fbb2..f7b96b662 100644 --- a/Source/3rd Party/wx/include/wx/bmpbuttn.h +++ b/Source/3rd Party/wx/include/wx/bmpbuttn.h @@ -1,10 +1,10 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/bmpbuttn.h +// Name: wx/bmpbutton.h // Purpose: wxBitmapButton class interface // Author: Vadim Zeitlin // Modified by: // Created: 25.08.00 -// RCS-ID: $Id$ +// RCS-ID: $Id: bmpbuttn.h 45498 2007-04-16 13:03:05Z VZ $ // Copyright: (c) 2000 Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -16,67 +16,57 @@ #if wxUSE_BMPBUTTON +#include "wx/bitmap.h" #include "wx/button.h" -// FIXME: right now only wxMSW, wxGTK and wxOSX implement bitmap support in wxButton -// itself, this shouldn't be used for the other platforms neither -// when all of them do it -#if (defined(__WXMSW__) || defined(__WXGTK20__) || defined(__WXOSX__)) && !defined(__WXUNIVERSAL__) - #define wxHAS_BUTTON_BITMAP -#endif +extern WXDLLEXPORT_DATA(const wxChar) wxButtonNameStr[]; // ---------------------------------------------------------------------------- // wxBitmapButton: a button which shows bitmaps instead of the usual string. // It has different bitmaps for different states (focused/disabled/pressed) // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxBitmapButtonBase : public wxButton +class WXDLLEXPORT wxBitmapButtonBase : public wxButton { public: wxBitmapButtonBase() { -#ifndef wxHAS_BUTTON_BITMAP m_marginX = m_marginY = 0; -#endif // wxHAS_BUTTON_BITMAP } - bool Create(wxWindow *parent, - wxWindowID winid, - const wxPoint& pos, - const wxSize& size, - long style, - const wxValidator& validator, - const wxString& name) - { - // We use wxBU_NOTEXT to let the base class Create() know that we are - // not going to show the label: this is a hack needed for wxGTK where - // we can show both label and bitmap only with GTK 2.6+ but we always - // can show just one of them and this style allows us to choose which - // one we need. - // - // And we also use wxBU_EXACTFIT to avoid being resized up to the - // standard button size as this doesn't make sense for bitmap buttons - // which are not standard anyhow and should fit their bitmap size. - return wxButton::Create(parent, winid, "", - pos, size, - style | wxBU_NOTEXT | wxBU_EXACTFIT, - validator, name); - } + // set the bitmaps + void SetBitmapLabel(const wxBitmap& bitmap) + { m_bmpNormal = bitmap; OnSetBitmap(); } + void SetBitmapSelected(const wxBitmap& sel) + { m_bmpSelected = sel; OnSetBitmap(); } + void SetBitmapFocus(const wxBitmap& focus) + { m_bmpFocus = focus; OnSetBitmap(); } + void SetBitmapDisabled(const wxBitmap& disabled) + { m_bmpDisabled = disabled; OnSetBitmap(); } + void SetBitmapHover(const wxBitmap& hover) + { m_bmpHover = hover; OnSetBitmap(); } + + // retrieve the bitmaps + const wxBitmap& GetBitmapLabel() const { return m_bmpNormal; } + const wxBitmap& GetBitmapSelected() const { return m_bmpSelected; } + const wxBitmap& GetBitmapFocus() const { return m_bmpFocus; } + const wxBitmap& GetBitmapDisabled() const { return m_bmpDisabled; } + const wxBitmap& GetBitmapHover() const { return m_bmpHover; } + wxBitmap& GetBitmapLabel() { return m_bmpNormal; } + wxBitmap& GetBitmapSelected() { return m_bmpSelected; } + wxBitmap& GetBitmapFocus() { return m_bmpFocus; } + wxBitmap& GetBitmapDisabled() { return m_bmpDisabled; } + wxBitmap& GetBitmapHover() { return m_bmpHover; } // set/get the margins around the button - virtual void SetMargins(int x, int y) - { - DoSetBitmapMargins(x, y); - } - - int GetMarginX() const { return DoGetBitmapMargins().x; } - int GetMarginY() const { return DoGetBitmapMargins().y; } + virtual void SetMargins(int x, int y) { m_marginX = x; m_marginY = y; } + int GetMarginX() const { return m_marginX; } + int GetMarginY() const { return m_marginY; } // deprecated synonym for SetBitmapLabel() #if WXWIN_COMPATIBILITY_2_6 - wxDEPRECATED_INLINE( void SetLabel(const wxBitmap& bitmap), - SetBitmapLabel(bitmap); ) + wxDEPRECATED( void SetLabel(const wxBitmap& bitmap) ); // prevent virtual function hiding virtual void SetLabel(const wxString& label) @@ -84,36 +74,31 @@ public: #endif // WXWIN_COMPATIBILITY_2_6 protected: -#ifndef wxHAS_BUTTON_BITMAP // function called when any of the bitmaps changes virtual void OnSetBitmap() { InvalidateBestSize(); Refresh(); } - virtual wxBitmap DoGetBitmap(State which) const { return m_bitmaps[which]; } - virtual void DoSetBitmap(const wxBitmap& bitmap, State which) - { m_bitmaps[which] = bitmap; OnSetBitmap(); } - - virtual wxSize DoGetBitmapMargins() const - { - return wxSize(m_marginX, m_marginY); - } - - virtual void DoSetBitmapMargins(int x, int y) - { - m_marginX = x; - m_marginY = y; - } - // the bitmaps for various states - wxBitmap m_bitmaps[State_Max]; + wxBitmap m_bmpNormal, + m_bmpSelected, + m_bmpFocus, + m_bmpDisabled, + m_bmpHover; // the margins around the bitmap int m_marginX, m_marginY; -#endif // !wxHAS_BUTTON_BITMAP - wxDECLARE_NO_COPY_CLASS(wxBitmapButtonBase); + + DECLARE_NO_COPY_CLASS(wxBitmapButtonBase) }; +#if WXWIN_COMPATIBILITY_2_6 +inline void wxBitmapButtonBase::SetLabel(const wxBitmap& bitmap) +{ + SetBitmapLabel(bitmap); +} +#endif // WXWIN_COMPATIBILITY_2_6 + #if defined(__WXUNIVERSAL__) #include "wx/univ/bmpbuttn.h" #elif defined(__WXMSW__) @@ -125,7 +110,7 @@ protected: #elif defined(__WXGTK__) #include "wx/gtk1/bmpbuttn.h" #elif defined(__WXMAC__) - #include "wx/osx/bmpbuttn.h" + #include "wx/mac/bmpbuttn.h" #elif defined(__WXCOCOA__) #include "wx/cocoa/bmpbuttn.h" #elif defined(__WXPM__) diff --git a/Source/3rd Party/wx/include/wx/bookctrl.h b/Source/3rd Party/wx/include/wx/bookctrl.h index 6042b0d91..98a95dc6e 100644 --- a/Source/3rd Party/wx/include/wx/bookctrl.h +++ b/Source/3rd Party/wx/include/wx/bookctrl.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 19.08.03 -// RCS-ID: $Id$ +// RCS-ID: $Id: bookctrl.h 49563 2007-10-31 20:46:21Z VZ $ // Copyright: (c) 2003 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -22,12 +22,11 @@ #include "wx/control.h" #include "wx/dynarray.h" -#include "wx/withimages.h" WX_DEFINE_EXPORTED_ARRAY_PTR(wxWindow *, wxArrayPages); class WXDLLIMPEXP_FWD_CORE wxImageList; -class WXDLLIMPEXP_FWD_CORE wxBookCtrlEvent; +class WXDLLIMPEXP_FWD_CORE wxBookCtrlBaseEvent; // ---------------------------------------------------------------------------- // constants @@ -55,8 +54,7 @@ enum // wxBookCtrlBase // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxBookCtrlBase : public wxControl, - public wxWithImages +class WXDLLEXPORT wxBookCtrlBase : public wxControl { public: // construction @@ -87,6 +85,9 @@ public: long style = 0, const wxString& name = wxEmptyString); + // dtor + virtual ~wxBookCtrlBase(); + // accessors // --------- @@ -95,7 +96,8 @@ public: virtual size_t GetPageCount() const { return m_pages.size(); } // get the panel which represents the given page - virtual wxWindow *GetPage(size_t n) const { return m_pages[n]; } + wxWindow *GetPage(size_t n) { return m_pages[n]; } + wxWindow *GetPage(size_t n) const { return m_pages[n]; } // get the current page or NULL if none wxWindow *GetCurrentPage() const @@ -105,7 +107,7 @@ public: } // get the currently selected page or wxNOT_FOUND if none - virtual int GetSelection() const { return m_selection; } + virtual int GetSelection() const = 0; // set/get the title of a page virtual bool SetPageText(size_t n, const wxString& strText) = 0; @@ -116,6 +118,15 @@ public: // images belong to the same image list) // --------------------------------------------------------------------- + // sets the image list to use, it is *not* deleted by the control + virtual void SetImageList(wxImageList *imageList); + + // as SetImageList() but we will delete the image list ourselves + void AssignImageList(wxImageList *imageList); + + // get pointer (may be NULL) to the associated image list + wxImageList* GetImageList() const { return m_imageList; } + // sets/returns item's image index in the current image list virtual int GetPageImage(size_t n) const = 0; virtual bool SetPageImage(size_t n, int imageId) = 0; @@ -127,14 +138,8 @@ public: // resize the notebook so that all pages will have the specified size virtual void SetPageSize(const wxSize& size); - // return the size of the area needed to accommodate the controller - wxSize GetControllerSize() const; - // calculate the size of the control from the size of its page - // - // by default this simply returns size enough to fit both the page and the - // controller - virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const; + virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const = 0; // get/set size of area between book control area and page area unsigned int GetInternalBorder() const { return m_internalBorder; } @@ -154,7 +159,6 @@ public: // returns the sizer containing the control, if any wxSizer* GetControlSizer() const { return m_controlSizer; } - // operations // ---------- @@ -171,7 +175,6 @@ public: // remove all pages and delete them virtual bool DeleteAllPages() { - m_selection = wxNOT_FOUND; DoInvalidateBestSize(); WX_CLEAR_ARRAY(m_pages); return true; @@ -181,7 +184,7 @@ public: virtual bool AddPage(wxWindow *page, const wxString& text, bool bSelect = false, - int imageId = NO_IMAGE) + int imageId = -1) { DoInvalidateBestSize(); return InsertPage(GetPageCount(), page, text, bSelect, imageId); @@ -192,10 +195,10 @@ public: wxWindow *page, const wxString& text, bool bSelect = false, - int imageId = NO_IMAGE) = 0; + int imageId = -1) = 0; // set the currently selected page, return the index of the previously - // selected one (or wxNOT_FOUND on error) + // selected one (or -1 on error) // // NB: this function will generate PAGE_CHANGING/ED events virtual int SetSelection(size_t n) = 0; @@ -208,7 +211,7 @@ public: void AdvanceSelection(bool forward = true) { int nPage = GetNextPage(forward); - if ( nPage != wxNOT_FOUND ) + if ( nPage != -1 ) { // cast is safe because of the check above SetSelection((size_t)nPage); @@ -226,11 +229,6 @@ public: // we do have multiple pages virtual bool HasMultiplePages() const { return true; } - // we don't want focus for ourselves - virtual bool AcceptsFocus() const { return false; } - - // returns true if the platform should explicitly apply a theme border - virtual bool CanApplyThemeBorder() const { return false; } protected: // flags for DoSetSelection() @@ -239,20 +237,6 @@ protected: SetSelection_SendEvent = 1 }; - // choose the default border for this window - virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } - - // After the insertion of the page in the method InsertPage, calling this - // method sets the selection to the given page or the first one if there is - // still no selection. The "selection changed" event is sent only if - // bSelect is true, so when it is false, no event is sent even if the - // selection changed from wxNOT_FOUND to 0 when inserting the first page. - // - // Returns true if the selection was set to the specified page (explicitly - // because of bSelect == true or implicitly because it's the first page) or - // false otherwise. - bool DoSetSelectionAfterInsertion(size_t n, bool bSelect); - // set the selection to the given page, sending the events (which can // possibly prevent the page change from taking place) if SendEvent flag is // included @@ -268,12 +252,12 @@ protected: { wxFAIL_MSG(wxT("Override this function!")); } // create a new "page changing" event - virtual wxBookCtrlEvent* CreatePageChangingEvent() const + virtual wxBookCtrlBaseEvent* CreatePageChangingEvent() const { wxFAIL_MSG(wxT("Override this function!")); return NULL; } // modify the event created by CreatePageChangingEvent() to "page changed" // event, usually by just calling SetEventType() on it - virtual void MakeChangedEvent(wxBookCtrlEvent& WXUNUSED(event)) + virtual void MakeChangedEvent(wxBookCtrlBaseEvent& WXUNUSED(event)) { wxFAIL_MSG(wxT("Override this function!")); } @@ -294,7 +278,7 @@ protected: int GetNextPage(bool forward) const; // Lay out controls - virtual void DoSize(); + void DoSize(); // This method also invalidates the size of the controller and should be // called instead of just InvalidateBestSize() whenever pages are added or @@ -310,10 +294,17 @@ protected: // the array of all pages of this control wxArrayPages m_pages; + // the associated image list or NULL + wxImageList *m_imageList; + + // true if we must delete m_imageList + bool m_ownsImageList; + // get the page area - virtual wxRect GetPageRect() const; + wxRect GetPageRect() const; // event handlers + virtual wxSize GetControllerSize() const; void OnSize(wxSizeEvent& event); // controller buddy if available, NULL otherwise (usually for native book controls like wxNotebook) @@ -328,11 +319,6 @@ protected: // the margin around the choice control int m_controlMargin; - // The currently selected page (in range 0..m_pages.size()-1 inclusive) or - // wxNOT_FOUND if none (this can normally only be the case for an empty - // control without any pages). - int m_selection; - private: // common part of all ctors @@ -342,75 +328,66 @@ private: unsigned int m_internalBorder; DECLARE_ABSTRACT_CLASS(wxBookCtrlBase) - wxDECLARE_NO_COPY_CLASS(wxBookCtrlBase); - + DECLARE_NO_COPY_CLASS(wxBookCtrlBase) DECLARE_EVENT_TABLE() }; // ---------------------------------------------------------------------------- -// wxBookCtrlEvent: page changing events generated by book classes +// wxBookCtrlBaseEvent: page changing events generated by derived classes // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxBookCtrlEvent : public wxNotifyEvent +class WXDLLEXPORT wxBookCtrlBaseEvent : public wxNotifyEvent { public: - wxBookCtrlEvent(wxEventType commandType = wxEVT_NULL, int winid = 0, - int nSel = wxNOT_FOUND, int nOldSel = wxNOT_FOUND) + wxBookCtrlBaseEvent(wxEventType commandType = wxEVT_NULL, int winid = 0, + int nSel = -1, int nOldSel = -1) : wxNotifyEvent(commandType, winid) { m_nSel = nSel; m_nOldSel = nOldSel; } - wxBookCtrlEvent(const wxBookCtrlEvent& event) + wxBookCtrlBaseEvent(const wxBookCtrlBaseEvent& event) : wxNotifyEvent(event) { m_nSel = event.m_nSel; m_nOldSel = event.m_nOldSel; } - virtual wxEvent *Clone() const { return new wxBookCtrlEvent(*this); } - // accessors - // the currently selected page (wxNOT_FOUND if none) + // the currently selected page (-1 if none) int GetSelection() const { return m_nSel; } void SetSelection(int nSel) { m_nSel = nSel; } - // the page that was selected before the change (wxNOT_FOUND if none) + // the page that was selected before the change (-1 if none) int GetOldSelection() const { return m_nOldSel; } void SetOldSelection(int nOldSel) { m_nOldSel = nOldSel; } private: int m_nSel, // currently selected page m_nOldSel; // previously selected page - - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxBookCtrlEvent) }; -typedef void (wxEvtHandler::*wxBookCtrlEventFunction)(wxBookCtrlEvent&); - -#define wxBookCtrlEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxBookCtrlEventFunction, func) - -// obsolete name, defined for compatibility only -#define wxBookCtrlBaseEvent wxBookCtrlEvent - // make a default book control for given platform #if wxUSE_NOTEBOOK // dedicated to majority of desktops #include "wx/notebook.h" #define wxBookCtrl wxNotebook + #define wxBookCtrlEvent wxNotebookEvent #define wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGED wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED #define wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGING wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING #define EVT_BOOKCTRL_PAGE_CHANGED(id, fn) EVT_NOTEBOOK_PAGE_CHANGED(id, fn) #define EVT_BOOKCTRL_PAGE_CHANGING(id, fn) EVT_NOTEBOOK_PAGE_CHANGING(id, fn) + #define wxBookctrlEventHandler(func) wxNotebookEventHandler(func) #else // dedicated to Smartphones #include "wx/choicebk.h" #define wxBookCtrl wxChoicebook + #define wxBookCtrlEvent wxChoicebookEvent #define wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGED wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED #define wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGING wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING #define EVT_BOOKCTRL_PAGE_CHANGED(id, fn) EVT_CHOICEBOOK_PAGE_CHANGED(id, fn) #define EVT_BOOKCTRL_PAGE_CHANGING(id, fn) EVT_CHOICEBOOK_PAGE_CHANGING(id, fn) + #define wxBookctrlEventHandler(func) wxChoicebookEventHandler(func) #endif #if WXWIN_COMPATIBILITY_2_6 diff --git a/Source/3rd Party/wx/include/wx/brush.h b/Source/3rd Party/wx/include/wx/brush.h index c39419269..cf963ab2d 100644 --- a/Source/3rd Party/wx/include/wx/brush.h +++ b/Source/3rd Party/wx/include/wx/brush.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: -// RCS-ID: $Id$ +// RCS-ID: $Id: brush.h 40865 2006-08-27 09:42:42Z VS $ // Copyright: Julian Smart // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// @@ -15,62 +15,22 @@ #include "wx/defs.h" #include "wx/object.h" #include "wx/gdiobj.h" -#include "wx/gdicmn.h" // for wxGDIObjListBase - -// NOTE: these values cannot be combined together! -enum wxBrushStyle -{ - wxBRUSHSTYLE_INVALID = -1, - - wxBRUSHSTYLE_SOLID = wxSOLID, - wxBRUSHSTYLE_TRANSPARENT = wxTRANSPARENT, - wxBRUSHSTYLE_STIPPLE_MASK_OPAQUE = wxSTIPPLE_MASK_OPAQUE, - wxBRUSHSTYLE_STIPPLE_MASK = wxSTIPPLE_MASK, - wxBRUSHSTYLE_STIPPLE = wxSTIPPLE, - wxBRUSHSTYLE_BDIAGONAL_HATCH = wxHATCHSTYLE_BDIAGONAL, - wxBRUSHSTYLE_CROSSDIAG_HATCH = wxHATCHSTYLE_CROSSDIAG, - wxBRUSHSTYLE_FDIAGONAL_HATCH = wxHATCHSTYLE_FDIAGONAL, - wxBRUSHSTYLE_CROSS_HATCH = wxHATCHSTYLE_CROSS, - wxBRUSHSTYLE_HORIZONTAL_HATCH = wxHATCHSTYLE_HORIZONTAL, - wxBRUSHSTYLE_VERTICAL_HATCH = wxHATCHSTYLE_VERTICAL, - wxBRUSHSTYLE_FIRST_HATCH = wxHATCHSTYLE_FIRST, - wxBRUSHSTYLE_LAST_HATCH = wxHATCHSTYLE_LAST -}; - // wxBrushBase -class WXDLLIMPEXP_CORE wxBrushBase: public wxGDIObject +class WXDLLEXPORT wxBrushBase: public wxGDIObject { public: virtual ~wxBrushBase() { } - virtual void SetColour(const wxColour& col) = 0; - virtual void SetColour(unsigned char r, unsigned char g, unsigned char b) = 0; - virtual void SetStyle(wxBrushStyle style) = 0; - virtual void SetStipple(const wxBitmap& stipple) = 0; - - virtual wxColour GetColour() const = 0; - virtual wxBrushStyle GetStyle() const = 0; - virtual wxBitmap *GetStipple() const = 0; + virtual int GetStyle() const = 0; virtual bool IsHatch() const - { return (GetStyle()>=wxBRUSHSTYLE_FIRST_HATCH) && (GetStyle()<=wxBRUSHSTYLE_LAST_HATCH); } - - // Convenient helpers for testing whether the brush is a transparent one: - // unlike GetStyle() == wxBRUSHSTYLE_TRANSPARENT, they work correctly even - // if the brush is invalid (they both return false in this case). - bool IsTransparent() const - { - return IsOk() && GetStyle() == wxBRUSHSTYLE_TRANSPARENT; - } - - bool IsNonTransparent() const - { - return IsOk() && GetStyle() != wxBRUSHSTYLE_TRANSPARENT; - } + { return (GetStyle()>=wxFIRST_HATCH) && (GetStyle()<=wxLAST_HATCH); } }; -#if defined(__WXMSW__) +#if defined(__WXPALMOS__) + #include "wx/palmos/brush.h" +#elif defined(__WXMSW__) #include "wx/msw/brush.h" #elif defined(__WXMOTIF__) || defined(__WXX11__) #include "wx/x11/brush.h" @@ -78,60 +38,17 @@ public: #include "wx/gtk/brush.h" #elif defined(__WXGTK__) #include "wx/gtk1/brush.h" +#elif defined(__WXMGL__) + #include "wx/mgl/brush.h" #elif defined(__WXDFB__) #include "wx/dfb/brush.h" #elif defined(__WXMAC__) - #include "wx/osx/brush.h" + #include "wx/mac/brush.h" #elif defined(__WXCOCOA__) #include "wx/cocoa/brush.h" #elif defined(__WXPM__) #include "wx/os2/brush.h" #endif -class WXDLLIMPEXP_CORE wxBrushList: public wxGDIObjListBase -{ -public: - wxBrush *FindOrCreateBrush(const wxColour& colour, - wxBrushStyle style = wxBRUSHSTYLE_SOLID); - -#if FUTURE_WXWIN_COMPATIBILITY_3_0 - wxBrush *FindOrCreateBrush(const wxColour& colour, int style) - { return FindOrCreateBrush(colour, (wxBrushStyle)style); } #endif - -#if WXWIN_COMPATIBILITY_2_6 - wxDEPRECATED( void AddBrush(wxBrush*) ); - wxDEPRECATED( void RemoveBrush(wxBrush*) ); -#endif -}; - -extern WXDLLIMPEXP_DATA_CORE(wxBrushList*) wxTheBrushList; - -// provide comparison operators to allow code such as -// -// if ( brush.GetStyle() == wxTRANSPARENT ) -// -// to compile without warnings which it would otherwise provoke from some -// compilers as it compares elements of different enums -#if FUTURE_WXWIN_COMPATIBILITY_3_0 - -// Unfortunately some compilers have ambiguity issues when enum comparisons are -// overloaded so we have to disable the overloads in this case, see -// wxCOMPILER_NO_OVERLOAD_ON_ENUM definition in wx/platform.h for more details. -#ifndef wxCOMPILER_NO_OVERLOAD_ON_ENUM - -inline bool operator==(wxBrushStyle s, wxDeprecatedGUIConstants t) -{ - return static_cast(s) == static_cast(t); -} - -inline bool operator!=(wxBrushStyle s, wxDeprecatedGUIConstants t) -{ - return !(s == t); -} - -#endif // wxCOMPILER_NO_OVERLOAD_ON_ENUM - -#endif // FUTURE_WXWIN_COMPATIBILITY_3_0 - -#endif // _WX_BRUSH_H_BASE_ + // _WX_BRUSH_H_BASE_ diff --git a/Source/3rd Party/wx/include/wx/buffer.h b/Source/3rd Party/wx/include/wx/buffer.h index 43b4e01d9..f1ef1a23f 100644 --- a/Source/3rd Party/wx/include/wx/buffer.h +++ b/Source/3rd Party/wx/include/wx/buffer.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 12.04.99 -// RCS-ID: $Id$ +// RCS-ID: $Id: buffer.h 61872 2009-09-09 22:37:05Z VZ $ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -12,412 +12,144 @@ #ifndef _WX_BUFFER_H #define _WX_BUFFER_H -#include "wx/chartype.h" -#include "wx/wxcrtbase.h" +#include "wx/wxchar.h" #include // malloc() and free() -class WXDLLIMPEXP_FWD_BASE wxCStrData; - // ---------------------------------------------------------------------------- // Special classes for (wide) character strings: they use malloc/free instead // of new/delete // ---------------------------------------------------------------------------- -// helpers used by wxCharTypeBuffer -namespace wxPrivate -{ - -struct UntypedBufferData -{ - enum Kind - { - Owned, - NonOwned - }; - - UntypedBufferData(void *str, size_t len, Kind kind = Owned) - : m_str(str), m_length(len), m_ref(1), m_owned(kind == Owned) {} - - ~UntypedBufferData() - { - if ( m_owned ) - free(m_str); - } - - void *m_str; - size_t m_length; - - // "short" to have sizeof(Data)=12 on 32bit archs - unsigned short m_ref; - - bool m_owned; -}; - -// NB: this is defined in string.cpp and not the (non-existent) buffer.cpp -WXDLLIMPEXP_BASE UntypedBufferData * GetUntypedNullData(); - -} // namespace wxPrivate - - -// Reference-counted character buffer for storing string data. The buffer -// is only valid for as long as the "parent" object that provided the data -// is valid; see wxCharTypeBuffer for persistent variant. -template -class wxScopedCharTypeBuffer -{ -public: - typedef T CharType; - - wxScopedCharTypeBuffer() - { - m_data = GetNullData(); - } - - // Creates "non-owned" buffer, i.e. 'str' is not owned by the buffer - // and doesn't get freed by dtor. Used e.g. to point to wxString's internal - // storage. - static - const wxScopedCharTypeBuffer CreateNonOwned(const CharType *str, - size_t len = wxNO_LEN) - { - if ( len == wxNO_LEN ) - len = wxStrlen(str); - - wxScopedCharTypeBuffer buf; - if ( str ) - buf.m_data = new Data(const_cast(str), len, Data::NonOwned); - return buf; - } - - // Creates "owned" buffer, i.e. takes over ownership of 'str' and frees it - // in dtor (if ref.count reaches 0). - static - const wxScopedCharTypeBuffer CreateOwned(CharType *str, - size_t len = wxNO_LEN ) - { - if ( len == wxNO_LEN ) - len = wxStrlen(str); - - wxScopedCharTypeBuffer buf; - if ( str ) - buf.m_data = new Data(str, len); - return buf; - } - - wxScopedCharTypeBuffer(const wxScopedCharTypeBuffer& src) - { - m_data = src.m_data; - IncRef(); - } - - wxScopedCharTypeBuffer& operator=(const wxScopedCharTypeBuffer& src) - { - if ( &src == this ) - return *this; - - DecRef(); - m_data = src.m_data; - IncRef(); - - return *this; - } - - ~wxScopedCharTypeBuffer() - { - DecRef(); - } - - // NB: this method is only const for backward compatibility. It used to - // be needed for auto_ptr-like semantics of the copy ctor, but now - // that ref-counting is used, it's not really needed. - CharType *release() const - { - if ( m_data == GetNullData() ) - return NULL; - - wxASSERT_MSG( m_data->m_owned, wxT("can't release non-owned buffer") ); - wxASSERT_MSG( m_data->m_ref == 1, wxT("can't release shared buffer") ); - - CharType * const p = m_data->Get(); - - wxScopedCharTypeBuffer *self = const_cast(this); - self->m_data->Set(NULL, 0); - self->DecRef(); - - return p; - } - - void reset() - { - DecRef(); - } - - CharType *data() { return m_data->Get(); } - const CharType *data() const { return m_data->Get(); } - operator const CharType *() const { return data(); } - CharType operator[](size_t n) const { return data()[n]; } - - size_t length() const { return m_data->m_length; } - -protected: - // reference-counted data - struct Data : public wxPrivate::UntypedBufferData - { - Data(CharType *str, size_t len, Kind kind = Owned) - : wxPrivate::UntypedBufferData(str, len, kind) - { - } - - CharType *Get() const { return static_cast(m_str); } - void Set(CharType *str, size_t len) - { - m_str = str; - m_length = len; - } - }; - - // placeholder for NULL string, to simplify this code - static Data *GetNullData() - { - return static_cast(wxPrivate::GetUntypedNullData()); - } - - void IncRef() - { - if ( m_data == GetNullData() ) // exception, not ref-counted - return; - m_data->m_ref++; - } - - void DecRef() - { - if ( m_data == GetNullData() ) // exception, not ref-counted - return; - if ( --m_data->m_ref == 0 ) - delete m_data; - m_data = GetNullData(); - } - - // sets this object to a be copy of 'other'; if 'src' is non-owned, - // a deep copy is made and 'this' will contain new instance of the data - void MakeOwnedCopyOf(const wxScopedCharTypeBuffer& src) - { - this->DecRef(); - - if ( src.m_data == this->GetNullData() ) - { - this->m_data = this->GetNullData(); - } - else if ( src.m_data->m_owned ) - { - this->m_data = src.m_data; - this->IncRef(); - } - else - { - // if the scoped buffer had non-owned data, we have to make - // a copy here, because src.m_data->m_str is valid only for as long - // as 'src' exists - this->m_data = new Data - ( - StrCopy(src.data(), src.length()), - src.length() - ); - } - } - - static CharType *StrCopy(const CharType *src, size_t len) - { - CharType *dst = (CharType*)malloc(sizeof(CharType) * (len + 1)); - memcpy(dst, src, sizeof(CharType) * (len + 1)); - return dst; - } - -protected: - Data *m_data; -}; - -typedef wxScopedCharTypeBuffer wxScopedCharBuffer; -typedef wxScopedCharTypeBuffer wxScopedWCharBuffer; - - -// this buffer class always stores data in "owned" (persistent) manner -template -class wxCharTypeBuffer : public wxScopedCharTypeBuffer -{ -protected: - typedef typename wxScopedCharTypeBuffer::Data Data; - -public: - typedef T CharType; - - wxCharTypeBuffer(const CharType *str = NULL, size_t len = wxNO_LEN) - { - if ( str ) - { - if ( len == wxNO_LEN ) - len = wxStrlen(str); - this->m_data = new Data(this->StrCopy(str, len), len); - } - else - { - this->m_data = this->GetNullData(); - } - } - - wxCharTypeBuffer(size_t len) - { - this->m_data = - new Data((CharType *)malloc((len + 1)*sizeof(CharType)), len); - this->m_data->Get()[len] = (CharType)0; - } - - wxCharTypeBuffer(const wxCharTypeBuffer& src) - : wxScopedCharTypeBuffer(src) {} - - wxCharTypeBuffer& operator=(const CharType *str) - { - this->DecRef(); - - if ( str ) - this->m_data = new Data(wxStrdup(str), wxStrlen(str)); - return *this; - } - - wxCharTypeBuffer& operator=(const wxCharTypeBuffer& src) - { - wxScopedCharTypeBuffer::operator=(src); - return *this; - } - - wxCharTypeBuffer(const wxScopedCharTypeBuffer& src) - { - this->MakeOwnedCopyOf(src); - } - - wxCharTypeBuffer& operator=(const wxScopedCharTypeBuffer& src) - { - MakeOwnedCopyOf(src); - return *this; - } - - bool extend(size_t len) - { - wxASSERT_MSG( this->m_data->m_owned, "cannot extend non-owned buffer" ); - wxASSERT_MSG( this->m_data->m_ref == 1, "can't extend shared buffer" ); - - CharType *str = - (CharType *)realloc(this->data(), (len + 1) * sizeof(CharType)); - if ( !str ) - return false; - - // For consistency with the ctor taking just the length, NUL-terminate - // the buffer. - str[len] = (CharType)0; - - if ( this->m_data == this->GetNullData() ) - { - this->m_data = new Data(str, len); - } - else - { - this->m_data->Set(str, len); - this->m_data->m_owned = true; - } - - return true; - } - - void shrink(size_t len) - { - wxASSERT_MSG( this->m_data->m_owned, "cannot shrink non-owned buffer" ); - wxASSERT_MSG( this->m_data->m_ref == 1, "can't shrink shared buffer" ); - - wxASSERT( len <= this->length() ); - - this->m_data->m_length = len; - this->data()[len] = 0; - } -}; - -WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE( wxScopedCharTypeBuffer ) -WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE( wxCharTypeBuffer ) - -class wxCharBuffer : public wxCharTypeBuffer -{ -public: - typedef wxCharTypeBuffer wxCharTypeBufferBase; - typedef wxScopedCharTypeBuffer wxScopedCharTypeBufferBase; - - wxCharBuffer(const wxCharTypeBufferBase& buf) - : wxCharTypeBufferBase(buf) {} - wxCharBuffer(const wxScopedCharTypeBufferBase& buf) - : wxCharTypeBufferBase(buf) {} - - wxCharBuffer(const CharType *str = NULL) : wxCharTypeBufferBase(str) {} - wxCharBuffer(size_t len) : wxCharTypeBufferBase(len) {} - - wxCharBuffer(const wxCStrData& cstr); -}; - -WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE( wxScopedCharTypeBuffer ) -WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE( wxCharTypeBuffer ) - -class wxWCharBuffer : public wxCharTypeBuffer -{ -public: - typedef wxCharTypeBuffer wxCharTypeBufferBase; - typedef wxScopedCharTypeBuffer wxScopedCharTypeBufferBase; - - wxWCharBuffer(const wxCharTypeBufferBase& buf) - : wxCharTypeBufferBase(buf) {} - wxWCharBuffer(const wxScopedCharTypeBufferBase& buf) - : wxCharTypeBufferBase(buf) {} - - wxWCharBuffer(const CharType *str = NULL) : wxCharTypeBufferBase(str) {} - wxWCharBuffer(size_t len) : wxCharTypeBufferBase(len) {} - - wxWCharBuffer(const wxCStrData& cstr); -}; - -// wxCharTypeBuffer implicitly convertible to T* -template -class wxWritableCharTypeBuffer : public wxCharTypeBuffer -{ -public: - typedef typename wxScopedCharTypeBuffer::CharType CharType; - - wxWritableCharTypeBuffer(const wxScopedCharTypeBuffer& src) - : wxCharTypeBuffer(src) {} - // FIXME-UTF8: this won't be needed after converting mb_str()/wc_str() to - // always return a buffer - // + we should derive this class from wxScopedCharTypeBuffer - // then - wxWritableCharTypeBuffer(const CharType *str = NULL) - : wxCharTypeBuffer(str) {} - - operator CharType*() { return this->data(); } -}; - -typedef wxWritableCharTypeBuffer wxWritableCharBuffer; -typedef wxWritableCharTypeBuffer wxWritableWCharBuffer; - +#define DEFINE_BUFFER(classname, chartype, strdupfunc) \ +class WXDLLIMPEXP_BASE classname \ +{ \ +public: \ + classname(const chartype *str = NULL) \ + : m_str(str ? strdupfunc(str) : NULL) \ + { \ + } \ + \ + classname(size_t len) \ + : m_str((chartype *)malloc((len + 1)*sizeof(chartype))) \ + { \ + m_str[len] = (chartype)0; \ + } \ + \ + /* no need to check for NULL, free() does it */ \ + ~classname() { free(m_str); } \ + \ + /* \ + WARNING: \ + \ + the copy ctor and assignment operators change the passed in object \ + even although it is declared as "const", so: \ + \ + a) it shouldn't be really const \ + b) you shouldn't use it afterwards (or know that it was reset) \ + \ + This is very ugly but is unfortunately needed to make the normal use\ + of classname buffer objects possible and is very similar to what \ + std::auto_ptr<> does (as if it were an excuse...) \ + */ \ + \ + /* \ + because of the remark above, release() is declared const even if it \ + isn't really const \ + */ \ + chartype *release() const \ + { \ + chartype *p = m_str; \ + ((classname *)this)->m_str = NULL; \ + return p; \ + } \ + \ + void reset() \ + { \ + free(m_str); \ + m_str = NULL; \ + } \ + \ + classname(const classname& src) \ + : m_str(src.release()) \ + { \ + } \ + \ + classname& operator=(const chartype *str) \ + { \ + free(m_str); \ + m_str = str ? strdupfunc(str) : NULL; \ + return *this; \ + } \ + \ + classname& operator=(const classname& src) \ + { \ + free(m_str); \ + m_str = src.release(); \ + \ + return *this; \ + } \ + \ + bool extend(size_t len) \ + { \ + chartype * \ + str = (chartype *)realloc(m_str, (len + 1)*sizeof(chartype)); \ + if ( !str ) \ + return false; \ + \ + m_str = str; \ + \ + return true; \ + } \ + \ + chartype *data() { return m_str; } \ + const chartype *data() const { return m_str; } \ + operator const chartype *() const { return m_str; } \ + chartype operator[](size_t n) const { return m_str[n]; } \ + \ +private: \ + chartype *m_str; \ +} + +#if wxABI_VERSION >= 20804 +// needed for wxString::char_str() and wchar_str() +#define DEFINE_WRITABLE_BUFFER(classname, baseclass, chartype) \ +class WXDLLIMPEXP_BASE classname : public baseclass \ +{ \ +public: \ + classname(const baseclass& src) : baseclass(src) {} \ + classname(const chartype *str = NULL) : baseclass(str) {} \ + \ + operator chartype*() { return this->data(); } \ +} +#endif // wxABI_VERSION >= 20804 + +DEFINE_BUFFER(wxCharBuffer, char, wxStrdupA); +#if wxABI_VERSION >= 20804 +DEFINE_WRITABLE_BUFFER(wxWritableCharBuffer, wxCharBuffer, char); +#endif + +#if wxUSE_WCHAR_T + +DEFINE_BUFFER(wxWCharBuffer, wchar_t, wxStrdupW); +#if wxABI_VERSION >= 20804 +DEFINE_WRITABLE_BUFFER(wxWritableWCharBuffer, wxWCharBuffer, wchar_t); +#endif + +#endif // wxUSE_WCHAR_T + +#undef DEFINE_BUFFER +#undef DEFINE_WRITABLE_BUFFER #if wxUSE_UNICODE - #define wxWxCharBuffer wxWCharBuffer + typedef wxWCharBuffer wxWxCharBuffer; #define wxMB2WXbuf wxWCharBuffer #define wxWX2MBbuf wxCharBuffer - #if wxUSE_UNICODE_WCHAR - #define wxWC2WXbuf wxChar* - #define wxWX2WCbuf wxChar* - #elif wxUSE_UNICODE_UTF8 - #define wxWC2WXbuf wxWCharBuffer - #define wxWX2WCbuf wxWCharBuffer - #endif + #define wxWC2WXbuf wxChar* + #define wxWX2WCbuf wxChar* #else // ANSI - #define wxWxCharBuffer wxCharBuffer + typedef wxCharBuffer wxWxCharBuffer; #define wxMB2WXbuf wxChar* #define wxWX2MBbuf wxChar* @@ -470,21 +202,6 @@ private: delete this; } - void *release() - { - if ( m_data == NULL ) - return NULL; - - wxASSERT_MSG( m_ref == 1, "can't release shared buffer" ); - - void *p = m_data; - m_data = NULL; - m_len = - m_size = 0; - - return p; - } - // the buffer containing the data void *m_data; @@ -498,7 +215,7 @@ private: // the reference count size_t m_ref; - wxDECLARE_NO_COPY_CLASS(wxMemoryBufferData); + DECLARE_NO_COPY_CLASS(wxMemoryBufferData) }; @@ -524,12 +241,9 @@ public: wxMemoryBuffer& operator=(const wxMemoryBuffer& src) { - if (&src != this) - { - m_bufdata->DecRef(); - m_bufdata = src.m_bufdata; - m_bufdata->IncRef(); - } + m_bufdata->DecRef(); + m_bufdata = src.m_bufdata; + m_bufdata->IncRef(); return *this; } @@ -539,8 +253,6 @@ public: size_t GetBufSize() const { return m_bufdata->m_size; } size_t GetDataLen() const { return m_bufdata->m_len; } - bool IsEmpty() const { return GetDataLen() == 0; } - void SetBufSize(size_t size) { m_bufdata->ResizeIfNeeded(size); } void SetDataLen(size_t len) { @@ -548,8 +260,6 @@ public: m_bufdata->m_len = len; } - void Clear() { SetDataLen(0); } - // Ensure the buffer is big enough and return a pointer to it void *GetWriteBuf(size_t sizeNeeded) { @@ -591,13 +301,6 @@ public: operator const char *() const { return (const char*)GetData(); } - // gives up ownership of data, returns the pointer; after this call, - // data isn't freed by the buffer and its content is resent to empty - void *release() - { - return m_bufdata->release(); - } - private: wxMemoryBufferData* m_bufdata; }; diff --git a/Source/3rd Party/wx/include/wx/build.h b/Source/3rd Party/wx/include/wx/build.h index 8c4df90d8..f6f5b0e22 100644 --- a/Source/3rd Party/wx/include/wx/build.h +++ b/Source/3rd Party/wx/include/wx/build.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin, Vaclav Slavik // Modified by: // Created: 07.05.02 -// RCS-ID: $Id$ +// RCS-ID: $Id: build.h 35858 2005-10-09 15:48:42Z MBN $ // Copyright: (c) 2002 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -15,7 +15,7 @@ #include "wx/version.h" // NB: This file contains macros for checking binary compatibility of libraries -// in multilib builds, plugins and user components. +// in multilib buildm, plugins and user components. // The WX_BUILD_OPTIONS_SIGNATURE macro expands into string that should // uniquely identify binary compatible builds: i.e. if two builds of the // library are binary compatible, their signature string should be the @@ -42,10 +42,14 @@ __WX_BO_STRINGIZE(x) "." __WX_BO_STRINGIZE(y) "." __WX_BO_STRINGIZE(z) #endif -#if wxUSE_UNICODE_UTF8 - #define __WX_BO_UNICODE "UTF-8" -#elif wxUSE_UNICODE_WCHAR - #define __WX_BO_UNICODE "wchar_t" +#ifdef __WXDEBUG__ + #define __WX_BO_DEBUG "debug" +#else + #define __WX_BO_DEBUG "no debug" +#endif + +#if wxUSE_UNICODE + #define __WX_BO_UNICODE "Unicode" #else #define __WX_BO_UNICODE "ANSI" #endif @@ -61,7 +65,7 @@ #define __WX_BO_COMPILER ",GCC " \ __WX_BO_STRINGIZE(__GNUC__) "." __WX_BO_STRINGIZE(__GNUC_MINOR__) #elif defined(__VISUALC__) - #define __WX_BO_COMPILER ",Visual C++ " __WX_BO_STRINGIZE(_MSC_VER) + #define __WX_BO_COMPILER ",Visual C++" #elif defined(__BORLANDC__) #define __WX_BO_COMPILER ",Borland C++" #elif defined(__DIGITALMARS__) @@ -73,19 +77,19 @@ #endif // WXWIN_COMPATIBILITY macros affect presence of virtual functions +#if WXWIN_COMPATIBILITY_2_4 + #define __WX_BO_WXWIN_COMPAT_2_4 ",compatible with 2.4" +#else + #define __WX_BO_WXWIN_COMPAT_2_4 +#endif #if WXWIN_COMPATIBILITY_2_6 #define __WX_BO_WXWIN_COMPAT_2_6 ",compatible with 2.6" #else #define __WX_BO_WXWIN_COMPAT_2_6 #endif -#if WXWIN_COMPATIBILITY_2_8 - #define __WX_BO_WXWIN_COMPAT_2_8 ",compatible with 2.8" -#else - #define __WX_BO_WXWIN_COMPAT_2_8 -#endif // deriving wxWin containers from STL ones changes them completely: -#if wxUSE_STD_CONTAINERS +#if wxUSE_STL #define __WX_BO_STL ",STL containers" #else #define __WX_BO_STL ",wx containers" @@ -94,10 +98,10 @@ // This macro is passed as argument to wxConsoleApp::CheckBuildOptions() #define WX_BUILD_OPTIONS_SIGNATURE \ __WX_BO_VERSION(wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER) \ - " (" __WX_BO_UNICODE \ + " (" __WX_BO_DEBUG "," __WX_BO_UNICODE \ __WX_BO_COMPILER \ __WX_BO_STL \ - __WX_BO_WXWIN_COMPAT_2_6 __WX_BO_WXWIN_COMPAT_2_8 \ + __WX_BO_WXWIN_COMPAT_2_4 __WX_BO_WXWIN_COMPAT_2_6 \ ")" @@ -106,7 +110,7 @@ // ---------------------------------------------------------------------------- // Use this macro to check build options. Adding it to a file in DLL will -// ensure that the DLL checks build options in same way wxIMPLEMENT_APP() does. +// ensure that the DLL checks build options in same way IMPLEMENT_APP() does. #define WX_CHECK_BUILD_OPTIONS(libName) \ static struct wxBuildOptionsChecker \ { \ @@ -118,4 +122,28 @@ } gs_buildOptionsCheck; +#if WXWIN_COMPATIBILITY_2_4 + +// ---------------------------------------------------------------------------- +// wxBuildOptions +// ---------------------------------------------------------------------------- + +// NB: Don't use this class in new code, it relies on the ctor being always +// inlined. WX_BUILD_OPTIONS_SIGNATURE always works. +class wxBuildOptions +{ +public: + // the ctor must be inline to get the compilation settings of the code + // which included this header + wxBuildOptions() : m_signature(WX_BUILD_OPTIONS_SIGNATURE) {} + +private: + const char *m_signature; + + // actually only CheckBuildOptions() should be our friend but well... + friend class wxAppConsole; +}; + +#endif // WXWIN_COMPATIBILITY_2_4 + #endif // _WX_BUILD_H_ diff --git a/Source/3rd Party/wx/include/wx/busyinfo.h b/Source/3rd Party/wx/include/wx/busyinfo.h index 47526c9b7..d13d3b68c 100644 --- a/Source/3rd Party/wx/include/wx/busyinfo.h +++ b/Source/3rd Party/wx/include/wx/busyinfo.h @@ -3,7 +3,7 @@ // Purpose: Information window (when app is busy) // Author: Vaclav Slavik // Copyright: (c) 1999 Vaclav Slavik -// RCS-ID: $Id$ +// RCS-ID: $Id: busyinfo.h 37158 2006-01-26 15:40:46Z ABX $ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// diff --git a/Source/3rd Party/wx/include/wx/button.h b/Source/3rd Party/wx/include/wx/button.h index a938db1dc..4ca2305ae 100644 --- a/Source/3rd Party/wx/include/wx/button.h +++ b/Source/3rd Party/wx/include/wx/button.h @@ -4,7 +4,7 @@ // Author: Vadim Zetlin // Modified by: // Created: 15.08.00 -// RCS-ID: $Id$ +// RCS-ID: $Id: button.h 49563 2007-10-31 20:46:21Z VZ $ // Copyright: (c) Vadim Zetlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -14,37 +14,70 @@ #include "wx/defs.h" +// ---------------------------------------------------------------------------- +// wxButton flags shared with other classes +// ---------------------------------------------------------------------------- + +#if wxUSE_TOGGLEBTN || wxUSE_BUTTON + +// These flags affect label alignment +#define wxBU_LEFT 0x0040 +#define wxBU_TOP 0x0080 +#define wxBU_RIGHT 0x0100 +#define wxBU_BOTTOM 0x0200 +#define wxBU_ALIGN_MASK ( wxBU_LEFT | wxBU_TOP | wxBU_RIGHT | wxBU_BOTTOM ) +#endif + #if wxUSE_BUTTON -#include "wx/anybutton.h" +// ---------------------------------------------------------------------------- +// wxButton specific flags +// ---------------------------------------------------------------------------- -extern WXDLLIMPEXP_DATA_CORE(const char) wxButtonNameStr[]; +// These two flags are obsolete +#define wxBU_NOAUTODRAW 0x0000 +#define wxBU_AUTODRAW 0x0004 + +// by default, the buttons will be created with some (system dependent) +// minimal size to make them look nicer, giving this style will make them as +// small as possible +#define wxBU_EXACTFIT 0x0001 + +#include "wx/control.h" + +class WXDLLIMPEXP_FWD_CORE wxBitmap; + +extern WXDLLEXPORT_DATA(const wxChar) wxButtonNameStr[]; // ---------------------------------------------------------------------------- // wxButton: a push button // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxButtonBase : public wxAnyButton +class WXDLLEXPORT wxButtonBase : public wxControl { public: wxButtonBase() { } - // show the authentication needed symbol on the button: this is currently - // only implemented on Windows Vista and newer (on which it shows the UAC - // shield symbol) - void SetAuthNeeded(bool show = true) { DoSetAuthNeeded(show); } - bool GetAuthNeeded() const { return DoGetAuthNeeded(); } + // show the image in the button in addition to the label + virtual void SetImageLabel(const wxBitmap& WXUNUSED(bitmap)) { } - // make this button the default button in its top level window - // - // returns the old default item (possibly NULL) - virtual wxWindow *SetDefault(); + // set the margins around the image + virtual void SetImageMargins(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y)) { } + + // this wxButton method is called when the button becomes the default one + // on its panel + virtual void SetDefault() { } + + // Buttons on MSW can look bad if they are not native colours, because + // then they become owner-drawn and not theme-drawn. Disable it here + // in wxButtonBase to make it consistent. + virtual bool ShouldInheritColours() const { return false; } // returns the default button size for this platform static wxSize GetDefaultSize(); protected: - wxDECLARE_NO_COPY_CLASS(wxButtonBase); + DECLARE_NO_COPY_CLASS(wxButtonBase) }; #if defined(__WXUNIVERSAL__) @@ -58,13 +91,16 @@ protected: #elif defined(__WXGTK__) #include "wx/gtk1/button.h" #elif defined(__WXMAC__) - #include "wx/osx/button.h" + #include "wx/mac/button.h" #elif defined(__WXCOCOA__) #include "wx/cocoa/button.h" #elif defined(__WXPM__) #include "wx/os2/button.h" +#elif defined(__WXPALMOS__) + #include "wx/palmos/button.h" #endif #endif // wxUSE_BUTTON -#endif // _WX_BUTTON_H_BASE_ +#endif + // _WX_BUTTON_H_BASE_ diff --git a/Source/3rd Party/wx/include/wx/cairo.h b/Source/3rd Party/wx/include/wx/cairo.h deleted file mode 100644 index 99df37033..000000000 --- a/Source/3rd Party/wx/include/wx/cairo.h +++ /dev/null @@ -1,29 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cairo.h -// Purpose: Cairo library -// Author: Anthony Bretaudeau -// Created: 2007-08-25 -// RCS-ID: $Id$ -// Copyright: (c) Anthony Bretaudeau -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CAIRO_H_BASE_ -#define _WX_CAIRO_H_BASE_ - -#if wxUSE_CAIRO - -#include "wx/dynlib.h" -#include - -extern "C" -{ - -bool wxCairoInit(); -void wxCairoCleanUp(); - -} - -#endif // wxUSE_CAIRO - -#endif // _WX_CAIRO_H_BASE_ diff --git a/Source/3rd Party/wx/include/wx/caret.h b/Source/3rd Party/wx/include/wx/caret.h index 86df48dbb..848fdcf73 100644 --- a/Source/3rd Party/wx/include/wx/caret.h +++ b/Source/3rd Party/wx/include/wx/caret.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 23.05.99 -// RCS-ID: $Id$ +// RCS-ID: $Id: caret.h 49804 2007-11-10 01:09:42Z VZ $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -34,7 +34,7 @@ class WXDLLIMPEXP_FWD_CORE wxWindowBase; // appear. It can be either a solid block or a custom bitmap (TODO) // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxCaretBase +class WXDLLEXPORT wxCaretBase { public: // ctors @@ -147,7 +147,7 @@ public: virtual void OnKillFocus() { } protected: - // these functions may be overridden in the derived classes, but they + // these functions may be overriden in the derived classes, but they // should call the base class version first virtual bool DoCreate(wxWindowBase *window, int width, int height) { @@ -167,7 +167,7 @@ protected: // the common initialization void Init() { - m_window = NULL; + m_window = (wxWindowBase *)NULL; m_x = m_y = 0; m_width = m_height = 0; m_countVisible = 0; @@ -186,7 +186,7 @@ protected: int m_countVisible; private: - wxDECLARE_NO_COPY_CLASS(wxCaretBase); + DECLARE_NO_COPY_CLASS(wxCaretBase) }; // --------------------------------------------------------------------------- @@ -208,17 +208,17 @@ private: #ifdef wxHAS_CARET_USING_OVERLAYS // we don't need to hide the caret if it's rendered using overlays -class WXDLLIMPEXP_CORE wxCaretSuspend +class WXDLLEXPORT wxCaretSuspend { public: wxCaretSuspend(wxWindow *WXUNUSED(win)) {} - wxDECLARE_NO_COPY_CLASS(wxCaretSuspend); + DECLARE_NO_COPY_CLASS(wxCaretSuspend) }; #else // !wxHAS_CARET_USING_OVERLAYS -class WXDLLIMPEXP_CORE wxCaretSuspend +class WXDLLEXPORT wxCaretSuspend { public: wxCaretSuspend(wxWindow *win) @@ -242,7 +242,7 @@ private: wxCaret *m_caret; bool m_show; - wxDECLARE_NO_COPY_CLASS(wxCaretSuspend); + DECLARE_NO_COPY_CLASS(wxCaretSuspend) }; #endif // wxHAS_CARET_USING_OVERLAYS/!wxHAS_CARET_USING_OVERLAYS diff --git a/Source/3rd Party/wx/include/wx/chartype.h b/Source/3rd Party/wx/include/wx/chartype.h deleted file mode 100644 index 672a0b9a5..000000000 --- a/Source/3rd Party/wx/include/wx/chartype.h +++ /dev/null @@ -1,305 +0,0 @@ -/* - * Name: wx/chartype.h - * Purpose: Declarations of wxChar and related types - * Author: Joel Farley, Ove KÃ¥ven - * Modified by: Vadim Zeitlin, Robert Roebling, Ron Lee - * Created: 1998/06/12 - * RCS-ID: $Id$ - * Copyright: (c) 1998-2006 wxWidgets dev team - * Licence: wxWindows licence - */ - -/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ - -#ifndef _WX_WXCHARTYPE_H_ -#define _WX_WXCHARTYPE_H_ - -/* defs.h indirectly includes this file, so don't include it here */ -#include "wx/platform.h" - -/* check whether we have wchar_t and which size it is if we do */ -#if !defined(wxUSE_WCHAR_T) - #if defined(__UNIX__) - #if defined(HAVE_WCSTR_H) || defined(HAVE_WCHAR_H) || defined(__FreeBSD__) || defined(__DARWIN__) - #define wxUSE_WCHAR_T 1 - #else - #define wxUSE_WCHAR_T 0 - #endif - #elif defined(__GNUWIN32__) && !defined(__MINGW32__) - #define wxUSE_WCHAR_T 0 - #elif defined(__WATCOMC__) - #define wxUSE_WCHAR_T 0 - #elif defined(__VISAGECPP__) && (__IBMCPP__ < 400) - #define wxUSE_WCHAR_T 0 - #else - /* add additional compiler checks if this fails */ - #define wxUSE_WCHAR_T 1 - #endif -#endif /* !defined(wxUSE_WCHAR_T) */ - -/* Unicode support requires wchar_t */ -#if !wxUSE_WCHAR_T - #error "wchar_t must be available" -#endif /* Unicode */ - -/* - non Unix compilers which do have wchar.h (but not tchar.h which is included - below and which includes wchar.h anyhow). - - Actually MinGW has tchar.h, but it does not include wchar.h - */ -#if defined(__VISAGECPP__) || defined(__MINGW32__) || defined(__WATCOMC__) - #ifndef HAVE_WCHAR_H - #define HAVE_WCHAR_H - #endif -#endif - -#ifdef HAVE_WCHAR_H - /* the current (as of Nov 2002) version of cygwin has a bug in its */ - /* wchar.h -- there is no extern "C" around the declarations in it */ - /* and this results in linking errors later; also, at least on some */ - /* Cygwin versions, wchar.h requires sys/types.h */ - #ifdef __CYGWIN__ - #include - #ifdef __cplusplus - extern "C" { - #endif - #endif /* Cygwin */ - - #include - - #if defined(__CYGWIN__) && defined(__cplusplus) - } - #endif /* Cygwin and C++ */ - -#elif defined(HAVE_WCSTR_H) - /* old compilers have relevant declarations here */ - #include -#elif defined(__FreeBSD__) || defined(__DARWIN__) || defined(__EMX__) - /* include stdlib.h for wchar_t */ - #include -#endif /* HAVE_WCHAR_H */ - -#ifdef HAVE_WIDEC_H - #include -#endif - -/* -------------------------------------------------------------------------- */ -/* define wxHAVE_TCHAR_SUPPORT for the compilers which support the TCHAR type */ -/* mapped to either char or wchar_t depending on the ASCII/Unicode mode and */ -/* have the function mapping _tfoo() -> foo() or wfoo() */ -/* -------------------------------------------------------------------------- */ - -/* VC++ and BC++ starting with 5.2 have TCHAR support */ -#ifdef __VISUALC__ - #define wxHAVE_TCHAR_SUPPORT -#elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x520) - #define wxHAVE_TCHAR_SUPPORT - #include -#elif defined(__WATCOMC__) - #define wxHAVE_TCHAR_SUPPORT -#elif defined(__DMC__) - #define wxHAVE_TCHAR_SUPPORT -#elif defined(__MINGW32__) && wxCHECK_W32API_VERSION( 1, 0 ) - #define wxHAVE_TCHAR_SUPPORT - #include - #include - #include -#elif 0 && defined(__VISAGECPP__) && (__IBMCPP__ >= 400) - /* VZ: the old VisualAge definitions were completely wrong and had no */ - /* chance at all to work in Unicode build anyhow so let's pretend */ - /* that VisualAge does _not_ support TCHAR for the moment (as */ - /* indicated by "0 &&" above) until someone really has time to delve */ - /* into Unicode issues under OS/2 */ - - /* VisualAge 4.0+ supports TCHAR */ - #define wxHAVE_TCHAR_SUPPORT -#endif /* compilers with (good) TCHAR support */ - -#ifdef wxHAVE_TCHAR_SUPPORT - /* get TCHAR definition if we've got it */ - #include - - /* we surely do have wchar_t if we have TCHAR */ - #ifndef wxUSE_WCHAR_T - #define wxUSE_WCHAR_T 1 - #endif /* !defined(wxUSE_WCHAR_T) */ -#endif /* wxHAVE_TCHAR_SUPPORT */ - -/* ------------------------------------------------------------------------- */ -/* define wxChar type */ -/* ------------------------------------------------------------------------- */ - -/* TODO: define wxCharInt to be equal to either int or wint_t? */ - -#if !wxUSE_UNICODE - typedef char wxChar; - typedef signed char wxSChar; - typedef unsigned char wxUChar; -#else - /* VZ: note that VC++ defines _T[SU]CHAR simply as wchar_t and not as */ - /* signed/unsigned version of it which (a) makes sense to me (unlike */ - /* char wchar_t is always unsigned) and (b) was how the previous */ - /* definitions worked so keep it like this */ - - /* Sun's SunPro compiler supports the wchar_t type and wide character */ - /* functions, but does not define __WCHAR_TYPE__. Define it here to */ - /* allow unicode enabled builds. */ - #if (defined(__SUNPRO_CC) || defined(__SUNPRO_C)) && !defined(__WCHAR_TYPE__) - #define __WCHAR_TYPE__ wxchar_t - #endif - - /* GNU libc has __WCHAR_TYPE__ which requires special treatment, see */ - /* comment below */ - #if !defined(__WCHAR_TYPE__) || \ - (!defined(__GNUC__) || wxCHECK_GCC_VERSION(2, 96)) - /* standard case */ - typedef wchar_t wxChar; - typedef wchar_t wxSChar; - typedef wchar_t wxUChar; - #else /* __WCHAR_TYPE__ and gcc < 2.96 */ - /* VS: wxWidgets used to define wxChar as __WCHAR_TYPE__ here. */ - /* However, this doesn't work with new GCC 3.x compilers because */ - /* wchar_t is C++'s builtin type in the new standard. OTOH, old */ - /* compilers (GCC 2.x) won't accept new definition of */ - /* wx{S,U}CharType, so we have to define wxChar */ - /* conditionally depending on detected compiler & compiler */ - /* version. */ - - /* with old definition of wxChar. */ - #define wchar_t __WCHAR_TYPE__ - typedef __WCHAR_TYPE__ wxChar; - typedef __WCHAR_TYPE__ wxSChar; - typedef __WCHAR_TYPE__ wxUChar; - #endif /* __WCHAR_TYPE__ */ -#endif /* ASCII/Unicode */ - -/* ------------------------------------------------------------------------- */ -/* define wxStringCharType */ -/* ------------------------------------------------------------------------- */ - -/* depending on the platform, Unicode build can either store wxStrings as - wchar_t* or UTF-8 encoded char*: */ -#if wxUSE_UNICODE - /* FIXME-UTF8: what would be better place for this? */ - #if defined(wxUSE_UTF8_LOCALE_ONLY) && !defined(wxUSE_UNICODE_UTF8) - #error "wxUSE_UTF8_LOCALE_ONLY only makes sense with wxUSE_UNICODE_UTF8" - #endif - #ifndef wxUSE_UTF8_LOCALE_ONLY - #define wxUSE_UTF8_LOCALE_ONLY 0 - #endif - - #ifndef wxUSE_UNICODE_UTF8 - #define wxUSE_UNICODE_UTF8 0 - #endif - - #if wxUSE_UNICODE_UTF8 - #define wxUSE_UNICODE_WCHAR 0 - #else - #define wxUSE_UNICODE_WCHAR 1 - #endif -#else - #define wxUSE_UNICODE_WCHAR 0 - #define wxUSE_UNICODE_UTF8 0 - #define wxUSE_UTF8_LOCALE_ONLY 0 -#endif - -/* define char type used by wxString internal representation: */ -#if wxUSE_UNICODE_WCHAR - typedef wchar_t wxStringCharType; -#else /* wxUSE_UNICODE_UTF8 || ANSI */ - typedef char wxStringCharType; -#endif - - -/* ------------------------------------------------------------------------- */ -/* define wxT() and related macros */ -/* ------------------------------------------------------------------------- */ - -/* BSD systems define _T() to be something different in ctype.h, override it */ -#if defined(__FreeBSD__) || defined(__DARWIN__) - #include - #undef _T -#endif - -/* - wxT ("wx text") macro turns a literal string constant into a wide char - constant. It is mostly unnecessary with wx 2.9 but defined for - compatibility. - */ -#ifndef wxT - #if !wxUSE_UNICODE - #define wxT(x) x - #else /* Unicode */ - /* - Notice that we use an intermediate macro to allow x to be expanded - if it's a macro itself. - */ - #ifndef wxCOMPILER_BROKEN_CONCAT_OPER - #define wxT(x) wxCONCAT_HELPER(L, x) - #else - #define wxT(x) wxPREPEND_L(x) - #endif - #endif /* ASCII/Unicode */ -#endif /* !defined(wxT) */ - -/* - wxT_2 exists only for compatibility with wx 2.x and is the same as wxT() in - that version but nothing in the newer ones. - */ -#define wxT_2(x) x - -/* - wxS ("wx string") macro can be used to create literals using the same - representation as wxString does internally, i.e. wchar_t in Unicode build - under Windows or char in UTF-8-based Unicode builds and (deprecated) ANSI - builds everywhere (see wxStringCharType definition above). - */ -#if wxUSE_UNICODE_WCHAR - /* - As above with wxT(), wxS() argument is expanded if it's a macro. - */ - #ifndef wxCOMPILER_BROKEN_CONCAT_OPER - #define wxS(x) wxCONCAT_HELPER(L, x) - #else - #define wxS(x) wxPREPEND_L(x) - #endif -#else /* wxUSE_UNICODE_UTF8 || ANSI */ - #define wxS(x) x -#endif - -/* - _T() is a synonym for wxT() familiar to Windows programmers. As this macro - has even higher risk of conflicting with system headers, its use is - discouraged and you may predefine wxNO__T to disable it. Additionally, we - do it ourselves for Sun CC which is known to use it in its standard headers - (see #10660). - */ -#if defined(__SUNPRO_C) || defined(__SUNPRO_CC) - #ifndef wxNO__T - #define wxNO__T - #endif -#endif - -#if !defined(_T) && !defined(wxNO__T) - #define _T(x) wxT(x) -#endif - -/* a helper macro allowing to make another macro Unicode-friendly, see below */ -#define wxAPPLY_T(x) wxT(x) - -/* Unicode-friendly __FILE__, __DATE__ and __TIME__ analogs */ -#ifndef __TFILE__ - #define __TFILE__ wxAPPLY_T(__FILE__) -#endif - -#ifndef __TDATE__ - #define __TDATE__ wxAPPLY_T(__DATE__) -#endif - -#ifndef __TTIME__ - #define __TTIME__ wxAPPLY_T(__TIME__) -#endif - -#endif /* _WX_WXCHARTYPE_H_ */ - diff --git a/Source/3rd Party/wx/include/wx/checkbox.h b/Source/3rd Party/wx/include/wx/checkbox.h index 92342a907..4760475ab 100644 --- a/Source/3rd Party/wx/include/wx/checkbox.h +++ b/Source/3rd Party/wx/include/wx/checkbox.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 07.09.00 -// RCS-ID: $Id$ +// RCS-ID: $Id: checkbox.h 39901 2006-06-30 10:51:44Z VS $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -25,12 +25,8 @@ * Determine whether to use a 3-state or 2-state * checkbox. 3-state enables to differentiate * between 'unchecked', 'checked' and 'undetermined'. - * - * In addition to the styles here it is also possible to specify just 0 which - * is treated the same as wxCHK_2STATE for compatibility (but using explicit - * flag is preferred). */ -#define wxCHK_2STATE 0x4000 +#define wxCHK_2STATE 0x0000 #define wxCHK_3STATE 0x1000 /* @@ -41,13 +37,25 @@ */ #define wxCHK_ALLOW_3RD_STATE_FOR_USER 0x2000 -extern WXDLLIMPEXP_DATA_CORE(const char) wxCheckBoxNameStr[]; +/* + * The possible states of a 3-state checkbox (Compatible + * with the 2-state checkbox). + */ +enum wxCheckBoxState +{ + wxCHK_UNCHECKED, + wxCHK_CHECKED, + wxCHK_UNDETERMINED /* 3-state checkbox only */ +}; + + +extern WXDLLEXPORT_DATA(const wxChar) wxCheckBoxNameStr[]; // ---------------------------------------------------------------------------- // wxCheckBox: a control which shows a label and a box which may be checked // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxCheckBoxBase : public wxControl +class WXDLLEXPORT wxCheckBoxBase : public wxControl { public: wxCheckBoxBase() { } @@ -110,9 +118,6 @@ public: } protected: - // choose the default border for this window - virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } - virtual void DoSet3StateValue(wxCheckBoxState WXUNUSED(state)) { wxFAIL; } virtual wxCheckBoxState DoGet3StateValue() const @@ -121,51 +126,10 @@ protected: return wxCHK_UNCHECKED; } - // Helper function to be called from derived classes Create() - // implementations: it checks that the style doesn't contain any - // incompatible bits and modifies it to be sane if it does. - static void WXValidateStyle(long *stylePtr) - { - long& style = *stylePtr; - - if ( !(style & (wxCHK_2STATE | wxCHK_3STATE)) ) - { - // For compatibility we use absence of style flags as wxCHK_2STATE - // because wxCHK_2STATE used to have the value of 0 and some - // existing code uses 0 instead of it. Moreover, some code even - // uses some non-0 style, e.g. wxBORDER_XXX, but doesn't specify - // neither wxCHK_2STATE nor wxCHK_3STATE -- to avoid breaking it, - // assume (much more common) 2 state checkbox by default. - style |= wxCHK_2STATE; - } - - if ( style & wxCHK_3STATE ) - { - if ( style & wxCHK_2STATE ) - { - wxFAIL_MSG( "wxCHK_2STATE and wxCHK_3STATE can't be used " - "together" ); - style &= ~wxCHK_3STATE; - } - } - else // No wxCHK_3STATE - { - if ( style & wxCHK_ALLOW_3RD_STATE_FOR_USER ) - { - wxFAIL_MSG( "wxCHK_ALLOW_3RD_STATE_FOR_USER doesn't make sense " - "without wxCHK_3STATE" ); - style &= ~wxCHK_ALLOW_3RD_STATE_FOR_USER; - } - } - } - private: - wxDECLARE_NO_COPY_CLASS(wxCheckBoxBase); + DECLARE_NO_COPY_CLASS(wxCheckBoxBase) }; -// Most ports support 3 state checkboxes so define this by default. -#define wxHAS_3STATE_CHECKBOX - #if defined(__WXUNIVERSAL__) #include "wx/univ/checkbox.h" #elif defined(__WXMSW__) @@ -175,17 +139,18 @@ private: #elif defined(__WXGTK20__) #include "wx/gtk/checkbox.h" #elif defined(__WXGTK__) - #undef wxHAS_3STATE_CHECKBOX #include "wx/gtk1/checkbox.h" #elif defined(__WXMAC__) - #include "wx/osx/checkbox.h" + #include "wx/mac/checkbox.h" #elif defined(__WXCOCOA__) #include "wx/cocoa/checkbox.h" #elif defined(__WXPM__) - #undef wxHAS_3STATE_CHECKBOX #include "wx/os2/checkbox.h" +#elif defined(__WXPALMOS__) + #include "wx/palmos/checkbox.h" #endif #endif // wxUSE_CHECKBOX -#endif // _WX_CHECKBOX_H_BASE_ +#endif + // _WX_CHECKBOX_H_BASE_ diff --git a/Source/3rd Party/wx/include/wx/checkeddelete.h b/Source/3rd Party/wx/include/wx/checkeddelete.h deleted file mode 100644 index 084791019..000000000 --- a/Source/3rd Party/wx/include/wx/checkeddelete.h +++ /dev/null @@ -1,54 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/checkeddelete.h -// Purpose: wxCHECKED_DELETE() macro -// Author: Vadim Zeitlin -// Created: 2009-02-03 -// RCS-ID: $Id$ -// Copyright: (c) 2002-2009 wxWidgets dev team -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CHECKEDDELETE_H_ -#define _WX_CHECKEDDELETE_H_ - -// TODO: provide wxCheckedDelete[Array]() template functions too - -// ---------------------------------------------------------------------------- -// wxCHECKED_DELETE and wxCHECKED_DELETE_ARRAY macros -// ---------------------------------------------------------------------------- - -/* - checked deleters are used to make sure that the type being deleted is really - a complete type.: otherwise sizeof() would result in a compile-time error - - do { ... } while ( 0 ) construct is used to have an anonymous scope - (otherwise we could have name clashes between different "complete"s) but - still force a semicolon after the macro -*/ - -#ifdef __WATCOMC__ - #define wxFOR_ONCE(name) for(int name=0; name<1; name++) - #define wxPRE_NO_WARNING_SCOPE(name) wxFOR_ONCE(wxMAKE_UNIQUE_NAME(name)) - #define wxPOST_NO_WARNING_SCOPE(name) -#else - #define wxPRE_NO_WARNING_SCOPE(name) do - #define wxPOST_NO_WARNING_SCOPE(name) while ( wxFalse ) -#endif - -#define wxCHECKED_DELETE(ptr) \ - wxPRE_NO_WARNING_SCOPE(scope_var1) \ - { \ - typedef char complete[sizeof(*ptr)]; \ - delete ptr; \ - } wxPOST_NO_WARNING_SCOPE(scope_var1) - -#define wxCHECKED_DELETE_ARRAY(ptr) \ - wxPRE_NO_WARNING_SCOPE(scope_var2) \ - { \ - typedef char complete[sizeof(*ptr)]; \ - delete [] ptr; \ - } wxPOST_NO_WARNING_SCOPE(scope_var2) - - -#endif // _WX_CHECKEDDELETE_H_ - diff --git a/Source/3rd Party/wx/include/wx/checklst.h b/Source/3rd Party/wx/include/wx/checklst.h index 53b1ecbad..c8857fd08 100644 --- a/Source/3rd Party/wx/include/wx/checklst.h +++ b/Source/3rd Party/wx/include/wx/checklst.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 12.09.00 -// RCS-ID: $Id$ +// RCS-ID: $Id: checklst.h 38319 2006-03-23 22:05:23Z VZ $ // Copyright: (c) Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -12,8 +12,6 @@ #ifndef _WX_CHECKLST_H_BASE_ #define _WX_CHECKLST_H_BASE_ -#include "wx/defs.h" - #if wxUSE_CHECKLISTBOX #include "wx/listbox.h" @@ -22,7 +20,7 @@ // wxCheckListBox: a listbox whose items may be checked // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxCheckListBoxBase : public +class WXDLLEXPORT wxCheckListBoxBase : public #ifdef __WXWINCE__ // keep virtuals synchronised wxListBoxBase @@ -37,7 +35,7 @@ public: virtual bool IsChecked(unsigned int item) const = 0; virtual void Check(unsigned int item, bool check = true) = 0; - wxDECLARE_NO_COPY_CLASS(wxCheckListBoxBase); + DECLARE_NO_COPY_CLASS(wxCheckListBoxBase) }; #if defined(__WXUNIVERSAL__) @@ -53,7 +51,7 @@ public: #elif defined(__WXGTK__) #include "wx/gtk1/checklst.h" #elif defined(__WXMAC__) - #include "wx/osx/checklst.h" + #include "wx/mac/checklst.h" #elif defined(__WXCOCOA__) #include "wx/cocoa/checklst.h" #elif defined(__WXPM__) diff --git a/Source/3rd Party/wx/include/wx/chkconf.h b/Source/3rd Party/wx/include/wx/chkconf.h index 482593d97..811e0c304 100644 --- a/Source/3rd Party/wx/include/wx/chkconf.h +++ b/Source/3rd Party/wx/include/wx/chkconf.h @@ -4,52 +4,46 @@ * Author: Vadim Zeitlin * Modified by: * Created: 09.08.00 - * RCS-ID: $Id$ + * RCS-ID: $Id: chkconf.h 48113 2007-08-15 17:43:50Z DE $ * Copyright: (c) 2000 Vadim Zeitlin * Licence: wxWindows licence */ /* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ -#ifndef _WX_CHKCONF_H_ -#define _WX_CHKCONF_H_ /* - ************************************************** - PLEASE READ THIS IF YOU GET AN ERROR IN THIS FILE! - ************************************************** - - If you get an error saying "wxUSE_FOO must be defined", it means that you - are not using the correct up-to-date version of setup.h. This happens most - often when using svn or daily snapshots and a new symbol was added to - setup0.h and you haven't updated your local setup.h to reflect it. If - this is the case, you need to propagate the changes from setup0.h to your - setup.h and, if using makefiles under MSW, also remove setup.h under the - build directory (lib/$(COMPILER)_{lib,dll}/msw[u][d][dll]/wx) so that - the new setup.h is copied there. - - If you get an error of the form "wxFoo requires wxBar", then the settings - in your setup.h are inconsistent. You have the choice between correcting - them manually or commenting out #define wxABORT_ON_CONFIG_ERROR below to - try to correct the problems automatically (not really recommended but - might work). + Platform-specific checking. */ -/* - This file has the following sections: - 1. checks that all wxUSE_XXX symbols we use are defined - a) first the non-GUI ones - b) then the GUI-only ones - 2. platform-specific checks done in the platform headers - 3. generic consistency checks - a) first the non-GUI ones - b) then the GUI-only ones - */ +#if defined(__WXPALMOS__) +# include "wx/palmos/chkconf.h" +#elif defined(__WXWINCE__) +# include "wx/msw/wince/chkconf.h" +#elif defined(__WXMSW__) +# include "wx/msw/chkconf.h" +#elif defined(__WXMAC__) +# include "wx/mac/chkconf.h" +#elif defined(__OS2__) +# include "wx/os2/chkconf.h" +#elif defined(__WXMGL__) +# include "wx/mgl/chkconf.h" +#elif defined(__WXDFB__) +# include "wx/dfb/chkconf.h" +#elif defined(__WXMOTIF__) +# include "wx/motif/chkconf.h" +#elif defined(__WXX11__) +# include "wx/x11/chkconf.h" +#endif + +#ifdef __WXUNIVERSAL__ +# include "wx/univ/chkconf.h" +#endif /* this global setting determines what should we do if the setting FOO requires BAR and BAR is not set: we can either silently unset FOO as well (do this if you're trying to build the smallest possible library) or give an - error and abort (default as leads to least surprising behaviour) + error and abort (default as leads to least surprizing behaviour) */ #define wxABORT_ON_CONFIG_ERROR @@ -57,6 +51,16 @@ global features */ +/* GUI build by default */ +#if !defined(wxUSE_GUI) +# define wxUSE_GUI 1 +#endif /* !defined(wxUSE_GUI) */ + +/* Turn off wxUSE_ABI_INCOMPATIBLE_FEATURES if not specified. */ +#if !defined(wxUSE_ABI_INCOMPATIBLE_FEATURES) +# define wxUSE_ABI_INCOMPATIBLE_FEATURES 0 +#endif /* !defined(wxUSE_ABI_INCOMPATIBLE_FEATURES) */ + /* If we're compiling without support for threads/exceptions we have to disable the corresponding features. @@ -79,38 +83,24 @@ /* - Section 1a: tests for non GUI features. + tests for non GUI features please keep the options in alphabetical order! */ -#ifndef wxUSE_ANY -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_ANY must be defined, please read comment near the top of this file." +#ifndef wxUSE_CRASHREPORT + /* this one is special: as currently it is Windows-only, don't force it + to be defined on other platforms */ +# if defined(wxABORT_ON_CONFIG_ERROR) && defined(__WXMSW__) +# error "wxUSE_CRASHREPORT must be defined." # else -# define wxUSE_ANY 0 +# define wxUSE_CRASHREPORT 0 # endif -#endif /* wxUSE_ANY */ - -#ifndef wxUSE_COMPILER_TLS -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_COMPILER_TLS must be defined, please read comment near the top of this file." -# else -# define wxUSE_COMPILER_TLS 0 -# endif -#endif /* !defined(wxUSE_COMPILER_TLS) */ - -#ifndef wxUSE_CONSOLE_EVENTLOOP -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_CONSOLE_EVENTLOOP must be defined, please read comment near the top of this file." -# else -# define wxUSE_CONSOLE_EVENTLOOP 0 -# endif -#endif /* !defined(wxUSE_CONSOLE_EVENTLOOP) */ +#endif /* !defined(wxUSE_CRASHREPORT) */ #ifndef wxUSE_DYNLIB_CLASS # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_DYNLIB_CLASS must be defined, please read comment near the top of this file." +# error "wxUSE_DYNLIB_CLASS must be defined." # else # define wxUSE_DYNLIB_CLASS 0 # endif @@ -118,23 +108,15 @@ #ifndef wxUSE_EXCEPTIONS # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_EXCEPTIONS must be defined, please read comment near the top of this file." +# error "wxUSE_EXCEPTIONS must be defined." # else # define wxUSE_EXCEPTIONS 0 # endif #endif /* !defined(wxUSE_EXCEPTIONS) */ -#ifndef wxUSE_FILE_HISTORY -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_FILE_HISTORY must be defined, please read comment near the top of this file." -# else -# define wxUSE_FILE_HISTORY 0 -# endif -#endif /* !defined(wxUSE_FILE_HISTORY) */ - #ifndef wxUSE_FILESYSTEM # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_FILESYSTEM must be defined, please read comment near the top of this file." +# error "wxUSE_FILESYSTEM must be defined." # else # define wxUSE_FILESYSTEM 0 # endif @@ -142,55 +124,28 @@ #ifndef wxUSE_FS_ARCHIVE # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_FS_ARCHIVE must be defined, please read comment near the top of this file." +# error "wxUSE_FS_ARCHIVE must be defined." # else # define wxUSE_FS_ARCHIVE 0 # endif #endif /* !defined(wxUSE_FS_ARCHIVE) */ +/* don't give an error about this one yet, it's not fully implemented */ #ifndef wxUSE_FSVOLUME -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_FSVOLUME must be defined, please read comment near the top of this file." -# else -# define wxUSE_FSVOLUME 0 -# endif +# define wxUSE_FSVOLUME 0 #endif /* !defined(wxUSE_FSVOLUME) */ -#ifndef wxUSE_FSWATCHER -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_FSWATCHER must be defined, please read comment near the top of this file." -# else -# define wxUSE_FSWATCHER 0 -# endif -#endif /* !defined(wxUSE_FSWATCHER) */ - #ifndef wxUSE_DYNAMIC_LOADER # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_DYNAMIC_LOADER must be defined, please read comment near the top of this file." +# error "wxUSE_DYNAMIC_LOADER must be defined." # else # define wxUSE_DYNAMIC_LOADER 0 # endif #endif /* !defined(wxUSE_DYNAMIC_LOADER) */ -#ifndef wxUSE_INTL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_INTL must be defined, please read comment near the top of this file." -# else -# define wxUSE_INTL 0 -# endif -#endif /* !defined(wxUSE_INTL) */ - -#ifndef wxUSE_IPV6 -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_IPV6 must be defined, please read comment near the top of this file." -# else -# define wxUSE_IPV6 0 -# endif -#endif /* !defined(wxUSE_IPV6) */ - #ifndef wxUSE_LOG # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_LOG must be defined, please read comment near the top of this file." +# error "wxUSE_LOG must be defined." # else # define wxUSE_LOG 0 # endif @@ -198,7 +153,7 @@ #ifndef wxUSE_LONGLONG # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_LONGLONG must be defined, please read comment near the top of this file." +# error "wxUSE_LONGLONG must be defined." # else # define wxUSE_LONGLONG 0 # endif @@ -206,7 +161,7 @@ #ifndef wxUSE_MIMETYPE # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_MIMETYPE must be defined, please read comment near the top of this file." +# error "wxUSE_MIMETYPE must be defined." # else # define wxUSE_MIMETYPE 0 # endif @@ -214,7 +169,7 @@ #ifndef wxUSE_ON_FATAL_EXCEPTION # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_ON_FATAL_EXCEPTION must be defined, please read comment near the top of this file." +# error "wxUSE_ON_FATAL_EXCEPTION must be defined." # else # define wxUSE_ON_FATAL_EXCEPTION 0 # endif @@ -222,7 +177,7 @@ #ifndef wxUSE_PRINTF_POS_PARAMS # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_PRINTF_POS_PARAMS must be defined, please read comment near the top of this file." +# error "wxUSE_PRINTF_POS_PARAMS must be defined." # else # define wxUSE_PRINTF_POS_PARAMS 0 # endif @@ -230,7 +185,7 @@ #ifndef wxUSE_PROTOCOL # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_PROTOCOL must be defined, please read comment near the top of this file." +# error "wxUSE_PROTOCOL must be defined." # else # define wxUSE_PROTOCOL 0 # endif @@ -248,7 +203,7 @@ #ifndef wxUSE_PROTOCOL_HTTP # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_PROTOCOL_HTTP must be defined, please read comment near the top of this file." +# error "wxUSE_PROTOCOL_HTTP must be defined." # else # define wxUSE_PROTOCOL_HTTP 0 # endif @@ -256,7 +211,7 @@ #ifndef wxUSE_PROTOCOL_FTP # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_PROTOCOL_FTP must be defined, please read comment near the top of this file." +# error "wxUSE_PROTOCOL_FTP must be defined." # else # define wxUSE_PROTOCOL_FTP 0 # endif @@ -264,7 +219,7 @@ #ifndef wxUSE_PROTOCOL_FILE # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_PROTOCOL_FILE must be defined, please read comment near the top of this file." +# error "wxUSE_PROTOCOL_FILE must be defined." # else # define wxUSE_PROTOCOL_FILE 0 # endif @@ -272,7 +227,7 @@ #ifndef wxUSE_REGEX # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_REGEX must be defined, please read comment near the top of this file." +# error "wxUSE_REGEX must be defined." # else # define wxUSE_REGEX 0 # endif @@ -280,7 +235,7 @@ #ifndef wxUSE_STDPATHS # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_STDPATHS must be defined, please read comment near the top of this file." +# error "wxUSE_STDPATHS must be defined." # else # define wxUSE_STDPATHS 1 # endif @@ -288,7 +243,7 @@ #ifndef wxUSE_XML # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_XML must be defined, please read comment near the top of this file." +# error "wxUSE_XML must be defined." # else # define wxUSE_XML 0 # endif @@ -296,31 +251,15 @@ #ifndef wxUSE_SOCKETS # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_SOCKETS must be defined, please read comment near the top of this file." +# error "wxUSE_SOCKETS must be defined." # else # define wxUSE_SOCKETS 0 # endif #endif /* !defined(wxUSE_SOCKETS) */ -#ifndef wxUSE_STD_CONTAINERS -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_STD_CONTAINERS must be defined, please read comment near the top of this file." -# else -# define wxUSE_STD_CONTAINERS 0 -# endif -#endif /* !defined(wxUSE_STD_CONTAINERS) */ - -#ifndef wxUSE_STD_STRING_CONV_IN_WXSTRING -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_STD_STRING_CONV_IN_WXSTRING must be defined, please read comment near the top of this file." -# else -# define wxUSE_STD_STRING_CONV_IN_WXSTRING 0 -# endif -#endif /* !defined(wxUSE_STD_STRING_CONV_IN_WXSTRING) */ - #ifndef wxUSE_STREAMS # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_STREAMS must be defined, please read comment near the top of this file." +# error "wxUSE_STREAMS must be defined." # else # define wxUSE_STREAMS 0 # endif @@ -328,7 +267,7 @@ #ifndef wxUSE_STOPWATCH # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_STOPWATCH must be defined, please read comment near the top of this file." +# error "wxUSE_STOPWATCH must be defined." # else # define wxUSE_STOPWATCH 0 # endif @@ -336,7 +275,7 @@ #ifndef wxUSE_TEXTBUFFER # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_TEXTBUFFER must be defined, please read comment near the top of this file." +# error "wxUSE_TEXTBUFFER must be defined." # else # define wxUSE_TEXTBUFFER 0 # endif @@ -344,7 +283,7 @@ #ifndef wxUSE_TEXTFILE # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_TEXTFILE must be defined, please read comment near the top of this file." +# error "wxUSE_TEXTFILE must be defined." # else # define wxUSE_TEXTFILE 0 # endif @@ -352,7 +291,7 @@ #ifndef wxUSE_UNICODE # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_UNICODE must be defined, please read comment near the top of this file." +# error "wxUSE_UNICODE must be defined." # else # define wxUSE_UNICODE 0 # endif @@ -360,7 +299,7 @@ #ifndef wxUSE_URL # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_URL must be defined, please read comment near the top of this file." +# error "wxUSE_URL must be defined." # else # define wxUSE_URL 0 # endif @@ -368,22 +307,14 @@ #ifndef wxUSE_VARIANT # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_VARIANT must be defined, please read comment near the top of this file." +# error "wxUSE_VARIANT must be defined." # else # define wxUSE_VARIANT 0 # endif #endif /* wxUSE_VARIANT */ -#ifndef wxUSE_XLOCALE -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_XLOCALE must be defined, please read comment near the top of this file." -# else -# define wxUSE_XLOCALE 0 -# endif -#endif /* !defined(wxUSE_XLOCALE) */ - /* - Section 1b: all these tests are for GUI only. + all these tests are for GUI only please keep the options in alphabetical order! */ @@ -396,7 +327,7 @@ #ifndef wxUSE_ABOUTDLG # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_ABOUTDLG must be defined, please read comment near the top of this file." +# error "wxUSE_ABOUTDLG must be defined." # else # define wxUSE_ABOUTDLG 0 # endif @@ -404,55 +335,23 @@ #ifndef wxUSE_ACCEL # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_ACCEL must be defined, please read comment near the top of this file." +# error "wxUSE_ACCEL must be defined." # else # define wxUSE_ACCEL 0 # endif #endif /* !defined(wxUSE_ACCEL) */ -#ifndef wxUSE_ACCESSIBILITY -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_ACCESSIBILITY must be defined, please read comment near the top of this file." -# else -# define wxUSE_ACCESSIBILITY 0 -# endif -#endif /* !defined(wxUSE_ACCESSIBILITY) */ - #ifndef wxUSE_ANIMATIONCTRL # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_ANIMATIONCTRL must be defined, please read comment near the top of this file." +# error "wxUSE_ANIMATIONCTRL must be defined." # else # define wxUSE_ANIMATIONCTRL 0 # endif #endif /* !defined(wxUSE_ANIMATIONCTRL) */ -#ifndef wxUSE_ARTPROVIDER_STD -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_ARTPROVIDER_STD must be defined, please read comment near the top of this file." -# else -# define wxUSE_ARTPROVIDER_STD 0 -# endif -#endif /* !defined(wxUSE_ARTPROVIDER_STD) */ - -#ifndef wxUSE_ARTPROVIDER_TANGO -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_ARTPROVIDER_TANGO must be defined, please read comment near the top of this file." -# else -# define wxUSE_ARTPROVIDER_TANGO 0 -# endif -#endif /* !defined(wxUSE_ARTPROVIDER_TANGO) */ - -#ifndef wxUSE_AUTOID_MANAGEMENT -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_AUTOID_MANAGEMENT must be defined, please read comment near the top of this file." -# else -# define wxUSE_AUTOID_MANAGEMENT 0 -# endif -#endif /* !defined(wxUSE_AUTOID_MANAGEMENT) */ - #ifndef wxUSE_BITMAPCOMBOBOX # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_BITMAPCOMBOBOX must be defined, please read comment near the top of this file." +# error "wxUSE_BITMAPCOMBOBOX must be defined." # else # define wxUSE_BITMAPCOMBOBOX 0 # endif @@ -460,7 +359,7 @@ #ifndef wxUSE_BMPBUTTON # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_BMPBUTTON must be defined, please read comment near the top of this file." +# error "wxUSE_BMPBUTTON must be defined." # else # define wxUSE_BMPBUTTON 0 # endif @@ -468,23 +367,15 @@ #ifndef wxUSE_BUTTON # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_BUTTON must be defined, please read comment near the top of this file." +# error "wxUSE_BUTTON must be defined." # else # define wxUSE_BUTTON 0 # endif #endif /* !defined(wxUSE_BUTTON) */ -#ifndef wxUSE_CAIRO -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_CAIRO must be defined, please read comment near the top of this file." -# else -# define wxUSE_CAIRO 0 -# endif -#endif /* !defined(wxUSE_CAIRO) */ - #ifndef wxUSE_CALENDARCTRL # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_CALENDARCTRL must be defined, please read comment near the top of this file." +# error "wxUSE_CALENDARCTRL must be defined." # else # define wxUSE_CALENDARCTRL 0 # endif @@ -492,7 +383,7 @@ #ifndef wxUSE_CARET # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_CARET must be defined, please read comment near the top of this file." +# error "wxUSE_CARET must be defined." # else # define wxUSE_CARET 0 # endif @@ -500,7 +391,7 @@ #ifndef wxUSE_CHECKBOX # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_CHECKBOX must be defined, please read comment near the top of this file." +# error "wxUSE_CHECKBOX must be defined." # else # define wxUSE_CHECKBOX 0 # endif @@ -508,7 +399,7 @@ #ifndef wxUSE_CHECKLISTBOX # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_CHECKLISTBOX must be defined, please read comment near the top of this file." +# error "wxUSE_CHECKLISTBOX must be defined." # else # define wxUSE_CHECKLISTBOX 0 # endif @@ -516,7 +407,7 @@ #ifndef wxUSE_CHOICE # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_CHOICE must be defined, please read comment near the top of this file." +# error "wxUSE_CHOICE must be defined." # else # define wxUSE_CHOICE 0 # endif @@ -524,7 +415,7 @@ #ifndef wxUSE_CHOICEBOOK # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_CHOICEBOOK must be defined, please read comment near the top of this file." +# error "wxUSE_CHOICEBOOK must be defined." # else # define wxUSE_CHOICEBOOK 0 # endif @@ -532,7 +423,7 @@ #ifndef wxUSE_CHOICEDLG # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_CHOICEDLG must be defined, please read comment near the top of this file." +# error "wxUSE_CHOICEDLG must be defined." # else # define wxUSE_CHOICEDLG 0 # endif @@ -540,7 +431,7 @@ #ifndef wxUSE_CLIPBOARD # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_CLIPBOARD must be defined, please read comment near the top of this file." +# error "wxUSE_CLIPBOARD must be defined." # else # define wxUSE_CLIPBOARD 0 # endif @@ -548,7 +439,7 @@ #ifndef wxUSE_COLLPANE # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_COLLPANE must be defined, please read comment near the top of this file." +# error "wxUSE_COLLPANE must be defined." # else # define wxUSE_COLLPANE 0 # endif @@ -556,7 +447,7 @@ #ifndef wxUSE_COLOURDLG # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_COLOURDLG must be defined, please read comment near the top of this file." +# error "wxUSE_COLOURDLG must be defined." # else # define wxUSE_COLOURDLG 0 # endif @@ -564,7 +455,7 @@ #ifndef wxUSE_COLOURPICKERCTRL # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_COLOURPICKERCTRL must be defined, please read comment near the top of this file." +# error "wxUSE_COLOURPICKERCTRL must be defined." # else # define wxUSE_COLOURPICKERCTRL 0 # endif @@ -572,23 +463,15 @@ #ifndef wxUSE_COMBOBOX # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_COMBOBOX must be defined, please read comment near the top of this file." +# error "wxUSE_COMBOBOX must be defined." # else # define wxUSE_COMBOBOX 0 # endif #endif /* !defined(wxUSE_COMBOBOX) */ -#ifndef wxUSE_COMMANDLINKBUTTON -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_COMMANDLINKBUTTON must be defined, please read comment near the top of this file." -# else -# define wxUSE_COMMANDLINKBUTTON 0 -# endif -#endif /* !defined(wxUSE_COMMANDLINKBUTTON) */ - #ifndef wxUSE_COMBOCTRL # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_COMBOCTRL must be defined, please read comment near the top of this file." +# error "wxUSE_COMBOCTRL must be defined." # else # define wxUSE_COMBOCTRL 0 # endif @@ -596,7 +479,7 @@ #ifndef wxUSE_DATAOBJ # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_DATAOBJ must be defined, please read comment near the top of this file." +# error "wxUSE_DATAOBJ must be defined." # else # define wxUSE_DATAOBJ 0 # endif @@ -604,7 +487,7 @@ #ifndef wxUSE_DATAVIEWCTRL # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_DATAVIEWCTRL must be defined, please read comment near the top of this file." +# error "wxUSE_DATAVIEWCTRL must be defined." # else # define wxUSE_DATAVIEWCTRL 0 # endif @@ -612,23 +495,15 @@ #ifndef wxUSE_DATEPICKCTRL # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_DATEPICKCTRL must be defined, please read comment near the top of this file." +# error "wxUSE_DATEPICKCTRL must be defined." # else # define wxUSE_DATEPICKCTRL 0 # endif #endif /* !defined(wxUSE_DATEPICKCTRL) */ -#ifndef wxUSE_DC_TRANSFORM_MATRIX -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_DC_TRANSFORM_MATRIX must be defined, please read comment near the top of this file." -# else -# define wxUSE_DC_TRANSFORM_MATRIX 1 -# endif -#endif /* wxUSE_DC_TRANSFORM_MATRIX */ - #ifndef wxUSE_DIRPICKERCTRL # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_DIRPICKERCTRL must be defined, please read comment near the top of this file." +# error "wxUSE_DIRPICKERCTRL must be defined." # else # define wxUSE_DIRPICKERCTRL 0 # endif @@ -636,7 +511,7 @@ #ifndef wxUSE_DISPLAY # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_DISPLAY must be defined, please read comment near the top of this file." +# error "wxUSE_DISPLAY must be defined." # else # define wxUSE_DISPLAY 0 # endif @@ -644,23 +519,15 @@ #ifndef wxUSE_DOC_VIEW_ARCHITECTURE # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_DOC_VIEW_ARCHITECTURE must be defined, please read comment near the top of this file." +# error "wxUSE_DOC_VIEW_ARCHITECTURE must be defined." # else # define wxUSE_DOC_VIEW_ARCHITECTURE 0 # endif #endif /* !defined(wxUSE_DOC_VIEW_ARCHITECTURE) */ -#ifndef wxUSE_FILECTRL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_FILECTRL must be defined, please read comment near the top of this file." -# else -# define wxUSE_FILECTRL 0 -# endif -#endif /* !defined(wxUSE_FILECTRL) */ - #ifndef wxUSE_FILEDLG # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_FILEDLG must be defined, please read comment near the top of this file." +# error "wxUSE_FILEDLG must be defined." # else # define wxUSE_FILEDLG 0 # endif @@ -668,7 +535,7 @@ #ifndef wxUSE_FILEPICKERCTRL # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_FILEPICKERCTRL must be defined, please read comment near the top of this file." +# error "wxUSE_FILEPICKERCTRL must be defined." # else # define wxUSE_FILEPICKERCTRL 0 # endif @@ -676,7 +543,7 @@ #ifndef wxUSE_FONTDLG # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_FONTDLG must be defined, please read comment near the top of this file." +# error "wxUSE_FONTDLG must be defined." # else # define wxUSE_FONTDLG 0 # endif @@ -684,7 +551,7 @@ #ifndef wxUSE_FONTMAP # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_FONTMAP must be defined, please read comment near the top of this file." +# error "wxUSE_FONTMAP must be defined." # else # define wxUSE_FONTMAP 0 # endif @@ -692,7 +559,7 @@ #ifndef wxUSE_FONTPICKERCTRL # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_FONTPICKERCTRL must be defined, please read comment near the top of this file." +# error "wxUSE_FONTPICKERCTRL must be defined." # else # define wxUSE_FONTPICKERCTRL 0 # endif @@ -700,7 +567,7 @@ #ifndef wxUSE_GAUGE # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_GAUGE must be defined, please read comment near the top of this file." +# error "wxUSE_GAUGE must be defined." # else # define wxUSE_GAUGE 0 # endif @@ -708,7 +575,7 @@ #ifndef wxUSE_GRAPHICS_CONTEXT # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_GRAPHICS_CONTEXT must be defined, please read comment near the top of this file." +# error "wxUSE_GRAPHICS_CONTEXT must be defined." # else # define wxUSE_GRAPHICS_CONTEXT 0 # endif @@ -717,23 +584,15 @@ #ifndef wxUSE_GRID # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_GRID must be defined, please read comment near the top of this file." +# error "wxUSE_GRID must be defined." # else # define wxUSE_GRID 0 # endif #endif /* !defined(wxUSE_GRID) */ -#ifndef wxUSE_HEADERCTRL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_HEADERCTRL must be defined, please read comment near the top of this file." -# else -# define wxUSE_HEADERCTRL 0 -# endif -#endif /* !defined(wxUSE_HEADERCTRL) */ - #ifndef wxUSE_HELP # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_HELP must be defined, please read comment near the top of this file." +# error "wxUSE_HELP must be defined." # else # define wxUSE_HELP 0 # endif @@ -741,7 +600,7 @@ #ifndef wxUSE_HYPERLINKCTRL # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_HYPERLINKCTRL must be defined, please read comment near the top of this file." +# error "wxUSE_HYPERLINKCTRL must be defined." # else # define wxUSE_HYPERLINKCTRL 0 # endif @@ -749,19 +608,19 @@ #ifndef wxUSE_HTML # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_HTML must be defined, please read comment near the top of this file." +# error "wxUSE_HTML must be defined." # else # define wxUSE_HTML 0 # endif #endif /* !defined(wxUSE_HTML) */ #ifndef wxUSE_LIBMSPACK -# if !defined(__UNIX__) +# ifndef __UNIX__ /* set to 0 on platforms that don't have libmspack */ # define wxUSE_LIBMSPACK 0 # else # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_LIBMSPACK must be defined, please read comment near the top of this file." +# error "wxUSE_LIBMSPACK must be defined." # else # define wxUSE_LIBMSPACK 0 # endif @@ -770,7 +629,7 @@ #ifndef wxUSE_ICO_CUR # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_ICO_CUR must be defined, please read comment near the top of this file." +# error "wxUSE_ICO_CUR must be defined." # else # define wxUSE_ICO_CUR 0 # endif @@ -778,7 +637,7 @@ #ifndef wxUSE_IFF # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_IFF must be defined, please read comment near the top of this file." +# error "wxUSE_IFF must be defined." # else # define wxUSE_IFF 0 # endif @@ -786,23 +645,15 @@ #ifndef wxUSE_IMAGLIST # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_IMAGLIST must be defined, please read comment near the top of this file." +# error "wxUSE_IMAGLIST must be defined." # else # define wxUSE_IMAGLIST 0 # endif #endif /* !defined(wxUSE_IMAGLIST) */ -#ifndef wxUSE_INFOBAR -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_INFOBAR must be defined, please read comment near the top of this file." -# else -# define wxUSE_INFOBAR 0 -# endif -#endif /* !defined(wxUSE_INFOBAR) */ - #ifndef wxUSE_JOYSTICK # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_JOYSTICK must be defined, please read comment near the top of this file." +# error "wxUSE_JOYSTICK must be defined." # else # define wxUSE_JOYSTICK 0 # endif @@ -810,7 +661,7 @@ #ifndef wxUSE_LISTBOOK # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_LISTBOOK must be defined, please read comment near the top of this file." +# error "wxUSE_LISTBOOK must be defined." # else # define wxUSE_LISTBOOK 0 # endif @@ -818,7 +669,7 @@ #ifndef wxUSE_LISTBOX # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_LISTBOX must be defined, please read comment near the top of this file." +# error "wxUSE_LISTBOX must be defined." # else # define wxUSE_LISTBOX 0 # endif @@ -826,7 +677,7 @@ #ifndef wxUSE_LISTCTRL # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_LISTCTRL must be defined, please read comment near the top of this file." +# error "wxUSE_LISTCTRL must be defined." # else # define wxUSE_LISTCTRL 0 # endif @@ -834,7 +685,7 @@ #ifndef wxUSE_LOGGUI # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_LOGGUI must be defined, please read comment near the top of this file." +# error "wxUSE_LOGGUI must be defined." # else # define wxUSE_LOGGUI 0 # endif @@ -842,7 +693,7 @@ #ifndef wxUSE_LOGWINDOW # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_LOGWINDOW must be defined, please read comment near the top of this file." +# error "wxUSE_LOGWINDOW must be defined." # else # define wxUSE_LOGWINDOW 0 # endif @@ -850,23 +701,15 @@ #ifndef wxUSE_LOG_DIALOG # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_LOG_DIALOG must be defined, please read comment near the top of this file." +# error "wxUSE_LOG_DIALOG must be defined." # else # define wxUSE_LOG_DIALOG 0 # endif #endif /* !defined(wxUSE_LOG_DIALOG) */ -#ifndef wxUSE_MARKUP -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_MARKUP must be defined, please read comment near the top of this file." -# else -# define wxUSE_MARKUP 0 -# endif -#endif /* !defined(wxUSE_MARKUP) */ - #ifndef wxUSE_MDI # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_MDI must be defined, please read comment near the top of this file." +# error "wxUSE_MDI must be defined." # else # define wxUSE_MDI 0 # endif @@ -874,7 +717,7 @@ #ifndef wxUSE_MDI_ARCHITECTURE # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_MDI_ARCHITECTURE must be defined, please read comment near the top of this file." +# error "wxUSE_MDI_ARCHITECTURE must be defined." # else # define wxUSE_MDI_ARCHITECTURE 0 # endif @@ -882,7 +725,7 @@ #ifndef wxUSE_MENUS # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_MENUS must be defined, please read comment near the top of this file." +# error "wxUSE_MENUS must be defined." # else # define wxUSE_MENUS 0 # endif @@ -890,7 +733,7 @@ #ifndef wxUSE_MSGDLG # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_MSGDLG must be defined, please read comment near the top of this file." +# error "wxUSE_MSGDLG must be defined." # else # define wxUSE_MSGDLG 0 # endif @@ -898,23 +741,15 @@ #ifndef wxUSE_NOTEBOOK # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_NOTEBOOK must be defined, please read comment near the top of this file." +# error "wxUSE_NOTEBOOK must be defined." # else # define wxUSE_NOTEBOOK 0 # endif #endif /* !defined(wxUSE_NOTEBOOK) */ -#ifndef wxUSE_NOTIFICATION_MESSAGE -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_NOTIFICATION_MESSAGE must be defined, please read comment near the top of this file." -# else -# define wxUSE_NOTIFICATION_MESSAGE 0 -# endif -#endif /* !defined(wxUSE_NOTIFICATION_MESSAGE) */ - #ifndef wxUSE_ODCOMBOBOX # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_ODCOMBOBOX must be defined, please read comment near the top of this file." +# error "wxUSE_ODCOMBOBOX must be defined." # else # define wxUSE_ODCOMBOBOX 0 # endif @@ -922,7 +757,7 @@ #ifndef wxUSE_PALETTE # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_PALETTE must be defined, please read comment near the top of this file." +# error "wxUSE_PALETTE must be defined." # else # define wxUSE_PALETTE 0 # endif @@ -930,7 +765,7 @@ #ifndef wxUSE_POPUPWIN # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_POPUPWIN must be defined, please read comment near the top of this file." +# error "wxUSE_POPUPWIN must be defined." # else # define wxUSE_POPUPWIN 0 # endif @@ -938,7 +773,7 @@ #ifndef wxUSE_PRINTING_ARCHITECTURE # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_PRINTING_ARCHITECTURE must be defined, please read comment near the top of this file." +# error "wxUSE_PRINTING_ARCHITECTURE must be defined." # else # define wxUSE_PRINTING_ARCHITECTURE 0 # endif @@ -946,7 +781,7 @@ #ifndef wxUSE_RADIOBOX # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_RADIOBOX must be defined, please read comment near the top of this file." +# error "wxUSE_RADIOBOX must be defined." # else # define wxUSE_RADIOBOX 0 # endif @@ -954,47 +789,15 @@ #ifndef wxUSE_RADIOBTN # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_RADIOBTN must be defined, please read comment near the top of this file." +# error "wxUSE_RADIOBTN must be defined." # else # define wxUSE_RADIOBTN 0 # endif #endif /* !defined(wxUSE_RADIOBTN) */ -#ifndef wxUSE_REARRANGECTRL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_REARRANGECTRL must be defined, please read comment near the top of this file." -# else -# define wxUSE_REARRANGECTRL 0 -# endif -#endif /* !defined(wxUSE_REARRANGECTRL) */ - -#ifndef wxUSE_RIBBON -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_RIBBON must be defined, please read comment near the top of this file." -# else -# define wxUSE_RIBBON 0 -# endif -#endif /* !defined(wxUSE_RIBBON) */ - -#ifndef wxUSE_RICHMSGDLG -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_RICHMSGDLG must be defined, please read comment near the top of this file." -# else -# define wxUSE_RICHMSGDLG 0 -# endif -#endif /* !defined(wxUSE_RICHMSGDLG) */ - -#ifndef wxUSE_RICHTOOLTIP -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_RICHTOOLTIP must be defined, please read comment near the top of this file." -# else -# define wxUSE_RICHTOOLTIP 0 -# endif -#endif /* !defined(wxUSE_RICHTOOLTIP) */ - #ifndef wxUSE_SASH # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_SASH must be defined, please read comment near the top of this file." +# error "wxUSE_SASH must be defined." # else # define wxUSE_SASH 0 # endif @@ -1002,7 +805,7 @@ #ifndef wxUSE_SCROLLBAR # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_SCROLLBAR must be defined, please read comment near the top of this file." +# error "wxUSE_SCROLLBAR must be defined." # else # define wxUSE_SCROLLBAR 0 # endif @@ -1010,7 +813,7 @@ #ifndef wxUSE_SLIDER # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_SLIDER must be defined, please read comment near the top of this file." +# error "wxUSE_SLIDER must be defined." # else # define wxUSE_SLIDER 0 # endif @@ -1018,7 +821,7 @@ #ifndef wxUSE_SOUND # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_SOUND must be defined, please read comment near the top of this file." +# error "wxUSE_SOUND must be defined." # else # define wxUSE_SOUND 0 # endif @@ -1026,7 +829,7 @@ #ifndef wxUSE_SPINBTN # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_SPINBTN must be defined, please read comment near the top of this file." +# error "wxUSE_SPINBTN must be defined." # else # define wxUSE_SPINBTN 0 # endif @@ -1034,7 +837,7 @@ #ifndef wxUSE_SPINCTRL # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_SPINCTRL must be defined, please read comment near the top of this file." +# error "wxUSE_SPINCTRL must be defined." # else # define wxUSE_SPINCTRL 0 # endif @@ -1042,7 +845,7 @@ #ifndef wxUSE_SPLASH # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_SPLASH must be defined, please read comment near the top of this file." +# error "wxUSE_SPLASH must be defined." # else # define wxUSE_SPLASH 0 # endif @@ -1050,7 +853,7 @@ #ifndef wxUSE_SPLITTER # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_SPLITTER must be defined, please read comment near the top of this file." +# error "wxUSE_SPLITTER must be defined." # else # define wxUSE_SPLITTER 0 # endif @@ -1058,7 +861,7 @@ #ifndef wxUSE_STATBMP # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_STATBMP must be defined, please read comment near the top of this file." +# error "wxUSE_STATBMP must be defined." # else # define wxUSE_STATBMP 0 # endif @@ -1066,7 +869,7 @@ #ifndef wxUSE_STATBOX # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_STATBOX must be defined, please read comment near the top of this file." +# error "wxUSE_STATBOX must be defined." # else # define wxUSE_STATBOX 0 # endif @@ -1074,7 +877,7 @@ #ifndef wxUSE_STATLINE # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_STATLINE must be defined, please read comment near the top of this file." +# error "wxUSE_STATLINE must be defined." # else # define wxUSE_STATLINE 0 # endif @@ -1082,7 +885,7 @@ #ifndef wxUSE_STATTEXT # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_STATTEXT must be defined, please read comment near the top of this file." +# error "wxUSE_STATTEXT must be defined." # else # define wxUSE_STATTEXT 0 # endif @@ -1090,39 +893,31 @@ #ifndef wxUSE_STATUSBAR # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_STATUSBAR must be defined, please read comment near the top of this file." +# error "wxUSE_STATUSBAR must be defined." # else # define wxUSE_STATUSBAR 0 # endif #endif /* !defined(wxUSE_STATUSBAR) */ -#ifndef wxUSE_TASKBARICON +#ifndef wxUSE_TAB_DIALOG # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_TASKBARICON must be defined, please read comment near the top of this file." +# error "wxUSE_TAB_DIALOG must be defined." # else -# define wxUSE_TASKBARICON 0 +# define wxUSE_TAB_DIALOG 0 # endif -#endif /* !defined(wxUSE_TASKBARICON) */ +#endif /* !defined(wxUSE_TAB_DIALOG) */ #ifndef wxUSE_TEXTCTRL # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_TEXTCTRL must be defined, please read comment near the top of this file." +# error "wxUSE_TEXTCTRL must be defined." # else # define wxUSE_TEXTCTRL 0 # endif #endif /* !defined(wxUSE_TEXTCTRL) */ -#ifndef wxUSE_TIMEPICKCTRL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_TIMEPICKCTRL must be defined, please read comment near the top of this file." -# else -# define wxUSE_TIMEPICKCTRL 0 -# endif -#endif /* !defined(wxUSE_TIMEPICKCTRL) */ - #ifndef wxUSE_TIPWINDOW # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_TIPWINDOW must be defined, please read comment near the top of this file." +# error "wxUSE_TIPWINDOW must be defined." # else # define wxUSE_TIPWINDOW 0 # endif @@ -1130,7 +925,7 @@ #ifndef wxUSE_TOOLBAR # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_TOOLBAR must be defined, please read comment near the top of this file." +# error "wxUSE_TOOLBAR must be defined." # else # define wxUSE_TOOLBAR 0 # endif @@ -1138,7 +933,7 @@ #ifndef wxUSE_TOOLTIPS # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_TOOLTIPS must be defined, please read comment near the top of this file." +# error "wxUSE_TOOLTIPS must be defined." # else # define wxUSE_TOOLTIPS 0 # endif @@ -1146,47 +941,23 @@ #ifndef wxUSE_TREECTRL # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_TREECTRL must be defined, please read comment near the top of this file." +# error "wxUSE_TREECTRL must be defined." # else # define wxUSE_TREECTRL 0 # endif #endif /* !defined(wxUSE_TREECTRL) */ -#ifndef wxUSE_TREELISTCTRL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_TREELISTCTRL must be defined, please read comment near the top of this file." -# else -# define wxUSE_TREELISTCTRL 0 -# endif -#endif /* !defined(wxUSE_TREELISTCTRL) */ - -#ifndef wxUSE_UIACTIONSIMULATOR -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_UIACTIONSIMULATOR must be defined, please read comment near the top of this file." -# else -# define wxUSE_UIACTIONSIMULATOR 0 -# endif -#endif /* !defined(wxUSE_UIACTIONSIMULATOR) */ - #ifndef wxUSE_VALIDATORS # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_VALIDATORS must be defined, please read comment near the top of this file." +# error "wxUSE_VALIDATORS must be defined." # else # define wxUSE_VALIDATORS 0 # endif #endif /* !defined(wxUSE_VALIDATORS) */ -#ifndef wxUSE_WEBVIEW -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_WEBVIEW must be defined, please read comment near the top of this file." -# else -# define wxUSE_WEBVIEW 0 -# endif -#endif /* !defined(wxUSE_WEBVIEW) */ - #ifndef wxUSE_WXHTML_HELP # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_WXHTML_HELP must be defined, please read comment near the top of this file." +# error "wxUSE_WXHTML_HELP must be defined." # else # define wxUSE_WXHTML_HELP 0 # endif @@ -1194,7 +965,7 @@ #ifndef wxUSE_XRC # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_XRC must be defined, please read comment near the top of this file." +# error "wxUSE_XRC must be defined." # else # define wxUSE_XRC 0 # endif @@ -1203,60 +974,19 @@ #endif /* wxUSE_GUI */ /* - Section 2: platform-specific checks. - - This must be done after checking that everything is defined as the platform - checks use wxUSE_XXX symbols in #if tests. + check consistency of the settings */ -#if defined(__WXWINCE__) -# include "wx/msw/wince/chkconf.h" -#elif defined(__WXMSW__) -# include "wx/msw/chkconf.h" -#elif defined(__WXGTK__) -# include "wx/gtk/chkconf.h" -#elif defined(__WXCOCOA__) -# include "wx/cocoa/chkconf.h" -#elif defined(__WXMAC__) -# include "wx/osx/chkconf.h" -#elif defined(__OS2__) -# include "wx/os2/chkconf.h" -#elif defined(__WXDFB__) -# include "wx/dfb/chkconf.h" -#elif defined(__WXMOTIF__) -# include "wx/motif/chkconf.h" -#elif defined(__WXX11__) -# include "wx/x11/chkconf.h" -#elif defined(__WXANDROID__) -# include "wx/android/chkconf.h" -#endif - -/* - __UNIX__ is also defined under Cygwin but we shouldn't perform these checks - there if we're building wxMSW. - */ -#if defined(__UNIX__) && !defined(__WXMSW__) -# include "wx/unix/chkconf.h" -#endif - -#ifdef __WXUNIVERSAL__ -# include "wx/univ/chkconf.h" -#endif - -/* - Section 3a: check consistency of the non-GUI settings. - */ - -#if WXWIN_COMPATIBILITY_2_6 -# if !WXWIN_COMPATIBILITY_2_8 +#if WXWIN_COMPATIBILITY_2_4 +# if !WXWIN_COMPATIBILITY_2_6 # ifdef wxABORT_ON_CONFIG_ERROR -# error "2.6.X compatibility requires 2.8.X compatibility" +# error "2.4.X compatibility requires 2.6.X compatibility" # else -# undef WXWIN_COMPATIBILITY_2_8 -# define WXWIN_COMPATIBILITY_2_8 1 +# undef WXWIN_COMPATIBILITY_2_6 +# define WXWIN_COMPATIBILITY_2_6 1 # endif # endif -#endif /* WXWIN_COMPATIBILITY_2_6 */ +#endif /* WXWIN_COMPATIBILITY_2_4 */ #if wxUSE_ARCHIVE_STREAMS # if !wxUSE_DATETIME @@ -1269,6 +999,15 @@ # endif #endif /* wxUSE_ARCHIVE_STREAMS */ +#if wxUSE_CRASHREPORT && !wxUSE_ON_FATAL_EXCEPTION +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_CRASHREPORT requires wxUSE_ON_FATAL_EXCEPTION" +# else +# undef wxUSE_CRASHREPORT +# define wxUSE_CRASHREPORT 0 +# endif +#endif /* wxUSE_CRASHREPORT */ + #if wxUSE_PROTOCOL_FILE || wxUSE_PROTOCOL_FTP || wxUSE_PROTOCOL_HTTP # if !wxUSE_PROTOCOL # ifdef wxABORT_ON_CONFIG_ERROR @@ -1396,6 +1135,17 @@ # endif #endif /* wxUSE_MIMETYPE */ +#if wxUSE_ODBC +# if !wxUSE_DATETIME +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxODBC requires wxUSE_DATETIME" +# else +# undef wxUSE_ODBC +# define wxUSE_ODBC 0 +# endif +# endif +#endif /* wxUSE_ODBC */ + #if wxUSE_TEXTFILE && !wxUSE_TEXTBUFFER # ifdef wxABORT_ON_CONFIG_ERROR # error "wxUSE_TEXTFILE requires wxUSE_TEXTBUFFER" @@ -1414,6 +1164,15 @@ # endif #endif /* wxUSE_TEXTFILE */ +#if wxUSE_XML && !wxUSE_WCHAR_T +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_XML requires wxUSE_WCHAR_T" +# else +# undef wxUSE_XML +# define wxUSE_XML 0 +# endif +#endif /* wxUSE_XML */ + #if !wxUSE_DYNLIB_CLASS # if wxUSE_DYNAMIC_LOADER # ifdef wxABORT_ON_CONFIG_ERROR @@ -1443,6 +1202,18 @@ # endif #endif /* wxUSE_ZIPSTREAM */ +#if wxUSE_TARSTREAM + /* wxTar doesn't currently compile without wchar_t */ +# if !wxUSE_WCHAR_T +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxTar requires wchar_t" +# else +# undef wxUSE_TARSTREAM +# define wxUSE_TARSTREAM 0 +# endif +# endif +#endif /* wxUSE_TARSTREAM */ + #if wxUSE_TARSTREAM # if !wxUSE_ARCHIVE_STREAMS # ifdef wxABORT_ON_CONFIG_ERROR @@ -1454,20 +1225,9 @@ # endif #endif /* wxUSE_TARSTREAM */ -/* - Section 3b: the tests for the GUI settings only. - */ +/* the rest of the tests is for the GUI settings only */ #if wxUSE_GUI -#if wxUSE_ACCESSIBILITY && !defined(__WXMSW__) -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_ACCESSIBILITY is currently only supported under wxMSW" -# else -# undef wxUSE_ACCESSIBILITY -# define wxUSE_ACCESSIBILITY 0 -# endif -#endif /* wxUSE_ACCESSIBILITY */ - #if wxUSE_BUTTON || \ wxUSE_CALENDARCTRL || \ wxUSE_CARET || \ @@ -1478,13 +1238,11 @@ wxUSE_CHOICE || \ wxUSE_GAUGE || \ wxUSE_GRID || \ - wxUSE_HEADERCTRL || \ wxUSE_LISTBOX || \ wxUSE_LISTCTRL || \ wxUSE_NOTEBOOK || \ wxUSE_RADIOBOX || \ wxUSE_RADIOBTN || \ - wxUSE_REARRANGECTRL || \ wxUSE_SCROLLBAR || \ wxUSE_SLIDER || \ wxUSE_SPINBTN || \ @@ -1496,8 +1254,7 @@ wxUSE_STATUSBAR || \ wxUSE_TEXTCTRL || \ wxUSE_TOOLBAR || \ - wxUSE_TREECTRL || \ - wxUSE_TREELISTCTRL + wxUSE_TREECTRL # if !wxUSE_CONTROLS # ifdef wxABORT_ON_CONFIG_ERROR # error "wxUSE_CONTROLS unset but some controls used" @@ -1519,17 +1276,6 @@ # endif #endif /* wxUSE_BMPBUTTON */ -#if wxUSE_COMMANDLINKBUTTON -# if !wxUSE_BUTTON -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_COMMANDLINKBUTTON requires wxUSE_BUTTON" -# else -# undef wxUSE_BUTTON -# define wxUSE_BUTTON 1 -# endif -# endif -#endif /* wxUSE_COMMANDLINKBUTTON */ - /* wxUSE_BOOKCTRL should be only used if any of the controls deriving from it are used @@ -1594,53 +1340,20 @@ #if !wxUSE_ODCOMBOBOX # if wxUSE_BITMAPCOMBOBOX -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxBitmapComboBox requires wxOwnerDrawnComboBox" -# else -# undef wxUSE_BITMAPCOMBOBOX -# define wxUSE_BITMAPCOMBOBOX 0 -# endif +# error "wxBitmapComboBox requires wxOwnerDrawnComboBox" +# else +# undef wxUSE_BITMAPCOMBOBOX +# define wxUSE_BITMAPCOMBOBOX 0 # endif #endif /* !wxUSE_ODCOMBOBOX */ -#if !wxUSE_HEADERCTRL -# if wxUSE_DATAVIEWCTRL || wxUSE_GRID -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxDataViewCtrl and wxGrid require wxHeaderCtrl" -# else -# undef wxUSE_HEADERCTRL -# define wxUSE_HEADERCTRL 1 -# endif -# endif -#endif /* !wxUSE_HEADERCTRL */ - -#if wxUSE_REARRANGECTRL -# if !wxUSE_CHECKLISTBOX -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxRearrangeCtrl requires wxCheckListBox" -# else -# undef wxUSE_REARRANGECTRL -# define wxUSE_REARRANGECTRL 0 -# endif -# endif -#endif /* wxUSE_REARRANGECTRL */ - -#if wxUSE_RICHMSGDLG -# if !wxUSE_MSGDLG -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_RICHMSGDLG requires wxUSE_MSGDLG" -# else -# undef wxUSE_MSGDLG -# define wxUSE_MSGDLG 1 -# endif -# endif -#endif /* wxUSE_RICHMSGDLG */ - /* don't attempt to use native status bar on the platforms not having it */ #ifndef wxUSE_NATIVE_STATUSBAR # define wxUSE_NATIVE_STATUSBAR 0 #elif wxUSE_NATIVE_STATUSBAR -# if defined(__WXUNIVERSAL__) || !(defined(__WXMSW__) || defined(__WXMAC__)) +# if defined(__WXUNIVERSAL__) || !( defined(__WXMSW__) || \ + defined(__WXMAC__) || \ + defined(__WXPALMOS__) ) # undef wxUSE_NATIVE_STATUSBAR # define wxUSE_NATIVE_STATUSBAR 0 # endif @@ -1656,6 +1369,40 @@ #endif /* wxUSE_GRAPHICS_CONTEXT */ +/* wxGTK-specific dependencies */ +#ifdef __WXGTK__ +# ifndef __WXUNIVERSAL__ +# if wxUSE_MDI_ARCHITECTURE && !wxUSE_MENUS +# ifdef wxABORT_ON_CONFIG_ERROR +# error "MDI requires wxUSE_MENUS in wxGTK" +# else +# undef wxUSE_MENUS +# define wxUSE_MENUS 1 +# endif +# endif +# endif /* !__WXUNIVERSAL__ */ + +# if wxUSE_JOYSTICK +# if !wxUSE_THREADS +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxJoystick requires threads in wxGTK" +# else +# undef wxUSE_JOYSTICK +# define wxUSE_JOYSTICK 0 +# endif +# endif +# endif +#endif /* wxGTK && !wxUniv */ + +/* Hopefully we can emulate these dialogs in due course */ +#if defined(__SMARTPHONE__) && defined(__WXWINCE__) +# ifdef wxUSE_COLOURDLG +# undef wxUSE_COLOURDLG +# define wxUSE_COLOURDLG 0 +# endif +#endif /* __SMARTPHONE__ && __WXWINCE__ */ + + /* generic controls dependencies */ #if !defined(__WXMSW__) || defined(__WXUNIVERSAL__) # if wxUSE_FONTDLG || wxUSE_FILEDLG || wxUSE_CHOICEDLG @@ -1683,29 +1430,7 @@ # endif #endif /* !wxMSW || wxUniv */ -/* generic file dialog depends on (generic) file control */ -#if wxUSE_FILEDLG && !wxUSE_FILECTRL && \ - (defined(__WXUNIVERSAL__) || defined(__WXGTK__)) -# ifdef wxABORT_ON_CONFIG_ERROR -# error "Generic wxFileDialog requires wxFileCtrl" -# else -# undef wxUSE_FILECTRL -# define wxUSE_FILECTRL 1 -# endif -#endif /* wxUSE_FILEDLG */ - /* common dependencies */ -#if wxUSE_ARTPROVIDER_TANGO -# if !(wxUSE_STREAMS && wxUSE_IMAGE && wxUSE_LIBPNG) -# ifdef wxABORT_ON_CONFIG_ERROR -# error "Tango art provider requires wxImage with streams and PNG support" -# else -# undef wxUSE_ARTPROVIDER_TANGO -# define wxUSE_ARTPROVIDER_TANGO 0 -# endif -# endif -#endif /* wxUSE_ARTPROVIDER_TANGO */ - #if wxUSE_CALENDARCTRL # if !(wxUSE_SPINBTN && wxUSE_COMBOBOX) # ifdef wxABORT_ON_CONFIG_ERROR @@ -1728,16 +1453,16 @@ # endif #endif /* wxUSE_CALENDARCTRL */ -#if wxUSE_DATEPICKCTRL || wxUSE_TIMEPICKCTRL +#if wxUSE_DATEPICKCTRL # if !wxUSE_DATETIME # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxDatePickerCtrl and wxTimePickerCtrl requires wxUSE_DATETIME" +# error "wxDatePickerCtrl requires wxUSE_DATETIME" # else # undef wxUSE_DATETIME # define wxUSE_DATETIME 1 # endif # endif -#endif /* wxUSE_DATEPICKCTRL || wxUSE_TIMEPICKCTRL */ +#endif /* wxUSE_DATEPICKCTRL */ #if wxUSE_CHECKLISTBOX # if !wxUSE_LISTBOX @@ -1761,17 +1486,6 @@ # endif #endif /* wxUSE_CHOICEDLG */ -#if wxUSE_FILECTRL -# if !wxUSE_DATETIME -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxFileCtrl requires wxDateTime" -# else -# undef wxUSE_DATETIME -# define wxUSE_DATETIME 1 -# endif -# endif -#endif /* wxUSE_FILECTRL */ - #if wxUSE_HELP # if !wxUSE_BMPBUTTON # ifdef wxABORT_ON_CONFIG_ERROR @@ -1948,15 +1662,6 @@ # define wxUSE_STREAMS 1 # endif # endif - -# if !wxUSE_FILE_HISTORY -# ifdef wxABORT_ON_CONFIG_ERROR -# error "DocView requires wxUSE_FILE_HISTORY" -# else -# undef wxUSE_FILE_HISTORY -# define wxUSE_FILE_HISTORY 1 -# endif -# endif #endif /* wxUSE_DOC_VIEW_ARCHITECTURE */ #if wxUSE_PRINTING_ARCHITECTURE @@ -2002,7 +1707,7 @@ #endif /* wxUSE_FILEDLG */ #if !wxUSE_GAUGE || !wxUSE_BUTTON -# if wxUSE_PROGRESSDLG +# if wxUSE_PROGRESSDLG && !defined(__WXPALMOS__) # ifdef wxABORT_ON_CONFIG_ERROR # error "Generic progress dialog requires wxUSE_GAUGE and wxUSE_BUTTON" # else @@ -2044,7 +1749,7 @@ #endif #if !wxUSE_IMAGLIST -# if wxUSE_TREECTRL || wxUSE_NOTEBOOK || wxUSE_LISTCTRL || wxUSE_TREELISTCTRL +# if wxUSE_TREECTRL || wxUSE_NOTEBOOK || wxUSE_LISTCTRL # ifdef wxABORT_ON_CONFIG_ERROR # error "wxImageList must be compiled as well" # else @@ -2054,6 +1759,16 @@ # endif #endif /* !wxUSE_IMAGLIST */ +#if !wxUSE_MSGDLG +# ifdef wxABORT_ON_CONFIG_ERROR + /* FIXME: should compile without it, of course, but doesn't */ +# error "wxMessageBox is always needed" +# else +# undef wxUSE_MSGDLG +# define wxUSE_MSGDLG 1 +# endif +#endif + #if wxUSE_RADIOBOX # if !wxUSE_RADIOBTN # ifdef wxABORT_ON_CONFIG_ERROR @@ -2063,7 +1778,7 @@ # define wxUSE_RADIOBTN 1 # endif # endif -# if !wxUSE_STATBOX +# if !wxUSE_STATBOX && !defined(__WXPALMOS__) # ifdef wxABORT_ON_CONFIG_ERROR # error "wxUSE_RADIOBOX requires wxUSE_STATBOX" # else @@ -2106,6 +1821,15 @@ # endif #endif /* wxUSE_CLIPBOARD */ +#if wxUSE_WX_RESOURCES && !wxUSE_PROLOGIO +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxr resources require PrologIO" +# else +# undef wxUSE_PROLOGIO +# define wxUSE_PROLOGIO 1 +# endif +#endif /* wxUSE_WX_RESOURCES */ + #if wxUSE_XRC && !wxUSE_XML # ifdef wxABORT_ON_CONFIG_ERROR # error "wxUSE_XRC requires wxUSE_XML" @@ -2124,42 +1848,6 @@ # endif #endif /* wxUSE_SOCKETS */ -#if wxUSE_SVG && !wxUSE_STREAMS -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_SVG requires wxUSE_STREAMS" -# else -# undef wxUSE_SVG -# define wxUSE_SVG 0 -# endif -#endif /* wxUSE_SVG */ - -#if wxUSE_SVG && !wxUSE_IMAGE -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_SVG requires wxUSE_IMAGE" -# else -# undef wxUSE_SVG -# define wxUSE_SVG 0 -# endif -#endif /* wxUSE_SVG */ - -#if wxUSE_SVG && !wxUSE_LIBPNG -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_SVG requires wxUSE_LIBPNG" -# else -# undef wxUSE_SVG -# define wxUSE_SVG 0 -# endif -#endif /* wxUSE_SVG */ - -#if wxUSE_TASKBARICON && !wxUSE_MENUS -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_TASKBARICON requires wxUSE_MENUS" -# else -# undef wxUSE_TASKBARICON -# define wxUSE_TASKBARICON 0 -# endif -#endif /* wxUSE_TASKBARICON */ - #if !wxUSE_VARIANT # if wxUSE_DATAVIEWCTRL # ifdef wxABORT_ON_CONFIG_ERROR @@ -2169,26 +1857,15 @@ # define wxUSE_DATAVIEWCTRL 0 # endif # endif + +# if wxUSE_ODBC +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_ODBC requires wxVariant" +# else +# undef wxUSE_ODBC +# define wxUSE_ODBC 0 +# endif +# endif #endif /* wxUSE_VARIANT */ -#if wxUSE_TREELISTCTRL && !wxUSE_DATAVIEWCTRL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_TREELISTCTRL requires wxDataViewCtrl" -# else -# undef wxUSE_TREELISTCTRL -# define wxUSE_TREELISTCTRL 0 -# endif -#endif /* wxUSE_TREELISTCTRL */ - -#if wxUSE_WEBVIEW && !(wxUSE_WEBVIEW_WEBKIT || wxUSE_WEBVIEW_IE) -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_WEBVIEW requires at least one backend" -# else -# undef wxUSE_WEBVIEW -# define wxUSE_WEBVIEW 0 -# endif -#endif /* wxUSE_WEBVIEW && !any web view backend */ - #endif /* wxUSE_GUI */ - -#endif /* _WX_CHKCONF_H_ */ diff --git a/Source/3rd Party/wx/include/wx/choicdlg.h b/Source/3rd Party/wx/include/wx/choicdlg.h index 54ba6fd1b..76867ec67 100644 --- a/Source/3rd Party/wx/include/wx/choicdlg.h +++ b/Source/3rd Party/wx/include/wx/choicdlg.h @@ -1,10 +1,10 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/choicdlg.h +// Name: wx/choicdgg.h // Purpose: Includes generic choice dialog file // Author: Julian Smart // Modified by: // Created: -// RCS-ID: $Id$ +// RCS-ID: $Id: choicdlg.h 33948 2005-05-04 18:57:50Z JS $ // Copyright: Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// diff --git a/Source/3rd Party/wx/include/wx/choice.h b/Source/3rd Party/wx/include/wx/choice.h index ccc66fa78..fe2a9fa76 100644 --- a/Source/3rd Party/wx/include/wx/choice.h +++ b/Source/3rd Party/wx/include/wx/choice.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 26.07.99 -// RCS-ID: $Id$ +// RCS-ID: $Id: choice.h 42727 2006-10-30 16:04:27Z VZ $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -26,13 +26,13 @@ // global data // ---------------------------------------------------------------------------- -extern WXDLLIMPEXP_DATA_CORE(const char) wxChoiceNameStr[]; +extern WXDLLEXPORT_DATA(const wxChar) wxChoiceNameStr[]; // ---------------------------------------------------------------------------- // wxChoice allows to select one of a non-modifiable list of strings // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxChoiceBase : public wxControlWithItems +class WXDLLEXPORT wxChoiceBase : public wxControlWithItems { public: wxChoiceBase() { } @@ -55,11 +55,8 @@ public: // emulate selecting the item event.GetInt() void Command(wxCommandEvent& event); - // override wxItemContainer::IsSorted - virtual bool IsSorted() const { return HasFlag(wxCB_SORT); } - private: - wxDECLARE_NO_COPY_CLASS(wxChoiceBase); + DECLARE_NO_COPY_CLASS(wxChoiceBase) }; // ---------------------------------------------------------------------------- @@ -79,7 +76,7 @@ private: #elif defined(__WXGTK__) #include "wx/gtk1/choice.h" #elif defined(__WXMAC__) - #include "wx/osx/choice.h" + #include "wx/mac/choice.h" #elif defined(__WXCOCOA__) #include "wx/cocoa/choice.h" #elif defined(__WXPM__) diff --git a/Source/3rd Party/wx/include/wx/choicebk.h b/Source/3rd Party/wx/include/wx/choicebk.h index 55293739f..2f35c0a01 100644 --- a/Source/3rd Party/wx/include/wx/choicebk.h +++ b/Source/3rd Party/wx/include/wx/choicebk.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: Wlodzimierz ABX Skiba from wx/listbook.h // Created: 15.09.04 -// RCS-ID: $Id$ +// RCS-ID: $Id: choicebk.h 59616 2009-03-18 21:58:15Z VZ $ // Copyright: (c) Vadim Zeitlin, Wlodzimierz Skiba // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -18,12 +18,11 @@ #include "wx/bookctrl.h" #include "wx/choice.h" -#include "wx/containr.h" class WXDLLIMPEXP_FWD_CORE wxChoice; -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED, wxBookCtrlEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING, wxBookCtrlEvent ); +extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED; +extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING; // wxChoicebook flags #define wxCHB_DEFAULT wxBK_DEFAULT @@ -37,10 +36,13 @@ wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGI // wxChoicebook // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxChoicebook : public wxNavigationEnabled +class WXDLLEXPORT wxChoicebook : public wxBookCtrlBase { public: - wxChoicebook() { } + wxChoicebook() + { + Init(); + } wxChoicebook(wxWindow *parent, wxWindowID id, @@ -49,6 +51,8 @@ public: long style = 0, const wxString& name = wxEmptyString) { + Init(); + (void)Create(parent, id, pos, size, style, name); } @@ -61,17 +65,18 @@ public: const wxString& name = wxEmptyString); + virtual int GetSelection() const; virtual bool SetPageText(size_t n, const wxString& strText); virtual wxString GetPageText(size_t n) const; virtual int GetPageImage(size_t n) const; virtual bool SetPageImage(size_t n, int imageId); + virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const; virtual bool InsertPage(size_t n, wxWindow *page, const wxString& text, bool bSelect = false, - int imageId = NO_IMAGE); - virtual int SetSelection(size_t n) - { return DoSetSelection(n, SetSelection_SendEvent); } + int imageId = -1); + virtual int SetSelection(size_t n) { return DoSetSelection(n, SetSelection_SendEvent); } virtual int ChangeSelection(size_t n) { return DoSetSelection(n); } virtual void SetImageList(wxImageList *imageList); @@ -80,29 +85,31 @@ public: // returns the choice control wxChoice* GetChoiceCtrl() const { return (wxChoice*)m_bookctrl; } - // Override this to return true because the part of parent window - // background between our controlling wxChoice and the page area should - // show through. - virtual bool HasTransparentBackground() { return true; } - protected: - virtual void DoSetWindowVariant(wxWindowVariant variant); - virtual wxWindow *DoRemovePage(size_t page); + // get the size which the choice control should have + virtual wxSize GetControllerSize() const; + void UpdateSelectedPage(size_t newsel) { - m_selection = static_cast(newsel); + m_selection = wx_static_cast(int, newsel); GetChoiceCtrl()->Select(m_selection); } - wxBookCtrlEvent* CreatePageChangingEvent() const; - void MakeChangedEvent(wxBookCtrlEvent &event); + wxBookCtrlBaseEvent* CreatePageChangingEvent() const; + void MakeChangedEvent(wxBookCtrlBaseEvent &event); // event handlers void OnChoiceSelected(wxCommandEvent& event); + // the currently selected page or wxNOT_FOUND if none + int m_selection; + private: + // common part of all constructors + void Init(); + DECLARE_EVENT_TABLE() DECLARE_DYNAMIC_CLASS_NO_COPY(wxChoicebook) }; @@ -111,16 +118,36 @@ private: // choicebook event class and related stuff // ---------------------------------------------------------------------------- -// wxChoicebookEvent is obsolete and defined for compatibility only -#define wxChoicebookEvent wxBookCtrlEvent -typedef wxBookCtrlEventFunction wxChoicebookEventFunction; -#define wxChoicebookEventHandler(func) wxBookCtrlEventHandler(func) +class WXDLLEXPORT wxChoicebookEvent : public wxBookCtrlBaseEvent +{ +public: + wxChoicebookEvent(wxEventType commandType = wxEVT_NULL, int id = 0, + int nSel = -1, int nOldSel = -1) + : wxBookCtrlBaseEvent(commandType, id, nSel, nOldSel) + { + } + + wxChoicebookEvent(const wxChoicebookEvent& event) + : wxBookCtrlBaseEvent(event) + { + } + + virtual wxEvent *Clone() const { return new wxChoicebookEvent(*this); } + +private: + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxChoicebookEvent) +}; + +typedef void (wxEvtHandler::*wxChoicebookEventFunction)(wxChoicebookEvent&); + +#define wxChoicebookEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxChoicebookEventFunction, &func) #define EVT_CHOICEBOOK_PAGE_CHANGED(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED, winid, wxBookCtrlEventHandler(fn)) + wx__DECLARE_EVT1(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED, winid, wxChoicebookEventHandler(fn)) #define EVT_CHOICEBOOK_PAGE_CHANGING(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING, winid, wxBookCtrlEventHandler(fn)) + wx__DECLARE_EVT1(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING, winid, wxChoicebookEventHandler(fn)) #endif // wxUSE_CHOICEBOOK diff --git a/Source/3rd Party/wx/include/wx/clipbrd.h b/Source/3rd Party/wx/include/wx/clipbrd.h index fbc8f9ad5..11976bec9 100644 --- a/Source/3rd Party/wx/include/wx/clipbrd.h +++ b/Source/3rd Party/wx/include/wx/clipbrd.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 19.10.99 -// RCS-ID: $Id$ +// RCS-ID: $Id: clipbrd.h 49563 2007-10-31 20:46:21Z VZ $ // Copyright: (c) wxWidgets Team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -17,11 +17,11 @@ #if wxUSE_CLIPBOARD -#include "wx/event.h" -#include "wx/chartype.h" -#include "wx/dataobj.h" // for wxDataFormat -#include "wx/vector.h" +#include "wx/object.h" +#include "wx/wxchar.h" +class WXDLLIMPEXP_FWD_CORE wxDataFormat; +class WXDLLIMPEXP_FWD_CORE wxDataObject; class WXDLLIMPEXP_FWD_CORE wxClipboard; // ---------------------------------------------------------------------------- @@ -32,10 +32,10 @@ class WXDLLIMPEXP_FWD_CORE wxClipboard; // with wxDataObject. // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxClipboardBase : public wxObject +class WXDLLEXPORT wxClipboardBase : public wxObject { public: - wxClipboardBase() { m_usePrimary = false; } + wxClipboardBase() {} // open the clipboard before Add/SetData() and GetData() virtual bool Open() = 0; @@ -59,9 +59,6 @@ public: // ask if data in correct format is available virtual bool IsSupported( const wxDataFormat& format ) = 0; - // ask if data in correct format is available - virtual bool IsSupportedAsync( wxEvtHandler *sink ); - // fill data with data on the clipboard (if available) virtual bool GetData( wxDataObject& data ) = 0; @@ -73,72 +70,13 @@ public: // eating memory), otherwise the clipboard will be emptied on exit virtual bool Flush() { return false; } - // this allows to choose whether we work with CLIPBOARD (default) or - // PRIMARY selection on X11-based systems - // - // on the other ones, working with primary selection does nothing: this - // allows to write code which sets the primary selection when something is - // selected without any ill effects (i.e. without overwriting the - // clipboard which would be wrong on the platforms without X11 PRIMARY) - virtual void UsePrimarySelection(bool usePrimary = false) - { - m_usePrimary = usePrimary; - } - - // return true if we're using primary selection - bool IsUsingPrimarySelection() const { return m_usePrimary; } + // X11 has two clipboards which get selected by this call. Empty on MSW. + virtual void UsePrimarySelection( bool WXUNUSED(primary) = false ) { } // Returns global instance (wxTheClipboard) of the object: static wxClipboard *Get(); - - - // don't use this directly, it is public for compatibility with some ports - // (wxX11, wxMotif, ...) only - bool m_usePrimary; }; -// ---------------------------------------------------------------------------- -// asynchronous clipboard event -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxClipboardEvent : public wxEvent -{ -public: - wxClipboardEvent(wxEventType evtType = wxEVT_NULL) - : wxEvent(0, evtType) - { - } - - wxClipboardEvent(const wxClipboardEvent& event) - : wxEvent(event), - m_formats(event.m_formats) - { - } - - bool SupportsFormat(const wxDataFormat& format) const; - void AddFormat(const wxDataFormat& format); - - virtual wxEvent *Clone() const - { - return new wxClipboardEvent(*this); - } - - -protected: - wxVector m_formats; - - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxClipboardEvent) -}; - -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_CLIPBOARD_CHANGED, wxClipboardEvent ); - -typedef void (wxEvtHandler::*wxClipboardEventFunction)(wxClipboardEvent&); - -#define wxClipboardEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxClipboardEventFunction, func) - -#define EVT_CLIPBOARD_CHANGED(func) wx__DECLARE_EVT0(wxEVT_CLIPBOARD_CHANGED, wxClipboardEventHandler(func)) - // ---------------------------------------------------------------------------- // globals // ---------------------------------------------------------------------------- @@ -160,8 +98,10 @@ typedef void (wxEvtHandler::*wxClipboardEventFunction)(wxClipboardEvent&); #include "wx/gtk1/clipbrd.h" #elif defined(__WXX11__) #include "wx/x11/clipbrd.h" +#elif defined(__WXMGL__) + #include "wx/mgl/clipbrd.h" #elif defined(__WXMAC__) - #include "wx/osx/clipbrd.h" + #include "wx/mac/clipbrd.h" #elif defined(__WXCOCOA__) #include "wx/cocoa/clipbrd.h" #elif defined(__WXPM__) @@ -172,10 +112,10 @@ typedef void (wxEvtHandler::*wxClipboardEventFunction)(wxClipboardEvent&); // helpful class for opening the clipboard and automatically closing it // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxClipboardLocker +class WXDLLEXPORT wxClipboardLocker { public: - wxClipboardLocker(wxClipboard *clipboard = NULL) + wxClipboardLocker(wxClipboard *clipboard = (wxClipboard *)NULL) { m_clipboard = clipboard ? clipboard : wxTheClipboard; if ( m_clipboard ) @@ -197,7 +137,7 @@ public: private: wxClipboard *m_clipboard; - wxDECLARE_NO_COPY_CLASS(wxClipboardLocker); + DECLARE_NO_COPY_CLASS(wxClipboardLocker) }; #endif // wxUSE_CLIPBOARD diff --git a/Source/3rd Party/wx/include/wx/clntdata.h b/Source/3rd Party/wx/include/wx/clntdata.h index e586f6198..f9704a7d0 100644 --- a/Source/3rd Party/wx/include/wx/clntdata.h +++ b/Source/3rd Party/wx/include/wx/clntdata.h @@ -4,7 +4,7 @@ // Author: Robin Dunn // Modified by: // Created: 9-Oct-2001 -// RCS-ID: $Id$ +// RCS-ID: $Id: clntdata.h 36973 2006-01-18 16:45:41Z JS $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -159,5 +159,115 @@ protected: }; +#include "wx/vector.h" + +struct WXDLLIMPEXP_BASE wxClientDataDictionaryPair +{ + wxClientDataDictionaryPair( size_t idx ) : index( idx ), data( 0 ) { } + + size_t index; + wxClientData* data; +}; + +_WX_DECLARE_VECTOR( + wxClientDataDictionaryPair, + wxClientDataDictionaryPairVector, + WXDLLIMPEXP_BASE +); + +// this class is used internally to maintain the association between items +// of (some subclasses of) wxControlWithItems and their client data +// NOTE: this class does not keep track of whether it contains +// wxClientData or void*. The client must ensure that +// it does not contain a mix of the two, and that +// DestroyData is called if it contains wxClientData +class WXDLLIMPEXP_BASE wxClientDataDictionary +{ +public: + wxClientDataDictionary() {} + + // deletes all the data + void DestroyData() + { + for( size_t i = 0, end = m_vec.size(); i != end; ++i ) + delete m_vec[i].data; + m_vec.clear(); + } + + // if data for the given index is not present, add it, + // if it is present, delete the old data and replace it with + // the new one + void Set( size_t index, wxClientData* data, bool doDelete ) + { + size_t ptr = Find( index ); + + if( !data ) + { + if( ptr == m_vec.size() ) return; + if( doDelete ) + delete m_vec[ptr].data; + m_vec.erase( ptr ); + } + else + { + if( ptr == m_vec.size() ) + { + m_vec.push_back( wxClientDataDictionaryPair( index ) ); + ptr = m_vec.size() - 1; + } + + if( doDelete ) + delete m_vec[ptr].data; + m_vec[ptr].data = data; + } + } + + // get the data associated with the given index, + // return 0 if not found + wxClientData* Get( size_t index ) const + { + size_t it = Find( index ); + if( it == m_vec.size() ) return 0; + return (wxClientData*)m_vec[it].data; // const cast + } + + // delete the data associated with the given index + // it also decreases by one the indices of all the elements + // with an index greater than the given index + void Delete( size_t index, bool doDelete ) + { + size_t todel = m_vec.size(); + + for( size_t i = 0, end = m_vec.size(); i != end; ++i ) + { + if( m_vec[i].index == index ) + todel = i; + else if( m_vec[i].index > index ) + --(m_vec[i].index); + } + + if( todel != m_vec.size() ) + { + if( doDelete ) + delete m_vec[todel].data; + m_vec.erase( todel ); + } + } +private: + // returns MyVec.size() if not found + size_t Find( size_t index ) const + { + for( size_t i = 0, end = m_vec.size(); i != end; ++i ) + { + if( m_vec[i].index == index ) + return i; + } + + return m_vec.size(); + } + + wxClientDataDictionaryPairVector m_vec; +}; + #endif // _WX_CLNTDATAH__ diff --git a/Source/3rd Party/wx/include/wx/clrpicker.h b/Source/3rd Party/wx/include/wx/clrpicker.h index 72662f9c3..f6a436fc3 100644 --- a/Source/3rd Party/wx/include/wx/clrpicker.h +++ b/Source/3rd Party/wx/include/wx/clrpicker.h @@ -5,7 +5,7 @@ // Modified by: // Created: 14/4/2006 // Copyright: (c) Vadim Zeitlin, Francesco Montorsi -// RCS-ID: $Id$ +// RCS-ID: $Id: clrpicker.h 53135 2008-04-12 02:31:04Z VZ $ // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// @@ -22,15 +22,8 @@ class WXDLLIMPEXP_FWD_CORE wxColourPickerEvent; -extern WXDLLIMPEXP_DATA_CORE(const char) wxColourPickerWidgetNameStr[]; -extern WXDLLIMPEXP_DATA_CORE(const char) wxColourPickerCtrlNameStr[]; - -// show the colour in HTML form (#AABBCC) as colour button label -#define wxCLRBTN_SHOW_LABEL 100 - -// the default style -#define wxCLRBTN_DEFAULT_STYLE (wxCLRBTN_SHOW_LABEL) - +extern WXDLLEXPORT_DATA(const wxChar) wxColourPickerWidgetNameStr[]; +extern WXDLLEXPORT_DATA(const wxChar) wxColourPickerCtrlNameStr[]; // ---------------------------------------------------------------------------- @@ -77,7 +70,7 @@ protected: // same prototype for their contructor (and also explains why we use // define instead of a typedef) // since GTK > 2.4, there is GtkColorButton -#if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__) +#if defined(__WXGTK24__) && !defined(__WXUNIVERSAL__) #include "wx/gtk/clrpicker.h" #define wxColourPickerWidget wxColourButton #else @@ -160,7 +153,9 @@ private: // wxColourPickerEvent: used by wxColourPickerCtrl only // ---------------------------------------------------------------------------- -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_COLOURPICKER_CHANGED, wxColourPickerEvent ); +BEGIN_DECLARE_EVENT_TYPES() + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_CORE, wxEVT_COMMAND_COLOURPICKER_CHANGED, 1102) +END_DECLARE_EVENT_TYPES() class WXDLLIMPEXP_CORE wxColourPickerEvent : public wxCommandEvent { @@ -193,7 +188,7 @@ private: typedef void (wxEvtHandler::*wxColourPickerEventFunction)(wxColourPickerEvent&); #define wxColourPickerEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxColourPickerEventFunction, func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxColourPickerEventFunction, &func) #define EVT_COLOURPICKER_CHANGED(id, fn) \ wx__DECLARE_EVT1(wxEVT_COMMAND_COLOURPICKER_CHANGED, id, wxColourPickerEventHandler(fn)) diff --git a/Source/3rd Party/wx/include/wx/cmdargs.h b/Source/3rd Party/wx/include/wx/cmdargs.h deleted file mode 100644 index 56a3b355e..000000000 --- a/Source/3rd Party/wx/include/wx/cmdargs.h +++ /dev/null @@ -1,152 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/cmdargs.h -// Purpose: declaration of wxCmdLineArgsArray helper class -// Author: Vadim Zeitlin -// Created: 2007-11-12 -// RCS-ID: $Id$ -// Copyright: (c) 2007 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CMDARGS_H_ -#define _WX_CMDARGS_H_ - -#include "wx/arrstr.h" - -// ---------------------------------------------------------------------------- -// wxCmdLineArgsArray: helper class used by wxApp::argv -// ---------------------------------------------------------------------------- - -#if wxUSE_UNICODE - -// this class is used instead of either "char **" or "wchar_t **" (neither of -// which would be backwards compatible with all the existing code) for argv -// field of wxApp -// -// as it's used for compatibility, it tries to look as much as traditional -// (char **) argv as possible, in particular it provides implicit conversions -// to "char **" and also array-like operator[] -class WXDLLIMPEXP_BASE wxCmdLineArgsArray -{ -public: - wxCmdLineArgsArray() { m_argsA = NULL; m_argsW = NULL; } - - template - wxCmdLineArgsArray& operator=(T **argv) - { - FreeArgs(); - - m_args.clear(); - - if ( argv ) - { - while ( *argv ) - m_args.push_back(*argv++); - } - - return *this; - } - - operator char**() const - { - if ( !m_argsA ) - { - const size_t count = m_args.size(); - m_argsA = new char *[count]; - for ( size_t n = 0; n < count; n++ ) - m_argsA[n] = wxStrdup(m_args[n].ToAscii()); - } - - return m_argsA; - } - - operator wchar_t**() const - { - if ( !m_argsW ) - { - const size_t count = m_args.size(); - m_argsW = new wchar_t *[count]; - for ( size_t n = 0; n < count; n++ ) - m_argsW[n] = wxStrdup(m_args[n].wc_str()); - } - - return m_argsW; - } - - // existing code does checks like "if ( argv )" and we want it to continue - // to compile, so provide this conversion even if it is pretty dangerous - operator bool() const - { - return !m_args.empty(); - } - - // and the same for "if ( !argv )" checks - bool operator!() const - { - return m_args.empty(); - } - - wxString operator[](size_t n) const - { - return m_args[n]; - } - - // we must provide this overload for g++ 3.4 which can't choose between - // our operator[](size_t) and ::operator[](char**, int) otherwise - wxString operator[](int n) const - { - return m_args[n]; - } - - - // convenience methods, i.e. not existing only for backwards compatibility - - // do we have any arguments at all? - bool IsEmpty() const { return m_args.empty(); } - - // access the arguments as a convenient array of wxStrings - const wxArrayString& GetArguments() const { return m_args; } - - ~wxCmdLineArgsArray() - { - FreeArgs(); - } - -private: - template - void Free(T **args) - { - if ( !args ) - return; - - const size_t count = m_args.size(); - for ( size_t n = 0; n < count; n++ ) - free(args[n]); - - delete [] args; - } - - void FreeArgs() - { - Free(m_argsA); - Free(m_argsW); - } - - wxArrayString m_args; - mutable char **m_argsA; - mutable wchar_t **m_argsW; - - wxDECLARE_NO_COPY_CLASS(wxCmdLineArgsArray); -}; - -// provide global operator overload for compatibility with the existing code -// doing things like "if ( condition && argv )" -inline bool operator&&(bool cond, const wxCmdLineArgsArray& array) -{ - return cond && !array.IsEmpty(); -} - -#endif // wxUSE_UNICODE - -#endif // _WX_CMDARGS_H_ - diff --git a/Source/3rd Party/wx/include/wx/cmdline.h b/Source/3rd Party/wx/include/wx/cmdline.h index d83c257cc..9f6e6080b 100644 --- a/Source/3rd Party/wx/include/wx/cmdline.h +++ b/Source/3rd Party/wx/include/wx/cmdline.h @@ -5,7 +5,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 04.01.00 -// RCS-ID: $Id$ +// RCS-ID: $Id: cmdline.h 49563 2007-10-31 20:46:21Z VZ $ // Copyright: (c) 2000 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -17,14 +17,6 @@ #include "wx/string.h" #include "wx/arrstr.h" -#include "wx/cmdargs.h" - -// determines ConvertStringToArgs() behaviour -enum wxCmdLineSplitType -{ - wxCMD_LINE_SPLIT_DOS, - wxCMD_LINE_SPLIT_UNIX -}; #if wxUSE_CMDLINE_PARSER @@ -36,14 +28,13 @@ class WXDLLIMPEXP_FWD_BASE wxDateTime; // by default, options are optional (sic) and each call to AddParam() allows // one more parameter - this may be changed by giving non-default flags to it -enum wxCmdLineEntryFlags +enum { wxCMD_LINE_OPTION_MANDATORY = 0x01, // this option must be given wxCMD_LINE_PARAM_OPTIONAL = 0x02, // the parameter may be omitted wxCMD_LINE_PARAM_MULTIPLE = 0x04, // the parameter may be repeated wxCMD_LINE_OPTION_HELP = 0x08, // this option is a help request - wxCMD_LINE_NEEDS_SEPARATOR = 0x10, // must have sep before the value - wxCMD_LINE_SWITCH_NEGATABLE = 0x20 // this switch can be negated (e.g. /S-) + wxCMD_LINE_NEEDS_SEPARATOR = 0x10 // must have sep before the value }; // an option value or parameter may be a string (the most common case), a @@ -53,7 +44,6 @@ enum wxCmdLineParamType wxCMD_LINE_VAL_STRING, // should be 0 (default) wxCMD_LINE_VAL_NUMBER, wxCMD_LINE_VAL_DATE, - wxCMD_LINE_VAL_DOUBLE, wxCMD_LINE_VAL_NONE }; @@ -63,18 +53,9 @@ enum wxCmdLineEntryType wxCMD_LINE_SWITCH, wxCMD_LINE_OPTION, wxCMD_LINE_PARAM, - wxCMD_LINE_USAGE_TEXT, wxCMD_LINE_NONE // to terminate the list }; -// Possible return values of wxCmdLineParser::FoundSwitch() -enum wxCmdLineSwitchState -{ - wxCMD_SWITCH_OFF = -1, // Found but turned off/negated. - wxCMD_SWITCH_NOT_FOUND, // Not found at all. - wxCMD_SWITCH_ON // Found in normal state. -}; - // ---------------------------------------------------------------------------- // wxCmdLineEntryDesc is a description of one command line // switch/option/parameter @@ -83,17 +64,13 @@ enum wxCmdLineSwitchState struct wxCmdLineEntryDesc { wxCmdLineEntryType kind; - const char *shortName; - const char *longName; - const char *description; + const wxChar *shortName; + const wxChar *longName; + const wxChar *description; wxCmdLineParamType type; int flags; }; -// the list of wxCmdLineEntryDesc objects should be terminated with this one -#define wxCMD_LINE_DESC_END \ - { wxCMD_LINE_NONE, NULL, NULL, NULL, wxCMD_LINE_VAL_NONE, 0x0 } - // ---------------------------------------------------------------------------- // wxCmdLineParser is a class for parsing command line. // @@ -123,8 +100,6 @@ public: wxCmdLineParser(int argc, char **argv) { Init(); SetCmdLine(argc, argv); } #if wxUSE_UNICODE wxCmdLineParser(int argc, wxChar **argv) { Init(); SetCmdLine(argc, argv); } - wxCmdLineParser(int argc, const wxCmdLineArgsArray& argv) - { Init(); SetCmdLine(argc, argv); } #endif // wxUSE_UNICODE wxCmdLineParser(const wxString& cmdline) { Init(); SetCmdLine(cmdline); } @@ -137,10 +112,6 @@ public: #if wxUSE_UNICODE wxCmdLineParser(const wxCmdLineEntryDesc *desc, int argc, wxChar **argv) { Init(); SetCmdLine(argc, argv); SetDesc(desc); } - wxCmdLineParser(const wxCmdLineEntryDesc *desc, - int argc, - const wxCmdLineArgsArray& argv) - { Init(); SetCmdLine(argc, argv); SetDesc(desc); } #endif // wxUSE_UNICODE wxCmdLineParser(const wxCmdLineEntryDesc *desc, const wxString& cmdline) { Init(); SetCmdLine(cmdline); SetDesc(desc); } @@ -149,7 +120,6 @@ public: void SetCmdLine(int argc, char **argv); #if wxUSE_UNICODE void SetCmdLine(int argc, wxChar **argv); - void SetCmdLine(int argc, const wxCmdLineArgsArray& argv); #endif // wxUSE_UNICODE void SetCmdLine(const wxString& cmdline); @@ -168,7 +138,7 @@ public: void EnableLongOptions(bool enable = true); void DisableLongOptions() { EnableLongOptions(false); } - bool AreLongOptionsEnabled() const; + bool AreLongOptionsEnabled(); // extra text may be shown by Usage() method if set by this function void SetLogo(const wxString& logo); @@ -183,34 +153,18 @@ public: void AddSwitch(const wxString& name, const wxString& lng = wxEmptyString, const wxString& desc = wxEmptyString, int flags = 0); - void AddLongSwitch(const wxString& lng, - const wxString& desc = wxEmptyString, - int flags = 0) - { - AddSwitch(wxString(), lng, desc, flags); - } // an option taking a value of the given type void AddOption(const wxString& name, const wxString& lng = wxEmptyString, const wxString& desc = wxEmptyString, wxCmdLineParamType type = wxCMD_LINE_VAL_STRING, int flags = 0); - void AddLongOption(const wxString& lng, - const wxString& desc = wxEmptyString, - wxCmdLineParamType type = wxCMD_LINE_VAL_STRING, - int flags = 0) - { - AddOption(wxString(), lng, desc, type, flags); - } // a parameter void AddParam(const wxString& desc = wxEmptyString, wxCmdLineParamType type = wxCMD_LINE_VAL_STRING, int flags = 0); - // add an explanatory text to be shown to the user in help - void AddUsageText(const wxString& text); - // actions // ------- @@ -223,10 +177,7 @@ public: int Parse(bool showUsage = true); // give the usage message describing all program options - void Usage() const; - - // return the usage string, call Usage() to directly show it to the user - wxString GetUsageString() const; + void Usage(); // get the command line arguments // ------------------------------ @@ -234,12 +185,6 @@ public: // returns true if the given switch was found bool Found(const wxString& name) const; - // Returns wxCMD_SWITCH_NOT_FOUND if the switch was not found at all, - // wxCMD_SWITCH_ON if it was found in normal state and wxCMD_SWITCH_OFF if - // it was found but negated (i.e. followed by "-", this can only happen for - // the switches with wxCMD_LINE_SWITCH_NEGATABLE flag). - wxCmdLineSwitchState FoundSwitch(const wxString& name) const; - // returns true if an option taking a string value was found and stores the // value in the provided pointer bool Found(const wxString& name, wxString *value) const; @@ -248,10 +193,6 @@ public: // the value in the provided pointer bool Found(const wxString& name, long *value) const; - // returns true if an option taking a double value was found and stores - // the value in the provided pointer - bool Found(const wxString& name, double *value) const; - #if wxUSE_DATETIME // returns true if an option taking a date value was found and stores the // value in the provided pointer @@ -268,17 +209,18 @@ public: void Reset(); // break down the command line in arguments - static wxArrayString - ConvertStringToArgs(const wxString& cmdline, - wxCmdLineSplitType type = wxCMD_LINE_SPLIT_DOS); + static wxArrayString ConvertStringToArgs(const wxChar *cmdline); private: + // get usage string + wxString GetUsageString(); + // common part of all ctors void Init(); struct wxCmdLineParserData *m_data; - wxDECLARE_NO_COPY_CLASS(wxCmdLineParser); + DECLARE_NO_COPY_CLASS(wxCmdLineParser) }; #else // !wxUSE_CMDLINE_PARSER @@ -288,11 +230,10 @@ private: class WXDLLIMPEXP_BASE wxCmdLineParser { public: - static wxArrayString - ConvertStringToArgs(const wxString& cmdline, - wxCmdLineSplitType type = wxCMD_LINE_SPLIT_DOS); + static wxArrayString ConvertStringToArgs(const wxChar *cmdline); }; #endif // wxUSE_CMDLINE_PARSER/!wxUSE_CMDLINE_PARSER #endif // _WX_CMDLINE_H_ + diff --git a/Source/3rd Party/wx/include/wx/cmdproc.h b/Source/3rd Party/wx/include/wx/cmdproc.h index 2a93d9e05..930cad753 100644 --- a/Source/3rd Party/wx/include/wx/cmdproc.h +++ b/Source/3rd Party/wx/include/wx/cmdproc.h @@ -4,7 +4,7 @@ // Author: Julian Smart (extracted from docview.h by VZ) // Modified by: // Created: 05.11.00 -// RCS-ID: $Id$ +// RCS-ID: $Id: cmdproc.h 49804 2007-11-10 01:09:42Z VZ $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -22,7 +22,7 @@ class WXDLLIMPEXP_FWD_CORE wxMenu; // wxCommand: a single command capable of performing itself // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxCommand : public wxObject +class WXDLLEXPORT wxCommand : public wxObject { public: wxCommand(bool canUndoIt = false, const wxString& name = wxEmptyString); @@ -49,7 +49,7 @@ private: // wxCommandProcessor: wxCommand manager // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxCommandProcessor : public wxObject +class WXDLLEXPORT wxCommandProcessor : public wxObject { public: // if max number of commands is -1, it is unlimited @@ -97,7 +97,10 @@ public: virtual void ClearCommands(); // Has the current project been changed? - virtual bool IsDirty() const; + virtual bool IsDirty() const + { + return m_currentCommand && (m_lastSavedCommand != m_currentCommand); + } // Mark the current command as the one where the last save took place void MarkAsSaved() @@ -134,7 +137,7 @@ protected: private: DECLARE_DYNAMIC_CLASS(wxCommandProcessor) - wxDECLARE_NO_COPY_CLASS(wxCommandProcessor); + DECLARE_NO_COPY_CLASS(wxCommandProcessor) }; #endif // _WX_CMDPROC_H_ diff --git a/Source/3rd Party/wx/include/wx/cmndata.h b/Source/3rd Party/wx/include/wx/cmndata.h index 2db863158..a96c4ff72 100644 --- a/Source/3rd Party/wx/include/wx/cmndata.h +++ b/Source/3rd Party/wx/include/wx/cmndata.h @@ -4,7 +4,7 @@ // Author: Julian Smart and others // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: cmndata.h 53135 2008-04-12 02:31:04Z VZ $ // Copyright: (c) // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -12,18 +12,134 @@ #ifndef _WX_CMNDATA_H_BASE_ #define _WX_CMNDATA_H_BASE_ -#include "wx/defs.h" - -#if wxUSE_PRINTING_ARCHITECTURE - +#include "wx/window.h" +#include "wx/font.h" +#include "wx/encinfo.h" +#include "wx/colour.h" #include "wx/gdicmn.h" #if wxUSE_STREAMS #include "wx/stream.h" #endif + class WXDLLIMPEXP_FWD_CORE wxPrintNativeDataBase; + +class WXDLLEXPORT wxColourData: public wxObject +{ +public: + wxColourData(); + wxColourData(const wxColourData& data); + virtual ~wxColourData(); + + void SetChooseFull(bool flag) { m_chooseFull = flag; } + bool GetChooseFull() const { return m_chooseFull; } + void SetColour(const wxColour& colour) { m_dataColour = colour; } + const wxColour& GetColour() const { return m_dataColour; } + wxColour& GetColour() { return m_dataColour; } + + // Array of 16 custom colours + void SetCustomColour(int i, const wxColour& colour); + wxColour GetCustomColour(int i); + + void operator=(const wxColourData& data); + +public: + wxColour m_dataColour; + wxColour m_custColours[16]; + bool m_chooseFull; + +private: + DECLARE_DYNAMIC_CLASS(wxColourData) +}; + +class WXDLLEXPORT wxFontData : public wxObject +{ +public: + wxFontData(); + virtual ~wxFontData(); + + wxFontData(const wxFontData& data) + : wxObject(), + m_fontColour(data.m_fontColour), + m_showHelp(data.m_showHelp), + m_allowSymbols(data.m_allowSymbols), + m_enableEffects(data.m_enableEffects), + m_initialFont(data.m_initialFont), + m_chosenFont(data.m_chosenFont), + m_minSize(data.m_minSize), + m_maxSize(data.m_maxSize), + m_encoding(data.m_encoding), + m_encodingInfo(data.m_encodingInfo) + { + } + + wxFontData& operator=(const wxFontData& data) + { + wxObject::operator=(data); + m_fontColour = data.m_fontColour; + m_showHelp = data.m_showHelp; + m_allowSymbols = data.m_allowSymbols; + m_enableEffects = data.m_enableEffects; + m_initialFont = data.m_initialFont; + m_chosenFont = data.m_chosenFont; + m_minSize = data.m_minSize; + m_maxSize = data.m_maxSize; + m_encoding = data.m_encoding; + m_encodingInfo = data.m_encodingInfo; + return *this; + } + + void SetAllowSymbols(bool flag) { m_allowSymbols = flag; } + bool GetAllowSymbols() const { return m_allowSymbols; } + + void SetColour(const wxColour& colour) { m_fontColour = colour; } + const wxColour& GetColour() const { return m_fontColour; } + + void SetShowHelp(bool flag) { m_showHelp = flag; } + bool GetShowHelp() const { return m_showHelp; } + + void EnableEffects(bool flag) { m_enableEffects = flag; } + bool GetEnableEffects() const { return m_enableEffects; } + + void SetInitialFont(const wxFont& font) { m_initialFont = font; } + wxFont GetInitialFont() const { return m_initialFont; } + + void SetChosenFont(const wxFont& font) { m_chosenFont = font; } + wxFont GetChosenFont() const { return m_chosenFont; } + + void SetRange(int minRange, int maxRange) { m_minSize = minRange; m_maxSize = maxRange; } + + // encoding info is split into 2 parts: the logical wxWin encoding + // (wxFontEncoding) and a structure containing the native parameters for + // it (wxNativeEncodingInfo) + wxFontEncoding GetEncoding() const { return m_encoding; } + void SetEncoding(wxFontEncoding encoding) { m_encoding = encoding; } + + wxNativeEncodingInfo& EncodingInfo() { return m_encodingInfo; } + + + // public for backwards compatibility only: don't use directly +public: + wxColour m_fontColour; + bool m_showHelp; + bool m_allowSymbols; + bool m_enableEffects; + wxFont m_initialFont; + wxFont m_chosenFont; + int m_minSize; + int m_maxSize; + +private: + wxFontEncoding m_encoding; + wxNativeEncodingInfo m_encodingInfo; + +private: + DECLARE_DYNAMIC_CLASS(wxFontData) +}; + +#if wxUSE_PRINTING_ARCHITECTURE /* * wxPrintData * Encapsulates printer information (not printer dialog information) @@ -52,7 +168,7 @@ enum wxPrintBin const int wxPRINTMEDIA_DEFAULT = 0; -class WXDLLIMPEXP_CORE wxPrintData: public wxObject +class WXDLLEXPORT wxPrintData: public wxObject { public: wxPrintData(); @@ -61,7 +177,7 @@ public: int GetNoCopies() const { return m_printNoCopies; } bool GetCollate() const { return m_printCollate; } - wxPrintOrientation GetOrientation() const { return m_printOrientation; } + int GetOrientation() const { return m_printOrientation; } bool IsOrientationReversed() const { return m_printOrientationReversed; } // Is this data OK for showing the print dialog? @@ -81,11 +197,7 @@ public: void SetNoCopies(int v) { m_printNoCopies = v; } void SetCollate(bool flag) { m_printCollate = flag; } - - // Please use the overloaded method below - wxDEPRECATED_INLINE(void SetOrientation(int orient), - m_printOrientation = (wxPrintOrientation)orient; ) - void SetOrientation(wxPrintOrientation orient) { m_printOrientation = orient; } + void SetOrientation(int orient) { m_printOrientation = orient; } void SetOrientationReversed(bool reversed) { m_printOrientationReversed = reversed; } void SetPrinterName(const wxString& name) { m_printerName = name; } @@ -101,13 +213,36 @@ public: wxString GetFilename() const { return m_filename; } void SetFilename( const wxString &filename ) { m_filename = filename; } - wxPrintData& operator=(const wxPrintData& data); + void operator=(const wxPrintData& data); char* GetPrivData() const { return m_privData; } int GetPrivDataLen() const { return m_privDataLen; } void SetPrivData( char *privData, int len ); +#if WXWIN_COMPATIBILITY_2_4 + // PostScript-specific data + wxString GetPrinterCommand() const; + wxString GetPrinterOptions() const; + wxString GetPreviewCommand() const; + wxString GetFontMetricPath() const; + double GetPrinterScaleX() const; + double GetPrinterScaleY() const; + long GetPrinterTranslateX() const; + long GetPrinterTranslateY() const; + + void SetPrinterCommand(const wxString& command); + void SetPrinterOptions(const wxString& options); + void SetPreviewCommand(const wxString& command); + void SetFontMetricPath(const wxString& path); + void SetPrinterScaleX(double x); + void SetPrinterScaleY(double y); + void SetPrinterScaling(double x, double y); + void SetPrinterTranslateX(long x); + void SetPrinterTranslateY(long y); + void SetPrinterTranslation(long x, long y); +#endif + // Convert between wxPrintData and native data void ConvertToNative(); void ConvertFromNative(); @@ -120,7 +255,7 @@ private: wxPrintMode m_printMode; int m_printNoCopies; - wxPrintOrientation m_printOrientation; + int m_printOrientation; bool m_printOrientationReversed; bool m_printCollate; @@ -149,7 +284,7 @@ private: * from the dialog. */ -class WXDLLIMPEXP_CORE wxPrintDialogData: public wxObject +class WXDLLEXPORT wxPrintDialogData: public wxObject { public: wxPrintDialogData(); @@ -166,7 +301,9 @@ public: bool GetSelection() const { return m_printSelection; } bool GetCollate() const { return m_printCollate; } bool GetPrintToFile() const { return m_printToFile; } - +#if WXWIN_COMPATIBILITY_2_4 + bool GetSetupDialog() const { return m_printSetupDialog; } +#endif void SetFromPage(int v) { m_printFromPage = v; } void SetToPage(int v) { m_printToPage = v; } void SetMinPage(int v) { m_printMinPage = v; } @@ -176,7 +313,9 @@ public: void SetSelection(bool flag) { m_printSelection = flag; } void SetCollate(bool flag) { m_printCollate = flag; } void SetPrintToFile(bool flag) { m_printToFile = flag; } - +#if WXWIN_COMPATIBILITY_2_4 + void SetSetupDialog(bool flag) { m_printSetupDialog = flag; } +#endif void EnablePrintToFile(bool flag) { m_printEnablePrintToFile = flag; } void EnableSelection(bool flag) { m_printEnableSelection = flag; } void EnablePageNumbers(bool flag) { m_printEnablePageNumbers = flag; } @@ -189,7 +328,7 @@ public: // Is this data OK for showing the print dialog? bool Ok() const { return IsOk(); } - bool IsOk() const { return m_printData.IsOk() ; } + bool IsOk() const { return m_printData.Ok() ; } wxPrintData& GetPrintData() { return m_printData; } void SetPrintData(const wxPrintData& printData) { m_printData = printData; } @@ -211,6 +350,9 @@ private: bool m_printEnablePageNumbers; bool m_printEnableHelp; bool m_printEnablePrintToFile; +#if WXWIN_COMPATIBILITY_2_4 + bool m_printSetupDialog; +#endif wxPrintData m_printData; private: @@ -224,7 +366,7 @@ private: // Compatibility with old name #define wxPageSetupData wxPageSetupDialogData -class WXDLLIMPEXP_CORE wxPageSetupDialogData: public wxObject +class WXDLLEXPORT wxPageSetupDialogData: public wxObject { public: wxPageSetupDialogData(); @@ -249,7 +391,7 @@ public: // Is this data OK for showing the page setup dialog? bool Ok() const { return IsOk(); } - bool IsOk() const { return m_printData.IsOk() ; } + bool IsOk() const { return m_printData.Ok() ; } // If a corresponding paper type is found in the paper database, will set the m_printData // paper size id member as well. @@ -280,7 +422,7 @@ public: // Use paper id in wxPrintData to set this object's paper size void CalculatePaperSizeFromId(); - wxPageSetupDialogData& operator=(const wxPageSetupDialogData& data); + wxPageSetupDialogData& operator=(const wxPageSetupData& data); wxPageSetupDialogData& operator=(const wxPrintData& data); wxPrintData& GetPrintData() { return m_printData; } diff --git a/Source/3rd Party/wx/include/wx/collpane.h b/Source/3rd Party/wx/include/wx/collpane.h index bd67ad705..483d33b26 100644 --- a/Source/3rd Party/wx/include/wx/collpane.h +++ b/Source/3rd Party/wx/include/wx/collpane.h @@ -4,7 +4,7 @@ // Author: Francesco Montorsi // Modified by: // Created: 8/10/2006 -// RCS-ID: $Id$ +// RCS-ID: $Id: collpane.h 43300 2006-11-11 07:32:08Z RD $ // Copyright: (c) Francesco Montorsi // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// @@ -19,8 +19,6 @@ #include "wx/control.h" -// class name -extern WXDLLIMPEXP_DATA_CORE(const char) wxCollapsiblePaneNameStr[]; // ---------------------------------------------------------------------------- // wxCollapsiblePaneBase: interface for wxCollapsiblePane @@ -51,9 +49,9 @@ public: // event types and macros // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_FWD_CORE wxCollapsiblePaneEvent; - -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_COLLPANE_CHANGED, wxCollapsiblePaneEvent ); +BEGIN_DECLARE_EVENT_TYPES() + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_CORE, wxEVT_COMMAND_COLLPANE_CHANGED, 1102) +END_DECLARE_EVENT_TYPES() class WXDLLIMPEXP_CORE wxCollapsiblePaneEvent : public wxCommandEvent { @@ -86,13 +84,13 @@ private: typedef void (wxEvtHandler::*wxCollapsiblePaneEventFunction)(wxCollapsiblePaneEvent&); #define wxCollapsiblePaneEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxCollapsiblePaneEventFunction, func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxCollapsiblePaneEventFunction, &func) #define EVT_COLLAPSIBLEPANE_CHANGED(id, fn) \ wx__DECLARE_EVT1(wxEVT_COMMAND_COLLPANE_CHANGED, id, wxCollapsiblePaneEventHandler(fn)) -#if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__) +#if defined(__WXGTK24__) && !defined(__WXUNIVERSAL__) #include "wx/gtk/collpane.h" #else #include "wx/generic/collpaneg.h" diff --git a/Source/3rd Party/wx/include/wx/colordlg.h b/Source/3rd Party/wx/include/wx/colordlg.h index 19a3f3084..f17192078 100644 --- a/Source/3rd Party/wx/include/wx/colordlg.h +++ b/Source/3rd Party/wx/include/wx/colordlg.h @@ -1,10 +1,10 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/colordlg.h +// Name: wx/colrdlgg.h // Purpose: wxColourDialog // Author: Vadim Zeitiln // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: colordlg.h 36623 2006-01-02 14:26:36Z JS $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -16,14 +16,14 @@ #if wxUSE_COLOURDLG -#include "wx/colourdata.h" - #if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) #include "wx/msw/colordlg.h" #elif defined(__WXMAC__) && !defined(__WXUNIVERSAL__) - #include "wx/osx/colordlg.h" + #include "wx/mac/colordlg.h" #elif defined(__WXGTK20__) && !defined(__WXUNIVERSAL__) #include "wx/gtk/colordlg.h" +#elif defined(__WXPALMOS__) + #include "wx/palmos/colordlg.h" #else #include "wx/generic/colrdlgg.h" @@ -31,10 +31,9 @@ #endif // get the colour from user and return it -WXDLLIMPEXP_CORE wxColour wxGetColourFromUser(wxWindow *parent = NULL, - const wxColour& colInit = wxNullColour, - const wxString& caption = wxEmptyString, - wxColourData *data = NULL); +wxColour WXDLLEXPORT +wxGetColourFromUser(wxWindow *parent = (wxWindow *)NULL, + const wxColour& colInit = wxNullColour, const wxString& caption = wxEmptyString); #endif // wxUSE_COLOURDLG diff --git a/Source/3rd Party/wx/include/wx/colour.h b/Source/3rd Party/wx/include/wx/colour.h index da30f5a04..66c45e772 100644 --- a/Source/3rd Party/wx/include/wx/colour.h +++ b/Source/3rd Party/wx/include/wx/colour.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: Francesco Montorsi // Created: -// RCS-ID: $Id$ +// RCS-ID: $Id: colour.h 53135 2008-04-12 02:31:04Z VZ $ // Copyright: Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -15,46 +15,38 @@ #include "wx/defs.h" #include "wx/gdiobj.h" + class WXDLLIMPEXP_FWD_CORE wxColour; -// A macro to define the standard wxColour constructors: -// -// It avoids the need to repeat these lines across all colour.h files, since -// Set() is a virtual function and thus cannot be called by wxColourBase ctors +// the standard wxColour constructors; +// this macro avoids to repeat these lines across all colour.h files, since +// Set() is a virtual function and thus cannot be called by wxColourBase +// constructors #define DEFINE_STD_WXCOLOUR_CONSTRUCTORS \ - wxColour() { Init(); } \ - wxColour(ChannelType red, \ - ChannelType green, \ - ChannelType blue, \ - ChannelType alpha = wxALPHA_OPAQUE) \ - { Init(); Set(red, green, blue, alpha); } \ - wxColour(unsigned long colRGB) { Init(); Set(colRGB ); } \ - wxColour(const wxString& colourName) { Init(); Set(colourName); } \ - wxColour(const char *colourName) { Init(); Set(colourName); } \ - wxColour(const wchar_t *colourName) { Init(); Set(colourName); } + wxColour( ChannelType red, ChannelType green, ChannelType blue, \ + ChannelType alpha = wxALPHA_OPAQUE ) \ + { Set(red, green, blue, alpha); } \ + wxColour( unsigned long colRGB ) { Set(colRGB); } \ + wxColour(const wxString &colourName) { Set(colourName); } \ + wxColour(const wxChar *colourName) { Set(colourName); } // flags for wxColour -> wxString conversion (see wxColour::GetAsString) -enum { - wxC2S_NAME = 1, // return colour name, when possible - wxC2S_CSS_SYNTAX = 2, // return colour in rgb(r,g,b) syntax - wxC2S_HTML_SYNTAX = 4 // return colour in #rrggbb syntax -}; +#define wxC2S_NAME 1 // return colour name, when possible +#define wxC2S_CSS_SYNTAX 2 // return colour in rgb(r,g,b) syntax +#define wxC2S_HTML_SYNTAX 4 // return colour in #rrggbb syntax + const unsigned char wxALPHA_TRANSPARENT = 0; const unsigned char wxALPHA_OPAQUE = 0xff; -// a valid but fully transparent colour -#define wxTransparentColour wxColour(0, 0, 0, wxALPHA_TRANSPARENT) -#define wxTransparentColor wxTransparentColour - // ---------------------------------------------------------------------------- // wxVariant support // ---------------------------------------------------------------------------- #if wxUSE_VARIANT #include "wx/variant.h" -DECLARE_VARIANT_OBJECT_EXPORTED(wxColour,WXDLLIMPEXP_CORE) +DECLARE_VARIANT_OBJECT_EXPORTED(wxColour,WXDLLEXPORT) #endif //----------------------------------------------------------------------------- @@ -62,22 +54,7 @@ DECLARE_VARIANT_OBJECT_EXPORTED(wxColour,WXDLLIMPEXP_CORE) // code redundancy in all native wxColour implementations //----------------------------------------------------------------------------- -/* Transition from wxGDIObject to wxObject is incomplete. If your port does - not need the wxGDIObject machinery to handle colors, please add it to the - list of ports which do not need it. - */ -#if defined( __WXMAC__ ) || defined( __WXMSW__ ) || defined( __WXPM__ ) || defined( __WXCOCOA__ ) -#define wxCOLOUR_IS_GDIOBJECT 0 -#else -#define wxCOLOUR_IS_GDIOBJECT 1 -#endif - -class WXDLLIMPEXP_CORE wxColourBase : public -#if wxCOLOUR_IS_GDIOBJECT - wxGDIObject -#else - wxObject -#endif +class WXDLLEXPORT wxColourBase : public wxGDIObject { public: // type of a single colour component @@ -94,9 +71,12 @@ public: ChannelType green, ChannelType blue, ChannelType alpha = wxALPHA_OPAQUE) - { InitRGBA(red, green, blue, alpha); } + { InitRGBA(red,green,blue, alpha); } // implemented in colourcmn.cpp + bool Set(const wxChar *str) + { return FromString(str); } + bool Set(const wxString &str) { return FromString(str); } @@ -114,6 +94,9 @@ public: // accessors // --------- + virtual bool Ok() const { return IsOk(); } + virtual bool IsOk() const = 0; + virtual ChannelType Red() const = 0; virtual ChannelType Green() const = 0; virtual ChannelType Blue() const = 0; @@ -123,97 +106,28 @@ public: // implemented in colourcmn.cpp virtual wxString GetAsString(long flags = wxC2S_NAME | wxC2S_CSS_SYNTAX) const; - void SetRGB(wxUint32 colRGB) - { - Set((ChannelType)(0xFF & colRGB), - (ChannelType)(0xFF & (colRGB >> 8)), - (ChannelType)(0xFF & (colRGB >> 16))); - } - void SetRGBA(wxUint32 colRGBA) - { - Set((ChannelType)(0xFF & colRGBA), - (ChannelType)(0xFF & (colRGBA >> 8)), - (ChannelType)(0xFF & (colRGBA >> 16)), - (ChannelType)(0xFF & (colRGBA >> 24))); - } - - wxUint32 GetRGB() const - { return Red() | (Green() << 8) | (Blue() << 16); } - - wxUint32 GetRGBA() const - { return Red() | (Green() << 8) | (Blue() << 16) | (Alpha() << 24); } - -#if !wxCOLOUR_IS_GDIOBJECT - virtual bool IsOk() const= 0; - - // older version, for backwards compatibility only (but not deprecated - // because it's still widely used) - bool Ok() const { return IsOk(); } -#endif - - // manipulation - // ------------ - - // These methods are static because they are mostly used - // within tight loops (where we don't want to instantiate wxColour's) - - static void MakeMono (unsigned char* r, unsigned char* g, unsigned char* b, bool on); - static void MakeDisabled(unsigned char* r, unsigned char* g, unsigned char* b, unsigned char brightness = 255); - static void MakeGrey (unsigned char* r, unsigned char* g, unsigned char* b); // integer version - static void MakeGrey (unsigned char* r, unsigned char* g, unsigned char* b, - double weight_r, double weight_g, double weight_b); // floating point version - static unsigned char AlphaBlend (unsigned char fg, unsigned char bg, double alpha); - static void ChangeLightness(unsigned char* r, unsigned char* g, unsigned char* b, int ialpha); - - wxColour ChangeLightness(int ialpha) const; // old, deprecated // --------------- #if WXWIN_COMPATIBILITY_2_6 - static wxDEPRECATED( wxColour CreateByName(const wxString& name) ); + wxDEPRECATED( static wxColour CreateByName(const wxString& name) ); wxDEPRECATED( void InitFromName(const wxString& col) ); #endif protected: - // Some ports need Init() and while we don't, provide a stub so that the - // ports which don't need it are not forced to define it - void Init() { } - virtual void InitRGBA(ChannelType r, ChannelType g, ChannelType b, ChannelType a) = 0; - virtual bool FromString(const wxString& s); - -#if wxCOLOUR_IS_GDIOBJECT - // wxColour doesn't use reference counted data (at least not in all ports) - // so provide stubs for the functions which need to be defined if we do use - // them - virtual wxGDIRefData *CreateGDIRefData() const - { - wxFAIL_MSG( "must be overridden if used" ); - - return NULL; - } - - virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *WXUNUSED(data)) const - { - wxFAIL_MSG( "must be overridden if used" ); - - return NULL; - } -#endif + virtual bool FromString(const wxChar *s); }; -// wxColour <-> wxString utilities, used by wxConfig, defined in colourcmn.cpp -WXDLLIMPEXP_CORE wxString wxToString(const wxColourBase& col); -WXDLLIMPEXP_CORE bool wxFromString(const wxString& str, wxColourBase* col); - - -#if defined(__WXMSW__) +#if defined(__WXPALMOS__) + #include "wx/generic/colour.h" +#elif defined(__WXMSW__) #include "wx/msw/colour.h" #elif defined(__WXMOTIF__) #include "wx/motif/colour.h" @@ -221,12 +135,14 @@ WXDLLIMPEXP_CORE bool wxFromString(const wxString& str, wxColourBase* col); #include "wx/gtk/colour.h" #elif defined(__WXGTK__) #include "wx/gtk1/colour.h" +#elif defined(__WXMGL__) + #include "wx/generic/colour.h" #elif defined(__WXDFB__) #include "wx/generic/colour.h" #elif defined(__WXX11__) #include "wx/x11/colour.h" #elif defined(__WXMAC__) - #include "wx/osx/colour.h" + #include "wx/mac/colour.h" #elif defined(__WXCOCOA__) #include "wx/cocoa/colour.h" #elif defined(__WXPM__) diff --git a/Source/3rd Party/wx/include/wx/colourdata.h b/Source/3rd Party/wx/include/wx/colourdata.h deleted file mode 100644 index a3a03d0ab..000000000 --- a/Source/3rd Party/wx/include/wx/colourdata.h +++ /dev/null @@ -1,52 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/colourdata.h -// Author: Julian Smart -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_COLOURDATA_H_ -#define _WX_COLOURDATA_H_ - -#include "wx/colour.h" - -class WXDLLIMPEXP_CORE wxColourData : public wxObject -{ -public: - // number of custom colours we store - enum - { - NUM_CUSTOM = 16 - }; - - wxColourData(); - wxColourData(const wxColourData& data); - wxColourData& operator=(const wxColourData& data); - virtual ~wxColourData(); - - void SetChooseFull(bool flag) { m_chooseFull = flag; } - bool GetChooseFull() const { return m_chooseFull; } - void SetColour(const wxColour& colour) { m_dataColour = colour; } - const wxColour& GetColour() const { return m_dataColour; } - wxColour& GetColour() { return m_dataColour; } - - // SetCustomColour() modifies colours in an internal array of NUM_CUSTOM - // custom colours; - void SetCustomColour(int i, const wxColour& colour); - wxColour GetCustomColour(int i) const; - - // Serialize the object to a string and restore it from it - wxString ToString() const; - bool FromString(const wxString& str); - - - // public for backwards compatibility only: don't use directly - wxColour m_dataColour; - wxColour m_custColours[NUM_CUSTOM]; - bool m_chooseFull; - - DECLARE_DYNAMIC_CLASS(wxColourData) -}; - -#endif // _WX_COLOURDATA_H_ diff --git a/Source/3rd Party/wx/include/wx/combo.h b/Source/3rd Party/wx/include/wx/combo.h index 6b1a76344..2e5593d72 100644 --- a/Source/3rd Party/wx/include/wx/combo.h +++ b/Source/3rd Party/wx/include/wx/combo.h @@ -4,7 +4,7 @@ // Author: Jaakko Salli // Modified by: // Created: Apr-30-2006 -// RCS-ID: $Id$ +// RCS-ID: $Id: combo.h 64412 2010-05-27 15:11:58Z JMS $ // Copyright: (c) Jaakko Salli // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -45,7 +45,6 @@ #include "wx/control.h" #include "wx/renderer.h" // this is needed for wxCONTROL_XXX flags #include "wx/bitmap.h" // wxBitmap used by-value -#include "wx/textentry.h" class WXDLLIMPEXP_FWD_CORE wxTextCtrl; class WXDLLIMPEXP_FWD_CORE wxComboPopup; @@ -87,8 +86,8 @@ enum wxCC_IFLAG_CREATED = 0x0100, // Internal use: really put button outside wxCC_IFLAG_BUTTON_OUTSIDE = 0x0200, - // Internal use: SetMargins has been successfully called - wxCC_IFLAG_LEFT_MARGIN_SET = 0x0400, + // Internal use: SetTextIndent has been called + wxCC_IFLAG_INDENT_SET = 0x0400, // Internal use: Set wxTAB_TRAVERSAL to parent when popup is dismissed wxCC_IFLAG_PARENT_TAB_TRAVERSAL = 0x0800, // Internal use: Secondary popup window type should be used (if available). @@ -120,8 +119,7 @@ struct wxComboCtrlFeatures BitmapButton = 0x0002, // Button may be replaced with bitmap ButtonSpacing = 0x0004, // Button can have spacing from the edge // of the control - TextIndent = 0x0008, // SetMargins can be used to control - // left margin. + TextIndent = 0x0008, // SetTextIndent can be used PaintControl = 0x0010, // Combo control itself can be custom painted PaintWritable = 0x0020, // A variable-width area in front of writable // combo control's textctrl can be custom @@ -140,14 +138,12 @@ struct wxComboCtrlFeatures }; -class WXDLLIMPEXP_CORE wxComboCtrlBase : public wxControl, - public wxTextEntry +class WXDLLEXPORT wxComboCtrlBase : public wxControl { friend class wxComboPopup; - friend class wxComboPopupEvtHandler; public: // ctors and such - wxComboCtrlBase() : wxControl(), wxTextEntry() { Init(); } + wxComboCtrlBase() : wxControl() { Init(); } bool Create(wxWindow *parent, wxWindowID id, @@ -160,19 +156,9 @@ public: virtual ~wxComboCtrlBase(); - // Show/hide popup window (wxComboBox-compatible methods) - virtual void Popup(); - virtual void Dismiss() - { - HidePopup(true); - } - - // Show/hide popup window. - // TODO: Maybe deprecate in favor of Popup()/Dismiss(). - // However, these functions are still called internally - // so it is not straightforward. + // show/hide popup window virtual void ShowPopup(); - virtual void HidePopup(bool generateEvent=false); + virtual void HidePopup(); // Override for totally custom combo action virtual void OnButtonClick(); @@ -208,56 +194,26 @@ public: virtual bool Enable(bool enable = true); virtual bool Show(bool show = true); virtual bool SetFont(const wxFont& font); +#if wxUSE_VALIDATORS + virtual void SetValidator(const wxValidator &validator); + virtual wxValidator *GetValidator(); +#endif // wxUSE_VALIDATORS - // - // wxTextEntry methods - // - // NB: We basically need to override all of them because there is - // no guarantee how platform-specific wxTextEntry is implemented. - // - virtual void SetValue(const wxString& value) - { wxTextEntryBase::SetValue(value); } - virtual void ChangeValue(const wxString& value) - { wxTextEntryBase::ChangeValue(value); } - - virtual void WriteText(const wxString& text); - virtual void AppendText(const wxString& text) - { wxTextEntryBase::AppendText(text); } - - virtual wxString GetValue() const - { return wxTextEntryBase::GetValue(); } - - virtual wxString GetRange(long from, long to) const - { return wxTextEntryBase::GetRange(from, to); } - - // Replace() and DoSetValue() need to be fully re-implemented since - // EventSuppressor utility class does not work with the way - // wxComboCtrl is implemented. - virtual void Replace(long from, long to, const wxString& value); - - virtual void Remove(long from, long to); - + // wxTextCtrl methods - for readonly combo they should return + // without errors. + virtual wxString GetValue() const; + virtual void SetValue(const wxString& value); virtual void Copy(); virtual void Cut(); virtual void Paste(); - - virtual void Undo(); - virtual void Redo(); - virtual bool CanUndo() const; - virtual bool CanRedo() const; - virtual void SetInsertionPoint(long pos); + virtual void SetInsertionPointEnd(); virtual long GetInsertionPoint() const; virtual long GetLastPosition() const; - + virtual void Replace(long from, long to, const wxString& value); + virtual void Remove(long from, long to); virtual void SetSelection(long from, long to); - virtual void GetSelection(long *from, long *to) const; - - virtual bool IsEditable() const; - virtual void SetEditable(bool editable); - - virtual bool SetHint(const wxString& hint); - virtual wxString GetHint() const; + virtual void Undo(); // This method sets the text without affecting list selection // (ie. wxComboPopup::SetStringValue doesn't get called). @@ -265,13 +221,7 @@ public: // This method sets value and also optionally sends EVT_TEXT // (needed by combo popups) - wxDEPRECATED( void SetValueWithEvent(const wxString& value, - bool withEvent = true) ); - - // Changes value of the control as if user had done it by selecting an - // item from a combo box drop-down list. Needs to be public so that - // derived popup classes can call it. - void SetValueByUser(const wxString& value); + void SetValueWithEvent(const wxString& value, bool withEvent = true); // // Popup customization methods @@ -353,18 +303,19 @@ public: const wxBitmap& bmpHover = wxNullBitmap, const wxBitmap& bmpDisabled = wxNullBitmap ); -#if WXWIN_COMPATIBILITY_2_8 // // This will set the space in pixels between left edge of the control and the // text, regardless whether control is read-only (ie. no wxTextCtrl) or not. // Platform-specific default can be set with value-1. // Remarks // * This method may do nothing on some native implementations. - wxDEPRECATED( void SetTextIndent( int indent ) ); + void SetTextIndent( int indent ); // Returns actual indentation in pixels. - wxDEPRECATED( wxCoord GetTextIndent() const ); -#endif + wxCoord GetTextIndent() const + { + return m_absIndent; + } // Returns area covered by the text field. const wxRect& GetTextRect() const @@ -435,21 +386,14 @@ public: const wxBitmap& GetBitmapHover() const { return m_bmpHover; } const wxBitmap& GetBitmapDisabled() const { return m_bmpDisabled; } - // Set custom style flags for embedded wxTextCtrl. Usually must be used - // with two-step creation, before Create() call. - void SetTextCtrlStyle( int style ); - // Return internal flags wxUint32 GetInternalFlags() const { return m_iFlags; } // Return true if Create has finished bool IsCreated() const { return m_iFlags & wxCC_IFLAG_CREATED ? true : false; } - // Need to override to return text area background colour - wxColour GetBackgroundColour() const; - // common code to be called on popup hide/dismiss - void OnPopupDismiss(bool generateEvent); + void OnPopupDismiss(); // PopupShown states enum @@ -467,22 +411,8 @@ public: // Set value returned by GetMainWindowOfCompositeControl void SetCtrlMainWnd( wxWindow* wnd ) { m_mainCtrlWnd = wnd; } - // This is public so we can access it from wxComboCtrlTextCtrl - virtual wxWindow *GetMainWindowOfCompositeControl() - { return m_mainCtrlWnd; } - protected: - // Returns true if hint text should be drawn in the control - bool ShouldUseHintText(int flags = 0) const - { - return ( !m_text && - !(flags & wxCONTROL_ISSUBMENU) && - !m_valueString.length() && - m_hintText.length() && - !ShouldDrawFocus() ); - } - // // Override these for customization purposes // @@ -490,8 +420,7 @@ protected: // called from wxSizeEvent handler virtual void OnResize() = 0; - // Return native text identation - // (i.e. text margin, for pure text, not textctrl) + // Return native text identation (for pure text, not textctrl) virtual wxCoord GetNativeTextIndent() const; // Called in syscolourchanged handler and base create @@ -499,25 +428,20 @@ protected: // Creates wxTextCtrl. // extraStyle: Extra style parameters - void CreateTextCtrl( int extraStyle ); - - // Called when text was changed programmatically - // (e.g. from WriteText()) - void OnSetValue(const wxString& value); + void CreateTextCtrl( int extraStyle, const wxValidator& validator ); // Installs standard input handler to combo (and optionally to the textctrl) void InstallInputHandlers(); - // Flags for DrawButton + // flags for DrawButton() enum { - Button_PaintBackground = 0x0001, // Paints control background below the button - Button_BitmapOnly = 0x0002 // Only paints the bitmap + Draw_PaintBg = 1, + Draw_BitmapOnly = 2 }; // Draws dropbutton. Using wxRenderer or bitmaps, as appropriate. - // Flags are defined above. - virtual void DrawButton( wxDC& dc, const wxRect& rect, int flags = Button_PaintBackground ); + void DrawButton( wxDC& dc, const wxRect& rect, int flags = Draw_PaintBg ); // Call if cursor is on button area or mouse is captured for the button. //bool HandleButtonMouseEvent( wxMouseEvent& event, bool isInside ); @@ -543,10 +467,6 @@ protected: // override the base class virtuals involved in geometry calculations virtual wxSize DoGetBestSize() const; - // also set the embedded wxTextCtrl colours - virtual bool SetForegroundColour(const wxColour& colour); - virtual bool SetBackgroundColour(const wxColour& colour); - // NULL popup can be used to indicate default in a derived class virtual void DoSetPopupControl(wxComboPopup* popup); @@ -560,8 +480,7 @@ protected: // Standard textctrl positioning routine. Just give it platform-dependant // textctrl coordinate adjustment. - virtual void PositionTextCtrl( int textCtrlXAdjust = 0, - int textCtrlYAdjust = 0); + void PositionTextCtrl( int textCtrlXAdjust, int textCtrlYAdjust ); // event handlers void OnSizeEvent( wxSizeEvent& event ); @@ -570,7 +489,6 @@ protected: void OnTextCtrlEvent(wxCommandEvent& event); void OnSysColourChanged(wxSysColourChangedEvent& event); void OnKeyEvent(wxKeyEvent& event); - void OnCharEvent(wxKeyEvent& event); // Set customization flags (directs how wxComboCtrlBase helpers behave) void Customize( wxUint32 flags ) { m_iFlags |= flags; } @@ -599,21 +517,12 @@ protected: virtual void DoSetToolTip( wxToolTip *tip ); #endif - // protected wxTextEntry methods - virtual void DoSetValue(const wxString& value, int flags); - virtual wxString DoGetValue() const; - virtual wxWindow *GetEditableWindow() { return this; } - - // margins functions - virtual bool DoSetMargins(const wxPoint& pt); - virtual wxPoint DoGetMargins() const; + virtual wxWindow *GetMainWindowOfCompositeControl() + { return m_mainCtrlWnd; } // This is used when m_text is hidden (readonly). wxString m_valueString; - // This is used when control is unfocused and m_valueString is empty - wxString m_hintText; - // the text control and button we show all the time wxTextCtrl* m_text; wxWindow* m_btn; @@ -634,7 +543,7 @@ protected: wxEvtHandler* m_toplevEvtHandler; // this is for the control in popup - wxEvtHandler* m_popupEvtHandler; + wxEvtHandler* m_popupExtraHandler; // this is for the popup window wxEvtHandler* m_popupWinEvtHandler; @@ -642,7 +551,7 @@ protected: // main (ie. topmost) window of a composite control (default = this) wxWindow* m_mainCtrlWnd; - // used to prevent immediate re-popupping in case closed popup + // used to prevent immediate re-popupping incase closed popup // by clicking on the combo control (needed because of inconsistent // transient implementation across platforms). wxLongLong m_timeCanAcceptClick; @@ -662,8 +571,8 @@ protected: // selection indicator. wxCoord m_widthCustomPaint; - // left margin, in pixels - wxCoord m_marginLeft; + // absolute text indentation, in pixels + wxCoord m_absIndent; // side on which the popup is aligned int m_anchorSide; @@ -675,9 +584,6 @@ protected: wxRect m_tcArea; wxRect m_btnArea; - // Colour of the text area, in case m_text is NULL - wxColour m_tcBgCol; - // current button state (uses renderer flags) int m_btnState; @@ -702,9 +608,6 @@ protected: // platform-dependant customization and other flags wxUint32 m_iFlags; - // custom style for m_text - int m_textCtrlStyle; - // draw blank button background under bitmap? bool m_blankButtonBg; @@ -713,10 +616,7 @@ protected: // should the focus be reset to the textctrl in idle time? bool m_resetFocus; - - // is the text-area background colour overridden? - bool m_hasTcBgCol; - + private: void Init(); @@ -743,16 +643,14 @@ enum wxCP_IFLAG_CREATED = 0x0001 // Set by wxComboCtrlBase after Create is called }; -class WXDLLIMPEXP_FWD_CORE wxComboCtrl; - -class WXDLLIMPEXP_CORE wxComboPopup +class WXDLLEXPORT wxComboPopup { friend class wxComboCtrlBase; public: wxComboPopup() { - m_combo = NULL; + m_combo = (wxComboCtrlBase*) NULL; m_iFlags = 0; } @@ -768,13 +666,6 @@ public: // Return true for success. virtual bool Create(wxWindow* parent) = 0; - // Calls Destroy() for the popup control (i.e. one returned by - // GetControl()) and makes sure that 'this' is deleted at the end. - // Default implementation works for both cases where popup control - // class is multiple inherited or created on heap as a separate - // object. - virtual void DestroyPopup(); - // We must have an associated control which is subclassed by the combobox. virtual wxWindow *GetControl() = 0; @@ -791,25 +682,14 @@ public: // Gets displayed string representation of the value. virtual wxString GetStringValue() const = 0; - // Called to check if the popup - when an item container - actually - // has matching item. Case-sensitivity checking etc. is up to the - // implementation. If the found item matched the string, but is - // different, it should be written back to pItem. Default implementation - // always return true and does not alter trueItem. - virtual bool FindItem(const wxString& item, wxString* trueItem=NULL); - // This is called to custom paint in the combo control itself (ie. not the popup). // Default implementation draws value as string. virtual void PaintComboControl( wxDC& dc, const wxRect& rect ); - // Receives wxEVT_KEY_DOWN key events from the parent wxComboCtrl. + // Receives key events from the parent wxComboCtrl. // Events not handled should be skipped, as usual. virtual void OnComboKeyEvent( wxKeyEvent& event ); - // Receives wxEVT_CHAR key events from the parent wxComboCtrl. - // Events not handled should be skipped, as usual. - virtual void OnComboCharEvent( wxKeyEvent& event ); - // Implement if you need to support special action when user // double-clicks on the parent wxComboCtrl. virtual void OnComboDoubleClick(); @@ -840,9 +720,6 @@ public: return (m_iFlags & wxCP_IFLAG_CREATED) ? true : false; } - // Returns pointer to the associated parent wxComboCtrl. - wxComboCtrl* GetComboCtrl() const; - // Default PaintComboControl behaviour static void DefaultPaintComboControl( wxComboCtrlBase* combo, wxDC& dc, diff --git a/Source/3rd Party/wx/include/wx/combobox.h b/Source/3rd Party/wx/include/wx/combobox.h index 89b9c1357..af84fb668 100644 --- a/Source/3rd Party/wx/include/wx/combobox.h +++ b/Source/3rd Party/wx/include/wx/combobox.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 24.12.00 -// RCS-ID: $Id$ +// RCS-ID: $Id: combobox.h 42727 2006-10-30 16:04:27Z VZ $ // Copyright: (c) 1996-2000 wxWidgets team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -16,54 +16,57 @@ #if wxUSE_COMBOBOX -// For compatibility with 2.8 include this header to allow using wxTE_XXX -// styles with wxComboBox without explicitly including it in the user code. -#include "wx/textctrl.h" - -extern WXDLLIMPEXP_DATA_CORE(const char) wxComboBoxNameStr[]; +extern WXDLLEXPORT_DATA(const wxChar) wxComboBoxNameStr[]; // ---------------------------------------------------------------------------- // wxComboBoxBase: this interface defines the methods wxComboBox must implement // ---------------------------------------------------------------------------- +#include "wx/textctrl.h" #include "wx/ctrlsub.h" -#include "wx/textentry.h" -class WXDLLIMPEXP_CORE wxComboBoxBase : public wxItemContainer, - public wxTextEntry +class WXDLLEXPORT wxComboBoxBase : public wxItemContainer { public: - // override these methods to disambiguate between two base classes versions - virtual void Clear() - { - wxTextEntry::Clear(); - wxItemContainer::Clear(); - } + // wxTextCtrl-like methods wxComboBox must implement + virtual wxString GetValue() const = 0; + virtual void SetValue(const wxString& value) = 0; - // IsEmpty() is ambiguous because we inherit it from both wxItemContainer - // and wxTextEntry, and even if defined it here to help the compiler with - // choosing one of them, it would still be confusing for the human users of - // this class. So instead define the clearly named methods below and leave - // IsEmpty() ambiguous to trigger a compilation error if it's used. - bool IsListEmpty() const { return wxItemContainer::IsEmpty(); } - bool IsTextEmpty() const { return wxTextEntry::IsEmpty(); } + virtual void Copy() = 0; + virtual void Cut() = 0; + virtual void Paste() = 0; + virtual void SetInsertionPoint(long pos) = 0; + virtual long GetInsertionPoint() const = 0; + virtual wxTextPos GetLastPosition() const = 0; + virtual void Replace(long from, long to, const wxString& value) = 0; + virtual void SetSelection(long from, long to) = 0; + virtual void SetEditable(bool editable) = 0; - // also bring in GetSelection() versions of both base classes in scope - // - // NB: GetSelection(from, to) could be already implemented in wxTextEntry - // but still make it pure virtual because for some platforms it's not - // implemented there and also because the derived class has to override - // it anyhow to avoid ambiguity with the other GetSelection() - virtual int GetSelection() const = 0; - virtual void GetSelection(long *from, long *to) const = 0; + virtual void SetInsertionPointEnd() + { SetInsertionPoint(GetLastPosition()); } + virtual void Remove(long from, long to) + { Replace(from, to, wxEmptyString); } - virtual void Popup() { wxFAIL_MSG( wxT("Not implemented") ); } - virtual void Dismiss() { wxFAIL_MSG( wxT("Not implemented") ); } + virtual bool IsEditable() const = 0; + + virtual void Undo() = 0; + virtual void Redo() = 0; + virtual void SelectAll() = 0; + + virtual bool CanCopy() const = 0; + virtual bool CanCut() const = 0; + virtual bool CanPaste() const = 0; + virtual bool CanUndo() const = 0; + virtual bool CanRedo() const = 0; // may return value different from GetSelection() when the combobox // dropdown is shown and the user selected, but not yet accepted, a value // different from the old one in it virtual int GetCurrentSelection() const { return GetSelection(); } + + // redeclare inherited SetSelection() overload here as well to avoid + // virtual function hiding + virtual void SetSelection(int n) = 0; }; // ---------------------------------------------------------------------------- @@ -81,7 +84,7 @@ public: #elif defined(__WXGTK__) #include "wx/gtk1/combobox.h" #elif defined(__WXMAC__) - #include "wx/osx/combobox.h" + #include "wx/mac/combobox.h" #elif defined(__WXCOCOA__) #include "wx/cocoa/combobox.h" #elif defined(__WXPM__) @@ -90,4 +93,5 @@ public: #endif // wxUSE_COMBOBOX -#endif // _WX_COMBOBOX_H_BASE_ +#endif + // _WX_COMBOBOX_H_BASE_ diff --git a/Source/3rd Party/wx/include/wx/compositewin.h b/Source/3rd Party/wx/include/wx/compositewin.h deleted file mode 100644 index dc8ea0e9d..000000000 --- a/Source/3rd Party/wx/include/wx/compositewin.h +++ /dev/null @@ -1,230 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/compositewin.h -// Purpose: wxCompositeWindow<> declaration -// Author: Vadim Zeitlin -// Created: 2011-01-02 -// RCS-ID: $Id$ -// Copyright: (c) 2011 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_COMPOSITEWIN_H_ -#define _WX_COMPOSITEWIN_H_ - -#include "wx/window.h" -#include "wx/containr.h" - -class WXDLLIMPEXP_FWD_CORE wxToolTip; - -// NB: This is an experimental and, as for now, undocumented class used only by -// wxWidgets itself internally. Don't use it in your code until its API is -// officially stabilized unless you are ready to change it with the next -// wxWidgets release. - -// ---------------------------------------------------------------------------- -// wxCompositeWindow is a helper for implementing composite windows: to define -// a class using subwindows, simply inherit from it specialized with the real -// base class name and implement GetCompositeWindowParts() pure virtual method. -// ---------------------------------------------------------------------------- - -// The template parameter W must be a wxWindow-derived class. -template -class wxCompositeWindow : public W -{ -public: - typedef W BaseWindowClass; - - // Default ctor doesn't do anything. - wxCompositeWindow() - { - this->Connect - ( - wxEVT_CREATE, - wxWindowCreateEventHandler(wxCompositeWindow::OnWindowCreate) - ); - - } - -#ifndef __VISUALC6__ - // FIXME-VC6: This compiler can't compile DoSetForAllParts() template function, - // it can't determine whether the deduced type should be "T" or "const T&". And - // without this function wxCompositeWindow is pretty useless so simply disable - // this code for it, this does mean that setting colours/fonts/... for - // composite controls won't work in the library compiled with it but so far - // this only affects the generic wxDatePickerCtrl which is not used by default - // under MSW anyhow so it doesn't seem to be worth it to spend time and uglify - // the code to fix it. - - // Override all wxWindow methods which must be forwarded to the composite - // window parts. - - // Attribute setters group. - // - // NB: Unfortunately we can't factor out the call for the setter itself - // into DoSetForAllParts() because we can't call the function passed to - // it non-virtually and we need to do this to avoid infinite recursion, - // so we work around this by calling the method of this object itself - // manually in each function. - virtual bool SetForegroundColour(const wxColour& colour) - { - if ( !BaseWindowClass::SetForegroundColour(colour) ) - return false; - - SetForAllParts(&wxWindowBase::SetForegroundColour, colour); - - return true; - } - - virtual bool SetBackgroundColour(const wxColour& colour) - { - if ( !BaseWindowClass::SetBackgroundColour(colour) ) - return false; - - SetForAllParts(&wxWindowBase::SetBackgroundColour, colour); - - return true; - } - - virtual bool SetFont(const wxFont& font) - { - if ( !BaseWindowClass::SetFont(font) ) - return false; - - SetForAllParts(&wxWindowBase::SetFont, font); - - return true; - } - - virtual bool SetCursor(const wxCursor& cursor) - { - if ( !BaseWindowClass::SetCursor(cursor) ) - return false; - - SetForAllParts(&wxWindowBase::SetCursor, cursor); - - return true; - } - -#if wxUSE_TOOLTIPS - virtual void DoSetToolTip(wxToolTip *tip) - { - BaseWindowClass::DoSetToolTip(tip); - - SetForAllParts(&wxWindowBase::CopyToolTip, tip); - } -#endif // wxUSE_TOOLTIPS - -#endif // !__VISUALC6__ - - virtual void SetFocus() - { - wxSetFocusToChild(this, NULL); - } - -private: - // Must be implemented by the derived class to return all children to which - // the public methods we override should forward to. - virtual wxWindowList GetCompositeWindowParts() const = 0; - - void OnWindowCreate(wxWindowCreateEvent& event) - { - event.Skip(); - - // Attach a few event handlers to all parts of the composite window. - // This makes the composite window behave more like a simple control - // and allows other code (such as wxDataViewCtrl's inline editing - // support) to hook into its event processing. - - wxWindow *child = event.GetWindow(); - if ( child == this ) - return; // not a child, we don't want to Connect() to ourselves - - // Always capture wxEVT_KILL_FOCUS: - child->Connect(wxEVT_KILL_FOCUS, - wxFocusEventHandler(wxCompositeWindow::OnKillFocus), - NULL, this); - - // Some events should be only handled for non-toplevel children. For - // example, we want to close the control in wxDataViewCtrl when Enter - // is pressed in the inline editor, but not when it's pressed in a - // popup dialog it opens. - wxWindow *win = child; - while ( win && win != this ) - { - if ( win->IsTopLevel() ) - return; - win = win->GetParent(); - } - - child->Connect(wxEVT_CHAR, - wxKeyEventHandler(wxCompositeWindow::OnChar), - NULL, this); - } - - void OnChar(wxKeyEvent& event) - { - if ( !this->ProcessWindowEvent(event) ) - event.Skip(); - } - - void OnKillFocus(wxFocusEvent& event) - { - // Ignore focus changes within the composite control: - wxWindow *win = event.GetWindow(); - while ( win ) - { - if ( win == this ) - { - event.Skip(); - return; - } - - // Note that we don't use IsTopLevel() check here, because we do - // want to ignore focus changes going to toplevel window that have - // the composite control as its parent; these would typically be - // some kind of control's popup window. - win = win->GetParent(); - } - - // The event shouldn't be ignored, forward it to the main control: - if ( !this->ProcessWindowEvent(event) ) - event.Skip(); - } - -#ifndef __VISUALC6__ - template - void SetForAllParts(bool (wxWindowBase::*func)(const T&), const T& arg) - { - DoSetForAllParts(func, arg); - } - - template - void SetForAllParts(bool (wxWindowBase::*func)(T*), T* arg) - { - DoSetForAllParts(func, arg); - } - - template - void DoSetForAllParts(bool (wxWindowBase::*func)(T), T arg) - { - // Simply call the setters for all parts of this composite window. - const wxWindowList parts = GetCompositeWindowParts(); - for ( wxWindowList::const_iterator i = parts.begin(); - i != parts.end(); - ++i ) - { - wxWindow * const child = *i; - - // Allow NULL elements in the list, this makes the code of derived - // composite controls which may have optionally shown children - // simpler and it doesn't cost us much here. - if ( child ) - (child->*func)(arg); - } - } -#endif // !__VISUALC6__ - - wxDECLARE_NO_COPY_TEMPLATE_CLASS(wxCompositeWindow, W); -}; - -#endif // _WX_COMPOSITEWIN_H_ diff --git a/Source/3rd Party/wx/include/wx/confbase.h b/Source/3rd Party/wx/include/wx/confbase.h index 2e17338bc..2e0197dce 100644 --- a/Source/3rd Party/wx/include/wx/confbase.h +++ b/Source/3rd Party/wx/include/wx/confbase.h @@ -1,23 +1,21 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: wx/confbase.h +// Name: confbase.h // Purpose: declaration of the base class of all config implementations // (see also: fileconf.h and msw/regconf.h and iniconf.h) // Author: Karsten Ballueder & Vadim Zeitlin // Modified by: // Created: 07.04.98 (adapted from appconf.h) -// RCS-ID: $Id$ +// RCS-ID: $Id: confbase.h 61872 2009-09-09 22:37:05Z VZ $ // Copyright: (c) 1997 Karsten Ballueder Ballueder@usa.net // Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// -#ifndef _WX_CONFBASE_H_ -#define _WX_CONFBASE_H_ +#ifndef _WX_CONFBASE_H_ +#define _WX_CONFBASE_H_ #include "wx/defs.h" #include "wx/string.h" -#include "wx/object.h" -#include "wx/base64.h" class WXDLLIMPEXP_FWD_BASE wxArrayString; @@ -43,6 +41,8 @@ class WXDLLIMPEXP_FWD_BASE wxArrayString; #if wxUSE_CONFIG +#include "wx/string.h" + /// should we use registry instead of configuration files under Windows? // (i.e. whether wxConfigBase::Create() will create a wxFileConfig (if it's // false) or wxRegConfig (if it's true and we're under Win32)) @@ -50,15 +50,6 @@ class WXDLLIMPEXP_FWD_BASE wxArrayString; #define wxUSE_CONFIG_NATIVE 1 #endif -// not all compilers can deal with template Read/Write() methods, define this -// symbol if the template functions are available -#if (!defined(__VISUALC__) || __VISUALC__ > 1200) && \ - !defined( __VMS ) && \ - !(defined(__HP_aCC) && defined(__hppa)) && \ - !defined (__DMC__) - #define wxHAS_CONFIG_TEMPLATE_RW -#endif - // Style flags for constructor style parameter enum { @@ -81,7 +72,7 @@ enum // (long) type (TODO doubles and other types such as wxDate coming soon). // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_BASE wxConfigBase : public wxObject +class WXDLLIMPEXP_BASE wxConfigBase { public: // constants @@ -173,7 +164,7 @@ public: bool Read(const wxString& key, long *pl) const; bool Read(const wxString& key, long *pl, long defVal) const; - // read an int (wrapper around `long' version) + // read an int bool Read(const wxString& key, int *pi) const; bool Read(const wxString& key, int *pi, int defVal) const; @@ -181,138 +172,39 @@ public: bool Read(const wxString& key, double* val) const; bool Read(const wxString& key, double* val, double defVal) const; - // read a float - bool Read(const wxString& key, float* val) const; - bool Read(const wxString& key, float* val, float defVal) const; - // read a bool bool Read(const wxString& key, bool* val) const; bool Read(const wxString& key, bool* val, bool defVal) const; -#if wxUSE_BASE64 - // read a binary data block - bool Read(const wxString& key, wxMemoryBuffer* data) const - { return DoReadBinary(key, data); } - // no default version since it does not make sense for binary data -#endif // wxUSE_BASE64 - -#ifdef wxHAS_CONFIG_TEMPLATE_RW - // read other types, for which wxFromString is defined - template - bool Read(const wxString& key, T* value) const - { - wxString s; - if ( !Read(key, &s) ) - return false; - return wxFromString(s, value); - } - - template - bool Read(const wxString& key, T* value, const T& defVal) const - { - const bool found = Read(key, value); - if ( !found ) - { - if (IsRecordingDefaults()) - ((wxConfigBase *)this)->Write(key, defVal); - *value = defVal; - } - return found; - } -#endif // wxHAS_CONFIG_TEMPLATE_RW - - // convenience functions returning directly the value + // convenience functions returning directly the value (we don't have them for + // int/double/bool as there would be ambiguities with the long one then) wxString Read(const wxString& key, const wxString& defVal = wxEmptyString) const { wxString s; (void)Read(key, &s, defVal); return s; } - // we have to provide a separate version for C strings as otherwise the - // template Read() would be used - wxString Read(const wxString& key, const char* defVal) const - { return Read(key, wxString(defVal)); } - wxString Read(const wxString& key, const wchar_t* defVal) const - { return Read(key, wxString(defVal)); } - - long ReadLong(const wxString& key, long defVal) const + long Read(const wxString& key, long defVal) const { long l; (void)Read(key, &l, defVal); return l; } - double ReadDouble(const wxString& key, double defVal) const - { double d; (void)Read(key, &d, defVal); return d; } - - bool ReadBool(const wxString& key, bool defVal) const - { bool b; (void)Read(key, &b, defVal); return b; } - - template - T ReadObject(const wxString& key, T const& defVal) const - { T t; (void)Read(key, &t, defVal); return t; } - - // for compatibility with wx 2.8 - long Read(const wxString& key, long defVal) const - { return ReadLong(key, defVal); } - - - // write the value (return true on success) + // write the value (return true on success) bool Write(const wxString& key, const wxString& value) { return DoWriteString(key, value); } bool Write(const wxString& key, long value) { return DoWriteLong(key, value); } + bool Write(const wxString& key, int value) + { return DoWriteInt(key, value); } + bool Write(const wxString& key, double value) { return DoWriteDouble(key, value); } bool Write(const wxString& key, bool value) { return DoWriteBool(key, value); } -#if wxUSE_BASE64 - bool Write(const wxString& key, const wxMemoryBuffer& buf) - { return DoWriteBinary(key, buf); } -#endif // wxUSE_BASE64 - // we have to provide a separate version for C strings as otherwise they // would be converted to bool and not to wxString as expected! - bool Write(const wxString& key, const char *value) + bool Write(const wxString& key, const wxChar *value) { return Write(key, wxString(value)); } - bool Write(const wxString& key, const unsigned char *value) - { return Write(key, wxString(value)); } - bool Write(const wxString& key, const wchar_t *value) - { return Write(key, wxString(value)); } - - - // we also have to provide specializations for other types which we want to - // handle using the specialized DoWriteXXX() instead of the generic template - // version below - bool Write(const wxString& key, char value) - { return DoWriteLong(key, value); } - - bool Write(const wxString& key, unsigned char value) - { return DoWriteLong(key, value); } - - bool Write(const wxString& key, short value) - { return DoWriteLong(key, value); } - - bool Write(const wxString& key, unsigned short value) - { return DoWriteLong(key, value); } - - bool Write(const wxString& key, unsigned int value) - { return DoWriteLong(key, value); } - - bool Write(const wxString& key, int value) - { return DoWriteLong(key, value); } - - bool Write(const wxString& key, unsigned long value) - { return DoWriteLong(key, value); } - - bool Write(const wxString& key, float value) - { return DoWriteDouble(key, value); } - - // Causes ambiguities in VC++ 6 and OpenVMS (at least) -#if ( (!defined(__VISUALC__) || __VISUALC__ > 1200) && !defined( __VMS ) && !defined (__DMC__)) - // for other types, use wxToString() - template - bool Write(const wxString& key, T const& value) - { return Write(key, wxToString(value)); } -#endif // permanently writes all changes virtual bool Flush(bool bCurrentOnly = false) = 0; @@ -373,19 +265,15 @@ protected: // do read/write the values of different types virtual bool DoReadString(const wxString& key, wxString *pStr) const = 0; virtual bool DoReadLong(const wxString& key, long *pl) const = 0; + virtual bool DoReadInt(const wxString& key, int *pi) const; virtual bool DoReadDouble(const wxString& key, double* val) const; virtual bool DoReadBool(const wxString& key, bool* val) const; -#if wxUSE_BASE64 - virtual bool DoReadBinary(const wxString& key, wxMemoryBuffer* buf) const = 0; -#endif // wxUSE_BASE64 virtual bool DoWriteString(const wxString& key, const wxString& value) = 0; virtual bool DoWriteLong(const wxString& key, long value) = 0; + virtual bool DoWriteInt(const wxString& key, int value); virtual bool DoWriteDouble(const wxString& key, double value); virtual bool DoWriteBool(const wxString& key, bool value); -#if wxUSE_BASE64 - virtual bool DoWriteBinary(const wxString& key, const wxMemoryBuffer& buf) = 0; -#endif // wxUSE_BASE64 private: // are we doing automatic environment variable expansion? @@ -403,8 +291,6 @@ private: // Style flag long m_style; - - DECLARE_ABSTRACT_CLASS(wxConfigBase) }; // a handy little class which changes current path to the path of given entry @@ -436,10 +322,22 @@ private: m_strOldPath; // saved path bool m_bChanged; // was the path changed? - wxDECLARE_NO_COPY_CLASS(wxConfigPathChanger); + DECLARE_NO_COPY_CLASS(wxConfigPathChanger) }; +// ---------------------------------------------------------------------------- +// the native wxConfigBase implementation +// ---------------------------------------------------------------------------- + +// under Windows we prefer to use the native implementation +// wxIniConfig isn't native anywhere after droping win16 in wxWidgets 2.6 +#if defined(__WXMSW__) && wxUSE_CONFIG_NATIVE + #define wxConfig wxRegConfig +#else // either we're under Unix or wish to use files even under Windows + #define wxConfig wxFileConfig +#endif + #endif // wxUSE_CONFIG /* @@ -453,7 +351,9 @@ WXDLLIMPEXP_BASE wxString wxExpandEnvVars(const wxString &sz); /* Split path into parts removing '..' in progress */ -WXDLLIMPEXP_BASE void wxSplitPath(wxArrayString& aParts, const wxString& path); +WXDLLIMPEXP_BASE void wxSplitPath(wxArrayString& aParts, const wxChar *sz); -#endif // _WX_CONFBASE_H_ + +#endif + // _WX_CONFIG_H_ diff --git a/Source/3rd Party/wx/include/wx/config.h b/Source/3rd Party/wx/include/wx/config.h index bbc072ed0..92d036f93 100644 --- a/Source/3rd Party/wx/include/wx/config.h +++ b/Source/3rd Party/wx/include/wx/config.h @@ -1,11 +1,11 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/config.h +// Name: config.h // Purpose: wxConfig base header // Author: Julian Smart // Modified by: // Created: // Copyright: (c) Julian Smart -// RCS-ID: $Id$ +// RCS-ID: $Id: config.h 60524 2009-05-05 22:51:44Z PC $ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -16,21 +16,16 @@ #if wxUSE_CONFIG -// ---------------------------------------------------------------------------- -// define the native wxConfigBase implementation -// ---------------------------------------------------------------------------- - -// under Windows we prefer to use the native implementation but can be forced -// to use the file-based one -#if defined(__WINDOWS__) && wxUSE_CONFIG_NATIVE - #include "wx/msw/regconf.h" - #define wxConfig wxRegConfig -#elif defined(__WXOS2__) && wxUSE_CONFIG_NATIVE - #include "wx/os2/iniconf.h" - #define wxConfig wxIniConfig -#else // either we're under Unix or wish to always use config files - #include "wx/fileconf.h" - #define wxConfig wxFileConfig +#if defined(__WXMSW__) && wxUSE_CONFIG_NATIVE +# ifdef __WIN32__ +# include "wx/msw/regconf.h" +# else +# include "wx/msw/iniconf.h" +# endif +#elif defined(__WXPALMOS__) && wxUSE_CONFIG_NATIVE +# include "wx/palmos/prefconf.h" +#else +# include "wx/fileconf.h" #endif #endif // wxUSE_CONFIG diff --git a/Source/3rd Party/wx/include/wx/containr.h b/Source/3rd Party/wx/include/wx/containr.h index d8047dc2c..0cf322c2e 100644 --- a/Source/3rd Party/wx/include/wx/containr.h +++ b/Source/3rd Party/wx/include/wx/containr.h @@ -1,94 +1,62 @@ /////////////////////////////////////////////////////////////////////////////// // Name: wx/containr.h -// Purpose: wxControlContainer and wxNavigationEnabled declarations +// Purpose: wxControlContainer class declration: a "mix-in" class which +// implements the TAB navigation between the controls // Author: Vadim Zeitlin // Modified by: // Created: 06.08.01 -// RCS-ID: $Id$ -// Copyright: (c) 2001, 2011 Vadim Zeitlin +// RCS-ID: $Id: containr.h 50863 2007-12-20 18:32:55Z VS $ +// Copyright: (c) 2001 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// #ifndef _WX_CONTAINR_H_ #define _WX_CONTAINR_H_ -#include "wx/defs.h" - -#ifndef wxHAS_NATIVE_TAB_TRAVERSAL - // We need wxEVT_XXX declarations in this case. - #include "wx/event.h" -#endif - +class WXDLLIMPEXP_FWD_CORE wxFocusEvent; +class WXDLLIMPEXP_FWD_CORE wxNavigationKeyEvent; class WXDLLIMPEXP_FWD_CORE wxWindow; class WXDLLIMPEXP_FWD_CORE wxWindowBase; /* - This header declares wxControlContainer class however it's not a real - container of controls but rather just a helper used to implement TAB - navigation among the window children. You should rarely need to use it - directly, derive from the documented public wxNavigationEnabled<> class to - implement TAB navigation in a custom composite window. + Implementation note: wxControlContainer is not a real mix-in but rather + a class meant to be agregated with (and not inherited from). Although + logically it should be a mix-in, doing it like this has no advantage from + the point of view of the existing code but does have some problems (we'd + need to play tricks with event handlers which may be difficult to do + safely). The price we pay for this simplicity is the ugly macros below. */ // ---------------------------------------------------------------------------- -// wxControlContainerBase: common part used in both native and generic cases +// wxControlContainer // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxControlContainerBase +class WXDLLEXPORT wxControlContainer { public: - // default ctor, SetContainerWindow() must be called later - wxControlContainerBase() - { - m_winParent = NULL; + // ctors and such + wxControlContainer(wxWindow *winParent = NULL); + void SetContainerWindow(wxWindow *winParent) { m_winParent = winParent; } - // do accept focus initially, we'll stop doing it if/when any children - // are added - m_acceptsFocus = true; - m_inSetFocus = false; - m_winLastFocused = NULL; - } - virtual ~wxControlContainerBase() {} - - void SetContainerWindow(wxWindow *winParent) - { - wxASSERT_MSG( !m_winParent, wxT("shouldn't be called twice") ); - - m_winParent = winParent; - } + // the methods to be called from the window event handlers + void HandleOnNavigationKey(wxNavigationKeyEvent& event); + void HandleOnFocus(wxFocusEvent& event); + void HandleOnWindowDestroy(wxWindowBase *child); // should be called from SetFocus(), returns false if we did nothing with // the focus and the default processing should take place bool DoSetFocus(); - // should be called when we decide that we should [stop] accepting focus - void SetCanFocus(bool acceptsFocus); + // can our child get the focus? + bool AcceptsFocus() const; - // returns whether we should accept focus ourselves or not - bool AcceptsFocus() const { return m_acceptsFocus; } - - // returns whether we or one of our children accepts focus: we always do - // because if we don't have any focusable children it probably means that - // we're not being used as a container at all (think of wxGrid or generic - // wxListCtrl) and so should get focus for ourselves - bool AcceptsFocusRecursively() const { return true; } - - // this is used to determine whether we can accept focus when Tab or - // another navigation key is pressed -- we alsways can, for the same reason - // as mentioned above for AcceptsFocusRecursively() - bool AcceptsFocusFromKeyboard() const { return true; } - - // Call this when the number of children of the window changes. - // If we have any children, this panel (used just as container for - // them) shouldn't get focus for itself. - void UpdateCanFocus() { SetCanFocus(!HasAnyFocusableChildren()); } + // called from OnChildFocus() handler, i.e. when one of our (grand) + // children gets the focus + void SetLastFocus(wxWindow *win); protected: // set the focus to the child which had it the last time - virtual bool SetFocusToChild(); - - // return true if we have any children accepting focus - bool HasAnyFocusableChildren() const; + bool SetFocusToChild(); // the parent window we manage the children for wxWindow *m_winParent; @@ -96,256 +64,33 @@ protected: // the child which had the focus last time this panel was activated wxWindow *m_winLastFocused; -private: - // value returned by AcceptsFocus(), should be changed using SetCanFocus() - // only - bool m_acceptsFocus; - // a guard against infinite recursion bool m_inSetFocus; + + DECLARE_NO_COPY_CLASS(wxControlContainer) }; -#ifdef wxHAS_NATIVE_TAB_TRAVERSAL - -// ---------------------------------------------------------------------------- -// wxControlContainer for native TAB navigation -// ---------------------------------------------------------------------------- - -// this must be a real class as we forward-declare it elsewhere -class WXDLLIMPEXP_CORE wxControlContainer : public wxControlContainerBase -{ -protected: - // set the focus to the child which had it the last time - virtual bool SetFocusToChild(); -}; - -#else // !wxHAS_NATIVE_TAB_TRAVERSAL - -// ---------------------------------------------------------------------------- -// wxControlContainer for TAB navigation implemented in wx itself -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxControlContainer : public wxControlContainerBase -{ -public: - // default ctor, SetContainerWindow() must be called later - wxControlContainer(); - - // the methods to be called from the window event handlers - void HandleOnNavigationKey(wxNavigationKeyEvent& event); - void HandleOnFocus(wxFocusEvent& event); - void HandleOnWindowDestroy(wxWindowBase *child); - - // called from OnChildFocus() handler, i.e. when one of our (grand) - // children gets the focus - void SetLastFocus(wxWindow *win); - -protected: - - wxDECLARE_NO_COPY_CLASS(wxControlContainer); -}; - -#endif // wxHAS_NATIVE_TAB_TRAVERSAL/!wxHAS_NATIVE_TAB_TRAVERSAL - // this function is for wxWidgets internal use only -extern WXDLLIMPEXP_CORE bool wxSetFocusToChild(wxWindow *win, wxWindow **child); +extern bool wxSetFocusToChild(wxWindow *win, wxWindow **child); // ---------------------------------------------------------------------------- -// wxNavigationEnabled: Derive from this class to support keyboard navigation -// among window children in a wxWindow-derived class. The details of this class -// don't matter, you just need to derive from it to make navigation work. +// macros which may be used by the classes wishing to implement TAB navigation +// among their children // ---------------------------------------------------------------------------- -// The template parameter W must be a wxWindow-derived class. -template -class wxNavigationEnabled : public W -{ -public: - typedef W BaseWindowClass; - - wxNavigationEnabled() - { - m_container.SetContainerWindow(this); - -#ifndef wxHAS_NATIVE_TAB_TRAVERSAL - BaseWindowClass::Connect(wxEVT_NAVIGATION_KEY, - wxNavigationKeyEventHandler(wxNavigationEnabled::OnNavigationKey)); - - BaseWindowClass::Connect(wxEVT_SET_FOCUS, - wxFocusEventHandler(wxNavigationEnabled::OnFocus)); - - BaseWindowClass::Connect(wxEVT_CHILD_FOCUS, - wxChildFocusEventHandler(wxNavigationEnabled::OnChildFocus)); -#endif // !wxHAS_NATIVE_TAB_TRAVERSAL - } - - WXDLLIMPEXP_INLINE_CORE virtual bool AcceptsFocus() const - { - return m_container.AcceptsFocus(); - } - - WXDLLIMPEXP_INLINE_CORE virtual bool AcceptsFocusRecursively() const - { - return m_container.AcceptsFocusRecursively(); - } - - WXDLLIMPEXP_INLINE_CORE virtual bool AcceptsFocusFromKeyboard() const - { - return m_container.AcceptsFocusFromKeyboard(); - } - - WXDLLIMPEXP_INLINE_CORE virtual void AddChild(wxWindowBase *child) - { - BaseWindowClass::AddChild(child); - - m_container.UpdateCanFocus(); - } - - WXDLLIMPEXP_INLINE_CORE virtual void RemoveChild(wxWindowBase *child) - { -#ifndef wxHAS_NATIVE_TAB_TRAVERSAL - m_container.HandleOnWindowDestroy(child); -#endif // !wxHAS_NATIVE_TAB_TRAVERSAL - - BaseWindowClass::RemoveChild(child); - - m_container.UpdateCanFocus(); - } - - WXDLLIMPEXP_INLINE_CORE virtual void SetFocus() - { - if ( !m_container.DoSetFocus() ) - BaseWindowClass::SetFocus(); - } - - void SetFocusIgnoringChildren() - { - BaseWindowClass::SetFocus(); - } - - void AcceptFocus(bool acceptFocus) - { - m_container.SetCanFocus(acceptFocus); - } - -protected: -#ifndef wxHAS_NATIVE_TAB_TRAVERSAL - void OnNavigationKey(wxNavigationKeyEvent& event) - { - m_container.HandleOnNavigationKey(event); - } - - void OnFocus(wxFocusEvent& event) - { - m_container.HandleOnFocus(event); - } - - void OnChildFocus(wxChildFocusEvent& event) - { - m_container.SetLastFocus(event.GetWindow()); - event.Skip(); - } -#endif // !wxHAS_NATIVE_TAB_TRAVERSAL - - wxControlContainer m_container; - - - wxDECLARE_NO_COPY_TEMPLATE_CLASS(wxNavigationEnabled, W); -}; - -// ---------------------------------------------------------------------------- -// Compatibility macros from now on, do NOT use them and preferably do not even -// look at them. -// ---------------------------------------------------------------------------- - -#if WXWIN_COMPATIBILITY_2_8 - -// common part of WX_DECLARE_CONTROL_CONTAINER in the native and generic cases, -// it should be used in the wxWindow-derived class declaration -#define WX_DECLARE_CONTROL_CONTAINER_BASE() \ -public: \ - virtual bool AcceptsFocus() const; \ - virtual bool AcceptsFocusRecursively() const; \ - virtual bool AcceptsFocusFromKeyboard() const; \ - virtual void AddChild(wxWindowBase *child); \ - virtual void RemoveChild(wxWindowBase *child); \ - virtual void SetFocus(); \ - void SetFocusIgnoringChildren(); \ - void AcceptFocus(bool acceptFocus) \ - { \ - m_container.SetCanFocus(acceptFocus); \ - } \ - \ -protected: \ - wxControlContainer m_container - -// this macro must be used in the derived class ctor -#define WX_INIT_CONTROL_CONTAINER() \ - m_container.SetContainerWindow(this) - -// common part of WX_DELEGATE_TO_CONTROL_CONTAINER in the native and generic -// cases, must be used in the wxWindow-derived class implementation -#define WX_DELEGATE_TO_CONTROL_CONTAINER_BASE(classname, basename) \ - void classname::AddChild(wxWindowBase *child) \ - { \ - basename::AddChild(child); \ - \ - m_container.UpdateCanFocus(); \ - } \ - \ - bool classname::AcceptsFocusRecursively() const \ - { \ - return m_container.AcceptsFocusRecursively(); \ - } \ - \ - void classname::SetFocus() \ - { \ - if ( !m_container.DoSetFocus() ) \ - basename::SetFocus(); \ - } \ - \ - bool classname::AcceptsFocus() const \ - { \ - return m_container.AcceptsFocus(); \ - } \ - \ - bool classname::AcceptsFocusFromKeyboard() const \ - { \ - return m_container.AcceptsFocusFromKeyboard(); \ - } - - -#ifdef wxHAS_NATIVE_TAB_TRAVERSAL - -#define WX_EVENT_TABLE_CONTROL_CONTAINER(classname) - -#define WX_DECLARE_CONTROL_CONTAINER WX_DECLARE_CONTROL_CONTAINER_BASE - -#define WX_DELEGATE_TO_CONTROL_CONTAINER(classname, basename) \ - WX_DELEGATE_TO_CONTROL_CONTAINER_BASE(classname, basename) \ - \ - void classname::RemoveChild(wxWindowBase *child) \ - { \ - basename::RemoveChild(child); \ - \ - m_container.UpdateCanFocus(); \ - } \ - \ - void classname::SetFocusIgnoringChildren() \ - { \ - basename::SetFocus(); \ - } - -#else // !wxHAS_NATIVE_TAB_TRAVERSAL - // declare the methods to be forwarded -#define WX_DECLARE_CONTROL_CONTAINER() \ - WX_DECLARE_CONTROL_CONTAINER_BASE(); \ - \ -public: \ - void OnNavigationKey(wxNavigationKeyEvent& event); \ - void OnFocus(wxFocusEvent& event); \ - virtual void OnChildFocus(wxChildFocusEvent& event) +#define WX_DECLARE_CONTROL_CONTAINER() \ +public: \ + void OnNavigationKey(wxNavigationKeyEvent& event); \ + void OnFocus(wxFocusEvent& event); \ + virtual void OnChildFocus(wxChildFocusEvent& event); \ + virtual void SetFocus(); \ + virtual void SetFocusIgnoringChildren(); \ + virtual void RemoveChild(wxWindowBase *child); \ + virtual bool AcceptsFocus() const; \ +\ +protected: \ + wxControlContainer m_container // implement the event table entries for wxControlContainer #define WX_EVENT_TABLE_CONTROL_CONTAINER(classname) \ @@ -354,41 +99,44 @@ public: \ EVT_NAVIGATION_KEY(classname::OnNavigationKey) // implement the methods forwarding to the wxControlContainer -#define WX_DELEGATE_TO_CONTROL_CONTAINER(classname, basename) \ - WX_DELEGATE_TO_CONTROL_CONTAINER_BASE(classname, basename) \ - \ - void classname::RemoveChild(wxWindowBase *child) \ - { \ - m_container.HandleOnWindowDestroy(child); \ - \ - basename::RemoveChild(child); \ - \ - m_container.UpdateCanFocus(); \ - } \ - \ - void classname::OnNavigationKey( wxNavigationKeyEvent& event ) \ - { \ - m_container.HandleOnNavigationKey(event); \ - } \ - \ - void classname::SetFocusIgnoringChildren() \ - { \ - basename::SetFocus(); \ - } \ - \ - void classname::OnChildFocus(wxChildFocusEvent& event) \ - { \ - m_container.SetLastFocus(event.GetWindow()); \ - event.Skip(); \ - } \ - \ - void classname::OnFocus(wxFocusEvent& event) \ - { \ - m_container.HandleOnFocus(event); \ - } +#define WX_DELEGATE_TO_CONTROL_CONTAINER(classname, basename) \ +void classname::OnNavigationKey( wxNavigationKeyEvent& event ) \ +{ \ + m_container.HandleOnNavigationKey(event); \ +} \ + \ +void classname::RemoveChild(wxWindowBase *child) \ +{ \ + m_container.HandleOnWindowDestroy(child); \ + \ + basename::RemoveChild(child); \ +} \ + \ +void classname::SetFocus() \ +{ \ + if ( !m_container.DoSetFocus() ) \ + basename::SetFocus(); \ +} \ + \ +void classname::SetFocusIgnoringChildren() \ +{ \ + basename::SetFocus(); \ +} \ + \ +void classname::OnChildFocus(wxChildFocusEvent& event) \ +{ \ + m_container.SetLastFocus(event.GetWindow()); \ + event.Skip(); \ +} \ + \ +void classname::OnFocus(wxFocusEvent& event) \ +{ \ + m_container.HandleOnFocus(event); \ +} \ +bool classname::AcceptsFocus() const \ +{ \ + return m_container.AcceptsFocus(); \ +} -#endif // wxHAS_NATIVE_TAB_TRAVERSAL/!wxHAS_NATIVE_TAB_TRAVERSAL - -#endif // WXWIN_COMPATIBILITY_2_8 #endif // _WX_CONTAINR_H_ diff --git a/Source/3rd Party/wx/include/wx/control.h b/Source/3rd Party/wx/include/wx/control.h index 83f552471..ff11a93cf 100644 --- a/Source/3rd Party/wx/include/wx/control.h +++ b/Source/3rd Party/wx/include/wx/control.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 26.07.99 -// RCS-ID: $Id$ +// RCS-ID: $Id: control.h 42816 2006-10-31 08:50:17Z RD $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -22,38 +22,13 @@ #include "wx/window.h" // base class -extern WXDLLIMPEXP_DATA_CORE(const char) wxControlNameStr[]; - - -// ---------------------------------------------------------------------------- -// Ellipsize() constants -// ---------------------------------------------------------------------------- - -enum wxEllipsizeFlags -{ - wxELLIPSIZE_FLAGS_NONE = 0, - wxELLIPSIZE_FLAGS_PROCESS_MNEMONICS = 1, - wxELLIPSIZE_FLAGS_EXPAND_TABS = 2, - - wxELLIPSIZE_FLAGS_DEFAULT = wxELLIPSIZE_FLAGS_PROCESS_MNEMONICS | - wxELLIPSIZE_FLAGS_EXPAND_TABS -}; - -// NB: Don't change the order of these values, they're the same as in -// PangoEllipsizeMode enum. -enum wxEllipsizeMode -{ - wxELLIPSIZE_NONE, - wxELLIPSIZE_START, - wxELLIPSIZE_MIDDLE, - wxELLIPSIZE_END -}; +extern WXDLLEXPORT_DATA(const wxChar) wxControlNameStr[]; // ---------------------------------------------------------------------------- // wxControl is the base class for all controls // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxControlBase : public wxWindow +class WXDLLEXPORT wxControlBase : public wxWindow { public: wxControlBase() { } @@ -71,51 +46,11 @@ public: // get the control alignment (left/right/centre, top/bottom/centre) int GetAlignment() const { return m_windowStyle & wxALIGN_MASK; } - // set label with mnemonics - virtual void SetLabel(const wxString& label) - { - m_labelOrig = label; - - InvalidateBestSize(); - - wxWindow::SetLabel(label); - } - - // return the original string, as it was passed to SetLabel() - // (i.e. with wx-style mnemonics) - virtual wxString GetLabel() const { return m_labelOrig; } - - // set label text (mnemonics will be escaped) - virtual void SetLabelText(const wxString& text) - { - SetLabel(EscapeMnemonics(text)); - } + // get the string without mnemonic characters ('&') + static wxString GetLabelText(const wxString& label); // get just the text of the label, without mnemonic characters ('&') - virtual wxString GetLabelText() const { return GetLabelText(GetLabel()); } - - -#if wxUSE_MARKUP - // Set the label with markup (and mnemonics). Markup is a simple subset of - // HTML with tags such as , and . By default it is not - // supported i.e. all the markup is simply stripped and SetLabel() is - // called but some controls in some ports do support this already and in - // the future most of them should. - // - // Notice that, being HTML-like, markup also supports XML entities so '<' - // should be encoded as "<" and so on, a bare '<' in the input will - // likely result in an error. As an exception, a bare '&' is allowed and - // indicates that the next character is a mnemonic. To insert a literal '&' - // in the control you need to use "&" in the input string. - // - // Returns true if the label was set, even if the markup in it was ignored. - // False is only returned if we failed to parse the label. - bool SetLabelMarkup(const wxString& markup) - { - return DoSetLabelMarkup(markup); - } -#endif // wxUSE_MARKUP - + wxString GetLabelText() const { return GetLabelText(GetLabel()); } // controls by default inherit the colours of their parents, if a // particular control class doesn't want to do it, it can override @@ -129,52 +64,13 @@ public: // if the button was clicked) virtual void Command(wxCommandEvent &event); + virtual void SetLabel( const wxString &label ); virtual bool SetFont(const wxFont& font); // wxControl-specific processing after processing the update event virtual void DoUpdateWindowUI(wxUpdateUIEvent& event); - - - // static utilities for mnemonics char (&) handling - // ------------------------------------------------ - - // returns the given string without mnemonic characters ('&') - static wxString GetLabelText(const wxString& label); - - // returns the given string without mnemonic characters ('&') - // this function is identic to GetLabelText() and is provided for clarity - // and for symmetry with the wxStaticText::RemoveMarkup() function. - static wxString RemoveMnemonics(const wxString& str); - - // escapes (by doubling them) the mnemonics - static wxString EscapeMnemonics(const wxString& str); - - - // miscellaneous static utilities - // ------------------------------ - - // replaces parts of the given (multiline) string with an ellipsis if needed - static wxString Ellipsize(const wxString& label, const wxDC& dc, - wxEllipsizeMode mode, int maxWidth, - int flags = wxELLIPSIZE_FLAGS_DEFAULT); - - // return the accel index in the string or -1 if none and puts the modified - // string into second parameter if non NULL - static int FindAccelIndex(const wxString& label, - wxString *labelOnly = NULL); - - // this is a helper for the derived class GetClassDefaultAttributes() - // implementation: it returns the right colours for the classes which - // contain something else (e.g. wxListBox, wxTextCtrl, ...) instead of - // being simple controls (such as wxButton, wxCheckBox, ...) - static wxVisualAttributes - GetCompositeControlsDefaultAttributes(wxWindowVariant variant); - protected: - // choose the default border for this window - virtual wxBorder GetDefaultBorder() const; - // creates the control (calls wxWindowBase::CreateBase inside) and adds it // to the list of parents children bool CreateControl(wxWindowBase *parent, @@ -185,34 +81,10 @@ protected: const wxValidator& validator, const wxString& name); -#if wxUSE_MARKUP - // This function may be overridden in the derived classes to implement - // support for labels with markup. The base class version simply strips the - // markup and calls SetLabel() with the remaining text. - virtual bool DoSetLabelMarkup(const wxString& markup); -#endif // wxUSE_MARKUP - - // initialize the common fields of wxCommandEvent void InitCommandEvent(wxCommandEvent& event) const; - // Ellipsize() helper: - static wxString DoEllipsizeSingleLine(const wxString& label, const wxDC& dc, - wxEllipsizeMode mode, int maxWidth, - int replacementWidth); - -#if wxUSE_MARKUP - // Remove markup from the given string, returns empty string on error i.e. - // if markup was syntactically invalid. - static wxString RemoveMarkup(const wxString& markup); -#endif // wxUSE_MARKUP - - - // this field contains the label in wx format, i.e. with '&' mnemonics, - // as it was passed to the last SetLabel() call - wxString m_labelOrig; - - wxDECLARE_NO_COPY_CLASS(wxControlBase); + DECLARE_NO_COPY_CLASS(wxControlBase) }; // ---------------------------------------------------------------------------- @@ -221,6 +93,8 @@ protected: #if defined(__WXUNIVERSAL__) #include "wx/univ/control.h" +#elif defined(__WXPALMOS__) + #include "wx/palmos/control.h" #elif defined(__WXMSW__) #include "wx/msw/control.h" #elif defined(__WXMOTIF__) @@ -230,7 +104,7 @@ protected: #elif defined(__WXGTK__) #include "wx/gtk1/control.h" #elif defined(__WXMAC__) - #include "wx/osx/control.h" + #include "wx/mac/control.h" #elif defined(__WXCOCOA__) #include "wx/cocoa/control.h" #elif defined(__WXPM__) diff --git a/Source/3rd Party/wx/include/wx/convauto.h b/Source/3rd Party/wx/include/wx/convauto.h index d90b5ed5a..ced911950 100644 --- a/Source/3rd Party/wx/include/wx/convauto.h +++ b/Source/3rd Party/wx/include/wx/convauto.h @@ -3,7 +3,7 @@ // Purpose: wxConvAuto class declaration // Author: Vadim Zeitlin // Created: 2006-04-03 -// RCS-ID: $Id$ +// RCS-ID: $Id: convauto.h 45893 2007-05-08 20:05:16Z VZ $ // Copyright: (c) 2006 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -12,63 +12,24 @@ #define _WX_CONVAUTO_H_ #include "wx/strconv.h" -#include "wx/fontenc.h" + +#if wxUSE_WCHAR_T // ---------------------------------------------------------------------------- // wxConvAuto: uses BOM to automatically detect input encoding // ---------------------------------------------------------------------------- -// All currently recognized BOM values. -enum wxBOM -{ - wxBOM_Unknown = -1, - wxBOM_None, - wxBOM_UTF32BE, - wxBOM_UTF32LE, - wxBOM_UTF16BE, - wxBOM_UTF16LE, - wxBOM_UTF8 -}; - class WXDLLIMPEXP_BASE wxConvAuto : public wxMBConv { public: // default ctor, the real conversion will be created on demand - wxConvAuto(wxFontEncoding enc = wxFONTENCODING_DEFAULT) - { - Init(); - - m_encDefault = enc; - } + wxConvAuto() { m_conv = NULL; /* the rest will be initialized later */ } // copy ctor doesn't initialize anything neither as conversion can only be // deduced on first use - wxConvAuto(const wxConvAuto& other) : wxMBConv() - { - Init(); - - m_encDefault = other.m_encDefault; - } - - virtual ~wxConvAuto() - { - if ( m_ownsConv ) - delete m_conv; - } - - // get/set the fall-back encoding used when the input text doesn't have BOM - // and isn't UTF-8 - // - // special values are wxFONTENCODING_MAX meaning not to use any fall back - // at all (but just fail to convert in this case) and wxFONTENCODING_SYSTEM - // meaning to use the encoding of the system locale - static wxFontEncoding GetFallbackEncoding() { return ms_defaultMBEncoding; } - static void SetFallbackEncoding(wxFontEncoding enc); - static void DisableFallbackEncoding() - { - SetFallbackEncoding(wxFONTENCODING_MAX); - } + wxConvAuto(const wxConvAuto& WXUNUSED(other)) : wxMBConv() { m_conv = NULL; } + virtual ~wxConvAuto() { if ( m_conv && m_ownsConv ) delete m_conv; } // override the base class virtual function(s) to use our m_conv virtual size_t ToWChar(wchar_t *dst, size_t dstLen, @@ -81,64 +42,46 @@ public: virtual wxMBConv *Clone() const { return new wxConvAuto(*this); } - // return the BOM type of this buffer - static wxBOM DetectBOM(const char *src, size_t srcLen); - - // return the characters composing the given BOM. - static const char* GetBOMChars(wxBOM bomType, size_t* count); - - wxBOM GetBOM() const - { - return m_bomType; - } - private: - // common part of all ctors - void Init() + // all currently recognized BOM values + enum BOMType { - // We don't initialize m_encDefault here as different ctors do it - // differently. - m_conv = NULL; - m_bomType = wxBOM_Unknown; - m_ownsConv = false; - m_consumedBOM = false; - } + BOM_None, + BOM_UTF32BE, + BOM_UTF32LE, + BOM_UTF16BE, + BOM_UTF16LE, + BOM_UTF8 + }; - // initialize m_conv with the UTF-8 conversion - void InitWithUTF8() + // return the BOM type of this buffer + static BOMType DetectBOM(const char *src, size_t srcLen); + + // initialize m_conv with the conversion to use by default (UTF-8) + void InitWithDefault() { m_conv = &wxConvUTF8; m_ownsConv = false; } // create the correct conversion object for the given BOM type - void InitFromBOM(wxBOM bomType); + void InitFromBOM(BOMType bomType); // create the correct conversion object for the BOM present in the - // beginning of the buffer - // - // return false if the buffer is too short to allow us to determine if we - // have BOM or not - bool InitFromInput(const char *src, size_t len); + // beginning of the buffer; adjust the buffer to skip the BOM if found + void InitFromInput(const char **src, size_t *len); // adjust src and len to skip over the BOM (identified by m_bomType) at the // start of the buffer void SkipBOM(const char **src, size_t *len) const; - // fall-back multibyte encoding to use, may be wxFONTENCODING_SYSTEM or - // wxFONTENCODING_MAX but not wxFONTENCODING_DEFAULT - static wxFontEncoding ms_defaultMBEncoding; - // conversion object which we really use, NULL until the first call to // either ToWChar() or FromWChar() wxMBConv *m_conv; - // the multibyte encoding to use by default if input isn't Unicode - wxFontEncoding m_encDefault; - // our BOM type - wxBOM m_bomType; + BOMType m_bomType; // true if we allocated m_conv ourselves, false if we just use an existing // global conversion @@ -149,8 +92,17 @@ private: bool m_consumedBOM; - wxDECLARE_NO_ASSIGN_CLASS(wxConvAuto); + DECLARE_NO_ASSIGN_CLASS(wxConvAuto) }; +#else // !wxUSE_WCHAR_T + +// it doesn't matter how we define it in this case as it's unused anyhow, but +// do define it to allow the code using wxConvAuto() as default argument (this +// is done in many places) to compile +typedef wxMBConv wxConvAuto; + +#endif // wxUSE_WCHAR_T/!wxUSE_WCHAR_T + #endif // _WX_CONVAUTO_H_ diff --git a/Source/3rd Party/wx/include/wx/cpp.h b/Source/3rd Party/wx/include/wx/cpp.h index c600e4023..8d7a646d7 100644 --- a/Source/3rd Party/wx/include/wx/cpp.h +++ b/Source/3rd Party/wx/include/wx/cpp.h @@ -3,7 +3,7 @@ * Purpose: Various preprocessor helpers * Author: Vadim Zeitlin * Created: 2006-09-30 - * RCS-ID: $Id$ + * RCS-ID: $Id: cpp.h 42993 2006-11-03 21:06:57Z VZ $ * Copyright: (c) 2006 Vadim Zeitlin * Licence: wxWindows licence */ @@ -15,23 +15,7 @@ /* wxCONCAT works like preprocessor ## operator but also works with macros */ #define wxCONCAT_HELPER(text, line) text ## line - -#define wxCONCAT(x1, x2) \ - wxCONCAT_HELPER(x1, x2) -#define wxCONCAT3(x1, x2, x3) \ - wxCONCAT(wxCONCAT(x1, x2), x3) -#define wxCONCAT4(x1, x2, x3, x4) \ - wxCONCAT(wxCONCAT3(x1, x2, x3), x4) -#define wxCONCAT5(x1, x2, x3, x4, x5) \ - wxCONCAT(wxCONCAT4(x1, x2, x3, x4), x5) -#define wxCONCAT6(x1, x2, x3, x4, x5, x6) \ - wxCONCAT(wxCONCAT5(x1, x2, x3, x4, x5), x6) -#define wxCONCAT7(x1, x2, x3, x4, x5, x6, x7) \ - wxCONCAT(wxCONCAT6(x1, x2, x3, x4, x5, x6), x7) -#define wxCONCAT8(x1, x2, x3, x4, x5, x6, x7, x8) \ - wxCONCAT(wxCONCAT7(x1, x2, x3, x4, x5, x6, x7), x8) -#define wxCONCAT9(x1, x2, x3, x4, x5, x6, x7, x8, x9) \ - wxCONCAT(wxCONCAT8(x1, x2, x3, x4, x5, x6, x7, x8), x9) +#define wxCONCAT(text, line) wxCONCAT_HELPER(text, line) /* wxSTRINGIZE works as the preprocessor # operator but also works with macros */ #define wxSTRINGIZE_HELPER(x) #x @@ -40,16 +24,6 @@ /* a Unicode-friendly version of wxSTRINGIZE_T */ #define wxSTRINGIZE_T(x) wxAPPLY_T(wxSTRINGIZE(x)) -/* - Special workarounds for compilers with broken "##" operator. For all the - other ones we can just use it directly. - */ -#ifdef wxCOMPILER_BROKEN_CONCAT_OPER - #define wxPREPEND_L(x) L ## x - #define wxAPPEND_i64(x) x ## i64 - #define wxAPPEND_ui64(x) x ## ui64 -#endif /* wxCOMPILER_BROKEN_CONCAT_OPER */ - /* Helper macros for wxMAKE_UNIQUE_NAME: normally this works by appending the current line number to the given identifier to reduce the probability of the @@ -79,27 +53,5 @@ */ #define wxEMPTY_PARAMETER_VALUE /* Fake macro parameter value */ -/* - Define __WXFUNCTION__ which is like standard __FUNCTION__ but defined as - NULL for the compilers which don't support the latter. - */ -#ifndef __WXFUNCTION__ - /* TODO: add more compilers supporting __FUNCTION__ */ - #if defined(__DMC__) - /* - __FUNCTION__ happens to be not defined within class members - http://www.digitalmars.com/drn-bin/wwwnews?c%2B%2B.beta/485 - */ - #define __WXFUNCTION__ (NULL) - #elif defined(__GNUC__) || \ - (defined(_MSC_VER) && _MSC_VER >= 1300) || \ - defined(__FUNCTION__) - #define __WXFUNCTION__ __FUNCTION__ - #else - /* still define __WXFUNCTION__ to avoid #ifdefs elsewhere */ - #define __WXFUNCTION__ (NULL) - #endif -#endif /* __WXFUNCTION__ already defined */ - -#endif /* _WX_CPP_H_ */ +#endif // _WX_CPP_H_ diff --git a/Source/3rd Party/wx/include/wx/crt.h b/Source/3rd Party/wx/include/wx/crt.h deleted file mode 100644 index 6c5629464..000000000 --- a/Source/3rd Party/wx/include/wx/crt.h +++ /dev/null @@ -1,23 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// Name: wx/crt.h -// Purpose: Header to include all headers with wrappers for CRT functions -// Author: Robert Roebling -// Created: 2007-05-30 -// RCS-ID: $Id$ -// Copyright: (c) 2007 wxWidgets dev team -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CRT_H_ -#define _WX_CRT_H_ - -#include "wx/defs.h" - -// include wxChar type definition: -#include "wx/chartype.h" - -// and wrappers for CRT functions: -#include "wx/wxcrt.h" -#include "wx/wxcrtvararg.h" - -#endif // _WX_CRT_H_ diff --git a/Source/3rd Party/wx/include/wx/cshelp.h b/Source/3rd Party/wx/include/wx/cshelp.h index 43f3831fc..53e13c389 100644 --- a/Source/3rd Party/wx/include/wx/cshelp.h +++ b/Source/3rd Party/wx/include/wx/cshelp.h @@ -4,7 +4,7 @@ // Author: Julian Smart, Vadim Zeitlin // Modified by: // Created: 08/09/2000 -// RCS-ID: $Id$ +// RCS-ID: $Id: cshelp.h 61872 2009-09-09 22:37:05Z VZ $ // Copyright: (c) 2000 Julian Smart, Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -36,7 +36,7 @@ * window for the application to display help for. */ -class WXDLLIMPEXP_CORE wxContextHelp : public wxObject +class WXDLLEXPORT wxContextHelp : public wxObject { public: wxContextHelp(wxWindow* win = NULL, bool beginHelp = true); @@ -65,7 +65,7 @@ private: * to put the application into context help mode. */ -class WXDLLIMPEXP_CORE wxContextHelpButton : public wxBitmapButton +class WXDLLEXPORT wxContextHelpButton : public wxBitmapButton { public: wxContextHelpButton(wxWindow* parent, @@ -106,7 +106,7 @@ private: // and overriding ShowHelp() but calling the base class version wouldn't work // any more, which forces us to use a rather ugly hack and pass the extra // parameters of ShowHelpAtPoint() to ShowHelp() via member variables. -class WXDLLIMPEXP_CORE wxHelpProvider +class WXDLLEXPORT wxHelpProvider { public: // get/set the current (application-global) help provider (Set() returns @@ -188,7 +188,7 @@ WX_DECLARE_EXPORTED_HASH_MAP( wxUIntPtr, wxString, wxIntegerHash, // wxSimpleHelpProvider is an implementation of wxHelpProvider which supports // only plain text help strings and shows the string associated with the // control (if any) in a tooltip -class WXDLLIMPEXP_CORE wxSimpleHelpProvider : public wxHelpProvider +class WXDLLEXPORT wxSimpleHelpProvider : public wxHelpProvider { public: // implement wxHelpProvider methods @@ -212,12 +212,12 @@ protected: // both context identifiers and plain text help strings. If the help text is an integer, // it is passed to wxHelpController::DisplayContextPopup. Otherwise, it shows the string // in a tooltip as per wxSimpleHelpProvider. -class WXDLLIMPEXP_CORE wxHelpControllerHelpProvider : public wxSimpleHelpProvider +class WXDLLEXPORT wxHelpControllerHelpProvider : public wxSimpleHelpProvider { public: // Note that it doesn't own the help controller. The help controller // should be deleted separately. - wxHelpControllerHelpProvider(wxHelpControllerBase* hc = NULL); + wxHelpControllerHelpProvider(wxHelpControllerBase* hc = (wxHelpControllerBase*) NULL); // implement wxHelpProvider methods @@ -232,11 +232,11 @@ public: protected: wxHelpControllerBase* m_helpController; - wxDECLARE_NO_COPY_CLASS(wxHelpControllerHelpProvider); + DECLARE_NO_COPY_CLASS(wxHelpControllerHelpProvider) }; // Convenience function for turning context id into wxString -WXDLLIMPEXP_CORE wxString wxContextId(int id); +WXDLLEXPORT wxString wxContextId(int id); #endif // wxUSE_HELP diff --git a/Source/3rd Party/wx/include/wx/ctrlsub.h b/Source/3rd Party/wx/include/wx/ctrlsub.h index b2c7f94b1..dc29fe63f 100644 --- a/Source/3rd Party/wx/include/wx/ctrlsub.h +++ b/Source/3rd Party/wx/include/wx/ctrlsub.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 22.10.99 -// RCS-ID: $Id$ +// RCS-ID: $Id: ctrlsub.h 42816 2006-10-31 08:50:17Z RD $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -16,7 +16,6 @@ #if wxUSE_CONTROLS -#include "wx/arrstr.h" #include "wx/control.h" // base class // ---------------------------------------------------------------------------- @@ -30,7 +29,7 @@ // implements an extended interface deriving from this one) // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxItemContainerImmutable +class WXDLLEXPORT wxItemContainerImmutable { public: wxItemContainerImmutable() { } @@ -73,7 +72,7 @@ public: bool SetStringSelection(const wxString& s); // return the selected string or empty string if none - virtual wxString GetStringSelection() const; + wxString GetStringSelection() const; // this is the same as SetSelection( for single-selection controls but // reads better for multi-selection ones @@ -81,109 +80,14 @@ public: protected: + // check that the index is valid - bool IsValid(unsigned int n) const { return n < GetCount(); } - bool IsValidInsert(unsigned int n) const { return n <= GetCount(); } + inline bool IsValid(unsigned int n) const { return n < GetCount(); } + inline bool IsValidInsert(unsigned int n) const { return n <= GetCount(); } }; -// ---------------------------------------------------------------------------- -// wxItemContainer extends wxItemContainerImmutable interface with methods -// for adding/removing items. -// -// Classes deriving from this one must override DoInsertItems() to implement -// adding items to the control. This can often be implemented more efficiently -// than simply looping over the elements and inserting them but if this is not -// the case, the generic DoInsertItemsInLoop can be used in implementation, but -// in this case DoInsertItem() needs to be overridden. -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxItemContainer : public wxItemContainerImmutable +class WXDLLEXPORT wxItemContainer : public wxItemContainerImmutable { -private: - // AppendItems() and InsertItems() helpers just call DoAppend/InsertItems() - // after doing some checks - // - // NB: they're defined here so that they're inlined when used in public part - int AppendItems(const wxArrayStringsAdapter& items, - void **clientData, - wxClientDataType type) - { - if ( items.IsEmpty() ) - return wxNOT_FOUND; - - return DoAppendItems(items, clientData, type); - } - - int AppendItems(const wxArrayStringsAdapter& items) - { - return AppendItems(items, NULL, wxClientData_None); - } - - int AppendItems(const wxArrayStringsAdapter& items, void **clientData) - { - wxASSERT_MSG( GetClientDataType() != wxClientData_Object, - wxT("can't mix different types of client data") ); - - return AppendItems(items, clientData, wxClientData_Void); - } - - int AppendItems(const wxArrayStringsAdapter& items, - wxClientData **clientData) - { - wxASSERT_MSG( GetClientDataType() != wxClientData_Void, - wxT("can't mix different types of client data") ); - - return AppendItems(items, reinterpret_cast(clientData), - wxClientData_Object); - } - - int InsertItems(const wxArrayStringsAdapter& items, - unsigned int pos, - void **clientData, - wxClientDataType type) - { - wxASSERT_MSG( !IsSorted(), wxT("can't insert items in sorted control") ); - - wxCHECK_MSG( pos <= GetCount(), wxNOT_FOUND, - wxT("position out of range") ); - - // not all derived classes handle empty arrays correctly in - // DoInsertItems() and besides it really doesn't make much sense to do - // this (for append it could correspond to creating an initially empty - // control but why would anybody need to insert 0 items?) - wxCHECK_MSG( !items.IsEmpty(), wxNOT_FOUND, - wxT("need something to insert") ); - - return DoInsertItems(items, pos, clientData, type); - } - - int InsertItems(const wxArrayStringsAdapter& items, unsigned int pos) - { - return InsertItems(items, pos, NULL, wxClientData_None); - } - - int InsertItems(const wxArrayStringsAdapter& items, - unsigned int pos, - void **clientData) - { - wxASSERT_MSG( GetClientDataType() != wxClientData_Object, - wxT("can't mix different types of client data") ); - - return InsertItems(items, pos, clientData, wxClientData_Void); - } - - int InsertItems(const wxArrayStringsAdapter& items, - unsigned int pos, - wxClientData **clientData) - { - wxASSERT_MSG( GetClientDataType() != wxClientData_Void, - wxT("can't mix different types of client data") ); - - return InsertItems(items, pos, - reinterpret_cast(clientData), - wxClientData_Object); - } - public: wxItemContainer() { m_clientDataItemsType = wxClientData_None; } virtual ~wxItemContainer(); @@ -191,251 +95,94 @@ public: // adding items // ------------ - // append single item, return its position in the control (which can be - // different from the last one if the control is sorted) int Append(const wxString& item) - { return AppendItems(item); } + { return DoAppend(item); } int Append(const wxString& item, void *clientData) - { return AppendItems(item, &clientData); } + { int n = DoAppend(item); SetClientData(n, clientData); return n; } int Append(const wxString& item, wxClientData *clientData) - { return AppendItems(item, &clientData); } + { int n = DoAppend(item); SetClientObject(n, clientData); return n; } - // append several items at once to the control, return the position of the - // last item appended - int Append(const wxArrayString& items) - { return AppendItems(items); } - int Append(const wxArrayString& items, void **clientData) - { return AppendItems(items, clientData); } - int Append(const wxArrayString& items, wxClientData **clientData) - { return AppendItems(items, clientData); } - int Append(unsigned int n, const wxString *items) - { return AppendItems(wxArrayStringsAdapter(n, items)); } - int Append(unsigned int n, const wxString *items, void **clientData) - { return AppendItems(wxArrayStringsAdapter(n, items), clientData); } - int Append(unsigned int n, - const wxString *items, - wxClientData **clientData) - { return AppendItems(wxArrayStringsAdapter(n, items), clientData); } + // only for rtti needs (separate name) + void AppendString( const wxString& item) + { Append( item ); } - // only for RTTI needs (separate name) - void AppendString(const wxString& item) - { Append(item); } + // append several items at once to the control + void Append(const wxArrayString& strings); - - // inserting items: not for sorted controls! - // ----------------------------------------- - - // insert single item at the given position, return its effective position int Insert(const wxString& item, unsigned int pos) - { return InsertItems(item, pos); } - int Insert(const wxString& item, unsigned int pos, void *clientData) - { return InsertItems(item, pos, &clientData); } - int Insert(const wxString& item, unsigned int pos, wxClientData *clientData) - { return InsertItems(item, pos, &clientData); } - - // insert several items at once into the control, return the index of the - // last item inserted - int Insert(const wxArrayString& items, unsigned int pos) - { return InsertItems(items, pos); } - int Insert(const wxArrayString& items, unsigned int pos, void **clientData) - { return InsertItems(items, pos, clientData); } - int Insert(const wxArrayString& items, - unsigned int pos, - wxClientData **clientData) - { return InsertItems(items, pos, clientData); } - int Insert(unsigned int n, const wxString *items, unsigned int pos) - { return InsertItems(wxArrayStringsAdapter(n, items), pos); } - int Insert(unsigned int n, - const wxString *items, - unsigned int pos, - void **clientData) - { return InsertItems(wxArrayStringsAdapter(n, items), pos, clientData); } - int Insert(unsigned int n, - const wxString *items, - unsigned int pos, - wxClientData **clientData) - { return InsertItems(wxArrayStringsAdapter(n, items), pos, clientData); } - - - // replacing items - // --------------- - - void Set(const wxArrayString& items) - { Clear(); Append(items); } - void Set(const wxArrayString& items, void **clientData) - { Clear(); Append(items, clientData); } - void Set(const wxArrayString& items, wxClientData **clientData) - { Clear(); Append(items, clientData); } - void Set(unsigned int n, const wxString *items) - { Clear(); Append(n, items); } - void Set(unsigned int n, const wxString *items, void **clientData) - { Clear(); Append(n, items, clientData); } - void Set(unsigned int n, const wxString *items, wxClientData **clientData) - { Clear(); Append(n, items, clientData); } + { return DoInsert(item, pos); } + int Insert(const wxString& item, unsigned int pos, void *clientData); + int Insert(const wxString& item, unsigned int pos, wxClientData *clientData); // deleting items // -------------- - void Clear(); - void Delete(unsigned int pos); - - - // various accessors - // ----------------- - - // The control may maintain its items in a sorted order in which case - // items are automatically inserted at the right position when they are - // inserted or appended. Derived classes have to override this method if - // they implement sorting, typically by returning HasFlag(wxXX_SORT) - virtual bool IsSorted() const { return false; } + virtual void Clear() = 0; + virtual void Delete(unsigned int n) = 0; + // misc + // ---- // client data stuff - // ----------------- - void SetClientData(unsigned int n, void* clientData); void* GetClientData(unsigned int n) const; - // SetClientObject() takes ownership of the pointer, GetClientObject() - // returns it but keeps the ownership while DetachClientObject() expects - // the caller to delete the pointer and also resets the internally stored - // one to NULL for this item void SetClientObject(unsigned int n, wxClientData* clientData); wxClientData* GetClientObject(unsigned int n) const; - wxClientData* DetachClientObject(unsigned int n); - // return the type of client data stored in this control: usually it just - // returns m_clientDataItemsType but must be overridden in the controls - // which delegate their client data storage to another one (e.g. wxChoice - // in wxUniv which stores data in wxListBox which it uses anyhow); don't - // forget to override SetClientDataType() if you override this one - // - // NB: for this to work no code should ever access m_clientDataItemsType - // directly but only via this function! - virtual wxClientDataType GetClientDataType() const - { return m_clientDataItemsType; } - - bool HasClientData() const - { return GetClientDataType() != wxClientData_None; } bool HasClientObjectData() const - { return GetClientDataType() == wxClientData_Object; } + { return m_clientDataItemsType == wxClientData_Object; } bool HasClientUntypedData() const - { return GetClientDataType() == wxClientData_Void; } + { return m_clientDataItemsType == wxClientData_Void; } protected: - // there is usually no need to override this method but you can do it if it - // is more convenient to only do "real" insertions in DoInsertItems() and - // to implement items appending here (in which case DoInsertItems() should - // call this method if pos == GetCount() as it can still be called in this - // case if public Insert() is called with such position) - virtual int DoAppendItems(const wxArrayStringsAdapter& items, - void **clientData, - wxClientDataType type) - { - return DoInsertItems(items, GetCount(), clientData, type); - } + virtual int DoAppend(const wxString& item) = 0; + virtual int DoInsert(const wxString& item, unsigned int pos) = 0; - // this method must be implemented to insert the items into the control at - // position pos which can be GetCount() meaning that the items should be - // appended; for the sorted controls the position can be ignored - // - // the derived classes typically use AssignNewItemClientData() to - // associate the data with the items as they're being inserted - // - // the method should return the index of the position the last item was - // inserted into or wxNOT_FOUND if an error occurred - virtual int DoInsertItems(const wxArrayStringsAdapter & items, - unsigned int pos, - void **clientData, - wxClientDataType type) = 0; - - // before the client data is set for the first time for the control which - // hadn't had it before, DoInitItemClientData() is called which gives the - // derived class the possibility to initialize its client data storage only - // when client data is really used - virtual void DoInitItemClientData() { } - virtual void DoSetItemClientData(unsigned int n, void *clientData) = 0; - virtual void *DoGetItemClientData(unsigned int n) const = 0; - - virtual void DoClear() = 0; - virtual void DoDeleteOneItem(unsigned int pos) = 0; + virtual void DoSetItemClientData(unsigned int n, void* clientData) = 0; + virtual void* DoGetItemClientData(unsigned int n) const = 0; + virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData) = 0; + virtual wxClientData* DoGetItemClientObject(unsigned int n) const = 0; - // methods useful for the derived classes which don't have any better way - // of adding multiple items to the control than doing it one by one: such - // classes should call DoInsertItemsInLoop() from their DoInsert() and - // override DoInsertOneItem() to perform the real insertion - virtual int DoInsertOneItem(const wxString& item, unsigned int pos); - int DoInsertItemsInLoop(const wxArrayStringsAdapter& items, - unsigned int pos, - void **clientData, - wxClientDataType type); - - - // helper for DoInsertItems(): n is the index into clientData, pos is the - // position of the item in the control - void AssignNewItemClientData(unsigned int pos, - void **clientData, - unsigned int n, - wxClientDataType type); - - // free the client object associated with the item at given position and - // set it to NULL (must only be called if HasClientObjectData()) - void ResetItemClientObject(unsigned int n); - - // set the type of the client data stored in this control: override this if - // you override GetClientDataType() - virtual void SetClientDataType(wxClientDataType clientDataItemsType) - { - m_clientDataItemsType = clientDataItemsType; - } - -private: // the type of the client data for the items wxClientDataType m_clientDataItemsType; }; -// Inheriting directly from a wxWindow-derived class and wxItemContainer -// unfortunately introduces an ambiguity for all GetClientXXX() methods as they -// are inherited twice: the "global" versions from wxWindow and the per-item -// versions taking the index from wxItemContainer. -// -// So we need to explicitly resolve them and this helper template class is -// provided to do it. To use it, simply inherit from wxWindowWithItems instead of Window and Container interface directly. -template -class wxWindowWithItems : public W, public C -{ -public: - typedef W BaseWindowClass; - typedef C BaseContainerInterface; - - wxWindowWithItems() { } - - void SetClientData(void *data) - { BaseWindowClass::SetClientData(data); } - void *GetClientData() const - { return BaseWindowClass::GetClientData(); } - void SetClientObject(wxClientData *data) - { BaseWindowClass::SetClientObject(data); } - wxClientData *GetClientObject() const - { return BaseWindowClass::GetClientObject(); } - - void SetClientData(unsigned int n, void* clientData) - { wxItemContainer::SetClientData(n, clientData); } - void* GetClientData(unsigned int n) const - { return wxItemContainer::GetClientData(n); } - void SetClientObject(unsigned int n, wxClientData* clientData) - { wxItemContainer::SetClientObject(n, clientData); } - wxClientData* GetClientObject(unsigned int n) const +// this macro must (unfortunately) be used in any class deriving from both +// wxItemContainer and wxControl because otherwise there is ambiguity when +// calling GetClientXXX() functions -- the compiler can't choose between the +// two versions +#define wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST \ + void SetClientData(void *data) \ + { wxEvtHandler::SetClientData(data); } \ + void *GetClientData() const \ + { return wxEvtHandler::GetClientData(); } \ + void SetClientObject(wxClientData *data) \ + { wxEvtHandler::SetClientObject(data); } \ + wxClientData *GetClientObject() const \ + { return wxEvtHandler::GetClientObject(); } \ + void SetClientData(unsigned int n, void* clientData) \ + { wxItemContainer::SetClientData(n, clientData); } \ + void* GetClientData(unsigned int n) const \ + { return wxItemContainer::GetClientData(n); } \ + void SetClientObject(unsigned int n, wxClientData* clientData) \ + { wxItemContainer::SetClientObject(n, clientData); } \ + wxClientData* GetClientObject(unsigned int n) const \ { return wxItemContainer::GetClientObject(n); } -}; -class WXDLLIMPEXP_CORE wxControlWithItemsBase : - public wxWindowWithItems +class WXDLLEXPORT wxControlWithItems : public wxControl, public wxItemContainer { public: - wxControlWithItemsBase() { } + wxControlWithItems() { } + virtual ~wxControlWithItems(); + + // we have to redefine these functions here to avoid ambiguities in classes + // deriving from us which would arise otherwise because both base classses + // have the methods with the same names - hopefully, a smart compiler can + // optimize away these simple inline wrappers so we don't suffer much from + // this + wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST // usually the controls like list/combo boxes have their own background // colour @@ -449,25 +196,14 @@ protected: void InitCommandEventWithItems(wxCommandEvent& event, int n); private: - wxDECLARE_NO_COPY_CLASS(wxControlWithItemsBase); + DECLARE_ABSTRACT_CLASS(wxControlWithItems) + DECLARE_NO_COPY_CLASS(wxControlWithItems) }; -// define the platform-specific wxControlWithItems class -#if defined(__WXMSW__) - #include "wx/msw/ctrlsub.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/ctrlsub.h" -#else - class WXDLLIMPEXP_CORE wxControlWithItems : public wxControlWithItemsBase - { - public: - wxControlWithItems() { } - private: - DECLARE_ABSTRACT_CLASS(wxControlWithItems) - wxDECLARE_NO_COPY_CLASS(wxControlWithItems); - }; -#endif +// ---------------------------------------------------------------------------- +// inline functions +// ---------------------------------------------------------------------------- #endif // wxUSE_CONTROLS diff --git a/Source/3rd Party/wx/include/wx/cursor.h b/Source/3rd Party/wx/include/wx/cursor.h index 6907d7211..d072ff56a 100644 --- a/Source/3rd Party/wx/include/wx/cursor.h +++ b/Source/3rd Party/wx/include/wx/cursor.h @@ -5,7 +5,7 @@ // Modified by: // Created: // Copyright: (c) Julian Smart -// RCS-ID: $Id$ +// RCS-ID: $Id: cursor.h 40865 2006-08-27 09:42:42Z VS $ // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// @@ -14,56 +14,27 @@ #include "wx/defs.h" -/* - wxCursor classes should have the following public API: - -class WXDLLIMPEXP_CORE wxCursor : public wxGDIObject -{ -public: - wxCursor(); - wxCursor(const wxImage& image); - wxCursor(const wxString& name, - wxBitmapType type = wxCURSOR_DEFAULT_TYPE, - int hotSpotX = 0, int hotSpotY = 0); - wxCursor(wxStockCursor id) { InitFromStock(id); } -#if WXWIN_COMPATIBILITY_2_8 - wxCursor(int id) { InitFromStock((wxStockCursor)id); } -#endif - virtual ~wxCursor(); -}; - -*/ - -#if defined(__WXMSW__) - #define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_CUR_RESOURCE +#if defined(__WXPALMOS__) + #include "wx/palmos/cursor.h" +#elif defined(__WXMSW__) #include "wx/msw/cursor.h" #elif defined(__WXMOTIF__) - #define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_XBM #include "wx/motif/cursor.h" #elif defined(__WXGTK20__) - #ifdef __WINDOWS__ - #define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_CUR_RESOURCE - #else - #define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_XPM - #endif #include "wx/gtk/cursor.h" #elif defined(__WXGTK__) - #define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_XPM #include "wx/gtk1/cursor.h" #elif defined(__WXX11__) - #define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_XPM #include "wx/x11/cursor.h" +#elif defined(__WXMGL__) + #include "wx/mgl/cursor.h" #elif defined(__WXDFB__) - #define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_CUR_RESOURCE #include "wx/dfb/cursor.h" #elif defined(__WXMAC__) - #define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_MACCURSOR_RESOURCE - #include "wx/osx/cursor.h" + #include "wx/mac/cursor.h" #elif defined(__WXCOCOA__) - #define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_MACCURSOR_RESOURCE #include "wx/cocoa/cursor.h" #elif defined(__WXPM__) - #define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_CUR_RESOURCE #include "wx/os2/cursor.h" #endif diff --git a/Source/3rd Party/wx/include/wx/dataobj.h b/Source/3rd Party/wx/include/wx/dataobj.h index 2d7ad48c4..31a756e23 100644 --- a/Source/3rd Party/wx/include/wx/dataobj.h +++ b/Source/3rd Party/wx/include/wx/dataobj.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin, Robert Roebling // Modified by: // Created: 26.05.99 -// RCS-ID: $Id$ +// RCS-ID: $Id: dataobj.h 40772 2006-08-23 13:38:45Z VZ $ // Copyright: (c) wxWidgets Team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -55,7 +55,7 @@ public: typedef NativeFormat; wxDataFormat(NativeFormat format = wxDF_INVALID); - wxDataFormat(const wxString& format); + wxDataFormat(const wxChar *format); wxDataFormat& operator=(NativeFormat format); wxDataFormat& operator=(const wxDataFormat& format); @@ -67,7 +67,7 @@ public: NativeFormat GetType() const; wxString GetId() const; - void SetId(const wxString& format); + void SetId(const wxChar *format); }; */ @@ -83,7 +83,7 @@ public: #elif defined(__WXX11__) #include "wx/x11/dataform.h" #elif defined(__WXMAC__) - #include "wx/osx/dataform.h" + #include "wx/mac/dataform.h" #elif defined(__WXCOCOA__) #include "wx/cocoa/dataform.h" #elif defined(__WXPM__) @@ -92,7 +92,7 @@ public: // the value for default argument to some functions (corresponds to // wxDF_INVALID) -extern WXDLLIMPEXP_CORE const wxDataFormat& wxFormatInvalid; +extern WXDLLEXPORT const wxDataFormat& wxFormatInvalid; // ---------------------------------------------------------------------------- // wxDataObject represents a piece of data which knows which formats it @@ -114,7 +114,7 @@ extern WXDLLIMPEXP_CORE const wxDataFormat& wxFormatInvalid; // to be supported by SetData() or GetDataHere(). // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxDataObjectBase +class WXDLLEXPORT wxDataObjectBase { public: enum Direction @@ -171,7 +171,7 @@ public: #elif defined(__WXGTK__) #include "wx/gtk1/dataobj.h" #elif defined(__WXMAC__) - #include "wx/osx/dataobj.h" + #include "wx/mac/dataobj.h" #elif defined(__WXCOCOA__) #include "wx/cocoa/dataobj.h" #elif defined(__WXPM__) @@ -194,7 +194,7 @@ public: // Otherwise, you should use wxDataObjectComposite or wxDataObject directly. // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxDataObjectSimple : public wxDataObject +class WXDLLEXPORT wxDataObjectSimple : public wxDataObject { public: // ctor takes the format we support, but it can also be set later with @@ -246,7 +246,7 @@ private: // the one and only format we support wxDataFormat m_format; - wxDECLARE_NO_COPY_CLASS(wxDataObjectSimple); + DECLARE_NO_COPY_CLASS(wxDataObjectSimple) }; // ---------------------------------------------------------------------------- @@ -261,7 +261,7 @@ private: WX_DECLARE_EXPORTED_LIST(wxDataObjectSimple, wxSimpleDataObjectList); -class WXDLLIMPEXP_CORE wxDataObjectComposite : public wxDataObject +class WXDLLEXPORT wxDataObjectComposite : public wxDataObject { public: // ctor @@ -274,17 +274,11 @@ public: void Add(wxDataObjectSimple *dataObject, bool preferred = false); // Report the format passed to the SetData method. This should be the - // format of the data object within the composite that received data from + // format of the data object within the composite that recieved data from // the clipboard or the DnD operation. You can use this method to find - // out what kind of data object was received. + // out what kind of data object was recieved. wxDataFormat GetReceivedFormat() const; - // Returns the pointer to the object which supports this format or NULL. - // The returned pointer is owned by wxDataObjectComposite and must - // therefore not be destroyed by the caller. - wxDataObjectSimple *GetObject(const wxDataFormat& format, - wxDataObjectBase::Direction dir = Get) const; - // implement base class pure virtuals // ---------------------------------- virtual wxDataFormat GetPreferredFormat(wxDataObjectBase::Direction dir = Get) const; @@ -301,6 +295,10 @@ public: virtual size_t GetBufferOffset( const wxDataFormat& format ); #endif +protected: + // returns the pointer to the object which supports this format or NULL + wxDataObjectSimple *GetObject(const wxDataFormat& format) const; + private: // the list of all (simple) data objects whose formats we support wxSimpleDataObjectList m_dataObjects; @@ -311,7 +309,7 @@ private: wxDataFormat m_receivedFormat; - wxDECLARE_NO_COPY_CLASS(wxDataObjectComposite); + DECLARE_NO_COPY_CLASS(wxDataObjectComposite) }; // ============================================================================ @@ -326,54 +324,7 @@ private: // wxTextDataObject contains text data // ---------------------------------------------------------------------------- -#if wxUSE_UNICODE - #if defined(__WXGTK20__) - #define wxNEEDS_UTF8_FOR_TEXT_DATAOBJ - #elif defined(__WXMAC__) - #define wxNEEDS_UTF16_FOR_TEXT_DATAOBJ - #endif -#endif // wxUSE_UNICODE - -class WXDLLIMPEXP_CORE wxHTMLDataObject : public wxDataObjectSimple -{ -public: - // ctor: you can specify the text here or in SetText(), or override - // GetText() - wxHTMLDataObject(const wxString& html = wxEmptyString) - : wxDataObjectSimple(wxDF_HTML), - m_html(html) - { - } - - // virtual functions which you may override if you want to provide text on - // demand only - otherwise, the trivial default versions will be used - virtual size_t GetLength() const { return m_html.Len() + 1; } - virtual wxString GetHTML() const { return m_html; } - virtual void SetHTML(const wxString& html) { m_html = html; } - - virtual size_t GetDataSize() const; - virtual bool GetDataHere(void *buf) const; - virtual bool SetData(size_t len, const void *buf); - - // Must provide overloads to avoid hiding them (and warnings about it) - virtual size_t GetDataSize(const wxDataFormat&) const - { - return GetDataSize(); - } - virtual bool GetDataHere(const wxDataFormat&, void *buf) const - { - return GetDataHere(buf); - } - virtual bool SetData(const wxDataFormat&, size_t len, const void *buf) - { - return SetData(len, buf); - } - -private: - wxString m_html; -}; - -class WXDLLIMPEXP_CORE wxTextDataObject : public wxDataObjectSimple +class WXDLLEXPORT wxTextDataObject : public wxDataObjectSimple { public: // ctor: you can specify the text here or in SetText(), or override @@ -400,7 +351,7 @@ public: // ---------------------------------- // some platforms have 2 and not 1 format for text data -#if defined(wxNEEDS_UTF8_FOR_TEXT_DATAOBJ) || defined(wxNEEDS_UTF16_FOR_TEXT_DATAOBJ) +#if wxUSE_UNICODE && (defined(__WXGTK20__) || defined(__WXMAC__)) virtual size_t GetFormatCount(Direction WXUNUSED(dir) = Get) const { return 2; } virtual void GetAllFormats(wxDataFormat *formats, wxDataObjectBase::Direction WXUNUSED(dir) = Get) const; @@ -412,7 +363,7 @@ public: size_t GetDataSize(const wxDataFormat& format) const; bool GetDataHere(const wxDataFormat& format, void *pBuf) const; bool SetData(const wxDataFormat& format, size_t nLen, const void* pBuf); -#else // !wxNEEDS_UTF{8,16}_FOR_TEXT_DATAOBJ +#else virtual size_t GetDataSize() const; virtual bool GetDataHere(void *buf) const; virtual bool SetData(size_t len, const void *buf); @@ -429,19 +380,19 @@ public: { return SetData(len, buf); } -#endif // different wxTextDataObject implementations +#endif private: wxString m_text; - wxDECLARE_NO_COPY_CLASS(wxTextDataObject); + DECLARE_NO_COPY_CLASS(wxTextDataObject) }; // ---------------------------------------------------------------------------- // wxBitmapDataObject contains a bitmap // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxBitmapDataObjectBase : public wxDataObjectSimple +class WXDLLEXPORT wxBitmapDataObjectBase : public wxDataObjectSimple { public: // ctor: you can specify the bitmap here or in SetBitmap(), or override @@ -459,7 +410,7 @@ public: protected: wxBitmap m_bitmap; - wxDECLARE_NO_COPY_CLASS(wxBitmapDataObjectBase); + DECLARE_NO_COPY_CLASS(wxBitmapDataObjectBase) }; // ---------------------------------------------------------------------------- @@ -469,7 +420,7 @@ protected: // data from drag and drop operation. // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxFileDataObjectBase : public wxDataObjectSimple +class WXDLLEXPORT wxFileDataObjectBase : public wxDataObjectSimple { public: // ctor: use AddFile() later to fill the array @@ -481,7 +432,7 @@ public: protected: wxArrayString m_filenames; - wxDECLARE_NO_COPY_CLASS(wxFileDataObjectBase); + DECLARE_NO_COPY_CLASS(wxFileDataObjectBase) }; // ---------------------------------------------------------------------------- @@ -490,7 +441,7 @@ protected: // It is understood that this data can be copied bitwise. // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxCustomDataObject : public wxDataObjectSimple +class WXDLLEXPORT wxCustomDataObject : public wxDataObjectSimple { public: // if you don't specify the format in the ctor, you can still use @@ -542,7 +493,7 @@ private: size_t m_size; void *m_data; - wxDECLARE_NO_COPY_CLASS(wxCustomDataObject); + DECLARE_NO_COPY_CLASS(wxCustomDataObject) }; // ---------------------------------------------------------------------------- @@ -551,20 +502,19 @@ private: #if defined(__WXMSW__) #include "wx/msw/ole/dataobj2.h" - // wxURLDataObject defined in msw/ole/dataobj2.h -#elif defined(__WXGTK20__) - #include "wx/gtk/dataobj2.h" - // wxURLDataObject defined in msw/ole/dataobj2.h -#else - #if defined(__WXGTK__) + // wxURLDataObject defined in msw/ole/dataobj2.h +#else // !__WXMSW__ + #if defined(__WXGTK20__) + #include "wx/gtk/dataobj2.h" + #elif defined(__WXGTK__) #include "wx/gtk1/dataobj2.h" #elif defined(__WXX11__) #include "wx/x11/dataobj2.h" #elif defined(__WXMOTIF__) #include "wx/motif/dataobj2.h" #elif defined(__WXMAC__) - #include "wx/osx/dataobj2.h" + #include "wx/mac/dataobj2.h" #elif defined(__WXCOCOA__) #include "wx/cocoa/dataobj2.h" #elif defined(__WXPM__) @@ -572,7 +522,7 @@ private: #endif // wxURLDataObject is simply wxTextDataObject with a different name - class WXDLLIMPEXP_CORE wxURLDataObject : public wxTextDataObject + class WXDLLEXPORT wxURLDataObject : public wxTextDataObject { public: wxURLDataObject(const wxString& url = wxEmptyString) @@ -583,7 +533,7 @@ private: wxString GetURL() const { return GetText(); } void SetURL(const wxString& url) { SetText(url); } }; -#endif +#endif // __WXMSW__/!__WXMSW__ #endif // wxUSE_DATAOBJ diff --git a/Source/3rd Party/wx/include/wx/datetime.h b/Source/3rd Party/wx/include/wx/datetime.h index f4bca124a..f527b9d42 100644 --- a/Source/3rd Party/wx/include/wx/datetime.h +++ b/Source/3rd Party/wx/include/wx/datetime.h @@ -5,7 +5,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 10.02.99 -// RCS-ID: $Id$ +// RCS-ID: $Id: datetime.h 61872 2009-09-09 22:37:05Z VZ $ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -17,23 +17,19 @@ #if wxUSE_DATETIME -#ifdef __WXWINCE__ - #include "wx/msw/wince/time.h" +#ifndef __WXWINCE__ +#include #else - #include -#endif // OS +#include "wx/msw/wince/time.h" +#endif #include // for INT_MIN #include "wx/longlong.h" -#include "wx/anystr.h" class WXDLLIMPEXP_FWD_BASE wxDateTime; class WXDLLIMPEXP_FWD_BASE wxTimeSpan; class WXDLLIMPEXP_FWD_BASE wxDateSpan; -#ifdef __WINDOWS__ -struct _SYSTEMTIME; -#endif #include "wx/dynarray.h" @@ -41,8 +37,11 @@ struct _SYSTEMTIME; // set this to the corresponding value in seconds 1/1/1970 has on your // systems c-runtime -#define WX_TIME_BASE_OFFSET 0 - +#if defined(__WXMAC__) && !defined(__DARWIN__) && __MSL__ < 0x6000 + #define WX_TIME_BASE_OFFSET ( 2082844800L + 126144000L ) +#else + #define WX_TIME_BASE_OFFSET 0 +#endif /* * TODO * @@ -53,6 +52,27 @@ struct _SYSTEMTIME; * 5. wxDateTimeHolidayAuthority for Easter and other christian feasts */ +/* Two wrapper functions for thread safety */ +#ifdef HAVE_LOCALTIME_R +#define wxLocaltime_r localtime_r +#else +WXDLLIMPEXP_BASE struct tm *wxLocaltime_r(const time_t*, struct tm*); +#if wxUSE_THREADS && !defined(__WINDOWS__) && !defined(__WATCOMC__) + // On Windows, localtime _is_ threadsafe! +#warning using pseudo thread-safe wrapper for localtime to emulate localtime_r +#endif +#endif + +#ifdef HAVE_GMTIME_R +#define wxGmtime_r gmtime_r +#else +WXDLLIMPEXP_BASE struct tm *wxGmtime_r(const time_t*, struct tm*); +#if wxUSE_THREADS && !defined(__WINDOWS__) && !defined(__WATCOMC__) + // On Windows, gmtime _is_ threadsafe! +#warning using pseudo thread-safe wrapper for gmtime to emulate gmtime_r +#endif +#endif + /* The three (main) classes declared in this header represent: @@ -107,25 +127,12 @@ struct _SYSTEMTIME; // wxInvalidDateTime) class WXDLLIMPEXP_FWD_BASE wxDateTime; -extern WXDLLIMPEXP_DATA_BASE(const char) wxDefaultDateTimeFormat[]; -extern WXDLLIMPEXP_DATA_BASE(const char) wxDefaultTimeSpanFormat[]; +extern WXDLLIMPEXP_DATA_BASE(const wxChar*) wxDefaultDateTimeFormat; +extern WXDLLIMPEXP_DATA_BASE(const wxChar*) wxDefaultTimeSpanFormat; extern WXDLLIMPEXP_DATA_BASE(const wxDateTime) wxDefaultDateTime; #define wxInvalidDateTime wxDefaultDateTime - -// ---------------------------------------------------------------------------- -// conditional compilation -// ---------------------------------------------------------------------------- - -// if configure detected strftime(), we have it too -#ifdef HAVE_STRFTIME - #define wxHAS_STRFTIME -// suppose everyone else has strftime except Win CE unless VC8 is used -#elif !defined(__WXWINCE__) || defined(__VISUALC8__) - #define wxHAS_STRFTIME -#endif - // ---------------------------------------------------------------------------- // wxDateTime represents an absolute moment in the time // ---------------------------------------------------------------------------- @@ -152,7 +159,7 @@ public: // the time in the current time zone Local, - // zones from GMT (= Greenwich Mean Time): they're guaranteed to be + // zones from GMT (= Greenwhich Mean Time): they're guaranteed to be // consequent numbers, so writing something like `GMT0 + offset' is // safe if abs(offset) <= 12 @@ -226,7 +233,7 @@ public: // adoption of the Gregorian calendar (see IsGregorian()) // // All data and comments taken verbatim from "The Calendar FAQ (v 2.0)" - // by Claus Tøndering, http://www.pip.dknet.dk/~c-t/calendar.html + // by Claus Tøndering, http://www.pip.dknet.dk/~c-t/calendar.html // except for the comments "we take". // // Symbol "->" should be read as "was followed by" in the comments @@ -415,15 +422,19 @@ public: public: TimeZone(TZ tz); - // create time zone object with the given offset - TimeZone(long offset = 0) { m_offset = offset; } + // don't use this ctor, it doesn't work for negative offsets (but can't + // be removed or changed to avoid breaking ABI in 2.8) + TimeZone(wxDateTime_t offset = 0) { m_offset = offset; } +#if wxABI_VERSION >= 20808 + // create time zone object with the given offset static TimeZone Make(long offset) { TimeZone tz; tz.m_offset = offset; return tz; } +#endif // wxABI 2.8.8+ long GetOffset() const { return m_offset; } @@ -441,9 +452,7 @@ public: // instead of modifying the member fields directly! struct WXDLLIMPEXP_BASE Tm { - wxDateTime_t msec, sec, min, hour, - mday, // Day of the month in 1..31 range. - yday; // Day of the year in 0..365 range. + wxDateTime_t msec, sec, min, hour, mday; Month mon; int year; @@ -478,10 +487,9 @@ public: // the timezone we correspond to TimeZone m_tz; - // This value can only be accessed via GetWeekDay() and not directly - // because it's not always computed when creating this object and may - // need to be calculated on demand. - wxDateTime_t wday; + // these values can't be accessed directly because they're not always + // computed and we calculate them on demand + wxDateTime_t wday, yday; }; // static methods @@ -524,25 +532,16 @@ public: int year = Inv_Year, Calendar cal = Gregorian); - // get the full (default) or abbreviated month name in the current // locale, returns empty string on error static wxString GetMonthName(Month month, NameFlags flags = Name_Full); - // get the standard English full (default) or abbreviated month name - static wxString GetEnglishMonthName(Month month, - NameFlags flags = Name_Full); - // get the full (default) or abbreviated weekday name in the current // locale, returns empty string on error static wxString GetWeekDayName(WeekDay weekday, NameFlags flags = Name_Full); - // get the standard English full (default) or abbreviated weekday name - static wxString GetEnglishWeekDayName(WeekDay weekday, - NameFlags flags = Name_Full); - // get the AM and PM strings in the current locale (may be empty) static void GetAmPmStrings(wxString *am, wxString *pm); @@ -578,7 +577,7 @@ public: // ------------------------------------------------------------------------ // default ctor does not initialize the object, use Set()! - wxDateTime() { m_time = wxLongLong(wxINT32_MIN, 0); } + wxDateTime() { m_time = wxLongLong((wxInt32)UINT_MAX, UINT_MAX); } // from time_t: seconds since the Epoch 00:00:00 UTC, Jan 1, 1970) #if (!(defined(__VISAGECPP__) && __IBMCPP__ >= 400)) @@ -606,12 +605,6 @@ public: wxDateTime_t minute = 0, wxDateTime_t second = 0, wxDateTime_t millisec = 0); -#ifdef __WINDOWS__ - wxDateTime(const struct _SYSTEMTIME& st) - { - SetFromMSWSysTime(st); - } -#endif // default copy ctor ok @@ -659,9 +652,11 @@ public: // resets time to 00:00:00, doesn't change the date wxDateTime& ResetTime(); +#if wxABI_VERSION >= 20802 // get the date part of this object only, i.e. the object which has the // same date as this one but time of 00:00:00 wxDateTime GetDateOnly() const; +#endif // wxABI 2.8.1+ // the following functions don't change the values of the other // fields, i.e. SetMinute() won't change either hour or seconds value @@ -711,7 +706,7 @@ public: wxDateTime& SetToPrevWeekDay(WeekDay weekday); inline wxDateTime GetPrevWeekDay(WeekDay weekday) const; - // set to Nth occurrence of given weekday in the given month of the + // set to Nth occurence of given weekday in the given month of the // given year (time is set to 0), return true on success and false on // failure. n may be positive (1..5) or negative to count from the end // of the month (see helper function SetToLastWeekDay()) @@ -926,20 +921,6 @@ public: // pack the date in DOS format unsigned long GetAsDOS() const; - // SYSTEMTIME format - // ------------------------------------------------------------------------ -#ifdef __WINDOWS__ - // convert SYSTEMTIME to wxDateTime - wxDateTime& SetFromMSWSysTime(const struct _SYSTEMTIME& st); - - // convert wxDateTime to SYSTEMTIME - void GetAsMSWSysTime(struct _SYSTEMTIME* st) const; - - // same as above but only take date part into account, time is always zero - wxDateTime& SetFromMSWSysDate(const struct _SYSTEMTIME& st); - void GetAsMSWSysDate(struct _SYSTEMTIME* st) const; -#endif // __WINDOWS__ - // comparison (see also functions below for operator versions) // ------------------------------------------------------------------------ @@ -1063,193 +1044,46 @@ public: inline wxTimeSpan Subtract(const wxDateTime& dt) const; inline wxTimeSpan operator-(const wxDateTime& dt2) const; - // conversion to/from text + // conversion to/from text: all conversions from text return the pointer to + // the next character following the date specification (i.e. the one where + // the scan had to stop) or NULL on failure. // ------------------------------------------------------------------------ - // all conversions functions return true to indicate whether parsing - // succeeded or failed and fill in the provided end iterator, which must - // not be NULL, with the location of the character where the parsing - // stopped (this will be end() of the passed string if everything was - // parsed) - // parse a string in RFC 822 format (found e.g. in mail headers and // having the form "Wed, 10 Feb 1999 19:07:07 +0100") - bool ParseRfc822Date(const wxString& date, - wxString::const_iterator *end); - + const wxChar *ParseRfc822Date(const wxChar* date); // parse a date/time in the given format (see strptime(3)), fill in // the missing (in the string) fields with the values of dateDef (by // default, they will not change if they had valid values or will // default to Today() otherwise) - bool ParseFormat(const wxString& date, - const wxString& format, - const wxDateTime& dateDef, - wxString::const_iterator *end); - - bool ParseFormat(const wxString& date, - const wxString& format, - wxString::const_iterator *end) - { - return ParseFormat(date, format, wxDefaultDateTime, end); - } - - bool ParseFormat(const wxString& date, - wxString::const_iterator *end) - { - return ParseFormat(date, wxDefaultDateTimeFormat, wxDefaultDateTime, end); - } - - // parse a string containing date, time or both in ISO 8601 format - // - // notice that these functions are new in wx 3.0 and so we don't - // provide compatibility overloads for them - bool ParseISODate(const wxString& date) - { - wxString::const_iterator end; - return ParseFormat(date, wxS("%Y-%m-%d"), &end) && end == date.end(); - } - - bool ParseISOTime(const wxString& time) - { - wxString::const_iterator end; - return ParseFormat(time, wxS("%H:%M:%S"), &end) && end == time.end(); - } - - bool ParseISOCombined(const wxString& datetime, char sep = 'T') - { - wxString::const_iterator end; - const wxString fmt = wxS("%Y-%m-%d") + wxString(sep) + wxS("%H:%M:%S"); - return ParseFormat(datetime, fmt, &end) && end == datetime.end(); - } - + const wxChar *ParseFormat(const wxChar *date, + const wxChar *format = wxDefaultDateTimeFormat, + const wxDateTime& dateDef = wxDefaultDateTime); // parse a string containing the date/time in "free" format, this // function will try to make an educated guess at the string contents - bool ParseDateTime(const wxString& datetime, - wxString::const_iterator *end); - + const wxChar *ParseDateTime(const wxChar *datetime); // parse a string containing the date only in "free" format (less // flexible than ParseDateTime) - bool ParseDate(const wxString& date, - wxString::const_iterator *end); - + const wxChar *ParseDate(const wxChar *date); // parse a string containing the time only in "free" format - bool ParseTime(const wxString& time, - wxString::const_iterator *end); - + const wxChar *ParseTime(const wxChar *time); // this function accepts strftime()-like format string (default // argument corresponds to the preferred date and time representation // for the current locale) and returns the string containing the // resulting text representation - wxString Format(const wxString& format = wxDefaultDateTimeFormat, + wxString Format(const wxChar *format = wxDefaultDateTimeFormat, const TimeZone& tz = Local) const; // preferred date representation for the current locale - wxString FormatDate() const { return Format(wxS("%x")); } + wxString FormatDate() const { return Format(wxT("%x")); } // preferred time representation for the current locale - wxString FormatTime() const { return Format(wxS("%X")); } + wxString FormatTime() const { return Format(wxT("%X")); } // returns the string representing the date in ISO 8601 format // (YYYY-MM-DD) - wxString FormatISODate() const { return Format(wxS("%Y-%m-%d")); } + wxString FormatISODate() const { return Format(wxT("%Y-%m-%d")); } // returns the string representing the time in ISO 8601 format // (HH:MM:SS) - wxString FormatISOTime() const { return Format(wxS("%H:%M:%S")); } - // return the combined date time representation in ISO 8601 format; the - // separator character should be 'T' according to the standard but it - // can also be useful to set it to ' ' - wxString FormatISOCombined(char sep = 'T') const - { return FormatISODate() + sep + FormatISOTime(); } - - - // backwards compatible versions of the parsing functions: they return an - // object representing the next character following the date specification - // (i.e. the one where the scan had to stop) or a special NULL-like object - // on failure - // - // they're not deprecated because a lot of existing code uses them and - // there is no particular harm in keeping them but you should still prefer - // the versions above in the new code - wxAnyStrPtr ParseRfc822Date(const wxString& date) - { - wxString::const_iterator end; - return ParseRfc822Date(date, &end) ? wxAnyStrPtr(date, end) - : wxAnyStrPtr(); - } - - wxAnyStrPtr ParseFormat(const wxString& date, - const wxString& format = wxDefaultDateTimeFormat, - const wxDateTime& dateDef = wxDefaultDateTime) - { - wxString::const_iterator end; - return ParseFormat(date, format, dateDef, &end) ? wxAnyStrPtr(date, end) - : wxAnyStrPtr(); - } - - wxAnyStrPtr ParseDateTime(const wxString& datetime) - { - wxString::const_iterator end; - return ParseDateTime(datetime, &end) ? wxAnyStrPtr(datetime, end) - : wxAnyStrPtr(); - } - - wxAnyStrPtr ParseDate(const wxString& date) - { - wxString::const_iterator end; - return ParseDate(date, &end) ? wxAnyStrPtr(date, end) - : wxAnyStrPtr(); - } - - wxAnyStrPtr ParseTime(const wxString& time) - { - wxString::const_iterator end; - return ParseTime(time, &end) ? wxAnyStrPtr(time, end) - : wxAnyStrPtr(); - } - - // In addition to wxAnyStrPtr versions above we also must provide the - // overloads for C strings as we must return a pointer into the original - // string and not inside a temporary wxString which would have been created - // if the overloads above were used. - // - // And then we also have to provide the overloads for wxCStrData, as usual. - // Unfortunately those ones can't return anything as we don't have any - // sufficiently long-lived wxAnyStrPtr to return from them: any temporary - // strings it would point to would be destroyed when this function returns - // making it impossible to dereference the return value. So we just don't - // return anything from here which at least allows to keep compatibility - // with the code not testing the return value. Other uses of this method - // need to be converted to use one of the new bool-returning overloads - // above. - void ParseRfc822Date(const wxCStrData& date) - { ParseRfc822Date(wxString(date)); } - const char* ParseRfc822Date(const char* date); - const wchar_t* ParseRfc822Date(const wchar_t* date); - - void ParseFormat(const wxCStrData& date, - const wxString& format = wxDefaultDateTimeFormat, - const wxDateTime& dateDef = wxDefaultDateTime) - { ParseFormat(wxString(date), format, dateDef); } - const char* ParseFormat(const char* date, - const wxString& format = wxDefaultDateTimeFormat, - const wxDateTime& dateDef = wxDefaultDateTime); - const wchar_t* ParseFormat(const wchar_t* date, - const wxString& format = wxDefaultDateTimeFormat, - const wxDateTime& dateDef = wxDefaultDateTime); - - void ParseDateTime(const wxCStrData& datetime) - { ParseDateTime(wxString(datetime)); } - const char* ParseDateTime(const char* datetime); - const wchar_t* ParseDateTime(const wchar_t* datetime); - - void ParseDate(const wxCStrData& date) - { ParseDate(wxString(date)); } - const char* ParseDate(const char* date); - const wchar_t* ParseDate(const wchar_t* date); - - void ParseTime(const wxCStrData& time) - { ParseTime(wxString(time)); } - const char* ParseTime(const char* time); - const wchar_t* ParseTime(const wchar_t* time); - + wxString FormatISOTime() const { return Format(wxT("%H:%M:%S")); } // implementation // ------------------------------------------------------------------------ @@ -1261,7 +1095,7 @@ public: inline wxLongLong GetValue() const; // a helper function to get the current time_t - static time_t GetTimeNow() { return time(NULL); } + static time_t GetTimeNow() { return time((time_t *)NULL); } // another one to get the current time broken down static struct tm *GetTmNow() @@ -1418,7 +1252,7 @@ public: // compare two timestamps: works with the absolute values, i.e. 1 // hour is shorter than -2 hours. Also, it will return false if the // timespans are equal in absolute value. - bool IsShorterThan(const wxTimeSpan& t) const; + bool IsShorterThan(const wxTimeSpan& t) const { return !IsLongerThan(t); } inline bool operator<(const wxTimeSpan &ts) const { @@ -1475,7 +1309,7 @@ public: // resulting text representation. Notice that only some of format // specifiers valid for wxDateTime are valid for wxTimeSpan: hours, // minutes and seconds make sense, but not "PM/AM" string for example. - wxString Format(const wxString& format = wxDefaultTimeSpanFormat) const; + wxString Format(const wxChar *format = wxDefaultTimeSpanFormat) const; // implementation // ------------------------------------------------------------------------ @@ -1753,9 +1587,7 @@ protected: inline bool wxDateTime::IsInStdRange() const { - // currently we don't know what is the real type of time_t so prefer to err - // on the safe side and limit it to 32 bit values which is safe everywhere - return m_time >= 0l && (m_time / TIME_T_FACTOR) < wxINT32_MAX; + return m_time >= 0l && (m_time / TIME_T_FACTOR) < LONG_MAX; } /* static */ @@ -2115,9 +1947,9 @@ inline wxLongLong wxTimeSpan::GetSeconds() const inline int wxTimeSpan::GetMinutes() const { - // For compatibility, this method (and the other accessors) return int, - // even though GetLo() actually returns unsigned long with greater range. - return static_cast((GetSeconds() / 60l).GetLo()); + // explicit cast to int suppresses a warning with CodeWarrior and possibly + // others (changing the return type to long from int is impossible in 2.8) + return (int)((GetSeconds() / 60l).GetLo()); } inline int wxTimeSpan::GetHours() const @@ -2190,11 +2022,6 @@ inline bool wxTimeSpan::IsLongerThan(const wxTimeSpan& ts) const return GetValue().Abs() > ts.GetValue().Abs(); } -inline bool wxTimeSpan::IsShorterThan(const wxTimeSpan& ts) const -{ - return GetValue().Abs() < ts.GetValue().Abs(); -} - // ---------------------------------------------------------------------------- // wxDateSpan // ---------------------------------------------------------------------------- diff --git a/Source/3rd Party/wx/include/wx/datstrm.h b/Source/3rd Party/wx/include/wx/datstrm.h index 5cf06eb29..b6d00e43e 100644 --- a/Source/3rd Party/wx/include/wx/datstrm.h +++ b/Source/3rd Party/wx/include/wx/datstrm.h @@ -1,10 +1,10 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/datstrm.h +// Name: datstrm.h // Purpose: Data stream classes // Author: Guilhem Lavaux // Modified by: Mickael Gilabert // Created: 28/06/1998 -// RCS-ID: $Id$ +// RCS-ID: $Id: datstrm.h 38576 2006-04-05 16:10:08Z VZ $ // Copyright: (c) Guilhem Lavaux // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -22,7 +22,7 @@ class WXDLLIMPEXP_BASE wxDataInputStream { public: #if wxUSE_UNICODE - wxDataInputStream(wxInputStream& s, const wxMBConv& conv = wxConvUTF8 ); + wxDataInputStream(wxInputStream& s, const wxMBConv& conv = wxConvAuto()); #else wxDataInputStream(wxInputStream& s); #endif @@ -79,11 +79,6 @@ public: void BigEndianOrdered(bool be_order) { m_be_order = be_order; } -#if wxUSE_UNICODE - void SetConv( const wxMBConv &conv ); - wxMBConv *GetConv() const { return m_conv; } -#endif - protected: wxInputStream *m_input; bool m_be_order; @@ -91,14 +86,14 @@ protected: wxMBConv *m_conv; #endif - wxDECLARE_NO_COPY_CLASS(wxDataInputStream); + DECLARE_NO_COPY_CLASS(wxDataInputStream) }; class WXDLLIMPEXP_BASE wxDataOutputStream { public: #if wxUSE_UNICODE - wxDataOutputStream(wxOutputStream& s, const wxMBConv& conv = wxConvUTF8 ); + wxDataOutputStream(wxOutputStream& s, const wxMBConv& conv = wxConvAuto()); #else wxDataOutputStream(wxOutputStream& s); #endif @@ -137,6 +132,7 @@ public: void Write8(const wxUint8 *buffer, size_t size); void WriteDouble(const double *buffer, size_t size); + wxDataOutputStream& operator<<(const wxChar *string); wxDataOutputStream& operator<<(const wxString& string); wxDataOutputStream& operator<<(wxInt8 c); wxDataOutputStream& operator<<(wxInt16 i); @@ -157,11 +153,6 @@ public: void BigEndianOrdered(bool be_order) { m_be_order = be_order; } -#if wxUSE_UNICODE - void SetConv( const wxMBConv &conv ); - wxMBConv *GetConv() const { return m_conv; } -#endif - protected: wxOutputStream *m_output; bool m_be_order; @@ -169,7 +160,7 @@ protected: wxMBConv *m_conv; #endif - wxDECLARE_NO_COPY_CLASS(wxDataOutputStream); + DECLARE_NO_COPY_CLASS(wxDataOutputStream) }; #endif diff --git a/Source/3rd Party/wx/include/wx/dc.h b/Source/3rd Party/wx/include/wx/dc.h index 63cde6779..8448d8005 100644 --- a/Source/3rd Party/wx/include/wx/dc.h +++ b/Source/3rd Party/wx/include/wx/dc.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 05/25/99 -// RCS-ID: $Id$ +// RCS-ID: $Id: dc.h 59768 2009-03-23 12:35:12Z VZ $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -26,137 +26,25 @@ #include "wx/brush.h" #include "wx/pen.h" #include "wx/palette.h" +#include "wx/list.h" // we use wxList in inline functions #include "wx/dynarray.h" #include "wx/math.h" -#include "wx/image.h" -#include "wx/region.h" -#include "wx/affinematrix2d.h" - -#define wxUSE_NEW_DC 1 class WXDLLIMPEXP_FWD_CORE wxDC; -class WXDLLIMPEXP_FWD_CORE wxClientDC; -class WXDLLIMPEXP_FWD_CORE wxPaintDC; -class WXDLLIMPEXP_FWD_CORE wxWindowDC; -class WXDLLIMPEXP_FWD_CORE wxScreenDC; -class WXDLLIMPEXP_FWD_CORE wxMemoryDC; -class WXDLLIMPEXP_FWD_CORE wxPrinterDC; -class WXDLLIMPEXP_FWD_CORE wxPrintData; +class WXDLLIMPEXP_FWD_CORE wxDCBase; -#if wxUSE_GRAPHICS_CONTEXT -class WXDLLIMPEXP_FWD_CORE wxGraphicsContext; -#endif - -// Logical ops -enum wxRasterOperationMode -{ - wxCLEAR, // 0 - wxXOR, // src XOR dst - wxINVERT, // NOT dst - wxOR_REVERSE, // src OR (NOT dst) - wxAND_REVERSE, // src AND (NOT dst) - wxCOPY, // src - wxAND, // src AND dst - wxAND_INVERT, // (NOT src) AND dst - wxNO_OP, // dst - wxNOR, // (NOT src) AND (NOT dst) - wxEQUIV, // (NOT src) XOR dst - wxSRC_INVERT, // (NOT src) - wxOR_INVERT, // (NOT src) OR dst - wxNAND, // (NOT src) OR (NOT dst) - wxOR, // src OR dst - wxSET // 1 -#if WXWIN_COMPATIBILITY_2_8 - ,wxROP_BLACK = wxCLEAR, - wxBLIT_BLACKNESS = wxCLEAR, - wxROP_XORPEN = wxXOR, - wxBLIT_SRCINVERT = wxXOR, - wxROP_NOT = wxINVERT, - wxBLIT_DSTINVERT = wxINVERT, - wxROP_MERGEPENNOT = wxOR_REVERSE, - wxBLIT_00DD0228 = wxOR_REVERSE, - wxROP_MASKPENNOT = wxAND_REVERSE, - wxBLIT_SRCERASE = wxAND_REVERSE, - wxROP_COPYPEN = wxCOPY, - wxBLIT_SRCCOPY = wxCOPY, - wxROP_MASKPEN = wxAND, - wxBLIT_SRCAND = wxAND, - wxROP_MASKNOTPEN = wxAND_INVERT, - wxBLIT_00220326 = wxAND_INVERT, - wxROP_NOP = wxNO_OP, - wxBLIT_00AA0029 = wxNO_OP, - wxROP_NOTMERGEPEN = wxNOR, - wxBLIT_NOTSRCERASE = wxNOR, - wxROP_NOTXORPEN = wxEQUIV, - wxBLIT_00990066 = wxEQUIV, - wxROP_NOTCOPYPEN = wxSRC_INVERT, - wxBLIT_NOTSCRCOPY = wxSRC_INVERT, - wxROP_MERGENOTPEN = wxOR_INVERT, - wxBLIT_MERGEPAINT = wxOR_INVERT, - wxROP_NOTMASKPEN = wxNAND, - wxBLIT_007700E6 = wxNAND, - wxROP_MERGEPEN = wxOR, - wxBLIT_SRCPAINT = wxOR, - wxROP_WHITE = wxSET, - wxBLIT_WHITENESS = wxSET -#endif //WXWIN_COMPATIBILITY_2_8 -}; - -// Flood styles -enum wxFloodFillStyle -{ - wxFLOOD_SURFACE = 1, - wxFLOOD_BORDER -}; - -// Mapping modes -enum wxMappingMode -{ - wxMM_TEXT = 1, - wxMM_METRIC, - wxMM_LOMETRIC, - wxMM_TWIPS, - wxMM_POINTS -}; - -// Description of text characteristics. -struct wxFontMetrics -{ - wxFontMetrics() - { - height = - ascent = - descent = - internalLeading = - externalLeading = - averageWidth = 0; - } - - int height, // Total character height. - ascent, // Part of the height above the baseline. - descent, // Part of the height below the baseline. - internalLeading, // Intra-line spacing. - externalLeading, // Inter-line spacing. - averageWidth; // Average font width, a.k.a. "x-width". -}; - -#if WXWIN_COMPATIBILITY_2_8 - -//----------------------------------------------------------------------------- -// wxDrawObject helper class -//----------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxDrawObject +class WXDLLEXPORT wxDrawObject { public: - wxDEPRECATED_CONSTRUCTOR(wxDrawObject)() + + wxDrawObject() : m_isBBoxValid(false) , m_minX(0), m_minY(0), m_maxX(0), m_maxY(0) { } virtual ~wxDrawObject() { } - virtual void Draw(wxDC&) const { } + virtual void Draw(wxDCBase&) const { } virtual void CalcBoundingBox(wxCoord x, wxCoord y) { @@ -202,114 +90,297 @@ protected: wxCoord m_minX, m_minY, m_maxX, m_maxY; }; -#endif // WXWIN_COMPATIBILITY_2_8 +// --------------------------------------------------------------------------- +// global variables +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// wxDC is the device context - object on which any drawing is done +// --------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -// wxDCFactory -//----------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_CORE wxDCImpl; - -class WXDLLIMPEXP_CORE wxDCFactory +class WXDLLEXPORT wxDCBase : public wxObject { public: - wxDCFactory() {} - virtual ~wxDCFactory() {} + wxDCBase() + : m_colour(wxColourDisplay()) + , m_ok(true) + , m_clipping(false) + , m_isInteractive(0) + , m_isBBoxValid(false) + , m_logicalOriginX(0), m_logicalOriginY(0) + , m_deviceOriginX(0), m_deviceOriginY(0) + , m_logicalScaleX(1.0), m_logicalScaleY(1.0) + , m_userScaleX(1.0), m_userScaleY(1.0) + , m_scaleX(1.0), m_scaleY(1.0) + , m_signX(1), m_signY(1) + , m_minX(0), m_minY(0), m_maxX(0), m_maxY(0) + , m_clipX1(0), m_clipY1(0), m_clipX2(0), m_clipY2(0) + , m_logicalFunction(wxCOPY) + , m_backgroundMode(wxTRANSPARENT) + , m_mappingMode(wxMM_TEXT) + , m_pen() + , m_brush() + , m_backgroundBrush(*wxTRANSPARENT_BRUSH) + , m_textForegroundColour(*wxBLACK) + , m_textBackgroundColour(*wxWHITE) + , m_font() +#if wxUSE_PALETTE + , m_palette() + , m_hasCustomPalette(false) +#endif // wxUSE_PALETTE + { + ResetBoundingBox(); + ResetClipping(); + } - virtual wxDCImpl* CreateWindowDC( wxWindowDC *owner, wxWindow *window ) = 0; - virtual wxDCImpl* CreateClientDC( wxClientDC *owner, wxWindow *window ) = 0; - virtual wxDCImpl* CreatePaintDC( wxPaintDC *owner, wxWindow *window ) = 0; - virtual wxDCImpl* CreateMemoryDC( wxMemoryDC *owner ) = 0; - virtual wxDCImpl* CreateMemoryDC( wxMemoryDC *owner, wxBitmap &bitmap ) = 0; - virtual wxDCImpl* CreateMemoryDC( wxMemoryDC *owner, wxDC *dc ) = 0; - virtual wxDCImpl* CreateScreenDC( wxScreenDC *owner ) = 0; -#if wxUSE_PRINTING_ARCHITECTURE - virtual wxDCImpl* CreatePrinterDC( wxPrinterDC *owner, const wxPrintData &data ) = 0; + virtual ~wxDCBase() { } + + // graphic primitives + // ------------------ + + virtual void DrawObject(wxDrawObject* drawobject) + { + drawobject->Draw(*this); + CalcBoundingBox(drawobject->MinX(),drawobject->MinY()); + CalcBoundingBox(drawobject->MaxX(),drawobject->MaxY()); + } + + bool FloodFill(wxCoord x, wxCoord y, const wxColour& col, + int style = wxFLOOD_SURFACE) + { return DoFloodFill(x, y, col, style); } + bool FloodFill(const wxPoint& pt, const wxColour& col, + int style = wxFLOOD_SURFACE) + { return DoFloodFill(pt.x, pt.y, col, style); } + + // fill the area specified by rect with a radial gradient, starting from + // initialColour in the centre of the cercle and fading to destColour. + void GradientFillConcentric(const wxRect& rect, + const wxColour& initialColour, + const wxColour& destColour) + { GradientFillConcentric(rect, initialColour, destColour, + wxPoint(rect.GetWidth() / 2, + rect.GetHeight() / 2)); } + + void GradientFillConcentric(const wxRect& rect, + const wxColour& initialColour, + const wxColour& destColour, + const wxPoint& circleCenter) + { DoGradientFillConcentric(rect, initialColour, destColour, circleCenter); } + + // fill the area specified by rect with a linear gradient + void GradientFillLinear(const wxRect& rect, + const wxColour& initialColour, + const wxColour& destColour, + wxDirection nDirection = wxEAST) + { DoGradientFillLinear(rect, initialColour, destColour, nDirection); } + + bool GetPixel(wxCoord x, wxCoord y, wxColour *col) const + { return DoGetPixel(x, y, col); } + bool GetPixel(const wxPoint& pt, wxColour *col) const + { return DoGetPixel(pt.x, pt.y, col); } + + void DrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) + { DoDrawLine(x1, y1, x2, y2); } + void DrawLine(const wxPoint& pt1, const wxPoint& pt2) + { DoDrawLine(pt1.x, pt1.y, pt2.x, pt2.y); } + + void CrossHair(wxCoord x, wxCoord y) + { DoCrossHair(x, y); } + void CrossHair(const wxPoint& pt) + { DoCrossHair(pt.x, pt.y); } + + void DrawArc(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, + wxCoord xc, wxCoord yc) + { DoDrawArc(x1, y1, x2, y2, xc, yc); } + void DrawArc(const wxPoint& pt1, const wxPoint& pt2, const wxPoint& centre) + { DoDrawArc(pt1.x, pt1.y, pt2.x, pt2.y, centre.x, centre.y); } + + void DrawCheckMark(wxCoord x, wxCoord y, + wxCoord width, wxCoord height) + { DoDrawCheckMark(x, y, width, height); } + void DrawCheckMark(const wxRect& rect) + { DoDrawCheckMark(rect.x, rect.y, rect.width, rect.height); } + + void DrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, + double sa, double ea) + { DoDrawEllipticArc(x, y, w, h, sa, ea); } + void DrawEllipticArc(const wxPoint& pt, const wxSize& sz, + double sa, double ea) + { DoDrawEllipticArc(pt.x, pt.y, sz.x, sz.y, sa, ea); } + + void DrawPoint(wxCoord x, wxCoord y) + { DoDrawPoint(x, y); } + void DrawPoint(const wxPoint& pt) + { DoDrawPoint(pt.x, pt.y); } + + void DrawLines(int n, wxPoint points[], + wxCoord xoffset = 0, wxCoord yoffset = 0) + { DoDrawLines(n, points, xoffset, yoffset); } + void DrawLines(const wxList *list, + wxCoord xoffset = 0, wxCoord yoffset = 0); + + void DrawPolygon(int n, wxPoint points[], + wxCoord xoffset = 0, wxCoord yoffset = 0, + int fillStyle = wxODDEVEN_RULE) + { DoDrawPolygon(n, points, xoffset, yoffset, fillStyle); } + + void DrawPolygon(const wxList *list, + wxCoord xoffset = 0, wxCoord yoffset = 0, + int fillStyle = wxODDEVEN_RULE); + + void DrawPolyPolygon(int n, int count[], wxPoint points[], + wxCoord xoffset = 0, wxCoord yoffset = 0, + int fillStyle = wxODDEVEN_RULE) + { DoDrawPolyPolygon(n, count, points, xoffset, yoffset, fillStyle); } + + void DrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) + { DoDrawRectangle(x, y, width, height); } + void DrawRectangle(const wxPoint& pt, const wxSize& sz) + { DoDrawRectangle(pt.x, pt.y, sz.x, sz.y); } + void DrawRectangle(const wxRect& rect) + { DoDrawRectangle(rect.x, rect.y, rect.width, rect.height); } + + void DrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, + double radius) + { DoDrawRoundedRectangle(x, y, width, height, radius); } + void DrawRoundedRectangle(const wxPoint& pt, const wxSize& sz, + double radius) + { DoDrawRoundedRectangle(pt.x, pt.y, sz.x, sz.y, radius); } + void DrawRoundedRectangle(const wxRect& r, double radius) + { DoDrawRoundedRectangle(r.x, r.y, r.width, r.height, radius); } + + void DrawCircle(wxCoord x, wxCoord y, wxCoord radius) + { DoDrawEllipse(x - radius, y - radius, 2*radius, 2*radius); } + void DrawCircle(const wxPoint& pt, wxCoord radius) + { DrawCircle(pt.x, pt.y, radius); } + + void DrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height) + { DoDrawEllipse(x, y, width, height); } + void DrawEllipse(const wxPoint& pt, const wxSize& sz) + { DoDrawEllipse(pt.x, pt.y, sz.x, sz.y); } + void DrawEllipse(const wxRect& rect) + { DoDrawEllipse(rect.x, rect.y, rect.width, rect.height); } + + void DrawIcon(const wxIcon& icon, wxCoord x, wxCoord y) + { DoDrawIcon(icon, x, y); } + void DrawIcon(const wxIcon& icon, const wxPoint& pt) + { DoDrawIcon(icon, pt.x, pt.y); } + + void DrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, + bool useMask = false) + { DoDrawBitmap(bmp, x, y, useMask); } + void DrawBitmap(const wxBitmap &bmp, const wxPoint& pt, + bool useMask = false) + { DoDrawBitmap(bmp, pt.x, pt.y, useMask); } + + void DrawText(const wxString& text, wxCoord x, wxCoord y) + { DoDrawText(text, x, y); } + void DrawText(const wxString& text, const wxPoint& pt) + { DoDrawText(text, pt.x, pt.y); } + + void DrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle) + { DoDrawRotatedText(text, x, y, angle); } + void DrawRotatedText(const wxString& text, const wxPoint& pt, double angle) + { DoDrawRotatedText(text, pt.x, pt.y, angle); } + + // this version puts both optional bitmap and the text into the given + // rectangle and aligns is as specified by alignment parameter; it also + // will emphasize the character with the given index if it is != -1 and + // return the bounding rectangle if required + virtual void DrawLabel(const wxString& text, + const wxBitmap& image, + const wxRect& rect, + int alignment = wxALIGN_LEFT | wxALIGN_TOP, + int indexAccel = -1, + wxRect *rectBounding = NULL); + + void DrawLabel(const wxString& text, const wxRect& rect, + int alignment = wxALIGN_LEFT | wxALIGN_TOP, + int indexAccel = -1) + { DrawLabel(text, wxNullBitmap, rect, alignment, indexAccel); } + + bool Blit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, + wxDC *source, wxCoord xsrc, wxCoord ysrc, + int rop = wxCOPY, bool useMask = false, wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord) + { + return DoBlit(xdest, ydest, width, height, + source, xsrc, ysrc, rop, useMask, xsrcMask, ysrcMask); + } + bool Blit(const wxPoint& destPt, const wxSize& sz, + wxDC *source, const wxPoint& srcPt, + int rop = wxCOPY, bool useMask = false, const wxPoint& srcPtMask = wxDefaultPosition) + { + return DoBlit(destPt.x, destPt.y, sz.x, sz.y, + source, srcPt.x, srcPt.y, rop, useMask, srcPtMask.x, srcPtMask.y); + } + + wxBitmap GetAsBitmap(const wxRect *subrect = (const wxRect *) NULL) const + { + return DoGetAsBitmap(subrect); + } + +#if wxUSE_SPLINES + // TODO: this API needs fixing (wxPointList, why (!const) "wxList *"?) + void DrawSpline(wxCoord x1, wxCoord y1, + wxCoord x2, wxCoord y2, + wxCoord x3, wxCoord y3); + void DrawSpline(int n, wxPoint points[]); + + void DrawSpline(wxList *points) { DoDrawSpline(points); } +#endif // wxUSE_SPLINES + + // Eventually we will have wxUSE_GENERIC_DRAWELLIPSE +#ifdef __WXWINCE__ + //! Generic method to draw ellipses, circles and arcs with current pen and brush. + /*! \param x Upper left corner of bounding box. + * \param y Upper left corner of bounding box. + * \param w Width of bounding box. + * \param h Height of bounding box. + * \param sa Starting angle of arc + * (counterclockwise, start at 3 o'clock, 360 is full circle). + * \param ea Ending angle of arc. + * \param angle Rotation angle, the Arc will be rotated after + * calculating begin and end. + */ + void DrawEllipticArcRot( wxCoord x, wxCoord y, + wxCoord width, wxCoord height, + double sa = 0, double ea = 0, double angle = 0 ) + { DoDrawEllipticArcRot( x, y, width, height, sa, ea, angle ); } + + void DrawEllipticArcRot( const wxPoint& pt, + const wxSize& sz, + double sa = 0, double ea = 0, double angle = 0 ) + { DoDrawEllipticArcRot( pt.x, pt.y, sz.x, sz.y, sa, ea, angle ); } + + void DrawEllipticArcRot( const wxRect& rect, + double sa = 0, double ea = 0, double angle = 0 ) + { DoDrawEllipticArcRot( rect.x, rect.y, rect.width, rect.height, sa, ea, angle ); } + + virtual void DoDrawEllipticArcRot( wxCoord x, wxCoord y, + wxCoord w, wxCoord h, + double sa = 0, double ea = 0, double angle = 0 ); + + //! Rotates points around center. + /*! This is a quite straight method, it calculates in pixels + * and so it produces rounding errors. + * \param points The points inside will be rotated. + * \param angle Rotating angle (counterclockwise, start at 3 o'clock, 360 is full circle). + * \param center Center of rotation. + */ + void Rotate( wxList* points, double angle, wxPoint center = wxPoint(0,0) ); + + // used by DrawEllipticArcRot + // Careful: wxList gets filled with points you have to delete later. + void CalculateEllipticPoints( wxList* points, + wxCoord xStart, wxCoord yStart, + wxCoord w, wxCoord h, + double sa, double ea ); #endif - static void Set(wxDCFactory *factory); - static wxDCFactory *Get(); + // global DC operations + // -------------------- -private: - static wxDCFactory *m_factory; -}; - -//----------------------------------------------------------------------------- -// wxNativeDCFactory -//----------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxNativeDCFactory: public wxDCFactory -{ -public: - wxNativeDCFactory() {} - - virtual wxDCImpl* CreateWindowDC( wxWindowDC *owner, wxWindow *window ); - virtual wxDCImpl* CreateClientDC( wxClientDC *owner, wxWindow *window ); - virtual wxDCImpl* CreatePaintDC( wxPaintDC *owner, wxWindow *window ); - virtual wxDCImpl* CreateMemoryDC( wxMemoryDC *owner ); - virtual wxDCImpl* CreateMemoryDC( wxMemoryDC *owner, wxBitmap &bitmap ); - virtual wxDCImpl* CreateMemoryDC( wxMemoryDC *owner, wxDC *dc ); - virtual wxDCImpl* CreateScreenDC( wxScreenDC *owner ); -#if wxUSE_PRINTING_ARCHITECTURE - virtual wxDCImpl* CreatePrinterDC( wxPrinterDC *owner, const wxPrintData &data ); -#endif -}; - -//----------------------------------------------------------------------------- -// wxDCImpl -//----------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxDCImpl: public wxObject -{ -public: - wxDCImpl( wxDC *owner ); - virtual ~wxDCImpl(); - - wxDC *GetOwner() const { return m_owner; } - - wxWindow* GetWindow() const { return m_window; } - - virtual bool IsOk() const { return m_ok; } - - // query capabilities - - virtual bool CanDrawBitmap() const = 0; - virtual bool CanGetTextExtent() const = 0; - - // get Cairo context - virtual void* GetCairoContext() const - { - return NULL; - } - - // query dimension, colour deps, resolution - - virtual void DoGetSize(int *width, int *height) const = 0; - void GetSize(int *width, int *height) const - { - DoGetSize(width, height); - return ; - } - - wxSize GetSize() const - { - int w, h; - DoGetSize(&w, &h); - return wxSize(w, h); - } - - virtual void DoGetSizeMM(int* width, int* height) const = 0; - - virtual int GetDepth() const = 0; - virtual wxSize GetPPI() const = 0; - - // Right-To-Left (RTL) modes - - virtual void SetLayoutDirection(wxLayoutDirection WXUNUSED(dir)) { } - virtual wxLayoutDirection GetLayoutDirection() const { return wxLayout_Default; } - - // page and document + virtual void Clear() = 0; virtual bool StartDoc(const wxString& WXUNUSED(message)) { return true; } virtual void EndDoc() { } @@ -317,10 +388,206 @@ public: virtual void StartPage() { } virtual void EndPage() { } - // flushing the content of this dc immediately eg onto screen - virtual void Flush() { } +#if WXWIN_COMPATIBILITY_2_6 + wxDEPRECATED( void BeginDrawing() ); + wxDEPRECATED( void EndDrawing() ); +#endif // WXWIN_COMPATIBILITY_2_6 + + + // set objects to use for drawing + // ------------------------------ + + virtual void SetFont(const wxFont& font) = 0; + virtual void SetPen(const wxPen& pen) = 0; + virtual void SetBrush(const wxBrush& brush) = 0; + virtual void SetBackground(const wxBrush& brush) = 0; + virtual void SetBackgroundMode(int mode) = 0; +#if wxUSE_PALETTE + virtual void SetPalette(const wxPalette& palette) = 0; +#endif // wxUSE_PALETTE + + // clipping region + // --------------- + + void SetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height) + { DoSetClippingRegion(x, y, width, height); } + void SetClippingRegion(const wxPoint& pt, const wxSize& sz) + { DoSetClippingRegion(pt.x, pt.y, sz.x, sz.y); } + void SetClippingRegion(const wxRect& rect) + { DoSetClippingRegion(rect.x, rect.y, rect.width, rect.height); } + void SetClippingRegion(const wxRegion& region) + { DoSetClippingRegionAsRegion(region); } + +#if wxABI_VERSION >= 20811 + void SetDeviceClippingRegion(const wxRegion& region) + { DoSetClippingRegionAsRegion(region); } +#endif + + virtual void DestroyClippingRegion() { ResetClipping(); } + + void GetClippingBox(wxCoord *x, wxCoord *y, wxCoord *w, wxCoord *h) const + { DoGetClippingBox(x, y, w, h); } + void GetClippingBox(wxRect& rect) const + { + DoGetClippingBox(&rect.x, &rect.y, &rect.width, &rect.height); + } + + // text extent + // ----------- + + virtual wxCoord GetCharHeight() const = 0; + virtual wxCoord GetCharWidth() const = 0; + + // only works for single line strings + void GetTextExtent(const wxString& string, + wxCoord *x, wxCoord *y, + wxCoord *descent = NULL, + wxCoord *externalLeading = NULL, + wxFont *theFont = NULL) const + { DoGetTextExtent(string, x, y, descent, externalLeading, theFont); } + + wxSize GetTextExtent(const wxString& string) const + { + wxCoord w, h; + DoGetTextExtent(string, &w, &h); + return wxSize(w, h); + } + + // works for single as well as multi-line strings + virtual void GetMultiLineTextExtent(const wxString& string, + wxCoord *width, + wxCoord *height, + wxCoord *heightLine = NULL, + wxFont *font = NULL) const; + + wxSize GetMultiLineTextExtent(const wxString& string) const + { + wxCoord w, h; + GetMultiLineTextExtent(string, &w, &h); + return wxSize(w, h); + } + + // Measure cumulative width of text after each character + bool GetPartialTextExtents(const wxString& text, wxArrayInt& widths) const + { return DoGetPartialTextExtents(text, widths); } + + // size and resolution + // ------------------- + + // in device units + void GetSize(int *width, int *height) const + { DoGetSize(width, height); } + wxSize GetSize() const + { + int w, h; + DoGetSize(&w, &h); + + return wxSize(w, h); + } + + // in mm + void GetSizeMM(int* width, int* height) const + { DoGetSizeMM(width, height); } + wxSize GetSizeMM() const + { + int w, h; + DoGetSizeMM(&w, &h); + + return wxSize(w, h); + } + + // coordinates conversions + // ----------------------- + + // This group of functions does actual conversion of the input, as you'd + // expect. + wxCoord DeviceToLogicalX(wxCoord x) const; + wxCoord DeviceToLogicalY(wxCoord y) const; + wxCoord DeviceToLogicalXRel(wxCoord x) const; + wxCoord DeviceToLogicalYRel(wxCoord y) const; + wxCoord LogicalToDeviceX(wxCoord x) const; + wxCoord LogicalToDeviceY(wxCoord y) const; + wxCoord LogicalToDeviceXRel(wxCoord x) const; + wxCoord LogicalToDeviceYRel(wxCoord y) const; + + // query DC capabilities + // --------------------- + + virtual bool CanDrawBitmap() const = 0; + virtual bool CanGetTextExtent() const = 0; + + // colour depth + virtual int GetDepth() const = 0; + + // Resolution in Pixels per inch + virtual wxSize GetPPI() const = 0; + + virtual bool Ok() const { return IsOk(); } + virtual bool IsOk() const { return m_ok; } + + // accessors and setters + // --------------------- + + virtual int GetBackgroundMode() const { return m_backgroundMode; } + virtual const wxBrush& GetBackground() const { return m_backgroundBrush; } + virtual const wxBrush& GetBrush() const { return m_brush; } + virtual const wxFont& GetFont() const { return m_font; } + virtual const wxPen& GetPen() const { return m_pen; } + + virtual const wxColour& GetTextForeground() const { return m_textForegroundColour; } + virtual const wxColour& GetTextBackground() const { return m_textBackgroundColour; } + virtual void SetTextForeground(const wxColour& colour) + { m_textForegroundColour = colour; } + virtual void SetTextBackground(const wxColour& colour) + { m_textBackgroundColour = colour; } + + virtual int GetMapMode() const { return m_mappingMode; } + virtual void SetMapMode(int mode) = 0; + + virtual void GetUserScale(double *x, double *y) const + { + if ( x ) *x = m_userScaleX; + if ( y ) *y = m_userScaleY; + } + virtual void SetUserScale(double x, double y) = 0; + + virtual void GetLogicalScale(double *x, double *y) + { + if ( x ) *x = m_logicalScaleX; + if ( y ) *y = m_logicalScaleY; + } + virtual void SetLogicalScale(double x, double y) + { + m_logicalScaleX = x; + m_logicalScaleY = y; + } + + void GetLogicalOrigin(wxCoord *x, wxCoord *y) const + { DoGetLogicalOrigin(x, y); } + wxPoint GetLogicalOrigin() const + { wxCoord x, y; DoGetLogicalOrigin(&x, &y); return wxPoint(x, y); } + virtual void SetLogicalOrigin(wxCoord x, wxCoord y) = 0; + + void GetDeviceOrigin(wxCoord *x, wxCoord *y) const + { DoGetDeviceOrigin(x, y); } + wxPoint GetDeviceOrigin() const + { wxCoord x, y; DoGetDeviceOrigin(&x, &y); return wxPoint(x, y); } + virtual void SetDeviceOrigin(wxCoord x, wxCoord y) = 0; + + virtual void ComputeScaleAndOrigin() {} + + virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp) = 0; + + virtual int GetLogicalFunction() const { return m_logicalFunction; } + virtual void SetLogicalFunction(int function) = 0; + +#if WXWIN_COMPATIBILITY_2_4 + virtual void SetOptimization(bool WXUNUSED(opt)) { } + virtual bool GetOptimization() { return false; } +#endif // bounding box + // ------------ virtual void CalcBoundingBox(wxCoord x, wxCoord y) { @@ -341,6 +608,7 @@ public: m_maxY = y; } } + void ResetBoundingBox() { m_isBBoxValid = false; @@ -348,192 +616,79 @@ public: m_minX = m_maxX = m_minY = m_maxY = 0; } + // Get the final bounding box of the PostScript or Metafile picture. wxCoord MinX() const { return m_minX; } wxCoord MaxX() const { return m_maxX; } wxCoord MinY() const { return m_minY; } wxCoord MaxY() const { return m_maxY; } - // setters and getters + // misc old functions + // ------------------ - virtual void SetFont(const wxFont& font) = 0; - virtual const wxFont& GetFont() const { return m_font; } - - virtual void SetPen(const wxPen& pen) = 0; - virtual const wxPen& GetPen() const { return m_pen; } - - virtual void SetBrush(const wxBrush& brush) = 0; - virtual const wxBrush& GetBrush() const { return m_brush; } - - virtual void SetBackground(const wxBrush& brush) = 0; - virtual const wxBrush& GetBackground() const { return m_backgroundBrush; } - - virtual void SetBackgroundMode(int mode) = 0; - virtual int GetBackgroundMode() const { return m_backgroundMode; } - - virtual void SetTextForeground(const wxColour& colour) - { m_textForegroundColour = colour; } - virtual const wxColour& GetTextForeground() const - { return m_textForegroundColour; } - - virtual void SetTextBackground(const wxColour& colour) - { m_textBackgroundColour = colour; } - virtual const wxColour& GetTextBackground() const - { return m_textBackgroundColour; } - -#if wxUSE_PALETTE - virtual void SetPalette(const wxPalette& palette) = 0; -#endif // wxUSE_PALETTE - - // inherit the DC attributes (font and colours) from the given window - // - // this is called automatically when a window, client or paint DC is - // created - virtual void InheritAttributes(wxWindow *win); - - - // logical functions - - virtual void SetLogicalFunction(wxRasterOperationMode function) = 0; - virtual wxRasterOperationMode GetLogicalFunction() const - { return m_logicalFunction; } - - // text measurement - - virtual wxCoord GetCharHeight() const = 0; - virtual wxCoord GetCharWidth() const = 0; - - // The derived classes should really override DoGetFontMetrics() to return - // the correct values in the future but for now provide a default - // implementation in terms of DoGetTextExtent() to avoid breaking the - // compilation of all other ports as wxMSW is the only one to implement it. - virtual void DoGetFontMetrics(int *height, - int *ascent, - int *descent, - int *internalLeading, - int *externalLeading, - int *averageWidth) const; - - virtual void DoGetTextExtent(const wxString& string, - wxCoord *x, wxCoord *y, - wxCoord *descent = NULL, - wxCoord *externalLeading = NULL, - const wxFont *theFont = NULL) const = 0; - virtual void GetMultiLineTextExtent(const wxString& string, - wxCoord *width, - wxCoord *height, - wxCoord *heightLine = NULL, - const wxFont *font = NULL) const; - virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const; - - // clearing - - virtual void Clear() = 0; - - // clipping - - virtual void DoSetClippingRegion(wxCoord x, wxCoord y, - wxCoord width, wxCoord height) = 0; - - // NB: this function works with device coordinates, not the logical ones! - virtual void DoSetDeviceClippingRegion(const wxRegion& region) = 0; - - virtual void DoGetClippingBox(wxCoord *x, wxCoord *y, - wxCoord *w, wxCoord *h) const + // for compatibility with the old code when wxCoord was long everywhere + void GetTextExtent(const wxString& string, + long *x, long *y, + long *descent = NULL, + long *externalLeading = NULL, + wxFont *theFont = NULL) const { + wxCoord x2, y2, descent2, externalLeading2; + DoGetTextExtent(string, &x2, &y2, + &descent2, &externalLeading2, + theFont); if ( x ) - *x = m_clipX1; + *x = x2; if ( y ) - *y = m_clipY1; - if ( w ) - *w = m_clipX2 - m_clipX1; - if ( h ) - *h = m_clipY2 - m_clipY1; + *y = y2; + if ( descent ) + *descent = descent2; + if ( externalLeading ) + *externalLeading = externalLeading2; } - virtual void DestroyClippingRegion() { ResetClipping(); } - - - // coordinates conversions and transforms - - virtual wxCoord DeviceToLogicalX(wxCoord x) const; - virtual wxCoord DeviceToLogicalY(wxCoord y) const; - virtual wxCoord DeviceToLogicalXRel(wxCoord x) const; - virtual wxCoord DeviceToLogicalYRel(wxCoord y) const; - virtual wxCoord LogicalToDeviceX(wxCoord x) const; - virtual wxCoord LogicalToDeviceY(wxCoord y) const; - virtual wxCoord LogicalToDeviceXRel(wxCoord x) const; - virtual wxCoord LogicalToDeviceYRel(wxCoord y) const; - - virtual void SetMapMode(wxMappingMode mode); - virtual wxMappingMode GetMapMode() const { return m_mappingMode; } - - virtual void SetUserScale(double x, double y); - virtual void GetUserScale(double *x, double *y) const + void GetLogicalOrigin(long *x, long *y) const { - if ( x ) *x = m_userScaleX; - if ( y ) *y = m_userScaleY; + wxCoord x2, y2; + DoGetLogicalOrigin(&x2, &y2); + if ( x ) + *x = x2; + if ( y ) + *y = y2; } - virtual void SetLogicalScale(double x, double y); - virtual void GetLogicalScale(double *x, double *y) const + void GetDeviceOrigin(long *x, long *y) const { - if ( x ) *x = m_logicalScaleX; - if ( y ) *y = m_logicalScaleY; + wxCoord x2, y2; + DoGetDeviceOrigin(&x2, &y2); + if ( x ) + *x = x2; + if ( y ) + *y = y2; } - - virtual void SetLogicalOrigin(wxCoord x, wxCoord y); - virtual void DoGetLogicalOrigin(wxCoord *x, wxCoord *y) const + void GetClippingBox(long *x, long *y, long *w, long *h) const { - if ( x ) *x = m_logicalOriginX; - if ( y ) *y = m_logicalOriginY; + wxCoord xx,yy,ww,hh; + DoGetClippingBox(&xx, &yy, &ww, &hh); + if (x) *x = xx; + if (y) *y = yy; + if (w) *w = ww; + if (h) *h = hh; } - virtual void SetDeviceOrigin(wxCoord x, wxCoord y); - virtual void DoGetDeviceOrigin(wxCoord *x, wxCoord *y) const - { - if ( x ) *x = m_deviceOriginX; - if ( y ) *y = m_deviceOriginY; - } + // RTL related functions + // --------------------- -#if wxUSE_DC_TRANSFORM_MATRIX - // Transform matrix support is not available in most ports right now - // (currently only wxMSW provides it) so do nothing in these methods by - // default. - virtual bool CanUseTransformMatrix() const - { return false; } - virtual bool SetTransformMatrix(const wxAffineMatrix2D& WXUNUSED(matrix)) - { return false; } - virtual wxAffineMatrix2D GetTransformMatrix() const - { return wxAffineMatrix2D(); } - virtual void ResetTransformMatrix() + // get or change the layout direction (LTR or RTL) for this dc, + // wxLayout_Default is returned if layout direction is not supported + virtual wxLayoutDirection GetLayoutDirection() const + { return wxLayout_Default; } + virtual void SetLayoutDirection(wxLayoutDirection WXUNUSED(dir)) { } -#endif // wxUSE_DC_TRANSFORM_MATRIX - - virtual void SetDeviceLocalOrigin( wxCoord x, wxCoord y ); - - virtual void ComputeScaleAndOrigin(); - - // this needs to overidden if the axis is inverted - virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp); - -#ifdef __WXMSW__ - // Native Windows functions using the underlying HDC don't honour GDI+ - // transformations which may be applied to it. Using this function we can - // transform the coordinates manually before passing them to such functions - // (as in e.g. wxRendererMSW code). It doesn't do anything if this is not a - // wxGCDC. - virtual wxRect MSWApplyGDIPlusTransform(const wxRect& r) const - { - return r; - } -#endif // __WXMSW__ - - - // --------------------------------------------------------- - // the actual drawing API +protected: + // the pure virtual functions which should be implemented by wxDC virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col, - wxFloodFillStyle style = wxFLOOD_SURFACE) = 0; + int style = wxFLOOD_SURFACE) = 0; virtual void DoGradientFillLinear(const wxRect& rect, const wxColour& initialColour, @@ -577,83 +732,78 @@ public: virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, - wxDC *source, - wxCoord xsrc, wxCoord ysrc, - wxRasterOperationMode rop = wxCOPY, - bool useMask = false, - wxCoord xsrcMask = wxDefaultCoord, - wxCoord ysrcMask = wxDefaultCoord) = 0; + wxDC *source, wxCoord xsrc, wxCoord ysrc, + int rop = wxCOPY, bool useMask = false, wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord) = 0; - virtual bool DoStretchBlit(wxCoord xdest, wxCoord ydest, - wxCoord dstWidth, wxCoord dstHeight, - wxDC *source, - wxCoord xsrc, wxCoord ysrc, - wxCoord srcWidth, wxCoord srcHeight, - wxRasterOperationMode rop = wxCOPY, - bool useMask = false, - wxCoord xsrcMask = wxDefaultCoord, - wxCoord ysrcMask = wxDefaultCoord); - - virtual wxBitmap DoGetAsBitmap(const wxRect *WXUNUSED(subrect)) const - { return wxNullBitmap; } + virtual wxBitmap DoGetAsBitmap(const wxRect *WXUNUSED(subrect)) const { return wxNullBitmap; } + virtual void DoGetSize(int *width, int *height) const = 0; + virtual void DoGetSizeMM(int* width, int* height) const = 0; virtual void DoDrawLines(int n, wxPoint points[], - wxCoord xoffset, wxCoord yoffset ) = 0; - virtual void DrawLines(const wxPointList *list, - wxCoord xoffset, wxCoord yoffset ); - + wxCoord xoffset, wxCoord yoffset) = 0; virtual void DoDrawPolygon(int n, wxPoint points[], - wxCoord xoffset, wxCoord yoffset, - wxPolygonFillMode fillStyle = wxODDEVEN_RULE) = 0; + wxCoord xoffset, wxCoord yoffset, + int fillStyle = wxODDEVEN_RULE) = 0; virtual void DoDrawPolyPolygon(int n, int count[], wxPoint points[], wxCoord xoffset, wxCoord yoffset, - wxPolygonFillMode fillStyle); - void DrawPolygon(const wxPointList *list, - wxCoord xoffset, wxCoord yoffset, - wxPolygonFillMode fillStyle ); + int fillStyle); + virtual void DoSetClippingRegionAsRegion(const wxRegion& region) = 0; + virtual void DoSetClippingRegion(wxCoord x, wxCoord y, + wxCoord width, wxCoord height) = 0; + +#if WXWIN_COMPATIBILITY_2_4 + // this was only for confusing people, use DoGetClippingBox only + virtual void DoGetClippingRegion(wxCoord *x, wxCoord *y, + wxCoord *w, wxCoord *h) + { DoGetClippingBox(x, y, w, h); } +#endif + + virtual void DoGetClippingBox(wxCoord *x, wxCoord *y, + wxCoord *w, wxCoord *h) const + { + if ( x ) + *x = m_clipX1; + if ( y ) + *y = m_clipY1; + if ( w ) + *w = m_clipX2 - m_clipX1; + if ( h ) + *h = m_clipY2 - m_clipY1; + } + + virtual void DoGetLogicalOrigin(wxCoord *x, wxCoord *y) const + { + if ( x ) *x = m_logicalOriginX; + if ( y ) *y = m_logicalOriginY; + } + + virtual void DoGetDeviceOrigin(wxCoord *x, wxCoord *y) const + { + if ( x ) *x = m_deviceOriginX; + if ( y ) *y = m_deviceOriginY; + } + + virtual void DoGetTextExtent(const wxString& string, + wxCoord *x, wxCoord *y, + wxCoord *descent = NULL, + wxCoord *externalLeading = NULL, + wxFont *theFont = NULL) const = 0; + + virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const; #if wxUSE_SPLINES - void DrawSpline(wxCoord x1, wxCoord y1, - wxCoord x2, wxCoord y2, - wxCoord x3, wxCoord y3); - void DrawSpline(int n, wxPoint points[]); - void DrawSpline(const wxPointList *points) { DoDrawSpline(points); } - - virtual void DoDrawSpline(const wxPointList *points); + virtual void DoDrawSpline(wxList *points); #endif - // --------------------------------------------------------- - // wxMemoryDC Impl API - - virtual void DoSelect(const wxBitmap& WXUNUSED(bmp)) - { } - - virtual const wxBitmap& GetSelectedBitmap() const - { return wxNullBitmap; } - virtual wxBitmap& GetSelectedBitmap() - { return wxNullBitmap; } - - // --------------------------------------------------------- - // wxPrinterDC Impl API - - virtual wxRect GetPaperRect() const - { int w = 0; int h = 0; DoGetSize( &w, &h ); return wxRect(0,0,w,h); } - - virtual int GetResolution() const - { return -1; } - -#if wxUSE_GRAPHICS_CONTEXT - virtual wxGraphicsContext* GetGraphicsContext() const - { return NULL; } - virtual void SetGraphicsContext( wxGraphicsContext* WXUNUSED(ctx) ) - {} +#if wxABI_VERSION >= 20810 + // returns adjustment factor for converting wxFont "point size"; in wx + // it is point size on screen and needs to be multiplied by this value + // for rendering on higher-resolution DCs such as printer ones + static float GetFontPointSizeAdjustment(float dpi); #endif -private: - wxDC *m_owner; - protected: // unset clipping variables (after clipping region was destroyed) void ResetClipping() @@ -663,61 +813,6 @@ protected: m_clipX1 = m_clipX2 = m_clipY1 = m_clipY2 = 0; } -#ifdef __WXWINCE__ - //! Generic method to draw ellipses, circles and arcs with current pen and brush. - /*! \param x Upper left corner of bounding box. - * \param y Upper left corner of bounding box. - * \param w Width of bounding box. - * \param h Height of bounding box. - * \param sa Starting angle of arc - * (counterclockwise, start at 3 o'clock, 360 is full circle). - * \param ea Ending angle of arc. - * \param angle Rotation angle, the Arc will be rotated after - * calculating begin and end. - */ - void DrawEllipticArcRot( wxCoord x, wxCoord y, - wxCoord width, wxCoord height, - double sa = 0, double ea = 0, double angle = 0 ) - { DoDrawEllipticArcRot( x, y, width, height, sa, ea, angle ); } - - void DrawEllipticArcRot( const wxPoint& pt, - const wxSize& sz, - double sa = 0, double ea = 0, double angle = 0 ) - { DoDrawEllipticArcRot( pt.x, pt.y, sz.x, sz.y, sa, ea, angle ); } - - void DrawEllipticArcRot( const wxRect& rect, - double sa = 0, double ea = 0, double angle = 0 ) - { DoDrawEllipticArcRot( rect.x, rect.y, rect.width, rect.height, sa, ea, angle ); } - - virtual void DoDrawEllipticArcRot( wxCoord x, wxCoord y, - wxCoord w, wxCoord h, - double sa = 0, double ea = 0, double angle = 0 ); - - //! Rotates points around center. - /*! This is a quite straight method, it calculates in pixels - * and so it produces rounding errors. - * \param points The points inside will be rotated. - * \param angle Rotating angle (counterclockwise, start at 3 o'clock, 360 is full circle). - * \param center Center of rotation. - */ - void Rotate( wxPointList* points, double angle, wxPoint center = wxPoint(0,0) ); - - // used by DrawEllipticArcRot - // Careful: wxList gets filled with points you have to delete later. - void CalculateEllipticPoints( wxPointList* points, - wxCoord xStart, wxCoord yStart, - wxCoord w, wxCoord h, - double sa, double ea ); -#endif // __WXWINCE__ - - // returns adjustment factor for converting wxFont "point size"; in wx - // it is point size on screen and needs to be multiplied by this value - // for rendering on higher-resolution DCs such as printer ones - static float GetFontPointSizeAdjustment(float dpi); - - // window on which the DC draws or NULL - wxWindow *m_window; - // flags bool m_colour:1; bool m_ok:1; @@ -727,33 +822,27 @@ protected: // coordinate system variables - wxCoord m_logicalOriginX, m_logicalOriginY; - wxCoord m_deviceOriginX, m_deviceOriginY; // Usually 0,0, can be change by user + // TODO short descriptions of what exactly they are would be nice... + + wxCoord m_logicalOriginX, m_logicalOriginY; + wxCoord m_deviceOriginX, m_deviceOriginY; - wxCoord m_deviceLocalOriginX, m_deviceLocalOriginY; // non-zero if native top-left corner - // is not at 0,0. This was the case under - // Mac's GrafPorts (coordinate system - // used toplevel window's origin) and - // e.g. for Postscript, where the native - // origin in the bottom left corner. double m_logicalScaleX, m_logicalScaleY; double m_userScaleX, m_userScaleY; - double m_scaleX, m_scaleY; // calculated from logical scale and user scale + double m_scaleX, m_scaleY; - int m_signX, m_signY; // Used by SetAxisOrientation() to invert the axes - - // what is a mm on a screen you don't know the size of? - double m_mm_to_pix_x, - m_mm_to_pix_y; + // Used by SetAxisOrientation() to invert the axes + int m_signX, m_signY; // bounding and clipping boxes wxCoord m_minX, m_minY, m_maxX, m_maxY; wxCoord m_clipX1, m_clipY1, m_clipX2, m_clipY2; - wxRasterOperationMode m_logicalFunction; + int m_logicalFunction; int m_backgroundMode; - wxMappingMode m_mappingMode; + int m_mappingMode; + // GDI objects wxPen m_pen; wxBrush m_brush; wxBrush m_backgroundBrush; @@ -767,607 +856,48 @@ protected: #endif // wxUSE_PALETTE private: - DECLARE_ABSTRACT_CLASS(wxDCImpl) + DECLARE_NO_COPY_CLASS(wxDCBase) + DECLARE_ABSTRACT_CLASS(wxDCBase) }; - -class WXDLLIMPEXP_CORE wxDC : public wxObject -{ -public: - // copy attributes (font, colours and writing direction) from another DC - void CopyAttributes(const wxDC& dc); - - virtual ~wxDC() { delete m_pimpl; } - - wxDCImpl *GetImpl() - { return m_pimpl; } - const wxDCImpl *GetImpl() const - { return m_pimpl; } - - wxWindow *GetWindow() const - { return m_pimpl->GetWindow(); } - - bool IsOk() const - { return m_pimpl && m_pimpl->IsOk(); } - - // query capabilities - - bool CanDrawBitmap() const - { return m_pimpl->CanDrawBitmap(); } - bool CanGetTextExtent() const - { return m_pimpl->CanGetTextExtent(); } - - // query dimension, colour deps, resolution - - void GetSize(int *width, int *height) const - { m_pimpl->DoGetSize(width, height); } - wxSize GetSize() const - { return m_pimpl->GetSize(); } - - void GetSizeMM(int* width, int* height) const - { m_pimpl->DoGetSizeMM(width, height); } - wxSize GetSizeMM() const - { - int w, h; - m_pimpl->DoGetSizeMM(&w, &h); - return wxSize(w, h); - } - - int GetDepth() const - { return m_pimpl->GetDepth(); } - wxSize GetPPI() const - { return m_pimpl->GetPPI(); } - - virtual int GetResolution() const - { return m_pimpl->GetResolution(); } - - // Right-To-Left (RTL) modes - - void SetLayoutDirection(wxLayoutDirection dir) - { m_pimpl->SetLayoutDirection( dir ); } - wxLayoutDirection GetLayoutDirection() const - { return m_pimpl->GetLayoutDirection(); } - - // page and document - - bool StartDoc(const wxString& message) - { return m_pimpl->StartDoc(message); } - void EndDoc() - { m_pimpl->EndDoc(); } - - void StartPage() - { m_pimpl->StartPage(); } - void EndPage() - { m_pimpl->EndPage(); } - - // bounding box - - void CalcBoundingBox(wxCoord x, wxCoord y) - { m_pimpl->CalcBoundingBox(x,y); } - void ResetBoundingBox() - { m_pimpl->ResetBoundingBox(); } - - wxCoord MinX() const - { return m_pimpl->MinX(); } - wxCoord MaxX() const - { return m_pimpl->MaxX(); } - wxCoord MinY() const - { return m_pimpl->MinY(); } - wxCoord MaxY() const - { return m_pimpl->MaxY(); } - - // setters and getters - - void SetFont(const wxFont& font) - { m_pimpl->SetFont( font ); } - const wxFont& GetFont() const - { return m_pimpl->GetFont(); } - - void SetPen(const wxPen& pen) - { m_pimpl->SetPen( pen ); } - const wxPen& GetPen() const - { return m_pimpl->GetPen(); } - - void SetBrush(const wxBrush& brush) - { m_pimpl->SetBrush( brush ); } - const wxBrush& GetBrush() const - { return m_pimpl->GetBrush(); } - - void SetBackground(const wxBrush& brush) - { m_pimpl->SetBackground( brush ); } - const wxBrush& GetBackground() const - { return m_pimpl->GetBackground(); } - - void SetBackgroundMode(int mode) - { m_pimpl->SetBackgroundMode( mode ); } - int GetBackgroundMode() const - { return m_pimpl->GetBackgroundMode(); } - - void SetTextForeground(const wxColour& colour) - { m_pimpl->SetTextForeground(colour); } - const wxColour& GetTextForeground() const - { return m_pimpl->GetTextForeground(); } - - void SetTextBackground(const wxColour& colour) - { m_pimpl->SetTextBackground(colour); } - const wxColour& GetTextBackground() const - { return m_pimpl->GetTextBackground(); } - -#if wxUSE_PALETTE - void SetPalette(const wxPalette& palette) - { m_pimpl->SetPalette(palette); } -#endif // wxUSE_PALETTE - - // logical functions - - void SetLogicalFunction(wxRasterOperationMode function) - { m_pimpl->SetLogicalFunction(function); } - wxRasterOperationMode GetLogicalFunction() const - { return m_pimpl->GetLogicalFunction(); } - - // text measurement - - wxCoord GetCharHeight() const - { return m_pimpl->GetCharHeight(); } - wxCoord GetCharWidth() const - { return m_pimpl->GetCharWidth(); } - - wxFontMetrics GetFontMetrics() const - { - wxFontMetrics fm; - m_pimpl->DoGetFontMetrics(&fm.height, &fm.ascent, &fm.descent, - &fm.internalLeading, &fm.externalLeading, - &fm.averageWidth); - return fm; - } - - void GetTextExtent(const wxString& string, - wxCoord *x, wxCoord *y, - wxCoord *descent = NULL, - wxCoord *externalLeading = NULL, - const wxFont *theFont = NULL) const - { m_pimpl->DoGetTextExtent(string, x, y, descent, externalLeading, theFont); } - - wxSize GetTextExtent(const wxString& string) const - { - wxCoord w, h; - m_pimpl->DoGetTextExtent(string, &w, &h); - return wxSize(w, h); - } - - void GetMultiLineTextExtent(const wxString& string, - wxCoord *width, - wxCoord *height, - wxCoord *heightLine = NULL, - const wxFont *font = NULL) const - { m_pimpl->GetMultiLineTextExtent( string, width, height, heightLine, font ); } - - wxSize GetMultiLineTextExtent(const wxString& string) const - { - wxCoord w, h; - m_pimpl->GetMultiLineTextExtent(string, &w, &h); - return wxSize(w, h); - } - - bool GetPartialTextExtents(const wxString& text, wxArrayInt& widths) const - { return m_pimpl->DoGetPartialTextExtents(text, widths); } - - // clearing - - void Clear() - { m_pimpl->Clear(); } - - // clipping - - void SetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height) - { m_pimpl->DoSetClippingRegion(x, y, width, height); } - void SetClippingRegion(const wxPoint& pt, const wxSize& sz) - { m_pimpl->DoSetClippingRegion(pt.x, pt.y, sz.x, sz.y); } - void SetClippingRegion(const wxRect& rect) - { m_pimpl->DoSetClippingRegion(rect.x, rect.y, rect.width, rect.height); } - - // unlike the functions above, the coordinates of the region used in this - // one are in device coordinates, not the logical ones - void SetDeviceClippingRegion(const wxRegion& region) - { m_pimpl->DoSetDeviceClippingRegion(region); } - - // this function is deprecated because its name is confusing: you may - // expect it to work with logical coordinates but, in fact, it does exactly - // the same thing as SetDeviceClippingRegion() - // - // please review the code using it and either replace it with calls to - // SetDeviceClippingRegion() or correct it if it was [wrongly] passing - // logical coordinates to this function - wxDEPRECATED_INLINE(void SetClippingRegion(const wxRegion& region), - SetDeviceClippingRegion(region); ) - - void DestroyClippingRegion() - { m_pimpl->DestroyClippingRegion(); } - - void GetClippingBox(wxCoord *x, wxCoord *y, wxCoord *w, wxCoord *h) const - { m_pimpl->DoGetClippingBox(x, y, w, h); } - void GetClippingBox(wxRect& rect) const - { m_pimpl->DoGetClippingBox(&rect.x, &rect.y, &rect.width, &rect.height); } - - // coordinates conversions and transforms - - wxCoord DeviceToLogicalX(wxCoord x) const - { return m_pimpl->DeviceToLogicalX(x); } - wxCoord DeviceToLogicalY(wxCoord y) const - { return m_pimpl->DeviceToLogicalY(y); } - wxCoord DeviceToLogicalXRel(wxCoord x) const - { return m_pimpl->DeviceToLogicalXRel(x); } - wxCoord DeviceToLogicalYRel(wxCoord y) const - { return m_pimpl->DeviceToLogicalYRel(y); } - wxCoord LogicalToDeviceX(wxCoord x) const - { return m_pimpl->LogicalToDeviceX(x); } - wxCoord LogicalToDeviceY(wxCoord y) const - { return m_pimpl->LogicalToDeviceY(y); } - wxCoord LogicalToDeviceXRel(wxCoord x) const - { return m_pimpl->LogicalToDeviceXRel(x); } - wxCoord LogicalToDeviceYRel(wxCoord y) const - { return m_pimpl->LogicalToDeviceYRel(y); } - - void SetMapMode(wxMappingMode mode) - { m_pimpl->SetMapMode(mode); } - wxMappingMode GetMapMode() const - { return m_pimpl->GetMapMode(); } - - void SetUserScale(double x, double y) - { m_pimpl->SetUserScale(x,y); } - void GetUserScale(double *x, double *y) const - { m_pimpl->GetUserScale( x, y ); } - - void SetLogicalScale(double x, double y) - { m_pimpl->SetLogicalScale( x, y ); } - void GetLogicalScale(double *x, double *y) const - { m_pimpl->GetLogicalScale( x, y ); } - - void SetLogicalOrigin(wxCoord x, wxCoord y) - { m_pimpl->SetLogicalOrigin(x,y); } - void GetLogicalOrigin(wxCoord *x, wxCoord *y) const - { m_pimpl->DoGetLogicalOrigin(x, y); } - wxPoint GetLogicalOrigin() const - { wxCoord x, y; m_pimpl->DoGetLogicalOrigin(&x, &y); return wxPoint(x, y); } - - void SetDeviceOrigin(wxCoord x, wxCoord y) - { m_pimpl->SetDeviceOrigin( x, y); } - void GetDeviceOrigin(wxCoord *x, wxCoord *y) const - { m_pimpl->DoGetDeviceOrigin(x, y); } - wxPoint GetDeviceOrigin() const - { wxCoord x, y; m_pimpl->DoGetDeviceOrigin(&x, &y); return wxPoint(x, y); } - - void SetAxisOrientation(bool xLeftRight, bool yBottomUp) - { m_pimpl->SetAxisOrientation(xLeftRight, yBottomUp); } - -#if wxUSE_DC_TRANSFORM_MATRIX - bool CanUseTransformMatrix() const - { return m_pimpl->CanUseTransformMatrix(); } - - bool SetTransformMatrix(const wxAffineMatrix2D &matrix) - { return m_pimpl->SetTransformMatrix(matrix); } - - wxAffineMatrix2D GetTransformMatrix() const - { return m_pimpl->GetTransformMatrix(); } - - void ResetTransformMatrix() - { m_pimpl->ResetTransformMatrix(); } -#endif // wxUSE_DC_TRANSFORM_MATRIX - - // mostly internal - void SetDeviceLocalOrigin( wxCoord x, wxCoord y ) - { m_pimpl->SetDeviceLocalOrigin( x, y ); } - - - // ----------------------------------------------- - // the actual drawing API - - bool FloodFill(wxCoord x, wxCoord y, const wxColour& col, - wxFloodFillStyle style = wxFLOOD_SURFACE) - { return m_pimpl->DoFloodFill(x, y, col, style); } - bool FloodFill(const wxPoint& pt, const wxColour& col, - wxFloodFillStyle style = wxFLOOD_SURFACE) - { return m_pimpl->DoFloodFill(pt.x, pt.y, col, style); } - - // fill the area specified by rect with a radial gradient, starting from - // initialColour in the centre of the cercle and fading to destColour. - void GradientFillConcentric(const wxRect& rect, - const wxColour& initialColour, - const wxColour& destColour) - { m_pimpl->DoGradientFillConcentric( rect, initialColour, destColour, - wxPoint(rect.GetWidth() / 2, - rect.GetHeight() / 2)); } - - void GradientFillConcentric(const wxRect& rect, - const wxColour& initialColour, - const wxColour& destColour, - const wxPoint& circleCenter) - { m_pimpl->DoGradientFillConcentric(rect, initialColour, destColour, circleCenter); } - - // fill the area specified by rect with a linear gradient - void GradientFillLinear(const wxRect& rect, - const wxColour& initialColour, - const wxColour& destColour, - wxDirection nDirection = wxEAST) - { m_pimpl->DoGradientFillLinear(rect, initialColour, destColour, nDirection); } - - bool GetPixel(wxCoord x, wxCoord y, wxColour *col) const - { return m_pimpl->DoGetPixel(x, y, col); } - bool GetPixel(const wxPoint& pt, wxColour *col) const - { return m_pimpl->DoGetPixel(pt.x, pt.y, col); } - - void DrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) - { m_pimpl->DoDrawLine(x1, y1, x2, y2); } - void DrawLine(const wxPoint& pt1, const wxPoint& pt2) - { m_pimpl->DoDrawLine(pt1.x, pt1.y, pt2.x, pt2.y); } - - void CrossHair(wxCoord x, wxCoord y) - { m_pimpl->DoCrossHair(x, y); } - void CrossHair(const wxPoint& pt) - { m_pimpl->DoCrossHair(pt.x, pt.y); } - - void DrawArc(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, - wxCoord xc, wxCoord yc) - { m_pimpl->DoDrawArc(x1, y1, x2, y2, xc, yc); } - void DrawArc(const wxPoint& pt1, const wxPoint& pt2, const wxPoint& centre) - { m_pimpl->DoDrawArc(pt1.x, pt1.y, pt2.x, pt2.y, centre.x, centre.y); } - - void DrawCheckMark(wxCoord x, wxCoord y, - wxCoord width, wxCoord height) - { m_pimpl->DoDrawCheckMark(x, y, width, height); } - void DrawCheckMark(const wxRect& rect) - { m_pimpl->DoDrawCheckMark(rect.x, rect.y, rect.width, rect.height); } - - void DrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, - double sa, double ea) - { m_pimpl->DoDrawEllipticArc(x, y, w, h, sa, ea); } - void DrawEllipticArc(const wxPoint& pt, const wxSize& sz, - double sa, double ea) - { m_pimpl->DoDrawEllipticArc(pt.x, pt.y, sz.x, sz.y, sa, ea); } - - void DrawPoint(wxCoord x, wxCoord y) - { m_pimpl->DoDrawPoint(x, y); } - void DrawPoint(const wxPoint& pt) - { m_pimpl->DoDrawPoint(pt.x, pt.y); } - - void DrawLines(int n, wxPoint points[], - wxCoord xoffset = 0, wxCoord yoffset = 0) - { m_pimpl->DoDrawLines(n, points, xoffset, yoffset); } - void DrawLines(const wxPointList *list, - wxCoord xoffset = 0, wxCoord yoffset = 0) - { m_pimpl->DrawLines( list, xoffset, yoffset ); } -#if WXWIN_COMPATIBILITY_2_8 - wxDEPRECATED( void DrawLines(const wxList *list, - wxCoord xoffset = 0, wxCoord yoffset = 0) ); -#endif // WXWIN_COMPATIBILITY_2_8 - - void DrawPolygon(int n, wxPoint points[], - wxCoord xoffset = 0, wxCoord yoffset = 0, - wxPolygonFillMode fillStyle = wxODDEVEN_RULE) - { m_pimpl->DoDrawPolygon(n, points, xoffset, yoffset, fillStyle); } - void DrawPolygon(const wxPointList *list, - wxCoord xoffset = 0, wxCoord yoffset = 0, - wxPolygonFillMode fillStyle = wxODDEVEN_RULE) - { m_pimpl->DrawPolygon( list, xoffset, yoffset, fillStyle ); } - void DrawPolyPolygon(int n, int count[], wxPoint points[], - wxCoord xoffset = 0, wxCoord yoffset = 0, - wxPolygonFillMode fillStyle = wxODDEVEN_RULE) - { m_pimpl->DoDrawPolyPolygon(n, count, points, xoffset, yoffset, fillStyle); } -#if WXWIN_COMPATIBILITY_2_8 - wxDEPRECATED( void DrawPolygon(const wxList *list, - wxCoord xoffset = 0, wxCoord yoffset = 0, - wxPolygonFillMode fillStyle = wxODDEVEN_RULE) ); -#endif // WXWIN_COMPATIBILITY_2_8 - - void DrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) - { m_pimpl->DoDrawRectangle(x, y, width, height); } - void DrawRectangle(const wxPoint& pt, const wxSize& sz) - { m_pimpl->DoDrawRectangle(pt.x, pt.y, sz.x, sz.y); } - void DrawRectangle(const wxRect& rect) - { m_pimpl->DoDrawRectangle(rect.x, rect.y, rect.width, rect.height); } - - void DrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, - double radius) - { m_pimpl->DoDrawRoundedRectangle(x, y, width, height, radius); } - void DrawRoundedRectangle(const wxPoint& pt, const wxSize& sz, - double radius) - { m_pimpl->DoDrawRoundedRectangle(pt.x, pt.y, sz.x, sz.y, radius); } - void DrawRoundedRectangle(const wxRect& r, double radius) - { m_pimpl->DoDrawRoundedRectangle(r.x, r.y, r.width, r.height, radius); } - - void DrawCircle(wxCoord x, wxCoord y, wxCoord radius) - { m_pimpl->DoDrawEllipse(x - radius, y - radius, 2*radius, 2*radius); } - void DrawCircle(const wxPoint& pt, wxCoord radius) - { m_pimpl->DoDrawEllipse(pt.x - radius, pt.y - radius, 2*radius, 2*radius); } - - void DrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height) - { m_pimpl->DoDrawEllipse(x, y, width, height); } - void DrawEllipse(const wxPoint& pt, const wxSize& sz) - { m_pimpl->DoDrawEllipse(pt.x, pt.y, sz.x, sz.y); } - void DrawEllipse(const wxRect& rect) - { m_pimpl->DoDrawEllipse(rect.x, rect.y, rect.width, rect.height); } - - void DrawIcon(const wxIcon& icon, wxCoord x, wxCoord y) - { m_pimpl->DoDrawIcon(icon, x, y); } - void DrawIcon(const wxIcon& icon, const wxPoint& pt) - { m_pimpl->DoDrawIcon(icon, pt.x, pt.y); } - - void DrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, - bool useMask = false) - { m_pimpl->DoDrawBitmap(bmp, x, y, useMask); } - void DrawBitmap(const wxBitmap &bmp, const wxPoint& pt, - bool useMask = false) - { m_pimpl->DoDrawBitmap(bmp, pt.x, pt.y, useMask); } - - void DrawText(const wxString& text, wxCoord x, wxCoord y) - { m_pimpl->DoDrawText(text, x, y); } - void DrawText(const wxString& text, const wxPoint& pt) - { m_pimpl->DoDrawText(text, pt.x, pt.y); } - - void DrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle) - { m_pimpl->DoDrawRotatedText(text, x, y, angle); } - void DrawRotatedText(const wxString& text, const wxPoint& pt, double angle) - { m_pimpl->DoDrawRotatedText(text, pt.x, pt.y, angle); } - - // this version puts both optional bitmap and the text into the given - // rectangle and aligns is as specified by alignment parameter; it also - // will emphasize the character with the given index if it is != -1 and - // return the bounding rectangle if required - void DrawLabel(const wxString& text, - const wxBitmap& image, - const wxRect& rect, - int alignment = wxALIGN_LEFT | wxALIGN_TOP, - int indexAccel = -1, - wxRect *rectBounding = NULL); - - void DrawLabel(const wxString& text, const wxRect& rect, - int alignment = wxALIGN_LEFT | wxALIGN_TOP, - int indexAccel = -1) - { DrawLabel(text, wxNullBitmap, rect, alignment, indexAccel); } - - bool Blit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, - wxDC *source, wxCoord xsrc, wxCoord ysrc, - wxRasterOperationMode rop = wxCOPY, bool useMask = false, - wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord) - { - return m_pimpl->DoBlit(xdest, ydest, width, height, - source, xsrc, ysrc, rop, useMask, xsrcMask, ysrcMask); - } - bool Blit(const wxPoint& destPt, const wxSize& sz, - wxDC *source, const wxPoint& srcPt, - wxRasterOperationMode rop = wxCOPY, bool useMask = false, - const wxPoint& srcPtMask = wxDefaultPosition) - { - return m_pimpl->DoBlit(destPt.x, destPt.y, sz.x, sz.y, - source, srcPt.x, srcPt.y, rop, useMask, srcPtMask.x, srcPtMask.y); - } - - bool StretchBlit(wxCoord dstX, wxCoord dstY, - wxCoord dstWidth, wxCoord dstHeight, - wxDC *source, - wxCoord srcX, wxCoord srcY, - wxCoord srcWidth, wxCoord srcHeight, - wxRasterOperationMode rop = wxCOPY, bool useMask = false, - wxCoord srcMaskX = wxDefaultCoord, wxCoord srcMaskY = wxDefaultCoord) - { - return m_pimpl->DoStretchBlit(dstX, dstY, dstWidth, dstHeight, - source, srcX, srcY, srcWidth, srcHeight, rop, useMask, srcMaskX, srcMaskY); - } - bool StretchBlit(const wxPoint& dstPt, const wxSize& dstSize, - wxDC *source, const wxPoint& srcPt, const wxSize& srcSize, - wxRasterOperationMode rop = wxCOPY, bool useMask = false, - const wxPoint& srcMaskPt = wxDefaultPosition) - { - return m_pimpl->DoStretchBlit(dstPt.x, dstPt.y, dstSize.x, dstSize.y, - source, srcPt.x, srcPt.y, srcSize.x, srcSize.y, rop, useMask, srcMaskPt.x, srcMaskPt.y); - } - - wxBitmap GetAsBitmap(const wxRect *subrect = (const wxRect *) NULL) const - { - return m_pimpl->DoGetAsBitmap(subrect); - } - -#if wxUSE_SPLINES - void DrawSpline(wxCoord x1, wxCoord y1, - wxCoord x2, wxCoord y2, - wxCoord x3, wxCoord y3) - { m_pimpl->DrawSpline(x1,y1,x2,y2,x3,y3); } - void DrawSpline(int n, wxPoint points[]) - { m_pimpl->DrawSpline(n,points); } - void DrawSpline(const wxPointList *points) - { m_pimpl->DrawSpline(points); } -#endif // wxUSE_SPLINES - - -#if WXWIN_COMPATIBILITY_2_8 - // for compatibility with the old code when wxCoord was long everywhere - wxDEPRECATED( void GetTextExtent(const wxString& string, - long *x, long *y, - long *descent = NULL, - long *externalLeading = NULL, - const wxFont *theFont = NULL) const ); - wxDEPRECATED( void GetLogicalOrigin(long *x, long *y) const ); - wxDEPRECATED( void GetDeviceOrigin(long *x, long *y) const ); - wxDEPRECATED( void GetClippingBox(long *x, long *y, long *w, long *h) const ); - - wxDEPRECATED( void DrawObject(wxDrawObject* drawobject) ); -#endif // WXWIN_COMPATIBILITY_2_8 - -#ifdef __WXMSW__ - // GetHDC() is the simplest way to retrieve an HDC From a wxDC but only - // works if this wxDC is GDI-based and fails for GDI+ contexts (and - // anything else without HDC, e.g. wxPostScriptDC) - WXHDC GetHDC() const; - - // don't use these methods manually, use GetTempHDC() instead - virtual WXHDC AcquireHDC() { return GetHDC(); } - virtual void ReleaseHDC(WXHDC WXUNUSED(hdc)) { } - - // helper class holding the result of GetTempHDC() with std::auto_ptr<>-like - // semantics, i.e. it is moved when copied - class TempHDC - { - public: - TempHDC(wxDC& dc) - : m_dc(dc), - m_hdc(dc.AcquireHDC()) - { - } - - TempHDC(const TempHDC& thdc) - : m_dc(thdc.m_dc), - m_hdc(thdc.m_hdc) - { - const_cast(thdc).m_hdc = 0; - } - - ~TempHDC() - { - if ( m_hdc ) - m_dc.ReleaseHDC(m_hdc); - } - - WXHDC GetHDC() const { return m_hdc; } - - private: - wxDC& m_dc; - WXHDC m_hdc; - - wxDECLARE_NO_ASSIGN_CLASS(TempHDC); - }; - - // GetTempHDC() also works for wxGCDC (but still not for wxPostScriptDC &c) - TempHDC GetTempHDC() { return TempHDC(*this); } -#endif // __WXMSW__ - -#if wxUSE_GRAPHICS_CONTEXT - virtual wxGraphicsContext* GetGraphicsContext() const - { - return m_pimpl->GetGraphicsContext(); - } - virtual void SetGraphicsContext( wxGraphicsContext* ctx ) - { - m_pimpl->SetGraphicsContext(ctx); - } +// ---------------------------------------------------------------------------- +// now include the declaration of wxDC class +// ---------------------------------------------------------------------------- + +#if defined(__WXPALMOS__) + #include "wx/palmos/dc.h" +#elif defined(__WXMSW__) + #include "wx/msw/dc.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/dc.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/dc.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/dc.h" +#elif defined(__WXX11__) + #include "wx/x11/dc.h" +#elif defined(__WXMGL__) + #include "wx/mgl/dc.h" +#elif defined(__WXDFB__) + #include "wx/dfb/dc.h" +#elif defined(__WXMAC__) + #include "wx/mac/dc.h" +#elif defined(__WXCOCOA__) + #include "wx/cocoa/dc.h" +#elif defined(__WXPM__) + #include "wx/os2/dc.h" #endif -protected: - // ctor takes ownership of the pointer - wxDC(wxDCImpl *pimpl) : m_pimpl(pimpl) { } - - wxDCImpl * const m_pimpl; - -private: - DECLARE_ABSTRACT_CLASS(wxDC) - wxDECLARE_NO_COPY_CLASS(wxDC); -}; +#if wxUSE_GRAPHICS_CONTEXT + #include "wx/dcgraph.h" +#endif // ---------------------------------------------------------------------------- // helper class: you can use it to temporarily change the DC text colour and // restore it automatically when the object goes out of scope // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxDCTextColourChanger +class WXDLLEXPORT wxDCTextColourChanger { public: wxDCTextColourChanger(wxDC& dc) : m_dc(dc), m_colFgOld() { } @@ -1379,13 +909,13 @@ public: ~wxDCTextColourChanger() { - if ( m_colFgOld.IsOk() ) + if ( m_colFgOld.Ok() ) m_dc.SetTextForeground(m_colFgOld); } void Set(const wxColour& col) { - if ( !m_colFgOld.IsOk() ) + if ( !m_colFgOld.Ok() ) m_colFgOld = m_dc.GetTextForeground(); m_dc.SetTextForeground(col); } @@ -1395,7 +925,7 @@ private: wxColour m_colFgOld; - wxDECLARE_NO_COPY_CLASS(wxDCTextColourChanger); + DECLARE_NO_COPY_CLASS(wxDCTextColourChanger) }; // ---------------------------------------------------------------------------- @@ -1403,7 +933,7 @@ private: // restore it automatically when the object goes out of scope // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxDCPenChanger +class WXDLLEXPORT wxDCPenChanger { public: wxDCPenChanger(wxDC& dc, const wxPen& pen) : m_dc(dc), m_penOld(dc.GetPen()) @@ -1413,7 +943,7 @@ public: ~wxDCPenChanger() { - if ( m_penOld.IsOk() ) + if ( m_penOld.Ok() ) m_dc.SetPen(m_penOld); } @@ -1422,7 +952,7 @@ private: wxPen m_penOld; - wxDECLARE_NO_COPY_CLASS(wxDCPenChanger); + DECLARE_NO_COPY_CLASS(wxDCPenChanger) }; // ---------------------------------------------------------------------------- @@ -1430,7 +960,7 @@ private: // restore it automatically when the object goes out of scope // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxDCBrushChanger +class WXDLLEXPORT wxDCBrushChanger { public: wxDCBrushChanger(wxDC& dc, const wxBrush& brush) : m_dc(dc), m_brushOld(dc.GetBrush()) @@ -1440,7 +970,7 @@ public: ~wxDCBrushChanger() { - if ( m_brushOld.IsOk() ) + if ( m_brushOld.Ok() ) m_dc.SetBrush(m_brushOld); } @@ -1449,7 +979,7 @@ private: wxBrush m_brushOld; - wxDECLARE_NO_COPY_CLASS(wxDCBrushChanger); + DECLARE_NO_COPY_CLASS(wxDCBrushChanger) }; // ---------------------------------------------------------------------------- @@ -1457,11 +987,11 @@ private: // destroys it in the dtor // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxDCClipper +class WXDLLEXPORT wxDCClipper { public: wxDCClipper(wxDC& dc, const wxRegion& r) : m_dc(dc) - { dc.SetClippingRegion(r.GetBox()); } + { dc.SetClippingRegion(r); } wxDCClipper(wxDC& dc, const wxRect& r) : m_dc(dc) { dc.SetClippingRegion(r.x, r.y, r.width, r.height); } wxDCClipper(wxDC& dc, wxCoord x, wxCoord y, wxCoord w, wxCoord h) : m_dc(dc) @@ -1472,48 +1002,7 @@ public: private: wxDC& m_dc; - wxDECLARE_NO_COPY_CLASS(wxDCClipper); + DECLARE_NO_COPY_CLASS(wxDCClipper) }; -// ---------------------------------------------------------------------------- -// helper class: you can use it to temporarily change the DC font and -// restore it automatically when the object goes out of scope -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxDCFontChanger -{ -public: - wxDCFontChanger(wxDC& dc) - : m_dc(dc), m_fontOld() - { - } - - wxDCFontChanger(wxDC& dc, const wxFont& font) - : m_dc(dc), m_fontOld(dc.GetFont()) - { - m_dc.SetFont(font); - } - - void Set(const wxFont& font) - { - if ( !m_fontOld.IsOk() ) - m_fontOld = m_dc.GetFont(); - m_dc.SetFont(font); - } - - ~wxDCFontChanger() - { - if ( m_fontOld.IsOk() ) - m_dc.SetFont(m_fontOld); - } - -private: - wxDC& m_dc; - - wxFont m_fontOld; - - wxDECLARE_NO_COPY_CLASS(wxDCFontChanger); -}; - - #endif // _WX_DC_H_BASE_ diff --git a/Source/3rd Party/wx/include/wx/dcbuffer.h b/Source/3rd Party/wx/include/wx/dcbuffer.h index d84cdfee6..6769dbc85 100644 --- a/Source/3rd Party/wx/include/wx/dcbuffer.h +++ b/Source/3rd Party/wx/include/wx/dcbuffer.h @@ -4,7 +4,7 @@ // Author: Ron Lee // Modified by: Vadim Zeitlin (refactored, added bg preservation) // Created: 16/03/02 -// RCS-ID: $Id$ +// RCS-ID: $Id: dcbuffer.h 61872 2009-09-09 22:37:05Z VZ $ // Copyright: (c) Ron Lee // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -37,11 +37,7 @@ // does not prepare the window DC #define wxBUFFER_CLIENT_AREA 0x02 -// Set when not using specific buffer bitmap. Note that this -// is private style and not returned by GetStyle. -#define wxBUFFER_USES_SHARED_BUFFER 0x04 - -class WXDLLIMPEXP_CORE wxBufferedDC : public wxMemoryDC +class WXDLLEXPORT wxBufferedDC : public wxMemoryDC { public: // Default ctor, must subsequently call Init for two stage construction. @@ -102,11 +98,25 @@ public: // Usually called in the dtor or by the dtor of derived classes if the // BufferedDC must blit before the derived class (which may own the dc it's // blitting to) is destroyed. - void UnMask(); + void UnMask() + { + wxCHECK_RET( m_dc, wxT("no underlying wxDC?") ); + wxASSERT_MSG( m_buffer && m_buffer->IsOk(), wxT("invalid backing store") ); + + wxCoord x = 0, + y = 0; + + if ( m_style & wxBUFFER_CLIENT_AREA ) + GetDeviceOrigin(&x, &y); + + m_dc->Blit(0, 0, m_buffer->GetWidth(), m_buffer->GetHeight(), + this, -x, -y ); + m_dc = NULL; + } // Set and get the style void SetStyle(int style) { m_style = style; } - int GetStyle() const { return m_style & ~wxBUFFER_USES_SHARED_BUFFER; } + int GetStyle() const { return m_style; } private: // common part of Init()s @@ -116,6 +126,10 @@ private: m_dc = dc; m_style = style; + + // inherit the same layout direction as the original DC + if (dc && dc->IsOk()) + SetLayoutDirection(dc->GetLayoutDirection()); } // check that the bitmap is valid and use it @@ -134,10 +148,8 @@ private: // the buffering style int m_style; - wxSize m_area; - DECLARE_DYNAMIC_CLASS(wxBufferedDC) - wxDECLARE_NO_COPY_CLASS(wxBufferedDC); + DECLARE_NO_COPY_CLASS(wxBufferedDC) }; @@ -147,7 +159,7 @@ private: // Creates a double buffered wxPaintDC, optionally allowing the // user to specify their own buffer to use. -class WXDLLIMPEXP_CORE wxBufferedPaintDC : public wxBufferedDC +class WXDLLEXPORT wxBufferedPaintDC : public wxBufferedDC { public: // If no bitmap is supplied by the user, a temporary one will be created. @@ -197,7 +209,7 @@ private: wxPaintDC m_paintdc; DECLARE_ABSTRACT_CLASS(wxBufferedPaintDC) - wxDECLARE_NO_COPY_CLASS(wxBufferedPaintDC); + DECLARE_NO_COPY_CLASS(wxBufferedPaintDC) }; @@ -214,25 +226,40 @@ private: #define wxAutoBufferedPaintDCBase wxBufferedPaintDC #endif -class WXDLLIMPEXP_CORE wxAutoBufferedPaintDC : public wxAutoBufferedPaintDCBase + +#ifdef __WXDEBUG__ + +class wxAutoBufferedPaintDC : public wxAutoBufferedPaintDCBase { public: wxAutoBufferedPaintDC(wxWindow* win) : wxAutoBufferedPaintDCBase(win) { - wxASSERT_MSG( win->GetBackgroundStyle() == wxBG_STYLE_PAINT, - "You need to call SetBackgroundStyle(wxBG_STYLE_PAINT) in ctor, " - "and also, if needed, paint the background in wxEVT_PAINT handler." - ); + TestWinStyle(win); } virtual ~wxAutoBufferedPaintDC() { } private: - wxDECLARE_NO_COPY_CLASS(wxAutoBufferedPaintDC); + + void TestWinStyle(wxWindow* win) + { + // Help the user to get the double-buffering working properly. + wxASSERT_MSG( win->GetBackgroundStyle() == wxBG_STYLE_CUSTOM, + wxT("In constructor, you need to call SetBackgroundStyle(wxBG_STYLE_CUSTOM), ") + wxT("and also, if needed, paint the background manually in the paint event handler.")); + } + + DECLARE_NO_COPY_CLASS(wxAutoBufferedPaintDC) }; +#else // !__WXDEBUG__ + +// In release builds, just use typedef +typedef wxAutoBufferedPaintDCBase wxAutoBufferedPaintDC; + +#endif // Check if the window is natively double buffered and will return a wxPaintDC diff --git a/Source/3rd Party/wx/include/wx/dcclient.h b/Source/3rd Party/wx/include/wx/dcclient.h index a5c1e6880..c770f6a2f 100644 --- a/Source/3rd Party/wx/include/wx/dcclient.h +++ b/Source/3rd Party/wx/include/wx/dcclient.h @@ -2,62 +2,41 @@ // Name: wx/dcclient.h // Purpose: wxClientDC base header // Author: Julian Smart +// Modified by: +// Created: // Copyright: (c) Julian Smart -// RCS-ID: $Id$ +// RCS-ID: $Id: dcclient.h 40865 2006-08-27 09:42:42Z VS $ // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_DCCLIENT_H_BASE_ #define _WX_DCCLIENT_H_BASE_ -#include "wx/dc.h" +#include "wx/defs.h" -//----------------------------------------------------------------------------- -// wxWindowDC -//----------------------------------------------------------------------------- +#if defined(__WXPALMOS__) +#include "wx/palmos/dcclient.h" +#elif defined(__WXMSW__) +#include "wx/msw/dcclient.h" +#elif defined(__WXMOTIF__) +#include "wx/motif/dcclient.h" +#elif defined(__WXGTK20__) +#include "wx/gtk/dcclient.h" +#elif defined(__WXGTK__) +#include "wx/gtk1/dcclient.h" +#elif defined(__WXX11__) +#include "wx/x11/dcclient.h" +#elif defined(__WXMGL__) +#include "wx/mgl/dcclient.h" +#elif defined(__WXDFB__) +#include "wx/dfb/dcclient.h" +#elif defined(__WXMAC__) +#include "wx/mac/dcclient.h" +#elif defined(__WXCOCOA__) +#include "wx/cocoa/dcclient.h" +#elif defined(__WXPM__) +#include "wx/os2/dcclient.h" +#endif -class WXDLLIMPEXP_CORE wxWindowDC : public wxDC -{ -public: - wxWindowDC(wxWindow *win); - -protected: - wxWindowDC(wxDCImpl *impl) : wxDC(impl) { } - -private: - DECLARE_ABSTRACT_CLASS(wxWindowDC) -}; - -//----------------------------------------------------------------------------- -// wxClientDC -//----------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxClientDC : public wxWindowDC -{ -public: - wxClientDC(wxWindow *win); - -protected: - wxClientDC(wxDCImpl *impl) : wxWindowDC(impl) { } - -private: - DECLARE_ABSTRACT_CLASS(wxClientDC) -}; - -//----------------------------------------------------------------------------- -// wxPaintDC -//----------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxPaintDC : public wxClientDC -{ -public: - wxPaintDC(wxWindow *win); - -protected: - wxPaintDC(wxDCImpl *impl) : wxClientDC(impl) { } - -private: - DECLARE_ABSTRACT_CLASS(wxPaintDC) -}; - -#endif // _WX_DCCLIENT_H_BASE_ +#endif + // _WX_DCCLIENT_H_BASE_ diff --git a/Source/3rd Party/wx/include/wx/dcgraph.h b/Source/3rd Party/wx/include/wx/dcgraph.h index e6404fc9f..8245f8145 100644 --- a/Source/3rd Party/wx/include/wx/dcgraph.h +++ b/Source/3rd Party/wx/include/wx/dcgraph.h @@ -1,11 +1,11 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/dcgraph.h +// Name: wx/graphdc.h // Purpose: graphics context device bridge header // Author: Stefan Csomor // Modified by: // Created: // Copyright: (c) Stefan Csomor -// RCS-ID: $Id$ +// RCS-ID: $Id: dcgraph.h 53390 2008-04-28 04:19:15Z KO $ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -14,60 +14,34 @@ #if wxUSE_GRAPHICS_CONTEXT -#include "wx/dc.h" #include "wx/geometry.h" +#include "wx/dynarray.h" #include "wx/graphics.h" -class WXDLLIMPEXP_FWD_CORE wxWindowDC; +class WXDLLEXPORT wxWindowDC; +#ifdef __WXMAC__ +#define wxGCDC wxDC +#endif -class WXDLLIMPEXP_CORE wxGCDC: public wxDC +class WXDLLEXPORT wxGCDC: +#ifdef __WXMAC__ + public wxDCBase +#else + public wxDC +#endif { + DECLARE_DYNAMIC_CLASS(wxGCDC) + DECLARE_NO_COPY_CLASS(wxGCDC) + public: - wxGCDC( const wxWindowDC& dc ); - wxGCDC( const wxMemoryDC& dc ); -#if wxUSE_PRINTING_ARCHITECTURE - wxGCDC( const wxPrinterDC& dc ); -#endif -#if defined(__WXMSW__) && wxUSE_ENH_METAFILE - wxGCDC( const wxEnhMetaFileDC& dc ); -#endif - wxGCDC(wxGraphicsContext* context); - + wxGCDC(const wxWindowDC& dc); +#ifdef __WXMSW__ + wxGCDC( const wxMemoryDC& dc); +#endif wxGCDC(); virtual ~wxGCDC(); - wxGraphicsContext* GetGraphicsContext() const; - void SetGraphicsContext( wxGraphicsContext* ctx ); - -#ifdef __WXMSW__ - // override wxDC virtual functions to provide access to HDC associated with - // this Graphics object (implemented in src/msw/graphics.cpp) - virtual WXHDC AcquireHDC(); - virtual void ReleaseHDC(WXHDC hdc); -#endif // __WXMSW__ - -private: - DECLARE_DYNAMIC_CLASS(wxGCDC) - wxDECLARE_NO_COPY_CLASS(wxGCDC); -}; - - -class WXDLLIMPEXP_CORE wxGCDCImpl: public wxDCImpl -{ -public: - wxGCDCImpl( wxDC *owner, const wxWindowDC& dc ); - wxGCDCImpl( wxDC *owner, const wxMemoryDC& dc ); -#if wxUSE_PRINTING_ARCHITECTURE - wxGCDCImpl( wxDC *owner, const wxPrinterDC& dc ); -#endif -#if defined(__WXMSW__) && wxUSE_ENH_METAFILE - wxGCDCImpl( wxDC *owner, const wxEnhMetaFileDC& dc ); -#endif - wxGCDCImpl( wxDC *owner ); - - virtual ~wxGCDCImpl(); - void Init(); @@ -81,9 +55,10 @@ public: virtual void StartPage(); virtual void EndPage(); - + + // to be virtualized on next major // flushing the content of this dc immediately onto screen - virtual void Flush(); + void Flush(); virtual void SetFont(const wxFont& font); virtual void SetPen(const wxPen& pen); @@ -102,19 +77,27 @@ public: virtual int GetDepth() const; virtual wxSize GetPPI() const; - virtual void SetLogicalFunction(wxRasterOperationMode function); + virtual void SetMapMode(int mode); + virtual void SetUserScale(double x, double y); + + virtual void SetLogicalScale(double x, double y); + virtual void SetLogicalOrigin(wxCoord x, wxCoord y); + virtual void SetDeviceOrigin(wxCoord x, wxCoord y); + virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp); + virtual void SetLogicalFunction(int function); virtual void SetTextForeground(const wxColour& colour); virtual void SetTextBackground(const wxColour& colour); virtual void ComputeScaleAndOrigin(); - wxGraphicsContext* GetGraphicsContext() const { return m_graphicContext; } + wxGraphicsContext* GetGraphicsContext() { return m_graphicContext; } virtual void SetGraphicsContext( wxGraphicsContext* ctx ); - + +protected: // the true implementations virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col, - wxFloodFillStyle style = wxFLOOD_SURFACE); + int style = wxFLOOD_SURFACE); virtual void DoGradientFillLinear(const wxRect& rect, const wxColour& initialColour, @@ -131,7 +114,7 @@ public: virtual void DoDrawPoint(wxCoord x, wxCoord y); #if wxUSE_SPLINES - virtual void DoDrawSpline(const wxPointList *points); + virtual void DoDrawSpline(wxList *points); #endif virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2); @@ -163,17 +146,8 @@ public: double angle); virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, - wxDC *source, wxCoord xsrc, wxCoord ysrc, - wxRasterOperationMode rop = wxCOPY, bool useMask = false, - wxCoord xsrcMask = -1, wxCoord ysrcMask = -1); - - virtual bool DoStretchBlit(wxCoord xdest, wxCoord ydest, - wxCoord dstWidth, wxCoord dstHeight, - wxDC *source, - wxCoord xsrc, wxCoord ysrc, - wxCoord srcWidth, wxCoord srcHeight, - wxRasterOperationMode = wxCOPY, bool useMask = false, - wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord); + wxDC *source, wxCoord xsrc, wxCoord ysrc, + int rop = wxCOPY, bool useMask = false, wxCoord xsrcMask = -1, wxCoord ysrcMask = -1); virtual void DoGetSize(int *,int *) const; virtual void DoGetSizeMM(int* width, int* height) const; @@ -181,13 +155,13 @@ public: virtual void DoDrawLines(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset); virtual void DoDrawPolygon(int n, wxPoint points[], - wxCoord xoffset, wxCoord yoffset, - wxPolygonFillMode fillStyle = wxODDEVEN_RULE); + wxCoord xoffset, wxCoord yoffset, + int fillStyle = wxODDEVEN_RULE); virtual void DoDrawPolyPolygon(int n, int count[], wxPoint points[], - wxCoord xoffset, wxCoord yoffset, - wxPolygonFillMode fillStyle); + wxCoord xoffset, wxCoord yoffset, + int fillStyle); - virtual void DoSetDeviceClippingRegion(const wxRegion& region); + virtual void DoSetClippingRegionAsRegion(const wxRegion& region); virtual void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height); @@ -195,27 +169,22 @@ public: wxCoord *x, wxCoord *y, wxCoord *descent = NULL, wxCoord *externalLeading = NULL, - const wxFont *theFont = NULL) const; + wxFont *theFont = NULL) const; virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const; -#ifdef __WXMSW__ - virtual wxRect MSWApplyGDIPlusTransform(const wxRect& r) const; -#endif // __WXMSW__ - protected: // scaling variables bool m_logicalFunctionSupported; + double m_mm_to_pix_x, m_mm_to_pix_y; wxGraphicsMatrix m_matrixOriginal; wxGraphicsMatrix m_matrixCurrent; double m_formerScaleX, m_formerScaleY; wxGraphicsContext* m_graphicContext; - - DECLARE_CLASS(wxGCDCImpl) - wxDECLARE_NO_COPY_CLASS(wxGCDCImpl); }; -#endif // wxUSE_GRAPHICS_CONTEXT +#endif + #endif // _WX_GRAPHICS_DC_H_ diff --git a/Source/3rd Party/wx/include/wx/dcmemory.h b/Source/3rd Party/wx/include/wx/dcmemory.h index 3ae9e6e23..cd7bb0c9d 100644 --- a/Source/3rd Party/wx/include/wx/dcmemory.h +++ b/Source/3rd Party/wx/include/wx/dcmemory.h @@ -5,41 +5,72 @@ // Modified by: // Created: // Copyright: (c) Julian Smart -// RCS-ID: $Id$ +// RCS-ID: $Id: dcmemory.h 43843 2006-12-07 05:44:44Z PC $ // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_DCMEMORY_H_BASE_ #define _WX_DCMEMORY_H_BASE_ -#include "wx/dc.h" #include "wx/bitmap.h" -//----------------------------------------------------------------------------- -// wxMemoryDC -//----------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxMemoryDC: public wxDC +// NOTE: different native implementations of wxMemoryDC will derive from +// different wxDC classes (wxPaintDC, wxWindowDC, etc), so that +// we cannot derive wxMemoryDCBase from wxDC and then use it as the +// only base class for native impl of wxMemoryDC... +class WXDLLEXPORT wxMemoryDCBase { public: - wxMemoryDC(); - wxMemoryDC( wxBitmap& bitmap ); - wxMemoryDC( wxDC *dc ); + wxMemoryDCBase() { } + + // avoid warnings about having virtual functions but non virtual dtor + virtual ~wxMemoryDCBase() { } // select the given bitmap to draw on it - void SelectObject(wxBitmap& bmp); + void SelectObject(wxBitmap& bmp) + { + // make sure that the given wxBitmap is not sharing its data with other + // wxBitmap instances as its contents will be modified by any drawing + // operation done on this DC + if (bmp.IsOk()) + bmp.UnShare(); + + DoSelect(bmp); + } // select the given bitmap for read-only - void SelectObjectAsSource(const wxBitmap& bmp); + virtual void SelectObjectAsSource(const wxBitmap& bmp) + { + DoSelect(bmp); + } - // get selected bitmap - const wxBitmap& GetSelectedBitmap() const; - wxBitmap& GetSelectedBitmap(); - -private: - DECLARE_DYNAMIC_CLASS(wxMemoryDC) +protected: + virtual void DoSelect(const wxBitmap& bmp) = 0; }; +#if defined(__WXPALMOS__) +#include "wx/palmos/dcmemory.h" +#elif defined(__WXMSW__) +#include "wx/msw/dcmemory.h" +#elif defined(__WXMOTIF__) +#include "wx/motif/dcmemory.h" +#elif defined(__WXGTK20__) +#include "wx/gtk/dcmemory.h" +#elif defined(__WXGTK__) +#include "wx/gtk1/dcmemory.h" +#elif defined(__WXX11__) +#include "wx/x11/dcmemory.h" +#elif defined(__WXMGL__) +#include "wx/mgl/dcmemory.h" +#elif defined(__WXDFB__) +#include "wx/dfb/dcmemory.h" +#elif defined(__WXMAC__) +#include "wx/mac/dcmemory.h" +#elif defined(__WXCOCOA__) +#include "wx/cocoa/dcmemory.h" +#elif defined(__WXPM__) +#include "wx/os2/dcmemory.h" +#endif #endif // _WX_DCMEMORY_H_BASE_ diff --git a/Source/3rd Party/wx/include/wx/dcmirror.h b/Source/3rd Party/wx/include/wx/dcmirror.h index 369e46a60..89bf12575 100644 --- a/Source/3rd Party/wx/include/wx/dcmirror.h +++ b/Source/3rd Party/wx/include/wx/dcmirror.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 21.07.2003 -// RCS-ID: $Id$ +// RCS-ID: $Id: dcmirror.h 61872 2009-09-09 22:37:05Z VZ $ // Copyright: (c) 2003 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -18,7 +18,7 @@ // wxMirrorDC allows to write the same code for horz/vertical layout // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxMirrorDCImpl : public wxDCImpl +class WXDLLEXPORT wxMirrorDC : public wxDC { public: // constructs a mirror DC associated with the given real DC @@ -26,12 +26,13 @@ public: // if mirror parameter is true, all vertical and horizontal coordinates are // exchanged, otherwise this class behaves in exactly the same way as a // plain DC - wxMirrorDCImpl(wxDC *owner, wxDCImpl& dc, bool mirror) - : wxDCImpl(owner), - m_dc(dc) - { - m_mirror = mirror; - } + // + // the cast to wxMirrorDC is a dirty hack done to allow us to call the + // protected methods of wxDCBase directly in our code below, without it it + // would be impossible (this is correct from C++ point of view but doesn't + // make any sense in this particular situation) + wxMirrorDC(wxDC& dc, bool mirror) : m_dc((wxMirrorDC&)dc) + { m_mirror = mirror; } // wxDCBase operations virtual void Clear() { m_dc.Clear(); } @@ -52,8 +53,9 @@ public: virtual bool CanGetTextExtent() const { return m_dc.CanGetTextExtent(); } virtual int GetDepth() const { return m_dc.GetDepth(); } virtual wxSize GetPPI() const { return m_dc.GetPPI(); } - virtual bool IsOk() const { return m_dc.IsOk(); } - virtual void SetMapMode(wxMappingMode mode) { m_dc.SetMapMode(mode); } + virtual bool Ok() const { return IsOk(); } + virtual bool IsOk() const { return m_dc.Ok(); } + virtual void SetMapMode(int mode) { m_dc.SetMapMode(mode); } virtual void SetUserScale(double x, double y) { m_dc.SetUserScale(GetX(x, y), GetY(x, y)); } virtual void SetLogicalOrigin(wxCoord x, wxCoord y) @@ -63,9 +65,15 @@ public: virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp) { m_dc.SetAxisOrientation(GetX(xLeftRight, yBottomUp), GetY(xLeftRight, yBottomUp)); } - virtual void SetLogicalFunction(wxRasterOperationMode function) + virtual void SetLogicalFunction(int function) { m_dc.SetLogicalFunction(function); } + // helper functions which may be useful for the users of this class + wxSize Reflect(const wxSize& sizeOrig) + { + return m_mirror ? wxSize(sizeOrig.y, sizeOrig.x) : sizeOrig; + } + protected: // returns x and y if not mirroring or y and x if mirroring wxCoord GetX(wxCoord x, wxCoord y) const { return m_mirror ? y : x; } @@ -102,7 +110,7 @@ protected: // wxDCBase functions virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col, - wxFloodFillStyle style = wxFLOOD_SURFACE) + int style = wxFLOOD_SURFACE) { return m_dc.DoFloodFill(GetX(x, y), GetY(x, y), col, style); } @@ -202,8 +210,7 @@ protected: virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord w, wxCoord h, wxDC *source, wxCoord xsrc, wxCoord ysrc, - wxRasterOperationMode rop = wxCOPY, - bool useMask = false, + int rop = wxCOPY, bool useMask = false, wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord) { return m_dc.DoBlit(GetX(xdest, ydest), GetY(xdest, ydest), @@ -236,7 +243,7 @@ protected: virtual void DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset, - wxPolygonFillMode fillStyle = wxODDEVEN_RULE) + int fillStyle = wxODDEVEN_RULE) { Mirror(n, points); @@ -247,7 +254,7 @@ protected: Mirror(n, points); } - virtual void DoSetDeviceClippingRegion(const wxRegion& WXUNUSED(region)) + virtual void DoSetClippingRegionAsRegion(const wxRegion& WXUNUSED(region)) { wxFAIL_MSG( wxT("not implemented") ); } @@ -262,39 +269,18 @@ protected: wxCoord *x, wxCoord *y, wxCoord *descent = NULL, wxCoord *externalLeading = NULL, - const wxFont *theFont = NULL) const + wxFont *theFont = NULL) const { // never mirrored m_dc.DoGetTextExtent(string, x, y, descent, externalLeading, theFont); } private: - wxDCImpl& m_dc; + wxMirrorDC& m_dc; bool m_mirror; - wxDECLARE_NO_COPY_CLASS(wxMirrorDCImpl); -}; - -class WXDLLIMPEXP_CORE wxMirrorDC : public wxDC -{ -public: - wxMirrorDC(wxDC& dc, bool mirror) - : wxDC(new wxMirrorDCImpl(this, *dc.GetImpl(), mirror)) - { - m_mirror = mirror; - } - - // helper functions which may be useful for the users of this class - wxSize Reflect(const wxSize& sizeOrig) - { - return m_mirror ? wxSize(sizeOrig.y, sizeOrig.x) : sizeOrig; - } - -private: - bool m_mirror; - - wxDECLARE_NO_COPY_CLASS(wxMirrorDC); + DECLARE_NO_COPY_CLASS(wxMirrorDC) }; #endif // _WX_DCMIRROR_H_ diff --git a/Source/3rd Party/wx/include/wx/dcprint.h b/Source/3rd Party/wx/include/wx/dcprint.h index 0ddef56e4..b22394b08 100644 --- a/Source/3rd Party/wx/include/wx/dcprint.h +++ b/Source/3rd Party/wx/include/wx/dcprint.h @@ -5,7 +5,7 @@ // Modified by: // Created: // Copyright: (c) Julian Smart -// RCS-ID: $Id$ +// RCS-ID: $Id: dcprint.h 41240 2006-09-15 16:45:48Z PC $ // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// @@ -16,28 +16,18 @@ #if wxUSE_PRINTING_ARCHITECTURE -#include "wx/dc.h" - -//----------------------------------------------------------------------------- -// wxPrinterDC -//----------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxPrinterDC : public wxDC -{ -public: - wxPrinterDC(); - wxPrinterDC(const wxPrintData& data); - - wxRect GetPaperRect() const; - int GetResolution() const; - -protected: - wxPrinterDC(wxDCImpl *impl) : wxDC(impl) { } - -private: - DECLARE_DYNAMIC_CLASS(wxPrinterDC) -}; +#if defined(__WXPALMOS__) +#include "wx/palmos/dcprint.h" +#elif defined(__WXMSW__) +#include "wx/msw/dcprint.h" +#endif +#if defined(__WXPM__) +#include "wx/os2/dcprint.h" +#endif +#if defined(__WXMAC__) +#include "wx/mac/dcprint.h" +#endif #endif // wxUSE_PRINTING_ARCHITECTURE - -#endif // _WX_DCPRINT_H_BASE_ +#endif + // _WX_DCPRINT_H_BASE_ diff --git a/Source/3rd Party/wx/include/wx/dcscreen.h b/Source/3rd Party/wx/include/wx/dcscreen.h index 3bfa71526..8b52dd959 100644 --- a/Source/3rd Party/wx/include/wx/dcscreen.h +++ b/Source/3rd Party/wx/include/wx/dcscreen.h @@ -5,7 +5,7 @@ // Modified by: // Created: // Copyright: (c) Julian Smart -// RCS-ID: $Id$ +// RCS-ID: $Id: dcscreen.h 40865 2006-08-27 09:42:42Z VS $ // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// @@ -13,24 +13,30 @@ #define _WX_DCSCREEN_H_BASE_ #include "wx/defs.h" -#include "wx/dc.h" - -class WXDLLIMPEXP_CORE wxScreenDC : public wxDC -{ -public: - wxScreenDC(); - - static bool StartDrawingOnTop(wxWindow * WXUNUSED(window)) - { return true; } - static bool StartDrawingOnTop(wxRect * WXUNUSED(rect) = NULL) - { return true; } - static bool EndDrawingOnTop() - { return true; } - -private: - DECLARE_DYNAMIC_CLASS(wxScreenDC) -}; +#if defined(__WXPALMOS__) +#include "wx/palmos/dcscreen.h" +#elif defined(__WXMSW__) +#include "wx/msw/dcscreen.h" +#elif defined(__WXMOTIF__) +#include "wx/motif/dcscreen.h" +#elif defined(__WXGTK20__) +#include "wx/gtk/dcscreen.h" +#elif defined(__WXGTK__) +#include "wx/gtk1/dcscreen.h" +#elif defined(__WXX11__) +#include "wx/x11/dcscreen.h" +#elif defined(__WXMGL__) +#include "wx/mgl/dcscreen.h" +#elif defined(__WXDFB__) +#include "wx/dfb/dcscreen.h" +#elif defined(__WXMAC__) +#include "wx/mac/dcscreen.h" +#elif defined(__WXCOCOA__) +#include "wx/cocoa/dcscreen.h" +#elif defined(__WXPM__) +#include "wx/os2/dcscreen.h" +#endif #endif // _WX_DCSCREEN_H_BASE_ diff --git a/Source/3rd Party/wx/include/wx/dcsvg.h b/Source/3rd Party/wx/include/wx/dcsvg.h deleted file mode 100644 index a2530d296..000000000 --- a/Source/3rd Party/wx/include/wx/dcsvg.h +++ /dev/null @@ -1,219 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/dcsvg.h -// Purpose: wxSVGFileDC -// Author: Chris Elliott -// Modified by: -// Created: -// Copyright: (c) Chris Elliott -// RCS-ID: $Id$ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DCSVG_H_ -#define _WX_DCSVG_H_ - -#include "wx/string.h" -#include "wx/dc.h" - -#if wxUSE_SVG - -#define wxSVGVersion wxT("v0100") - -#ifdef __BORLANDC__ -#pragma warn -8008 -#pragma warn -8066 -#endif - -class WXDLLIMPEXP_FWD_BASE wxFileOutputStream; - - - -class WXDLLIMPEXP_FWD_CORE wxSVGFileDC; - -class WXDLLIMPEXP_CORE wxSVGFileDCImpl : public wxDCImpl -{ -public: - wxSVGFileDCImpl( wxSVGFileDC *owner, const wxString &filename, - int width=320, int height=240, double dpi=72.0 ); - - virtual ~wxSVGFileDCImpl(); - - bool IsOk() const { return m_OK; } - - virtual bool CanDrawBitmap() const { return true; } - virtual bool CanGetTextExtent() const { return true; } - - virtual int GetDepth() const - { - wxFAIL_MSG(wxT("wxSVGFILEDC::GetDepth Call not implemented")); - return -1; - } - - virtual void Clear() - { - wxFAIL_MSG(wxT("wxSVGFILEDC::Clear() Call not implemented \nNot sensible for an output file?")); - } - - virtual void DestroyClippingRegion() - { - wxFAIL_MSG(wxT("wxSVGFILEDC::void Call not yet implemented")); - } - - virtual wxCoord GetCharHeight() const; - virtual wxCoord GetCharWidth() const; - - virtual void SetClippingRegion(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), - wxCoord WXUNUSED(w), wxCoord WXUNUSED(h)) - { - wxFAIL_MSG(wxT("wxSVGFILEDC::SetClippingRegion not implemented")); - } - - virtual void SetPalette(const wxPalette& WXUNUSED(palette)) - { - wxFAIL_MSG(wxT("wxSVGFILEDC::SetPalette not implemented")); - } - - virtual void GetClippingBox(wxCoord *WXUNUSED(x), wxCoord *WXUNUSED(y), - wxCoord *WXUNUSED(w), wxCoord *WXUNUSED(h)) - { - wxFAIL_MSG(wxT("wxSVGFILEDC::GetClippingBox not implemented")); - } - - virtual void SetLogicalFunction(wxRasterOperationMode WXUNUSED(function)) - { - wxFAIL_MSG(wxT("wxSVGFILEDC::SetLogicalFunction Call not implemented")); - } - - virtual wxRasterOperationMode GetLogicalFunction() const - { - wxFAIL_MSG(wxT("wxSVGFILEDC::GetLogicalFunction() not implemented")); - return wxCOPY; - } - - virtual void SetBackground( const wxBrush &brush ); - virtual void SetBackgroundMode( int mode ); - virtual void SetBrush(const wxBrush& brush); - virtual void SetFont(const wxFont& font); - virtual void SetPen(const wxPen& pen); - -private: - virtual bool DoGetPixel(wxCoord, wxCoord, wxColour *) const - { - wxFAIL_MSG(wxT("wxSVGFILEDC::DoGetPixel Call not implemented")); - return true; - } - - virtual bool DoBlit(wxCoord, wxCoord, wxCoord, wxCoord, wxDC *, - wxCoord, wxCoord, wxRasterOperationMode = wxCOPY, - bool = 0, int = -1, int = -1); - - virtual void DoCrossHair(wxCoord, wxCoord) - { - wxFAIL_MSG(wxT("wxSVGFILEDC::CrossHair Call not implemented")); - } - - virtual void DoDrawArc(wxCoord, wxCoord, wxCoord, wxCoord, wxCoord, wxCoord); - - virtual void DoDrawBitmap(const wxBitmap &, wxCoord, wxCoord, bool = false); - - virtual void DoDrawCheckMark(wxCoord x, wxCoord y, wxCoord w, wxCoord h); - - virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord w, wxCoord h); - - virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, - double sa, double ea); - - virtual void DoDrawIcon(const wxIcon &, wxCoord, wxCoord); - - virtual void DoDrawLine (wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2); - - virtual void DoDrawLines(int n, wxPoint points[], - wxCoord xoffset = 0, wxCoord yoffset = 0); - - virtual void DoDrawPoint(wxCoord, wxCoord); - - virtual void DoDrawPolygon(int n, wxPoint points[], - wxCoord xoffset, wxCoord yoffset, - wxPolygonFillMode fillStyle); - - virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord w, wxCoord h); - - virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, - double angle); - - virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y, - wxCoord w, wxCoord h, - double radius = 20) ; - - virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y); - - virtual bool DoFloodFill(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), - const wxColour& WXUNUSED(col), - wxFloodFillStyle WXUNUSED(style) = wxFLOOD_SURFACE) - { - wxFAIL_MSG(wxT("wxSVGFILEDC::DoFloodFill Call not implemented")); - return false; - } - - virtual void DoGetSize(int * x, int *y) const - { - if ( x ) - *x = m_width; - if ( y ) - *y = m_height; - } - - virtual void DoGetTextExtent(const wxString& string, wxCoord *w, wxCoord *h, - wxCoord *descent = NULL, - wxCoord *externalLeading = NULL, - const wxFont *font = NULL) const; - - virtual void DoSetDeviceClippingRegion(const wxRegion& WXUNUSED(region)) - { - wxFAIL_MSG(wxT("wxSVGFILEDC::DoSetDeviceClippingRegion not yet implemented")); - } - - virtual void DoSetClippingRegion( int WXUNUSED(x), int WXUNUSED(y), int WXUNUSED(width), int WXUNUSED(height) ) - { - wxFAIL_MSG(wxT("wxSVGFILEDC::DoSetClippingRegion not yet implemented")); - } - - virtual void DoGetSizeMM( int *width, int *height ) const; - - virtual wxSize GetPPI() const; - - void Init (const wxString &filename, int width, int height, double dpi); - - void NewGraphics(); - - void write( const wxString &s ); - -private: - wxFileOutputStream *m_outfile; - wxString m_filename; - int m_sub_images; // number of png format images we have - bool m_OK; - bool m_graphics_changed; - int m_width, m_height; - double m_dpi; - -private: - DECLARE_ABSTRACT_CLASS(wxSVGFileDCImpl) -}; - - -class WXDLLIMPEXP_CORE wxSVGFileDC : public wxDC -{ -public: - wxSVGFileDC(const wxString& filename, - int width = 320, - int height = 240, - double dpi = 72.0) - : wxDC(new wxSVGFileDCImpl(this, filename, width, height, dpi)) - { - } -}; - -#endif // wxUSE_SVG - -#endif // _WX_DCSVG_H_ diff --git a/Source/3rd Party/wx/include/wx/dde.h b/Source/3rd Party/wx/include/wx/dde.h index 2a6f6639e..495e9e27a 100644 --- a/Source/3rd Party/wx/include/wx/dde.h +++ b/Source/3rd Party/wx/include/wx/dde.h @@ -5,7 +5,7 @@ // Modified by: // Created: // Copyright: (c) Julian Smart -// RCS-ID: $Id$ +// RCS-ID: $Id: dde.h 53135 2008-04-12 02:31:04Z VZ $ // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// @@ -22,10 +22,10 @@ WX_DECLARE_USER_EXPORTED_LIST(wxDDEClient, wxDDEClientList, WXDLLIMPEXP_BASE); WX_DECLARE_USER_EXPORTED_LIST(wxDDEServer, wxDDEServerList, WXDLLIMPEXP_BASE); WX_DECLARE_USER_EXPORTED_LIST(wxDDEConnection, wxDDEConnectionList, WXDLLIMPEXP_BASE); -#if defined(__WINDOWS__) +#if defined(__WXMSW__) #include "wx/msw/dde.h" #else - #error DDE is only supported under Windows + #error DDE is only supported on MSW #endif #endif diff --git a/Source/3rd Party/wx/include/wx/debug.h b/Source/3rd Party/wx/include/wx/debug.h index a7c33e272..fd42bdbfd 100644 --- a/Source/3rd Party/wx/include/wx/debug.h +++ b/Source/3rd Party/wx/include/wx/debug.h @@ -1,364 +1,247 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/debug.h -// Purpose: Misc debug functions and macros -// Author: Vadim Zeitlin -// Created: 29/01/98 -// RCS-ID: $Id$ -// Copyright: (c) 1998-2009 Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// +/** +* Name: wx/debug.h +* Purpose: Misc debug functions and macros +* Author: Vadim Zeitlin +* Modified by: Ryan Norton (Converted to C) +* Created: 29/01/98 +* RCS-ID: $Id: debug.h 61872 2009-09-09 22:37:05Z VZ $ +* Copyright: (c) 1998 Vadim Zeitlin +* Licence: wxWindows licence +*/ -#ifndef _WX_DEBUG_H_ -#define _WX_DEBUG_H_ +/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ -#if !defined(__WXWINCE__) - #include -#endif // systems without assert.h +#ifndef _WX_DEBUG_H_ +#define _WX_DEBUG_H_ -#include // for CHAR_BIT used below +#ifndef __WXWINCE__ +#include +#endif +#include /* for CHAR_BIT used below */ -#include "wx/chartype.h" // for __TFILE__ and wxChar -#include "wx/cpp.h" // for __WXFUNCTION__ -#include "wx/dlimpexp.h" // for WXDLLIMPEXP_FWD_BASE +#include "wx/wxchar.h" /* for __TFILE__ and wxChar */ -class WXDLLIMPEXP_FWD_BASE wxString; -class WXDLLIMPEXP_FWD_BASE wxCStrData; +/* ---------------------------------------------------------------------------- */ +/* Defines controlling the debugging macros */ +/* ---------------------------------------------------------------------------- */ -// ---------------------------------------------------------------------------- -// Defines controlling the debugging macros -// ---------------------------------------------------------------------------- - -/* - wxWidgets can be built with several different levels of debug support - specified by the value of wxDEBUG_LEVEL constant: - - 0: No assertion macros at all, this should only be used when optimizing - for resource-constrained systems (typically embedded ones). - 1: Default level, most of the assertions are enabled. - 2: Maximal (at least for now): asserts which are "expensive" - (performance-wise) or only make sense for finding errors in wxWidgets - itself, as opposed to bugs in applications using it, are also enabled. - */ - -// unless wxDEBUG_LEVEL is predefined (by configure or via wx/setup.h under -// Windows), use the default -#if !defined(wxDEBUG_LEVEL) - #define wxDEBUG_LEVEL 1 -#endif // !defined(wxDEBUG_LEVEL) - -/* - __WXDEBUG__ is defined when wxDEBUG_LEVEL != 0. This is done mostly for - compatibility but it also provides a simpler way to check if asserts and - debug logging is enabled at all. - */ -#if wxDEBUG_LEVEL > 0 +/* if _DEBUG is defined (MS VC++ and others use it in debug builds), define */ +/* __WXDEBUG__ too */ +#ifdef _DEBUG #ifndef __WXDEBUG__ #define __WXDEBUG__ - #endif -#else - #undef __WXDEBUG__ -#endif + #endif /* !__WXDEBUG__ */ +#endif /* _DEBUG */ -// Finally there is also a very old WXDEBUG macro not used anywhere at all, it -// is only defined for compatibility. +/* if NDEBUG is defined ( uses it), undef __WXDEBUG__ and WXDEBUG */ +#ifdef NDEBUG + #undef __WXDEBUG__ + #undef WXDEBUG +#endif /* NDEBUG */ + +/* if __WXDEBUG__ is defined, make sure that WXDEBUG is defined and >= 1 */ #ifdef __WXDEBUG__ #if !defined(WXDEBUG) || !WXDEBUG #undef WXDEBUG #define WXDEBUG 1 - #endif // !WXDEBUG -#endif // __WXDEBUG__ + #endif /* !WXDEBUG */ +#endif /* __WXDEBUG__ */ -// ---------------------------------------------------------------------------- -// Handling assertion failures -// ---------------------------------------------------------------------------- +#ifndef __WXFUNCTION__ + /* TODO: add more compilers supporting __FUNCTION__ */ + #if defined(__DMC__) + /* + __FUNCTION__ happens to be not defined within class members + http://www.digitalmars.com/drn-bin/wwwnews?c%2B%2B.beta/485 + */ + #define __WXFUNCTION__ (NULL) + #elif defined(__GNUC__) || \ + (defined(_MSC_VER) && _MSC_VER >= 1300) || \ + defined(__FUNCTION__) + #define __WXFUNCTION__ __FUNCTION__ + #else + /* still define __WXFUNCTION__ to avoid #ifdefs elsewhere */ + #define __WXFUNCTION__ (NULL) + #endif +#endif /* __WXFUNCTION__ already defined */ -/* - Type for the function called in case of assert failure, see - wxSetAssertHandler(). - */ -typedef void (*wxAssertHandler_t)(const wxString& file, - int line, - const wxString& func, - const wxString& cond, - const wxString& msg); +/* ---------------------------------------------------------------------------- */ +/* Debugging macros */ +/* */ +/* All debugging macros rely on ASSERT() which in turn calls the user-defined */ +/* OnAssert() function. To keep things simple, it's called even when the */ +/* expression is true (i.e. everything is ok) and by default does nothing: just */ +/* returns the same value back. But if you redefine it to do something more sexy */ +/* (popping up a message box in your favourite GUI, sending you e-mail or */ +/* whatever) it will affect all ASSERTs, FAILs and CHECKs in your code. */ +/* */ +/* Warning: if you don't like advice on programming style, don't read */ +/* further! ;-) */ +/* */ +/* Extensive use of these macros is recommended! Remember that ASSERTs are */ +/* disabled in final build (without __WXDEBUG__ defined), so they add strictly */ +/* nothing to your program's code. On the other hand, CHECK macros do stay */ +/* even in release builds, but in general are not much of a burden, while */ +/* a judicious use of them might increase your program's stability. */ +/* ---------------------------------------------------------------------------- */ -#if wxDEBUG_LEVEL +/* Macros which are completely disabled in 'release' mode */ +/* */ +/* NB: these functions are implemented in src/common/appcmn.cpp */ +#if defined(__cplusplus) && defined(__WXDEBUG__) + /* + This function is called whenever one of debugging macros fails (i.e. + condition is false in an assertion). To customize its behaviour, override + wxApp::OnAssert(). -// the global assert handler function, if it is NULL asserts don't check their -// conditions -extern WXDLLIMPEXP_DATA_BASE(wxAssertHandler_t) wxTheAssertHandler; + Parameters: + szFile and nLine - file name and line number of the ASSERT + szFunc - function name of the ASSERT, may be NULL (NB: ASCII) + szCond - text form of the condition which failed + szMsg - optional message explaining the reason + */ + extern void WXDLLIMPEXP_BASE wxOnAssert(const wxChar *szFile, + int nLine, + const char *szFunc, + const wxChar *szCond, + const wxChar *szMsg = NULL); -/* - Sets the function to be called in case of assertion failure. + /* call this function to break into the debugger unconditionally (assuming */ + /* the program is running under debugger, of course) */ + extern void WXDLLIMPEXP_BASE wxTrap(); - The default assert handler forwards to wxApp::OnAssertFailure() whose - default behaviour is, in turn, to show the standard assertion failure - dialog if a wxApp object exists or shows the same dialog itself directly - otherwise. - - While usually it is enough -- and more convenient -- to just override - OnAssertFailure(), to handle all assertion failures, including those - occurring even before wxApp object creation or after its destruction you - need to provide your assertion handler function. - - This function also provides a simple way to disable all asserts: simply - pass NULL pointer to it. Doing this will result in not even evaluating - assert conditions at all, avoiding almost all run-time cost of asserts. - - Notice that this function is not MT-safe, so you should call it before - starting any other threads. - - The return value of this function is the previous assertion handler. It can - be called after any pre-processing by your handler and can also be restored - later if you uninstall your handler. - */ -inline wxAssertHandler_t wxSetAssertHandler(wxAssertHandler_t handler) -{ - const wxAssertHandler_t old = wxTheAssertHandler; - wxTheAssertHandler = handler; - return old; -} - -/* - Reset the default assert handler. - - This may be used to enable asserts, which are disabled by default in this - case, for programs built in release build (NDEBUG defined). - */ -extern void WXDLLIMPEXP_BASE wxSetDefaultAssertHandler(); - -#else // !wxDEBUG_LEVEL - -// provide empty stubs in case assertions are completely disabled -// -// NB: can't use WXUNUSED() here as we're included from wx/defs.h before it is -// defined -inline wxAssertHandler_t wxSetAssertHandler(wxAssertHandler_t /* handler */) -{ - return NULL; -} - -inline void wxSetDefaultAssertHandler() { } - -#endif // wxDEBUG_LEVEL/!wxDEBUG_LEVEL - -// simply a synonym for wxSetAssertHandler(NULL) -inline void wxDisableAsserts() { wxSetAssertHandler(NULL); } - -/* - A macro which disables asserts for applications compiled in release build. - - By default, wxIMPLEMENT_APP (or rather wxIMPLEMENT_WXWIN_MAIN) disable the - asserts in the applications compiled in the release build by calling this. - It does nothing if NDEBUG is not defined. - */ -#ifdef NDEBUG - #define wxDISABLE_ASSERTS_IN_RELEASE_BUILD() wxDisableAsserts() -#else - #define wxDISABLE_ASSERTS_IN_RELEASE_BUILD() -#endif - -#if wxDEBUG_LEVEL - -/* - wxOnAssert() is used by the debugging macros defined below. Different - overloads are needed because these macros can be used with or without wxT(). - - All of them are implemented in src/common/appcmn.cpp and unconditionally - call wxTheAssertHandler so the caller must check that it is non-NULL - (assert macros do it). - */ - -#if wxUSE_UNICODE - -// these overloads are the ones typically used by debugging macros: we have to -// provide wxChar* msg version because it's common to use wxT() in the macros -// and finally, we can't use const wx(char)* msg = NULL, because that would -// be ambiguous -// -// also notice that these functions can't be inline as wxString is not defined -// yet (and can't be as wxString code itself may use assertions) -extern WXDLLIMPEXP_BASE void wxOnAssert(const char *file, - int line, - const char *func, - const char *cond); - -extern WXDLLIMPEXP_BASE void wxOnAssert(const char *file, - int line, - const char *func, - const char *cond, - const char *msg); - -extern WXDLLIMPEXP_BASE void wxOnAssert(const char *file, - int line, - const char *func, - const char *cond, - const wxChar *msg) ; -#endif /* wxUSE_UNICODE */ - -// this version is for compatibility with wx 2.8 Unicode build only, we don't -// use it ourselves any more except in ANSI-only build in which case it is all -// we need -extern WXDLLIMPEXP_BASE void wxOnAssert(const wxChar *file, - int line, - const char *func, - const wxChar *cond, - const wxChar *msg = NULL); - -// these overloads work when msg passed to debug macro is a string and we -// also have to provide wxCStrData overload to resolve ambiguity which would -// otherwise arise from wxASSERT( s.c_str() ) -extern WXDLLIMPEXP_BASE void wxOnAssert(const wxString& file, - int line, - const wxString& func, - const wxString& cond, - const wxString& msg); - -extern WXDLLIMPEXP_BASE void wxOnAssert(const wxString& file, - int line, - const wxString& func, - const wxString& cond); - -extern WXDLLIMPEXP_BASE void wxOnAssert(const char *file, - int line, - const char *func, - const char *cond, - const wxCStrData& msg); - -extern WXDLLIMPEXP_BASE void wxOnAssert(const char *file, - int line, - const char *func, - const char *cond, - const wxString& msg); - -#endif // wxDEBUG_LEVEL + /* generic assert macro */ + #define wxASSERT(cond) wxASSERT_MSG(cond, NULL) -// ---------------------------------------------------------------------------- -// Debugging macros -// ---------------------------------------------------------------------------- + /* assert with additional message explaining its cause */ -/* - Assertion macros: check if the condition is true and call assert handler - (which will by default notify the user about failure) if it isn't. - - wxASSERT and wxFAIL macros as well as wxTrap() function do nothing at all - if wxDEBUG_LEVEL is 0 however they do check their conditions at default - debug level 1, unlike the previous wxWidgets versions. - - wxASSERT_LEVEL_2 is meant to be used for "expensive" asserts which should - normally be disabled because they have a big impact on performance and so - this macro only does anything if wxDEBUG_LEVEL >= 2. - */ -#if wxDEBUG_LEVEL - // call this function to break into the debugger unconditionally (assuming - // the program is running under debugger, of course) - extern void WXDLLIMPEXP_BASE wxTrap(); - - // assert checks if the condition is true and calls the assert handler with - // the provided message if it isn't - // - // NB: the macro is defined like this to ensure that nested if/else - // statements containing it are compiled in the same way whether it is - // defined as empty or not; also notice that we can't use ";" instead - // of "{}" as some compilers warn about "possible unwanted ;" then + /* compilers can give a warning (such as "possible unwanted ;") when using */ + /* the default definition of wxASSERT_MSG so we provide an alternative */ + #if defined(__MWERKS__) #define wxASSERT_MSG(cond, msg) \ - if ( !wxTheAssertHandler || (cond) ) \ - {} \ - else \ - wxOnAssert(__FILE__, __LINE__, __WXFUNCTION__, #cond, msg) + if ( cond ) \ + {} \ + else \ + wxOnAssert(__TFILE__, __LINE__, __WXFUNCTION__, wxT(#cond), msg) + #else + #define wxASSERT_MSG(cond, msg) \ + if ( cond ) \ + ; \ + else \ + wxOnAssert(__TFILE__, __LINE__, __WXFUNCTION__, wxT(#cond), msg) + #endif - // a version without any additional message, don't use unless condition - // itself is fully self-explanatory - #define wxASSERT(cond) wxASSERT_MSG(cond, (const char*)NULL) + /* special form of assert: always triggers it (in debug mode) */ + #define wxFAIL wxFAIL_MSG(NULL) - // wxFAIL is a special form of assert: it always triggers (and so is - // usually used in normally unreachable code) - #define wxFAIL_COND_MSG(cond, msg) \ - if ( !wxTheAssertHandler ) \ - {} \ - else \ - wxOnAssert(__FILE__, __LINE__, __WXFUNCTION__, cond, msg) - #define wxFAIL_MSG(msg) wxFAIL_COND_MSG("Assert failure", msg) - #define wxFAIL wxFAIL_MSG((const char*)NULL) -#else // !wxDEBUG_LEVEL - #define wxTrap() + /* FAIL with some message */ + #define wxFAIL_MSG(msg) wxFAIL_COND_MSG("wxAssertFailure", msg) - #define wxASSERT(cond) - #define wxASSERT_MSG(cond, msg) - #define wxFAIL - #define wxFAIL_MSG(msg) - #define wxFAIL_COND_MSG(cond, msg) -#endif // wxDEBUG_LEVEL + /* FAIL with some message and a condition */ + #define wxFAIL_COND_MSG(cond, msg) \ + wxOnAssert(__TFILE__, __LINE__, __WXFUNCTION__, wxT(cond), msg) -#if wxDEBUG_LEVEL >= 2 - #define wxASSERT_LEVEL_2_MSG(cond, msg) wxASSERT_MSG(cond, msg) - #define wxASSERT_LEVEL_2(cond) wxASSERT(cond) -#else // wxDEBUG_LEVEL < 2 - #define wxASSERT_LEVEL_2_MSG(cond, msg) - #define wxASSERT_LEVEL_2(cond) + /* An assert helper used to avoid warning when testing constant expressions, */ + /* i.e. wxASSERT( sizeof(int) == 4 ) can generate a compiler warning about */ + /* expression being always true, but not using */ + /* wxASSERT( wxAssertIsEqual(sizeof(int), 4) ) */ + /* */ + /* NB: this is made obsolete by wxCOMPILE_TIME_ASSERT() and should no */ + /* longer be used. */ + extern bool WXDLLIMPEXP_BASE wxAssertIsEqual(int x, int y); +#else + #define wxTrap() + + /* nothing to do in release mode (hopefully at this moment there are */ + /* no more bugs ;-) */ + #define wxASSERT(cond) + #define wxASSERT_MSG(cond, msg) + #define wxFAIL + #define wxFAIL_MSG(msg) + #define wxFAIL_COND_MSG(cond, msg) +#endif /* __WXDEBUG__ */ + +#ifdef __cplusplus + /* Use of wxFalse instead of false suppresses compiler warnings about testing */ + /* constant expression */ + extern WXDLLIMPEXP_DATA_BASE(const bool) wxFalse; #endif -// This is simply a wrapper for the standard abort() which is not available -// under all platforms. -// -// It isn't really debug-related but there doesn't seem to be any better place -// for it, so declare it here and define it in appbase.cpp, together with -// wxTrap(). -extern void WXDLLIMPEXP_BASE wxAbort(); +#define wxAssertFailure wxFalse + +/* NB: the following macros also work in release mode! */ /* - wxCHECK macros always check their conditions, setting debug level to 0 only - makes them silent in case of failure, otherwise -- including at default - debug level 1 -- they call the assert handler if the condition is false - - They are supposed to be used only in invalid situation: for example, an - invalid parameter (e.g. a NULL pointer) is passed to a function. Instead of - dereferencing it and causing core dump the function might use - - wxCHECK_RET( p != NULL, "pointer can't be NULL" ) + These macros must be used only in invalid situation: for example, an + invalid parameter (e.g. a NULL pointer) is passed to a function. Instead of + dereferencing it and causing core dump the function might try using + CHECK( p != NULL ) or CHECK( p != NULL, return LogError("p is NULL!!") ) */ -// the generic macro: takes the condition to check, the statement to be executed -// in case the condition is false and the message to pass to the assert handler -#define wxCHECK2_MSG(cond, op, msg) \ - if ( cond ) \ - {} \ - else \ - { \ - wxFAIL_COND_MSG(#cond, msg); \ - op; \ - } \ - struct wxDummyCheckStruct /* just to force a semicolon */ +/* check that expression is true, "return" if not (also FAILs in debug mode) */ +#define wxCHECK(cond, rc) wxCHECK_MSG(cond, rc, NULL) -// check which returns with the specified return code if the condition fails +/* as wxCHECK but with a message explaining why we fail */ #define wxCHECK_MSG(cond, rc, msg) wxCHECK2_MSG(cond, return rc, msg) -// check that expression is true, "return" if not (also FAILs in debug mode) -#define wxCHECK(cond, rc) wxCHECK_MSG(cond, rc, (const char*)NULL) +/* check that expression is true, perform op if not */ +#define wxCHECK2(cond, op) wxCHECK2_MSG(cond, op, NULL) -// check that expression is true, perform op if not -#define wxCHECK2(cond, op) wxCHECK2_MSG(cond, op, (const char*)NULL) +/* as wxCHECK2 but with a message explaining why we fail */ -// special form of wxCHECK2: as wxCHECK, but for use in void functions -// -// NB: there is only one form (with msg parameter) and it's intentional: -// there is no other way to tell the caller what exactly went wrong -// from the void function (of course, the function shouldn't be void -// to begin with...) +#ifdef __GNUC__ + #define wxFORCE_SEMICOLON typedef int wxDummyCheckInt + /* Note: old gcc versions (e.g. 2.8) give an internal compiler error */ + /* on a simple forward declaration, when used in a template */ + /* function, so rather use a dummy typedef which does work... */ +#else + #define wxFORCE_SEMICOLON struct wxDummyCheckStruct + /* Note2: however, some other compilers (notably Digital Mars */ + /* don't like multiple typedefs (even though the standard */ + /* does allow them), so use a forward declaration for non-gcc. */ +#endif +/* see comment near the definition of wxASSERT_MSG for the # if/else reason */ +#if defined(__MWERKS__) + #define wxCHECK2_MSG(cond, op, msg) \ + if ( cond ) \ + {} \ + else \ + { \ + wxFAIL_COND_MSG(#cond, msg); \ + op; \ + } \ + struct wxDummyCheckStruct /* just to force a semicolon */ +#else + #define wxCHECK2_MSG(cond, op, msg) \ + if ( cond ) \ + ; \ + else \ + { \ + wxFAIL_COND_MSG(#cond, msg); \ + op; \ + } \ + wxFORCE_SEMICOLON /* just to force a semicolon */ +#endif + +/* special form of wxCHECK2: as wxCHECK, but for use in void functions */ +/* */ +/* NB: there is only one form (with msg parameter) and it's intentional: */ +/* there is no other way to tell the caller what exactly went wrong */ +/* from the void function (of course, the function shouldn't be void */ +/* to begin with...) */ #define wxCHECK_RET(cond, msg) wxCHECK2_MSG(cond, return, msg) - -// ---------------------------------------------------------------------------- -// Compile time asserts -// -// Unlike the normal assert and related macros above which are checked during -// the program run-time the macros below will result in a compilation error if -// the condition they check is false. This is usually used to check the -// expressions containing sizeof()s which cannot be tested with the -// preprocessor. If you can use the #if's, do use them as you can give a more -// detailed error message then. -// ---------------------------------------------------------------------------- +/* ---------------------------------------------------------------------------- */ +/* Compile time asserts */ +/* */ +/* Unlike the normal assert and related macros above which are checked during */ +/* the program tun-time the macros below will result in a compilation error if */ +/* the condition they check is false. This is usually used to check the */ +/* expressions containing sizeof()s which cannot be tested with the */ +/* preprocessor. If you can use the #if's, do use them as you can give a more */ +/* detailed error message then. */ +/* ---------------------------------------------------------------------------- */ /* How this works (you don't have to understand it to be able to use the @@ -380,31 +263,13 @@ extern void WXDLLIMPEXP_BASE wxAbort(); It may be used both within a function and in the global scope. */ -#if defined(__WATCOMC__) +#if defined(__WATCOMC__) && defined(__cplusplus) /* avoid "unused symbol" warning */ #define wxCOMPILE_TIME_ASSERT(expr, msg) \ class wxMAKE_UNIQUE_ASSERT_NAME { \ unsigned int msg: expr; \ wxMAKE_UNIQUE_ASSERT_NAME() { wxUnusedVar(msg); } \ } -#elif defined( __VMS ) -namespace wxdebug{ - -// HP aCC cannot deal with missing names for template value parameters -template struct STATIC_ASSERTION_FAILURE; - -template <> struct STATIC_ASSERTION_FAILURE { enum { value = 1 }; }; - -// HP aCC cannot deal with missing names for template value parameters -template struct static_assert_test{}; - -} - #define WX_JOIN( X, Y ) X##Y - #define WX_STATIC_ASSERT_BOOL_CAST(x) (bool)(x) - #define wxCOMPILE_TIME_ASSERT(expr, msg) \ - typedef ::wxdebug::static_assert_test<\ - sizeof(::wxdebug::STATIC_ASSERTION_FAILURE< WX_STATIC_ASSERT_BOOL_CAST( expr ) >)>\ - WX_JOIN(wx_static_assert_typedef_, __LINE__) #else #define wxCOMPILE_TIME_ASSERT(expr, msg) \ struct wxMAKE_UNIQUE_ASSERT_NAME { unsigned int msg: expr; } @@ -420,53 +285,32 @@ template struct static_assert_test{}; #define wxCOMPILE_TIME_ASSERT2(expr, msg, text) \ struct wxMAKE_UNIQUE_ASSERT_NAME2(text) { unsigned int msg: expr; } -// helpers for wxCOMPILE_TIME_ASSERT below, for private use only +/* helpers for wxCOMPILE_TIME_ASSERT below, for private use only */ #define wxMAKE_BITSIZE_MSG(type, size) type ## SmallerThan ## size ## Bits -// a special case of compile time assert: check that the size of the given type -// is at least the given number of bits +/* a special case of compile time assert: check that the size of the given type */ +/* is at least the given number of bits */ #define wxASSERT_MIN_BITSIZE(type, size) \ wxCOMPILE_TIME_ASSERT(sizeof(type) * CHAR_BIT >= size, \ wxMAKE_BITSIZE_MSG(type, size)) - -// ---------------------------------------------------------------------------- -// other miscellaneous debugger-related functions -// ---------------------------------------------------------------------------- +/* ---------------------------------------------------------------------------- */ +/* other miscellaneous debugger-related functions */ +/* ---------------------------------------------------------------------------- */ /* Return true if we're running under debugger. - Currently only really works under Win32 and just returns false elsewhere. + Currently this only really works under Win32 and Mac in CodeWarrior builds, + it always returns false in other cases. */ -#if defined(__WIN32__) - extern bool WXDLLIMPEXP_BASE wxIsDebuggerRunning(); -#else // !Mac - inline bool wxIsDebuggerRunning() { return false; } -#endif // Mac/!Mac +#ifdef __cplusplus + /* ABX: check __WIN32__ instead of __WXMSW__ for the same MSWBase in any Win32 port */ + #if defined(__WXMAC__) || defined(__WIN32__) + extern bool WXDLLIMPEXP_BASE wxIsDebuggerRunning(); + #else /* !Mac */ + inline bool wxIsDebuggerRunning() { return false; } + #endif /* Mac/!Mac */ +#endif /* __cplusplus */ -// An assert helper used to avoid warning when testing constant expressions, -// i.e. wxASSERT( sizeof(int) == 4 ) can generate a compiler warning about -// expression being always true, but not using -// wxASSERT( wxAssertIsEqual(sizeof(int), 4) ) -// -// NB: this is made obsolete by wxCOMPILE_TIME_ASSERT() and should no -// longer be used. -extern bool WXDLLIMPEXP_BASE wxAssertIsEqual(int x, int y); - -// Use of wxFalse instead of false suppresses compiler warnings about testing -// constant expression -extern WXDLLIMPEXP_DATA_BASE(const bool) wxFalse; - -#define wxAssertFailure wxFalse - -// This is similar to WXUNUSED() and useful for parameters which are only used -// in assertions. -#if wxDEBUG_LEVEL - #define WXUNUSED_UNLESS_DEBUG(param) param -#else - #define WXUNUSED_UNLESS_DEBUG(param) WXUNUSED(param) -#endif - - -#endif // _WX_DEBUG_H_ +#endif /* _WX_DEBUG_H_ */ diff --git a/Source/3rd Party/wx/include/wx/defs.h b/Source/3rd Party/wx/include/wx/defs.h index e49f8d1be..6e3fd8765 100644 --- a/Source/3rd Party/wx/include/wx/defs.h +++ b/Source/3rd Party/wx/include/wx/defs.h @@ -4,7 +4,7 @@ * Author: Julian Smart and others * Modified by: Ryan Norton (Converted to C) * Created: 01/02/97 - * RCS-ID: $Id$ + * RCS-ID: $Id: defs.h 66923 2011-02-16 22:37:48Z JS $ * Copyright: (c) Julian Smart * Licence: wxWindows licence */ @@ -14,13 +14,6 @@ #ifndef _WX_DEFS_H_ #define _WX_DEFS_H_ -/* - NOTE: this symbol will be replaced with "WXWIN_COMPATIBILITY_3_0" as soon - as the development branch for 3.1 is created - */ -#define FUTURE_WXWIN_COMPATIBILITY_3_0 1 -#define wxDEPRECATED_FUTURE( x ) x - /* ---------------------------------------------------------------------------- */ /* compiler and OS identification */ /* ---------------------------------------------------------------------------- */ @@ -30,16 +23,18 @@ #ifdef __cplusplus /* Make sure the environment is set correctly */ # if defined(__WXMSW__) && defined(__X__) -# error "Target can't be both X and MSW" +# error "Target can't be both X and Windows" +# elif defined(__WXMSW__) && defined(__PALMOS__) +# error "Target can't be both PalmOS and Windows" # elif !defined(__WXMOTIF__) && \ !defined(__WXMSW__) && \ + !defined(__WXPALMOS__)&& \ !defined(__WXGTK__) && \ !defined(__WXPM__) && \ - !defined(__WXOSX_CARBON__) && \ - !defined(__WXOSX_COCOA__) && \ - !defined(__WXOSX_IPHONE__) && \ + !defined(__WXMAC__) && \ !defined(__WXCOCOA__) && \ !defined(__X__) && \ + !defined(__WXMGL__) && \ !defined(__WXDFB__) && \ !defined(__WXX11__) && \ wxUSE_GUI @@ -64,6 +59,9 @@ #define __WXBASE__ #endif +/* include the feature test macros */ +#include "wx/features.h" + /* suppress some Visual C++ warnings */ #ifdef __VISUALC__ /* the only "real" warning here is 4244 but there are just too many of them */ @@ -74,89 +72,43 @@ # pragma warning(disable:4355) /* 'this' used in base member initializer list */ # pragma warning(disable:4511) /* copy ctor couldn't be generated */ # pragma warning(disable:4512) /* operator=() couldn't be generated */ -# pragma warning(disable:4514) /* unreferenced inline func has been removed */ # pragma warning(disable:4710) /* function not inlined */ - /* - TODO: this warning should really be enabled as it can be genuinely - useful, check where does it occur in wxWidgets - */ - #pragma warning(disable: 4127) /* conditional expression is constant */ - - /* There are too many false positivies for this one, particularly when - using templates like wxVector */ - /* class 'foo' needs to have dll-interface to be used by clients of - class 'bar'" */ -# pragma warning(disable:4251) - - /* - This is a similar warning which occurs when deriving from standard - containers. MSDN even mentions that it can be ignored in this case - (albeit only in debug build while the warning is the same in release - too and seems equally harmless). - */ -#if wxUSE_STD_CONTAINERS -# pragma warning(disable:4275) -#endif /* wxUSE_STD_CONTAINERS */ - -# ifdef __VISUALC5__ /* For VC++ 5.0 for release mode, the warning 'C4702: unreachable code */ /* is buggy, and occurs for code that does actually get executed */ -# ifndef __WXDEBUG__ +# if !defined __WXDEBUG__ && __VISUALC__ <= 1100 # pragma warning(disable:4702) /* unreachable code */ # endif - /* The VC++ 5.0 warning 'C4003: not enough actual parameters for macro' * is incompatible with the wxWidgets headers since it is given when * parameters are empty but not missing. */ +# if __VISUALC__ <= 1100 # pragma warning(disable:4003) /* not enough actual parameters for macro */ # endif - /* - VC6 insists on complaining about - - return type for 'wxVector::reverse_iterator::operator ->' is 'T **' - (ie; not a UDT or reference to a UDT. Will produce errors if applied - using infix notation) - - which is perfectly fine because template classes do routinely define - operators which don't make sense for all template parameter values - (besides this warning was removed in subsequent versions). - */ - #ifdef __VISUALC6__ - #pragma warning(disable: 4284) - #endif /* VC6 */ - - /* - When compiling with VC++ 7 /Wp64 option we get thousands of warnings for - conversion from size_t to int or long. Some precious few of them might - be worth looking into but unfortunately it seems infeasible to fix all - the other, harmless ones (e.g. inserting static_cast(s.length()) - everywhere this method is used though we are quite sure that using >4GB - strings is a bad idea anyhow) so just disable it globally for now. - */ - #if wxCHECK_VISUALC_VERSION(7) - /* conversion from 'size_t' to 'unsigned long', possible loss of data */ - #pragma warning(disable:4267) - #endif /* VC++ 7 or later */ - /* VC++ 8 gives a warning when using standard functions such as sprintf, localtime, ... -- stop this madness, unless the user had already done it */ - #if wxCHECK_VISUALC_VERSION(8) + #if __VISUALC__ >= 1400 #ifndef _CRT_SECURE_NO_DEPRECATE #define _CRT_SECURE_NO_DEPRECATE 1 #endif #ifndef _CRT_NON_CONFORMING_SWPRINTFS #define _CRT_NON_CONFORMING_SWPRINTFS 1 #endif - #ifndef _SCL_SECURE_NO_WARNINGS - #define _SCL_SECURE_NO_WARNINGS 1 - #endif #endif /* VC++ 8 */ #endif /* __VISUALC__ */ +/* suppress some Salford C++ warnings */ +#ifdef __SALFORDC__ +# pragma suppress 353 /* Possible nested comments */ +# pragma suppress 593 /* Define not used */ +# pragma suppress 61 /* enum has no name (doesn't suppress!) */ +# pragma suppress 106 /* unnamed, unused parameter */ +# pragma suppress 571 /* Virtual function hiding */ +#endif /* __SALFORDC__ */ + /* suppress some Borland C++ warnings */ #ifdef __BORLANDC__ # pragma warn -inl /* Functions containing reserved words and certain constructs are not expanded inline */ @@ -175,18 +127,6 @@ # define wxSUPPRESS_GCC_PRIVATE_DTOR_WARNING(name) #endif -/* - Clang Support - */ - -#ifndef WX_HAS_CLANG_FEATURE -# ifndef __has_feature -# define WX_HAS_CLANG_FEATURE(x) 0 -# else -# define WX_HAS_CLANG_FEATURE(x) __has_feature(x) -# endif -#endif - /* ---------------------------------------------------------------------------- */ /* wxWidgets version and compatibility defines */ /* ---------------------------------------------------------------------------- */ @@ -215,16 +155,73 @@ #define va_list __gnuc_va_list #endif /* HP-UX */ -/* Prevents conflicts between sys/types.h and winsock.h with Cygwin, */ -/* when using Windows sockets. */ -#if defined(__CYGWIN__) && defined(__WXMSW__) -#define __USE_W32_SOCKETS -#endif - /* ---------------------------------------------------------------------------- */ /* check for native bool type and TRUE/FALSE constants */ /* ---------------------------------------------------------------------------- */ +/* Add more tests here for Windows compilers that already define bool */ +/* (under Unix, configure tests for this) */ +#ifndef HAVE_BOOL + #if defined( __MWERKS__ ) + #if (__MWERKS__ >= 0x1000) && __option(bool) + #define HAVE_BOOL + #endif + #elif defined(__APPLE__) && defined(__APPLE_CC__) + /* Apple bundled gcc supports bool */ + #define HAVE_BOOL + #elif defined(__VISUALC__) && (__VISUALC__ == 1020) + /* in VC++ 4.2 the bool keyword is reserved (hence can't be typedefed) */ + /* but not implemented, so we must #define it */ + #define bool unsigned int + #elif defined(__VISUALC__) && (__VISUALC__ == 1010) + /* For VisualC++ 4.1, we need to define */ + /* bool as something between 4.0 & 5.0... */ + typedef unsigned int wxbool; + #define bool wxbool + #define HAVE_BOOL + #elif defined(__VISUALC__) && (__VISUALC__ > 1020) + /* VC++ supports bool since 4.2 */ + #define HAVE_BOOL + #elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x500) + /* Borland 5.0+ supports bool */ + #define HAVE_BOOL + #elif wxCHECK_WATCOM_VERSION(1,0) + /* Watcom 11+ supports bool */ + #define HAVE_BOOL + #elif defined(__DIGITALMARS__) + /* DigitalMars supports bool */ + #define HAVE_BOOL + #elif defined(__GNUWIN32__) || defined(__MINGW32__) || defined(__CYGWIN__) + /* Cygwin supports bool */ + #define HAVE_BOOL + #elif defined(__VISAGECPP__) + #if __IBMCPP__ < 400 + typedef unsigned long bool; + #define true ((bool)1) + #define false ((bool)0) + #endif + #define HAVE_BOOL + #endif /* compilers */ +#endif /* HAVE_BOOL */ + +#if !defined(__MWERKS__) || !defined(true) +#if !defined(HAVE_BOOL) && !defined(bool) && !defined(VMS) + /* NB: of course, this doesn't replace the standard type, because, for */ + /* example, overloading based on bool/int parameter doesn't work and */ + /* so should be avoided in portable programs */ + typedef unsigned int bool; +#endif /* bool */ + +/* deal with TRUE/true stuff: we assume that if the compiler supports bool, it */ +/* supports true/false as well and that, OTOH, if it does _not_ support bool, */ +/* it doesn't support these keywords (this is less sure, in particular VC++ */ +/* 4.x could be a problem here) */ +#ifndef HAVE_BOOL + #define true ((bool)1) + #define false ((bool)0) +#endif +#endif + /* for backwards compatibility, also define TRUE and FALSE */ /* */ /* note that these definitions should work both in C++ and C code, so don't */ @@ -239,6 +236,12 @@ typedef short int WXTYPE; +/* special care should be taken with this type under Windows where the real */ +/* window id is unsigned, so we must always do the cast before comparing them */ +/* (or else they would be always different!). Using wxGetWindowId() which does */ +/* the cast itself is recommended. Note that this type can't be unsigned */ +/* because wxID_ANY == -1 is a valid (and largely used) value for window id. */ +typedef int wxWindowID; /* ---------------------------------------------------------------------------- */ /* other feature tests */ @@ -264,9 +267,10 @@ typedef short int WXTYPE; #elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x0520) /* BC++ 4.52 doesn't support explicit, CBuilder 1 does */ #define HAVE_EXPLICIT - #elif defined(__DIGITALMARS__) + #elif defined(__MWERKS__) && (__MWERKS__ >= 0x2400) + /* Metrowerks CW6 or higher has explicit */ #define HAVE_EXPLICIT - #elif defined(__WATCOMC__) + #elif defined(__DIGITALMARS__) #define HAVE_EXPLICIT #endif #endif /* !HAVE_EXPLICIT */ @@ -277,10 +281,51 @@ typedef short int WXTYPE; #define wxEXPLICIT #endif /* HAVE_EXPLICIT/!HAVE_EXPLICIT */ -/* these macros are obsolete, use the standard C++ casts directly now */ -#define wx_static_cast(t, x) static_cast(x) -#define wx_const_cast(t, x) const_cast(x) -#define wx_reinterpret_cast(t, x) reinterpret_cast(x) +/* check for static/const_cast<>() (we don't use the other ones for now) */ +#ifndef HAVE_CXX_CASTS + #if defined(__VISUALC__) && (__VISUALC__ >= 1100) + /* VC++ 6.0 and 5.0 have C++ casts (what about earlier versions?) */ + #define HAVE_CXX_CASTS + #elif defined(__MINGW32__) || defined(__CYGWIN32__) + #if wxCHECK_GCC_VERSION(2, 95) + /* GCC 2.95 has C++ casts, what about earlier versions? */ + #define HAVE_CXX_CASTS + #endif + #endif +#endif /* !HAVE_CXX_CASTS */ + +#ifdef HAVE_CXX_CASTS + #ifndef HAVE_CONST_CAST + #define HAVE_CONST_CAST + #endif + #ifndef HAVE_REINTERPRET_CAST + #define HAVE_REINTERPRET_CAST + #endif + #ifndef HAVE_STATIC_CAST + #define HAVE_STATIC_CAST + #endif + #ifndef HAVE_DYNAMIC_CAST + #define HAVE_DYNAMIC_CAST + #endif +#endif /* HAVE_CXX_CASTS */ + +#ifdef HAVE_STATIC_CAST + #define wx_static_cast(t, x) static_cast(x) +#else + #define wx_static_cast(t, x) ((t)(x)) +#endif + +#ifdef HAVE_CONST_CAST + #define wx_const_cast(t, x) const_cast(x) +#else + #define wx_const_cast(t, x) ((t)(x)) +#endif + +#ifdef HAVE_REINTERPRET_CAST + #define wx_reinterpret_cast(t, x) reinterpret_cast(x) +#else + #define wx_reinterpret_cast(t, x) ((t)(x)) +#endif /* This one is a wx invention: like static cast but used when we intentionally @@ -296,8 +341,6 @@ typedef short int WXTYPE; #pragma warning(disable: 1682) /* conversion from "X" to "T" may lose significant bits */ #pragma warning(disable: 810) - /* non-pointer conversion from "foo" to "bar" may lose significant bits */ - #pragma warning(disable: 2259) return x; @@ -331,7 +374,8 @@ typedef short int WXTYPE; #if defined(__VISUALC__) && (__VISUALC__ >= 1100) /* VC++ 6.0 and 5.0 have std::wstring (what about earlier versions?) */ #define HAVE_STD_WSTRING - #elif defined(__MINGW32__) && wxCHECK_GCC_VERSION(3, 3) + #elif ( defined(__MINGW32__) || defined(__CYGWIN32__) ) \ + && wxCHECK_GCC_VERSION(3, 3) /* GCC 3.1 has std::wstring; 3.0 never was in MinGW, 2.95 hasn't it */ #define HAVE_STD_WSTRING #endif @@ -350,12 +394,6 @@ typedef short int WXTYPE; #endif #endif -#ifndef HAVE_TR1_TYPE_TRAITS - #if defined(__VISUALC__) && (_MSC_FULL_VER >= 150030729) - #define HAVE_TR1_TYPE_TRAITS - #endif -#endif - /* provide replacement for C99 va_copy() if the compiler doesn't have it */ /* could be already defined by configure or the user */ @@ -399,62 +437,6 @@ typedef short int WXTYPE; #endif /* va_copy/!va_copy */ #endif /* wxVaCopy */ -#ifndef HAVE_VARIADIC_MACROS - #if wxCHECK_WATCOM_VERSION(1,2) - #define HAVE_VARIADIC_MACROS - #endif - - #if wxCHECK_VISUALC_VERSION(9) - #define HAVE_VARIADIC_MACROS - #endif -#endif /* HAVE_VARIADIC_MACROS */ - - -#ifndef HAVE_WOSTREAM - /* - Mingw <= 3.4 and all versions of Cygwin don't have std::wostream - */ - #if (defined(__MINGW32__) && !wxCHECK_GCC_VERSION(4, 0)) || \ - defined(__CYGWIN__) - #define wxNO_WOSTREAM - #endif - - /* VC++ doesn't have it in the old iostream library */ - #if defined(__VISUALC__) && wxUSE_IOSTREAMH - #define wxNO_WOSTREAM - #endif - - #ifndef wxNO_WOSTREAM - #define HAVE_WOSTREAM - #endif - - #undef wxNO_WOSTREAM -#endif /* HAVE_WOSTREAM */ - -/* ---------------------------------------------------------------------------- */ -/* other C++ features */ -/* ---------------------------------------------------------------------------- */ - -#ifndef HAVE_PARTIAL_SPECIALIZATION - /* be optimistic by default */ - #define HAVE_PARTIAL_SPECIALIZATION -#endif - -#ifdef __VISUALC__ - #if __VISUALC__ < 1310 - #undef HAVE_PARTIAL_SPECIALIZATION - #endif -#endif /* __VISUALC__ */ - - -#ifndef HAVE_TEMPLATE_OVERLOAD_RESOLUTION - /* assume the compiler can use type or const expressions as template - arguments if it supports partial specialization -- except if it's a - Borland one which can't */ - #if defined(HAVE_PARTIAL_SPECIALIZATION) && !defined(__BORLANDC__) - #define HAVE_TEMPLATE_OVERLOAD_RESOLUTION - #endif /* (HAVE_PARTIAL_SPECIALIZATION) && !defined(__BORLANDC__) */ -#endif /* !defined(HAVE_TEMPLATE_OVERLOAD_RESOLUTION) */ /* ---------------------------------------------------------------------------- */ /* portable calling conventions macros */ @@ -512,135 +494,48 @@ typedef short int WXTYPE; /* ---------------------------------------------------------------------------- */ /* Printf-like attribute definitions to obtain warnings with GNU C/C++ */ -#ifndef WX_ATTRIBUTE_PRINTF +#ifndef ATTRIBUTE_PRINTF # if defined(__GNUC__) && !wxUSE_UNICODE -# define WX_ATTRIBUTE_PRINTF(m, n) __attribute__ ((__format__ (__printf__, m, n))) +# define ATTRIBUTE_PRINTF(m, n) __attribute__ ((__format__ (__printf__, m, n))) # else -# define WX_ATTRIBUTE_PRINTF(m, n) +# define ATTRIBUTE_PRINTF(m, n) # endif -# define WX_ATTRIBUTE_PRINTF_1 WX_ATTRIBUTE_PRINTF(1, 2) -# define WX_ATTRIBUTE_PRINTF_2 WX_ATTRIBUTE_PRINTF(2, 3) -# define WX_ATTRIBUTE_PRINTF_3 WX_ATTRIBUTE_PRINTF(3, 4) -# define WX_ATTRIBUTE_PRINTF_4 WX_ATTRIBUTE_PRINTF(4, 5) -# define WX_ATTRIBUTE_PRINTF_5 WX_ATTRIBUTE_PRINTF(5, 6) -#endif /* !defined(WX_ATTRIBUTE_PRINTF) */ - -#ifndef WX_ATTRIBUTE_NORETURN -# if WX_HAS_CLANG_FEATURE(attribute_analyzer_noreturn) -# define WX_ATTRIBUTE_NORETURN __attribute__((analyzer_noreturn)) -# elif defined( __GNUC__ ) -# define WX_ATTRIBUTE_NORETURN __attribute__ ((noreturn)) -# elif wxCHECK_VISUALC_VERSION(7) -# define WX_ATTRIBUTE_NORETURN __declspec(noreturn) -# else -# define WX_ATTRIBUTE_NORETURN -# endif -#endif +# define ATTRIBUTE_PRINTF_1 ATTRIBUTE_PRINTF(1, 2) +# define ATTRIBUTE_PRINTF_2 ATTRIBUTE_PRINTF(2, 3) +# define ATTRIBUTE_PRINTF_3 ATTRIBUTE_PRINTF(3, 4) +# define ATTRIBUTE_PRINTF_4 ATTRIBUTE_PRINTF(4, 5) +# define ATTRIBUTE_PRINTF_5 ATTRIBUTE_PRINTF(5, 6) +#endif /* !defined(ATTRIBUTE_PRINTF) */ /* Macro to issue warning when using deprecated functions with gcc3 or MSVC7: */ #if wxCHECK_GCC_VERSION(3, 1) - #define wxDEPRECATED(x) __attribute__((deprecated)) x + #define wxDEPRECATED(x) x __attribute__ ((deprecated)) #elif defined(__VISUALC__) && (__VISUALC__ >= 1300) #define wxDEPRECATED(x) __declspec(deprecated) x #else #define wxDEPRECATED(x) x #endif -#if defined(__GNUC__) && !wxCHECK_GCC_VERSION(3, 4) - /* - We need to add dummy "inline" to allow gcc < 3.4 to handle the - deprecation attribute on the constructors. - */ - #define wxDEPRECATED_CONSTRUCTOR(x) wxDEPRECATED( inline x) -#else - #define wxDEPRECATED_CONSTRUCTOR(x) wxDEPRECATED(x) -#endif - -/* - Macro which marks the function as being deprecated but also defines it - inline. - - Currently it's defined in the same trivial way in all cases but it could - need a special definition with some other compilers in the future which - explains why do we have it. - */ -#define wxDEPRECATED_INLINE(func, body) wxDEPRECATED(func) { body } - -/* - A macro to define a simple deprecated accessor. - */ -#define wxDEPRECATED_ACCESSOR(func, what) wxDEPRECATED_INLINE(func, return what;) - -/* - Special variant of the macro above which should be used for the functions - which are deprecated but called by wx itself: this often happens with - deprecated virtual functions which are called by the library. - */ -#ifdef WXBUILDING -# define wxDEPRECATED_BUT_USED_INTERNALLY(x) x -#else -# define wxDEPRECATED_BUT_USED_INTERNALLY(x) wxDEPRECATED(x) -#endif - -/* - Combination of the two variants above: should be used for deprecated - functions which are defined inline and are used by wxWidgets itself. - */ -#ifdef WXBUILDING -# define wxDEPRECATED_BUT_USED_INTERNALLY_INLINE(func, body) func { body } -#else -# define wxDEPRECATED_BUT_USED_INTERNALLY_INLINE(func, body) \ - wxDEPRECATED(func) { body } -#endif +/* everybody gets the assert and other debug macros */ +#include "wx/debug.h" /* NULL declaration: it must be defined as 0 for C++ programs (in particular, */ /* it must not be defined as "(void *)0" which is standard for C but completely */ /* breaks C++ code) */ -#if !defined(__HANDHELDPC__) +#ifndef __HANDHELDPC__ #include #endif -#ifdef __cplusplus +/* delete pointer if it is not NULL and NULL it afterwards */ +/* (checking that it's !NULL before passing it to delete is just a */ +/* a question of style, because delete will do it itself anyhow, but it might */ +/* be considered as an error by some overzealous debugging implementations of */ +/* the library, so we do it ourselves) */ +#define wxDELETE(p) if ( (p) != NULL ) { delete p; p = NULL; } -// everybody gets the assert and other debug macros -#include "wx/debug.h" - - // delete pointer if it is not NULL and NULL it afterwards - template - inline void wxDELETE(T*& ptr) - { - typedef char TypeIsCompleteCheck[sizeof(T)]; - - if ( ptr != NULL ) - { - delete ptr; - ptr = NULL; - } - } - - // delete an array and NULL it (see comments above) - template - inline void wxDELETEA(T*& ptr) - { - typedef char TypeIsCompleteCheck[sizeof(T)]; - - if ( ptr != NULL ) - { - delete [] ptr; - ptr = NULL; - } - } - - // trivial implementation of std::swap() for primitive types - template - inline void wxSwap(T& first, T& second) - { - T tmp(first); - first = second; - second = tmp; - } -#endif /*__cplusplus*/ +/* delete an array and NULL it (see comments above) */ +#define wxDELETEA(p) if ( (p) ) { delete [] (p); p = NULL; } /* size of statically declared array */ #define WXSIZEOF(array) (sizeof(array)/sizeof(array[0])) @@ -649,64 +544,6 @@ typedef short int WXTYPE; /* integer on success as failure indicator */ #define wxNOT_FOUND (-1) -/* the default value for some length parameters meaning that the string is */ -/* NUL-terminated */ -#define wxNO_LEN ((size_t)-1) - -/* ---------------------------------------------------------------------------- */ -/* macros dealing with comparison operators */ -/* ---------------------------------------------------------------------------- */ - -/* - Expands into m(op, args...) for each op in the set { ==, !=, <, <=, >, >= }. - */ -#define wxFOR_ALL_COMPARISONS(m) \ - m(==) m(!=) m(>=) m(<=) m(>) m(<) - -#define wxFOR_ALL_COMPARISONS_1(m, x) \ - m(==,x) m(!=,x) m(>=,x) m(<=,x) m(>,x) m(<,x) - -#define wxFOR_ALL_COMPARISONS_2(m, x, y) \ - m(==,x,y) m(!=,x,y) m(>=,x,y) m(<=,x,y) m(>,x,y) m(<,x,y) - -#define wxFOR_ALL_COMPARISONS_3(m, x, y, z) \ - m(==,x,y,z) m(!=,x,y,z) m(>=,x,y,z) m(<=,x,y,z) m(>,x,y,z) m(<,x,y,z) - -/* - This is only used with wxDEFINE_COMPARISON_REV: it passes both the normal - and the reversed comparison operators to the macro. - */ -#define wxFOR_ALL_COMPARISONS_3_REV(m, x, y, z) \ - m(==,x,y,z,==) m(!=,x,y,z,!=) m(>=,x,y,z,<=) \ - m(<=,x,y,z,>=) m(>,x,y,z,<) m(<,x,y,z,>) - - -#define wxDEFINE_COMPARISON(op, T1, T2, cmp) \ - inline bool operator op(T1 x, T2 y) { return cmp(x, y, op); } - -#define wxDEFINE_COMPARISON_REV(op, T1, T2, cmp, oprev) \ - inline bool operator op(T2 y, T1 x) { return cmp(x, y, oprev); } - -/* - Define all 6 comparison operators (==, !=, <, <=, >, >=) for the given - types in the specified order. The implementation is provided by the cmp - macro. Normally wxDEFINE_ALL_COMPARISONS should be used as comparison - operators are usually symmetric. - */ -#define wxDEFINE_COMPARISONS(T1, T2, cmp) \ - wxFOR_ALL_COMPARISONS_3(wxDEFINE_COMPARISON, T1, T2, cmp) - -/* - This macro allows to define all 12 comparison operators (6 operators for - both orders of arguments) for the given types using the provided "cmp" - macro to implement the actual comparison: the macro is called with the 2 - arguments names, the first of type T1 and the second of type T2, and the - comparison operator being implemented. - */ -#define wxDEFINE_ALL_COMPARISONS(T1, T2, cmp) \ - wxFOR_ALL_COMPARISONS_3(wxDEFINE_COMPARISON, T1, T2, cmp) \ - wxFOR_ALL_COMPARISONS_3_REV(wxDEFINE_COMPARISON_REV, T1, T2, cmp) - /* ---------------------------------------------------------------------------- */ /* macros to avoid compiler warnings */ /* ---------------------------------------------------------------------------- */ @@ -718,6 +555,13 @@ typedef short int WXTYPE; #define WXUNUSED(identifier) identifier #endif +/* some arguments are only used in debug mode, but unused in release one */ +#ifdef __WXDEBUG__ + #define WXUNUSED_UNLESS_DEBUG(param) param +#else + #define WXUNUSED_UNLESS_DEBUG(param) WXUNUSED(param) +#endif + /* some arguments are not used in unicode mode */ #if wxUSE_UNICODE #define WXUNUSED_IN_UNICODE(param) WXUNUSED(param) @@ -764,6 +608,25 @@ typedef short int WXTYPE; /* compiler specific settings */ /* ---------------------------------------------------------------------------- */ +/* to allow compiling with warning level 4 under Microsoft Visual C++ some */ +/* warnings just must be disabled */ +#ifdef __VISUALC__ + #pragma warning(disable: 4514) /* unreferenced inline func has been removed */ +/* + you might be tempted to disable this one also: triggered by CHECK and FAIL + macros in debug.h, but it's, overall, a rather useful one, so I leave it and + will try to find some way to disable this warning just for CHECK/FAIL. Anyone? +*/ + #pragma warning(disable: 4127) /* conditional expression is constant */ +#endif /* VC++ */ + +#if defined(__MWERKS__) + #undef try + #undef except + #undef finally + #define except(x) catch(...) +#endif /* Metrowerks */ + #if wxONLY_WATCOM_EARLIER_THAN(1,4) typedef short mode_t; #endif @@ -771,10 +634,13 @@ typedef short int WXTYPE; /* where should i put this? we need to make sure of this as it breaks */ /* the code. */ #if !wxUSE_IOSTREAMH && defined(__WXDEBUG__) +# ifndef __MWERKS__ +/* #undef __WXDEBUG__ */ # ifdef wxUSE_DEBUG_NEW_ALWAYS # undef wxUSE_DEBUG_NEW_ALWAYS # define wxUSE_DEBUG_NEW_ALWAYS 0 # endif +# endif #endif /* ---------------------------------------------------------------------------- */ @@ -790,7 +656,7 @@ enum { wxDefaultCoord = -1 }; /* define fixed length types */ /* ---------------------------------------------------------------------------- */ -#if defined(__MINGW32__) +#if defined(__WXPALMOS__) || defined(__MINGW32__) #include #endif @@ -798,6 +664,9 @@ enum { wxDefaultCoord = -1 }; /* practice) */ /* 8bit */ +#ifndef SIZEOF_CHAR + #define SIZEOF_CHAR 1 +#endif typedef signed char wxInt8; typedef unsigned char wxUint8; typedef wxUint8 wxByte; @@ -829,7 +698,7 @@ typedef wxUint16 wxWord; |short | 16 16 16 16 16 | |int | 32 64 32 32 16 | |long | 64 64 32 32 32 | - |long long | 64 64 64 -- -- | + |long long | 64 | |void * | 64 64 64 32 32 | +-----------+----------------------------+ @@ -840,31 +709,32 @@ typedef wxUint16 wxWord; */ /* 32bit */ -#if defined(__WINDOWS__) +#ifdef __PALMOS__ + typedef int wxInt32; + typedef unsigned int wxUint32; + #define SIZEOF_INT 4 + #define SIZEOF_LONG 4 + #define SIZEOF_WCHAR_T 2 + #define SIZEOF_SIZE_T 4 + #define wxSIZE_T_IS_UINT + #define SIZEOF_VOID_P 4 + #define SIZEOF_SIZE_T 4 +#elif defined(__WINDOWS__) + /* Win64 uses LLP64 model and so ints and longs have the same size as in */ + /* Win32 */ #if defined(__WIN32__) typedef int wxInt32; typedef unsigned int wxUint32; - /* - Win64 uses LLP64 model and so ints and longs have the same size as - in Win32. - */ + /* Assume that if SIZEOF_INT is defined that all the other ones except + SIZEOF_SIZE_T, are too. See next #if below. */ #ifndef SIZEOF_INT #define SIZEOF_INT 4 - #endif - - #ifndef SIZEOF_LONG #define SIZEOF_LONG 4 - #endif - - #ifndef SIZEOF_WCHAR_T - /* Windows uses UTF-16 */ #define SIZEOF_WCHAR_T 2 - #endif - #ifndef SIZEOF_SIZE_T /* - Under Win64 sizeof(size_t) == 8 and so it is neither unsigned + under Win64 sizeof(size_t) == 8 and so it is neither unsigned int nor unsigned long! */ #ifdef __WIN64__ @@ -877,14 +747,25 @@ typedef wxUint16 wxWord; #define wxSIZE_T_IS_UINT #endif #undef wxSIZE_T_IS_ULONG - #endif - #ifndef SIZEOF_VOID_P #ifdef __WIN64__ #define SIZEOF_VOID_P 8 #else /* Win32 */ #define SIZEOF_VOID_P 4 #endif /* Win64/32 */ + #endif /* !defined(SIZEOF_INT) */ + + /* + If Python.h was included first, it defines all of the SIZEOF's above + except for SIZEOF_SIZE_T, so we need to do it here to avoid + triggering the #error in the ssize_t typedefs below... + */ + #ifndef SIZEOF_SIZE_T + #ifdef __WIN64__ + #define SIZEOF_SIZE_T 8 + #else /* Win32 */ + #define SIZEOF_SIZE_T 4 + #endif #endif #else #error "Unsupported Windows version" @@ -927,7 +808,7 @@ typedef wxUint16 wxWord; #if defined(__MACH__) && !defined(SIZEOF_WCHAR_T) #define SIZEOF_WCHAR_T 4 #endif - #if !defined(SIZEOF_WCHAR_T) + #if wxUSE_WCHAR_T && !defined(SIZEOF_WCHAR_T) /* also assume that sizeof(wchar_t) == 2 (under Unix the most */ /* common case is 4 but there configure would have defined */ /* SIZEOF_WCHAR_T for us) */ @@ -936,213 +817,23 @@ typedef wxUint16 wxWord; Wchar_tMustBeExactly2Bytes); #define SIZEOF_WCHAR_T 2 - #endif /* !defined(SIZEOF_WCHAR_T) */ + #endif /* wxUSE_WCHAR_T */ #endif #endif /* Win/!Win */ -#ifndef SIZEOF_WCHAR_T - #error "SIZEOF_WCHAR_T must be defined, but isn't" -#endif - -/* also define C99-like sized MIN/MAX constants */ -#define wxINT8_MIN CHAR_MIN -#define wxINT8_MAX CHAR_MAX -#define wxUINT8_MAX UCHAR_MAX - -#define wxINT16_MIN SHRT_MIN -#define wxINT16_MAX SHRT_MAX -#define wxUINT16_MAX USHRT_MAX - -#if SIZEOF_INT == 4 - #define wxINT32_MIN INT_MIN - #define wxINT32_MAX INT_MAX - #define wxUINT32_MAX UINT_MAX -#elif SIZEOF_LONG == 4 - #define wxINT32_MIN LONG_MIN - #define wxINT32_MAX LONG_MAX - #define wxUINT32_MAX ULONG_MAX -#else - #error "Unknown 32 bit type" -#endif - typedef wxUint32 wxDword; -#ifdef LLONG_MAX - #define wxINT64_MIN LLONG_MIN - #define wxINT64_MAX LLONG_MAX - #define wxUINT64_MAX ULLONG_MAX -#else - #define wxINT64_MIN (wxLL(-9223372036854775807)-1) - #define wxINT64_MAX wxLL(9223372036854775807) - #define wxUINT64_MAX wxULL(0xFFFFFFFFFFFFFFFF) -#endif - -/* 64 bit */ - -/* NB: we #define and not typedef wxLongLong_t because we use "#ifdef */ -/* wxLongLong_t" in wx/longlong.h */ - -/* wxULongLong_t is set later (usually to unsigned wxLongLong_t) */ - -/* to avoid compilation problems on 64bit machines with ambiguous method calls */ -/* we will need to define this */ -#undef wxLongLongIsLong - /* - First check for specific compilers which have known 64 bit integer types, - this avoids clashes with SIZEOF_LONG[_LONG] being defined incorrectly for - e.g. MSVC builds (Python.h defines it as 8 even for MSVC). - - Also notice that we check for "long long" before checking for 64 bit long as - we still want to use "long long" and not "long" for wxLongLong_t on 64 bit - architectures to be able to pass wxLongLong_t to the standard functions - prototyped as taking "long long" such as strtoll(). + Define an integral type big enough to contain all of long, size_t and void *. */ -#if (defined(__VISUALC__) && defined(__WIN32__)) - #define wxLongLong_t __int64 - #define wxLongLongSuffix i64 - #define wxLongLongFmtSpec "I64" -#elif defined(__BORLANDC__) && defined(__WIN32__) && (__BORLANDC__ >= 0x520) - #define wxLongLong_t __int64 - #define wxLongLongSuffix i64 - #define wxLongLongFmtSpec "L" -#elif (defined(__WATCOMC__) && (defined(__WIN32__) || defined(__DOS__) || defined(__OS2__))) - #define wxLongLong_t __int64 - #define wxLongLongSuffix i64 - #define wxLongLongFmtSpec "L" -#elif defined(__DIGITALMARS__) - #define wxLongLong_t __int64 - #define wxLongLongSuffix LL - #define wxLongLongFmtSpec "ll" -#elif defined(__MINGW32__) - #define wxLongLong_t long long - #define wxLongLongSuffix ll - #define wxLongLongFmtSpec "I64" -#elif defined(__VISAGECPP__) && __IBMCPP__ >= 400 - #define wxLongLong_t long long -#elif (defined(SIZEOF_LONG_LONG) && SIZEOF_LONG_LONG >= 8) || \ - defined(__GNUC__) || \ - defined(__CYGWIN__) || \ - defined(__WXMICROWIN__) || \ - (defined(__DJGPP__) && __DJGPP__ >= 2) - #define wxLongLong_t long long - #define wxLongLongSuffix ll - #define wxLongLongFmtSpec "ll" -#elif defined(SIZEOF_LONG) && (SIZEOF_LONG == 8) - #define wxLongLong_t long - #define wxLongLongSuffix l - #define wxLongLongFmtSpec "l" - #define wxLongLongIsLong -#endif - - -#ifdef wxLongLong_t - #define wxULongLong_t unsigned wxLongLong_t - - /* - wxLL() and wxULL() macros allow to define 64 bit constants in a - portable way. - */ - #ifndef wxCOMPILER_BROKEN_CONCAT_OPER - #define wxLL(x) wxCONCAT(x, wxLongLongSuffix) - #define wxULL(x) wxCONCAT(x, wxCONCAT(u, wxLongLongSuffix)) - #else - /* - Currently only Borland compiler has broken concatenation operator - and this compiler is known to use [u]i64 suffix. - */ - #define wxLL(x) wxAPPEND_i64(x) - #define wxULL(x) wxAPPEND_ui64(x) - #endif - - typedef wxLongLong_t wxInt64; - typedef wxULongLong_t wxUint64; - - #define wxHAS_INT64 1 - - #ifndef wxLongLongIsLong - #define wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG - #endif -#elif wxUSE_LONGLONG - /* these macros allow to define 64 bit constants in a portable way */ - #define wxLL(x) wxLongLong(x) - #define wxULL(x) wxULongLong(x) - - #define wxInt64 wxLongLong - #define wxUint64 wxULongLong - - #define wxHAS_INT64 1 - -#else /* !wxUSE_LONGLONG */ - - #define wxHAS_INT64 0 - -#endif - - -/* Make sure ssize_t is defined (a signed type the same size as size_t). */ -/* (HAVE_SSIZE_T is not already defined by configure) */ -#ifndef HAVE_SSIZE_T -#ifdef __MINGW32__ - #if defined(_SSIZE_T_) || defined(_SSIZE_T_DEFINED) - #define HAVE_SSIZE_T - #endif -#elif wxCHECK_WATCOM_VERSION(1,4) - #define HAVE_SSIZE_T -#endif -#endif /* !HAVE_SSIZE_T */ - -/* If we really don't have ssize_t, provide our own version. */ -#ifdef HAVE_SSIZE_T - #ifdef __UNIX__ - #include - #endif -#else /* !HAVE_SSIZE_T */ - #if SIZEOF_SIZE_T == 4 - typedef wxInt32 ssize_t; - #elif SIZEOF_SIZE_T == 8 - typedef wxInt64 ssize_t; - #else - #error "error defining ssize_t, size_t is not 4 or 8 bytes" - #endif - - /* prevent ssize_t redefinitions in other libraries */ - #define HAVE_SSIZE_T -#endif - -/* - We can't rely on Windows _W64 being defined as windows.h may not be - included so define our own equivalent: this should be used with types - like WXLPARAM or WXWPARAM which are 64 bit under Win64 to avoid warnings - each time we cast it to a pointer or a handle (which results in hundreds - of warnings as Win32 API often passes pointers in them) - */ -#if wxCHECK_VISUALC_VERSION(7) - #define wxW64 __w64 -#else - #define wxW64 -#endif - -/* - Define signed and unsigned integral types big enough to contain all of long, - size_t and void *. - */ -#if SIZEOF_LONG >= SIZEOF_VOID_P - /* - Normal case when long is the largest integral type. - */ - typedef long wxIntPtr; +#if SIZEOF_LONG >= SIZEOF_VOID_P && SIZEOF_LONG >= SIZEOF_SIZE_T + /* normal case */ typedef unsigned long wxUIntPtr; + typedef long wxIntPtr; #elif SIZEOF_SIZE_T >= SIZEOF_VOID_P - /* - Win64 case: size_t is the only integral type big enough for "void *". - - Notice that we must use __w64 to avoid warnings about casting pointers - to wxIntPtr (which we do often as this is what it is defined for) in 32 - bit build with MSVC. - */ - typedef wxW64 ssize_t wxIntPtr; + /* Win64 case */ typedef size_t wxUIntPtr; + #define wxIntPtr ssize_t #else /* This should never happen for the current architectures but if you're @@ -1202,16 +893,152 @@ inline void *wxUIntToPtr(wxUIntPtr p) #endif /*__cplusplus*/ +/* 64 bit */ + +/* NB: we #define and not typedef wxLongLong_t because we use "#ifdef */ +/* wxLongLong_t" in wx/longlong.h */ + +/* wxULongLong_t is set later (usually to unsigned wxLongLong_t) */ + +/* to avoid compilation problems on 64bit machines with ambiguous method calls */ +/* we will need to define this */ +#undef wxLongLongIsLong + +/* + First check for specific compilers which have known 64 bit integer types, + this avoids clashes with SIZEOF_LONG[_LONG] being defined incorrectly for + e.g. MSVC builds (Python.h defines it as 8 even for MSVC). + + Also notice that we check for "long long" before checking for 64 bit long as + we still want to use "long long" and not "long" for wxLongLong_t on 64 bit + architectures to be able to pass wxLongLong_t to the standard functions + prototyped as taking "long long" such as strtoll(). + */ +#if (defined(__VISUALC__) && defined(__WIN32__)) + #define wxLongLong_t __int64 + #define wxLongLongSuffix i64 + #define wxLongLongFmtSpec wxT("I64") +#elif defined(__BORLANDC__) && defined(__WIN32__) && (__BORLANDC__ >= 0x520) + #define wxLongLong_t __int64 + #define wxLongLongSuffix i64 + #define wxLongLongFmtSpec wxT("L") +#elif (defined(__WATCOMC__) && (defined(__WIN32__) || defined(__DOS__) || defined(__OS2__))) + #define wxLongLong_t __int64 + #define wxLongLongSuffix i64 + #define wxLongLongFmtSpec wxT("L") +#elif defined(__DIGITALMARS__) + #define wxLongLong_t __int64 + #define wxLongLongSuffix LL + #define wxLongLongFmtSpec wxT("ll") +#elif defined(__MINGW32__) + #define wxLongLong_t long long + #define wxLongLongSuffix ll + #define wxLongLongFmtSpec wxT("I64") +#elif defined(__MWERKS__) + #if __option(longlong) + #define wxLongLong_t long long + #define wxLongLongSuffix ll + #define wxLongLongFmtSpec wxT("ll") + #else + #error "The 64 bit integer support in CodeWarrior has been disabled." + #error "See the documentation on the 'longlong' pragma." + #endif +#elif defined(__WXPALMOS__) + #define wxLongLong_t int64_t + #define wxLongLongSuffix ll + #define wxLongLongFmtSpec wxT("ll") +#elif defined(__VISAGECPP__) && __IBMCPP__ >= 400 + #define wxLongLong_t long long +#elif (defined(SIZEOF_LONG_LONG) && SIZEOF_LONG_LONG >= 8) || \ + defined(__GNUC__) || \ + defined(__CYGWIN__) || \ + defined(__WXMICROWIN__) || \ + (defined(__DJGPP__) && __DJGPP__ >= 2) + #define wxLongLong_t long long + #define wxLongLongSuffix ll + #define wxLongLongFmtSpec wxT("ll") +#elif defined(SIZEOF_LONG) && (SIZEOF_LONG == 8) + #define wxLongLong_t long + #define wxLongLongSuffix l + #define wxLongLongFmtSpec wxT("l") + #define wxLongLongIsLong +#endif + + +#ifdef wxLongLong_t + + #ifdef __WXPALMOS__ + #define wxULongLong_t uint64_t + #else + #define wxULongLong_t unsigned wxLongLong_t + #endif + + /* these macros allow to define 64 bit constants in a portable way */ + #define wxLL(x) wxCONCAT(x, wxLongLongSuffix) + #define wxULL(x) wxCONCAT(x, wxCONCAT(u, wxLongLongSuffix)) + + typedef wxLongLong_t wxInt64; + typedef wxULongLong_t wxUint64; + + #define wxHAS_INT64 1 + +#elif wxUSE_LONGLONG + /* these macros allow to define 64 bit constants in a portable way */ + #define wxLL(x) wxLongLong(x) + #define wxULL(x) wxULongLong(x) + + #define wxInt64 wxLongLong + #define wxUint64 wxULongLong + + #define wxHAS_INT64 1 + +#else /* !wxUSE_LONGLONG */ + + #define wxHAS_INT64 0 + +#endif + + +/* Make sure ssize_t is defined (a signed type the same size as size_t) */ +/* HAVE_SSIZE_T should be defined for compiliers that already have it */ +#ifdef __MINGW32__ + #if defined(_SSIZE_T_) && !defined(HAVE_SSIZE_T) + #define HAVE_SSIZE_T + #endif +#endif +#if defined(__PALMOS__) && !defined(HAVE_SSIZE_T) + #define HAVE_SSIZE_T +#endif +#if wxCHECK_WATCOM_VERSION(1,4) + #define HAVE_SSIZE_T +#endif +#ifndef HAVE_SSIZE_T + #if SIZEOF_SIZE_T == 4 + typedef wxInt32 ssize_t; + #elif SIZEOF_SIZE_T == 8 + typedef wxInt64 ssize_t; + #else + #error "error defining ssize_t, size_t is not 4 or 8 bytes" + #endif + + /* prevent ssize_t redefinitions in other libraries */ + #define HAVE_SSIZE_T +#endif + /* base floating point types */ -/* wxFloat32: 32 bit IEEE float ( 1 sign, 8 exponent bits, 23 fraction bits ) */ -/* wxFloat64: 64 bit IEEE float ( 1 sign, 11 exponent bits, 52 fraction bits ) */ +/* wxFloat32: 32 bit IEEE float ( 1 sign, 8 exponent bits, 23 fraction bits */ +/* wxFloat64: 64 bit IEEE float ( 1 sign, 11 exponent bits, 52 fraction bits */ /* wxDouble: native fastest representation that has at least wxFloat64 */ /* precision, so use the IEEE types for storage, and this for */ /* calculations */ typedef float wxFloat32; -typedef double wxFloat64; +#if (defined( __WXMAC__ ) || defined(__WXCOCOA__)) && defined (__MWERKS__) + typedef short double wxFloat64; +#else + typedef double wxFloat64; +#endif typedef double wxDouble; @@ -1220,56 +1047,18 @@ typedef double wxDouble; of treating it as a real fundamental type, set wxWCHAR_T_IS_REAL_TYPE to 0 for them and to 1 for all the others. */ -#ifndef wxWCHAR_T_IS_REAL_TYPE +#if wxUSE_WCHAR_T /* - VC++ typedefs wchar_t as unsigned short by default until VC8, that is - unless /Za or /Zc:wchar_t option is used in which case _WCHAR_T_DEFINED - is defined. + VC++ typedefs wchar_t as unsigned short by default, that is unless + /Za or /Zc:wchar_t option is used in which case _WCHAR_T_DEFINED is + defined. */ # if defined(__VISUALC__) && !defined(_NATIVE_WCHAR_T_DEFINED) # define wxWCHAR_T_IS_REAL_TYPE 0 # else /* compiler having standard-conforming wchar_t */ # define wxWCHAR_T_IS_REAL_TYPE 1 # endif -#endif /* !defined(wxWCHAR_T_IS_REAL_TYPE) */ - -/* Helper macro for doing something dependent on whether wchar_t is or isn't a - typedef inside another macro. */ -#if wxWCHAR_T_IS_REAL_TYPE - #define wxIF_WCHAR_T_TYPE(x) x -#else /* !wxWCHAR_T_IS_REAL_TYPE */ - #define wxIF_WCHAR_T_TYPE(x) -#endif /* wxWCHAR_T_IS_REAL_TYPE/!wxWCHAR_T_IS_REAL_TYPE */ - -/* - This constant should be used instead of NULL in vararg functions taking - wxChar* arguments: passing NULL (which is the same as 0, unless the compiler - defines it specially, e.g. like gcc does with its __null built-in) doesn't - work in this case as va_arg() wouldn't interpret the integer 0 correctly - when trying to convert it to a pointer on architectures where sizeof(int) is - strictly less than sizeof(void *). - - Examples of places where this must be used include wxFileTypeInfo ctor. - */ -#define wxNullPtr ((void *)NULL) - - -/* Define wxChar16 and wxChar32 */ - -#if SIZEOF_WCHAR_T == 2 - #define wxWCHAR_T_IS_WXCHAR16 - typedef wchar_t wxChar16; -#else - typedef wxUint16 wxChar16; -#endif - -#if SIZEOF_WCHAR_T == 4 - #define wxWCHAR_T_IS_WXCHAR32 - typedef wchar_t wxChar32; -#else - typedef wxUint32 wxChar32; -#endif - +#endif /* wxUSE_WCHAR_T */ /* ---------------------------------------------------------------------------- */ /* byte ordering related definition and macros */ @@ -1289,6 +1078,36 @@ typedef double wxDouble; /* byte swapping */ +#if defined (__MWERKS__) && ( (__MWERKS__ < 0x0900) || macintosh ) +/* assembler versions for these */ +#ifdef __POWERPC__ + inline wxUint16 wxUINT16_SWAP_ALWAYS( wxUint16 i ) + {return (__lhbrx( &i , 0 ) );} + inline wxInt16 wxINT16_SWAP_ALWAYS( wxInt16 i ) + {return (__lhbrx( &i , 0 ) );} + inline wxUint32 wxUINT32_SWAP_ALWAYS( wxUint32 i ) + {return (__lwbrx( &i , 0 ) );} + inline wxInt32 wxINT32_SWAP_ALWAYS( wxInt32 i ) + {return (__lwbrx( &i , 0 ) );} +#else + #pragma parameter __D0 wxUINT16_SWAP_ALWAYS(__D0) + pascal wxUint16 wxUINT16_SWAP_ALWAYS(wxUint16 value) + = { 0xE158 }; + + #pragma parameter __D0 wxINT16_SWAP_ALWAYS(__D0) + pascal wxInt16 wxINT16_SWAP_ALWAYS(wxInt16 value) + = { 0xE158 }; + + #pragma parameter __D0 wxUINT32_SWAP_ALWAYS (__D0) + pascal wxUint32 wxUINT32_SWAP_ALWAYS(wxUint32 value) + = { 0xE158, 0x4840, 0xE158 }; + + #pragma parameter __D0 wxINT32_SWAP_ALWAYS (__D0) + pascal wxInt32 wxINT32_SWAP_ALWAYS(wxInt32 value) + = { 0xE158, 0x4840, 0xE158 }; + +#endif +#else /* !MWERKS */ #define wxUINT16_SWAP_ALWAYS(val) \ ((wxUint16) ( \ (((wxUint16) (val) & (wxUint16) 0x00ffU) << 8) | \ @@ -1312,6 +1131,7 @@ typedef double wxDouble; (((wxUint32) (val) & (wxUint32) 0x0000ff00U) << 8) | \ (((wxUint32) (val) & (wxUint32) 0x00ff0000U) >> 8) | \ (((wxUint32) (val) & (wxUint32) 0xff000000U) >> 24))) +#endif /* machine specific byte swapping */ #ifdef wxLongLong_t @@ -1372,8 +1192,6 @@ typedef double wxDouble; #if wxHAS_INT64 #define wxUINT64_SWAP_ON_BE(val) wxUINT64_SWAP_ALWAYS(val) #define wxUINT64_SWAP_ON_LE(val) (val) - #define wxINT64_SWAP_ON_BE(val) wxINT64_SWAP_ALWAYS(val) - #define wxINT64_SWAP_ON_LE(val) (val) #endif #else #define wxUINT16_SWAP_ON_LE(val) wxUINT16_SWAP_ALWAYS(val) @@ -1387,50 +1205,9 @@ typedef double wxDouble; #if wxHAS_INT64 #define wxUINT64_SWAP_ON_LE(val) wxUINT64_SWAP_ALWAYS(val) #define wxUINT64_SWAP_ON_BE(val) (val) - #define wxINT64_SWAP_ON_LE(val) wxINT64_SWAP_ALWAYS(val) - #define wxINT64_SWAP_ON_BE(val) (val) #endif #endif -/* ---------------------------------------------------------------------------- */ -/* template workarounds for buggy compilers */ -/* ---------------------------------------------------------------------------- */ - -#if defined(__GNUC__) && !wxCHECK_GCC_VERSION( 3, 4 ) - /* GCC <= 3.4 has buggy template support */ -# define wxUSE_MEMBER_TEMPLATES 0 -#endif - -#if defined(_MSC_VER) && _MSC_VER <= 1200 - /* MSVC <= 6.0 has buggy template support */ -# define wxUSE_MEMBER_TEMPLATES 0 -# define wxUSE_FUNC_TEMPLATE_POINTER 0 -#endif - -#ifndef wxUSE_MEMBER_TEMPLATES -# define wxUSE_MEMBER_TEMPLATES 1 -#endif - -#ifndef wxUSE_FUNC_TEMPLATE_POINTER -# define wxUSE_FUNC_TEMPLATE_POINTER 1 -#endif - -#if wxUSE_MEMBER_TEMPLATES -# define wxTEMPLATED_MEMBER_CALL( method, type ) method() -# define wxTEMPLATED_MEMBER_FIX( type ) -#else -# define wxTEMPLATED_MEMBER_CALL( method, type ) method((type*)NULL) -# define wxTEMPLATED_MEMBER_FIX( type ) type* =NULL -#endif - -#if defined(_MSC_VER) && _MSC_VER <= 1200 -# define wxTEMPLATED_FUNCTION_FIX( type ), wxTEMPLATED_MEMBER_FIX(type) -# define wxINFUNC_CLASS_TYPE_FIX( type ) typedef type type; -#else -# define wxTEMPLATED_FUNCTION_FIX( type ) -# define wxINFUNC_CLASS_TYPE_FIX( type ) -#endif - /* ---------------------------------------------------------------------------- */ /* Geometric flags */ /* ---------------------------------------------------------------------------- */ @@ -1453,10 +1230,7 @@ enum wxOrientation wxHORIZONTAL = 0x0004, wxVERTICAL = 0x0008, - wxBOTH = wxVERTICAL | wxHORIZONTAL, - - /* a mask to extract orientation from the combination of flags */ - wxORIENTATION_MASK = wxBOTH + wxBOTH = wxVERTICAL | wxHORIZONTAL }; enum wxDirection @@ -1474,21 +1248,11 @@ enum wxDirection wxWEST = wxLEFT, wxEAST = wxRIGHT, - wxALL = (wxUP | wxDOWN | wxRIGHT | wxLEFT), - - /* a mask to extract direction from the combination of flags */ - wxDIRECTION_MASK = wxALL + wxALL = (wxUP | wxDOWN | wxRIGHT | wxLEFT) }; enum wxAlignment { - /* - 0 is a valid wxAlignment value (both wxALIGN_LEFT and wxALIGN_TOP - use it) so define a symbolic name for an invalid alignment value - which can be assumed to be different from anything else - */ - wxALIGN_INVALID = -1, - wxALIGN_NOT = 0x0000, wxALIGN_CENTER_HORIZONTAL = 0x0100, wxALIGN_CENTRE_HORIZONTAL = wxALIGN_CENTER_HORIZONTAL, @@ -1506,25 +1270,6 @@ enum wxAlignment wxALIGN_MASK = 0x0f00 }; -/* misc. flags for wxSizer items */ -enum wxSizerFlagBits -{ - /* - wxADJUST_MINSIZE doesn't do anything any more but we still define - it for compatibility. Notice that it may be also predefined (as 0, - hopefully) in the user code in order to use it even in - !WXWIN_COMPATIBILITY_2_8 builds so don't redefine it in such case. - */ -#if WXWIN_COMPATIBILITY_2_8 && !defined(wxADJUST_MINSIZE) - wxADJUST_MINSIZE = 0, -#endif - wxFIXED_MINSIZE = 0x8000, - wxRESERVE_SPACE_EVEN_IF_HIDDEN = 0x0002, - - /* a mask to extract wxSizerFlagBits from combination of flags */ - wxSIZER_FLAG_BITS_MASK = 0x8002 -}; - enum wxStretch { wxSTRETCH_NOT = 0x0000, @@ -1532,10 +1277,18 @@ enum wxStretch wxGROW = 0x2000, wxEXPAND = wxGROW, wxSHAPED = 0x4000, - wxTILE = wxSHAPED | wxFIXED_MINSIZE, + wxFIXED_MINSIZE = 0x8000, +#if wxABI_VERSION >= 20808 + wxRESERVE_SPACE_EVEN_IF_HIDDEN = 0x0002, +#endif + wxTILE = 0xc000, - /* a mask to extract stretch from the combination of flags */ - wxSTRETCH_MASK = 0x7000 /* sans wxTILE */ + /* for compatibility only, default now, don't use explicitly any more */ +#if WXWIN_COMPATIBILITY_2_4 + wxADJUST_MINSIZE = 0x00100000 +#else + wxADJUST_MINSIZE = 0 +#endif }; /* border flags: the values are chosen for backwards compatibility */ @@ -1551,7 +1304,7 @@ enum wxBorder wxBORDER_RAISED = 0x04000000, wxBORDER_SUNKEN = 0x08000000, wxBORDER_DOUBLE = 0x10000000, /* deprecated */ - wxBORDER_THEME = wxBORDER_DOUBLE, + wxBORDER_THEME = 0x10000000, /* a mask to extract border style from the combination of flags */ wxBORDER_MASK = 0x1f200000 @@ -1573,40 +1326,12 @@ enum wxBorder * Some styles are used across more than one group, * so the values mustn't clash with others in the group. * Otherwise, numbers can be reused across groups. - */ - -/* - Summary of the bits used by various styles. - - High word, containing styles which can be used with many windows: - - +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ - |31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16| - +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ - | | | | | | | | | | | | | | | | - | | | | | | | | | | | | | | | \_ wxFULL_REPAINT_ON_RESIZE - | | | | | | | | | | | | | | \____ wxPOPUP_WINDOW - | | | | | | | | | | | | | \_______ wxWANTS_CHARS - | | | | | | | | | | | | \__________ wxTAB_TRAVERSAL - | | | | | | | | | | | \_____________ wxTRANSPARENT_WINDOW - | | | | | | | | | | \________________ wxBORDER_NONE - | | | | | | | | | \___________________ wxCLIP_CHILDREN - | | | | | | | | \______________________ wxALWAYS_SHOW_SB - | | | | | | | \_________________________ wxBORDER_STATIC - | | | | | | \____________________________ wxBORDER_SIMPLE - | | | | | \_______________________________ wxBORDER_RAISED - | | | | \__________________________________ wxBORDER_SUNKEN - | | | \_____________________________________ wxBORDER_{DOUBLE,THEME} - | | \________________________________________ wxCAPTION/wxCLIP_SIBLINGS - | \___________________________________________ wxHSCROLL - \______________________________________________ wxVSCROLL - - - Low word style bits is class-specific meaning that the same bit can have - different meanings for different controls (e.g. 0x10 is wxCB_READONLY - meaning that the control can't be modified for wxComboBox but wxLB_SORT - meaning that the control should be kept sorted for wxListBox, while - wxLB_SORT has a different value -- and this is just fine). + * + * From version 1.66: + * Window (cross-group) styles now take up the first half + * of the flag, and control-specific styles the + * second half. + * */ /* @@ -1765,10 +1490,9 @@ enum wxBorder #define wxLB_MULTIPLE 0x0040 #define wxLB_EXTENDED 0x0080 /* wxLB_OWNERDRAW is Windows-only */ -#define wxLB_NEEDED_SB 0x0000 #define wxLB_OWNERDRAW 0x0100 -#define wxLB_ALWAYS_SB 0x0200 -#define wxLB_NO_SB 0x0400 +#define wxLB_NEEDED_SB 0x0200 +#define wxLB_ALWAYS_SB 0x0400 #define wxLB_HSCROLL wxHSCROLL /* always show an entire number of rows */ #define wxLB_INT_HEIGHT 0x0800 @@ -1802,12 +1526,14 @@ enum wxBorder /* Old names for compatibility */ #define wxRA_HORIZONTAL wxHORIZONTAL #define wxRA_VERTICAL wxVERTICAL +#define wxRA_USE_CHECKBOX 0x0010 /* alternative native subcontrols (wxPalmOS) */ /* * wxRadioButton style flag */ #define wxRB_GROUP 0x0004 #define wxRB_SINGLE 0x0008 +#define wxRB_USE_CHECKBOX 0x0010 /* alternative native control (wxPalmOS) */ /* * wxScrollBar flags @@ -1817,15 +1543,14 @@ enum wxBorder /* * wxSpinButton flags. - * Note that a wxSpinCtrl is sometimes defined as a wxTextCtrl, and so the - * flags shouldn't overlap with wxTextCtrl flags that can be used for a single - * line controls (currently we reuse wxTE_CHARWRAP and wxTE_RICH2 neither of - * which makes sense for them). + * Note that a wxSpinCtrl is sometimes defined as + * a wxTextCtrl, and so the flags must be different + * from wxTextCtrl's. */ #define wxSP_HORIZONTAL wxHORIZONTAL /* 4 */ #define wxSP_VERTICAL wxVERTICAL /* 8 */ -#define wxSP_ARROW_KEYS 0x4000 -#define wxSP_WRAP 0x8000 +#define wxSP_ARROW_KEYS 0x1000 +#define wxSP_WRAP 0x2000 /* * wxTabCtrl flags @@ -1839,6 +1564,18 @@ enum wxBorder #define wxTC_MULTILINE 0x0200 /* == wxNB_MULTILINE */ #define wxTC_OWNERDRAW 0x0400 +/* + * wxStatusBar95 flags + */ +#define wxST_SIZEGRIP 0x0010 + +/* + * wxStaticText flags + */ +#define wxST_NO_AUTORESIZE 0x0001 +#define wxST_DOTS_MIDDLE 0x0002 +#define wxST_DOTS_END 0x0004 + /* * wxStaticBitmap flags */ @@ -1864,13 +1601,9 @@ enum wxBorder #define wxNO 0x00000008 #define wxYES_NO (wxYES | wxNO) #define wxCANCEL 0x00000010 -#define wxAPPLY 0x00000020 -#define wxCLOSE 0x00000040 -#define wxOK_DEFAULT 0x00000000 /* has no effect (default) */ -#define wxYES_DEFAULT 0x00000000 /* has no effect (default) */ -#define wxNO_DEFAULT 0x00000080 /* only valid with wxYES_NO */ -#define wxCANCEL_DEFAULT 0x80000000 /* only valid with wxCANCEL */ +#define wxYES_DEFAULT 0x00000000 /* has no effect (default) */ +#define wxNO_DEFAULT 0x00000080 #define wxICON_EXCLAMATION 0x00000100 #define wxICON_HAND 0x00000200 @@ -1880,65 +1613,24 @@ enum wxBorder #define wxICON_INFORMATION 0x00000800 #define wxICON_STOP wxICON_HAND #define wxICON_ASTERISK wxICON_INFORMATION +#define wxICON_MASK (0x00000100|0x00000200|0x00000400|0x00000800) -#define wxHELP 0x00001000 -#define wxFORWARD 0x00002000 -#define wxBACKWARD 0x00004000 -#define wxRESET 0x00008000 -#define wxMORE 0x00010000 -#define wxSETUP 0x00020000 -#define wxICON_NONE 0x00040000 - -#define wxICON_MASK \ - (wxICON_EXCLAMATION|wxICON_HAND|wxICON_QUESTION|wxICON_INFORMATION|wxICON_NONE) +#define wxFORWARD 0x00001000 +#define wxBACKWARD 0x00002000 +#define wxRESET 0x00004000 +#define wxHELP 0x00008000 +#define wxMORE 0x00010000 +#define wxSETUP 0x00020000 /* * Background styles. See wxWindow::SetBackgroundStyle */ + enum wxBackgroundStyle { - /* - background is erased in the EVT_ERASE_BACKGROUND handler or using - the system default background if no such handler is defined (this - is the default style) - */ - wxBG_STYLE_ERASE, - - /* - background is erased by the system, no EVT_ERASE_BACKGROUND event - is generated at all - */ - wxBG_STYLE_SYSTEM, - - /* - background is erased in EVT_PAINT handler and not erased at all - before it, this should be used if the paint handler paints over - the entire window to avoid flicker - */ - wxBG_STYLE_PAINT, - - - /* this is a Mac-only style, don't use in portable code */ - wxBG_STYLE_TRANSPARENT, - - /* this style is deprecated and doesn't do anything, don't use */ - wxBG_STYLE_COLOUR, - - /* - this style is deprecated and is synonymous with - wxBG_STYLE_PAINT, use the new name - */ - wxBG_STYLE_CUSTOM = wxBG_STYLE_PAINT -}; - -/* - * Key types used by (old style) lists and hashes. - */ -enum wxKeyType -{ - wxKEY_NONE, - wxKEY_INTEGER, - wxKEY_STRING + wxBG_STYLE_SYSTEM, + wxBG_STYLE_COLOUR, + wxBG_STYLE_CUSTOM }; /* ---------------------------------------------------------------------------- */ @@ -1946,26 +1638,8 @@ enum wxKeyType /* ---------------------------------------------------------------------------- */ /* Standard menu IDs */ -enum wxStandardID +enum { - /* - These ids delimit the range used by automatically-generated ids - (i.e. those used when wxID_ANY is specified during construction). - */ -#if defined(__WXMSW__) || wxUSE_AUTOID_MANAGEMENT - /* - On MSW the range is always restricted no matter if id management - is used or not because the native window ids are limited to short - range. On other platforms the range is only restricted if id - management is used so the reference count buffer won't be so big. - */ - wxID_AUTO_LOWEST = -32000, - wxID_AUTO_HIGHEST = -2000, -#else - wxID_AUTO_LOWEST = -1000000, - wxID_AUTO_HIGHEST = -2000, -#endif - /* no id matches this one when compared to it */ wxID_NONE = -3, @@ -2081,24 +1755,6 @@ enum wxStandardID wxID_ZOOM_OUT, wxID_UNDELETE, wxID_REVERT_TO_SAVED, - wxID_CDROM, - wxID_CONVERT, - wxID_EXECUTE, - wxID_FLOPPY, - wxID_HARDDISK, - wxID_BOTTOM, - wxID_FIRST, - wxID_LAST, - wxID_TOP, - wxID_INFO, - wxID_JUMP_TO, - wxID_NETWORK, - wxID_SELECT_COLOR, - wxID_SELECT_FONT, - wxID_SORT_ASCENDING, - wxID_SORT_DESCENDING, - wxID_SPELL_CHECK, - wxID_STRIKETHROUGH, /* System menu IDs (used by wxUniv): */ wxID_SYSTEM_MENU = 5200, @@ -2109,45 +1765,12 @@ enum wxStandardID wxID_ICONIZE_FRAME, wxID_RESTORE_FRAME, - /* MDI window menu ids */ - wxID_MDI_WINDOW_FIRST = 5230, - wxID_MDI_WINDOW_CASCADE = wxID_MDI_WINDOW_FIRST, - wxID_MDI_WINDOW_TILE_HORZ, - wxID_MDI_WINDOW_TILE_VERT, - wxID_MDI_WINDOW_ARRANGE_ICONS, - wxID_MDI_WINDOW_PREV, - wxID_MDI_WINDOW_NEXT, - wxID_MDI_WINDOW_LAST = wxID_MDI_WINDOW_NEXT, - - /* OS X system menu ids */ - wxID_OSX_MENU_FIRST = 5250, - wxID_OSX_HIDE = wxID_OSX_MENU_FIRST, - wxID_OSX_HIDEOTHERS, - wxID_OSX_SHOWALL, - wxID_OSX_MENU_LAST = wxID_OSX_SHOWALL, - /* IDs used by generic file dialog (13 consecutive starting from this value) */ wxID_FILEDLGG = 5900, - /* IDs used by generic file ctrl (4 consecutive starting from this value) */ - wxID_FILECTRL = 5950, - wxID_HIGHEST = 5999 }; -/* ---------------------------------------------------------------------------- */ -/* wxWindowID type (after wxID_XYZ enum, platform detection, and dlimpexp.h) */ -/* ---------------------------------------------------------------------------- */ - -/* special care should be taken with this type under Windows where the real */ -/* window id is unsigned, so we must always do the cast before comparing them */ -/* (or else they would be always different!). Using wxGetWindowId() which does */ -/* the cast itself is recommended. Note that this type can't be unsigned */ -/* because wxID_ANY == -1 is a valid (and largely used) value for window id. */ -#if defined(__cplusplus) && wxUSE_GUI - #include "wx/windowid.h" -#endif - /* ---------------------------------------------------------------------------- */ /* other constants */ /* ---------------------------------------------------------------------------- */ @@ -2159,22 +1782,9 @@ enum wxItemKind wxITEM_NORMAL, wxITEM_CHECK, wxITEM_RADIO, - wxITEM_DROPDOWN, wxITEM_MAX }; -/* - * The possible states of a 3-state checkbox (Compatible - * with the 2-state checkbox). - */ -enum wxCheckBoxState -{ - wxCHK_UNCHECKED, - wxCHK_CHECKED, - wxCHK_UNDETERMINED /* 3-state checkbox only */ -}; - - /* hit test results */ enum wxHitTest { @@ -2220,45 +1830,12 @@ enum wxHitTest #define wxSIZE_NO_ADJUSTMENTS 0x0008 /* Change the window position even if it seems to be already correct */ #define wxSIZE_FORCE 0x0010 -/* Emit size event even if size didn't change */ -#define wxSIZE_FORCE_EVENT 0x0020 /* ---------------------------------------------------------------------------- */ /* GDI descriptions */ /* ---------------------------------------------------------------------------- */ -// Hatch styles used by both pen and brush styles. -// -// NB: Do not use these constants directly, they're for internal use only, use -// wxBRUSHSTYLE_XXX_HATCH and wxPENSTYLE_XXX_HATCH instead. -enum wxHatchStyle -{ - wxHATCHSTYLE_INVALID = -1, - - /* - The value of the first style is chosen to fit with - wxDeprecatedGUIConstants values below, don't change it. - */ - wxHATCHSTYLE_FIRST = 111, - wxHATCHSTYLE_BDIAGONAL = wxHATCHSTYLE_FIRST, - wxHATCHSTYLE_CROSSDIAG, - wxHATCHSTYLE_FDIAGONAL, - wxHATCHSTYLE_CROSS, - wxHATCHSTYLE_HORIZONTAL, - wxHATCHSTYLE_VERTICAL, - wxHATCHSTYLE_LAST = wxHATCHSTYLE_VERTICAL -}; - -/* - WARNING: the following styles are deprecated; use the - wxFontFamily, wxFontStyle, wxFontWeight, wxBrushStyle, - wxPenStyle, wxPenCap, wxPenJoin enum values instead! -*/ - -#if FUTURE_WXWIN_COMPATIBILITY_3_0 - -/* don't use any elements of this enum in the new code */ -enum wxDeprecatedGUIConstants +enum { /* Text font families */ wxDEFAULT = 70, @@ -2291,23 +1868,71 @@ enum wxDeprecatedGUIConstants wxTRANSPARENT, /* Brush & Pen Stippling. Note that a stippled pen cannot be dashed!! */ - /* Note also that stippling a Pen IS meaningful, because a Line is */ + /* Note also that stippling a Pen IS meaningfull, because a Line is */ wxSTIPPLE_MASK_OPAQUE, /* mask is used for blitting monochrome using text fore and back ground colors */ wxSTIPPLE_MASK, /* mask is used for masking areas in the stipple bitmap (TO DO) */ /* drawn with a Pen, and without any Brush -- and it can be stippled. */ wxSTIPPLE = 110, - wxBDIAGONAL_HATCH = wxHATCHSTYLE_BDIAGONAL, - wxCROSSDIAG_HATCH = wxHATCHSTYLE_CROSSDIAG, - wxFDIAGONAL_HATCH = wxHATCHSTYLE_FDIAGONAL, - wxCROSS_HATCH = wxHATCHSTYLE_CROSS, - wxHORIZONTAL_HATCH = wxHATCHSTYLE_HORIZONTAL, - wxVERTICAL_HATCH = wxHATCHSTYLE_VERTICAL, - wxFIRST_HATCH = wxHATCHSTYLE_FIRST, - wxLAST_HATCH = wxHATCHSTYLE_LAST + wxBDIAGONAL_HATCH, /* In wxWidgets < 2.6 use WX_HATCH macro */ + wxCROSSDIAG_HATCH, /* to verify these wx*_HATCH are in style */ + wxFDIAGONAL_HATCH, /* of wxBrush. In wxWidgets >= 2.6 use */ + wxCROSS_HATCH, /* wxBrush::IsHatch() instead. */ + wxHORIZONTAL_HATCH, + wxVERTICAL_HATCH, + wxFIRST_HATCH = wxBDIAGONAL_HATCH, + wxLAST_HATCH = wxVERTICAL_HATCH, + + wxJOIN_BEVEL = 120, + wxJOIN_MITER, + wxJOIN_ROUND, + + wxCAP_ROUND = 130, + wxCAP_PROJECTING, + wxCAP_BUTT }; + +#if WXWIN_COMPATIBILITY_2_4 + #define IS_HATCH(s) ((s)>=wxFIRST_HATCH && (s)<=wxLAST_HATCH) +#else + /* use wxBrush::IsHatch() instead thought wxMotif still uses it in src/motif/dcclient.cpp */ #endif +/* Logical ops */ +typedef enum +{ + wxCLEAR, wxROP_BLACK = wxCLEAR, wxBLIT_BLACKNESS = wxCLEAR, /* 0 */ + wxXOR, wxROP_XORPEN = wxXOR, wxBLIT_SRCINVERT = wxXOR, /* src XOR dst */ + wxINVERT, wxROP_NOT = wxINVERT, wxBLIT_DSTINVERT = wxINVERT, /* NOT dst */ + wxOR_REVERSE, wxROP_MERGEPENNOT = wxOR_REVERSE, wxBLIT_00DD0228 = wxOR_REVERSE, /* src OR (NOT dst) */ + wxAND_REVERSE, wxROP_MASKPENNOT = wxAND_REVERSE, wxBLIT_SRCERASE = wxAND_REVERSE, /* src AND (NOT dst) */ + wxCOPY, wxROP_COPYPEN = wxCOPY, wxBLIT_SRCCOPY = wxCOPY, /* src */ + wxAND, wxROP_MASKPEN = wxAND, wxBLIT_SRCAND = wxAND, /* src AND dst */ + wxAND_INVERT, wxROP_MASKNOTPEN = wxAND_INVERT, wxBLIT_00220326 = wxAND_INVERT, /* (NOT src) AND dst */ + wxNO_OP, wxROP_NOP = wxNO_OP, wxBLIT_00AA0029 = wxNO_OP, /* dst */ + wxNOR, wxROP_NOTMERGEPEN = wxNOR, wxBLIT_NOTSRCERASE = wxNOR, /* (NOT src) AND (NOT dst) */ + wxEQUIV, wxROP_NOTXORPEN = wxEQUIV, wxBLIT_00990066 = wxEQUIV, /* (NOT src) XOR dst */ + wxSRC_INVERT, wxROP_NOTCOPYPEN = wxSRC_INVERT, wxBLIT_NOTSCRCOPY = wxSRC_INVERT, /* (NOT src) */ + wxOR_INVERT, wxROP_MERGENOTPEN = wxOR_INVERT, wxBLIT_MERGEPAINT = wxOR_INVERT, /* (NOT src) OR dst */ + wxNAND, wxROP_NOTMASKPEN = wxNAND, wxBLIT_007700E6 = wxNAND, /* (NOT src) OR (NOT dst) */ + wxOR, wxROP_MERGEPEN = wxOR, wxBLIT_SRCPAINT = wxOR, /* src OR dst */ + wxSET, wxROP_WHITE = wxSET, wxBLIT_WHITENESS = wxSET /* 1 */ +} form_ops_t; + +/* Flood styles */ +enum +{ + wxFLOOD_SURFACE = 1, + wxFLOOD_BORDER +}; + +/* Polygon filling mode */ +enum +{ + wxODDEVEN_RULE = 1, + wxWINDING_RULE +}; + /* ToolPanel in wxFrame (VZ: unused?) */ enum { @@ -2343,55 +1968,19 @@ enum wxDataFormatId wxDF_MAX }; -/* Key codes */ +/* Virtual keycodes */ enum wxKeyCode { - WXK_NONE = 0, - - WXK_CONTROL_A = 1, - WXK_CONTROL_B, - WXK_CONTROL_C, - WXK_CONTROL_D, - WXK_CONTROL_E, - WXK_CONTROL_F, - WXK_CONTROL_G, - WXK_CONTROL_H, - WXK_CONTROL_I, - WXK_CONTROL_J, - WXK_CONTROL_K, - WXK_CONTROL_L, - WXK_CONTROL_M, - WXK_CONTROL_N, - WXK_CONTROL_O, - WXK_CONTROL_P, - WXK_CONTROL_Q, - WXK_CONTROL_R, - WXK_CONTROL_S, - WXK_CONTROL_T, - WXK_CONTROL_U, - WXK_CONTROL_V, - WXK_CONTROL_W, - WXK_CONTROL_X, - WXK_CONTROL_Y, - WXK_CONTROL_Z, - - WXK_BACK = 8, /* backspace */ + WXK_BACK = 8, WXK_TAB = 9, WXK_RETURN = 13, WXK_ESCAPE = 27, - - /* values from 33 to 126 are reserved for the standard ASCII characters */ - WXK_SPACE = 32, WXK_DELETE = 127, - /* values from 128 to 255 are reserved for ASCII extended characters - (note that there isn't a single fixed standard for the meaning - of these values; avoid them in portable apps!) */ - - /* These are not compatible with unicode characters. + /* These are, by design, not compatible with unicode characters. If you want to get a unicode character from a key event, use - wxKeyEvent::GetUnicodeKey */ + wxKeyEvent::GetUnicodeKey instead. */ WXK_START = 300, WXK_LBUTTON, WXK_RBUTTON, @@ -2498,12 +2087,7 @@ enum wxKeyCode WXK_WINDOWS_LEFT, WXK_WINDOWS_RIGHT, WXK_WINDOWS_MENU , -#ifdef __WXOSX__ - WXK_RAW_CONTROL, -#else - WXK_RAW_CONTROL = WXK_CONTROL, -#endif - WXK_COMMAND = WXK_CONTROL, + WXK_COMMAND, /* Hardware-specific buttons */ WXK_SPECIAL1 = 193, @@ -2539,14 +2123,28 @@ enum wxKeyModifier wxMOD_META = 0x0008, wxMOD_WIN = wxMOD_META, #if defined(__WXMAC__) || defined(__WXCOCOA__) - wxMOD_RAW_CONTROL = 0x0010, + wxMOD_CMD = wxMOD_META, #else - wxMOD_RAW_CONTROL = wxMOD_CONTROL, -#endif wxMOD_CMD = wxMOD_CONTROL, +#endif wxMOD_ALL = 0xffff }; +/* Mapping modes (same values as used by Windows, don't change) */ +enum +{ + wxMM_TEXT = 1, + wxMM_LOMETRIC, + wxMM_HIMETRIC, + wxMM_LOENGLISH, + wxMM_HIENGLISH, + wxMM_TWIPS, + wxMM_ISOTROPIC, + wxMM_ANISOTROPIC, + wxMM_POINTS, + wxMM_METRIC +}; + /* Shortcut for easier dialog-unit-to-pixel conversion */ #define wxDLG_UNIT(parent, pt) parent->ConvertDialogToPixels(pt) @@ -2671,17 +2269,14 @@ typedef enum wxPAPER_PENV_7_ROTATED, /* PRC Envelope #7 Rotated 230 x 160 mm */ wxPAPER_PENV_8_ROTATED, /* PRC Envelope #8 Rotated 309 x 120 mm */ wxPAPER_PENV_9_ROTATED, /* PRC Envelope #9 Rotated 324 x 229 mm */ - wxPAPER_PENV_10_ROTATED, /* PRC Envelope #10 Rotated 458 x 324 m */ - wxPAPER_A0, /* A0 Sheet 841 x 1189 mm */ - wxPAPER_A1 /* A1 Sheet 594 x 841 mm */ + wxPAPER_PENV_10_ROTATED /* PRC Envelope #10 Rotated 458 x 324 m */ } wxPaperSize; /* Printing orientation */ -enum wxPrintOrientation -{ - wxPORTRAIT = 1, - wxLANDSCAPE -}; +#ifndef wxPORTRAIT +#define wxPORTRAIT 1 +#define wxLANDSCAPE 2 +#endif /* Duplex printing modes */ @@ -2726,20 +2321,16 @@ enum wxUpdateUI wxUPDATE_UI_FROMIDLE = 0x0002 /* Invoked from On(Internal)Idle */ }; +/* ---------------------------------------------------------------------------- */ +/* Notification Event flags - used for dock icon bouncing, etc. */ +/* ---------------------------------------------------------------------------- */ -/* ---------------------------------------------------------------------------- */ -/* wxList types */ -/* ---------------------------------------------------------------------------- */ - -/* type of compare function for list sort operation (as in 'qsort'): it should - return a negative value, 0 or positive value if the first element is less - than, equal or greater than the second */ - -typedef int (* LINKAGEMODE wxSortCompareFunction)(const void *elem1, const void *elem2); - -/* wxList iterator function */ -typedef int (* LINKAGEMODE wxListIterateFunction)(void *current); - +enum wxNotificationOptions +{ + wxNOTIFY_NONE = 0x0000, + wxNOTIFY_ONCE = 0x0001, + wxNOTIFY_REPEAT = 0x0002 +}; /* ---------------------------------------------------------------------------- */ /* miscellaneous */ @@ -2760,7 +2351,7 @@ typedef int (* LINKAGEMODE wxListIterateFunction)(void *current); #endif #if defined(__CYGWIN__) && defined(__WXMSW__) -# if wxUSE_STD_CONTAINERS || defined(wxUSE_STD_STRING) +# if wxUSE_STL || defined(wxUSE_STD_STRING) /* NASTY HACK because the gethostname in sys/unistd.h which the gnu stl includes and wx builds with by default clash with each other @@ -2783,8 +2374,11 @@ typedef int (* LINKAGEMODE wxListIterateFunction)(void *current); #define WX_OPAQUE_TYPE( name ) struct wxOpaque##name +typedef unsigned char WXCOLORREF[6]; +typedef void* WXCGIMAGEREF; typedef void* WXHBITMAP; typedef void* WXHCURSOR; +typedef void* WXHRGN; typedef void* WXRECTPTR; typedef void* WXPOINTPTR; typedef void* WXHWND; @@ -2792,72 +2386,54 @@ typedef void* WXEVENTREF; typedef void* WXEVENTHANDLERREF; typedef void* WXEVENTHANDLERCALLREF; typedef void* WXAPPLEEVENTREF; - +typedef void* WXHDC; +typedef void* WXHMENU; typedef unsigned int WXUINT; typedef unsigned long WXDWORD; typedef unsigned short WXWORD; +typedef WX_OPAQUE_TYPE(CIconHandle ) * WXHICON ; typedef WX_OPAQUE_TYPE(PicHandle ) * WXHMETAFILE ; -#if wxOSX_USE_CARBON -typedef struct OpaqueControlRef* WXWidget ; -typedef struct OpaqueWindowPtr* WXWindow ; -typedef struct __AGLPixelFormatRec *WXGLPixelFormat; -typedef struct __AGLContextRec *WXGLContext; -#endif + +/* typedef void* WXWidget; */ +/* typedef void* WXWindow; */ +typedef WX_OPAQUE_TYPE(ControlRef ) * WXWidget ; +typedef WX_OPAQUE_TYPE(WindowRef) * WXWindow ; typedef void* WXDisplay; -/* - * core frameworks - */ +/* typedef WindowPtr WXHWND; */ +/* typedef Handle WXHANDLE; */ +/* typedef CIconHandle WXHICON; */ +/* typedef unsigned long WXHFONT; */ +/* typedef MenuHandle WXHMENU; */ +/* typedef unsigned long WXHPEN; */ +/* typedef unsigned long WXHBRUSH; */ +/* typedef unsigned long WXHPALETTE; */ +/* typedef CursHandle WXHCURSOR; */ +/* typedef RgnHandle WXHRGN; */ +/* typedef unsigned long WXHACCEL; */ +/* typedef unsigned long WXHINSTANCE; */ +/* typedef unsigned long WXHIMAGELIST; */ +/* typedef unsigned long WXHGLOBAL; */ +/* typedef GrafPtr WXHDC; */ +/* typedef unsigned int WXWPARAM; */ +/* typedef long WXLPARAM; */ +/* typedef void * WXRGNDATA; */ +/* typedef void * WXMSG; */ +/* typedef unsigned long WXHCONV; */ +/* typedef unsigned long WXHKEY; */ +/* typedef void * WXDRAWITEMSTRUCT; */ +/* typedef void * WXMEASUREITEMSTRUCT; */ +/* typedef void * WXLPCREATESTRUCT; */ +/* typedef int (*WXFARPROC)(); */ -typedef const void * CFTypeRef; - -/* typedef const struct __CFString * CFStringRef; */ - -#define DECLARE_WXOSX_OPAQUE_CFREF( name ) typedef struct __##name* name##Ref; -#define DECLARE_WXOSX_OPAQUE_CONST_CFREF( name ) typedef const struct __##name* name##Ref; - -DECLARE_WXOSX_OPAQUE_CONST_CFREF( CFString ) -typedef struct __CFString * CFMutableStringRef; - -DECLARE_WXOSX_OPAQUE_CFREF( CFRunLoopSource ) -DECLARE_WXOSX_OPAQUE_CONST_CFREF( CTFont ) -DECLARE_WXOSX_OPAQUE_CONST_CFREF( CTFontDescriptor ) - -#define DECLARE_WXOSX_OPAQUE_CGREF( name ) typedef struct name* name##Ref; - -DECLARE_WXOSX_OPAQUE_CGREF( CGColor ) -DECLARE_WXOSX_OPAQUE_CGREF( CGImage ) -DECLARE_WXOSX_OPAQUE_CGREF( CGContext ) -DECLARE_WXOSX_OPAQUE_CGREF( CGFont ) - -typedef CGColorRef WXCOLORREF; -typedef CGImageRef WXCGIMAGEREF; -typedef CGContextRef WXHDC; - -/* - * carbon - */ - -typedef const struct __HIShape * HIShapeRef; -typedef struct __HIShape * HIMutableShapeRef; - -#define DECLARE_WXMAC_OPAQUE_REF( name ) typedef struct Opaque##name* name; - -DECLARE_WXMAC_OPAQUE_REF( PasteboardRef ) -DECLARE_WXMAC_OPAQUE_REF( IconRef ) -DECLARE_WXMAC_OPAQUE_REF( MenuRef ) - -typedef IconRef WXHICON ; -typedef HIShapeRef WXHRGN; -#if wxOSX_USE_CARBON -typedef MenuRef WXHMENU; -#endif +/* typedef WindowPtr WXWindow; */ +/* typedef ControlHandle WXWidget; */ #endif -#if defined( __WXCOCOA__ ) || defined(__WXMAC__) +#if defined( __WXCOCOA__ ) || ( defined(__WXMAC__) && defined(__DARWIN__) ) /* Definitions of 32-bit/64-bit types * These are typedef'd exactly the same way in newer OS X headers so @@ -2890,7 +2466,7 @@ typedef unsigned int NSUInteger; */ /* NOTE: This ought to work with other compilers too, but I'm being cautious */ -#if (defined(__GNUC__) && defined(__APPLE__)) +#if (defined(__GNUC__) && defined(__APPLE__)) || defined(__MWERKS__) /* It's desirable to have type safety for Objective-C(++) code as it does at least catch typos of method names among other things. However, it is not possible to declare an Objective-C class from plain old C or C++ @@ -2910,7 +2486,7 @@ typedef klass *WX_##klass typedef struct klass *WX_##klass #endif /* defined(__OBJC__) */ -#else /* not Apple's gcc */ +#else /* not Apple's GNU or CodeWarrior */ #warning "Objective-C types will not be checked by the compiler." /* NOTE: typedef struct objc_object *id; */ /* IOW, we're declaring these using the id type without using that name, */ @@ -2920,7 +2496,7 @@ typedef struct klass *WX_##klass #define DECLARE_WXCOCOA_OBJC_CLASS(klass) \ typedef struct objc_object *WX_##klass -#endif /* (defined(__GNUC__) && defined(__APPLE__)) */ +#endif /* (defined(__GNUC__) && defined(__APPLE__)) || defined(__MWERKS__) */ DECLARE_WXCOCOA_OBJC_CLASS(NSApplication); DECLARE_WXCOCOA_OBJC_CLASS(NSBitmapImageRep); @@ -2931,8 +2507,6 @@ DECLARE_WXCOCOA_OBJC_CLASS(NSColorPanel); DECLARE_WXCOCOA_OBJC_CLASS(NSControl); DECLARE_WXCOCOA_OBJC_CLASS(NSCursor); DECLARE_WXCOCOA_OBJC_CLASS(NSEvent); -DECLARE_WXCOCOA_OBJC_CLASS(NSFont); -DECLARE_WXCOCOA_OBJC_CLASS(NSFontDescriptor); DECLARE_WXCOCOA_OBJC_CLASS(NSFontPanel); DECLARE_WXCOCOA_OBJC_CLASS(NSImage); DECLARE_WXCOCOA_OBJC_CLASS(NSLayoutManager); @@ -2954,77 +2528,76 @@ DECLARE_WXCOCOA_OBJC_CLASS(NSTextStorage); DECLARE_WXCOCOA_OBJC_CLASS(NSThread); DECLARE_WXCOCOA_OBJC_CLASS(NSWindow); DECLARE_WXCOCOA_OBJC_CLASS(NSView); -DECLARE_WXCOCOA_OBJC_CLASS(NSOpenGLContext); -DECLARE_WXCOCOA_OBJC_CLASS(NSOpenGLPixelFormat); -DECLARE_WXCOCOA_OBJC_CLASS( NSPrintInfo ); -#ifndef __WXMAC__ +#ifdef __WXMAC__ +// things added for __WXMAC__ +DECLARE_WXCOCOA_OBJC_CLASS(NSString); +#else +// things only for __WXCOCOA__ typedef WX_NSView WXWidget; /* wxWidgets BASE definition */ #endif #endif /* __WXCOCOA__ || ( __WXMAC__ &__DARWIN__)*/ -#ifdef __WXMAC__ +#if defined(__WXPALMOS__) -DECLARE_WXCOCOA_OBJC_CLASS(NSString); +typedef void * WXHWND; +typedef void * WXHANDLE; +typedef void * WXHICON; +typedef void * WXHFONT; +typedef void * WXHMENU; +typedef void * WXHPEN; +typedef void * WXHBRUSH; +typedef void * WXHPALETTE; +typedef void * WXHCURSOR; +typedef void * WXHRGN; +typedef void * WXHACCEL; +typedef void * WXHINSTANCE; +typedef void * WXHBITMAP; +typedef void * WXHIMAGELIST; +typedef void * WXHGLOBAL; +typedef void * WXHDC; +typedef unsigned int WXUINT; +typedef unsigned long WXDWORD; +typedef unsigned short WXWORD; -#if wxOSX_USE_COCOA +typedef unsigned long WXCOLORREF; +typedef struct tagMSG WXMSG; -typedef WX_NSWindow WXWindow; -typedef WX_NSView WXWidget; -typedef WX_NSMenu WXHMENU; -typedef WX_NSOpenGLPixelFormat WXGLPixelFormat; -typedef WX_NSOpenGLContext WXGLContext; +typedef WXHWND WXWINHANDLE; /* WinHandle of PalmOS */ +typedef WXWINHANDLE WXWidget; -#elif wxOSX_USE_IPHONE +typedef void * WXFORMPTR; +typedef void * WXEVENTPTR; +typedef void * WXRECTANGLEPTR; -DECLARE_WXCOCOA_OBJC_CLASS(UIWindow); -DECLARE_WXCOCOA_OBJC_CLASS(UIView); -DECLARE_WXCOCOA_OBJC_CLASS(UIFont); -DECLARE_WXCOCOA_OBJC_CLASS(UIImage); -DECLARE_WXCOCOA_OBJC_CLASS(UIEvent); -DECLARE_WXCOCOA_OBJC_CLASS(NSSet); -DECLARE_WXCOCOA_OBJC_CLASS(EAGLContext); +#endif /* __WXPALMOS__ */ -typedef WX_UIWindow WXWindow; -typedef WX_UIView WXWidget; -typedef WX_EAGLContext WXGLContext; -typedef WX_NSString* WXGLPixelFormat; - -#endif - -#endif /* __WXMAC__ */ /* ABX: check __WIN32__ instead of __WXMSW__ for the same MSWBase in any Win32 port */ #if defined(__WIN32__) -/* Stand-ins for Windows types to avoid #including all of windows.h */ - -#ifndef NO_STRICT - #define WX_MSW_DECLARE_HANDLE(type) typedef struct type##__ * WX##type -#else - #define WX_MSW_DECLARE_HANDLE(type) typedef void * WX##type +/* the keywords needed for WinMain() declaration */ +#ifndef WXFAR +# define WXFAR #endif -typedef void* WXHANDLE; -WX_MSW_DECLARE_HANDLE(HWND); -WX_MSW_DECLARE_HANDLE(HICON); -WX_MSW_DECLARE_HANDLE(HFONT); -WX_MSW_DECLARE_HANDLE(HMENU); -WX_MSW_DECLARE_HANDLE(HPEN); -WX_MSW_DECLARE_HANDLE(HBRUSH); -WX_MSW_DECLARE_HANDLE(HPALETTE); -WX_MSW_DECLARE_HANDLE(HCURSOR); -WX_MSW_DECLARE_HANDLE(HRGN); -WX_MSW_DECLARE_HANDLE(RECTPTR); -WX_MSW_DECLARE_HANDLE(HACCEL); -WX_MSW_DECLARE_HANDLE(HINSTANCE); -WX_MSW_DECLARE_HANDLE(HBITMAP); -WX_MSW_DECLARE_HANDLE(HIMAGELIST); -WX_MSW_DECLARE_HANDLE(HGLOBAL); -WX_MSW_DECLARE_HANDLE(HDC); -typedef WXHINSTANCE WXHMODULE; - -#undef WX_MSW_DECLARE_HANDLE - +/* Stand-ins for Windows types to avoid #including all of windows.h */ +typedef void * WXHWND; +typedef void * WXHANDLE; +typedef void * WXHICON; +typedef void * WXHFONT; +typedef void * WXHMENU; +typedef void * WXHPEN; +typedef void * WXHBRUSH; +typedef void * WXHPALETTE; +typedef void * WXHCURSOR; +typedef void * WXHRGN; +typedef void * WXRECTPTR; +typedef void * WXHACCEL; +typedef void WXFAR * WXHINSTANCE; +typedef void * WXHBITMAP; +typedef void * WXHIMAGELIST; +typedef void * WXHGLOBAL; +typedef void * WXHDC; typedef unsigned int WXUINT; typedef unsigned long WXDWORD; typedef unsigned short WXWORD; @@ -3040,18 +2613,16 @@ typedef void * WXDRAWITEMSTRUCT; typedef void * WXMEASUREITEMSTRUCT; typedef void * WXLPCREATESTRUCT; -#ifdef __WXMSW__ typedef WXHWND WXWidget; -#endif #ifdef __WIN64__ -typedef unsigned __int64 WXWPARAM; +typedef unsigned __int64 WXWPARAM; typedef __int64 WXLPARAM; typedef __int64 WXLRESULT; #else -typedef wxW64 unsigned int WXWPARAM; -typedef wxW64 long WXLPARAM; -typedef wxW64 long WXLRESULT; +typedef unsigned int WXWPARAM; +typedef long WXLPARAM; +typedef long WXLRESULT; #endif #if defined(__GNUWIN32__) || defined(__WXMICROWIN__) @@ -3081,8 +2652,6 @@ typedef unsigned long WXHPALETTE; typedef unsigned long WXHCURSOR; typedef unsigned long WXHRGN; typedef unsigned long WXHACCEL; -typedef unsigned long WXHINSTANCE; -typedef unsigned long WXHMODULE; typedef unsigned long WXHBITMAP; typedef unsigned long WXHDC; typedef unsigned int WXUINT; @@ -3202,49 +2771,56 @@ typedef long WXPixel; /* safety catch in src/motif/colour.cpp */ #ifdef __WXGTK__ /* Stand-ins for GLIB types */ +typedef char gchar; +typedef signed char gint8; +typedef int gint; +typedef unsigned guint; +typedef unsigned long gulong; +typedef void* gpointer; typedef struct _GSList GSList; /* Stand-ins for GDK types */ typedef struct _GdkColor GdkColor; +typedef struct _GdkColormap GdkColormap; +typedef struct _GdkFont GdkFont; +typedef struct _GdkGC GdkGC; +typedef struct _GdkVisual GdkVisual; + +#ifdef __WXGTK20__ +typedef struct _GdkAtom *GdkAtom; +typedef struct _GdkDrawable GdkWindow; +typedef struct _GdkDrawable GdkBitmap; +typedef struct _GdkDrawable GdkPixmap; +#else /* GTK+ 1.2 */ +typedef gulong GdkAtom; +typedef struct _GdkWindow GdkWindow; +typedef struct _GdkWindow GdkBitmap; +typedef struct _GdkWindow GdkPixmap; +#endif /* GTK+ 1.2/2.0 */ + typedef struct _GdkCursor GdkCursor; +typedef struct _GdkRegion GdkRegion; typedef struct _GdkDragContext GdkDragContext; -#if defined(__WXGTK20__) - typedef struct _GdkAtom* GdkAtom; -#else - typedef unsigned long GdkAtom; -#endif - -#if !defined(__WXGTK3__) - typedef struct _GdkColormap GdkColormap; - typedef struct _GdkFont GdkFont; - typedef struct _GdkGC GdkGC; - typedef struct _GdkRegion GdkRegion; -#endif - -#if defined(__WXGTK3__) - typedef struct _GdkWindow GdkWindow; -#elif defined(__WXGTK20__) - typedef struct _GdkDrawable GdkWindow; - typedef struct _GdkDrawable GdkPixmap; -#else - typedef struct _GdkWindow GdkWindow; - typedef struct _GdkWindow GdkBitmap; - typedef struct _GdkWindow GdkPixmap; +#ifdef HAVE_XIM +typedef struct _GdkIC GdkIC; +typedef struct _GdkICAttr GdkICAttr; #endif /* Stand-ins for GTK types */ typedef struct _GtkWidget GtkWidget; typedef struct _GtkRcStyle GtkRcStyle; typedef struct _GtkAdjustment GtkAdjustment; +typedef struct _GtkList GtkList; typedef struct _GtkToolbar GtkToolbar; +typedef struct _GtkTooltips GtkTooltips; typedef struct _GtkNotebook GtkNotebook; typedef struct _GtkNotebookPage GtkNotebookPage; typedef struct _GtkAccelGroup GtkAccelGroup; +typedef struct _GtkItemFactory GtkItemFactory; typedef struct _GtkSelectionData GtkSelectionData; typedef struct _GtkTextBuffer GtkTextBuffer; typedef struct _GtkRange GtkRange; -typedef struct _GtkCellRenderer GtkCellRenderer; typedef GtkWidget *WXWidget; @@ -3268,6 +2844,10 @@ typedef struct _PangoLayout PangoLayout; typedef struct _PangoFontDescription PangoFontDescription; #endif +#ifdef __WXMGL__ +typedef struct window_t *WXWidget; +#endif /* MGL */ + #ifdef __WXDFB__ /* DirectFB doesn't have the concept of non-TLW window, so use something arbitrary */ @@ -3278,45 +2858,23 @@ typedef const void* WXWidget; /* included before or after wxWidgets classes, and therefore must be */ /* disabled here before any significant wxWidgets headers are included. */ #ifdef __cplusplus -#ifdef __WINDOWS__ +#ifdef __WXMSW__ #include "wx/msw/winundef.h" -#endif /* __WINDOWS__ */ +#endif /* __WXMSW__ */ #endif /* __cplusplus */ - -/* include the feature test macros */ -#include "wx/features.h" - /* --------------------------------------------------------------------------- */ -/* macros to define a class without copy ctor nor assignment operator */ +/* macro to define a class without copy ctor nor assignment operator */ /* --------------------------------------------------------------------------- */ -#define wxDECLARE_NO_COPY_CLASS(classname) \ +#define DECLARE_NO_COPY_CLASS(classname) \ private: \ classname(const classname&); \ - classname& operator=(const classname&) + classname& operator=(const classname&); -#define wxDECLARE_NO_COPY_TEMPLATE_CLASS(classname, arg) \ - private: \ - classname(const classname&); \ - classname& operator=(const classname&) - -#define wxDECLARE_NO_COPY_TEMPLATE_CLASS_2(classname, arg1, arg2) \ - private: \ - classname(const classname&); \ - classname& operator=(const classname&) - -#define wxDECLARE_NO_ASSIGN_CLASS(classname) \ +#define DECLARE_NO_ASSIGN_CLASS(classname) \ private: \ - classname& operator=(const classname&) - -/* deprecated variants _not_ requiring a semicolon after them */ -#define DECLARE_NO_COPY_CLASS(classname) \ - wxDECLARE_NO_COPY_CLASS(classname); -#define DECLARE_NO_COPY_TEMPLATE_CLASS(classname, arg) \ - wxDECLARE_NO_COPY_TEMPLATE_CLASS(classname, arg); -#define DECLARE_NO_ASSIGN_CLASS(classname) \ - wxDECLARE_NO_ASSIGN_CLASS(classname); + classname& operator=(const classname&); /* --------------------------------------------------------------------------- */ /* If a manifest is being automatically generated, add common controls 6 to it */ @@ -3329,7 +2887,7 @@ typedef const void* WXWidget; "/manifestdependency:\"type='win32' \ name='Microsoft.Windows.Common-Controls' \ version='6.0.0.0' \ - processorArchitecture='" cpu "' \ + processorArchitecture='"cpu"' \ publicKeyToken='6595b64144ccf1df' \ language='*'\"" diff --git a/Source/3rd Party/wx/include/wx/dialog.h b/Source/3rd Party/wx/include/wx/dialog.h index 63fb51994..cf9dbf6c9 100644 --- a/Source/3rd Party/wx/include/wx/dialog.h +++ b/Source/3rd Party/wx/include/wx/dialog.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 29.06.99 -// RCS-ID: $Id$ +// RCS-ID: $Id: dialog.h 49804 2007-11-10 01:09:42Z VZ $ // Copyright: (c) Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -13,20 +13,13 @@ #define _WX_DIALOG_H_BASE_ #include "wx/defs.h" +#include "wx/containr.h" #include "wx/toplevel.h" class WXDLLIMPEXP_FWD_CORE wxSizer; class WXDLLIMPEXP_FWD_CORE wxStdDialogButtonSizer; -class WXDLLIMPEXP_FWD_CORE wxBoxSizer; -class WXDLLIMPEXP_FWD_CORE wxDialogLayoutAdapter; -class WXDLLIMPEXP_FWD_CORE wxDialog; -class WXDLLIMPEXP_FWD_CORE wxButton; -class WXDLLIMPEXP_FWD_CORE wxScrolledWindow; -class wxTextSizerWrapper; -// Also see the bit summary table in wx/toplevel.h. - -#define wxDIALOG_NO_PARENT 0x00000020 // Don't make owned by apps top window +#define wxDIALOG_NO_PARENT 0x0001 // Don't make owned by apps top window #ifdef __WXWINCE__ #define wxDEFAULT_DIALOG_STYLE (wxCAPTION | wxMAXIMIZE | wxCLOSE_BOX | wxNO_BORDER) @@ -34,40 +27,17 @@ class wxTextSizerWrapper; #define wxDEFAULT_DIALOG_STYLE (wxCAPTION | wxSYSTEM_MENU | wxCLOSE_BOX) #endif -// Layout adaptation levels, for SetLayoutAdaptationLevel +extern WXDLLEXPORT_DATA(const wxChar) wxDialogNameStr[]; -// Don't do any layout adaptation -#define wxDIALOG_ADAPTATION_NONE 0 - -// Only look for wxStdDialogButtonSizer for non-scrolling part -#define wxDIALOG_ADAPTATION_STANDARD_SIZER 1 - -// Also look for any suitable sizer for non-scrolling part -#define wxDIALOG_ADAPTATION_ANY_SIZER 2 - -// Also look for 'loose' standard buttons for non-scrolling part -#define wxDIALOG_ADAPTATION_LOOSE_BUTTONS 3 - -// Layout adaptation mode, for SetLayoutAdaptationMode -enum wxDialogLayoutAdaptationMode -{ - wxDIALOG_ADAPTATION_MODE_DEFAULT = 0, // use global adaptation enabled status - wxDIALOG_ADAPTATION_MODE_ENABLED = 1, // enable this dialog overriding global status - wxDIALOG_ADAPTATION_MODE_DISABLED = 2 // disable this dialog overriding global status -}; - -enum wxDialogModality -{ - wxDIALOG_MODALITY_NONE = 0, - wxDIALOG_MODALITY_WINDOW_MODAL = 1, - wxDIALOG_MODALITY_APP_MODAL = 2 -}; - -extern WXDLLIMPEXP_DATA_CORE(const char) wxDialogNameStr[]; - -class WXDLLIMPEXP_CORE wxDialogBase : public wxTopLevelWindow +class WXDLLEXPORT wxDialogBase : public wxTopLevelWindow { public: + enum + { + // all flags allowed in wxDialogBase::CreateButtonSizer() + ButtonSizerFlags = wxOK|wxCANCEL|wxYES|wxNO|wxHELP|wxNO_DEFAULT + }; + wxDialogBase() { Init(); } virtual ~wxDialogBase() { } @@ -75,10 +45,7 @@ public: virtual int ShowModal() = 0; virtual void EndModal(int retCode) = 0; virtual bool IsModal() const = 0; - // show the dialog frame-modally (needs a parent), using app-modal - // dialogs on platforms that don't support it - virtual void ShowWindowModal () ; - virtual void SendWindowModalDialogEvent ( wxEventType type ); + // Modal dialogs have a return code - usually the id of the last // pressed button @@ -97,33 +64,10 @@ public: void SetEscapeId(int escapeId); int GetEscapeId() const { return m_escapeId; } - // Find the parent to use for modal dialog: try to use the specified parent - // but fall back to the current active window or main application window as - // last resort if it is unsuitable. - // - // As this function is often called from the ctor, the window style may be - // not set yet and hence must be passed explicitly to it so that we could - // check whether it contains wxDIALOG_NO_PARENT bit. - // - // This function always returns a valid top level window or NULL. - wxWindow *GetParentForModalDialog(wxWindow *parent, long style) const; - - // This overload can only be used for already initialized windows, i.e. not - // from the ctor. It uses the current window parent and style. - wxWindow *GetParentForModalDialog() const - { - return GetParentForModalDialog(GetParent(), GetWindowStyle()); - } - #if wxUSE_STATTEXT // && wxUSE_TEXTCTRL - // splits text up at newlines and places the lines into a vertical - // wxBoxSizer - wxSizer *CreateTextSizer( const wxString& message ); - - // same as above but uses a customized wxTextSizerWrapper to create - // non-standard controls for the lines - wxSizer *CreateTextSizer( const wxString& message, - wxTextSizerWrapper& wrapper ); + // splits text up at newlines and places the + // lines into a vertical wxBoxSizer + wxSizer *CreateTextSizer( const wxString &message ); #endif // wxUSE_STATTEXT // && wxUSE_TEXTCTRL // returns a horizontal wxBoxSizer containing the given buttons @@ -133,64 +77,15 @@ public: // platforms which have hardware buttons replacing OK/Cancel and such) wxSizer *CreateButtonSizer(long flags); - // returns a sizer containing the given one and a static line separating it - // from the preceding elements if it's appropriate for the current platform - wxSizer *CreateSeparatedSizer(wxSizer *sizer); - // returns the sizer containing CreateButtonSizer() below a separating // static line for the platforms which use static lines for items // separation (i.e. not Mac) - // - // this is just a combination of CreateButtonSizer() and - // CreateSeparatedSizer() wxSizer *CreateSeparatedButtonSizer(long flags); #if wxUSE_BUTTON wxStdDialogButtonSizer *CreateStdDialogButtonSizer( long flags ); #endif // wxUSE_BUTTON - // Do layout adaptation - virtual bool DoLayoutAdaptation(); - - // Can we do layout adaptation? - virtual bool CanDoLayoutAdaptation(); - - // Returns a content window if there is one. This can be used by the layout adapter, for - // example to make the pages of a book control into scrolling windows - virtual wxWindow* GetContentWindow() const { return NULL; } - - // Add an id to the list of main button identifiers that should be in the button sizer - void AddMainButtonId(wxWindowID id) { m_mainButtonIds.Add((int) id); } - wxArrayInt& GetMainButtonIds() { return m_mainButtonIds; } - - // Is this id in the main button id array? - bool IsMainButtonId(wxWindowID id) const { return (m_mainButtonIds.Index((int) id) != wxNOT_FOUND); } - - // Level of adaptation, from none (Level 0) to full (Level 3). To disable adaptation, - // set level 0, for example in your dialog constructor. You might - // do this if you know that you are displaying on a large screen and you don't want the - // dialog changed. - void SetLayoutAdaptationLevel(int level) { m_layoutAdaptationLevel = level; } - int GetLayoutAdaptationLevel() const { return m_layoutAdaptationLevel; } - - /// Override global adaptation enabled/disabled status - void SetLayoutAdaptationMode(wxDialogLayoutAdaptationMode mode) { m_layoutAdaptationMode = mode; } - wxDialogLayoutAdaptationMode GetLayoutAdaptationMode() const { return m_layoutAdaptationMode; } - - // Returns true if the adaptation has been done - void SetLayoutAdaptationDone(bool adaptationDone) { m_layoutAdaptationDone = adaptationDone; } - bool GetLayoutAdaptationDone() const { return m_layoutAdaptationDone; } - - // Set layout adapter class, returning old adapter - static wxDialogLayoutAdapter* SetLayoutAdapter(wxDialogLayoutAdapter* adapter); - static wxDialogLayoutAdapter* GetLayoutAdapter() { return sm_layoutAdapter; } - - // Global switch for layout adaptation - static bool IsLayoutAdaptationEnabled() { return sm_layoutAdaptation; } - static void EnableLayoutAdaptation(bool enable) { sm_layoutAdaptation = enable; } - - // modality kind - virtual wxDialogModality GetModality() const; protected: // emulate click of a button with the given id if it's present in the dialog // @@ -213,6 +108,7 @@ protected: // wxID_OK return code void AcceptAndClose(); + // The return code from modal dialog int m_returnCode; @@ -222,40 +118,10 @@ protected: // The identifier for cancel button (usually wxID_CANCEL) int m_escapeId; - // Flags whether layout adaptation has been done for this dialog - bool m_layoutAdaptationDone; - - // Extra button identifiers to be taken as 'main' button identifiers - // to be placed in the non-scrolling area - wxArrayInt m_mainButtonIds; - - // Adaptation level - int m_layoutAdaptationLevel; - - // Local override for global adaptation enabled status - wxDialogLayoutAdaptationMode m_layoutAdaptationMode; - - // Global layout adapter - static wxDialogLayoutAdapter* sm_layoutAdapter; - - // Global adaptation switch - static bool sm_layoutAdaptation; - private: // common part of all ctors void Init(); - // helper of GetParentForModalDialog(): returns the passed in window if it - // can be used as our parent or NULL if it can't - wxWindow *CheckIfCanBeUsedAsParent(wxWindow *parent) const; - - // Helper of OnCharHook() and OnCloseWindow(): find the appropriate button - // for closing the dialog and send a click event for it. - // - // Return true if we found a button to close the dialog and "clicked" it or - // false otherwise. - bool SendCloseButtonClickEvent(); - // handle Esc key presses void OnCharHook(wxKeyEvent& event); @@ -269,88 +135,18 @@ private: void OnSysColourChanged(wxSysColourChangedEvent& event); - wxDECLARE_NO_COPY_CLASS(wxDialogBase); + DECLARE_NO_COPY_CLASS(wxDialogBase) DECLARE_EVENT_TABLE() + WX_DECLARE_CONTROL_CONTAINER(); }; -/*! - * Base class for layout adapters - code that, for example, turns a dialog into a - * scrolling dialog if there isn't enough screen space. You can derive further - * adapter classes to do any other kind of adaptation, such as applying a watermark, or adding - * a help mechanism. - */ - -class WXDLLIMPEXP_CORE wxDialogLayoutAdapter: public wxObject -{ - DECLARE_CLASS(wxDialogLayoutAdapter) -public: - wxDialogLayoutAdapter() {} - - // Override this function to indicate that adaptation should be done - virtual bool CanDoLayoutAdaptation(wxDialog* dialog) = 0; - - // Override this function to do the adaptation - virtual bool DoLayoutAdaptation(wxDialog* dialog) = 0; -}; - -/*! - * Standard adapter. Does scrolling adaptation for paged and regular dialogs. - * - */ - -class WXDLLIMPEXP_CORE wxStandardDialogLayoutAdapter: public wxDialogLayoutAdapter -{ - DECLARE_CLASS(wxStandardDialogLayoutAdapter) -public: - wxStandardDialogLayoutAdapter() {} - -// Overrides - - // Indicate that adaptation should be done - virtual bool CanDoLayoutAdaptation(wxDialog* dialog); - - // Do layout adaptation - virtual bool DoLayoutAdaptation(wxDialog* dialog); - -// Implementation - - // Create the scrolled window - virtual wxScrolledWindow* CreateScrolledWindow(wxWindow* parent); - -#if wxUSE_BUTTON - // Find a standard or horizontal box sizer - virtual wxSizer* FindButtonSizer(bool stdButtonSizer, wxDialog* dialog, wxSizer* sizer, int& retBorder, int accumlatedBorder = 0); - - // Check if this sizer contains standard buttons, and so can be repositioned in the dialog - virtual bool IsOrdinaryButtonSizer(wxDialog* dialog, wxBoxSizer* sizer); - - // Check if this is a standard button - virtual bool IsStandardButton(wxDialog* dialog, wxButton* button); - - // Find 'loose' main buttons in the existing layout and add them to the standard dialog sizer - virtual bool FindLooseButtons(wxDialog* dialog, wxStdDialogButtonSizer* buttonSizer, wxSizer* sizer, int& count); -#endif // wxUSE_BUTTON - - // Reparent the controls to the scrolled window, except those in buttonSizer - virtual void ReparentControls(wxWindow* parent, wxWindow* reparentTo, wxSizer* buttonSizer = NULL); - static void DoReparentControls(wxWindow* parent, wxWindow* reparentTo, wxSizer* buttonSizer = NULL); - - // A function to fit the dialog around its contents, and then adjust for screen size. - // If scrolled windows are passed, scrolling is enabled in the required orientation(s). - virtual bool FitWithScrolling(wxDialog* dialog, wxScrolledWindow* scrolledWindow); - virtual bool FitWithScrolling(wxDialog* dialog, wxWindowList& windows); - static bool DoFitWithScrolling(wxDialog* dialog, wxScrolledWindow* scrolledWindow); - static bool DoFitWithScrolling(wxDialog* dialog, wxWindowList& windows); - - // Find whether scrolling will be necessary for the dialog, returning wxVERTICAL, wxHORIZONTAL or both - virtual int MustScroll(wxDialog* dialog, wxSize& windowSize, wxSize& displaySize); - static int DoMustScroll(wxDialog* dialog, wxSize& windowSize, wxSize& displaySize); -}; #if defined(__WXUNIVERSAL__) && !defined(__WXMICROWIN__) #include "wx/univ/dialog.h" #else - #if defined(__WXMSW__) + #if defined(__WXPALMOS__) + #include "wx/palmos/dialog.h" + #elif defined(__WXMSW__) #include "wx/msw/dialog.h" #elif defined(__WXMOTIF__) #include "wx/motif/dialog.h" @@ -359,7 +155,7 @@ public: #elif defined(__WXGTK__) #include "wx/gtk1/dialog.h" #elif defined(__WXMAC__) - #include "wx/osx/dialog.h" + #include "wx/mac/dialog.h" #elif defined(__WXCOCOA__) #include "wx/cocoa/dialog.h" #elif defined(__WXPM__) @@ -367,33 +163,5 @@ public: #endif #endif -class WXDLLIMPEXP_CORE wxWindowModalDialogEvent : public wxCommandEvent -{ -public: - wxWindowModalDialogEvent (wxEventType commandType = wxEVT_NULL, int id = 0) - : wxCommandEvent(commandType, id) { } - - wxDialog *GetDialog() const - { return wxStaticCast(GetEventObject(), wxDialog); } - - int GetReturnCode() const - { return GetDialog()->GetReturnCode(); } - - virtual wxEvent *Clone() const { return new wxWindowModalDialogEvent (*this); } - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxWindowModalDialogEvent ) -}; - -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_WINDOW_MODAL_DIALOG_CLOSED , wxWindowModalDialogEvent ); - -typedef void (wxEvtHandler::*wxWindowModalDialogEventFunction)(wxWindowModalDialogEvent &); - -#define wxWindowModalDialogEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxWindowModalDialogEventFunction, func) - -#define EVT_WINDOW_MODAL_DIALOG_CLOSED(winid, func) \ - wx__DECLARE_EVT1(wxEVT_WINDOW_MODAL_DIALOG_CLOSED, winid, wxWindowModalDialogEventHandler(func)) - #endif // _WX_DIALOG_H_BASE_ diff --git a/Source/3rd Party/wx/include/wx/dialup.h b/Source/3rd Party/wx/include/wx/dialup.h index 954b258da..b86e70cba 100644 --- a/Source/3rd Party/wx/include/wx/dialup.h +++ b/Source/3rd Party/wx/include/wx/dialup.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 07.07.99 -// RCS-ID: $Id$ +// RCS-ID: $Id: dialup.h 49804 2007-11-10 01:09:42Z VZ $ // Copyright: (c) Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -43,7 +43,7 @@ class WXDLLIMPEXP_FWD_BASE wxArrayString; * main thread? */ -class WXDLLIMPEXP_CORE wxDialUpManager +class WXDLLEXPORT wxDialUpManager { public: // this function should create and return the object of the @@ -152,13 +152,13 @@ public: // wxDialUpManager events // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_FWD_CORE wxDialUpEvent; - -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_DIALUP_CONNECTED, wxDialUpEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_DIALUP_DISCONNECTED, wxDialUpEvent ); +BEGIN_DECLARE_EVENT_TYPES() + DECLARE_EVENT_TYPE(wxEVT_DIALUP_CONNECTED, 450) + DECLARE_EVENT_TYPE(wxEVT_DIALUP_DISCONNECTED, 451) +END_DECLARE_EVENT_TYPES() // the event class for the dialup events -class WXDLLIMPEXP_CORE wxDialUpEvent : public wxEvent +class WXDLLEXPORT wxDialUpEvent : public wxEvent { public: wxDialUpEvent(bool isConnected, bool isOwnEvent) : wxEvent(isOwnEvent) @@ -171,7 +171,7 @@ public: bool IsConnectedEvent() const { return GetEventType() == wxEVT_DIALUP_CONNECTED; } - // does this event come from wxDialUpManager::Dial() or from some external + // does this event come from wxDialUpManager::Dial() or from some extrenal // process (i.e. does it result from our own attempt to establish the // connection)? bool IsOwnEvent() const { return m_id != 0; } @@ -180,14 +180,14 @@ public: virtual wxEvent *Clone() const { return new wxDialUpEvent(*this); } private: - wxDECLARE_NO_ASSIGN_CLASS(wxDialUpEvent); + DECLARE_NO_ASSIGN_CLASS(wxDialUpEvent) }; // the type of dialup event handler function typedef void (wxEvtHandler::*wxDialUpEventFunction)(wxDialUpEvent&); #define wxDialUpEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxDialUpEventFunction, func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxDialUpEventFunction, &func) // macros to catch dialup events #define EVT_DIALUP_CONNECTED(func) \ diff --git a/Source/3rd Party/wx/include/wx/dir.h b/Source/3rd Party/wx/include/wx/dir.h index 16aaef39d..90cee0225 100644 --- a/Source/3rd Party/wx/include/wx/dir.h +++ b/Source/3rd Party/wx/include/wx/dir.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 08.12.99 -// RCS-ID: $Id$ +// RCS-ID: $Id: dir.h 53135 2008-04-12 02:31:04Z VZ $ // Copyright: (c) 1999 Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -14,7 +14,6 @@ #include "wx/longlong.h" #include "wx/string.h" -#include "wx/filefn.h" // for wxS_DIR_DEFAULT class WXDLLIMPEXP_FWD_BASE wxArrayString; @@ -24,7 +23,7 @@ class WXDLLIMPEXP_FWD_BASE wxArrayString; // these flags define what kind of filenames is included in the list of files // enumerated by GetFirst/GetNext -enum wxDirFlags +enum { wxDIR_FILES = 0x0001, // include files wxDIR_DIRS = 0x0002, // include directories @@ -64,7 +63,7 @@ public: virtual wxDirTraverseResult OnDir(const wxString& dirname) = 0; // called for each directory which we couldn't open during our traversal - // of the directory tree + // of the directory tyree // // this method can also return either wxDIR_STOP, wxDIR_IGNORE or // wxDIR_CONTINUE but the latter is treated specially: it means to retry @@ -84,6 +83,8 @@ class WXDLLIMPEXP_FWD_BASE wxDirData; class WXDLLIMPEXP_BASE wxDir { public: + // test for existence of a directory with the given name + static bool Exists(const wxString& dir); // ctors // ----- @@ -94,7 +95,7 @@ public: // opens the directory for enumeration, use IsOpened() to test success wxDir(const wxString& dir); - // dtor cleans up the associated resources + // dtor cleans up the associated ressources ~wxDir(); // open the directory for enumerating @@ -106,11 +107,6 @@ public: // get the full name of the directory (without '/' at the end) wxString GetName() const; - // Same as GetName() but does include the trailing separator, unless the - // string is empty (only for invalid directories). - wxString GetNameWithSep() const; - - // file enumeration routines // ------------------------- @@ -124,10 +120,10 @@ public: bool GetNext(wxString *filename) const; // return true if this directory has any files in it - bool HasFiles(const wxString& spec = wxEmptyString) const; + bool HasFiles(const wxString& spec = wxEmptyString); // return true if this directory has any subdirectories - bool HasSubDirs(const wxString& spec = wxEmptyString) const; + bool HasSubDirs(const wxString& spec = wxEmptyString); // enumerate all files in this directory and its subdirectories // @@ -150,31 +146,15 @@ public: const wxString& filespec, int flags = wxDIR_DEFAULT); -#if wxUSE_LONGLONG // returns the size of all directories recursively found in given path static wxULongLong GetTotalSize(const wxString &dir, wxArrayString *filesSkipped = NULL); -#endif // wxUSE_LONGLONG - - - // static utilities for directory management - // (alias to wxFileName's functions for dirs) - // ----------------------------------------- - - // test for existence of a directory with the given name - static bool Exists(const wxString& dir); - - static bool Make(const wxString &dir, int perm = wxS_DIR_DEFAULT, - int flags = 0); - - static bool Remove(const wxString &dir, int flags = 0); - private: friend class wxDirData; wxDirData *m_data; - wxDECLARE_NO_COPY_CLASS(wxDir); + DECLARE_NO_COPY_CLASS(wxDir) }; #endif // _WX_DIR_H_ diff --git a/Source/3rd Party/wx/include/wx/dirdlg.h b/Source/3rd Party/wx/include/wx/dirdlg.h index 228ced765..8c6d2f8fe 100644 --- a/Source/3rd Party/wx/include/wx/dirdlg.h +++ b/Source/3rd Party/wx/include/wx/dirdlg.h @@ -5,7 +5,7 @@ // Modified by: // Created: // Copyright: (c) Robert Roebling -// RCS-ID: $Id$ +// RCS-ID: $Id: dirdlg.h 44027 2006-12-21 19:26:48Z VZ $ // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// @@ -20,9 +20,9 @@ // constants // ---------------------------------------------------------------------------- -extern WXDLLIMPEXP_DATA_CORE(const char) wxDirDialogNameStr[]; -extern WXDLLIMPEXP_DATA_CORE(const char) wxDirDialogDefaultFolderStr[]; -extern WXDLLIMPEXP_DATA_CORE(const char) wxDirSelectorPromptStr[]; +extern WXDLLEXPORT_DATA(const wxChar) wxDirDialogNameStr[]; +extern WXDLLEXPORT_DATA(const wxChar) wxDirDialogDefaultFolderStr[]; +extern WXDLLEXPORT_DATA(const wxChar) wxDirSelectorPromptStr[]; #define wxDD_CHANGE_DIR 0x0100 #define wxDD_DIR_MUST_EXIST 0x0200 @@ -40,7 +40,7 @@ extern WXDLLIMPEXP_DATA_CORE(const char) wxDirSelectorPromptStr[]; // wxDirDialogBase //------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxDirDialogBase : public wxDialog +class WXDLLEXPORT wxDirDialogBase : public wxDialog { public: wxDirDialogBase() {} @@ -96,7 +96,8 @@ protected: #if defined(__WXUNIVERSAL__) #include "wx/generic/dirdlgg.h" #define wxDirDialog wxGenericDirDialog -#elif defined(__WXMSW__) && (!wxUSE_OLE || \ +#elif defined(__WXMSW__) && (defined(__SALFORDC__) || \ + !wxUSE_OLE || \ (defined (__GNUWIN32__) && !wxUSE_NORLANDER_HEADERS)) #include "wx/generic/dirdlgg.h" #define wxDirDialog wxGenericDirDialog @@ -105,17 +106,18 @@ protected: #define wxDirDialog wxGenericDirDialog #elif defined(__WXMSW__) #include "wx/msw/dirdlg.h" // Native MSW -#elif defined(__WXGTK20__) +#elif defined(__WXGTK24__) #include "wx/gtk/dirdlg.h" // Native GTK for gtk2.4 #elif defined(__WXGTK__) #include "wx/generic/dirdlgg.h" #define wxDirDialog wxGenericDirDialog #elif defined(__WXMAC__) - #include "wx/osx/dirdlg.h" // Native Mac + #include "wx/mac/dirdlg.h" // Native Mac #elif defined(__WXCOCOA__) #include "wx/cocoa/dirdlg.h" // Native Cocoa #elif defined(__WXMOTIF__) || \ defined(__WXX11__) || \ + defined(__WXMGL__) || \ defined(__WXCOCOA__) || \ defined(__WXPM__) #include "wx/generic/dirdlgg.h" // Other ports use generic implementation @@ -126,7 +128,7 @@ protected: // common ::wxDirSelector() function // ---------------------------------------------------------------------------- -WXDLLIMPEXP_CORE wxString +WXDLLEXPORT wxString wxDirSelector(const wxString& message = wxDirSelectorPromptStr, const wxString& defaultPath = wxEmptyString, long style = wxDD_DEFAULT_STYLE, diff --git a/Source/3rd Party/wx/include/wx/display.h b/Source/3rd Party/wx/include/wx/display.h index 2e925ca9a..98a52ec30 100644 --- a/Source/3rd Party/wx/include/wx/display.h +++ b/Source/3rd Party/wx/include/wx/display.h @@ -3,7 +3,7 @@ // Purpose: wxDisplay class // Author: Royce Mitchell III, Vadim Zeitlin // Created: 06/21/02 -// RCS-ID: $Id$ +// RCS-ID: $Id: display.h 49804 2007-11-10 01:09:42Z VZ $ // Copyright: (c) 2002-2006 wxWidgets team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -22,7 +22,7 @@ WX_DECLARE_EXPORTED_OBJARRAY(wxVideoMode, wxArrayVideoModes); // default, uninitialized, video mode object - extern WXDLLIMPEXP_DATA_CORE(const wxVideoMode) wxDefaultVideoMode; + extern WXDLLEXPORT_DATA(const wxVideoMode) wxDefaultVideoMode; #endif // wxUSE_DISPLAY class WXDLLIMPEXP_FWD_CORE wxWindow; @@ -37,7 +37,7 @@ class WXDLLIMPEXP_FWD_CORE wxDisplayImpl; // wxDisplay: represents a display/monitor attached to the system // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxDisplay +class WXDLLEXPORT wxDisplay { public: // initialize the object containing all information about the given @@ -62,7 +62,7 @@ public: // find the display where the given window lies, return wxNOT_FOUND if it // is not shown at all - static int GetFromWindow(const wxWindow *window); + static int GetFromWindow(wxWindow *window); // return true if the object was initialized successfully @@ -122,7 +122,7 @@ private: wxDisplayImpl *m_impl; - wxDECLARE_NO_COPY_CLASS(wxDisplay); + DECLARE_NO_COPY_CLASS(wxDisplay) }; #endif // _WX_DISPLAY_H_BASE_ diff --git a/Source/3rd Party/wx/include/wx/display_impl.h b/Source/3rd Party/wx/include/wx/display_impl.h index 0d5833158..8c38f6522 100644 --- a/Source/3rd Party/wx/include/wx/display_impl.h +++ b/Source/3rd Party/wx/include/wx/display_impl.h @@ -3,7 +3,7 @@ // Purpose: wxDisplayImpl class declaration // Author: Vadim Zeitlin // Created: 2006-03-15 -// RCS-ID: $Id$ +// RCS-ID: $Id: display_impl.h 41548 2006-10-02 05:38:05Z PC $ // Copyright: (c) 2002-2006 Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -17,7 +17,7 @@ // wxDisplayFactory: allows to create wxDisplay objects // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxDisplayFactory +class WXDLLEXPORT wxDisplayFactory { public: wxDisplayFactory() { } @@ -37,14 +37,14 @@ public: // return the display for the given window or wxNOT_FOUND // // the window pointer must not be NULL (i.e. caller should check it) - virtual int GetFromWindow(const wxWindow *window); + virtual int GetFromWindow(wxWindow *window); }; // ---------------------------------------------------------------------------- // wxDisplayImpl: base class for all wxDisplay implementations // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxDisplayImpl +class WXDLLEXPORT wxDisplayImpl { public: // virtual dtor for this base class @@ -89,7 +89,7 @@ protected: friend class wxDisplayFactory; - wxDECLARE_NO_COPY_CLASS(wxDisplayImpl); + DECLARE_NO_COPY_CLASS(wxDisplayImpl) }; // ---------------------------------------------------------------------------- @@ -98,7 +98,7 @@ protected: // this is a stub implementation using single/main display only, it is // available even if wxUSE_DISPLAY == 0 -class WXDLLIMPEXP_CORE wxDisplayFactorySingle : public wxDisplayFactory +class WXDLLEXPORT wxDisplayFactorySingle : public wxDisplayFactory { public: virtual wxDisplayImpl *CreateDisplay(unsigned n); diff --git a/Source/3rd Party/wx/include/wx/dlimpexp.h b/Source/3rd Party/wx/include/wx/dlimpexp.h index 485842b89..743785e04 100644 --- a/Source/3rd Party/wx/include/wx/dlimpexp.h +++ b/Source/3rd Party/wx/include/wx/dlimpexp.h @@ -4,7 +4,7 @@ * Author: Vadim Zeitlin * Modified by: * Created: 16.10.2003 (extracted from wx/defs.h) - * RCS-ID: $Id$ + * RCS-ID: $Id: dlimpexp.h 49563 2007-10-31 20:46:21Z VZ $ * Copyright: (c) 2003 Vadim Zeitlin * Licence: wxWindows licence */ @@ -16,31 +16,17 @@ #ifndef _WX_DLIMPEXP_H_ #define _WX_DLIMPEXP_H_ -#if defined(HAVE_VISIBILITY) -# define WXEXPORT __attribute__ ((visibility("default"))) -# define WXIMPORT __attribute__ ((visibility("default"))) -#elif defined(__WINDOWS__) +#if defined(__WXMSW__) /* __declspec works in BC++ 5 and later, Watcom C++ 11.0 and later as well - as VC++. + as VC++ and gcc */ -# if defined(__VISUALC__) || defined(__BORLANDC__) || defined(__WATCOMC__) +# if defined(__VISUALC__) || defined(__BORLANDC__) || defined(__GNUC__) || defined(__WATCOMC__) # define WXEXPORT __declspec(dllexport) # define WXIMPORT __declspec(dllimport) - /* - While gcc also supports __declspec(dllexport), it creates unusably huge - DLL files since gcc 4.5 (while taking horribly long amounts of time), - see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43601. Because of this - we rely on binutils auto export/import support which seems to work - quite well for 4.5+. - */ -# elif defined(__GNUC__) && !wxCHECK_GCC_VERSION(4, 5) - /* - __declspec could be used here too but let's use the native - __attribute__ instead for clarity. - */ -# define WXEXPORT __attribute__((dllexport)) -# define WXIMPORT __attribute__((dllimport)) +# else /* compiler doesn't support __declspec() */ +# define WXEXPORT +# define WXIMPORT # endif #elif defined(__WXPM__) # if defined (__WATCOMC__) @@ -57,6 +43,11 @@ # define WXEXPORT _Export # define WXIMPORT _Export # endif +#elif defined(__WXMAC__) || defined(__WXCOCOA__) +# ifdef __MWERKS__ +# define WXEXPORT __declspec(export) +# define WXIMPORT __declspec(import) +# endif #elif defined(__CYGWIN__) # define WXEXPORT __declspec(dllexport) # define WXIMPORT __declspec(dllimport) @@ -73,7 +64,7 @@ support arbitrary combinations of libs/DLLs: either we build all of them as DLLs (in which case WXMAKINGDLL is defined) or none (it isn't). - However we have a problem because we need separate WXDLLIMPEXP versions for + However we have a problem because we need separate WXDLLEXPORT versions for different libraries as, for example, wxString class should be dllexported when compiled in wxBase and dllimported otherwise, so we do define separate WXMAKING/USINGDLL_XYZ constants for each component XYZ. @@ -87,43 +78,30 @@ # define WXMAKINGDLL_CORE # define WXMAKINGDLL_ADV # define WXMAKINGDLL_QA +# define WXMAKINGDLL_ODBC +# define WXMAKINGDLL_DBGRID # define WXMAKINGDLL_HTML # define WXMAKINGDLL_GL # define WXMAKINGDLL_XML # define WXMAKINGDLL_XRC # define WXMAKINGDLL_AUI -# define WXMAKINGDLL_RIBBON -# define WXMAKINGDLL_PROPGRID # define WXMAKINGDLL_RICHTEXT # define WXMAKINGDLL_MEDIA -# define WXMAKINGDLL_STC -# define WXMAKINGDLL_WEBVIEW #endif /* WXMAKINGDLL */ /* - WXDLLIMPEXP_CORE maps to export declaration when building the DLL, to import + WXDLLEXPORT maps to export declaration when building the DLL, to import declaration if using it or to nothing at all if we don't use wxWin as DLL */ #ifdef WXMAKINGDLL_BASE # define WXDLLIMPEXP_BASE WXEXPORT # define WXDLLIMPEXP_DATA_BASE(type) WXEXPORT type -# if defined(HAVE_VISIBILITY) -# define WXDLLIMPEXP_INLINE_BASE WXEXPORT -# else -# define WXDLLIMPEXP_INLINE_BASE -# endif #elif defined(WXUSINGDLL) # define WXDLLIMPEXP_BASE WXIMPORT # define WXDLLIMPEXP_DATA_BASE(type) WXIMPORT type -# if defined(HAVE_VISIBILITY) -# define WXDLLIMPEXP_INLINE_BASE WXIMPORT -# else -# define WXDLLIMPEXP_INLINE_BASE -# endif #else /* not making nor using DLL */ # define WXDLLIMPEXP_BASE # define WXDLLIMPEXP_DATA_BASE(type) type -# define WXDLLIMPEXP_INLINE_BASE #endif #ifdef WXMAKINGDLL_NET @@ -140,23 +118,12 @@ #ifdef WXMAKINGDLL_CORE # define WXDLLIMPEXP_CORE WXEXPORT # define WXDLLIMPEXP_DATA_CORE(type) WXEXPORT type -# if defined(HAVE_VISIBILITY) -# define WXDLLIMPEXP_INLINE_CORE WXEXPORT -# else -# define WXDLLIMPEXP_INLINE_CORE -# endif #elif defined(WXUSINGDLL) # define WXDLLIMPEXP_CORE WXIMPORT # define WXDLLIMPEXP_DATA_CORE(type) WXIMPORT type -# if defined(HAVE_VISIBILITY) -# define WXDLLIMPEXP_INLINE_CORE WXIMPORT -# else -# define WXDLLIMPEXP_INLINE_CORE -# endif #else /* not making nor using DLL */ # define WXDLLIMPEXP_CORE # define WXDLLIMPEXP_DATA_CORE(type) type -# define WXDLLIMPEXP_INLINE_CORE #endif #ifdef WXMAKINGDLL_ADV @@ -170,6 +137,17 @@ # define WXDLLIMPEXP_DATA_ADV(type) type #endif +#ifdef WXMAKINGDLL_ODBC +# define WXDLLIMPEXP_ODBC WXEXPORT +# define WXDLLIMPEXP_DATA_ODBC(type) WXEXPORT type +#elif defined(WXUSINGDLL) +# define WXDLLIMPEXP_ODBC WXIMPORT +# define WXDLLIMPEXP_DATA_ODBC(type) WXIMPORT type +#else /* not making nor using DLL */ +# define WXDLLIMPEXP_ODBC +# define WXDLLIMPEXP_DATA_ODBC(type) type +#endif + #ifdef WXMAKINGDLL_QA # define WXDLLIMPEXP_QA WXEXPORT # define WXDLLIMPEXP_DATA_QA(type) WXEXPORT type @@ -181,6 +159,17 @@ # define WXDLLIMPEXP_DATA_QA(type) type #endif +#ifdef WXMAKINGDLL_DBGRID +# define WXDLLIMPEXP_DBGRID WXEXPORT +# define WXDLLIMPEXP_DATA_DBGRID(type) WXEXPORT type +#elif defined(WXUSINGDLL) +# define WXDLLIMPEXP_DBGRID WXIMPORT +# define WXDLLIMPEXP_DATA_DBGRID(type) WXIMPORT type +#else /* not making nor using DLL */ +# define WXDLLIMPEXP_DBGRID +# define WXDLLIMPEXP_DATA_DBGRID(type) type +#endif + #ifdef WXMAKINGDLL_HTML # define WXDLLIMPEXP_HTML WXEXPORT # define WXDLLIMPEXP_DATA_HTML(type) WXEXPORT type @@ -224,25 +213,6 @@ # define WXDLLIMPEXP_AUI #endif -#ifdef WXMAKINGDLL_RIBBON -# define WXDLLIMPEXP_RIBBON WXEXPORT -#elif defined(WXUSINGDLL) -# define WXDLLIMPEXP_RIBBON WXIMPORT -#else /* not making nor using DLL */ -# define WXDLLIMPEXP_RIBBON -#endif - -#ifdef WXMAKINGDLL_PROPGRID -# define WXDLLIMPEXP_PROPGRID WXEXPORT -# define WXDLLIMPEXP_DATA_PROPGRID(type) WXEXPORT type -#elif defined(WXUSINGDLL) -# define WXDLLIMPEXP_PROPGRID WXIMPORT -# define WXDLLIMPEXP_DATA_PROPGRID(type) WXIMPORT type -#else /* not making nor using DLL */ -# define WXDLLIMPEXP_PROPGRID -# define WXDLLIMPEXP_DATA_PROPGRID(type) type -#endif - #ifdef WXMAKINGDLL_RICHTEXT # define WXDLLIMPEXP_RICHTEXT WXEXPORT #elif defined(WXUSINGDLL) @@ -259,35 +229,19 @@ # define WXDLLIMPEXP_MEDIA #endif -#ifdef WXMAKINGDLL_STC -# define WXDLLIMPEXP_STC WXEXPORT -# define WXDLLIMPEXP_DATA_STC(type) WXEXPORT type -#elif defined(WXUSINGDLL) -# define WXDLLIMPEXP_STC WXIMPORT -# define WXDLLIMPEXP_DATA_STC(type) WXIMPORT type -#else /* not making nor using DLL */ -# define WXDLLIMPEXP_STC -# define WXDLLIMPEXP_DATA_STC(type) type -#endif +/* for backwards compatibility, define suffix-less versions too */ +#define WXDLLEXPORT WXDLLIMPEXP_CORE +#define WXDLLEXPORT_DATA WXDLLIMPEXP_DATA_CORE -#ifdef WXMAKINGDLL_WEBVIEW -# define WXDLLIMPEXP_WEBVIEW WXEXPORT -# define WXDLLIMPEXP_DATA_WEBVIEW(type) WXEXPORT type -#elif defined(WXUSINGDLL) -# define WXDLLIMPEXP_WEBVIEW WXIMPORT -# define WXDLLIMPEXP_DATA_WEBVIEW(type) WXIMPORT type -#else /* not making nor using DLL */ -# define WXDLLIMPEXP_WEBVIEW -# define WXDLLIMPEXP_DATA_WEBVIEW(type) type -#endif - -/* +/* wx-2.9 introduces new macros for forward declarations, include them + * here for forward compatibility: + GCC warns about using __attribute__ (and also __declspec in mingw32 case) on forward declarations while MSVC complains about forward declarations without __declspec for the classes later declared with it, so we need a separate set of macros for forward declarations to hide this difference: */ -#if defined(HAVE_VISIBILITY) || (defined(__WINDOWS__) && defined(__GNUC__)) +#if defined(__WINDOWS__) && defined(__GNUC__) #define WXDLLIMPEXP_FWD_BASE #define WXDLLIMPEXP_FWD_NET #define WXDLLIMPEXP_FWD_CORE @@ -298,11 +252,9 @@ #define WXDLLIMPEXP_FWD_XML #define WXDLLIMPEXP_FWD_XRC #define WXDLLIMPEXP_FWD_AUI - #define WXDLLIMPEXP_FWD_PROPGRID #define WXDLLIMPEXP_FWD_RICHTEXT #define WXDLLIMPEXP_FWD_MEDIA #define WXDLLIMPEXP_FWD_STC - #define WXDLLIMPEXP_FWD_WEBVIEW #else #define WXDLLIMPEXP_FWD_BASE WXDLLIMPEXP_BASE #define WXDLLIMPEXP_FWD_NET WXDLLIMPEXP_NET @@ -314,50 +266,10 @@ #define WXDLLIMPEXP_FWD_XML WXDLLIMPEXP_XML #define WXDLLIMPEXP_FWD_XRC WXDLLIMPEXP_XRC #define WXDLLIMPEXP_FWD_AUI WXDLLIMPEXP_AUI - #define WXDLLIMPEXP_FWD_PROPGRID WXDLLIMPEXP_PROPGRID #define WXDLLIMPEXP_FWD_RICHTEXT WXDLLIMPEXP_RICHTEXT #define WXDLLIMPEXP_FWD_MEDIA WXDLLIMPEXP_MEDIA #define WXDLLIMPEXP_FWD_STC WXDLLIMPEXP_STC - #define WXDLLIMPEXP_FWD_WEBVIEW WXDLLIMPEXP_WEBVIEW #endif -/* for backwards compatibility, define suffix-less versions too */ -#define WXDLLEXPORT WXDLLIMPEXP_CORE -#define WXDLLEXPORT_DATA WXDLLIMPEXP_DATA_CORE - -/* - MSVC up to 6.0 needs to be explicitly told to export template instantiations - used by the DLL clients, use this macro to do it like this: - - template class Foo { ... }; - WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE( Foo ) - - (notice that currently we only need this for wxBase and wxCore libraries) - */ -#if defined(__VISUALC__) && (__VISUALC__ <= 1200) - #ifdef WXMAKINGDLL_BASE - #define WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE(decl) \ - template class WXDLLIMPEXP_BASE decl; - #define WXDLLIMPEXP_TEMPLATE_INSTANCE_CORE(decl) \ - template class WXDLLIMPEXP_CORE decl; - #else - /* - We need to disable this warning when using this macro, as - recommended by Microsoft itself: - - http://support.microsoft.com/default.aspx?scid=kb%3ben-us%3b168958 - */ - #pragma warning(disable:4231) - - #define WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE(decl) \ - extern template class WXDLLIMPEXP_BASE decl; - #define WXDLLIMPEXP_TEMPLATE_INSTANCE_CORE(decl) \ - extern template class WXDLLIMPEXP_CORE decl; - #endif -#else /* not VC <= 6 */ - #define WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE(decl) - #define WXDLLIMPEXP_TEMPLATE_INSTANCE_CORE(decl) -#endif /* VC6/others */ - #endif /* _WX_DLIMPEXP_H_ */ diff --git a/Source/3rd Party/wx/include/wx/dlist.h b/Source/3rd Party/wx/include/wx/dlist.h deleted file mode 100644 index 1948b877a..000000000 --- a/Source/3rd Party/wx/include/wx/dlist.h +++ /dev/null @@ -1,850 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/dlist.h -// Purpose: wxDList which is a template version of wxList -// Author: Robert Roebling -// Created: 18.09.2008 -// Copyright: (c) 2008 wxWidgets team -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DLIST_H_ -#define _WX_DLIST_H_ - -#include "wx/defs.h" -#include "wx/utils.h" - -#if wxUSE_STD_CONTAINERS - -#include "wx/beforestd.h" -#include -#include -#include -#include "wx/afterstd.h" - -template -class wxDList: public std::list -{ -private: - bool m_destroy; - typedef std::list BaseListType; - typedef wxDList ListType; - -public: - typedef typename BaseListType::iterator iterator; - - class compatibility_iterator - { - private: - /* Workaround for broken VC6 nested class name resolution */ - typedef typename BaseListType::iterator iterator; - friend class wxDList; - - iterator m_iter; - ListType *m_list; - - public: - compatibility_iterator() - : m_iter(), m_list( NULL ) {} - compatibility_iterator( ListType* li, iterator i ) - : m_iter( i ), m_list( li ) {} - compatibility_iterator( const ListType* li, iterator i ) - : m_iter( i ), m_list( const_cast(li) ) {} - - compatibility_iterator* operator->() { return this; } - const compatibility_iterator* operator->() const { return this; } - - bool operator==(const compatibility_iterator& i) const - { - wxASSERT_MSG( m_list && i.m_list, - "comparing invalid iterators is illegal" ); - return (m_list == i.m_list) && (m_iter == i.m_iter); - } - bool operator!=(const compatibility_iterator& i) const - { return !( operator==( i ) ); } - operator bool() const - { return m_list ? m_iter != m_list->end() : false; } - bool operator !() const - { return !( operator bool() ); } - - T* GetData() const { return *m_iter; } - void SetData( T* e ) { *m_iter = e; } - - compatibility_iterator GetNext() const - { - iterator i = m_iter; - return compatibility_iterator( m_list, ++i ); - } - - compatibility_iterator GetPrevious() const - { - if ( m_iter == m_list->begin() ) - return compatibility_iterator(); - - iterator i = m_iter; - return compatibility_iterator( m_list, --i ); - } - - int IndexOf() const - { - return *this ? std::distance( m_list->begin(), m_iter ) - : wxNOT_FOUND; - } - }; - -public: - wxDList() : m_destroy( false ) {} - - ~wxDList() { Clear(); } - - compatibility_iterator Find( const T* e ) const - { - return compatibility_iterator( this, - std::find( const_cast(this)->begin(), - const_cast(this)->end(), e ) ); - } - - bool IsEmpty() const - { return this->empty(); } - size_t GetCount() const - { return this->size(); } - - compatibility_iterator Item( size_t idx ) const - { - iterator i = const_cast(this)->begin(); - std::advance( i, idx ); - return compatibility_iterator( this, i ); - } - - T* operator[](size_t idx) const - { - return Item(idx).GetData(); - } - - compatibility_iterator GetFirst() const - { - return compatibility_iterator( this, const_cast(this)->begin() ); - } - compatibility_iterator GetLast() const - { - iterator i = const_cast(this)->end(); - return compatibility_iterator( this, !(this->empty()) ? --i : i ); - } - compatibility_iterator Member( T* e ) const - { return Find( e ); } - compatibility_iterator Nth( int n ) const - { return Item( n ); } - int IndexOf( T* e ) const - { return Find( e ).IndexOf(); } - - compatibility_iterator Append( T* e ) - { - this->push_back( e ); - return GetLast(); - } - - compatibility_iterator Insert( T* e ) - { - this->push_front( e ); - return compatibility_iterator( this, this->begin() ); - } - - compatibility_iterator Insert( compatibility_iterator & i, T* e ) - { - return compatibility_iterator( this, this->insert( i.m_iter, e ) ); - } - - compatibility_iterator Insert( size_t idx, T* e ) - { - return compatibility_iterator( this, - this->insert( Item( idx ).m_iter, e ) ); - } - - void DeleteContents( bool destroy ) - { m_destroy = destroy; } - - bool GetDeleteContents() const - { return m_destroy; } - - void Erase( const compatibility_iterator& i ) - { - if ( m_destroy ) - delete i->GetData(); - this->erase( i.m_iter ); - } - - bool DeleteNode( const compatibility_iterator& i ) - { - if( i ) - { - Erase( i ); - return true; - } - return false; - } - - bool DeleteObject( T* e ) - { - return DeleteNode( Find( e ) ); - } - - void Clear() - { - if ( m_destroy ) - { - iterator it, en; - for ( it = this->begin(), en = this->end(); it != en; ++it ) - delete *it; - } - this->clear(); - } -}; - -#else // !wxUSE_STD_CONTAINERS - -template -class wxDList -{ -public: - class Node - { - public: - Node(wxDList *list = NULL, - Node *previous = NULL, - Node *next = NULL, - T *data = NULL) - { - m_list = list; - m_previous = previous; - m_next = next; - m_data = data; - if (previous) - previous->m_next = this; - if (next) - next->m_previous = this; - } - - ~Node() - { - // handle the case when we're being deleted from the list by - // the user (i.e. not by the list itself from DeleteNode) - - // we must do it for compatibility with old code - if (m_list != NULL) - m_list->DetachNode(this); - } - - void DeleteData() - { - delete m_data; - } - - Node *GetNext() const { return m_next; } - Node *GetPrevious() const { return m_previous; } - T *GetData() const { return m_data; } - T **GetDataPtr() const { return &(wx_const_cast(nodetype*,this)->m_data); } - void SetData( T *data ) { m_data = data; } - - int IndexOf() const - { - wxCHECK_MSG( m_list, wxNOT_FOUND, - "node doesn't belong to a list in IndexOf" ); - - int i; - Node *prev = m_previous; - for( i = 0; prev; i++ ) - prev = prev->m_previous; - return i; - } - - private: - T *m_data; // user data - Node *m_next, // next and previous nodes in the list - *m_previous; - wxDList *m_list; // list we belong to - - friend class wxDList; - }; - - typedef Node nodetype; - - class compatibility_iterator - { - public: - compatibility_iterator(nodetype *ptr = NULL) : m_ptr(ptr) { } - nodetype *operator->() const { return m_ptr; } - operator nodetype *() const { return m_ptr; } - - private: - nodetype *m_ptr; - }; - -private: - void Init() - { - m_nodeFirst = - m_nodeLast = NULL; - m_count = 0; - m_destroy = false; - } - - void DoDeleteNode( nodetype *node ) - { - if ( m_destroy ) - node->DeleteData(); - // so that the node knows that it's being deleted by the list - node->m_list = NULL; - delete node; - } - - size_t m_count; // number of elements in the list - bool m_destroy; // destroy user data when deleting list items? - nodetype *m_nodeFirst, // pointers to the head and tail of the list - *m_nodeLast; - -public: - wxDList() - { - Init(); - } - - wxDList( const wxDList& list ) - { - Init(); - Assign(list); - } - - wxDList( size_t count, T *elements[] ) - { - Init(); - size_t n; - for (n = 0; n < count; n++) - Append( elements[n] ); - } - - wxDList& operator=( const wxDList& list ) - { - if (&list != this) - Assign(list); - return *this; - } - - ~wxDList() - { - nodetype *each = m_nodeFirst; - while ( each != NULL ) - { - nodetype *next = each->GetNext(); - DoDeleteNode(each); - each = next; - } - } - - void Assign(const wxDList &list) - { - wxASSERT_MSG( !list.m_destroy, - "copying list which owns it's elements is a bad idea" ); - Clear(); - m_destroy = list.m_destroy; - m_nodeFirst = NULL; - m_nodeLast = NULL; - nodetype* node; - for (node = list.GetFirst(); node; node = node->GetNext() ) - Append(node->GetData()); - wxASSERT_MSG( m_count == list.m_count, "logic error in Assign()" ); - } - - nodetype *Append( T *object ) - { - nodetype *node = new nodetype( this, m_nodeLast, NULL, object ); - - if ( !m_nodeFirst ) - { - m_nodeFirst = node; - m_nodeLast = m_nodeFirst; - } - else - { - m_nodeLast->m_next = node; - m_nodeLast = node; - } - m_count++; - return node; - } - - nodetype *Insert( T* object ) - { - return Insert( NULL, object ); - } - - nodetype *Insert( size_t pos, T* object ) - { - if (pos == m_count) - return Append( object ); - else - return Insert( Item(pos), object ); - } - - nodetype *Insert( nodetype *position, T* object ) - { - wxCHECK_MSG( !position || position->m_list == this, NULL, - "can't insert before a node from another list" ); - - // previous and next node for the node being inserted - nodetype *prev, *next; - if ( position ) - { - prev = position->GetPrevious(); - next = position; - } - else - { - // inserting in the beginning of the list - prev = NULL; - next = m_nodeFirst; - } - nodetype *node = new nodetype( this, prev, next, object ); - if ( !m_nodeFirst ) - m_nodeLast = node; - if ( prev == NULL ) - m_nodeFirst = node; - m_count++; - return node; - } - - nodetype *GetFirst() const { return m_nodeFirst; } - nodetype *GetLast() const { return m_nodeLast; } - size_t GetCount() const { return m_count; } - bool IsEmpty() const { return m_count == 0; } - - void DeleteContents(bool destroy) { m_destroy = destroy; } - bool GetDeleteContents() const { return m_destroy; } - - nodetype *Item(size_t index) const - { - for ( nodetype *current = GetFirst(); current; current = current->GetNext() ) - { - if ( index-- == 0 ) - return current; - } - wxFAIL_MSG( "invalid index in Item()" ); - return NULL; - } - - T *operator[](size_t index) const - { - nodetype *node = Item(index); - return node ? node->GetData() : NULL; - } - - nodetype *DetachNode( nodetype *node ) - { - wxCHECK_MSG( node, NULL, "detaching NULL wxNodeBase" ); - wxCHECK_MSG( node->m_list == this, NULL, - "detaching node which is not from this list" ); - // update the list - nodetype **prevNext = node->GetPrevious() ? &node->GetPrevious()->m_next - : &m_nodeFirst; - nodetype **nextPrev = node->GetNext() ? &node->GetNext()->m_previous - : &m_nodeLast; - *prevNext = node->GetNext(); - *nextPrev = node->GetPrevious(); - m_count--; - // mark the node as not belonging to this list any more - node->m_list = NULL; - return node; - } - - void Erase( nodetype *node ) - { - DeleteNode(node); - } - - bool DeleteNode( nodetype *node ) - { - if ( !DetachNode(node) ) - return false; - DoDeleteNode(node); - return true; - } - - bool DeleteObject( T *object ) - { - for ( nodetype *current = GetFirst(); current; current = current->GetNext() ) - { - if ( current->GetData() == object ) - { - DeleteNode(current); - return true; - } - } - // not found - return false; - } - - nodetype *Find(const T *object) const - { - for ( nodetype *current = GetFirst(); current; current = current->GetNext() ) - { - if ( current->GetData() == object ) - return current; - } - // not found - return NULL; - } - - int IndexOf(const T *object) const - { - int n = 0; - for ( nodetype *current = GetFirst(); current; current = current->GetNext() ) - { - if ( current->GetData() == object ) - return n; - n++; - } - return wxNOT_FOUND; - } - - void Clear() - { - nodetype *current = m_nodeFirst; - while ( current ) - { - nodetype *next = current->GetNext(); - DoDeleteNode(current); - current = next; - } - m_nodeFirst = - m_nodeLast = NULL; - m_count = 0; - } - - void Reverse() - { - nodetype * node = m_nodeFirst; - nodetype* tmp; - while (node) - { - // swap prev and next pointers - tmp = node->m_next; - node->m_next = node->m_previous; - node->m_previous = tmp; - // this is the node that was next before swapping - node = tmp; - } - // swap first and last node - tmp = m_nodeFirst; m_nodeFirst = m_nodeLast; m_nodeLast = tmp; - } - - void DeleteNodes(nodetype* first, nodetype* last) - { - nodetype * node = first; - while (node != last) - { - nodetype* next = node->GetNext(); - DeleteNode(node); - node = next; - } - } - - void ForEach(wxListIterateFunction F) - { - for ( nodetype *current = GetFirst(); current; current = current->GetNext() ) - (*F)(current->GetData()); - } - - T *FirstThat(wxListIterateFunction F) - { - for ( nodetype *current = GetFirst(); current; current = current->GetNext() ) - { - if ( (*F)(current->GetData()) ) - return current->GetData(); - } - return NULL; - } - - T *LastThat(wxListIterateFunction F) - { - for ( nodetype *current = GetLast(); current; current = current->GetPrevious() ) - { - if ( (*F)(current->GetData()) ) - return current->GetData(); - } - return NULL; - } - - /* STL interface */ -public: - typedef size_t size_type; - typedef int difference_type; - typedef T* value_type; - typedef value_type& reference; - typedef const value_type& const_reference; - - class iterator - { - public: - typedef nodetype Node; - typedef iterator itor; - typedef T* value_type; - typedef value_type* ptr_type; - typedef value_type& reference; - - Node* m_node; - Node* m_init; - public: - typedef reference reference_type; - typedef ptr_type pointer_type; - - iterator(Node* node, Node* init) : m_node(node), m_init(init) {} - iterator() : m_node(NULL), m_init(NULL) { } - reference_type operator*() const - { return *m_node->GetDataPtr(); } - // ptrop - itor& operator++() { m_node = m_node->GetNext(); return *this; } - const itor operator++(int) - { itor tmp = *this; m_node = m_node->GetNext(); return tmp; } - itor& operator--() - { - m_node = m_node ? m_node->GetPrevious() : m_init; - return *this; - } - const itor operator--(int) - { - itor tmp = *this; - m_node = m_node ? m_node->GetPrevious() : m_init; - return tmp; - } - bool operator!=(const itor& it) const - { return it.m_node != m_node; } - bool operator==(const itor& it) const - { return it.m_node == m_node; } - }; - class const_iterator - { - public: - typedef nodetype Node; - typedef T* value_type; - typedef const value_type& const_reference; - typedef const_iterator itor; - typedef value_type* ptr_type; - - Node* m_node; - Node* m_init; - public: - typedef const_reference reference_type; - typedef const ptr_type pointer_type; - - const_iterator(Node* node, Node* init) - : m_node(node), m_init(init) { } - const_iterator() : m_node(NULL), m_init(NULL) { } - const_iterator(const iterator& it) - : m_node(it.m_node), m_init(it.m_init) { } - reference_type operator*() const - { return *m_node->GetDataPtr(); } - // ptrop - itor& operator++() { m_node = m_node->GetNext(); return *this; } - const itor operator++(int) - { itor tmp = *this; m_node = m_node->GetNext(); return tmp; } - itor& operator--() - { - m_node = m_node ? m_node->GetPrevious() : m_init; - return *this; - } - const itor operator--(int) - { - itor tmp = *this; - m_node = m_node ? m_node->GetPrevious() : m_init; - return tmp; - } - bool operator!=(const itor& it) const - { return it.m_node != m_node; } - bool operator==(const itor& it) const - { return it.m_node == m_node; } - }; - - class reverse_iterator - { - public: - typedef nodetype Node; - typedef T* value_type; - typedef reverse_iterator itor; - typedef value_type* ptr_type; - typedef value_type& reference; - - Node* m_node; - Node* m_init; - public: - typedef reference reference_type; - typedef ptr_type pointer_type; - - reverse_iterator(Node* node, Node* init) - : m_node(node), m_init(init) { } - reverse_iterator() : m_node(NULL), m_init(NULL) { } - reference_type operator*() const - { return *m_node->GetDataPtr(); } - // ptrop - itor& operator++() - { m_node = m_node->GetPrevious(); return *this; } - const itor operator++(int) - { itor tmp = *this; m_node = m_node->GetPrevious(); return tmp; } - itor& operator--() - { m_node = m_node ? m_node->GetNext() : m_init; return *this; } - const itor operator--(int) - { - itor tmp = *this; - m_node = m_node ? m_node->GetNext() : m_init; - return tmp; - } - bool operator!=(const itor& it) const - { return it.m_node != m_node; } - bool operator==(const itor& it) const - { return it.m_node == m_node; } - }; - - class const_reverse_iterator - { - public: - typedef nodetype Node; - typedef T* value_type; - typedef const_reverse_iterator itor; - typedef value_type* ptr_type; - typedef const value_type& const_reference; - - Node* m_node; - Node* m_init; - public: - typedef const_reference reference_type; - typedef const ptr_type pointer_type; - - const_reverse_iterator(Node* node, Node* init) - : m_node(node), m_init(init) { } - const_reverse_iterator() : m_node(NULL), m_init(NULL) { } - const_reverse_iterator(const reverse_iterator& it) - : m_node(it.m_node), m_init(it.m_init) { } - reference_type operator*() const - { return *m_node->GetDataPtr(); } - // ptrop - itor& operator++() - { m_node = m_node->GetPrevious(); return *this; } - const itor operator++(int) - { itor tmp = *this; m_node = m_node->GetPrevious(); return tmp; } - itor& operator--() - { m_node = m_node ? m_node->GetNext() : m_init; return *this;} - const itor operator--(int) - { - itor tmp = *this; - m_node = m_node ? m_node->GetNext() : m_init; - return tmp; - } - bool operator!=(const itor& it) const - { return it.m_node != m_node; } - bool operator==(const itor& it) const - { return it.m_node == m_node; } - }; - - wxEXPLICIT wxDList(size_type n, const_reference v = value_type()) - { assign(n, v); } - wxDList(const const_iterator& first, const const_iterator& last) - { assign(first, last); } - iterator begin() { return iterator(GetFirst(), GetLast()); } - const_iterator begin() const - { return const_iterator(GetFirst(), GetLast()); } - iterator end() { return iterator(NULL, GetLast()); } - const_iterator end() const { return const_iterator(NULL, GetLast()); } - reverse_iterator rbegin() - { return reverse_iterator(GetLast(), GetFirst()); } - const_reverse_iterator rbegin() const - { return const_reverse_iterator(GetLast(), GetFirst()); } - reverse_iterator rend() { return reverse_iterator(NULL, GetFirst()); } - const_reverse_iterator rend() const - { return const_reverse_iterator(NULL, GetFirst()); } - void resize(size_type n, value_type v = value_type()) - { - while (n < size()) - pop_back(); - while (n > size()) - push_back(v); - } - size_type size() const { return GetCount(); } - size_type max_size() const { return INT_MAX; } - bool empty() const { return IsEmpty(); } - reference front() { return *begin(); } - const_reference front() const { return *begin(); } - reference back() { iterator tmp = end(); return *--tmp; } - const_reference back() const { const_iterator tmp = end(); return *--tmp; } - void push_front(const_reference v = value_type()) - { Insert(GetFirst(), v); } - void pop_front() { DeleteNode(GetFirst()); } - void push_back(const_reference v = value_type()) - { Append( v ); } - void pop_back() { DeleteNode(GetLast()); } - void assign(const_iterator first, const const_iterator& last) - { - clear(); - for(; first != last; ++first) - Append(*first); - } - void assign(size_type n, const_reference v = value_type()) - { - clear(); - for(size_type i = 0; i < n; ++i) - Append(v); - } - iterator insert(const iterator& it, const_reference v) - { - if (it == end()) - Append( v ); - else - Insert(it.m_node,v); - iterator itprev(it); - return itprev--; - } - void insert(const iterator& it, size_type n, const_reference v) - { - for(size_type i = 0; i < n; ++i) - Insert(it.m_node, v); - } - void insert(const iterator& it, const_iterator first, const const_iterator& last) - { - for(; first != last; ++first) - Insert(it.m_node, *first); - } - iterator erase(const iterator& it) - { - iterator next = iterator(it.m_node->GetNext(), GetLast()); - DeleteNode(it.m_node); return next; - } - iterator erase(const iterator& first, const iterator& last) - { - iterator next = last; ++next; - DeleteNodes(first.m_node, last.m_node); - return next; - } - void clear() { Clear(); } - void splice(const iterator& it, wxDList& l, const iterator& first, const iterator& last) - { insert(it, first, last); l.erase(first, last); } - void splice(const iterator& it, wxDList& l) - { splice(it, l, l.begin(), l.end() ); } - void splice(const iterator& it, wxDList& l, const iterator& first) - { - iterator tmp = first; ++tmp; - if(it == first || it == tmp) return; - insert(it, *first); - l.erase(first); - } - void remove(const_reference v) - { DeleteObject(v); } - void reverse() - { Reverse(); } - /* void swap(list& l) - { - { size_t t = m_count; m_count = l.m_count; l.m_count = t; } - { bool t = m_destroy; m_destroy = l.m_destroy; l.m_destroy = t; } - { wxNodeBase* t = m_nodeFirst; m_nodeFirst = l.m_nodeFirst; l.m_nodeFirst = t; } - { wxNodeBase* t = m_nodeLast; m_nodeLast = l.m_nodeLast; l.m_nodeLast = t; } - { wxKeyType t = m_keyType; m_keyType = l.m_keyType; l.m_keyType = t; } - } */ -}; - -#endif // wxUSE_STD_CONTAINERS/!wxUSE_STD_CONTAINERS - -#endif // _WX_DLIST_H_ diff --git a/Source/3rd Party/wx/include/wx/dnd.h b/Source/3rd Party/wx/include/wx/dnd.h index 017745a3c..62dbac117 100644 --- a/Source/3rd Party/wx/include/wx/dnd.h +++ b/Source/3rd Party/wx/include/wx/dnd.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin, Robert Roebling // Modified by: // Created: 26.05.99 -// RCS-ID: $Id$ +// RCS-ID: $Id: dnd.h 43636 2006-11-25 14:08:27Z VZ $ // Copyright: (c) wxWidgets Team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -47,14 +47,14 @@ enum wxDragResult // return true if res indicates that something was done during a dnd operation, // i.e. is neither error nor none nor cancel -WXDLLIMPEXP_CORE bool wxIsDragResultOk(wxDragResult res); +WXDLLEXPORT bool wxIsDragResultOk(wxDragResult res); // ---------------------------------------------------------------------------- // wxDropSource is the object you need to create (and call DoDragDrop on it) // to initiate a drag-and-drop operation // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxDropSourceBase +class WXDLLEXPORT wxDropSourceBase { public: wxDropSourceBase(const wxCursor &cursorCopy = wxNullCursor, @@ -63,7 +63,7 @@ public: : m_cursorCopy(cursorCopy), m_cursorMove(cursorMove), m_cursorStop(cursorStop) - { m_data = NULL; } + { m_data = (wxDataObject *)NULL; } virtual ~wxDropSourceBase() { } // set the data which is transfered by drag and drop @@ -115,7 +115,7 @@ protected: m_cursorMove, m_cursorStop; - wxDECLARE_NO_COPY_CLASS(wxDropSourceBase); + DECLARE_NO_COPY_CLASS(wxDropSourceBase) }; // ---------------------------------------------------------------------------- @@ -129,13 +129,13 @@ protected: // OnData() is called) // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxDropTargetBase +class WXDLLEXPORT wxDropTargetBase { public: // ctor takes a pointer to heap-allocated wxDataObject which will be owned // by wxDropTarget and deleted by it automatically. If you don't give it // here, you can use SetDataObject() later. - wxDropTargetBase(wxDataObject *dataObject = NULL) + wxDropTargetBase(wxDataObject *dataObject = (wxDataObject*)NULL) { m_dataObject = dataObject; m_defaultAction = wxDragNone; } // dtor deletes our data object virtual ~wxDropTargetBase() @@ -203,7 +203,7 @@ protected: wxDataObject *m_dataObject; wxDragResult m_defaultAction; - wxDECLARE_NO_COPY_CLASS(wxDropTargetBase); + DECLARE_NO_COPY_CLASS(wxDropTargetBase) }; // ---------------------------------------------------------------------------- @@ -222,7 +222,7 @@ protected: #elif defined(__WXGTK__) #include "wx/gtk1/dnd.h" #elif defined(__WXMAC__) - #include "wx/osx/dnd.h" + #include "wx/mac/dnd.h" #elif defined(__WXPM__) #include "wx/os2/dnd.h" #endif @@ -233,7 +233,7 @@ protected: // A simple wxDropTarget derived class for text data: you only need to // override OnDropText() to get something working -class WXDLLIMPEXP_CORE wxTextDropTarget : public wxDropTarget +class WXDLLEXPORT wxTextDropTarget : public wxDropTarget { public: wxTextDropTarget(); @@ -243,11 +243,11 @@ public: virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def); private: - wxDECLARE_NO_COPY_CLASS(wxTextDropTarget); + DECLARE_NO_COPY_CLASS(wxTextDropTarget) }; // A drop target which accepts files (dragged from File Manager or Explorer) -class WXDLLIMPEXP_CORE wxFileDropTarget : public wxDropTarget +class WXDLLEXPORT wxFileDropTarget : public wxDropTarget { public: wxFileDropTarget(); @@ -259,7 +259,7 @@ public: virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def); private: - wxDECLARE_NO_COPY_CLASS(wxFileDropTarget); + DECLARE_NO_COPY_CLASS(wxFileDropTarget) }; #endif // wxUSE_DRAG_AND_DROP diff --git a/Source/3rd Party/wx/include/wx/docmdi.h b/Source/3rd Party/wx/include/wx/docmdi.h index 911e0dd7f..d4d7fcfed 100644 --- a/Source/3rd Party/wx/include/wx/docmdi.h +++ b/Source/3rd Party/wx/include/wx/docmdi.h @@ -1,11 +1,11 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/docmdi.h +// Name: docmdi.h // Purpose: Frame classes for MDI document/view applications // Author: Julian Smart +// Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ -// Copyright: (c) 1997 Julian Smart -// (c) 2010 Vadim Zeitlin +// RCS-ID: $Id: docmdi.h 41020 2006-09-05 20:47:48Z VZ $ +// Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -19,83 +19,89 @@ #include "wx/docview.h" #include "wx/mdi.h" -#ifdef __VISUALC6__ - // "non dll-interface class 'wxDocXXXFrameAny<>' used as base interface for - // dll-interface class 'wxDocMDIXXXFrame'" -- this is bogus as the template - // will be DLL-exported but only once it is used as base class here! - #pragma warning (push) - #pragma warning (disable:4275) -#endif +/* + * Use this instead of wxMDIParentFrame + */ -// Define MDI versions of the doc-view frame classes. Note that we need to -// define them as classes for wxRTTI, otherwise we could simply define them as -// typedefs. - -// ---------------------------------------------------------------------------- -// An MDI document parent frame -// ---------------------------------------------------------------------------- - -typedef - wxDocParentFrameAny wxDocMDIParentFrameBase; - -class WXDLLIMPEXP_CORE wxDocMDIParentFrame : public wxDocMDIParentFrameBase +class WXDLLEXPORT wxDocMDIParentFrame: public wxMDIParentFrame { public: - wxDocMDIParentFrame() : wxDocMDIParentFrameBase() { } + wxDocMDIParentFrame(); + wxDocMDIParentFrame(wxDocManager *manager, wxFrame *parent, wxWindowID id, + const wxString& title, const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE, const wxString& name = wxT("frame")); - wxDocMDIParentFrame(wxDocManager *manager, - wxFrame *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr) - : wxDocMDIParentFrameBase(manager, - parent, id, title, pos, size, style, name) - { - } + bool Create(wxDocManager *manager, wxFrame *parent, wxWindowID id, + const wxString& title, const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE, const wxString& name = wxT("frame")); + + // Extend event processing to search the document manager's event table + virtual bool ProcessEvent(wxEvent& event); + + wxDocManager *GetDocumentManager(void) const { return m_docManager; } + + void OnExit(wxCommandEvent& event); + void OnMRUFile(wxCommandEvent& event); + void OnCloseWindow(wxCloseEvent& event); + +protected: + void Init(); + wxDocManager *m_docManager; private: DECLARE_CLASS(wxDocMDIParentFrame) - wxDECLARE_NO_COPY_CLASS(wxDocMDIParentFrame); + DECLARE_EVENT_TABLE() + DECLARE_NO_COPY_CLASS(wxDocMDIParentFrame) }; -// ---------------------------------------------------------------------------- -// An MDI document child frame -// ---------------------------------------------------------------------------- +/* + * Use this instead of wxMDIChildFrame + */ -typedef - wxDocChildFrameAny wxDocMDIChildFrameBase; - -class WXDLLIMPEXP_CORE wxDocMDIChildFrame : public wxDocMDIChildFrameBase +class WXDLLEXPORT wxDocMDIChildFrame: public wxMDIChildFrame { public: - wxDocMDIChildFrame() { } + wxDocMDIChildFrame(); + wxDocMDIChildFrame(wxDocument *doc, wxView *view, wxMDIParentFrame *frame, wxWindowID id, + const wxString& title, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, + long type = wxDEFAULT_FRAME_STYLE, const wxString& name = wxT("frame")); + virtual ~wxDocMDIChildFrame(); - wxDocMDIChildFrame(wxDocument *doc, - wxView *view, - wxMDIParentFrame *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr) - : wxDocMDIChildFrameBase(doc, view, - parent, id, title, pos, size, style, name) - { - } + bool Create(wxDocument *doc, + wxView *view, + wxMDIParentFrame *frame, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long type = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxFrameNameStr); + + // Extend event processing to search the view's event table + virtual bool ProcessEvent(wxEvent& event); + + void OnActivate(wxActivateEvent& event); + void OnCloseWindow(wxCloseEvent& event); + + inline wxDocument *GetDocument() const { return m_childDocument; } + inline wxView *GetView(void) const { return m_childView; } + inline void SetDocument(wxDocument *doc) { m_childDocument = doc; } + inline void SetView(wxView *view) { m_childView = view; } + bool Destroy() { m_childView = (wxView *)NULL; return wxMDIChildFrame::Destroy(); } + +protected: + void Init(); + wxDocument* m_childDocument; + wxView* m_childView; private: + DECLARE_EVENT_TABLE() DECLARE_CLASS(wxDocMDIChildFrame) - wxDECLARE_NO_COPY_CLASS(wxDocMDIChildFrame); + DECLARE_NO_COPY_CLASS(wxDocMDIChildFrame) }; -#ifdef __VISUALC6__ - #pragma warning (pop) #endif + // wxUSE_MDI_ARCHITECTURE -#endif // wxUSE_MDI_ARCHITECTURE - -#endif // _WX_DOCMDI_H_ +#endif + // _WX_DOCMDI_H_ diff --git a/Source/3rd Party/wx/include/wx/docview.h b/Source/3rd Party/wx/include/wx/docview.h index cd703c997..c19bae19d 100644 --- a/Source/3rd Party/wx/include/wx/docview.h +++ b/Source/3rd Party/wx/include/wx/docview.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: docview.h 53546 2008-05-10 21:02:36Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -17,10 +17,8 @@ #if wxUSE_DOC_VIEW_ARCHITECTURE #include "wx/list.h" -#include "wx/dlist.h" #include "wx/string.h" #include "wx/frame.h" -#include "wx/filehistory.h" #if wxUSE_PRINTING_ARCHITECTURE #include "wx/print.h" @@ -33,37 +31,39 @@ class WXDLLIMPEXP_FWD_CORE wxDocTemplate; class WXDLLIMPEXP_FWD_CORE wxDocManager; class WXDLLIMPEXP_FWD_CORE wxPrintInfo; class WXDLLIMPEXP_FWD_CORE wxCommandProcessor; +class WXDLLIMPEXP_FWD_CORE wxFileHistory; class WXDLLIMPEXP_FWD_BASE wxConfigBase; -class wxDocChildFrameAnyBase; - #if wxUSE_STD_IOSTREAM #include "wx/iosfwrap.h" #else #include "wx/stream.h" #endif -// Flags for wxDocManager (can be combined). +// Document manager flags enum { - wxDOC_NEW = 1, - wxDOC_SILENT = 2 + wxDOC_SDI = 1, + wxDOC_MDI, + wxDOC_NEW, + wxDOC_SILENT, + wxDEFAULT_DOCMAN_FLAGS = wxDOC_SDI }; // Document template flags enum { wxTEMPLATE_VISIBLE = 1, - wxTEMPLATE_INVISIBLE = 2, + wxTEMPLATE_INVISIBLE, wxDEFAULT_TEMPLATE_FLAGS = wxTEMPLATE_VISIBLE }; #define wxMAX_FILE_HISTORY 9 -class WXDLLIMPEXP_CORE wxDocument : public wxEvtHandler +class WXDLLEXPORT wxDocument : public wxEvtHandler { public: - wxDocument(wxDocument *parent = NULL); + wxDocument(wxDocument *parent = (wxDocument *) NULL); virtual ~wxDocument(); // accessors @@ -76,16 +76,9 @@ public: void SetDocumentName(const wxString& name) { m_documentTypeName = name; } wxString GetDocumentName() const { return m_documentTypeName; } - // access the flag indicating whether this document had been already saved, - // SetDocumentSaved() is only used internally, don't call it bool GetDocumentSaved() const { return m_savedYet; } void SetDocumentSaved(bool saved = true) { m_savedYet = saved; } - // return true if the document hasn't been modified since the last time it - // was saved (implying that it returns false if it was never saved, even if - // the document is not modified) - bool AlreadySaved() const { return !IsModified() && GetDocumentSaved(); } - virtual bool Close(); virtual bool Save(); virtual bool SaveAs(); @@ -110,10 +103,6 @@ public: // modified to false) virtual bool OnSaveModified(); - // if you override, remember to call the default - // implementation (wxDocument::OnChangeFilename) - virtual void OnChangeFilename(bool notifyViews); - // Called by framework if created automatically by the default document // manager: gives document a chance to initialise and (usually) create a // view @@ -121,22 +110,18 @@ public: // By default, creates a base wxCommandProcessor. virtual wxCommandProcessor *OnCreateCommandProcessor(); - virtual wxCommandProcessor *GetCommandProcessor() const - { return m_commandProcessor; } - virtual void SetCommandProcessor(wxCommandProcessor *proc) - { m_commandProcessor = proc; } + virtual wxCommandProcessor *GetCommandProcessor() const { return m_commandProcessor; } + virtual void SetCommandProcessor(wxCommandProcessor *proc) { m_commandProcessor = proc; } // Called after a view is added or removed. The default implementation // deletes the document if this is there are no more views. virtual void OnChangedViewList(); - // Called from OnCloseDocument(), does nothing by default but may be - // overridden. Return value is ignored. virtual bool DeleteContents(); virtual bool Draw(wxDC&); virtual bool IsModified() const { return m_documentModified; } - virtual void Modify(bool mod); + virtual void Modify(bool mod) { m_documentModified = mod; } virtual bool AddView(wxView *view); virtual bool RemoveView(wxView *view); @@ -144,7 +129,7 @@ public: const wxList& GetViews() const { return m_documentViews; } wxView *GetFirstView() const; - virtual void UpdateAllViews(wxView *sender = NULL, wxObject *hint = NULL); + virtual void UpdateAllViews(wxView *sender = (wxView *) NULL, wxObject *hint = (wxObject *) NULL); virtual void NotifyClosing(); // Remove all views (because we're closing the document) @@ -152,31 +137,30 @@ public: // Other stuff virtual wxDocManager *GetDocumentManager() const; - virtual wxDocTemplate *GetDocumentTemplate() const - { return m_documentTemplate; } - virtual void SetDocumentTemplate(wxDocTemplate *temp) - { m_documentTemplate = temp; } + virtual wxDocTemplate *GetDocumentTemplate() const { return m_documentTemplate; } + virtual void SetDocumentTemplate(wxDocTemplate *temp) { m_documentTemplate = temp; } - // Get the document name to be shown to the user: the title if there is - // any, otherwise the filename if the document was saved and, finally, - // "unnamed" otherwise - virtual wxString GetUserReadableName() const; + // Get title, or filename if no title, else [unnamed] + // + // NB: this method will be deprecated in wxWidgets 3.0, you still need to + // override it if you need to modify the existing behaviour in this + // version but use GetUserReadableName() below if you just need to call + // it + virtual bool GetPrintableName(wxString& buf) const; -#if WXWIN_COMPATIBILITY_2_8 - // use GetUserReadableName() instead - wxDEPRECATED_BUT_USED_INTERNALLY( - virtual bool GetPrintableName(wxString& buf) const - ); -#endif // WXWIN_COMPATIBILITY_2_8 +#if wxABI_VERSION >= 20805 + wxString GetUserReadableName() const + { + wxString s; + GetPrintableName(s); + return s; + } +#endif // wxABI 2.8.5+ // Returns a window that can be used as a parent for document-related // dialogs. Override if necessary. virtual wxWindow *GetDocumentWindow() const; - // Returns true if this document is a child document corresponding to a - // part of the parent document and not a disk file as usual. - bool IsChildDocument() const { return m_documentParent != NULL; } - protected: wxList m_documentViews; wxString m_documentFile; @@ -184,36 +168,25 @@ protected: wxString m_documentTypeName; wxDocTemplate* m_documentTemplate; bool m_documentModified; - - // if the document parent is non-NULL, it's a pseudo-document corresponding - // to a part of the parent document which can't be saved or loaded - // independently of its parent and is always closed when its parent is wxDocument* m_documentParent; - wxCommandProcessor* m_commandProcessor; bool m_savedYet; // Called by OnSaveDocument and OnOpenDocument to implement standard - // Save/Load behaviour. Re-implement in derived class for custom - // behaviour. + // Save/Load behavior. Re-implement in derived class for custom + // behavior. virtual bool DoSaveDocument(const wxString& file); virtual bool DoOpenDocument(const wxString& file); - // the default implementation of GetUserReadableName() - wxString DoGetUserReadableName() const; - private: - // list of all documents whose m_documentParent is this one - typedef wxDList DocsList; - DocsList m_childDocuments; - DECLARE_ABSTRACT_CLASS(wxDocument) - wxDECLARE_NO_COPY_CLASS(wxDocument); + DECLARE_NO_COPY_CLASS(wxDocument) }; -class WXDLLIMPEXP_CORE wxView: public wxEvtHandler +class WXDLLEXPORT wxView: public wxEvtHandler { public: + // wxView(wxDocument *doc = (wxDocument *) NULL); wxView(); virtual ~wxView(); @@ -226,19 +199,16 @@ public: wxWindow *GetFrame() const { return m_viewFrame ; } void SetFrame(wxWindow *frame) { m_viewFrame = frame; } - virtual void OnActivateView(bool activate, - wxView *activeView, - wxView *deactiveView); + virtual void OnActivateView(bool activate, wxView *activeView, wxView *deactiveView); virtual void OnDraw(wxDC *dc) = 0; virtual void OnPrint(wxDC *dc, wxObject *info); - virtual void OnUpdate(wxView *sender, wxObject *hint = NULL); + virtual void OnUpdate(wxView *sender, wxObject *hint = (wxObject *) NULL); virtual void OnClosingDocument() {} virtual void OnChangeFilename(); // Called by framework if created automatically by the default document // manager class: gives view a chance to initialise - virtual bool OnCreate(wxDocument *WXUNUSED(doc), long WXUNUSED(flags)) - { return true; } + virtual bool OnCreate(wxDocument *WXUNUSED(doc), long WXUNUSED(flags)) { return true; } // Checks if the view is the last one for the document; if so, asks user // to confirm save data (if modified). If ok, deletes itself and returns @@ -248,6 +218,9 @@ public: // Override to do cleanup/veto close virtual bool OnClose(bool deleteWindow); + // Extend event processing to search the document's event table + virtual bool ProcessEvent(wxEvent& event); + // A view's window can call this to notify the view it is (in)active. // The function then notifies the document manager. virtual void Activate(bool activate); @@ -259,30 +232,18 @@ public: virtual wxPrintout *OnCreatePrintout(); #endif - // implementation only - // ------------------- - - // set the associated frame, it is used to reset its view when we're - // destroyed - void SetDocChildFrame(wxDocChildFrameAnyBase *docChildFrame); - protected: - // hook the document into event handlers chain here - virtual bool TryBefore(wxEvent& event); - wxDocument* m_viewDocument; wxString m_viewTypeName; wxWindow* m_viewFrame; - wxDocChildFrameAnyBase *m_docChildFrame; - private: DECLARE_ABSTRACT_CLASS(wxView) - wxDECLARE_NO_COPY_CLASS(wxView); + DECLARE_NO_COPY_CLASS(wxView) }; // Represents user interface (and other) properties of documents and views -class WXDLLIMPEXP_CORE wxDocTemplate: public wxObject +class WXDLLEXPORT wxDocTemplate: public wxObject { friend class WXDLLIMPEXP_FWD_CORE wxDocManager; @@ -297,8 +258,8 @@ public: const wxString& ext, const wxString& docTypeName, const wxString& viewTypeName, - wxClassInfo *docClassInfo = NULL, - wxClassInfo *viewClassInfo = NULL, + wxClassInfo *docClassInfo = (wxClassInfo *) NULL, + wxClassInfo *viewClassInfo = (wxClassInfo *)NULL, long flags = wxDEFAULT_TEMPLATE_FLAGS); virtual ~wxDocTemplate(); @@ -311,16 +272,13 @@ public: // Helper method for CreateDocument; also allows you to do your own document // creation - virtual bool InitDocument(wxDocument* doc, - const wxString& path, - long flags = 0); + virtual bool InitDocument(wxDocument* doc, const wxString& path, long flags = 0); wxString GetDefaultExtension() const { return m_defaultExt; } wxString GetDescription() const { return m_description; } wxString GetDirectory() const { return m_directory; } wxDocManager *GetDocumentManager() const { return m_documentManager; } - void SetDocumentManager(wxDocManager *manager) - { m_documentManager = manager; } + void SetDocumentManager(wxDocManager *manager) { m_documentManager = manager; } wxString GetFileFilter() const { return m_fileFilter; } long GetFlags() const { return m_flags; } virtual wxString GetViewName() const { return m_viewTypeName; } @@ -332,7 +290,7 @@ public: void SetDefaultExtension(const wxString& ext) { m_defaultExt = ext; } void SetFlags(long flags) { m_flags = flags; } - bool IsVisible() const { return (m_flags & wxTEMPLATE_VISIBLE) != 0; } + bool IsVisible() const { return ((m_flags & wxTEMPLATE_VISIBLE) == wxTEMPLATE_VISIBLE); } wxClassInfo* GetDocClassInfo() const { return m_docClassInfo; } wxClassInfo* GetViewClassInfo() const { return m_viewClassInfo; } @@ -353,26 +311,23 @@ protected: wxClassInfo* m_docClassInfo; wxClassInfo* m_viewClassInfo; - // Called by CreateDocument and CreateView to create the actual - // document/view object. - // - // By default uses the ClassInfo provided to the constructor. Override - // these functions to provide a different method of creation. + // Called by CreateDocument and CreateView to create the actual document/view object. + // By default uses the ClassInfo provided to the constructor. Override these functions + // to provide a different method of creation. virtual wxDocument *DoCreateDocument(); virtual wxView *DoCreateView(); private: DECLARE_CLASS(wxDocTemplate) - wxDECLARE_NO_COPY_CLASS(wxDocTemplate); + DECLARE_NO_COPY_CLASS(wxDocTemplate) }; // One object of this class may be created in an application, to manage all // the templates and documents. -class WXDLLIMPEXP_CORE wxDocManager: public wxEvtHandler +class WXDLLEXPORT wxDocManager: public wxEvtHandler { public: - // NB: flags are unused, don't pass wxDOC_XXX to this ctor - wxDocManager(long flags = 0, bool initialize = true); + wxDocManager(long flags = wxDEFAULT_DOCMAN_FLAGS, bool initialize = true); virtual ~wxDocManager(); virtual bool Initialize(); @@ -385,18 +340,14 @@ public: void OnFileRevert(wxCommandEvent& event); void OnFileSave(wxCommandEvent& event); void OnFileSaveAs(wxCommandEvent& event); - void OnMRUFile(wxCommandEvent& event); -#if wxUSE_PRINTING_ARCHITECTURE void OnPrint(wxCommandEvent& event); void OnPreview(wxCommandEvent& event); - void OnPageSetup(wxCommandEvent& event); -#endif // wxUSE_PRINTING_ARCHITECTURE void OnUndo(wxCommandEvent& event); void OnRedo(wxCommandEvent& event); // Handlers for UI update commands void OnUpdateFileOpen(wxUpdateUIEvent& event); - void OnUpdateDisableIfNoDoc(wxUpdateUIEvent& event); + void OnUpdateFileClose(wxUpdateUIEvent& event); void OnUpdateFileRevert(wxUpdateUIEvent& event); void OnUpdateFileNew(wxUpdateUIEvent& event); void OnUpdateFileSave(wxUpdateUIEvent& event); @@ -404,16 +355,17 @@ public: void OnUpdateUndo(wxUpdateUIEvent& event); void OnUpdateRedo(wxUpdateUIEvent& event); + void OnUpdatePrint(wxUpdateUIEvent& event); + void OnUpdatePreview(wxUpdateUIEvent& event); + + // Extend event processing to search the view's event table + virtual bool ProcessEvent(wxEvent& event); + // called when file format detection didn't work, can be overridden to do // something in this case virtual void OnOpenFileFailure() { } virtual wxDocument *CreateDocument(const wxString& path, long flags = 0); - - // wrapper around CreateDocument() with a more clear name - wxDocument *CreateNewDocument() - { return CreateDocument(wxString(), wxDOC_NEW); } - virtual wxView *CreateView(wxDocument *doc, long flags = 0); virtual void DeleteTemplate(wxDocTemplate *temp, long flags = 0); virtual bool FlushDoc(wxDocument *doc); @@ -429,9 +381,6 @@ public: void AssociateTemplate(wxDocTemplate *temp); void DisassociateTemplate(wxDocTemplate *temp); - // Find template from document class info, may return NULL. - wxDocTemplate* FindTemplate(const wxClassInfo* documentClassInfo); - wxDocument *GetCurrentDocument() const; void SetMaxDocsOpen(int n) { m_maxDocsOpen = n; } @@ -453,14 +402,27 @@ public: // Views or windows should inform the document manager // when a view is going in or out of focus virtual void ActivateView(wxView *view, bool activate = true); - virtual wxView *GetCurrentView() const { return m_currentView; } + virtual wxView *GetCurrentView() const; wxList& GetDocuments() { return m_docs; } wxList& GetTemplates() { return m_templates; } - // Return the default name for a new document (by default returns strings - // in the form "unnamed " but can be overridden) - virtual wxString MakeNewDocumentName(); + // Make a default document name + // + // NB: this method is renamed to MakeNewDocumentName() in wx 3.0, you still + // need to override it if your code needs to customize the default name + // generation but if you just use it from your code, prefer the version + // below which is forward-compatible with wx 3.0 + virtual bool MakeDefaultName(wxString& buf); + +#if wxABI_VERSION >= 20808 + wxString MakeNewDocumentName() const + { + wxString s; + wx_const_cast(wxDocManager *, this)->MakeDefaultName(s); + return s; + } +#endif // wx ABI >= 2.8.8 // Make a frame title (override this to do something different) virtual wxString MakeFrameTitle(wxDocument* doc); @@ -476,68 +438,26 @@ public: virtual void FileHistoryUseMenu(wxMenu *menu); virtual void FileHistoryRemoveMenu(wxMenu *menu); #if wxUSE_CONFIG - virtual void FileHistoryLoad(const wxConfigBase& config); + virtual void FileHistoryLoad(wxConfigBase& config); virtual void FileHistorySave(wxConfigBase& config); #endif // wxUSE_CONFIG virtual void FileHistoryAddFilesToMenu(); virtual void FileHistoryAddFilesToMenu(wxMenu* menu); - wxString GetLastDirectory() const; + wxString GetLastDirectory() const { return m_lastDirectory; } void SetLastDirectory(const wxString& dir) { m_lastDirectory = dir; } // Get the current document manager static wxDocManager* GetDocumentManager() { return sm_docManager; } -#if wxUSE_PRINTING_ARCHITECTURE - wxPageSetupDialogData& GetPageSetupDialogData() - { return m_pageSetupDialogData; } - const wxPageSetupDialogData& GetPageSetupDialogData() const - { return m_pageSetupDialogData; } -#endif // wxUSE_PRINTING_ARCHITECTURE - -#if WXWIN_COMPATIBILITY_2_8 - // deprecated, override GetDefaultName() instead - wxDEPRECATED_BUT_USED_INTERNALLY( - virtual bool MakeDefaultName(wxString& buf) - ); -#endif - #if WXWIN_COMPATIBILITY_2_6 // deprecated, use GetHistoryFilesCount() instead wxDEPRECATED( size_t GetNoHistoryFiles() const ); #endif // WXWIN_COMPATIBILITY_2_6 - protected: - // Called when a file selected from the MRU list doesn't exist any more. - // The default behaviour is to remove the file from the MRU and notify the - // user about it but this method can be overridden to customize it. - virtual void OnMRUFileNotExist(unsigned n, const wxString& filename); - - // Open the MRU file with the given index in our associated file history. - void DoOpenMRUFile(unsigned n); -#if wxUSE_PRINTING_ARCHITECTURE - virtual wxPreviewFrame* CreatePreviewFrame(wxPrintPreviewBase* preview, - wxWindow *parent, - const wxString& title); -#endif // wxUSE_PRINTING_ARCHITECTURE - - // hook the currently active view into event handlers chain here - virtual bool TryBefore(wxEvent& event); - - // return the command processor for the current document, if any - wxCommandProcessor *GetCurrentCommandProcessor() const; - - // this method tries to find an active view harder than GetCurrentView(): - // if the latter is NULL, it also checks if we don't have just a single - // view and returns it then - wxView *GetActiveView() const; - - // activate the first view of the given document if any - void ActivateDocument(wxDocument *doc); - - + long m_flags; int m_defaultDocumentNameCounter; int m_maxDocsOpen; wxList m_docs; @@ -547,13 +467,9 @@ protected: wxString m_lastDirectory; static wxDocManager* sm_docManager; -#if wxUSE_PRINTING_ARCHITECTURE - wxPageSetupDialogData m_pageSetupDialogData; -#endif // wxUSE_PRINTING_ARCHITECTURE - DECLARE_EVENT_TABLE() DECLARE_DYNAMIC_CLASS(wxDocManager) - wxDECLARE_NO_COPY_CLASS(wxDocManager); + DECLARE_NO_COPY_CLASS(wxDocManager) }; #if WXWIN_COMPATIBILITY_2_6 @@ -564,282 +480,61 @@ inline size_t wxDocManager::GetNoHistoryFiles() const #endif // WXWIN_COMPATIBILITY_2_6 // ---------------------------------------------------------------------------- -// Base class for child frames -- this is what wxView renders itself into -// -// Notice that this is a mix-in class so it doesn't derive from wxWindow, only -// wxDocChildFrameAny does +// A default child frame // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxDocChildFrameAnyBase +class WXDLLEXPORT wxDocChildFrame : public wxFrame { public: - // default ctor, use Create() after it - wxDocChildFrameAnyBase() - { - m_childDocument = NULL; - m_childView = NULL; - m_win = NULL; - } + wxDocChildFrame(wxDocument *doc, + wxView *view, + wxFrame *frame, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long type = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxT("frame")); + virtual ~wxDocChildFrame(){} - // full ctor equivalent to using the default one and Create(0 - wxDocChildFrameAnyBase(wxDocument *doc, wxView *view, wxWindow *win) - { - Create(doc, view, win); - } + // Extend event processing to search the view's event table + virtual bool ProcessEvent(wxEvent& event); - // method which must be called for an object created using the default ctor - // - // note that it returns bool just for consistency with Create() methods in - // other classes, we never return false from here - bool Create(wxDocument *doc, wxView *view, wxWindow *win) - { - m_childDocument = doc; - m_childView = view; - m_win = win; - - if ( view ) - view->SetDocChildFrame(this); - - return true; - } - - // dtor doesn't need to be virtual, an object should never be destroyed via - // a pointer to this class - ~wxDocChildFrameAnyBase() - { - // prevent the view from deleting us if we're being deleted directly - // (and not via Close() + Destroy()) - if ( m_childView ) - m_childView->SetDocChildFrame(NULL); - } + void OnActivate(wxActivateEvent& event); + void OnCloseWindow(wxCloseEvent& event); wxDocument *GetDocument() const { return m_childDocument; } wxView *GetView() const { return m_childView; } void SetDocument(wxDocument *doc) { m_childDocument = doc; } void SetView(wxView *view) { m_childView = view; } - - wxWindow *GetWindow() const { return m_win; } + bool Destroy() { m_childView = (wxView *)NULL; return wxFrame::Destroy(); } protected: - // we're not a wxEvtHandler but we provide this wxEvtHandler-like function - // which is called from TryBefore() of the derived classes to give our view - // a chance to process the message before the frame event handlers are used - bool TryProcessEvent(wxEvent& event) - { - return m_childView && m_childView->ProcessEventLocally(event); - } - - // called from EVT_CLOSE handler in the frame: check if we can close and do - // cleanup if so; veto the event otherwise - bool CloseView(wxCloseEvent& event); - - wxDocument* m_childDocument; wxView* m_childView; - // the associated window: having it here is not terribly elegant but it - // allows us to avoid having any virtual functions in this class - wxWindow* m_win; - - - wxDECLARE_NO_COPY_CLASS(wxDocChildFrameAnyBase); -}; - -// ---------------------------------------------------------------------------- -// Template implementing child frame concept using the given wxFrame-like class -// -// This is used to define wxDocChildFrame and wxDocMDIChildFrame: ChildFrame is -// a wxFrame or wxMDIChildFrame (although in theory it could be any wxWindow- -// derived class as long as it provided a ctor with the same signature as -// wxFrame and OnActivate() method) and ParentFrame is either wxFrame or -// wxMDIParentFrame. -// ---------------------------------------------------------------------------- - -template -class WXDLLIMPEXP_CORE wxDocChildFrameAny : public ChildFrame, - public wxDocChildFrameAnyBase -{ -public: - typedef ChildFrame BaseClass; - - // default ctor, use Create after it - wxDocChildFrameAny() { } - - // ctor for a frame showing the given view of the specified document - wxDocChildFrameAny(wxDocument *doc, - wxView *view, - ParentFrame *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr) - { - Create(doc, view, parent, id, title, pos, size, style, name); - } - - bool Create(wxDocument *doc, - wxView *view, - ParentFrame *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr) - { - if ( !wxDocChildFrameAnyBase::Create(doc, view, this) ) - return false; - - if ( !BaseClass::Create(parent, id, title, pos, size, style, name) ) - return false; - - this->Connect(wxEVT_ACTIVATE, - wxActivateEventHandler(wxDocChildFrameAny::OnActivate)); - this->Connect(wxEVT_CLOSE_WINDOW, - wxCloseEventHandler(wxDocChildFrameAny::OnCloseWindow)); - - return true; - } - - virtual bool Destroy() - { - // FIXME: why exactly do we do this? to avoid activation events during - // destructions maybe? - m_childView = NULL; - return BaseClass::Destroy(); - } - -protected: - // hook the child view into event handlers chain here - virtual bool TryBefore(wxEvent& event) - { - return TryProcessEvent(event) || BaseClass::TryBefore(event); - } - -private: - void OnActivate(wxActivateEvent& event) - { - BaseClass::OnActivate(event); - - if ( m_childView ) - m_childView->Activate(event.GetActive()); - } - - void OnCloseWindow(wxCloseEvent& event) - { - if ( CloseView(event) ) - Destroy(); - //else: vetoed - } - - wxDECLARE_NO_COPY_TEMPLATE_CLASS_2(wxDocChildFrameAny, - ChildFrame, ParentFrame); -}; - -// ---------------------------------------------------------------------------- -// A default child frame: we need to define it as a class just for wxRTTI, -// otherwise we could simply typedef it -// ---------------------------------------------------------------------------- - -#ifdef __VISUALC6__ - // "non dll-interface class 'wxDocChildFrameAny<>' used as base interface - // for dll-interface class 'wxDocChildFrame'" -- this is bogus as the - // template will be DLL-exported but only once it is used as base class - // here! - #pragma warning (push) - #pragma warning (disable:4275) -#endif - -typedef wxDocChildFrameAny wxDocChildFrameBase; - -class WXDLLIMPEXP_CORE wxDocChildFrame : public wxDocChildFrameBase -{ -public: - wxDocChildFrame() - { - } - - wxDocChildFrame(wxDocument *doc, - wxView *view, - wxFrame *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr) - : wxDocChildFrameBase(doc, view, - parent, id, title, pos, size, style, name) - { - } - - bool Create(wxDocument *doc, - wxView *view, - wxFrame *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr) - { - return wxDocChildFrameBase::Create - ( - doc, view, - parent, id, title, pos, size, style, name - ); - } - private: DECLARE_CLASS(wxDocChildFrame) - wxDECLARE_NO_COPY_CLASS(wxDocChildFrame); + DECLARE_EVENT_TABLE() + DECLARE_NO_COPY_CLASS(wxDocChildFrame) }; // ---------------------------------------------------------------------------- -// wxDocParentFrame and related classes. -// -// As with wxDocChildFrame we define a template base class used by both normal -// and MDI versions +// A default parent frame // ---------------------------------------------------------------------------- -// Base class containing type-independent code of wxDocParentFrameAny -// -// Similarly to wxDocChildFrameAnyBase, this class is a mix-in and doesn't -// derive from wxWindow. -class WXDLLIMPEXP_CORE wxDocParentFrameAnyBase +class WXDLLEXPORT wxDocParentFrame : public wxFrame { public: - wxDocParentFrameAnyBase() { m_docManager = NULL; } - - wxDocManager *GetDocumentManager() const { return m_docManager; } - -protected: - wxDocManager *m_docManager; - - wxDECLARE_NO_COPY_CLASS(wxDocParentFrameAnyBase); -}; - -// This is similar to wxDocChildFrameAny and is used to provide common -// implementation for both wxDocParentFrame and wxDocMDIParentFrame -template -class WXDLLIMPEXP_CORE wxDocParentFrameAny : public BaseFrame, - public wxDocParentFrameAnyBase -{ -public: - wxDocParentFrameAny() { } - wxDocParentFrameAny(wxDocManager *manager, - wxFrame *frame, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr) - { - Create(manager, frame, id, title, pos, size, style, name); - } + wxDocParentFrame(); + wxDocParentFrame(wxDocManager *manager, + wxFrame *frame, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxFrameNameStr); bool Create(wxDocManager *manager, wxFrame *frame, @@ -848,115 +543,40 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr) - { - m_docManager = manager; + const wxString& name = wxFrameNameStr); - if ( !BaseFrame::Create(frame, id, title, pos, size, style, name) ) - return false; + // Extend event processing to search the document manager's event table + virtual bool ProcessEvent(wxEvent& event); - this->Connect(wxID_EXIT, wxEVT_COMMAND_MENU_SELECTED, - wxCommandEventHandler(wxDocParentFrameAny::OnExit)); - this->Connect(wxEVT_CLOSE_WINDOW, - wxCloseEventHandler(wxDocParentFrameAny::OnCloseWindow)); + wxDocManager *GetDocumentManager() const { return m_docManager; } - return true; - } + void OnExit(wxCommandEvent& event); + void OnMRUFile(wxCommandEvent& event); + void OnCloseWindow(wxCloseEvent& event); protected: - // hook the document manager into event handling chain here - virtual bool TryBefore(wxEvent& event) - { - if ( m_docManager && m_docManager->ProcessEventLocally(event) ) - return true; - - return BaseFrame::TryBefore(event); - } - -private: - void OnExit(wxCommandEvent& WXUNUSED(event)) - { - this->Close(); - } - - void OnCloseWindow(wxCloseEvent& event) - { - if ( m_docManager && !m_docManager->Clear(!event.CanVeto()) ) - { - // The user decided not to close finally, abort. - event.Veto(); - } - else - { - // Just skip the event, base class handler will destroy the window. - event.Skip(); - } - } - - - wxDECLARE_NO_COPY_CLASS(wxDocParentFrameAny); -}; - -typedef wxDocParentFrameAny wxDocParentFrameBase; - -class WXDLLIMPEXP_CORE wxDocParentFrame : public wxDocParentFrameBase -{ -public: - wxDocParentFrame() : wxDocParentFrameBase() { } - - wxDocParentFrame(wxDocManager *manager, - wxFrame *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr) - : wxDocParentFrameBase(manager, - parent, id, title, pos, size, style, name) - { - } - - bool Create(wxDocManager *manager, - wxFrame *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr) - { - return wxDocParentFrameBase::Create(manager, - parent, id, title, - pos, size, style, name); - } + wxDocManager *m_docManager; private: + typedef wxFrame base_type; DECLARE_CLASS(wxDocParentFrame) - wxDECLARE_NO_COPY_CLASS(wxDocParentFrame); + DECLARE_EVENT_TABLE() + DECLARE_NO_COPY_CLASS(wxDocParentFrame) }; -#ifdef __VISUALC6__ - // reenable warning 4275 - #pragma warning (pop) -#endif - // ---------------------------------------------------------------------------- // Provide simple default printing facilities // ---------------------------------------------------------------------------- #if wxUSE_PRINTING_ARCHITECTURE -class WXDLLIMPEXP_CORE wxDocPrintout : public wxPrintout +class WXDLLEXPORT wxDocPrintout : public wxPrintout { public: - wxDocPrintout(wxView *view = NULL, const wxString& title = wxString()); - - // implement wxPrintout methods - virtual bool OnPrintPage(int page); - virtual bool HasPage(int page); - virtual bool OnBeginDocument(int startPage, int endPage); - virtual void GetPageInfo(int *minPage, int *maxPage, - int *selPageFrom, int *selPageTo); + wxDocPrintout(wxView *view = (wxView *) NULL, const wxString& title = wxT("Printout")); + bool OnPrintPage(int page); + bool HasPage(int page); + bool OnBeginDocument(int startPage, int endPage); + void GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo); virtual wxView *GetView() { return m_printoutView; } @@ -965,36 +585,91 @@ protected: private: DECLARE_DYNAMIC_CLASS(wxDocPrintout) - wxDECLARE_NO_COPY_CLASS(wxDocPrintout); + DECLARE_NO_COPY_CLASS(wxDocPrintout) }; #endif // wxUSE_PRINTING_ARCHITECTURE +// ---------------------------------------------------------------------------- +// File history management +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxFileHistory : public wxObject +{ +public: + wxFileHistory(size_t maxFiles = 9, wxWindowID idBase = wxID_FILE1); + virtual ~wxFileHistory(); + + // Operations + virtual void AddFileToHistory(const wxString& file); + virtual void RemoveFileFromHistory(size_t i); + virtual int GetMaxFiles() const { return (int)m_fileMaxFiles; } + virtual void UseMenu(wxMenu *menu); + + // Remove menu from the list (MDI child may be closing) + virtual void RemoveMenu(wxMenu *menu); + +#if wxUSE_CONFIG + virtual void Load(wxConfigBase& config); + virtual void Save(wxConfigBase& config); +#endif // wxUSE_CONFIG + + virtual void AddFilesToMenu(); + virtual void AddFilesToMenu(wxMenu* menu); // Single menu + + // Accessors + virtual wxString GetHistoryFile(size_t i) const; + virtual size_t GetCount() const { return m_fileHistoryN; } + + const wxList& GetMenus() const { return m_fileMenus; } + +#if wxABI_VERSION >= 20802 + // Set/get base id + void SetBaseId(wxWindowID baseId) { m_idBase = baseId; } + wxWindowID GetBaseId() const { return m_idBase; } +#endif // wxABI 2.8.2+ + +#if WXWIN_COMPATIBILITY_2_6 + // deprecated, use GetCount() instead + wxDEPRECATED( size_t GetNoHistoryFiles() const ); +#endif // WXWIN_COMPATIBILITY_2_6 + +protected: + // Last n files + wxChar** m_fileHistory; + // Number of files saved + size_t m_fileHistoryN; + // Menus to maintain (may need several for an MDI app) + wxList m_fileMenus; + // Max files to maintain + size_t m_fileMaxFiles; + +private: + // The ID of the first history menu item (Doesn't have to be wxID_FILE1) + wxWindowID m_idBase; + + DECLARE_DYNAMIC_CLASS(wxFileHistory) + DECLARE_NO_COPY_CLASS(wxFileHistory) +}; + +#if WXWIN_COMPATIBILITY_2_6 +inline size_t wxFileHistory::GetNoHistoryFiles() const +{ + return m_fileHistoryN; +} +#endif // WXWIN_COMPATIBILITY_2_6 + +#if wxUSE_STD_IOSTREAM // For compatibility with existing file formats: // converts from/to a stream to/from a temporary file. -#if wxUSE_STD_IOSTREAM -bool WXDLLIMPEXP_CORE -wxTransferFileToStream(const wxString& filename, wxSTD ostream& stream); -bool WXDLLIMPEXP_CORE -wxTransferStreamToFile(wxSTD istream& stream, const wxString& filename); +bool WXDLLEXPORT wxTransferFileToStream(const wxString& filename, wxSTD ostream& stream); +bool WXDLLEXPORT wxTransferStreamToFile(wxSTD istream& stream, const wxString& filename); #else -bool WXDLLIMPEXP_CORE -wxTransferFileToStream(const wxString& filename, wxOutputStream& stream); -bool WXDLLIMPEXP_CORE -wxTransferStreamToFile(wxInputStream& stream, const wxString& filename); +// For compatibility with existing file formats: +// converts from/to a stream to/from a temporary file. +bool WXDLLEXPORT wxTransferFileToStream(const wxString& filename, wxOutputStream& stream); +bool WXDLLEXPORT wxTransferStreamToFile(wxInputStream& stream, const wxString& filename); #endif // wxUSE_STD_IOSTREAM - -// these flags are not used anywhere by wxWidgets and kept only for an unlikely -// case of existing user code using them for its own purposes -#if WXWIN_COMPATIBILITY_2_8 -enum -{ - wxDOC_SDI = 1, - wxDOC_MDI, - wxDEFAULT_DOCMAN_FLAGS = wxDOC_SDI -}; -#endif // WXWIN_COMPATIBILITY_2_8 - #endif // wxUSE_DOC_VIEW_ARCHITECTURE #endif // _WX_DOCH__ diff --git a/Source/3rd Party/wx/include/wx/dynarray.h b/Source/3rd Party/wx/include/wx/dynarray.h index 0414f2dd2..3cde91ae7 100644 --- a/Source/3rd Party/wx/include/wx/dynarray.h +++ b/Source/3rd Party/wx/include/wx/dynarray.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 12.09.97 -// RCS-ID: $Id$ +// RCS-ID: $Id: dynarray.h 45498 2007-04-16 13:03:05Z VZ $ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -14,7 +14,7 @@ #include "wx/defs.h" -#if wxUSE_STD_CONTAINERS +#if wxUSE_STL #include "wx/beforestd.h" #include #include @@ -54,8 +54,6 @@ */ #define WX_ARRAY_DEFAULT_INITIAL_SIZE (16) -#define _WX_ERROR_REMOVE "removing inexistent element in wxArray::Remove" - // ---------------------------------------------------------------------------- // types // ---------------------------------------------------------------------------- @@ -81,10 +79,10 @@ typedef int (wxCMPFUNC_CONV *CMPFUNC)(const void* pItem1, const void* pItem2); // you cast "SomeArray *" as "BaseArray *" and then delete it) // ---------------------------------------------------------------------------- -#if wxUSE_STD_CONTAINERS +#if wxUSE_STL template -class wxArray_SortFunction +class WXDLLIMPEXP_BASE wxArray_SortFunction { public: typedef int (wxCMPFUNC_CONV *CMPFUNC)(T* pItem1, T* pItem2); @@ -97,7 +95,7 @@ private: }; template -class wxSortedArray_SortFunction +class WXDLLIMPEXP_BASE wxSortedArray_SortFunction { public: typedef F CMPFUNC; @@ -121,78 +119,32 @@ classexp name : public std::vector \ typedef predicate::CMPFUNC SCMPFUNC; \ public: \ typedef wxArray_SortFunction::CMPFUNC CMPFUNC; \ - \ public: \ - typedef T base_type; \ - \ - name() : std::vector() { } \ - name(size_type n) : std::vector(n) { } \ - name(size_type n, const_reference v) : std::vector(n, v) { } \ - \ void Empty() { clear(); } \ void Clear() { clear(); } \ void Alloc(size_t uiSize) { reserve(uiSize); } \ - void Shrink() { name tmp(*this); swap(tmp); } \ + void Shrink(); \ \ size_t GetCount() const { return size(); } \ void SetCount(size_t n, T v = T()) { resize(n, v); } \ bool IsEmpty() const { return empty(); } \ size_t Count() const { return size(); } \ \ + typedef T base_type; \ + \ +protected: \ T& Item(size_t uiIndex) const \ { wxASSERT( uiIndex < size() ); return (T&)operator[](uiIndex); } \ - T& Last() const { return Item(size() - 1); } \ \ - int Index(T item, bool bFromEnd = false) const \ - { \ - if ( bFromEnd ) \ - { \ - const const_reverse_iterator b = rbegin(), \ - e = rend(); \ - for ( const_reverse_iterator i = b; i != e; ++i ) \ - if ( *i == item ) \ - return (int)(e - i - 1); \ - } \ - else \ - { \ - const const_iterator b = begin(), \ - e = end(); \ - for ( const_iterator i = b; i != e; ++i ) \ - if ( *i == item ) \ - return (int)(i - b); \ - } \ - \ - return wxNOT_FOUND; \ - } \ - int Index(T lItem, CMPFUNC fnCompare) const \ - { \ - Predicate p((SCMPFUNC)fnCompare); \ - const_iterator i = std::lower_bound(begin(), end(), lItem, p);\ - return i != end() && !p(lItem, *i) ? (int)(i - begin()) \ - : wxNOT_FOUND; \ - } \ - size_t IndexForInsert(T lItem, CMPFUNC fnCompare) const \ - { \ - Predicate p((SCMPFUNC)fnCompare); \ - const_iterator i = std::lower_bound(begin(), end(), lItem, p);\ - return i - begin(); \ - } \ + int Index(T e, bool bFromEnd = false) const; \ + int Index(T lItem, CMPFUNC fnCompare) const; \ + size_t IndexForInsert(T lItem, CMPFUNC fnCompare) const; \ void Add(T lItem, size_t nInsert = 1) \ { insert(end(), nInsert, lItem); } \ - size_t Add(T lItem, CMPFUNC fnCompare) \ - { \ - size_t n = IndexForInsert(lItem, fnCompare); \ - Insert(lItem, n); \ - return n; \ - } \ + size_t Add(T lItem, CMPFUNC fnCompare); \ void Insert(T lItem, size_t uiIndex, size_t nInsert = 1) \ { insert(begin() + uiIndex, nInsert, lItem); } \ - void Remove(T lItem) \ - { \ - int n = Index(lItem); \ - wxCHECK_RET( n != wxNOT_FOUND, _WX_ERROR_REMOVE ); \ - RemoveAt((size_t)n); \ - } \ + void Remove(T lItem); \ void RemoveAt(size_t uiIndex, size_t nRemove = 1) \ { erase(begin() + uiIndex, begin() + uiIndex + nRemove); } \ \ @@ -203,12 +155,12 @@ public: \ } \ } -#else // if !wxUSE_STD_CONTAINERS +#else // if !wxUSE_STL #define _WX_DECLARE_BASEARRAY(T, name, classexp) \ classexp name \ { \ - typedef CMPFUNC SCMPFUNC; /* for compatibility wuth wxUSE_STD_CONTAINERS */ \ + typedef CMPFUNC SCMPFUNC; /* for compatibility wuth wxUSE_STL */ \ public: \ name(); \ name(const name& array); \ @@ -282,13 +234,6 @@ protected: \ const_iterator begin() const { return m_pItems; } \ const_iterator end() const { return m_pItems + m_nCount; } \ \ - void swap(name& other) \ - { \ - wxSwap(m_nSize, other.m_nSize); \ - wxSwap(m_nCount, other.m_nCount); \ - wxSwap(m_pItems, other.m_pItems); \ - } \ - \ /* the following functions may be made directly public because */ \ /* they don't use the type of the elements at all */ \ public: \ @@ -307,7 +252,7 @@ private: \ T *m_pItems; \ } -#endif // !wxUSE_STD_CONTAINERS +#endif // !wxUSE_STL // ============================================================================ // The private helper macros containing the core of the array classes @@ -320,22 +265,53 @@ private: \ // so using a temporary variable instead. // // The classes need a (even trivial) ~name() to link under Mac X +// +// _WX_ERROR_REMOVE is needed to resolve the name conflict between the wxT() +// macro and T typedef: we can't use wxT() inside WX_DEFINE_ARRAY! + +#define _WX_ERROR_REMOVE wxT("removing inexisting element in wxArray::Remove") // ---------------------------------------------------------------------------- // _WX_DEFINE_TYPEARRAY: array for simple types // ---------------------------------------------------------------------------- -#if wxUSE_STD_CONTAINERS +#if wxUSE_STL -// in STL case we don't need the entire base arrays hack as standard container -// don't suffer from alignment/storage problems as our home-grown do #define _WX_DEFINE_TYPEARRAY(T, name, base, classexp) \ - _WX_DECLARE_BASEARRAY(T, name, classexp) +typedef int (CMPFUNC_CONV *CMPFUNC##T)(T *pItem1, T *pItem2); \ +classexp name : public base \ +{ \ +public: \ + T& operator[](size_t uiIndex) const \ + { return (T&)(base::operator[](uiIndex)); } \ + T& Item(size_t uiIndex) const \ + { return (T&)/*const cast*/base::operator[](uiIndex); } \ + T& Last() const \ + { return Item(Count() - 1); } \ + \ + int Index(T e, bool bFromEnd = false) const \ + { return base::Index(e, bFromEnd); } \ + \ + void Add(T lItem, size_t nInsert = 1) \ + { insert(end(), nInsert, lItem); } \ + void Insert(T lItem, size_t uiIndex, size_t nInsert = 1) \ + { insert(begin() + uiIndex, nInsert, lItem); } \ + \ + void RemoveAt(size_t uiIndex, size_t nRemove = 1) \ + { base::RemoveAt(uiIndex, nRemove); } \ + void Remove(T lItem) \ + { int iIndex = Index(lItem); \ + wxCHECK2_MSG( iIndex != wxNOT_FOUND, return, \ + _WX_ERROR_REMOVE); \ + RemoveAt((size_t)iIndex); } \ + \ + void Sort(CMPFUNC##T fCmp) { base::Sort((CMPFUNC)fCmp); } \ +} #define _WX_DEFINE_TYPEARRAY_PTR(T, name, base, classexp) \ _WX_DEFINE_TYPEARRAY(T, name, base, classexp) -#else // if !wxUSE_STD_CONTAINERS +#else // if !wxUSE_STL // common declaration used by both _WX_DEFINE_TYPEARRAY and // _WX_DEFINE_TYPEARRAY_PTR @@ -350,12 +326,17 @@ public: \ name() { } \ ~name() { } \ \ + name& operator=(const name& src) \ + { base* temp = (base*) this; \ + (*temp) = ((const base&)src); \ + return *this; } \ + \ T& operator[](size_t uiIndex) const \ { return (T&)(base::operator[](uiIndex)); } \ T& Item(size_t uiIndex) const \ { return (T&)(base::operator[](uiIndex)); } \ T& Last() const \ - { return (T&)(base::operator[](GetCount() - 1)); } \ + { return (T&)(base::operator[](Count() - 1)); } \ \ int Index(T lItem, bool bFromEnd = false) const \ { return base::Index((base_type)lItem, bFromEnd); } \ @@ -369,7 +350,8 @@ public: \ { base::RemoveAt(uiIndex, nRemove); } \ void Remove(T lItem) \ { int iIndex = Index(lItem); \ - wxCHECK_RET( iIndex != wxNOT_FOUND, _WX_ERROR_REMOVE); \ + wxCHECK2_MSG( iIndex != wxNOT_FOUND, return, \ + _WX_ERROR_REMOVE); \ base::RemoveAt((size_t)iIndex); } \ \ void Sort(CMPFUNC##T fCmp) { base::Sort((CMPFUNC)fCmp); } \ @@ -456,7 +438,6 @@ public: \ bool operator !=(const itor& it) const { return m_ptr != it.m_ptr; }\ }; \ \ - name(size_type n) { assign(n, value_type()); } \ name(size_type n, const_reference v) { assign(n, v); } \ name(const_iterator first, const_iterator last) \ { assign(first, last); } \ @@ -494,7 +475,6 @@ public: \ void reserve(size_type n) { base::reserve(n); } \ void resize(size_type n, value_type v = value_type()) \ { base::resize(n, v); } \ - void swap(name& other) { base::swap(other); } \ } #define _WX_PTROP pointer operator->() const { return m_ptr; } @@ -505,7 +485,7 @@ public: \ #define _WX_DEFINE_TYPEARRAY_PTR(T, name, base, classexp) \ _WX_DEFINE_TYPEARRAY_HELPER(T, name, base, classexp, _WX_PTROP_NONE) -#endif // !wxUSE_STD_CONTAINERS +#endif // !wxUSE_STL // ---------------------------------------------------------------------------- // _WX_DEFINE_SORTED_TYPEARRAY: sorted array for simple data types @@ -546,14 +526,13 @@ public: \ \ size_t Add(T lItem) \ { return base::Add(lItem, (CMPFUNC)m_fnCompare); } \ - void push_back(T lItem) \ - { Add(lItem); } \ \ void RemoveAt(size_t uiIndex, size_t nRemove = 1) \ { base::erase(begin() + uiIndex, begin() + uiIndex + nRemove); } \ void Remove(T lItem) \ { int iIndex = Index(lItem); \ - wxCHECK_RET( iIndex != wxNOT_FOUND, _WX_ERROR_REMOVE ); \ + wxCHECK2_MSG( iIndex != wxNOT_FOUND, return, \ + _WX_ERROR_REMOVE ); \ base::erase(begin() + iIndex); } \ \ private: \ @@ -578,8 +557,7 @@ public: \ \ ~name(); \ \ - void Alloc(size_t count) { base::reserve(count); } \ - void reserve(size_t count) { base::reserve(count); } \ + void Alloc(size_t count) { reserve(count); } \ size_t GetCount() const { return base_array::size(); } \ size_t size() const { return base_array::size(); } \ bool IsEmpty() const { return base_array::empty(); } \ @@ -638,7 +616,7 @@ private: \ // that wants to export a wxArray daubed with your own import/export goo. // // Finally, you can define the macro below as something special to modify the -// arrays defined by a simple WX_FOO_ARRAY as well. By default is empty. +// arrays defined by a simple WX_FOO_ARRAY as well. By default is is empty. #define wxARRAY_DEFAULT_EXPORT // ---------------------------------------------------------------------------- @@ -650,7 +628,7 @@ private: \ WX_DECLARE_USER_EXPORTED_BASEARRAY(T, name, wxARRAY_DEFAULT_EXPORT) #define WX_DECLARE_EXPORTED_BASEARRAY(T, name) \ - WX_DECLARE_USER_EXPORTED_BASEARRAY(T, name, WXDLLIMPEXP_CORE) + WX_DECLARE_USER_EXPORTED_BASEARRAY(T, name, WXDLLEXPORT) #define WX_DECLARE_USER_EXPORTED_BASEARRAY(T, name, expmode) \ typedef T _wxArray##name; \ @@ -671,10 +649,10 @@ private: \ WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, base, class wxARRAY_DEFAULT_EXPORT) #define WX_DEFINE_EXPORTED_TYPEARRAY(T, name, base) \ - WX_DEFINE_TYPEARRAY_WITH_DECL(T, name, base, class WXDLLIMPEXP_CORE) + WX_DEFINE_TYPEARRAY_WITH_DECL(T, name, base, class WXDLLEXPORT) #define WX_DEFINE_EXPORTED_TYPEARRAY_PTR(T, name, base) \ - WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, base, class WXDLLIMPEXP_CORE) + WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, base, class WXDLLEXPORT) #define WX_DEFINE_USER_EXPORTED_TYPEARRAY(T, name, base, expdecl) \ WX_DEFINE_TYPEARRAY_WITH_DECL(T, name, base, class expdecl) @@ -727,7 +705,7 @@ private: \ wxARRAY_DEFAULT_EXPORT) #define WX_DEFINE_SORTED_EXPORTED_TYPEARRAY(T, name, base) \ - WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, base, WXDLLIMPEXP_CORE) + WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, base, WXDLLEXPORT) #define WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, base, expmode) \ typedef T _wxArray##name; \ @@ -753,7 +731,7 @@ private: \ #define WX_DEFINE_SORTED_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, base) \ WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, base, \ - WXDLLIMPEXP_CORE) + WXDLLEXPORT) #define WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, base, \ expmode) \ @@ -806,7 +784,7 @@ private: \ WX_DECLARE_USER_EXPORTED_OBJARRAY(T, name, wxARRAY_DEFAULT_EXPORT) #define WX_DECLARE_EXPORTED_OBJARRAY(T, name) \ - WX_DECLARE_USER_EXPORTED_OBJARRAY(T, name, WXDLLIMPEXP_CORE) + WX_DECLARE_USER_EXPORTED_OBJARRAY(T, name, WXDLLEXPORT) #define WX_DECLARE_OBJARRAY_WITH_DECL(T, name, decl) \ typedef T _wxObjArray##name; \ @@ -1028,7 +1006,7 @@ WX_DEFINE_USER_EXPORTED_ARRAY_PTR(void *, wxArrayPtrVoid, class WXDLLIMPEXP_BASE #define WX_PREPEND_ARRAY(array, other) \ { \ size_t wxAAcnt = (other).size(); \ - (array).reserve(wxAAcnt); \ + (array).Alloc(wxAAcnt); \ for ( size_t wxAAn = 0; wxAAn < wxAAcnt; wxAAn++ ) \ { \ (array).Insert((other)[wxAAn], wxAAn); \ @@ -1039,7 +1017,7 @@ WX_DEFINE_USER_EXPORTED_ARRAY_PTR(void *, wxArrayPtrVoid, class WXDLLIMPEXP_BASE #define WX_APPEND_ARRAY(array, other) \ { \ size_t wxAAcnt = (other).size(); \ - (array).reserve(wxAAcnt); \ + (array).Alloc(wxAAcnt); \ for ( size_t wxAAn = 0; wxAAn < wxAAcnt; wxAAn++ ) \ { \ (array).push_back((other)[wxAAn]); \ diff --git a/Source/3rd Party/wx/include/wx/dynlib.h b/Source/3rd Party/wx/include/wx/dynlib.h index e79bc3b30..5903a7b5b 100644 --- a/Source/3rd Party/wx/include/wx/dynlib.h +++ b/Source/3rd Party/wx/include/wx/dynlib.h @@ -4,7 +4,7 @@ // Author: Guilhem Lavaux, Vadim Zeitlin, Vaclav Slavik // Modified by: // Created: 20/07/98 -// RCS-ID: $Id$ +// RCS-ID: $Id: dynlib.h 61872 2009-09-09 22:37:05Z VZ $ // Copyright: (c) 1998 Guilhem Lavaux // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -19,6 +19,14 @@ #include "wx/string.h" #include "wx/dynarray.h" +#if defined(__OS2__) || defined(__EMX__) +#include "wx/os2/private.h" +#endif + +#ifdef __WXMSW__ +#include "wx/msw/private.h" +#endif + // note that we have our own dlerror() implementation under Darwin #if (defined(HAVE_DLERROR) && !defined(__EMX__)) || defined(__DARWIN__) #define wxHAVE_DYNLIB_ERROR @@ -33,7 +41,7 @@ class WXDLLIMPEXP_FWD_BASE wxDynamicLibraryDetailsCreator; // Note: __OS2__/EMX has to be tested first, since we want to use // native version, even if configure detected presence of DLOPEN. #if defined(__OS2__) || defined(__EMX__) || defined(__WINDOWS__) - typedef WXHMODULE wxDllType; + typedef HMODULE wxDllType; #elif defined(__DARWIN__) // Don't include dlfcn.h on Darwin, we may be using our own replacements. typedef void *wxDllType; @@ -65,13 +73,12 @@ enum wxDLFlags wxDL_VERBATIM = 0x00000008, // attempt to load the supplied library // name without appending the usual dll // filename extension. - - // this flag is obsolete, don't use wxDL_NOSHARE = 0x00000010, // load new DLL, don't reuse already loaded // (only for wxPluginManager) wxDL_QUIET = 0x00000020, // don't log an error if failed to load +#if wxABI_VERSION >= 20810 // this flag is dangerous, for internal use of wxMSW only, don't use at all // and especially don't use directly, use wxLoadedDLL instead if you really // do need it @@ -79,6 +86,7 @@ enum wxDLFlags // loaded DLL or NULL otherwise; Unload() // should not be called so don't forget to // Detach() if you use this function +#endif // wx 2.8.10+ wxDL_DEFAULT = wxDL_NOW // default flags correspond to Win32 }; @@ -110,63 +118,6 @@ enum wxPluginCategory #define wxDYNLIB_FUNCTION(type, name, dynlib) \ type pfn ## name = (type)(dynlib).GetSymbol(wxT(#name)) - -// a more convenient function replacing wxDYNLIB_FUNCTION above -// -// it uses the convention that the type of the function is its name suffixed -// with "_t" but it doesn't define a variable but just assigns the loaded value -// to it and also allows to pass it the prefix to be used instead of hardcoding -// "pfn" (the prefix can be "m_" or "gs_pfn" or whatever) -// -// notice that this function doesn't generate error messages if the symbol -// couldn't be loaded, the caller should generate the appropriate message -#define wxDL_INIT_FUNC(pfx, name, dynlib) \ - pfx ## name = (name ## _t)(dynlib).RawGetSymbol(#name) - -#ifdef __WINDOWS__ - -// same as wxDL_INIT_FUNC() but appends 'A' or 'W' to the function name, see -// wxDynamicLibrary::GetSymbolAorW() -#define wxDL_INIT_FUNC_AW(pfx, name, dynlib) \ - pfx ## name = (name ## _t)(dynlib).GetSymbolAorW(#name) - -#endif // __WINDOWS__ - -// the following macros can be used to redirect a whole library to a class and -// check at run-time if the library is present and contains all required -// methods -// -// notice that they are supposed to be used inside a class which has "m_ok" -// member variable indicating if the library had been successfully loaded - -// helper macros constructing the name of the variable storing the function -// pointer and the name of its type from the function name -#define wxDL_METHOD_NAME(name) m_pfn ## name -#define wxDL_METHOD_TYPE(name) name ## _t - -// parameters are: -// - rettype: return type of the function, e.g. "int" -// - name: name of the function, e.g. "foo" -// - args: function signature in parentheses, e.g. "(int x, int y)" -// - argnames: the names of the parameters in parentheses, e.g. "(x, y)" -// - defret: the value to return if the library wasn't successfully loaded -#define wxDL_METHOD_DEFINE( rettype, name, args, argnames, defret ) \ - typedef rettype (* wxDL_METHOD_TYPE(name)) args ; \ - wxDL_METHOD_TYPE(name) wxDL_METHOD_NAME(name); \ - rettype name args \ - { return m_ok ? wxDL_METHOD_NAME(name) argnames : defret; } - -#define wxDL_VOIDMETHOD_DEFINE( name, args, argnames ) \ - typedef void (* wxDL_METHOD_TYPE(name)) args ; \ - wxDL_METHOD_TYPE(name) wxDL_METHOD_NAME(name); \ - void name args \ - { if ( m_ok ) wxDL_METHOD_NAME(name) argnames ; } - -#define wxDL_METHOD_LOAD(lib, name) \ - wxDL_METHOD_NAME(name) = \ - (wxDL_METHOD_TYPE(name)) lib.GetSymbol(#name, &m_ok); \ - if ( !m_ok ) return false - // ---------------------------------------------------------------------------- // wxDynamicLibraryDetails: contains details about a loaded wxDynamicLibrary // ---------------------------------------------------------------------------- @@ -232,7 +183,7 @@ public: static wxDllType GetProgramHandle(); // return the platform standard DLL extension (with leading dot) - static const wxString& GetDllExt() { return ms_dllext; } + static const wxChar *GetDllExt() { return ms_dllext; } wxDynamicLibrary() : m_handle(0) { } wxDynamicLibrary(const wxString& libname, int flags = wxDL_DEFAULT) @@ -304,7 +255,7 @@ public: #endif } -#ifdef __WINDOWS__ +#ifdef __WXMSW__ // this function is useful for loading functions from the standard Windows // DLLs: such functions have an 'A' (in ANSI build) or 'W' (in Unicode, or // wide character build) suffix if they take string parameters @@ -326,7 +277,7 @@ public: { return RawGetSymbolAorW(m_handle, name); } -#endif // __WINDOWS__ +#endif // __WXMSW__ // return all modules/shared libraries in the address space of this process // @@ -349,19 +300,6 @@ public: static wxString GetPluginsDirectory(); -#ifdef __WINDOWS__ - // return the handle (HMODULE/HINSTANCE) of the DLL with the given name - // and/or containing the specified address: for XP and later systems only - // the address is used and the name is ignored but for the previous systems - // only the name (which may be either a full path to the DLL or just its - // base name, possibly even without extension) is used - // - // the returned handle reference count is not incremented so it doesn't - // need to be freed using FreeLibrary() but it also means that it can - // become invalid if the DLL is unloaded - static WXHMODULE MSWGetModuleHandle(const char *name, void *addr); -#endif // __WINDOWS__ - protected: // common part of GetSymbol() and HasSymbol() void *DoGetSymbol(const wxString& name, bool *success = 0) const; @@ -373,17 +311,17 @@ protected: // platform specific shared lib suffix. - static const wxString ms_dllext; + static const wxChar *ms_dllext; // the handle to DLL or NULL wxDllType m_handle; // no copy ctor/assignment operators (or we'd try to unload the library // twice) - wxDECLARE_NO_COPY_CLASS(wxDynamicLibrary); + DECLARE_NO_COPY_CLASS(wxDynamicLibrary) }; -#ifdef __WINDOWS__ +#if defined(__WXMSW__) && wxABI_VERSION >= 20810 // ---------------------------------------------------------------------------- // wxLoadedDLL is a MSW-only internal helper class allowing to dynamically bind @@ -404,7 +342,7 @@ public: } }; -#endif // __WINDOWS__ +#endif // __WXMSW__ // ---------------------------------------------------------------------------- // Interesting defines diff --git a/Source/3rd Party/wx/include/wx/dynload.h b/Source/3rd Party/wx/include/wx/dynload.h index d2a1fc038..76b377c07 100644 --- a/Source/3rd Party/wx/include/wx/dynload.h +++ b/Source/3rd Party/wx/include/wx/dynload.h @@ -1,11 +1,11 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/dynload.h +// Name: dynload.h // Purpose: Dynamic loading framework // Author: Ron Lee, David Falkinder, Vadim Zeitlin and a cast of 1000's // (derived in part from dynlib.cpp (c) 1998 Guilhem Lavaux) // Modified by: // Created: 03/12/01 -// RCS-ID: $Id$ +// RCS-ID: $Id: dynload.h 61872 2009-09-09 22:37:05Z VZ $ // Copyright: (c) 2001 Ron Lee // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -82,11 +82,8 @@ public: private: - // These pointers may be NULL but if they are not, then m_ourLast follows - // m_ourFirst in the linked list, i.e. can be found by calling GetNext() a - // sufficient number of times. - const wxClassInfo *m_ourFirst; // first class info in this plugin - const wxClassInfo *m_ourLast; // ..and the last one + wxClassInfo *m_before; // sm_first before loading this lib + wxClassInfo *m_after; // ..and after. size_t m_linkcount; // Ref count of library link calls size_t m_objcount; // ..and (pluggable) object instantiations. @@ -97,7 +94,7 @@ private: void RegisterModules(); // Init any wxModules in the lib. void UnregisterModules(); // Cleanup any wxModules we installed. - wxDECLARE_NO_COPY_CLASS(wxPluginLibrary); + DECLARE_NO_COPY_CLASS(wxPluginLibrary) }; @@ -147,7 +144,7 @@ private: // We could allow this class to be copied if we really // wanted to, but not without modification. - wxDECLARE_NO_COPY_CLASS(wxPluginManager); + DECLARE_NO_COPY_CLASS(wxPluginManager) }; diff --git a/Source/3rd Party/wx/include/wx/effects.h b/Source/3rd Party/wx/include/wx/effects.h index a43a23c64..987ddf51a 100644 --- a/Source/3rd Party/wx/include/wx/effects.h +++ b/Source/3rd Party/wx/include/wx/effects.h @@ -5,7 +5,7 @@ // Author: Julian Smart et al // Modified by: // Created: 25/4/2000 -// RCS-ID: $Id$ +// RCS-ID: $Id: effects.h 39109 2006-05-08 11:31:03Z ABX $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -13,12 +13,6 @@ #ifndef _WX_EFFECTS_H_ #define _WX_EFFECTS_H_ -// this class is deprecated and will be removed in the next wx version -// -// please use wxRenderer::DrawBorder() instead of DrawSunkenEdge(); there is no -// replacement for TileBitmap() but it doesn't seem to be very useful anyhow -#if WXWIN_COMPATIBILITY_2_8 - /* * wxEffects: various 3D effects */ @@ -28,15 +22,17 @@ #include "wx/gdicmn.h" #include "wx/dc.h" -class WXDLLIMPEXP_CORE wxEffectsImpl: public wxObject +class WXDLLEXPORT wxEffects: public wxObject { +DECLARE_CLASS(wxEffects) + public: // Assume system colours - wxEffectsImpl() ; + wxEffects() ; // Going from lightest to darkest - wxEffectsImpl(const wxColour& highlightColour, const wxColour& lightShadow, - const wxColour& faceColour, const wxColour& mediumShadow, - const wxColour& darkShadow) ; + wxEffects(const wxColour& highlightColour, const wxColour& lightShadow, + const wxColour& faceColour, const wxColour& mediumShadow, + const wxColour& darkShadow) ; // Accessors wxColour GetHighlightColour() const { return m_highlightColour; } @@ -74,18 +70,6 @@ protected: wxColour m_faceColour; // Usually grey wxColour m_mediumShadow; // Usually dark grey wxColour m_darkShadow; // Usually black - - DECLARE_CLASS(wxEffectsImpl) }; -// current versions of g++ don't generate deprecation warnings for classes -// declared deprecated, so define wxEffects as a typedef instead: this does -// generate warnings with both g++ and VC (which also has no troubles with -// directly deprecating the classes...) -// -// note that this g++ bug (16370) is supposed to be fixed in g++ 4.3.0 -typedef wxEffectsImpl wxDEPRECATED(wxEffects); - -#endif // WXWIN_COMPATIBILITY_2_8 - -#endif // _WX_EFFECTS_H_ +#endif diff --git a/Source/3rd Party/wx/include/wx/encconv.h b/Source/3rd Party/wx/include/wx/encconv.h index 555e2ba00..f57d8ea9d 100644 --- a/Source/3rd Party/wx/include/wx/encconv.h +++ b/Source/3rd Party/wx/include/wx/encconv.h @@ -57,7 +57,7 @@ class WXDLLIMPEXP_BASE wxEncodingConverter : public wxObject virtual ~wxEncodingConverter() { if (m_Table) delete[] m_Table; } // Initialize conversion. Both output or input encoding may - // be wxFONTENCODING_UNICODE. + // be wxFONTENCODING_UNICODE, but only if wxUSE_WCHAR_T is set to 1. // // All subsequent calls to Convert() will interpret it's argument // as a string in input_enc encoding and will output string in @@ -91,11 +91,12 @@ class WXDLLIMPEXP_BASE wxEncodingConverter : public wxObject bool Convert(char* str) const { return Convert(str, str); } wxString Convert(const wxString& input) const; +#if wxUSE_WCHAR_T bool Convert(const char* input, wchar_t* output) const; bool Convert(const wchar_t* input, char* output) const; bool Convert(const wchar_t* input, wchar_t* output) const; bool Convert(wchar_t* str) const { return Convert(str, str); } - +#endif // Return equivalent(s) for given font that are used // under given platform. wxPLATFORM_CURRENT means the plaform // this binary was compiled for @@ -143,11 +144,16 @@ class WXDLLIMPEXP_BASE wxEncodingConverter : public wxObject } private: + +#if wxUSE_WCHAR_T wchar_t *m_Table; +#else + char *m_Table; +#endif bool m_UnicodeInput, m_UnicodeOutput; bool m_JustCopy; - wxDECLARE_NO_COPY_CLASS(wxEncodingConverter); + DECLARE_NO_COPY_CLASS(wxEncodingConverter) }; #endif // _WX_ENCCONV_H_ diff --git a/Source/3rd Party/wx/include/wx/encinfo.h b/Source/3rd Party/wx/include/wx/encinfo.h index 360a2150b..fb3d9214f 100644 --- a/Source/3rd Party/wx/include/wx/encinfo.h +++ b/Source/3rd Party/wx/include/wx/encinfo.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 19.09.2003 (extracted from wx/fontenc.h) -// RCS-ID: $Id$ +// RCS-ID: $Id: encinfo.h 40865 2006-08-27 09:42:42Z VS $ // Copyright: (c) 2003 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -32,9 +32,10 @@ // to create a font of non-standard encoding (like KOI8) under Windows - the // facename specifies the encoding then) -struct WXDLLIMPEXP_CORE wxNativeEncodingInfo +struct WXDLLEXPORT wxNativeEncodingInfo { wxString facename; // may be empty meaning "any" +#ifndef __WXPALMOS__ wxFontEncoding encoding; // so that we know what this struct represents #if defined(__WXMSW__) || \ @@ -52,11 +53,17 @@ struct WXDLLIMPEXP_CORE wxNativeEncodingInfo #elif defined(_WX_X_FONTLIKE) wxString xregistry, xencoding; -#elif defined(wxHAS_UTF8_FONTS) - // ports using UTF-8 for text don't need encoding information for fonts +#elif defined(__WXGTK20__) + // No way to specify this in Pango as this + // seems to be handled internally. +#elif defined(__WXMGL__) + int mglEncoding; +#elif defined(__WXDFB__) + // DirectFB uses UTF-8 internally, doesn't use font encodings #else #error "Unsupported toolkit" #endif +#endif // !__WXPALMOS__ // this struct is saved in config by wxFontMapper, so it should know to // serialise itself (implemented in platform-specific code) bool FromString(const wxString& s); diff --git a/Source/3rd Party/wx/include/wx/event.h b/Source/3rd Party/wx/include/wx/event.h index 5dca14a73..599b588d2 100644 --- a/Source/3rd Party/wx/include/wx/event.h +++ b/Source/3rd Party/wx/include/wx/event.h @@ -4,13 +4,13 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: event.h 61872 2009-09-09 22:37:05Z VZ $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifndef _WX_EVENT_H_ -#define _WX_EVENT_H_ +#ifndef _WX_EVENT_H__ +#define _WX_EVENT_H__ #include "wx/defs.h" #include "wx/cpp.h" @@ -20,26 +20,18 @@ #if wxUSE_GUI #include "wx/gdicmn.h" #include "wx/cursor.h" - #include "wx/mousestate.h" #endif +#include "wx/thread.h" + #include "wx/dynarray.h" -#include "wx/thread.h" -#include "wx/tracker.h" -#include "wx/typeinfo.h" -#include "wx/any.h" - -#ifdef wxHAS_EVENT_BIND - #include "wx/meta/convertible.h" -#endif // ---------------------------------------------------------------------------- // forward declarations // ---------------------------------------------------------------------------- class WXDLLIMPEXP_FWD_BASE wxList; -class WXDLLIMPEXP_FWD_BASE wxEvent; -class WXDLLIMPEXP_FWD_BASE wxEventFilter; + #if wxUSE_GUI class WXDLLIMPEXP_FWD_CORE wxDC; class WXDLLIMPEXP_FWD_CORE wxMenu; @@ -47,25 +39,7 @@ class WXDLLIMPEXP_FWD_BASE wxEventFilter; class WXDLLIMPEXP_FWD_CORE wxWindowBase; #endif // wxUSE_GUI -// We operate with pointer to members of wxEvtHandler (such functions are used -// as event handlers in the event tables or as arguments to Connect()) but by -// default MSVC uses a restricted (but more efficient) representation of -// pointers to members which can't deal with multiple base classes. To avoid -// mysterious (as the compiler is not good enough to detect this and give a -// sensible error message) errors in the user code as soon as it defines -// classes inheriting from both wxEvtHandler (possibly indirectly, e.g. via -// wxWindow) and something else (including our own wxTrackable but not limited -// to it), we use the special MSVC keyword telling the compiler to use a more -// general pointer to member representation for the classes inheriting from -// wxEvtHandler. -#ifdef __VISUALC__ - #define wxMSVC_FWD_MULTIPLE_BASES __multiple_inheritance -#else - #define wxMSVC_FWD_MULTIPLE_BASES -#endif - -class WXDLLIMPEXP_FWD_BASE wxMSVC_FWD_MULTIPLE_BASES wxEvtHandler; -class wxEventConnectionRef; +class WXDLLIMPEXP_FWD_BASE wxEvtHandler; // ---------------------------------------------------------------------------- // Event types @@ -73,751 +47,246 @@ class wxEventConnectionRef; typedef int wxEventType; -#define wxEVT_ANY ((wxEventType)-1) - // this is used to make the event table entry type safe, so that for an event -// handler only a function with proper parameter list can be given. See also -// the wxEVENT_HANDLER_CAST-macro. -#define wxStaticCastEvent(type, val) static_cast(val) +// handler only a function with proper parameter list can be given. +#define wxStaticCastEvent(type, val) wx_static_cast(type, val) -#define wxDECLARE_EVENT_TABLE_ENTRY(type, winid, idLast, fn, obj) \ - wxEventTableEntry(type, winid, idLast, wxNewEventTableFunctor(type, fn), obj) +// in previous versions of wxWidgets the event types used to be constants +// which created difficulties with custom/user event types definition +// +// starting from wxWidgets 2.4 the event types are now dynamically assigned +// using wxNewEventType() which solves this problem, however at price of +// several incompatibilities: +// +// a) event table macros declaration changed, it now uses wxEventTableEntry +// ctor instead of initialisation from an agregate - the macro +// DECLARE_EVENT_TABLE_ENTRY may be used to write code which can compile +// with all versions of wxWidgets +// +// b) event types can't be used as switch() cases as they're not really +// constant any more - there is no magic solution here, you just have to +// change the switch()es to if()s +// +// if these are real problems for you, define WXWIN_COMPATIBILITY_EVENT_TYPES +// as 1 to get 100% old behaviour, however you won't be able to use the +// libraries using the new dynamic event type allocation in such case, so avoid +// it if possible. +#ifndef WXWIN_COMPATIBILITY_EVENT_TYPES + #define WXWIN_COMPATIBILITY_EVENT_TYPES 0 +#endif -#define wxDECLARE_EVENT_TABLE_TERMINATOR() \ - wxEventTableEntry(wxEVT_NULL, 0, 0, 0, 0) +#if WXWIN_COMPATIBILITY_EVENT_TYPES + +#define DECLARE_EVENT_TABLE_ENTRY(type, winid, idLast, fn, obj) \ + { type, winid, idLast, fn, obj } + +#define BEGIN_DECLARE_EVENT_TYPES() enum { +#define END_DECLARE_EVENT_TYPES() }; +#define DECLARE_EVENT_TYPE(name, value) name = wxEVT_FIRST + value, +#define DECLARE_LOCAL_EVENT_TYPE(name, value) name = wxEVT_USER_FIRST + value, +#define DECLARE_EXPORTED_EVENT_TYPE(expdecl, name, value) \ + DECLARE_LOCAL_EVENT_TYPE(name, value) +#define DEFINE_EVENT_TYPE(name) +#define DEFINE_LOCAL_EVENT_TYPE(name) + + +#else // !WXWIN_COMPATIBILITY_EVENT_TYPES + +#define DECLARE_EVENT_TABLE_ENTRY(type, winid, idLast, fn, obj) \ + wxEventTableEntry(type, winid, idLast, fn, obj) + +#define BEGIN_DECLARE_EVENT_TYPES() +#define END_DECLARE_EVENT_TYPES() +#define DECLARE_EXPORTED_EVENT_TYPE(expdecl, name, value) \ + extern expdecl const wxEventType name; +#define DECLARE_EVENT_TYPE(name, value) \ + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_CORE, name, value) +#define DECLARE_LOCAL_EVENT_TYPE(name, value) \ + DECLARE_EXPORTED_EVENT_TYPE(wxEMPTY_PARAMETER_VALUE, name, value) +#define DEFINE_EVENT_TYPE(name) const wxEventType name = wxNewEventType(); +#define DEFINE_LOCAL_EVENT_TYPE(name) DEFINE_EVENT_TYPE(name) // generate a new unique event type extern WXDLLIMPEXP_BASE wxEventType wxNewEventType(); -// define macros to create new event types: -#ifdef wxHAS_EVENT_BIND - // events are represented by an instance of wxEventTypeTag and the - // corresponding type must be specified for type-safety checks - - // define a new custom event type, can be used alone or after event - // declaration in the header using one of the macros below - #define wxDEFINE_EVENT( name, type ) \ - const wxEventTypeTag< type > name( wxNewEventType() ) - - // the general version allowing exporting the event type from DLL, used by - // wxWidgets itself - #define wxDECLARE_EXPORTED_EVENT( expdecl, name, type ) \ - extern const expdecl wxEventTypeTag< type > name - - // this is the version which will normally be used in the user code - #define wxDECLARE_EVENT( name, type ) \ - wxDECLARE_EXPORTED_EVENT( wxEMPTY_PARAMETER_VALUE, name, type ) - - - // these macros are only used internally for backwards compatibility and - // allow to define an alias for an existing event type (this is used by - // wxEVT_SPIN_XXX) - #define wxDEFINE_EVENT_ALIAS( name, type, value ) \ - const wxEventTypeTag< type > name( value ) - - #define wxDECLARE_EXPORTED_EVENT_ALIAS( expdecl, name, type ) \ - extern const expdecl wxEventTypeTag< type > name -#else // !wxHAS_EVENT_BIND - // the macros are the same ones as above but defined differently as we only - // use the integer event type values to identify events in this case - - #define wxDEFINE_EVENT( name, type ) \ - const wxEventType name( wxNewEventType() ) - - #define wxDECLARE_EXPORTED_EVENT( expdecl, name, type ) \ - extern const expdecl wxEventType name - #define wxDECLARE_EVENT( name, type ) \ - wxDECLARE_EXPORTED_EVENT( wxEMPTY_PARAMETER_VALUE, name, type ) - - #define wxDEFINE_EVENT_ALIAS( name, type, value ) \ - const wxEventType name = value - #define wxDECLARE_EXPORTED_EVENT_ALIAS( expdecl, name, type ) \ - extern const expdecl wxEventType name -#endif // wxHAS_EVENT_BIND/!wxHAS_EVENT_BIND - -// Try to cast the given event handler to the correct handler type: - -#define wxEVENT_HANDLER_CAST( functype, func ) \ - ( wxObjectEventFunction )( wxEventFunction )wxStaticCastEvent( functype, &func ) - - -#ifdef wxHAS_EVENT_BIND - -// The tag is a type associated to the event type (which is an integer itself, -// in spite of its name) value. It exists in order to be used as a template -// parameter and provide a mapping between the event type values and their -// corresponding wxEvent-derived classes. -template -class wxEventTypeTag -{ -public: - // The class of wxEvent-derived class carried by the events of this type. - typedef T EventClass; - - wxEventTypeTag(wxEventType type) { m_type = type; } - - // Return a wxEventType reference for the initialization of the static - // event tables. See wxEventTableEntry::m_eventType for a more thorough - // explanation. - operator const wxEventType&() const { return m_type; } - -private: - wxEventType m_type; -}; - -#endif // wxHAS_EVENT_BIND - -// These are needed for the functor definitions -typedef void (wxEvtHandler::*wxEventFunction)(wxEvent&); - -// We had some trouble (specifically with eVC for ARM WinCE build) with using -// wxEventFunction in the past so we had introduced wxObjectEventFunction which -// used to be a typedef for a member of wxObject and not wxEvtHandler to work -// around this but as eVC is not really supported any longer we now only keep -// this for backwards compatibility and, despite its name, this is a typedef -// for wxEvtHandler member now -- but if we have the same problem with another -// compiler we can restore its old definition for it. -typedef wxEventFunction wxObjectEventFunction; - -// The event functor which is stored in the static and dynamic event tables: -class WXDLLIMPEXP_BASE wxEventFunctor -{ -public: - virtual ~wxEventFunctor(); - - // Invoke the actual event handler: - virtual void operator()(wxEvtHandler *, wxEvent&) = 0; - - // this function tests whether this functor is matched, for the purpose of - // finding it in an event table in Unbind(), by the given functor: - virtual bool IsMatching(const wxEventFunctor& functor) const = 0; - - // If the functor holds an wxEvtHandler, then get access to it and track - // its lifetime with wxEventConnectionRef: - virtual wxEvtHandler *GetEvtHandler() const - { return NULL; } - - // This is only used to maintain backward compatibility in - // wxAppConsoleBase::CallEventHandler and ensures that an overwritten - // wxAppConsoleBase::HandleEvent is still called for functors which hold an - // wxEventFunction: - virtual wxEventFunction GetEvtMethod() const - { return NULL; } - -private: - WX_DECLARE_ABSTRACT_TYPEINFO(wxEventFunctor) -}; - -// A plain method functor for the untyped legacy event types: -class WXDLLIMPEXP_BASE wxObjectEventFunctor : public wxEventFunctor -{ -public: - wxObjectEventFunctor(wxObjectEventFunction method, wxEvtHandler *handler) - : m_handler( handler ), m_method( method ) - { } - - virtual void operator()(wxEvtHandler *handler, wxEvent& event); - - virtual bool IsMatching(const wxEventFunctor& functor) const - { - if ( wxTypeId(functor) == wxTypeId(*this) ) - { - const wxObjectEventFunctor &other = - static_cast< const wxObjectEventFunctor & >( functor ); - - // FIXME-VC6: amazing but true: replacing "m_method == 0" here - // with "!m_method" makes VC6 crash with an ICE in DLL build (only!) - // Also notice that using "NULL" instead of "0" results in warnings - // about "using NULL in arithmetics" from arm-linux-androideabi-g++ - // 4.4.3 used for wxAndroid build. - - return ( m_method == other.m_method || other.m_method == 0 ) && - ( m_handler == other.m_handler || other.m_handler == NULL ); - } - else - return false; - } - - virtual wxEvtHandler *GetEvtHandler() const - { return m_handler; } - - virtual wxEventFunction GetEvtMethod() const - { return m_method; } - -private: - wxEvtHandler *m_handler; - wxEventFunction m_method; - - // Provide a dummy default ctor for type info purposes - wxObjectEventFunctor() { } - - WX_DECLARE_TYPEINFO_INLINE(wxObjectEventFunctor) -}; - -// Create a functor for the legacy events: used by Connect() -inline wxObjectEventFunctor * -wxNewEventFunctor(const wxEventType& WXUNUSED(evtType), - wxObjectEventFunction method, - wxEvtHandler *handler) -{ - return new wxObjectEventFunctor(method, handler); -} - -// This version is used by wxDECLARE_EVENT_TABLE_ENTRY() -inline wxObjectEventFunctor * -wxNewEventTableFunctor(const wxEventType& WXUNUSED(evtType), - wxObjectEventFunction method) -{ - return new wxObjectEventFunctor(method, NULL); -} - -inline wxObjectEventFunctor -wxMakeEventFunctor(const wxEventType& WXUNUSED(evtType), - wxObjectEventFunction method, - wxEvtHandler *handler) -{ - return wxObjectEventFunctor(method, handler); -} - -#ifdef wxHAS_EVENT_BIND - -namespace wxPrivate -{ - -// helper template defining nested "type" typedef as the event class -// corresponding to the given event type -template struct EventClassOf; - -// the typed events provide the information about the class of the events they -// carry themselves: -template -struct EventClassOf< wxEventTypeTag > -{ - typedef typename wxEventTypeTag::EventClass type; -}; - -// for the old untyped events we don't have information about the exact event -// class carried by them -template <> -struct EventClassOf -{ - typedef wxEvent type; -}; - - -// helper class defining operations different for method functors using an -// object of wxEvtHandler-derived class as handler and the others -template struct HandlerImpl; - -// specialization for handlers deriving from wxEvtHandler -template -struct HandlerImpl -{ - static bool IsEvtHandler() - { return true; } - static T *ConvertFromEvtHandler(wxEvtHandler *p) - { return static_cast(p); } - static wxEvtHandler *ConvertToEvtHandler(T *p) - { return p; } - static wxEventFunction ConvertToEvtMethod(void (T::*f)(A&)) - { return static_cast( - reinterpret_cast(f)); } -}; - -// specialization for handlers not deriving from wxEvtHandler -template -struct HandlerImpl -{ - static bool IsEvtHandler() - { return false; } - static T *ConvertFromEvtHandler(wxEvtHandler *) - { return NULL; } - static wxEvtHandler *ConvertToEvtHandler(T *) - { return NULL; } - static wxEventFunction ConvertToEvtMethod(void (T::*)(A&)) - { return NULL; } -}; - -} // namespace wxPrivate - -// functor forwarding the event to a method of the given object -// -// notice that the object class may be different from the class in which the -// method is defined but it must be convertible to this class -// -// also, the type of the handler parameter doesn't need to be exactly the same -// as EventTag::EventClass but it must be its base class -- this is explicitly -// allowed to handle different events in the same handler taking wxEvent&, for -// example -template - -class wxEventFunctorMethod - : public wxEventFunctor, - private wxPrivate::HandlerImpl - < - Class, - EventArg, - wxConvertibleTo::value != 0 - > -{ -private: - static void CheckHandlerArgument(EventArg *) { } - -public: - // the event class associated with the given event tag - typedef typename wxPrivate::EventClassOf::type EventClass; - - - wxEventFunctorMethod(void (Class::*method)(EventArg&), EventHandler *handler) - : m_handler( handler ), m_method( method ) - { - wxASSERT_MSG( handler || this->IsEvtHandler(), - "handlers defined in non-wxEvtHandler-derived classes " - "must be connected with a valid sink object" ); - - // if you get an error here it means that the signature of the handler - // you're trying to use is not compatible with (i.e. is not the same as - // or a base class of) the real event class used for this event type - CheckHandlerArgument(static_cast(NULL)); - } - - virtual void operator()(wxEvtHandler *handler, wxEvent& event) - { - Class * realHandler = m_handler; - if ( !realHandler ) - { - realHandler = this->ConvertFromEvtHandler(handler); - - // this is not supposed to happen but check for it nevertheless - wxCHECK_RET( realHandler, "invalid event handler" ); - } - - // the real (run-time) type of event is EventClass and we checked in - // the ctor that EventClass can be converted to EventArg, so this cast - // is always valid - (realHandler->*m_method)(static_cast(event)); - } - - virtual bool IsMatching(const wxEventFunctor& functor) const - { - if ( wxTypeId(functor) != wxTypeId(*this) ) - return false; - - typedef wxEventFunctorMethod - ThisFunctor; - - // the cast is valid because wxTypeId()s matched above - const ThisFunctor& other = static_cast(functor); - - return (m_method == other.m_method || other.m_method == NULL) && - (m_handler == other.m_handler || other.m_handler == NULL); - } - - virtual wxEvtHandler *GetEvtHandler() const - { return this->ConvertToEvtHandler(m_handler); } - - virtual wxEventFunction GetEvtMethod() const - { return this->ConvertToEvtMethod(m_method); } - -private: - EventHandler *m_handler; - void (Class::*m_method)(EventArg&); - - // Provide a dummy default ctor for type info purposes - wxEventFunctorMethod() { } - - typedef wxEventFunctorMethod thisClass; - WX_DECLARE_TYPEINFO_INLINE(thisClass) -}; - - -// functor forwarding the event to function (function, static method) -template -class wxEventFunctorFunction : public wxEventFunctor -{ -private: - static void CheckHandlerArgument(EventArg *) { } - -public: - // the event class associated with the given event tag - typedef typename wxPrivate::EventClassOf::type EventClass; - - wxEventFunctorFunction( void ( *handler )( EventArg & )) - : m_handler( handler ) - { - // if you get an error here it means that the signature of the handler - // you're trying to use is not compatible with (i.e. is not the same as - // or a base class of) the real event class used for this event type - CheckHandlerArgument(static_cast(NULL)); - } - - virtual void operator()(wxEvtHandler *WXUNUSED(handler), wxEvent& event) - { - // If you get an error here like "must use .* or ->* to call - // pointer-to-member function" then you probably tried to call - // Bind/Unbind with a method pointer but without a handler pointer or - // NULL as a handler e.g.: - // Unbind( wxEVT_XXX, &EventHandler::method ); - // or - // Unbind( wxEVT_XXX, &EventHandler::method, NULL ) - m_handler(static_cast(event)); - } - - virtual bool IsMatching(const wxEventFunctor &functor) const - { - if ( wxTypeId(functor) != wxTypeId(*this) ) - return false; - - typedef wxEventFunctorFunction ThisFunctor; - - const ThisFunctor& other = static_cast( functor ); - - return m_handler == other.m_handler; - } - -private: - void (*m_handler)(EventArg&); - - // Provide a dummy default ctor for type info purposes - wxEventFunctorFunction() { } - - typedef wxEventFunctorFunction thisClass; - WX_DECLARE_TYPEINFO_INLINE(thisClass) -}; - - -template -class wxEventFunctorFunctor : public wxEventFunctor -{ -public: - typedef typename EventTag::EventClass EventArg; - - wxEventFunctorFunctor(const Functor& handler) - : m_handler(handler), m_handlerAddr(&handler) - { } - - virtual void operator()(wxEvtHandler *WXUNUSED(handler), wxEvent& event) - { - // If you get an error here like "must use '.*' or '->*' to call - // pointer-to-member function" then you probably tried to call - // Bind/Unbind with a method pointer but without a handler pointer or - // NULL as a handler e.g.: - // Unbind( wxEVT_XXX, &EventHandler::method ); - // or - // Unbind( wxEVT_XXX, &EventHandler::method, NULL ) - m_handler(static_cast(event)); - } - - virtual bool IsMatching(const wxEventFunctor &functor) const - { - if ( wxTypeId(functor) != wxTypeId(*this) ) - return false; - - typedef wxEventFunctorFunctor FunctorThis; - - const FunctorThis& other = static_cast(functor); - - // The only reliable/portable way to compare two functors is by - // identity: - return m_handlerAddr == other.m_handlerAddr; - } - -private: - // Store a copy of the functor to prevent using/calling an already - // destroyed instance: - Functor m_handler; - - // Use the address of the original functor for comparison in IsMatching: - const void *m_handlerAddr; - - // Provide a dummy default ctor for type info purposes - wxEventFunctorFunctor() { } - - typedef wxEventFunctorFunctor thisClass; - WX_DECLARE_TYPEINFO_INLINE(thisClass) -}; - -// Create functors for the templatized events, either allocated on the heap for -// wxNewXXX() variants (this is needed in wxEvtHandler::Bind<>() to store them -// in dynamic event table) or just by returning them as temporary objects (this -// is enough for Unbind<>() and we avoid unnecessary heap allocation like this). - - -// Create functors wrapping functions: -template -inline wxEventFunctorFunction * -wxNewEventFunctor(const EventTag&, void (*func)(EventArg &)) -{ - return new wxEventFunctorFunction(func); -} - -template -inline wxEventFunctorFunction -wxMakeEventFunctor(const EventTag&, void (*func)(EventArg &)) -{ - return wxEventFunctorFunction(func); -} - -// Create functors wrapping other functors: -template -inline wxEventFunctorFunctor * -wxNewEventFunctor(const EventTag&, const Functor &func) -{ - return new wxEventFunctorFunctor(func); -} - -template -inline wxEventFunctorFunctor -wxMakeEventFunctor(const EventTag&, const Functor &func) -{ - return wxEventFunctorFunctor(func); -} - -// Create functors wrapping methods: -template - -inline wxEventFunctorMethod * -wxNewEventFunctor(const EventTag&, - void (Class::*method)(EventArg&), - EventHandler *handler) -{ - return new wxEventFunctorMethod( - method, handler); -} - -template - -inline wxEventFunctorMethod -wxMakeEventFunctor(const EventTag&, - void (Class::*method)(EventArg&), - EventHandler *handler) -{ - return wxEventFunctorMethod( - method, handler); -} - -// Create an event functor for the event table via wxDECLARE_EVENT_TABLE_ENTRY: -// in this case we don't have the handler (as it's always the same as the -// object which generated the event) so we must use Class as its type -template -inline wxEventFunctorMethod * -wxNewEventTableFunctor(const EventTag&, void (Class::*method)(EventArg&)) -{ - return new wxEventFunctorMethod( - method, NULL); -} - -#endif // wxHAS_EVENT_BIND - - -// many, but not all, standard event types - - // some generic events -extern WXDLLIMPEXP_BASE const wxEventType wxEVT_NULL; -extern WXDLLIMPEXP_BASE const wxEventType wxEVT_FIRST; -extern WXDLLIMPEXP_BASE const wxEventType wxEVT_USER_FIRST; - - // Need events declared to do this -class WXDLLIMPEXP_FWD_BASE wxIdleEvent; -class WXDLLIMPEXP_FWD_BASE wxThreadEvent; -class WXDLLIMPEXP_FWD_CORE wxCommandEvent; -class WXDLLIMPEXP_FWD_CORE wxMouseEvent; -class WXDLLIMPEXP_FWD_CORE wxFocusEvent; -class WXDLLIMPEXP_FWD_CORE wxChildFocusEvent; -class WXDLLIMPEXP_FWD_CORE wxKeyEvent; -class WXDLLIMPEXP_FWD_CORE wxNavigationKeyEvent; -class WXDLLIMPEXP_FWD_CORE wxSetCursorEvent; -class WXDLLIMPEXP_FWD_CORE wxScrollEvent; -class WXDLLIMPEXP_FWD_CORE wxSpinEvent; -class WXDLLIMPEXP_FWD_CORE wxScrollWinEvent; -class WXDLLIMPEXP_FWD_CORE wxSizeEvent; -class WXDLLIMPEXP_FWD_CORE wxMoveEvent; -class WXDLLIMPEXP_FWD_CORE wxCloseEvent; -class WXDLLIMPEXP_FWD_CORE wxActivateEvent; -class WXDLLIMPEXP_FWD_CORE wxWindowCreateEvent; -class WXDLLIMPEXP_FWD_CORE wxWindowDestroyEvent; -class WXDLLIMPEXP_FWD_CORE wxShowEvent; -class WXDLLIMPEXP_FWD_CORE wxIconizeEvent; -class WXDLLIMPEXP_FWD_CORE wxMaximizeEvent; -class WXDLLIMPEXP_FWD_CORE wxMouseCaptureChangedEvent; -class WXDLLIMPEXP_FWD_CORE wxMouseCaptureLostEvent; -class WXDLLIMPEXP_FWD_CORE wxPaintEvent; -class WXDLLIMPEXP_FWD_CORE wxEraseEvent; -class WXDLLIMPEXP_FWD_CORE wxNcPaintEvent; -class WXDLLIMPEXP_FWD_CORE wxMenuEvent; -class WXDLLIMPEXP_FWD_CORE wxContextMenuEvent; -class WXDLLIMPEXP_FWD_CORE wxSysColourChangedEvent; -class WXDLLIMPEXP_FWD_CORE wxDisplayChangedEvent; -class WXDLLIMPEXP_FWD_CORE wxQueryNewPaletteEvent; -class WXDLLIMPEXP_FWD_CORE wxPaletteChangedEvent; -class WXDLLIMPEXP_FWD_CORE wxJoystickEvent; -class WXDLLIMPEXP_FWD_CORE wxDropFilesEvent; -class WXDLLIMPEXP_FWD_CORE wxInitDialogEvent; -class WXDLLIMPEXP_FWD_CORE wxUpdateUIEvent; -class WXDLLIMPEXP_FWD_CORE wxClipboardTextEvent; -class WXDLLIMPEXP_FWD_CORE wxHelpEvent; - - - // Command events -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, wxCommandEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, wxCommandEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_MENU_SELECTED, wxCommandEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_SLIDER_UPDATED, wxCommandEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEvent); - -// wxEVT_COMMAND_SCROLLBAR_UPDATED is deprecated, use wxEVT_SCROLL... events -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_SCROLLBAR_UPDATED, wxCommandEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_VLBOX_SELECTED, wxCommandEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_TOOL_RCLICKED, wxCommandEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_TOOL_DROPDOWN_CLICKED, wxCommandEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_TOOL_ENTER, wxCommandEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_COMBOBOX_DROPDOWN, wxCommandEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_COMBOBOX_CLOSEUP, wxCommandEvent); - - // Thread events -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_BASE, wxEVT_THREAD, wxThreadEvent); - - // Mouse event types -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_LEFT_DOWN, wxMouseEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_LEFT_UP, wxMouseEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MIDDLE_DOWN, wxMouseEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MIDDLE_UP, wxMouseEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_RIGHT_DOWN, wxMouseEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_RIGHT_UP, wxMouseEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOTION, wxMouseEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_ENTER_WINDOW, wxMouseEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_LEAVE_WINDOW, wxMouseEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_LEFT_DCLICK, wxMouseEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MIDDLE_DCLICK, wxMouseEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_RIGHT_DCLICK, wxMouseEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SET_FOCUS, wxFocusEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_KILL_FOCUS, wxFocusEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CHILD_FOCUS, wxChildFocusEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOUSEWHEEL, wxMouseEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX1_DOWN, wxMouseEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX1_UP, wxMouseEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX1_DCLICK, wxMouseEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX2_DOWN, wxMouseEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX2_UP, wxMouseEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX2_DCLICK, wxMouseEvent); - - // Character input event type -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CHAR, wxKeyEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CHAR_HOOK, wxKeyEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_NAVIGATION_KEY, wxNavigationKeyEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_KEY_DOWN, wxKeyEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_KEY_UP, wxKeyEvent); +#endif // WXWIN_COMPATIBILITY_EVENT_TYPES/!WXWIN_COMPATIBILITY_EVENT_TYPES + +BEGIN_DECLARE_EVENT_TYPES() + +#if WXWIN_COMPATIBILITY_EVENT_TYPES + wxEVT_NULL = 0, + wxEVT_FIRST = 10000, + wxEVT_USER_FIRST = wxEVT_FIRST + 2000, +#else // !WXWIN_COMPATIBILITY_EVENT_TYPES + // it is important to still have these as constants to avoid + // initialization order related problems + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_BASE, wxEVT_NULL, 0) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_BASE, wxEVT_FIRST, 10000) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_BASE, wxEVT_USER_FIRST, wxEVT_FIRST + 2000) +#endif // WXWIN_COMPATIBILITY_EVENT_TYPES/!WXWIN_COMPATIBILITY_EVENT_TYPES + + DECLARE_EVENT_TYPE(wxEVT_COMMAND_BUTTON_CLICKED, 1) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_CHECKBOX_CLICKED, 2) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_CHOICE_SELECTED, 3) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_LISTBOX_SELECTED, 4) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, 5) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, 6) + // now they are in wx/textctrl.h +#if WXWIN_COMPATIBILITY_EVENT_TYPES + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_UPDATED, 7) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_ENTER, 8) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_URL, 13) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_MAXLEN, 14) +#endif // WXWIN_COMPATIBILITY_EVENT_TYPES + DECLARE_EVENT_TYPE(wxEVT_COMMAND_MENU_SELECTED, 9) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_SLIDER_UPDATED, 10) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_RADIOBOX_SELECTED, 11) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_RADIOBUTTON_SELECTED, 12) + + // wxEVT_COMMAND_SCROLLBAR_UPDATED is now obsolete since we use + // wxEVT_SCROLL... events + + DECLARE_EVENT_TYPE(wxEVT_COMMAND_SCROLLBAR_UPDATED, 13) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_VLBOX_SELECTED, 14) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_COMBOBOX_SELECTED, 15) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TOOL_RCLICKED, 16) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TOOL_ENTER, 17) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_SPINCTRL_UPDATED, 18) + + // Sockets and timers send events, too + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_BASE, wxEVT_SOCKET, 50) + DECLARE_EVENT_TYPE(wxEVT_TIMER , 80) + + // Mouse event types + DECLARE_EVENT_TYPE(wxEVT_LEFT_DOWN, 100) + DECLARE_EVENT_TYPE(wxEVT_LEFT_UP, 101) + DECLARE_EVENT_TYPE(wxEVT_MIDDLE_DOWN, 102) + DECLARE_EVENT_TYPE(wxEVT_MIDDLE_UP, 103) + DECLARE_EVENT_TYPE(wxEVT_RIGHT_DOWN, 104) + DECLARE_EVENT_TYPE(wxEVT_RIGHT_UP, 105) + DECLARE_EVENT_TYPE(wxEVT_MOTION, 106) + DECLARE_EVENT_TYPE(wxEVT_ENTER_WINDOW, 107) + DECLARE_EVENT_TYPE(wxEVT_LEAVE_WINDOW, 108) + DECLARE_EVENT_TYPE(wxEVT_LEFT_DCLICK, 109) + DECLARE_EVENT_TYPE(wxEVT_MIDDLE_DCLICK, 110) + DECLARE_EVENT_TYPE(wxEVT_RIGHT_DCLICK, 111) + DECLARE_EVENT_TYPE(wxEVT_SET_FOCUS, 112) + DECLARE_EVENT_TYPE(wxEVT_KILL_FOCUS, 113) + DECLARE_EVENT_TYPE(wxEVT_CHILD_FOCUS, 114) + DECLARE_EVENT_TYPE(wxEVT_MOUSEWHEEL, 115) + + // Non-client mouse events + DECLARE_EVENT_TYPE(wxEVT_NC_LEFT_DOWN, 200) + DECLARE_EVENT_TYPE(wxEVT_NC_LEFT_UP, 201) + DECLARE_EVENT_TYPE(wxEVT_NC_MIDDLE_DOWN, 202) + DECLARE_EVENT_TYPE(wxEVT_NC_MIDDLE_UP, 203) + DECLARE_EVENT_TYPE(wxEVT_NC_RIGHT_DOWN, 204) + DECLARE_EVENT_TYPE(wxEVT_NC_RIGHT_UP, 205) + DECLARE_EVENT_TYPE(wxEVT_NC_MOTION, 206) + DECLARE_EVENT_TYPE(wxEVT_NC_ENTER_WINDOW, 207) + DECLARE_EVENT_TYPE(wxEVT_NC_LEAVE_WINDOW, 208) + DECLARE_EVENT_TYPE(wxEVT_NC_LEFT_DCLICK, 209) + DECLARE_EVENT_TYPE(wxEVT_NC_MIDDLE_DCLICK, 210) + DECLARE_EVENT_TYPE(wxEVT_NC_RIGHT_DCLICK, 211) + + // Character input event type + DECLARE_EVENT_TYPE(wxEVT_CHAR, 212) + DECLARE_EVENT_TYPE(wxEVT_CHAR_HOOK, 213) + DECLARE_EVENT_TYPE(wxEVT_NAVIGATION_KEY, 214) + DECLARE_EVENT_TYPE(wxEVT_KEY_DOWN, 215) + DECLARE_EVENT_TYPE(wxEVT_KEY_UP, 216) #if wxUSE_HOTKEY -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_HOTKEY, wxKeyEvent); + DECLARE_EVENT_TYPE(wxEVT_HOTKEY, 217) #endif -// This is a private event used by wxMSW code only and subject to change or -// disappear in the future. Don't use. -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AFTER_CHAR, wxKeyEvent); + // Set cursor event + DECLARE_EVENT_TYPE(wxEVT_SET_CURSOR, 230) - // Set cursor event -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SET_CURSOR, wxSetCursorEvent); + // wxScrollBar and wxSlider event identifiers + DECLARE_EVENT_TYPE(wxEVT_SCROLL_TOP, 300) + DECLARE_EVENT_TYPE(wxEVT_SCROLL_BOTTOM, 301) + DECLARE_EVENT_TYPE(wxEVT_SCROLL_LINEUP, 302) + DECLARE_EVENT_TYPE(wxEVT_SCROLL_LINEDOWN, 303) + DECLARE_EVENT_TYPE(wxEVT_SCROLL_PAGEUP, 304) + DECLARE_EVENT_TYPE(wxEVT_SCROLL_PAGEDOWN, 305) + DECLARE_EVENT_TYPE(wxEVT_SCROLL_THUMBTRACK, 306) + DECLARE_EVENT_TYPE(wxEVT_SCROLL_THUMBRELEASE, 307) + DECLARE_EVENT_TYPE(wxEVT_SCROLL_CHANGED, 308) - // wxScrollBar and wxSlider event identifiers -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_TOP, wxScrollEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_BOTTOM, wxScrollEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_LINEUP, wxScrollEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_LINEDOWN, wxScrollEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_PAGEUP, wxScrollEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_PAGEDOWN, wxScrollEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_THUMBTRACK, wxScrollEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_THUMBRELEASE, wxScrollEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_CHANGED, wxScrollEvent); + // Scroll events from wxWindow + DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_TOP, 320) + DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_BOTTOM, 321) + DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_LINEUP, 322) + DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_LINEDOWN, 323) + DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_PAGEUP, 324) + DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_PAGEDOWN, 325) + DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_THUMBTRACK, 326) + DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_THUMBRELEASE, 327) -// Due to a bug in older wx versions, wxSpinEvents were being sent with type of -// wxEVT_SCROLL_LINEUP, wxEVT_SCROLL_LINEDOWN and wxEVT_SCROLL_THUMBTRACK. But -// with the type-safe events in place, these event types are associated with -// wxScrollEvent. To allow handling of spin events, new event types have been -// defined in spinbutt.h/spinnbuttcmn.cpp. To maintain backward compatibility -// the spin event types are being initialized with the scroll event types. + // System events + DECLARE_EVENT_TYPE(wxEVT_SIZE, 400) + DECLARE_EVENT_TYPE(wxEVT_MOVE, 401) + DECLARE_EVENT_TYPE(wxEVT_CLOSE_WINDOW, 402) + DECLARE_EVENT_TYPE(wxEVT_END_SESSION, 403) + DECLARE_EVENT_TYPE(wxEVT_QUERY_END_SESSION, 404) + DECLARE_EVENT_TYPE(wxEVT_ACTIVATE_APP, 405) + // 406..408 are power events + DECLARE_EVENT_TYPE(wxEVT_ACTIVATE, 409) + DECLARE_EVENT_TYPE(wxEVT_CREATE, 410) + DECLARE_EVENT_TYPE(wxEVT_DESTROY, 411) + DECLARE_EVENT_TYPE(wxEVT_SHOW, 412) + DECLARE_EVENT_TYPE(wxEVT_ICONIZE, 413) + DECLARE_EVENT_TYPE(wxEVT_MAXIMIZE, 414) + DECLARE_EVENT_TYPE(wxEVT_MOUSE_CAPTURE_CHANGED, 415) + DECLARE_EVENT_TYPE(wxEVT_MOUSE_CAPTURE_LOST, 416) + DECLARE_EVENT_TYPE(wxEVT_PAINT, 417) + DECLARE_EVENT_TYPE(wxEVT_ERASE_BACKGROUND, 418) + DECLARE_EVENT_TYPE(wxEVT_NC_PAINT, 419) + DECLARE_EVENT_TYPE(wxEVT_PAINT_ICON, 420) + DECLARE_EVENT_TYPE(wxEVT_MENU_OPEN, 421) + DECLARE_EVENT_TYPE(wxEVT_MENU_CLOSE, 422) + DECLARE_EVENT_TYPE(wxEVT_MENU_HIGHLIGHT, 423) + DECLARE_EVENT_TYPE(wxEVT_CONTEXT_MENU, 424) + DECLARE_EVENT_TYPE(wxEVT_SYS_COLOUR_CHANGED, 425) + DECLARE_EVENT_TYPE(wxEVT_DISPLAY_CHANGED, 426) + DECLARE_EVENT_TYPE(wxEVT_SETTING_CHANGED, 427) + DECLARE_EVENT_TYPE(wxEVT_QUERY_NEW_PALETTE, 428) + DECLARE_EVENT_TYPE(wxEVT_PALETTE_CHANGED, 429) + DECLARE_EVENT_TYPE(wxEVT_JOY_BUTTON_DOWN, 430) + DECLARE_EVENT_TYPE(wxEVT_JOY_BUTTON_UP, 431) + DECLARE_EVENT_TYPE(wxEVT_JOY_MOVE, 432) + DECLARE_EVENT_TYPE(wxEVT_JOY_ZMOVE, 433) + DECLARE_EVENT_TYPE(wxEVT_DROP_FILES, 434) + DECLARE_EVENT_TYPE(wxEVT_DRAW_ITEM, 435) + DECLARE_EVENT_TYPE(wxEVT_MEASURE_ITEM, 436) + DECLARE_EVENT_TYPE(wxEVT_COMPARE_ITEM, 437) + DECLARE_EVENT_TYPE(wxEVT_INIT_DIALOG, 438) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_BASE, wxEVT_IDLE, 439) + DECLARE_EVENT_TYPE(wxEVT_UPDATE_UI, 440) + DECLARE_EVENT_TYPE(wxEVT_SIZING, 441) + DECLARE_EVENT_TYPE(wxEVT_MOVING, 442) + DECLARE_EVENT_TYPE(wxEVT_HIBERNATE, 443) + // more power events follow -- see wx/power.h -#if wxUSE_SPINBTN + // Clipboard events + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_COPY, 444) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_CUT, 445) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_PASTE, 446) -wxDECLARE_EXPORTED_EVENT_ALIAS( WXDLLIMPEXP_CORE, wxEVT_SPIN_UP, wxSpinEvent ); -wxDECLARE_EXPORTED_EVENT_ALIAS( WXDLLIMPEXP_CORE, wxEVT_SPIN_DOWN, wxSpinEvent ); -wxDECLARE_EXPORTED_EVENT_ALIAS( WXDLLIMPEXP_CORE, wxEVT_SPIN, wxSpinEvent ); + // Generic command events + // Note: a click is a higher-level event than button down/up + DECLARE_EVENT_TYPE(wxEVT_COMMAND_LEFT_CLICK, 500) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_LEFT_DCLICK, 501) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_RIGHT_CLICK, 502) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_RIGHT_DCLICK, 503) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_SET_FOCUS, 504) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_KILL_FOCUS, 505) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_ENTER, 506) -#endif + // Help events + DECLARE_EVENT_TYPE(wxEVT_HELP, 1050) + DECLARE_EVENT_TYPE(wxEVT_DETAILED_HELP, 1051) - // Scroll events from wxWindow -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_TOP, wxScrollWinEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_BOTTOM, wxScrollWinEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_LINEUP, wxScrollWinEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_LINEDOWN, wxScrollWinEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_PAGEUP, wxScrollWinEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_PAGEDOWN, wxScrollWinEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_THUMBTRACK, wxScrollWinEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_THUMBRELEASE, wxScrollWinEvent); - - // System events -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SIZE, wxSizeEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOVE, wxMoveEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CLOSE_WINDOW, wxCloseEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_END_SESSION, wxCloseEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_QUERY_END_SESSION, wxCloseEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_ACTIVATE_APP, wxActivateEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_ACTIVATE, wxActivateEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CREATE, wxWindowCreateEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_DESTROY, wxWindowDestroyEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SHOW, wxShowEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_ICONIZE, wxIconizeEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MAXIMIZE, wxMaximizeEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOUSE_CAPTURE_CHANGED, wxMouseCaptureChangedEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOUSE_CAPTURE_LOST, wxMouseCaptureLostEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_PAINT, wxPaintEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_ERASE_BACKGROUND, wxEraseEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_NC_PAINT, wxNcPaintEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MENU_OPEN, wxMenuEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MENU_CLOSE, wxMenuEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MENU_HIGHLIGHT, wxMenuEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CONTEXT_MENU, wxContextMenuEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SYS_COLOUR_CHANGED, wxSysColourChangedEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_DISPLAY_CHANGED, wxDisplayChangedEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_QUERY_NEW_PALETTE, wxQueryNewPaletteEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_PALETTE_CHANGED, wxPaletteChangedEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_JOY_BUTTON_DOWN, wxJoystickEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_JOY_BUTTON_UP, wxJoystickEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_JOY_MOVE, wxJoystickEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_JOY_ZMOVE, wxJoystickEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_DROP_FILES, wxDropFilesEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_INIT_DIALOG, wxInitDialogEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_BASE, wxEVT_IDLE, wxIdleEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_UPDATE_UI, wxUpdateUIEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SIZING, wxSizeEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOVING, wxMoveEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOVE_START, wxMoveEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOVE_END, wxMoveEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_HIBERNATE, wxActivateEvent); - - // Clipboard events -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_TEXT_COPY, wxClipboardTextEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_TEXT_CUT, wxClipboardTextEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_TEXT_PASTE, wxClipboardTextEvent); - - // Generic command events - // Note: a click is a higher-level event than button down/up -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_LEFT_CLICK, wxCommandEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_LEFT_DCLICK, wxCommandEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_RIGHT_CLICK, wxCommandEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_RIGHT_DCLICK, wxCommandEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_SET_FOCUS, wxCommandEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_KILL_FOCUS, wxCommandEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_ENTER, wxCommandEvent); - - // Help events -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_HELP, wxHelpEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_DETAILED_HELP, wxHelpEvent); +END_DECLARE_EVENT_TYPES() // these 2 events are the same #define wxEVT_COMMAND_TOOL_CLICKED wxEVT_COMMAND_MENU_SELECTED @@ -830,16 +299,13 @@ wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_DETAILED_HELP, wxHelpEvent); // wx/textctrl.h in all ports [yet], so declare it here as well // // still, any new code using it should include wx/textctrl.h explicitly -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_TEXT_UPDATED, wxCommandEvent); - - -// ---------------------------------------------------------------------------- -// wxEvent(-derived) classes -// ---------------------------------------------------------------------------- +#if !WXWIN_COMPATIBILITY_EVENT_TYPES + extern const wxEventType WXDLLIMPEXP_CORE wxEVT_COMMAND_TEXT_UPDATED; +#endif // the predefined constants for the number of times we propagate event // upwards window child-parent chain -enum wxEventPropagation +enum Propagation_state { // don't propagate it at all wxEVENT_PROPAGATE_NONE = 0, @@ -848,59 +314,6 @@ enum wxEventPropagation wxEVENT_PROPAGATE_MAX = INT_MAX }; -// The different categories for a wxEvent; see wxEvent::GetEventCategory. -// NOTE: they are used as OR-combinable flags by wxEventLoopBase::YieldFor -enum wxEventCategory -{ - // this is the category for those events which are generated to update - // the appearance of the GUI but which (usually) do not comport data - // processing, i.e. which do not provide input or output data - // (e.g. size events, scroll events, etc). - // They are events NOT directly generated by the user's input devices. - wxEVT_CATEGORY_UI = 1, - - // this category groups those events which are generated directly from the - // user through input devices like mouse and keyboard and usually result in - // data to be processed from the application. - // (e.g. mouse clicks, key presses, etc) - wxEVT_CATEGORY_USER_INPUT = 2, - - // this category is for wxSocketEvent - wxEVT_CATEGORY_SOCKET = 4, - - // this category is for wxTimerEvent - wxEVT_CATEGORY_TIMER = 8, - - // this category is for any event used to send notifications from the - // secondary threads to the main one or in general for notifications among - // different threads (which may or may not be user-generated) - wxEVT_CATEGORY_THREAD = 16, - - - // implementation only - - // used in the implementations of wxEventLoopBase::YieldFor - wxEVT_CATEGORY_UNKNOWN = 32, - - // a special category used as an argument to wxEventLoopBase::YieldFor to indicate that - // Yield() should leave all wxEvents on the queue while emptying the native event queue - // (native events will be processed but the wxEvents they generate will be queued) - wxEVT_CATEGORY_CLIPBOARD = 64, - - - // shortcut masks - - // this category groups those events which are emitted in response to - // events of the native toolkit and which typically are not-"delayable". - wxEVT_CATEGORY_NATIVE_EVENTS = wxEVT_CATEGORY_UI|wxEVT_CATEGORY_USER_INPUT, - - // used in wxEventLoopBase::YieldFor to specify all event categories should be processed: - wxEVT_CATEGORY_ALL = - wxEVT_CATEGORY_UI|wxEVT_CATEGORY_USER_INPUT|wxEVT_CATEGORY_SOCKET| \ - wxEVT_CATEGORY_TIMER|wxEVT_CATEGORY_THREAD|wxEVT_CATEGORY_UNKNOWN| \ - wxEVT_CATEGORY_CLIPBOARD -}; - /* * wxWidgets events, covering all interesting things that might happen * (button clicking, resizing, setting text in widgets, etc.). @@ -915,18 +328,21 @@ enum wxEventCategory class WXDLLIMPEXP_BASE wxEvent : public wxObject { +private: + wxEvent& operator=(const wxEvent&); + +protected: + wxEvent(const wxEvent&); // for implementing Clone() + public: wxEvent(int winid = 0, wxEventType commandType = wxEVT_NULL ); void SetEventType(wxEventType typ) { m_eventType = typ; } wxEventType GetEventType() const { return m_eventType; } - wxObject *GetEventObject() const { return m_eventObject; } void SetEventObject(wxObject *obj) { m_eventObject = obj; } - long GetTimestamp() const { return m_timeStamp; } void SetTimestamp(long ts = 0) { m_timeStamp = ts; } - int GetId() const { return m_id; } void SetId(int Id) { m_id = Id; } @@ -937,17 +353,11 @@ public: void Skip(bool skip = true) { m_skipped = skip; } bool GetSkipped() const { return m_skipped; } - // This function is used to create a copy of the event polymorphically and + // this function is used to create a copy of the event polymorphically and // all derived classes must implement it because otherwise wxPostEvent() // for them wouldn't work (it needs to do a copy of the event) virtual wxEvent *Clone() const = 0; - // this function is used to selectively process events in wxEventLoopBase::YieldFor - // NOTE: by default it returns wxEVT_CATEGORY_UI just because the major - // part of wxWidgets events belong to that category. - virtual wxEventCategory GetEventCategory() const - { return wxEVT_CATEGORY_UI; } - // Implementation only: this test is explicitly anti OO and this function // exists only for optimization purposes. bool IsCommandEvent() const { return m_isCommandEvent; } @@ -972,40 +382,11 @@ public: m_propagationLevel = propagationLevel; } - - // This is for internal use only and is only called by - // wxEvtHandler::ProcessEvent() to check whether it's the first time this - // event is being processed - bool WasProcessed() - { - if ( m_wasProcessed ) - return true; - - m_wasProcessed = true; - - return false; - } - - // This is also used only internally by ProcessEvent() to check if it - // should process the event normally or only restrict the search for the - // event handler to this object itself. - bool ShouldProcessOnlyIn(wxEvtHandler *h) const - { - return h == m_handlerToProcessOnlyIn; - } - - // Called to indicate that the result of ShouldProcessOnlyIn() wasn't taken - // into account. The existence of this function may seem counterintuitive - // but unfortunately it's needed by wxScrollHelperEvtHandler, see comments - // there. Don't even think of using this in your own code, this is a gross - // hack and is only needed because of wx complicated history and should - // never be used anywhere else. - void DidntHonourProcessOnlyIn() - { - m_handlerToProcessOnlyIn = NULL; - } - +#if WXWIN_COMPATIBILITY_2_4 +public: +#else protected: +#endif wxObject* m_eventObject; wxEventType m_eventType; long m_timeStamp; @@ -1015,36 +396,26 @@ public: // m_callbackUserData is for internal usage only wxObject* m_callbackUserData; -private: - // If this handler - wxEvtHandler *m_handlerToProcessOnlyIn; - protected: // the propagation level: while it is positive, we propagate the event to // the parent window (if any) + // + // this one doesn't have to be public, we don't have to worry about + // backwards compatibility as it is new int m_propagationLevel; +#if WXWIN_COMPATIBILITY_2_4 +public: +#else +protected: +#endif bool m_skipped; bool m_isCommandEvent; - // initially false but becomes true as soon as WasProcessed() is called for - // the first time, as this is done only by ProcessEvent() it explains the - // variable name: it becomes true after ProcessEvent() was called at least - // once for this event - bool m_wasProcessed; - -protected: - wxEvent(const wxEvent&); // for implementing Clone() - wxEvent& operator=(const wxEvent&); // for derived classes operator=() - private: // it needs to access our m_propagationLevel friend class WXDLLIMPEXP_FWD_BASE wxPropagateOnce; - // and this one needs to access our m_handlerToProcessOnlyIn - friend class WXDLLIMPEXP_FWD_BASE wxEventProcessInHandlerOnly; - - DECLARE_ABSTRACT_CLASS(wxEvent) }; @@ -1068,7 +439,7 @@ private: wxEvent& m_event; int m_propagationLevelOld; - wxDECLARE_NO_COPY_CLASS(wxPropagationDisabler); + DECLARE_NO_COPY_CLASS(wxPropagationDisabler) }; /* @@ -1093,175 +464,9 @@ public: private: wxEvent& m_event; - wxDECLARE_NO_COPY_CLASS(wxPropagateOnce); + DECLARE_NO_COPY_CLASS(wxPropagateOnce) }; -// A helper object used to temporarily make wxEvent::ShouldProcessOnlyIn() -// return true for the handler passed to its ctor. -class wxEventProcessInHandlerOnly -{ -public: - wxEventProcessInHandlerOnly(wxEvent& event, wxEvtHandler *handler) - : m_event(event), - m_handlerToProcessOnlyInOld(event.m_handlerToProcessOnlyIn) - { - m_event.m_handlerToProcessOnlyIn = handler; - } - - ~wxEventProcessInHandlerOnly() - { - m_event.m_handlerToProcessOnlyIn = m_handlerToProcessOnlyInOld; - } - -private: - wxEvent& m_event; - wxEvtHandler * const m_handlerToProcessOnlyInOld; - - wxDECLARE_NO_COPY_CLASS(wxEventProcessInHandlerOnly); -}; - - -class WXDLLIMPEXP_BASE wxEventBasicPayloadMixin -{ -public: - wxEventBasicPayloadMixin() - : m_commandInt(0), - m_extraLong(0) - { - } - - void SetString(const wxString& s) { m_cmdString = s; } - const wxString& GetString() const { return m_cmdString; } - - void SetInt(int i) { m_commandInt = i; } - int GetInt() const { return m_commandInt; } - - void SetExtraLong(long extraLong) { m_extraLong = extraLong; } - long GetExtraLong() const { return m_extraLong; } - -protected: - // Note: these variables have "cmd" or "command" in their name for backward compatibility: - // they used to be part of wxCommandEvent, not this mixin. - wxString m_cmdString; // String event argument - int m_commandInt; - long m_extraLong; // Additional information (e.g. select/deselect) - - wxDECLARE_NO_ASSIGN_CLASS(wxEventBasicPayloadMixin); -}; - -class WXDLLIMPEXP_BASE wxEventAnyPayloadMixin : public wxEventBasicPayloadMixin -{ -public: - wxEventAnyPayloadMixin() : wxEventBasicPayloadMixin() {} - -#if wxUSE_ANY && (!defined(__VISUALC__) || wxCHECK_VISUALC_VERSION(7)) - template - void SetPayload(const T& payload) - { - m_payload = payload; - } - - template - T GetPayload() const - { - return m_payload.As(); - } - -protected: - wxAny m_payload; -#endif // wxUSE_ANY && (!defined(__VISUALC__) || wxCHECK_VISUALC_VERSION(7)) - - wxDECLARE_NO_ASSIGN_CLASS(wxEventBasicPayloadMixin); -}; - - -// Idle event -/* - wxEVT_IDLE - */ - -// Whether to always send idle events to windows, or -// to only send update events to those with the -// wxWS_EX_PROCESS_IDLE style. - -enum wxIdleMode -{ - // Send idle events to all windows - wxIDLE_PROCESS_ALL, - - // Send idle events to windows that have - // the wxWS_EX_PROCESS_IDLE flag specified - wxIDLE_PROCESS_SPECIFIED -}; - -class WXDLLIMPEXP_BASE wxIdleEvent : public wxEvent -{ -public: - wxIdleEvent() - : wxEvent(0, wxEVT_IDLE), - m_requestMore(false) - { } - wxIdleEvent(const wxIdleEvent& event) - : wxEvent(event), - m_requestMore(event.m_requestMore) - { } - - void RequestMore(bool needMore = true) { m_requestMore = needMore; } - bool MoreRequested() const { return m_requestMore; } - - virtual wxEvent *Clone() const { return new wxIdleEvent(*this); } - - // Specify how wxWidgets will send idle events: to - // all windows, or only to those which specify that they - // will process the events. - static void SetMode(wxIdleMode mode) { sm_idleMode = mode; } - - // Returns the idle event mode - static wxIdleMode GetMode() { return sm_idleMode; } - -protected: - bool m_requestMore; - static wxIdleMode sm_idleMode; - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxIdleEvent) -}; - - -// Thread event - -class WXDLLIMPEXP_BASE wxThreadEvent : public wxEvent, - public wxEventAnyPayloadMixin -{ -public: - wxThreadEvent(wxEventType eventType = wxEVT_THREAD, int id = wxID_ANY) - : wxEvent(id, eventType) - { } - - wxThreadEvent(const wxThreadEvent& event) - : wxEvent(event), - wxEventAnyPayloadMixin(event) - { - // make sure our string member (which uses COW, aka refcounting) is not - // shared by other wxString instances: - SetString(GetString().Clone()); - } - - virtual wxEvent *Clone() const - { - return new wxThreadEvent(*this); - } - - // this is important to avoid that calling wxEventLoopBase::YieldFor thread events - // gets processed when this is unwanted: - virtual wxEventCategory GetEventCategory() const - { return wxEVT_CATEGORY_THREAD; } - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxThreadEvent) -}; - - #if wxUSE_GUI @@ -1284,15 +489,39 @@ private: wxEVT_COMMAND_TOGGLEBUTTON_CLICKED */ -class WXDLLIMPEXP_CORE wxCommandEvent : public wxEvent, - public wxEventBasicPayloadMixin +#if WXWIN_COMPATIBILITY_2_4 +// Backwards compatibility for wxCommandEvent::m_commandString, will lead to compilation errors in some cases of usage +class WXDLLIMPEXP_CORE wxCommandEvent; + +class WXDLLIMPEXP_CORE wxCommandEventStringHelper +{ +public: + wxCommandEventStringHelper(wxCommandEvent * evt) + : m_evt(evt) + { } + + void operator=(const wxString &str); + operator wxString(); + const wxChar* c_str() const; + +private: + wxCommandEvent* m_evt; +}; +#endif + +class WXDLLIMPEXP_CORE wxCommandEvent : public wxEvent { public: wxCommandEvent(wxEventType commandType = wxEVT_NULL, int winid = 0); wxCommandEvent(const wxCommandEvent& event) : wxEvent(event), - wxEventBasicPayloadMixin(event), +#if WXWIN_COMPATIBILITY_2_4 + m_commandString(this), +#endif + m_cmdString(event.m_cmdString), + m_commandInt(event.m_commandInt), + m_extraLong(event.m_extraLong), m_clientData(event.m_clientData), m_clientObject(event.m_clientObject) { } @@ -1305,23 +534,36 @@ public: void SetClientObject(wxClientData* clientObject) { m_clientObject = clientObject; } wxClientData *GetClientObject() const { return m_clientObject; } - // Note: this shadows wxEventBasicPayloadMixin::GetString(), because it does some - // GUI-specific hacks - wxString GetString() const; - // Get listbox selection if single-choice int GetSelection() const { return m_commandInt; } + // Set/Get listbox/choice selection string + void SetString(const wxString& s) { m_cmdString = s; } + wxString GetString() const; + // Get checkbox value bool IsChecked() const { return m_commandInt != 0; } // true if the listbox event was a selection. bool IsSelection() const { return (m_extraLong != 0); } - virtual wxEvent *Clone() const { return new wxCommandEvent(*this); } - virtual wxEventCategory GetEventCategory() const { return wxEVT_CATEGORY_USER_INPUT; } + void SetExtraLong(long extraLong) { m_extraLong = extraLong; } + long GetExtraLong() const { return m_extraLong; } + void SetInt(int i) { m_commandInt = i; } + int GetInt() const { return m_commandInt; } + + virtual wxEvent *Clone() const { return new wxCommandEvent(*this); } + +#if WXWIN_COMPATIBILITY_2_4 +public: + wxCommandEventStringHelper m_commandString; +#else protected: +#endif + wxString m_cmdString; // String event argument + int m_commandInt; + long m_extraLong; // Additional information (e.g. select/deselect) void* m_clientData; // Arbitrary client data wxClientData* m_clientObject; // Arbitrary client object @@ -1329,6 +571,23 @@ private: DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCommandEvent) }; +#if WXWIN_COMPATIBILITY_2_4 +inline void wxCommandEventStringHelper::operator=(const wxString &str) +{ + m_evt->SetString(str); +} + +inline wxCommandEventStringHelper::operator wxString() +{ + return m_evt->GetString(); +} + +inline const wxChar* wxCommandEventStringHelper::c_str() const +{ + return m_evt->GetString().c_str(); +} +#endif + // this class adds a possibility to react (from the user) code to a control // notification: allow or veto the operation being reported. class WXDLLIMPEXP_CORE wxNotifyEvent : public wxCommandEvent @@ -1360,7 +619,6 @@ private: DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxNotifyEvent) }; - // Scroll event class, derived form wxCommandEvent. wxScrollEvents are // sent by wxSlider and wxScrollBar. /* @@ -1410,7 +668,7 @@ class WXDLLIMPEXP_CORE wxScrollWinEvent : public wxEvent public: wxScrollWinEvent(wxEventType commandType = wxEVT_NULL, int pos = 0, int orient = 0); - wxScrollWinEvent(const wxScrollWinEvent& event) : wxEvent(event) + wxScrollWinEvent(const wxScrollWinEvent & event) : wxEvent(event) { m_commandInt = event.m_commandInt; m_extraLong = event.m_extraLong; } @@ -1421,7 +679,11 @@ public: virtual wxEvent *Clone() const { return new wxScrollWinEvent(*this); } +#if WXWIN_COMPATIBILITY_2_4 +public: +#else protected: +#endif int m_commandInt; long m_extraLong; @@ -1429,8 +691,6 @@ private: DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxScrollWinEvent) }; - - // Mouse event class /* @@ -1446,25 +706,36 @@ private: wxEVT_LEFT_DCLICK wxEVT_MIDDLE_DCLICK wxEVT_RIGHT_DCLICK + wxEVT_NC_LEFT_DOWN + wxEVT_NC_LEFT_UP, + wxEVT_NC_MIDDLE_DOWN, + wxEVT_NC_MIDDLE_UP, + wxEVT_NC_RIGHT_DOWN, + wxEVT_NC_RIGHT_UP, + wxEVT_NC_MOTION, + wxEVT_NC_ENTER_WINDOW, + wxEVT_NC_LEAVE_WINDOW, + wxEVT_NC_LEFT_DCLICK, + wxEVT_NC_MIDDLE_DCLICK, + wxEVT_NC_RIGHT_DCLICK, */ -enum wxMouseWheelAxis +// the symbolic names for the mouse buttons +enum { - wxMOUSE_WHEEL_VERTICAL, - wxMOUSE_WHEEL_HORIZONTAL + wxMOUSE_BTN_ANY = -1, + wxMOUSE_BTN_NONE = 0, + wxMOUSE_BTN_LEFT = 1, + wxMOUSE_BTN_MIDDLE = 2, + wxMOUSE_BTN_RIGHT = 3 }; -class WXDLLIMPEXP_CORE wxMouseEvent : public wxEvent, - public wxMouseState +class WXDLLIMPEXP_CORE wxMouseEvent : public wxEvent { public: wxMouseEvent(wxEventType mouseType = wxEVT_NULL); - wxMouseEvent(const wxMouseEvent& event) - : wxEvent(event), - wxMouseState(event) - { - Assign(event); - } + wxMouseEvent(const wxMouseEvent& event) : wxEvent(event) + { Assign(event); } // Was it a button event? (*doesn't* mean: is any button *down*?) bool IsButton() const { return Button(wxMOUSE_BTN_ANY); } @@ -1478,30 +749,47 @@ public: // Was it a up event from this (or any) button? bool ButtonUp(int but = wxMOUSE_BTN_ANY) const; - // Was this event generated by the given button? + // Was the given button? bool Button(int but) const; + // Was the given button in Down state? + bool ButtonIsDown(int but) const; + // Get the button which is changing state (wxMOUSE_BTN_NONE if none) int GetButton() const; + // Find state of shift/control keys + bool ControlDown() const { return m_controlDown; } + bool MetaDown() const { return m_metaDown; } + bool AltDown() const { return m_altDown; } + bool ShiftDown() const { return m_shiftDown; } + bool CmdDown() const + { +#if defined(__WXMAC__) || defined(__WXCOCOA__) + return MetaDown(); +#else + return ControlDown(); +#endif + } + // Find which event was just generated bool LeftDown() const { return (m_eventType == wxEVT_LEFT_DOWN); } bool MiddleDown() const { return (m_eventType == wxEVT_MIDDLE_DOWN); } bool RightDown() const { return (m_eventType == wxEVT_RIGHT_DOWN); } - bool Aux1Down() const { return (m_eventType == wxEVT_AUX1_DOWN); } - bool Aux2Down() const { return (m_eventType == wxEVT_AUX2_DOWN); } bool LeftUp() const { return (m_eventType == wxEVT_LEFT_UP); } bool MiddleUp() const { return (m_eventType == wxEVT_MIDDLE_UP); } bool RightUp() const { return (m_eventType == wxEVT_RIGHT_UP); } - bool Aux1Up() const { return (m_eventType == wxEVT_AUX1_UP); } - bool Aux2Up() const { return (m_eventType == wxEVT_AUX2_UP); } bool LeftDClick() const { return (m_eventType == wxEVT_LEFT_DCLICK); } bool MiddleDClick() const { return (m_eventType == wxEVT_MIDDLE_DCLICK); } bool RightDClick() const { return (m_eventType == wxEVT_RIGHT_DCLICK); } - bool Aux1DClick() const { return (m_eventType == wxEVT_AUX1_DCLICK); } - bool Aux2DClick() const { return (m_eventType == wxEVT_AUX2_DCLICK); } + + // Find the current state of the mouse buttons (regardless + // of current event type) + bool LeftIsDown() const { return m_leftDown; } + bool MiddleIsDown() const { return m_middleDown; } + bool RightIsDown() const { return m_rightDown; } // True if a button is down and the mouse is moving bool Dragging() const @@ -1521,12 +809,35 @@ public: // True if the mouse is just leaving the window bool Leaving() const { return (m_eventType == wxEVT_LEAVE_WINDOW); } - // Returns the number of mouse clicks associated with this event. - int GetClickCount() const { return m_clickCount; } + // Find the position of the event + void GetPosition(wxCoord *xpos, wxCoord *ypos) const + { + if (xpos) + *xpos = m_x; + if (ypos) + *ypos = m_y; + } + + void GetPosition(long *xpos, long *ypos) const + { + if (xpos) + *xpos = (long)m_x; + if (ypos) + *ypos = (long)m_y; + } + + // Find the position of the event + wxPoint GetPosition() const { return wxPoint(m_x, m_y); } // Find the logical position of the event given the DC wxPoint GetLogicalPosition(const wxDC& dc) const; + // Get X position + wxCoord GetX() const { return m_x; } + + // Get Y position + wxCoord GetY() const { return m_y; } + // Get wheel rotation, positive or negative indicates direction of // rotation. Current devices all send an event when rotation is equal to // +/-WheelDelta, but this allows for finer resolution devices to be @@ -1541,11 +852,6 @@ public: // should occur for each delta. int GetWheelDelta() const { return m_wheelDelta; } - // Gets the axis the wheel operation concerns; wxMOUSE_WHEEL_VERTICAL - // (most common case) or wxMOUSE_WHEEL_HORIZONTAL (for horizontal scrolling - // using e.g. a trackpad). - wxMouseWheelAxis GetWheelAxis() const { return m_wheelAxis; } - // Returns the configured number of lines (or whatever) to be scrolled per // wheel action. Defaults to one. int GetLinesPerAction() const { return m_linesPerAction; } @@ -1554,19 +860,21 @@ public: bool IsPageScroll() const { return ((unsigned int)m_linesPerAction == UINT_MAX); } virtual wxEvent *Clone() const { return new wxMouseEvent(*this); } - virtual wxEventCategory GetEventCategory() const { return wxEVT_CATEGORY_USER_INPUT; } - wxMouseEvent& operator=(const wxMouseEvent& event) - { - if (&event != this) - Assign(event); - return *this; - } + wxMouseEvent& operator=(const wxMouseEvent& event) { Assign(event); return *this; } public: - int m_clickCount; + wxCoord m_x, m_y; + + bool m_leftDown; + bool m_middleDown; + bool m_rightDown; + + bool m_controlDown; + bool m_shiftDown; + bool m_altDown; + bool m_metaDown; - wxMouseWheelAxis m_wheelAxis; int m_wheelRotation; int m_wheelDelta; int m_linesPerAction; @@ -1592,7 +900,7 @@ public: m_x(x), m_y(y), m_cursor() { } - wxSetCursorEvent(const wxSetCursorEvent& event) + wxSetCursorEvent(const wxSetCursorEvent & event) : wxEvent(event), m_x(event.m_x), m_y(event.m_y), @@ -1604,7 +912,7 @@ public: void SetCursor(const wxCursor& cursor) { m_cursor = cursor; } const wxCursor& GetCursor() const { return m_cursor; } - bool HasCursor() const { return m_cursor.IsOk(); } + bool HasCursor() const { return m_cursor.Ok(); } virtual wxEvent *Clone() const { return new wxSetCursorEvent(*this); } @@ -1626,51 +934,51 @@ private: wxEVT_HOTKEY */ -// key categories: the bit flags for IsKeyInCategory() function -// -// the enum values used may change in future version of wx -// use the named constants only, or bitwise combinations thereof -enum wxKeyCategoryFlags -{ - // arrow keys, on and off numeric keypads - WXK_CATEGORY_ARROW = 1, - - // page up and page down keys, on and off numeric keypads - WXK_CATEGORY_PAGING = 2, - - // home and end keys, on and off numeric keypads - WXK_CATEGORY_JUMP = 4, - - // tab key, on and off numeric keypads - WXK_CATEGORY_TAB = 8, - - // backspace and delete keys, on and off numeric keypads - WXK_CATEGORY_CUT = 16, - - // all keys usually used for navigation - WXK_CATEGORY_NAVIGATION = WXK_CATEGORY_ARROW | - WXK_CATEGORY_PAGING | - WXK_CATEGORY_JUMP -}; - -class WXDLLIMPEXP_CORE wxKeyEvent : public wxEvent, - public wxKeyboardState +class WXDLLIMPEXP_CORE wxKeyEvent : public wxEvent { public: wxKeyEvent(wxEventType keyType = wxEVT_NULL); - - // Normal copy ctor and a ctor creating a new event for the same key as the - // given one but a different event type (this is used in implementation - // code only, do not use outside of the library). wxKeyEvent(const wxKeyEvent& evt); - wxKeyEvent(wxEventType eventType, const wxKeyEvent& evt); + + // can be used check if the key event has exactly the given modifiers: + // "GetModifiers() = wxMOD_CONTROL" is easier to write than "ControlDown() + // && !MetaDown() && !AltDown() && !ShiftDown()" + int GetModifiers() const + { + return (m_controlDown ? wxMOD_CONTROL : 0) | + (m_shiftDown ? wxMOD_SHIFT : 0) | + (m_metaDown ? wxMOD_META : 0) | + (m_altDown ? wxMOD_ALT : 0); + } + + // Find state of shift/control keys + bool ControlDown() const { return m_controlDown; } + bool ShiftDown() const { return m_shiftDown; } + bool MetaDown() const { return m_metaDown; } + bool AltDown() const { return m_altDown; } + + // "Cmd" is a pseudo key which is Control for PC and Unix platforms but + // Apple ("Command") key under Macs: it makes often sense to use it instead + // of, say, ControlDown() because Cmd key is used for the same thing under + // Mac as Ctrl elsewhere (but Ctrl still exists, just not used for this + // purpose under Mac) + bool CmdDown() const + { +#if defined(__WXMAC__) || defined(__WXCOCOA__) + return MetaDown(); +#else + return ControlDown(); +#endif + } + + // exclude MetaDown() from HasModifiers() because NumLock under X is often + // configured as mod2 modifier, yet the key events even when it is pressed + // should be processed normally, not like Ctrl- or Alt-key + bool HasModifiers() const { return ControlDown() || AltDown(); } // get the key code: an ASCII7 char or an element of wxKeyCode enum int GetKeyCode() const { return (int)m_keyCode; } - // returns true iff this event's key code is of a certain type - bool IsKeyInCategory(int category) const; - #if wxUSE_UNICODE // get the Unicode character corresponding to this key wxChar GetUnicodeKey() const { return m_uniChar; } @@ -1704,32 +1012,33 @@ public: // Get Y position wxCoord GetY() const { return m_y; } - // Can be called from wxEVT_CHAR_HOOK handler to allow generation of normal - // key events even though the event had been handled (by default they would - // not be generated in this case). - void DoAllowNextEvent() { m_allowNext = true; } - - // Return the value of the "allow next" flag, for internal use only. - bool IsNextEventAllowed() const { return m_allowNext; } - +#if WXWIN_COMPATIBILITY_2_6 + // deprecated, Use GetKeyCode instead. + wxDEPRECATED( long KeyCode() const ); +#endif // WXWIN_COMPATIBILITY_2_6 virtual wxEvent *Clone() const { return new wxKeyEvent(*this); } - virtual wxEventCategory GetEventCategory() const { return wxEVT_CATEGORY_USER_INPUT; } // we do need to copy wxKeyEvent sometimes (in wxTreeCtrl code, for // example) wxKeyEvent& operator=(const wxKeyEvent& evt) { - if ( &evt != this ) - { - wxEvent::operator=(evt); + m_x = evt.m_x; + m_y = evt.m_y; - // Borland C++ 5.82 doesn't compile an explicit call to an - // implicitly defined operator=() so need to do it this way: - *static_cast(this) = evt; + m_keyCode = evt.m_keyCode; + + m_controlDown = evt.m_controlDown; + m_shiftDown = evt.m_shiftDown; + m_altDown = evt.m_altDown; + m_metaDown = evt.m_metaDown; + m_scanCode = evt.m_scanCode; + m_rawCode = evt.m_rawCode; + m_rawFlags = evt.m_rawFlags; +#if wxUSE_UNICODE + m_uniChar = evt.m_uniChar; +#endif - DoAssignMembers(evt); - } return *this; } @@ -1738,6 +1047,15 @@ public: long m_keyCode; + // TODO: replace those with a single m_modifiers bitmask of wxMOD_XXX? + bool m_controlDown; + bool m_shiftDown; + bool m_altDown; + bool m_metaDown; + + // FIXME: what is this for? relation to m_rawXXX? + bool m_scanCode; + #if wxUSE_UNICODE // This contains the full Unicode character // in a character events in Unicode mode @@ -1750,37 +1068,6 @@ public: wxUint32 m_rawFlags; private: - // Set the event to propagate if necessary, i.e. if it's of wxEVT_CHAR_HOOK - // type. This is used by all ctors. - void InitPropagation() - { - if ( m_eventType == wxEVT_CHAR_HOOK ) - m_propagationLevel = wxEVENT_PROPAGATE_MAX; - - m_allowNext = false; - } - - // Copy only the event data present in this class, this is used by - // AssignKeyData() and copy ctor. - void DoAssignMembers(const wxKeyEvent& evt) - { - m_x = evt.m_x; - m_y = evt.m_y; - - m_keyCode = evt.m_keyCode; - - m_rawCode = evt.m_rawCode; - m_rawFlags = evt.m_rawFlags; -#if wxUSE_UNICODE - m_uniChar = evt.m_uniChar; -#endif - } - - // If this flag is true, the normal key events should still be generated - // even if wxEVT_CHAR_HOOK had been handled. By default it is false as - // handling wxEVT_CHAR_HOOK suppresses all the subsequent events. - bool m_allowNext; - DECLARE_DYNAMIC_CLASS(wxKeyEvent) }; @@ -1798,7 +1085,7 @@ public: : wxEvent(winid, wxEVT_SIZE), m_size(sz) { } - wxSizeEvent(const wxSizeEvent& event) + wxSizeEvent(const wxSizeEvent & event) : wxEvent(event), m_size(event.m_size), m_rect(event.m_rect) { } @@ -1807,7 +1094,6 @@ public: { m_eventType = wxEVT_SIZING; m_id = id; } wxSize GetSize() const { return m_size; } - void SetSize(wxSize size) { m_size = size; } wxRect GetRect() const { return m_rect; } void SetRect(const wxRect& rect) { m_rect = rect; } @@ -1853,7 +1139,11 @@ public: virtual wxEvent *Clone() const { return new wxMoveEvent(*this); } +#if WXWIN_COMPATIBILITY_2_4 +public: +#else protected: +#endif wxPoint m_pos; wxRect m_rect; @@ -1865,11 +1155,10 @@ private: /* wxEVT_PAINT wxEVT_NC_PAINT + wxEVT_PAINT_ICON */ -#if wxDEBUG_LEVEL && (defined(__WXMSW__) || defined(__WXPM__)) - #define wxHAS_PAINT_DEBUG - +#if defined(__WXDEBUG__) && (defined(__WXMSW__) || defined(__WXPM__)) // see comments in src/msw|os2/dcclient.cpp where g_isPainting is defined extern WXDLLIMPEXP_CORE int g_isPainting; #endif // debug @@ -1880,15 +1169,15 @@ public: wxPaintEvent(int Id = 0) : wxEvent(Id, wxEVT_PAINT) { -#ifdef wxHAS_PAINT_DEBUG - // set the internal flag for the duration of redrawing +#if defined(__WXDEBUG__) && (defined(__WXMSW__) || defined(__WXPM__)) + // set the internal flag for the duration of processing of WM_PAINT g_isPainting++; #endif // debug } // default copy ctor and dtor are normally fine, we only need them to keep // g_isPainting updated in debug build -#ifdef wxHAS_PAINT_DEBUG +#if defined(__WXDEBUG__) && (defined(__WXMSW__) || defined(__WXPM__)) wxPaintEvent(const wxPaintEvent& event) : wxEvent(event) { @@ -1928,7 +1217,7 @@ private: class WXDLLIMPEXP_CORE wxEraseEvent : public wxEvent { public: - wxEraseEvent(int Id = 0, wxDC *dc = NULL) + wxEraseEvent(int Id = 0, wxDC *dc = (wxDC *) NULL) : wxEvent(Id, wxEVT_ERASE_BACKGROUND), m_dc(dc) { } @@ -1942,7 +1231,11 @@ public: virtual wxEvent *Clone() const { return new wxEraseEvent(*this); } +#if WXWIN_COMPATIBILITY_2_4 +public: +#else protected: +#endif wxDC *m_dc; private: @@ -2055,7 +1348,7 @@ public: wxMenuEvent(wxEventType type = wxEVT_NULL, int winid = 0, wxMenu* menu = NULL) : wxEvent(winid, type) { m_menuId = winid; m_menu = menu; } - wxMenuEvent(const wxMenuEvent& event) + wxMenuEvent(const wxMenuEvent & event) : wxEvent(event) { m_menuId = event.m_menuId; m_menu = event.m_menu; } @@ -2093,7 +1386,7 @@ public: m_veto(false), // should be false by default m_canVeto(true) {} - wxCloseEvent(const wxCloseEvent& event) + wxCloseEvent(const wxCloseEvent & event) : wxEvent(event), m_loggingOff(event.m_loggingOff), m_veto(event.m_veto), @@ -2143,17 +1436,14 @@ public: wxShowEvent(int winid = 0, bool show = false) : wxEvent(winid, wxEVT_SHOW) { m_show = show; } - wxShowEvent(const wxShowEvent& event) + wxShowEvent(const wxShowEvent & event) : wxEvent(event) { m_show = event.m_show; } void SetShow(bool show) { m_show = show; } - - // return true if the window was shown, false if hidden - bool IsShown() const { return m_show; } - -#if WXWIN_COMPATIBILITY_2_8 - wxDEPRECATED( bool GetShow() const { return IsShown(); } ) + bool GetShow() const { return m_show; } +#if wxABI_VERSION >= 20811 + bool IsShown() const { return GetShow(); } #endif virtual wxEvent *Clone() const { return new wxShowEvent(*this); } @@ -2175,16 +1465,15 @@ public: wxIconizeEvent(int winid = 0, bool iconized = true) : wxEvent(winid, wxEVT_ICONIZE) { m_iconized = iconized; } - wxIconizeEvent(const wxIconizeEvent& event) + wxIconizeEvent(const wxIconizeEvent & event) : wxEvent(event) { m_iconized = event.m_iconized; } -#if WXWIN_COMPATIBILITY_2_8 - wxDEPRECATED( bool Iconized() const { return IsIconized(); } ) -#endif // return true if the frame was iconized, false if restored - bool IsIconized() const { return m_iconized; } - + bool Iconized() const { return m_iconized; } +#if wxABI_VERSION >= 20811 + bool IsIconized() const { return Iconized(); } +#endif virtual wxEvent *Clone() const { return new wxIconizeEvent(*this); } protected: @@ -2237,7 +1526,11 @@ enum class WXDLLIMPEXP_CORE wxJoystickEvent : public wxEvent { +#if WXWIN_COMPATIBILITY_2_4 +public: +#else protected: +#endif wxPoint m_pos; int m_zPosition; int m_buttonChange; // Which button changed? @@ -2257,7 +1550,7 @@ public: m_joyStick(joystick) { } - wxJoystickEvent(const wxJoystickEvent& event) + wxJoystickEvent(const wxJoystickEvent & event) : wxEvent(event), m_pos(event.m_pos), m_zPosition(event.m_zPosition), @@ -2323,7 +1616,7 @@ public: wxDropFilesEvent(wxEventType type = wxEVT_NULL, int noFiles = 0, - wxString *files = NULL) + wxString *files = (wxString *) NULL) : wxEvent(0, type), m_noFiles(noFiles), m_pos(), @@ -2392,7 +1685,7 @@ public: m_setText = m_setChecked = false; } - wxUpdateUIEvent(const wxUpdateUIEvent& event) + wxUpdateUIEvent(const wxUpdateUIEvent & event) : wxCommandEvent(event), m_checked(event.m_checked), m_enabled(event.m_enabled), @@ -2556,7 +1849,7 @@ class WXDLLIMPEXP_CORE wxPaletteChangedEvent : public wxEvent public: wxPaletteChangedEvent(wxWindowID winid = 0) : wxEvent(winid, wxEVT_PALETTE_CHANGED), - m_changedWindow(NULL) + m_changedWindow((wxWindow *) NULL) { } wxPaletteChangedEvent(const wxPaletteChangedEvent& event) @@ -2588,7 +1881,7 @@ public: : wxEvent(winid, wxEVT_QUERY_NEW_PALETTE), m_paletteRealized(false) { } - wxQueryNewPaletteEvent(const wxQueryNewPaletteEvent& event) + wxQueryNewPaletteEvent(const wxQueryNewPaletteEvent & event) : wxEvent(event), m_paletteRealized(event.m_paletteRealized) { } @@ -2617,7 +1910,7 @@ public: wxNavigationKeyEvent() : wxEvent(0, wxEVT_NAVIGATION_KEY), m_flags(IsForward | FromTab), // defaults are for TAB - m_focus(NULL) + m_focus((wxWindow *)NULL) { m_propagationLevel = wxEVENT_PROPAGATE_NONE; } @@ -2658,7 +1951,7 @@ public: virtual wxEvent *Clone() const { return new wxNavigationKeyEvent(*this); } - enum wxNavigationKeyEventFlags + enum { IsBackward = 0x0000, IsForward = 0x0001, @@ -2734,7 +2027,7 @@ public: m_pos(pt), m_origin(GuessOrigin(origin)) { } - wxHelpEvent(const wxHelpEvent& event) + wxHelpEvent(const wxHelpEvent & event) : wxCommandEvent(event), m_pos(event.m_pos), m_target(event.m_target), @@ -2792,7 +2085,7 @@ public: wxWindowID winid = 0) : wxCommandEvent(type, winid) { } - wxClipboardTextEvent(const wxClipboardTextEvent& event) + wxClipboardTextEvent(const wxClipboardTextEvent & event) : wxCommandEvent(event) { } @@ -2819,7 +2112,7 @@ public: : wxCommandEvent(type, winid), m_pos(pt) { } - wxContextMenuEvent(const wxContextMenuEvent& event) + wxContextMenuEvent(const wxContextMenuEvent & event) : wxCommandEvent(event), m_pos(event.m_pos) { } @@ -2837,6 +2130,62 @@ private: DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxContextMenuEvent) }; +// Idle event +/* + wxEVT_IDLE + */ + +// Whether to always send idle events to windows, or +// to only send update events to those with the +// wxWS_EX_PROCESS_IDLE style. + +enum wxIdleMode +{ + // Send idle events to all windows + wxIDLE_PROCESS_ALL, + + // Send idle events to windows that have + // the wxWS_EX_PROCESS_IDLE flag specified + wxIDLE_PROCESS_SPECIFIED +}; + +class WXDLLIMPEXP_CORE wxIdleEvent : public wxEvent +{ +public: + wxIdleEvent() + : wxEvent(0, wxEVT_IDLE), + m_requestMore(false) + { } + wxIdleEvent(const wxIdleEvent & event) + : wxEvent(event), + m_requestMore(event.m_requestMore) + { } + + void RequestMore(bool needMore = true) { m_requestMore = needMore; } + bool MoreRequested() const { return m_requestMore; } + + virtual wxEvent *Clone() const { return new wxIdleEvent(*this); } + + // Specify how wxWidgets will send idle events: to + // all windows, or only to those which specify that they + // will process the events. + static void SetMode(wxIdleMode mode) { sm_idleMode = mode; } + + // Returns the idle event mode + static wxIdleMode GetMode() { return sm_idleMode; } + + // Can we send an idle event? + static bool CanSend(wxWindow* win); + +protected: + bool m_requestMore; + static wxIdleMode sm_idleMode; + +private: + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxIdleEvent) +}; + +#endif // wxUSE_GUI /* TODO wxEVT_MOUSE_CAPTURE_CHANGED, @@ -2848,69 +2197,75 @@ private: wxEVT_COMPARE_ITEM */ -#endif // wxUSE_GUI - // ============================================================================ // event handler and related classes // ============================================================================ +// for backwards compatibility and to prevent eVC 4 for ARM from crashing with +// internal compiler error when compiling wx, we define wxObjectEventFunction +// as a wxObject method even though it can only be a wxEvtHandler one +typedef void (wxObject::*wxObjectEventFunction)(wxEvent&); + +// we can't have ctors nor base struct in backwards compatibility mode or +// otherwise we won't be able to initialize the objects with an agregate, so +// we have to keep both versions +#if WXWIN_COMPATIBILITY_EVENT_TYPES + +struct WXDLLIMPEXP_BASE wxEventTableEntry +{ + // For some reason, this can't be wxEventType, or VC++ complains. + int m_eventType; // main event type + int m_id; // control/menu/toolbar id + int m_lastId; // used for ranges of ids + wxObjectEventFunction m_fn; // function to call: not wxEventFunction, + // because of dependency problems + + wxObject* m_callbackUserData; +}; + +#else // !WXWIN_COMPATIBILITY_EVENT_TYPES // struct containing the members common to static and dynamic event tables // entries struct WXDLLIMPEXP_BASE wxEventTableEntryBase { +private: + wxEventTableEntryBase& operator=(const wxEventTableEntryBase& event); + +public: wxEventTableEntryBase(int winid, int idLast, - wxEventFunctor* fn, wxObject *data) + wxObjectEventFunction fn, wxObject *data) : m_id(winid), m_lastId(idLast), m_fn(fn), m_callbackUserData(data) - { - wxASSERT_MSG( idLast == wxID_ANY || winid <= idLast, - "invalid IDs range: lower bound > upper bound" ); - } + { } - wxEventTableEntryBase( const wxEventTableEntryBase &entry ) - : m_id( entry.m_id ), - m_lastId( entry.m_lastId ), - m_fn( entry.m_fn ), - m_callbackUserData( entry.m_callbackUserData ) - { - // This is a 'hack' to ensure that only one instance tries to delete - // the functor pointer. It is safe as long as the only place where the - // copy constructor is being called is when the static event tables are - // being initialized (a temporary instance is created and then this - // constructor is called). - - const_cast( entry ).m_fn = NULL; - } - - ~wxEventTableEntryBase() - { - delete m_fn; - } + wxEventTableEntryBase(const wxEventTableEntryBase& event) + : m_id(event.m_id), + m_lastId(event.m_lastId), + m_fn(event.m_fn), + m_callbackUserData(event.m_callbackUserData) + { } // the range of ids for this entry: if m_lastId == wxID_ANY, the range // consists only of m_id, otherwise it is m_id..m_lastId inclusive int m_id, m_lastId; - // function/method/functor to call - wxEventFunctor* m_fn; + // function to call: not wxEventFunction, because of dependency problems + wxObjectEventFunction m_fn; - // arbitrary user data associated with the callback + // arbitrary user data asosciated with the callback wxObject* m_callbackUserData; - -private: - wxDECLARE_NO_ASSIGN_CLASS(wxEventTableEntryBase); }; // an entry from a static event table struct WXDLLIMPEXP_BASE wxEventTableEntry : public wxEventTableEntryBase { wxEventTableEntry(const int& evType, int winid, int idLast, - wxEventFunctor* fn, wxObject *data) + wxObjectEventFunction fn, wxObject *data) : wxEventTableEntryBase(winid, idLast, fn, data), m_eventType(evType) { } @@ -2924,16 +2279,17 @@ struct WXDLLIMPEXP_BASE wxEventTableEntry : public wxEventTableEntryBase const int& m_eventType; private: - wxDECLARE_NO_ASSIGN_CLASS(wxEventTableEntry); + wxEventTableEntry& operator=(const wxEventTableEntry&); }; // an entry used in dynamic event table managed by wxEvtHandler::Connect() struct WXDLLIMPEXP_BASE wxDynamicEventTableEntry : public wxEventTableEntryBase { wxDynamicEventTableEntry(int evType, int winid, int idLast, - wxEventFunctor* fn, wxObject *data) + wxObjectEventFunction fn, wxObject *data, wxEvtHandler* eventSink) : wxEventTableEntryBase(winid, idLast, fn, data), - m_eventType(evType) + m_eventType(evType), + m_eventSink(eventSink) { } // not a reference here as we can't keep a reference to a temporary int @@ -2941,10 +2297,16 @@ struct WXDLLIMPEXP_BASE wxDynamicEventTableEntry : public wxEventTableEntryBase // do we need it int m_eventType; -private: - wxDECLARE_NO_ASSIGN_CLASS(wxDynamicEventTableEntry); + // Pointer to object whose function is fn - so we don't assume the + // EventFunction is always a member of the EventHandler receiving the + // message + wxEvtHandler* m_eventSink; + + DECLARE_NO_COPY_CLASS(wxDynamicEventTableEntry) }; +#endif // !WXWIN_COMPATIBILITY_EVENT_TYPES + // ---------------------------------------------------------------------------- // wxEventTable: an array of event entries terminated with {0, 0, 0, 0, 0} // ---------------------------------------------------------------------------- @@ -2983,16 +2345,15 @@ public: // Handle the given event, in other words search the event table hash // and call self->ProcessEvent() if a match was found. - bool HandleEvent(wxEvent& event, wxEvtHandler *self); + bool HandleEvent(wxEvent &event, wxEvtHandler *self); // Clear table void Clear(); -#if wxUSE_MEMORY_TRACING - // Clear all tables: only used to work around problems in memory tracing - // code + // Clear all tables static void ClearAll(); -#endif // wxUSE_MEMORY_TRACING + // Rebuild all tables + static void ReconstructAll(); protected: // Init the hash table with the entries of the static event table. @@ -3016,7 +2377,7 @@ protected: wxEventHashTable* m_previous; wxEventHashTable* m_next; - wxDECLARE_NO_COPY_CLASS(wxEventHashTable); + DECLARE_NO_COPY_CLASS(wxEventHashTable) }; // ---------------------------------------------------------------------------- @@ -3024,252 +2385,75 @@ protected: // ---------------------------------------------------------------------------- class WXDLLIMPEXP_BASE wxEvtHandler : public wxObject - , public wxTrackable { public: wxEvtHandler(); virtual ~wxEvtHandler(); - - // Event handler chain - // ------------------- - wxEvtHandler *GetNextHandler() const { return m_nextHandler; } wxEvtHandler *GetPreviousHandler() const { return m_previousHandler; } - virtual void SetNextHandler(wxEvtHandler *handler) { m_nextHandler = handler; } - virtual void SetPreviousHandler(wxEvtHandler *handler) { m_previousHandler = handler; } + void SetNextHandler(wxEvtHandler *handler) { m_nextHandler = handler; } + void SetPreviousHandler(wxEvtHandler *handler) { m_previousHandler = handler; } void SetEvtHandlerEnabled(bool enabled) { m_enabled = enabled; } bool GetEvtHandlerEnabled() const { return m_enabled; } - void Unlink(); - bool IsUnlinked() const; - - - // Global event filters - // -------------------- - - // Add an event filter whose FilterEvent() method will be called for each - // and every event processed by wxWidgets. The filters are called in LIFO - // order and wxApp is registered as an event filter by default. The pointer - // must remain valid until it's removed with RemoveFilter() and is not - // deleted by wxEvtHandler. - static void AddFilter(wxEventFilter* filter); - - // Remove a filter previously installed with AddFilter(). - static void RemoveFilter(wxEventFilter* filter); - - - // Event queuing and processing - // ---------------------------- - - // Process an event right now: this can only be called from the main - // thread, use QueueEvent() for scheduling the events for - // processing from other threads. + // process an event right now virtual bool ProcessEvent(wxEvent& event); - // Process an event by calling ProcessEvent and handling any exceptions - // thrown by event handlers. It's mostly useful when processing wx events - // when called from C code (e.g. in GTK+ callback) when the exception - // wouldn't correctly propagate to wxEventLoop. - bool SafelyProcessEvent(wxEvent& event); - // NOTE: uses ProcessEvent() - - // This method tries to process the event in this event handler, including - // any preprocessing done by TryBefore() and all the handlers chained to - // it, but excluding the post-processing done in TryAfter(). - // - // It is meant to be called from ProcessEvent() only and is not virtual, - // additional event handlers can be hooked into the normal event processing - // logic using TryBefore() and TryAfter() hooks. - // - // You can also call it yourself to forward an event to another handler but - // without propagating it upwards if it's unhandled (this is usually - // unwanted when forwarding as the original handler would already do it if - // needed normally). - bool ProcessEventLocally(wxEvent& event); - - // Schedule the given event to be processed later. It takes ownership of - // the event pointer, i.e. it will be deleted later. This is safe to call - // from multiple threads although you still need to ensure that wxString - // fields of the event object are deep copies and not use the same string - // buffer as other wxString objects in this thread. - virtual void QueueEvent(wxEvent *event); - - // Add an event to be processed later: notice that this function is not - // safe to call from threads other than main, use QueueEvent() - virtual void AddPendingEvent(const wxEvent& event) - { - // notice that the thread-safety problem comes from the fact that - // Clone() doesn't make deep copies of wxString fields of wxEvent - // object and so the same wxString could be used from both threads when - // the event object is destroyed in this one -- QueueEvent() avoids - // this problem as the event pointer is not used any more in this - // thread at all after it is called. - QueueEvent(event.Clone()); - } + // add an event to be processed later + void AddPendingEvent(wxEvent& event); void ProcessPendingEvents(); - // NOTE: uses ProcessEvent() - - void DeletePendingEvents(); #if wxUSE_THREADS - bool ProcessThreadEvent(const wxEvent& event); - // NOTE: uses AddPendingEvent(); call only from secondary threads + bool ProcessThreadEvent(wxEvent& event); #endif - - // Connecting and disconnecting - // ---------------------------- - - // These functions are used for old, untyped, event handlers and don't - // check that the type of the function passed to them actually matches the - // type of the event. They also only allow connecting events to methods of - // wxEvtHandler-derived classes. - // - // The template Connect() methods below are safer and allow connecting - // events to arbitrary functions or functors -- but require compiler - // support for templates. - // Dynamic association of a member function handler with the event handler, // winid and event type void Connect(int winid, int lastId, - wxEventType eventType, + int eventType, wxObjectEventFunction func, - wxObject *userData = NULL, - wxEvtHandler *eventSink = NULL) - { - DoBind(winid, lastId, eventType, - wxNewEventFunctor(eventType, func, eventSink), - userData); - } + wxObject *userData = (wxObject *) NULL, + wxEvtHandler *eventSink = (wxEvtHandler *) NULL); // Convenience function: take just one id void Connect(int winid, - wxEventType eventType, + int eventType, wxObjectEventFunction func, - wxObject *userData = NULL, - wxEvtHandler *eventSink = NULL) + wxObject *userData = (wxObject *) NULL, + wxEvtHandler *eventSink = (wxEvtHandler *) NULL) { Connect(winid, wxID_ANY, eventType, func, userData, eventSink); } // Even more convenient: without id (same as using id of wxID_ANY) - void Connect(wxEventType eventType, + void Connect(int eventType, wxObjectEventFunction func, - wxObject *userData = NULL, - wxEvtHandler *eventSink = NULL) + wxObject *userData = (wxObject *) NULL, + wxEvtHandler *eventSink = (wxEvtHandler *) NULL) { Connect(wxID_ANY, wxID_ANY, eventType, func, userData, eventSink); } bool Disconnect(int winid, int lastId, wxEventType eventType, wxObjectEventFunction func = NULL, - wxObject *userData = NULL, - wxEvtHandler *eventSink = NULL) - { - return DoUnbind(winid, lastId, eventType, - wxMakeEventFunctor(eventType, func, eventSink), - userData ); - } + wxObject *userData = (wxObject *) NULL, + wxEvtHandler *eventSink = (wxEvtHandler *) NULL); bool Disconnect(int winid = wxID_ANY, wxEventType eventType = wxEVT_NULL, wxObjectEventFunction func = NULL, - wxObject *userData = NULL, - wxEvtHandler *eventSink = NULL) + wxObject *userData = (wxObject *) NULL, + wxEvtHandler *eventSink = (wxEvtHandler *) NULL) { return Disconnect(winid, wxID_ANY, eventType, func, userData, eventSink); } bool Disconnect(wxEventType eventType, wxObjectEventFunction func, - wxObject *userData = NULL, - wxEvtHandler *eventSink = NULL) + wxObject *userData = (wxObject *) NULL, + wxEvtHandler *eventSink = (wxEvtHandler *) NULL) { return Disconnect(wxID_ANY, eventType, func, userData, eventSink); } -#ifdef wxHAS_EVENT_BIND - // Bind functions to an event: - template - void Bind(const EventTag& eventType, - void (*function)(EventArg &), - int winid = wxID_ANY, - int lastId = wxID_ANY, - wxObject *userData = NULL) - { - DoBind(winid, lastId, eventType, - wxNewEventFunctor(eventType, function), - userData); - } - - - template - bool Unbind(const EventTag& eventType, - void (*function)(EventArg &), - int winid = wxID_ANY, - int lastId = wxID_ANY, - wxObject *userData = NULL) - { - return DoUnbind(winid, lastId, eventType, - wxMakeEventFunctor(eventType, function), - userData); - } - - // Bind functors to an event: - template - void Bind(const EventTag& eventType, - const Functor &functor, - int winid = wxID_ANY, - int lastId = wxID_ANY, - wxObject *userData = NULL) - { - DoBind(winid, lastId, eventType, - wxNewEventFunctor(eventType, functor), - userData); - } - - - template - bool Unbind(const EventTag& eventType, - const Functor &functor, - int winid = wxID_ANY, - int lastId = wxID_ANY, - wxObject *userData = NULL) - { - return DoUnbind(winid, lastId, eventType, - wxMakeEventFunctor(eventType, functor), - userData); - } - - - // Bind a method of a class (called on the specified handler which must - // be convertible to this class) object to an event: - - template - void Bind(const EventTag &eventType, - void (Class::*method)(EventArg &), - EventHandler *handler, - int winid = wxID_ANY, - int lastId = wxID_ANY, - wxObject *userData = NULL) - { - DoBind(winid, lastId, eventType, - wxNewEventFunctor(eventType, method, handler), - userData); - } - - template - bool Unbind(const EventTag &eventType, - void (Class::*method)(EventArg&), - EventHandler *handler, - int winid = wxID_ANY, - int lastId = wxID_ANY, - wxObject *userData = NULL ) - { - return DoUnbind(winid, lastId, eventType, - wxMakeEventFunctor(eventType, method, handler), - userData); - } -#endif // wxHAS_EVENT_BIND - wxList* GetDynamicEventTable() const { return m_dynamicEvents ; } // User data can be associated with each wxEvtHandler @@ -3279,80 +2463,48 @@ public: void SetClientData( void *data ) { DoSetClientData(data); } void *GetClientData() const { return DoGetClientData(); } - - // implementation from now on - // -------------------------- - - // check if the given event table entry matches this event by id (the check - // for the event type should be done by caller) and call the handler if it - // does + // check if the given event table entry matches this event and call the + // handler if it does // // return true if the event was processed, false otherwise (no match or the // handler decided to skip the event) - static bool ProcessEventIfMatchesId(const wxEventTableEntryBase& tableEntry, - wxEvtHandler *handler, - wxEvent& event); + static bool ProcessEventIfMatches(const wxEventTableEntryBase& tableEntry, + wxEvtHandler *handler, + wxEvent& event); + // implementation from now on virtual bool SearchEventTable(wxEventTable& table, wxEvent& event); bool SearchDynamicEventTable( wxEvent& event ); +#if wxUSE_THREADS + void ClearEventLocker(); +#endif // wxUSE_THREADS + // Avoid problems at exit by cleaning up static hash table gracefully void ClearEventHashTable() { GetEventHashTable().Clear(); } - void OnSinkDestroyed( wxEvtHandler *sink ); - private: - void DoBind(int winid, - int lastId, - wxEventType eventType, - wxEventFunctor *func, - wxObject* userData = NULL); - - bool DoUnbind(int winid, - int lastId, - wxEventType eventType, - const wxEventFunctor& func, - wxObject *userData = NULL); - static const wxEventTableEntry sm_eventTableEntries[]; protected: // hooks for wxWindow used by ProcessEvent() // ----------------------------------------- - // this one is called before trying our own event table to allow plugging - // in the event handlers overriding the default logic, this is used by e.g. - // validators. - virtual bool TryBefore(wxEvent& event); - - // This one is not a hook but just a helper which looks up the handler in - // this object itself. + // This one is called before trying our own event table to allow plugging + // in the validators. // - // It is called from ProcessEventLocally() and normally shouldn't be called - // directly as doing it would ignore any chained event handlers - bool TryHereOnly(wxEvent& event); - - // Another helper which simply calls pre-processing hook and then tries to - // handle the event at this handler level. - bool TryBeforeAndHere(wxEvent& event) - { - return TryBefore(event) || TryHereOnly(event); - } + // NB: This method is intentionally *not* inside wxUSE_VALIDATORS! + // It is part of wxBase which doesn't use validators and the code + // is compiled out when building wxBase w/o GUI classes, which affects + // binary compatibility and wxBase library can't be used by GUI + // ports. + virtual bool TryValidator(wxEvent& WXUNUSED(event)) { return false; } // this one is called after failing to find the event handle in our own // table to give a chance to the other windows to process it // // base class implementation passes the event to wxTheApp - virtual bool TryAfter(wxEvent& event); - -#if WXWIN_COMPATIBILITY_2_8 - // deprecated method: override TryBefore() instead of this one - wxDEPRECATED_BUT_USED_INTERNALLY_INLINE( - virtual bool TryValidator(wxEvent& WXUNUSED(event)), return false; ) - - wxDEPRECATED_BUT_USED_INTERNALLY_INLINE( - virtual bool TryParent(wxEvent& event), return DoTryApp(event); ) -#endif // WXWIN_COMPATIBILITY_2_8 + virtual bool TryParent(wxEvent& event); static const wxEventTable sm_eventTable; @@ -3367,9 +2519,18 @@ protected: wxList* m_pendingEvents; #if wxUSE_THREADS - // critical section protecting m_pendingEvents - wxCriticalSection m_pendingEventsLock; -#endif // wxUSE_THREADS +#if defined (__VISAGECPP__) + const wxCriticalSection& Lock() const { return m_eventsLocker; } + wxCriticalSection& Lock() { return m_eventsLocker; } + + wxCriticalSection m_eventsLocker; +# else + const wxCriticalSection& Lock() const { return *m_eventsLocker; } + wxCriticalSection& Lock() { return *m_eventsLocker; } + + wxCriticalSection* m_eventsLocker; +# endif +#endif // Is event handler enabled? bool m_enabled; @@ -3396,142 +2557,26 @@ protected: virtual void DoSetClientData( void *data ); virtual void *DoGetClientData() const; - // Search tracker objects for event connection with this sink - wxEventConnectionRef *FindRefInTrackerList(wxEvtHandler *handler); - private: - // pass the event to wxTheApp instance, called from TryAfter() - bool DoTryApp(wxEvent& event); - - // try to process events in all handlers chained to this one - bool DoTryChain(wxEvent& event); - - // Head of the event filter linked list. - static wxEventFilter* ms_filterList; - DECLARE_DYNAMIC_CLASS_NO_COPY(wxEvtHandler) }; -WX_DEFINE_ARRAY_WITH_DECL_PTR(wxEvtHandler *, wxEvtHandlerArray, class WXDLLIMPEXP_BASE); - - -// Define an inline method of wxObjectEventFunctor which couldn't be defined -// before wxEvtHandler declaration: at least Sun CC refuses to compile function -// calls through pointer to member for forward-declared classes (see #12452). -inline void wxObjectEventFunctor::operator()(wxEvtHandler *handler, wxEvent& event) +// Post a message to the given eventhandler which will be processed during the +// next event loop iteration +inline void wxPostEvent(wxEvtHandler *dest, wxEvent& event) { - wxEvtHandler * const realHandler = m_handler ? m_handler : handler; - - (realHandler->*m_method)(event); -} - -// ---------------------------------------------------------------------------- -// wxEventConnectionRef represents all connections between two event handlers -// and enables automatic disconnect when an event handler sink goes out of -// scope. Each connection/disconnect increases/decreases ref count, and -// when it reaches zero the node goes out of scope. -// ---------------------------------------------------------------------------- - -class wxEventConnectionRef : public wxTrackerNode -{ -public: - wxEventConnectionRef() : m_src(NULL), m_sink(NULL), m_refCount(0) { } - wxEventConnectionRef(wxEvtHandler *src, wxEvtHandler *sink) - : m_src(src), m_sink(sink), m_refCount(1) - { - m_sink->AddNode(this); - } - - // The sink is being destroyed - virtual void OnObjectDestroy( ) - { - if ( m_src ) - m_src->OnSinkDestroyed( m_sink ); - delete this; - } - - virtual wxEventConnectionRef *ToEventConnection() { return this; } - - void IncRef() { m_refCount++; } - void DecRef() - { - if ( !--m_refCount ) - { - // The sink holds the only external pointer to this object - if ( m_sink ) - m_sink->RemoveNode(this); - delete this; - } - } - -private: - wxEvtHandler *m_src, - *m_sink; - int m_refCount; - - friend class wxEvtHandler; - - wxDECLARE_NO_ASSIGN_CLASS(wxEventConnectionRef); -}; - -// Post a message to the given event handler which will be processed during the -// next event loop iteration. -// -// Notice that this one is not thread-safe, use wxQueueEvent() -inline void wxPostEvent(wxEvtHandler *dest, const wxEvent& event) -{ - wxCHECK_RET( dest, "need an object to post event to" ); + wxCHECK_RET( dest, wxT("need an object to post event to in wxPostEvent") ); dest->AddPendingEvent(event); } -// Wrapper around wxEvtHandler::QueueEvent(): adds an event for later -// processing, unlike wxPostEvent it is safe to use from different thread even -// for events with wxString members -inline void wxQueueEvent(wxEvtHandler *dest, wxEvent *event) -{ - wxCHECK_RET( dest, "need an object to queue event for" ); - - dest->QueueEvent(event); -} - typedef void (wxEvtHandler::*wxEventFunction)(wxEvent&); -typedef void (wxEvtHandler::*wxIdleEventFunction)(wxIdleEvent&); -typedef void (wxEvtHandler::*wxThreadEventFunction)(wxThreadEvent&); #define wxEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxEventFunction, func) -#define wxIdleEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxIdleEventFunction, func) -#define wxThreadEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxThreadEventFunction, func) + (wxObjectEventFunction)wxStaticCastEvent(wxEventFunction, &func) #if wxUSE_GUI -// ---------------------------------------------------------------------------- -// wxEventBlocker: helper class to temporarily disable event handling for a window -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxEventBlocker : public wxEvtHandler -{ -public: - wxEventBlocker(wxWindow *win, wxEventType type = wxEVT_ANY); - virtual ~wxEventBlocker(); - - void Block(wxEventType type) - { - m_eventsToBlock.push_back(type); - } - - virtual bool ProcessEvent(wxEvent& event); - -protected: - wxArrayInt m_eventsToBlock; - wxWindow *m_window; - - wxDECLARE_NO_COPY_CLASS(wxEventBlocker); -}; - typedef void (wxEvtHandler::*wxCommandEventFunction)(wxCommandEvent&); typedef void (wxEvtHandler::*wxScrollEventFunction)(wxScrollEvent&); typedef void (wxEvtHandler::*wxScrollWinEventFunction)(wxScrollWinEvent&); @@ -3552,6 +2597,7 @@ typedef void (wxEvtHandler::*wxInitDialogEventFunction)(wxInitDialogEvent&); typedef void (wxEvtHandler::*wxSysColourChangedEventFunction)(wxSysColourChangedEvent&); typedef void (wxEvtHandler::*wxDisplayChangedEventFunction)(wxDisplayChangedEvent&); typedef void (wxEvtHandler::*wxUpdateUIEventFunction)(wxUpdateUIEvent&); +typedef void (wxEvtHandler::*wxIdleEventFunction)(wxIdleEvent&); typedef void (wxEvtHandler::*wxCloseEventFunction)(wxCloseEvent&); typedef void (wxEvtHandler::*wxShowEventFunction)(wxShowEvent&); typedef void (wxEvtHandler::*wxIconizeEventFunction)(wxIconizeEvent&); @@ -3569,100 +2615,109 @@ typedef void (wxEvtHandler::*wxMouseCaptureChangedEventFunction)(wxMouseCaptureC typedef void (wxEvtHandler::*wxMouseCaptureLostEventFunction)(wxMouseCaptureLostEvent&); typedef void (wxEvtHandler::*wxClipboardTextEventFunction)(wxClipboardTextEvent&); +// these typedefs don't have the same name structure as the others, keep for +// backwards compatibility only +#if WXWIN_COMPATIBILITY_2_4 + typedef wxSysColourChangedEventFunction wxSysColourChangedFunction; + typedef wxDisplayChangedEventFunction wxDisplayChangedFunction; +#endif // WXWIN_COMPATIBILITY_2_4 + #define wxCommandEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxCommandEventFunction, func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxCommandEventFunction, &func) #define wxScrollEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxScrollEventFunction, func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxScrollEventFunction, &func) #define wxScrollWinEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxScrollWinEventFunction, func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxScrollWinEventFunction, &func) #define wxSizeEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxSizeEventFunction, func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxSizeEventFunction, &func) #define wxMoveEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxMoveEventFunction, func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxMoveEventFunction, &func) #define wxPaintEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxPaintEventFunction, func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxPaintEventFunction, &func) #define wxNcPaintEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxNcPaintEventFunction, func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxNcPaintEventFunction, &func) #define wxEraseEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxEraseEventFunction, func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxEraseEventFunction, &func) #define wxMouseEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxMouseEventFunction, func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxMouseEventFunction, &func) #define wxCharEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxCharEventFunction, func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxCharEventFunction, &func) #define wxKeyEventHandler(func) wxCharEventHandler(func) #define wxFocusEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxFocusEventFunction, func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxFocusEventFunction, &func) #define wxChildFocusEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxChildFocusEventFunction, func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxChildFocusEventFunction, &func) #define wxActivateEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxActivateEventFunction, func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxActivateEventFunction, &func) #define wxMenuEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxMenuEventFunction, func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxMenuEventFunction, &func) #define wxJoystickEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxJoystickEventFunction, func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxJoystickEventFunction, &func) #define wxDropFilesEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxDropFilesEventFunction, func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxDropFilesEventFunction, &func) #define wxInitDialogEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxInitDialogEventFunction, func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxInitDialogEventFunction, &func) #define wxSysColourChangedEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxSysColourChangedEventFunction, func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxSysColourChangedEventFunction, &func) #define wxDisplayChangedEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxDisplayChangedEventFunction, func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxDisplayChangedEventFunction, &func) #define wxUpdateUIEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxUpdateUIEventFunction, func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxUpdateUIEventFunction, &func) +#define wxIdleEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxIdleEventFunction, &func) #define wxCloseEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxCloseEventFunction, func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxCloseEventFunction, &func) #define wxShowEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxShowEventFunction, func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxShowEventFunction, &func) #define wxIconizeEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxIconizeEventFunction, func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxIconizeEventFunction, &func) #define wxMaximizeEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxMaximizeEventFunction, func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxMaximizeEventFunction, &func) #define wxNavigationKeyEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxNavigationKeyEventFunction, func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxNavigationKeyEventFunction, &func) #define wxPaletteChangedEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxPaletteChangedEventFunction, func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxPaletteChangedEventFunction, &func) #define wxQueryNewPaletteEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxQueryNewPaletteEventFunction, func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxQueryNewPaletteEventFunction, &func) #define wxWindowCreateEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxWindowCreateEventFunction, func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxWindowCreateEventFunction, &func) #define wxWindowDestroyEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxWindowDestroyEventFunction, func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxWindowDestroyEventFunction, &func) #define wxSetCursorEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxSetCursorEventFunction, func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxSetCursorEventFunction, &func) #define wxNotifyEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxNotifyEventFunction, func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxNotifyEventFunction, &func) #define wxHelpEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxHelpEventFunction, func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxHelpEventFunction, &func) #define wxContextMenuEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxContextMenuEventFunction, func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxContextMenuEventFunction, &func) #define wxMouseCaptureChangedEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxMouseCaptureChangedEventFunction, func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxMouseCaptureChangedEventFunction, &func) #define wxMouseCaptureLostEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxMouseCaptureLostEventFunction, func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxMouseCaptureLostEventFunction, &func) #define wxClipboardTextEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxClipboardTextEventFunction, func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxClipboardTextEventFunction, &func) #endif // wxUSE_GUI // N.B. In GNU-WIN32, you *have* to take the address of a member function // (use &) or the compiler crashes... -#define wxDECLARE_EVENT_TABLE() \ - private: \ - static const wxEventTableEntry sm_eventTableEntries[]; \ - protected: \ - static const wxEventTable sm_eventTable; \ - virtual const wxEventTable* GetEventTable() const; \ - static wxEventHashTable sm_eventHashTable; \ - virtual wxEventHashTable& GetEventHashTable() const +#define DECLARE_EVENT_TABLE() \ + private: \ + static const wxEventTableEntry sm_eventTableEntries[]; \ + protected: \ + static const wxEventTable sm_eventTable; \ + virtual const wxEventTable* GetEventTable() const; \ + static wxEventHashTable sm_eventHashTable; \ + virtual wxEventHashTable& GetEventHashTable() const; // N.B.: when building DLL with Borland C++ 5.5 compiler, you must initialize // sm_eventTable before using it in GetEventTable() or the compiler gives // E2233 (see http://groups.google.com/groups?selm=397dcc8a%241_2%40dnews) -#define wxBEGIN_EVENT_TABLE(theClass, baseClass) \ +#define BEGIN_EVENT_TABLE(theClass, baseClass) \ const wxEventTable theClass::sm_eventTable = \ { &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \ const wxEventTable *theClass::GetEventTable() const \ @@ -3672,7 +2727,7 @@ typedef void (wxEvtHandler::*wxClipboardTextEventFunction)(wxClipboardTextEvent& { return theClass::sm_eventHashTable; } \ const wxEventTableEntry theClass::sm_eventTableEntries[] = { \ -#define wxBEGIN_EVENT_TABLE_TEMPLATE1(theClass, baseClass, T1) \ +#define BEGIN_EVENT_TABLE_TEMPLATE1(theClass, baseClass, T1) \ template \ const wxEventTable theClass::sm_eventTable = \ { &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \ @@ -3687,7 +2742,7 @@ typedef void (wxEvtHandler::*wxClipboardTextEventFunction)(wxClipboardTextEvent& template \ const wxEventTableEntry theClass::sm_eventTableEntries[] = { \ -#define wxBEGIN_EVENT_TABLE_TEMPLATE2(theClass, baseClass, T1, T2) \ +#define BEGIN_EVENT_TABLE_TEMPLATE2(theClass, baseClass, T1, T2) \ template \ const wxEventTable theClass::sm_eventTable = \ { &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \ @@ -3702,7 +2757,7 @@ typedef void (wxEvtHandler::*wxClipboardTextEventFunction)(wxClipboardTextEvent& template \ const wxEventTableEntry theClass::sm_eventTableEntries[] = { \ -#define wxBEGIN_EVENT_TABLE_TEMPLATE3(theClass, baseClass, T1, T2, T3) \ +#define BEGIN_EVENT_TABLE_TEMPLATE3(theClass, baseClass, T1, T2, T3) \ template \ const wxEventTable theClass::sm_eventTable = \ { &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \ @@ -3717,7 +2772,7 @@ typedef void (wxEvtHandler::*wxClipboardTextEventFunction)(wxClipboardTextEvent& template \ const wxEventTableEntry theClass::sm_eventTableEntries[] = { \ -#define wxBEGIN_EVENT_TABLE_TEMPLATE4(theClass, baseClass, T1, T2, T3, T4) \ +#define BEGIN_EVENT_TABLE_TEMPLATE4(theClass, baseClass, T1, T2, T3, T4) \ template \ const wxEventTable theClass::sm_eventTable = \ { &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \ @@ -3732,7 +2787,7 @@ typedef void (wxEvtHandler::*wxClipboardTextEventFunction)(wxClipboardTextEvent& template \ const wxEventTableEntry theClass::sm_eventTableEntries[] = { \ -#define wxBEGIN_EVENT_TABLE_TEMPLATE5(theClass, baseClass, T1, T2, T3, T4, T5) \ +#define BEGIN_EVENT_TABLE_TEMPLATE5(theClass, baseClass, T1, T2, T3, T4, T5) \ template \ const wxEventTable theClass::sm_eventTable = \ { &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \ @@ -3747,7 +2802,7 @@ typedef void (wxEvtHandler::*wxClipboardTextEventFunction)(wxClipboardTextEvent& template \ const wxEventTableEntry theClass::sm_eventTableEntries[] = { \ -#define wxBEGIN_EVENT_TABLE_TEMPLATE7(theClass, baseClass, T1, T2, T3, T4, T5, T6, T7) \ +#define BEGIN_EVENT_TABLE_TEMPLATE7(theClass, baseClass, T1, T2, T3, T4, T5, T6, T7) \ template \ const wxEventTable theClass::sm_eventTable = \ { &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \ @@ -3762,7 +2817,7 @@ typedef void (wxEvtHandler::*wxClipboardTextEventFunction)(wxClipboardTextEvent& template \ const wxEventTableEntry theClass::sm_eventTableEntries[] = { \ -#define wxBEGIN_EVENT_TABLE_TEMPLATE8(theClass, baseClass, T1, T2, T3, T4, T5, T6, T7, T8) \ +#define BEGIN_EVENT_TABLE_TEMPLATE8(theClass, baseClass, T1, T2, T3, T4, T5, T6, T7, T8) \ template \ const wxEventTable theClass::sm_eventTable = \ { &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \ @@ -3777,8 +2832,7 @@ typedef void (wxEvtHandler::*wxClipboardTextEventFunction)(wxClipboardTextEvent& template \ const wxEventTableEntry theClass::sm_eventTableEntries[] = { \ -#define wxEND_EVENT_TABLE() \ - wxDECLARE_EVENT_TABLE_TERMINATOR() }; +#define END_EVENT_TABLE() DECLARE_EVENT_TABLE_ENTRY( wxEVT_NULL, 0, 0, 0, 0 ) }; /* * Event table macros @@ -3792,7 +2846,7 @@ typedef void (wxEvtHandler::*wxClipboardTextEventFunction)(wxClipboardTextEvent& // - id1, id2 ids of the first/last id // - fn the function (should be cast to the right type) #define wx__DECLARE_EVT2(evt, id1, id2, fn) \ - wxDECLARE_EVENT_TABLE_ENTRY(evt, id1, id2, fn, NULL), + DECLARE_EVENT_TABLE_ENTRY(evt, id1, id2, fn, NULL), #define wx__DECLARE_EVT1(evt, id, fn) \ wx__DECLARE_EVT2(evt, id, wxID_ANY, fn) #define wx__DECLARE_EVT0(evt, fn) \ @@ -3808,13 +2862,11 @@ typedef void (wxEvtHandler::*wxClipboardTextEventFunction)(wxClipboardTextEvent& // EVT_COMMAND #define EVT_COMMAND(winid, event, func) \ wx__DECLARE_EVT1(event, winid, wxCommandEventHandler(func)) - #define EVT_COMMAND_RANGE(id1, id2, event, func) \ wx__DECLARE_EVT2(event, id1, id2, wxCommandEventHandler(func)) #define EVT_NOTIFY(event, winid, func) \ wx__DECLARE_EVT1(event, winid, wxNotifyEventHandler(func)) - #define EVT_NOTIFY_RANGE(event, id1, id2, func) \ wx__DECLARE_EVT2(event, id1, id2, wxNotifyEventHandler(func)) @@ -3823,8 +2875,6 @@ typedef void (wxEvtHandler::*wxClipboardTextEventFunction)(wxClipboardTextEvent& #define EVT_SIZING(func) wx__DECLARE_EVT0(wxEVT_SIZING, wxSizeEventHandler(func)) #define EVT_MOVE(func) wx__DECLARE_EVT0(wxEVT_MOVE, wxMoveEventHandler(func)) #define EVT_MOVING(func) wx__DECLARE_EVT0(wxEVT_MOVING, wxMoveEventHandler(func)) -#define EVT_MOVE_START(func) wx__DECLARE_EVT0(wxEVT_MOVE_START, wxMoveEventHandler(func)) -#define EVT_MOVE_END(func) wx__DECLARE_EVT0(wxEVT_MOVE_END, wxMoveEventHandler(func)) #define EVT_CLOSE(func) wx__DECLARE_EVT0(wxEVT_CLOSE_WINDOW, wxCloseEventHandler(func)) #define EVT_END_SESSION(func) wx__DECLARE_EVT0(wxEVT_END_SESSION, wxCloseEventHandler(func)) #define EVT_QUERY_END_SESSION(func) wx__DECLARE_EVT0(wxEVT_QUERY_END_SESSION, wxCloseEventHandler(func)) @@ -3880,31 +2930,19 @@ typedef void (wxEvtHandler::*wxClipboardTextEventFunction)(wxClipboardTextEvent& #define EVT_LEAVE_WINDOW(func) wx__DECLARE_EVT0(wxEVT_LEAVE_WINDOW, wxMouseEventHandler(func)) #define EVT_ENTER_WINDOW(func) wx__DECLARE_EVT0(wxEVT_ENTER_WINDOW, wxMouseEventHandler(func)) #define EVT_MOUSEWHEEL(func) wx__DECLARE_EVT0(wxEVT_MOUSEWHEEL, wxMouseEventHandler(func)) -#define EVT_MOUSE_AUX1_DOWN(func) wx__DECLARE_EVT0(wxEVT_AUX1_DOWN, wxMouseEventHandler(func)) -#define EVT_MOUSE_AUX1_UP(func) wx__DECLARE_EVT0(wxEVT_AUX1_UP, wxMouseEventHandler(func)) -#define EVT_MOUSE_AUX1_DCLICK(func) wx__DECLARE_EVT0(wxEVT_AUX1_DCLICK, wxMouseEventHandler(func)) -#define EVT_MOUSE_AUX2_DOWN(func) wx__DECLARE_EVT0(wxEVT_AUX2_DOWN, wxMouseEventHandler(func)) -#define EVT_MOUSE_AUX2_UP(func) wx__DECLARE_EVT0(wxEVT_AUX2_UP, wxMouseEventHandler(func)) -#define EVT_MOUSE_AUX2_DCLICK(func) wx__DECLARE_EVT0(wxEVT_AUX2_DCLICK, wxMouseEventHandler(func)) // All mouse events #define EVT_MOUSE_EVENTS(func) \ EVT_LEFT_DOWN(func) \ EVT_LEFT_UP(func) \ - EVT_LEFT_DCLICK(func) \ EVT_MIDDLE_DOWN(func) \ EVT_MIDDLE_UP(func) \ - EVT_MIDDLE_DCLICK(func) \ EVT_RIGHT_DOWN(func) \ EVT_RIGHT_UP(func) \ - EVT_RIGHT_DCLICK(func) \ - EVT_MOUSE_AUX1_DOWN(func) \ - EVT_MOUSE_AUX1_UP(func) \ - EVT_MOUSE_AUX1_DCLICK(func) \ - EVT_MOUSE_AUX2_DOWN(func) \ - EVT_MOUSE_AUX2_UP(func) \ - EVT_MOUSE_AUX2_DCLICK(func) \ EVT_MOTION(func) \ + EVT_LEFT_DCLICK(func) \ + EVT_MIDDLE_DCLICK(func) \ + EVT_RIGHT_DCLICK(func) \ EVT_LEAVE_WINDOW(func) \ EVT_ENTER_WINDOW(func) \ EVT_MOUSEWHEEL(func) @@ -4000,14 +3038,11 @@ typedef void (wxEvtHandler::*wxClipboardTextEventFunction)(wxClipboardTextEvent& #define EVT_VLBOX(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_VLBOX_SELECTED, winid, wxCommandEventHandler(func)) #define EVT_COMBOBOX(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_COMBOBOX_SELECTED, winid, wxCommandEventHandler(func)) #define EVT_TOOL(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_TOOL_CLICKED, winid, wxCommandEventHandler(func)) -#define EVT_TOOL_DROPDOWN(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_TOOL_DROPDOWN_CLICKED, winid, wxCommandEventHandler(func)) #define EVT_TOOL_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_COMMAND_TOOL_CLICKED, id1, id2, wxCommandEventHandler(func)) #define EVT_TOOL_RCLICKED(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_TOOL_RCLICKED, winid, wxCommandEventHandler(func)) #define EVT_TOOL_RCLICKED_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_COMMAND_TOOL_RCLICKED, id1, id2, wxCommandEventHandler(func)) #define EVT_TOOL_ENTER(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_TOOL_ENTER, winid, wxCommandEventHandler(func)) #define EVT_CHECKLISTBOX(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, winid, wxCommandEventHandler(func)) -#define EVT_COMBOBOX_DROPDOWN(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_COMBOBOX_DROPDOWN, winid, wxCommandEventHandler(func)) -#define EVT_COMBOBOX_CLOSEUP(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_COMBOBOX_CLOSEUP, winid, wxCommandEventHandler(func)) // Generic command events #define EVT_COMMAND_LEFT_CLICK(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_LEFT_CLICK, winid, wxCommandEventHandler(func)) @@ -4025,6 +3060,12 @@ typedef void (wxEvtHandler::*wxClipboardTextEventFunction)(wxClipboardTextEvent& #define EVT_JOY_MOVE(func) wx__DECLARE_EVT0(wxEVT_JOY_MOVE, wxJoystickEventHandler(func)) #define EVT_JOY_ZMOVE(func) wx__DECLARE_EVT0(wxEVT_JOY_ZMOVE, wxJoystickEventHandler(func)) +// These are obsolete, see _BUTTON_ events +#if WXWIN_COMPATIBILITY_2_4 + #define EVT_JOY_DOWN(func) EVT_JOY_BUTTON_DOWN(func) + #define EVT_JOY_UP(func) EVT_JOY_BUTTON_UP(func) +#endif // WXWIN_COMPATIBILITY_2_4 + // All joystick events #define EVT_JOYSTICK_EVENTS(func) \ EVT_JOY_BUTTON_DOWN(func) \ @@ -4054,50 +3095,21 @@ typedef void (wxEvtHandler::*wxClipboardTextEventFunction)(wxClipboardTextEvent& #define EVT_TEXT_COPY(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_TEXT_COPY, winid, wxClipboardTextEventHandler(func)) #define EVT_TEXT_PASTE(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_TEXT_PASTE, winid, wxClipboardTextEventHandler(func)) -// Thread events -#define EVT_THREAD(id, func) wx__DECLARE_EVT1(wxEVT_THREAD, id, wxThreadEventHandler(func)) -// alias for backward compatibility with 2.9.0: -#define wxEVT_COMMAND_THREAD wxEVT_THREAD +// ---------------------------------------------------------------------------- +// Global data +// ---------------------------------------------------------------------------- + +// for pending event processing - notice that there is intentionally no +// WXDLLEXPORT here +extern WXDLLIMPEXP_BASE wxList *wxPendingEvents; +#if wxUSE_THREADS + extern WXDLLIMPEXP_BASE wxCriticalSection *wxPendingEventsLocker; +#endif // ---------------------------------------------------------------------------- // Helper functions // ---------------------------------------------------------------------------- -// This is an ugly hack to allow the use of Bind() instead of Connect() inside -// the library code if the library was built with support for it, here is how -// it is used: -// -// class SomeEventHandlingClass : wxBIND_OR_CONNECT_HACK_BASE_CLASS -// public SomeBaseClass -// { -// public: -// SomeEventHandlingClass(wxWindow *win) -// { -// // connect to the event for the given window -// wxBIND_OR_CONNECT_HACK(win, wxEVT_SOMETHING, wxSomeEventHandler, -// SomeEventHandlingClass::OnSomeEvent, this); -// } -// -// private: -// void OnSomeEvent(wxSomeEvent&) { ... } -// }; -// -// This is *not* meant to be used by library users, it is only defined here -// (and not in a private header) because the base class must be visible from -// other public headers, please do NOT use this in your code, it will be -// removed from future wx versions without warning. -#ifdef wxHAS_EVENT_BIND - #define wxBIND_OR_CONNECT_HACK_BASE_CLASS - #define wxBIND_OR_CONNECT_HACK_ONLY_BASE_CLASS - #define wxBIND_OR_CONNECT_HACK(win, evt, handler, func, obj) \ - win->Bind(evt, &func, obj) -#else // wxHAS_EVENT_BIND - #define wxBIND_OR_CONNECT_HACK_BASE_CLASS public wxEvtHandler, - #define wxBIND_OR_CONNECT_HACK_ONLY_BASE_CLASS : public wxEvtHandler - #define wxBIND_OR_CONNECT_HACK(win, evt, handler, func, obj) \ - win->Connect(evt, handler(func), NULL, obj) -#endif // wxHAS_EVENT_BIND - #if wxUSE_GUI // Find a window with the focus, that is also a descendant of the given window. @@ -4106,39 +3118,4 @@ WXDLLIMPEXP_CORE wxWindow* wxFindFocusDescendant(wxWindow* ancestor); #endif // wxUSE_GUI - -// ---------------------------------------------------------------------------- -// Compatibility macro aliases -// ---------------------------------------------------------------------------- - -// deprecated variants _not_ requiring a semicolon after them and without wx prefix -// (note that also some wx-prefixed macro do _not_ require a semicolon because -// it's not always possible to force the compire to require it) - -#define DECLARE_EVENT_TABLE_ENTRY(type, winid, idLast, fn, obj) \ - wxDECLARE_EVENT_TABLE_ENTRY(type, winid, idLast, fn, obj) -#define DECLARE_EVENT_TABLE_TERMINATOR() wxDECLARE_EVENT_TABLE_TERMINATOR() -#define DECLARE_EVENT_TABLE() wxDECLARE_EVENT_TABLE(); -#define BEGIN_EVENT_TABLE(a,b) wxBEGIN_EVENT_TABLE(a,b) -#define BEGIN_EVENT_TABLE_TEMPLATE1(a,b,c) wxBEGIN_EVENT_TABLE_TEMPLATE1(a,b,c) -#define BEGIN_EVENT_TABLE_TEMPLATE2(a,b,c,d) wxBEGIN_EVENT_TABLE_TEMPLATE1(a,b,c,d) -#define BEGIN_EVENT_TABLE_TEMPLATE3(a,b,c,d,e) wxBEGIN_EVENT_TABLE_TEMPLATE1(a,b,c,d,e) -#define BEGIN_EVENT_TABLE_TEMPLATE4(a,b,c,d,e,f) wxBEGIN_EVENT_TABLE_TEMPLATE1(a,b,c,d,e,f) -#define BEGIN_EVENT_TABLE_TEMPLATE5(a,b,c,d,e,f,g) wxBEGIN_EVENT_TABLE_TEMPLATE1(a,b,c,d,e,f,g) -#define BEGIN_EVENT_TABLE_TEMPLATE6(a,b,c,d,e,f,g,h) wxBEGIN_EVENT_TABLE_TEMPLATE1(a,b,c,d,e,f,g,h) -#define END_EVENT_TABLE() wxEND_EVENT_TABLE() - -// other obsolete event declaration/definition macros; we don't need them any longer -// but we keep them for compatibility as it doesn't cost us anything anyhow -#define BEGIN_DECLARE_EVENT_TYPES() -#define END_DECLARE_EVENT_TYPES() -#define DECLARE_EXPORTED_EVENT_TYPE(expdecl, name, value) \ - extern expdecl const wxEventType name; -#define DECLARE_EVENT_TYPE(name, value) \ - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_CORE, name, value) -#define DECLARE_LOCAL_EVENT_TYPE(name, value) \ - DECLARE_EXPORTED_EVENT_TYPE(wxEMPTY_PARAMETER_VALUE, name, value) -#define DEFINE_EVENT_TYPE(name) const wxEventType name = wxNewEventType(); -#define DEFINE_LOCAL_EVENT_TYPE(name) DEFINE_EVENT_TYPE(name) - -#endif // _WX_EVENT_H_ +#endif // _WX_EVENT_H__ diff --git a/Source/3rd Party/wx/include/wx/eventfilter.h b/Source/3rd Party/wx/include/wx/eventfilter.h deleted file mode 100644 index af55b518b..000000000 --- a/Source/3rd Party/wx/include/wx/eventfilter.h +++ /dev/null @@ -1,72 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/eventfilter.h -// Purpose: wxEventFilter class declaration. -// Author: Vadim Zeitlin -// Created: 2011-11-21 -// RCS-ID: $Id$ -// Copyright: (c) 2011 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_EVENTFILTER_H_ -#define _WX_EVENTFILTER_H_ - -#include "wx/defs.h" - -class WXDLLIMPEXP_FWD_BASE wxEvent; -class WXDLLIMPEXP_FWD_BASE wxEvtHandler; - -// ---------------------------------------------------------------------------- -// wxEventFilter is used with wxEvtHandler::AddFilter() and ProcessEvent(). -// ---------------------------------------------------------------------------- - -class wxEventFilter -{ -public: - // Possible return values for FilterEvent(). - // - // Notice that the values of these enum elements are fixed due to backwards - // compatibility constraints. - enum - { - // Process event as usual. - Event_Skip = -1, - - // Don't process the event normally at all. - Event_Ignore = 0, - - // Event was already handled, don't process it normally. - Event_Processed = 1 - }; - - wxEventFilter() - { - m_next = NULL; - } - - virtual ~wxEventFilter() - { - wxASSERT_MSG( !m_next, "Forgot to call wxEvtHandler::RemoveFilter()?" ); - } - - // This method allows to filter all the events processed by the program, so - // you should try to return quickly from it to avoid slowing down the - // program to a crawl. - // - // Return value should be -1 to continue with the normal event processing, - // or true or false to stop further processing and pretend that the event - // had been already processed or won't be processed at all, respectively. - virtual int FilterEvent(wxEvent& event) = 0; - -private: - // Objects of this class are made to be stored in a linked list in - // wxEvtHandler so put the next node ponter directly in the class itself. - wxEventFilter* m_next; - - // And provide access to it for wxEvtHandler [only]. - friend class wxEvtHandler; - - wxDECLARE_NO_COPY_CLASS(wxEventFilter); -}; - -#endif // _WX_EVENTFILTER_H_ diff --git a/Source/3rd Party/wx/include/wx/evtloop.h b/Source/3rd Party/wx/include/wx/evtloop.h index 6c29c94a0..3f44e8688 100644 --- a/Source/3rd Party/wx/include/wx/evtloop.h +++ b/Source/3rd Party/wx/include/wx/evtloop.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 01.06.01 -// RCS-ID: $Id$ +// RCS-ID: $Id: evtloop.h 53607 2008-05-16 15:21:40Z SN $ // Copyright: (c) 2001 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -12,90 +12,26 @@ #ifndef _WX_EVTLOOP_H_ #define _WX_EVTLOOP_H_ -#include "wx/event.h" #include "wx/utils.h" -// TODO: implement wxEventLoopSource for MSW (it should wrap a HANDLE and be -// monitored using MsgWaitForMultipleObjects()) -#if defined(__WXOSX__) || (defined(__UNIX__) && !defined(__WXMSW__)) - #define wxUSE_EVENTLOOP_SOURCE 1 -#else - #define wxUSE_EVENTLOOP_SOURCE 0 -#endif - -#if wxUSE_EVENTLOOP_SOURCE - class wxEventLoopSource; - class wxEventLoopSourceHandler; -#endif - -/* - NOTE ABOUT wxEventLoopBase::YieldFor LOGIC - ------------------------------------------ - - The YieldFor() function helps to avoid re-entrancy problems and problems - caused by out-of-order event processing - (see "wxYield-like problems" and "wxProgressDialog+threading BUG" wx-dev threads). - - The logic behind YieldFor() is simple: it analyzes the queue of the native - events generated by the underlying GUI toolkit and picks out and processes - only those matching the given mask. - - It's important to note that YieldFor() is used to selectively process the - events generated by the NATIVE toolkit. - Events syntethized by wxWidgets code or by user code are instead selectively - processed thanks to the logic built into wxEvtHandler::ProcessPendingEvents(). - In fact, when wxEvtHandler::ProcessPendingEvents gets called from inside a - YieldFor() call, wxEventLoopBase::IsEventAllowedInsideYield is used to decide - if the pending events for that event handler can be processed. - If all the pending events associated with that event handler result as "not processable", - the event handler "delays" itself calling wxEventLoopBase::DelayPendingEventHandler - (so it's moved: m_handlersWithPendingEvents => m_handlersWithPendingDelayedEvents). - Last, wxEventLoopBase::ProcessPendingEvents() before exiting moves the delayed - event handlers back into the list of handlers with pending events - (m_handlersWithPendingDelayedEvents => m_handlersWithPendingEvents) so that - a later call to ProcessPendingEvents() (possibly outside the YieldFor() call) - will process all pending events as usual. -*/ +class WXDLLIMPEXP_FWD_CORE wxEventLoop; // ---------------------------------------------------------------------------- -// wxEventLoopBase: interface for wxEventLoop +// wxEventLoop: a GUI event loop // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_BASE wxEventLoopBase +class WXDLLEXPORT wxEventLoopBase { public: // trivial, but needed (because of wxEventLoopBase) ctor - wxEventLoopBase(); + wxEventLoopBase() { } // dtor virtual ~wxEventLoopBase() { } - // use this to check whether the event loop was successfully created before - // using it - virtual bool IsOk() const { return true; } - - // returns true if this is the main loop - bool IsMain() const; - -#if wxUSE_EVENTLOOP_SOURCE - // create a new event loop source wrapping the given file descriptor and - // start monitoring it - virtual wxEventLoopSource * - AddSourceForFD(int fd, wxEventLoopSourceHandler *handler, int flags) = 0; -#endif // wxUSE_EVENTLOOP_SOURCE - - // dispatch&processing - // ------------------- - // start the event loop, return the exit code when it is finished virtual int Run() = 0; - // is this event loop running now? - // - // notice that even if this event loop hasn't terminated yet but has just - // spawned a nested (e.g. modal) event loop, this would return false - bool IsRunning() const; - // exit from the loop with the given exit code virtual void Exit(int rc = 0) = 0; @@ -105,92 +41,38 @@ public: // dispatch a single event, return false if we should exit from the loop virtual bool Dispatch() = 0; - // same as Dispatch() but doesn't wait for longer than the specified (in - // ms) timeout, return true if an event was processed, false if we should - // exit the loop or -1 if timeout expired - virtual int DispatchTimeout(unsigned long timeout) = 0; - - // implement this to wake up the loop: usually done by posting a dummy event - // to it (can be called from non main thread) - virtual void WakeUp() = 0; - - - // idle handling - // ------------- - - // make sure that idle events are sent again - virtual void WakeUpIdle(); - - // this virtual function is called when the application - // becomes idle and by default it forwards to wxApp::ProcessIdle() and - // while it can be overridden in a custom event loop, you must call the - // base class version to ensure that idle events are still generated - // - // it should return true if more idle events are needed, false if not - virtual bool ProcessIdle(); - - - // Yield-related hooks - // ------------------- - - // process all currently pending events right now - // - // it is an error to call Yield() recursively unless the value of - // onlyIfNeeded is true - // - // WARNING: this function is dangerous as it can lead to unexpected - // reentrancies (i.e. when called from an event handler it - // may result in calling the same event handler again), use - // with _extreme_ care or, better, don't use at all! - bool Yield(bool onlyIfNeeded = false); - virtual bool YieldFor(long eventsToProcess) = 0; - - // returns true if the main thread is inside a Yield() call - virtual bool IsYielding() const - { return m_isInsideYield; } - - // returns true if events of the given event category should be immediately - // processed inside a wxApp::Yield() call or rather should be queued for - // later processing by the main event loop - virtual bool IsEventAllowedInsideYield(wxEventCategory cat) const - { return (m_eventsToProcessInsideYield & cat) != 0; } - - // no SafeYield hooks since it uses wxWindow which is not available when wxUSE_GUI=0 - - - // active loop - // ----------- - // return currently active (running) event loop, may be NULL - static wxEventLoopBase *GetActive() { return ms_activeLoop; } + static wxEventLoop *GetActive() { return ms_activeLoop; } // set currently active (running) event loop - static void SetActive(wxEventLoopBase* loop); + static void SetActive(wxEventLoop* loop) { ms_activeLoop = loop; } + // is this event loop running now? + // + // notice that even if this event loop hasn't terminated yet but has just + // spawned a nested (e.g. modal) event loop, this would return false + bool IsRunning() const; protected: // this function should be called before the event loop terminates, whether // this happens normally (because of Exit() call) or abnormally (because of // an exception thrown from inside the loop) - virtual void OnExit(); + virtual void OnExit() { } + // the pointer to currently active loop - static wxEventLoopBase *ms_activeLoop; + static wxEventLoop *ms_activeLoop; - // YieldFor() helpers: - bool m_isInsideYield; - long m_eventsToProcessInsideYield; - - wxDECLARE_NO_COPY_CLASS(wxEventLoopBase); + DECLARE_NO_COPY_CLASS(wxEventLoopBase) }; -#if defined(__WXMSW__) || defined(__WXMAC__) || defined(__WXDFB__) || (defined(__UNIX__) && !defined(__WXOSX__)) +#if defined(__WXMSW__) || defined(__WXMAC__) || defined(__WXDFB__) // this class can be used to implement a standard event loop logic using // Pending() and Dispatch() // // it also handles idle processing automatically -class WXDLLIMPEXP_BASE wxEventLoopManual : public wxEventLoopBase +class WXDLLEXPORT wxEventLoopManual : public wxEventLoopBase { public: wxEventLoopManual(); @@ -204,6 +86,10 @@ public: virtual void Exit(int rc = 0); protected: + // implement this to wake up the loop: usually done by posting a dummy event + // to it (called from Exit()) + virtual void WakeUp() = 0; + // may be overridden to perform some action at the start of each new event // loop iteration virtual void OnNextIteration() { } @@ -214,15 +100,6 @@ protected: // should we exit the loop? bool m_shouldExit; - -private: - // process all already pending events and dispatch a new one (blocking - // until it appears in the event queue if necessary) - // - // returns the return value of Dispatch() - bool ProcessEvents(); - - wxDECLARE_NO_COPY_CLASS(wxEventLoopManual); }; #endif // platforms using "manual" loop @@ -230,105 +107,42 @@ private: // we're moving away from old m_impl wxEventLoop model as otherwise the user // code doesn't have access to platform-specific wxEventLoop methods and this // can sometimes be very useful (e.g. under MSW this is necessary for -// integration with MFC) but currently this is not done for all ports yet (e.g. -// wxX11) so fall back to the old wxGUIEventLoop definition below for them - -#if defined(__WXMSW__) - // this header defines both console and GUI loops for MSW +// integration with MFC) but currently this is done for MSW only, other ports +// should follow a.s.a.p. +#if defined(__WXPALMOS__) + #include "wx/palmos/evtloop.h" +#elif defined(__WXMSW__) #include "wx/msw/evtloop.h" -#elif defined(__WXOSX__) - // CoreFoundation-based event loop is currently in wxBase so include it in - // any case too (although maybe it actually shouldn't be there at all) - #include "wx/osx/evtloop.h" -#elif wxUSE_GUI - -// include the appropriate header defining wxGUIEventLoop - -#if defined(__WXCOCOA__) - #include "wx/cocoa/evtloop.h" +#elif defined(__WXMAC__) + #include "wx/mac/evtloop.h" #elif defined(__WXDFB__) #include "wx/dfb/evtloop.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/evtloop.h" #else // other platform -#include "wx/stopwatch.h" // for wxMilliClock_t +class WXDLLEXPORT wxEventLoopImpl; -class WXDLLIMPEXP_FWD_CORE wxEventLoopImpl; - -class WXDLLIMPEXP_CORE wxGUIEventLoop : public wxEventLoopBase +class WXDLLEXPORT wxEventLoop : public wxEventLoopBase { public: - wxGUIEventLoop() { m_impl = NULL; } - virtual ~wxGUIEventLoop(); - -#if wxUSE_EVENTLOOP_SOURCE - // We need to define a base class pure virtual method but we can't provide - // a generic implementation for it so simply fail. - virtual wxEventLoopSource * - AddSourceForFD(int WXUNUSED(fd), - wxEventLoopSourceHandler * WXUNUSED(handler), - int WXUNUSED(flags)) - { - wxFAIL_MSG( "support for event loop sources not implemented" ); - return NULL; - } -#endif // wxUSE_EVENTLOOP_SOURCE + wxEventLoop() { m_impl = NULL; } + virtual ~wxEventLoop(); virtual int Run(); virtual void Exit(int rc = 0); virtual bool Pending() const; virtual bool Dispatch(); - virtual int DispatchTimeout(unsigned long timeout) - { - // TODO: this is, of course, horribly inefficient and a proper wait with - // timeout should be implemented for all ports natively... - const wxMilliClock_t timeEnd = wxGetLocalTimeMillis() + timeout; - for ( ;; ) - { - if ( Pending() ) - return Dispatch(); - - if ( wxGetLocalTimeMillis() >= timeEnd ) - return -1; - } - } - virtual void WakeUp() { } - virtual bool YieldFor(long eventsToProcess); protected: // the pointer to the port specific implementation class wxEventLoopImpl *m_impl; - wxDECLARE_NO_COPY_CLASS(wxGUIEventLoop); + DECLARE_NO_COPY_CLASS(wxEventLoop) }; #endif // platforms -#endif // wxUSE_GUI - -// include the header defining wxConsoleEventLoop for Unix systems -#if defined(__UNIX__) && !defined(__WXMSW__) -#include "wx/unix/evtloop.h" -#endif - -#if wxUSE_GUI - // we use a class rather than a typedef because wxEventLoop is - // forward-declared in many places - class wxEventLoop : public wxGUIEventLoop { }; -#else // !wxUSE_GUI - // we can't define wxEventLoop differently in GUI and base libraries so use - // a #define to still allow writing wxEventLoop in the user code - #if wxUSE_CONSOLE_EVENTLOOP && (defined(__WXMSW__) || defined(__UNIX__)) - #define wxEventLoop wxConsoleEventLoop - #else // we still must define it somehow for the code below... - #define wxEventLoop wxEventLoopBase - #endif -#endif - inline bool wxEventLoopBase::IsRunning() const { return GetActive() == this; } -#if wxUSE_GUI && !defined(__WXOSX__) // ---------------------------------------------------------------------------- // wxModalEventLoop // ---------------------------------------------------------------------------- @@ -337,7 +151,7 @@ inline bool wxEventLoopBase::IsRunning() const { return GetActive() == this; } // implement modality, we will surely need platform-specific implementations // too, this generic implementation is here only temporarily to see how it // works -class WXDLLIMPEXP_CORE wxModalEventLoop : public wxGUIEventLoop +class WXDLLEXPORT wxModalEventLoop : public wxEventLoop { public: wxModalEventLoop(wxWindow *winModal) @@ -351,15 +165,13 @@ protected: delete m_windowDisabler; m_windowDisabler = NULL; - wxGUIEventLoop::OnExit(); + wxEventLoop::OnExit(); } private: wxWindowDisabler *m_windowDisabler; }; -#endif //wxUSE_GUI - // ---------------------------------------------------------------------------- // wxEventLoopActivator: helper class for wxEventLoop implementations // ---------------------------------------------------------------------------- @@ -370,24 +182,23 @@ private: class wxEventLoopActivator { public: - wxEventLoopActivator(wxEventLoopBase *evtLoop) + wxEventLoopActivator(wxEventLoop *evtLoop) { - m_evtLoopOld = wxEventLoopBase::GetActive(); - wxEventLoopBase::SetActive(evtLoop); + m_evtLoopOld = wxEventLoop::GetActive(); + wxEventLoop::SetActive(evtLoop); } ~wxEventLoopActivator() { // restore the previously active event loop - wxEventLoopBase::SetActive(m_evtLoopOld); + wxEventLoop::SetActive(m_evtLoopOld); } private: - wxEventLoopBase *m_evtLoopOld; + wxEventLoop *m_evtLoopOld; }; -#if wxUSE_CONSOLE_EVENTLOOP - +#if wxABI_VERSION >= 20808 class wxEventLoopGuarantor { public: @@ -413,7 +224,6 @@ public: private: wxEventLoop *m_evtLoopNew; }; - -#endif // wxUSE_CONSOLE_EVENTLOOP +#endif // wxABI_VERSION >= 20805 #endif // _WX_EVTLOOP_H_ diff --git a/Source/3rd Party/wx/include/wx/except.h b/Source/3rd Party/wx/include/wx/except.h index 6c9a7f6d5..f6310a57f 100644 --- a/Source/3rd Party/wx/include/wx/except.h +++ b/Source/3rd Party/wx/include/wx/except.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 17.09.2003 -// RCS-ID: $Id$ +// RCS-ID: $Id: except.h 27408 2004-05-23 20:53:33Z JS $ // Copyright: (c) 2003 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -18,24 +18,13 @@ // macros working whether wxUSE_EXCEPTIONS is 0 or 1 // ---------------------------------------------------------------------------- -// even if the library itself was compiled with exceptions support, the user -// code using it might be compiling with a compiler switch disabling them in -// which cases we shouldn't use try/catch in the headers -- this results in -// compilation errors in e.g. wx/scopeguard.h with at least g++ 4 -#if !wxUSE_EXCEPTIONS || \ - (defined(__GNUG__) && !defined(__EXCEPTIONS)) - #ifndef wxNO_EXCEPTIONS - #define wxNO_EXCEPTIONS - #endif -#endif - -#ifdef wxNO_EXCEPTIONS - #define wxTRY - #define wxCATCH_ALL(code) -#else // do use exceptions +#if wxUSE_EXCEPTIONS #define wxTRY try #define wxCATCH_ALL(code) catch ( ... ) { code } -#endif // wxNO_EXCEPTIONS/!wxNO_EXCEPTIONS +#else // !wxUSE_EXCEPTIONS + #define wxTRY + #define wxCATCH_ALL(code) +#endif // wxUSE_EXCEPTIONS/!wxUSE_EXCEPTIONS #endif // _WX_EXCEPT_H_ diff --git a/Source/3rd Party/wx/include/wx/fdrepdlg.h b/Source/3rd Party/wx/include/wx/fdrepdlg.h index cf2798b7c..87d154497 100644 --- a/Source/3rd Party/wx/include/wx/fdrepdlg.h +++ b/Source/3rd Party/wx/include/wx/fdrepdlg.h @@ -4,7 +4,7 @@ // Author: Markus Greither and Vadim Zeitlin // Modified by: // Created: 23/03/2001 -// RCS-ID: $Id$ +// RCS-ID: // Copyright: (c) Markus Greither // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -60,7 +60,7 @@ enum wxFindReplaceDialogStyles // wxFindReplaceData: holds Setup Data/Feedback Data for wxFindReplaceDialog // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxFindReplaceData : public wxObject +class WXDLLEXPORT wxFindReplaceData : public wxObject { public: wxFindReplaceData() { Init(); } @@ -93,7 +93,7 @@ private: // wxFindReplaceDialogBase // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxFindReplaceDialogBase : public wxDialog +class WXDLLEXPORT wxFindReplaceDialogBase : public wxDialog { public: // ctors and such @@ -121,7 +121,7 @@ protected: // the last string we searched for wxString m_lastSearch; - wxDECLARE_NO_COPY_CLASS(wxFindReplaceDialogBase); + DECLARE_NO_COPY_CLASS(wxFindReplaceDialogBase) }; // include wxFindReplaceDialog declaration @@ -137,13 +137,11 @@ protected: // wxFindReplaceDialog events // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxFindDialogEvent : public wxCommandEvent +class WXDLLEXPORT wxFindDialogEvent : public wxCommandEvent { public: wxFindDialogEvent(wxEventType commandType = wxEVT_NULL, int id = 0) : wxCommandEvent(commandType, id) { } - wxFindDialogEvent(const wxFindDialogEvent& event) - : wxCommandEvent(event), m_strReplace(event.m_strReplace) { } int GetFlags() const { return GetInt(); } wxString GetFindString() const { return GetString(); } @@ -157,24 +155,24 @@ public: void SetFindString(const wxString& str) { SetString(str); } void SetReplaceString(const wxString& str) { m_strReplace = str; } - virtual wxEvent *Clone() const { return new wxFindDialogEvent(*this); } - private: wxString m_strReplace; - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxFindDialogEvent) + DECLARE_DYNAMIC_CLASS_NO_COPY(wxFindDialogEvent) }; -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_FIND, wxFindDialogEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_FIND_NEXT, wxFindDialogEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_FIND_REPLACE, wxFindDialogEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_FIND_REPLACE_ALL, wxFindDialogEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_FIND_CLOSE, wxFindDialogEvent ); +BEGIN_DECLARE_EVENT_TYPES() + DECLARE_EVENT_TYPE(wxEVT_COMMAND_FIND, 510) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_FIND_NEXT, 511) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_FIND_REPLACE, 512) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_FIND_REPLACE_ALL, 513) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_FIND_CLOSE, 514) +END_DECLARE_EVENT_TYPES() typedef void (wxEvtHandler::*wxFindDialogEventFunction)(wxFindDialogEvent&); #define wxFindDialogEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxFindDialogEventFunction, func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxFindDialogEventFunction, &func) #define EVT_FIND(id, fn) \ wx__DECLARE_EVT1(wxEVT_COMMAND_FIND, id, wxFindDialogEventHandler(fn)) diff --git a/Source/3rd Party/wx/include/wx/features.h b/Source/3rd Party/wx/include/wx/features.h index e76f2c567..953940a87 100644 --- a/Source/3rd Party/wx/include/wx/features.h +++ b/Source/3rd Party/wx/include/wx/features.h @@ -5,7 +5,7 @@ * Author: Vadim Zeitlin * Modified by: Ryan Norton (Converted to C) * Created: 18.03.02 -* RCS-ID: $Id$ +* RCS-ID: $Id: features.h 40865 2006-08-27 09:42:42Z VS $ * Copyright: (c) 2002 Vadim Zeitlin * Licence: wxWindows licence */ @@ -35,11 +35,9 @@ /* taskbar is implemented in the major ports */ #if defined(__WXMSW__) || defined(__WXCOCOA__) \ || defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXX11__) \ - || defined(__WXOSX_MAC__) || defined(__WXCOCOA__) + || defined(__WXMAC_OSX__) || defined(__WXCOCOA__) #define wxHAS_TASK_BAR_ICON #else - #undef wxUSE_TASKBARICON - #define wxUSE_TASKBARICON 0 #undef wxHAS_TASK_BAR_ICON #endif @@ -62,65 +60,5 @@ #undef wxHAS_REGEX_ADVANCED #endif -/* Pango-based ports and wxDFB use UTF-8 for text and font encodings - * internally and so their fonts can handle any encodings: */ -#if wxUSE_PANGO || defined(__WXDFB__) - #define wxHAS_UTF8_FONTS -#endif - -/* This is defined when the underlying toolkit handles tab traversal natively. - Otherwise we implement it ourselves in wxControlContainer. */ -#ifdef __WXGTK20__ - #define wxHAS_NATIVE_TAB_TRAVERSAL -#endif - -/* This is defined when the compiler provides some type of extended locale - functions. Otherwise, we implement them ourselves to only support the - 'C' locale */ -#if defined(HAVE_LOCALE_T) || \ - (wxCHECK_VISUALC_VERSION(8) && !defined(__WXWINCE__)) - #define wxHAS_XLOCALE_SUPPORT -#else - #undef wxHAS_XLOCALE_SUPPORT -#endif - -/* Direct access to bitmap data is not implemented in all ports yet */ -#if defined(__WXGTK20__) || defined(__WXMAC__) || defined(__WXDFB__) || \ - defined(__WXMSW__) - - /* - These compilers can't deal with templates in wx/rawbmp.h: - - HP aCC for PA-RISC - - Watcom < 1.8 - */ - #if !wxONLY_WATCOM_EARLIER_THAN(1, 8) && \ - !(defined(__HP_aCC) && defined(__hppa)) - #define wxHAS_RAW_BITMAP - #endif -#endif - -/* also define deprecated synonym which exists for compatibility only */ -#ifdef wxHAS_RAW_BITMAP - #define wxHAVE_RAW_BITMAP -#endif - -/* - If this is defined, wxEvtHandler::Bind<>() is available (not all compilers - have the required template support for this and in particular under Windows - where only g++ and MSVC >= 7 currently support it. - - Recent Sun CC versions support this but perhaps older ones can compile this - code too, adjust the version check if this is the case (unfortunately we - can't easily test for the things used in wx/event.h in configure so we have - to maintain these checks manually). The same applies to xlC 7: perhaps - earlier versions can compile this code too but they were not tested. - */ -#if wxCHECK_GCC_VERSION(3, 2) || wxCHECK_VISUALC_VERSION(7) \ - || (defined(__SUNCC__) && __SUNCC__ >= 0x5100) \ - || (defined(__xlC__) && __xlC__ >= 0x700) - #define wxHAS_EVENT_BIND -#endif - - #endif /* _WX_FEATURES_H_ */ diff --git a/Source/3rd Party/wx/include/wx/ffile.h b/Source/3rd Party/wx/include/wx/ffile.h index 3c39c7eeb..26f1b4e3e 100644 --- a/Source/3rd Party/wx/include/wx/ffile.h +++ b/Source/3rd Party/wx/include/wx/ffile.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 14.07.99 -// RCS-ID: $Id$ +// RCS-ID: $Id: ffile.h 61872 2009-09-09 22:37:05Z VZ $ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -37,13 +37,13 @@ public: // def ctor wxFFile() { m_fp = NULL; } // open specified file (may fail, use IsOpened()) - wxFFile(const wxString& filename, const wxString& mode = wxT("r")); + wxFFile(const wxChar *filename, const wxChar *mode = wxT("r")); // attach to (already opened) file wxFFile(FILE *lfp) { m_fp = lfp; } // open/close // open a file (existing or not - the mode controls what happens) - bool Open(const wxString& filename, const wxString& mode = wxT("r")); + bool Open(const wxChar *filename, const wxChar *mode = wxT("r")); // closes the opened file (this is a NOP if not opened) bool Close(); @@ -62,7 +62,12 @@ public: // returns the number of bytes written size_t Write(const void *pBuf, size_t nCount); // returns true on success - bool Write(const wxString& s, const wxMBConv& conv = wxConvAuto()); + bool Write(const wxString& s, const wxMBConv& conv = wxConvAuto()) + { + const wxWX2MBbuf buf = s.mb_str(conv); + size_t size = strlen(buf); + return Write((const char *)buf, size) == size; + } // flush data not yet written bool Flush(); diff --git a/Source/3rd Party/wx/include/wx/file.h b/Source/3rd Party/wx/include/wx/file.h index 370242a01..a2ccd4223 100644 --- a/Source/3rd Party/wx/include/wx/file.h +++ b/Source/3rd Party/wx/include/wx/file.h @@ -1,11 +1,11 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/file.h +// Name: file.h // Purpose: wxFile - encapsulates low-level "file descriptor" // wxTempFile - safely replace the old file // Author: Vadim Zeitlin // Modified by: // Created: 29/01/98 -// RCS-ID: $Id$ +// RCS-ID: $Id: file.h 46331 2007-06-05 13:16:11Z JS $ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -21,6 +21,28 @@ #include "wx/filefn.h" #include "wx/strconv.h" +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// we redefine these constants here because S_IREAD &c are _not_ standard +// however, we do assume that the values correspond to the Unix umask bits +#define wxS_IRUSR 00400 +#define wxS_IWUSR 00200 +#define wxS_IXUSR 00100 + +#define wxS_IRGRP 00040 +#define wxS_IWGRP 00020 +#define wxS_IXGRP 00010 + +#define wxS_IROTH 00004 +#define wxS_IWOTH 00002 +#define wxS_IXOTH 00001 + +// default mode for the new files: corresponds to umask 022 +#define wxS_DEFAULT (wxS_IRUSR | wxS_IWUSR | wxS_IRGRP | wxS_IWGRP |\ + wxS_IROTH | wxS_IWOTH) + // ---------------------------------------------------------------------------- // class wxFile: raw file IO // @@ -41,31 +63,31 @@ public: // static functions // ---------------- // check whether a regular file by this name exists - static bool Exists(const wxString& name); + static bool Exists(const wxChar *name); // check whether we can access the given file in given mode // (only read and write make sense here) - static bool Access(const wxString& name, OpenMode mode); + static bool Access(const wxChar *name, OpenMode mode); // ctors // ----- // def ctor - wxFile() { m_fd = fd_invalid; m_lasterror = 0; } + wxFile() { m_fd = fd_invalid; m_error = false; } // open specified file (may fail, use IsOpened()) - wxFile(const wxString& fileName, OpenMode mode = read); + wxFile(const wxChar *szFileName, OpenMode mode = read); // attach to (already opened) file - wxFile(int lfd) { m_fd = lfd; m_lasterror = 0; } + wxFile(int lfd) { m_fd = lfd; m_error = false; } // open/close // create a new file (with the default value of bOverwrite, it will fail if // the file already exists, otherwise it will overwrite it and succeed) - bool Create(const wxString& fileName, bool bOverwrite = false, + bool Create(const wxChar *szFileName, bool bOverwrite = false, int access = wxS_DEFAULT); - bool Open(const wxString& fileName, OpenMode mode = read, + bool Open(const wxChar *szFileName, OpenMode mode = read, int access = wxS_DEFAULT); bool Close(); // Close is a NOP if not opened // assign an existing file descriptor and get it back from wxFile object - void Attach(int lfd) { Close(); m_fd = lfd; m_lasterror = 0; } + void Attach(int lfd) { Close(); m_fd = lfd; m_error = false; } void Detach() { m_fd = fd_invalid; } int fd() const { return m_fd; } @@ -75,7 +97,14 @@ public: // returns the number of bytes written size_t Write(const void *pBuf, size_t nCount); // returns true on success - bool Write(const wxString& s, const wxMBConv& conv = wxMBConvUTF8()); + bool Write(const wxString& s, const wxMBConv& conv = wxConvUTF8) + { + const wxWX2MBbuf buf = s.mb_str(conv); + if (!buf) + return false; + size_t size = strlen(buf); + return Write((const char *) buf, size) == size; + } // flush data not yet written bool Flush(); @@ -95,15 +124,10 @@ public: // is end of file reached? bool Eof() const; // has an error occurred? - bool Error() const { return m_lasterror != 0; } - // get last errno - int GetLastError() const { return m_lasterror; } - // reset error state - void ClearLastError() { m_lasterror = 0; } + bool Error() const { return m_error; } // type such as disk or pipe wxFileKind GetKind() const { return wxGetFileKind(m_fd); } - // dtor closes the file if opened ~wxFile() { Close(); } @@ -114,16 +138,8 @@ private: wxFile(const wxFile&); wxFile& operator=(const wxFile&); - // Copy the value of errno into m_lasterror if rc == -1 and return true in - // this case (indicating that we've got an error). Otherwise return false. - // - // Notice that we use the possibly 64 bit wxFileOffset instead of int here so - // that it works for checking the result of functions such as tell() too. - bool CheckForError(wxFileOffset rc) const; - - int m_fd; // file descriptor or INVALID_FD if not opened - int m_lasterror; // errno value of last error + bool m_error; // error memory }; // ---------------------------------------------------------------------------- @@ -158,13 +174,9 @@ public: // I/O (both functions return true on success, false on failure) bool Write(const void *p, size_t n) { return m_file.Write(p, n) == n; } - bool Write(const wxString& str, const wxMBConv& conv = wxMBConvUTF8()) + bool Write(const wxString& str, const wxMBConv& conv = wxConvUTF8) { return m_file.Write(str, conv); } - // flush data: can be called before closing file to ensure that data was - // correctly written out - bool Flush() { return m_file.Flush(); } - // different ways to close the file // validate changes and delete the old file of name m_strName bool Commit(); diff --git a/Source/3rd Party/wx/include/wx/fileconf.h b/Source/3rd Party/wx/include/wx/fileconf.h index 669175981..47c483f26 100644 --- a/Source/3rd Party/wx/include/wx/fileconf.h +++ b/Source/3rd Party/wx/include/wx/fileconf.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 07.04.98 (adapted from appconf.cpp) -// RCS-ID: $Id$ +// RCS-ID: $Id: fileconf.h 50711 2007-12-15 02:57:58Z VZ $ // Copyright: (c) 1997 Karsten Ballueder & Vadim Zeitlin // Ballueder@usa.net // Licence: wxWindows licence @@ -20,7 +20,6 @@ #include "wx/textfile.h" #include "wx/string.h" #include "wx/confbase.h" -#include "wx/filename.h" // ---------------------------------------------------------------------------- // wxFileConfig @@ -112,18 +111,8 @@ public: // // where file is the basename of szFile, ext is its extension // or .conf (Unix) or .ini (Win) if it has none - static wxFileName GetGlobalFile(const wxString& szFile); - static wxFileName GetLocalFile(const wxString& szFile, int style = 0); - - static wxString GetGlobalFileName(const wxString& szFile) - { - return GetGlobalFile(szFile).GetFullPath(); - } - - static wxString GetLocalFileName(const wxString& szFile, int style = 0) - { - return GetLocalFile(szFile, style).GetFullPath(); - } + static wxString GetGlobalFileName(const wxChar *szFile); + static wxString GetLocalFileName(const wxChar *szFile); // ctor & dtor // New constructor: one size fits all. Specify wxCONFIG_USE_LOCAL_FILE or @@ -153,7 +142,7 @@ public: // implement inherited pure virtual functions virtual void SetPath(const wxString& strPath); - virtual const wxString& GetPath() const; + virtual const wxString& GetPath() const { return m_strPath; } virtual bool GetFirstGroup(wxString& str, long& lIndex) const; virtual bool GetNextGroup (wxString& str, long& lIndex) const; @@ -194,20 +183,14 @@ public: protected: virtual bool DoReadString(const wxString& key, wxString *pStr) const; virtual bool DoReadLong(const wxString& key, long *pl) const; -#if wxUSE_BASE64 - virtual bool DoReadBinary(const wxString& key, wxMemoryBuffer* buf) const; -#endif // wxUSE_BASE64 virtual bool DoWriteString(const wxString& key, const wxString& szValue); virtual bool DoWriteLong(const wxString& key, long lValue); -#if wxUSE_BASE64 - virtual bool DoWriteBinary(const wxString& key, const wxMemoryBuffer& buf); -#endif // wxUSE_BASE64 private: // GetXXXFileName helpers: return ('/' terminated) directory names static wxString GetGlobalDir(); - static wxString GetLocalDir(int style = 0); + static wxString GetLocalDir(); // common part of all ctors (assumes that m_str{Local|Global}File are already // initialized @@ -237,8 +220,8 @@ private: wxFileConfigLineList *m_linesHead, // head of the linked list *m_linesTail; // tail - wxFileName m_fnLocalFile, // local file name passed to ctor - m_fnGlobalFile; // global + wxString m_strLocalFile, // local file name passed to ctor + m_strGlobalFile; // global wxString m_strPath; // current path (not '/' terminated) wxFileConfigGroup *m_pRootGroup, // the top (unnamed) group @@ -252,8 +235,7 @@ private: bool m_isDirty; // if true, we have unsaved changes - wxDECLARE_NO_COPY_CLASS(wxFileConfig); - DECLARE_ABSTRACT_CLASS(wxFileConfig) + DECLARE_NO_COPY_CLASS(wxFileConfig) }; #endif diff --git a/Source/3rd Party/wx/include/wx/filectrl.h b/Source/3rd Party/wx/include/wx/filectrl.h deleted file mode 100644 index 52e804ea2..000000000 --- a/Source/3rd Party/wx/include/wx/filectrl.h +++ /dev/null @@ -1,146 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/filectrl.h -// Purpose: Header for wxFileCtrlBase and other common functions used by -// platform-specific wxFileCtrl's -// Author: Diaa M. Sami -// Modified by: -// Created: Jul-07-2007 -// RCS-ID: $Id$ -// Copyright: (c) Diaa M. Sami -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FILECTRL_H_BASE_ -#define _WX_FILECTRL_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_FILECTRL - -#include "wx/string.h" -#include "wx/event.h" - -enum -{ - wxFC_OPEN = 0x0001, - wxFC_SAVE = 0x0002, - wxFC_MULTIPLE = 0x0004, - wxFC_NOSHOWHIDDEN = 0x0008 -}; - -#define wxFC_DEFAULT_STYLE wxFC_OPEN -extern WXDLLIMPEXP_DATA_CORE(const char) wxFileCtrlNameStr[]; // in filectrlcmn.cpp - -class WXDLLIMPEXP_CORE wxFileCtrlBase -{ -public: - virtual ~wxFileCtrlBase() {} - - virtual void SetWildcard( const wxString& wildCard ) = 0; - virtual void SetFilterIndex( int filterindex ) = 0; - virtual bool SetDirectory( const wxString& dir ) = 0; - - // Selects a certain file. - // In case the filename specified isn't found/couldn't be shown with - // currently selected filter, false is returned and nothing happens - virtual bool SetFilename( const wxString& name ) = 0; - - // chdirs to a certain directory and selects a certain file. - // In case the filename specified isn't found/couldn't be shown with - // currently selected filter, false is returned and if directory exists - // it's chdir'ed to - virtual bool SetPath( const wxString& path ) = 0; - - virtual wxString GetFilename() const = 0; - virtual wxString GetDirectory() const = 0; - virtual wxString GetWildcard() const = 0; - virtual wxString GetPath() const = 0; - virtual void GetPaths( wxArrayString& paths ) const = 0; - virtual void GetFilenames( wxArrayString& files ) const = 0; - virtual int GetFilterIndex() const = 0; - - virtual bool HasMultipleFileSelection() const = 0; - virtual void ShowHidden(bool show) = 0; -}; - -void GenerateFilterChangedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd ); -void GenerateFolderChangedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd ); -void GenerateSelectionChangedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd ); -void GenerateFileActivatedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd, const wxString filename = wxEmptyString ); - -#if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__) - #define wxFileCtrl wxGtkFileCtrl - #include "wx/gtk/filectrl.h" -#else - #define wxFileCtrl wxGenericFileCtrl - #include "wx/generic/filectrlg.h" -#endif - -// Some documentation -// On wxEVT_FILECTRL_FILTERCHANGED, only the value returned by GetFilterIndex is -// valid and it represents the (new) current filter index for the wxFileCtrl. -// On wxEVT_FILECTRL_FOLDERCHANGED, only the value returned by GetDirectory is -// valid and it represents the (new) current directory for the wxFileCtrl. -// On wxEVT_FILECTRL_FILEACTIVATED, GetDirectory returns the current directory -// for the wxFileCtrl and GetFiles returns the names of the file(s) activated. -// On wxEVT_FILECTRL_SELECTIONCHANGED, GetDirectory returns the current directory -// for the wxFileCtrl and GetFiles returns the names of the currently selected -// file(s). -// In wxGTK, after each wxEVT_FILECTRL_FOLDERCHANGED, wxEVT_FILECTRL_SELECTIONCHANGED -// is fired automatically once or more with 0 files. -class WXDLLIMPEXP_CORE wxFileCtrlEvent : public wxCommandEvent -{ -public: - wxFileCtrlEvent() {} - wxFileCtrlEvent( wxEventType type, wxObject *evtObject, int id ) - : wxCommandEvent( type, id ) - { - SetEventObject( evtObject ); - } - - // no need for the copy constructor as the default one will be fine. - virtual wxEvent *Clone() const { return new wxFileCtrlEvent( *this ); } - - void SetFiles( const wxArrayString &files ) { m_files = files; } - void SetDirectory( const wxString &directory ) { m_directory = directory; } - void SetFilterIndex( int filterIndex ) { m_filterIndex = filterIndex; } - - wxArrayString GetFiles() const { return m_files; } - wxString GetDirectory() const { return m_directory; } - int GetFilterIndex() const { return m_filterIndex; } - - wxString GetFile() const; - -protected: - int m_filterIndex; - wxString m_directory; - wxArrayString m_files; - - DECLARE_DYNAMIC_CLASS_NO_ASSIGN( wxFileCtrlEvent ) -}; - -typedef void ( wxEvtHandler::*wxFileCtrlEventFunction )( wxFileCtrlEvent& ); - -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_FILECTRL_SELECTIONCHANGED, wxFileCtrlEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_FILECTRL_FILEACTIVATED, wxFileCtrlEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_FILECTRL_FOLDERCHANGED, wxFileCtrlEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_FILECTRL_FILTERCHANGED, wxFileCtrlEvent ); - -#define wxFileCtrlEventHandler(func) \ - wxEVENT_HANDLER_CAST( wxFileCtrlEventFunction, func ) - -#define EVT_FILECTRL_FILEACTIVATED(id, fn) \ - wx__DECLARE_EVT1(wxEVT_FILECTRL_FILEACTIVATED, id, wxFileCtrlEventHandler(fn)) - -#define EVT_FILECTRL_SELECTIONCHANGED(id, fn) \ - wx__DECLARE_EVT1(wxEVT_FILECTRL_SELECTIONCHANGED, id, wxFileCtrlEventHandler(fn)) - -#define EVT_FILECTRL_FOLDERCHANGED(id, fn) \ - wx__DECLARE_EVT1(wxEVT_FILECTRL_FOLDERCHANGED, id, wxFileCtrlEventHandler(fn)) - -#define EVT_FILECTRL_FILTERCHANGED(id, fn) \ - wx__DECLARE_EVT1(wxEVT_FILECTRL_FILTERCHANGED, id, wxFileCtrlEventHandler(fn)) - -#endif // wxUSE_FILECTRL - -#endif // _WX_FILECTRL_H_BASE_ diff --git a/Source/3rd Party/wx/include/wx/filedlg.h b/Source/3rd Party/wx/include/wx/filedlg.h index c8e9588ea..0e247b358 100644 --- a/Source/3rd Party/wx/include/wx/filedlg.h +++ b/Source/3rd Party/wx/include/wx/filedlg.h @@ -5,7 +5,7 @@ // Modified by: // Created: 8/17/99 // Copyright: (c) Robert Roebling -// RCS-ID: $Id$ +// RCS-ID: $Id: filedlg.h 44027 2006-12-21 19:26:48Z VZ $ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -19,12 +19,6 @@ #include "wx/dialog.h" #include "wx/arrstr.h" -// this symbol is defined for the platforms which support multiple -// ('|'-separated) filters in the file dialog -#if defined(__WXMSW__) || defined(__WXGTK__) || defined(__WXMAC__) - #define wxHAS_MULTIPLE_FILEDLG_FILTERS -#endif - //---------------------------------------------------------------------------- // wxFileDialog data //---------------------------------------------------------------------------- @@ -56,6 +50,9 @@ enum wxOPEN = wxFD_OPEN, wxSAVE = wxFD_SAVE, wxOVERWRITE_PROMPT = wxFD_OVERWRITE_PROMPT, +#if WXWIN_COMPATIBILITY_2_4 + wxHIDE_READONLY = 0x0008, +#endif wxFILE_MUST_EXIST = wxFD_FILE_MUST_EXIST, wxMULTIPLE = wxFD_MULTIPLE, wxCHANGE_DIR = wxFD_CHANGE_DIR @@ -64,15 +61,15 @@ enum #define wxFD_DEFAULT_STYLE wxFD_OPEN -extern WXDLLIMPEXP_DATA_CORE(const char) wxFileDialogNameStr[]; -extern WXDLLIMPEXP_DATA_CORE(const char) wxFileSelectorPromptStr[]; -extern WXDLLIMPEXP_DATA_CORE(const char) wxFileSelectorDefaultWildcardStr[]; +extern WXDLLEXPORT_DATA(const wxChar) wxFileDialogNameStr[]; +extern WXDLLEXPORT_DATA(const wxChar) wxFileSelectorPromptStr[]; +extern WXDLLEXPORT_DATA(const wxChar) wxFileSelectorDefaultWildcardStr[]; //---------------------------------------------------------------------------- // wxFileDialogBase //---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxFileDialogBase: public wxDialog +class WXDLLEXPORT wxFileDialogBase: public wxDialog { public: wxFileDialogBase () { Init(); } @@ -91,9 +88,6 @@ public: Create(parent, message, defaultDir, defaultFile, wildCard, style, pos, sz, name); } - virtual ~wxFileDialogBase() {} - - bool Create(wxWindow *parent, const wxString& message = wxFileSelectorPromptStr, const wxString& defaultDir = wxEmptyString, @@ -107,9 +101,9 @@ public: bool HasFdFlag(int flag) const { return HasFlag(flag); } virtual void SetMessage(const wxString& message) { m_message = message; } - virtual void SetPath(const wxString& path); - virtual void SetDirectory(const wxString& dir); - virtual void SetFilename(const wxString& name); + virtual void SetPath(const wxString& path) { m_path = path; } + virtual void SetDirectory(const wxString& dir) { m_dir = dir; } + virtual void SetFilename(const wxString& name) { m_fileName = name; } virtual void SetWildcard(const wxString& wildCard) { m_wildCard = wildCard; } virtual void SetFilterIndex(int filterIndex) { m_filterIndex = filterIndex; } @@ -122,17 +116,19 @@ public: virtual wxString GetWildcard() const { return m_wildCard; } virtual int GetFilterIndex() const { return m_filterIndex; } - // this function is called with wxFileDialog as parameter and should - // create the window containing the extra controls we want to show in it - typedef wxWindow *(*ExtraControlCreatorFunction)(wxWindow*); - - virtual bool SupportsExtraControl() const { return false; } - - bool SetExtraControlCreator(ExtraControlCreatorFunction creator); - wxWindow *GetExtraControl() const { return m_extraControl; } - // Utility functions +#if WXWIN_COMPATIBILITY_2_4 + // Parses the wildCard, returning the number of filters. + // Returns 0 if none or if there's a problem, + // The arrays will contain an equal number of items found before the error. + // wildCard is in the form: + // "All files (*)|*|Image Files (*.jpeg *.png)|*.jpg;*.png" + wxDEPRECATED( static int ParseWildcard(const wxString& wildCard, + wxArrayString& descriptions, + wxArrayString& filters) ); +#endif // WXWIN_COMPATIBILITY_2_4 + #if WXWIN_COMPATIBILITY_2_6 wxDEPRECATED( long GetStyle() const ); @@ -155,83 +151,74 @@ protected: wxString m_fileName; wxString m_wildCard; int m_filterIndex; - wxWindow* m_extraControl; - - // returns true if control is created (if it already exists returns false) - bool CreateExtraControl(); - // return true if SetExtraControlCreator() was called - bool HasExtraControlCreator() const - { return m_extraControlCreator != NULL; } - // get the size of the extra control by creating and deleting it - wxSize GetExtraControlSize(); private: - ExtraControlCreatorFunction m_extraControlCreator; - void Init(); DECLARE_DYNAMIC_CLASS(wxFileDialogBase) - wxDECLARE_NO_COPY_CLASS(wxFileDialogBase); + DECLARE_NO_COPY_CLASS(wxFileDialogBase) }; - //---------------------------------------------------------------------------- // wxFileDialog convenience functions //---------------------------------------------------------------------------- // File selector - backward compatibility -WXDLLIMPEXP_CORE wxString -wxFileSelector(const wxString& message = wxFileSelectorPromptStr, - const wxString& default_path = wxEmptyString, - const wxString& default_filename = wxEmptyString, - const wxString& default_extension = wxEmptyString, - const wxString& wildcard = wxFileSelectorDefaultWildcardStr, +WXDLLEXPORT wxString +wxFileSelector(const wxChar *message = wxFileSelectorPromptStr, + const wxChar *default_path = NULL, + const wxChar *default_filename = NULL, + const wxChar *default_extension = NULL, + const wxChar *wildcard = wxFileSelectorDefaultWildcardStr, int flags = 0, wxWindow *parent = NULL, int x = wxDefaultCoord, int y = wxDefaultCoord); // An extended version of wxFileSelector -WXDLLIMPEXP_CORE wxString -wxFileSelectorEx(const wxString& message = wxFileSelectorPromptStr, - const wxString& default_path = wxEmptyString, - const wxString& default_filename = wxEmptyString, +WXDLLEXPORT wxString +wxFileSelectorEx(const wxChar *message = wxFileSelectorPromptStr, + const wxChar *default_path = NULL, + const wxChar *default_filename = NULL, int *indexDefaultExtension = NULL, - const wxString& wildcard = wxFileSelectorDefaultWildcardStr, + const wxChar *wildcard = wxFileSelectorDefaultWildcardStr, int flags = 0, wxWindow *parent = NULL, int x = wxDefaultCoord, int y = wxDefaultCoord); // Ask for filename to load -WXDLLIMPEXP_CORE wxString -wxLoadFileSelector(const wxString& what, - const wxString& extension, - const wxString& default_name = wxEmptyString, - wxWindow *parent = NULL); +WXDLLEXPORT wxString +wxLoadFileSelector(const wxChar *what, + const wxChar *extension, + const wxChar *default_name = (const wxChar *)NULL, + wxWindow *parent = (wxWindow *) NULL); // Ask for filename to save -WXDLLIMPEXP_CORE wxString -wxSaveFileSelector(const wxString& what, - const wxString& extension, - const wxString& default_name = wxEmptyString, - wxWindow *parent = NULL); +WXDLLEXPORT wxString +wxSaveFileSelector(const wxChar *what, + const wxChar *extension, + const wxChar *default_name = (const wxChar *) NULL, + wxWindow *parent = (wxWindow *) NULL); #if defined (__WXUNIVERSAL__) - #define wxHAS_GENERIC_FILEDIALOG - #include "wx/generic/filedlgg.h" +#define wxUSE_GENERIC_FILEDIALOG +#include "wx/generic/filedlgg.h" #elif defined(__WXMSW__) - #include "wx/msw/filedlg.h" +#include "wx/msw/filedlg.h" #elif defined(__WXMOTIF__) - #include "wx/motif/filedlg.h" +#include "wx/motif/filedlg.h" +#elif defined(__WXGTK24__) +#include "wx/gtk/filedlg.h" // GTK+ > 2.4 has native version #elif defined(__WXGTK20__) - #include "wx/gtk/filedlg.h" // GTK+ > 2.4 has native version +#define wxUSE_GENERIC_FILEDIALOG +#include "wx/generic/filedlgg.h" #elif defined(__WXGTK__) - #include "wx/gtk1/filedlg.h" +#include "wx/gtk1/filedlg.h" #elif defined(__WXMAC__) - #include "wx/osx/filedlg.h" +#include "wx/mac/filedlg.h" #elif defined(__WXCOCOA__) - #include "wx/cocoa/filedlg.h" +#include "wx/cocoa/filedlg.h" #elif defined(__WXPM__) - #include "wx/os2/filedlg.h" +#include "wx/os2/filedlg.h" #endif #endif // wxUSE_FILEDLG diff --git a/Source/3rd Party/wx/include/wx/filefn.h b/Source/3rd Party/wx/include/wx/filefn.h index a20fd26df..84bb515a7 100644 --- a/Source/3rd Party/wx/include/wx/filefn.h +++ b/Source/3rd Party/wx/include/wx/filefn.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 29/01/98 -// RCS-ID: $Id$ +// RCS-ID: $Id: filefn.h 63300 2010-01-28 21:36:09Z MW $ // Copyright: (c) 1998 Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -22,9 +22,22 @@ #include #endif -#ifndef __WXWINCE__ +#ifdef __WXWINCE__ +// Nothing +#elif !defined(__MWERKS__) #include #include +#else + #ifdef __MACH__ + #include + #include + #include + #include + #else + #include + #include + #include + #endif #endif #ifdef __OS2__ @@ -45,7 +58,7 @@ #endif #if defined(__WINDOWS__) && !defined(__WXMICROWIN__) -#if !defined( __GNUWIN32__ ) && !defined(__WXWINCE__) && !defined(__CYGWIN__) +#if !defined( __GNUWIN32__ ) && !defined( __MWERKS__ ) && !defined(__SALFORDC__) && !defined(__WXWINCE__) && !defined(__CYGWIN__) #include #include #include @@ -70,18 +83,18 @@ #include #endif +#ifdef __SALFORDC__ + #include + #include +#endif + #ifndef __WXWINCE__ #include // O_RDONLY &c #endif - // ---------------------------------------------------------------------------- // constants // ---------------------------------------------------------------------------- -#if defined(__VISUALC__) || defined(__DIGITALMARS__) - typedef int mode_t; -#endif - #ifdef __WXWINCE__ typedef long off_t; #else @@ -93,10 +106,12 @@ #endif #endif -#if defined(__VISUALC__) && !defined(__WXWINCE__) +#if (defined(__VISUALC__) && !defined(__WXWINCE__)) || ( defined(__MWERKS__) && defined( __INTEL__) ) typedef _off_t off_t; #elif defined(__SYMANTEC__) typedef long off_t; +#elif defined(__MWERKS__) && !defined(__INTEL__) && !defined(__MACH__) + typedef long off_t; #endif enum wxSeekMode @@ -114,51 +129,6 @@ enum wxFileKind wxFILE_KIND_PIPE // a pipe }; -// we redefine these constants here because S_IREAD &c are _not_ standard -// however, we do assume that the values correspond to the Unix umask bits -enum wxPosixPermissions -{ - // standard Posix names for these permission flags: - wxS_IRUSR = 00400, - wxS_IWUSR = 00200, - wxS_IXUSR = 00100, - - wxS_IRGRP = 00040, - wxS_IWGRP = 00020, - wxS_IXGRP = 00010, - - wxS_IROTH = 00004, - wxS_IWOTH = 00002, - wxS_IXOTH = 00001, - - // longer but more readable synonyms for the constants above: - wxPOSIX_USER_READ = wxS_IRUSR, - wxPOSIX_USER_WRITE = wxS_IWUSR, - wxPOSIX_USER_EXECUTE = wxS_IXUSR, - - wxPOSIX_GROUP_READ = wxS_IRGRP, - wxPOSIX_GROUP_WRITE = wxS_IWGRP, - wxPOSIX_GROUP_EXECUTE = wxS_IXGRP, - - wxPOSIX_OTHERS_READ = wxS_IROTH, - wxPOSIX_OTHERS_WRITE = wxS_IWOTH, - wxPOSIX_OTHERS_EXECUTE = wxS_IXOTH, - - // default mode for the new files: allow reading/writing them to everybody but - // the effective file mode will be set after anding this value with umask and - // so won't include wxS_IW{GRP,OTH} for the default 022 umask value - wxS_DEFAULT = (wxPOSIX_USER_READ | wxPOSIX_USER_WRITE | \ - wxPOSIX_GROUP_READ | wxPOSIX_GROUP_WRITE | \ - wxPOSIX_OTHERS_READ | wxPOSIX_OTHERS_WRITE), - - // default mode for the new directories (see wxFileName::Mkdir): allow - // reading/writing/executing them to everybody, but just like wxS_DEFAULT - // the effective directory mode will be set after anding this value with umask - wxS_DIR_DEFAULT = (wxPOSIX_USER_READ | wxPOSIX_USER_WRITE | wxPOSIX_USER_EXECUTE | \ - wxPOSIX_GROUP_READ | wxPOSIX_GROUP_WRITE | wxPOSIX_GROUP_EXECUTE | \ - wxPOSIX_OTHERS_READ | wxPOSIX_OTHERS_WRITE | wxPOSIX_OTHERS_EXECUTE) -}; - // ---------------------------------------------------------------------------- // declare our versions of low level file functions: some compilers prepend // underscores to the usual names, some also have Unicode versions of them @@ -168,29 +138,29 @@ enum wxPosixPermissions // Implemented in filefnwce.cpp #if defined( __WXWINCE__) typedef __int64 wxFileOffset; - #define wxFileOffsetFmtSpec wxT("I64") - WXDLLIMPEXP_BASE int wxCRT_Open(const wxChar *filename, int oflag, int WXUNUSED(pmode)); - WXDLLIMPEXP_BASE int wxCRT_Access(const wxChar *name, int WXUNUSED(how)); - WXDLLIMPEXP_BASE int wxClose(int fd); - WXDLLIMPEXP_BASE int wxFsync(int WXUNUSED(fd)); - WXDLLIMPEXP_BASE int wxRead(int fd, void *buf, unsigned int count); - WXDLLIMPEXP_BASE int wxWrite(int fd, const void *buf, unsigned int count); - WXDLLIMPEXP_BASE int wxEof(int fd); - WXDLLIMPEXP_BASE wxFileOffset wxSeek(int fd, wxFileOffset offset, int origin); + #define wxFileOffsetFmtSpec _("I64") + int wxOpen(const wxChar *filename, int oflag, int WXUNUSED(pmode)); + int wxAccess(const wxChar *name, int WXUNUSED(how)); + int wxClose(int fd); + int wxFsync(int WXUNUSED(fd)); + int wxRead(int fd, void *buf, unsigned int count); + int wxWrite(int fd, const void *buf, unsigned int count); + int wxEof(int fd); + wxFileOffset wxSeek(int fd, wxFileOffset offset, int origin); #define wxLSeek wxSeek - WXDLLIMPEXP_BASE wxFileOffset wxTell(int fd); + wxFileOffset wxTell(int fd); // always Unicode under WinCE - #define wxCRT_MkDir _wmkdir - #define wxCRT_RmDir _wrmdir - #define wxCRT_Stat _wstat + #define wxMkDir _wmkdir + #define wxRmDir _wrmdir + #define wxStat _wstat #define wxStructStat struct _stat -#elif (defined(__WINDOWS__) || defined(__OS2__)) && \ +#elif (defined(__WXMSW__) || defined(__OS2__)) && !defined(__WXPALMOS__) && \ ( \ defined(__VISUALC__) || \ - defined(__MINGW64__) || \ (defined(__MINGW32__) && !defined(__WINE__) && \ wxCHECK_W32API_VERSION(0, 5)) || \ + defined(__MWERKS__) || \ defined(__DMC__) || \ defined(__WATCOMC__) || \ defined(__BORLANDC__) \ @@ -203,14 +173,14 @@ enum wxPosixPermissions // detect compilers which have support for huge files #if defined(__VISUALC__) #define wxHAS_HUGE_FILES 1 - #elif defined(__MINGW32__) || defined(__MINGW64__) + #elif defined(__MINGW32__) #define wxHAS_HUGE_FILES 1 #elif defined(_LARGE_FILES) #define wxHAS_HUGE_FILES 1 #endif // detect compilers which have support for huge stdio files - #if wxCHECK_VISUALC_VERSION(8) + #if defined __VISUALC__ && __VISUALC__ >= 1400 #define wxHAS_HUGE_STDIO_FILES #define wxFseek _fseeki64 #define wxFtell _ftelli64 @@ -220,10 +190,9 @@ enum wxPosixPermissions #define wxFtell ftello64 #endif - // other Windows compilers (DMC, Watcom, and Borland) don't have huge file - // support (or at least not all functions needed for it by wx) currently - - // types + // other Windows compilers (DMC, Watcom, Metrowerks and Borland) don't have + // huge file support (or at least not all functions needed for it by wx) + // currently #ifdef wxHAS_HUGE_FILES typedef wxLongLong_t wxFileOffset; @@ -232,46 +201,6 @@ enum wxPosixPermissions typedef off_t wxFileOffset; #endif - // at least Borland 5.5 doesn't like "struct ::stat" so don't use the scope - // resolution operator present in wxPOSIX_IDENT for it - #ifdef __BORLANDC__ - #define wxPOSIX_STRUCT(s) struct s - #else - #define wxPOSIX_STRUCT(s) struct wxPOSIX_IDENT(s) - #endif - - // Notice that Watcom is the only compiler to have a wide char - // version of struct stat as well as a wide char stat function variant. - // This was dropped since OW 1.4 "for consistency across platforms". - // - // Borland is also special in that it uses _stat with Unicode functions - // (for MSVC compatibility?) but stat with ANSI ones - #ifdef __BORLANDC__ - #if wxHAS_HUGE_FILES - #define wxStructStat struct stati64 - #else - #if wxUSE_UNICODE - #define wxStructStat struct _stat - #else - #define wxStructStat struct stat - #endif - #endif - #else // !__BORLANDC__ - #ifdef wxHAS_HUGE_FILES - #if wxUSE_UNICODE && wxONLY_WATCOM_EARLIER_THAN(1,4) - #define wxStructStat struct _wstati64 - #else - #define wxStructStat struct _stati64 - #endif - #else - #if wxUSE_UNICODE && wxONLY_WATCOM_EARLIER_THAN(1,4) - #define wxStructStat struct _wstat - #else - #define wxStructStat struct _stat - #endif - #endif - #endif // __BORLANDC__/!__BORLANDC__ - // functions @@ -288,12 +217,32 @@ enum wxPosixPermissions #define wxHAS_UNDERSCORES_IN_POSIX_IDENTS #endif + // at least Borland 5.5 doesn't like "struct ::stat" so don't use the scope + // resolution operator present in wxPOSIX_IDENT for it + #ifdef __BORLANDC__ + #define wxPOSIX_STRUCT(s) struct s + #else + #define wxPOSIX_STRUCT(s) struct wxPOSIX_IDENT(s) + #endif + // first functions not working with strings, i.e. without ANSI/Unicode // complications #define wxClose wxPOSIX_IDENT(close) - #define wxRead wxPOSIX_IDENT(read) - #define wxWrite wxPOSIX_IDENT(write) + #if defined(__MWERKS__) + #if __MSL__ >= 0x6000 + #define wxRead(fd, buf, nCount) _read(fd, (void *)buf, nCount) + #define wxWrite(fd, buf, nCount) _write(fd, (void *)buf, nCount) + #else + #define wxRead(fd, buf, nCount)\ + _read(fd, (const char *)buf, nCount) + #define wxWrite(fd, buf, nCount)\ + _write(fd, (const char *)buf, nCount) + #endif + #else // __MWERKS__ + #define wxRead wxPOSIX_IDENT(read) + #define wxWrite wxPOSIX_IDENT(write) + #endif #ifdef wxHAS_HUGE_FILES #ifndef __MINGW64__ @@ -327,86 +276,104 @@ enum wxPosixPermissions #define wxEof wxPOSIX_IDENT(eof) // then the functions taking strings - - // first the ANSI versions - #define wxCRT_OpenA wxPOSIX_IDENT(open) - #define wxCRT_AccessA wxPOSIX_IDENT(access) - #define wxCRT_MkDirA wxPOSIX_IDENT(mkdir) - #define wxCRT_RmDirA wxPOSIX_IDENT(rmdir) - #ifdef wxHAS_HUGE_FILES - // MinGW-64 provides underscore-less versions of all file functions - // except for this one. - #ifdef __MINGW64__ - #define wxCRT_StatA _stati64 - #else - #define wxCRT_StatA wxPOSIX_IDENT(stati64) - #endif - #else - // Unfortunately Watcom is not consistent - #if defined(__OS2__) && defined(__WATCOMC__) - #define wxCRT_StatA _stat - #else - #define wxCRT_StatA wxPOSIX_IDENT(stat) - #endif - #endif - - // then wide char ones #if wxUSE_UNICODE - // special workaround for buggy wopen() in bcc 5.5 - #if defined(__BORLANDC__) && \ - (__BORLANDC__ >= 0x550 && __BORLANDC__ <= 0x551) - WXDLLIMPEXP_BASE int wxCRT_OpenW(const wxChar *pathname, - int flags, mode_t mode); - #else - #define wxCRT_OpenW _wopen - #endif - - #define wxCRT_AccessW _waccess - #define wxCRT_MkDirW _wmkdir - #define wxCRT_RmDirW _wrmdir - #ifdef wxHAS_HUGE_FILES - #define wxCRT_StatW _wstati64 - #else - #define wxCRT_StatW _wstat - #endif - #endif // wxUSE_UNICODE - - - // finally the default char-type versions - #if wxUSE_UNICODE - #if wxUSE_UNICODE_MSLU || defined(__WX_STRICT_ANSI_GCC__) + #if wxUSE_UNICODE_MSLU // implement the missing file functions in Win9x ourselves - WXDLLIMPEXP_BASE int wxMSLU__wopen(const wxChar *name, - int flags, int mode); - WXDLLIMPEXP_BASE int wxMSLU__waccess(const wxChar *name, - int mode); - WXDLLIMPEXP_BASE int wxMSLU__wmkdir(const wxChar *name); - WXDLLIMPEXP_BASE int wxMSLU__wrmdir(const wxChar *name); + #if defined( __VISUALC__ ) \ + || ( defined(__MINGW32__) && wxCHECK_W32API_VERSION( 0, 5 ) ) \ + || ( defined(__MWERKS__) && defined(__WXMSW__) ) \ + || ( defined(__BORLANDC__) && (__BORLANDC__ > 0x460) ) \ + || defined(__DMC__) - WXDLLIMPEXP_BASE int - wxMSLU__wstat(const wxChar *name, wxStructStat *buffer); + WXDLLIMPEXP_BASE int wxMSLU__wopen(const wxChar *name, + int flags, int mode); + WXDLLIMPEXP_BASE int wxMSLU__waccess(const wxChar *name, + int mode); + WXDLLIMPEXP_BASE int wxMSLU__wmkdir(const wxChar *name); + WXDLLIMPEXP_BASE int wxMSLU__wrmdir(const wxChar *name); - #define wxCRT_Open wxMSLU__wopen + WXDLLIMPEXP_BASE int + wxMSLU__wstat(const wxChar *name, wxPOSIX_STRUCT(stat) *buffer); + WXDLLIMPEXP_BASE int + wxMSLU__wstati64(const wxChar *name, + wxPOSIX_STRUCT(stati64) *buffer); + #endif // Windows compilers with MSLU support - #define wxCRT_Access wxMSLU__waccess - #define wxCRT_MkDir wxMSLU__wmkdir - #define wxCRT_RmDir wxMSLU__wrmdir - #define wxCRT_Stat wxMSLU__wstat + #define wxOpen wxMSLU__wopen + + #define wxAccess wxMSLU__waccess + #define wxMkDir wxMSLU__wmkdir + #define wxRmDir wxMSLU__wrmdir + #ifdef wxHAS_HUGE_FILES + #define wxStat wxMSLU__wstati64 + #else + #define wxStat wxMSLU__wstat + #endif #else // !wxUSE_UNICODE_MSLU - #define wxCRT_Open wxCRT_OpenW - #define wxCRT_Access wxCRT_AccessW - #define wxCRT_MkDir wxCRT_MkDirW - #define wxCRT_RmDir wxCRT_RmDirW - #define wxCRT_Stat wxCRT_StatW + #ifdef __BORLANDC__ + #if __BORLANDC__ >= 0x550 && __BORLANDC__ <= 0x551 + WXDLLIMPEXP_BASE int wxOpen(const wxChar *pathname, + int flags, mode_t mode); + #else + #define wxOpen _wopen + #endif + #define wxAccess _waccess + #define wxMkDir _wmkdir + #define wxRmDir _wrmdir + #ifdef wxHAS_HUGE_FILES + #define wxStat _wstati64 + #else + #define wxStat _wstat + #endif + #else + #define wxOpen _wopen + #define wxAccess _waccess + #define wxMkDir _wmkdir + #define wxRmDir _wrmdir + #ifdef wxHAS_HUGE_FILES + #define wxStat _wstati64 + #else + #define wxStat _wstat + #endif + #endif #endif // wxUSE_UNICODE_MSLU/!wxUSE_UNICODE_MSLU #else // !wxUSE_UNICODE - #define wxCRT_Open wxCRT_OpenA - #define wxCRT_Access wxCRT_AccessA - #define wxCRT_MkDir wxCRT_MkDirA - #define wxCRT_RmDir wxCRT_RmDirA - #define wxCRT_Stat wxCRT_StatA + #define wxOpen wxPOSIX_IDENT(open) + #define wxAccess wxPOSIX_IDENT(access) + #define wxMkDir wxPOSIX_IDENT(mkdir) + #define wxRmDir wxPOSIX_IDENT(rmdir) + #ifdef wxHAS_HUGE_FILES + #define wxStat wxPOSIX_IDENT(stati64) + #else + // Unfortunately Watcom is not consistent, so:- + #if defined(__OS2__) && defined(__WATCOMC__) + #define wxStat _stat + #else + #if defined (__BORLANDC__) + #define wxStat _stat //wxPOSIX_IDENT(stat) + #else + #define wxStat wxPOSIX_IDENT(stat) + #endif // !borland + #endif // !watcom + #endif #endif // wxUSE_UNICODE/!wxUSE_UNICODE + // Types: Notice that Watcom is the only compiler to have a wide char + // version of struct stat as well as a wide char stat function variant. + // This was droped since OW 1.4 "for consistency across platforms". + #ifdef wxHAS_HUGE_FILES + #if wxUSE_UNICODE && wxONLY_WATCOM_EARLIER_THAN(1,4) + #define wxStructStat struct _wstati64 + #else + #define wxStructStat struct _stati64 + #endif + #else + #if wxUSE_UNICODE && wxONLY_WATCOM_EARLIER_THAN(1,4) + #define wxStructStat struct _wstat + #else + #define wxStructStat struct _stat + #endif + #endif // constants (unless already defined by the user code) #ifdef wxHAS_UNDERSCORES_IN_POSIX_IDENTS @@ -442,16 +409,16 @@ enum wxPosixPermissions #undef wxHAS_HUGE_STDIO_FILES #else // Unix or Windows using unknown compiler, assume POSIX supported typedef off_t wxFileOffset; - #ifdef HAVE_LARGEFILE_SUPPORT + #ifdef _LARGE_FILES #define wxFileOffsetFmtSpec wxLongLongFmtSpec wxCOMPILE_TIME_ASSERT( sizeof(off_t) == sizeof(wxLongLong_t), BadFileSizeType ); // wxFile is present and supports large files - #if wxUSE_FILE + #ifdef wxUSE_FILE #define wxHAS_LARGE_FILES #endif // wxFFile is present and supports large files - #if wxUSE_FFILE && (SIZEOF_LONG == 8 || defined HAVE_FSEEKO) + #if SIZEOF_LONG == 8 || defined HAVE_FSEEKO #define wxHAS_LARGE_FFILES #endif #ifdef HAVE_FSEEKO @@ -470,27 +437,32 @@ enum wxPosixPermissions #define wxFsync fsync #define wxEof eof - #define wxCRT_MkDir mkdir - #define wxCRT_RmDir rmdir + #define wxMkDir mkdir + #define wxRmDir rmdir #define wxTell(fd) lseek(fd, 0, SEEK_CUR) #define wxStructStat struct stat - #define wxCRT_Open open - #define wxCRT_Stat stat - #define wxCRT_Lstat lstat - #define wxCRT_Access access + #if wxUSE_UNICODE + #define wxNEED_WX_UNISTD_H + #if defined(__DMC__) + typedef unsigned long mode_t; + #endif + WXDLLIMPEXP_BASE int wxStat( const wxChar *file_name, wxStructStat *buf ); + WXDLLIMPEXP_BASE int wxLstat( const wxChar *file_name, wxStructStat *buf ); + WXDLLIMPEXP_BASE int wxAccess( const wxChar *pathname, int mode ); + WXDLLIMPEXP_BASE int wxOpen( const wxChar *pathname, int flags, mode_t mode ); + #else + #define wxOpen open + #define wxStat stat + #define wxLstat lstat + #define wxAccess access + #endif #define wxHAS_NATIVE_LSTAT #endif // platforms -// if the platform doesn't have symlinks, define wxCRT_Lstat to be the same as -// wxCRT_Stat to avoid #ifdefs in the code using it -#ifndef wxHAS_NATIVE_LSTAT - #define wxCRT_Lstat wxCRT_Stat -#endif - // define wxFseek/wxFtell to large file versions if available (done above) or // to fseek/ftell if not, to save ifdefs in using code #ifndef wxFseek @@ -500,35 +472,18 @@ enum wxPosixPermissions #define wxFtell ftell #endif -inline int wxAccess(const wxString& path, mode_t mode) - { return wxCRT_Access(path.fn_str(), mode); } -inline int wxOpen(const wxString& path, int flags, mode_t mode) - { return wxCRT_Open(path.fn_str(), flags, mode); } - -// FIXME-CE: provide our own implementations of the missing CRT functions -#ifndef __WXWINCE__ -inline int wxStat(const wxString& path, wxStructStat *buf) - { return wxCRT_Stat(path.fn_str(), buf); } -inline int wxLstat(const wxString& path, wxStructStat *buf) - { return wxCRT_Lstat(path.fn_str(), buf); } -inline int wxRmDir(const wxString& path) - { return wxCRT_RmDir(path.fn_str()); } -#if (defined(__WINDOWS__) && !defined(__CYGWIN__)) \ - || (defined(__OS2__) && defined(__WATCOMC__)) -inline int wxMkDir(const wxString& path, mode_t WXUNUSED(mode) = 0) - { return wxCRT_MkDir(path.fn_str()); } -#else -inline int wxMkDir(const wxString& path, mode_t mode) - { return wxCRT_MkDir(path.fn_str(), mode); } -#endif -#endif // !__WXWINCE__ - #ifdef O_BINARY #define wxO_BINARY O_BINARY #else #define wxO_BINARY 0 #endif +// if the platform doesn't have symlinks, define wxLstat to be the same as +// wxStat to avoid #ifdefs in the code using it +#ifndef wxHAS_NATIVE_LSTAT + #define wxLstat wxStat +#endif + #if defined(__VISAGECPP__) && __IBMCPP__ >= 400 // // VisualAge C++ V4.0 cannot have any external linkage const decs @@ -545,7 +500,7 @@ const int wxInvalidOffset = -1; WXDLLIMPEXP_BASE bool wxFileExists(const wxString& filename); // does the path exist? (may have or not '/' or '\\' at the end) -WXDLLIMPEXP_BASE bool wxDirExists(const wxString& pathName); +WXDLLIMPEXP_BASE bool wxDirExists(const wxChar *pszPathName); WXDLLIMPEXP_BASE bool wxIsAbsolutePath(const wxString& filename); @@ -556,58 +511,43 @@ WXDLLIMPEXP_BASE wxString wxFileNameFromPath(const wxString& path); // Get directory WXDLLIMPEXP_BASE wxString wxPathOnly(const wxString& path); -// all deprecated functions below are deprecated in favour of wxFileName's methods -#if WXWIN_COMPATIBILITY_2_8 +// wxString version +WXDLLIMPEXP_BASE wxString wxRealPath(const wxString& path); -wxDEPRECATED( WXDLLIMPEXP_BASE void wxDos2UnixFilename(char *s) ); -wxDEPRECATED( WXDLLIMPEXP_BASE void wxDos2UnixFilename(wchar_t *s) ); +WXDLLIMPEXP_BASE void wxDos2UnixFilename(wxChar *s); -wxDEPRECATED_BUT_USED_INTERNALLY( - WXDLLIMPEXP_BASE void wxUnix2DosFilename(char *s) ); -wxDEPRECATED_BUT_USED_INTERNALLY( - WXDLLIMPEXP_BASE void wxUnix2DosFilename(wchar_t *s) ); +WXDLLIMPEXP_BASE void wxUnix2DosFilename(wxChar *s); // Strip the extension, in situ -// Deprecated in favour of wxFileName::StripExtension() but notice that their -// behaviour is slightly different, see the manual -wxDEPRECATED( WXDLLIMPEXP_BASE void wxStripExtension(char *buffer) ); -wxDEPRECATED( WXDLLIMPEXP_BASE void wxStripExtension(wchar_t *buffer) ); -wxDEPRECATED( WXDLLIMPEXP_BASE void wxStripExtension(wxString& buffer) ); +WXDLLIMPEXP_BASE void wxStripExtension(wxChar *buffer); +WXDLLIMPEXP_BASE void wxStripExtension(wxString& buffer); // Get a temporary filename -wxDEPRECATED_BUT_USED_INTERNALLY( WXDLLIMPEXP_BASE wxChar* wxGetTempFileName(const wxString& prefix, wxChar *buf = NULL) ); -wxDEPRECATED_BUT_USED_INTERNALLY( WXDLLIMPEXP_BASE bool wxGetTempFileName(const wxString& prefix, wxString& buf) ); +WXDLLIMPEXP_BASE wxChar* wxGetTempFileName(const wxString& prefix, wxChar *buf = (wxChar *) NULL); +WXDLLIMPEXP_BASE bool wxGetTempFileName(const wxString& prefix, wxString& buf); // Expand file name (~/ and ${OPENWINHOME}/ stuff) -wxDEPRECATED_BUT_USED_INTERNALLY( WXDLLIMPEXP_BASE char* wxExpandPath(char *dest, const wxString& path) ); -wxDEPRECATED_BUT_USED_INTERNALLY( WXDLLIMPEXP_BASE wchar_t* wxExpandPath(wchar_t *dest, const wxString& path) ); - // DEPRECATED: use wxFileName::Normalize(wxPATH_NORM_ENV_VARS) +WXDLLIMPEXP_BASE wxChar* wxExpandPath(wxChar *dest, const wxChar *path); +WXDLLIMPEXP_BASE bool wxExpandPath(wxString& dest, const wxChar *path); // Contract w.r.t environment ( -> ${OPENWINHOME}/lib) // and make (if under the home tree) relative to home // [caller must copy-- volatile] -wxDEPRECATED( WXDLLIMPEXP_BASE wxChar* wxContractPath(const wxString& filename, const wxString& envname = wxEmptyString, - const wxString& user = wxEmptyString) ); - // DEPRECATED: use wxFileName::ReplaceEnvVariable and wxFileName::ReplaceHomeDir + const wxString& user = wxEmptyString); // Destructive removal of /./ and /../ stuff -wxDEPRECATED_BUT_USED_INTERNALLY( WXDLLIMPEXP_BASE char* wxRealPath(char *path) ); -wxDEPRECATED_BUT_USED_INTERNALLY( WXDLLIMPEXP_BASE wchar_t* wxRealPath(wchar_t *path) ); -wxDEPRECATED_BUT_USED_INTERNALLY( WXDLLIMPEXP_BASE wxString wxRealPath(const wxString& path) ); - // DEPRECATED: use wxFileName::Normalize instead +WXDLLIMPEXP_BASE wxChar* wxRealPath(wxChar *path); // Allocate a copy of the full absolute path -wxDEPRECATED( WXDLLIMPEXP_BASE wxChar* wxCopyAbsolutePath(const wxString& path) ); - // DEPRECATED: use wxFileName::MakeAbsolute instead -#endif +WXDLLIMPEXP_BASE wxChar* wxCopyAbsolutePath(const wxString& path); // Get first file name matching given wild card. // Flags are reserved for future use. #define wxFILE 1 #define wxDIR 2 -WXDLLIMPEXP_BASE wxString wxFindFirstFile(const wxString& spec, int flags = wxFILE); +WXDLLIMPEXP_BASE wxString wxFindFirstFile(const wxChar *spec, int flags = wxFILE); WXDLLIMPEXP_BASE wxString wxFindNextFile(); // Does the pattern contain wildcards? @@ -637,7 +577,7 @@ WXDLLIMPEXP_BASE bool wxRenameFile(const wxString& file1, const wxString& file2, // copies into buf. // IMPORTANT NOTE getcwd is know not to work under some releases // of Win32s 1.3, according to MS release notes! -wxDEPRECATED( WXDLLIMPEXP_BASE wxChar* wxGetWorkingDirectory(wxChar *buf = NULL, int sz = 1000) ); +wxDEPRECATED( WXDLLIMPEXP_BASE wxChar* wxGetWorkingDirectory(wxChar *buf = (wxChar *) NULL, int sz = 1000) ); // new and preferred version of wxGetWorkingDirectory // NB: can't have the same name because of overloading ambiguity #endif // WXWIN_COMPATIBILITY_2_6 @@ -647,7 +587,7 @@ WXDLLIMPEXP_BASE wxString wxGetCwd(); WXDLLIMPEXP_BASE bool wxSetWorkingDirectory(const wxString& d); // Make directory -WXDLLIMPEXP_BASE bool wxMkdir(const wxString& dir, int perm = wxS_DIR_DEFAULT); +WXDLLIMPEXP_BASE bool wxMkdir(const wxString& dir, int perm = 0777); // Remove directory. Flags reserved for future use. WXDLLIMPEXP_BASE bool wxRmdir(const wxString& dir, int flags = 0); @@ -727,20 +667,17 @@ inline bool wxIsPathSeparator(wxChar c) } // does the string ends with path separator? -WXDLLIMPEXP_BASE bool wxEndsWithPathSeparator(const wxString& filename); +WXDLLIMPEXP_BASE bool wxEndsWithPathSeparator(const wxChar *pszFileName); -#if WXWIN_COMPATIBILITY_2_8 // split the full path into path (including drive for DOS), name and extension // (understands both '/' and '\\') -// Deprecated in favour of wxFileName::SplitPath -wxDEPRECATED( WXDLLIMPEXP_BASE void wxSplitPath(const wxString& fileName, - wxString *pstrPath, - wxString *pstrName, - wxString *pstrExt) ); -#endif +WXDLLIMPEXP_BASE void wxSplitPath(const wxChar *pszFileName, + wxString *pstrPath, + wxString *pstrName, + wxString *pstrExt); // find a file in a list of directories, returns false if not found -WXDLLIMPEXP_BASE bool wxFindFileInPath(wxString *pStr, const wxString& szPath, const wxString& szFile); +WXDLLIMPEXP_BASE bool wxFindFileInPath(wxString *pStr, const wxChar *pszPath, const wxChar *pszFile); // Get the OS directory if appropriate (such as the Windows directory). // On non-Windows platform, probably just return the empty string. diff --git a/Source/3rd Party/wx/include/wx/filehistory.h b/Source/3rd Party/wx/include/wx/filehistory.h deleted file mode 100644 index 222f93739..000000000 --- a/Source/3rd Party/wx/include/wx/filehistory.h +++ /dev/null @@ -1,114 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/filehistory.h -// Purpose: wxFileHistory class -// Author: Julian Smart, Vaclav Slavik -// Created: 2010-05-03 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart, Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FILEHISTORY_H_ -#define _WX_FILEHISTORY_H_ - -#include "wx/defs.h" - -#if wxUSE_FILE_HISTORY - -#include "wx/windowid.h" -#include "wx/object.h" -#include "wx/list.h" -#include "wx/string.h" -#include "wx/arrstr.h" - -class WXDLLIMPEXP_FWD_CORE wxMenu; -class WXDLLIMPEXP_FWD_BASE wxConfigBase; -class WXDLLIMPEXP_FWD_BASE wxFileName; - -// ---------------------------------------------------------------------------- -// File history management -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxFileHistoryBase : public wxObject -{ -public: - wxFileHistoryBase(size_t maxFiles = 9, wxWindowID idBase = wxID_FILE1); - - // Operations - virtual void AddFileToHistory(const wxString& file); - virtual void RemoveFileFromHistory(size_t i); - virtual int GetMaxFiles() const { return (int)m_fileMaxFiles; } - virtual void UseMenu(wxMenu *menu); - - // Remove menu from the list (MDI child may be closing) - virtual void RemoveMenu(wxMenu *menu); - -#if wxUSE_CONFIG - virtual void Load(const wxConfigBase& config); - virtual void Save(wxConfigBase& config); -#endif // wxUSE_CONFIG - - virtual void AddFilesToMenu(); - virtual void AddFilesToMenu(wxMenu* menu); // Single menu - - // Accessors - virtual wxString GetHistoryFile(size_t i) const { return m_fileHistory[i]; } - virtual size_t GetCount() const { return m_fileHistory.GetCount(); } - - const wxList& GetMenus() const { return m_fileMenus; } - - // Set/get base id - void SetBaseId(wxWindowID baseId) { m_idBase = baseId; } - wxWindowID GetBaseId() const { return m_idBase; } - -#if WXWIN_COMPATIBILITY_2_6 - // deprecated, use GetCount() instead - wxDEPRECATED( size_t GetNoHistoryFiles() const ); -#endif // WXWIN_COMPATIBILITY_2_6 - -protected: - // Last n files - wxArrayString m_fileHistory; - - // Menus to maintain (may need several for an MDI app) - wxList m_fileMenus; - - // Max files to maintain - size_t m_fileMaxFiles; - -private: - // The ID of the first history menu item (Doesn't have to be wxID_FILE1) - wxWindowID m_idBase; - - // Normalize a file name to canonical form. We have a special function for - // this to ensure the same normalization is used everywhere. - static wxString NormalizeFileName(const wxFileName& filename); - - wxDECLARE_NO_COPY_CLASS(wxFileHistoryBase); -}; - -#if WXWIN_COMPATIBILITY_2_6 -inline size_t wxFileHistoryBase::GetNoHistoryFiles() const -{ - return m_fileHistory.GetCount(); -} -#endif // WXWIN_COMPATIBILITY_2_6 - - -#if defined(__WXGTK20__) - #include "wx/gtk/filehistory.h" -#else - // no platform-specific implementation of wxFileHistory yet - class WXDLLIMPEXP_CORE wxFileHistory : public wxFileHistoryBase - { - public: - wxFileHistory(size_t maxFiles = 9, wxWindowID idBase = wxID_FILE1) - : wxFileHistoryBase(maxFiles, idBase) {} - - DECLARE_DYNAMIC_CLASS(wxFileHistory) - }; -#endif - -#endif // wxUSE_FILE_HISTORY - -#endif // _WX_FILEHISTORY_H_ diff --git a/Source/3rd Party/wx/include/wx/filename.h b/Source/3rd Party/wx/include/wx/filename.h index 62e37abb1..e9228787d 100644 --- a/Source/3rd Party/wx/include/wx/filename.h +++ b/Source/3rd Party/wx/include/wx/filename.h @@ -4,7 +4,7 @@ // Author: Robert Roebling, Vadim Zeitlin // Modified by: // Created: 28.12.00 -// RCS-ID: $Id$ +// RCS-ID: $Id: filename.h 61872 2009-09-09 22:37:05Z VZ $ // Copyright: (c) 2000 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -27,8 +27,6 @@ #include "wx/filefn.h" #include "wx/datetime.h" #include "wx/intl.h" -#include "wx/longlong.h" -#include "wx/file.h" #if wxUSE_FILE class WXDLLIMPEXP_FWD_BASE wxFile; @@ -38,12 +36,6 @@ class WXDLLIMPEXP_FWD_BASE wxFile; class WXDLLIMPEXP_FWD_BASE wxFFile; #endif -// this symbol is defined for the platforms where file systems use volumes in -// paths -#if defined(__WINDOWS__) || defined(__DOS__) || defined(__OS2__) - #define wxHAS_FILESYSTEM_VOLUMES -#endif - // ---------------------------------------------------------------------------- // constants // ---------------------------------------------------------------------------- @@ -65,20 +57,12 @@ enum wxPathFormat wxPATH_MAX // Not a valid value for specifying path format }; -// different conventions that may be used with GetHumanReadableSize() -enum wxSizeConvention -{ - wxSIZE_CONV_TRADITIONAL, // 1024 bytes = 1 KB - wxSIZE_CONV_IEC, // 1024 bytes = 1 KiB - wxSIZE_CONV_SI // 1000 bytes = 1 KB -}; - // the kind of normalization to do with the file name: these values can be // or'd together to perform several operations at once enum wxPathNormalize { wxPATH_NORM_ENV_VARS = 0x0001, // replace env vars with their values - wxPATH_NORM_DOTS = 0x0002, // squeeze all .. and . + wxPATH_NORM_DOTS = 0x0002, // squeeze all .. and . and prepend cwd wxPATH_NORM_TILDE = 0x0004, // Unix only: replace ~ and ~user wxPATH_NORM_CASE = 0x0008, // if case insensitive => tolower wxPATH_NORM_ABSOLUTE = 0x0010, // make the path absolute @@ -90,28 +74,18 @@ enum wxPathNormalize // what exactly should GetPath() return? enum { - wxPATH_NO_SEPARATOR = 0x0000, // for symmetry with wxPATH_GET_SEPARATOR wxPATH_GET_VOLUME = 0x0001, // include the volume if applicable wxPATH_GET_SEPARATOR = 0x0002 // terminate the path with the separator }; -// Mkdir flags +// MkDir flags enum { wxPATH_MKDIR_FULL = 0x0001 // create directories recursively }; -// Rmdir flags -enum -{ - wxPATH_RMDIR_FULL = 0x0001, // delete with subdirectories if empty - wxPATH_RMDIR_RECURSIVE = 0x0002 // delete all recursively (dangerous!) -}; - -#if wxUSE_LONGLONG // error code of wxFileName::GetSize() -extern WXDLLIMPEXP_DATA_BASE(const wxULongLong) wxInvalidSize; -#endif // wxUSE_LONGLONG +extern WXDLLIMPEXP_DATA_BASE(wxULongLong) wxInvalidSize; @@ -190,7 +164,7 @@ public: // assorted assignment operators wxFileName& operator=(const wxFileName& filename) - { if (this != &filename) Assign(filename); return *this; } + { Assign(filename); return *this; } wxFileName& operator=(const wxString& filename) { Assign(filename); return *this; } @@ -214,20 +188,14 @@ public: !m_ext.empty() || m_hasExt; } - // does the file with this name exist? + // does the file with this name exists? bool FileExists() const; static bool FileExists( const wxString &file ); - // does the directory with this name exist? + // does the directory with this name exists? bool DirExists() const; static bool DirExists( const wxString &dir ); - // does anything at all with this name (i.e. file, directory or some - // other file system object such as a device, socket, ...) exist? - bool Exists() const { return Exists(GetFullPath()); } - static bool Exists(const wxString& path); - - // checks on most common flags for files/directories; // more platform-specific features (like e.g. Unix permissions) are not // available in wxFileName @@ -257,10 +225,10 @@ public: // (any of the pointers may be NULL) bool SetTimes(const wxDateTime *dtAccess, const wxDateTime *dtMod, - const wxDateTime *dtCreate) const; + const wxDateTime *dtCreate); // set the access and modification times to the current moment - bool Touch() const; + bool Touch(); // return the last access, last modification and create times // (any of the pointers may be NULL) @@ -277,9 +245,9 @@ public: } #endif // wxUSE_DATETIME -#if defined( __WXOSX_MAC__ ) && wxOSX_USE_CARBON +#ifdef __WXMAC__ bool MacSetTypeAndCreator( wxUint32 type , wxUint32 creator ) ; - bool MacGetTypeAndCreator( wxUint32 *type , wxUint32 *creator ) const; + bool MacGetTypeAndCreator( wxUint32 *type , wxUint32 *creator ) ; // gets the 'common' type and creator for a certain extension static bool MacFindDefaultTypeAndCreator( const wxString& ext , wxUint32 *type , wxUint32 *creator ) ; // registers application defined extensions and their default type and creator @@ -295,7 +263,7 @@ public: static wxString GetCwd(const wxString& volume = wxEmptyString); // change the current working directory - bool SetCwd() const; + bool SetCwd(); static bool SetCwd( const wxString &cwd ); // get the value of user home (Unix only mainly) @@ -330,12 +298,11 @@ public: #endif // wxUSE_FFILE // directory creation and removal. - bool Mkdir(int perm = wxS_DIR_DEFAULT, int flags = 0) const; - static bool Mkdir(const wxString &dir, int perm = wxS_DIR_DEFAULT, - int flags = 0); + bool Mkdir( int perm = 0777, int flags = 0); + static bool Mkdir( const wxString &dir, int perm = 0777, int flags = 0 ); - bool Rmdir(int flags = 0) const; - static bool Rmdir(const wxString &dir, int flags = 0); + bool Rmdir(); + static bool Rmdir( const wxString &dir ); // operations on the path @@ -372,28 +339,9 @@ public: // the arguments bool GetShortcutTarget(const wxString& shortcutPath, wxString& targetFilename, - wxString* arguments = NULL) const; + wxString* arguments = NULL); #endif -#ifndef __WXWINCE__ - // if the path contains the value of the environment variable named envname - // then this function replaces it with the string obtained from - // wxString::Format(replacementFmtString, value_of_envname_variable) - // - // Example: - // wxFileName fn("/usr/openwin/lib/someFile"); - // fn.ReplaceEnvVariable("OPENWINHOME"); - // // now fn.GetFullPath() == "$OPENWINHOME/lib/someFile" - bool ReplaceEnvVariable(const wxString& envname, - const wxString& replacementFmtString = "$%s", - wxPathFormat format = wxPATH_NATIVE); -#endif - - // replaces, if present in the path, the home directory for the given user - // (see wxGetHomeDir) with a tilde - bool ReplaceHomeDir(wxPathFormat format = wxPATH_NATIVE); - - // Comparison // compares with the rules of the given platforms format @@ -441,17 +389,12 @@ public: static wxString GetPathTerminators(wxPathFormat format = wxPATH_NATIVE); // get the canonical path separator for this format - static wxUniChar GetPathSeparator(wxPathFormat format = wxPATH_NATIVE) + static wxChar GetPathSeparator(wxPathFormat format = wxPATH_NATIVE) { return GetPathSeparators(format)[0u]; } // is the char a path separator for this format? static bool IsPathSeparator(wxChar ch, wxPathFormat format = wxPATH_NATIVE); - // is this is a DOS path which beings with a windows unique volume name - // ('\\?\Volume{guid}\')? - static bool IsMSWUniqueVolumeNamePath(const wxString& path, - wxPathFormat format = wxPATH_NATIVE); - // Dir accessors size_t GetDirCount() const { return m_dirs.size(); } void AppendDir(const wxString& dir); @@ -538,32 +481,24 @@ public: wxString *path, wxPathFormat format = wxPATH_NATIVE); - // strip the file extension: "foo.bar" => "foo" (but ".baz" => ".baz") +#if wxABI_VERSION >= 20811 + // strip the file extension static wxString StripExtension(const wxString& fullpath); +#endif // wxABI_VERSION >= 20811 -#ifdef wxHAS_FILESYSTEM_VOLUMES - // return the string representing a file system volume, or drive - static wxString GetVolumeString(char drive, int flags = wxPATH_GET_SEPARATOR); -#endif // wxHAS_FILESYSTEM_VOLUMES - // File size + // Filesize -#if wxUSE_LONGLONG // returns the size of the given filename wxULongLong GetSize() const; static wxULongLong GetSize(const wxString &file); // returns the size in a human readable form - wxString - GetHumanReadableSize(const wxString& nullsize = _("Not available"), - int precision = 1, - wxSizeConvention conv = wxSIZE_CONV_TRADITIONAL) const; - static wxString - GetHumanReadableSize(const wxULongLong& sz, - const wxString& nullsize = _("Not available"), - int precision = 1, - wxSizeConvention conv = wxSIZE_CONV_TRADITIONAL); -#endif // wxUSE_LONGLONG + wxString GetHumanReadableSize(const wxString &nullsize = wxGetTranslation(wxT("Not available")), + int precision = 1) const; + static wxString GetHumanReadableSize(const wxULongLong &sz, + const wxString &nullsize = wxGetTranslation(wxT("Not available")), + int precision = 1); // deprecated methods, don't use any more diff --git a/Source/3rd Party/wx/include/wx/filepicker.h b/Source/3rd Party/wx/include/wx/filepicker.h index a272a1dcd..ce08f8569 100644 --- a/Source/3rd Party/wx/include/wx/filepicker.h +++ b/Source/3rd Party/wx/include/wx/filepicker.h @@ -5,7 +5,7 @@ // Modified by: // Created: 14/4/2006 // Copyright: (c) Francesco Montorsi -// RCS-ID: $Id$ +// RCS-ID: $Id: filepicker.h 49804 2007-11-10 01:09:42Z VZ $ // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// @@ -17,64 +17,20 @@ #if wxUSE_FILEPICKERCTRL || wxUSE_DIRPICKERCTRL #include "wx/pickerbase.h" -#include "wx/filename.h" class WXDLLIMPEXP_FWD_CORE wxDialog; class WXDLLIMPEXP_FWD_CORE wxFileDirPickerEvent; -extern WXDLLIMPEXP_DATA_CORE(const char) wxFilePickerWidgetLabel[]; -extern WXDLLIMPEXP_DATA_CORE(const char) wxFilePickerWidgetNameStr[]; -extern WXDLLIMPEXP_DATA_CORE(const char) wxFilePickerCtrlNameStr[]; -extern WXDLLIMPEXP_DATA_CORE(const char) wxFileSelectorPromptStr[]; +extern WXDLLEXPORT_DATA(const wxChar) wxFilePickerWidgetLabel[]; +extern WXDLLEXPORT_DATA(const wxChar) wxFilePickerWidgetNameStr[]; +extern WXDLLEXPORT_DATA(const wxChar) wxFilePickerCtrlNameStr[]; +extern WXDLLEXPORT_DATA(const wxChar) wxFileSelectorPromptStr[]; -extern WXDLLIMPEXP_DATA_CORE(const char) wxDirPickerWidgetLabel[]; -extern WXDLLIMPEXP_DATA_CORE(const char) wxDirPickerWidgetNameStr[]; -extern WXDLLIMPEXP_DATA_CORE(const char) wxDirPickerCtrlNameStr[]; -extern WXDLLIMPEXP_DATA_CORE(const char) wxDirSelectorPromptStr[]; +extern WXDLLEXPORT_DATA(const wxChar) wxDirPickerWidgetLabel[]; +extern WXDLLEXPORT_DATA(const wxChar) wxDirPickerWidgetNameStr[]; +extern WXDLLEXPORT_DATA(const wxChar) wxDirPickerCtrlNameStr[]; +extern WXDLLEXPORT_DATA(const wxChar) wxDirSelectorPromptStr[]; -// ---------------------------------------------------------------------------- -// wxFileDirPickerEvent: used by wxFilePickerCtrl and wxDirPickerCtrl only -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxFileDirPickerEvent : public wxCommandEvent -{ -public: - wxFileDirPickerEvent() {} - wxFileDirPickerEvent(wxEventType type, wxObject *generator, int id, const wxString &path) - : wxCommandEvent(type, id), - m_path(path) - { - SetEventObject(generator); - } - - wxString GetPath() const { return m_path; } - void SetPath(const wxString &p) { m_path = p; } - - // default copy ctor, assignment operator and dtor are ok - virtual wxEvent *Clone() const { return new wxFileDirPickerEvent(*this); } - -private: - wxString m_path; - - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxFileDirPickerEvent) -}; - -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_FILEPICKER_CHANGED, wxFileDirPickerEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_DIRPICKER_CHANGED, wxFileDirPickerEvent ); - -// ---------------------------------------------------------------------------- -// event types and macros -// ---------------------------------------------------------------------------- - -typedef void (wxEvtHandler::*wxFileDirPickerEventFunction)(wxFileDirPickerEvent&); - -#define wxFileDirPickerEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxFileDirPickerEventFunction, func) - -#define EVT_FILEPICKER_CHANGED(id, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_FILEPICKER_CHANGED, id, wxFileDirPickerEventHandler(fn)) -#define EVT_DIRPICKER_CHANGED(id, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_DIRPICKER_CHANGED, id, wxFileDirPickerEventHandler(fn)) // ---------------------------------------------------------------------------- // wxFileDirPickerWidgetBase: a generic abstract interface which must be @@ -87,13 +43,9 @@ public: wxFileDirPickerWidgetBase() { } virtual ~wxFileDirPickerWidgetBase() { } - // Path here is the name of the selected file or directory. wxString GetPath() const { return m_path; } virtual void SetPath(const wxString &str) { m_path=str; } - // Set the directory to open the file browse dialog at initially. - virtual void SetInitialDirectory(const wxString& dir) = 0; - // returns the picker widget cast to wxControl virtual wxControl *AsControl() = 0; @@ -113,14 +65,12 @@ protected: #define wxFLP_OVERWRITE_PROMPT 0x1000 #define wxFLP_FILE_MUST_EXIST 0x2000 #define wxFLP_CHANGE_DIR 0x4000 -#define wxFLP_SMALL wxPB_SMALL // NOTE: wxMULTIPLE is not supported ! #define wxDIRP_DIR_MUST_EXIST 0x0008 #define wxDIRP_CHANGE_DIR 0x0010 -#define wxDIRP_SMALL wxPB_SMALL // map platform-dependent controls which implement the wxFileDirPickerWidgetBase @@ -169,12 +119,6 @@ public: // public API wxString GetPath() const; void SetPath(const wxString &str); - // Set the directory to open the file browse dialog at initially. - void SetInitialDirectory(const wxString& dir) - { - m_pickerIface->SetInitialDirectory(dir); - } - public: // internal functions void UpdatePickerFromTextCtrl(); @@ -194,8 +138,6 @@ public: // internal functions // Returns the event type sent by this picker virtual wxEventType GetEventType() const = 0; - virtual void DoConnect( wxControl *sender, wxFileDirPickerCtrlBase *eventSink ) = 0; - // Returns the filtered value currently placed in the text control (if present). virtual wxString GetTextCtrlValue() const = 0; @@ -265,13 +207,14 @@ public: const wxSize& size = wxDefaultSize, long style = wxFLP_DEFAULT_STYLE, const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxFilePickerCtrlNameStr); + const wxString& name = wxFilePickerCtrlNameStr) + { + return wxFileDirPickerCtrlBase::CreateBase(parent, id, path, + message, wildcard, + pos, size, style, + validator, name); + } - void SetFileName(const wxFileName &filename) - { SetPath(filename.GetFullPath()); } - - wxFileName GetFileName() const - { return wxFileName(GetPath()); } public: // overrides @@ -287,23 +230,14 @@ public: // overrides wxEventType GetEventType() const { return wxEVT_COMMAND_FILEPICKER_CHANGED; } - virtual void DoConnect( wxControl *sender, wxFileDirPickerCtrlBase *eventSink ) - { - sender->Connect( wxEVT_COMMAND_FILEPICKER_CHANGED, - wxFileDirPickerEventHandler( wxFileDirPickerCtrlBase::OnFileDirChange ), - NULL, eventSink ); - } - - protected: - virtual wxFileDirPickerWidgetBase *CreatePicker(wxWindow *parent, const wxString& path, const wxString& message, const wxString& wildcard) { return new wxFilePickerWidget(parent, wxID_ANY, - wxGetTranslation(wxFilePickerWidgetLabel), + wxFilePickerWidgetLabel, path, message, wildcard, wxDefaultPosition, wxDefaultSize, GetPickerStyle(GetWindowStyle())); @@ -312,13 +246,8 @@ protected: // extracts the style for our picker from wxFileDirPickerCtrlBase's style long GetPickerStyle(long style) const { - return style & (wxFLP_OPEN | - wxFLP_SAVE | - wxFLP_OVERWRITE_PROMPT | - wxFLP_FILE_MUST_EXIST | - wxFLP_CHANGE_DIR | - wxFLP_USE_TEXTCTRL | - wxFLP_SMALL); + return (style & (wxFLP_OPEN|wxFLP_SAVE|wxFLP_OVERWRITE_PROMPT| + wxFLP_FILE_MUST_EXIST|wxFLP_CHANGE_DIR)); } private: @@ -369,13 +298,15 @@ public: const wxSize& size = wxDefaultSize, long style = wxDIRP_DEFAULT_STYLE, const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxDirPickerCtrlNameStr); + const wxString& name = wxDirPickerCtrlNameStr) + { + return wxFileDirPickerCtrlBase::CreateBase + ( + parent, id, path, message, wxEmptyString, + pos, size, style, validator, name + ); + } - void SetDirName(const wxFileName &dirname) - { SetPath(dirname.GetPath()); } - - wxFileName GetDirName() const - { return wxFileName::DirName(GetPath()); } public: // overrides @@ -389,23 +320,13 @@ public: // overrides wxEventType GetEventType() const { return wxEVT_COMMAND_DIRPICKER_CHANGED; } - virtual void DoConnect( wxControl *sender, wxFileDirPickerCtrlBase *eventSink ) - { - sender->Connect( wxEVT_COMMAND_DIRPICKER_CHANGED, - wxFileDirPickerEventHandler( wxFileDirPickerCtrlBase::OnFileDirChange ), - NULL, eventSink ); - } - - protected: - virtual wxFileDirPickerWidgetBase *CreatePicker(wxWindow *parent, const wxString& path, const wxString& message, const wxString& WXUNUSED(wildcard)) { - return new wxDirPickerWidget(parent, wxID_ANY, - wxGetTranslation(wxDirPickerWidgetLabel), + return new wxDirPickerWidget(parent, wxID_ANY, wxDirPickerWidgetLabel, path, message, wxDefaultPosition, wxDefaultSize, GetPickerStyle(GetWindowStyle())); @@ -413,12 +334,7 @@ protected: // extracts the style for our picker from wxFileDirPickerCtrlBase's style long GetPickerStyle(long style) const - { - return style & (wxDIRP_DIR_MUST_EXIST | - wxDIRP_CHANGE_DIR | - wxDIRP_USE_TEXTCTRL | - wxDIRP_SMALL); - } + { return (style & (wxDIRP_DIR_MUST_EXIST|wxDIRP_CHANGE_DIR)); } private: DECLARE_DYNAMIC_CLASS(wxDirPickerCtrl) @@ -426,5 +342,57 @@ private: #endif // wxUSE_DIRPICKERCTRL + +#if wxUSE_FILEPICKERCTRL || wxUSE_DIRPICKERCTRL + +// ---------------------------------------------------------------------------- +// wxFileDirPickerEvent: used by wxFilePickerCtrl and wxDirPickerCtrl only +// ---------------------------------------------------------------------------- + +BEGIN_DECLARE_EVENT_TYPES() + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_CORE, wxEVT_COMMAND_FILEPICKER_CHANGED, 1102) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_CORE, wxEVT_COMMAND_DIRPICKER_CHANGED, 1103) +END_DECLARE_EVENT_TYPES() + +class WXDLLIMPEXP_CORE wxFileDirPickerEvent : public wxCommandEvent +{ +public: + wxFileDirPickerEvent() {} + wxFileDirPickerEvent(wxEventType type, wxObject *generator, int id, const wxString &path) + : wxCommandEvent(type, id), + m_path(path) + { + SetEventObject(generator); + } + + wxString GetPath() const { return m_path; } + void SetPath(const wxString &p) { m_path = p; } + + // default copy ctor, assignment operator and dtor are ok + virtual wxEvent *Clone() const { return new wxFileDirPickerEvent(*this); } + +private: + wxString m_path; + + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxFileDirPickerEvent) +}; + +// ---------------------------------------------------------------------------- +// event types and macros +// ---------------------------------------------------------------------------- + +typedef void (wxEvtHandler::*wxFileDirPickerEventFunction)(wxFileDirPickerEvent&); + +#define wxFileDirPickerEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxFileDirPickerEventFunction, &func) + +#define EVT_FILEPICKER_CHANGED(id, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_FILEPICKER_CHANGED, id, wxFileDirPickerEventHandler(fn)) +#define EVT_DIRPICKER_CHANGED(id, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_DIRPICKER_CHANGED, id, wxFileDirPickerEventHandler(fn)) + + +#endif // wxUSE_FILEPICKERCTRL || wxUSE_DIRPICKERCTRL + #endif // _WX_FILEDIRPICKER_H_BASE_ diff --git a/Source/3rd Party/wx/include/wx/filesys.h b/Source/3rd Party/wx/include/wx/filesys.h index 26fdaf44d..3d40f1104 100644 --- a/Source/3rd Party/wx/include/wx/filesys.h +++ b/Source/3rd Party/wx/include/wx/filesys.h @@ -3,7 +3,7 @@ // Purpose: class for opening files - virtual file system // Author: Vaclav Slavik // Copyright: (c) 1999 Vaclav Slavik -// RCS-ID: $Id$ +// RCS-ID: $Id: filesys.h 53135 2008-04-12 02:31:04Z VZ $ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -12,8 +12,6 @@ #include "wx/defs.h" -#if wxUSE_FILESYSTEM - #if !wxUSE_STREAMS #error You cannot compile virtual file systems without wxUSE_STREAMS #endif @@ -22,6 +20,8 @@ #error You cannot compile wxHTML without virtual file systems #endif +#if wxUSE_FILESYSTEM + #include "wx/stream.h" #include "wx/datetime.h" #include "wx/filename.h" @@ -50,7 +50,7 @@ public: { m_Stream = stream; m_Location = loc; - m_MimeType = mimetype.Lower(); + m_MimeType = mimetype; m_MimeType.MakeLower(); m_Anchor = anchor; #if wxUSE_DATETIME m_Modif = modif; @@ -78,7 +78,7 @@ public: } // returns file's mime type - const wxString& GetMimeType() const; + const wxString& GetMimeType() const { return m_MimeType; } // returns the original location (aka filename) of the file const wxString& GetLocation() const { return m_Location; } @@ -99,7 +99,7 @@ private: #endif // wxUSE_DATETIME DECLARE_ABSTRACT_CLASS(wxFSFile) - wxDECLARE_NO_COPY_CLASS(wxFSFile); + DECLARE_NO_COPY_CLASS(wxFSFile) }; @@ -132,28 +132,28 @@ public: virtual wxString FindFirst(const wxString& spec, int flags = 0); virtual wxString FindNext(); - // Returns MIME type of the file - w/o need to open it - // (default behaviour is that it returns type based on extension) - static wxString GetMimeTypeFromExt(const wxString& location); - protected: // returns protocol ("file", "http", "tar" etc.) The last (most right) // protocol is used: // {it returns "tar" for "file:subdir/archive.tar.gz#tar:/README.txt"} - static wxString GetProtocol(const wxString& location); + wxString GetProtocol(const wxString& location) const; // returns left part of address: // {it returns "file:subdir/archive.tar.gz" for "file:subdir/archive.tar.gz#tar:/README.txt"} - static wxString GetLeftLocation(const wxString& location); + wxString GetLeftLocation(const wxString& location) const; // returns anchor part of address: // {it returns "anchor" for "file:subdir/archive.tar.gz#tar:/README.txt#anchor"} // NOTE: anchor is NOT a part of GetLeftLocation()'s return value - static wxString GetAnchor(const wxString& location); + wxString GetAnchor(const wxString& location) const; // returns right part of address: // {it returns "/README.txt" for "file:subdir/archive.tar.gz#tar:/README.txt"} - static wxString GetRightLocation(const wxString& location); + wxString GetRightLocation(const wxString& location) const; + + // Returns MIME type of the file - w/o need to open it + // (default behaviour is that it returns type based on extension) + wxString GetMimeTypeFromExt(const wxString& location); DECLARE_ABSTRACT_CLASS(wxFileSystemHandler) }; @@ -168,8 +168,7 @@ protected: //-------------------------------------------------------------------------------- // Open Bit Flags -enum wxFileSystemOpenFlags -{ +enum { wxFS_READ = 1, // Open for reading wxFS_SEEKABLE = 4 // Returned stream will be seekable }; @@ -206,8 +205,7 @@ public: wxString FindNext(); // find a file in a list of directories, returns false if not found - bool FindFileInPath(wxString *pStr, - const wxString& path, const wxString& file); + bool FindFileInPath(wxString *pStr, const wxChar *path, const wxChar *file); // Adds FS handler. // In fact, this class is only front-end to the FS handlers :-) @@ -247,7 +245,7 @@ protected: // Handlers local to this instance DECLARE_DYNAMIC_CLASS(wxFileSystem) - wxDECLARE_NO_COPY_CLASS(wxFileSystem); + DECLARE_NO_COPY_CLASS(wxFileSystem) }; @@ -293,20 +291,7 @@ protected: static wxString ms_root; }; -// Stream reading data from wxFSFile: this allows to use virtual files with any -// wx functions accepting streams. -class WXDLLIMPEXP_BASE wxFSInputStream : public wxWrapperInputStream -{ -public: - // Notice that wxFS_READ is implied in flags. - wxFSInputStream(const wxString& filename, int flags = 0); - virtual ~wxFSInputStream(); -private: - wxFSFile* m_file; - - wxDECLARE_NO_COPY_CLASS(wxFSInputStream); -}; #endif // wxUSE_FILESYSTEM diff --git a/Source/3rd Party/wx/include/wx/flags.h b/Source/3rd Party/wx/include/wx/flags.h index f0ff9fa89..803205fdf 100644 --- a/Source/3rd Party/wx/include/wx/flags.h +++ b/Source/3rd Party/wx/include/wx/flags.h @@ -4,7 +4,7 @@ // Author: Stefan Csomor // Modified by: // Created: 27/07/03 -// RCS-ID: $Id$ +// RCS-ID: $Id: flags.h 35650 2005-09-23 12:56:45Z MR $ // Copyright: (c) 2003 Stefan Csomor // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -153,10 +153,8 @@ private : unsigned long m_data; }; -#if wxUSE_EXTENDED_RTTI - -#define wxDEFINE_FLAGS( flags ) \ - class WXDLLIMPEXP_BASE flags \ +#define WX_DEFINE_FLAGS( flags ) \ + class WXDLLEXPORT flags \ {\ public : \ flags(long data=0) :m_data(data) {} \ @@ -164,14 +162,4 @@ private : bool operator ==(const flags &rhs) const { return m_data == rhs.m_data; }\ } ; -#else - -#define wxDEFINE_FLAGS( flags ) - -#endif - -#if WXWIN_COMPATIBILITY_2_8 - #define WX_DEFINE_FLAGS wxDEFINE_FLAGS -#endif - #endif diff --git a/Source/3rd Party/wx/include/wx/fmappriv.h b/Source/3rd Party/wx/include/wx/fmappriv.h index ced61d9a0..95df28c90 100644 --- a/Source/3rd Party/wx/include/wx/fmappriv.h +++ b/Source/3rd Party/wx/include/wx/fmappriv.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 21.06.2003 (extracted from common/fontmap.cpp) -// RCS-ID: $Id$ +// RCS-ID: $Id: fmappriv.h 27454 2004-05-26 10:49:43Z JS $ // Copyright: (c) 1999-2003 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -65,7 +65,7 @@ private: bool m_ok; - wxDECLARE_NO_COPY_CLASS(wxFontMapperPathChanger); + DECLARE_NO_COPY_CLASS(wxFontMapperPathChanger) }; #endif // wxUSE_CONFIG diff --git a/Source/3rd Party/wx/include/wx/font.h b/Source/3rd Party/wx/include/wx/font.h index 4f0effee7..751262626 100644 --- a/Source/3rd Party/wx/include/wx/font.h +++ b/Source/3rd Party/wx/include/wx/font.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 20.09.99 -// RCS-ID: $Id$ +// RCS-ID: $Id: font.h 53135 2008-04-12 02:31:04Z VZ $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -19,13 +19,15 @@ #include "wx/defs.h" // for wxDEFAULT &c #include "wx/fontenc.h" // the font encoding constants #include "wx/gdiobj.h" // the base class -#include "wx/gdicmn.h" // for wxGDIObjListBase // ---------------------------------------------------------------------------- // forward declarations // ---------------------------------------------------------------------------- +class WXDLLIMPEXP_FWD_CORE wxFontData; +class WXDLLIMPEXP_FWD_CORE wxFontBase; class WXDLLIMPEXP_FWD_CORE wxFont; +class WXDLLIMPEXP_FWD_CORE wxSize; // ---------------------------------------------------------------------------- // font constants @@ -66,20 +68,8 @@ enum wxFontWeight wxFONTWEIGHT_MAX }; -// Symbolic font sizes as defined in CSS specification. -enum wxFontSymbolicSize -{ - wxFONTSIZE_XX_SMALL = -3, - wxFONTSIZE_X_SMALL, - wxFONTSIZE_SMALL, - wxFONTSIZE_MEDIUM, - wxFONTSIZE_LARGE, - wxFONTSIZE_X_LARGE, - wxFONTSIZE_XX_LARGE -}; - // the font flag bits for the new font ctor accepting one combined flags word -enum wxFontFlag +enum { // no special flags: font with default weight/slant/anti-aliasing wxFONTFLAG_DEFAULT = 0, @@ -117,36 +107,12 @@ enum wxFontFlag class WXDLLIMPEXP_FWD_CORE wxNativeFontInfo; -class WXDLLIMPEXP_CORE wxFontBase : public wxGDIObject +class WXDLLEXPORT wxFontBase : public wxGDIObject { public: - /* - derived classes should provide the following ctors: - - wxFont(); - wxFont(const wxString& nativeFontInfoString); - wxFont(const wxNativeFontInfo& info); - wxFont(int size, - wxFontFamily family, - wxFontStyle style, - wxFontWeight weight, - bool underlined = false, - const wxString& face = wxEmptyString, - wxFontEncoding encoding = wxFONTENCODING_DEFAULT); - wxFont(const wxSize& pixelSize, - wxFontFamily family, - wxFontStyle style, - wxFontWeight weight, - bool underlined = false, - const wxString& face = wxEmptyString, - wxFontEncoding encoding = wxFONTENCODING_DEFAULT); - */ - // creator function virtual ~wxFontBase(); - -#if FUTURE_WXWIN_COMPATIBILITY_3_0 // from the font components static wxFont *New( int pointSize, // size of the font in points @@ -155,41 +121,6 @@ public: int weight, // see wxFontWeight enum bool underlined = false, // not underlined by default const wxString& face = wxEmptyString, // facename - wxFontEncoding encoding = wxFONTENCODING_DEFAULT) // ISO8859-X, ... - { return New(pointSize, (wxFontFamily)family, (wxFontStyle)style, - (wxFontWeight)weight, underlined, face, encoding); } - - // from the font components - static wxFont *New( - const wxSize& pixelSize, // size of the font in pixels - int family, // see wxFontFamily enum - int style, // see wxFontStyle enum - int weight, // see wxFontWeight enum - bool underlined = false, // not underlined by default - const wxString& face = wxEmptyString, // facename - wxFontEncoding encoding = wxFONTENCODING_DEFAULT) // ISO8859-X, ... - { return New(pixelSize, (wxFontFamily)family, (wxFontStyle)style, - (wxFontWeight)weight, underlined, face, encoding); } -#endif - - // from the font components - static wxFont *New( - int pointSize, // size of the font in points - wxFontFamily family, // see wxFontFamily enum - wxFontStyle style, // see wxFontStyle enum - wxFontWeight weight, // see wxFontWeight enum - bool underlined = false, // not underlined by default - const wxString& face = wxEmptyString, // facename - wxFontEncoding encoding = wxFONTENCODING_DEFAULT); // ISO8859-X, ... - - // from the font components - static wxFont *New( - const wxSize& pixelSize, // size of the font in pixels - wxFontFamily family, // see wxFontFamily enum - wxFontStyle style, // see wxFontStyle enum - wxFontWeight weight, // see wxFontWeight enum - bool underlined = false, // not underlined by default - const wxString& face = wxEmptyString, // facename wxFontEncoding encoding = wxFONTENCODING_DEFAULT); // ISO8859-X, ... // from the font components but using the font flags instead of separate @@ -200,6 +131,15 @@ public: const wxString& face = wxEmptyString, wxFontEncoding encoding = wxFONTENCODING_DEFAULT); + // from the font components + static wxFont *New( + const wxSize& pixelSize, // size of the font in pixels + int family, // see wxFontFamily enum + int style, // see wxFontStyle enum + int weight, // see wxFontWeight enum + bool underlined = false, // not underlined by default + const wxString& face = wxEmptyString, // facename + wxFontEncoding encoding = wxFONTENCODING_DEFAULT); // ISO8859-X, ... // from the font components but using the font flags instead of separate // parameters for each flag @@ -215,19 +155,22 @@ public: // from the string representation of wxNativeFontInfo static wxFont *New(const wxString& strNativeFontDesc); + // was the font successfully created? + bool Ok() const { return IsOk(); } + bool IsOk() const { return m_refData != NULL; } + // comparison - bool operator==(const wxFont& font) const; - bool operator!=(const wxFont& font) const { return !(*this == font); } + bool operator == (const wxFont& font) const; + bool operator != (const wxFont& font) const; // accessors: get the font characteristics virtual int GetPointSize() const = 0; virtual wxSize GetPixelSize() const; virtual bool IsUsingSizeInPixels() const; - wxFontFamily GetFamily() const; - virtual wxFontStyle GetStyle() const = 0; - virtual wxFontWeight GetWeight() const = 0; + virtual int GetFamily() const = 0; + virtual int GetStyle() const = 0; + virtual int GetWeight() const = 0; virtual bool GetUnderlined() const = 0; - virtual bool GetStrikethrough() const { return false; } virtual wxString GetFaceName() const = 0; virtual wxFontEncoding GetEncoding() const = 0; virtual const wxNativeFontInfo *GetNativeFontInfo() const = 0; @@ -240,12 +183,10 @@ public: // change the font characteristics virtual void SetPointSize( int pointSize ) = 0; virtual void SetPixelSize( const wxSize& pixelSize ); - virtual void SetFamily( wxFontFamily family ) = 0; - virtual void SetStyle( wxFontStyle style ) = 0; - virtual void SetWeight( wxFontWeight weight ) = 0; - + virtual void SetFamily( int family ) = 0; + virtual void SetStyle( int style ) = 0; + virtual void SetWeight( int weight ) = 0; virtual void SetUnderlined( bool underlined ) = 0; - virtual void SetStrikethrough( bool WXUNUSED(strikethrough) ) {} virtual void SetEncoding(wxFontEncoding encoding) = 0; virtual bool SetFaceName( const wxString& faceName ); void SetNativeFontInfo(const wxNativeFontInfo& info) @@ -254,71 +195,25 @@ public: bool SetNativeFontInfo(const wxString& info); bool SetNativeFontInfoUserDesc(const wxString& info); - // Symbolic font sizes support: set the font size to "large" or "very - // small" either absolutely (i.e. compared to the default font size) or - // relatively to the given font size. - void SetSymbolicSize(wxFontSymbolicSize size); - void SetSymbolicSizeRelativeTo(wxFontSymbolicSize size, int base) - { - SetPointSize(AdjustToSymbolicSize(size, base)); - } - - // Adjust the base size in points according to symbolic size. - static int AdjustToSymbolicSize(wxFontSymbolicSize size, int base); - - // translate the fonts into human-readable string (i.e. GetStyleString() // will return "wxITALIC" for an italic font, ...) wxString GetFamilyString() const; wxString GetStyleString() const; wxString GetWeightString() const; + // Unofficial API, don't use + virtual void SetNoAntiAliasing( bool WXUNUSED(no) = true ) { } + virtual bool GetNoAntiAliasing() const { return false; } + // the default encoding is used for creating all fonts with default // encoding parameter static wxFontEncoding GetDefaultEncoding() { return ms_encodingDefault; } static void SetDefaultEncoding(wxFontEncoding encoding); - // this doesn't do anything and is kept for compatibility only -#if WXWIN_COMPATIBILITY_2_8 - wxDEPRECATED_INLINE(void SetNoAntiAliasing(bool no = true), wxUnusedVar(no);); - wxDEPRECATED_INLINE(bool GetNoAntiAliasing() const, return false;) -#endif // WXWIN_COMPATIBILITY_2_8 - protected: // the function called by both overloads of SetNativeFontInfo() virtual void DoSetNativeFontInfo(const wxNativeFontInfo& info); - // The function called by public GetFamily(): it can return - // wxFONTFAMILY_UNKNOWN unlike the public method (see comment there). - virtual wxFontFamily DoGetFamily() const = 0; - - - // Helper functions to recover wxFONTSTYLE/wxFONTWEIGHT and underlined flg - // values from flags containing a combination of wxFONTFLAG_XXX. - static wxFontStyle GetStyleFromFlags(int flags) - { - return flags & wxFONTFLAG_ITALIC - ? wxFONTSTYLE_ITALIC - : flags & wxFONTFLAG_SLANT - ? wxFONTSTYLE_SLANT - : wxFONTSTYLE_NORMAL; - } - - static wxFontWeight GetWeightFromFlags(int flags) - { - return flags & wxFONTFLAG_LIGHT - ? wxFONTWEIGHT_LIGHT - : flags & wxFONTFLAG_BOLD - ? wxFONTWEIGHT_BOLD - : wxFONTWEIGHT_NORMAL; - } - - static bool GetUnderlinedFromFlags(int flags) - { - return (flags & wxFONTFLAG_UNDERLINED) != 0; - } - - private: // the currently default encoding: by default, it's the default system // encoding, but may be changed by the application using @@ -327,52 +222,10 @@ private: static wxFontEncoding ms_encodingDefault; }; -// wxFontBase <-> wxString utilities, used by wxConfig -WXDLLIMPEXP_CORE wxString wxToString(const wxFontBase& font); -WXDLLIMPEXP_CORE bool wxFromString(const wxString& str, wxFontBase* font); - - -#if FUTURE_WXWIN_COMPATIBILITY_3_0 -#define wxDECLARE_FONT_COMPAT_SETTER \ - wxDEPRECATED_FUTURE( void SetFamily(int family) ) \ - { SetFamily((wxFontFamily)family); } \ - wxDEPRECATED_FUTURE( void SetStyle(int style) ) \ - { SetStyle((wxFontStyle)style); } \ - wxDEPRECATED_FUTURE( void SetWeight(int weight) ) \ - { SetWeight((wxFontWeight)weight); } \ - wxDEPRECATED_FUTURE( void SetFamily(wxDeprecatedGUIConstants family) ) \ - { SetFamily((wxFontFamily)family); } \ - wxDEPRECATED_FUTURE( void SetStyle(wxDeprecatedGUIConstants style) ) \ - { SetStyle((wxFontStyle)style); } \ - wxDEPRECATED_FUTURE( void SetWeight(wxDeprecatedGUIConstants weight) ) \ - { SetWeight((wxFontWeight)weight); } -#else -#define wxDECLARE_FONT_COMPAT_SETTER /*empty*/ -#endif - -// this macro must be used in all derived wxFont classes declarations -#define wxDECLARE_COMMON_FONT_METHODS() \ - wxDECLARE_FONT_COMPAT_SETTER \ - \ - /* functions for modifying font in place */ \ - wxFont& MakeBold(); \ - wxFont& MakeItalic(); \ - wxFont& MakeUnderlined(); \ - wxFont& MakeStrikethrough(); \ - wxFont& MakeLarger() { return Scale(1.2f); } \ - wxFont& MakeSmaller() { return Scale(1/1.2f); } \ - wxFont& Scale(float x); \ - /* functions for creating fonts based on this one */ \ - wxFont Bold() const; \ - wxFont Italic() const; \ - wxFont Underlined() const; \ - wxFont Strikethrough() const; \ - wxFont Larger() const { return Scaled(1.2f); } \ - wxFont Smaller() const { return Scaled(1/1.2f); } \ - wxFont Scaled(float x) const - // include the real class declaration -#if defined(__WXMSW__) +#if defined(__WXPALMOS__) + #include "wx/palmos/font.h" +#elif defined(__WXMSW__) #include "wx/msw/font.h" #elif defined(__WXMOTIF__) #include "wx/motif/font.h" @@ -382,74 +235,17 @@ WXDLLIMPEXP_CORE bool wxFromString(const wxString& str, wxFontBase* font); #include "wx/gtk1/font.h" #elif defined(__WXX11__) #include "wx/x11/font.h" +#elif defined(__WXMGL__) + #include "wx/mgl/font.h" #elif defined(__WXDFB__) #include "wx/dfb/font.h" #elif defined(__WXMAC__) - #include "wx/osx/font.h" + #include "wx/mac/font.h" #elif defined(__WXCOCOA__) #include "wx/cocoa/font.h" #elif defined(__WXPM__) #include "wx/os2/font.h" #endif -class WXDLLIMPEXP_CORE wxFontList: public wxGDIObjListBase -{ -public: - wxFont *FindOrCreateFont(int pointSize, - wxFontFamily family, - wxFontStyle style, - wxFontWeight weight, - bool underline = false, - const wxString& face = wxEmptyString, - wxFontEncoding encoding = wxFONTENCODING_DEFAULT); - -#if FUTURE_WXWIN_COMPATIBILITY_3_0 - wxFont *FindOrCreateFont(int pointSize, int family, int style, int weight, - bool underline = false, - const wxString& face = wxEmptyString, - wxFontEncoding encoding = wxFONTENCODING_DEFAULT) - { return FindOrCreateFont(pointSize, (wxFontFamily)family, (wxFontStyle)style, - (wxFontWeight)weight, underline, face, encoding); } -#endif - -#if WXWIN_COMPATIBILITY_2_6 - wxDEPRECATED( void AddFont(wxFont*) ); - wxDEPRECATED( void RemoveFont(wxFont*) ); -#endif -}; - -extern WXDLLIMPEXP_DATA_CORE(wxFontList*) wxTheFontList; - - -// provide comparison operators to allow code such as -// -// if ( font.GetStyle() == wxFONTSTYLE_SLANT ) -// -// to compile without warnings which it would otherwise provoke from some -// compilers as it compares elements of different enums -#if FUTURE_WXWIN_COMPATIBILITY_3_0 - -// Unfortunately some compilers have ambiguity issues when enum comparisons are -// overloaded so we have to disable the overloads in this case, see -// wxCOMPILER_NO_OVERLOAD_ON_ENUM definition in wx/platform.h for more details. -#ifndef wxCOMPILER_NO_OVERLOAD_ON_ENUM - -inline bool operator==(wxFontFamily s, wxDeprecatedGUIConstants t) -{ return static_cast(s) == static_cast(t); } -inline bool operator!=(wxFontFamily s, wxDeprecatedGUIConstants t) -{ return !(s == t); } -inline bool operator==(wxFontStyle s, wxDeprecatedGUIConstants t) -{ return static_cast(s) == static_cast(t); } -inline bool operator!=(wxFontStyle s, wxDeprecatedGUIConstants t) -{ return !(s == t); } -inline bool operator==(wxFontWeight s, wxDeprecatedGUIConstants t) -{ return static_cast(s) == static_cast(t); } -inline bool operator!=(wxFontWeight s, wxDeprecatedGUIConstants t) -{ return !(s == t); } - -#endif // // wxCOMPILER_NO_OVERLOAD_ON_ENUM - -#endif // FUTURE_WXWIN_COMPATIBILITY_3_0 - #endif // _WX_FONT_H_BASE_ diff --git a/Source/3rd Party/wx/include/wx/fontdata.h b/Source/3rd Party/wx/include/wx/fontdata.h deleted file mode 100644 index 4b9a16bc1..000000000 --- a/Source/3rd Party/wx/include/wx/fontdata.h +++ /dev/null @@ -1,71 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/fontdata.h -// Author: Julian Smart -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FONTDATA_H_ -#define _WX_FONTDATA_H_ - -#include "wx/font.h" -#include "wx/colour.h" -#include "wx/encinfo.h" - -class WXDLLIMPEXP_CORE wxFontData : public wxObject -{ -public: - wxFontData(); - virtual ~wxFontData(); - - wxFontData(const wxFontData& data); - wxFontData& operator=(const wxFontData& data); - - void SetAllowSymbols(bool flag) { m_allowSymbols = flag; } - bool GetAllowSymbols() const { return m_allowSymbols; } - - void SetColour(const wxColour& colour) { m_fontColour = colour; } - const wxColour& GetColour() const { return m_fontColour; } - - void SetShowHelp(bool flag) { m_showHelp = flag; } - bool GetShowHelp() const { return m_showHelp; } - - void EnableEffects(bool flag) { m_enableEffects = flag; } - bool GetEnableEffects() const { return m_enableEffects; } - - void SetInitialFont(const wxFont& font) { m_initialFont = font; } - wxFont GetInitialFont() const { return m_initialFont; } - - void SetChosenFont(const wxFont& font) { m_chosenFont = font; } - wxFont GetChosenFont() const { return m_chosenFont; } - - void SetRange(int minRange, int maxRange) { m_minSize = minRange; m_maxSize = maxRange; } - - // encoding info is split into 2 parts: the logical wxWin encoding - // (wxFontEncoding) and a structure containing the native parameters for - // it (wxNativeEncodingInfo) - wxFontEncoding GetEncoding() const { return m_encoding; } - void SetEncoding(wxFontEncoding encoding) { m_encoding = encoding; } - - wxNativeEncodingInfo& EncodingInfo() { return m_encodingInfo; } - - - // public for backwards compatibility only: don't use directly - wxColour m_fontColour; - bool m_showHelp; - bool m_allowSymbols; - bool m_enableEffects; - wxFont m_initialFont; - wxFont m_chosenFont; - int m_minSize; - int m_maxSize; - -private: - wxFontEncoding m_encoding; - wxNativeEncodingInfo m_encodingInfo; - - DECLARE_DYNAMIC_CLASS(wxFontData) -}; - -#endif // _WX_FONTDATA_H_ diff --git a/Source/3rd Party/wx/include/wx/fontdlg.h b/Source/3rd Party/wx/include/wx/fontdlg.h index f05b97fe2..f93bba49e 100644 --- a/Source/3rd Party/wx/include/wx/fontdlg.h +++ b/Source/3rd Party/wx/include/wx/fontdlg.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 12.05.02 -// RCS-ID: $Id$ +// RCS-ID: $Id: fontdlg.h 41846 2006-10-09 22:56:48Z VZ $ // Copyright: (c) 1997-2002 wxWidgets team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -17,13 +17,13 @@ #if wxUSE_FONTDLG #include "wx/dialog.h" // the base class -#include "wx/fontdata.h" +#include "wx/cmndata.h" // wxFontData // ---------------------------------------------------------------------------- // wxFontDialog interface // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxFontDialogBase : public wxDialog +class WXDLLEXPORT wxFontDialogBase : public wxDialog { public: // create the font dialog @@ -37,6 +37,8 @@ public: bool Create(wxWindow *parent, const wxFontData& data) { InitFontData(&data); return Create(parent); } + virtual ~wxFontDialogBase(); + // retrieve the font data const wxFontData& GetFontData() const { return m_fontData; } wxFontData& GetFontData() { return m_fontData; } @@ -56,7 +58,7 @@ protected: wxFontData m_fontData; - wxDECLARE_NO_COPY_CLASS(wxFontDialogBase); + DECLARE_NO_COPY_CLASS(wxFontDialogBase) }; #if WXWIN_COMPATIBILITY_2_6 @@ -72,7 +74,7 @@ inline bool wxFontDialogBase::Create(wxWindow *parent, const wxFontData *data) // platform-specific wxFontDialog implementation // ---------------------------------------------------------------------------- -#if defined( __WXOSX_MAC__ ) +#if defined( __WXMAC_OSX__ ) && ( MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2 ) //set to 1 to use native mac font and color dialogs #define USE_NATIVE_FONT_DIALOG_FOR_MACOSX 1 #else @@ -97,7 +99,7 @@ inline bool wxFontDialogBase::Create(wxWindow *parent, const wxFontData *data) #elif defined(__WXPM__) #include "wx/os2/fontdlg.h" #elif defined(__WXMAC__) - #include "wx/osx/fontdlg.h" + #include "wx/mac/fontdlg.h" #endif // ---------------------------------------------------------------------------- @@ -106,9 +108,9 @@ inline bool wxFontDialogBase::Create(wxWindow *parent, const wxFontData *data) // get the font from user and return it, returns wxNullFont if the dialog was // cancelled -WXDLLIMPEXP_CORE wxFont wxGetFontFromUser(wxWindow *parent = NULL, - const wxFont& fontInit = wxNullFont, - const wxString& caption = wxEmptyString); +wxFont WXDLLEXPORT +wxGetFontFromUser(wxWindow *parent = (wxWindow *)NULL, + const wxFont& fontInit = wxNullFont, const wxString& caption = wxEmptyString); #endif // wxUSE_FONTDLG diff --git a/Source/3rd Party/wx/include/wx/fontenc.h b/Source/3rd Party/wx/include/wx/fontenc.h index 76f47af15..b80acafff 100644 --- a/Source/3rd Party/wx/include/wx/fontenc.h +++ b/Source/3rd Party/wx/include/wx/fontenc.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 29.03.00 -// RCS-ID: $Id$ +// RCS-ID: $Id: fontenc.h 29139 2004-09-14 12:08:28Z ABX $ // Copyright: (c) Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -55,7 +55,7 @@ enum wxFontEncoding wxFONTENCODING_CP874, // WinThai wxFONTENCODING_CP932, // Japanese (shift-JIS) wxFONTENCODING_CP936, // Chinese simplified (GB) - wxFONTENCODING_CP949, // Korean (Hangul charset, a.k.a. EUC-KR) + wxFONTENCODING_CP949, // Korean (Hangul charset) wxFONTENCODING_CP950, // Chinese (traditional - Big5) wxFONTENCODING_CP1250, // WinLatin2 wxFONTENCODING_CP1251, // WinCyrillic @@ -65,8 +65,6 @@ enum wxFontEncoding wxFONTENCODING_CP1255, // WinHebrew wxFONTENCODING_CP1256, // WinArabic wxFONTENCODING_CP1257, // WinBaltic (same as Latin 7) - wxFONTENCODING_CP1258, // WinVietnamese - wxFONTENCODING_CP1361, // Johab Korean character set. wxFONTENCODING_CP12_MAX, wxFONTENCODING_UTF7, // UTF-7 Unicode encoding @@ -118,10 +116,6 @@ enum wxFontEncoding wxFONTENCODING_MACGAELIC, wxFONTENCODING_MACKEYBOARD, - // more CJK encodings (for historical reasons some are already declared - // above) - wxFONTENCODING_ISO2022_JP, // ISO-2022-JP JIS encoding - wxFONTENCODING_MAX, // highest enumerated encoding value wxFONTENCODING_MACMIN = wxFONTENCODING_MACROMAN , @@ -150,14 +144,7 @@ enum wxFontEncoding wxFONTENCODING_BIG5 = wxFONTENCODING_CP950, // Traditional Chinese // Japanese (see http://zsigri.tripod.com/fontboard/cjk/jis.html) - wxFONTENCODING_SHIFT_JIS = wxFONTENCODING_CP932, // Shift JIS - - // Korean (CP 949 not actually the same but close enough) - wxFONTENCODING_EUC_KR = wxFONTENCODING_CP949, - wxFONTENCODING_JOHAB = wxFONTENCODING_CP1361, - - // Vietnamese - wxFONTENCODING_VIETNAMESE = wxFONTENCODING_CP1258 + wxFONTENCODING_SHIFT_JIS = wxFONTENCODING_CP932 // Shift JIS }; #endif // _WX_FONTENC_H_ diff --git a/Source/3rd Party/wx/include/wx/fontenum.h b/Source/3rd Party/wx/include/wx/fontenum.h index 6faf25f16..8ea5a23c9 100644 --- a/Source/3rd Party/wx/include/wx/fontenum.h +++ b/Source/3rd Party/wx/include/wx/fontenum.h @@ -5,7 +5,7 @@ // Modified by: extended to enumerate more than just font facenames and works // not only on Windows now (VZ) // Created: 04/01/98 -// RCS-ID: $Id$ +// RCS-ID: $Id: fontenum.h 43727 2006-12-01 10:14:28Z VS $ // Copyright: (c) Julian Smart, Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -13,19 +13,20 @@ #ifndef _WX_FONTENUM_H_ #define _WX_FONTENUM_H_ -#include "wx/defs.h" - -#if wxUSE_FONTENUM - #include "wx/fontenc.h" #include "wx/arrstr.h" +#if wxUSE_PANGO || defined(__WXDFB__) + // defined if the port uses only UTF-8 font encodings internally + #define wxHAS_UTF8_FONTS +#endif + // ---------------------------------------------------------------------------- // wxFontEnumerator enumerates all available fonts on the system or only the // fonts with given attributes // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxFontEnumerator +class WXDLLEXPORT wxFontEnumerator { public: wxFontEnumerator() {} @@ -81,9 +82,7 @@ private: bool EnumerateEncodingsUTF8(const wxString& facename); #endif - wxDECLARE_NO_COPY_CLASS(wxFontEnumerator); + DECLARE_NO_COPY_CLASS(wxFontEnumerator) }; -#endif // wxUSE_FONTENUM - #endif // _WX_FONTENUM_H_ diff --git a/Source/3rd Party/wx/include/wx/fontmap.h b/Source/3rd Party/wx/include/wx/fontmap.h index eaa5ebecd..c30511328 100644 --- a/Source/3rd Party/wx/include/wx/fontmap.h +++ b/Source/3rd Party/wx/include/wx/fontmap.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 04.11.99 -// RCS-ID: $Id$ +// RCS-ID: $Id: fontmap.h 49563 2007-10-31 20:46:21Z VZ $ // Copyright: (c) Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -50,7 +50,7 @@ class WXDLLIMPEXP_FWD_CORE wxFontMapper; class WXDLLIMPEXP_BASE wxFontMapperBase { public: - // constructor and such + // constructtor and such // --------------------- // default ctor @@ -122,7 +122,7 @@ public: void SetConfigPath(const wxString& prefix); // return default config path - static const wxString& GetDefaultConfigPath(); + static const wxChar *GetDefaultConfigPath(); #endif // wxUSE_CONFIG @@ -170,7 +170,7 @@ private: friend class wxFontMapperPathChanger; - wxDECLARE_NO_COPY_CLASS(wxFontMapperBase); + DECLARE_NO_COPY_CLASS(wxFontMapperBase) }; // ---------------------------------------------------------------------------- @@ -264,7 +264,7 @@ protected: wxWindow *m_windowParent; private: - wxDECLARE_NO_COPY_CLASS(wxFontMapper); + DECLARE_NO_COPY_CLASS(wxFontMapper) }; #endif // wxUSE_GUI diff --git a/Source/3rd Party/wx/include/wx/fontpicker.h b/Source/3rd Party/wx/include/wx/fontpicker.h index 2a0c33b3f..d13d0b22f 100644 --- a/Source/3rd Party/wx/include/wx/fontpicker.h +++ b/Source/3rd Party/wx/include/wx/fontpicker.h @@ -5,7 +5,7 @@ // Modified by: // Created: 14/4/2006 // Copyright: (c) Francesco Montorsi -// RCS-ID: $Id$ +// RCS-ID: $Id: fontpicker.h 53135 2008-04-12 02:31:04Z VZ $ // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// @@ -22,8 +22,8 @@ class WXDLLIMPEXP_FWD_CORE wxFontPickerEvent; -extern WXDLLIMPEXP_DATA_CORE(const char) wxFontPickerWidgetNameStr[]; -extern WXDLLIMPEXP_DATA_CORE(const char) wxFontPickerCtrlNameStr[]; +extern WXDLLEXPORT_DATA(const wxChar) wxFontPickerWidgetNameStr[]; +extern WXDLLEXPORT_DATA(const wxChar) wxFontPickerCtrlNameStr[]; // ---------------------------------------------------------------------------- @@ -66,11 +66,8 @@ protected: // uses the currently selected font to draw the label of the button #define wxFNTP_USEFONT_FOR_LABEL 0x0010 -#define wxFONTBTN_DEFAULT_STYLE \ - (wxFNTP_FONTDESC_AS_LABEL | wxFNTP_USEFONT_FOR_LABEL) - -// native version currently only exists in wxGTK2 -#if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__) +// since GTK > 2.4, there is GtkFontButton +#if defined(__WXGTK24__) && !defined(__WXUNIVERSAL__) #include "wx/gtk/fontpicker.h" #define wxFontPickerWidget wxFontButton #else @@ -180,7 +177,9 @@ private: // wxFontPickerEvent: used by wxFontPickerCtrl only // ---------------------------------------------------------------------------- -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_FONTPICKER_CHANGED, wxFontPickerEvent ); +BEGIN_DECLARE_EVENT_TYPES() + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_CORE, wxEVT_COMMAND_FONTPICKER_CHANGED, 1102) +END_DECLARE_EVENT_TYPES() class WXDLLIMPEXP_CORE wxFontPickerEvent : public wxCommandEvent { @@ -212,7 +211,7 @@ private: typedef void (wxEvtHandler::*wxFontPickerEventFunction)(wxFontPickerEvent&); #define wxFontPickerEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxFontPickerEventFunction, func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxFontPickerEventFunction, &func) #define EVT_FONTPICKER_CHANGED(id, fn) \ wx__DECLARE_EVT1(wxEVT_COMMAND_FONTPICKER_CHANGED, id, wxFontPickerEventHandler(fn)) diff --git a/Source/3rd Party/wx/include/wx/fontutil.h b/Source/3rd Party/wx/include/wx/fontutil.h index 0a4546a56..c0c46e458 100644 --- a/Source/3rd Party/wx/include/wx/fontutil.h +++ b/Source/3rd Party/wx/include/wx/fontutil.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 05.11.99 -// RCS-ID: $Id$ +// RCS-ID: $Id: fontutil.h 49563 2007-10-31 20:46:21Z VZ $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -65,8 +65,7 @@ enum wxXLFDField // functions, the user code can only get the objects of this type from // somewhere and pass it somewhere else (possibly save them somewhere using // ToString() and restore them using FromString()) - -class WXDLLIMPEXP_CORE wxNativeFontInfo +class WXDLLEXPORT wxNativeFontInfo { public: #if wxUSE_PANGO @@ -106,76 +105,12 @@ public: // set the XFLD void SetXFontName(const wxString& xFontName); #elif defined(__WXMSW__) - wxNativeFontInfo(const LOGFONT& lf_) : lf(lf_) { } - LOGFONT lf; #elif defined(__WXPM__) // OS/2 native structures that define a font FATTRS fa; FONTMETRICS fm; FACENAMEDESC fn; -#elif defined(__WXOSX__) -public: - wxNativeFontInfo(const wxNativeFontInfo& info) { Init(info); } - wxNativeFontInfo( int size, - wxFontFamily family, - wxFontStyle style, - wxFontWeight weight, - bool underlined, - const wxString& faceName, - wxFontEncoding encoding) - { Init(size,family,style,weight,underlined,faceName,encoding); } - - ~wxNativeFontInfo() { Free(); } - - wxNativeFontInfo& operator=(const wxNativeFontInfo& info) - { - if (this != &info) - { - Free(); - Init(info); - } - return *this; - } - -#if wxOSX_USE_CORE_TEXT - void Init(CTFontDescriptorRef descr); -#endif - void Init(const wxNativeFontInfo& info); - void Init(int size, - wxFontFamily family, - wxFontStyle style, - wxFontWeight weight, - bool underlined, - const wxString& faceName , - wxFontEncoding encoding); - - void Free(); - void EnsureValid(); - - bool m_descriptorValid; - -#if wxOSX_USE_ATSU_TEXT - bool m_atsuFontValid; - // the atsu font ID - wxUint32 m_atsuFontID; - // the qd styles that are not intrinsic to the font above - wxInt16 m_atsuAdditionalQDStyles; -#if wxOSX_USE_CARBON - wxInt16 m_qdFontFamily; - wxInt16 m_qdFontStyle; -#endif -#endif - - int m_pointSize; - wxFontFamily m_family; - wxFontStyle m_style; - wxFontWeight m_weight; - bool m_underlined; - bool m_strikethrough; - wxString m_faceName; - wxFontEncoding m_encoding; -public : #else // other platforms // // This is a generic implementation that should work on all ports @@ -188,7 +123,6 @@ public : wxFontStyle style; wxFontWeight weight; bool underlined; - bool strikethrough; wxString faceName; wxFontEncoding encoding; #endif // platforms @@ -207,11 +141,8 @@ public: wxNativeFontInfo& operator=(const wxNativeFontInfo& info) { - if (this != &info) - { - Free(); - Init(info); - } + Free(); + Init(info); return *this; } #endif // wxUSE_PANGO @@ -226,7 +157,6 @@ public: SetStyle((wxFontStyle)font.GetStyle()); SetWeight((wxFontWeight)font.GetWeight()); SetUnderlined(font.GetUnderlined()); - SetStrikethrough(font.GetStrikethrough()); #if defined(__WXMSW__) if ( font.IsUsingSizeInPixels() ) SetPixelSize(font.GetPixelSize()); @@ -255,7 +185,6 @@ public: wxFontStyle GetStyle() const; wxFontWeight GetWeight() const; bool GetUnderlined() const; - bool GetStrikethrough() const; wxString GetFaceName() const; wxFontFamily GetFamily() const; wxFontEncoding GetEncoding() const; @@ -265,7 +194,6 @@ public: void SetStyle(wxFontStyle style); void SetWeight(wxFontWeight weight); void SetUnderlined(bool underlined); - void SetStrikethrough(bool strikethrough); bool SetFaceName(const wxString& facename); void SetFamily(wxFontFamily family); void SetEncoding(wxFontEncoding encoding); @@ -296,12 +224,12 @@ public: // translate a wxFontEncoding into native encoding parameter (defined above), // returning true if an (exact) macth could be found, false otherwise (without // attempting any substitutions) -WXDLLIMPEXP_CORE bool wxGetNativeFontEncoding(wxFontEncoding encoding, - wxNativeEncodingInfo *info); +extern bool wxGetNativeFontEncoding(wxFontEncoding encoding, + wxNativeEncodingInfo *info); // test for the existence of the font described by this facename/encoding, // return true if such font(s) exist, false otherwise -WXDLLIMPEXP_CORE bool wxTestFontEncoding(const wxNativeEncodingInfo& info); +extern bool wxTestFontEncoding(const wxNativeEncodingInfo& info); // ---------------------------------------------------------------------------- // font-related functions (X and GTK) diff --git a/Source/3rd Party/wx/include/wx/frame.h b/Source/3rd Party/wx/include/wx/frame.h index b3b7d8290..a1a8036fc 100644 --- a/Source/3rd Party/wx/include/wx/frame.h +++ b/Source/3rd Party/wx/include/wx/frame.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 15.11.99 -// RCS-ID: $Id$ +// RCS-ID: $Id: frame.h 49804 2007-11-10 01:09:42Z VZ $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -17,15 +17,13 @@ // ---------------------------------------------------------------------------- #include "wx/toplevel.h" // the base class -#include "wx/statusbr.h" // the default names for various classs -extern WXDLLIMPEXP_DATA_CORE(const char) wxStatusLineNameStr[]; -extern WXDLLIMPEXP_DATA_CORE(const char) wxToolBarNameStr[]; +extern WXDLLEXPORT_DATA(const wxChar) wxStatusLineNameStr[]; +extern WXDLLEXPORT_DATA(const wxChar) wxToolBarNameStr[]; class WXDLLIMPEXP_FWD_CORE wxFrame; class WXDLLIMPEXP_FWD_CORE wxMenuBar; -class WXDLLIMPEXP_FWD_CORE wxMenuItem; class WXDLLIMPEXP_FWD_CORE wxStatusBar; class WXDLLIMPEXP_FWD_CORE wxToolBar; @@ -34,11 +32,10 @@ class WXDLLIMPEXP_FWD_CORE wxToolBar; // ---------------------------------------------------------------------------- // wxFrame-specific (i.e. not for wxDialog) styles -// -// Also see the bit summary table in wx/toplevel.h. #define wxFRAME_NO_TASKBAR 0x0002 // No taskbar button (MSW only) #define wxFRAME_TOOL_WINDOW 0x0004 // No taskbar button, no system menu #define wxFRAME_FLOAT_ON_PARENT 0x0008 // Always above its parent +#define wxFRAME_SHAPED 0x0010 // Create a window that is able to be shaped // ---------------------------------------------------------------------------- // wxFrame is a top-level window with optional menubar, statusbar and toolbar @@ -52,7 +49,7 @@ class WXDLLIMPEXP_FWD_CORE wxToolBar; // CreateXXXBar() is called. // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxFrameBase : public wxTopLevelWindow +class WXDLLEXPORT wxFrameBase : public wxTopLevelWindow { public: // construction @@ -74,6 +71,9 @@ public: // if the frame has a toolbar) in client coordinates virtual wxPoint GetClientAreaOrigin() const; + // sends a size event to the window using its current size -- this has an + // effect of refreshing the window layout + virtual void SendSizeEvent(); // menu bar functions // ------------------ @@ -81,33 +81,20 @@ public: #if wxUSE_MENUS virtual void SetMenuBar(wxMenuBar *menubar); virtual wxMenuBar *GetMenuBar() const { return m_frameMenuBar; } - - // find the item by id in the frame menu bar: this is an internal function - // and exists mainly in order to be overridden in the MDI parent frame - // which also looks at its active child menu bar - virtual wxMenuItem *FindItemInMenuBar(int menuId) const; - - // generate menu command corresponding to the given menu item - // - // returns true if processed - bool ProcessCommand(wxMenuItem *item); - - // generate menu command corresponding to the given menu command id - // - // returns true if processed - bool ProcessCommand(int winid); -#else - bool ProcessCommand(int WXUNUSED(winid)) { return false; } #endif // wxUSE_MENUS + // process menu command: returns true if processed + bool ProcessCommand(int winid); + // status bar functions // -------------------- #if wxUSE_STATUSBAR // create the main status bar by calling OnCreateStatusBar() virtual wxStatusBar* CreateStatusBar(int number = 1, - long style = wxSTB_DEFAULT_STYLE, + long style = wxST_SIZEGRIP|wxFULL_REPAINT_ON_RESIZE, wxWindowID winid = 0, - const wxString& name = wxStatusLineNameStr); + const wxString& name = + wxStatusLineNameStr); // return a new status bar virtual wxStatusBar *OnCreateStatusBar(int number, long style, @@ -170,18 +157,23 @@ public: // Implement internal behaviour (menu updating on some platforms) virtual void OnInternalIdle(); + // if there is no real wxTopLevelWindow on this platform we have to define + // some wxTopLevelWindowBase pure virtual functions here to avoid breaking + // old ports (wxMotif) which don't define them in wxFrame +#ifndef wxTopLevelWindowNative + virtual bool ShowFullScreen(bool WXUNUSED(show), + long WXUNUSED(style) = wxFULLSCREEN_ALL) + { return false; } + virtual bool IsFullScreen() const + { return false; } +#endif // no wxTopLevelWindowNative + #if wxUSE_MENUS || wxUSE_TOOLBAR - // show help text for the currently selected menu or toolbar item - // (typically in the status bar) or hide it and restore the status bar text - // originally shown before the menu was opened if show == false + // show help text (typically in the statusbar); show is false + // if you are hiding the help, true otherwise virtual void DoGiveHelp(const wxString& text, bool show); #endif - virtual bool IsClientAreaChild(const wxWindow *child) const - { - return !IsOneOfBars(child) && wxTopLevelWindow::IsClientAreaChild(child); - } - protected: // the frame main menu/status/tool bars // ------------------------------------ @@ -211,9 +203,6 @@ protected: #if wxUSE_STATUSBAR && (wxUSE_MENUS || wxUSE_TOOLBAR) // the saved status bar text overwritten by DoGiveHelp() wxString m_oldStatusText; - - // the last help string we have shown in the status bar - wxString m_lastHelpShown; #endif #if wxUSE_STATUSBAR @@ -221,10 +210,9 @@ protected: // something changes virtual void PositionStatusBar() { } - // show the help string for the given menu item using DoGiveHelp() if the - // given item does have a help string (as determined by FindInMenuBar()), - // return false if there is no help for such item - bool ShowMenuHelp(int helpid); + // show the help string for this menu item in the given status bar: the + // status bar pointer can be NULL; return true if help was shown + bool ShowMenuHelp(wxStatusBar *statbar, int helpid); wxStatusBar *m_frameStatusBar; #endif // wxUSE_STATUSBAR @@ -244,14 +232,16 @@ protected: DECLARE_EVENT_TABLE() #endif // wxUSE_MENUS && wxUSE_STATUSBAR - wxDECLARE_NO_COPY_CLASS(wxFrameBase); + DECLARE_NO_COPY_CLASS(wxFrameBase) }; // include the real class declaration #if defined(__WXUNIVERSAL__) // && !defined(__WXMICROWIN__) #include "wx/univ/frame.h" #else // !__WXUNIVERSAL__ - #if defined(__WXMSW__) + #if defined(__WXPALMOS__) + #include "wx/palmos/frame.h" + #elif defined(__WXMSW__) #include "wx/msw/frame.h" #elif defined(__WXGTK20__) #include "wx/gtk/frame.h" @@ -260,7 +250,7 @@ protected: #elif defined(__WXMOTIF__) #include "wx/motif/frame.h" #elif defined(__WXMAC__) - #include "wx/osx/frame.h" + #include "wx/mac/frame.h" #elif defined(__WXCOCOA__) #include "wx/cocoa/frame.h" #elif defined(__WXPM__) diff --git a/Source/3rd Party/wx/include/wx/fs_arc.h b/Source/3rd Party/wx/include/wx/fs_arc.h index 07ff65d30..02afd0746 100644 --- a/Source/3rd Party/wx/include/wx/fs_arc.h +++ b/Source/3rd Party/wx/include/wx/fs_arc.h @@ -3,7 +3,7 @@ // Purpose: Archive file system // Author: Vaclav Slavik, Mike Wetherell // Copyright: (c) 1999 Vaclav Slavik, (c) 2006 Mike Wetherell -// CVS-ID: $Id$ +// CVS-ID: $Id: fs_arc.h 42713 2006-10-30 11:56:12Z ABX $ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -47,7 +47,7 @@ private: wxString DoFind(); - wxDECLARE_NO_COPY_CLASS(wxArchiveFSHandler); + DECLARE_NO_COPY_CLASS(wxArchiveFSHandler) DECLARE_DYNAMIC_CLASS(wxArchiveFSHandler) }; diff --git a/Source/3rd Party/wx/include/wx/fs_filter.h b/Source/3rd Party/wx/include/wx/fs_filter.h index b42c0d67b..1eb014510 100644 --- a/Source/3rd Party/wx/include/wx/fs_filter.h +++ b/Source/3rd Party/wx/include/wx/fs_filter.h @@ -3,7 +3,7 @@ // Purpose: Filter file system handler // Author: Mike Wetherell // Copyright: (c) 2006 Mike Wetherell -// CVS-ID: $Id$ +// CVS-ID: $Id: fs_filter.h 42713 2006-10-30 11:56:12Z ABX $ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -33,7 +33,7 @@ public: virtual wxString FindNext(); private: - wxDECLARE_NO_COPY_CLASS(wxFilterFSHandler); + DECLARE_NO_COPY_CLASS(wxFilterFSHandler) }; #endif // wxUSE_FILESYSTEM diff --git a/Source/3rd Party/wx/include/wx/fs_mem.h b/Source/3rd Party/wx/include/wx/fs_mem.h index facb6c5e0..e4d6737d7 100644 --- a/Source/3rd Party/wx/include/wx/fs_mem.h +++ b/Source/3rd Party/wx/include/wx/fs_mem.h @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/fs_mem.h +// Name: fs_mem.h // Purpose: in-memory file system // Author: Vaclav Slavik // Copyright: (c) 2000 Vaclav Slavik @@ -15,13 +15,9 @@ #include "wx/filesys.h" -#include "wx/hashmap.h" - -class wxMemoryFSFile; -WX_DECLARE_STRING_HASH_MAP(wxMemoryFSFile *, wxMemoryFSHash); - #if wxUSE_GUI - #include "wx/bitmap.h" + class WXDLLIMPEXP_FWD_CORE wxBitmap; + class WXDLLIMPEXP_FWD_CORE wxImage; #endif // wxUSE_GUI // ---------------------------------------------------------------------------- @@ -39,12 +35,14 @@ public: // name "memory:" + filename static void AddFile(const wxString& filename, const wxString& textdata); static void AddFile(const wxString& filename, const void *binarydata, size_t size); +#if wxABI_VERSION >= 20805 static void AddFileWithMimeType(const wxString& filename, const wxString& textdata, const wxString& mimetype); static void AddFileWithMimeType(const wxString& filename, const void *binarydata, size_t size, const wxString& mimetype); +#endif // wxABI_VERSION >= 20805 // Remove file from memory FS and free occupied memory static void RemoveFile(const wxString& filename); @@ -55,21 +53,8 @@ public: virtual wxString FindNext(); protected: - // check that the given file is not already present in m_Hash; logs an - // error and returns false if it does exist - static bool CheckDoesntExist(const wxString& filename); - - // the hash map indexed by the names of the files stored in the memory FS - static wxMemoryFSHash m_Hash; - - // the file name currently being searched for, i.e. the argument of the - // last FindFirst() call or empty string if FindFirst() hasn't been called - // yet or FindNext() didn't find anything - wxString m_findArgument; - - // iterator into m_Hash used by FindFirst/Next(), possibly m_Hash.end() or - // even invalid (can only be used when m_findArgument is not empty) - wxMemoryFSHash::const_iterator m_findIter; + static bool CheckHash(const wxString& filename); + static wxHashTable *m_Hash; }; // ---------------------------------------------------------------------------- @@ -96,6 +81,7 @@ public: { wxMemoryFSHandlerBase::AddFile(filename, binarydata, size); } +#if wxABI_VERSION >= 20805 static void AddFileWithMimeType(const wxString& filename, const wxString& textdata, const wxString& mimetype) @@ -112,15 +98,16 @@ public: binarydata, size, mimetype); } +#endif // wxABI_VERSION >= 20805 #if wxUSE_IMAGE static void AddFile(const wxString& filename, const wxImage& image, - wxBitmapType type); + long type); static void AddFile(const wxString& filename, const wxBitmap& bitmap, - wxBitmapType type); + long type); #endif // wxUSE_IMAGE }; diff --git a/Source/3rd Party/wx/include/wx/fswatcher.h b/Source/3rd Party/wx/include/wx/fswatcher.h deleted file mode 100644 index 3a57caac9..000000000 --- a/Source/3rd Party/wx/include/wx/fswatcher.h +++ /dev/null @@ -1,354 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/fswatcher.h -// Purpose: wxFileSystemWatcherBase -// Author: Bartosz Bekier -// Created: 2009-05-23 -// RCS-ID: $Id$ -// Copyright: (c) 2009 Bartosz Bekier -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FSWATCHER_BASE_H_ -#define _WX_FSWATCHER_BASE_H_ - -#include "wx/defs.h" - -#if wxUSE_FSWATCHER - -#include "wx/log.h" -#include "wx/event.h" -#include "wx/evtloop.h" -#include "wx/filename.h" -#include "wx/dir.h" -#include "wx/hashmap.h" - -#define wxTRACE_FSWATCHER "fswatcher" - -// ---------------------------------------------------------------------------- -// wxFileSystemWatcherEventType & wxFileSystemWatcherEvent -// ---------------------------------------------------------------------------- - -/** - * Possible types of file system events. - * This is a subset that will work fine an all platforms (actually, we will - * see how it works on Mac). - * - * We got 2 types of error events: - * - warning: these are not fatal and further events can still be generated - * - error: indicates fatal error and causes that no more events will happen - */ -enum -{ - wxFSW_EVENT_CREATE = 0x01, - wxFSW_EVENT_DELETE = 0x02, - wxFSW_EVENT_RENAME = 0x04, - wxFSW_EVENT_MODIFY = 0x08, - wxFSW_EVENT_ACCESS = 0x10, - - // error events - wxFSW_EVENT_WARNING = 0x20, - wxFSW_EVENT_ERROR = 0x40, - - wxFSW_EVENT_ALL = wxFSW_EVENT_CREATE | wxFSW_EVENT_DELETE | - wxFSW_EVENT_RENAME | wxFSW_EVENT_MODIFY | - wxFSW_EVENT_ACCESS | - wxFSW_EVENT_WARNING | wxFSW_EVENT_ERROR -}; - -// Type of the path watched, used only internally for now. -enum wxFSWPathType -{ - wxFSWPath_None, // Invalid value for an initialized watch. - wxFSWPath_File, // Plain file. - wxFSWPath_Dir, // Watch a directory and the files in it. - wxFSWPath_Tree // Watch a directory and all its children recursively. -}; - - -/** - * Event containing information about file system change. - */ -class WXDLLIMPEXP_FWD_BASE wxFileSystemWatcherEvent; -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_BASE, wxEVT_FSWATCHER, - wxFileSystemWatcherEvent); - -class WXDLLIMPEXP_BASE wxFileSystemWatcherEvent: public wxEvent -{ -public: - wxFileSystemWatcherEvent(int changeType, int watchid = wxID_ANY) : - wxEvent(watchid, wxEVT_FSWATCHER), - m_changeType(changeType) - { - } - - wxFileSystemWatcherEvent(int changeType, const wxString& errorMsg, - int watchid = wxID_ANY) : - wxEvent(watchid, wxEVT_FSWATCHER), - m_changeType(changeType), m_errorMsg(errorMsg) - { - } - - wxFileSystemWatcherEvent(int changeType, - const wxFileName& path, const wxFileName& newPath, - int watchid = wxID_ANY) : - wxEvent(watchid, wxEVT_FSWATCHER), - m_changeType(changeType), m_path(path), m_newPath(newPath) - { - } - - /** - * Returns the path at which the event occurred. - */ - const wxFileName& GetPath() const - { - return m_path; - } - - /** - * Sets the path at which the event occurred - */ - void SetPath(const wxFileName& path) - { - m_path = path; - } - - /** - * In case of rename(move?) events, returns the new path related to the - * event. The "new" means newer in the sense of time. In case of other - * events it returns the same path as GetPath(). - */ - const wxFileName& GetNewPath() const - { - return m_newPath; - } - - /** - * Sets the new path related to the event. See above. - */ - void SetNewPath(const wxFileName& path) - { - m_newPath = path; - } - - /** - * Returns the type of file system event that occurred. - */ - int GetChangeType() const - { - return m_changeType; - } - - virtual wxEvent* Clone() const - { - wxFileSystemWatcherEvent* evt = new wxFileSystemWatcherEvent(*this); - evt->m_errorMsg = m_errorMsg.Clone(); - evt->m_path = wxFileName(m_path.GetFullPath().Clone()); - evt->m_newPath = wxFileName(m_newPath.GetFullPath().Clone()); - return evt; - } - - virtual wxEventCategory GetEventCategory() const - { - // TODO this has to be merged with "similiar" categories and changed - return wxEVT_CATEGORY_UNKNOWN; - } - - /** - * Returns if this error is an error event - */ - bool IsError() const - { - return (m_changeType & (wxFSW_EVENT_ERROR | wxFSW_EVENT_WARNING)) != 0; - } - - wxString GetErrorDescription() const - { - return m_errorMsg; - } - - /** - * Returns a wxString describing an event useful for debugging or testing - */ - wxString ToString() const; - -protected: - int m_changeType; - wxFileName m_path; - wxFileName m_newPath; - wxString m_errorMsg; -}; - -typedef void (wxEvtHandler::*wxFileSystemWatcherEventFunction) - (wxFileSystemWatcherEvent&); - -#define wxFileSystemWatcherEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxFileSystemWatcherEventFunction, func) - -#define EVT_FSWATCHER(winid, func) \ - wx__DECLARE_EVT1(wxEVT_FSWATCHER, winid, wxFileSystemWatcherEventHandler(func)) - -// ---------------------------------------------------------------------------- -// wxFileSystemWatcherBase: interface for wxFileSystemWatcher -// ---------------------------------------------------------------------------- - -// Simple container to store information about one watched path. -class wxFSWatchInfo -{ -public: - wxFSWatchInfo() : - m_events(-1), m_type(wxFSWPath_None) - { - } - - wxFSWatchInfo(const wxString& path, int events, wxFSWPathType type) : - m_path(path), m_events(events), m_type(type) - { - } - - const wxString& GetPath() const - { - return m_path; - } - - int GetFlags() const - { - return m_events; - } - - wxFSWPathType GetType() const - { - return m_type; - } - -protected: - wxString m_path; - int m_events; - wxFSWPathType m_type; -}; - -WX_DECLARE_STRING_HASH_MAP(wxFSWatchInfo, wxFSWatchInfoMap); - -/** - * Encapsulation of platform-specific file system event mechanism - */ -class wxFSWatcherImpl; - -/** - * Main entry point for clients interested in file system events. - * Defines interface that can be used to receive that kind of events. - */ -class WXDLLIMPEXP_BASE wxFileSystemWatcherBase: public wxEvtHandler -{ -public: - wxFileSystemWatcherBase(); - - virtual ~wxFileSystemWatcherBase(); - - /** - * Adds path to currently watched files. Any events concerning this - * particular path will be sent to handler. Optionally a filter can be - * specified to receive only events of particular type. - * - * Please note that when adding a dir, immediate children will be watched - * as well. - */ - virtual bool Add(const wxFileName& path, int events = wxFSW_EVENT_ALL); - - /** - * Like above, but recursively adds every file/dir in the tree rooted in - * path. Additionally a file mask can be specified to include only files - * of particular type. - */ - virtual bool AddTree(const wxFileName& path, int events = wxFSW_EVENT_ALL, - const wxString& filter = wxEmptyString); - - /** - * Removes path from the list of watched paths. - */ - virtual bool Remove(const wxFileName& path); - - /** - * Same as above, but also removes every file belonging to the tree rooted - * at path. - */ - virtual bool RemoveTree(const wxFileName& path); - - /** - * Clears the list of currently watched paths. - */ - virtual bool RemoveAll(); - - /** - * Returns the number of watched paths - */ - int GetWatchedPathsCount() const; - - /** - * Retrevies all watched paths and places them in wxArrayString. Returns - * the number of paths. - * - * TODO think about API here: we need to return more information (like is - * the path watched recursively) - */ - int GetWatchedPaths(wxArrayString* paths) const; - - wxEvtHandler* GetOwner() const - { - return m_owner; - } - - void SetOwner(wxEvtHandler* handler) - { - if (!handler) - m_owner = this; - else - m_owner = handler; - } - -protected: - - static wxString GetCanonicalPath(const wxFileName& path) - { - wxFileName path_copy = wxFileName(path); - if ( !path_copy.Normalize() ) - { - wxFAIL_MSG(wxString::Format("Unable to normalize path '%s'", - path.GetFullPath())); - return wxEmptyString; - } - - return path_copy.GetFullPath(); - } - - // Delegates the real work of adding the path to wxFSWatcherImpl::Add() and - // updates m_watches if the new path was successfully added. - bool DoAdd(const wxFileName& path, int events, wxFSWPathType type); - - - wxFSWatchInfoMap m_watches; // path=>wxFSWatchInfo map - wxFSWatcherImpl* m_service; // file system events service - wxEvtHandler* m_owner; // handler for file system events - - friend class wxFSWatcherImpl; -}; - -// include the platform specific file defining wxFileSystemWatcher -// inheriting from wxFileSystemWatcherBase - -#ifdef wxHAS_INOTIFY - #include "wx/unix/fswatcher_inotify.h" - #define wxFileSystemWatcher wxInotifyFileSystemWatcher -#elif defined(wxHAS_KQUEUE) - #include "wx/unix/fswatcher_kqueue.h" - #define wxFileSystemWatcher wxKqueueFileSystemWatcher -#elif defined(__WINDOWS__) - #include "wx/msw/fswatcher.h" - #define wxFileSystemWatcher wxMSWFileSystemWatcher -#else - #include "wx/generic/fswatcher.h" - #define wxFileSystemWatcher wxPollingFileSystemWatcher -#endif - -#endif // wxUSE_FSWATCHER - -#endif /* _WX_FSWATCHER_BASE_H_ */ diff --git a/Source/3rd Party/wx/include/wx/gauge.h b/Source/3rd Party/wx/include/wx/gauge.h index 21acb77fc..a6246ca42 100644 --- a/Source/3rd Party/wx/include/wx/gauge.h +++ b/Source/3rd Party/wx/include/wx/gauge.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 20.02.01 -// RCS-ID: $Id$ +// RCS-ID: $Id: gauge.h 41089 2006-09-09 13:36:54Z RR $ // Copyright: (c) 1996-2001 wxWidgets team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -41,13 +41,13 @@ #define wxGAUGE_EMULATE_INDETERMINATE_MODE 0 #endif -extern WXDLLIMPEXP_DATA_CORE(const char) wxGaugeNameStr[]; +extern WXDLLEXPORT_DATA(const wxChar) wxGaugeNameStr[]; // ---------------------------------------------------------------------------- // wxGauge: a progress bar // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxGaugeBase : public wxControl +class WXDLLEXPORT wxGaugeBase : public wxControl { public: wxGaugeBase() { m_rangeMax = m_gaugePos = 0; } @@ -84,12 +84,10 @@ public: virtual void SetBezelFace(int w); virtual int GetBezelFace() const; - // overridden base class virtuals + // overriden base class virtuals virtual bool AcceptsFocus() const { return false; } protected: - virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } - // the max position int m_rangeMax; @@ -100,13 +98,14 @@ protected: int m_nDirection; // can be wxRIGHT or wxLEFT #endif - wxDECLARE_NO_COPY_CLASS(wxGaugeBase); + DECLARE_NO_COPY_CLASS(wxGaugeBase) }; #if defined(__WXUNIVERSAL__) #include "wx/univ/gauge.h" #elif defined(__WXMSW__) - #include "wx/msw/gauge.h" + #include "wx/msw/gauge95.h" + #define wxGauge wxGauge95 #elif defined(__WXMOTIF__) #include "wx/motif/gauge.h" #elif defined(__WXGTK20__) @@ -114,7 +113,7 @@ protected: #elif defined(__WXGTK__) #include "wx/gtk1/gauge.h" #elif defined(__WXMAC__) - #include "wx/osx/gauge.h" + #include "wx/mac/gauge.h" #elif defined(__WXCOCOA__) #include "wx/cocoa/gauge.h" #elif defined(__WXPM__) diff --git a/Source/3rd Party/wx/include/wx/gbsizer.h b/Source/3rd Party/wx/include/wx/gbsizer.h index d9fc7e33d..dd2f31bec 100644 --- a/Source/3rd Party/wx/include/wx/gbsizer.h +++ b/Source/3rd Party/wx/include/wx/gbsizer.h @@ -1,12 +1,12 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/gbsizer.h +// Name: gbsizer.h // Purpose: wxGridBagSizer: A sizer that can lay out items in a grid, // with items at specified cells, and with the option of row // and/or column spanning // // Author: Robin Dunn // Created: 03-Nov-2003 -// RCS-ID: $Id$ +// RCS-ID: $Id: gbsizer.h 53135 2008-04-12 02:31:04Z VZ $ // Copyright: (c) Robin Dunn // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -28,7 +28,7 @@ // is used for this and also for wxGridCellCoords. //--------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxGBPosition +class WXDLLEXPORT wxGBPosition { public: wxGBPosition() : m_row(0), m_col(0) {} @@ -50,55 +50,29 @@ private: }; -class WXDLLIMPEXP_CORE wxGBSpan +class WXDLLEXPORT wxGBSpan { public: - wxGBSpan() { Init(); } - wxGBSpan(int rowspan, int colspan) - { - // Initialize the members to valid values as not doing it may result in - // infinite loop in wxGBSizer code if the user passed 0 for any of - // them, see #12934. - Init(); - - SetRowspan(rowspan); - SetColspan(colspan); - } + wxGBSpan() : m_rowspan(1), m_colspan(1) {} + wxGBSpan(int rowspan, int colspan) : m_rowspan(rowspan), m_colspan(colspan) {} // default copy ctor and assignment operator are okay. int GetRowspan() const { return m_rowspan; } int GetColspan() const { return m_colspan; } - void SetRowspan(int rowspan) - { - wxCHECK_RET( rowspan > 0, "Row span should be strictly positive" ); - - m_rowspan = rowspan; - } - - void SetColspan(int colspan) - { - wxCHECK_RET( colspan > 0, "Column span should be strictly positive" ); - - m_colspan = colspan; - } + void SetRowspan(int rowspan) { m_rowspan = rowspan; } + void SetColspan(int colspan) { m_colspan = colspan; } bool operator==(const wxGBSpan& o) const { return m_rowspan == o.m_rowspan && m_colspan == o.m_colspan; } bool operator!=(const wxGBSpan& o) const { return !(*this == o); } private: - void Init() - { - m_rowspan = - m_colspan = 1; - } - int m_rowspan; int m_colspan; }; -extern WXDLLIMPEXP_DATA_CORE(const wxGBSpan) wxDefaultSpan; +extern WXDLLEXPORT_DATA(const wxGBSpan) wxDefaultSpan; //--------------------------------------------------------------------------- @@ -108,33 +82,33 @@ extern WXDLLIMPEXP_DATA_CORE(const wxGBSpan) wxDefaultSpan; class WXDLLIMPEXP_FWD_CORE wxGridBagSizer; -class WXDLLIMPEXP_CORE wxGBSizerItem : public wxSizerItem +class WXDLLEXPORT wxGBSizerItem : public wxSizerItem { public: // spacer wxGBSizerItem( int width, int height, const wxGBPosition& pos, - const wxGBSpan& span=wxDefaultSpan, - int flag=0, - int border=0, - wxObject* userData=NULL); + const wxGBSpan& span, + int flag, + int border, + wxObject* userData); // window wxGBSizerItem( wxWindow *window, const wxGBPosition& pos, - const wxGBSpan& span=wxDefaultSpan, - int flag=0, - int border=0, - wxObject* userData=NULL ); + const wxGBSpan& span, + int flag, + int border, + wxObject* userData ); // subsizer wxGBSizerItem( wxSizer *sizer, const wxGBPosition& pos, - const wxGBSpan& span=wxDefaultSpan, - int flag=0, - int border=0, - wxObject* userData=NULL ); + const wxGBSpan& span, + int flag, + int border, + wxObject* userData ); // default ctor wxGBSizerItem(); @@ -160,7 +134,7 @@ public: // is successful and after the next Layout the item will be resized. bool SetSpan( const wxGBSpan& span ); - // Returns true if this item and the other item intersect + // Returns true if this item and the other item instersect bool Intersects(const wxGBSizerItem& other); // Returns true if the given pos/span would intersect with this item. @@ -182,7 +156,7 @@ protected: private: DECLARE_DYNAMIC_CLASS(wxGBSizerItem) - wxDECLARE_NO_COPY_CLASS(wxGBSizerItem); + DECLARE_NO_COPY_CLASS(wxGBSizerItem) }; @@ -191,7 +165,7 @@ private: //--------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxGridBagSizer : public wxFlexGridSizer +class WXDLLEXPORT wxGridBagSizer : public wxFlexGridSizer { public: wxGridBagSizer(int vgap = 0, int hgap = 0 ); @@ -312,7 +286,9 @@ public: protected: wxGBPosition FindEmptyCell(); +#if wxABI_VERSION >= 20808 void AdjustForOverflow(); +#endif wxSize m_emptyCellSize; @@ -320,7 +296,7 @@ protected: private: DECLARE_CLASS(wxGridBagSizer) - wxDECLARE_NO_COPY_CLASS(wxGridBagSizer); + DECLARE_NO_COPY_CLASS(wxGridBagSizer) }; //--------------------------------------------------------------------------- diff --git a/Source/3rd Party/wx/include/wx/gdicmn.h b/Source/3rd Party/wx/include/wx/gdicmn.h index 61e80d7fe..2b9e71b05 100644 --- a/Source/3rd Party/wx/include/wx/gdicmn.h +++ b/Source/3rd Party/wx/include/wx/gdicmn.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: gdicmn.h 49563 2007-10-31 20:46:21Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -37,8 +37,6 @@ class WXDLLIMPEXP_FWD_CORE wxPalette; class WXDLLIMPEXP_FWD_CORE wxPen; class WXDLLIMPEXP_FWD_CORE wxRegion; class WXDLLIMPEXP_FWD_BASE wxString; -class WXDLLIMPEXP_FWD_CORE wxIconBundle; -class WXDLLIMPEXP_FWD_CORE wxPoint; // --------------------------------------------------------------------------- // constants @@ -59,10 +57,8 @@ enum wxBitmapType wxBITMAP_TYPE_XBM_DATA, wxBITMAP_TYPE_XPM, wxBITMAP_TYPE_XPM_DATA, - wxBITMAP_TYPE_TIFF, - wxBITMAP_TYPE_TIF = wxBITMAP_TYPE_TIFF, - wxBITMAP_TYPE_TIFF_RESOURCE, - wxBITMAP_TYPE_TIF_RESOURCE = wxBITMAP_TYPE_TIFF_RESOURCE, + wxBITMAP_TYPE_TIF, + wxBITMAP_TYPE_TIF_RESOURCE, wxBITMAP_TYPE_GIF, wxBITMAP_TYPE_GIF_RESOURCE, wxBITMAP_TYPE_PNG, @@ -82,18 +78,9 @@ enum wxBitmapType wxBITMAP_TYPE_TGA, wxBITMAP_TYPE_MACCURSOR, wxBITMAP_TYPE_MACCURSOR_RESOURCE, - - wxBITMAP_TYPE_MAX, wxBITMAP_TYPE_ANY = 50 }; -// Polygon filling mode -enum wxPolygonFillMode -{ - wxODDEVEN_RULE = 1, - wxWINDING_RULE -}; - // Standard cursors enum wxStockCursor { @@ -137,58 +124,48 @@ enum wxStockCursor wxCURSOR_BASED_ARROW_UP, wxCURSOR_BASED_ARROW_DOWN, #endif // X11 + wxCURSOR_ARROWWAIT, -#ifdef __WXMAC__ - wxCURSOR_OPEN_HAND, - wxCURSOR_CLOSED_HAND, -#endif wxCURSOR_MAX }; #ifndef __WXGTK__ - #define wxCURSOR_DEFAULT wxCURSOR_ARROW -#endif - -#ifndef __WXMAC__ - // TODO CS supply openhand and closedhand cursors - #define wxCURSOR_OPEN_HAND wxCURSOR_HAND - #define wxCURSOR_CLOSED_HAND wxCURSOR_HAND + #define wxCURSOR_DEFAULT wxCURSOR_ARROW #endif // --------------------------------------------------------------------------- // macros // --------------------------------------------------------------------------- -#if defined(__WINDOWS__) || defined(__WXPM__) - #define wxHAS_IMAGES_IN_RESOURCES -#endif - /* Useful macro for creating icons portably, for example: - wxIcon *icon = new wxICON(sample); + wxIcon *icon = new wxICON(mondrian); expands into: - wxIcon *icon = new wxIcon("sample"); // On Windows - wxIcon *icon = new wxIcon(sample_xpm); // On wxGTK/Linux + wxIcon *icon = new wxIcon("mondrian"); // On wxMSW + wxIcon *icon = new wxIcon(mondrian_xpm); // On wxGTK */ -#ifdef __WINDOWS__ +#ifdef __WXMSW__ // Load from a resource #define wxICON(X) wxIcon(wxT(#X)) #elif defined(__WXPM__) // Load from a resource #define wxICON(X) wxIcon(wxT(#X)) +#elif defined(__WXMGL__) + // Initialize from an included XPM + #define wxICON(X) wxIcon( (const char**) X##_xpm ) #elif defined(__WXDFB__) // Initialize from an included XPM - #define wxICON(X) wxIcon( X##_xpm ) + #define wxICON(X) wxIcon( (const char**) X##_xpm ) #elif defined(__WXGTK__) // Initialize from an included XPM - #define wxICON(X) wxIcon( X##_xpm ) + #define wxICON(X) wxIcon( (const char**) X##_xpm ) #elif defined(__WXMAC__) // Initialize from an included XPM - #define wxICON(X) wxIcon( X##_xpm ) + #define wxICON(X) wxIcon( (const char**) X##_xpm ) #elif defined(__WXMOTIF__) // Initialize from an included XPM #define wxICON(X) wxIcon( X##_xpm ) @@ -204,16 +181,17 @@ enum wxStockCursor under Unix bitmaps live in XPMs and under Windows they're in ressources. */ -#if defined(__WINDOWS__) || defined(__WXPM__) - #define wxBITMAP(name) wxBitmap(wxT(#name), wxBITMAP_TYPE_BMP_RESOURCE) +#if defined(__WXMSW__) || defined(__WXPM__) + #define wxBITMAP(name) wxBitmap(wxT(#name), wxBITMAP_TYPE_RESOURCE) #elif defined(__WXGTK__) || \ defined(__WXMOTIF__) || \ defined(__WXX11__) || \ defined(__WXMAC__) || \ + defined(__WXMGL__) || \ defined(__WXDFB__) || \ defined(__WXCOCOA__) // Initialize from an included XPM - #define wxBITMAP(name) wxBitmap(name##_xpm) + #define wxBITMAP(name) wxBitmap( (const char**) name##_xpm ) #else // other platforms #define wxBITMAP(name) wxBitmap(name##_xpm, wxBITMAP_TYPE_XPM) #endif // platform @@ -226,7 +204,7 @@ enum wxStockCursor // wxSize // --------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxSize +class WXDLLEXPORT wxSize { public: // members are public for compatibility, don't use them directly. @@ -238,18 +216,18 @@ public: // no copy ctor or assignment operator - the defaults are ok + bool operator==(const wxSize& sz) const { return x == sz.x && y == sz.y; } + bool operator!=(const wxSize& sz) const { return x != sz.x || y != sz.y; } + + wxSize operator+(const wxSize& sz) const { return wxSize(x + sz.x, y + sz.y); } + wxSize operator-(const wxSize& sz) const { return wxSize(x - sz.x, y - sz.y); } + wxSize operator/(int i) const { return wxSize(x / i, y / i); } + wxSize operator*(int i) const { return wxSize(x * i, y * i); } + wxSize& operator+=(const wxSize& sz) { x += sz.x; y += sz.y; return *this; } wxSize& operator-=(const wxSize& sz) { x -= sz.x; y -= sz.y; return *this; } - wxSize& operator/=(int i) { x /= i; y /= i; return *this; } - wxSize& operator*=(int i) { x *= i; y *= i; return *this; } - wxSize& operator/=(unsigned int i) { x /= i; y /= i; return *this; } - wxSize& operator*=(unsigned int i) { x *= i; y *= i; return *this; } - wxSize& operator/=(long i) { x /= i; y /= i; return *this; } - wxSize& operator*=(long i) { x *= i; y *= i; return *this; } - wxSize& operator/=(unsigned long i) { x /= i; y /= i; return *this; } - wxSize& operator*=(unsigned long i) { x *= i; y *= i; return *this; } - wxSize& operator/=(double i) { x = int(x/i); y = int(y/i); return *this; } - wxSize& operator*=(double i) { x = int(x*i); y = int(y*i); return *this; } + wxSize& operator/=(const int i) { x /= i; y /= i; return *this; } + wxSize& operator*=(const int i) { x *= i; y *= i; return *this; } void IncTo(const wxSize& sz) { if ( sz.x > x ) x = sz.x; if ( sz.y > y ) y = sz.y; } @@ -257,12 +235,10 @@ public: { if ( sz.x < x ) x = sz.x; if ( sz.y < y ) y = sz.y; } void IncBy(int dx, int dy) { x += dx; y += dy; } - void IncBy(const wxPoint& pt); void IncBy(const wxSize& sz) { IncBy(sz.x, sz.y); } void IncBy(int d) { IncBy(d, d); } void DecBy(int dx, int dy) { IncBy(-dx, -dy); } - void DecBy(const wxPoint& pt); void DecBy(const wxSize& sz) { DecBy(sz.x, sz.y); } void DecBy(int d) { DecBy(d, d); } @@ -295,103 +271,11 @@ public: int GetY() const { return y; } }; -inline bool operator==(const wxSize& s1, const wxSize& s2) -{ - return s1.x == s2.x && s1.y == s2.y; -} - -inline bool operator!=(const wxSize& s1, const wxSize& s2) -{ - return s1.x != s2.x || s1.y != s2.y; -} - -inline wxSize operator+(const wxSize& s1, const wxSize& s2) -{ - return wxSize(s1.x + s2.x, s1.y + s2.y); -} - -inline wxSize operator-(const wxSize& s1, const wxSize& s2) -{ - return wxSize(s1.x - s2.x, s1.y - s2.y); -} - -inline wxSize operator/(const wxSize& s, int i) -{ - return wxSize(s.x / i, s.y / i); -} - -inline wxSize operator*(const wxSize& s, int i) -{ - return wxSize(s.x * i, s.y * i); -} - -inline wxSize operator*(int i, const wxSize& s) -{ - return wxSize(s.x * i, s.y * i); -} - -inline wxSize operator/(const wxSize& s, unsigned int i) -{ - return wxSize(s.x / i, s.y / i); -} - -inline wxSize operator*(const wxSize& s, unsigned int i) -{ - return wxSize(s.x * i, s.y * i); -} - -inline wxSize operator*(unsigned int i, const wxSize& s) -{ - return wxSize(s.x * i, s.y * i); -} - -inline wxSize operator/(const wxSize& s, long i) -{ - return wxSize(s.x / i, s.y / i); -} - -inline wxSize operator*(const wxSize& s, long i) -{ - return wxSize(s.x * i, s.y * i); -} - -inline wxSize operator*(long i, const wxSize& s) -{ - return wxSize(s.x * i, s.y * i); -} - -inline wxSize operator/(const wxSize& s, unsigned long i) -{ - return wxSize(s.x / i, s.y / i); -} - -inline wxSize operator*(const wxSize& s, unsigned long i) -{ - return wxSize(s.x * i, s.y * i); -} - -inline wxSize operator*(unsigned long i, const wxSize& s) -{ - return wxSize(s.x * i, s.y * i); -} - -inline wxSize operator*(const wxSize& s, double i) -{ - return wxSize(int(s.x * i), int(s.y * i)); -} - -inline wxSize operator*(double i, const wxSize& s) -{ - return wxSize(int(s.x * i), int(s.y * i)); -} - - - // --------------------------------------------------------------------------- // Point classes: with real or integer coordinates // --------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxRealPoint +class WXDLLEXPORT wxRealPoint { public: double x; @@ -399,273 +283,53 @@ public: wxRealPoint() : x(0.0), y(0.0) { } wxRealPoint(double xx, double yy) : x(xx), y(yy) { } - wxRealPoint(const wxPoint& pt); - // no copy ctor or assignment operator - the defaults are ok + wxRealPoint operator+(const wxRealPoint& pt) const { return wxRealPoint(x + pt.x, y + pt.y); } + wxRealPoint operator-(const wxRealPoint& pt) const { return wxRealPoint(x - pt.x, y - pt.y); } - //assignment operators - wxRealPoint& operator+=(const wxRealPoint& p) { x += p.x; y += p.y; return *this; } - wxRealPoint& operator-=(const wxRealPoint& p) { x -= p.x; y -= p.y; return *this; } - - wxRealPoint& operator+=(const wxSize& s) { x += s.GetWidth(); y += s.GetHeight(); return *this; } - wxRealPoint& operator-=(const wxSize& s) { x -= s.GetWidth(); y -= s.GetHeight(); return *this; } + bool operator==(const wxRealPoint& pt) const + { + return wxIsSameDouble(x, pt.x) && wxIsSameDouble(y, pt.y); + } + bool operator!=(const wxRealPoint& pt) const { return !(*this == pt); } }; -inline bool operator==(const wxRealPoint& p1, const wxRealPoint& p2) -{ - return wxIsSameDouble(p1.x, p2.x) && wxIsSameDouble(p1.y, p2.y); -} - -inline bool operator!=(const wxRealPoint& p1, const wxRealPoint& p2) -{ - return !(p1 == p2); -} - -inline wxRealPoint operator+(const wxRealPoint& p1, const wxRealPoint& p2) -{ - return wxRealPoint(p1.x + p2.x, p1.y + p2.y); -} - - -inline wxRealPoint operator-(const wxRealPoint& p1, const wxRealPoint& p2) -{ - return wxRealPoint(p1.x - p2.x, p1.y - p2.y); -} - - -inline wxRealPoint operator/(const wxRealPoint& s, int i) -{ - return wxRealPoint(s.x / i, s.y / i); -} - -inline wxRealPoint operator*(const wxRealPoint& s, int i) -{ - return wxRealPoint(s.x * i, s.y * i); -} - -inline wxRealPoint operator*(int i, const wxRealPoint& s) -{ - return wxRealPoint(s.x * i, s.y * i); -} - -inline wxRealPoint operator/(const wxRealPoint& s, unsigned int i) -{ - return wxRealPoint(s.x / i, s.y / i); -} - -inline wxRealPoint operator*(const wxRealPoint& s, unsigned int i) -{ - return wxRealPoint(s.x * i, s.y * i); -} - -inline wxRealPoint operator*(unsigned int i, const wxRealPoint& s) -{ - return wxRealPoint(s.x * i, s.y * i); -} - -inline wxRealPoint operator/(const wxRealPoint& s, long i) -{ - return wxRealPoint(s.x / i, s.y / i); -} - -inline wxRealPoint operator*(const wxRealPoint& s, long i) -{ - return wxRealPoint(s.x * i, s.y * i); -} - -inline wxRealPoint operator*(long i, const wxRealPoint& s) -{ - return wxRealPoint(s.x * i, s.y * i); -} - -inline wxRealPoint operator/(const wxRealPoint& s, unsigned long i) -{ - return wxRealPoint(s.x / i, s.y / i); -} - -inline wxRealPoint operator*(const wxRealPoint& s, unsigned long i) -{ - return wxRealPoint(s.x * i, s.y * i); -} - -inline wxRealPoint operator*(unsigned long i, const wxRealPoint& s) -{ - return wxRealPoint(s.x * i, s.y * i); -} - -inline wxRealPoint operator*(const wxRealPoint& s, double i) -{ - return wxRealPoint(int(s.x * i), int(s.y * i)); -} - -inline wxRealPoint operator*(double i, const wxRealPoint& s) -{ - return wxRealPoint(int(s.x * i), int(s.y * i)); -} - - -// ---------------------------------------------------------------------------- -// wxPoint: 2D point with integer coordinates -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxPoint +class WXDLLEXPORT wxPoint { public: int x, y; wxPoint() : x(0), y(0) { } wxPoint(int xx, int yy) : x(xx), y(yy) { } - wxPoint(const wxRealPoint& pt) : x(int(pt.x)), y(int(pt.y)) { } // no copy ctor or assignment operator - the defaults are ok - //assignment operators + // comparison + bool operator==(const wxPoint& p) const { return x == p.x && y == p.y; } + bool operator!=(const wxPoint& p) const { return !(*this == p); } + + // arithmetic operations (component wise) + wxPoint operator+(const wxPoint& p) const { return wxPoint(x + p.x, y + p.y); } + wxPoint operator-(const wxPoint& p) const { return wxPoint(x - p.x, y - p.y); } + wxPoint& operator+=(const wxPoint& p) { x += p.x; y += p.y; return *this; } wxPoint& operator-=(const wxPoint& p) { x -= p.x; y -= p.y; return *this; } wxPoint& operator+=(const wxSize& s) { x += s.GetWidth(); y += s.GetHeight(); return *this; } wxPoint& operator-=(const wxSize& s) { x -= s.GetWidth(); y -= s.GetHeight(); return *this; } - // check if both components are set/initialized - bool IsFullySpecified() const { return x != wxDefaultCoord && y != wxDefaultCoord; } + wxPoint operator+(const wxSize& s) const { return wxPoint(x + s.GetWidth(), y + s.GetHeight()); } + wxPoint operator-(const wxSize& s) const { return wxPoint(x - s.GetWidth(), y - s.GetHeight()); } - // fill in the unset components with the values from the other point - void SetDefaults(const wxPoint& pt) - { - if ( x == wxDefaultCoord ) - x = pt.x; - if ( y == wxDefaultCoord ) - y = pt.y; - } + wxPoint operator-() const { return wxPoint(-x, -y); } }; - -// comparison -inline bool operator==(const wxPoint& p1, const wxPoint& p2) -{ - return p1.x == p2.x && p1.y == p2.y; -} - -inline bool operator!=(const wxPoint& p1, const wxPoint& p2) -{ - return !(p1 == p2); -} - - -// arithmetic operations (component wise) -inline wxPoint operator+(const wxPoint& p1, const wxPoint& p2) -{ - return wxPoint(p1.x + p2.x, p1.y + p2.y); -} - -inline wxPoint operator-(const wxPoint& p1, const wxPoint& p2) -{ - return wxPoint(p1.x - p2.x, p1.y - p2.y); -} - -inline wxPoint operator+(const wxPoint& p, const wxSize& s) -{ - return wxPoint(p.x + s.x, p.y + s.y); -} - -inline wxPoint operator-(const wxPoint& p, const wxSize& s) -{ - return wxPoint(p.x - s.x, p.y - s.y); -} - -inline wxPoint operator+(const wxSize& s, const wxPoint& p) -{ - return wxPoint(p.x + s.x, p.y + s.y); -} - -inline wxPoint operator-(const wxSize& s, const wxPoint& p) -{ - return wxPoint(s.x - p.x, s.y - p.y); -} - -inline wxPoint operator-(const wxPoint& p) -{ - return wxPoint(-p.x, -p.y); -} - -inline wxPoint operator/(const wxPoint& s, int i) -{ - return wxPoint(s.x / i, s.y / i); -} - -inline wxPoint operator*(const wxPoint& s, int i) -{ - return wxPoint(s.x * i, s.y * i); -} - -inline wxPoint operator*(int i, const wxPoint& s) -{ - return wxPoint(s.x * i, s.y * i); -} - -inline wxPoint operator/(const wxPoint& s, unsigned int i) -{ - return wxPoint(s.x / i, s.y / i); -} - -inline wxPoint operator*(const wxPoint& s, unsigned int i) -{ - return wxPoint(s.x * i, s.y * i); -} - -inline wxPoint operator*(unsigned int i, const wxPoint& s) -{ - return wxPoint(s.x * i, s.y * i); -} - -inline wxPoint operator/(const wxPoint& s, long i) -{ - return wxPoint(s.x / i, s.y / i); -} - -inline wxPoint operator*(const wxPoint& s, long i) -{ - return wxPoint(s.x * i, s.y * i); -} - -inline wxPoint operator*(long i, const wxPoint& s) -{ - return wxPoint(s.x * i, s.y * i); -} - -inline wxPoint operator/(const wxPoint& s, unsigned long i) -{ - return wxPoint(s.x / i, s.y / i); -} - -inline wxPoint operator*(const wxPoint& s, unsigned long i) -{ - return wxPoint(s.x * i, s.y * i); -} - -inline wxPoint operator*(unsigned long i, const wxPoint& s) -{ - return wxPoint(s.x * i, s.y * i); -} - -inline wxPoint operator*(const wxPoint& s, double i) -{ - return wxPoint(int(s.x * i), int(s.y * i)); -} - -inline wxPoint operator*(double i, const wxPoint& s) -{ - return wxPoint(int(s.x * i), int(s.y * i)); -} - -WX_DECLARE_LIST_WITH_DECL(wxPoint, wxPointList, class WXDLLIMPEXP_CORE); - // --------------------------------------------------------------------------- // wxRect // --------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxRect +class WXDLLEXPORT wxRect { public: wxRect() @@ -727,7 +391,7 @@ public: wxPoint GetTopRight() const { return wxPoint(GetRight(), GetTop()); } wxPoint GetRightTop() const { return GetTopRight(); } void SetTopRight(const wxPoint &p) { SetRight(p.x); SetTop(p.y); } - void SetRightTop(const wxPoint &p) { SetTopRight(p); } + void SetRightTop(const wxPoint &p) { SetTopLeft(p); } wxPoint GetBottomLeft() const { return wxPoint(GetLeft(), GetBottom()); } wxPoint GetLeftBottom() const { return GetBottomLeft(); } @@ -774,10 +438,14 @@ public: return r; } + // compare rectangles + bool operator==(const wxRect& rect) const; + bool operator!=(const wxRect& rect) const { return !(*this == rect); } + // return true if the point is (not strcitly) inside the rect bool Contains(int x, int y) const; bool Contains(const wxPoint& pt) const { return Contains(pt.x, pt.y); } - // return true if the rectangle 'rect' is (not strictly) inside this rect + // return true if the rectangle is (not strcitly) inside the rect bool Contains(const wxRect& rect) const; #if WXWIN_COMPATIBILITY_2_6 @@ -790,11 +458,15 @@ public: // return true if the rectangles have a non empty intersection bool Intersects(const wxRect& rect) const; - // like Union() but don't ignore empty rectangles - wxRect& operator+=(const wxRect& rect); - // intersections of two rectrangles not testing for empty rectangles - wxRect& operator*=(const wxRect& rect); + // these are like Union() but don't ignore empty rectangles + wxRect operator+(const wxRect& rect) const; + wxRect& operator+=(const wxRect& rect) + { + *this = *this + rect; + return *this; + } + // centre this rectangle in the given (usually, but not necessarily, // larger) one @@ -814,28 +486,6 @@ public: int x, y, width, height; }; - -// compare rectangles -inline bool operator==(const wxRect& r1, const wxRect& r2) -{ - return (r1.x == r2.x) && (r1.y == r2.y) && - (r1.width == r2.width) && (r1.height == r2.height); -} - -inline bool operator!=(const wxRect& r1, const wxRect& r2) -{ - return !(r1 == r2); -} - -// like Union() but don't treat empty rectangles specially -WXDLLIMPEXP_CORE wxRect operator+(const wxRect& r1, const wxRect& r2); - -// intersections of two rectangles -WXDLLIMPEXP_CORE wxRect operator*(const wxRect& r1, const wxRect& r2); - - - - #if WXWIN_COMPATIBILITY_2_6 inline bool wxRect::Inside(int cx, int cy) const { return Contains(cx, cy); } inline bool wxRect::Inside(const wxPoint& pt) const { return Contains(pt); } @@ -843,11 +493,6 @@ inline bool wxRect::Inside(const wxRect& rect) const { return Contains(rect); } #endif // WXWIN_COMPATIBILITY_2_6 -// define functions which couldn't be defined above because of declarations -// order -inline void wxSize::IncBy(const wxPoint& pt) { IncBy(pt.x, pt.y); } -inline void wxSize::DecBy(const wxPoint& pt) { DecBy(pt.x, pt.y); } - // --------------------------------------------------------------------------- // Management of pens, brushes and fonts // --------------------------------------------------------------------------- @@ -863,9 +508,42 @@ protected: wxList list; }; +class WXDLLIMPEXP_CORE wxPenList: public wxGDIObjListBase +{ +public: + wxPen *FindOrCreatePen(const wxColour& colour, int width, int style); +#if WXWIN_COMPATIBILITY_2_6 + wxDEPRECATED( void AddPen(wxPen*) ); + wxDEPRECATED( void RemovePen(wxPen*) ); +#endif +}; + +class WXDLLIMPEXP_CORE wxBrushList: public wxGDIObjListBase +{ +public: + wxBrush *FindOrCreateBrush(const wxColour& colour, int style = wxSOLID); +#if WXWIN_COMPATIBILITY_2_6 + wxDEPRECATED( void AddBrush(wxBrush*) ); + wxDEPRECATED( void RemoveBrush(wxBrush*) ); +#endif +}; + +class WXDLLIMPEXP_CORE wxFontList: public wxGDIObjListBase +{ +public: + wxFont *FindOrCreateFont(int pointSize, int family, int style, int weight, + bool underline = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT); +#if WXWIN_COMPATIBILITY_2_6 + wxDEPRECATED( void AddFont(wxFont*) ); + wxDEPRECATED( void RemoveFont(wxFont*) ); +#endif +}; + WX_DECLARE_STRING_HASH_MAP(wxColour*, wxStringToColourHashMap); -class WXDLLIMPEXP_CORE wxColourDatabase +class WXDLLEXPORT wxColourDatabase { public: wxColourDatabase(); @@ -898,11 +576,11 @@ private: wxStringToColourHashMap *m_map; }; -class WXDLLIMPEXP_CORE wxResourceCache: public wxList +class WXDLLEXPORT wxResourceCache: public wxList { public: wxResourceCache() { } -#if !wxUSE_STD_CONTAINERS +#if !wxUSE_STL wxResourceCache(const unsigned int keyType) : wxList(keyType) { } #endif virtual ~wxResourceCache(); @@ -912,6 +590,10 @@ public: // global variables // --------------------------------------------------------------------------- +// Lists of GDI objects +extern WXDLLEXPORT_DATA(wxPenList*) wxThePenList; +extern WXDLLEXPORT_DATA(wxBrushList*) wxTheBrushList; +extern WXDLLEXPORT_DATA(wxFontList*) wxTheFontList; /* Stock objects @@ -931,7 +613,6 @@ public: BRUSH_BLUE, BRUSH_CYAN, BRUSH_GREEN, - BRUSH_YELLOW, BRUSH_GREY, BRUSH_LIGHTGREY, BRUSH_MEDIUMGREY, @@ -942,7 +623,6 @@ public: COLOUR_BLUE, COLOUR_CYAN, COLOUR_GREEN, - COLOUR_YELLOW, COLOUR_LIGHTGREY, COLOUR_RED, COLOUR_WHITE, @@ -955,10 +635,8 @@ public: FONT_SWISS, PEN_BLACK, PEN_BLACKDASHED, - PEN_BLUE, PEN_CYAN, PEN_GREEN, - PEN_YELLOW, PEN_GREY, PEN_LIGHTGREY, PEN_MEDIUMGREY, @@ -986,7 +664,7 @@ protected: static wxObject* ms_stockObject[ITEMCOUNT]; - wxDECLARE_NO_COPY_CLASS(wxStockGDI); + DECLARE_NO_COPY_CLASS(wxStockGDI) }; #define wxITALIC_FONT wxStockGDI::instance().GetFont(wxStockGDI::FONT_ITALIC) @@ -996,10 +674,8 @@ protected: #define wxBLACK_DASHED_PEN wxStockGDI::GetPen(wxStockGDI::PEN_BLACKDASHED) #define wxBLACK_PEN wxStockGDI::GetPen(wxStockGDI::PEN_BLACK) -#define wxBLUE_PEN wxStockGDI::GetPen(wxStockGDI::PEN_BLUE) #define wxCYAN_PEN wxStockGDI::GetPen(wxStockGDI::PEN_CYAN) #define wxGREEN_PEN wxStockGDI::GetPen(wxStockGDI::PEN_GREEN) -#define wxYELLOW_PEN wxStockGDI::GetPen(wxStockGDI::PEN_YELLOW) #define wxGREY_PEN wxStockGDI::GetPen(wxStockGDI::PEN_GREY) #define wxLIGHT_GREY_PEN wxStockGDI::GetPen(wxStockGDI::PEN_LIGHTGREY) #define wxMEDIUM_GREY_PEN wxStockGDI::GetPen(wxStockGDI::PEN_MEDIUMGREY) @@ -1011,7 +687,6 @@ protected: #define wxBLUE_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_BLUE) #define wxCYAN_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_CYAN) #define wxGREEN_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_GREEN) -#define wxYELLOW_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_YELLOW) #define wxGREY_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_GREY) #define wxLIGHT_GREY_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_LIGHTGREY) #define wxMEDIUM_GREY_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_MEDIUMGREY) @@ -1023,7 +698,6 @@ protected: #define wxBLUE wxStockGDI::GetColour(wxStockGDI::COLOUR_BLUE) #define wxCYAN wxStockGDI::GetColour(wxStockGDI::COLOUR_CYAN) #define wxGREEN wxStockGDI::GetColour(wxStockGDI::COLOUR_GREEN) -#define wxYELLOW wxStockGDI::GetColour(wxStockGDI::COLOUR_YELLOW) #define wxLIGHT_GREY wxStockGDI::GetColour(wxStockGDI::COLOUR_LIGHTGREY) #define wxRED wxStockGDI::GetColour(wxStockGDI::COLOUR_RED) #define wxWHITE wxStockGDI::GetColour(wxStockGDI::COLOUR_WHITE) @@ -1033,51 +707,49 @@ protected: #define wxSTANDARD_CURSOR wxStockGDI::GetCursor(wxStockGDI::CURSOR_STANDARD) // 'Null' objects -extern WXDLLIMPEXP_DATA_CORE(wxBitmap) wxNullBitmap; -extern WXDLLIMPEXP_DATA_CORE(wxIcon) wxNullIcon; -extern WXDLLIMPEXP_DATA_CORE(wxCursor) wxNullCursor; -extern WXDLLIMPEXP_DATA_CORE(wxPen) wxNullPen; -extern WXDLLIMPEXP_DATA_CORE(wxBrush) wxNullBrush; -extern WXDLLIMPEXP_DATA_CORE(wxPalette) wxNullPalette; -extern WXDLLIMPEXP_DATA_CORE(wxFont) wxNullFont; -extern WXDLLIMPEXP_DATA_CORE(wxColour) wxNullColour; -extern WXDLLIMPEXP_DATA_CORE(wxIconBundle) wxNullIconBundle; +extern WXDLLEXPORT_DATA(wxBitmap) wxNullBitmap; +extern WXDLLEXPORT_DATA(wxIcon) wxNullIcon; +extern WXDLLEXPORT_DATA(wxCursor) wxNullCursor; +extern WXDLLEXPORT_DATA(wxPen) wxNullPen; +extern WXDLLEXPORT_DATA(wxBrush) wxNullBrush; +extern WXDLLEXPORT_DATA(wxPalette) wxNullPalette; +extern WXDLLEXPORT_DATA(wxFont) wxNullFont; +extern WXDLLEXPORT_DATA(wxColour) wxNullColour; -extern WXDLLIMPEXP_DATA_CORE(wxColourDatabase*) wxTheColourDatabase; +extern WXDLLEXPORT_DATA(wxColourDatabase*) wxTheColourDatabase; -extern WXDLLIMPEXP_DATA_CORE(const char) wxPanelNameStr[]; +extern WXDLLEXPORT_DATA(const wxChar) wxPanelNameStr[]; -extern WXDLLIMPEXP_DATA_CORE(const wxSize) wxDefaultSize; -extern WXDLLIMPEXP_DATA_CORE(const wxPoint) wxDefaultPosition; +extern WXDLLEXPORT_DATA(const wxSize) wxDefaultSize; +extern WXDLLEXPORT_DATA(const wxPoint) wxDefaultPosition; // --------------------------------------------------------------------------- // global functions // --------------------------------------------------------------------------- // resource management -extern void WXDLLIMPEXP_CORE wxInitializeStockLists(); -extern void WXDLLIMPEXP_CORE wxDeleteStockLists(); +extern void WXDLLEXPORT wxInitializeStockLists(); +extern void WXDLLEXPORT wxDeleteStockLists(); // is the display colour (or monochrome)? -extern bool WXDLLIMPEXP_CORE wxColourDisplay(); +extern bool WXDLLEXPORT wxColourDisplay(); // Returns depth of screen -extern int WXDLLIMPEXP_CORE wxDisplayDepth(); +extern int WXDLLEXPORT wxDisplayDepth(); #define wxGetDisplayDepth wxDisplayDepth // get the display size -extern void WXDLLIMPEXP_CORE wxDisplaySize(int *width, int *height); -extern wxSize WXDLLIMPEXP_CORE wxGetDisplaySize(); -extern void WXDLLIMPEXP_CORE wxDisplaySizeMM(int *width, int *height); -extern wxSize WXDLLIMPEXP_CORE wxGetDisplaySizeMM(); -extern wxSize WXDLLIMPEXP_CORE wxGetDisplayPPI(); +extern void WXDLLEXPORT wxDisplaySize(int *width, int *height); +extern wxSize WXDLLEXPORT wxGetDisplaySize(); +extern void WXDLLEXPORT wxDisplaySizeMM(int *width, int *height); +extern wxSize WXDLLEXPORT wxGetDisplaySizeMM(); // Get position and size of the display workarea -extern void WXDLLIMPEXP_CORE wxClientDisplayRect(int *x, int *y, int *width, int *height); -extern wxRect WXDLLIMPEXP_CORE wxGetClientDisplayRect(); +extern void WXDLLEXPORT wxClientDisplayRect(int *x, int *y, int *width, int *height); +extern wxRect WXDLLEXPORT wxGetClientDisplayRect(); // set global cursor -extern void WXDLLIMPEXP_CORE wxSetCursor(const wxCursor& cursor); +extern void WXDLLEXPORT wxSetCursor(const wxCursor& cursor); #endif // _WX_GDICMNH__ diff --git a/Source/3rd Party/wx/include/wx/gdiobj.h b/Source/3rd Party/wx/include/wx/gdiobj.h index 19334d485..b4dab2774 100644 --- a/Source/3rd Party/wx/include/wx/gdiobj.h +++ b/Source/3rd Party/wx/include/wx/gdiobj.h @@ -5,7 +5,7 @@ // Modified by: // Created: // Copyright: (c) Julian Smart -// RCS-ID: $Id$ +// RCS-ID: $Id: gdiobj.h 42211 2006-10-21 17:19:11Z SN $ // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// @@ -20,44 +20,18 @@ // the same native GDI object // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxGDIRefData : public wxObjectRefData -{ -public: - // Default ctor which needs to be defined just because we use - // wxDECLARE_NO_COPY_CLASS() below. - wxGDIRefData() { } - - // override this in the derived classes to check if this data object is - // really fully initialized - virtual bool IsOk() const { return true; } - -private: - wxDECLARE_NO_COPY_CLASS(wxGDIRefData); -}; +class WXDLLIMPEXP_CORE wxGDIRefData: public wxObjectRefData { }; // ---------------------------------------------------------------------------- -// wxGDIObject: base class for bitmaps, pens, brushes, ... +// wxGDIObject // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxGDIObject : public wxObject +class WXDLLIMPEXP_CORE wxGDIObject: public wxObject { public: - // checks if the object can be used - virtual bool IsOk() const - { - // the cast here is safe because the derived classes always create - // wxGDIRefData objects - return m_refData && static_cast(m_refData)->IsOk(); - } - - // don't use in the new code, use IsOk() instead bool IsNull() const { return m_refData == NULL; } - // older version, for backwards compatibility only (but not deprecated - // because it's still widely used) - bool Ok() const { return IsOk(); } - -#if defined(__WXMSW__) || defined(__WXPM__) +#if defined(__WXMSW__) || defined(__WXPM__) || defined(__WXPALMOS__) // Creates the resource virtual bool RealizeResource() { return false; } @@ -70,24 +44,8 @@ public: virtual WXHANDLE GetResourceHandle() const { return 0; } #endif // defined(__WXMSW__) || defined(__WXPM__) -protected: - // replace base class functions using wxObjectRefData with our own which - // use wxGDIRefData to ensure that we always work with data objects of the - // correct type (i.e. derived from wxGDIRefData) - virtual wxObjectRefData *CreateRefData() const - { - return CreateGDIRefData(); - } - - virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const - { - return CloneGDIRefData(static_cast(data)); - } - - virtual wxGDIRefData *CreateGDIRefData() const = 0; - virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const = 0; - DECLARE_DYNAMIC_CLASS(wxGDIObject) }; -#endif // _WX_GDIOBJ_H_BASE_ +#endif + // _WX_GDIOBJ_H_BASE_ diff --git a/Source/3rd Party/wx/include/wx/generic/busyinfo.h b/Source/3rd Party/wx/include/wx/generic/busyinfo.h index 42bfd2d25..b8fdd4866 100644 --- a/Source/3rd Party/wx/include/wx/generic/busyinfo.h +++ b/Source/3rd Party/wx/include/wx/generic/busyinfo.h @@ -3,19 +3,17 @@ // Purpose: Information window (when app is busy) // Author: Vaclav Slavik // Copyright: (c) 1999 Vaclav Slavik -// RCS-ID: $Id$ +// RCS-ID: $Id: busyinfo.h 49804 2007-11-10 01:09:42Z VZ $ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifndef _WX_BUSYINFO_H_ -#define _WX_BUSYINFO_H_ +#ifndef __BUSYINFO_H__ +#define __BUSYINFO_H__ #include "wx/defs.h" #if wxUSE_BUSYINFO -#include "wx/object.h" - class WXDLLIMPEXP_FWD_CORE wxFrame; class WXDLLIMPEXP_FWD_CORE wxWindow; @@ -25,7 +23,7 @@ class WXDLLIMPEXP_FWD_CORE wxWindow; // Can be used in exactly same way as wxBusyCursor //-------------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxBusyInfo : public wxObject +class WXDLLEXPORT wxBusyInfo : public wxObject { public: wxBusyInfo(const wxString& message, wxWindow *parent = NULL); @@ -35,8 +33,10 @@ public: private: wxFrame *m_InfoFrame; - wxDECLARE_NO_COPY_CLASS(wxBusyInfo); + DECLARE_NO_COPY_CLASS(wxBusyInfo) }; + #endif // wxUSE_BUSYINFO -#endif // _WX_BUSYINFO_H_ + +#endif // __BUSYINFO_H__ diff --git a/Source/3rd Party/wx/include/wx/generic/choicdgg.h b/Source/3rd Party/wx/include/wx/generic/choicdgg.h index 2d8876a99..ebefcd81b 100644 --- a/Source/3rd Party/wx/include/wx/generic/choicdgg.h +++ b/Source/3rd Party/wx/include/wx/generic/choicdgg.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: 03.11.00: VZ to add wxArrayString and multiple sel functions // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: choicdgg.h 49563 2007-10-31 20:46:21Z VZ $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -36,7 +36,7 @@ class WXDLLIMPEXP_FWD_CORE wxListBoxBase; // wxAnyChoiceDialog: a base class for dialogs containing a listbox // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxAnyChoiceDialog : public wxDialog +class WXDLLEXPORT wxAnyChoiceDialog : public wxDialog { public: wxAnyChoiceDialog() { } @@ -86,14 +86,14 @@ protected: const wxString *choices, long styleLbox); - wxDECLARE_NO_COPY_CLASS(wxAnyChoiceDialog); + DECLARE_NO_COPY_CLASS(wxAnyChoiceDialog) }; // ---------------------------------------------------------------------------- // wxSingleChoiceDialog: a dialog with single selection listbox // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxSingleChoiceDialog : public wxAnyChoiceDialog +class WXDLLEXPORT wxSingleChoiceDialog : public wxAnyChoiceDialog { public: wxSingleChoiceDialog() @@ -106,112 +106,39 @@ public: const wxString& caption, int n, const wxString *choices, - void **clientData = NULL, + char **clientData = (char **)NULL, long style = wxCHOICEDLG_STYLE, - const wxPoint& pos = wxDefaultPosition) - { - Create(parent, message, caption, n, choices, clientData, style, pos); - } - + const wxPoint& pos = wxDefaultPosition); wxSingleChoiceDialog(wxWindow *parent, const wxString& message, const wxString& caption, const wxArrayString& choices, - void **clientData = NULL, + char **clientData = (char **)NULL, long style = wxCHOICEDLG_STYLE, - const wxPoint& pos = wxDefaultPosition) - { - Create(parent, message, caption, choices, clientData, style, pos); - } + const wxPoint& pos = wxDefaultPosition); bool Create(wxWindow *parent, const wxString& message, const wxString& caption, int n, const wxString *choices, - void **clientData = NULL, + char **clientData = (char **)NULL, long style = wxCHOICEDLG_STYLE, const wxPoint& pos = wxDefaultPosition); bool Create(wxWindow *parent, const wxString& message, const wxString& caption, const wxArrayString& choices, - void **clientData = NULL, + char **clientData = (char **)NULL, long style = wxCHOICEDLG_STYLE, const wxPoint& pos = wxDefaultPosition); void SetSelection(int sel); int GetSelection() const { return m_selection; } wxString GetStringSelection() const { return m_stringSelection; } - void* GetSelectionData() const { return m_clientData; } -#if WXWIN_COMPATIBILITY_2_8 - // Deprecated overloads taking "char**" client data. - wxDEPRECATED_CONSTRUCTOR - ( - wxSingleChoiceDialog(wxWindow *parent, - const wxString& message, - const wxString& caption, - int n, - const wxString *choices, - char **clientData, - long style = wxCHOICEDLG_STYLE, - const wxPoint& pos = wxDefaultPosition) - ) - { - Create(parent, message, caption, n, choices, - (void**)clientData, style, pos); - } - - wxDEPRECATED_CONSTRUCTOR - ( - wxSingleChoiceDialog(wxWindow *parent, - const wxString& message, - const wxString& caption, - const wxArrayString& choices, - char **clientData, - long style = wxCHOICEDLG_STYLE, - const wxPoint& pos = wxDefaultPosition) - ) - { - Create(parent, message, caption, choices, - (void**)clientData, style, pos); - } - - wxDEPRECATED_INLINE - ( - bool Create(wxWindow *parent, - const wxString& message, - const wxString& caption, - int n, - const wxString *choices, - char **clientData, - long style = wxCHOICEDLG_STYLE, - const wxPoint& pos = wxDefaultPosition), - return Create(parent, message, caption, n, choices, - (void**)clientData, style, pos); - ) - - wxDEPRECATED_INLINE - ( - bool Create(wxWindow *parent, - const wxString& message, - const wxString& caption, - const wxArrayString& choices, - char **clientData, - long style = wxCHOICEDLG_STYLE, - const wxPoint& pos = wxDefaultPosition), - return Create(parent, message, caption, choices, - (void**)clientData, style, pos); - ) - - // NB: no need to make it return wxChar, it's untyped - wxDEPRECATED_ACCESSOR - ( - char* GetSelectionClientData() const, - (char*)GetSelectionData() - ) -#endif // WXWIN_COMPATIBILITY_2_8 + // obsolete function (NB: no need to make it return wxChar, it's untyped) + char *GetSelectionClientData() const { return (char *)m_clientData; } // implementation from now on void OnOK(wxCommandEvent& event); @@ -237,7 +164,7 @@ private: // wxMultiChoiceDialog: a dialog with multi selection listbox // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxMultiChoiceDialog : public wxAnyChoiceDialog +class WXDLLEXPORT wxMultiChoiceDialog : public wxAnyChoiceDialog { public: wxMultiChoiceDialog() { } @@ -300,7 +227,7 @@ private: // ---------------------------------------------------------------------------- // get the user selection as a string -WXDLLIMPEXP_CORE wxString wxGetSingleChoice(const wxString& message, +WXDLLEXPORT wxString wxGetSingleChoice(const wxString& message, const wxString& caption, const wxArrayString& choices, wxWindow *parent = NULL, @@ -308,10 +235,9 @@ WXDLLIMPEXP_CORE wxString wxGetSingleChoice(const wxString& message, int y = wxDefaultCoord, bool centre = true, int width = wxCHOICE_WIDTH, - int height = wxCHOICE_HEIGHT, - int initialSelection = 0); + int height = wxCHOICE_HEIGHT); -WXDLLIMPEXP_CORE wxString wxGetSingleChoice(const wxString& message, +WXDLLEXPORT wxString wxGetSingleChoice(const wxString& message, const wxString& caption, int n, const wxString *choices, wxWindow *parent = NULL, @@ -319,24 +245,11 @@ WXDLLIMPEXP_CORE wxString wxGetSingleChoice(const wxString& message, int y = wxDefaultCoord, bool centre = true, int width = wxCHOICE_WIDTH, - int height = wxCHOICE_HEIGHT, - int initialSelection = 0); - -WXDLLIMPEXP_CORE wxString wxGetSingleChoice(const wxString& message, - const wxString& caption, - const wxArrayString& choices, - int initialSelection, - wxWindow *parent = NULL); - -WXDLLIMPEXP_CORE wxString wxGetSingleChoice(const wxString& message, - const wxString& caption, - int n, const wxString *choices, - int initialSelection, - wxWindow *parent = NULL); + int height = wxCHOICE_HEIGHT); // Same as above but gets position in list of strings, instead of string, // or -1 if no selection -WXDLLIMPEXP_CORE int wxGetSingleChoiceIndex(const wxString& message, +WXDLLEXPORT int wxGetSingleChoiceIndex(const wxString& message, const wxString& caption, const wxArrayString& choices, wxWindow *parent = NULL, @@ -344,10 +257,9 @@ WXDLLIMPEXP_CORE int wxGetSingleChoiceIndex(const wxString& message, int y = wxDefaultCoord, bool centre = true, int width = wxCHOICE_WIDTH, - int height = wxCHOICE_HEIGHT, - int initialSelection = 0); + int height = wxCHOICE_HEIGHT); -WXDLLIMPEXP_CORE int wxGetSingleChoiceIndex(const wxString& message, +WXDLLEXPORT int wxGetSingleChoiceIndex(const wxString& message, const wxString& caption, int n, const wxString *choices, wxWindow *parent = NULL, @@ -355,23 +267,10 @@ WXDLLIMPEXP_CORE int wxGetSingleChoiceIndex(const wxString& message, int y = wxDefaultCoord, bool centre = true, int width = wxCHOICE_WIDTH, - int height = wxCHOICE_HEIGHT, - int initialSelection = 0); + int height = wxCHOICE_HEIGHT); -WXDLLIMPEXP_CORE int wxGetSingleChoiceIndex(const wxString& message, - const wxString& caption, - const wxArrayString& choices, - int initialSelection, - wxWindow *parent = NULL); - -WXDLLIMPEXP_CORE int wxGetSingleChoiceIndex(const wxString& message, - const wxString& caption, - int n, const wxString *choices, - int initialSelection, - wxWindow *parent = NULL); - -// Return client data instead or NULL if canceled -WXDLLIMPEXP_CORE void* wxGetSingleChoiceData(const wxString& message, +// Return client data instead or NULL if cancelled +WXDLLEXPORT void* wxGetSingleChoiceData(const wxString& message, const wxString& caption, const wxArrayString& choices, void **client_data, @@ -380,10 +279,9 @@ WXDLLIMPEXP_CORE void* wxGetSingleChoiceData(const wxString& message, int y = wxDefaultCoord, bool centre = true, int width = wxCHOICE_WIDTH, - int height = wxCHOICE_HEIGHT, - int initialSelection = 0); + int height = wxCHOICE_HEIGHT); -WXDLLIMPEXP_CORE void* wxGetSingleChoiceData(const wxString& message, +WXDLLEXPORT void* wxGetSingleChoiceData(const wxString& message, const wxString& caption, int n, const wxString *choices, void **client_data, @@ -392,54 +290,12 @@ WXDLLIMPEXP_CORE void* wxGetSingleChoiceData(const wxString& message, int y = wxDefaultCoord, bool centre = true, int width = wxCHOICE_WIDTH, - int height = wxCHOICE_HEIGHT, - int initialSelection = 0); - -WXDLLIMPEXP_CORE void* wxGetSingleChoiceData(const wxString& message, - const wxString& caption, - const wxArrayString& choices, - void **client_data, - int initialSelection, - wxWindow *parent = NULL); - - -WXDLLIMPEXP_CORE void* wxGetSingleChoiceData(const wxString& message, - const wxString& caption, - int n, const wxString *choices, - void **client_data, - int initialSelection, - wxWindow *parent = NULL); - -// fill the array with the indices of the chosen items, it will be empty -// if no items were selected or Cancel was pressed - return the number of -// selections or -1 if cancelled -WXDLLIMPEXP_CORE int wxGetSelectedChoices(wxArrayInt& selections, - const wxString& message, - const wxString& caption, - int n, const wxString *choices, - wxWindow *parent = NULL, - int x = wxDefaultCoord, - int y = wxDefaultCoord, - bool centre = true, - int width = wxCHOICE_WIDTH, int height = wxCHOICE_HEIGHT); -WXDLLIMPEXP_CORE int wxGetSelectedChoices(wxArrayInt& selections, - const wxString& message, - const wxString& caption, - const wxArrayString& choices, - wxWindow *parent = NULL, - int x = wxDefaultCoord, - int y = wxDefaultCoord, - bool centre = true, - int width = wxCHOICE_WIDTH, - int height = wxCHOICE_HEIGHT); - -#if WXWIN_COMPATIBILITY_2_8 // fill the array with the indices of the chosen items, it will be empty // if no items were selected or Cancel was pressed - return the number of // selections -wxDEPRECATED( WXDLLIMPEXP_CORE size_t wxGetMultipleChoices(wxArrayInt& selections, +WXDLLEXPORT size_t wxGetMultipleChoices(wxArrayInt& selections, const wxString& message, const wxString& caption, int n, const wxString *choices, @@ -448,9 +304,9 @@ wxDEPRECATED( WXDLLIMPEXP_CORE size_t wxGetMultipleChoices(wxArrayInt& selection int y = wxDefaultCoord, bool centre = true, int width = wxCHOICE_WIDTH, - int height = wxCHOICE_HEIGHT) ); + int height = wxCHOICE_HEIGHT); -wxDEPRECATED( WXDLLIMPEXP_CORE size_t wxGetMultipleChoices(wxArrayInt& selections, +WXDLLEXPORT size_t wxGetMultipleChoices(wxArrayInt& selections, const wxString& message, const wxString& caption, const wxArrayString& choices, @@ -459,7 +315,6 @@ wxDEPRECATED( WXDLLIMPEXP_CORE size_t wxGetMultipleChoices(wxArrayInt& selection int y = wxDefaultCoord, bool centre = true, int width = wxCHOICE_WIDTH, - int height = wxCHOICE_HEIGHT)); -#endif // WXWIN_COMPATIBILITY_2_8 + int height = wxCHOICE_HEIGHT); #endif // _WX_GENERIC_CHOICDGG_H_ diff --git a/Source/3rd Party/wx/include/wx/generic/clrpickerg.h b/Source/3rd Party/wx/include/wx/generic/clrpickerg.h index 5cd82ea18..3a54f1e6f 100644 --- a/Source/3rd Party/wx/include/wx/generic/clrpickerg.h +++ b/Source/3rd Party/wx/include/wx/generic/clrpickerg.h @@ -5,7 +5,7 @@ // Modified by: // Created: 14/4/2006 // Copyright: (c) Vadim Zeitlin, Francesco Montorsi -// RCS-ID: $Id$ +// RCS-ID: $Id: clrpickerg.h 58967 2009-02-17 13:31:28Z SC $ // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// @@ -13,14 +13,30 @@ #define _WX_CLRPICKER_H_ #include "wx/button.h" -#include "wx/bmpbuttn.h" -#include "wx/colourdata.h" +#include "wx/cmndata.h" //----------------------------------------------------------------------------- // wxGenericColourButton: a button which brings up a wxColourDialog //----------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxGenericColourButton : public wxBitmapButton, +// show the colour in HTML form (#AABBCC) as colour button label +#define wxCLRBTN_SHOW_LABEL 100 + +// the default style +#define wxCLRBTN_DEFAULT_STYLE (wxCLRBTN_SHOW_LABEL) + +#ifndef wxCLRBTN_USES_BMP_BUTTON + #define wxCLRBTN_USES_BMP_BUTTON 0 +#endif + +#if wxCLRBTN_USES_BMP_BUTTON + #include "wx/bmpbutton.h" + #define wxCLRBTN_BASE_CLASS wxBitmapButton +#else + #define wxCLRBTN_BASE_CLASS wxButton +#endif + +class WXDLLIMPEXP_CORE wxGenericColourButton : public wxCLRBTN_BASE_CLASS, public wxColourPickerWidgetBase { public: @@ -64,7 +80,6 @@ public: protected: - wxBitmap m_bitmap; wxSize DoGetBestSize() const; diff --git a/Source/3rd Party/wx/include/wx/generic/collpaneg.h b/Source/3rd Party/wx/include/wx/generic/collpaneg.h index 34babeacc..b16b65948 100644 --- a/Source/3rd Party/wx/include/wx/generic/collpaneg.h +++ b/Source/3rd Party/wx/include/wx/generic/collpaneg.h @@ -4,7 +4,7 @@ // Author: Francesco Montorsi // Modified by: // Created: 8/10/2006 -// RCS-ID: $Id$ +// RCS-ID: $Id: collpaneg.h 49804 2007-11-10 01:09:42Z VZ $ // Copyright: (c) Francesco Montorsi // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// @@ -15,18 +15,15 @@ // forward declared class WXDLLIMPEXP_FWD_CORE wxButton; class WXDLLIMPEXP_FWD_CORE wxStaticLine; -#if defined( __WXMAC__ ) && !defined(__WXUNIVERSAL__) -class WXDLLIMPEXP_FWD_CORE wxDisclosureTriangle; -#endif -#include "wx/containr.h" +// class name +extern WXDLLIMPEXP_DATA_CORE(const wxChar) wxCollapsiblePaneNameStr[]; // ---------------------------------------------------------------------------- // wxGenericCollapsiblePane // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxGenericCollapsiblePane : - public wxNavigationEnabled +class WXDLLIMPEXP_CORE wxGenericCollapsiblePane : public wxCollapsiblePaneBase { public: wxGenericCollapsiblePane() { Init(); } @@ -45,7 +42,15 @@ public: Create(parent, winid, label, pos, size, style, val, name); } - virtual ~wxGenericCollapsiblePane(); + void Init() + { + m_pButton = NULL; + m_pPane = NULL; + m_pStaticLine = NULL; + m_sz = NULL; + } + + ~wxGenericCollapsiblePane(); bool Create(wxWindow *parent, wxWindowID winid, @@ -69,11 +74,6 @@ public: virtual bool Layout(); - - // for the generic collapsible pane only: - wxControl* GetControlWidget() const - { return (wxControl*)m_pButton; } - // implementation only, don't use void OnStateChange(const wxSize& sizeNew); @@ -85,11 +85,7 @@ protected: int GetBorder() const; // child controls -#if defined( __WXMAC__ ) && !defined(__WXUNIVERSAL__) - wxDisclosureTriangle *m_pButton; -#else wxButton *m_pButton; -#endif wxStaticLine *m_pStaticLine; wxWindow *m_pPane; wxSizer *m_sz; @@ -98,8 +94,6 @@ protected: wxString m_strLabel; private: - void Init(); - // event handlers void OnButton(wxCommandEvent &ev); void OnSize(wxSizeEvent &ev); diff --git a/Source/3rd Party/wx/include/wx/generic/combo.h b/Source/3rd Party/wx/include/wx/generic/combo.h index 3cc274284..1c0ccee5c 100644 --- a/Source/3rd Party/wx/include/wx/generic/combo.h +++ b/Source/3rd Party/wx/include/wx/generic/combo.h @@ -4,7 +4,7 @@ // Author: Jaakko Salli // Modified by: // Created: Apr-30-2006 -// RCS-ID: $Id$ +// RCS-ID: $Id: combo.h 61872 2009-09-09 22:37:05Z VZ $ // Copyright: (c) Jaakko Salli // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -31,11 +31,9 @@ #endif -#include "wx/dcbuffer.h" +extern WXDLLIMPEXP_DATA_CORE(const wxChar) wxComboBoxNameStr[]; -extern WXDLLIMPEXP_DATA_CORE(const char) wxComboBoxNameStr[]; - -class WXDLLIMPEXP_CORE wxGenericComboCtrl : public wxComboCtrlBase +class WXDLLEXPORT wxGenericComboCtrl : public wxComboCtrlBase { public: // ctors and such @@ -82,37 +80,6 @@ public: protected: - // Dummies for platform-specific wxTextEntry implementations -#if defined(__WXUNIVERSAL__) - // Looks like there's nothing we need to override here -#elif defined(__WXMOTIF__) - virtual WXWidget GetTextWidget() const { return NULL; } -#elif defined(__WXGTK__) -#if defined(__WXGTK20__) - virtual GtkEditable *GetEditable() const { return NULL; } - virtual GtkEntry *GetEntry() const { return NULL; } -#endif -#elif defined(__WXMAC__) - // Looks like there's nothing we need to override here -#elif defined(__WXPM__) - virtual WXHWND GetEditHWND() const { return NULL; } -#endif - - // For better transparent background rendering - virtual bool HasTransparentBackground() - { - #if wxALWAYS_NATIVE_DOUBLE_BUFFER - #ifdef __WXGTK__ - // Sanity check for GTK+ - return IsDoubleBuffered(); - #else - return true; - #endif - #else - return false; - #endif - } - // Mandatory virtuals virtual void OnResize(); @@ -134,7 +101,7 @@ private: // If native wxComboCtrl was not defined, then prepare a simple // front-end so that wxRTTI works as expected. -class WXDLLIMPEXP_CORE wxComboCtrl : public wxGenericComboCtrl +class WXDLLEXPORT wxComboCtrl : public wxGenericComboCtrl { public: wxComboCtrl() : wxGenericComboCtrl() {} diff --git a/Source/3rd Party/wx/include/wx/generic/ctrlsub.h b/Source/3rd Party/wx/include/wx/generic/ctrlsub.h deleted file mode 100644 index ed15283ec..000000000 --- a/Source/3rd Party/wx/include/wx/generic/ctrlsub.h +++ /dev/null @@ -1,123 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/ctrlsub.h -// Purpose: common functionality of wxItemContainer-derived controls -// Author: Vadim Zeitlin -// Created: 2007-07-25 -// RCS-ID: $Id$ -// Copyright: (c) 2007 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GENERIC_CTRLSUB_H_ -#define _WX_GENERIC_CTRLSUB_H_ - -#include "wx/dynarray.h" - -// ---------------------------------------------------------------------------- -// wxControlWithItemsGeneric: generic implementation of item client data -// ---------------------------------------------------------------------------- - -class wxControlWithItemsGeneric : public wxControlWithItemsBase -{ -public: - wxControlWithItemsGeneric() { } - - virtual void DoInitItemClientData() - { - m_itemsClientData.resize(GetCount(), NULL); - } - - virtual void DoSetItemClientData(unsigned int n, void *clientData) - { - m_itemsClientData[n] = clientData; - } - - virtual void *DoGetItemClientData(unsigned int n) const - { - return m_itemsClientData[n]; - } - - virtual void DoClear() { m_itemsClientData.clear(); } - virtual void DoDeleteOneItem(unsigned int pos) - { - if ( HasClientData() ) - m_itemsClientData.RemoveAt(pos); - } - -protected: - // preallocate memory for numItems new items: this should be called from - // the derived classes DoInsertItems() to speed up appending big numbers of - // items with client data; it is safe to call even if we don't use client - // data at all and does nothing in this case - void AllocClientData(unsigned int numItems) - { - if ( HasClientData() ) - m_itemsClientData.reserve(m_itemsClientData.size() + numItems); - } - - // this must be called by derived classes when a new item is added to the - // control to add storage for the corresponding client data pointer (before - // inserting many items, call AllocClientData()) - void InsertNewItemClientData(unsigned int pos, - void **clientData, - unsigned int n, - wxClientDataType type) - { - if ( InitClientDataIfNeeded(type) ) - m_itemsClientData.Insert(clientData[n], pos); - } - - // the same as InsertNewItemClientData() but for numItems consecutive items - // (this can only be used if the control doesn't support sorting as - // otherwise the items positions wouldn't be consecutive any more) - void InsertNewItemsClientData(unsigned int pos, - unsigned int numItems, - void **clientData, - wxClientDataType type) - { - if ( InitClientDataIfNeeded(type) ) - { - // it's more efficient to insert everything at once and then update - // for big number of items to avoid moving the array contents - // around (which would result in O(N^2) algorithm) - m_itemsClientData.Insert(NULL, pos, numItems); - - for ( unsigned int n = 0; n < numItems; ++n, ++pos ) - m_itemsClientData[pos] = clientData[n]; - } - } - - - // vector containing the client data pointers: it is either empty (if - // client data is not used) or has the same number of elements as the - // control - wxArrayPtrVoid m_itemsClientData; - -private: - // initialize client data if needed, return false if we don't have any - // client data and true otherwise - bool InitClientDataIfNeeded(wxClientDataType type) - { - if ( !HasClientData() ) - { - if ( type == wxClientData_None ) - { - // we didn't have the client data before and are not asked to - // store it now neither - return false; - } - - // this is the first time client data is used with this control - DoInitItemClientData(); - SetClientDataType(type); - } - //else: we already have client data - - return true; - } - - wxDECLARE_NO_COPY_CLASS(wxControlWithItemsGeneric); -}; - -#endif // _WX_GENERIC_CTRLSUB_H_ - diff --git a/Source/3rd Party/wx/include/wx/generic/dirctrlg.h b/Source/3rd Party/wx/include/wx/generic/dirctrlg.h index 16c84bf12..b4cea43b5 100644 --- a/Source/3rd Party/wx/include/wx/generic/dirctrlg.h +++ b/Source/3rd Party/wx/include/wx/generic/dirctrlg.h @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/dirctrlg.h +// Name: dirctrlg.h // Purpose: wxGenericDirCtrl class // Builds on wxDirCtrl class written by Robert Roebling for the // wxFile application, modified by Harm van der Heijden. @@ -7,7 +7,7 @@ // Author: Robert Roebling, Harm van der Heijden, Julian Smart et al // Modified by: // Created: 21/3/2000 -// RCS-ID: $Id$ +// RCS-ID: $Id: dirctrlg.h 53135 2008-04-12 02:31:04Z VZ $ // Copyright: (c) Robert Roebling, Harm van der Heijden, Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -15,6 +15,10 @@ #ifndef _WX_DIRCTRL_H_ #define _WX_DIRCTRL_H_ +#if wxUSE_DIRDLG || wxUSE_FILEDLG + #include "wx/imaglist.h" +#endif + #if wxUSE_DIRDLG #include "wx/treectrl.h" @@ -27,6 +31,7 @@ //----------------------------------------------------------------------------- class WXDLLIMPEXP_FWD_CORE wxTextCtrl; +class WXDLLIMPEXP_FWD_CORE wxImageList; class WXDLLIMPEXP_FWD_BASE wxHashTable; //----------------------------------------------------------------------------- @@ -39,23 +44,19 @@ enum wxDIRCTRL_DIR_ONLY = 0x0010, // When setting the default path, select the first file in the directory wxDIRCTRL_SELECT_FIRST = 0x0020, -#if WXWIN_COMPATIBILITY_2_8 - // Unused, for compatibility only + // Show the filter list wxDIRCTRL_SHOW_FILTERS = 0x0040, -#endif // WXWIN_COMPATIBILITY_2_8 // Use 3D borders on internal controls wxDIRCTRL_3D_INTERNAL = 0x0080, // Editable labels - wxDIRCTRL_EDIT_LABELS = 0x0100, - // Allow multiple selection - wxDIRCTRL_MULTIPLE = 0x0200 + wxDIRCTRL_EDIT_LABELS = 0x0100 }; //----------------------------------------------------------------------------- // wxDirItemData //----------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxDirItemData : public wxTreeItemData +class WXDLLEXPORT wxDirItemData : public wxTreeItemData { public: wxDirItemData(const wxString& path, const wxString& name, bool isDir); @@ -77,7 +78,7 @@ public: class WXDLLIMPEXP_FWD_CORE wxDirFilterListCtrl; -class WXDLLIMPEXP_CORE wxGenericDirCtrl: public wxControl +class WXDLLEXPORT wxGenericDirCtrl: public wxControl { public: wxGenericDirCtrl(); @@ -85,7 +86,7 @@ public: const wxString &dir = wxDirDialogDefaultFolderStr, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxDIRCTRL_3D_INTERNAL, + long style = wxDIRCTRL_3D_INTERNAL|wxSUNKEN_BORDER, const wxString& filter = wxEmptyString, int defaultFilter = 0, const wxString& name = wxTreeCtrlNameStr ) @@ -98,7 +99,7 @@ public: const wxString &dir = wxDirDialogDefaultFolderStr, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxDIRCTRL_3D_INTERNAL, + long style = wxDIRCTRL_3D_INTERNAL|wxSUNKEN_BORDER, const wxString& filter = wxEmptyString, int defaultFilter = 0, const wxString& name = wxTreeCtrlNameStr ); @@ -125,17 +126,12 @@ public: // Get dir or filename virtual wxString GetPath() const; - virtual void GetPaths(wxArrayString& paths) const; // Get selected filename path only (else empty string). // I.e. don't count a directory as a selection virtual wxString GetFilePath() const; - virtual void GetFilePaths(wxArrayString& paths) const; virtual void SetPath(const wxString& path); - virtual void SelectPath(const wxString& path, bool select = true); - virtual void SelectPaths(const wxArrayString& paths); - virtual void ShowHidden( bool show ); virtual bool GetShowHidden() { return m_showHidden; } @@ -150,11 +146,14 @@ public: virtual wxTreeCtrl* GetTreeCtrl() const { return m_treeCtrl; } virtual wxDirFilterListCtrl* GetFilterListCtrl() const { return m_filterListCtrl; } - virtual void UnselectAll(); - // Helper virtual void SetupSections(); +#if WXWIN_COMPATIBILITY_2_4 + // Parse the filter into an array of filters and an array of descriptions + virtual int ParseFilter(const wxString& filterStr, wxArrayString& filters, wxArrayString& descriptions); +#endif // WXWIN_COMPATIBILITY_2_4 + // Find the child that matches the first part of 'path'. // E.g. if a child path is "/usr" and 'path' is "/usr/include" // then the child for /usr is returned. @@ -170,9 +169,6 @@ public: // Collapse the entire tree virtual void CollapseTree(); - // overridden base class methods - virtual void SetFocus(); - protected: virtual void ExpandRoot(); virtual void ExpandDir(wxTreeItemId parentId); @@ -189,8 +185,6 @@ protected: bool ExtractWildcard(const wxString& filterStr, int n, wxString& filter, wxString& description); private: - void PopulateNode(wxTreeItemId node); - bool m_showHidden; wxTreeItemId m_rootId; wxString m_defaultPath; // Starting path @@ -204,14 +198,14 @@ private: private: DECLARE_EVENT_TABLE() DECLARE_DYNAMIC_CLASS(wxGenericDirCtrl) - wxDECLARE_NO_COPY_CLASS(wxGenericDirCtrl); + DECLARE_NO_COPY_CLASS(wxGenericDirCtrl) }; //----------------------------------------------------------------------------- // wxDirFilterListCtrl //----------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxDirFilterListCtrl: public wxChoice +class WXDLLEXPORT wxDirFilterListCtrl: public wxChoice { public: wxDirFilterListCtrl() { Init(); } @@ -244,7 +238,7 @@ protected: DECLARE_EVENT_TABLE() DECLARE_CLASS(wxDirFilterListCtrl) - wxDECLARE_NO_COPY_CLASS(wxDirFilterListCtrl); + DECLARE_NO_COPY_CLASS(wxDirFilterListCtrl) }; #if !defined(__WXMSW__) && !defined(__WXMAC__) && !defined(__WXPM__) @@ -261,11 +255,9 @@ protected: // wxFileIconsTable - use wxTheFileIconsTable which is created as necessary //------------------------------------------------------------------------- -#if wxUSE_DIRDLG || wxUSE_FILEDLG || wxUSE_FILECTRL +#if wxUSE_DIRDLG || wxUSE_FILEDLG -class WXDLLIMPEXP_FWD_CORE wxImageList; - -class WXDLLIMPEXP_CORE wxFileIconsTable +class WXDLLEXPORT wxFileIconsTable { public: wxFileIconsTable(); @@ -295,9 +287,9 @@ protected: }; // The global fileicons table -extern WXDLLIMPEXP_DATA_CORE(wxFileIconsTable *) wxTheFileIconsTable; +extern WXDLLEXPORT_DATA(wxFileIconsTable *) wxTheFileIconsTable; -#endif // wxUSE_DIRDLG || wxUSE_FILEDLG || wxUSE_FILECTRL +#endif // wxUSE_DIRDLG || wxUSE_FILEDLG #endif // _WX_DIRCTRLG_H_ diff --git a/Source/3rd Party/wx/include/wx/generic/dragimgg.h b/Source/3rd Party/wx/include/wx/generic/dragimgg.h index 201bafa14..79f2785ba 100644 --- a/Source/3rd Party/wx/include/wx/generic/dragimgg.h +++ b/Source/3rd Party/wx/include/wx/generic/dragimgg.h @@ -5,7 +5,7 @@ // Author: Julian Smart // Modified by: // Created: 29/2/2000 -// RCS-ID: $Id$ +// RCS-ID: $Id: dragimgg.h 42397 2006-10-25 12:12:56Z VS $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -88,7 +88,7 @@ * wxGenericDragImage */ -class WXDLLIMPEXP_CORE wxGenericDragImage: public wxObject +class WXDLLEXPORT wxGenericDragImage: public wxObject { public: @@ -157,14 +157,13 @@ public: // Attributes //////////////////////////////////////////////////////////////////////////// -#ifdef wxHAS_NATIVE_OVERLAY - // backing store is not used when native overlays are - void SetBackingBitmap(wxBitmap* WXUNUSED(bitmap)) { } -#else // For efficiency, tell wxGenericDragImage to use a bitmap that's already // created (e.g. from last drag) - void SetBackingBitmap(wxBitmap* bitmap) { m_pBackingBitmap = bitmap; } -#endif // wxHAS_NATIVE_OVERLAY/!wxHAS_NATIVE_OVERLAY + void SetBackingBitmap(wxBitmap* bitmap) { +#ifndef wxHAS_NATIVE_OVERLAY + m_pBackingBitmap = bitmap; +#endif + } // Operations //////////////////////////////////////////////////////////////////////////// @@ -193,7 +192,7 @@ public: // Begin drag. hotspot is the location of the drag position relative to the upper-left // corner of the image. - bool BeginDrag(const wxPoint& hotspot, wxWindow* window, bool fullScreen = false, wxRect* rect = NULL); + bool BeginDrag(const wxPoint& hotspot, wxWindow* window, bool fullScreen = false, wxRect* rect = (wxRect*) NULL); // Begin drag. hotspot is the location of the drag position relative to the upper-left // corner of the image. This is full screen only. fullScreenRect gives the @@ -265,7 +264,7 @@ protected: private: DECLARE_DYNAMIC_CLASS(wxGenericDragImage) - wxDECLARE_NO_COPY_CLASS(wxGenericDragImage); + DECLARE_NO_COPY_CLASS(wxGenericDragImage) }; #endif diff --git a/Source/3rd Party/wx/include/wx/generic/filectrlg.h b/Source/3rd Party/wx/include/wx/generic/filectrlg.h deleted file mode 100644 index 0f5735e45..000000000 --- a/Source/3rd Party/wx/include/wx/generic/filectrlg.h +++ /dev/null @@ -1,304 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/filectrlg.h -// Purpose: wxGenericFileCtrl Header -// Author: Diaa M. Sami -// Modified by: -// Created: Jul-07-2007 -// RCS-ID: $Id$ -// Copyright: (c) Diaa M. Sami -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GENERIC_FILECTRL_H_ -#define _WX_GENERIC_FILECTRL_H_ - -#if wxUSE_FILECTRL - -#include "wx/containr.h" -#include "wx/listctrl.h" -#include "wx/filectrl.h" -#include "wx/filename.h" - -class WXDLLIMPEXP_FWD_CORE wxCheckBox; -class WXDLLIMPEXP_FWD_CORE wxChoice; -class WXDLLIMPEXP_FWD_CORE wxStaticText; -class WXDLLIMPEXP_FWD_CORE wxTextCtrl; - -extern WXDLLIMPEXP_DATA_CORE(const char) wxFileSelectorDefaultWildcardStr[]; - -//----------------------------------------------------------------------------- -// wxFileData - a class to hold the file info for the wxFileListCtrl -//----------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxFileData -{ -public: - enum fileType - { - is_file = 0x0000, - is_dir = 0x0001, - is_link = 0x0002, - is_exe = 0x0004, - is_drive = 0x0008 - }; - - wxFileData() { Init(); } - // Full copy constructor - wxFileData( const wxFileData& fileData ) { Copy(fileData); } - // Create a filedata from this information - wxFileData( const wxString &filePath, const wxString &fileName, - fileType type, int image_id ); - - // make a full copy of the other wxFileData - void Copy( const wxFileData &other ); - - // (re)read the extra data about the file from the system - void ReadData(); - - // get the name of the file, dir, drive - wxString GetFileName() const { return m_fileName; } - // get the full path + name of the file, dir, path - wxString GetFilePath() const { return m_filePath; } - // Set the path + name and name of the item - void SetNewName( const wxString &filePath, const wxString &fileName ); - - // Get the size of the file in bytes - wxFileOffset GetSize() const { return m_size; } - // Get the type of file, either file extension or , , - wxString GetFileType() const; - // get the last modification time - wxDateTime GetDateTime() const { return m_dateTime; } - // Get the time as a formatted string - wxString GetModificationTime() const; - // in UNIX get rwx for file, in MSW get attributes ARHS - wxString GetPermissions() const { return m_permissions; } - // Get the id of the image used in a wxImageList - int GetImageId() const { return m_image; } - - bool IsFile() const { return !IsDir() && !IsLink() && !IsDrive(); } - bool IsDir() const { return (m_type & is_dir ) != 0; } - bool IsLink() const { return (m_type & is_link ) != 0; } - bool IsExe() const { return (m_type & is_exe ) != 0; } - bool IsDrive() const { return (m_type & is_drive) != 0; } - - // Get/Set the type of file, file/dir/drive/link - int GetType() const { return m_type; } - - // the wxFileListCtrl fields in report view - enum fileListFieldType - { - FileList_Name, - FileList_Size, - FileList_Type, - FileList_Time, -#if defined(__UNIX__) || defined(__WIN32__) - FileList_Perm, -#endif // defined(__UNIX__) || defined(__WIN32__) - FileList_Max - }; - - // Get the entry for report view of wxFileListCtrl - wxString GetEntry( fileListFieldType num ) const; - - // Get a string representation of the file info - wxString GetHint() const; - // initialize a wxListItem attributes - void MakeItem( wxListItem &item ); - - // operators - wxFileData& operator = (const wxFileData& fd) { Copy(fd); return *this; } - -protected: - wxString m_fileName; - wxString m_filePath; - wxFileOffset m_size; - wxDateTime m_dateTime; - wxString m_permissions; - int m_type; - int m_image; - -private: - void Init(); -}; - -//----------------------------------------------------------------------------- -// wxFileListCtrl -//----------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxFileListCtrl : public wxListCtrl -{ -public: - wxFileListCtrl(); - wxFileListCtrl( wxWindow *win, - wxWindowID id, - const wxString &wild, - bool showHidden, - const wxPoint &pos = wxDefaultPosition, - const wxSize &size = wxDefaultSize, - long style = wxLC_LIST, - const wxValidator &validator = wxDefaultValidator, - const wxString &name = wxT("filelist") ); - virtual ~wxFileListCtrl(); - - virtual void ChangeToListMode(); - virtual void ChangeToReportMode(); - virtual void ChangeToSmallIconMode(); - virtual void ShowHidden( bool show = true ); - bool GetShowHidden() const { return m_showHidden; } - - virtual long Add( wxFileData *fd, wxListItem &item ); - virtual void UpdateItem(const wxListItem &item); - virtual void UpdateFiles(); - virtual void MakeDir(); - virtual void GoToParentDir(); - virtual void GoToHomeDir(); - virtual void GoToDir( const wxString &dir ); - virtual void SetWild( const wxString &wild ); - wxString GetWild() const { return m_wild; } - wxString GetDir() const { return m_dirName; } - - void OnListDeleteItem( wxListEvent &event ); - void OnListDeleteAllItems( wxListEvent &event ); - void OnListEndLabelEdit( wxListEvent &event ); - void OnListColClick( wxListEvent &event ); - - virtual void SortItems(wxFileData::fileListFieldType field, bool forward); - bool GetSortDirection() const { return m_sort_forward; } - wxFileData::fileListFieldType GetSortField() const { return m_sort_field; } - -protected: - void FreeItemData(wxListItem& item); - void FreeAllItemsData(); - - wxString m_dirName; - bool m_showHidden; - wxString m_wild; - - bool m_sort_forward; - wxFileData::fileListFieldType m_sort_field; - -private: - DECLARE_DYNAMIC_CLASS(wxFileListCtrl) - DECLARE_EVENT_TABLE() -}; - -class WXDLLIMPEXP_CORE wxGenericFileCtrl : public wxNavigationEnabled, - public wxFileCtrlBase -{ -public: - wxGenericFileCtrl() - { - m_ignoreChanges = false; - } - - wxGenericFileCtrl ( wxWindow *parent, - wxWindowID id, - const wxString& defaultDirectory = wxEmptyString, - const wxString& defaultFilename = wxEmptyString, - const wxString& wildCard = wxFileSelectorDefaultWildcardStr, - long style = wxFC_DEFAULT_STYLE, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - const wxString& name = wxFileCtrlNameStr ) - { - m_ignoreChanges = false; - Create(parent, id, defaultDirectory, defaultFilename, wildCard, - style, pos, size, name ); - } - - virtual ~wxGenericFileCtrl() {} - - bool Create( wxWindow *parent, - wxWindowID id, - const wxString& defaultDirectory = wxEmptyString, - const wxString& defaultFileName = wxEmptyString, - const wxString& wildCard = wxFileSelectorDefaultWildcardStr, - long style = wxFC_DEFAULT_STYLE, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - const wxString& name = wxFileCtrlNameStr ); - - virtual void SetWildcard( const wxString& wildCard ); - virtual void SetFilterIndex( int filterindex ); - virtual bool SetDirectory( const wxString& dir ); - - // Selects a certain file. - // In case the filename specified isn't found/couldn't be shown with - // currently selected filter, false is returned and nothing happens - virtual bool SetFilename( const wxString& name ); - - // Changes to a certain directory and selects a certain file. - // In case the filename specified isn't found/couldn't be shown with - // currently selected filter, false is returned and if directory exists - // it's chdir'ed to - virtual bool SetPath( const wxString& path ); - - virtual wxString GetFilename() const; - virtual wxString GetDirectory() const; - virtual wxString GetWildcard() const { return this->m_wildCard; } - virtual wxString GetPath() const; - virtual void GetPaths( wxArrayString& paths ) const; - virtual void GetFilenames( wxArrayString& files ) const; - virtual int GetFilterIndex() const { return m_filterIndex; } - - virtual bool HasMultipleFileSelection() const - { return HasFlag(wxFC_MULTIPLE); } - virtual void ShowHidden(bool show) { m_list->ShowHidden( show ); } - - void GoToParentDir(); - void GoToHomeDir(); - - // get the directory currently shown in the control: this can be different - // from GetDirectory() if the user entered a full path (with a path other - // than the one currently shown in the control) in the text control - // manually - wxString GetShownDirectory() const { return m_list->GetDir(); } - - wxFileListCtrl *GetFileList() { return m_list; } - - void ChangeToReportMode() { m_list->ChangeToReportMode(); } - void ChangeToListMode() { m_list->ChangeToListMode(); } - - -private: - void OnChoiceFilter( wxCommandEvent &event ); - void OnCheck( wxCommandEvent &event ); - void OnActivated( wxListEvent &event ); - void OnTextEnter( wxCommandEvent &WXUNUSED( event ) ); - void OnTextChange( wxCommandEvent &WXUNUSED( event ) ); - void OnSelected( wxListEvent &event ); - void HandleAction( const wxString &fn ); - - void DoSetFilterIndex( int filterindex ); - void UpdateControls(); - - // the first of these methods can only be used for the controls with single - // selection (i.e. without wxFC_MULTIPLE style), the second one in any case - wxFileName DoGetFileName() const; - void DoGetFilenames( wxArrayString& filenames, bool fullPath ) const; - - int m_style; - - wxString m_filterExtension; - wxChoice *m_choice; - wxTextCtrl *m_text; - wxFileListCtrl *m_list; - wxCheckBox *m_check; - wxStaticText *m_static; - - wxString m_dir; - wxString m_fileName; - wxString m_wildCard; // wild card in one string as we got it - - int m_filterIndex; - bool m_inSelected; - bool m_ignoreChanges; - bool m_noSelChgEvent; // suppress selection changed events. - - DECLARE_DYNAMIC_CLASS( wxGenericFileCtrl ) - DECLARE_EVENT_TABLE() -}; - -#endif // wxUSE_FILECTRL - -#endif // _WX_GENERIC_FILECTRL_H_ diff --git a/Source/3rd Party/wx/include/wx/generic/filepickerg.h b/Source/3rd Party/wx/include/wx/generic/filepickerg.h index aec59350e..769d20b4a 100644 --- a/Source/3rd Party/wx/include/wx/generic/filepickerg.h +++ b/Source/3rd Party/wx/include/wx/generic/filepickerg.h @@ -5,7 +5,7 @@ // Modified by: // Created: 14/4/2006 // Copyright: (c) Francesco Montorsi -// RCS-ID: $Id$ +// RCS-ID: $Id: filepickerg.h 40100 2006-07-15 15:13:04Z VS $ // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// @@ -17,8 +17,8 @@ #include "wx/dirdlg.h" -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_DIRPICKER_CHANGED, wxFileDirPickerEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_FILEPICKER_CHANGED, wxFileDirPickerEvent ); +extern WXDLLEXPORT_DATA(const wxEventType) wxEVT_COMMAND_DIRPICKER_CHANGED; +extern WXDLLEXPORT_DATA(const wxEventType) wxEVT_COMMAND_FILEPICKER_CHANGED; //----------------------------------------------------------------------------- @@ -29,7 +29,7 @@ class WXDLLIMPEXP_CORE wxGenericFileDirButton : public wxButton, public wxFileDirPickerWidgetBase { public: - wxGenericFileDirButton() { Init(); } + wxGenericFileDirButton() { } wxGenericFileDirButton(wxWindow *parent, wxWindowID id, const wxString& label = wxFilePickerWidgetLabel, @@ -42,14 +42,15 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = wxFilePickerWidgetNameStr) { - Init(); Create(parent, id, label, path, message, wildcard, pos, size, style, validator, name); } + virtual ~wxGenericFileDirButton() {} + virtual wxControl *AsControl() { return this; } -public: // overridable +public: // overrideable virtual wxDialog *CreateDialog() = 0; @@ -58,8 +59,6 @@ public: // overridable virtual wxEventType GetEventType() const = 0; - virtual void SetInitialDirectory(const wxString& dir); - public: bool Create(wxWindow *parent, wxWindowID id, @@ -78,18 +77,6 @@ public: protected: wxString m_message, m_wildcard; - - // we just store the style passed to the ctor here instead of passing it to - // wxButton as some of our bits can conflict with wxButton styles and it - // just doesn't make sense to use picker styles for wxButton anyhow - long m_pickerStyle; - - // Initial directory set by SetInitialDirectory() call or empty. - wxString m_initialDir; - -private: - // common part of all ctors - void Init() { m_pickerStyle = -1; } }; @@ -119,33 +106,36 @@ public: pos, size, style, validator, name); } -public: // overridable +public: // overrideable virtual long GetDialogStyle() const { - // the derived class must initialize it if it doesn't use the - // non-default wxGenericFileDirButton ctor - wxASSERT_MSG( m_pickerStyle != -1, - "forgot to initialize m_pickerStyle?" ); - - long filedlgstyle = 0; - if ( m_pickerStyle & wxFLP_OPEN ) + if (this->HasFlag(wxFLP_OPEN)) filedlgstyle |= wxFD_OPEN; - if ( m_pickerStyle & wxFLP_SAVE ) + if (this->HasFlag(wxFLP_SAVE)) filedlgstyle |= wxFD_SAVE; - if ( m_pickerStyle & wxFLP_OVERWRITE_PROMPT ) + if (this->HasFlag(wxFLP_OVERWRITE_PROMPT)) filedlgstyle |= wxFD_OVERWRITE_PROMPT; - if ( m_pickerStyle & wxFLP_FILE_MUST_EXIST ) + if (this->HasFlag(wxFLP_FILE_MUST_EXIST)) filedlgstyle |= wxFD_FILE_MUST_EXIST; - if ( m_pickerStyle & wxFLP_CHANGE_DIR ) + if (this->HasFlag(wxFLP_CHANGE_DIR)) filedlgstyle |= wxFD_CHANGE_DIR; return filedlgstyle; } - virtual wxDialog *CreateDialog(); + virtual wxDialog *CreateDialog() + { + wxFileDialog *p = new wxFileDialog(GetDialogParent(), m_message, + wxEmptyString, wxEmptyString, + m_wildcard, GetDialogStyle()); + + // this sets both the default folder and the default file of the dialog + p->SetPath(m_path); + return p; + } wxEventType GetEventType() const { return wxEVT_COMMAND_FILEPICKER_CHANGED; } @@ -156,10 +146,6 @@ protected: void UpdatePathFromDialog(wxDialog *p) { m_path = wxStaticCast(p, wxFileDialog)->GetPath(); } - // Set the initial directory for the dialog but without overriding the - // directory of the currently selected file, if any. - void DoSetInitialDirectory(wxFileDialog* dialog, const wxString& dir); - private: DECLARE_DYNAMIC_CLASS(wxGenericFileButton) }; @@ -190,21 +176,25 @@ public: pos, size, style, validator, name); } -public: // overridable +public: // overrideable virtual long GetDialogStyle() const { long dirdlgstyle = wxDD_DEFAULT_STYLE; - if ( m_pickerStyle & wxDIRP_DIR_MUST_EXIST ) + if (this->HasFlag(wxDIRP_DIR_MUST_EXIST)) dirdlgstyle |= wxDD_DIR_MUST_EXIST; - if ( m_pickerStyle & wxDIRP_CHANGE_DIR ) + if (this->HasFlag(wxDIRP_CHANGE_DIR)) dirdlgstyle |= wxDD_CHANGE_DIR; return dirdlgstyle; } - virtual wxDialog *CreateDialog(); + virtual wxDialog *CreateDialog() + { + return new wxDirDialog(GetDialogParent(), m_message, m_path, + GetDialogStyle()); + } wxEventType GetEventType() const { return wxEVT_COMMAND_DIRPICKER_CHANGED; } diff --git a/Source/3rd Party/wx/include/wx/generic/fontpickerg.h b/Source/3rd Party/wx/include/wx/generic/fontpickerg.h index c31a0b014..cfa612aa9 100644 --- a/Source/3rd Party/wx/include/wx/generic/fontpickerg.h +++ b/Source/3rd Party/wx/include/wx/generic/fontpickerg.h @@ -5,7 +5,7 @@ // Modified by: // Created: 14/4/2006 // Copyright: (c) Francesco Montorsi -// RCS-ID: $Id$ +// RCS-ID: $Id: fontpickerg.h 42999 2006-11-03 21:54:13Z VZ $ // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// @@ -13,12 +13,15 @@ #define _WX_FONTPICKER_H_ #include "wx/button.h" -#include "wx/fontdata.h" +#include "wx/cmndata.h" //----------------------------------------------------------------------------- -// wxGenericFontButton: a button which brings up a wxFontDialog +// wxGenericFontButton: a button which brings up a wxColourDialog //----------------------------------------------------------------------------- +#define wxFONTBTN_DEFAULT_STYLE \ + (wxFNTP_FONTDESC_AS_LABEL | wxFNTP_USEFONT_FOR_LABEL) + class WXDLLIMPEXP_CORE wxGenericFontButton : public wxButton, public wxFontPickerWidgetBase { @@ -44,8 +47,8 @@ public: // API extensions specific for wxGenericFontButton // user can override this to init font data in a different way virtual void InitFontData(); - // returns the font data shown in wxFontDialog - wxFontData *GetFontData() { return &m_data; } + // returns the font data shown in wxColourDialog + wxFontData *GetFontData() { return &ms_data; } public: @@ -66,7 +69,10 @@ protected: void UpdateFont(); - wxFontData m_data; + // the colour data shown in wxColourPickerCtrlGeneric + // controls. This member is static so that all colour pickers + // in the program share the same set of custom colours. + static wxFontData ms_data; private: DECLARE_DYNAMIC_CLASS(wxGenericFontButton) diff --git a/Source/3rd Party/wx/include/wx/generic/fswatcher.h b/Source/3rd Party/wx/include/wx/generic/fswatcher.h deleted file mode 100644 index 9f16ab150..000000000 --- a/Source/3rd Party/wx/include/wx/generic/fswatcher.h +++ /dev/null @@ -1,26 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/fswatcher.h -// Purpose: wxPollingFileSystemWatcher -// Author: Bartosz Bekier -// Created: 2009-05-26 -// RCS-ID: $Id$ -// Copyright: (c) 2009 Bartosz Bekier -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FSWATCHER_GENERIC_H_ -#define _WX_FSWATCHER_GENERIC_H_ - -#include "wx/defs.h" - -#if wxUSE_FSWATCHER - -class WXDLLIMPEXP_BASE wxPollingFileSystemWatcher : public wxFileSystemWatcherBase -{ -public: - -}; - -#endif // wxUSE_FSWATCHER - -#endif /* _WX_FSWATCHER_GENERIC_H_ */ diff --git a/Source/3rd Party/wx/include/wx/generic/infobar.h b/Source/3rd Party/wx/include/wx/generic/infobar.h deleted file mode 100644 index 45f085b52..000000000 --- a/Source/3rd Party/wx/include/wx/generic/infobar.h +++ /dev/null @@ -1,133 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/infobar.h -// Purpose: generic wxInfoBar class declaration -// Author: Vadim Zeitlin -// Created: 2009-07-28 -// RCS-ID: $Id$ -// Copyright: (c) 2009 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GENERIC_INFOBAR_H_ -#define _WX_GENERIC_INFOBAR_H_ - -class WXDLLIMPEXP_FWD_CORE wxBitmapButton; -class WXDLLIMPEXP_FWD_CORE wxStaticBitmap; -class WXDLLIMPEXP_FWD_CORE wxStaticText; - -// ---------------------------------------------------------------------------- -// wxInfoBar -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxInfoBarGeneric : public wxInfoBarBase -{ -public: - // the usual ctors and Create() but remember that info bar is created - // hidden - wxInfoBarGeneric() { Init(); } - - wxInfoBarGeneric(wxWindow *parent, wxWindowID winid = wxID_ANY) - { - Init(); - Create(parent, winid); - } - - bool Create(wxWindow *parent, wxWindowID winid = wxID_ANY); - - - // implement base class methods - // ---------------------------- - - virtual void ShowMessage(const wxString& msg, - int flags = wxICON_INFORMATION); - - virtual void Dismiss(); - - virtual void AddButton(wxWindowID btnid, const wxString& label = wxString()); - - virtual void RemoveButton(wxWindowID btnid); - - // methods specific to this version - // -------------------------------- - - // set the effect(s) to use when showing/hiding the bar, may be - // wxSHOW_EFFECT_NONE to disable any effects entirely - // - // by default, slide to bottom/top is used when it's positioned on the top - // of the window for showing/hiding it and top/bottom when it's positioned - // at the bottom - void SetShowHideEffects(wxShowEffect showEffect, wxShowEffect hideEffect) - { - m_showEffect = showEffect; - m_hideEffect = hideEffect; - } - - // get effect used when showing/hiding the window - wxShowEffect GetShowEffect() const; - wxShowEffect GetHideEffect() const; - - // set the duration of animation used when showing/hiding the bar, in ms - void SetEffectDuration(int duration) { m_effectDuration = duration; } - - // get the currently used effect animation duration - int GetEffectDuration() const { return m_effectDuration; } - - - // overridden base class methods - // ----------------------------- - - // setting the font of this window sets it for the text control inside it - // (default font is a larger and bold version of the normal one) - virtual bool SetFont(const wxFont& font); - -protected: - // info bar shouldn't have any border by default, the colour difference - // between it and the main window separates it well enough - virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } - - - // update the parent to take our new or changed size into account (notably - // should be called when we're shown or hidden) - void UpdateParent(); - -private: - // common part of all ctors - void Init(); - - // handler for the close button - void OnButton(wxCommandEvent& event); - - // show/hide the bar - void DoShow(); - void DoHide(); - - // determine the placement of the bar from its position in the containing - // sizer - enum BarPlacement - { - BarPlacement_Top, - BarPlacement_Bottom, - BarPlacement_Unknown - }; - - BarPlacement GetBarPlacement() const; - - - // different controls making up the bar - wxStaticBitmap *m_icon; - wxStaticText *m_text; - wxBitmapButton *m_button; - - // the effects to use when showing/hiding and duration for them: by default - // the effect is determined by the info bar automatically depending on its - // position and the default duration is used - wxShowEffect m_showEffect, - m_hideEffect; - int m_effectDuration; - - DECLARE_EVENT_TABLE() - wxDECLARE_NO_COPY_CLASS(wxInfoBarGeneric); -}; - -#endif // _WX_GENERIC_INFOBAR_H_ - diff --git a/Source/3rd Party/wx/include/wx/generic/logg.h b/Source/3rd Party/wx/include/wx/generic/logg.h index 161f4f5c8..240b30fbd 100644 --- a/Source/3rd Party/wx/include/wx/generic/logg.h +++ b/Source/3rd Party/wx/include/wx/generic/logg.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 29/01/98 -// RCS-ID: $Id$ +// RCS-ID: $Id: logg.h 41020 2006-09-05 20:47:48Z VZ $ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -14,10 +14,6 @@ #if wxUSE_GUI -class WXDLLIMPEXP_FWD_CORE wxTextCtrl; -class WXDLLIMPEXP_FWD_CORE wxLogFrame; -class WXDLLIMPEXP_FWD_CORE wxWindow; - // ---------------------------------------------------------------------------- // the following log targets are only compiled in if the we're compiling the // GUI part (andnot just the base one) of the library, they're implemented in @@ -27,20 +23,20 @@ class WXDLLIMPEXP_FWD_CORE wxWindow; #if wxUSE_TEXTCTRL // log everything to a text window (GUI only of course) -class WXDLLIMPEXP_CORE wxLogTextCtrl : public wxLog +class WXDLLEXPORT wxLogTextCtrl : public wxLog { public: wxLogTextCtrl(wxTextCtrl *pTextCtrl); protected: // implement sink function - virtual void DoLogText(const wxString& msg); + virtual void DoLogString(const wxChar *szString, time_t t); private: // the control we use wxTextCtrl *m_pTextCtrl; - wxDECLARE_NO_COPY_CLASS(wxLogTextCtrl); + DECLARE_NO_COPY_CLASS(wxLogTextCtrl) }; #endif // wxUSE_TEXTCTRL @@ -51,7 +47,7 @@ private: #if wxUSE_LOGGUI -class WXDLLIMPEXP_CORE wxLogGui : public wxLog +class WXDLLEXPORT wxLogGui : public wxLog { public: // ctor @@ -61,22 +57,11 @@ public: virtual void Flush(); protected: - virtual void DoLogRecord(wxLogLevel level, - const wxString& msg, - const wxLogRecordInfo& info); - - // return the title to be used for the log dialog, depending on m_bErrors - // and m_bWarnings values - wxString GetTitle() const; - - // return the icon (one of wxICON_XXX constants) to be used for the dialog - // depending on m_bErrors/m_bWarnings - int GetSeverityIcon() const; + virtual void DoLog(wxLogLevel level, const wxChar *szString, time_t t); // empty everything void Clear(); - wxArrayString m_aMessages; // the log message texts wxArrayInt m_aSeverity; // one of wxLOG_XXX values wxArrayLong m_aTimes; // the time of each message @@ -84,19 +69,6 @@ protected: m_bWarnings, // any warnings? m_bHasMessages; // any messages at all? -private: - // this method is called to show a single log message, it uses - // wxMessageBox() by default - virtual void DoShowSingleLogMessage(const wxString& message, - const wxString& title, - int style); - - // this method is called to show multiple log messages, it uses wxLogDialog - virtual void DoShowMultipleLogMessages(const wxArrayString& messages, - const wxArrayInt& severities, - const wxArrayLong& times, - const wxString& title, - int style); }; #endif // wxUSE_LOGGUI @@ -104,17 +76,17 @@ private: // ---------------------------------------------------------------------------- // (background) log window: this class forwards all log messages to the log // target which was active when it was instantiated, but also collects them -// to the log window. This window has its own menu which allows the user to +// to the log window. This window has it's own menu which allows the user to // close it, clear the log contents or save it to the file. // ---------------------------------------------------------------------------- #if wxUSE_LOGWINDOW -class WXDLLIMPEXP_CORE wxLogWindow : public wxLogPassThrough +class WXDLLEXPORT wxLogWindow : public wxLogPassThrough { public: - wxLogWindow(wxWindow *pParent, // the parent frame (can be NULL) - const wxString& szTitle, // the title of the frame + wxLogWindow(wxWindow *pParent, // the parent frame (can be NULL) + const wxChar *szTitle, // the title of the frame bool bShow = true, // show window immediately? bool bPassToOld = true); // pass messages to the old target? @@ -140,12 +112,13 @@ public: virtual void OnFrameDelete(wxFrame *frame); protected: - virtual void DoLogTextAtLevel(wxLogLevel level, const wxString& msg); + virtual void DoLog(wxLogLevel level, const wxChar *szString, time_t t); + virtual void DoLogString(const wxChar *szString, time_t t); private: wxLogFrame *m_pLogFrame; // the log frame - wxDECLARE_NO_COPY_CLASS(wxLogWindow); + DECLARE_NO_COPY_CLASS(wxLogWindow) }; #endif // wxUSE_LOGWINDOW diff --git a/Source/3rd Party/wx/include/wx/generic/msgdlgg.h b/Source/3rd Party/wx/include/wx/generic/msgdlgg.h index 2088374bc..4776b106a 100644 --- a/Source/3rd Party/wx/include/wx/generic/msgdlgg.h +++ b/Source/3rd Party/wx/include/wx/generic/msgdlgg.h @@ -4,53 +4,41 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: msgdlgg.h 49765 2007-11-09 18:32:38Z DE $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifndef _WX_GENERIC_MSGDLGG_H_ -#define _WX_GENERIC_MSGDLGG_H_ +#ifndef __MSGDLGH_G__ +#define __MSGDLGH_G__ -class WXDLLIMPEXP_FWD_CORE wxSizer; +#include "wx/defs.h" +#include "wx/dialog.h" -class WXDLLIMPEXP_CORE wxGenericMessageDialog : public wxMessageDialogBase +// type is an 'or' (|) of wxOK, wxCANCEL, wxYES_NO +// Returns wxYES/NO/OK/CANCEL + +extern WXDLLEXPORT_DATA(const wxChar) wxMessageBoxCaptionStr[]; + +class WXDLLEXPORT wxGenericMessageDialog: public wxDialog, public wxMessageDialogBase { +DECLARE_DYNAMIC_CLASS(wxGenericMessageDialog) + public: - wxGenericMessageDialog(wxWindow *parent, - const wxString& message, - const wxString& caption = wxMessageBoxCaptionStr, - long style = wxOK|wxCENTRE, - const wxPoint& pos = wxDefaultPosition); - - virtual int ShowModal(); - -protected: - // Creates a message dialog taking any options that have been set after - // object creation into account such as custom labels. - void DoCreateMsgdialog(); + wxGenericMessageDialog(wxWindow *parent, const wxString& message, + const wxString& caption = wxMessageBoxCaptionStr, + long style = wxOK|wxCENTRE, const wxPoint& pos = wxDefaultPosition); void OnYes(wxCommandEvent& event); void OnNo(wxCommandEvent& event); - void OnHelp(wxCommandEvent& event); void OnCancel(wxCommandEvent& event); - // can be overridden to provide more contents to the dialog - virtual void AddMessageDialogCheckBox(wxSizer *WXUNUSED(sizer)) { } - virtual void AddMessageDialogDetails(wxSizer *WXUNUSED(sizer)) { } - private: - // Creates and returns a standard button sizer using the style of this - // dialog and the custom labels, if any. - // - // May return NULL on smart phone platforms not using buttons at all. - wxSizer *CreateMsgDlgButtonSizer(); - - wxPoint m_pos; - bool m_created; - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxGenericMessageDialog) }; -#endif // _WX_GENERIC_MSGDLGG_H_ +#if (!defined( __WXMSW__ ) && !defined( __WXMAC__) && !defined(__WXPM__) && !defined(__WXCOCOA__)) || defined(__WXUNIVERSAL__) +#define wxMessageDialog wxGenericMessageDialog +#endif + +#endif // __MSGDLGH_G__ diff --git a/Source/3rd Party/wx/include/wx/generic/notebook.h b/Source/3rd Party/wx/include/wx/generic/notebook.h index f330ca07e..5b96a204b 100644 --- a/Source/3rd Party/wx/include/wx/generic/notebook.h +++ b/Source/3rd Party/wx/include/wx/generic/notebook.h @@ -1,9 +1,9 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/notebook.h +// Name: notebook.h // Purpose: wxNotebook class (a.k.a. property sheet, tabbed dialog) // Author: Julian Smart // Modified by: -// RCS-ID: $Id$ +// RCS-ID: $Id: notebook.h 41738 2006-10-08 17:37:23Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -22,9 +22,9 @@ // ---------------------------------------------------------------------------- // fwd declarations -class WXDLLIMPEXP_FWD_CORE wxImageList; -class WXDLLIMPEXP_FWD_CORE wxWindow; -class WXDLLIMPEXP_FWD_CORE wxTabView; +class WXDLLEXPORT wxImageList; +class WXDLLEXPORT wxWindow; +class WXDLLEXPORT wxTabView; // ---------------------------------------------------------------------------- // wxNotebook @@ -56,15 +56,17 @@ public: // accessors // --------- - // Find the position of the wxNotebookPage, wxNOT_FOUND if not found. + // Find the position of the wxNotebookPage, -1 if not found. int FindPagePosition(wxNotebookPage* page) const; // set the currently selected page, return the index of the previously - // selected one (or wxNOT_FOUND on error) + // selected one (or -1 on error) // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events int SetSelection(size_t nPage); // cycle thru the tabs // void AdvanceSelection(bool bForward = true); + // get the currently selected page + int GetSelection() const { return m_nSelection; } // changes selected page without sending events int ChangeSelection(size_t nPage); @@ -107,13 +109,13 @@ public: wxNotebookPage *pPage, const wxString& strText, bool bSelect = false, - int imageId = NO_IMAGE); + int imageId = -1); // callbacks // --------- void OnSize(wxSizeEvent& event); void OnInternalIdle(); - void OnSelChange(wxBookCtrlEvent& event); + void OnSelChange(wxNotebookEvent& event); void OnSetFocus(wxFocusEvent& event); void OnNavigationKey(wxNavigationKeyEvent& event); @@ -147,6 +149,8 @@ protected: // helper functions void ChangePage(int nOldSel, int nSel); // change pages + int m_nSelection; // the current selection (-1 if none) + wxTabView* m_tabView; DECLARE_DYNAMIC_CLASS(wxNotebook) diff --git a/Source/3rd Party/wx/include/wx/generic/numdlgg.h b/Source/3rd Party/wx/include/wx/generic/numdlgg.h index 7a51f5a3e..cbebd0918 100644 --- a/Source/3rd Party/wx/include/wx/generic/numdlgg.h +++ b/Source/3rd Party/wx/include/wx/generic/numdlgg.h @@ -4,7 +4,7 @@ // Author: John Labenski // Modified by: // Created: 07.02.04 (extracted from textdlgg.cpp) -// RCS-ID: $Id$ +// RCS-ID: $Id: numdlgg.h 49563 2007-10-31 20:46:21Z VZ $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -28,7 +28,7 @@ // wxNumberEntryDialog: a dialog with spin control, [ok] and [cancel] buttons // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxNumberEntryDialog : public wxDialog +class WXDLLEXPORT wxNumberEntryDialog : public wxDialog { public: wxNumberEntryDialog(wxWindow *parent, @@ -57,22 +57,22 @@ protected: private: DECLARE_EVENT_TABLE() DECLARE_DYNAMIC_CLASS(wxNumberEntryDialog) - wxDECLARE_NO_COPY_CLASS(wxNumberEntryDialog); + DECLARE_NO_COPY_CLASS(wxNumberEntryDialog) }; // ---------------------------------------------------------------------------- // function to get a number from user // ---------------------------------------------------------------------------- -WXDLLIMPEXP_CORE long - wxGetNumberFromUser(const wxString& message, - const wxString& prompt, - const wxString& caption, - long value = 0, - long min = 0, - long max = 100, - wxWindow *parent = NULL, - const wxPoint& pos = wxDefaultPosition); +long WXDLLEXPORT +wxGetNumberFromUser(const wxString& message, + const wxString& prompt, + const wxString& caption, + long value = 0, + long min = 0, + long max = 100, + wxWindow *parent = (wxWindow *)NULL, + const wxPoint& pos = wxDefaultPosition); #endif // wxUSE_NUMBERDLG diff --git a/Source/3rd Party/wx/include/wx/generic/panelg.h b/Source/3rd Party/wx/include/wx/generic/panelg.h new file mode 100644 index 000000000..f211a995c --- /dev/null +++ b/Source/3rd Party/wx/include/wx/generic/panelg.h @@ -0,0 +1,95 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/panelg.h +// Purpose: wxPanel: a container for child controls +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: panelg.h 49563 2007-10-31 20:46:21Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_PANEL_H_ +#define _WX_GENERIC_PANEL_H_ + +// ---------------------------------------------------------------------------- +// headers and forward declarations +// ---------------------------------------------------------------------------- + +#include "wx/window.h" +#include "wx/containr.h" + +class WXDLLIMPEXP_FWD_CORE wxControlContainer; + +extern WXDLLEXPORT_DATA(const wxChar) wxPanelNameStr[]; + +// ---------------------------------------------------------------------------- +// wxPanel contains other controls and implements TAB traversal between them +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxPanel : public wxWindow +{ +public: + wxPanel() { Init(); } + + // Old-style constructor (no default values for coordinates to avoid + // ambiguity with the new one) + wxPanel(wxWindow *parent, + int x, int y, int width, int height, + long style = wxTAB_TRAVERSAL | wxNO_BORDER, + const wxString& name = wxPanelNameStr) + { + Init(); + + Create(parent, wxID_ANY, wxPoint(x, y), wxSize(width, height), style, name); + } + + // Constructor + wxPanel(wxWindow *parent, + wxWindowID winid = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTAB_TRAVERSAL | wxNO_BORDER, + const wxString& name = wxPanelNameStr) + { + Init(); + + Create(parent, winid, pos, size, style, name); + } + + // Pseudo ctor + bool Create(wxWindow *parent, + wxWindowID winid = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTAB_TRAVERSAL | wxNO_BORDER, + const wxString& name = wxPanelNameStr); + + virtual ~wxPanel(); + + // implementation from now on + // -------------------------- + + // calls layout for layout constraints and sizers + void OnSize(wxSizeEvent& event); + + virtual void InitDialog(); + +#ifdef __WXUNIVERSAL__ + virtual bool IsCanvasWindow() const { return true; } +#endif + + + WX_DECLARE_CONTROL_CONTAINER(); + +protected: + // common part of all ctors + void Init(); + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxPanel) + DECLARE_EVENT_TABLE() +}; + +#endif + // _WX_GENERIC_PANEL_H_ diff --git a/Source/3rd Party/wx/include/wx/generic/private/markuptext.h b/Source/3rd Party/wx/include/wx/generic/private/markuptext.h deleted file mode 100644 index 146b1a16a..000000000 --- a/Source/3rd Party/wx/include/wx/generic/private/markuptext.h +++ /dev/null @@ -1,78 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/private/markuptext.h -// Purpose: Generic wxMarkupText class for managing text with markup. -// Author: Vadim Zeitlin -// Created: 2011-02-21 -// RCS-ID: $Id: wxhead.h,v 1.12 2010-04-22 12:44:51 zeitlin Exp $ -// Copyright: (c) 2011 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GENERIC_PRIVATE_MARKUPTEXT_H_ -#define _WX_GENERIC_PRIVATE_MARKUPTEXT_H_ - -#include "wx/defs.h" - -class WXDLLIMPEXP_FWD_CORE wxDC; -class WXDLLIMPEXP_FWD_CORE wxRect; - -// ---------------------------------------------------------------------------- -// wxMarkupText: allows to measure and draw the text containing markup. -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxMarkupText -{ -public: - // Constants for Render() flags. - enum - { - Render_Default = 0, // Don't show mnemonics visually. - Render_ShowAccels = 1 // Underline mnemonics. - }; - - - // Initialize with the given string containing markup (which is supposed to - // be valid, the caller must check for it before constructing this object). - // - // Notice that the usual rules for mnemonics apply to the markup text: if - // it contains any '&' characters they must be escaped by doubling them, - // otherwise they indicate that the next character is the mnemonic for this - // field. - // - // TODO-MULTILINE-MARKUP: Currently only single line labels are supported, - // search for other occurrences of this comment to find the places which - // need to be updated to support multiline labels with markup. - wxMarkupText(const wxString& markup) - : m_markup(markup) - { - } - - // Default copy ctor, assignment operator and dtor are ok. - - // Update the markup string. - // - // The same rules for mnemonics as in the ctor apply to this string. - void SetMarkup(const wxString& markup) { m_markup = markup; } - - - // Return the width and height required by the given string and optionally - // the height of the visible part above the baseline (i.e. ascent minus - // internal leading). - // - // The font currently selected into the DC is used for measuring (notice - // that it is changed by this function but normally -- i.e. if markup is - // valid -- restored to its original value when it returns). - wxSize Measure(wxDC& dc, int *visibleHeight = NULL) const; - - // Render the markup string into the given DC in the specified rectangle. - // - // Notice that while the function uses the provided rectangle for alignment - // (it centers the text in it), no clipping is done by it so use Measure() - // and set the clipping region before rendering if necessary. - void Render(wxDC& dc, const wxRect& rect, int flags); - -private: - wxString m_markup; -}; - -#endif // _WX_GENERIC_PRIVATE_MARKUPTEXT_H_ diff --git a/Source/3rd Party/wx/include/wx/generic/prntdlgg.h b/Source/3rd Party/wx/include/wx/generic/prntdlgg.h index f43b05b88..ef57d47cc 100644 --- a/Source/3rd Party/wx/include/wx/generic/prntdlgg.h +++ b/Source/3rd Party/wx/include/wx/generic/prntdlgg.h @@ -1,11 +1,11 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/prntdlgg.h +// Name: prntdlgg.h // Purpose: wxGenericPrintDialog, wxGenericPrintSetupDialog, // wxGenericPageSetupDialog // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: prntdlgg.h 49804 2007-11-10 01:09:42Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -23,7 +23,6 @@ #include "wx/printdlg.h" #include "wx/listctrl.h" -#include "wx/dc.h" #if wxUSE_POSTSCRIPT #include "wx/dcps.h" #endif @@ -34,7 +33,7 @@ class WXDLLIMPEXP_FWD_CORE wxCheckBox; class WXDLLIMPEXP_FWD_CORE wxComboBox; class WXDLLIMPEXP_FWD_CORE wxStaticText; class WXDLLIMPEXP_FWD_CORE wxRadioBox; -class WXDLLIMPEXP_FWD_CORE wxPageSetupDialogData; +class WXDLLIMPEXP_FWD_CORE wxPageSetupData; // ---------------------------------------------------------------------------- // constants @@ -78,7 +77,7 @@ enum // wxPostScriptNativeData //---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxPostScriptPrintNativeData: public wxPrintNativeDataBase +class WXDLLEXPORT wxPostScriptPrintNativeData: public wxPrintNativeDataBase { public: wxPostScriptPrintNativeData(); @@ -137,11 +136,11 @@ private: // Windows using PostScript print/preview) // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxGenericPrintDialog : public wxPrintDialogBase +class WXDLLEXPORT wxGenericPrintDialog : public wxPrintDialogBase { public: wxGenericPrintDialog(wxWindow *parent, - wxPrintDialogData* data = NULL); + wxPrintDialogData* data = (wxPrintDialogData*)NULL); wxGenericPrintDialog(wxWindow *parent, wxPrintData* data); virtual ~wxGenericPrintDialog(); @@ -182,7 +181,7 @@ private: DECLARE_DYNAMIC_CLASS(wxGenericPrintDialog) }; -class WXDLLIMPEXP_CORE wxGenericPrintSetupDialog : public wxDialog +class WXDLLEXPORT wxGenericPrintSetupDialog : public wxDialog { public: // There are no configuration options for the dialog, so we @@ -220,7 +219,7 @@ private: #endif // wxUSE_POSTSCRIPT -class WXDLLIMPEXP_CORE wxGenericPageSetupDialog : public wxPageSetupDialogBase +class WXDLLEXPORT wxGenericPageSetupDialog : public wxPageSetupDialogBase { public: wxGenericPageSetupDialog(wxWindow *parent = NULL, diff --git a/Source/3rd Party/wx/include/wx/generic/progdlgg.h b/Source/3rd Party/wx/include/wx/generic/progdlgg.h index 4a36eb08e..6382d1fc8 100644 --- a/Source/3rd Party/wx/include/wx/generic/progdlgg.h +++ b/Source/3rd Party/wx/include/wx/generic/progdlgg.h @@ -1,197 +1,132 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/progdlgg.h -// Purpose: wxGenericProgressDialog class +//////////////////////////////////////////////////// +// Name: progdlgg.h +// Purpose: wxProgressDialog class // Author: Karsten Ballueder -// Modified by: Francesco Montorsi +// Modified by: // Created: 09.05.1999 -// RCS-ID: $Id$ +// RCS-ID: $Id: progdlgg.h 50711 2007-12-15 02:57:58Z VZ $ // Copyright: (c) Karsten Ballueder // Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////// #ifndef __PROGDLGH_G__ #define __PROGDLGH_G__ +#include "wx/defs.h" +#include "wx/progdlg.h" + +#if wxUSE_PROGRESSDLG + #include "wx/dialog.h" class WXDLLIMPEXP_FWD_CORE wxButton; -class WXDLLIMPEXP_FWD_CORE wxEventLoop; class WXDLLIMPEXP_FWD_CORE wxGauge; class WXDLLIMPEXP_FWD_CORE wxStaticText; -class WXDLLIMPEXP_FWD_CORE wxWindowDisabler; -/* - Progress dialog which shows a moving progress bar. - Taken from the Mahogany project. -*/ -class WXDLLIMPEXP_CORE wxGenericProgressDialog : public wxDialog +/* Progress dialog which shows a moving progress bar. + Taken from the Mahogany project.*/ + +class WXDLLEXPORT wxProgressDialog : public wxDialog { +DECLARE_DYNAMIC_CLASS(wxProgressDialog) public: - wxGenericProgressDialog(); - wxGenericProgressDialog(const wxString& title, const wxString& message, - int maximum = 100, - wxWindow *parent = NULL, - int style = wxPD_APP_MODAL | wxPD_AUTO_HIDE); + /* Creates and displays dialog, disables event handling for other + frames or parent frame to avoid recursion problems. + @param title title for window + @param message message to display in window + @param maximum value for status bar, if <= 0, no bar is shown + @param parent window or NULL + @param style is the bit mask of wxPD_XXX constants from wx/defs.h + */ + wxProgressDialog(const wxString &title, wxString const &message, + int maximum = 100, + wxWindow *parent = NULL, + int style = wxPD_APP_MODAL | wxPD_AUTO_HIDE); + /* Destructor. + Re-enables event handling for other windows. + */ + virtual ~wxProgressDialog(); - virtual ~wxGenericProgressDialog(); + /* Update the status bar to the new value. + @param value new value + @param newmsg if used, new message to display + @returns true if ABORT button has not been pressed + */ + virtual bool Update(int value, const wxString& newmsg = wxEmptyString, bool *skip = NULL); - bool Create(const wxString& title, - const wxString& message, - int maximum = 100, - wxWindow *parent = NULL, - int style = wxPD_APP_MODAL | wxPD_AUTO_HIDE); - - virtual bool Update(int value, const wxString& newmsg = wxEmptyString, bool *skip = NULL); + /* Switches the dialog to use a gauge in indeterminate mode and calls + wxGauge::Pulse() to show to the user a bit of progress */ virtual bool Pulse(const wxString& newmsg = wxEmptyString, bool *skip = NULL); - void Resume(); - - int GetValue() const; - int GetRange() const; - wxString GetMessage() const; - - void SetRange(int maximum); - - // Return whether "Cancel" or "Skip" button was pressed, always return - // false if the corresponding button is not shown. - bool WasCancelled() const; - bool WasSkipped() const; - // Must provide overload to avoid hiding it (and warnings about it) virtual void Update() { wxDialog::Update(); } - virtual bool Show( bool show = true ); + /* Can be called to continue after the cancel button has been pressed, but + the program decided to continue the operation (e.g., user didn't + confirm it) + */ + void Resume(); - // This enum is an implementation detail and should not be used - // by user code. - enum State + virtual bool Show( bool show = true ); + +protected: + // callback for optional abort button + void OnCancel(wxCommandEvent& event); + + // callback for optional skip button + void OnSkip(wxCommandEvent& event); + + // callback to disable "hard" window closing + void OnClose(wxCloseEvent& event); + + // must be called to reenable the other windows temporarily disabled while + // the dialog was shown + void ReenableOtherWindows(); + +private: + // create the label with given text and another one to show the time nearby + // as the next windows in the sizer, returns the created control + wxStaticText *CreateLabel(const wxString& text, wxSizer *sizer); + + // updates the label message + void UpdateMessage(const wxString &newmsg); + + // common part of Update() and Pulse(), returns true if not cancelled + bool DoAfterUpdate(bool *skip); + + // shortcuts for enabling buttons + void EnableClose(); + void EnableSkip(bool enable=true); + void EnableAbort(bool enable=true); + inline void DisableSkip() { EnableSkip(false); } + inline void DisableAbort() { EnableAbort(false); } + + // the status bar + wxGauge *m_gauge; + // the message displayed + wxStaticText *m_msg; + // displayed elapsed, estimated, remaining time + class wxStaticText *m_elapsed, + *m_estimated, + *m_remaining; + // time when the dialog was created + unsigned long m_timeStart; + // time when the dialog was closed or cancelled + unsigned long m_timeStop; + // time between the moment the dialog was closed/cancelled and resume + unsigned long m_break; + + // parent top level window (may be NULL) + wxWindow *m_parentTop; + + // continue processing or not (return value for Update()) + enum { Uncancelable = -1, // dialog can't be canceled Canceled, // can be cancelled and, in fact, was Continue, // can be cancelled but wasn't - Finished, // finished, waiting to be removed from screen - Dismissed // was closed by user after finishing - }; - -protected: - // Update just the m_maximum field, this is used by public SetRange() but, - // unlike it, doesn't update the controls state. This makes it useful for - // both this class and its derived classes that don't use m_gauge to - // display progress. - void SetMaximum(int maximum); - - // Return the labels to use for showing the elapsed/estimated/remaining - // times respectively. - static wxString GetElapsedLabel() { return wxGetTranslation("Elapsed time:"); } - static wxString GetEstimatedLabel() { return wxGetTranslation("Estimated time:"); } - static wxString GetRemainingLabel() { return wxGetTranslation("Remaining time:"); } - - - // Similar to wxWindow::HasFlag() but tests for a presence of a wxPD_XXX - // flag in our (separate) flags instead of using m_windowStyle. - bool HasPDFlag(int flag) const { return (m_pdStyle & flag) != 0; } - - // Return the progress dialog style. Prefer to use HasPDFlag() if possible. - int GetPDStyle() const { return m_pdStyle; } - void SetPDStyle(int pdStyle) { m_pdStyle = pdStyle; } - - // Updates estimated times from a given progress bar value and stores the - // results in provided arguments. - void UpdateTimeEstimates(int value, - unsigned long &elapsedTime, - unsigned long &estimatedTime, - unsigned long &remainingTime); - - // Converts seconds to HH:mm:ss format. - static wxString GetFormattedTime(unsigned long timeInSec); - - // callback for optional abort button - void OnCancel(wxCommandEvent&); - - // callback for optional skip button - void OnSkip(wxCommandEvent&); - - // callback to disable "hard" window closing - void OnClose(wxCloseEvent&); - - // called to disable the other windows while this dialog is shown - void DisableOtherWindows(); - - // must be called to reenable the other windows temporarily disabled while - // the dialog was shown - void ReenableOtherWindows(); - - // Set the top level parent we store from the parent window provided when - // creating the dialog. - void SetTopParent(wxWindow* parent); - - // return the top level parent window of this dialog (may be NULL) - wxWindow *GetTopParent() const { return m_parentTop; } - - - // continue processing or not (return value for Update()) - State m_state; - - // the maximum value - int m_maximum; - -#if defined(__WXMSW__ ) || defined(__WXPM__) - // the factor we use to always keep the value in 16 bit range as the native - // control only supports ranges from 0 to 65,535 - size_t m_factor; -#endif // __WXMSW__ - - // time when the dialog was created - unsigned long m_timeStart; - // time when the dialog was closed or cancelled - unsigned long m_timeStop; - // time between the moment the dialog was closed/cancelled and resume - unsigned long m_break; - -private: - // update the label to show the given time (in seconds) - static void SetTimeLabel(unsigned long val, wxStaticText *label); - - // common part of all ctors - void Init(); - - // create the label with given text and another one to show the time nearby - // as the next windows in the sizer, returns the created control - wxStaticText *CreateLabel(const wxString& text, wxSizer *sizer); - - // updates the label message - void UpdateMessage(const wxString &newmsg); - - // common part of Update() and Pulse(), returns true if not cancelled - bool DoBeforeUpdate(bool *skip); - - // common part of Update() and Pulse() - void DoAfterUpdate(); - - // shortcuts for enabling buttons - void EnableClose(); - void EnableSkip(bool enable = true); - void EnableAbort(bool enable = true); - void DisableSkip() { EnableSkip(false); } - void DisableAbort() { EnableAbort(false); } - - // the widget displaying current status (may be NULL) - wxGauge *m_gauge; - // the message displayed - wxStaticText *m_msg; - // displayed elapsed, estimated, remaining time - wxStaticText *m_elapsed, - *m_estimated, - *m_remaining; - - // parent top level window (may be NULL) - wxWindow *m_parentTop; - - // Progress dialog styles: this is not the same as m_windowStyle because - // wxPD_XXX constants clash with the existing TLW styles so to be sure we - // don't have any conflicts we just use a separate variable for storing - // them. - int m_pdStyle; + Finished // finished, waiting to be removed from screen + } m_state; // skip some portion bool m_skip; @@ -202,29 +137,36 @@ private: wxButton *m_btnSkip; #endif + // the maximum value + int m_maximum; + // saves the time when elapsed time was updated so there is only one // update per second unsigned long m_last_timeupdate; - // tells how often a change of the estimated time has to be confirmed - // before it is actually displayed - this reduces the frequency of updates + // before it is actually displayed - this reduces the frequence of updates // of estimated and remaining time - int m_delay; - + const int m_delay; // counts the confirmations int m_ctdelay; unsigned long m_display_estimated; + bool m_hasAbortButton, + m_hasSkipButton; + +#if defined(__WXMSW__ ) || defined(__WXPM__) + // the factor we use to always keep the value in 16 bit range as the native + // control only supports ranges from 0 to 65,535 + size_t m_factor; +#endif // __WXMSW__ + // for wxPD_APP_MODAL case - wxWindowDisabler *m_winDisabler; - - // Temporary event loop created by the dialog itself if there is no - // currently active loop when it is created. - wxEventLoop *m_tempEventLoop; - + class WXDLLIMPEXP_FWD_CORE wxWindowDisabler *m_winDisabler; DECLARE_EVENT_TABLE() - wxDECLARE_NO_COPY_CLASS(wxGenericProgressDialog); + DECLARE_NO_COPY_CLASS(wxProgressDialog) }; +#endif // wxUSE_PROGRESSDLG + #endif // __PROGDLGH_G__ diff --git a/Source/3rd Party/wx/include/wx/generic/richmsgdlgg.h b/Source/3rd Party/wx/include/wx/generic/richmsgdlgg.h deleted file mode 100644 index c39642d88..000000000 --- a/Source/3rd Party/wx/include/wx/generic/richmsgdlgg.h +++ /dev/null @@ -1,49 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/richmsgdlgg.h -// Purpose: wxGenericRichMessageDialog -// Author: Rickard Westerlund -// Created: 2010-07-04 -// RCS-ID: $Id$ -// Copyright: (c) 2010 wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GENERIC_RICHMSGDLGG_H_ -#define _WX_GENERIC_RICHMSGDLGG_H_ - -class WXDLLIMPEXP_FWD_CORE wxCheckBox; -class WXDLLIMPEXP_FWD_CORE wxCollapsiblePane; -class WXDLLIMPEXP_FWD_CORE wxCollapsiblePaneEvent; - -class WXDLLIMPEXP_CORE wxGenericRichMessageDialog - : public wxRichMessageDialogBase -{ -public: - wxGenericRichMessageDialog(wxWindow *parent, - const wxString& message, - const wxString& caption, - long style) - : wxRichMessageDialogBase( parent, message, caption, style ), - m_checkBox(NULL), - m_detailsPane(NULL) - { } - - virtual bool IsCheckBoxChecked() const; - -protected: - wxCheckBox *m_checkBox; - wxCollapsiblePane *m_detailsPane; - - // overrides methods in the base class - virtual void AddMessageDialogCheckBox(wxSizer *sizer); - virtual void AddMessageDialogDetails(wxSizer *sizer); - -private: - void OnPaneChanged(wxCollapsiblePaneEvent& event); - - DECLARE_EVENT_TABLE() - - wxDECLARE_NO_COPY_CLASS(wxGenericRichMessageDialog); -}; - -#endif // _WX_GENERIC_RICHMSGDLGG_H_ diff --git a/Source/3rd Party/wx/include/wx/generic/scrolwin.h b/Source/3rd Party/wx/include/wx/generic/scrolwin.h index 07e529c1b..b1cea5de7 100644 --- a/Source/3rd Party/wx/include/wx/generic/scrolwin.h +++ b/Source/3rd Party/wx/include/wx/generic/scrolwin.h @@ -1,10 +1,11 @@ ///////////////////////////////////////////////////////////////////////////// // Name: wx/generic/scrolwin.h -// Purpose: generic wxScrollHelper -// Author: Vadim Zeitlin -// Created: 2008-12-24 (replacing old file with the same name) -// RCS-ID: $Id$ -// Copyright: (c) 2008 Vadim Zeitlin +// Purpose: wxGenericScrolledWindow class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: scrolwin.h 35875 2005-10-10 18:24:27Z VZ $ +// Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -12,42 +13,15 @@ #define _WX_GENERIC_SCROLLWIN_H_ // ---------------------------------------------------------------------------- -// generic wxScrollHelper implementation +// headers and constants // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxScrollHelper : public wxScrollHelperBase -{ -public: - wxScrollHelper(wxWindow *winToScroll); +#include "wx/window.h" +#include "wx/panel.h" - // implement base class pure virtuals - virtual void AdjustScrollbars(); - -protected: - virtual void DoScroll(int x, int y); - virtual void DoShowScrollbars(wxScrollbarVisibility horz, - wxScrollbarVisibility vert); - -private: - // helper of AdjustScrollbars(): does the work for the single scrollbar - // - // notice that the parameters passed by non-const references are modified - // by this function - void DoAdjustScrollbar(int orient, - int clientSize, - int virtSize, - int pixelsPerUnit, - int& scrollUnits, - int& scrollPosition, - int& scrollLinesPerPage, - wxScrollbarVisibility visibility); - - - wxScrollbarVisibility m_xVisibility, - m_yVisibility; - - wxDECLARE_NO_COPY_CLASS(wxScrollHelper); -}; +// ---------------------------------------------------------------------------- +// wxGenericScrolledWindow +// ---------------------------------------------------------------------------- #endif // _WX_GENERIC_SCROLLWIN_H_ diff --git a/Source/3rd Party/wx/include/wx/generic/spinctlg.h b/Source/3rd Party/wx/include/wx/generic/spinctlg.h index 2df3e94bc..59a62d6a4 100644 --- a/Source/3rd Party/wx/include/wx/generic/spinctlg.h +++ b/Source/3rd Party/wx/include/wx/generic/spinctlg.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 28.10.99 -// RCS-ID: $Id$ +// RCS-ID: $Id: spinctlg.h 61872 2009-09-09 22:37:05Z VZ $ // Copyright: (c) Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -22,248 +22,108 @@ #if wxUSE_SPINBTN -class WXDLLIMPEXP_FWD_CORE wxSpinButton; -class WXDLLIMPEXP_FWD_CORE wxTextCtrl; - -class wxSpinCtrlTextGeneric; // wxTextCtrl used for the wxSpinCtrlGenericBase - -// The !wxUSE_SPINBTN version's GetValue() function conflicts with the -// wxTextCtrl's GetValue() and so you have to input a dummy int value. -#define wxSPINCTRL_GETVALUE_FIX +class WXDLLEXPORT wxSpinButton; +class WXDLLEXPORT wxTextCtrl; // ---------------------------------------------------------------------------- -// wxSpinCtrlGeneric is a combination of wxTextCtrl and wxSpinButton -// -// This class manages a double valued generic spinctrl through the DoGet/SetXXX -// functions that are made public as Get/SetXXX functions for int or double -// for the wxSpinCtrl and wxSpinCtrlDouble classes respectively to avoid -// function ambiguity. +// wxSpinCtrl is a combination of wxTextCtrl and wxSpinButton // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxSpinCtrlGenericBase : public wxSpinCtrlBase +class WXDLLEXPORT wxSpinCtrl : public wxControl { public: - wxSpinCtrlGenericBase() { Init(); } + wxSpinCtrl() { Init(); } + + wxSpinCtrl(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSP_ARROW_KEYS, + int min = 0, int max = 100, int initial = 0, + const wxString& name = wxT("wxSpinCtrl")) + { + Init(); + Create(parent, id, value, pos, size, style, min, max, initial, name); + } bool Create(wxWindow *parent, wxWindowID id = wxID_ANY, const wxString& value = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxSP_ARROW_KEYS | wxALIGN_RIGHT, - double min = 0, double max = 100, double initial = 0, - double inc = 1, + long style = wxSP_ARROW_KEYS, + int min = 0, int max = 100, int initial = 0, const wxString& name = wxT("wxSpinCtrl")); - virtual ~wxSpinCtrlGenericBase(); - - // accessors - // T GetValue() const - // T GetMin() const - // T GetMax() const - // T GetIncrement() const - virtual bool GetSnapToTicks() const { return m_snap_to_ticks; } - // unsigned GetDigits() const - wxSpinCtrlDouble only + virtual ~wxSpinCtrl(); // operations - virtual void SetValue(const wxString& text); - // void SetValue(T val) - // void SetRange(T minVal, T maxVal) - // void SetIncrement(T inc) - virtual void SetSnapToTicks(bool snap_to_ticks); - // void SetDigits(unsigned digits) - wxSpinCtrlDouble only - - // Select text in the textctrl + void SetValue(int val); + void SetValue(const wxString& text); + void SetRange(int min, int max); void SetSelection(long from, long to); + // accessors + int GetValue() const; + int GetMin() const; + int GetMax() const; + // implementation from now on // forward these functions to all subcontrols virtual bool Enable(bool enable = true); virtual bool Show(bool show = true); -#if wxUSE_TOOLTIPS - virtual void DoSetToolTip(wxToolTip *tip); -#endif // wxUSE_TOOLTIPS + virtual bool Reparent(wxWindow *newParent); // get the subcontrols - wxTextCtrl *GetText() const { return m_textCtrl; } - wxSpinButton *GetSpinButton() const { return m_spinButton; } + wxTextCtrl *GetText() const { return m_text; } + wxSpinButton *GetSpinButton() const { return m_btn; } - // forwarded events from children windows - void OnSpinButton(wxSpinEvent& event); - void OnTextLostFocus(wxFocusEvent& event); - void OnTextChar(wxKeyEvent& event); + // set the value of the text (only) + void SetTextValue(int val); - // this window itself is used only as a container for its sub windows so it - // shouldn't accept the focus at all and any attempts to explicitly set - // focus to it should give focus to its text constol part - virtual bool AcceptsFocus() const { return false; } - virtual void SetFocus(); - - friend class wxSpinCtrlTextGeneric; + // put the numeric value of the string in the text ctrl into val and return + // true or return false if the text ctrl doesn't contain a number or if the + // number is out of range + bool GetTextValue(int *val) const; protected: // override the base class virtuals involved into geometry calculations virtual wxSize DoGetBestSize() const; virtual void DoMoveWindow(int x, int y, int width, int height); -#ifdef __WXMSW__ - // and, for MSW, enabling this window itself - virtual void DoEnable(bool enable); -#endif // __WXMSW__ - - // generic double valued functions - double DoGetValue() const { return m_value; } - bool DoSetValue(double val); - void DoSetRange(double min_val, double max_val); - void DoSetIncrement(double inc); - - // update our value to reflect the text control contents (if it has been - // modified by user, do nothing otherwise) - // - // can also change the text control if its value is invalid - // - // return true if our value has changed - bool SyncSpinToText(); - - // Send the correct event type - virtual void DoSendEvent() = 0; - - // check if the value is in range - bool InRange(double n) const { return (n >= m_min) && (n <= m_max); } - - // ensure that the value is in range wrapping it round if necessary - double AdjustToFitInRange(double value) const; - - - double m_value; - double m_min; - double m_max; - double m_increment; - bool m_snap_to_ticks; - wxString m_format; - - int m_spin_value; - - // the subcontrols - wxTextCtrl *m_textCtrl; - wxSpinButton *m_spinButton; - -private: // common part of all ctors void Init(); - DECLARE_EVENT_TABLE() +private: + // the subcontrols + wxTextCtrl *m_text; + wxSpinButton *m_btn; + +private: + DECLARE_DYNAMIC_CLASS(wxSpinCtrl) }; #else // !wxUSE_SPINBTN -#define wxSPINCTRL_GETVALUE_FIX int = 1 - // ---------------------------------------------------------------------------- // wxSpinCtrl is just a text control // ---------------------------------------------------------------------------- #include "wx/textctrl.h" -class WXDLLIMPEXP_CORE wxSpinCtrlGenericBase : public wxTextCtrl +class WXDLLEXPORT wxSpinCtrl : public wxTextCtrl { public: - wxSpinCtrlGenericBase() : m_value(0), m_min(0), m_max(100), - m_increment(1), m_snap_to_ticks(false), - m_format(wxT("%g")) { } + wxSpinCtrl() { Init(); } - bool Create(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSP_ARROW_KEYS | wxALIGN_RIGHT, - double min = 0, double max = 100, double initial = 0, - double inc = 1, - const wxString& name = wxT("wxSpinCtrl")) - { - m_min = min; - m_max = max; - m_value = initial; - m_increment = inc; - - bool ok = wxTextCtrl::Create(parent, id, value, pos, size, style, - wxDefaultValidator, name); - DoSetValue(initial); - - return ok; - } - - // accessors - // T GetValue() const - // T GetMin() const - // T GetMax() const - // T GetIncrement() const - virtual bool GetSnapToTicks() const { return m_snap_to_ticks; } - // unsigned GetDigits() const - wxSpinCtrlDouble only - - // operations - virtual void SetValue(const wxString& text) { wxTextCtrl::SetValue(text); } - // void SetValue(T val) - // void SetRange(T minVal, T maxVal) - // void SetIncrement(T inc) - virtual void SetSnapToTicks(bool snap_to_ticks) - { m_snap_to_ticks = snap_to_ticks; } - // void SetDigits(unsigned digits) - wxSpinCtrlDouble only - - // Select text in the textctrl - //void SetSelection(long from, long to); - -protected: - // generic double valued - double DoGetValue() const - { - double n; - if ( (wxSscanf(wxTextCtrl::GetValue(), wxT("%lf"), &n) != 1) ) - n = INT_MIN; - - return n; - } - - bool DoSetValue(double val) - { - wxTextCtrl::SetValue(wxString::Format(m_format.c_str(), val)); - return true; - } - void DoSetRange(double min_val, double max_val) - { - m_min = min_val; - m_max = max_val; - } - void DoSetIncrement(double inc) { m_increment = inc; } // Note: unused - - double m_value; - double m_min; - double m_max; - double m_increment; - bool m_snap_to_ticks; - wxString m_format; -}; - -#endif // wxUSE_SPINBTN/!wxUSE_SPINBTN - -#if !defined(wxHAS_NATIVE_SPINCTRL) - -//----------------------------------------------------------------------------- -// wxSpinCtrl -//----------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxSpinCtrl : public wxSpinCtrlGenericBase -{ -public: - wxSpinCtrl() {} wxSpinCtrl(wxWindow *parent, wxWindowID id = wxID_ANY, const wxString& value = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxSP_ARROW_KEYS | wxALIGN_RIGHT, + long style = wxSP_ARROW_KEYS, int min = 0, int max = 100, int initial = 0, const wxString& name = wxT("wxSpinCtrl")) { @@ -275,94 +135,49 @@ public: const wxString& value = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxSP_ARROW_KEYS | wxALIGN_RIGHT, + long style = wxSP_ARROW_KEYS, int min = 0, int max = 100, int initial = 0, const wxString& name = wxT("wxSpinCtrl")) { - return wxSpinCtrlGenericBase::Create(parent, id, value, pos, size, - style, min, max, initial, 1, name); + SetRange(min, max); + + bool ok = wxTextCtrl::Create(parent, id, value, pos, size, style, + wxDefaultValidator, name); + SetValue(initial); + + return ok; } // accessors - int GetValue(wxSPINCTRL_GETVALUE_FIX) const { return int(DoGetValue()); } - int GetMin() const { return int(m_min); } - int GetMax() const { return int(m_max); } - int GetIncrement() const { return int(m_increment); } + int GetValue(int WXUNUSED(dummy) = 1) const + { + int n; + if ( (wxSscanf(wxTextCtrl::GetValue(), wxT("%d"), &n) != 1) ) + n = INT_MIN; + + return n; + } + + int GetMin() const { return m_min; } + int GetMax() const { return m_max; } // operations - void SetValue(const wxString& value) - { wxSpinCtrlGenericBase::SetValue(value); } - void SetValue( int value ) { DoSetValue(value); } - void SetRange( int minVal, int maxVal ) { DoSetRange(minVal, maxVal); } - void SetIncrement(int inc) { DoSetIncrement(inc); } + void SetValue(const wxString& value) { wxTextCtrl::SetValue(value); } + void SetValue(int val) { wxString s; s << val; wxTextCtrl::SetValue(s); } + void SetRange(int min, int max) { m_min = min; m_max = max; } protected: - virtual void DoSendEvent(); + // initialize m_min/max with the default values + void Init() { SetRange(0, 100); } + int m_min; + int m_max; + +private: DECLARE_DYNAMIC_CLASS(wxSpinCtrl) }; -#endif // wxHAS_NATIVE_SPINCTRL - -//----------------------------------------------------------------------------- -// wxSpinCtrlDouble -//----------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxSpinCtrlDouble : public wxSpinCtrlGenericBase -{ -public: - wxSpinCtrlDouble() : m_digits(0) { } - wxSpinCtrlDouble(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSP_ARROW_KEYS | wxALIGN_RIGHT, - double min = 0, double max = 100, double initial = 0, - double inc = 1, - const wxString& name = wxT("wxSpinCtrlDouble")) - { - m_digits = 0; - Create(parent, id, value, pos, size, style, - min, max, initial, inc, name); - } - - bool Create(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSP_ARROW_KEYS | wxALIGN_RIGHT, - double min = 0, double max = 100, double initial = 0, - double inc = 1, - const wxString& name = wxT("wxSpinCtrlDouble")) - { - return wxSpinCtrlGenericBase::Create(parent, id, value, pos, size, - style, min, max, initial, - inc, name); - } - - // accessors - double GetValue(wxSPINCTRL_GETVALUE_FIX) const { return DoGetValue(); } - double GetMin() const { return m_min; } - double GetMax() const { return m_max; } - double GetIncrement() const { return m_increment; } - unsigned GetDigits() const { return m_digits; } - - // operations - void SetValue(const wxString& value) - { wxSpinCtrlGenericBase::SetValue(value); } - void SetValue(double value) { DoSetValue(value); } - void SetRange(double minVal, double maxVal) { DoSetRange(minVal, maxVal); } - void SetIncrement(double inc) { DoSetIncrement(inc); } - void SetDigits(unsigned digits); - -protected: - virtual void DoSendEvent(); - - unsigned m_digits; - - DECLARE_DYNAMIC_CLASS(wxSpinCtrlDouble) -}; +#endif // wxUSE_SPINBTN/!wxUSE_SPINBTN #endif // _WX_GENERIC_SPINCTRL_H_ + diff --git a/Source/3rd Party/wx/include/wx/generic/splitter.h b/Source/3rd Party/wx/include/wx/generic/splitter.h index d35e32550..14012b1b8 100644 --- a/Source/3rd Party/wx/include/wx/generic/splitter.h +++ b/Source/3rd Party/wx/include/wx/generic/splitter.h @@ -1,10 +1,10 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/splitter.h +// Name: wx/splitter.h // Purpose: wxSplitterWindow class // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: splitter.h 61872 2009-09-09 22:37:05Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -49,7 +49,7 @@ enum // to prevent flickering. (WS_CLIPCHILDREN doesn't work in all cases so can't be // standard). -class WXDLLIMPEXP_CORE wxSplitterWindow: public wxNavigationEnabled +class WXDLLEXPORT wxSplitterWindow: public wxWindow { public: @@ -119,7 +119,7 @@ public: // Removes the specified (or second) window from the view // Doesn't actually delete the window. - bool Unsplit(wxWindow *toRemove = NULL); + bool Unsplit(wxWindow *toRemove = (wxWindow *) NULL); // Replaces one of the windows with another one (neither old nor new // parameter should be NULL) @@ -133,17 +133,14 @@ public: // Is the window split? bool IsSplit() const { return (m_windowTwo != NULL); } + // Sets the sash size + void SetSashSize(int width) { m_sashSize = width; } + // Sets the border size void SetBorderSize(int WXUNUSED(width)) { } - // Hide or show the sash and test whether it's currently hidden. - void SetSashInvisible(bool invisible = true); - bool IsSashInvisible() const { return HasFlag(wxSP_NOSASH); } - - // Gets the current sash size which may be 0 if it's hidden and the default - // sash size. + // Gets the sash size int GetSashSize() const; - int GetDefaultSashSize() const; // Gets the border size int GetBorderSize() const; @@ -196,9 +193,6 @@ public: // Handles mouse events void OnMouseEvent(wxMouseEvent& ev); - // Aborts dragging mode - void OnMouseCaptureLost(wxMouseCaptureLostEvent& event); - // Adjusts the panes void OnSize(wxSizeEvent& event); @@ -217,14 +211,13 @@ public: // Resizes subwindows virtual void SizeWindows(); + void SetNeedUpdating(bool needUpdating) { m_needUpdating = needUpdating; } + bool GetNeedUpdating() const { return m_needUpdating ; } + #ifdef __WXMAC__ virtual bool MacClipGrandChildren() const { return true ; } #endif - // Sets the sash size: this doesn't do anything and shouldn't be used at - // all any more. - wxDEPRECATED_INLINE( void SetSashSize(int WXUNUSED(width)), return; ) - protected: // event handlers #if defined(__WXMSW__) || defined(__WXMAC__) @@ -282,15 +275,16 @@ protected: wxWindow* m_windowOne; wxWindow* m_windowTwo; int m_dragMode; - int m_oldX; // current tracker position if not live mode - int m_oldY; // current tracker position if not live mode + int m_oldX; + int m_oldY; int m_sashPosition; // Number of pixels from left or top double m_sashGravity; + int m_sashSize; wxSize m_lastSize; int m_requestedSashPosition; int m_sashPositionCurrent; // while dragging - wxPoint m_ptStart; // mouse position when dragging started - int m_sashStart; // sash position when dragging started + int m_firstX; + int m_firstY; int m_minimumPaneSize; wxCursor m_sashCursorWE; wxCursor m_sashCursorNS; @@ -300,11 +294,14 @@ protected: bool m_needUpdating:1; bool m_permitUnsplitAlways:1; bool m_isHot:1; + bool m_checkRequestedSashPosition:1; private: + WX_DECLARE_CONTROL_CONTAINER(); + DECLARE_DYNAMIC_CLASS(wxSplitterWindow) DECLARE_EVENT_TABLE() - wxDECLARE_NO_COPY_CLASS(wxSplitterWindow); + DECLARE_NO_COPY_CLASS(wxSplitterWindow) }; // ---------------------------------------------------------------------------- @@ -315,18 +312,16 @@ private: // usual wxWin convention, but the three event types have different kind of // data associated with them, so the accessors can be only used if the real // event type matches with the one for which the accessors make sense -class WXDLLIMPEXP_CORE wxSplitterEvent : public wxNotifyEvent +class WXDLLEXPORT wxSplitterEvent : public wxNotifyEvent { public: wxSplitterEvent(wxEventType type = wxEVT_NULL, - wxSplitterWindow *splitter = NULL) + wxSplitterWindow *splitter = (wxSplitterWindow *)NULL) : wxNotifyEvent(type) { SetEventObject(splitter); if (splitter) m_id = splitter->GetId(); } - wxSplitterEvent(const wxSplitterEvent& event) - : wxNotifyEvent(event), m_data(event.m_data) { } // SASH_POS_CHANGED methods @@ -371,8 +366,6 @@ public: return m_data.pt.y; } - virtual wxEvent *Clone() const { return new wxSplitterEvent(*this); } - private: friend class WXDLLIMPEXP_FWD_CORE wxSplitterWindow; @@ -387,13 +380,13 @@ private: } pt; // position of double click for DCLICK event } m_data; - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSplitterEvent) + DECLARE_DYNAMIC_CLASS_NO_COPY(wxSplitterEvent) }; typedef void (wxEvtHandler::*wxSplitterEventFunction)(wxSplitterEvent&); #define wxSplitterEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxSplitterEventFunction, func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxSplitterEventFunction, &func) #define wx__DECLARE_SPLITTEREVT(evt, id, fn) \ wx__DECLARE_EVT1(wxEVT_COMMAND_SPLITTER_ ## evt, id, wxSplitterEventHandler(fn)) diff --git a/Source/3rd Party/wx/include/wx/generic/srchctlg.h b/Source/3rd Party/wx/include/wx/generic/srchctlg.h index 8f515ccfd..8f7a42e52 100644 --- a/Source/3rd Party/wx/include/wx/generic/srchctlg.h +++ b/Source/3rd Party/wx/include/wx/generic/srchctlg.h @@ -3,7 +3,7 @@ // Purpose: generic wxSearchCtrl class // Author: Vince Harron // Created: 2006-02-19 -// RCS-ID: $Id$ +// RCS-ID: $Id: srchctlg.h 53135 2008-04-12 02:31:04Z VZ $ // Copyright: Vince Harron // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -22,7 +22,7 @@ class WXDLLIMPEXP_FWD_CORE wxSearchTextCtrl; // wxSearchCtrl is a combination of wxTextCtrl and wxSearchButton // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxSearchCtrl : public wxSearchCtrlBase +class WXDLLEXPORT wxSearchCtrl : public wxSearchCtrlBase { public: // creation @@ -62,13 +62,18 @@ public: virtual void ShowCancelButton( bool show ); virtual bool IsCancelButtonVisible() const; +#if wxABI_VERSION >= 20802 // TODO: In 2.9 these should probably be virtual, and declared in the base class... void SetDescriptiveText(const wxString& text); wxString GetDescriptiveText() const; +#endif // accessors // --------- + virtual wxString GetValue() const; + virtual void SetValue(const wxString& value); + virtual wxString GetRange(long from, long to) const; virtual int GetLineLength(long lineNo) const; @@ -191,7 +196,6 @@ public: // wxWindow overrides virtual bool SetFont(const wxFont& font); - virtual bool SetBackgroundColour(const wxColour& colour); // search control generic only void SetSearchBitmap( const wxBitmap& bitmap ); @@ -201,11 +205,7 @@ public: #endif // wxUSE_MENUS protected: - virtual void DoSetValue(const wxString& value, int flags); - virtual wxString DoGetValue() const; - - virtual bool DoLoadFile(const wxString& file, int fileType); - virtual bool DoSaveFile(const wxString& file, int fileType); + virtual void DoSetValue(const wxString& value, int flags = 0); // override the base class virtuals involved into geometry calculations virtual wxSize DoGetBestSize() const; @@ -236,9 +236,6 @@ protected: private: friend class wxSearchButton; - // Implement pure virtual function inherited from wxCompositeWindow. - virtual wxWindowList GetCompositeWindowParts() const; - #if wxUSE_MENUS void PopupSearchMenu(); #endif // wxUSE_MENUS diff --git a/Source/3rd Party/wx/include/wx/generic/statbmpg.h b/Source/3rd Party/wx/include/wx/generic/statbmpg.h deleted file mode 100644 index f7f645b36..000000000 --- a/Source/3rd Party/wx/include/wx/generic/statbmpg.h +++ /dev/null @@ -1,76 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/statbmpg.h -// Purpose: wxGenericStaticBitmap header -// Author: Marcin Wojdyr, Stefan Csomor -// Created: 2008-06-16 -// RCS-ID: $Id$ -// Copyright: wxWidgets developers -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GENERIC_STATBMP_H_ -#define _WX_GENERIC_STATBMP_H_ - -#include "wx/statbmp.h" - -class WXDLLIMPEXP_CORE wxGenericStaticBitmap : public wxStaticBitmapBase -{ -public: - wxGenericStaticBitmap() {} - wxGenericStaticBitmap(wxWindow *parent, - wxWindowID id, - const wxBitmap& bitmap, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxStaticBitmapNameStr) - { - Create(parent, id, bitmap, pos, size, style, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxBitmap& bitmap, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxStaticBitmapNameStr); - - virtual void SetBitmap(const wxBitmap& bitmap) - { - m_bitmap = bitmap; - SetInitialSize(GetBitmapSize()); - Refresh(); - } - - virtual wxBitmap GetBitmap() const { return m_bitmap; } - - virtual void SetIcon(const wxIcon& icon) - { - m_bitmap.CopyFromIcon(icon); - SetInitialSize(GetBitmapSize()); - Refresh(); - } - -#if defined(__WXGTK20__) || defined(__WXMAC__) - // icons and bitmaps are really the same thing in wxGTK and wxMac - wxIcon GetIcon() const { return (const wxIcon &)m_bitmap; } -#endif - - -private: - wxSize GetBitmapSize() - { - return m_bitmap.IsOk() ? wxSize(m_bitmap.GetWidth(), m_bitmap.GetHeight()) - : wxSize(16, 16); // this is completely arbitrary - } - - void OnPaint(wxPaintEvent& event); - - wxBitmap m_bitmap; - - DECLARE_DYNAMIC_CLASS(wxGenericStaticBitmap) -}; - - -#endif //_WX_GENERIC_STATBMP_H_ diff --git a/Source/3rd Party/wx/include/wx/generic/statline.h b/Source/3rd Party/wx/include/wx/generic/statline.h index 170c6626b..4ad6f17fd 100644 --- a/Source/3rd Party/wx/include/wx/generic/statline.h +++ b/Source/3rd Party/wx/include/wx/generic/statline.h @@ -1,9 +1,9 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/statline.h +// Name: generic/statline.h // Purpose: a generic wxStaticLine class // Author: Vadim Zeitlin // Created: 28.06.99 -// Version: $Id$ +// Version: $Id: statline.h 43874 2006-12-09 14:52:59Z VZ $ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -17,7 +17,7 @@ class wxStaticBox; // wxStaticLine // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxStaticLine : public wxStaticLineBase +class WXDLLEXPORT wxStaticLine : public wxStaticLineBase { DECLARE_DYNAMIC_CLASS(wxStaticLine) diff --git a/Source/3rd Party/wx/include/wx/generic/stattextg.h b/Source/3rd Party/wx/include/wx/generic/stattextg.h deleted file mode 100644 index 2e82dc2a1..000000000 --- a/Source/3rd Party/wx/include/wx/generic/stattextg.h +++ /dev/null @@ -1,91 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/stattextg.h -// Purpose: wxGenericStaticText header -// Author: Marcin Wojdyr -// Created: 2008-06-26 -// Id: $Id$ -// Copyright: Marcin Wojdyr -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GENERIC_STATTEXTG_H_ -#define _WX_GENERIC_STATTEXTG_H_ - -// prevent it from including the platform-specific wxStaticText declaration as -// this is not going to compile if it derives from wxGenericStaticText defined -// below (currently this is only the case in wxUniv but it could also happen -// with other ports) -#define wxNO_PORT_STATTEXT_INCLUDE -#include "wx/stattext.h" -#undef wxNO_PORT_STATTEXT_INCLUDE - -class WXDLLIMPEXP_CORE wxGenericStaticText : public wxStaticTextBase -{ -public: - wxGenericStaticText() { Init(); } - - wxGenericStaticText(wxWindow *parent, - wxWindowID id, - const wxString& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxStaticTextNameStr) - { - Init(); - - Create(parent, id, label, pos, size, style, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxString& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxStaticTextNameStr); - - virtual ~wxGenericStaticText(); - - - // overridden base class virtual methods - virtual void SetLabel(const wxString& label); - virtual bool SetFont(const wxFont &font); - -protected: - virtual wxSize DoGetBestClientSize() const; - - virtual wxString DoGetLabel() const { return m_label; } - virtual void DoSetLabel(const wxString& label); - - void DoSetSize(int x, int y, int width, int height, int sizeFlags); - -#if wxUSE_MARKUP - virtual bool DoSetLabelMarkup(const wxString& markup); -#endif // wxUSE_MARKUP - -private: - void Init() - { -#if wxUSE_MARKUP - m_markupText = NULL; -#endif // wxUSE_MARKUP - } - - void OnPaint(wxPaintEvent& event); - - void DoDrawLabel(wxDC& dc, const wxRect& rect); - - // These fields are only used if m_markupText == NULL. - wxString m_label; - int m_mnemonic; - -#if wxUSE_MARKUP - class wxMarkupText *m_markupText; -#endif // wxUSE_MARKUP - - DECLARE_DYNAMIC_CLASS_NO_COPY(wxGenericStaticText) -}; - -#endif // _WX_GENERIC_STATTEXTG_H_ - diff --git a/Source/3rd Party/wx/include/wx/generic/statusbr.h b/Source/3rd Party/wx/include/wx/generic/statusbr.h index 779e487a5..5934a9472 100644 --- a/Source/3rd Party/wx/include/wx/generic/statusbr.h +++ b/Source/3rd Party/wx/include/wx/generic/statusbr.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: VZ at 05.02.00 to derive from wxStatusBarBase // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: statusbr.h 41200 2006-09-13 19:10:31Z ABX $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -19,18 +19,13 @@ #include "wx/pen.h" #include "wx/arrstr.h" - -// ---------------------------------------------------------------------------- -// wxStatusBarGeneric -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxStatusBarGeneric : public wxStatusBarBase +class WXDLLEXPORT wxStatusBarGeneric : public wxStatusBarBase { public: wxStatusBarGeneric() { Init(); } wxStatusBarGeneric(wxWindow *parent, wxWindowID winid = wxID_ANY, - long style = wxSTB_DEFAULT_STYLE, + long style = wxST_SIZEGRIP, const wxString& name = wxStatusBarNameStr) { Init(); @@ -41,75 +36,67 @@ public: virtual ~wxStatusBarGeneric(); bool Create(wxWindow *parent, wxWindowID winid = wxID_ANY, - long style = wxSTB_DEFAULT_STYLE, + long style = wxST_SIZEGRIP, const wxString& name = wxStatusBarNameStr); - // implement base class methods + // Create status line + virtual void SetFieldsCount(int number = 1, + const int *widths = (const int *) NULL); + + // Set status line text + virtual void SetStatusText(const wxString& text, int number = 0); + virtual wxString GetStatusText(int number = 0) const; + + // Set status line widths virtual void SetStatusWidths(int n, const int widths_field[]); + + // Get the position and size of the field's internal bounding rectangle virtual bool GetFieldRect(int i, wxRect& rect) const; + + // sets the minimal vertical size of the status bar virtual void SetMinHeight(int height); virtual int GetBorderX() const { return m_borderX; } virtual int GetBorderY() const { return m_borderY; } + //////////////////////////////////////////////////////////////////////// + // Implementation - // implementation only (not part of wxStatusBar public API): + virtual void DrawFieldText(wxDC& dc, int i); + virtual void DrawField(wxDC& dc, int i); - int GetFieldFromPoint(const wxPoint& point) const; + void SetBorderX(int x); + void SetBorderY(int y); -protected: - virtual void DoUpdateStatusText(int number); - - // event handlers void OnPaint(wxPaintEvent& event); - void OnSize(wxSizeEvent& event); void OnLeftDown(wxMouseEvent& event); void OnRightDown(wxMouseEvent& event); + virtual void InitColours(); + // Responds to colour changes void OnSysColourChanged(wxSysColourChangedEvent& event); protected: - - virtual void DrawFieldText(wxDC& dc, const wxRect& rc, int i, int textHeight); - virtual void DrawField(wxDC& dc, int i, int textHeight); - - void SetBorderX(int x); - void SetBorderY(int y); - - virtual void InitColours(); - - // true if the status bar shows the size grip: for this it must have - // wxSTB_SIZEGRIP style and the window it is attached to must be resizable - // and not maximized - bool ShowsSizeGrip() const; - - // returns the position and the size of the size grip - wxRect GetSizeGripRect() const; - // common part of all ctors void Init(); - // the last known size, fields widths must be updated whenever it's out of - // date - wxSize m_lastClientSize; + wxArrayString m_statusStrings; - // the absolute widths of the status bar panes in pixels + // the last known width of the client rect (used to rebuild cache) + int m_lastClientWidth; + // the widths of the status bar panes in pixels wxArrayInt m_widthsAbs; int m_borderX; int m_borderY; - wxPen m_mediumShadowPen; wxPen m_hilightPen; virtual wxSize DoGetBestSize() const; private: - // Update m_lastClientSize and m_widthsAbs from the current size. - void DoUpdateFieldWidths(); - DECLARE_EVENT_TABLE() DECLARE_DYNAMIC_CLASS_NO_COPY(wxStatusBarGeneric) }; diff --git a/Source/3rd Party/wx/include/wx/generic/textdlgg.h b/Source/3rd Party/wx/include/wx/generic/textdlgg.h index 1b10489ce..fab9a1012 100644 --- a/Source/3rd Party/wx/include/wx/generic/textdlgg.h +++ b/Source/3rd Party/wx/include/wx/generic/textdlgg.h @@ -1,16 +1,16 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/textdlgg.h +// Name: textdlgg.h // Purpose: wxTextEntryDialog class // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: textdlgg.h 49563 2007-10-31 20:46:21Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifndef _WX_TEXTDLGG_H_ -#define _WX_TEXTDLGG_H_ +#ifndef __TEXTDLGH_G__ +#define __TEXTDLGH_G__ #include "wx/defs.h" @@ -20,13 +20,12 @@ #if wxUSE_VALIDATORS #include "wx/valtext.h" -#include "wx/textctrl.h" #endif class WXDLLIMPEXP_FWD_CORE wxTextCtrl; -extern WXDLLIMPEXP_DATA_CORE(const char) wxGetTextFromUserPromptStr[]; -extern WXDLLIMPEXP_DATA_CORE(const char) wxGetPasswordFromUserPromptStr[]; +extern WXDLLEXPORT_DATA(const wxChar) wxGetTextFromUserPromptStr[]; +extern WXDLLEXPORT_DATA(const wxChar) wxGetPasswordFromUserPromptStr[]; #define wxTextEntryDialogStyle (wxOK | wxCANCEL | wxCENTRE | wxWS_EX_VALIDATE_RECURSIVELY) @@ -34,7 +33,7 @@ extern WXDLLIMPEXP_DATA_CORE(const char) wxGetPasswordFromUserPromptStr[]; // wxTextEntryDialog: a dialog with text control, [ok] and [cancel] buttons // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxTextEntryDialog : public wxDialog +class WXDLLEXPORT wxTextEntryDialog : public wxDialog { public: wxTextEntryDialog(wxWindow *parent, @@ -49,10 +48,7 @@ public: #if wxUSE_VALIDATORS void SetTextValidator( const wxTextValidator& validator ); -#if WXWIN_COMPATIBILITY_2_8 - wxDEPRECATED( void SetTextValidator( long style ) ); -#endif - void SetTextValidator( wxTextValidatorStyle style = wxFILTER_NONE ); + void SetTextValidator( long style = wxFILTER_NONE ); wxTextValidator* GetTextValidator() { return (wxTextValidator*)m_textctrl->GetValidator(); } #endif // wxUSE_VALIDATORS @@ -68,14 +64,14 @@ protected: private: DECLARE_EVENT_TABLE() DECLARE_DYNAMIC_CLASS(wxTextEntryDialog) - wxDECLARE_NO_COPY_CLASS(wxTextEntryDialog); + DECLARE_NO_COPY_CLASS(wxTextEntryDialog) }; // ---------------------------------------------------------------------------- // wxPasswordEntryDialog: dialog with password control, [ok] and [cancel] // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxPasswordEntryDialog : public wxTextEntryDialog +class WXDLLEXPORT wxPasswordEntryDialog : public wxTextEntryDialog { public: wxPasswordEntryDialog(wxWindow *parent, @@ -86,31 +82,32 @@ public: const wxPoint& pos = wxDefaultPosition); private: DECLARE_DYNAMIC_CLASS(wxPasswordEntryDialog) - wxDECLARE_NO_COPY_CLASS(wxPasswordEntryDialog); + DECLARE_NO_COPY_CLASS(wxPasswordEntryDialog) }; // ---------------------------------------------------------------------------- // function to get a string from user // ---------------------------------------------------------------------------- -WXDLLIMPEXP_CORE wxString - wxGetTextFromUser(const wxString& message, - const wxString& caption = wxGetTextFromUserPromptStr, - const wxString& default_value = wxEmptyString, - wxWindow *parent = NULL, - wxCoord x = wxDefaultCoord, - wxCoord y = wxDefaultCoord, - bool centre = true); +wxString WXDLLEXPORT +wxGetTextFromUser(const wxString& message, + const wxString& caption = wxGetTextFromUserPromptStr, + const wxString& default_value = wxEmptyString, + wxWindow *parent = (wxWindow *) NULL, + wxCoord x = wxDefaultCoord, + wxCoord y = wxDefaultCoord, + bool centre = true); -WXDLLIMPEXP_CORE wxString - wxGetPasswordFromUser(const wxString& message, - const wxString& caption = wxGetPasswordFromUserPromptStr, - const wxString& default_value = wxEmptyString, - wxWindow *parent = NULL, - wxCoord x = wxDefaultCoord, - wxCoord y = wxDefaultCoord, - bool centre = true); +wxString WXDLLEXPORT +wxGetPasswordFromUser(const wxString& message, + const wxString& caption = wxGetPasswordFromUserPromptStr, + const wxString& default_value = wxEmptyString, + wxWindow *parent = (wxWindow *) NULL, + wxCoord x = wxDefaultCoord, + wxCoord y = wxDefaultCoord, + bool centre = true); #endif // wxUSE_TEXTDLG -#endif // _WX_TEXTDLGG_H_ +#endif + // __TEXTDLGH_G__ diff --git a/Source/3rd Party/wx/include/wx/generic/timer.h b/Source/3rd Party/wx/include/wx/generic/timer.h new file mode 100644 index 000000000..0f52c1b4a --- /dev/null +++ b/Source/3rd Party/wx/include/wx/generic/timer.h @@ -0,0 +1,45 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: timer.h +// Purpose: Generic implementation of wxTimer class +// Author: Vaclav Slavik +// Id: $Id: timer.h 41020 2006-09-05 20:47:48Z VZ $ +// Copyright: (c) Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef __WX_TIMER_H__ +#define __WX_TIMER_H__ + +//----------------------------------------------------------------------------- +// wxTimer +//----------------------------------------------------------------------------- + +class wxTimerDesc; + +class WXDLLEXPORT wxTimer : public wxTimerBase +{ +public: + wxTimer() { Init(); } + wxTimer(wxEvtHandler *owner, int timerid = -1) : wxTimerBase(owner, timerid) + { Init(); } + virtual ~wxTimer(); + + virtual bool Start(int millisecs = -1, bool oneShot = false); + virtual void Stop(); + + virtual bool IsRunning() const; + + // implementation + static void NotifyTimers(); + +protected: + void Init(); + +private: + wxTimerDesc *m_desc; + + DECLARE_ABSTRACT_CLASS(wxTimer) +}; + +#endif // __WX_TIMER_H__ diff --git a/Source/3rd Party/wx/include/wx/generic/treectlg.h b/Source/3rd Party/wx/include/wx/generic/treectlg.h index ee4bc39be..818c8a31c 100644 --- a/Source/3rd Party/wx/include/wx/generic/treectlg.h +++ b/Source/3rd Party/wx/include/wx/generic/treectlg.h @@ -4,7 +4,7 @@ // Author: Robert Roebling // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: treectlg.h 49804 2007-11-10 01:09:42Z VZ $ // Copyright: (c) 1997,1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -34,7 +34,7 @@ class WXDLLIMPEXP_FWD_CORE wxTextCtrl; // wxGenericTreeCtrl - the tree control // ----------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxGenericTreeCtrl : public wxTreeCtrlBase, +class WXDLLEXPORT wxGenericTreeCtrl : public wxTreeCtrlBase, public wxScrollHelper { public: @@ -112,18 +112,8 @@ public: // ---------- virtual wxTreeItemId GetRootItem() const { return m_anchor; } - virtual wxTreeItemId GetSelection() const - { - wxASSERT_MSG( !HasFlag(wxTR_MULTIPLE), - wxT("must use GetSelections() with this control") ); - - return m_current; - } + virtual wxTreeItemId GetSelection() const { return m_current; } virtual size_t GetSelections(wxArrayTreeItemIds&) const; - virtual wxTreeItemId GetFocusedItem() const { return m_current; } - - virtual void ClearFocusedItem(); - virtual void SetFocusedItem(const wxTreeItemId& item); virtual wxTreeItemId GetItemParent(const wxTreeItemId& item) const; virtual wxTreeItemId GetFirstChild(const wxTreeItemId& item, @@ -158,13 +148,12 @@ public: virtual void Unselect(); virtual void UnselectAll(); virtual void SelectItem(const wxTreeItemId& item, bool select = true); - virtual void SelectChildren(const wxTreeItemId& parent); virtual void EnsureVisible(const wxTreeItemId& item); virtual void ScrollTo(const wxTreeItemId& item); virtual wxTextCtrl *EditLabel(const wxTreeItemId& item, - wxClassInfo* textCtrlClass = wxCLASSINFO(wxTextCtrl)); + wxClassInfo* textCtrlClass = CLASSINFO(wxTextCtrl)); virtual wxTextCtrl *GetEditControl() const; virtual void EndEditLabel(const wxTreeItemId& item, bool discardChanges = false); @@ -196,12 +185,29 @@ public: void Edit( const wxTreeItemId& item ) { EditLabel(item); } #endif // WXWIN_COMPATIBILITY_2_6 +#if WXWIN_COMPATIBILITY_2_4 + // deprecated functions: use Set/GetItemImage directly + wxDEPRECATED( int GetItemSelectedImage(const wxTreeItemId& item) const ); + wxDEPRECATED( void SetItemSelectedImage(const wxTreeItemId& item, int image) ); + + // use the versions taking wxTreeItemIdValue cookies (note that + // GetNextChild() is not inside wxDEPRECATED on purpose, as otherwise we + // get twice as many warnings without any added benefit: it is always used + // with GetFirstChild() anyhow) + wxDEPRECATED( wxTreeItemId GetFirstChild(const wxTreeItemId& item, + long& cookie) const ); + wxTreeItemId GetNextChild(const wxTreeItemId& item, + long& cookie) const; +#endif // WXWIN_COMPATIBILITY_2_4 + // implementation only from now on // overridden base class virtuals virtual bool SetBackgroundColour(const wxColour& colour); virtual bool SetForegroundColour(const wxColour& colour); + virtual void Freeze(); + virtual void Thaw(); virtual void Refresh(bool eraseBackground = true, const wxRect *rect = NULL); virtual bool SetFont( const wxFont &font ); @@ -211,7 +217,6 @@ public: void OnPaint( wxPaintEvent &event ); void OnSetFocus( wxFocusEvent &event ); void OnKillFocus( wxFocusEvent &event ); - void OnKeyDown( wxKeyEvent &event ); void OnChar( wxKeyEvent &event ); void OnMouse( wxMouseEvent &event ); void OnGetToolTip( wxTreeEvent &event ); @@ -257,19 +262,15 @@ protected: bool m_lastOnSame; // last click on the same item as prev wxImageList *m_imageListButtons; + int m_freezeCount; int m_dragCount; wxPoint m_dragStart; wxGenericTreeItem *m_dropTarget; wxCursor m_oldCursor; // cursor is changed while dragging wxGenericTreeItem *m_oldSelection; wxGenericTreeItem *m_underMouse; // for visual effects - - enum { NoEffect, BorderEffect, AboveEffect, BelowEffect } m_dndEffect; - wxGenericTreeItem *m_dndEffectItem; - wxTreeTextCtrl *m_textCtrl; - wxTimer *m_renameTimer; // incremental search data @@ -281,9 +282,6 @@ protected: // the common part of all ctors void Init(); - // overridden wxWindow methods - virtual void DoThaw(); - // misc helpers void SendDeleteEvent(wxGenericTreeItem *itemBeingDeleted); @@ -295,9 +293,6 @@ protected: bool unselect_others = true, bool extended_select = false); - virtual int DoGetItemState(const wxTreeItemId& item) const; - virtual void DoSetItemState(const wxTreeItemId& item, int state); - virtual wxTreeItemId DoInsertItem(const wxTreeItemId& parent, size_t previous, const wxString& text, @@ -326,6 +321,7 @@ protected: void CalculateLevel( wxGenericTreeItem *item, wxDC &dc, int level, int &y ); void CalculatePositions(); + void CalculateSize( wxGenericTreeItem *item, wxDC &dc ); void RefreshSubtree( wxGenericTreeItem *item ); void RefreshLine( wxGenericTreeItem *item ); @@ -354,7 +350,7 @@ protected: private: DECLARE_EVENT_TABLE() DECLARE_DYNAMIC_CLASS(wxGenericTreeCtrl) - wxDECLARE_NO_COPY_CLASS(wxGenericTreeCtrl); + DECLARE_NO_COPY_CLASS(wxGenericTreeCtrl) }; #if !defined(__WXMSW__) || defined(__WXUNIVERSAL__) @@ -363,7 +359,7 @@ private: * the run-time information. */ -class WXDLLIMPEXP_CORE wxTreeCtrl: public wxGenericTreeCtrl +class WXDLLEXPORT wxTreeCtrl: public wxGenericTreeCtrl { DECLARE_DYNAMIC_CLASS(wxTreeCtrl) diff --git a/Source/3rd Party/wx/include/wx/geometry.h b/Source/3rd Party/wx/include/wx/geometry.h index 6b01c4c86..c4e67817f 100644 --- a/Source/3rd Party/wx/include/wx/geometry.h +++ b/Source/3rd Party/wx/include/wx/geometry.h @@ -4,7 +4,7 @@ // Author: Stefan Csomor // Modified by: // Created: 08/05/99 -// RCS-ID: $Id$ +// RCS-ID: $Id: geometry.h 53135 2008-04-12 02:31:04Z VZ $ // Copyright: (c) 1999 Stefan Csomor // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -34,7 +34,7 @@ enum wxOutCode wxOutBottom = 0x04 }; -class WXDLLIMPEXP_CORE wxPoint2DInt +class WXDLLEXPORT wxPoint2DInt { public : inline wxPoint2DInt(); @@ -88,9 +88,12 @@ inline wxPoint2DInt operator+(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2) inline wxPoint2DInt operator-(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2); inline wxPoint2DInt operator*(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2); inline wxPoint2DInt operator*(wxInt32 n , const wxPoint2DInt& pt); +inline wxPoint2DInt operator*(wxInt32 n , const wxPoint2DInt& pt); +inline wxPoint2DInt operator*(const wxPoint2DInt& pt , wxInt32 n); inline wxPoint2DInt operator*(const wxPoint2DInt& pt , wxInt32 n); inline wxPoint2DInt operator/(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2); inline wxPoint2DInt operator/(const wxPoint2DInt& pt , wxInt32 n); +inline wxPoint2DInt operator/(const wxPoint2DInt& pt , wxInt32 n); inline wxPoint2DInt::wxPoint2DInt() { @@ -154,7 +157,7 @@ inline wxDouble wxPoint2DInt::GetDistance( const wxPoint2DInt &pt ) const inline wxDouble wxPoint2DInt::GetDistanceSquare( const wxPoint2DInt &pt ) const { - return ( (pt.m_x-m_x)*(pt.m_x-m_x) + (pt.m_y-m_y)*(pt.m_y-m_y) ); + return ( (wxDouble)(pt.m_x-m_x)*(pt.m_x-m_x) + (wxDouble)(pt.m_y-m_y)*(pt.m_y-m_y) ); } inline wxInt32 wxPoint2DInt::GetDotProduct( const wxPoint2DInt &vec ) const @@ -179,11 +182,8 @@ inline wxPoint2DInt wxPoint2DInt::operator-() inline wxPoint2DInt& wxPoint2DInt::operator=(const wxPoint2DInt& pt) { - if (this != &pt) - { - m_x = pt.m_x; - m_y = pt.m_y; - } + m_x = pt.m_x; + m_y = pt.m_y; return *this; } @@ -278,7 +278,7 @@ inline wxPoint2DInt operator/(const wxPoint2DInt& pt , wxDouble n) // wxPoint2Ds represent a point or a vector in a 2d coordinate system -class WXDLLIMPEXP_CORE wxPoint2DDouble +class WXDLLEXPORT wxPoint2DDouble { public : inline wxPoint2DDouble(); @@ -411,11 +411,8 @@ inline wxPoint2DDouble wxPoint2DDouble::operator-() inline wxPoint2DDouble& wxPoint2DDouble::operator=(const wxPoint2DDouble& pt) { - if (this != &pt) - { - m_x = pt.m_x; - m_y = pt.m_y; - } + m_x = pt.m_x; + m_y = pt.m_y; return *this; } @@ -512,7 +509,7 @@ inline wxPoint2DDouble operator/(const wxPoint2DDouble& pt , wxInt32 n) // top left and bottom right corner, or by the top left corner and size. A point is contained within the rectangle if // left <= x < right and top <= m_y < bottom , thus it is a half open interval. -class WXDLLIMPEXP_CORE wxRect2DDouble +class WXDLLEXPORT wxRect2DDouble { public: wxRect2DDouble() @@ -531,8 +528,8 @@ public: inline wxSize GetSize() { return wxSize((int) m_width, (int) m_height); } - // for the edge and corner accessors there are two setters counterparts, the Set.. functions keep the other corners at their - // position whenever sensible, the Move.. functions keep the size of the rect and move the other corners appropriately + // for the edge and corner accessors there are two setters conterparts, the Set.. functions keep the other corners at their + // position whenever sensible, the Move.. functions keep the size of the rect and move the other corners apropriately inline wxDouble GetLeft() const { return m_x; } inline void SetLeft( wxDouble n ) { m_width += m_x - n; m_x = n; } @@ -643,7 +640,7 @@ public: // top left and bottom right corner, or by the top left corner and size. A point is contained within the rectangle if // left <= x < right and top <= m_y < bottom , thus it is a half open interval. -class WXDLLIMPEXP_CORE wxRect2DInt +class WXDLLEXPORT wxRect2DInt { public: wxRect2DInt() { m_x = m_y = m_width = m_height = 0; } @@ -658,8 +655,8 @@ public: inline wxPoint2DInt GetPosition() { return wxPoint2DInt(m_x, m_y); } inline wxSize GetSize() { return wxSize(m_width, m_height); } - // for the edge and corner accessors there are two setters counterparts, the Set.. functions keep the other corners at their - // position whenever sensible, the Move.. functions keep the size of the rect and move the other corners appropriately + // for the edge and corner accessors there are two setters conterparts, the Set.. functions keep the other corners at their + // position whenever sensible, the Move.. functions keep the size of the rect and move the other corners apropriately inline wxInt32 GetLeft() const { return m_x; } inline void SetLeft( wxInt32 n ) { m_width += m_x - n; m_x = n; } diff --git a/Source/3rd Party/wx/include/wx/gifdecod.h b/Source/3rd Party/wx/include/wx/gifdecod.h index 121a6afdd..3ada1a19d 100644 --- a/Source/3rd Party/wx/include/wx/gifdecod.h +++ b/Source/3rd Party/wx/include/wx/gifdecod.h @@ -3,7 +3,7 @@ // Purpose: wxGIFDecoder, GIF reader for wxImage and wxAnimation // Author: Guillermo Rodriguez Garcia // Version: 3.02 -// CVS-ID: $Id$ +// CVS-ID: $Id: gifdecod.h 45563 2007-04-21 18:17:50Z VZ $ // Copyright: (c) 1999 Guillermo Rodriguez Garcia // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -46,7 +46,7 @@ enum wxGIFErrorCode // wxGIFDecoder class // -------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxGIFDecoder : public wxAnimationDecoder +class WXDLLEXPORT wxGIFDecoder : public wxAnimationDecoder { public: // constructor, destructor, etc. @@ -76,6 +76,7 @@ public: void Destroy(); // implementation of wxAnimationDecoder's pure virtuals + virtual bool CanRead( wxInputStream& stream ) const; virtual bool Load( wxInputStream& stream ) { return LoadGIF(stream) == wxGIF_OK; } @@ -87,15 +88,6 @@ public: { return wxANIMATION_TYPE_GIF; } private: - // wxAnimationDecoder pure virtual - virtual bool DoCanRead( wxInputStream& stream ) const; - // modifies current stream position (see wxAnimationDecoder::CanRead) - - int getcode(wxInputStream& stream, int bits, int abfin); - wxGIFErrorCode dgif(wxInputStream& stream, - GIFImage *img, int interl, int bits); - - // array of all frames wxArrayPtrVoid m_frames; @@ -106,9 +98,13 @@ private: unsigned char m_buffer[256]; // buffer for reading unsigned char *m_bufp; // pointer to next byte in buffer - wxDECLARE_NO_COPY_CLASS(wxGIFDecoder); + int getcode(wxInputStream& stream, int bits, int abfin); + wxGIFErrorCode dgif(wxInputStream& stream, + GIFImage *img, int interl, int bits); + + DECLARE_NO_COPY_CLASS(wxGIFDecoder) }; -#endif // wxUSE_STREAMS && wxUSE_GIF +#endif // wxUSE_STREAM && wxUSE_GIF #endif // _WX_GIFDECOD_H_ diff --git a/Source/3rd Party/wx/include/wx/graphics.h b/Source/3rd Party/wx/include/wx/graphics.h index 2b9b74b1e..6d4333bd2 100644 --- a/Source/3rd Party/wx/include/wx/graphics.h +++ b/Source/3rd Party/wx/include/wx/graphics.h @@ -5,7 +5,7 @@ // Modified by: // Created: // Copyright: (c) Stefan Csomor -// RCS-ID: $Id$ +// RCS-ID: $Id: graphics.h 60190 2009-04-16 00:57:35Z KO $ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -18,76 +18,18 @@ #include "wx/geometry.h" #include "wx/dynarray.h" -#include "wx/dc.h" -#include "wx/image.h" -#include "wx/vector.h" -enum wxAntialiasMode -{ - wxANTIALIAS_NONE, // should be 0 - wxANTIALIAS_DEFAULT -}; - -enum wxInterpolationQuality -{ - // default interpolation - wxINTERPOLATION_DEFAULT, - // no interpolation - wxINTERPOLATION_NONE, - // fast interpolation, suited for interactivity - wxINTERPOLATION_FAST, - // better quality - wxINTERPOLATION_GOOD, - // best quality, not suited for interactivity - wxINTERPOLATION_BEST -}; - -enum wxCompositionMode -{ - // R = Result, S = Source, D = Destination, premultiplied with alpha - // Ra, Sa, Da their alpha components - - // classic Porter-Duff compositions - // http://keithp.com/~keithp/porterduff/p253-porter.pdf - - wxCOMPOSITION_INVALID = -1, /* indicates invalid/unsupported mode */ - wxCOMPOSITION_CLEAR, /* R = 0 */ - wxCOMPOSITION_SOURCE, /* R = S */ - wxCOMPOSITION_OVER, /* R = S + D*(1 - Sa) */ - wxCOMPOSITION_IN, /* R = S*Da */ - wxCOMPOSITION_OUT, /* R = S*(1 - Da) */ - wxCOMPOSITION_ATOP, /* R = S*Da + D*(1 - Sa) */ - - wxCOMPOSITION_DEST, /* R = D, essentially a noop */ - wxCOMPOSITION_DEST_OVER, /* R = S*(1 - Da) + D */ - wxCOMPOSITION_DEST_IN, /* R = D*Sa */ - wxCOMPOSITION_DEST_OUT, /* R = D*(1 - Sa) */ - wxCOMPOSITION_DEST_ATOP, /* R = S*(1 - Da) + D*Sa */ - wxCOMPOSITION_XOR, /* R = S*(1 - Da) + D*(1 - Sa) */ - - // mathematical compositions - wxCOMPOSITION_ADD /* R = S + D */ -}; - -class WXDLLIMPEXP_FWD_CORE wxWindowDC; -class WXDLLIMPEXP_FWD_CORE wxMemoryDC; -#if wxUSE_PRINTING_ARCHITECTURE -class WXDLLIMPEXP_FWD_CORE wxPrinterDC; -#endif -#ifdef __WXMSW__ -#if wxUSE_ENH_METAFILE -class WXDLLIMPEXP_FWD_CORE wxEnhMetaFileDC; -#endif -#endif -class WXDLLIMPEXP_FWD_CORE wxGraphicsContext; -class WXDLLIMPEXP_FWD_CORE wxGraphicsPath; -class WXDLLIMPEXP_FWD_CORE wxGraphicsMatrix; -class WXDLLIMPEXP_FWD_CORE wxGraphicsFigure; -class WXDLLIMPEXP_FWD_CORE wxGraphicsRenderer; -class WXDLLIMPEXP_FWD_CORE wxGraphicsPen; -class WXDLLIMPEXP_FWD_CORE wxGraphicsBrush; -class WXDLLIMPEXP_FWD_CORE wxGraphicsFont; -class WXDLLIMPEXP_FWD_CORE wxGraphicsBitmap; +class WXDLLIMPEXP_CORE wxWindowDC; +class WXDLLIMPEXP_CORE wxMemoryDC; +class WXDLLIMPEXP_CORE wxGraphicsContext; +class WXDLLIMPEXP_CORE wxGraphicsPath; +class WXDLLIMPEXP_CORE wxGraphicsMatrix; +class WXDLLIMPEXP_CORE wxGraphicsFigure; +class WXDLLIMPEXP_CORE wxGraphicsRenderer; +class WXDLLIMPEXP_CORE wxGraphicsPen; +class WXDLLIMPEXP_CORE wxGraphicsBrush; +class WXDLLIMPEXP_CORE wxGraphicsFont; +class WXDLLIMPEXP_CORE wxGraphicsBitmap; /* * notes about the graphics context apis @@ -106,93 +48,164 @@ class WXDLLIMPEXP_FWD_CORE wxGraphicsBitmap; // instance from the other instances that were shared - using copy on write semantics // -class WXDLLIMPEXP_FWD_CORE wxGraphicsObjectRefData; -class WXDLLIMPEXP_FWD_CORE wxGraphicsBitmapData; -class WXDLLIMPEXP_FWD_CORE wxGraphicsMatrixData; -class WXDLLIMPEXP_FWD_CORE wxGraphicsPathData; +class WXDLLIMPEXP_CORE wxGraphicsObjectRefData : public wxObjectRefData +{ +public : + wxGraphicsObjectRefData( wxGraphicsRenderer* renderer ); + wxGraphicsObjectRefData( const wxGraphicsObjectRefData* data ); + wxGraphicsRenderer* GetRenderer() const ; + virtual wxGraphicsObjectRefData* Clone() const ; + +protected : + wxGraphicsRenderer* m_renderer; +} ; class WXDLLIMPEXP_CORE wxGraphicsObject : public wxObject { -public: - wxGraphicsObject(); - wxGraphicsObject( wxGraphicsRenderer* renderer ); - virtual ~wxGraphicsObject(); +public : + wxGraphicsObject() ; +#if wxABI_VERSION >= 20810 + wxGraphicsObject( const wxGraphicsObject& other) : wxObject( other ) {} + wxGraphicsObject& operator= (const wxGraphicsObject & other) { Ref(other); return *this;} +#endif + wxGraphicsObject( wxGraphicsRenderer* renderer ) ; + virtual ~wxGraphicsObject() ; - bool IsNull() const; + bool IsNull() const ; // returns the renderer that was used to create this instance, or NULL if it has not been initialized yet - wxGraphicsRenderer* GetRenderer() const; - wxGraphicsObjectRefData* GetGraphicsData() const; -protected: + wxGraphicsRenderer* GetRenderer() const ; + wxGraphicsObjectRefData* GetGraphicsData() const ; +protected : virtual wxObjectRefData* CreateRefData() const; virtual wxObjectRefData* CloneRefData(const wxObjectRefData* data) const; DECLARE_DYNAMIC_CLASS(wxGraphicsObject) -}; +} ; class WXDLLIMPEXP_CORE wxGraphicsPen : public wxGraphicsObject { -public: +public : wxGraphicsPen() {} +#if wxABI_VERSION >= 20810 + wxGraphicsPen( const wxGraphicsPen& other) : wxGraphicsObject( other ) {} + wxGraphicsPen& operator= (const wxGraphicsPen & other) { Ref(other); return *this;} +#endif virtual ~wxGraphicsPen() {} -private: +private : DECLARE_DYNAMIC_CLASS(wxGraphicsPen) -}; +} ; -extern WXDLLIMPEXP_DATA_CORE(wxGraphicsPen) wxNullGraphicsPen; +extern WXDLLEXPORT_DATA(wxGraphicsPen) wxNullGraphicsPen; class WXDLLIMPEXP_CORE wxGraphicsBrush : public wxGraphicsObject { -public: +public : wxGraphicsBrush() {} +#if wxABI_VERSION >= 20810 + wxGraphicsBrush( const wxGraphicsBrush& other) : wxGraphicsObject( other ) {} + wxGraphicsBrush& operator= (const wxGraphicsBrush & other) { Ref(other); return *this;} +#endif virtual ~wxGraphicsBrush() {} -private: +private : DECLARE_DYNAMIC_CLASS(wxGraphicsBrush) -}; +} ; -extern WXDLLIMPEXP_DATA_CORE(wxGraphicsBrush) wxNullGraphicsBrush; +extern WXDLLEXPORT_DATA(wxGraphicsBrush) wxNullGraphicsBrush; class WXDLLIMPEXP_CORE wxGraphicsFont : public wxGraphicsObject { -public: +public : wxGraphicsFont() {} +#if wxABI_VERSION >= 20810 + wxGraphicsFont( const wxGraphicsFont& other) : wxGraphicsObject( other ) {} + wxGraphicsFont& operator= (const wxGraphicsFont & other) { Ref(other); return *this;} +#endif virtual ~wxGraphicsFont() {} -private: +private : DECLARE_DYNAMIC_CLASS(wxGraphicsFont) -}; +} ; -extern WXDLLIMPEXP_DATA_CORE(wxGraphicsFont) wxNullGraphicsFont; +extern WXDLLEXPORT_DATA(wxGraphicsFont) wxNullGraphicsFont; class WXDLLIMPEXP_CORE wxGraphicsBitmap : public wxGraphicsObject { -public: +public : wxGraphicsBitmap() {} +#if wxABI_VERSION >= 20810 + wxGraphicsBitmap( const wxGraphicsBitmap& other) : wxGraphicsObject( other ) {} + wxGraphicsBitmap& operator= (const wxGraphicsBitmap & other) { Ref(other); return *this;} +#endif virtual ~wxGraphicsBitmap() {} - - // Convert bitmap to wxImage: this is more efficient than converting to - // wxBitmap first and then to wxImage and also works without X server - // connection under Unix that wxBitmap requires. -#if wxUSE_IMAGE - wxImage ConvertToImage() const; -#endif // wxUSE_IMAGE - - void* GetNativeBitmap() const; - - const wxGraphicsBitmapData* GetBitmapData() const - { return (const wxGraphicsBitmapData*) GetRefData(); } - wxGraphicsBitmapData* GetBitmapData() - { return (wxGraphicsBitmapData*) GetRefData(); } - -private: +private : DECLARE_DYNAMIC_CLASS(wxGraphicsBitmap) -}; +} ; -extern WXDLLIMPEXP_DATA_CORE(wxGraphicsBitmap) wxNullGraphicsBitmap; +extern WXDLLEXPORT_DATA(wxGraphicsBitmap) wxNullGraphicsBitmap; + +class WXDLLIMPEXP_CORE wxGraphicsMatrixData : public wxGraphicsObjectRefData +{ +public : + wxGraphicsMatrixData( wxGraphicsRenderer* renderer) : + wxGraphicsObjectRefData(renderer) {} + + virtual ~wxGraphicsMatrixData() {} + + // concatenates the matrix + virtual void Concat( const wxGraphicsMatrixData *t ) = 0; + + // sets the matrix to the respective values + virtual void Set(wxDouble a=1.0, wxDouble b=0.0, wxDouble c=0.0, wxDouble d=1.0, + wxDouble tx=0.0, wxDouble ty=0.0) = 0; + + // gets the component valuess of the matrix + virtual void Get(wxDouble* a=NULL, wxDouble* b=NULL, wxDouble* c=NULL, + wxDouble* d=NULL, wxDouble* tx=NULL, wxDouble* ty=NULL) const = 0; + + // makes this the inverse matrix + virtual void Invert() = 0; + + // returns true if the elements of the transformation matrix are equal ? + virtual bool IsEqual( const wxGraphicsMatrixData* t) const = 0; + + // return true if this is the identity matrix + virtual bool IsIdentity() const = 0; + + // + // transformation + // + + // add the translation to this matrix + virtual void Translate( wxDouble dx , wxDouble dy ) = 0; + + // add the scale to this matrix + virtual void Scale( wxDouble xScale , wxDouble yScale ) = 0; + + // add the rotation to this matrix (radians) + virtual void Rotate( wxDouble angle ) = 0; + + // + // apply the transforms + // + + // applies that matrix to the point + virtual void TransformPoint( wxDouble *x, wxDouble *y ) const = 0; + + // applies the matrix except for translations + virtual void TransformDistance( wxDouble *dx, wxDouble *dy ) const =0; + + // returns the native representation + virtual void * GetNativeMatrix() const = 0; +} ; class WXDLLIMPEXP_CORE wxGraphicsMatrix : public wxGraphicsObject { -public: +public : wxGraphicsMatrix() {} +#if wxABI_VERSION >= 20810 + wxGraphicsMatrix( const wxGraphicsMatrix& other) : wxGraphicsObject( other ) {} + wxGraphicsMatrix& operator= (const wxGraphicsMatrix & other) { Ref(other); return *this;} +#endif virtual ~wxGraphicsMatrix() {} @@ -249,16 +262,89 @@ public: wxGraphicsMatrixData* GetMatrixData() { return (wxGraphicsMatrixData*) GetRefData(); } -private: +private : DECLARE_DYNAMIC_CLASS(wxGraphicsMatrix) -}; +} ; -extern WXDLLIMPEXP_DATA_CORE(wxGraphicsMatrix) wxNullGraphicsMatrix; +extern WXDLLEXPORT_DATA(wxGraphicsMatrix) wxNullGraphicsMatrix; + +class WXDLLIMPEXP_CORE wxGraphicsPathData : public wxGraphicsObjectRefData +{ +public : + wxGraphicsPathData(wxGraphicsRenderer* renderer) : wxGraphicsObjectRefData(renderer) {} + virtual ~wxGraphicsPathData() {} + + // + // These are the path primitives from which everything else can be constructed + // + + // begins a new subpath at (x,y) + virtual void MoveToPoint( wxDouble x, wxDouble y ) = 0; + + // adds a straight line from the current point to (x,y) + virtual void AddLineToPoint( wxDouble x, wxDouble y ) = 0; + + // adds a cubic Bezier curve from the current point, using two control points and an end point + virtual void AddCurveToPoint( wxDouble cx1, wxDouble cy1, wxDouble cx2, wxDouble cy2, wxDouble x, wxDouble y ) = 0; + + // adds another path + virtual void AddPath( const wxGraphicsPathData* path ) =0; + + // closes the current sub-path + virtual void CloseSubpath() = 0; + + // gets the last point of the current path, (0,0) if not yet set + virtual void GetCurrentPoint( wxDouble* x, wxDouble* y) const = 0; + + // adds an arc of a circle centering at (x,y) with radius (r) from startAngle to endAngle + virtual void AddArc( wxDouble x, wxDouble y, wxDouble r, wxDouble startAngle, wxDouble endAngle, bool clockwise ) = 0; + + // + // These are convenience functions which - if not available natively will be assembled + // using the primitives from above + // + + // adds a quadratic Bezier curve from the current point, using a control point and an end point + virtual void AddQuadCurveToPoint( wxDouble cx, wxDouble cy, wxDouble x, wxDouble y ); + + // appends a rectangle as a new closed subpath + virtual void AddRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h ); + + // appends an ellipsis as a new closed subpath fitting the passed rectangle + virtual void AddCircle( wxDouble x, wxDouble y, wxDouble r ); + + // appends a an arc to two tangents connecting (current) to (x1,y1) and (x1,y1) to (x2,y2), also a straight line from (current) to (x1,y1) + virtual void AddArcToPoint( wxDouble x1, wxDouble y1 , wxDouble x2, wxDouble y2, wxDouble r ) ; + + // appends an ellipse + virtual void AddEllipse( wxDouble x, wxDouble y, wxDouble w, wxDouble h); + + // appends a rounded rectangle + virtual void AddRoundedRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h, wxDouble radius); + + // returns the native path + virtual void * GetNativePath() const = 0; + + // give the native path returned by GetNativePath() back (there might be some deallocations necessary) + virtual void UnGetNativePath(void *p) const= 0; + + // transforms each point of this path by the matrix + virtual void Transform( const wxGraphicsMatrixData* matrix ) =0; + + // gets the bounding box enclosing all points (possibly including control points) + virtual void GetBox(wxDouble *x, wxDouble *y, wxDouble *w, wxDouble *h) const=0; + + virtual bool Contains( wxDouble x, wxDouble y, int fillStyle = wxODDEVEN_RULE) const=0; +}; class WXDLLIMPEXP_CORE wxGraphicsPath : public wxGraphicsObject { -public: +public : wxGraphicsPath() {} +#if wxABI_VERSION >= 20810 + wxGraphicsPath( const wxGraphicsPath& other) : wxGraphicsObject( other ) {} + wxGraphicsPath& operator= (const wxGraphicsPath & other) { Ref(other); return *this;} +#endif virtual ~wxGraphicsPath() {} // @@ -274,21 +360,21 @@ public: void AddLineToPoint( const wxPoint2DDouble& p); // adds a cubic Bezier curve from the current point, using two control points and an end point - virtual void AddCurveToPoint( wxDouble cx1, wxDouble cy1, wxDouble cx2, wxDouble cy2, wxDouble x, wxDouble y ); + virtual void AddCurveToPoint( wxDouble cx1, wxDouble cy1, wxDouble cx2, wxDouble cy2, wxDouble x, wxDouble y ) ; void AddCurveToPoint( const wxPoint2DDouble& c1, const wxPoint2DDouble& c2, const wxPoint2DDouble& e); // adds another path virtual void AddPath( const wxGraphicsPath& path ); // closes the current sub-path - virtual void CloseSubpath(); + virtual void CloseSubpath() ; // gets the last point of the current path, (0,0) if not yet set virtual void GetCurrentPoint( wxDouble* x, wxDouble* y) const; wxPoint2DDouble GetCurrentPoint() const; // adds an arc of a circle centering at (x,y) with radius (r) from startAngle to endAngle - virtual void AddArc( wxDouble x, wxDouble y, wxDouble r, wxDouble startAngle, wxDouble endAngle, bool clockwise ); + virtual void AddArc( wxDouble x, wxDouble y, wxDouble r, wxDouble startAngle, wxDouble endAngle, bool clockwise ) ; void AddArc( const wxPoint2DDouble& c, wxDouble r, wxDouble startAngle, wxDouble endAngle, bool clockwise); // @@ -306,7 +392,7 @@ public: virtual void AddCircle( wxDouble x, wxDouble y, wxDouble r ); // appends a an arc to two tangents connecting (current) to (x1,y1) and (x1,y1) to (x2,y2), also a straight line from (current) to (x1,y1) - virtual void AddArcToPoint( wxDouble x1, wxDouble y1 , wxDouble x2, wxDouble y2, wxDouble r ); + virtual void AddArcToPoint( wxDouble x1, wxDouble y1 , wxDouble x2, wxDouble y2, wxDouble r ) ; // appends an ellipse virtual void AddEllipse( wxDouble x, wxDouble y, wxDouble w, wxDouble h); @@ -327,97 +413,21 @@ public: virtual void GetBox(wxDouble *x, wxDouble *y, wxDouble *w, wxDouble *h)const; wxRect2DDouble GetBox()const; - virtual bool Contains( wxDouble x, wxDouble y, wxPolygonFillMode fillStyle = wxODDEVEN_RULE)const; - bool Contains( const wxPoint2DDouble& c, wxPolygonFillMode fillStyle = wxODDEVEN_RULE)const; + virtual bool Contains( wxDouble x, wxDouble y, int fillStyle = wxODDEVEN_RULE)const; + bool Contains( const wxPoint2DDouble& c, int fillStyle = wxODDEVEN_RULE)const; const wxGraphicsPathData* GetPathData() const { return (const wxGraphicsPathData*) GetRefData(); } wxGraphicsPathData* GetPathData() { return (wxGraphicsPathData*) GetRefData(); } -private: +private : DECLARE_DYNAMIC_CLASS(wxGraphicsPath) -}; +} ; -extern WXDLLIMPEXP_DATA_CORE(wxGraphicsPath) wxNullGraphicsPath; +extern WXDLLEXPORT_DATA(wxGraphicsPath) wxNullGraphicsPath; -// Describes a single gradient stop. -class wxGraphicsGradientStop -{ -public: - wxGraphicsGradientStop(wxColour col = wxTransparentColour, - float pos = 0.) - : m_col(col), - m_pos(pos) - { - } - - // default copy ctor, assignment operator and dtor are ok - - const wxColour& GetColour() const { return m_col; } - void SetColour(const wxColour& col) { m_col = col; } - - float GetPosition() const { return m_pos; } - void SetPosition(float pos) - { - wxASSERT_MSG( pos >= 0 && pos <= 1, "invalid gradient stop position" ); - - m_pos = pos; - } - -private: - // The colour of this gradient band. - wxColour m_col; - - // Its starting position: 0 is the beginning and 1 is the end. - float m_pos; -}; - -// A collection of gradient stops ordered by their positions (from lowest to -// highest). The first stop (index 0, position 0.0) is always the starting -// colour and the last one (index GetCount() - 1, position 1.0) is the end -// colour. -class WXDLLIMPEXP_CORE wxGraphicsGradientStops -{ -public: - wxGraphicsGradientStops(wxColour startCol = wxTransparentColour, - wxColour endCol = wxTransparentColour) - { - // we can't use Add() here as it relies on having start/end stops as - // first/last array elements so do it manually - m_stops.push_back(wxGraphicsGradientStop(startCol, 0.f)); - m_stops.push_back(wxGraphicsGradientStop(endCol, 1.f)); - } - - // default copy ctor, assignment operator and dtor are ok for this class - - - // Add a stop in correct order. - void Add(const wxGraphicsGradientStop& stop); - void Add(wxColour col, float pos) { Add(wxGraphicsGradientStop(col, pos)); } - - // Get the number of stops. - unsigned GetCount() const { return m_stops.size(); } - - // Return the stop at the given index (which must be valid). - wxGraphicsGradientStop Item(unsigned n) const { return m_stops.at(n); } - - // Get/set start and end colours. - void SetStartColour(wxColour col) - { m_stops[0].SetColour(col); } - wxColour GetStartColour() const - { return m_stops[0].GetColour(); } - void SetEndColour(wxColour col) - { m_stops[m_stops.size() - 1].SetColour(col); } - wxColour GetEndColour() const - { return m_stops[m_stops.size() - 1].GetColour(); } - -private: - // All the stops stored in ascending order of positions. - wxVector m_stops; -}; - class WXDLLIMPEXP_CORE wxGraphicsContext : public wxGraphicsObject { public: @@ -425,109 +435,49 @@ public: virtual ~wxGraphicsContext(); - static wxGraphicsContext* Create( const wxWindowDC& dc); - static wxGraphicsContext * Create( const wxMemoryDC& dc); -#if wxUSE_PRINTING_ARCHITECTURE - static wxGraphicsContext * Create( const wxPrinterDC& dc); -#endif + static wxGraphicsContext* Create( const wxWindowDC& dc) ; + #ifdef __WXMSW__ -#if wxUSE_ENH_METAFILE - static wxGraphicsContext * Create( const wxEnhMetaFileDC& dc); -#endif + static wxGraphicsContext * Create( const wxMemoryDC& dc) ; #endif - static wxGraphicsContext* CreateFromNative( void * context ); + static wxGraphicsContext* CreateFromNative( void * context ) ; - static wxGraphicsContext* CreateFromNativeWindow( void * window ); + static wxGraphicsContext* CreateFromNativeWindow( void * window ) ; - static wxGraphicsContext* Create( wxWindow* window ); - -#if wxUSE_IMAGE - // Create a context for drawing onto a wxImage. The image life time must be - // greater than that of the context itself as when the context is destroyed - // it will copy its contents to the specified image. - static wxGraphicsContext* Create(wxImage& image); -#endif // wxUSE_IMAGE + static wxGraphicsContext* Create( wxWindow* window ) ; // create a context that can be used for measuring texts only, no drawing allowed static wxGraphicsContext * Create(); - // begin a new document (relevant only for printing / pdf etc) if there is a progress dialog, message will be shown - virtual bool StartDoc( const wxString& message ); - - // done with that document (relevant only for printing / pdf etc) - virtual void EndDoc(); - - // opens a new page (relevant only for printing / pdf etc) with the given size in points - // (if both are null the default page size will be used) - virtual void StartPage( wxDouble width = 0, wxDouble height = 0 ); - - // ends the current page (relevant only for printing / pdf etc) - virtual void EndPage(); - - // make sure that the current content of this context is immediately visible - virtual void Flush(); - wxGraphicsPath CreatePath() const; virtual wxGraphicsPen CreatePen(const wxPen& pen) const; virtual wxGraphicsBrush CreateBrush(const wxBrush& brush ) const; - // sets the brush to a linear gradient, starting at (x1,y1) and ending at - // (x2,y2) with the given boundary colours or the specified stops - wxGraphicsBrush - CreateLinearGradientBrush(wxDouble x1, wxDouble y1, - wxDouble x2, wxDouble y2, - const wxColour& c1, const wxColour& c2) const; - wxGraphicsBrush - CreateLinearGradientBrush(wxDouble x1, wxDouble y1, - wxDouble x2, wxDouble y2, - const wxGraphicsGradientStops& stops) const; + // sets the brush to a linear gradient, starting at (x1,y1) with color c1 to (x2,y2) with color c2 + virtual wxGraphicsBrush CreateLinearGradientBrush( wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2, + const wxColour&c1, const wxColour&c2) const; - // sets the brush to a radial gradient originating at (xo,yc) and ending - // on a circle around (xc,yc) with the given radius; the colours may be - // specified by just the two extremes or the full array of gradient stops - wxGraphicsBrush - CreateRadialGradientBrush(wxDouble xo, wxDouble yo, - wxDouble xc, wxDouble yc, wxDouble radius, - const wxColour& oColor, const wxColour& cColor) const; + // sets the brush to a radial gradient originating at (xo,yc) with color oColor and ends on a circle around (xc,yc) + // with radius r and color cColor + virtual wxGraphicsBrush CreateRadialGradientBrush( wxDouble xo, wxDouble yo, wxDouble xc, wxDouble yc, wxDouble radius, + const wxColour &oColor, const wxColour &cColor) const; - wxGraphicsBrush - CreateRadialGradientBrush(wxDouble xo, wxDouble yo, - wxDouble xc, wxDouble yc, wxDouble radius, - const wxGraphicsGradientStops& stops) const; - - // creates a font + // sets the font virtual wxGraphicsFont CreateFont( const wxFont &font , const wxColour &col = *wxBLACK ) const; - virtual wxGraphicsFont CreateFont(double sizeInPixels, - const wxString& facename, - int flags = wxFONTFLAG_DEFAULT, - const wxColour& col = *wxBLACK) const; + +#if wxABI_VERSION >= 20809 + wxGraphicsBitmap CreateBitmap( const wxBitmap &bitmap ) const; +#endif - // create a native bitmap representation - virtual wxGraphicsBitmap CreateBitmap( const wxBitmap &bitmap ) const; -#if wxUSE_IMAGE - wxGraphicsBitmap CreateBitmapFromImage(const wxImage& image) const; -#endif // wxUSE_IMAGE - - // create a native bitmap representation - virtual wxGraphicsBitmap CreateSubBitmap( const wxGraphicsBitmap &bitmap, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) const; + //virtual wxGraphicsBitmap CreateSubBitmap( const wxGraphicsBitmap &bitmap, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) const; // create a 'native' matrix corresponding to these values virtual wxGraphicsMatrix CreateMatrix( wxDouble a=1.0, wxDouble b=0.0, wxDouble c=0.0, wxDouble d=1.0, wxDouble tx=0.0, wxDouble ty=0.0) const; - wxGraphicsMatrix CreateMatrix( const wxAffineMatrix2DBase& mat ) const - { - wxMatrix2D mat2D; - wxPoint2DDouble tr; - mat.Get(&mat2D, &tr); - - return CreateMatrix(mat2D.m_11, mat2D.m_12, mat2D.m_21, mat2D.m_22, - tr.m_x, tr.m_y); - } - // push the current state of the context, ie the transformation matrix on a stack virtual void PushState() = 0; @@ -541,55 +491,16 @@ public: virtual void Clip( wxDouble x, wxDouble y, wxDouble w, wxDouble h ) = 0; // resets the clipping to original extent - virtual void ResetClip() = 0; + virtual void ResetClip() = 0 ; // returns the native context virtual void * GetNativeContext() = 0; - // returns the current shape antialiasing mode - virtual wxAntialiasMode GetAntialiasMode() const { return m_antialias; } + // returns the current logical function + virtual int GetLogicalFunction() const { return m_logicalFunction; } - // sets the antialiasing mode, returns true if it supported - virtual bool SetAntialiasMode(wxAntialiasMode antialias) = 0; - - // returns the current interpolation quality - virtual wxInterpolationQuality GetInterpolationQuality() const { return m_interpolation; } - - // sets the interpolation quality, returns true if it supported - virtual bool SetInterpolationQuality(wxInterpolationQuality interpolation) = 0; - - // returns the current compositing operator - virtual wxCompositionMode GetCompositionMode() const { return m_composition; } - - // sets the compositing operator, returns true if it supported - virtual bool SetCompositionMode(wxCompositionMode op) = 0; - - // returns the size of the graphics context in device coordinates - void GetSize(wxDouble* width, wxDouble* height) - { - if ( width ) - *width = m_width; - if ( height ) - *height = m_height; - } - - // returns the resolution of the graphics context in device points per inch - virtual void GetDPI( wxDouble* dpiX, wxDouble* dpiY); - -#if 0 - // sets the current alpha on this context - virtual void SetAlpha( wxDouble alpha ); - - // returns the alpha on this context - virtual wxDouble GetAlpha() const; -#endif - - // all rendering is done into a fully transparent temporary context - virtual void BeginLayer(wxDouble opacity) = 0; - - // composites back the drawings into the context with the opacity given at - // the BeginLayer call - virtual void EndLayer() = 0; + // sets the current logical function, returns true if it supported + virtual bool SetLogicalFunction(int function) ; // // transformation : changes the current transformation matrix CTM of the context @@ -636,41 +547,35 @@ public: virtual void StrokePath( const wxGraphicsPath& path ) = 0; // fills a path with the current brush - virtual void FillPath( const wxGraphicsPath& path, wxPolygonFillMode fillStyle = wxODDEVEN_RULE ) = 0; + virtual void FillPath( const wxGraphicsPath& path, int fillStyle = wxODDEVEN_RULE ) = 0; // draws a path by first filling and then stroking - virtual void DrawPath( const wxGraphicsPath& path, wxPolygonFillMode fillStyle = wxODDEVEN_RULE ); + virtual void DrawPath( const wxGraphicsPath& path, int fillStyle = wxODDEVEN_RULE ); // // text // - void DrawText( const wxString &str, wxDouble x, wxDouble y ) - { DoDrawText(str, x, y); } + virtual void DrawText( const wxString &str, wxDouble x, wxDouble y ) = 0; - void DrawText( const wxString &str, wxDouble x, wxDouble y, wxDouble angle ) - { DoDrawRotatedText(str, x, y, angle); } + virtual void DrawText( const wxString &str, wxDouble x, wxDouble y, wxDouble angle ); - void DrawText( const wxString &str, wxDouble x, wxDouble y, - const wxGraphicsBrush& backgroundBrush ) - { DoDrawFilledText(str, x, y, backgroundBrush); } - - void DrawText( const wxString &str, wxDouble x, wxDouble y, - wxDouble angle, const wxGraphicsBrush& backgroundBrush ) - { DoDrawRotatedFilledText(str, x, y, angle, backgroundBrush); } + virtual void DrawText( const wxString &str, wxDouble x, wxDouble y, const wxGraphicsBrush& backgroundBrush ) ; + virtual void DrawText( const wxString &str, wxDouble x, wxDouble y, wxDouble angle, const wxGraphicsBrush& backgroundBrush ); virtual void GetTextExtent( const wxString &text, wxDouble *width, wxDouble *height, - wxDouble *descent = NULL, wxDouble *externalLeading = NULL ) const = 0; + wxDouble *descent, wxDouble *externalLeading ) const = 0; virtual void GetPartialTextExtents(const wxString& text, wxArrayDouble& widths) const = 0; // // image support // - - virtual void DrawBitmap( const wxGraphicsBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) = 0; - +#if wxABI_VERSION >= 20809 + void DrawGraphicsBitmap( const wxGraphicsBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h ); +#endif + virtual void DrawBitmap( const wxBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) = 0; virtual void DrawIcon( const wxIcon &icon, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) = 0; @@ -689,9 +594,9 @@ public: virtual void StrokeLines( size_t n, const wxPoint2DDouble *beginPoints, const wxPoint2DDouble *endPoints); // draws a polygon - virtual void DrawLines( size_t n, const wxPoint2DDouble *points, wxPolygonFillMode fillStyle = wxODDEVEN_RULE ); + virtual void DrawLines( size_t n, const wxPoint2DDouble *points, int fillStyle = wxODDEVEN_RULE ); - // draws a rectangle + // draws a polygon virtual void DrawRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h); // draws an ellipse @@ -704,42 +609,16 @@ public: // helper to determine if a 0.5 offset should be applied for the drawing operation virtual bool ShouldOffset() const { return false; } - - // indicates whether the context should try to offset for pixel boundaries, this only makes sense on - // bitmap devices like screen, by default this is turned off - virtual void EnableOffset(bool enable = true); - - void DisableOffset() { EnableOffset(false); } - bool OffsetEnabled() { return m_enableOffset; } - -protected: - // These fields must be initialized in the derived class ctors. - wxDouble m_width, - m_height; + +protected : wxGraphicsPen m_pen; wxGraphicsBrush m_brush; wxGraphicsFont m_font; - wxAntialiasMode m_antialias; - wxCompositionMode m_composition; - wxInterpolationQuality m_interpolation; - bool m_enableOffset; + int m_logicalFunction; -protected: - // implementations of overloaded public functions: we use different names - // for them to avoid the virtual function hiding problems in the derived - // classes - virtual void DoDrawText(const wxString& str, wxDouble x, wxDouble y) = 0; - virtual void DoDrawRotatedText(const wxString& str, wxDouble x, wxDouble y, - wxDouble angle); - virtual void DoDrawFilledText(const wxString& str, wxDouble x, wxDouble y, - const wxGraphicsBrush& backgroundBrush); - virtual void DoDrawRotatedFilledText(const wxString& str, - wxDouble x, wxDouble y, - wxDouble angle, - const wxGraphicsBrush& backgroundBrush); - - wxDECLARE_NO_COPY_CLASS(wxGraphicsContext); +private : + DECLARE_NO_COPY_CLASS(wxGraphicsContext) DECLARE_ABSTRACT_CLASS(wxGraphicsContext) }; @@ -751,10 +630,14 @@ protected: class WXDLLIMPEXP_CORE wxGraphicsFigure : public wxGraphicsObject { -public: - wxGraphicsFigure(wxGraphicsRenderer* renderer); +public : + wxGraphicsFigure(wxGraphicsRenderer* renderer) ; +#if wxABI_VERSION >= 20810 + wxGraphicsFigure( const wxGraphicsFigure& other) : wxGraphicsObject( other ) {} + wxGraphicsFigure& operator= (const wxGraphicsFigure & other) { Ref(other); return *this;} +#endif - virtual ~wxGraphicsFigure(); + virtual ~wxGraphicsFigure() ; void SetPath( wxGraphicsMatrix* matrix ); @@ -769,12 +652,12 @@ public: // returns the transformation matrix of this object, may be null if there is no transformation necessary wxGraphicsMatrix* GetMatrix() { return m_matrix; } -private: +private : wxGraphicsMatrix* m_matrix; wxGraphicsPath* m_path; DECLARE_DYNAMIC_CLASS(wxGraphicsFigure) -}; +} ; #endif @@ -786,37 +669,28 @@ private: class WXDLLIMPEXP_CORE wxGraphicsRenderer : public wxObject { -public: +public : wxGraphicsRenderer() {} virtual ~wxGraphicsRenderer() {} static wxGraphicsRenderer* GetDefaultRenderer(); +#if wxABI_VERSION >= 20811 static wxGraphicsRenderer* GetCairoRenderer(); +#endif // Context - virtual wxGraphicsContext * CreateContext( const wxWindowDC& dc) = 0; - virtual wxGraphicsContext * CreateContext( const wxMemoryDC& dc) = 0; -#if wxUSE_PRINTING_ARCHITECTURE - virtual wxGraphicsContext * CreateContext( const wxPrinterDC& dc) = 0; -#endif + virtual wxGraphicsContext * CreateContext( const wxWindowDC& dc) = 0 ; #ifdef __WXMSW__ -#if wxUSE_ENH_METAFILE - virtual wxGraphicsContext * CreateContext( const wxEnhMetaFileDC& dc) = 0; + virtual wxGraphicsContext * CreateContext( const wxMemoryDC& dc) = 0 ; #endif -#endif - virtual wxGraphicsContext * CreateContextFromNativeContext( void * context ) = 0; virtual wxGraphicsContext * CreateContextFromNativeWindow( void * window ) = 0; virtual wxGraphicsContext * CreateContext( wxWindow* window ) = 0; -#if wxUSE_IMAGE - virtual wxGraphicsContext * CreateContextFromImage(wxImage& image) = 0; -#endif // wxUSE_IMAGE - // create a context that can be used for measuring texts only, no drawing allowed virtual wxGraphicsContext * CreateMeasuringContext() = 0; @@ -831,59 +705,31 @@ public: // Paints - virtual wxGraphicsPen CreatePen(const wxPen& pen) = 0; + virtual wxGraphicsPen CreatePen(const wxPen& pen) = 0 ; - virtual wxGraphicsBrush CreateBrush(const wxBrush& brush ) = 0; + virtual wxGraphicsBrush CreateBrush(const wxBrush& brush ) = 0 ; - // Gradient brush creation functions may not honour all the stops specified - // stops and use just its boundary colours (this is currently the case - // under OS X) - virtual wxGraphicsBrush - CreateLinearGradientBrush(wxDouble x1, wxDouble y1, - wxDouble x2, wxDouble y2, - const wxGraphicsGradientStops& stops) = 0; + // sets the brush to a linear gradient, starting at (x1,y1) with color c1 to (x2,y2) with color c2 + virtual wxGraphicsBrush CreateLinearGradientBrush( wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2, + const wxColour&c1, const wxColour&c2) = 0; - virtual wxGraphicsBrush - CreateRadialGradientBrush(wxDouble xo, wxDouble yo, - wxDouble xc, wxDouble yc, - wxDouble radius, - const wxGraphicsGradientStops& stops) = 0; + // sets the brush to a radial gradient originating at (xo,yc) with color oColor and ends on a circle around (xc,yc) + // with radius r and color cColor + virtual wxGraphicsBrush CreateRadialGradientBrush( wxDouble xo, wxDouble yo, wxDouble xc, wxDouble yc, wxDouble radius, + const wxColour &oColor, const wxColour &cColor) = 0; - // sets the font + // sets the font virtual wxGraphicsFont CreateFont( const wxFont &font , const wxColour &col = *wxBLACK ) = 0; - virtual wxGraphicsFont CreateFont(double sizeInPixels, - const wxString& facename, - int flags = wxFONTFLAG_DEFAULT, - const wxColour& col = *wxBLACK) = 0; - // create a native bitmap representation - virtual wxGraphicsBitmap CreateBitmap( const wxBitmap &bitmap ) = 0; -#if wxUSE_IMAGE - virtual wxGraphicsBitmap CreateBitmapFromImage(const wxImage& image) = 0; - virtual wxImage CreateImageFromBitmap(const wxGraphicsBitmap& bmp) = 0; -#endif // wxUSE_IMAGE +#if wxABI_VERSION >= 20809 + wxGraphicsBitmap CreateBitmap( const wxBitmap &bmp ); +#endif - // create a graphics bitmap from a native bitmap - virtual wxGraphicsBitmap CreateBitmapFromNativeBitmap( void* bitmap ) = 0; - - // create a subimage from a native image representation - virtual wxGraphicsBitmap CreateSubBitmap( const wxGraphicsBitmap &bitmap, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) = 0; - -private: - wxDECLARE_NO_COPY_CLASS(wxGraphicsRenderer); +private : + DECLARE_NO_COPY_CLASS(wxGraphicsRenderer) DECLARE_ABSTRACT_CLASS(wxGraphicsRenderer) -}; +} ; - -#if wxUSE_IMAGE -inline -wxImage wxGraphicsBitmap::ConvertToImage() const -{ - wxGraphicsRenderer* renderer = GetRenderer(); - return renderer ? renderer->CreateImageFromBitmap(*this) : wxNullImage; -} -#endif // wxUSE_IMAGE - -#endif // wxUSE_GRAPHICS_CONTEXT +#endif #endif // _WX_GRAPHICS_H_ diff --git a/Source/3rd Party/wx/include/wx/gsocket.h b/Source/3rd Party/wx/include/wx/gsocket.h new file mode 100644 index 000000000..83d8ee49b --- /dev/null +++ b/Source/3rd Party/wx/include/wx/gsocket.h @@ -0,0 +1,184 @@ +/* ------------------------------------------------------------------------- + * Project: GSocket (Generic Socket) + * Name: gsocket.h + * Author: Guilhem Lavaux + * Guillermo Rodriguez Garcia (maintainer) + * Copyright: (c) Guilhem Lavaux + * Licence: wxWindows Licence + * Purpose: GSocket include file (system independent) + * CVSID: $Id: gsocket.h 33948 2005-05-04 18:57:50Z JS $ + * ------------------------------------------------------------------------- + */ + +#ifndef __GSOCKET_H +#define __GSOCKET_H + +#ifndef __GSOCKET_STANDALONE__ +#include "wx/defs.h" + +#include "wx/dlimpexp.h" /* for WXDLLIMPEXP_NET */ + +#endif + +#if wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) + +#include + +/* + Including sys/types.h under cygwin results in the warnings about "fd_set + having been defined in sys/types.h" when winsock.h is included later and + doesn't seem to be necessary anyhow. It's not needed under Mac neither. + */ +#if !defined(__WXMAC__) && !defined(__CYGWIN__) && !defined(__WXWINCE__) +#include +#endif + +#ifdef __WXWINCE__ +#include +#endif + +class GSocket; + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct _GAddress GAddress; + +typedef enum { + GSOCK_NOFAMILY = 0, + GSOCK_INET, + GSOCK_INET6, + GSOCK_UNIX +} GAddressType; + +typedef enum { + GSOCK_STREAMED, + GSOCK_UNSTREAMED +} GSocketStream; + +typedef enum { + GSOCK_NOERROR = 0, + GSOCK_INVOP, + GSOCK_IOERR, + GSOCK_INVADDR, + GSOCK_INVSOCK, + GSOCK_NOHOST, + GSOCK_INVPORT, + GSOCK_WOULDBLOCK, + GSOCK_TIMEDOUT, + GSOCK_MEMERR, + GSOCK_OPTERR +} GSocketError; + +/* See below for an explanation on how events work. + */ +typedef enum { + GSOCK_INPUT = 0, + GSOCK_OUTPUT = 1, + GSOCK_CONNECTION = 2, + GSOCK_LOST = 3, + GSOCK_MAX_EVENT = 4 +} GSocketEvent; + +enum { + GSOCK_INPUT_FLAG = 1 << GSOCK_INPUT, + GSOCK_OUTPUT_FLAG = 1 << GSOCK_OUTPUT, + GSOCK_CONNECTION_FLAG = 1 << GSOCK_CONNECTION, + GSOCK_LOST_FLAG = 1 << GSOCK_LOST +}; + +typedef int GSocketEventFlags; + +typedef void (*GSocketCallback)(GSocket *socket, GSocketEvent event, + char *cdata); + + +/* Functions tables for internal use by GSocket code: */ + +/* Actually this is a misnomer now, but reusing this name means I don't + have to ifdef app traits or common socket code */ +class GSocketGUIFunctionsTable +{ +public: + // needed since this class declares virtual members + virtual ~GSocketGUIFunctionsTable() { } + virtual bool OnInit() = 0; + virtual void OnExit() = 0; + virtual bool CanUseEventLoop() = 0; + virtual bool Init_Socket(GSocket *socket) = 0; + virtual void Destroy_Socket(GSocket *socket) = 0; +#ifndef __WINDOWS__ + virtual void Install_Callback(GSocket *socket, GSocketEvent event) = 0; + virtual void Uninstall_Callback(GSocket *socket, GSocketEvent event) = 0; +#endif + virtual void Enable_Events(GSocket *socket) = 0; + virtual void Disable_Events(GSocket *socket) = 0; +}; + + +/* Global initializers */ + +/* Sets GUI functions callbacks. Must be called *before* GSocket_Init + if the app uses async sockets. */ +void GSocket_SetGUIFunctions(GSocketGUIFunctionsTable *guifunc); + +/* GSocket_Init() must be called at the beginning */ +int GSocket_Init(void); + +/* GSocket_Cleanup() must be called at the end */ +void GSocket_Cleanup(void); + + +/* Constructors / Destructors */ + +GSocket *GSocket_new(void); + + +/* GAddress */ + +GAddress *GAddress_new(void); +GAddress *GAddress_copy(GAddress *address); +void GAddress_destroy(GAddress *address); + +void GAddress_SetFamily(GAddress *address, GAddressType type); +GAddressType GAddress_GetFamily(GAddress *address); + +/* The use of any of the next functions will set the address family to + * the specific one. For example if you use GAddress_INET_SetHostName, + * address family will be implicitly set to AF_INET. + */ + +GSocketError GAddress_INET_SetHostName(GAddress *address, const char *hostname); +GSocketError GAddress_INET_SetAnyAddress(GAddress *address); +GSocketError GAddress_INET_SetHostAddress(GAddress *address, + unsigned long hostaddr); +GSocketError GAddress_INET_SetPortName(GAddress *address, const char *port, + const char *protocol); +GSocketError GAddress_INET_SetPort(GAddress *address, unsigned short port); + +GSocketError GAddress_INET_GetHostName(GAddress *address, char *hostname, + size_t sbuf); +unsigned long GAddress_INET_GetHostAddress(GAddress *address); +unsigned short GAddress_INET_GetPort(GAddress *address); + +/* TODO: Define specific parts (INET6, UNIX) */ + +GSocketError GAddress_UNIX_SetPath(GAddress *address, const char *path); +GSocketError GAddress_UNIX_GetPath(GAddress *address, char *path, size_t sbuf); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +# if defined(__WINDOWS__) +# include "wx/msw/gsockmsw.h" +# elif defined(__WXMAC__) && !defined(__DARWIN__) +# include "wx/mac/gsockmac.h" +# else +# include "wx/unix/gsockunx.h" +# endif + +#endif /* wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) */ + +#endif /* __GSOCKET_H */ diff --git a/Source/3rd Party/wx/include/wx/hash.h b/Source/3rd Party/wx/include/wx/hash.h index bed013171..9937bbe4e 100644 --- a/Source/3rd Party/wx/include/wx/hash.h +++ b/Source/3rd Party/wx/include/wx/hash.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: VZ at 25.02.00: type safe hashes with WX_DECLARE_HASH() // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: hash.h 53135 2008-04-12 02:31:04Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -13,12 +13,23 @@ #define _WX_HASH_H__ #include "wx/defs.h" -#include "wx/string.h" -#if !wxUSE_STD_CONTAINERS +#if !wxUSE_STL && WXWIN_COMPATIBILITY_2_4 + #define wxUSE_OLD_HASH_TABLE 1 +#else + #define wxUSE_OLD_HASH_TABLE 0 +#endif + +#if !wxUSE_STL #include "wx/object.h" #else - class WXDLLIMPEXP_FWD_BASE wxObject; + class WXDLLIMPEXP_BASE wxObject; +#endif +#if wxUSE_OLD_HASH_TABLE + #include "wx/list.h" +#endif +#if WXWIN_COMPATIBILITY_2_4 + #include "wx/dynarray.h" #endif // the default size of the hash @@ -31,10 +42,69 @@ * the list to find the desired item. */ +// ---------------------------------------------------------------------------- +// this is the base class for object hashes: hash tables which contain +// pointers to objects +// ---------------------------------------------------------------------------- + +#if wxUSE_OLD_HASH_TABLE + +class WXDLLIMPEXP_BASE wxHashTableBase : public wxObject +{ +public: + wxHashTableBase(); + + void Create(wxKeyType keyType = wxKEY_INTEGER, + size_t size = wxHASH_SIZE_DEFAULT); + void Destroy(); + + size_t GetSize() const { return m_hashSize; } + size_t GetCount() const { return m_count; } + + void DeleteContents(bool flag); + +protected: + // find the node for (key, value) + wxNodeBase *GetNode(long key, long value) const; + + // the array of lists in which we store the values for given key hash + wxListBase **m_hashTable; + + // the size of m_lists array + size_t m_hashSize; + + // the type of indexing we use + wxKeyType m_keyType; + + // the total number of elements in the hash + size_t m_count; + + // should we delete our data? + bool m_deleteContents; + +private: + // no copy ctor/assignment operator (yet) + DECLARE_NO_COPY_CLASS(wxHashTableBase) +}; + +#else // if !wxUSE_OLD_HASH_TABLE + +#if !defined(wxENUM_KEY_TYPE_DEFINED) +#define wxENUM_KEY_TYPE_DEFINED + +enum wxKeyType +{ + wxKEY_NONE, + wxKEY_INTEGER, + wxKEY_STRING +}; + +#endif + union wxHashKeyValue { long integer; - wxString *string; + wxChar *string; }; // for some compilers (AIX xlC), defining it as friend inside the class is not @@ -48,12 +118,12 @@ class WXDLLIMPEXP_BASE wxHashTableBase_Node public: wxHashTableBase_Node( long key, void* value, wxHashTableBase* table ); - wxHashTableBase_Node( const wxString& key, void* value, + wxHashTableBase_Node( const wxChar* key, void* value, wxHashTableBase* table ); ~wxHashTableBase_Node(); long GetKeyInteger() const { return m_key.integer; } - const wxString& GetKeyString() const { return *m_key.string; } + const wxChar* GetKeyString() const { return m_key.string; } void* GetData() const { return m_value; } void SetData( void* data ) { m_value = data; } @@ -80,7 +150,7 @@ protected: }; class WXDLLIMPEXP_BASE wxHashTableBase -#if !wxUSE_STD_CONTAINERS +#if !wxUSE_STL : public wxObject #endif { @@ -101,15 +171,15 @@ public: void DeleteContents( bool flag ) { m_deleteContents = flag; } - static long MakeKey(const wxString& string); + static long MakeKey(const wxChar *string); protected: void DoPut( long key, long hash, void* data ); - void DoPut( const wxString& key, long hash, void* data ); + void DoPut( const wxChar* key, long hash, void* data ); void* DoGet( long key, long hash ) const; - void* DoGet( const wxString& key, long hash ) const; + void* DoGet( const wxChar* key, long hash ) const; void* DoDelete( long key, long hash ); - void* DoDelete( const wxString& key, long hash ); + void* DoDelete( const wxChar* key, long hash ); private: // Remove the node from the hash, *only called from @@ -150,13 +220,96 @@ protected: bool m_deleteContents; private: - wxDECLARE_NO_COPY_CLASS(wxHashTableBase); + DECLARE_NO_COPY_CLASS(wxHashTableBase) }; +#endif // wxUSE_OLD_HASH_TABLE + +#if !wxUSE_STL + +#if WXWIN_COMPATIBILITY_2_4 + +// ---------------------------------------------------------------------------- +// a hash table which stores longs +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxHashTableLong : public wxObject +{ +public: + wxHashTableLong(size_t size = wxHASH_SIZE_DEFAULT) + { Init(size); } + virtual ~wxHashTableLong(); + + void Create(size_t size = wxHASH_SIZE_DEFAULT); + void Destroy(); + + size_t GetSize() const { return m_hashSize; } + size_t GetCount() const { return m_count; } + + void Put(long key, long value); + long Get(long key) const; + long Delete(long key); + +protected: + void Init(size_t size); + +private: + wxArrayLong **m_values, + **m_keys; + + // the size of array above + size_t m_hashSize; + + // the total number of elements in the hash + size_t m_count; + + // not implemented yet + DECLARE_NO_COPY_CLASS(wxHashTableLong) +}; + +// ---------------------------------------------------------------------------- +// wxStringHashTable: a hash table which indexes strings with longs +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxStringHashTable : public wxObject +{ +public: + wxStringHashTable(size_t sizeTable = wxHASH_SIZE_DEFAULT); + virtual ~wxStringHashTable(); + + // add a string associated with this key to the table + void Put(long key, const wxString& value); + + // get the string from the key: if not found, an empty string is returned + // and the wasFound is set to false if not NULL + wxString Get(long key, bool *wasFound = NULL) const; + + // remove the item, returning true if the item was found and deleted + bool Delete(long key) const; + + // clean up + void Destroy(); + +private: + wxArrayLong **m_keys; + wxArrayString **m_values; + + // the size of array above + size_t m_hashSize; + + DECLARE_NO_COPY_CLASS(wxStringHashTable) +}; + +#endif // WXWIN_COMPATIBILITY_2_4 + +#endif // !wxUSE_STL + // ---------------------------------------------------------------------------- // for compatibility only // ---------------------------------------------------------------------------- +#if !wxUSE_OLD_HASH_TABLE + class WXDLLIMPEXP_BASE wxHashTable_Node : public wxHashTableBase_Node { friend class WXDLLIMPEXP_FWD_BASE wxHashTable; @@ -164,7 +317,7 @@ public: wxHashTable_Node( long key, void* value, wxHashTableBase* table ) : wxHashTableBase_Node( key, value, table ) { } - wxHashTable_Node( const wxString& key, void* value, + wxHashTable_Node( const wxChar* key, void* value, wxHashTableBase* table ) : wxHashTableBase_Node( key, value, table ) { } @@ -200,9 +353,9 @@ public: { DoPut( value, value, object ); } void Put(long lhash, long value, wxObject *object) { DoPut( value, lhash, object ); } - void Put(const wxString& value, wxObject *object) + void Put(const wxChar *value, wxObject *object) { DoPut( value, MakeKey( value ), object ); } - void Put(long lhash, const wxString& value, wxObject *object) + void Put(long lhash, const wxChar *value, wxObject *object) { DoPut( value, lhash, object ); } // key and value are the same @@ -210,9 +363,9 @@ public: { return (wxObject*)DoGet( value, value ); } wxObject *Get(long lhash, long value) const { return (wxObject*)DoGet( value, lhash ); } - wxObject *Get(const wxString& value) const + wxObject *Get(const wxChar *value) const { return (wxObject*)DoGet( value, MakeKey( value ) ); } - wxObject *Get(long lhash, const wxString& value) const + wxObject *Get(long lhash, const wxChar *value) const { return (wxObject*)DoGet( value, lhash ); } // Deletes entry and returns data if found @@ -220,11 +373,16 @@ public: { return (wxObject*)DoDelete( key, key ); } wxObject *Delete(long lhash, long key) { return (wxObject*)DoDelete( key, lhash ); } - wxObject *Delete(const wxString& key) + wxObject *Delete(const wxChar *key) { return (wxObject*)DoDelete( key, MakeKey( key ) ); } - wxObject *Delete(long lhash, const wxString& key) + wxObject *Delete(long lhash, const wxChar *key) { return (wxObject*)DoDelete( key, lhash ); } + // Construct your own integer key from a string, e.g. in case + // you need to combine it with something + long MakeKey(const wxChar *string) const + { return wxHashTableBase::MakeKey(string); } + // Way of iterating through whole hash table (e.g. to delete everything) // Not necessary, of course, if you're only storing pointers to // objects maintained separately @@ -251,6 +409,101 @@ private: size_t m_currBucket; }; +#else // if wxUSE_OLD_HASH_TABLE + +class WXDLLIMPEXP_BASE wxHashTable : public wxObject +{ +public: + typedef wxNode Node; + typedef wxNode* compatibility_iterator; + + int n; + int current_position; + wxNode *current_node; + + unsigned int key_type; + wxList **hash_table; + + wxHashTable(int the_key_type = wxKEY_INTEGER, + int size = wxHASH_SIZE_DEFAULT); + virtual ~wxHashTable(); + + // copy ctor and assignment operator + wxHashTable(const wxHashTable& table) : wxObject() + { DoCopy(table); } + wxHashTable& operator=(const wxHashTable& table) + { Clear(); DoCopy(table); return *this; } + + void DoCopy(const wxHashTable& table); + + void Destroy(); + + bool Create(int the_key_type = wxKEY_INTEGER, + int size = wxHASH_SIZE_DEFAULT); + + // Note that there are 2 forms of Put, Get. + // With a key and a value, the *value* will be checked + // when a collision is detected. Otherwise, if there are + // 2 items with a different value but the same key, + // we'll retrieve the WRONG ONE. So where possible, + // supply the required value along with the key. + // In fact, the value-only versions make a key, and still store + // the value. The use of an explicit key might be required + // e.g. when combining several values into one key. + // When doing that, it's highly likely we'll get a collision, + // e.g. 1 + 2 = 3, 2 + 1 = 3. + + // key and value are NOT necessarily the same + void Put(long key, long value, wxObject *object); + void Put(long key, const wxChar *value, wxObject *object); + + // key and value are the same + void Put(long value, wxObject *object); + void Put(const wxChar *value, wxObject *object); + + // key and value not the same + wxObject *Get(long key, long value) const; + wxObject *Get(long key, const wxChar *value) const; + + // key and value are the same + wxObject *Get(long value) const; + wxObject *Get(const wxChar *value) const; + + // Deletes entry and returns data if found + wxObject *Delete(long key); + wxObject *Delete(const wxChar *key); + + wxObject *Delete(long key, int value); + wxObject *Delete(long key, const wxChar *value); + + // Construct your own integer key from a string, e.g. in case + // you need to combine it with something + long MakeKey(const wxChar *string) const; + + // Way of iterating through whole hash table (e.g. to delete everything) + // Not necessary, of course, if you're only storing pointers to + // objects maintained separately + + void BeginFind(); + Node* Next(); + + void DeleteContents(bool flag); + void Clear(); + + // Returns number of nodes + size_t GetCount() const { return m_count; } + +private: + size_t m_count; // number of elements in the hashtable + bool m_deleteContents; + + DECLARE_DYNAMIC_CLASS(wxHashTable) +}; + +#endif // wxUSE_OLD_HASH_TABLE + +#if !wxUSE_OLD_HASH_TABLE + // defines a new type safe hash table which stores the elements of type eltype // in lists of class listclass #define _WX_DECLARE_HASH(eltype, dummy, hashclass, classexp) \ @@ -279,6 +532,69 @@ private: DECLARE_NO_COPY_CLASS(hashclass) \ } +#else // if wxUSE_OLD_HASH_TABLE + +#define _WX_DECLARE_HASH(eltype, listclass, hashclass, classexp) \ + classexp hashclass : public wxHashTableBase \ + { \ + public: \ + hashclass(wxKeyType keyType = wxKEY_INTEGER, \ + size_t size = wxHASH_SIZE_DEFAULT) \ + { Create(keyType, size); } \ + \ + virtual ~hashclass() { Destroy(); } \ + \ + void Put(long key, long val, eltype *data) { DoPut(key, val, data); } \ + void Put(long key, eltype *data) { DoPut(key, key, data); } \ + \ + eltype *Get(long key, long value) const \ + { \ + wxNodeBase *node = GetNode(key, value); \ + return node ? ((listclass::Node *)node)->GetData() : (eltype *)0; \ + } \ + eltype *Get(long key) const { return Get(key, key); } \ + \ + eltype *Delete(long key, long value) \ + { \ + eltype *data; \ + \ + wxNodeBase *node = GetNode(key, value); \ + if ( node ) \ + { \ + data = ((listclass::Node *)node)->GetData(); \ + \ + delete node; \ + m_count--; \ + } \ + else \ + { \ + data = (eltype *)0; \ + } \ + \ + return data; \ + } \ + eltype *Delete(long key) { return Delete(key, key); } \ + \ + protected: \ + void DoPut(long key, long value, eltype *data) \ + { \ + size_t slot = (size_t)abs((int)(key % (long)m_hashSize)); \ + \ + if ( !m_hashTable[slot] ) \ + { \ + m_hashTable[slot] = new listclass(m_keyType); \ + if ( m_deleteContents ) \ + m_hashTable[slot]->DeleteContents(true); \ + } \ + \ + ((listclass *)m_hashTable[slot])->Append(value, data); \ + m_count++; \ + } \ + \ + DECLARE_NO_COPY_CLASS(hashclass) \ + } + +#endif // wxUSE_OLD_HASH_TABLE // this macro is to be used in the user code #define WX_DECLARE_HASH(el, list, hash) \ @@ -287,7 +603,7 @@ private: // and this one does exactly the same thing but should be used inside the // library #define WX_DECLARE_EXPORTED_HASH(el, list, hash) \ - _WX_DECLARE_HASH(el, list, hash, class WXDLLIMPEXP_CORE) + _WX_DECLARE_HASH(el, list, hash, class WXDLLEXPORT) #define WX_DECLARE_USER_EXPORTED_HASH(el, list, hash, usergoo) \ _WX_DECLARE_HASH(el, list, hash, class usergoo) @@ -310,4 +626,5 @@ private: (hash).Clear(); \ } -#endif // _WX_HASH_H__ +#endif + // _WX_HASH_H__ diff --git a/Source/3rd Party/wx/include/wx/hashmap.h b/Source/3rd Party/wx/include/wx/hashmap.h index 18a939c02..44b081fb3 100644 --- a/Source/3rd Party/wx/include/wx/hashmap.h +++ b/Source/3rd Party/wx/include/wx/hashmap.h @@ -4,7 +4,7 @@ // Author: Mattia Barbon // Modified by: // Created: 29/01/2002 -// RCS-ID: $Id$ +// RCS-ID: $Id: hashmap.h 57388 2008-12-17 09:34:48Z VZ $ // Copyright: (c) Mattia Barbon // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -13,11 +13,10 @@ #define _WX_HASHMAP_H_ #include "wx/string.h" -#include "wx/wxcrt.h" -// In wxUSE_STD_CONTAINERS build we prefer to use the standard hash map class -// but it can be either in non-standard hash_map header (old g++ and some other -// STL implementations) or in C++0x standard unordered_map which can in turn be +// In wxUSE_STL build we prefer to use the standard hash map class but it can +// be either in non-standard hash_map header (old g++ and some other STL +// implementations) or in C++0x standard unordered_map which can in turn be // available either in std::tr1 or std namespace itself // // To summarize: if std::unordered_map is available use it, otherwise use tr1 @@ -28,7 +27,7 @@ #define HAVE_STL_HASH_MAP #endif -#if wxUSE_STD_CONTAINERS && \ +#if wxUSE_STL && \ (defined(HAVE_STD_UNORDERED_MAP) || defined(HAVE_TR1_UNORDERED_MAP)) #if defined(HAVE_STD_UNORDERED_MAP) @@ -42,7 +41,7 @@ #define _WX_DECLARE_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME, CLASSEXP ) \ typedef WX_HASH_MAP_NAMESPACE::unordered_map< KEY_T, VALUE_T, HASH_T, KEY_EQ_T > CLASSNAME -#elif wxUSE_STD_CONTAINERS && defined(HAVE_STL_HASH_MAP) +#elif wxUSE_STL && defined(HAVE_STL_HASH_MAP) #if defined(HAVE_EXT_HASH_MAP) #include @@ -59,7 +58,7 @@ #define _WX_DECLARE_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME, CLASSEXP ) \ typedef WX_HASH_MAP_NAMESPACE::hash_map< KEY_T, VALUE_T, HASH_T, KEY_EQ_T > CLASSNAME -#else // !wxUSE_STD_CONTAINERS || no std::{hash,unordered}_map class available +#else // !wxUSE_STL || no std::{hash,unordered}_map class available #define wxNEEDS_WX_HASH_MAP @@ -72,12 +71,12 @@ typedef int ptrdiff_t; // private struct WXDLLIMPEXP_BASE _wxHashTable_NodeBase { - _wxHashTable_NodeBase() : m_next(NULL) {} + _wxHashTable_NodeBase() : m_nxt(0) {} - _wxHashTable_NodeBase* m_next; + _wxHashTable_NodeBase* m_nxt; // Cannot do this: -// wxDECLARE_NO_COPY_CLASS(_wxHashTable_NodeBase); +// DECLARE_NO_COPY_CLASS(_wxHashTable_NodeBase) // without rewriting the macros, which require a public copy constructor. }; @@ -98,7 +97,7 @@ protected: for( size_t i = 0; i < buckets; ++i ) if( table[i] ) return table[i]; - return NULL; + return 0; } // as static const unsigned prime_count = 31 but works with all compilers @@ -127,9 +126,7 @@ protected: } }; -#define _WX_DECLARE_HASHTABLE( VALUE_T, KEY_T, HASH_T, KEY_EX_T, KEY_EQ_T,\ - PTROPERATOR, CLASSNAME, CLASSEXP, \ - SHOULD_GROW, SHOULD_SHRINK ) \ +#define _WX_DECLARE_HASHTABLE( VALUE_T, KEY_T, HASH_T, KEY_EX_T, KEY_EQ_T, CLASSNAME, CLASSEXP, SHOULD_GROW, SHOULD_SHRINK ) \ CLASSEXP CLASSNAME : protected _wxHashTableBase2 \ { \ public: \ @@ -148,10 +145,11 @@ public: \ typedef const KEY_T const_key_type; \ typedef const VALUE_T const_mapped_type; \ public: \ + struct Node; \ typedef KEY_EX_T key_extractor; \ typedef CLASSNAME Self; \ protected: \ - _wxHashTable_NodeBase** m_table; \ + Node** m_table; \ size_t m_tableBuckets; \ size_t m_items; \ hasher m_hasher; \ @@ -163,15 +161,17 @@ public: \ public: \ Node( const value_type& value ) \ : m_value( value ) {} \ - Node* next() { return static_cast(m_next); } \ + Node* m_next() { return (Node*)this->m_nxt; } \ \ value_type m_value; \ }; \ \ + CLASSEXP Iterator; \ + friend CLASSEXP Iterator; \ protected: \ static void DeleteNode( _wxHashTable_NodeBase* node ) \ { \ - delete static_cast(node); \ + delete (Node*)node; \ } \ public: \ /* */ \ @@ -183,9 +183,9 @@ public: \ Node* m_node; \ Self* m_ht; \ \ - Iterator() : m_node(NULL), m_ht(NULL) {} \ + Iterator() : m_node(0), m_ht(0) {} \ Iterator( Node* node, const Self* ht ) \ - : m_node(node), m_ht(const_cast(ht)) {} \ + : m_node(node), m_ht((Self*)ht) {} \ bool operator ==( const Iterator& it ) const \ { return m_node == it.m_node; } \ bool operator !=( const Iterator& it ) const \ @@ -197,18 +197,17 @@ public: \ for( size_type i = bucket + 1; i < m_ht->m_tableBuckets; ++i ) \ { \ if( m_ht->m_table[i] ) \ - return static_cast(m_ht->m_table[i]); \ + return m_ht->m_table[i]; \ } \ - return NULL; \ + return 0; \ } \ \ void PlusPlus() \ { \ - Node* next = m_node->next(); \ + Node* next = m_node->m_next(); \ m_node = next ? next : GetNextNode(); \ } \ }; \ - friend class Iterator; \ \ public: \ CLASSEXP iterator : public Iterator \ @@ -219,7 +218,7 @@ public: \ iterator& operator++() { PlusPlus(); return *this; } \ iterator operator++(int) { iterator it=*this;PlusPlus();return it; } \ reference operator *() const { return m_node->m_value; } \ - PTROPERATOR(pointer) \ + pointer operator ->() const { return &(m_node->m_value); } \ }; \ \ CLASSEXP const_iterator : public Iterator \ @@ -228,11 +227,11 @@ public: \ const_iterator() : Iterator() {} \ const_iterator(iterator i) : Iterator(i) {} \ const_iterator( Node* node, const Self* ht ) \ - : Iterator(node, const_cast(ht)) {} \ + : Iterator( node, (Self*)ht ) {} \ const_iterator& operator++() { PlusPlus();return *this; } \ const_iterator operator++(int) { const_iterator it=*this;PlusPlus();return it; } \ const_reference operator *() const { return m_node->m_value; } \ - PTROPERATOR(const_pointer) \ + const_pointer operator ->() const { return &(m_node->m_value); } \ }; \ \ CLASSNAME( size_type sz = 10, const hasher& hfun = hasher(), \ @@ -244,11 +243,11 @@ public: \ m_equals( k_eq ), \ m_getKey( k_ex ) \ { \ - m_table = (_wxHashTable_NodeBase**)AllocTable(m_tableBuckets); \ + m_table = (Node**)AllocTable( m_tableBuckets ); \ } \ \ CLASSNAME( const Self& ht ) \ - : m_table(NULL), \ + : m_table( 0 ), \ m_tableBuckets( 0 ), \ m_items( ht.m_items ), \ m_hasher( ht.m_hasher ), \ @@ -260,15 +259,12 @@ public: \ \ const Self& operator=( const Self& ht ) \ { \ - if (&ht != this) \ - { \ - clear(); \ - m_hasher = ht.m_hasher; \ - m_equals = ht.m_equals; \ - m_getKey = ht.m_getKey; \ - m_items = ht.m_items; \ - HashCopy( ht ); \ - } \ + clear(); \ + m_hasher = ht.m_hasher; \ + m_equals = ht.m_equals; \ + m_getKey = ht.m_getKey; \ + m_items = ht.m_items; \ + HashCopy( ht ); \ return *this; \ } \ \ @@ -286,7 +282,8 @@ public: \ /* shrink it ( perhaps it should ) */ \ void clear() \ { \ - DeleteNodes(m_tableBuckets, m_table, DeleteNode); \ + DeleteNodes( m_tableBuckets, (_wxHashTable_NodeBase**)m_table, \ + DeleteNode ); \ m_items = 0; \ } \ \ @@ -294,23 +291,23 @@ public: \ size_type max_size() const { return size_type(-1); } \ bool empty() const { return size() == 0; } \ \ - const_iterator end() const { return const_iterator(NULL, this); } \ - iterator end() { return iterator(NULL, this); } \ + const_iterator end() const { return const_iterator( 0, this ); } \ + iterator end() { return iterator( 0, this ); } \ const_iterator begin() const \ - { return const_iterator(static_cast(GetFirstNode(m_tableBuckets, m_table)), this); } \ + { return const_iterator( (Node*)GetFirstNode( m_tableBuckets, (_wxHashTable_NodeBase**)m_table ), this ); } \ iterator begin() \ - { return iterator(static_cast(GetFirstNode(m_tableBuckets, m_table)), this); } \ + { return iterator( (Node*)GetFirstNode( m_tableBuckets, (_wxHashTable_NodeBase**)m_table ), this ); } \ \ size_type erase( const const_key_type& key ) \ { \ - _wxHashTable_NodeBase** node = GetNodePtr(key); \ + Node** node = GetNodePtr( key ); \ \ if( !node ) \ return 0; \ \ --m_items; \ - _wxHashTable_NodeBase* temp = (*node)->m_next; \ - delete static_cast(*node); \ + Node* temp = (*node)->m_next(); \ + delete *node; \ (*node) = temp; \ if( SHOULD_SHRINK( m_tableBuckets, m_items ) ) \ ResizeTable( GetPreviousPrime( (unsigned long) m_tableBuckets ) - 1 ); \ @@ -329,7 +326,7 @@ protected: \ { \ const const_key_type& key = m_getKey( value ); \ size_t bucket = m_hasher( key ) % m_tableBuckets; \ - Node* node = static_cast(m_table[bucket]); \ + Node* node = m_table[bucket]; \ \ while( node ) \ { \ @@ -338,7 +335,7 @@ protected: \ created = false; \ return node; \ } \ - node = node->next(); \ + node = node->m_next(); \ } \ created = true; \ return CreateNode( value, bucket); \ @@ -346,7 +343,7 @@ protected: \ Node * CreateNode( const value_type& value, size_t bucket ) \ {\ Node* node = new Node( value ); \ - node->m_next = m_table[bucket]; \ + node->m_nxt = m_table[bucket]; \ m_table[bucket] = node; \ \ /* must be after the node is inserted */ \ @@ -362,16 +359,17 @@ protected: \ }\ \ /* returns NULL if not found */ \ - _wxHashTable_NodeBase** GetNodePtr(const const_key_type& key) const \ + Node** GetNodePtr( const const_key_type& key ) const \ { \ size_t bucket = m_hasher( key ) % m_tableBuckets; \ - _wxHashTable_NodeBase** node = &m_table[bucket]; \ + Node** node = &m_table[bucket]; \ \ while( *node ) \ { \ - if (m_equals(m_getKey(static_cast(*node)->m_value), key)) \ + if( m_equals( m_getKey( (*node)->m_value ), key ) ) \ return node; \ - node = &(*node)->m_next; \ + /* Tell the compiler to not do any strict-aliasing assumptions with a void cast? Can we make such a runtime guarantee? */ \ + node = (Node**)&(*node)->m_nxt; \ } \ \ return NULL; \ @@ -382,28 +380,28 @@ protected: \ Node* GetNode( const const_key_type& key ) const \ { \ size_t bucket = m_hasher( key ) % m_tableBuckets; \ - Node* node = static_cast(m_table[bucket]); \ + Node* node = m_table[bucket]; \ \ while( node ) \ { \ if( m_equals( m_getKey( node->m_value ), key ) ) \ return node; \ - node = node->next(); \ + node = node->m_next(); \ } \ \ - return NULL; \ + return 0; \ } \ \ void ResizeTable( size_t newSize ) \ { \ newSize = GetNextPrime( (unsigned long)newSize ); \ - _wxHashTable_NodeBase** srcTable = m_table; \ + Node** srcTable = m_table; \ size_t srcBuckets = m_tableBuckets; \ - m_table = (_wxHashTable_NodeBase**)AllocTable( newSize ); \ + m_table = (Node**)AllocTable( newSize ); \ m_tableBuckets = newSize; \ \ - CopyHashTable( srcTable, srcBuckets, \ - this, m_table, \ + CopyHashTable( (_wxHashTable_NodeBase**)srcTable, srcBuckets, \ + this, (_wxHashTable_NodeBase**)m_table, \ (BucketFromNode)GetBucketForNode,\ (ProcessNode)&DummyProcessNode ); \ FreeTable(srcTable); \ @@ -413,9 +411,9 @@ protected: \ void HashCopy( const Self& ht ) \ { \ ResizeTable( ht.size() ); \ - CopyHashTable( ht.m_table, ht.m_tableBuckets, \ + CopyHashTable( (_wxHashTable_NodeBase**)ht.m_table, ht.m_tableBuckets,\ (_wxHashTableBase2*)this, \ - m_table, \ + (_wxHashTable_NodeBase**)m_table, \ (BucketFromNode)GetBucketForNode, \ (ProcessNode)CopyNode ); \ } \ @@ -427,15 +425,12 @@ protected: \ CLASSEXP CLASSNAME \ { \ public: \ - typedef KEY_T first_type; \ - typedef VALUE_T second_type; \ typedef KEY_T t1; \ typedef VALUE_T t2; \ typedef const KEY_T const_t1; \ typedef const VALUE_T const_t2; \ \ - CLASSNAME(const const_t1& f, const const_t2& s) \ - : first(const_cast(f)), second(const_cast(s)) {} \ + CLASSNAME( const const_t1& f, const const_t2& s ):first(t1(f)),second(t2(s)) {} \ \ t1 first; \ t2 second; \ @@ -467,7 +462,7 @@ inline bool never_grow( size_t, size_t ) { return false; } inline bool never_shrink( size_t, size_t ) { return false; } inline bool grow_lf70( size_t buckets, size_t items ) { - return float(items)/float(buckets) >= 0.85f; + return float(items)/float(buckets) >= 0.85; } #endif // various hash map implementations @@ -492,7 +487,7 @@ class WXDLLIMPEXP_BASE wxIntegerHash WX_HASH_MAP_NAMESPACE::hash shortHash; WX_HASH_MAP_NAMESPACE::hash ushortHash; -#ifdef wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG +#if defined wxLongLong_t && !defined wxLongLongIsLong // hash ought to work but doesn't on some compilers #if (!defined SIZEOF_LONG_LONG && SIZEOF_LONG == 4) \ || (defined SIZEOF_LONG_LONG && SIZEOF_LONG_LONG == SIZEOF_LONG * 2) @@ -506,7 +501,7 @@ class WXDLLIMPEXP_BASE wxIntegerHash #else WX_HASH_MAP_NAMESPACE::hash longlongHash; #endif -#endif // wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG +#endif public: wxIntegerHash() { } @@ -516,10 +511,10 @@ public: size_t operator()( unsigned int x ) const { return uintHash( x ); } size_t operator()( short x ) const { return shortHash( x ); } size_t operator()( unsigned short x ) const { return ushortHash( x ); } -#ifdef wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG +#if defined wxLongLong_t && !defined wxLongLongIsLong size_t operator()( wxLongLong_t x ) const { return longlongHash(x); } size_t operator()( wxULongLong_t x ) const { return longlongHash(x); } -#endif // wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG +#endif wxIntegerHash& operator=(const wxIntegerHash&) { return *this; } }; @@ -537,10 +532,10 @@ public: unsigned long operator()( unsigned int x ) const { return x; } unsigned long operator()( short x ) const { return (unsigned long)x; } unsigned long operator()( unsigned short x ) const { return x; } -#ifdef wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG - wxULongLong_t operator()( wxLongLong_t x ) const { return static_cast(x); } +#if defined wxLongLong_t && !defined wxLongLongIsLong + wxULongLong_t operator()( wxLongLong_t x ) const { return wx_static_cast(wxULongLong_t, x); } wxULongLong_t operator()( wxULongLong_t x ) const { return x; } -#endif // wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG +#endif wxIntegerHash& operator=(const wxIntegerHash&) { return *this; } }; @@ -557,10 +552,10 @@ public: bool operator()( unsigned int a, unsigned int b ) const { return a == b; } bool operator()( short a, short b ) const { return a == b; } bool operator()( unsigned short a, unsigned short b ) const { return a == b; } -#ifdef wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG +#if defined wxLongLong_t && !defined wxLongLongIsLong bool operator()( wxLongLong_t a, wxLongLong_t b ) const { return a == b; } bool operator()( wxULongLong_t a, wxULongLong_t b ) const { return a == b; } -#endif // wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG +#endif wxIntegerEqual& operator=(const wxIntegerEqual&) { return *this; } }; @@ -574,7 +569,7 @@ public: #ifdef wxNEEDS_WX_HASH_MAP wxUIntPtr operator()( const void* k ) const { return wxPtrToUInt(k); } #else - size_t operator()( const void* k ) const { return (size_t)k; } + wxUIntPtr operator()( const void* k ) const { return wxPtrToUInt(k); } #endif wxPointerHash& operator=(const wxPointerHash&) { return *this; } @@ -589,29 +584,21 @@ public: wxPointerEqual& operator=(const wxPointerEqual&) { return *this; } }; -// wxString, char*, wchar_t* +// wxString, char*, wxChar* class WXDLLIMPEXP_BASE wxStringHash { public: wxStringHash() {} unsigned long operator()( const wxString& x ) const - { return stringHash( x.wx_str() ); } - unsigned long operator()( const wchar_t* x ) const - { return stringHash( x ); } + { return wxCharStringHash( x.c_str() ); } + unsigned long operator()( const wxChar* x ) const + { return wxCharStringHash( x ); } + static unsigned long wxCharStringHash( const wxChar* ); +#if wxUSE_UNICODE unsigned long operator()( const char* x ) const - { return stringHash( x ); } - -#if WXWIN_COMPATIBILITY_2_8 - static unsigned long wxCharStringHash( const wxChar* x ) - { return stringHash(x); } - #if wxUSE_UNICODE - static unsigned long charStringHash( const char* x ) - { return stringHash(x); } - #endif -#endif // WXWIN_COMPATIBILITY_2_8 - - static unsigned long stringHash( const wchar_t* ); - static unsigned long stringHash( const char* ); + { return charStringHash( x ); } + static unsigned long charStringHash( const char* ); +#endif // wxUSE_UNICODE wxStringHash& operator=(const wxStringHash&) { return *this; } }; @@ -634,16 +621,10 @@ public: #ifdef wxNEEDS_WX_HASH_MAP -#define wxPTROP_NORMAL(pointer) \ - pointer operator ->() const { return &(m_node->m_value); } -#define wxPTROP_NOP(pointer) - #define _WX_DECLARE_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME, CLASSEXP ) \ _WX_DECLARE_PAIR( KEY_T, VALUE_T, CLASSNAME##_wxImplementation_Pair, CLASSEXP ) \ _WX_DECLARE_HASH_MAP_KEY_EX( KEY_T, CLASSNAME##_wxImplementation_Pair, CLASSNAME##_wxImplementation_KeyEx, CLASSEXP ) \ -_WX_DECLARE_HASHTABLE( CLASSNAME##_wxImplementation_Pair, KEY_T, HASH_T, \ - CLASSNAME##_wxImplementation_KeyEx, KEY_EQ_T, wxPTROP_NORMAL, \ - CLASSNAME##_wxImplementation_HashTable, CLASSEXP, grow_lf70, never_shrink ) \ +_WX_DECLARE_HASHTABLE( CLASSNAME##_wxImplementation_Pair, KEY_T, HASH_T, CLASSNAME##_wxImplementation_KeyEx, KEY_EQ_T, CLASSNAME##_wxImplementation_HashTable, CLASSEXP, grow_lf70, never_shrink ) \ CLASSEXP CLASSNAME:public CLASSNAME##_wxImplementation_HashTable \ { \ public: \ @@ -684,12 +665,14 @@ public: \ \ size_type erase( const key_type& k ) \ { return CLASSNAME##_wxImplementation_HashTable::erase( k ); } \ - void erase( const iterator& it ) { erase( (*it).first ); } \ + void erase( const iterator& it ) { erase( it->first ); } \ + void erase( const const_iterator& it ) { erase( it->first ); } \ \ /* count() == 0 | 1 */ \ size_type count( const const_key_type& key ) \ { \ - return GetNode( key ) ? 1u : 0u; \ + /* explicit cast needed to suppress CodeWarrior warnings */ \ + return (size_type)(GetNode( key ) ? 1 : 0); \ } \ } @@ -714,7 +697,7 @@ public: \ #define WX_DECLARE_EXPORTED_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME) \ WX_DECLARE_HASH_MAP_WITH_DECL( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, \ - CLASSNAME, class WXDLLIMPEXP_CORE ) + CLASSNAME, class WXDLLEXPORT ) #define WX_DECLARE_STRING_HASH_MAP_WITH_DECL( VALUE_T, CLASSNAME, DECL ) \ _WX_DECLARE_HASH_MAP( wxString, VALUE_T, wxStringHash, wxStringEqual, \ @@ -722,7 +705,7 @@ public: \ #define WX_DECLARE_EXPORTED_STRING_HASH_MAP( VALUE_T, CLASSNAME ) \ WX_DECLARE_STRING_HASH_MAP_WITH_DECL( VALUE_T, CLASSNAME, \ - class WXDLLIMPEXP_CORE ) + class WXDLLEXPORT ) #define WX_DECLARE_VOIDPTR_HASH_MAP_WITH_DECL( VALUE_T, CLASSNAME, DECL ) \ _WX_DECLARE_HASH_MAP( void*, VALUE_T, wxPointerHash, wxPointerEqual, \ @@ -730,7 +713,7 @@ public: \ #define WX_DECLARE_EXPORTED_VOIDPTR_HASH_MAP( VALUE_T, CLASSNAME ) \ WX_DECLARE_VOIDPTR_HASH_MAP_WITH_DECL( VALUE_T, CLASSNAME, \ - class WXDLLIMPEXP_CORE ) + class WXDLLEXPORT ) // delete all hash elements // @@ -752,11 +735,5 @@ public: \ WX_DECLARE_HASH_MAP_WITH_DECL( long, long, wxIntegerHash, wxIntegerEqual, wxLongToLongHashMap, class WXDLLIMPEXP_BASE ); -WX_DECLARE_STRING_HASH_MAP_WITH_DECL( wxString, wxStringToStringHashMap, - class WXDLLIMPEXP_BASE ); - -WX_DECLARE_STRING_HASH_MAP_WITH_DECL( wxUIntPtr, wxStringToNumHashMap, - class WXDLLIMPEXP_BASE ); - #endif // _WX_HASHMAP_H_ diff --git a/Source/3rd Party/wx/include/wx/hashset.h b/Source/3rd Party/wx/include/wx/hashset.h index c6806b953..b5e7892ff 100644 --- a/Source/3rd Party/wx/include/wx/hashset.h +++ b/Source/3rd Party/wx/include/wx/hashset.h @@ -4,7 +4,7 @@ // Author: Mattia Barbon // Modified by: // Created: 11/08/2003 -// RCS-ID: $Id$ +// RCS-ID: $Id: hashset.h 55215 2008-08-23 18:54:04Z VZ $ // Copyright: (c) Mattia Barbon // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -17,20 +17,22 @@ // see comment in wx/hashmap.h which also applies to different standard hash // set classes -#if wxUSE_STD_CONTAINERS && \ +#if wxUSE_STL && \ (defined(HAVE_STD_UNORDERED_SET) || defined(HAVE_TR1_UNORDERED_SET)) #if defined(HAVE_STD_UNORDERED_SET) #include - #define WX_HASH_SET_BASE_TEMPLATE std::unordered_set + #define _WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME, CLASSEXP )\ + typedef std::unordered_set< KEY_T, HASH_T, KEY_EQ_T > CLASSNAME #elif defined(HAVE_TR1_UNORDERED_SET) #include - #define WX_HASH_SET_BASE_TEMPLATE std::tr1::unordered_set + #define _WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME, CLASSEXP )\ + typedef std::tr1::unordered_set< KEY_T, HASH_T, KEY_EQ_T > CLASSNAME #else - #error Update this code: unordered_set is available, but I do not know where. +#error Update this code: unordered_set is available, but I do not know where. #endif -#elif wxUSE_STD_CONTAINERS && defined(HAVE_STL_HASH_MAP) +#elif wxUSE_STL && defined(HAVE_STL_HASH_MAP) #if defined(HAVE_EXT_HASH_MAP) #include @@ -38,38 +40,10 @@ #include #endif -#define WX_HASH_SET_BASE_TEMPLATE WX_HASH_MAP_NAMESPACE::hash_set +#define _WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME, CLASSEXP )\ + typedef WX_HASH_MAP_NAMESPACE::hash_set< KEY_T, HASH_T, KEY_EQ_T > CLASSNAME -#endif // different hash_set/unordered_set possibilities - -#ifdef WX_HASH_SET_BASE_TEMPLATE - -// we need to define the class declared by _WX_DECLARE_HASH_SET as a class and -// not a typedef to allow forward declaring it -#define _WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, PTROP, CLASSNAME, CLASSEXP ) \ -CLASSEXP CLASSNAME \ - : public WX_HASH_SET_BASE_TEMPLATE< KEY_T, HASH_T, KEY_EQ_T > \ -{ \ -public: \ - explicit CLASSNAME(size_type n = 3, \ - const hasher& h = hasher(), \ - const key_equal& ke = key_equal(), \ - const allocator_type& a = allocator_type()) \ - : WX_HASH_SET_BASE_TEMPLATE< KEY_T, HASH_T, KEY_EQ_T >(n, h, ke, a) \ - {} \ - template \ - CLASSNAME(InputIterator f, InputIterator l, \ - const hasher& h = hasher(), \ - const key_equal& ke = key_equal(), \ - const allocator_type& a = allocator_type()) \ - : WX_HASH_SET_BASE_TEMPLATE< KEY_T, HASH_T, KEY_EQ_T >(f, l, h, ke, a)\ - {} \ - CLASSNAME(const WX_HASH_SET_BASE_TEMPLATE< KEY_T, HASH_T, KEY_EQ_T >& s) \ - : WX_HASH_SET_BASE_TEMPLATE< KEY_T, HASH_T, KEY_EQ_T >(s) \ - {} \ -} - -#else // no appropriate STL class, use our own implementation +#else // !wxUSE_STL || !defined(HAVE_STL_HASH_MAP) // this is a complex way of defining an easily inlineable identity function... #define _WX_DECLARE_HASH_SET_KEY_EX( KEY_T, CLASSNAME, CLASSEXP ) \ @@ -89,11 +63,9 @@ public: \ CLASSNAME& operator=(const CLASSNAME&) { return *this; } \ }; -#define _WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, PTROP, CLASSNAME, CLASSEXP )\ +#define _WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME, CLASSEXP )\ _WX_DECLARE_HASH_SET_KEY_EX( KEY_T, CLASSNAME##_wxImplementation_KeyEx, CLASSEXP ) \ -_WX_DECLARE_HASHTABLE( KEY_T, KEY_T, HASH_T, \ - CLASSNAME##_wxImplementation_KeyEx, KEY_EQ_T, PTROP, \ - CLASSNAME##_wxImplementation_HashTable, CLASSEXP, grow_lf70, never_shrink ) \ +_WX_DECLARE_HASHTABLE( KEY_T, KEY_T, HASH_T, CLASSNAME##_wxImplementation_KeyEx, KEY_EQ_T, CLASSNAME##_wxImplementation_HashTable, CLASSEXP, grow_lf70, never_shrink ) \ CLASSEXP CLASSNAME:public CLASSNAME##_wxImplementation_HashTable \ { \ public: \ @@ -127,35 +99,24 @@ public: \ void erase( const const_iterator& it ) { erase( *it ); } \ \ /* count() == 0 | 1 */ \ - size_type count( const const_key_type& key ) const \ + size_type count( const const_key_type& key ) \ { return GetNode( key ) ? 1 : 0; } \ } -#endif // STL/wx implementations - +#endif // !wxUSE_STL || !defined(HAVE_STL_HASH_MAP) // these macros are to be used in the user code #define WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME) \ - _WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, wxPTROP_NORMAL, CLASSNAME, class ) + _WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME, class ) // and these do exactly the same thing but should be used inside the // library #define WX_DECLARE_HASH_SET_WITH_DECL( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME, DECL) \ - _WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, wxPTROP_NORMAL, CLASSNAME, DECL ) + _WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME, DECL ) #define WX_DECLARE_EXPORTED_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME) \ WX_DECLARE_HASH_SET_WITH_DECL( KEY_T, HASH_T, KEY_EQ_T, \ - CLASSNAME, class WXDLLIMPEXP_CORE ) - -// Finally these versions allow to define hash sets of non-objects (including -// pointers, hence the confusing but wxArray-compatible name) without -// operator->() which can't be used for them. This is mostly used inside the -// library itself to avoid warnings when using such hash sets with some less -// common compilers (notably Sun CC). -#define WX_DECLARE_HASH_SET_PTR( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME) \ - _WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, wxPTROP_NOP, CLASSNAME, class ) -#define WX_DECLARE_HASH_SET_WITH_DECL_PTR( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME, DECL) \ - _WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, wxPTROP_NOP, CLASSNAME, DECL ) + CLASSNAME, class WXDLLEXPORT ) // delete all hash elements // diff --git a/Source/3rd Party/wx/include/wx/headercol.h b/Source/3rd Party/wx/include/wx/headercol.h deleted file mode 100644 index e5a84eda2..000000000 --- a/Source/3rd Party/wx/include/wx/headercol.h +++ /dev/null @@ -1,289 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/headercol.h -// Purpose: declaration of wxHeaderColumn class -// Author: Vadim Zeitlin -// Created: 2008-12-02 -// RCS-ID: $Id$ -// Copyright: (c) 2008 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_HEADERCOL_H_ -#define _WX_HEADERCOL_H_ - -#include "wx/bitmap.h" - -#if wxUSE_HEADERCTRL - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -enum -{ - // special value for column width meaning unspecified/default - wxCOL_WIDTH_DEFAULT = -1, - - // size the column automatically to fit all values - wxCOL_WIDTH_AUTOSIZE = -2 -}; - -// bit masks for the various column attributes -enum -{ - // column can be resized (included in default flags) - wxCOL_RESIZABLE = 1, - - // column can be clicked to toggle the sort order by its contents - wxCOL_SORTABLE = 2, - - // column can be dragged to change its order (included in default) - wxCOL_REORDERABLE = 4, - - // column is not shown at all - wxCOL_HIDDEN = 8, - - // default flags for wxHeaderColumn ctor - wxCOL_DEFAULT_FLAGS = wxCOL_RESIZABLE | wxCOL_REORDERABLE -}; - -// ---------------------------------------------------------------------------- -// wxHeaderColumn: interface for a column in a header of controls such as -// wxListCtrl, wxDataViewCtrl or wxGrid -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxHeaderColumn -{ -public: - // ctors and dtor - // -------------- - - /* - Derived classes must provide ctors with the following signatures - (notice that they shouldn't be explicit to allow passing strings/bitmaps - directly to methods such wxHeaderCtrl::AppendColumn()): - wxHeaderColumn(const wxString& title, - int width = wxCOL_WIDTH_DEFAULT, - wxAlignment align = wxALIGN_NOT, - int flags = wxCOL_DEFAULT_FLAGS); - wxHeaderColumn(const wxBitmap &bitmap, - int width = wxDVC_DEFAULT_WIDTH, - wxAlignment align = wxALIGN_CENTER, - int flags = wxCOL_DEFAULT_FLAGS); - */ - - // virtual dtor for the base class to avoid gcc warnings even though we - // don't normally delete the objects of this class via a pointer to - // wxHeaderColumn so it's not necessary, strictly speaking - virtual ~wxHeaderColumn() { } - - // getters for various attributes - // ------------------------------ - - // notice that wxHeaderColumn only provides getters as this is all the - // wxHeaderCtrl needs, various derived class must also provide some way to - // change these attributes but this can be done either at the column level - // (in which case they should inherit from wxSettableHeaderColumn) or via - // the methods of the main control in which case you don't need setters in - // the column class at all - - // title is the string shown for this column - virtual wxString GetTitle() const = 0; - - // bitmap shown (instead of text) in the column header - virtual wxBitmap GetBitmap() const = 0; \ - - // width of the column in pixels, can be set to wxCOL_WIDTH_DEFAULT meaning - // unspecified/default - virtual int GetWidth() const = 0; - - // minimal width can be set for resizable columns to forbid resizing them - // below the specified size (set to 0 to remove) - virtual int GetMinWidth() const = 0; - - // alignment of the text: wxALIGN_CENTRE, wxALIGN_LEFT or wxALIGN_RIGHT - virtual wxAlignment GetAlignment() const = 0; - - - // flags manipulations: - // -------------------- - - // notice that while we make GetFlags() pure virtual here and implement the - // individual flags access in terms of it, for some derived classes it is - // more natural to implement access to each flag individually, in which - // case they can use our GetFromIndividualFlags() helper below to implement - // GetFlags() - - // retrieve all column flags at once: combination of wxCOL_XXX values above - virtual int GetFlags() const = 0; - - bool HasFlag(int flag) const { return (GetFlags() & flag) != 0; } - - - // wxCOL_RESIZABLE - virtual bool IsResizeable() const - { return HasFlag(wxCOL_RESIZABLE); } - - // wxCOL_SORTABLE - virtual bool IsSortable() const - { return HasFlag(wxCOL_SORTABLE); } - - // wxCOL_REORDERABLE - virtual bool IsReorderable() const - { return HasFlag(wxCOL_REORDERABLE); } - - // wxCOL_HIDDEN - virtual bool IsHidden() const - { return HasFlag(wxCOL_HIDDEN); } - bool IsShown() const - { return !IsHidden(); } - - - // sorting - // ------- - - // return true if the column is the one currently used for sorting - virtual bool IsSortKey() const = 0; - - // for sortable columns indicate whether we should sort in ascending or - // descending order (this should only be taken into account if IsSortKey()) - virtual bool IsSortOrderAscending() const = 0; - -protected: - // helper for the class overriding IsXXX() - int GetFromIndividualFlags() const; -}; - -// ---------------------------------------------------------------------------- -// wxSettableHeaderColumn: column which allows to change its fields too -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxSettableHeaderColumn : public wxHeaderColumn -{ -public: - virtual void SetTitle(const wxString& title) = 0; - virtual void SetBitmap(const wxBitmap& bitmap) = 0; - virtual void SetWidth(int width) = 0; - virtual void SetMinWidth(int minWidth) = 0; - virtual void SetAlignment(wxAlignment align) = 0; - - // see comment for wxHeaderColumn::GetFlags() about the relationship - // between SetFlags() and Set{Sortable,Reorderable,...} - - // change, set, clear, toggle or test for any individual flag - virtual void SetFlags(int flags) = 0; - void ChangeFlag(int flag, bool set); - void SetFlag(int flag); - void ClearFlag(int flag); - void ToggleFlag(int flag); - - virtual void SetResizeable(bool resizable) - { ChangeFlag(wxCOL_RESIZABLE, resizable); } - virtual void SetSortable(bool sortable) - { ChangeFlag(wxCOL_SORTABLE, sortable); } - virtual void SetReorderable(bool reorderable) - { ChangeFlag(wxCOL_REORDERABLE, reorderable); } - virtual void SetHidden(bool hidden) - { ChangeFlag(wxCOL_HIDDEN, hidden); } - - // This function can be called to indicate that this column is not used for - // sorting any more. Under some platforms it's not necessary to do anything - // in this case as just setting another column as a sort key takes care of - // everything but under MSW we currently need to call this explicitly to - // reset the sort indicator displayed on the column. - virtual void UnsetAsSortKey() { } - - virtual void SetSortOrder(bool ascending) = 0; - void ToggleSortOrder() { SetSortOrder(!IsSortOrderAscending()); } - -protected: - // helper for the class overriding individual SetXXX() methods instead of - // overriding SetFlags() - void SetIndividualFlags(int flags); -}; - -// ---------------------------------------------------------------------------- -// wxHeaderColumnSimple: trivial generic implementation of wxHeaderColumn -// ---------------------------------------------------------------------------- - -class wxHeaderColumnSimple : public wxSettableHeaderColumn -{ -public: - // ctors and dtor - wxHeaderColumnSimple(const wxString& title, - int width = wxCOL_WIDTH_DEFAULT, - wxAlignment align = wxALIGN_NOT, - int flags = wxCOL_DEFAULT_FLAGS) - : m_title(title), - m_width(width), - m_align(align), - m_flags(flags) - { - Init(); - } - - wxHeaderColumnSimple(const wxBitmap& bitmap, - int width = wxCOL_WIDTH_DEFAULT, - wxAlignment align = wxALIGN_CENTER, - int flags = wxCOL_DEFAULT_FLAGS) - : m_bitmap(bitmap), - m_width(width), - m_align(align), - m_flags(flags) - { - Init(); - } - - // implement base class pure virtuals - virtual void SetTitle(const wxString& title) { m_title = title; } - virtual wxString GetTitle() const { return m_title; } - - virtual void SetBitmap(const wxBitmap& bitmap) { m_bitmap = bitmap; } - wxBitmap GetBitmap() const { return m_bitmap; } - - virtual void SetWidth(int width) { m_width = width; } - virtual int GetWidth() const { return m_width; } - - virtual void SetMinWidth(int minWidth) { m_minWidth = minWidth; } - virtual int GetMinWidth() const { return m_minWidth; } - - virtual void SetAlignment(wxAlignment align) { m_align = align; } - virtual wxAlignment GetAlignment() const { return m_align; } - - virtual void SetFlags(int flags) { m_flags = flags; } - virtual int GetFlags() const { return m_flags; } - - virtual bool IsSortKey() const { return m_sort; } - virtual void UnsetAsSortKey() { m_sort = false; } - - virtual void SetSortOrder(bool ascending) - { - m_sort = true; - m_sortAscending = ascending; - } - - virtual bool IsSortOrderAscending() const { return m_sortAscending; } - -private: - // common part of all ctors - void Init() - { - m_minWidth = 0; - m_sort = false; - m_sortAscending = true; - } - - wxString m_title; - wxBitmap m_bitmap; - int m_width, - m_minWidth; - wxAlignment m_align; - int m_flags; - bool m_sort, - m_sortAscending; -}; - -#endif // wxUSE_HEADERCTRL - -#endif // _WX_HEADERCOL_H_ - diff --git a/Source/3rd Party/wx/include/wx/headerctrl.h b/Source/3rd Party/wx/include/wx/headerctrl.h deleted file mode 100644 index 1f9829ee4..000000000 --- a/Source/3rd Party/wx/include/wx/headerctrl.h +++ /dev/null @@ -1,474 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/headerctrl.h -// Purpose: wxHeaderCtrlBase class: interface of wxHeaderCtrl -// Author: Vadim Zeitlin -// Created: 2008-12-01 -// RCS-ID: $Id$ -// Copyright: (c) 2008 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_HEADERCTRL_H_ -#define _WX_HEADERCTRL_H_ - -#include "wx/control.h" - -#if wxUSE_HEADERCTRL - -#include "wx/dynarray.h" -#include "wx/vector.h" - -#include "wx/headercol.h" - -// notice that the classes in this header are defined in the core library even -// although currently they're only used by wxGrid which is in wxAdv because we -// plan to use it in wxListCtrl which is in core too in the future -class WXDLLIMPEXP_FWD_CORE wxHeaderCtrlEvent; - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -enum -{ - // allow column drag and drop - wxHD_ALLOW_REORDER = 0x0001, - - // allow hiding (and showing back) the columns using the menu shown by - // right clicking the header - wxHD_ALLOW_HIDE = 0x0002, - - // style used by default when creating the control - wxHD_DEFAULT_STYLE = wxHD_ALLOW_REORDER -}; - -extern WXDLLIMPEXP_DATA_CORE(const char) wxHeaderCtrlNameStr[]; - -// ---------------------------------------------------------------------------- -// wxHeaderCtrlBase defines the interface of a header control -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxHeaderCtrlBase : public wxControl -{ -public: - /* - Derived classes must provide default ctor as well as a ctor and - Create() function with the following signatures: - - wxHeaderCtrl(wxWindow *parent, - wxWindowID winid = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxHD_DEFAULT_STYLE, - const wxString& name = wxHeaderCtrlNameStr); - - bool Create(wxWindow *parent, - wxWindowID winid = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxHD_DEFAULT_STYLE, - const wxString& name = wxHeaderCtrlNameStr); - */ - - // column-related methods - // ---------------------- - - // set the number of columns in the control - // - // this also calls UpdateColumn() for all columns - void SetColumnCount(unsigned int count); - - // return the number of columns in the control as set by SetColumnCount() - unsigned int GetColumnCount() const { return DoGetCount(); } - - // return whether the control has any columns - bool IsEmpty() const { return DoGetCount() == 0; } - - // update the column with the given index - void UpdateColumn(unsigned int idx) - { - wxCHECK_RET( idx < GetColumnCount(), "invalid column index" ); - - DoUpdate(idx); - } - - - // columns order - // ------------- - - // set the columns order: the array defines the column index which appears - // the given position, it must have GetColumnCount() elements and contain - // all indices exactly once - void SetColumnsOrder(const wxArrayInt& order); - wxArrayInt GetColumnsOrder() const; - - // get the index of the column at the given display position - unsigned int GetColumnAt(unsigned int pos) const; - - // get the position at which this column is currently displayed - unsigned int GetColumnPos(unsigned int idx) const; - - // reset the columns order to the natural one - void ResetColumnsOrder(); - - // helper function used by the generic version of this control and also - // wxGrid: reshuffles the array of column indices indexed by positions - // (i.e. using the same convention as for SetColumnsOrder()) so that the - // column with the given index is found at the specified position - static void MoveColumnInOrderArray(wxArrayInt& order, - unsigned int idx, - unsigned int pos); - - - // UI helpers - // ---------- - -#if wxUSE_MENUS - // show the popup menu containing all columns with check marks for the ones - // which are currently shown and return true if something was done using it - // (in this case UpdateColumnVisibility() will have been called) or false - // if the menu was cancelled - // - // this is called from the default right click handler for the controls - // with wxHD_ALLOW_HIDE style - bool ShowColumnsMenu(const wxPoint& pt, const wxString& title = wxString()); - - // append the entries for all our columns to the given menu, with the - // currently visible columns being checked - // - // this is used by ShowColumnsMenu() but can also be used if you use your - // own custom columns menu but nevertheless want to show all the columns in - // it - // - // the ids of the items corresponding to the columns are consecutive and - // start from idColumnsBase - void AddColumnsItems(wxMenu& menu, int idColumnsBase = 0); -#endif // wxUSE_MENUS - - // show the columns customization dialog and return true if something was - // changed using it (in which case UpdateColumnVisibility() and/or - // UpdateColumnsOrder() will have been called) - // - // this is called by the control itself from ShowColumnsMenu() (which in - // turn is only called by the control if wxHD_ALLOW_HIDE style was - // specified) and if the control has wxHD_ALLOW_REORDER style as well - bool ShowCustomizeDialog(); - - // compute column title width - int GetColumnTitleWidth(const wxHeaderColumn& col); - - // implementation only from now on - // ------------------------------- - - // the user doesn't need to TAB to this control - virtual bool AcceptsFocusFromKeyboard() const { return false; } - - // this method is only overridden in order to synchronize the control with - // the main window when it is scrolled, the derived class must implement - // DoScrollHorz() - virtual void ScrollWindow(int dx, int dy, const wxRect *rect = NULL); - -protected: - // this method must be implemented by the derived classes to return the - // information for the given column - virtual const wxHeaderColumn& GetColumn(unsigned int idx) const = 0; - - // this method is called from the default EVT_HEADER_SEPARATOR_DCLICK - // handler to update the fitting column width of the given column, it - // should return true if the width was really updated - virtual bool UpdateColumnWidthToFit(unsigned int WXUNUSED(idx), - int WXUNUSED(widthTitle)) - { - return false; - } - - // this method is called from ShowColumnsMenu() and must be overridden to - // update the internal column visibility (there is no need to call - // UpdateColumn() from here, this will be done internally) - virtual void UpdateColumnVisibility(unsigned int WXUNUSED(idx), - bool WXUNUSED(show)) - { - wxFAIL_MSG( "must be overridden if called" ); - } - - // this method is called from ShowCustomizeDialog() to reorder all columns - // at once and should be implemented for controls using wxHD_ALLOW_REORDER - // style (there is no need to call SetColumnsOrder() from here, this is - // done by the control itself) - virtual void UpdateColumnsOrder(const wxArrayInt& WXUNUSED(order)) - { - wxFAIL_MSG( "must be overridden if called" ); - } - - // this method can be overridden in the derived classes to do something - // (e.g. update/resize some internal data structures) before the number of - // columns in the control changes - virtual void OnColumnCountChanging(unsigned int WXUNUSED(count)) { } - - - // helper function for the derived classes: update the array of column - // indices after the number of columns changed - void DoResizeColumnIndices(wxArrayInt& colIndices, unsigned int count); - -protected: - // this window doesn't look nice with the border so don't use it by default - virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } - -private: - // methods implementing our public API and defined in platform-specific - // implementations - virtual void DoSetCount(unsigned int count) = 0; - virtual unsigned int DoGetCount() const = 0; - virtual void DoUpdate(unsigned int idx) = 0; - - virtual void DoScrollHorz(int dx) = 0; - - virtual void DoSetColumnsOrder(const wxArrayInt& order) = 0; - virtual wxArrayInt DoGetColumnsOrder() const = 0; - - - // event handlers - void OnSeparatorDClick(wxHeaderCtrlEvent& event); -#if wxUSE_MENUS - void OnRClick(wxHeaderCtrlEvent& event); -#endif // wxUSE_MENUS - - DECLARE_EVENT_TABLE() -}; - -// ---------------------------------------------------------------------------- -// wxHeaderCtrl: port-specific header control implementation, notice that this -// is still an ABC which is meant to be used as part of another -// control, see wxHeaderCtrlSimple for a standalone version -// ---------------------------------------------------------------------------- - -#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) - #include "wx/msw/headerctrl.h" -#else - #define wxHAS_GENERIC_HEADERCTRL - #include "wx/generic/headerctrlg.h" -#endif // platform - -// ---------------------------------------------------------------------------- -// wxHeaderCtrlSimple: concrete header control which can be used standalone -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxHeaderCtrlSimple : public wxHeaderCtrl -{ -public: - // control creation - // ---------------- - - wxHeaderCtrlSimple() { Init(); } - wxHeaderCtrlSimple(wxWindow *parent, - wxWindowID winid = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxHD_DEFAULT_STYLE, - const wxString& name = wxHeaderCtrlNameStr) - { - Init(); - - Create(parent, winid, pos, size, style, name); - } - - // managing the columns - // -------------------- - - // insert the column at the given position, using GetColumnCount() as - // position appends it at the end - void InsertColumn(const wxHeaderColumnSimple& col, unsigned int idx) - { - wxCHECK_RET( idx <= GetColumnCount(), "invalid column index" ); - - DoInsert(col, idx); - } - - // append the column to the end of the control - void AppendColumn(const wxHeaderColumnSimple& col) - { - DoInsert(col, GetColumnCount()); - } - - // delete the column at the given index - void DeleteColumn(unsigned int idx) - { - wxCHECK_RET( idx < GetColumnCount(), "invalid column index" ); - - DoDelete(idx); - } - - // delete all the existing columns - void DeleteAllColumns(); - - - // modifying columns - // ----------------- - - // show or hide the column, notice that even when a column is hidden we - // still account for it when using indices - void ShowColumn(unsigned int idx, bool show = true) - { - wxCHECK_RET( idx < GetColumnCount(), "invalid column index" ); - - DoShowColumn(idx, show); - } - - void HideColumn(unsigned int idx) - { - ShowColumn(idx, false); - } - - // indicate that the column is used for sorting - void ShowSortIndicator(unsigned int idx, bool ascending = true) - { - wxCHECK_RET( idx < GetColumnCount(), "invalid column index" ); - - DoShowSortIndicator(idx, ascending); - } - - // remove the sort indicator completely - void RemoveSortIndicator(); - -protected: - // implement/override base class methods - virtual const wxHeaderColumn& GetColumn(unsigned int idx) const; - virtual bool UpdateColumnWidthToFit(unsigned int idx, int widthTitle); - - // and define another one to be overridden in the derived classes: it - // should return the best width for the given column contents or -1 if not - // implemented, we use it to implement UpdateColumnWidthToFit() - virtual int GetBestFittingWidth(unsigned int WXUNUSED(idx)) const - { - return -1; - } - -private: - // functions implementing our public API - void DoInsert(const wxHeaderColumnSimple& col, unsigned int idx); - void DoDelete(unsigned int idx); - void DoShowColumn(unsigned int idx, bool show); - void DoShowSortIndicator(unsigned int idx, bool ascending); - - // common part of all ctors - void Init(); - - // bring the column count in sync with the number of columns we store - void UpdateColumnCount() - { - SetColumnCount(static_cast(m_cols.size())); - } - - - // all our current columns - typedef wxVector Columns; - Columns m_cols; - - // the column currently used for sorting or -1 if none - unsigned int m_sortKey; - - - wxDECLARE_NO_COPY_CLASS(wxHeaderCtrlSimple); -}; - -// ---------------------------------------------------------------------------- -// wxHeaderCtrl events -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxHeaderCtrlEvent : public wxNotifyEvent -{ -public: - wxHeaderCtrlEvent(wxEventType commandType = wxEVT_NULL, int winid = 0) - : wxNotifyEvent(commandType, winid), - m_col(-1), - m_width(0), - m_order(static_cast(-1)) - { - } - - wxHeaderCtrlEvent(const wxHeaderCtrlEvent& event) - : wxNotifyEvent(event), - m_col(event.m_col), - m_width(event.m_width), - m_order(event.m_order) - { - } - - // the column which this event pertains to: valid for all header events - int GetColumn() const { return m_col; } - void SetColumn(int col) { m_col = col; } - - // the width of the column: valid for column resizing/dragging events only - int GetWidth() const { return m_width; } - void SetWidth(int width) { m_width = width; } - - // the new position of the column: for end reorder events only - unsigned int GetNewOrder() const { return m_order; } - void SetNewOrder(unsigned int order) { m_order = order; } - - virtual wxEvent *Clone() const { return new wxHeaderCtrlEvent(*this); } - -protected: - // the column affected by the event - int m_col; - - // the current width for the dragging events - int m_width; - - // the new column position for end reorder event - unsigned int m_order; - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxHeaderCtrlEvent) -}; - - -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_HEADER_CLICK, wxHeaderCtrlEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_HEADER_RIGHT_CLICK, wxHeaderCtrlEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_HEADER_MIDDLE_CLICK, wxHeaderCtrlEvent ); - -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_HEADER_DCLICK, wxHeaderCtrlEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_HEADER_RIGHT_DCLICK, wxHeaderCtrlEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_HEADER_MIDDLE_DCLICK, wxHeaderCtrlEvent ); - -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_HEADER_SEPARATOR_DCLICK, wxHeaderCtrlEvent ); - -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_HEADER_BEGIN_RESIZE, wxHeaderCtrlEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_HEADER_RESIZING, wxHeaderCtrlEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_HEADER_END_RESIZE, wxHeaderCtrlEvent ); - -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_HEADER_BEGIN_REORDER, wxHeaderCtrlEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_HEADER_END_REORDER, wxHeaderCtrlEvent ); - -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_HEADER_DRAGGING_CANCELLED, wxHeaderCtrlEvent ); - -typedef void (wxEvtHandler::*wxHeaderCtrlEventFunction)(wxHeaderCtrlEvent&); - -#define wxHeaderCtrlEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxHeaderCtrlEventFunction, func) - -#define wx__DECLARE_HEADER_EVT(evt, id, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_HEADER_ ## evt, id, wxHeaderCtrlEventHandler(fn)) - -#define EVT_HEADER_CLICK(id, fn) wx__DECLARE_HEADER_EVT(CLICK, id, fn) -#define EVT_HEADER_RIGHT_CLICK(id, fn) wx__DECLARE_HEADER_EVT(RIGHT_CLICK, id, fn) -#define EVT_HEADER_MIDDLE_CLICK(id, fn) wx__DECLARE_HEADER_EVT(MIDDLE_CLICK, id, fn) - -#define EVT_HEADER_DCLICK(id, fn) wx__DECLARE_HEADER_EVT(DCLICK, id, fn) -#define EVT_HEADER_RIGHT_DCLICK(id, fn) wx__DECLARE_HEADER_EVT(RIGHT_DCLICK, id, fn) -#define EVT_HEADER_MIDDLE_DCLICK(id, fn) wx__DECLARE_HEADER_EVT(MIDDLE_DCLICK, id, fn) - -#define EVT_HEADER_SEPARATOR_DCLICK(id, fn) wx__DECLARE_HEADER_EVT(SEPARATOR_DCLICK, id, fn) - -#define EVT_HEADER_BEGIN_RESIZE(id, fn) wx__DECLARE_HEADER_EVT(BEGIN_RESIZE, id, fn) -#define EVT_HEADER_RESIZING(id, fn) wx__DECLARE_HEADER_EVT(RESIZING, id, fn) -#define EVT_HEADER_END_RESIZE(id, fn) wx__DECLARE_HEADER_EVT(END_RESIZE, id, fn) - -#define EVT_HEADER_BEGIN_REORDER(id, fn) wx__DECLARE_HEADER_EVT(BEGIN_REORDER, id, fn) -#define EVT_HEADER_END_REORDER(id, fn) wx__DECLARE_HEADER_EVT(END_REORDER, id, fn) - -#define EVT_HEADER_DRAGGING_CANCELLED(id, fn) wx__DECLARE_HEADER_EVT(DRAGGING_CANCELLED, id, fn) - -#endif // wxUSE_HEADERCTRL - -#endif // _WX_HEADERCTRL_H_ diff --git a/Source/3rd Party/wx/include/wx/help.h b/Source/3rd Party/wx/include/wx/help.h index f6a8f69bb..1cc09d42c 100644 --- a/Source/3rd Party/wx/include/wx/help.h +++ b/Source/3rd Party/wx/include/wx/help.h @@ -1,11 +1,11 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/help.h +// Name: help.h // Purpose: wxHelpController base header // Author: wxWidgets Team // Modified by: // Created: // Copyright: (c) Julian Smart -// RCS-ID: $Id$ +// RCS-ID: $Id: help.h 33948 2005-05-04 18:57:50Z JS $ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -22,6 +22,10 @@ #include "wx/msw/wince/helpwce.h" #define wxHelpController wxWinceHelpController +#elif defined(__WXPALMOS__) + #include "wx/palmos/help.h" + + #define wxHelpController wxPalmHelpController #elif defined(__WXMSW__) #include "wx/msw/helpchm.h" diff --git a/Source/3rd Party/wx/include/wx/helpbase.h b/Source/3rd Party/wx/include/wx/helpbase.h index c0bb23b6f..0ab778205 100644 --- a/Source/3rd Party/wx/include/wx/helpbase.h +++ b/Source/3rd Party/wx/include/wx/helpbase.h @@ -1,10 +1,10 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/helpbase.h +// Name: helpbase.h // Purpose: Help system base classes // Author: Julian Smart // Modified by: // Created: 04/01/98 -// RCS-ID: $Id$ +// RCS-ID: $Id: helpbase.h 45498 2007-04-16 13:03:05Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -32,7 +32,7 @@ enum wxHelpSearchMode }; // Defines the API for help controllers -class WXDLLIMPEXP_CORE wxHelpControllerBase: public wxObject +class WXDLLEXPORT wxHelpControllerBase: public wxObject { public: inline wxHelpControllerBase(wxWindow* parentWindow = NULL) { m_parentWindow = parentWindow; } @@ -82,7 +82,7 @@ public: wxPoint *WXUNUSED(pos) = NULL, bool *WXUNUSED(newFrameEachTime) = NULL) { - return NULL; // does nothing by default + return (wxFrame*) NULL; // does nothing by default } virtual bool Quit() = 0; diff --git a/Source/3rd Party/wx/include/wx/icon.h b/Source/3rd Party/wx/include/wx/icon.h index d5f531357..8a73884ca 100644 --- a/Source/3rd Party/wx/include/wx/icon.h +++ b/Source/3rd Party/wx/include/wx/icon.h @@ -5,7 +5,7 @@ // Modified by: // Created: // Copyright: (c) Julian Smart -// RCS-ID: $Id$ +// RCS-ID: $Id: icon.h 41538 2006-09-30 20:45:15Z RR $ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -14,50 +14,28 @@ #include "wx/iconloc.h" - -// a more readable way to tell -#define wxICON_SCREEN_DEPTH (-1) - - -// the wxICON_DEFAULT_TYPE (the wxIcon equivalent of wxBITMAP_DEFAULT_TYPE) -// constant defines the default argument value for wxIcon ctor and wxIcon::LoadFile() -// functions. - -#if defined(__WXMSW__) - #define wxICON_DEFAULT_TYPE wxBITMAP_TYPE_ICO_RESOURCE +#if defined(__WXPALMOS__) + #include "wx/generic/icon.h" +#elif defined(__WXMSW__) #include "wx/msw/icon.h" #elif defined(__WXMOTIF__) - #define wxICON_DEFAULT_TYPE wxBITMAP_TYPE_XPM #include "wx/motif/icon.h" #elif defined(__WXGTK20__) - #ifdef __WINDOWS__ - #define wxICON_DEFAULT_TYPE wxBITMAP_TYPE_ICO_RESOURCE - #else - #define wxICON_DEFAULT_TYPE wxBITMAP_TYPE_XPM - #endif #include "wx/generic/icon.h" #elif defined(__WXGTK__) - #define wxICON_DEFAULT_TYPE wxBITMAP_TYPE_XPM #include "wx/generic/icon.h" #elif defined(__WXX11__) - #define wxICON_DEFAULT_TYPE wxBITMAP_TYPE_XPM + #include "wx/generic/icon.h" +#elif defined(__WXMGL__) + #define wxICON_DEFAULT_BITMAP_TYPE wxBITMAP_TYPE_ICO_RESOURCE #include "wx/generic/icon.h" #elif defined(__WXDFB__) - #define wxICON_DEFAULT_TYPE wxBITMAP_TYPE_XPM #include "wx/generic/icon.h" #elif defined(__WXMAC__) -#if wxOSX_USE_COCOA_OR_CARBON - #define wxICON_DEFAULT_TYPE wxBITMAP_TYPE_ICON_RESOURCE - #include "wx/osx/icon.h" -#else - #define wxICON_DEFAULT_TYPE wxBITMAP_TYPE_PNG_RESOURCE - #include "wx/generic/icon.h" -#endif + #include "wx/mac/icon.h" #elif defined(__WXCOCOA__) - #define wxICON_DEFAULT_TYPE wxBITMAP_TYPE_ICON_RESOURCE #include "wx/cocoa/icon.h" #elif defined(__WXPM__) - #define wxICON_DEFAULT_TYPE wxBITMAP_TYPE_ICO_RESOURCE #include "wx/os2/icon.h" #endif @@ -67,7 +45,7 @@ #if wxUSE_VARIANT #include "wx/variant.h" -DECLARE_VARIANT_OBJECT_EXPORTED(wxIcon,WXDLLIMPEXP_CORE) +DECLARE_VARIANT_OBJECT_EXPORTED(wxIcon,WXDLLEXPORT) #endif diff --git a/Source/3rd Party/wx/include/wx/iconbndl.h b/Source/3rd Party/wx/include/wx/iconbndl.h index 651c4d29b..ced8dbba6 100644 --- a/Source/3rd Party/wx/include/wx/iconbndl.h +++ b/Source/3rd Party/wx/include/wx/iconbndl.h @@ -4,7 +4,7 @@ // Author: Mattia barbon // Modified by: // Created: 23.03.02 -// RCS-ID: $Id$ +// RCS-ID: $Id: iconbndl.h 49563 2007-10-31 20:46:21Z VZ $ // Copyright: (c) Mattia Barbon // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -12,122 +12,58 @@ #ifndef _WX_ICONBNDL_H_ #define _WX_ICONBNDL_H_ -#include "wx/gdiobj.h" -#include "wx/gdicmn.h" // for wxSize -#include "wx/icon.h" - #include "wx/dynarray.h" +// for wxSize +#include "wx/gdicmn.h" -class WXDLLIMPEXP_FWD_BASE wxInputStream; +class WXDLLIMPEXP_FWD_CORE wxIcon; +class WXDLLIMPEXP_FWD_BASE wxString; -WX_DECLARE_EXPORTED_OBJARRAY(wxIcon, wxIconArray); +WX_DECLARE_EXPORTED_OBJARRAY( wxIcon, wxIconArray ); // this class can't load bitmaps of type wxBITMAP_TYPE_ICO_RESOURCE, // if you need them, you have to load them manually and call // wxIconCollection::AddIcon -class WXDLLIMPEXP_CORE wxIconBundle : public wxGDIObject +class WXDLLEXPORT wxIconBundle { public: - // Flags that determine what happens if GetIcon() doesn't find the icon of - // exactly the requested size. - enum - { - // Return invalid icon if exact size is not found. - FALLBACK_NONE = 0, - - // Return the icon of the system icon size if exact size is not found. - // May be combined with other non-NONE enum elements to determine what - // happens if the system icon size is not found neither. - FALLBACK_SYSTEM = 1, - - // Return the icon of closest larger size or, if there is no icon of - // larger size in the bundle, the closest icon of smaller size. - FALLBACK_NEAREST_LARGER = 2 - }; - // default constructor - wxIconBundle(); - + wxIconBundle() : m_icons() {} // initializes the bundle with the icon(s) found in the file -#if wxUSE_STREAMS && wxUSE_IMAGE -#if wxUSE_FFILE || wxUSE_FILE - wxIconBundle(const wxString& file, wxBitmapType type = wxBITMAP_TYPE_ANY); -#endif // wxUSE_FFILE || wxUSE_FILE - wxIconBundle(wxInputStream& stream, wxBitmapType type = wxBITMAP_TYPE_ANY); -#endif // wxUSE_STREAMS && wxUSE_IMAGE - + wxIconBundle( const wxString& file, long type ) : m_icons() + { AddIcon( file, type ); } // initializes the bundle with a single icon - wxIconBundle(const wxIcon& icon); + wxIconBundle( const wxIcon& icon ) : m_icons() + { AddIcon( icon ); } - // default copy ctor and assignment operator are OK + const wxIconBundle& operator =( const wxIconBundle& ic ); + wxIconBundle( const wxIconBundle& ic ) : m_icons() + { *this = ic; } + + ~wxIconBundle() { DeleteIcons(); } // adds all the icons contained in the file to the collection, // if the collection already contains icons with the same // width and height, they are replaced -#if wxUSE_STREAMS && wxUSE_IMAGE -#if wxUSE_FFILE || wxUSE_FILE - void AddIcon(const wxString& file, wxBitmapType type = wxBITMAP_TYPE_ANY); -#endif // wxUSE_FFILE || wxUSE_FILE - void AddIcon(wxInputStream& stream, wxBitmapType type = wxBITMAP_TYPE_ANY); -#endif // wxUSE_STREAMS && wxUSE_IMAGE - + void AddIcon( const wxString& file, long type ); // adds the icon to the collection, if the collection already // contains an icon with the same width and height, it is // replaced - void AddIcon(const wxIcon& icon); + void AddIcon( const wxIcon& icon ); // returns the icon with the given size; if no such icon exists, - // behavior is specified by the flags. - wxIcon GetIcon(const wxSize& size, int flags = FALLBACK_SYSTEM) const; - - // equivalent to GetIcon(wxSize(size, size)) - wxIcon GetIcon(wxCoord size = wxDefaultCoord, - int flags = FALLBACK_SYSTEM) const - { return GetIcon(wxSize(size, size), flags); } - - // returns the icon exactly of the specified size or wxNullIcon if no icon - // of exactly given size are available - wxIcon GetIconOfExactSize(const wxSize& size) const; - wxIcon GetIconOfExactSize(wxCoord size) const - { return GetIconOfExactSize(wxSize(size, size)); } - - // enumerate all icons in the bundle: don't use these functions if ti can - // be avoided, using GetIcon() directly is better - - // return the number of available icons - size_t GetIconCount() const; - - // return the icon at index (must be < GetIconCount()) - wxIcon GetIconByIndex(size_t n) const; - - // check if we have any icons at all - bool IsEmpty() const { return GetIconCount() == 0; } - -#if WXWIN_COMPATIBILITY_2_8 -#if wxUSE_STREAMS && wxUSE_IMAGE && (wxUSE_FFILE || wxUSE_FILE) - wxDEPRECATED( void AddIcon(const wxString& file, long type) - { - AddIcon(file, (wxBitmapType)type); - } - ) - - wxDEPRECATED_CONSTRUCTOR( wxIconBundle (const wxString& file, long type) - { - AddIcon(file, (wxBitmapType)type); - } - ) -#endif // wxUSE_STREAMS && wxUSE_IMAGE && (wxUSE_FFILE || wxUSE_FILE) -#endif // WXWIN_COMPATIBILITY_2_8 - -protected: - virtual wxGDIRefData *CreateGDIRefData() const; - virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; - + // returns the icon with size wxSYS_ICON_[XY]; if no such icon exists, + // returns the first icon in the bundle + const wxIcon& GetIcon( const wxSize& size ) const; + // equivalent to GetIcon( wxSize( size, size ) ) + const wxIcon& GetIcon( wxCoord size = wxDefaultCoord ) const + { return GetIcon( wxSize( size, size ) ); } private: // delete all icons void DeleteIcons(); - - DECLARE_DYNAMIC_CLASS(wxIconBundle) +public: + wxIconArray m_icons; }; -#endif // _WX_ICONBNDL_H_ +#endif + // _WX_ICONBNDL_H_ diff --git a/Source/3rd Party/wx/include/wx/iconloc.h b/Source/3rd Party/wx/include/wx/iconloc.h index df2cf92e2..e89d45d4e 100644 --- a/Source/3rd Party/wx/include/wx/iconloc.h +++ b/Source/3rd Party/wx/include/wx/iconloc.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 21.06.2003 -// RCS-ID: $Id$ +// RCS-ID: $Id: iconloc.h 27408 2004-05-23 20:53:33Z JS $ // Copyright: (c) 2003 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -39,9 +39,9 @@ private: wxString m_filename; }; -// under Windows the same file may contain several icons so we also store the +// under MSW the same file may contain several icons so we also store the // index of the icon -#if defined(__WINDOWS__) +#if defined(__WXMSW__) class WXDLLIMPEXP_BASE wxIconLocation : public wxIconLocationBase { @@ -65,7 +65,7 @@ wxIconLocation::wxIconLocation(const wxString& file, int num) SetIndex(num); } -#else // !__WINDOWS__ +#else // !MSW // must be a class because we forward declare it as class class WXDLLIMPEXP_BASE wxIconLocation : public wxIconLocationBase diff --git a/Source/3rd Party/wx/include/wx/imagbmp.h b/Source/3rd Party/wx/include/wx/imagbmp.h index 130630865..e32fc509b 100644 --- a/Source/3rd Party/wx/include/wx/imagbmp.h +++ b/Source/3rd Party/wx/include/wx/imagbmp.h @@ -2,7 +2,7 @@ // Name: wx/imagbmp.h // Purpose: wxImage BMP, ICO, CUR and ANI handlers // Author: Robert Roebling, Chris Elliott -// RCS-ID: $Id$ +// RCS-ID: $Id: imagbmp.h 61872 2009-09-09 22:37:05Z VZ $ // Copyright: (c) Robert Roebling, Chris Elliott // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -21,6 +21,13 @@ #define wxIMAGE_OPTION_CUR_HOTSPOT_X wxT("HotSpotX") #define wxIMAGE_OPTION_CUR_HOTSPOT_Y wxT("HotSpotY") +#if WXWIN_COMPATIBILITY_2_4 + // Do not use these macros, they are deprecated + #define wxBMP_FORMAT wxIMAGE_OPTION_BMP_FORMAT + #define wxCUR_HOTSPOT_X wxIMAGE_OPTION_CUR_HOTSPOT_X + #define wxCUR_HOTSPOT_Y wxIMAGE_OPTION_CUR_HOTSPOT_Y +#endif + enum { @@ -40,7 +47,7 @@ enum // wxBMPHandler // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxBMPHandler : public wxImageHandler +class WXDLLEXPORT wxBMPHandler : public wxImageHandler { public: wxBMPHandler() @@ -74,7 +81,7 @@ private: // wxICOHandler // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxICOHandler : public wxBMPHandler +class WXDLLEXPORT wxICOHandler : public wxBMPHandler { public: wxICOHandler() @@ -89,9 +96,8 @@ public: virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ); virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ); virtual bool DoLoadFile( wxImage *image, wxInputStream& stream, bool verbose, int index ); - + virtual int GetImageCount( wxInputStream& stream ); protected: - virtual int DoGetImageCount( wxInputStream& stream ); virtual bool DoCanRead( wxInputStream& stream ); #endif // wxUSE_STREAMS @@ -104,7 +110,7 @@ private: // wxCURHandler // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxCURHandler : public wxICOHandler +class WXDLLEXPORT wxCURHandler : public wxICOHandler { public: wxCURHandler() @@ -131,7 +137,7 @@ private: // wxANIHandler // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxANIHandler : public wxCURHandler +class WXDLLEXPORT wxANIHandler : public wxCURHandler { public: wxANIHandler() @@ -146,9 +152,8 @@ public: #if wxUSE_STREAMS virtual bool SaveFile( wxImage *WXUNUSED(image), wxOutputStream& WXUNUSED(stream), bool WXUNUSED(verbose=true) ){return false ;} virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ); - + virtual int GetImageCount( wxInputStream& stream ); protected: - virtual int DoGetImageCount( wxInputStream& stream ); virtual bool DoCanRead( wxInputStream& stream ); #endif // wxUSE_STREAMS diff --git a/Source/3rd Party/wx/include/wx/image.h b/Source/3rd Party/wx/include/wx/image.h index 36e136116..8dc2d8500 100644 --- a/Source/3rd Party/wx/include/wx/image.h +++ b/Source/3rd Party/wx/include/wx/image.h @@ -2,7 +2,7 @@ // Name: wx/image.h // Purpose: wxImage class // Author: Robert Roebling -// RCS-ID: $Id$ +// RCS-ID: $Id: image.h 61872 2009-09-09 22:37:05Z VZ $ // Copyright: (c) Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -18,7 +18,6 @@ #include "wx/string.h" #include "wx/gdicmn.h" #include "wx/hashmap.h" -#include "wx/arrstr.h" #if wxUSE_STREAMS # include "wx/stream.h" @@ -28,50 +27,27 @@ // which breaks the compilation below #undef index -#define wxIMAGE_OPTION_QUALITY wxString(wxS("quality")) -#define wxIMAGE_OPTION_FILENAME wxString(wxS("FileName")) +#define wxIMAGE_OPTION_QUALITY wxString(wxT("quality")) +#define wxIMAGE_OPTION_FILENAME wxString(wxT("FileName")) -#define wxIMAGE_OPTION_RESOLUTION wxString(wxS("Resolution")) -#define wxIMAGE_OPTION_RESOLUTIONX wxString(wxS("ResolutionX")) -#define wxIMAGE_OPTION_RESOLUTIONY wxString(wxS("ResolutionY")) +#define wxIMAGE_OPTION_RESOLUTION wxString(wxT("Resolution")) +#define wxIMAGE_OPTION_RESOLUTIONX wxString(wxT("ResolutionX")) +#define wxIMAGE_OPTION_RESOLUTIONY wxString(wxT("ResolutionY")) -#define wxIMAGE_OPTION_RESOLUTIONUNIT wxString(wxS("ResolutionUnit")) - -#define wxIMAGE_OPTION_MAX_WIDTH wxString(wxS("MaxWidth")) -#define wxIMAGE_OPTION_MAX_HEIGHT wxString(wxS("MaxHeight")) - -#define wxIMAGE_OPTION_ORIGINAL_WIDTH wxString(wxS("OriginalWidth")) -#define wxIMAGE_OPTION_ORIGINAL_HEIGHT wxString(wxS("OriginalHeight")) +#define wxIMAGE_OPTION_RESOLUTIONUNIT wxString(wxT("ResolutionUnit")) // constants used with wxIMAGE_OPTION_RESOLUTIONUNIT -// -// NB: don't change these values, they correspond to libjpeg constants -enum wxImageResolution +enum { - // Resolution not specified - wxIMAGE_RESOLUTION_NONE = 0, - - // Resolution specified in inches wxIMAGE_RESOLUTION_INCHES = 1, - - // Resolution specified in centimeters wxIMAGE_RESOLUTION_CM = 2 }; // Constants for wxImage::Scale() for determining the level of quality -enum wxImageResizeQuality +enum { - // different image resizing algorithms used by Scale() and Rescale() - wxIMAGE_QUALITY_NEAREST = 0, - wxIMAGE_QUALITY_BILINEAR = 1, - wxIMAGE_QUALITY_BICUBIC = 2, - wxIMAGE_QUALITY_BOX_AVERAGE = 3, - - // default quality is low (but fast) - wxIMAGE_QUALITY_NORMAL = wxIMAGE_QUALITY_NEAREST, - - // highest (but best) quality - wxIMAGE_QUALITY_HIGH + wxIMAGE_QUALITY_NORMAL = 0, + wxIMAGE_QUALITY_HIGH = 1 }; // alpha channel values: fully transparent, default threshold separating @@ -95,32 +71,25 @@ class WXDLLIMPEXP_FWD_CORE wxPalette; #if wxUSE_VARIANT #include "wx/variant.h" -DECLARE_VARIANT_OBJECT_EXPORTED(wxImage,WXDLLIMPEXP_CORE) +DECLARE_VARIANT_OBJECT_EXPORTED(wxImage,WXDLLEXPORT) #endif //----------------------------------------------------------------------------- // wxImageHandler //----------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxImageHandler: public wxObject +class WXDLLEXPORT wxImageHandler: public wxObject { public: wxImageHandler() - : m_name(wxEmptyString), m_extension(wxEmptyString), m_mime(), m_type(wxBITMAP_TYPE_INVALID) + : m_name(wxEmptyString), m_extension(wxEmptyString), m_mime(), m_type(0) { } #if wxUSE_STREAMS - // NOTE: LoadFile and SaveFile are not pure virtuals to allow derived classes - // to implement only one of the two - virtual bool LoadFile( wxImage *WXUNUSED(image), wxInputStream& WXUNUSED(stream), - bool WXUNUSED(verbose)=true, int WXUNUSED(index)=-1 ) - { return false; } - virtual bool SaveFile( wxImage *WXUNUSED(image), wxOutputStream& WXUNUSED(stream), - bool WXUNUSED(verbose)=true ) - { return false; } + virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ); + virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ); - int GetImageCount( wxInputStream& stream ); - // save the stream position, call DoGetImageCount() and restore the position + virtual int GetImageCount( wxInputStream& stream ); bool CanRead( wxInputStream& stream ) { return CallDoCanRead(stream); } bool CanRead( const wxString& name ); @@ -128,48 +97,25 @@ public: void SetName(const wxString& name) { m_name = name; } void SetExtension(const wxString& ext) { m_extension = ext; } - void SetAltExtensions(const wxArrayString& exts) { m_altExtensions = exts; } - void SetType(wxBitmapType type) { m_type = type; } + void SetType(long type) { m_type = type; } void SetMimeType(const wxString& type) { m_mime = type; } const wxString& GetName() const { return m_name; } const wxString& GetExtension() const { return m_extension; } - const wxArrayString& GetAltExtensions() const { return m_altExtensions; } - wxBitmapType GetType() const { return m_type; } + long GetType() const { return m_type; } const wxString& GetMimeType() const { return m_mime; } -#if WXWIN_COMPATIBILITY_2_8 - wxDEPRECATED( - void SetType(long type) { SetType((wxBitmapType)type); } - ) -#endif // WXWIN_COMPATIBILITY_2_8 - protected: #if wxUSE_STREAMS - // NOTE: this function is allowed to change the current stream position - // since GetImageCount() will take care of restoring it later - virtual int DoGetImageCount( wxInputStream& WXUNUSED(stream) ) - { return 1; } // default return value is 1 image - - // NOTE: this function is allowed to change the current stream position - // since CallDoCanRead() will take care of restoring it later virtual bool DoCanRead( wxInputStream& stream ) = 0; // save the stream position, call DoCanRead() and restore the position bool CallDoCanRead(wxInputStream& stream); #endif // wxUSE_STREAMS - // helper for the derived classes SaveFile() implementations: returns the - // values of x- and y-resolution options specified as the image options if - // any - static wxImageResolution - GetResolutionFromOptions(const wxImage& image, int *x, int *y); - - wxString m_name; wxString m_extension; - wxArrayString m_altExtensions; wxString m_mime; - wxBitmapType m_type; + long m_type; private: DECLARE_CLASS(wxImageHandler) @@ -179,7 +125,7 @@ private: // wxImageHistogram //----------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxImageHistogramEntry +class WXDLLEXPORT wxImageHistogramEntry { public: wxImageHistogramEntry() { index = value = 0; } @@ -191,7 +137,7 @@ WX_DECLARE_EXPORTED_HASH_MAP(unsigned long, wxImageHistogramEntry, wxIntegerHash, wxIntegerEqual, wxImageHistogramBase); -class WXDLLIMPEXP_CORE wxImageHistogram : public wxImageHistogramBase +class WXDLLEXPORT wxImageHistogram : public wxImageHistogramBase { public: wxImageHistogram() : wxImageHistogramBase(256) { } @@ -221,7 +167,7 @@ public: // wxImage //----------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxImage: public wxObject +class WXDLLEXPORT wxImage: public wxObject { public: // red, green and blue are 8 bit unsigned integers in the range of 0..255 @@ -247,60 +193,30 @@ public: double value; }; - wxImage() {} - wxImage( int width, int height, bool clear = true ) - { Create( width, height, clear ); } - wxImage( int width, int height, unsigned char* data, bool static_data = false ) - { Create( width, height, data, static_data ); } - wxImage( int width, int height, unsigned char* data, unsigned char* alpha, bool static_data = false ) - { Create( width, height, data, alpha, static_data ); } - - // ctor variants using wxSize: - wxImage( const wxSize& sz, bool clear = true ) - { Create( sz, clear ); } - wxImage( const wxSize& sz, unsigned char* data, bool static_data = false ) - { Create( sz, data, static_data ); } - wxImage( const wxSize& sz, unsigned char* data, unsigned char* alpha, bool static_data = false ) - { Create( sz, data, alpha, static_data ); } - - wxImage( const wxString& name, wxBitmapType type = wxBITMAP_TYPE_ANY, int index = -1 ) - { LoadFile( name, type, index ); } - wxImage( const wxString& name, const wxString& mimetype, int index = -1 ) - { LoadFile( name, mimetype, index ); } - wxImage( const char* const* xpmData ) - { Create(xpmData); } + wxImage(){} + wxImage( int width, int height, bool clear = true ); + wxImage( int width, int height, unsigned char* data, bool static_data = false ); + wxImage( int width, int height, unsigned char* data, unsigned char* alpha, bool static_data = false ); + wxImage( const wxString& name, long type = wxBITMAP_TYPE_ANY, int index = -1 ); + wxImage( const wxString& name, const wxString& mimetype, int index = -1 ); + wxImage( const char* const* xpmData ); #if wxUSE_STREAMS - wxImage( wxInputStream& stream, wxBitmapType type = wxBITMAP_TYPE_ANY, int index = -1 ) - { LoadFile( stream, type, index ); } - wxImage( wxInputStream& stream, const wxString& mimetype, int index = -1 ) - { LoadFile( stream, mimetype, index ); } + wxImage( wxInputStream& stream, long type = wxBITMAP_TYPE_ANY, int index = -1 ); + wxImage( wxInputStream& stream, const wxString& mimetype, int index = -1 ); #endif // wxUSE_STREAMS - bool Create( const char* const* xpmData ); -#ifdef __BORLANDC__ - // needed for Borland 5.5 - wxImage( char** xpmData ) { Create(const_cast(xpmData)); } - bool Create( char** xpmData ) { return Create(const_cast(xpmData)); } -#endif - bool Create( int width, int height, bool clear = true ); bool Create( int width, int height, unsigned char* data, bool static_data = false ); bool Create( int width, int height, unsigned char* data, unsigned char* alpha, bool static_data = false ); - - // Create() variants using wxSize: - bool Create( const wxSize& sz, bool clear = true ) - { return Create(sz.GetWidth(), sz.GetHeight(), clear); } - bool Create( const wxSize& sz, unsigned char* data, bool static_data = false ) - { return Create(sz.GetWidth(), sz.GetHeight(), data, static_data); } - bool Create( const wxSize& sz, unsigned char* data, unsigned char* alpha, bool static_data = false ) - { return Create(sz.GetWidth(), sz.GetHeight(), data, alpha, static_data); } - + bool Create( const char* const* xpmData ); +#ifdef __BORLANDC__ + // needed for Borland 5.5 + wxImage( char** xpmData ) { Create(wx_const_cast(const char* const*, xpmData)); } + bool Create( char** xpmData ) { return Create(wx_const_cast(const char* const*, xpmData)); } +#endif void Destroy(); - // initialize the image data with zeroes - void Clear(unsigned char value = 0); - // creates an identical copy of the image (the = operator // just raises the ref count) wxImage Copy() const; @@ -320,26 +236,21 @@ public: void Paste( const wxImage &image, int x, int y ); // return the new image with size width*height - wxImage Scale( int width, int height, - wxImageResizeQuality quality = wxIMAGE_QUALITY_NORMAL ) const; + wxImage Scale( int width, int height, int quality = wxIMAGE_QUALITY_NORMAL ) const; // box averager and bicubic filters for up/down sampling - wxImage ResampleNearest(int width, int height) const; wxImage ResampleBox(int width, int height) const; - wxImage ResampleBilinear(int width, int height) const; wxImage ResampleBicubic(int width, int height) const; // blur the image according to the specified pixel radius - wxImage Blur(int radius) const; - wxImage BlurHorizontal(int radius) const; - wxImage BlurVertical(int radius) const; + wxImage Blur(int radius); + wxImage BlurHorizontal(int radius); + wxImage BlurVertical(int radius); wxImage ShrinkBy( int xFactor , int yFactor ) const ; // rescales the image in place - wxImage& Rescale( int width, int height, - wxImageResizeQuality quality = wxIMAGE_QUALITY_NORMAL ) - { return *this = Scale(width, height, quality); } + wxImage& Rescale( int width, int height, int quality = wxIMAGE_QUALITY_NORMAL ) { return *this = Scale(width, height, quality); } // resizes the image in place wxImage& Resize( const wxSize& size, const wxPoint& pos, @@ -348,10 +259,9 @@ public: // Rotates the image about the given point, 'angle' radians. // Returns the rotated image, leaving this image intact. wxImage Rotate(double angle, const wxPoint & centre_of_rotation, - bool interpolating = true, wxPoint * offset_after_rotation = NULL) const; + bool interpolating = true, wxPoint * offset_after_rotation = (wxPoint*) NULL) const; wxImage Rotate90( bool clockwise = true ) const; - wxImage Rotate180() const; wxImage Mirror( bool horizontally = true ) const; // replace one colour with another @@ -359,17 +269,13 @@ public: unsigned char r2, unsigned char g2, unsigned char b2 ); // Convert to greyscale image. Uses the luminance component (Y) of the image. - // The luma value (YUV) is calculated using (R * weight_r) + (G * weight_g) + (B * weight_b), defaults to ITU-T BT.601 - wxImage ConvertToGreyscale(double weight_r, double weight_g, double weight_b) const; - wxImage ConvertToGreyscale(void) const; + // The luma value (YUV) is calculated using (R * lr) + (G * lg) + (B * lb), defaults to ITU-T BT.601 + wxImage ConvertToGreyscale( double lr = 0.299, double lg = 0.587, double lb = 0.114 ) const; // convert to monochrome image ( will be replaced by white, // everything else by black) wxImage ConvertToMono( unsigned char r, unsigned char g, unsigned char b ) const; - // Convert to disabled (dimmed) image. - wxImage ConvertToDisabled(unsigned char brightness = 255) const; - // these routines are slow but safe void SetRGB( int x, int y, unsigned char r, unsigned char g, unsigned char b ); void SetRGB( const wxRect& rect, unsigned char r, unsigned char g, unsigned char b ); @@ -389,13 +295,9 @@ public: bool SetMaskFromImage(const wxImage & mask, unsigned char mr, unsigned char mg, unsigned char mb); - // converts image's alpha channel to mask (choosing mask colour - // automatically or using the specified colour for the mask), if it has - // any, does nothing otherwise: + // converts image's alpha channel to mask, if it has any, does nothing + // otherwise: bool ConvertAlphaToMask(unsigned char threshold = wxIMAGE_ALPHA_THRESHOLD); - bool ConvertAlphaToMask(unsigned char mr, unsigned char mg, unsigned char mb, - unsigned char threshold = wxIMAGE_ALPHA_THRESHOLD); - // This method converts an image where the original alpha // information is only available as a shades of a colour @@ -410,23 +312,23 @@ public: bool ConvertColourToAlpha( unsigned char r, unsigned char g, unsigned char b ); static bool CanRead( const wxString& name ); - static int GetImageCount( const wxString& name, wxBitmapType type = wxBITMAP_TYPE_ANY ); - virtual bool LoadFile( const wxString& name, wxBitmapType type = wxBITMAP_TYPE_ANY, int index = -1 ); + static int GetImageCount( const wxString& name, long type = wxBITMAP_TYPE_ANY ); + virtual bool LoadFile( const wxString& name, long type = wxBITMAP_TYPE_ANY, int index = -1 ); virtual bool LoadFile( const wxString& name, const wxString& mimetype, int index = -1 ); #if wxUSE_STREAMS static bool CanRead( wxInputStream& stream ); - static int GetImageCount( wxInputStream& stream, wxBitmapType type = wxBITMAP_TYPE_ANY ); - virtual bool LoadFile( wxInputStream& stream, wxBitmapType type = wxBITMAP_TYPE_ANY, int index = -1 ); + static int GetImageCount( wxInputStream& stream, long type = wxBITMAP_TYPE_ANY ); + virtual bool LoadFile( wxInputStream& stream, long type = wxBITMAP_TYPE_ANY, int index = -1 ); virtual bool LoadFile( wxInputStream& stream, const wxString& mimetype, int index = -1 ); #endif virtual bool SaveFile( const wxString& name ) const; - virtual bool SaveFile( const wxString& name, wxBitmapType type ) const; + virtual bool SaveFile( const wxString& name, int type ) const; virtual bool SaveFile( const wxString& name, const wxString& mimetype ) const; #if wxUSE_STREAMS - virtual bool SaveFile( wxOutputStream& stream, wxBitmapType type ) const; + virtual bool SaveFile( wxOutputStream& stream, int type ) const; virtual bool SaveFile( wxOutputStream& stream, const wxString& mimetype ) const; #endif @@ -435,17 +337,6 @@ public: int GetWidth() const; int GetHeight() const; - wxSize GetSize() const - { return wxSize(GetWidth(), GetHeight()); } - - // Gets the type of image found by LoadFile or specified with SaveFile - wxBitmapType GetType() const; - - // Set the image type, this is normally only called if the image is being - // created from data in the given format but not using LoadFile() (e.g. - // wxGIFDecoder uses this) - void SetType(wxBitmapType type); - // these functions provide fastest access to wxImage data but should be // used carefully as no checks are done unsigned char *GetData() const; @@ -456,7 +347,6 @@ public: bool HasAlpha() const { return GetAlpha() != NULL; } void SetAlpha(unsigned char *alpha = NULL, bool static_data=false); void InitAlpha(); - void ClearAlpha(); // return true if this pixel is masked or has alpha less than specified // threshold @@ -507,9 +397,8 @@ public: static void InsertHandler( wxImageHandler *handler ); static bool RemoveHandler( const wxString& name ); static wxImageHandler *FindHandler( const wxString& name ); - static wxImageHandler *FindHandler( const wxString& extension, wxBitmapType imageType ); - static wxImageHandler *FindHandler( wxBitmapType imageType ); - + static wxImageHandler *FindHandler( const wxString& extension, long imageType ); + static wxImageHandler *FindHandler( long imageType ); static wxImageHandler *FindHandlerMime( const wxString& mimetype ); static wxString GetImageExtWildcard(); @@ -520,65 +409,6 @@ public: static HSVValue RGBtoHSV(const RGBValue& rgb); static RGBValue HSVtoRGB(const HSVValue& hsv); -#if WXWIN_COMPATIBILITY_2_8 - wxDEPRECATED_CONSTRUCTOR( - wxImage(const wxString& name, long type, int index = -1) - { - LoadFile(name, (wxBitmapType)type, index); - } - ) - -#if wxUSE_STREAMS - wxDEPRECATED_CONSTRUCTOR( - wxImage(wxInputStream& stream, long type, int index = -1) - { - LoadFile(stream, (wxBitmapType)type, index); - } - ) - - wxDEPRECATED( - bool LoadFile(wxInputStream& stream, long type, int index = -1) - { - return LoadFile(stream, (wxBitmapType)type, index); - } - ) - - wxDEPRECATED( - bool SaveFile(wxOutputStream& stream, long type) const - { - return SaveFile(stream, (wxBitmapType)type); - } - ) -#endif // wxUSE_STREAMS - - wxDEPRECATED( - bool LoadFile(const wxString& name, long type, int index = -1) - { - return LoadFile(name, (wxBitmapType)type, index); - } - ) - - wxDEPRECATED( - bool SaveFile(const wxString& name, long type) const - { - return SaveFile(name, (wxBitmapType)type); - } - ) - - static wxDEPRECATED( - wxImageHandler *FindHandler(const wxString& ext, long type) - { - return FindHandler(ext, (wxBitmapType)type); - } - ) - - static wxDEPRECATED( - wxImageHandler *FindHandler(long imageType) - { - return FindHandler((wxBitmapType)imageType); - } - ) -#endif // WXWIN_COMPATIBILITY_2_8 protected: static wxList sm_handlers; @@ -595,41 +425,13 @@ protected: private: friend class WXDLLIMPEXP_FWD_CORE wxImageHandler; - // Possible values for MakeEmptyClone() flags. - enum - { - // Create an image with the same orientation as this one. This is the - // default and only exists for symmetry with SwapOrientation. - Clone_SameOrientation = 0, - - // Create an image with the same height as this image width and the - // same width as this image height. - Clone_SwapOrientation = 1 - }; - - // Returns a new blank image with the same dimensions (or with width and - // height swapped if Clone_SwapOrientation flag is given), alpha, and mask - // as this image itself. This is used by several functions creating - // modified versions of this image. - wxImage MakeEmptyClone(int flags = Clone_SameOrientation) const; - -#if wxUSE_STREAMS - // read the image from the specified stream updating image type if - // successful - bool DoLoad(wxImageHandler& handler, wxInputStream& stream, int index); - - // write the image to the specified stream and also update the image type - // if successful - bool DoSave(wxImageHandler& handler, wxOutputStream& stream) const; -#endif // wxUSE_STREAMS - DECLARE_DYNAMIC_CLASS(wxImage) }; -extern void WXDLLIMPEXP_CORE wxInitAllImageHandlers(); +extern void WXDLLEXPORT wxInitAllImageHandlers(); -extern WXDLLIMPEXP_DATA_CORE(wxImage) wxNullImage; +extern WXDLLEXPORT_DATA(wxImage) wxNullImage; //----------------------------------------------------------------------------- // wxImage handlers diff --git a/Source/3rd Party/wx/include/wx/imaggif.h b/Source/3rd Party/wx/include/wx/imaggif.h index fce797ae5..21b58e618 100644 --- a/Source/3rd Party/wx/include/wx/imaggif.h +++ b/Source/3rd Party/wx/include/wx/imaggif.h @@ -1,9 +1,9 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/imaggif.h +// Name: imaggif.h // Purpose: wxImage GIF handler -// Author: Vaclav Slavik, Guillermo Rodriguez Garcia, Gershon Elber, Troels K -// RCS-ID: $Id$ -// Copyright: (c) 1999-2011 Vaclav Slavik, Guillermo Rodriguez Garcia, Gershon Elber, Troels K +// Author: Vaclav Slavik & Guillermo Rodriguez Garcia +// RCS-ID: $Id: imaggif.h 37393 2006-02-08 21:47:09Z VZ $ +// Copyright: (c) Guillermo Rodriguez Garcia // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -19,13 +19,7 @@ #if wxUSE_GIF -#define wxIMAGE_OPTION_GIF_COMMENT wxT("GifComment") - -struct wxRGB; -struct GifHashTableType; -class WXDLLIMPEXP_FWD_CORE wxImageArray; // anidecod.h - -class WXDLLIMPEXP_CORE wxGIFHandler : public wxImageHandler +class WXDLLEXPORT wxGIFHandler : public wxImageHandler { public: inline wxGIFHandler() @@ -34,61 +28,21 @@ public: m_extension = wxT("gif"); m_type = wxBITMAP_TYPE_GIF; m_mime = wxT("image/gif"); - m_hashTable = NULL; } #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); - - // Save animated gif - bool SaveAnimation(const wxImageArray& images, wxOutputStream *stream, - bool verbose = true, int delayMilliSecs = 1000); - + virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ); + virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ); protected: - virtual int DoGetImageCount(wxInputStream& stream); - virtual bool DoCanRead(wxInputStream& stream); - - bool DoSaveFile(const wxImage&, wxOutputStream *, bool verbose, - bool first, int delayMilliSecs, bool loop, - const wxRGB *pal, int palCount, - int mask_index); -#endif // wxUSE_STREAMS -protected: - - // Declarations for saving - - unsigned long m_crntShiftDWord; /* For bytes decomposition into codes. */ - int m_pixelCount; - struct GifHashTableType *m_hashTable; - wxInt16 - m_EOFCode, /* The EOF LZ code. */ - m_clearCode, /* The CLEAR LZ code. */ - m_runningCode, /* The next code algorithm can generate. */ - m_runningBits, /* The number of bits required to represent RunningCode. */ - m_maxCode1, /* 1 bigger than max. possible code, in RunningBits bits. */ - m_crntCode, /* Current algorithm code. */ - m_crntShiftState; /* Number of bits in CrntShiftDWord. */ - wxUint8 m_LZBuf[256]; /* Compressed input is buffered here. */ - - bool InitHashTable(); - void ClearHashTable(); - void InsertHashTable(unsigned long key, int code); - int ExistsHashTable(unsigned long key); - -#if wxUSE_STREAMS - bool CompressOutput(wxOutputStream *, int code); - bool SetupCompress(wxOutputStream *, int bpp); - bool CompressLine(wxOutputStream *, const wxUint8 *line, int lineLen); + virtual bool DoCanRead( wxInputStream& stream ); #endif private: DECLARE_DYNAMIC_CLASS(wxGIFHandler) }; +#endif -#endif // wxUSE_GIF -#endif // _WX_IMAGGIF_H_ +#endif + // _WX_IMAGGIF_H_ diff --git a/Source/3rd Party/wx/include/wx/imagiff.h b/Source/3rd Party/wx/include/wx/imagiff.h index 06e1daefc..6b47da735 100644 --- a/Source/3rd Party/wx/include/wx/imagiff.h +++ b/Source/3rd Party/wx/include/wx/imagiff.h @@ -1,8 +1,8 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/imagiff.h +// Name: imagiff.h // Purpose: wxImage handler for Amiga IFF images // Author: Steffen Gutmann -// RCS-ID: $Id$ +// RCS-ID: $Id: imagiff.h 35650 2005-09-23 12:56:45Z MR $ // Copyright: (c) Steffen Gutmann, 2002 // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -18,7 +18,7 @@ #if wxUSE_IMAGE && wxUSE_IFF -class WXDLLIMPEXP_CORE wxIFFHandler : public wxImageHandler +class WXDLLEXPORT wxIFFHandler : public wxImageHandler { public: wxIFFHandler() @@ -32,10 +32,10 @@ public: #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); -protected: virtual bool DoCanRead(wxInputStream& stream); #endif +private: DECLARE_DYNAMIC_CLASS(wxIFFHandler) }; diff --git a/Source/3rd Party/wx/include/wx/imagjpeg.h b/Source/3rd Party/wx/include/wx/imagjpeg.h index ad13c400d..410b7cc93 100644 --- a/Source/3rd Party/wx/include/wx/imagjpeg.h +++ b/Source/3rd Party/wx/include/wx/imagjpeg.h @@ -1,8 +1,8 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/imagjpeg.h +// Name: imagjpeg.h // Purpose: wxImage JPEG handler // Author: Vaclav Slavik -// RCS-ID: $Id$ +// RCS-ID: $Id: imagjpeg.h 37393 2006-02-08 21:47:09Z VZ $ // Copyright: (c) Vaclav Slavik // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -19,23 +19,18 @@ #if wxUSE_LIBJPEG #include "wx/image.h" -#include "wx/versioninfo.h" -class WXDLLIMPEXP_CORE wxJPEGHandler: public wxImageHandler +class WXDLLEXPORT wxJPEGHandler: public wxImageHandler { public: inline wxJPEGHandler() { m_name = wxT("JPEG file"); m_extension = wxT("jpg"); - m_altExtensions.Add(wxT("jpeg")); - m_altExtensions.Add(wxT("jpe")); m_type = wxBITMAP_TYPE_JPEG; 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/Source/3rd Party/wx/include/wx/imaglist.h b/Source/3rd Party/wx/include/wx/imaglist.h index 0a08bb5b7..91cf8eac6 100644 --- a/Source/3rd Party/wx/include/wx/imaglist.h +++ b/Source/3rd Party/wx/include/wx/imaglist.h @@ -5,15 +5,13 @@ // Modified by: // Created: // Copyright: (c) Julian Smart -// RCS-ID: $Id$ +// RCS-ID: $Id: imaglist.h 41288 2006-09-18 23:06:35Z VZ $ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_IMAGLIST_H_BASE_ #define _WX_IMAGLIST_H_BASE_ -#include "wx/defs.h" - /* * wxImageList is used for wxListCtrl, wxTreeCtrl. These controls refer to * images for their items by an index into an image list. @@ -42,7 +40,7 @@ enum #define wxIMAGELIST_DRAW_SELECTED 0x0004 #define wxIMAGELIST_DRAW_FOCUSED 0x0008 -#if defined(__WXMSW__) || defined(__WXMAC__) +#if defined(__WXMSW__) || defined(__WXMAC_CARBON__) #define wxHAS_NATIVE_IMAGELIST #endif @@ -50,8 +48,8 @@ enum #include "wx/generic/imaglist.h" #elif defined(__WXMSW__) #include "wx/msw/imaglist.h" -#elif defined(__WXMAC__) - #include "wx/osx/imaglist.h" +#elif defined(__WXMAC_CARBON__) + #include "wx/mac/imaglist.h" #endif #endif // _WX_IMAGLIST_H_BASE_ diff --git a/Source/3rd Party/wx/include/wx/imagpcx.h b/Source/3rd Party/wx/include/wx/imagpcx.h index 193bd4e71..f56048f84 100644 --- a/Source/3rd Party/wx/include/wx/imagpcx.h +++ b/Source/3rd Party/wx/include/wx/imagpcx.h @@ -1,8 +1,8 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/imagpcx.h +// Name: imagpcx.h // Purpose: wxImage PCX handler // Author: Guillermo Rodriguez Garcia -// RCS-ID: $Id$ +// RCS-ID: $Id: imagpcx.h 37393 2006-02-08 21:47:09Z VZ $ // Copyright: (c) 1999 Guillermo Rodriguez Garcia // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -18,7 +18,7 @@ //----------------------------------------------------------------------------- #if wxUSE_PCX -class WXDLLIMPEXP_CORE wxPCXHandler : public wxImageHandler +class WXDLLEXPORT wxPCXHandler : public wxImageHandler { public: inline wxPCXHandler() diff --git a/Source/3rd Party/wx/include/wx/imagpng.h b/Source/3rd Party/wx/include/wx/imagpng.h index 5524d6336..daea3a26f 100644 --- a/Source/3rd Party/wx/include/wx/imagpng.h +++ b/Source/3rd Party/wx/include/wx/imagpng.h @@ -1,8 +1,8 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/imagpng.h +// Name: imagpng.h // Purpose: wxImage PNG handler // Author: Robert Roebling -// RCS-ID: $Id$ +// RCS-ID: $Id: imagpng.h 37393 2006-02-08 21:47:09Z VZ $ // Copyright: (c) Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -19,25 +19,18 @@ #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") -#define wxIMAGE_OPTION_PNG_FILTER wxT("PngF") -#define wxIMAGE_OPTION_PNG_COMPRESSION_LEVEL wxT("PngZL") -#define wxIMAGE_OPTION_PNG_COMPRESSION_MEM_LEVEL wxT("PngZM") -#define wxIMAGE_OPTION_PNG_COMPRESSION_STRATEGY wxT("PngZS") -#define wxIMAGE_OPTION_PNG_COMPRESSION_BUFFER_SIZE wxT("PngZB") enum { wxPNG_TYPE_COLOUR = 0, wxPNG_TYPE_GREY = 2, - wxPNG_TYPE_GREY_RED = 3, - wxPNG_TYPE_PALETTE = 4 + wxPNG_TYPE_GREY_RED = 3 }; -class WXDLLIMPEXP_CORE wxPNGHandler: public wxImageHandler +class WXDLLEXPORT wxPNGHandler: public wxImageHandler { public: inline wxPNGHandler() @@ -48,8 +41,6 @@ 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/Source/3rd Party/wx/include/wx/imagpnm.h b/Source/3rd Party/wx/include/wx/imagpnm.h index e8ca02a01..68b95efd9 100644 --- a/Source/3rd Party/wx/include/wx/imagpnm.h +++ b/Source/3rd Party/wx/include/wx/imagpnm.h @@ -1,8 +1,8 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/imagpnm.h +// Name: imagpnm.h // Purpose: wxImage PNM handler // Author: Sylvain Bougnoux -// RCS-ID: $Id$ +// RCS-ID: $Id: imagpnm.h 37393 2006-02-08 21:47:09Z VZ $ // Copyright: (c) Sylvain Bougnoux // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -17,16 +17,13 @@ //----------------------------------------------------------------------------- #if wxUSE_PNM -class WXDLLIMPEXP_CORE wxPNMHandler : public wxImageHandler +class WXDLLEXPORT wxPNMHandler : public wxImageHandler { public: inline wxPNMHandler() { m_name = wxT("PNM file"); m_extension = wxT("pnm"); - m_altExtensions.Add(wxT("ppm")); - m_altExtensions.Add(wxT("pgm")); - m_altExtensions.Add(wxT("pbm")); m_type = wxBITMAP_TYPE_PNM; m_mime = wxT("image/pnm"); } diff --git a/Source/3rd Party/wx/include/wx/imagtga.h b/Source/3rd Party/wx/include/wx/imagtga.h index 361d88738..9b0a84187 100644 --- a/Source/3rd Party/wx/include/wx/imagtga.h +++ b/Source/3rd Party/wx/include/wx/imagtga.h @@ -2,7 +2,7 @@ // Name: wx/imagtga.h // Purpose: wxImage TGA handler // Author: Seth Jackson -// RCS-ID: $Id$ +// RCS-ID: $Id: imagtga.h 43843 2006-12-07 05:44:44Z PC $ // Copyright: (c) 2005 Seth Jackson // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -18,14 +18,13 @@ #if wxUSE_TGA -class WXDLLIMPEXP_CORE wxTGAHandler : public wxImageHandler +class WXDLLEXPORT wxTGAHandler : public wxImageHandler { public: wxTGAHandler() { m_name = wxT("TGA file"); m_extension = wxT("tga"); - m_altExtensions.Add(wxT("tpic")); m_type = wxBITMAP_TYPE_TGA; m_mime = wxT("image/tga"); } diff --git a/Source/3rd Party/wx/include/wx/imagtiff.h b/Source/3rd Party/wx/include/wx/imagtiff.h index 5363fdfe5..53df633a3 100644 --- a/Source/3rd Party/wx/include/wx/imagtiff.h +++ b/Source/3rd Party/wx/include/wx/imagtiff.h @@ -1,8 +1,8 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/imagtiff.h +// Name: imagtiff.h // Purpose: wxImage TIFF handler // Author: Robert Roebling -// RCS-ID: $Id$ +// RCS-ID: $Id: imagtiff.h 61872 2009-09-09 22:37:05Z VZ $ // Copyright: (c) Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -19,34 +19,23 @@ #if wxUSE_LIBTIFF #include "wx/image.h" -#include "wx/versioninfo.h" // defines for wxImage::SetOption -#define wxIMAGE_OPTION_TIFF_BITSPERSAMPLE wxString(wxT("BitsPerSample")) -#define wxIMAGE_OPTION_TIFF_SAMPLESPERPIXEL wxString(wxT("SamplesPerPixel")) -#define wxIMAGE_OPTION_TIFF_COMPRESSION wxString(wxT("Compression")) -#define wxIMAGE_OPTION_TIFF_PHOTOMETRIC wxString(wxT("Photometric")) -#define wxIMAGE_OPTION_TIFF_IMAGEDESCRIPTOR wxString(wxT("ImageDescriptor")) +#define wxIMAGE_OPTION_BITSPERSAMPLE wxString(wxT("BitsPerSample")) +#define wxIMAGE_OPTION_SAMPLESPERPIXEL wxString(wxT("SamplesPerPixel")) +#define wxIMAGE_OPTION_COMPRESSION wxString(wxT("Compression")) +#define wxIMAGE_OPTION_IMAGEDESCRIPTOR wxString(wxT("ImageDescriptor")) -// for backwards compatibility -#define wxIMAGE_OPTION_BITSPERSAMPLE wxIMAGE_OPTION_TIFF_BITSPERSAMPLE -#define wxIMAGE_OPTION_SAMPLESPERPIXEL wxIMAGE_OPTION_TIFF_SAMPLESPERPIXEL -#define wxIMAGE_OPTION_COMPRESSION wxIMAGE_OPTION_TIFF_COMPRESSION -#define wxIMAGE_OPTION_IMAGEDESCRIPTOR wxIMAGE_OPTION_TIFF_IMAGEDESCRIPTOR - -class WXDLLIMPEXP_CORE wxTIFFHandler: public wxImageHandler +class WXDLLEXPORT 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 ); - + virtual int GetImageCount( wxInputStream& stream ); protected: - virtual int DoGetImageCount( wxInputStream& stream ); virtual bool DoCanRead( wxInputStream& stream ); #endif diff --git a/Source/3rd Party/wx/include/wx/imagxpm.h b/Source/3rd Party/wx/include/wx/imagxpm.h index 5dfd27f29..4bff4894f 100644 --- a/Source/3rd Party/wx/include/wx/imagxpm.h +++ b/Source/3rd Party/wx/include/wx/imagxpm.h @@ -1,8 +1,8 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/imagxpm.h +// Name: imaggif.h // Purpose: wxImage XPM handler // Author: Vaclav Slavik -// RCS-ID: $Id$ +// RCS-ID: $Id: imagxpm.h 37393 2006-02-08 21:47:09Z VZ $ // Copyright: (c) 2001 Vaclav Slavik // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -12,13 +12,12 @@ #include "wx/image.h" -#if wxUSE_XPM //----------------------------------------------------------------------------- // wxXPMHandler //----------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxXPMHandler : public wxImageHandler +class WXDLLEXPORT wxXPMHandler : public wxImageHandler { public: inline wxXPMHandler() @@ -40,6 +39,7 @@ private: DECLARE_DYNAMIC_CLASS(wxXPMHandler) }; -#endif // wxUSE_XPM -#endif // _WX_IMAGXPM_H_ +#endif + // _WX_IMAGXPM_H_ + diff --git a/Source/3rd Party/wx/include/wx/infobar.h b/Source/3rd Party/wx/include/wx/infobar.h deleted file mode 100644 index 5c3cfe379..000000000 --- a/Source/3rd Party/wx/include/wx/infobar.h +++ /dev/null @@ -1,68 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/infobar.h -// Purpose: declaration of wxInfoBarBase defining common API of wxInfoBar -// Author: Vadim Zeitlin -// Created: 2009-07-28 -// RCS-ID: $Id$ -// Copyright: (c) 2009 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_INFOBAR_H_ -#define _WX_INFOBAR_H_ - -#include "wx/defs.h" - -#if wxUSE_INFOBAR - -#include "wx/control.h" - -// ---------------------------------------------------------------------------- -// wxInfoBar shows non-critical but important information to the user -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxInfoBarBase : public wxControl -{ -public: - // real ctors are provided by the derived classes, just notice that unlike - // most of the other windows, info bar is created hidden and must be - // explicitly shown when it is needed (this is done because it is supposed - // to be shown only intermittently and hiding it after creating it from the - // user code would result in flicker) - wxInfoBarBase() { } - - - // show the info bar with the given message and optionally an icon - virtual void ShowMessage(const wxString& msg, - int flags = wxICON_INFORMATION) = 0; - - // hide the info bar - virtual void Dismiss() = 0; - - // add an extra button to the bar, near the message (replacing the default - // close button which is only shown if no extra buttons are used) - virtual void AddButton(wxWindowID btnid, - const wxString& label = wxString()) = 0; - - // remove a button previously added by AddButton() - virtual void RemoveButton(wxWindowID btnid) = 0; - -private: - wxDECLARE_NO_COPY_CLASS(wxInfoBarBase); -}; - -// currently only GTK+ has a native implementation -#if defined(__WXGTK218__) && !defined(__WXUNIVERSAL__) - #include "wx/gtk/infobar.h" - #define wxHAS_NATIVE_INFOBAR -#endif // wxGTK2 - -// if the generic version is the only one we have, use it -#ifndef wxHAS_NATIVE_INFOBAR - #include "wx/generic/infobar.h" - #define wxInfoBar wxInfoBarGeneric -#endif - -#endif // wxUSE_INFOBAR - -#endif // _WX_INFOBAR_H_ diff --git a/Source/3rd Party/wx/include/wx/init.h b/Source/3rd Party/wx/include/wx/init.h index 611a893dc..d07112ff5 100644 --- a/Source/3rd Party/wx/include/wx/init.h +++ b/Source/3rd Party/wx/include/wx/init.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 29.06.2003 -// RCS-ID: $Id$ +// RCS-ID: $Id: init.h 61558 2009-07-30 10:14:36Z VS $ // Copyright: (c) 2003 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -13,7 +13,7 @@ #define _WX_INIT_H_ #include "wx/defs.h" -#include "wx/chartype.h" +#include "wx/wxchar.h" // ---------------------------------------------------------------------------- // wxEntry helper functions which allow to have more fine grained control @@ -53,23 +53,16 @@ extern int WXDLLIMPEXP_BASE wxEntry(int& argc, char **argv); #endif// wxUSE_UNICODE -// Under Windows we define additional wxEntry() overloads with signature -// compatible with WinMain() and not the traditional main(). -#if wxUSE_GUI && defined(__WINDOWS__) - #include "wx/msw/init.h" -#endif - // ---------------------------------------------------------------------------- // Using the library without (explicit) application object: you may avoid using -// wxDECLARE_APP and wxIMPLEMENT_APP macros and call the functions below instead at +// DECLARE_APP and IMPLEMENT_APP macros and call the functions below instead at // the program startup and termination // ---------------------------------------------------------------------------- // initialize the library (may be called as many times as needed, but each // call to wxInitialize() must be matched by wxUninitialize()) -extern bool WXDLLIMPEXP_BASE wxInitialize(); -extern bool WXDLLIMPEXP_BASE wxInitialize(int argc, wxChar **argv); -#if wxUSE_UNICODE +extern bool WXDLLIMPEXP_BASE wxInitialize(int argc = 0, wxChar **argv = NULL); +#if wxUSE_UNICODE && wxABI_VERSION >= 20811 extern bool WXDLLIMPEXP_BASE wxInitialize(int argc, char **argv); #endif @@ -83,17 +76,12 @@ class WXDLLIMPEXP_BASE wxInitializer { public: // initialize the library - wxInitializer() - { - m_ok = wxInitialize(); - } - - wxInitializer(int argc, wxChar **argv) + wxInitializer(int argc = 0, wxChar **argv = NULL) { m_ok = wxInitialize(argc, argv); } -#if wxUSE_UNICODE +#if wxUSE_UNICODE && wxABI_VERSION >= 20811 wxInitializer(int argc, char **argv) { m_ok = wxInitialize(argc, argv); diff --git a/Source/3rd Party/wx/include/wx/intl.h b/Source/3rd Party/wx/include/wx/intl.h index f84e4626d..ed5631a83 100644 --- a/Source/3rd Party/wx/include/wx/intl.h +++ b/Source/3rd Party/wx/include/wx/intl.h @@ -5,17 +5,19 @@ // Modified by: Michael N. Filippov // (2003/09/30 - plural forms support) // Created: 29/01/98 -// RCS-ID: $Id$ +// RCS-ID: $Id: intl.h 61872 2009-09-09 22:37:05Z VZ $ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// +// WARNING: Parts of this file are generated. See misc/languages/README for +// details. + #ifndef _WX_INTL_H_ #define _WX_INTL_H_ #include "wx/defs.h" #include "wx/string.h" -#include "wx/translation.h" // Make wxLayoutDirection enum available without need for wxUSE_INTL so wxWindow, wxApp // and other classes are not distrubed by wxUSE_INTL @@ -30,7 +32,6 @@ enum wxLayoutDirection #if wxUSE_INTL #include "wx/fontenc.h" -#include "wx/language.h" // ============================================================================ // global decls @@ -40,17 +41,290 @@ enum wxLayoutDirection // macros // ---------------------------------------------------------------------------- +// gettext() style macros (notice that xgettext should be invoked with +// --keyword="_" --keyword="wxPLURAL:1,2" options +// to extract the strings from the sources) +#ifndef WXINTL_NO_GETTEXT_MACRO + #define _(s) wxGetTranslation(wxT(s)) + #define wxPLURAL(sing, plur, n) wxGetTranslation(wxT(sing), wxT(plur), n) +#endif + +// another one which just marks the strings for extraction, but doesn't +// perform the translation (use -kwxTRANSLATE with xgettext!) +#define wxTRANSLATE(str) wxT(str) + // ---------------------------------------------------------------------------- // forward decls // ---------------------------------------------------------------------------- class WXDLLIMPEXP_FWD_BASE wxLocale; class WXDLLIMPEXP_FWD_BASE wxLanguageInfoArray; +class wxMsgCatalog; // ============================================================================ // locale support // ============================================================================ +// ---------------------------------------------------------------------------- +// wxLanguage: defines all supported languages +// ---------------------------------------------------------------------------- + +// --- --- --- generated code begins here --- --- --- + +// This enum is generated by misc/languages/genlang.py +// When making changes, please put them into misc/languages/langtabl.txt +enum wxLanguage +{ + // user's default/preffered language as got from OS: + wxLANGUAGE_DEFAULT, + // unknown language, if wxLocale::GetSystemLanguage fails: + wxLANGUAGE_UNKNOWN, + + wxLANGUAGE_ABKHAZIAN, + wxLANGUAGE_AFAR, + wxLANGUAGE_AFRIKAANS, + wxLANGUAGE_ALBANIAN, + wxLANGUAGE_AMHARIC, + wxLANGUAGE_ARABIC, + wxLANGUAGE_ARABIC_ALGERIA, + wxLANGUAGE_ARABIC_BAHRAIN, + wxLANGUAGE_ARABIC_EGYPT, + wxLANGUAGE_ARABIC_IRAQ, + wxLANGUAGE_ARABIC_JORDAN, + wxLANGUAGE_ARABIC_KUWAIT, + wxLANGUAGE_ARABIC_LEBANON, + wxLANGUAGE_ARABIC_LIBYA, + wxLANGUAGE_ARABIC_MOROCCO, + wxLANGUAGE_ARABIC_OMAN, + wxLANGUAGE_ARABIC_QATAR, + wxLANGUAGE_ARABIC_SAUDI_ARABIA, + wxLANGUAGE_ARABIC_SUDAN, + wxLANGUAGE_ARABIC_SYRIA, + wxLANGUAGE_ARABIC_TUNISIA, + wxLANGUAGE_ARABIC_UAE, + wxLANGUAGE_ARABIC_YEMEN, + wxLANGUAGE_ARMENIAN, + wxLANGUAGE_ASSAMESE, + wxLANGUAGE_AYMARA, + wxLANGUAGE_AZERI, + wxLANGUAGE_AZERI_CYRILLIC, + wxLANGUAGE_AZERI_LATIN, + wxLANGUAGE_BASHKIR, + wxLANGUAGE_BASQUE, + wxLANGUAGE_BELARUSIAN, + wxLANGUAGE_BENGALI, + wxLANGUAGE_BHUTANI, + wxLANGUAGE_BIHARI, + wxLANGUAGE_BISLAMA, + wxLANGUAGE_BRETON, + wxLANGUAGE_BULGARIAN, + wxLANGUAGE_BURMESE, + wxLANGUAGE_CAMBODIAN, + wxLANGUAGE_CATALAN, + wxLANGUAGE_CHINESE, + wxLANGUAGE_CHINESE_SIMPLIFIED, + wxLANGUAGE_CHINESE_TRADITIONAL, + wxLANGUAGE_CHINESE_HONGKONG, + wxLANGUAGE_CHINESE_MACAU, + wxLANGUAGE_CHINESE_SINGAPORE, + wxLANGUAGE_CHINESE_TAIWAN, + wxLANGUAGE_CORSICAN, + wxLANGUAGE_CROATIAN, + wxLANGUAGE_CZECH, + wxLANGUAGE_DANISH, + wxLANGUAGE_DUTCH, + wxLANGUAGE_DUTCH_BELGIAN, + wxLANGUAGE_ENGLISH, + wxLANGUAGE_ENGLISH_UK, + wxLANGUAGE_ENGLISH_US, + wxLANGUAGE_ENGLISH_AUSTRALIA, + wxLANGUAGE_ENGLISH_BELIZE, + wxLANGUAGE_ENGLISH_BOTSWANA, + wxLANGUAGE_ENGLISH_CANADA, + wxLANGUAGE_ENGLISH_CARIBBEAN, + wxLANGUAGE_ENGLISH_DENMARK, + wxLANGUAGE_ENGLISH_EIRE, + wxLANGUAGE_ENGLISH_JAMAICA, + wxLANGUAGE_ENGLISH_NEW_ZEALAND, + wxLANGUAGE_ENGLISH_PHILIPPINES, + wxLANGUAGE_ENGLISH_SOUTH_AFRICA, + wxLANGUAGE_ENGLISH_TRINIDAD, + wxLANGUAGE_ENGLISH_ZIMBABWE, + wxLANGUAGE_ESPERANTO, + wxLANGUAGE_ESTONIAN, + wxLANGUAGE_FAEROESE, + wxLANGUAGE_FARSI, + wxLANGUAGE_FIJI, + wxLANGUAGE_FINNISH, + wxLANGUAGE_FRENCH, + wxLANGUAGE_FRENCH_BELGIAN, + wxLANGUAGE_FRENCH_CANADIAN, + wxLANGUAGE_FRENCH_LUXEMBOURG, + wxLANGUAGE_FRENCH_MONACO, + wxLANGUAGE_FRENCH_SWISS, + wxLANGUAGE_FRISIAN, + wxLANGUAGE_GALICIAN, + wxLANGUAGE_GEORGIAN, + wxLANGUAGE_GERMAN, + wxLANGUAGE_GERMAN_AUSTRIAN, + wxLANGUAGE_GERMAN_BELGIUM, + wxLANGUAGE_GERMAN_LIECHTENSTEIN, + wxLANGUAGE_GERMAN_LUXEMBOURG, + wxLANGUAGE_GERMAN_SWISS, + wxLANGUAGE_GREEK, + wxLANGUAGE_GREENLANDIC, + wxLANGUAGE_GUARANI, + wxLANGUAGE_GUJARATI, + wxLANGUAGE_HAUSA, + wxLANGUAGE_HEBREW, + wxLANGUAGE_HINDI, + wxLANGUAGE_HUNGARIAN, + wxLANGUAGE_ICELANDIC, + wxLANGUAGE_INDONESIAN, + wxLANGUAGE_INTERLINGUA, + wxLANGUAGE_INTERLINGUE, + wxLANGUAGE_INUKTITUT, + wxLANGUAGE_INUPIAK, + wxLANGUAGE_IRISH, + wxLANGUAGE_ITALIAN, + wxLANGUAGE_ITALIAN_SWISS, + wxLANGUAGE_JAPANESE, + wxLANGUAGE_JAVANESE, + wxLANGUAGE_KANNADA, + wxLANGUAGE_KASHMIRI, + wxLANGUAGE_KASHMIRI_INDIA, + wxLANGUAGE_KAZAKH, + wxLANGUAGE_KERNEWEK, + wxLANGUAGE_KINYARWANDA, + wxLANGUAGE_KIRGHIZ, + wxLANGUAGE_KIRUNDI, + wxLANGUAGE_KONKANI, + wxLANGUAGE_KOREAN, + wxLANGUAGE_KURDISH, + wxLANGUAGE_LAOTHIAN, + wxLANGUAGE_LATIN, + wxLANGUAGE_LATVIAN, + wxLANGUAGE_LINGALA, + wxLANGUAGE_LITHUANIAN, + wxLANGUAGE_MACEDONIAN, + wxLANGUAGE_MALAGASY, + wxLANGUAGE_MALAY, + wxLANGUAGE_MALAYALAM, + wxLANGUAGE_MALAY_BRUNEI_DARUSSALAM, + wxLANGUAGE_MALAY_MALAYSIA, + wxLANGUAGE_MALTESE, + wxLANGUAGE_MANIPURI, + wxLANGUAGE_MAORI, + wxLANGUAGE_MARATHI, + wxLANGUAGE_MOLDAVIAN, + wxLANGUAGE_MONGOLIAN, + wxLANGUAGE_NAURU, + wxLANGUAGE_NEPALI, + wxLANGUAGE_NEPALI_INDIA, + wxLANGUAGE_NORWEGIAN_BOKMAL, + wxLANGUAGE_NORWEGIAN_NYNORSK, + wxLANGUAGE_OCCITAN, + wxLANGUAGE_ORIYA, + wxLANGUAGE_OROMO, + wxLANGUAGE_PASHTO, + wxLANGUAGE_POLISH, + wxLANGUAGE_PORTUGUESE, + wxLANGUAGE_PORTUGUESE_BRAZILIAN, + wxLANGUAGE_PUNJABI, + wxLANGUAGE_QUECHUA, + wxLANGUAGE_RHAETO_ROMANCE, + wxLANGUAGE_ROMANIAN, + wxLANGUAGE_RUSSIAN, + wxLANGUAGE_RUSSIAN_UKRAINE, + wxLANGUAGE_SAMOAN, + wxLANGUAGE_SANGHO, + wxLANGUAGE_SANSKRIT, + wxLANGUAGE_SCOTS_GAELIC, + wxLANGUAGE_SERBIAN, + wxLANGUAGE_SERBIAN_CYRILLIC, + wxLANGUAGE_SERBIAN_LATIN, + wxLANGUAGE_SERBO_CROATIAN, + wxLANGUAGE_SESOTHO, + wxLANGUAGE_SETSWANA, + wxLANGUAGE_SHONA, + wxLANGUAGE_SINDHI, + wxLANGUAGE_SINHALESE, + wxLANGUAGE_SISWATI, + wxLANGUAGE_SLOVAK, + wxLANGUAGE_SLOVENIAN, + wxLANGUAGE_SOMALI, + wxLANGUAGE_SPANISH, + wxLANGUAGE_SPANISH_ARGENTINA, + wxLANGUAGE_SPANISH_BOLIVIA, + wxLANGUAGE_SPANISH_CHILE, + wxLANGUAGE_SPANISH_COLOMBIA, + wxLANGUAGE_SPANISH_COSTA_RICA, + wxLANGUAGE_SPANISH_DOMINICAN_REPUBLIC, + wxLANGUAGE_SPANISH_ECUADOR, + wxLANGUAGE_SPANISH_EL_SALVADOR, + wxLANGUAGE_SPANISH_GUATEMALA, + wxLANGUAGE_SPANISH_HONDURAS, + wxLANGUAGE_SPANISH_MEXICAN, + wxLANGUAGE_SPANISH_MODERN, + wxLANGUAGE_SPANISH_NICARAGUA, + wxLANGUAGE_SPANISH_PANAMA, + wxLANGUAGE_SPANISH_PARAGUAY, + wxLANGUAGE_SPANISH_PERU, + wxLANGUAGE_SPANISH_PUERTO_RICO, + wxLANGUAGE_SPANISH_URUGUAY, + wxLANGUAGE_SPANISH_US, + wxLANGUAGE_SPANISH_VENEZUELA, + wxLANGUAGE_SUNDANESE, + wxLANGUAGE_SWAHILI, + wxLANGUAGE_SWEDISH, + wxLANGUAGE_SWEDISH_FINLAND, + wxLANGUAGE_TAGALOG, + wxLANGUAGE_TAJIK, + wxLANGUAGE_TAMIL, + wxLANGUAGE_TATAR, + wxLANGUAGE_TELUGU, + wxLANGUAGE_THAI, + wxLANGUAGE_TIBETAN, + wxLANGUAGE_TIGRINYA, + wxLANGUAGE_TONGA, + wxLANGUAGE_TSONGA, + wxLANGUAGE_TURKISH, + wxLANGUAGE_TURKMEN, + wxLANGUAGE_TWI, + wxLANGUAGE_UIGHUR, + wxLANGUAGE_UKRAINIAN, + wxLANGUAGE_URDU, + wxLANGUAGE_URDU_INDIA, + wxLANGUAGE_URDU_PAKISTAN, + wxLANGUAGE_UZBEK, + wxLANGUAGE_UZBEK_CYRILLIC, + wxLANGUAGE_UZBEK_LATIN, + wxLANGUAGE_VIETNAMESE, + wxLANGUAGE_VOLAPUK, + wxLANGUAGE_WELSH, + wxLANGUAGE_WOLOF, + wxLANGUAGE_XHOSA, + wxLANGUAGE_YIDDISH, + wxLANGUAGE_YORUBA, + wxLANGUAGE_ZHUANG, + wxLANGUAGE_ZULU, + + // for custom, user-defined languages: + wxLANGUAGE_USER_DEFINED + + +#if wxABI_VERSION >= 20808 + // For binary compatibility, we can't put new items in their normal + // position in the enum, because it would change other values. We have to + // put it somewhere well outside normal range -- the particular value used + // is arbitrary: + , wxLANGUAGE_VALENCIAN = 0x1fffffff, + wxLANGUAGE_SAMI +#endif +}; + +// --- --- --- generated code ends here --- --- --- + // ---------------------------------------------------------------------------- // wxLanguageInfo: encapsulates wxLanguage to OS native lang.desc. // translation information @@ -60,30 +334,14 @@ struct WXDLLIMPEXP_BASE wxLanguageInfo { int Language; // wxLanguage id wxString CanonicalName; // Canonical name, e.g. fr_FR -#ifdef __WINDOWS__ +#ifdef __WIN32__ wxUint32 WinLang, // Win32 language identifiers WinSublang; -#endif // __WINDOWS__ +#endif // __WIN32__ wxString Description; // human-readable name of the language wxLayoutDirection LayoutDirection; - -#ifdef __WINDOWS__ - // return the LCID corresponding to this language - wxUint32 GetLCID() const; -#endif // __WINDOWS__ - - // return the locale name corresponding to this language usable with - // setlocale() on the current system - wxString GetLocaleName() const; }; -// for Unix systems GetLocaleName() is trivial so implement it inline here, for -// MSW it's implemented in intl.cpp -#ifndef __WINDOWS__ -inline wxString wxLanguageInfo::GetLocaleName() const { return CanonicalName; } -#endif // !__WINDOWS__ - - // ---------------------------------------------------------------------------- // wxLocaleCategory: the category of locale settings // ---------------------------------------------------------------------------- @@ -99,10 +357,6 @@ enum wxLocaleCategory // monetary value wxLOCALE_CAT_MONEY, - // default category for wxLocaleInfo values which only apply to a single - // category (e.g. wxLOCALE_SHORT_DATE_FMT) - wxLOCALE_CAT_DEFAULT, - wxLOCALE_CAT_MAX }; @@ -112,21 +366,11 @@ enum wxLocaleCategory enum wxLocaleInfo { - // the thousands separator (for wxLOCALE_CAT_NUMBER or MONEY) + // the thounsands separator wxLOCALE_THOUSANDS_SEP, - // the character used as decimal point (for wxLOCALE_CAT_NUMBER or MONEY) - wxLOCALE_DECIMAL_POINT, - - // the stftime()-formats used for short/long date and time representations - // (under some platforms short and long date formats are the same) - // - // NB: these elements should appear in this order, code in GetInfo() relies - // on it - wxLOCALE_SHORT_DATE_FMT, - wxLOCALE_LONG_DATE_FMT, - wxLOCALE_DATE_TIME_FMT, - wxLOCALE_TIME_FMT + // the character used as decimal point + wxLOCALE_DECIMAL_POINT }; @@ -137,12 +381,8 @@ enum wxLocaleInfo enum wxLocaleInitFlags { - wxLOCALE_DONT_LOAD_DEFAULT = 0x0000, // don't load wxwin.mo - wxLOCALE_LOAD_DEFAULT = 0x0001 // load wxwin.mo? -#if WXWIN_COMPATIBILITY_2_8 - ,wxLOCALE_CONV_ENCODING = 0x0002 // no longer used, simply remove - // it from the existing code -#endif + wxLOCALE_LOAD_DEFAULT = 0x0001, // load wxwin.mo? + wxLOCALE_CONV_ENCODING = 0x0002 // convert encoding on the fly? }; class WXDLLIMPEXP_BASE wxLocale @@ -155,26 +395,19 @@ public: wxLocale() { DoCommonInit(); } // the ctor has a side effect of changing current locale - wxLocale(const wxString& name, // name (for messages) - const wxString& shortName = wxEmptyString, // dir prefix (for msg files) - const wxString& locale = wxEmptyString, // locale (for setlocale) - bool bLoadDefault = true // preload wxstd.mo? -#if WXWIN_COMPATIBILITY_2_8 - ,bool bConvertEncoding = true // convert Win<->Unix if necessary? -#endif - ) + wxLocale(const wxChar *szName, // name (for messages) + const wxChar *szShort = (const wxChar *) NULL, // dir prefix (for msg files) + const wxChar *szLocale = (const wxChar *) NULL, // locale (for setlocale) + bool bLoadDefault = true, // preload wxstd.mo? + bool bConvertEncoding = false) // convert Win<->Unix if necessary? { DoCommonInit(); -#if WXWIN_COMPATIBILITY_2_8 - Init(name, shortName, locale, bLoadDefault, bConvertEncoding); -#else - Init(name, shortName, locale, bLoadDefault); -#endif + Init(szName, szShort, szLocale, bLoadDefault, bConvertEncoding); } wxLocale(int language, // wxLanguage id or custom language - int flags = wxLOCALE_LOAD_DEFAULT) + int flags = wxLOCALE_LOAD_DEFAULT | wxLOCALE_CONV_ENCODING) { DoCommonInit(); @@ -182,18 +415,15 @@ public: } // the same as a function (returns true on success) - bool Init(const wxString& name, - const wxString& shortName = wxEmptyString, - const wxString& locale = wxEmptyString, - bool bLoadDefault = true -#if WXWIN_COMPATIBILITY_2_8 - ,bool bConvertEncoding = true -#endif - ); + bool Init(const wxChar *szName, + const wxChar *szShort = (const wxChar *) NULL, + const wxChar *szLocale = (const wxChar *) NULL, + bool bLoadDefault = true, + bool bConvertEncoding = false); // same as second ctor (returns true on success) bool Init(int language = wxLANGUAGE_DEFAULT, - int flags = wxLOCALE_LOAD_DEFAULT); + int flags = wxLOCALE_LOAD_DEFAULT | wxLOCALE_CONV_ENCODING); // restores old locale virtual ~wxLocale(); @@ -212,14 +442,13 @@ public: // get the values of the given locale-dependent datum: the current locale // is used, the US default value is returned if everything else fails - static wxString GetInfo(wxLocaleInfo index, - wxLocaleCategory cat = wxLOCALE_CAT_DEFAULT); + static wxString GetInfo(wxLocaleInfo index, wxLocaleCategory cat); // return true if the locale was set successfully bool IsOk() const { return m_pszOldLocale != NULL; } // returns locale name - const wxString& GetLocale() const { return m_strLocale; } + const wxChar *GetLocale() const { return m_strLocale; } // return current locale wxLanguage value int GetLanguage() const { return m_language; } @@ -237,8 +466,7 @@ public: // (in this order). // // This only applies to subsequent invocations of AddCatalog()! - static void AddCatalogLookupPathPrefix(const wxString& prefix) - { wxFileTranslationsLoader::AddCatalogLookupPathPrefix(prefix); } + static void AddCatalogLookupPathPrefix(const wxString& prefix); // add a catalog: it's searched for in standard places (current directory // first, system one after), but the you may prepend additional directories to @@ -247,16 +475,15 @@ public: // The loaded catalog will be used for message lookup by GetString(). // // Returns 'true' if it was successfully loaded - bool AddCatalog(const wxString& domain); - bool AddCatalog(const wxString& domain, wxLanguage msgIdLanguage); - bool AddCatalog(const wxString& domain, - wxLanguage msgIdLanguage, const wxString& msgIdCharset); + bool AddCatalog(const wxChar *szDomain); + bool AddCatalog(const wxChar *szDomain, + wxLanguage msgIdLanguage, const wxChar *msgIdCharset); // check if the given locale is provided by OS and C run time static bool IsAvailable(int lang); // check if the given catalog is loaded - bool IsLoaded(const wxString& domain) const; + bool IsLoaded(const wxChar *szDomain) const; // Retrieve the language info struct for the given language // @@ -267,10 +494,6 @@ public: // is not in database static wxString GetLanguageName(int lang); - // Returns ISO code ("canonical name") of language or empty string if the - // language is not in database - static wxString GetLanguageCanonicalName(int lang); - // Find the language for the given locale string which may be either a // canonical ISO 2 letter language code ("xx"), a language code followed by // the country code ("xx_XX") or a Windows full language name ("Xxxxx...") @@ -294,32 +517,20 @@ public: // // domains are searched in the last to first order, i.e. catalogs // added later override those added before. - const wxString& GetString(const wxString& origString, - const wxString& domain = wxEmptyString) const - { - return wxGetTranslation(origString, domain); - } + virtual const wxChar *GetString(const wxChar *szOrigString, + const wxChar *szDomain = NULL) const; // plural form version of the same: - const wxString& GetString(const wxString& origString, - const wxString& origString2, - unsigned n, - const wxString& domain = wxEmptyString) const - { - return wxGetTranslation(origString, origString2, n, domain); - } - - // this is hack to work around a problem with wxGetTranslation() which - // returns const wxString& and not wxString, so when it returns untranslated - // string, it needs to have a copy of it somewhere - static const wxString& GetUntranslatedString(const wxString& str) - { return wxTranslations::GetUntranslatedString(str); } + virtual const wxChar *GetString(const wxChar *szOrigString, + const wxChar *szOrigString2, + size_t n, + const wxChar *szDomain = NULL) const; // Returns the current short name for the locale const wxString& GetName() const { return m_strShort; } // return the contents of .po file header - wxString GetHeaderValue(const wxString& header, - const wxString& domain = wxEmptyString) const; + wxString GetHeaderValue( const wxChar* szHeader, + const wxChar* szDomain = NULL ) const; // These two methods are for internal use only. First one creates // ms_languagesDB if it doesn't already exist, second one destroys @@ -328,9 +539,8 @@ public: static void DestroyLanguagesDB(); private: - bool DoInit(const wxString& name, - const wxString& shortName, - const wxString& locale); + // find catalog by name in a linked list, return NULL if !found + wxMsgCatalog *FindCatalog(const wxChar *szDomain) const; // copy default table of languages from global static array to // m_langugagesInfo, called by InitLanguagesDB @@ -343,16 +553,18 @@ private: m_strShort; // short name for the locale int m_language; // this locale wxLanguage value - const char *m_pszOldLocale; // previous locale from setlocale() + const wxChar *m_pszOldLocale; // previous locale from setlocale() wxLocale *m_pOldLocale; // previous wxLocale + wxMsgCatalog *m_pMsgCat; // pointer to linked list of catalogs + + bool m_bConvertEncoding; + bool m_initialized; - wxTranslations m_translations; - static wxLanguageInfoArray *ms_languagesDB; - wxDECLARE_NO_COPY_CLASS(wxLocale); + DECLARE_NO_COPY_CLASS(wxLocale) }; // ---------------------------------------------------------------------------- @@ -362,6 +574,59 @@ private: // get the current locale object (note that it may be NULL!) extern WXDLLIMPEXP_BASE wxLocale* wxGetLocale(); -#endif // wxUSE_INTL +// get the translation of the string in the current locale +inline const wxChar * +wxGetTranslation(const wxChar *sz, const wxChar* domain = NULL) +{ + wxLocale *pLoc = wxGetLocale(); + if (pLoc) + return pLoc->GetString(sz, domain); + else + return sz; +} + +inline const wxChar * +wxGetTranslation(const wxChar *sz1, const wxChar *sz2, + size_t n, + const wxChar *domain = NULL) +{ + wxLocale *pLoc = wxGetLocale(); + if (pLoc) + return pLoc->GetString(sz1, sz2, n, domain); + else + return n == 1 ? sz1 : sz2; +} + +#else // !wxUSE_INTL + +// the macros should still be defined - otherwise compilation would fail + +#if !defined(WXINTL_NO_GETTEXT_MACRO) + #if !defined(_) + #define _(s) (wxT(s)) + #endif + #define wxPLURAL(sing, plur, n) ((n) == 1 ? wxT(sing) : wxT(plur)) +#endif + +#define wxTRANSLATE(str) wxT(str) + +inline const wxChar * +wxGetTranslation(const wxChar *sz, const wxChar * WXUNUSED(domain) = NULL) +{ + return sz; +} + +#endif // wxUSE_INTL/!wxUSE_INTL + +// define this one just in case it occurs somewhere (instead of preferred +// wxTRANSLATE) too +#if !defined(WXINTL_NO_GETTEXT_MACRO) + #if !defined(gettext_noop) + #define gettext_noop(str) wxT(str) + #endif + #if !defined(N_) + #define N_(s) wxT(s) + #endif +#endif #endif // _WX_INTL_H_ diff --git a/Source/3rd Party/wx/include/wx/iosfwrap.h b/Source/3rd Party/wx/include/wx/iosfwrap.h index c3471596e..0a68afcc2 100644 --- a/Source/3rd Party/wx/include/wx/iosfwrap.h +++ b/Source/3rd Party/wx/include/wx/iosfwrap.h @@ -4,7 +4,7 @@ // Author: Jan van Dijk // Modified by: // Created: 18.12.2002 -// RCS-ID: $Id$ +// RCS-ID: $Id: iosfwrap.h 33555 2005-04-12 21:06:03Z ABX $ // Copyright: wxWidgets team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -18,7 +18,7 @@ # include #endif -#ifdef __WINDOWS__ +#ifdef __WXMSW__ # include "wx/msw/winundef.h" #endif diff --git a/Source/3rd Party/wx/include/wx/ioswrap.h b/Source/3rd Party/wx/include/wx/ioswrap.h index 7008ce727..19292af5d 100644 --- a/Source/3rd Party/wx/include/wx/ioswrap.h +++ b/Source/3rd Party/wx/include/wx/ioswrap.h @@ -4,24 +4,20 @@ // Author: Vadim Zeitlin // Modified by: // Created: 03.02.99 -// RCS-ID: $Id$ +// RCS-ID: $Id: ioswrap.h 33555 2005-04-12 21:06:03Z ABX $ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// #if wxUSE_STD_IOSTREAM -#include "wx/beforestd.h" - #if wxUSE_IOSTREAMH # include #else # include #endif -#include "wx/afterstd.h" - -#ifdef __WINDOWS__ +#ifdef __WXMSW__ # include "wx/msw/winundef.h" #endif diff --git a/Source/3rd Party/wx/include/wx/ipcbase.h b/Source/3rd Party/wx/include/wx/ipcbase.h index 7a010c2d8..d2a48f621 100644 --- a/Source/3rd Party/wx/include/wx/ipcbase.h +++ b/Source/3rd Party/wx/include/wx/ipcbase.h @@ -1,10 +1,10 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/ipcbase.h +// Name: ipcbase.h // Purpose: Base classes for IPC // Author: Julian Smart // Modified by: // Created: 4/1/98 -// RCS-ID: $Id$ +// RCS-ID: $Id: ipcbase.h 53135 2008-04-12 02:31:04Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -31,19 +31,10 @@ enum wxIPCFormat wxIPC_PENDATA = 10, wxIPC_RIFF = 11, wxIPC_WAVE = 12, - wxIPC_UTF16TEXT = 13, /* CF_UNICODE */ + wxIPC_UNICODETEXT = 13, wxIPC_ENHMETAFILE = 14, wxIPC_FILENAME = 15, /* CF_HDROP */ wxIPC_LOCALE = 16, - wxIPC_UTF8TEXT = 17, - wxIPC_UTF32TEXT = 18, -#if SIZEOF_WCHAR_T == 2 - wxIPC_UNICODETEXT = wxIPC_UTF16TEXT, -#elif SIZEOF_WCHAR_T == 4 - wxIPC_UNICODETEXT = wxIPC_UTF32TEXT, -#else -# error "Unknown wchar_t size" -#endif wxIPC_PRIVATE = 20 }; @@ -52,201 +43,110 @@ class WXDLLIMPEXP_FWD_BASE wxClientBase; class WXDLLIMPEXP_BASE wxConnectionBase: public wxObject { + DECLARE_CLASS(wxConnectionBase) + public: - wxConnectionBase(void *buffer, size_t size); // use external buffer + wxConnectionBase(wxChar *buffer, int size); // use external buffer wxConnectionBase(); // use internal, adaptive buffer wxConnectionBase(const wxConnectionBase& copy); - virtual ~wxConnectionBase(); + virtual ~wxConnectionBase(void); void SetConnected( bool c ) { m_connected = c; } bool GetConnected() { return m_connected; } // Calls that CLIENT can make - bool Execute(const void *data, size_t size, wxIPCFormat fmt = wxIPC_PRIVATE) - { return DoExecute(data, size, fmt); } - bool Execute(const char *s, size_t size = wxNO_LEN) - { return DoExecute(s, size == wxNO_LEN ? strlen(s) + 1 - : size, wxIPC_TEXT); } - bool Execute(const wchar_t *ws, size_t size = wxNO_LEN) - { return DoExecute(ws, size == wxNO_LEN ? (wcslen(ws) + 1)*sizeof(wchar_t) - : size, wxIPC_UNICODETEXT); } - bool Execute(const wxString& s) - { - const wxScopedCharBuffer buf = s.utf8_str(); - return DoExecute(buf, strlen(buf) + 1, wxIPC_UTF8TEXT); - } - bool Execute(const wxCStrData& cs) - { return Execute(cs.AsString()); } - - virtual const void *Request(const wxString& item, - size_t *size = NULL, - wxIPCFormat format = wxIPC_TEXT) = 0; - - bool Poke(const wxString& item, const void *data, size_t size, - wxIPCFormat fmt = wxIPC_PRIVATE) - { return DoPoke(item, data, size, fmt); } - bool Poke(const wxString& item, const char *s, size_t size = wxNO_LEN) - { return DoPoke(item, s, size == wxNO_LEN ? strlen(s) + 1 - : size, wxIPC_TEXT); } - bool Poke(const wxString& item, const wchar_t *ws, size_t size = wxNO_LEN) - { return DoPoke(item, ws, - size == wxNO_LEN ? (wcslen(ws) + 1)*sizeof(wchar_t) - : size, wxIPC_UNICODETEXT); } - bool Poke(const wxString& item, const wxString s) - { - const wxScopedCharBuffer buf = s.utf8_str(); - return DoPoke(item, buf, strlen(buf) + 1, wxIPC_UTF8TEXT); - } - bool Poke(const wxString& item, const wxCStrData& cs) - { return Poke(item, cs.AsString()); } - + virtual bool Execute(const wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT ) = 0; + virtual bool Execute(const wxString& str) { return Execute(str, -1, wxIPC_TEXT); } + virtual wxChar *Request(const wxString& item, int *size = (int *) NULL, wxIPCFormat format = wxIPC_TEXT) = 0; + virtual bool Poke(const wxString& item, wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT) = 0; virtual bool StartAdvise(const wxString& item) = 0; virtual bool StopAdvise(const wxString& item) = 0; // Calls that SERVER can make - bool Advise(const wxString& item, const void *data, size_t size, - wxIPCFormat fmt = wxIPC_PRIVATE) - { return DoAdvise(item, data, size, fmt); } - bool Advise(const wxString& item, const char *s, size_t size = wxNO_LEN) - { return DoAdvise(item, s, size == wxNO_LEN ? strlen(s) + 1 - : size, wxIPC_TEXT); } - bool Advise(const wxString& item, const wchar_t *ws, size_t size = wxNO_LEN) - { return DoAdvise(item, ws, - size == wxNO_LEN ? (wcslen(ws) + 1)*sizeof(wchar_t) - : size, wxIPC_UNICODETEXT); } - bool Advise(const wxString& item, const wxString s) - { - const wxScopedCharBuffer buf = s.utf8_str(); - return DoAdvise(item, buf, strlen(buf) + 1, wxIPC_UTF8TEXT); - } - bool Advise(const wxString& item, const wxCStrData& cs) - { return Advise(item, cs.AsString()); } + virtual bool Advise(const wxString& item, wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT) = 0; // Calls that both can make - virtual bool Disconnect() = 0; - + virtual bool Disconnect(void) = 0; // Callbacks to SERVER - override at will - virtual bool OnExec(const wxString& WXUNUSED(topic), - const wxString& WXUNUSED(data)) - { - wxFAIL_MSG( "This method shouldn't be called, if it is, it probably " - "means that you didn't update your old code overriding " - "OnExecute() to use the new parameter types (\"const void *\" " - "instead of \"wxChar *\" and \"size_t\" instead of \"int\"), " - "you must do it or your code wouldn't be executed at all!" ); - return false; - } + virtual bool OnExecute ( const wxString& WXUNUSED(topic), + wxChar *WXUNUSED(data), + int WXUNUSED(size), + wxIPCFormat WXUNUSED(format) ) + { return false; } - // deprecated function kept for backwards compatibility: usually you will - // want to override OnExec() above instead which receives its data in a more - // convenient format - virtual bool OnExecute(const wxString& topic, - const void *data, - size_t size, - wxIPCFormat format) - { return OnExec(topic, GetTextFromData(data, size, format)); } + virtual wxChar *OnRequest ( const wxString& WXUNUSED(topic), + const wxString& WXUNUSED(item), + int *WXUNUSED(size), + wxIPCFormat WXUNUSED(format) ) + { return (wxChar *) NULL; } - virtual const void *OnRequest(const wxString& WXUNUSED(topic), - const wxString& WXUNUSED(item), - size_t *size, - wxIPCFormat WXUNUSED(format)) - { *size = 0; return NULL; } + virtual bool OnPoke ( const wxString& WXUNUSED(topic), + const wxString& WXUNUSED(item), + wxChar *WXUNUSED(data), + int WXUNUSED(size), + wxIPCFormat WXUNUSED(format) ) + { return false; } - virtual bool OnPoke(const wxString& WXUNUSED(topic), - const wxString& WXUNUSED(item), - const void *WXUNUSED(data), - size_t WXUNUSED(size), - wxIPCFormat WXUNUSED(format)) - { return false; } + virtual bool OnStartAdvise ( const wxString& WXUNUSED(topic), + const wxString& WXUNUSED(item) ) + { return false; } - virtual bool OnStartAdvise(const wxString& WXUNUSED(topic), - const wxString& WXUNUSED(item)) - { return false; } - - virtual bool OnStopAdvise(const wxString& WXUNUSED(topic), - const wxString& WXUNUSED(item)) - { return false; } + virtual bool OnStopAdvise ( const wxString& WXUNUSED(topic), + const wxString& WXUNUSED(item) ) + { return false; } // Callbacks to CLIENT - override at will - virtual bool OnAdvise(const wxString& WXUNUSED(topic), - const wxString& WXUNUSED(item), - const void *WXUNUSED(data), - size_t WXUNUSED(size), - wxIPCFormat WXUNUSED(format)) - { return false; } - - // Callbacks to BOTH - virtual bool OnDisconnect() { delete this; return true; } - - - // return true if this is one of the formats used for textual data - // transmission - static bool IsTextFormat(wxIPCFormat format) - { - return format == wxIPC_TEXT || - format == wxIPC_UTF8TEXT || - format == wxIPC_UTF16TEXT || - format == wxIPC_UTF32TEXT; - } - - // converts from the data and format into a wxString automatically - // - // this function accepts data in all of wxIPC_TEXT, wxIPC_UNICODETEXT, and - // wxIPC_UTF8TEXT formats but asserts if the format is anything else (i.e. - // such that IsTextFormat(format) doesn't return true) - // - // notice that the size parameter here contains the total size of the data, - // including the terminating '\0' or L'\0' - static - wxString GetTextFromData(const void *data, size_t size, wxIPCFormat format); + virtual bool OnAdvise ( const wxString& WXUNUSED(topic), + const wxString& WXUNUSED(item), + wxChar *WXUNUSED(data), + int WXUNUSED(size), + wxIPCFormat WXUNUSED(format) ) + { return false; } + // Callbacks to BOTH - override at will + // Default behaviour is to delete connection and return true + virtual bool OnDisconnect(void) = 0; // return a buffer at least this size, reallocating buffer if needed - // returns NULL if using an inadequate user buffer which can't be resized - void *GetBufferAtLeast(size_t bytes); - -protected: - virtual bool DoExecute(const void *data, size_t size, wxIPCFormat format) = 0; - virtual bool DoPoke(const wxString& item, const void *data, size_t size, - wxIPCFormat format) = 0; - virtual bool DoAdvise(const wxString& item, const void *data, size_t size, - wxIPCFormat format) = 0; - - -private: - char *m_buffer; - size_t m_buffersize; - bool m_deletebufferwhendone; + // returns NULL if using an inadequate user buffer - it can't be resized + wxChar * GetBufferAtLeast( size_t bytes ); protected: bool m_connected; +private: + wxChar * m_buffer; + size_t m_buffersize; + bool m_deletebufferwhendone; - wxDECLARE_NO_ASSIGN_CLASS(wxConnectionBase); - DECLARE_CLASS(wxConnectionBase) + // can't use DECLARE_NO_COPY_CLASS(wxConnectionBase) because we already + // have copy ctor but still forbid the default assignment operator + wxConnectionBase& operator=(const wxConnectionBase&); }; -class WXDLLIMPEXP_BASE wxServerBase : public wxObject +class WXDLLIMPEXP_BASE wxServerBase: public wxObject { + DECLARE_CLASS(wxServerBase) + public: - wxServerBase() { } - virtual ~wxServerBase() { } + inline wxServerBase(void) {} + inline ~wxServerBase(void) {} // Returns false on error (e.g. port number is already in use) virtual bool Create(const wxString& serverName) = 0; // Callbacks to SERVER - override at will virtual wxConnectionBase *OnAcceptConnection(const wxString& topic) = 0; - - DECLARE_CLASS(wxServerBase) }; -class WXDLLIMPEXP_BASE wxClientBase : public wxObject +class WXDLLIMPEXP_BASE wxClientBase: public wxObject { + DECLARE_CLASS(wxClientBase) + public: - wxClientBase() { } - virtual ~wxClientBase() { } + inline wxClientBase(void) {} + inline ~wxClientBase(void) {} virtual bool ValidHost(const wxString& host) = 0; @@ -256,9 +156,8 @@ public: const wxString& topic) = 0; // Callbacks to CLIENT - override at will - virtual wxConnectionBase *OnMakeConnection() = 0; - - DECLARE_CLASS(wxClientBase) + virtual wxConnectionBase *OnMakeConnection(void) = 0; }; -#endif // _WX_IPCBASEH__ +#endif + // _WX_IPCBASEH__ diff --git a/Source/3rd Party/wx/include/wx/itemid.h b/Source/3rd Party/wx/include/wx/itemid.h deleted file mode 100644 index 5f147081c..000000000 --- a/Source/3rd Party/wx/include/wx/itemid.h +++ /dev/null @@ -1,62 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/itemid.h -// Purpose: wxItemId class declaration. -// Author: Vadim Zeitlin -// Created: 2011-08-17 -// RCS-ID: $Id: wxhead.h,v 1.12 2010-04-22 12:44:51 zeitlin Exp $ -// Copyright: (c) 2011 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_ITEMID_H_ -#define _WX_ITEMID_H_ - -// ---------------------------------------------------------------------------- -// wxItemId: an opaque item identifier used with wx{Tree,TreeList,DataView}Ctrl. -// ---------------------------------------------------------------------------- - -// The template argument T is typically a pointer to some opaque type. While -// wxTreeItemId and wxDataViewItem use a pointer to void, this is dangerous and -// not recommended for the new item id classes. -template -class wxItemId -{ -public: - typedef T Type; - - // This ctor is implicit which is fine for non-void* types, but if you use - // this class with void* you're strongly advised to make the derived class - // ctor explicit as implicitly converting from any pointer is simply too - // dangerous. - wxItemId(Type item = NULL) : m_pItem(item) { } - - // Default copy ctor, assignment operator and dtor are ok. - - bool IsOk() const { return m_pItem != NULL; } - Type GetID() const { return m_pItem; } - operator const Type() const { return m_pItem; } - - // This is used for implementation purposes only. - Type operator->() const { return m_pItem; } - - void Unset() { m_pItem = NULL; } - - // This field is public *only* for compatibility with the old wxTreeItemId - // implementation and must not be used in any new code. -//private: - Type m_pItem; -}; - -template -bool operator==(const wxItemId& left, const wxItemId& right) -{ - return left.GetID() == right.GetID(); -} - -template -bool operator!=(const wxItemId& left, const wxItemId& right) -{ - return !(left == right); -} - -#endif // _WX_ITEMID_H_ diff --git a/Source/3rd Party/wx/include/wx/kbdstate.h b/Source/3rd Party/wx/include/wx/kbdstate.h deleted file mode 100644 index 801605879..000000000 --- a/Source/3rd Party/wx/include/wx/kbdstate.h +++ /dev/null @@ -1,115 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/kbdstate.h -// Purpose: Declaration of wxKeyboardState class -// Author: Vadim Zeitlin -// Created: 2008-09-19 -// RCS-ID: $Id$ -// Copyright: (c) 2008 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_KBDSTATE_H_ -#define _WX_KBDSTATE_H_ - -#include "wx/defs.h" - -// ---------------------------------------------------------------------------- -// wxKeyboardState stores the state of the keyboard modifier keys -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxKeyboardState -{ -public: - wxKeyboardState(bool controlDown = false, - bool shiftDown = false, - bool altDown = false, - bool metaDown = false) - : m_controlDown(controlDown), - m_shiftDown(shiftDown), - m_altDown(altDown), - m_metaDown(metaDown) -#ifdef __WXOSX__ - ,m_rawControlDown(false) -#endif - { - } - - // default copy ctor, assignment operator and dtor are ok - - - // accessors for the various modifier keys - // --------------------------------------- - - // should be used check if the key event has exactly the given modifiers: - // "GetModifiers() = wxMOD_CONTROL" is easier to write than "ControlDown() - // && !MetaDown() && !AltDown() && !ShiftDown()" - int GetModifiers() const - { - return (m_controlDown ? wxMOD_CONTROL : 0) | - (m_shiftDown ? wxMOD_SHIFT : 0) | - (m_metaDown ? wxMOD_META : 0) | -#ifdef __WXOSX__ - (m_rawControlDown ? wxMOD_RAW_CONTROL : 0) | -#endif - (m_altDown ? wxMOD_ALT : 0); - } - - // returns true if any modifiers at all are pressed - bool HasModifiers() const { return GetModifiers() != wxMOD_NONE; } - - // accessors for individual modifier keys - bool ControlDown() const { return m_controlDown; } - bool RawControlDown() const - { -#ifdef __WXOSX__ - return m_rawControlDown; -#else - return m_controlDown; -#endif - } - bool ShiftDown() const { return m_shiftDown; } - bool MetaDown() const { return m_metaDown; } - bool AltDown() const { return m_altDown; } - - // "Cmd" is a pseudo key which is Control for PC and Unix platforms but - // Apple ("Command") key under Macs: it makes often sense to use it instead - // of, say, ControlDown() because Cmd key is used for the same thing under - // Mac as Ctrl elsewhere (but Ctrl still exists, just not used for this - // purpose under Mac) - bool CmdDown() const - { - return ControlDown(); - } - - // these functions are mostly used by wxWidgets itself - // --------------------------------------------------- - - void SetControlDown(bool down) { m_controlDown = down; } - void SetRawControlDown(bool down) - { -#ifdef __WXOSX__ - m_rawControlDown = down; -#else - m_controlDown = down; -#endif - } - void SetShiftDown(bool down) { m_shiftDown = down; } - void SetAltDown(bool down) { m_altDown = down; } - void SetMetaDown(bool down) { m_metaDown = down; } - - - // for backwards compatibility with the existing code accessing these - // members of wxKeyEvent directly, these variables are public, however you - // should not use them in any new code, please use the accessors instead -public: - bool m_controlDown : 1; - bool m_shiftDown : 1; - bool m_altDown : 1; - bool m_metaDown : 1; -#ifdef __WXOSX__ - bool m_rawControlDown : 1; -#endif -}; - -#endif // _WX_KBDSTATE_H_ - diff --git a/Source/3rd Party/wx/include/wx/language.h b/Source/3rd Party/wx/include/wx/language.h deleted file mode 100644 index 2bd803d70..000000000 --- a/Source/3rd Party/wx/include/wx/language.h +++ /dev/null @@ -1,282 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/language.h -// Purpose: wxLanguage enum -// Author: Vadim Zeitlin -// Created: 2010-04-23 -// RCS-ID: $Id$ -// Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// WARNING: Parts of this file are generated. See misc/languages/README for -// details. - -#ifndef _WX_LANGUAGE_H_ -#define _WX_LANGUAGE_H_ - -#include "wx/defs.h" - -#if wxUSE_INTL - -// ---------------------------------------------------------------------------- -// wxLanguage: defines all supported languages -// ---------------------------------------------------------------------------- - -// --- --- --- generated code begins here --- --- --- - -/** - The languages supported by wxLocale. - - This enum is generated by misc/languages/genlang.py - When making changes, please put them into misc/languages/langtabl.txt -*/ -enum wxLanguage -{ - /// User's default/preffered language as got from OS. - wxLANGUAGE_DEFAULT, - - /// Unknown language, returned if wxLocale::GetSystemLanguage fails. - wxLANGUAGE_UNKNOWN, - - wxLANGUAGE_ABKHAZIAN, - wxLANGUAGE_AFAR, - wxLANGUAGE_AFRIKAANS, - wxLANGUAGE_ALBANIAN, - wxLANGUAGE_AMHARIC, - wxLANGUAGE_ARABIC, - wxLANGUAGE_ARABIC_ALGERIA, - wxLANGUAGE_ARABIC_BAHRAIN, - wxLANGUAGE_ARABIC_EGYPT, - wxLANGUAGE_ARABIC_IRAQ, - wxLANGUAGE_ARABIC_JORDAN, - wxLANGUAGE_ARABIC_KUWAIT, - wxLANGUAGE_ARABIC_LEBANON, - wxLANGUAGE_ARABIC_LIBYA, - wxLANGUAGE_ARABIC_MOROCCO, - wxLANGUAGE_ARABIC_OMAN, - wxLANGUAGE_ARABIC_QATAR, - wxLANGUAGE_ARABIC_SAUDI_ARABIA, - wxLANGUAGE_ARABIC_SUDAN, - wxLANGUAGE_ARABIC_SYRIA, - wxLANGUAGE_ARABIC_TUNISIA, - wxLANGUAGE_ARABIC_UAE, - wxLANGUAGE_ARABIC_YEMEN, - wxLANGUAGE_ARMENIAN, - wxLANGUAGE_ASSAMESE, - wxLANGUAGE_ASTURIAN, - wxLANGUAGE_AYMARA, - wxLANGUAGE_AZERI, - wxLANGUAGE_AZERI_CYRILLIC, - wxLANGUAGE_AZERI_LATIN, - wxLANGUAGE_BASHKIR, - wxLANGUAGE_BASQUE, - wxLANGUAGE_BELARUSIAN, - wxLANGUAGE_BENGALI, - wxLANGUAGE_BHUTANI, - wxLANGUAGE_BIHARI, - wxLANGUAGE_BISLAMA, - wxLANGUAGE_BOSNIAN, - wxLANGUAGE_BRETON, - wxLANGUAGE_BULGARIAN, - wxLANGUAGE_BURMESE, - wxLANGUAGE_CAMBODIAN, - wxLANGUAGE_CATALAN, - wxLANGUAGE_CHINESE, - wxLANGUAGE_CHINESE_SIMPLIFIED, - wxLANGUAGE_CHINESE_TRADITIONAL, - wxLANGUAGE_CHINESE_HONGKONG, - wxLANGUAGE_CHINESE_MACAU, - wxLANGUAGE_CHINESE_SINGAPORE, - wxLANGUAGE_CHINESE_TAIWAN, - wxLANGUAGE_CORSICAN, - wxLANGUAGE_CROATIAN, - wxLANGUAGE_CZECH, - wxLANGUAGE_DANISH, - wxLANGUAGE_DUTCH, - wxLANGUAGE_DUTCH_BELGIAN, - wxLANGUAGE_ENGLISH, - wxLANGUAGE_ENGLISH_UK, - wxLANGUAGE_ENGLISH_US, - wxLANGUAGE_ENGLISH_AUSTRALIA, - wxLANGUAGE_ENGLISH_BELIZE, - wxLANGUAGE_ENGLISH_BOTSWANA, - wxLANGUAGE_ENGLISH_CANADA, - wxLANGUAGE_ENGLISH_CARIBBEAN, - wxLANGUAGE_ENGLISH_DENMARK, - wxLANGUAGE_ENGLISH_EIRE, - wxLANGUAGE_ENGLISH_JAMAICA, - wxLANGUAGE_ENGLISH_NEW_ZEALAND, - wxLANGUAGE_ENGLISH_PHILIPPINES, - wxLANGUAGE_ENGLISH_SOUTH_AFRICA, - wxLANGUAGE_ENGLISH_TRINIDAD, - wxLANGUAGE_ENGLISH_ZIMBABWE, - wxLANGUAGE_ESPERANTO, - wxLANGUAGE_ESTONIAN, - wxLANGUAGE_FAEROESE, - wxLANGUAGE_FARSI, - wxLANGUAGE_FIJI, - wxLANGUAGE_FINNISH, - wxLANGUAGE_FRENCH, - wxLANGUAGE_FRENCH_BELGIAN, - wxLANGUAGE_FRENCH_CANADIAN, - wxLANGUAGE_FRENCH_LUXEMBOURG, - wxLANGUAGE_FRENCH_MONACO, - wxLANGUAGE_FRENCH_SWISS, - wxLANGUAGE_FRISIAN, - wxLANGUAGE_GALICIAN, - wxLANGUAGE_GEORGIAN, - wxLANGUAGE_GERMAN, - wxLANGUAGE_GERMAN_AUSTRIAN, - wxLANGUAGE_GERMAN_BELGIUM, - wxLANGUAGE_GERMAN_LIECHTENSTEIN, - wxLANGUAGE_GERMAN_LUXEMBOURG, - wxLANGUAGE_GERMAN_SWISS, - wxLANGUAGE_GREEK, - wxLANGUAGE_GREENLANDIC, - wxLANGUAGE_GUARANI, - wxLANGUAGE_GUJARATI, - wxLANGUAGE_HAUSA, - wxLANGUAGE_HEBREW, - wxLANGUAGE_HINDI, - wxLANGUAGE_HUNGARIAN, - wxLANGUAGE_ICELANDIC, - wxLANGUAGE_INDONESIAN, - wxLANGUAGE_INTERLINGUA, - wxLANGUAGE_INTERLINGUE, - wxLANGUAGE_INUKTITUT, - wxLANGUAGE_INUPIAK, - wxLANGUAGE_IRISH, - wxLANGUAGE_ITALIAN, - wxLANGUAGE_ITALIAN_SWISS, - wxLANGUAGE_JAPANESE, - wxLANGUAGE_JAVANESE, - wxLANGUAGE_KANNADA, - wxLANGUAGE_KASHMIRI, - wxLANGUAGE_KASHMIRI_INDIA, - wxLANGUAGE_KAZAKH, - wxLANGUAGE_KERNEWEK, - wxLANGUAGE_KINYARWANDA, - wxLANGUAGE_KIRGHIZ, - wxLANGUAGE_KIRUNDI, - wxLANGUAGE_KONKANI, - wxLANGUAGE_KOREAN, - wxLANGUAGE_KURDISH, - wxLANGUAGE_LAOTHIAN, - wxLANGUAGE_LATIN, - wxLANGUAGE_LATVIAN, - wxLANGUAGE_LINGALA, - wxLANGUAGE_LITHUANIAN, - wxLANGUAGE_MACEDONIAN, - wxLANGUAGE_MALAGASY, - wxLANGUAGE_MALAY, - wxLANGUAGE_MALAYALAM, - wxLANGUAGE_MALAY_BRUNEI_DARUSSALAM, - wxLANGUAGE_MALAY_MALAYSIA, - wxLANGUAGE_MALTESE, - wxLANGUAGE_MANIPURI, - wxLANGUAGE_MAORI, - wxLANGUAGE_MARATHI, - wxLANGUAGE_MOLDAVIAN, - wxLANGUAGE_MONGOLIAN, - wxLANGUAGE_NAURU, - wxLANGUAGE_NEPALI, - wxLANGUAGE_NEPALI_INDIA, - wxLANGUAGE_NORWEGIAN_BOKMAL, - wxLANGUAGE_NORWEGIAN_NYNORSK, - wxLANGUAGE_OCCITAN, - wxLANGUAGE_ORIYA, - wxLANGUAGE_OROMO, - wxLANGUAGE_PASHTO, - wxLANGUAGE_POLISH, - wxLANGUAGE_PORTUGUESE, - wxLANGUAGE_PORTUGUESE_BRAZILIAN, - wxLANGUAGE_PUNJABI, - wxLANGUAGE_QUECHUA, - wxLANGUAGE_RHAETO_ROMANCE, - wxLANGUAGE_ROMANIAN, - wxLANGUAGE_RUSSIAN, - wxLANGUAGE_RUSSIAN_UKRAINE, - wxLANGUAGE_SAMI, - wxLANGUAGE_SAMOAN, - wxLANGUAGE_SANGHO, - wxLANGUAGE_SANSKRIT, - wxLANGUAGE_SCOTS_GAELIC, - wxLANGUAGE_SERBIAN, - wxLANGUAGE_SERBIAN_CYRILLIC, - wxLANGUAGE_SERBIAN_LATIN, - wxLANGUAGE_SERBO_CROATIAN, - wxLANGUAGE_SESOTHO, - wxLANGUAGE_SETSWANA, - wxLANGUAGE_SHONA, - wxLANGUAGE_SINDHI, - wxLANGUAGE_SINHALESE, - wxLANGUAGE_SISWATI, - wxLANGUAGE_SLOVAK, - wxLANGUAGE_SLOVENIAN, - wxLANGUAGE_SOMALI, - wxLANGUAGE_SPANISH, - wxLANGUAGE_SPANISH_ARGENTINA, - wxLANGUAGE_SPANISH_BOLIVIA, - wxLANGUAGE_SPANISH_CHILE, - wxLANGUAGE_SPANISH_COLOMBIA, - wxLANGUAGE_SPANISH_COSTA_RICA, - wxLANGUAGE_SPANISH_DOMINICAN_REPUBLIC, - wxLANGUAGE_SPANISH_ECUADOR, - wxLANGUAGE_SPANISH_EL_SALVADOR, - wxLANGUAGE_SPANISH_GUATEMALA, - wxLANGUAGE_SPANISH_HONDURAS, - wxLANGUAGE_SPANISH_MEXICAN, - wxLANGUAGE_SPANISH_MODERN, - wxLANGUAGE_SPANISH_NICARAGUA, - wxLANGUAGE_SPANISH_PANAMA, - wxLANGUAGE_SPANISH_PARAGUAY, - wxLANGUAGE_SPANISH_PERU, - wxLANGUAGE_SPANISH_PUERTO_RICO, - wxLANGUAGE_SPANISH_URUGUAY, - wxLANGUAGE_SPANISH_US, - wxLANGUAGE_SPANISH_VENEZUELA, - wxLANGUAGE_SUNDANESE, - wxLANGUAGE_SWAHILI, - wxLANGUAGE_SWEDISH, - wxLANGUAGE_SWEDISH_FINLAND, - wxLANGUAGE_TAGALOG, - wxLANGUAGE_TAJIK, - wxLANGUAGE_TAMIL, - wxLANGUAGE_TATAR, - wxLANGUAGE_TELUGU, - wxLANGUAGE_THAI, - wxLANGUAGE_TIBETAN, - wxLANGUAGE_TIGRINYA, - wxLANGUAGE_TONGA, - wxLANGUAGE_TSONGA, - wxLANGUAGE_TURKISH, - wxLANGUAGE_TURKMEN, - wxLANGUAGE_TWI, - wxLANGUAGE_UIGHUR, - wxLANGUAGE_UKRAINIAN, - wxLANGUAGE_URDU, - wxLANGUAGE_URDU_INDIA, - wxLANGUAGE_URDU_PAKISTAN, - wxLANGUAGE_UZBEK, - wxLANGUAGE_UZBEK_CYRILLIC, - wxLANGUAGE_UZBEK_LATIN, - wxLANGUAGE_VALENCIAN, - wxLANGUAGE_VIETNAMESE, - wxLANGUAGE_VOLAPUK, - wxLANGUAGE_WELSH, - wxLANGUAGE_WOLOF, - wxLANGUAGE_XHOSA, - wxLANGUAGE_YIDDISH, - wxLANGUAGE_YORUBA, - wxLANGUAGE_ZHUANG, - wxLANGUAGE_ZULU, - - /// For custom, user-defined languages. - wxLANGUAGE_USER_DEFINED -}; - -// --- --- --- generated code ends here --- --- --- - -#endif // wxUSE_INTL - -#endif // _WX_LANGUAGE_H_ diff --git a/Source/3rd Party/wx/include/wx/layout.h b/Source/3rd Party/wx/include/wx/layout.h index be529ea30..4a6d82d7b 100644 --- a/Source/3rd Party/wx/include/wx/layout.h +++ b/Source/3rd Party/wx/include/wx/layout.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 29/01/98 -// RCS-ID: $Id$ +// RCS-ID: $Id: layout.h 49563 2007-10-31 20:46:21Z VZ $ // Copyright: (c) 1998 Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -64,7 +64,7 @@ enum wxRelationship // wxIndividualLayoutConstraint: a constraint on window position // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxIndividualLayoutConstraint : public wxObject +class WXDLLEXPORT wxIndividualLayoutConstraint : public wxObject { public: wxIndividualLayoutConstraint(); @@ -155,7 +155,7 @@ protected: // wxLayoutConstraints: the complete set of constraints for a window // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxLayoutConstraints : public wxObject +class WXDLLEXPORT wxLayoutConstraints : public wxObject { public: // Edge constraints diff --git a/Source/3rd Party/wx/include/wx/list.h b/Source/3rd Party/wx/include/wx/list.h index 7caaaa376..1d3a69af3 100644 --- a/Source/3rd Party/wx/include/wx/list.h +++ b/Source/3rd Party/wx/include/wx/list.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: VZ at 16/11/98: WX_DECLARE_LIST() and typesafe lists added // Created: 29/01/98 -// RCS-ID: $Id$ +// RCS-ID: $Id: list.h 61872 2009-09-09 22:37:05Z VZ $ // Copyright: (c) 1998 Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -22,8 +22,8 @@ like the old class. */ -#ifndef _WX_LIST_H_ -#define _WX_LIST_H_ +#ifndef _WX_LISTH__ +#define _WX_LISTH__ // ----------------------------------------------------------------------------- // headers @@ -33,7 +33,7 @@ #include "wx/object.h" #include "wx/string.h" -#if wxUSE_STD_CONTAINERS +#if wxUSE_STL #include "wx/beforestd.h" #include #include @@ -45,10 +45,38 @@ // types // ---------------------------------------------------------------------------- +// type of compare function for list sort operation (as in 'qsort'): it should +// return a negative value, 0 or positive value if the first element is less +// than, equal or greater than the second + +extern "C" +{ +typedef int (* LINKAGEMODE wxSortCompareFunction)(const void *elem1, const void *elem2); +} + class WXDLLIMPEXP_FWD_BASE wxObjectListNode; typedef wxObjectListNode wxNode; -#if wxUSE_STD_CONTAINERS +// +typedef int (* LINKAGEMODE wxListIterateFunction)(void *current); + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +#if !defined(wxENUM_KEY_TYPE_DEFINED) +#define wxENUM_KEY_TYPE_DEFINED + +enum wxKeyType +{ + wxKEY_NONE, + wxKEY_INTEGER, + wxKEY_STRING +}; + +#endif + +#if wxUSE_STL #define wxLIST_COMPATIBILITY @@ -65,10 +93,10 @@ typedef wxObjectListNode wxNode; #define WX_DECLARE_LIST_WITH_DECL(elT, liT, decl) \ WX_DECLARE_LIST_XO(elT*, liT, decl) -#if !defined(__VISUALC__) || __VISUALC__ >= 1300 // == !VC6 +#if !defined( __VISUALC__ ) template -class wxList_SortFunction +class WXDLLIMPEXP_BASE wxList_SortFunction { public: wxList_SortFunction(wxSortCompareFunction f) : m_f(f) { } @@ -79,12 +107,12 @@ private: }; #define WX_LIST_SORTFUNCTION( elT, f ) wxList_SortFunction(f) -#define WX_LIST_VC6_WORKAROUND(elT, liT, decl) +#define VC6_WORKAROUND(elT, liT, decl) -#else // if defined( __VISUALC__ ) && __VISUALC__ < 1300 // == VC6 +#else // if defined( __VISUALC__ ) #define WX_LIST_SORTFUNCTION( elT, f ) std::greater( f ) -#define WX_LIST_VC6_WORKAROUND(elT, liT, decl) \ +#define VC6_WORKAROUND(elT, liT, decl) \ decl liT; \ \ /* Workaround for broken VC6 STL incorrectly requires a std::greater<> */ \ @@ -100,26 +128,19 @@ private: bool operator()(const elT X, const elT Y) const \ { \ return m_CompFunc ? \ - ( m_CompFunc( wxListCastElementToVoidPtr(X), \ - wxListCastElementToVoidPtr(Y) ) < 0 ) : \ + ( m_CompFunc( X, Y ) < 0 ) : \ ( X > Y ); \ } \ }; -// helper for std::greater above: -template -inline const void *wxListCastElementToVoidPtr(const T* ptr) { return ptr; } -inline const void *wxListCastElementToVoidPtr(const wxString& str) - { return (const char*)str; } - -#endif // VC6/!VC6 +#endif // defined( __VISUALC__ ) /* Note 1: the outer helper class _WX_LIST_HELPER_##liT below is a workaround for mingw 3.2.3 compiler bug that prevents a static function of liT class from being exported into dll. A minimal code snippet reproducing the bug: - struct WXDLLIMPEXP_CORE Foo + struct WXDLLEXPORT Foo { static void Bar(); struct SomeInnerClass @@ -152,7 +173,7 @@ inline const void *wxListCastElementToVoidPtr(const wxString& str) static void DeleteFunction( _WX_LIST_ITEM_TYPE_##liT X ); \ }; \ \ - WX_LIST_VC6_WORKAROUND(elT, liT, decl) \ + VC6_WORKAROUND(elT, liT, decl) \ decl liT : public std::list \ { \ private: \ @@ -258,7 +279,7 @@ inline const void *wxListCastElementToVoidPtr(const wxString& str) iterator i = const_cast< liT* >(this)->end(); \ return compatibility_iterator( this, !empty() ? --i : i ); \ } \ - bool Member( elT e ) const \ + compatibility_iterator Member( elT e ) const \ { return Find( e ); } \ compatibility_iterator Nth( int n ) const \ { return Item( n ); } \ @@ -275,7 +296,7 @@ inline const void *wxListCastElementToVoidPtr(const wxString& str) push_front( e ); \ return compatibility_iterator( this, begin() ); \ } \ - compatibility_iterator Insert(const compatibility_iterator & i, elT e)\ + compatibility_iterator Insert(const compatibility_iterator &i, elT e) \ { \ return compatibility_iterator( this, insert( i.m_iter, e ) ); \ } \ @@ -321,7 +342,7 @@ inline const void *wxListCastElementToVoidPtr(const wxString& str) ~liT() { Clear(); } \ \ /* It needs access to our EmptyList */ \ - friend class compatibility_iterator; \ + friend decl compatibility_iterator; \ } #define WX_DECLARE_LIST(elementtype, listname) \ @@ -330,7 +351,7 @@ inline const void *wxListCastElementToVoidPtr(const wxString& str) WX_DECLARE_LIST(elementtype, listname) #define WX_DECLARE_EXPORTED_LIST(elementtype, listname) \ - WX_DECLARE_LIST_WITH_DECL(elementtype, listname, class WXDLLIMPEXP_CORE) + WX_DECLARE_LIST_WITH_DECL(elementtype, listname, class WXDLLEXPORT) #define WX_DECLARE_EXPORTED_LIST_PTR(elementtype, listname) \ WX_DECLARE_EXPORTED_LIST(elementtype, listname) @@ -346,8 +367,13 @@ inline const void *wxListCastElementToVoidPtr(const wxString& str) #define WX_DEFINE_EXPORTED_LIST(name) WX_DEFINE_LIST(name) #define WX_DEFINE_USER_EXPORTED_LIST(name) WX_DEFINE_LIST(name) -#else // if !wxUSE_STD_CONTAINERS +#else // if !wxUSE_STL +// due to circular header dependencies this function has to be declared here +// (normally it's found in utils.h which includes itself list.h...) +#if WXWIN_COMPATIBILITY_2_4 +extern WXDLLIMPEXP_BASE wxChar* copystring(const wxChar *s); +#endif // undef it to get rid of old, deprecated functions #define wxLIST_COMPATIBILITY @@ -359,7 +385,7 @@ inline const void *wxListCastElementToVoidPtr(const wxString& str) union wxListKeyValue { long integer; - wxString *string; + wxChar *string; }; // a struct which may contain both types of keys @@ -376,17 +402,15 @@ public: { } wxListKey(long i) : m_keyType(wxKEY_INTEGER) { m_key.integer = i; } + wxListKey(const wxChar *s) : m_keyType(wxKEY_STRING) + { m_key.string = wxStrdup(s); } wxListKey(const wxString& s) : m_keyType(wxKEY_STRING) - { m_key.string = new wxString(s); } - wxListKey(const char *s) : m_keyType(wxKEY_STRING) - { m_key.string = new wxString(s); } - wxListKey(const wchar_t *s) : m_keyType(wxKEY_STRING) - { m_key.string = new wxString(s); } + { m_key.string = wxStrdup(s.c_str()); } // accessors wxKeyType GetKeyType() const { return m_keyType; } - const wxString GetString() const - { wxASSERT( m_keyType == wxKEY_STRING ); return *m_key.string; } + const wxChar *GetString() const + { wxASSERT( m_keyType == wxKEY_STRING ); return m_key.string; } long GetNumber() const { wxASSERT( m_keyType == wxKEY_INTEGER ); return m_key.integer; } @@ -399,7 +423,7 @@ public: ~wxListKey() { if ( m_keyType == wxKEY_STRING ) - delete m_key.string; + free(m_key.string); } private: @@ -420,20 +444,20 @@ class WXDLLIMPEXP_BASE wxNodeBase friend class wxListBase; public: // ctor - wxNodeBase(wxListBase *list = NULL, - wxNodeBase *previous = NULL, - wxNodeBase *next = NULL, + wxNodeBase(wxListBase *list = (wxListBase *)NULL, + wxNodeBase *previous = (wxNodeBase *)NULL, + wxNodeBase *next = (wxNodeBase *)NULL, void *data = NULL, const wxListKey& key = wxDefaultListKey); virtual ~wxNodeBase(); // FIXME no check is done that the list is really keyed on strings - wxString GetKeyString() const { return *m_key.string; } + const wxChar *GetKeyString() const { return m_key.string; } long GetKeyInteger() const { return m_key.integer; } // Necessary for some existing code - void SetKeyString(const wxString& s) { m_key.string = new wxString(s); } + void SetKeyString(wxChar* s) { m_key.string = s; } void SetKeyInteger(long i) { m_key.integer = i; } #ifdef wxLIST_COMPATIBILITY @@ -457,7 +481,7 @@ protected: virtual void DeleteData() { } public: // for wxList::iterator - void** GetDataPtr() const { return &(const_cast(this)->m_data); } + void** GetDataPtr() const { return &(((wxNodeBase*)this)->m_data); } private: // optional key stuff wxListKeyValue m_key; @@ -468,7 +492,7 @@ private: wxListBase *m_list; // list we belong to - wxDECLARE_NO_COPY_CLASS(wxNodeBase); + DECLARE_NO_COPY_CLASS(wxNodeBase) }; // ----------------------------------------------------------------------------- @@ -477,9 +501,9 @@ private: class WXDLLIMPEXP_FWD_BASE wxList; -class WXDLLIMPEXP_BASE wxListBase +class WXDLLIMPEXP_BASE wxListBase : public wxObject { -friend class wxNodeBase; // should be able to call DetachNode() +friend class WXDLLIMPEXP_FWD_BASE wxNodeBase; // should be able to call DetachNode() friend class wxHashTableBase; // should be able to call untyped Find() public: @@ -536,6 +560,10 @@ protected: void *data, const wxListKey& key = wxDefaultListKey) = 0; +// Can't access these from derived classes otherwise (bug in Salford C++?) +#ifdef __SALFORDC__ +public: +#endif // ctors // from an array @@ -559,7 +587,7 @@ protected: { wxNodeBase *node = Item(n); - return node ? node->GetData() : NULL; + return node ? node->GetData() : (wxNodeBase *)NULL; } // operations @@ -569,8 +597,7 @@ protected: // append to beginning of list wxNodeBase *Append(void *object); // insert a new item at the beginning of the list - wxNodeBase *Insert(void *object) - { return Insert(static_cast(NULL), object); } + wxNodeBase *Insert(void *object) { return Insert( (wxNodeBase*)NULL, object); } // insert a new item at the given position wxNodeBase *Insert(size_t pos, void *object) { return pos == GetCount() ? Append(object) @@ -580,7 +607,7 @@ protected: // keyed append wxNodeBase *Append(long key, void *object); - wxNodeBase *Append(const wxString& key, void *object); + wxNodeBase *Append(const wxChar *key, void *object); // removes node from the list but doesn't delete it (returns pointer // to the node or NULL if it wasn't found in the list) @@ -674,10 +701,10 @@ private: classexp nodetype : public wxNodeBase \ { \ public: \ - nodetype(wxListBase *list = NULL, \ - nodetype *previous = NULL, \ - nodetype *next = NULL, \ - T *data = NULL, \ + nodetype(wxListBase *list = (wxListBase *)NULL, \ + nodetype *previous = (nodetype *)NULL, \ + nodetype *next = (nodetype *)NULL, \ + T *data = (T *)NULL, \ const wxListKey& key = wxDefaultListKey) \ : wxNodeBase(list, previous, next, data, key) { } \ \ @@ -721,7 +748,7 @@ private: : wxListBase(count, (void **)elements) { } \ \ name& operator=(const name& list) \ - { if (&list != this) Assign(list); return *this; } \ + { Assign(list); return *this; } \ \ nodetype *GetFirst() const \ { return (nodetype *)wxListBase::GetFirst(); } \ @@ -734,14 +761,13 @@ private: T *operator[](size_t index) const \ { \ nodetype *node = Item(index); \ - return node ? (T*)(node->GetData()) : NULL; \ + return node ? (T*)(node->GetData()) : (T*)NULL; \ } \ \ nodetype *Append(Tbase *object) \ { return (nodetype *)wxListBase::Append(object); } \ nodetype *Insert(Tbase *object) \ - { return (nodetype *)Insert(static_cast(NULL), \ - object); } \ + { return (nodetype *)Insert((nodetype*)NULL, object); } \ nodetype *Insert(size_t pos, Tbase *object) \ { return (nodetype *)wxListBase::Insert(pos, object); } \ nodetype *Insert(nodetype *prev, Tbase *object) \ @@ -767,9 +793,6 @@ private: virtual nodetype *Find(const wxListKey& key) const \ { return (nodetype *)wxListBase::Find(key); } \ \ - bool Member(const Tbase *object) const \ - { return Find(object) != NULL; } \ - \ int IndexOf(Tbase *object) const \ { return wxListBase::IndexOf(object); } \ \ @@ -819,19 +842,9 @@ private: reference_type operator*() const \ { return *(pointer_type)m_node->GetDataPtr(); } \ ptrop \ - itor& operator++() \ - { \ - wxASSERT_MSG( m_node, wxT("uninitialized iterator") ); \ - m_node = m_node->GetNext(); \ - return *this; \ - } \ + itor& operator++() { m_node = m_node->GetNext(); return *this; }\ const itor operator++(int) \ - { \ - itor tmp = *this; \ - wxASSERT_MSG( m_node, wxT("uninitialized iterator") ); \ - m_node = m_node->GetNext(); \ - return tmp; \ - } \ + { itor tmp = *this; m_node = m_node->GetNext(); return tmp; }\ itor& operator--() \ { \ m_node = m_node ? m_node->GetPrevious() : m_init; \ @@ -872,19 +885,9 @@ private: reference_type operator*() const \ { return *(pointer_type)m_node->GetDataPtr(); } \ ptrop \ - itor& operator++() \ - { \ - wxASSERT_MSG( m_node, wxT("uninitialized iterator") ); \ - m_node = m_node->GetNext(); \ - return *this; \ - } \ + itor& operator++() { m_node = m_node->GetNext(); return *this; }\ const itor operator++(int) \ - { \ - itor tmp = *this; \ - wxASSERT_MSG( m_node, wxT("uninitialized iterator") ); \ - m_node = m_node->GetNext(); \ - return tmp; \ - } \ + { itor tmp = *this; m_node = m_node->GetNext(); return tmp; }\ itor& operator--() \ { \ m_node = m_node ? m_node->GetPrevious() : m_init; \ @@ -1030,33 +1033,21 @@ private: for(size_type i = 0; i < n; ++i) \ Append((const_base_reference)v); \ } \ - iterator insert(const iterator& it, const_reference v) \ + iterator insert(const iterator& it, const_reference v = value_type())\ { \ if ( it == end() ) \ - { \ Append((const_base_reference)v); \ - /* \ - note that this is the new end(), the old one was \ - invalidated by the Append() call, and this is why we \ - can't use the same code as in the normal case below \ - */ \ - iterator itins(end()); \ - return --itins; \ - } \ else \ - { \ Insert(it.m_node, (const_base_reference)v); \ - iterator itins(it); \ - return --itins; \ - } \ + iterator itprev(it); \ + return itprev--; \ } \ - void insert(const iterator& it, size_type n, const_reference v) \ + void insert(const iterator& it, size_type n, const_reference v = value_type())\ { \ for(size_type i = 0; i < n; ++i) \ insert(it, v); \ } \ - void insert(const iterator& it, \ - const_iterator first, const const_iterator& last) \ + void insert(const iterator& it, const_iterator first, const const_iterator& last)\ { \ for(; first != last; ++first) \ insert(it, *first); \ @@ -1128,11 +1119,11 @@ private: WX_DECLARE_LIST_2(elementtype, listname, wx##listname##Node, decl) #define WX_DECLARE_EXPORTED_LIST(elementtype, listname) \ - WX_DECLARE_LIST_WITH_DECL(elementtype, listname, class WXDLLIMPEXP_CORE) + WX_DECLARE_LIST_WITH_DECL(elementtype, listname, class WXDLLEXPORT) #define WX_DECLARE_EXPORTED_LIST_PTR(elementtype, listname) \ typedef elementtype _WX_LIST_ITEM_TYPE_##listname; \ - WX_DECLARE_LIST_PTR_2(elementtype, listname, wx##listname##Node, class WXDLLIMPEXP_CORE) + WX_DECLARE_LIST_PTR_2(elementtype, listname, wx##listname##Node, class WXDLLEXPORT) #define WX_DECLARE_USER_EXPORTED_LIST(elementtype, listname, usergoo) \ typedef elementtype _WX_LIST_ITEM_TYPE_##listname; \ @@ -1148,7 +1139,7 @@ private: #define WX_DEFINE_EXPORTED_LIST(name) WX_DEFINE_LIST(name) #define WX_DEFINE_USER_EXPORTED_LIST(name) WX_DEFINE_LIST(name) -#endif // !wxUSE_STD_CONTAINERS +#endif // !wxUSE_STL // ============================================================================ // now we can define classes 100% compatible with the old ones @@ -1162,7 +1153,7 @@ private: // inline compatibility functions -#if !wxUSE_STD_CONTAINERS +#if !wxUSE_STL // ---------------------------------------------------------------------------- // wxNodeBase deprecated methods @@ -1197,26 +1188,36 @@ WX_DECLARE_LIST_2(wxObject, wxObjectList, wxObjectListNode, class WXDLLIMPEXP_BASE wxList : public wxObjectList { public: -#if defined(wxWARN_COMPAT_LIST_USE) && !wxUSE_STD_CONTAINERS - wxList() { } +#if defined(wxWARN_COMPAT_LIST_USE) && !wxUSE_STL + wxList() { }; wxDEPRECATED( wxList(int key_type) ); -#elif !wxUSE_STD_CONTAINERS +#elif !wxUSE_STL wxList(int key_type = wxKEY_NONE); #endif // this destructor is required for Darwin ~wxList() { } -#if !wxUSE_STD_CONTAINERS +#if !wxUSE_STL wxList& operator=(const wxList& list) - { if (&list != this) Assign(list); return *this; } + { (void) wxListBase::operator=(list); return *this; } // compatibility methods void Sort(wxSortCompareFunction compfunc) { wxListBase::Sort(compfunc); } -#endif // !wxUSE_STD_CONTAINERS +#endif + +#if wxUSE_STL +#else + wxNode *Member(wxObject *object) const { return (wxNode *)Find(object); } +#endif + +private: +#if !wxUSE_STL + DECLARE_DYNAMIC_CLASS(wxList) +#endif }; -#if !wxUSE_STD_CONTAINERS +#if !wxUSE_STL // ----------------------------------------------------------------------------- // wxStringList class for compatibility with the old code @@ -1230,24 +1231,17 @@ public: // default #ifdef wxWARN_COMPAT_LIST_USE wxStringList(); - wxDEPRECATED( wxStringList(const wxChar *first ...) ); // FIXME-UTF8 + wxDEPRECATED( wxStringList(const wxChar *first ...) ); #else wxStringList(); - wxStringList(const wxChar *first ...); // FIXME-UTF8 + wxStringList(const wxChar *first ...); #endif // copying the string list: the strings are copied, too (extremely // inefficient!) wxStringList(const wxStringList& other) : wxStringListBase() { DeleteContents(true); DoCopy(other); } wxStringList& operator=(const wxStringList& other) - { - if (&other != this) - { - Clear(); - DoCopy(other); - } - return *this; - } + { Clear(); DoCopy(other); return *this; } // operations // makes a copy of the string @@ -1266,9 +1260,11 @@ public: private: void DoCopy(const wxStringList&); // common part of copy ctor and operator= + + DECLARE_DYNAMIC_CLASS(wxStringList) }; -#else // if wxUSE_STD_CONTAINERS +#else // if wxUSE_STL WX_DECLARE_LIST_XO(wxString, wxStringListBase, class WXDLLIMPEXP_BASE); @@ -1291,7 +1287,7 @@ public: { push_front(s); return GetFirst(); } }; -#endif // wxUSE_STD_CONTAINERS +#endif // wxUSE_STL #endif // wxLIST_COMPATIBILITY @@ -1309,15 +1305,4 @@ public: (list).clear(); \ } -// append all element of one list to another one -#define WX_APPEND_LIST(list, other) \ - { \ - wxList::compatibility_iterator node = other->GetFirst(); \ - while ( node ) \ - { \ - (list)->push_back(node->GetData()); \ - node = node->GetNext(); \ - } \ - } - #endif // _WX_LISTH__ diff --git a/Source/3rd Party/wx/include/wx/listbase.h b/Source/3rd Party/wx/include/wx/listbase.h index d6a6aafaa..152864786 100644 --- a/Source/3rd Party/wx/include/wx/listbase.h +++ b/Source/3rd Party/wx/include/wx/listbase.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 04.12.99 -// RCS-ID: $Id$ +// RCS-ID: $Id: listbase.h 46313 2007-06-03 22:38:28Z VZ $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -16,17 +16,13 @@ #include "wx/font.h" #include "wx/gdicmn.h" #include "wx/event.h" -#include "wx/control.h" - -class WXDLLIMPEXP_FWD_CORE wxImageList; // ---------------------------------------------------------------------------- // types // ---------------------------------------------------------------------------- // type of compare function for wxListCtrl sort operation -typedef -int (wxCALLBACK *wxListCtrlCompare)(wxIntPtr item1, wxIntPtr item2, wxIntPtr sortData); +typedef int (wxCALLBACK *wxListCtrlCompare)(long item1, long item2, long sortData); // ---------------------------------------------------------------------------- // wxListCtrl constants @@ -165,7 +161,7 @@ enum // TODO: this should be renamed to wxItemAttr or something general like this // and used as base class for wxTextAttr which duplicates this class // entirely currently -class WXDLLIMPEXP_CORE wxListItemAttr +class WXDLLEXPORT wxListItemAttr { public: // ctors @@ -186,9 +182,9 @@ public: void SetFont(const wxFont& font) { m_font = font; } // accessors - bool HasTextColour() const { return m_colText.IsOk(); } - bool HasBackgroundColour() const { return m_colBack.IsOk(); } - bool HasFont() const { return m_font.IsOk(); } + bool HasTextColour() const { return m_colText.Ok(); } + bool HasBackgroundColour() const { return m_colBack.Ok(); } + bool HasFont() const { return m_font.Ok(); } const wxColour& GetTextColour() const { return m_colText; } const wxColour& GetBackgroundColour() const { return m_colBack; } @@ -217,7 +213,7 @@ private: // wxListItem: the item or column info, used to exchange data with wxListCtrl // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxListItem : public wxObject +class WXDLLEXPORT wxListItem : public wxObject { public: wxListItem() { Init(); m_attr = NULL; } @@ -239,27 +235,6 @@ public: if ( item.HasAttributes() ) m_attr = new wxListItemAttr(*item.GetAttributes()); } - - wxListItem& operator=(const wxListItem& item) - { - if ( &item != this ) - { - m_mask = item.m_mask; - m_itemId = item.m_itemId; - m_col = item.m_col; - m_state = item.m_state; - m_stateMask = item.m_stateMask; - m_text = item.m_text; - m_image = item.m_image; - m_data = item.m_data; - m_format = item.m_format; - m_width = item.m_width; - m_attr = item.m_attr ? new wxListItemAttr(*item.m_attr) : NULL; - } - - return *this; - } - virtual ~wxListItem() { delete m_attr; } // resetting @@ -357,7 +332,7 @@ protected: void Init() { m_mask = 0; - m_itemId = -1; + m_itemId = 0; m_col = 0; m_state = 0; m_stateMask = 0; @@ -371,110 +346,25 @@ protected: wxListItemAttr *m_attr; // optional pointer to the items style private: + // VZ: this is strange, we have a copy ctor but not operator=(), why? + wxListItem& operator=(const wxListItem& item); + DECLARE_DYNAMIC_CLASS(wxListItem) }; -// ---------------------------------------------------------------------------- -// wxListCtrlBase: the base class for the main control itself. -// ---------------------------------------------------------------------------- - -// Unlike other base classes, this class doesn't currently define the API of -// the real control class but is just used for implementation convenience. We -// should define the public class functions as pure virtual here in the future -// however. -class WXDLLIMPEXP_CORE wxListCtrlBase : public wxControl -{ -public: - wxListCtrlBase() { } - - // Image list methods. - // ------------------- - - // Associate the given (possibly NULL to indicate that no images will be - // used) image list with the control. The ownership of the image list - // passes to the control, i.e. it will be deleted when the control itself - // is destroyed. - // - // The value of "which" must be one of wxIMAGE_LIST_{NORMAL,SMALL,STATE}. - virtual void AssignImageList(wxImageList* imageList, int which) = 0; - - // Same as AssignImageList() but the control does not delete the image list - // so it can be shared among several controls. - virtual void SetImageList(wxImageList* imageList, int which) = 0; - - // Return the currently used image list, may be NULL. - virtual wxImageList* GetImageList(int which) const = 0; - - - // Column-related methods. - // ----------------------- - - // All these methods can only be used in report view mode. - - // Appends a new column. - // - // Returns the index of the newly inserted column or -1 on error. - long AppendColumn(const wxString& heading, - int format = wxLIST_FORMAT_LEFT, - int width = -1); - - // Add a new column to the control at the position "col". - // - // Returns the index of the newly inserted column or -1 on error. - long InsertColumn(long col, const wxListItem& info); - long InsertColumn(long col, - const wxString& heading, - int format = wxLIST_FORMAT_LEFT, - int width = wxLIST_AUTOSIZE); - - // Delete the given or all columns. - virtual bool DeleteColumn(int col) = 0; - virtual bool DeleteAllColumns() = 0; - - // Return the current number of columns. - virtual int GetColumnCount() const = 0; - - // Get or update information about the given column. Set item mask to - // indicate the fields to retrieve or change. - // - // Returns false on error, e.g. if the column index is invalid. - virtual bool GetColumn(int col, wxListItem& item) const = 0; - virtual bool SetColumn(int col, const wxListItem& item) = 0; - - // Convenient wrappers for the above methods which get or update just the - // column width. - virtual int GetColumnWidth(int col) const = 0; - virtual bool SetColumnWidth(int col, int width) = 0; - - - // Other miscellaneous accessors. - // ------------------------------ - - // Convenient functions for testing the list control mode: - bool InReportView() const { return HasFlag(wxLC_REPORT); } - bool IsVirtual() const { return HasFlag(wxLC_VIRTUAL); } - -protected: - // Real implementations methods to which our public forwards. - virtual long DoInsertColumn(long col, const wxListItem& info) = 0; - - // Overridden methods of the base class. - virtual wxSize DoGetBestClientSize() const; -}; - // ---------------------------------------------------------------------------- // wxListEvent - the event class for the wxListCtrl notifications // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxListEvent : public wxNotifyEvent +class WXDLLEXPORT wxListEvent : public wxNotifyEvent { public: wxListEvent(wxEventType commandType = wxEVT_NULL, int winid = 0) : wxNotifyEvent(commandType, winid) - , m_code(-1) - , m_oldItemIndex(-1) - , m_itemIndex(-1) - , m_col(-1) + , m_code(0) + , m_oldItemIndex(0) + , m_itemIndex(0) + , m_col(0) , m_pointDrag() , m_item() , m_editCancelled(false) @@ -498,7 +388,7 @@ public: const wxString& GetLabel() const { return m_item.m_text; } const wxString& GetText() const { return m_item.m_text; } int GetImage() const { return m_item.m_image; } - long GetData() const { return static_cast(m_item.m_data); } + long GetData() const { return wx_static_cast(long, m_item.m_data); } long GetMask() const { return m_item.m_mask; } const wxListItem& GetItem() const { return m_item; } @@ -532,32 +422,37 @@ private: // wxListCtrl event macros // ---------------------------------------------------------------------------- -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_BEGIN_DRAG, wxListEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_BEGIN_RDRAG, wxListEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT, wxListEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_END_LABEL_EDIT, wxListEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_DELETE_ITEM, wxListEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS, wxListEvent ); - -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_KEY_DOWN, wxListEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_INSERT_ITEM, wxListEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_COL_CLICK, wxListEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK, wxListEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK, wxListEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_CACHE_HINT, wxListEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_COL_RIGHT_CLICK, wxListEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_COL_BEGIN_DRAG, wxListEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_COL_DRAGGING, wxListEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_COL_END_DRAG, wxListEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_ITEM_FOCUSED, wxListEvent ); +BEGIN_DECLARE_EVENT_TYPES() + DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_BEGIN_DRAG, 700) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_BEGIN_RDRAG, 701) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT, 702) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_END_LABEL_EDIT, 703) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_DELETE_ITEM, 704) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS, 705) +#if WXWIN_COMPATIBILITY_2_4 + DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_GET_INFO, 706) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_SET_INFO, 707) +#endif + DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_SELECTED, 708) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_DESELECTED, 709) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_KEY_DOWN, 710) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_INSERT_ITEM, 711) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_COL_CLICK, 712) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK, 713) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK, 714) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_ACTIVATED, 715) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_CACHE_HINT, 716) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_COL_RIGHT_CLICK, 717) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_COL_BEGIN_DRAG, 718) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_COL_DRAGGING, 719) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_COL_END_DRAG, 720) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_FOCUSED, 721) +END_DECLARE_EVENT_TYPES() typedef void (wxEvtHandler::*wxListEventFunction)(wxListEvent&); #define wxListEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxListEventFunction, func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxListEventFunction, &func) #define wx__DECLARE_LISTEVT(evt, id, fn) \ wx__DECLARE_EVT1(wxEVT_COMMAND_LIST_ ## evt, id, wxListEventHandler(fn)) @@ -587,5 +482,10 @@ typedef void (wxEvtHandler::*wxListEventFunction)(wxListEvent&); #define EVT_LIST_CACHE_HINT(id, fn) wx__DECLARE_LISTEVT(CACHE_HINT, id, fn) +#if WXWIN_COMPATIBILITY_2_4 +#define EVT_LIST_GET_INFO(id, fn) wx__DECLARE_LISTEVT(GET_INFO, id, fn) +#define EVT_LIST_SET_INFO(id, fn) wx__DECLARE_LISTEVT(SET_INFO, id, fn) +#endif + #endif // _WX_LISTCTRL_H_BASE_ diff --git a/Source/3rd Party/wx/include/wx/listbook.h b/Source/3rd Party/wx/include/wx/listbook.h index a74bc6613..b14ee4cdb 100644 --- a/Source/3rd Party/wx/include/wx/listbook.h +++ b/Source/3rd Party/wx/include/wx/listbook.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 19.08.03 -// RCS-ID: $Id$ +// RCS-ID: $Id: listbook.h 49563 2007-10-31 20:46:21Z VZ $ // Copyright: (c) 2003 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -17,13 +17,12 @@ #if wxUSE_LISTBOOK #include "wx/bookctrl.h" -#include "wx/containr.h" class WXDLLIMPEXP_FWD_CORE wxListView; class WXDLLIMPEXP_FWD_CORE wxListEvent; -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED, wxBookCtrlEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING, wxBookCtrlEvent ); +extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED; +extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING; // wxListbook flags #define wxLB_DEFAULT wxBK_DEFAULT @@ -37,10 +36,13 @@ wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING // wxListbook // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxListbook : public wxNavigationEnabled +class WXDLLEXPORT wxListbook : public wxBookCtrlBase { public: - wxListbook() { } + wxListbook() + { + Init(); + } wxListbook(wxWindow *parent, wxWindowID id, @@ -49,6 +51,8 @@ public: long style = 0, const wxString& name = wxEmptyString) { + Init(); + (void)Create(parent, id, pos, size, style, name); } @@ -62,15 +66,17 @@ public: // overridden base class methods + virtual int GetSelection() const; virtual bool SetPageText(size_t n, const wxString& strText); virtual wxString GetPageText(size_t n) const; virtual int GetPageImage(size_t n) const; virtual bool SetPageImage(size_t n, int imageId); + virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const; virtual bool InsertPage(size_t n, wxWindow *page, const wxString& text, bool bSelect = false, - int imageId = NO_IMAGE); + int imageId = -1); virtual int SetSelection(size_t n) { return DoSetSelection(n, SetSelection_SendEvent); } virtual int ChangeSelection(size_t n) { return DoSetSelection(n); } virtual int HitTest(const wxPoint& pt, long *flags = NULL) const; @@ -83,19 +89,24 @@ public: protected: virtual wxWindow *DoRemovePage(size_t page); + // get the size which the list control should have + virtual wxSize GetControllerSize() const; + void UpdateSelectedPage(size_t newsel); - wxBookCtrlEvent* CreatePageChangingEvent() const; - void MakeChangedEvent(wxBookCtrlEvent &event); + wxBookCtrlBaseEvent* CreatePageChangingEvent() const; + void MakeChangedEvent(wxBookCtrlBaseEvent &event); // event handlers void OnListSelected(wxListEvent& event); void OnSize(wxSizeEvent& event); -private: - // this should be called when we need to be relaid out - void UpdateSize(); + // the currently selected page or wxNOT_FOUND if none + int m_selection; +private: + // common part of all constructors + void Init(); DECLARE_EVENT_TABLE() DECLARE_DYNAMIC_CLASS_NO_COPY(wxListbook) @@ -105,18 +116,36 @@ private: // listbook event class and related stuff // ---------------------------------------------------------------------------- -// wxListbookEvent is obsolete and defined for compatibility only (notice that -// we use #define and not typedef to also keep compatibility with the existing -// code which forward declares it) -#define wxListbookEvent wxBookCtrlEvent -typedef wxBookCtrlEventFunction wxListbookEventFunction; -#define wxListbookEventHandler(func) wxBookCtrlEventHandler(func) +class WXDLLEXPORT wxListbookEvent : public wxBookCtrlBaseEvent +{ +public: + wxListbookEvent(wxEventType commandType = wxEVT_NULL, int id = 0, + int nSel = wxNOT_FOUND, int nOldSel = wxNOT_FOUND) + : wxBookCtrlBaseEvent(commandType, id, nSel, nOldSel) + { + } + + wxListbookEvent(const wxListbookEvent& event) + : wxBookCtrlBaseEvent(event) + { + } + + virtual wxEvent *Clone() const { return new wxListbookEvent(*this); } + +private: + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxListbookEvent) +}; + +typedef void (wxEvtHandler::*wxListbookEventFunction)(wxListbookEvent&); + +#define wxListbookEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxListbookEventFunction, &func) #define EVT_LISTBOOK_PAGE_CHANGED(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED, winid, wxBookCtrlEventHandler(fn)) + wx__DECLARE_EVT1(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED, winid, wxListbookEventHandler(fn)) #define EVT_LISTBOOK_PAGE_CHANGING(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING, winid, wxBookCtrlEventHandler(fn)) + wx__DECLARE_EVT1(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING, winid, wxListbookEventHandler(fn)) #endif // wxUSE_LISTBOOK diff --git a/Source/3rd Party/wx/include/wx/listbox.h b/Source/3rd Party/wx/include/wx/listbox.h index 863aad3ab..a3b98fc48 100644 --- a/Source/3rd Party/wx/include/wx/listbox.h +++ b/Source/3rd Party/wx/include/wx/listbox.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 22.10.99 -// RCS-ID: $Id$ +// RCS-ID: $Id: listbox.h 49563 2007-10-31 20:46:21Z VZ $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -30,26 +30,38 @@ class WXDLLIMPEXP_FWD_BASE wxArrayString; // global data // ---------------------------------------------------------------------------- -extern WXDLLIMPEXP_DATA_CORE(const char) wxListBoxNameStr[]; +extern WXDLLEXPORT_DATA(const wxChar) wxListBoxNameStr[]; // ---------------------------------------------------------------------------- // wxListBox interface is defined by the class wxListBoxBase // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxListBoxBase : public wxControlWithItems +class WXDLLEXPORT wxListBoxBase : public wxControlWithItems { public: wxListBoxBase() { } virtual ~wxListBoxBase(); - void InsertItems(unsigned int nItems, const wxString *items, unsigned int pos) - { Insert(nItems, items, pos); } + // all generic methods are in wxControlWithItems, except for the following + // ones which are not yet implemented by wxChoice/wxComboBox + void Insert(const wxString& item, unsigned int pos) + { /* return*/ wxControlWithItems::Insert(item,pos); } + void Insert(const wxString& item, unsigned int pos, void *clientData) + { /* return*/ wxControlWithItems::Insert(item,pos,clientData); } + void Insert(const wxString& item, unsigned int pos, wxClientData *clientData) + { /* return*/ wxControlWithItems::Insert(item,pos,clientData); } + + void InsertItems(unsigned int nItems, const wxString *items, unsigned int pos); void InsertItems(const wxArrayString& items, unsigned int pos) - { Insert(items, pos); } + { DoInsertItems(items, pos); } + + void Set(int n, const wxString* items, void **clientData = NULL); + void Set(const wxArrayString& items, void **clientData = NULL) + { DoSetItems(items, clientData); } // multiple selection logic virtual bool IsSelected(int n) const = 0; - virtual void SetSelection(int n); + virtual void SetSelection(int n) { DoSetSelection(n, true); } void SetSelection(int n, bool select) { DoSetSelection(n, select); } void Deselect(int n) { DoSetSelection(n, false); } void DeselectAll(int itemToLeaveSelected = -1); @@ -84,19 +96,32 @@ public: (m_windowStyle & wxLB_EXTENDED); } - // override wxItemContainer::IsSorted - virtual bool IsSorted() const { return HasFlag( wxLB_SORT ); } + // return true if this listbox is sorted + bool IsSorted() const { return (m_windowStyle & wxLB_SORT) != 0; } // emulate selecting or deselecting the item event.GetInt() (depending on // event.GetExtraLong()) void Command(wxCommandEvent& event); - // return the index of the item at this position or wxNOT_FOUND + // returns the item number at a point or wxNOT_FOUND int HitTest(const wxPoint& point) const { return DoListHitTest(point); } - int HitTest(int x, int y) const { return DoListHitTest(wxPoint(x, y)); } +#if WXWIN_COMPATIBILITY_2_6 + // compatibility - these functions are deprecated, use the new ones + // instead + wxDEPRECATED( bool Selected(int n) const ); +#endif // WXWIN_COMPATIBILITY_2_6 protected: + // NB: due to wxGTK implementation details, DoInsert() is implemented + // using DoInsertItems() and not the other way round + virtual int DoInsert(const wxString& item, unsigned int pos) + { InsertItems(1, &item, pos); return pos; } + + // to be implemented in derived classes + virtual void DoInsertItems(const wxArrayString& items, unsigned int pos) = 0; + virtual void DoSetItems(const wxArrayString& items, void **clientData) = 0; + virtual void DoSetFirstItem(int n) = 0; virtual void DoSetSelection(int n, bool select) = 0; @@ -105,39 +130,14 @@ protected: virtual int DoListHitTest(const wxPoint& WXUNUSED(point)) const { return wxNOT_FOUND; } - // Helper for the code generating events in single selection mode: updates - // m_oldSelections and return true if the selection really changed. - // Otherwise just returns false. - bool DoChangeSingleSelection(int item); - // Helper for generating events in multiple and extended mode: compare the - // current selections with the previously recorded ones (in - // m_oldSelections) and send the appropriate event if they differ, - // otherwise just return false. - bool CalcAndSendEvent(); - - // Send a listbox (de)selection or double click event. - // - // Returns true if the event was processed. - bool SendEvent(wxEventType evtType, int item, bool selected); - - // Array storing the indices of all selected items that we already notified - // the user code about for multi selection list boxes. - // - // For single selection list boxes, we reuse this array to store the single - // currently selected item, this is used by DoChangeSingleSelection(). - // - // TODO-OPT: wxSelectionStore would be more efficient for big list boxes. - wxArrayInt m_oldSelections; - - // Update m_oldSelections with currently selected items (does nothing in - // single selection mode on platforms other than MSW). - void UpdateOldSelections(); - -private: - wxDECLARE_NO_COPY_CLASS(wxListBoxBase); + DECLARE_NO_COPY_CLASS(wxListBoxBase) }; +#if WXWIN_COMPATIBILITY_2_6 + inline bool wxListBoxBase::Selected(int n) const { return IsSelected(n); } +#endif // WXWIN_COMPATIBILITY_2_6 + // ---------------------------------------------------------------------------- // include the platform-specific class declaration // ---------------------------------------------------------------------------- @@ -153,7 +153,7 @@ private: #elif defined(__WXGTK__) #include "wx/gtk1/listbox.h" #elif defined(__WXMAC__) - #include "wx/osx/listbox.h" + #include "wx/mac/listbox.h" #elif defined(__WXPM__) #include "wx/os2/listbox.h" #elif defined(__WXCOCOA__) diff --git a/Source/3rd Party/wx/include/wx/listctrl.h b/Source/3rd Party/wx/include/wx/listctrl.h index 0d2347642..efccc7300 100644 --- a/Source/3rd Party/wx/include/wx/listctrl.h +++ b/Source/3rd Party/wx/include/wx/listctrl.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 04.12.99 -// RCS-ID: $Id$ +// RCS-ID: $Id: listctrl.h 46432 2007-06-13 03:46:20Z SC $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -22,16 +22,16 @@ // constants // ---------------------------------------------------------------------------- -extern WXDLLIMPEXP_DATA_CORE(const char) wxListCtrlNameStr[]; +extern WXDLLEXPORT_DATA(const wxChar) wxListCtrlNameStr[]; // ---------------------------------------------------------------------------- // include the wxListCtrl class declaration // ---------------------------------------------------------------------------- -#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) +#if defined(__WIN32__) && !defined(__WXUNIVERSAL__) #include "wx/msw/listctrl.h" -#elif defined(__WXMAC__) && !defined(__WXUNIVERSAL__) && wxOSX_USE_CARBON - #include "wx/osx/listctrl.h" +#elif defined(__WXMAC__) && !defined(__WXUNIVERSAL__) + #include "wx/mac/carbon/listctrl.h" #else #include "wx/generic/listctrl.h" #endif @@ -40,7 +40,7 @@ extern WXDLLIMPEXP_DATA_CORE(const char) wxListCtrlNameStr[]; // wxListView: a class which provides a better API for list control // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxListView : public wxListCtrl +class WXDLLEXPORT wxListView : public wxListCtrl { public: wxListView() { } diff --git a/Source/3rd Party/wx/include/wx/listimpl.cpp b/Source/3rd Party/wx/include/wx/listimpl.cpp index 358134d6f..d05fda13e 100644 --- a/Source/3rd Party/wx/include/wx/listimpl.cpp +++ b/Source/3rd Party/wx/include/wx/listimpl.cpp @@ -1,15 +1,15 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/listimpl.cpp +// Name: listimpl.cpp // Purpose: second-part of macro based implementation of template lists // Author: Vadim Zeitlin // Modified by: // Created: 16/11/98 -// RCS-ID: $Id$ +// RCS-ID: $Id: listimpl.cpp 38893 2006-04-24 17:59:10Z VZ $ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#if wxUSE_STD_CONTAINERS +#if wxUSE_STL #undef WX_DEFINE_LIST #define WX_DEFINE_LIST(name) \ @@ -19,9 +19,9 @@ } \ name::BaseListType name::EmptyList; -#else // !wxUSE_STD_CONTAINERS - #undef WX_DEFINE_LIST_2 - #define WX_DEFINE_LIST_2(T, name) \ +#else // !wxUSE_STL + + #define _DEFINE_LIST(T, name) \ void wx##name##Node::DeleteData() \ { \ delete (T *)GetData(); \ @@ -30,7 +30,10 @@ // redefine the macro so that now it will generate the class implementation // old value would provoke a compile-time error if this file is not included #undef WX_DEFINE_LIST - #define WX_DEFINE_LIST(name) WX_DEFINE_LIST_2(_WX_LIST_ITEM_TYPE_##name, name) + #define WX_DEFINE_LIST(name) _DEFINE_LIST(_WX_LIST_ITEM_TYPE_##name, name) -#endif // wxUSE_STD_CONTAINERS/!wxUSE_STD_CONTAINERS + // don't pollute preprocessor's name space + //#undef _DEFINE_LIST + +#endif // wxUSE_STL/!wxUSE_STL diff --git a/Source/3rd Party/wx/include/wx/log.h b/Source/3rd Party/wx/include/wx/log.h index 83787a085..5e23bcf92 100644 --- a/Source/3rd Party/wx/include/wx/log.h +++ b/Source/3rd Party/wx/include/wx/log.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 29/01/98 -// RCS-ID: $Id$ +// RCS-ID: $Id: log.h 50993 2008-01-02 21:18:15Z VZ $ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -14,44 +14,37 @@ #include "wx/defs.h" +// ---------------------------------------------------------------------------- +// common constants for use in wxUSE_LOG/!wxUSE_LOG +// ---------------------------------------------------------------------------- + +// the trace masks have been superceded by symbolic trace constants, they're +// for compatibility only andwill be removed soon - do NOT use them + +// meaning of different bits of the trace mask (which allows selectively +// enable/disable some trace messages) +#define wxTraceMemAlloc 0x0001 // trace memory allocation (new/delete) +#define wxTraceMessages 0x0002 // trace window messages/X callbacks +#define wxTraceResAlloc 0x0004 // trace GDI resource allocation +#define wxTraceRefCount 0x0008 // trace various ref counting operations + +#ifdef __WXMSW__ + #define wxTraceOleCalls 0x0100 // OLE interface calls +#endif + // ---------------------------------------------------------------------------- // types // ---------------------------------------------------------------------------- -// NB: this is needed even if wxUSE_LOG == 0 +// NB: these types are needed even if wxUSE_LOG == 0 +typedef unsigned long wxTraceMask; typedef unsigned long wxLogLevel; -// the trace masks have been superseded by symbolic trace constants, they're -// for compatibility only and will be removed soon - do NOT use them -#if WXWIN_COMPATIBILITY_2_8 - #define wxTraceMemAlloc 0x0001 // trace memory allocation (new/delete) - #define wxTraceMessages 0x0002 // trace window messages/X callbacks - #define wxTraceResAlloc 0x0004 // trace GDI resource allocation - #define wxTraceRefCount 0x0008 // trace various ref counting operations - - #ifdef __WINDOWS__ - #define wxTraceOleCalls 0x0100 // OLE interface calls - #endif - - typedef unsigned long wxTraceMask; -#endif // WXWIN_COMPATIBILITY_2_8 - // ---------------------------------------------------------------------------- // headers // ---------------------------------------------------------------------------- #include "wx/string.h" -#include "wx/strvararg.h" - -// ---------------------------------------------------------------------------- -// forward declarations -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_BASE wxObject; - -#if wxUSE_GUI - class WXDLLIMPEXP_FWD_CORE wxFrame; -#endif // wxUSE_GUI #if wxUSE_LOG @@ -62,49 +55,32 @@ class WXDLLIMPEXP_FWD_BASE wxObject; #endif #include "wx/dynarray.h" -#include "wx/hashmap.h" -#if wxUSE_THREADS - #include "wx/thread.h" -#endif // wxUSE_THREADS - -// wxUSE_LOG_DEBUG enables the debug log messages #ifndef wxUSE_LOG_DEBUG - #if wxDEBUG_LEVEL - #define wxUSE_LOG_DEBUG 1 - #else // !wxDEBUG_LEVEL - #define wxUSE_LOG_DEBUG 0 - #endif +# ifdef __WXDEBUG__ +# define wxUSE_LOG_DEBUG 1 +# else // !__WXDEBUG__ +# define wxUSE_LOG_DEBUG 0 +# endif #endif -// wxUSE_LOG_TRACE enables the trace messages, they are disabled by default -#ifndef wxUSE_LOG_TRACE - #if wxDEBUG_LEVEL - #define wxUSE_LOG_TRACE 1 - #else // !wxDEBUG_LEVEL - #define wxUSE_LOG_TRACE 0 - #endif -#endif // wxUSE_LOG_TRACE +// ---------------------------------------------------------------------------- +// forward declarations +// ---------------------------------------------------------------------------- -// wxLOG_COMPONENT identifies the component which generated the log record and -// can be #define'd to a user-defined value when compiling the user code to use -// component-based filtering (see wxLog::SetComponentLevel()) -#ifndef wxLOG_COMPONENT - // this is a variable and not a macro in order to allow the user code to - // just #define wxLOG_COMPONENT without #undef'ining it first - extern WXDLLIMPEXP_DATA_BASE(const char *) wxLOG_COMPONENT; - - #ifdef WXBUILDING - #define wxLOG_COMPONENT "wx" - #endif -#endif +#if wxUSE_GUI + class WXDLLIMPEXP_FWD_CORE wxTextCtrl; + class WXDLLIMPEXP_FWD_CORE wxLogFrame; + class WXDLLIMPEXP_FWD_CORE wxFrame; + class WXDLLIMPEXP_FWD_CORE wxWindow; +#endif // wxUSE_GUI // ---------------------------------------------------------------------------- // constants // ---------------------------------------------------------------------------- // different standard log levels (you may also define your own) -enum wxLogLevelValues +enum { wxLOG_FatalError, // program can't continue, abort immediately wxLOG_Error, // a serious error, user must be informed about it @@ -128,213 +104,12 @@ enum wxLogLevelValues #define wxTRACE_ResAlloc wxT("resalloc") // trace GDI resource allocation #define wxTRACE_RefCount wxT("refcount") // trace various ref counting operations -#ifdef __WINDOWS__ +#ifdef __WXMSW__ #define wxTRACE_OleCalls wxT("ole") // OLE interface calls #endif #include "wx/iosfwrap.h" -// ---------------------------------------------------------------------------- -// information about a log record, i.e. unit of log output -// ---------------------------------------------------------------------------- - -class wxLogRecordInfo -{ -public: - // default ctor creates an uninitialized object - wxLogRecordInfo() - { - memset(this, 0, sizeof(*this)); - } - - // normal ctor, used by wxLogger specifies the location of the log - // statement; its time stamp and thread id are set up here - wxLogRecordInfo(const char *filename_, - int line_, - const char *func_, - const char *component_) - { - filename = filename_; - func = func_; - line = line_; - component = component_; - - timestamp = time(NULL); - -#if wxUSE_THREADS - threadId = wxThread::GetCurrentId(); -#endif // wxUSE_THREADS - - m_data = NULL; - } - - // we need to define copy ctor and assignment operator because of m_data - wxLogRecordInfo(const wxLogRecordInfo& other) - { - Copy(other); - } - - wxLogRecordInfo& operator=(const wxLogRecordInfo& other) - { - if ( &other != this ) - { - delete m_data; - Copy(other); - } - - return *this; - } - - // dtor is non-virtual, this class is not meant to be derived from - ~wxLogRecordInfo() - { - delete m_data; - } - - - // the file name and line number of the file where the log record was - // generated, if available or NULL and 0 otherwise - const char *filename; - int line; - - // the name of the function where the log record was generated (may be NULL - // if the compiler doesn't support __FUNCTION__) - const char *func; - - // the name of the component which generated this message, may be NULL if - // not set (i.e. wxLOG_COMPONENT not defined) - const char *component; - - // time of record generation - time_t timestamp; - -#if wxUSE_THREADS - // id of the thread which logged this record - wxThreadIdType threadId; -#endif // wxUSE_THREADS - - - // store an arbitrary value in this record context - // - // wxWidgets always uses keys starting with "wx.", e.g. "wx.sys_error" - void StoreValue(const wxString& key, wxUIntPtr val) - { - if ( !m_data ) - m_data = new ExtraData; - - m_data->numValues[key] = val; - } - - void StoreValue(const wxString& key, const wxString& val) - { - if ( !m_data ) - m_data = new ExtraData; - - m_data->strValues[key] = val; - } - - - // these functions retrieve the value of either numeric or string key, - // return false if not found - bool GetNumValue(const wxString& key, wxUIntPtr *val) const - { - if ( !m_data ) - return false; - - wxStringToNumHashMap::const_iterator it = m_data->numValues.find(key); - if ( it == m_data->numValues.end() ) - return false; - - *val = it->second; - - return true; - } - - bool GetStrValue(const wxString& key, wxString *val) const - { - if ( !m_data ) - return false; - - wxStringToStringHashMap::const_iterator it = m_data->strValues.find(key); - if ( it == m_data->strValues.end() ) - return false; - - *val = it->second; - - return true; - } - -private: - void Copy(const wxLogRecordInfo& other) - { - memcpy(this, &other, sizeof(*this)); - if ( other.m_data ) - m_data = new ExtraData(*other.m_data); - } - - // extra data associated with the log record: this is completely optional - // and can be used to pass information from the log function to the log - // sink (e.g. wxLogSysError() uses this to pass the error code) - struct ExtraData - { - wxStringToNumHashMap numValues; - wxStringToStringHashMap strValues; - }; - - // NULL if not used - ExtraData *m_data; -}; - -#define wxLOG_KEY_TRACE_MASK "wx.trace_mask" - -// ---------------------------------------------------------------------------- -// log record: a unit of log output -// ---------------------------------------------------------------------------- - -struct wxLogRecord -{ - wxLogRecord(wxLogLevel level_, - const wxString& msg_, - const wxLogRecordInfo& info_) - : level(level_), - msg(msg_), - info(info_) - { - } - - wxLogLevel level; - wxString msg; - wxLogRecordInfo info; -}; - -// ---------------------------------------------------------------------------- -// Derive from this class to customize format of log messages. -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxLogFormatter -{ -public: - // Default constructor. - wxLogFormatter() { } - - // Trivial but virtual destructor for the base class. - virtual ~wxLogFormatter() { } - - - // Override this method to implement custom formatting of the given log - // record. The default implementation simply prepends a level-dependent - // prefix to the message and optionally adds a time stamp. - virtual wxString Format(wxLogLevel level, - const wxString& msg, - const wxLogRecordInfo& info) const; - -protected: - // Override this method to change just the time stamp formatting. It is - // called by default Format() implementation. - virtual wxString FormatTime(time_t t) const; -}; - - // ---------------------------------------------------------------------------- // derive from this class to redirect (or suppress, or ...) log messages // normally, only a single instance of this class exists but it's not enforced @@ -344,106 +119,46 @@ class WXDLLIMPEXP_BASE wxLog { public: // ctor - wxLog() : m_formatter(new wxLogFormatter) { } + wxLog(){} - // make dtor virtual for all derived classes - virtual ~wxLog(); + // these functions allow to completely disable all log messages - - // log messages selection - // ---------------------- - - // these functions allow to completely disable all log messages or disable - // log messages at level less important than specified for the current - // thread - - // is logging enabled at all now? - static bool IsEnabled() - { -#if wxUSE_THREADS - if ( !wxThread::IsMain() ) - return IsThreadLoggingEnabled(); -#endif // wxUSE_THREADS - - return ms_doLog; - } + // is logging disabled now? + static bool IsEnabled() { return ms_doLog; } // change the flag state, return the previous one - static bool EnableLogging(bool enable = true) - { -#if wxUSE_THREADS - if ( !wxThread::IsMain() ) - return EnableThreadLogging(enable); -#endif // wxUSE_THREADS - - bool doLogOld = ms_doLog; - ms_doLog = enable; - return doLogOld; - } - - // return the current global log level - static wxLogLevel GetLogLevel() { return ms_logLevel; } - - // set global log level: messages with level > logLevel will not be logged - static void SetLogLevel(wxLogLevel logLevel) { ms_logLevel = logLevel; } - - // set the log level for the given component - static void SetComponentLevel(const wxString& component, wxLogLevel level); - - // return the effective log level for this component, falling back to - // parent component and to the default global log level if necessary - // - // NB: component argument is passed by value and not const reference in an - // attempt to encourage compiler to avoid an extra copy: as we modify - // the component internally, we'd create one anyhow and like this it - // can be avoided if the string is a temporary anyhow - static wxLogLevel GetComponentLevel(wxString component); - - - // is logging of messages from this component enabled at this level? - // - // usually always called with wxLOG_COMPONENT as second argument - static bool IsLevelEnabled(wxLogLevel level, wxString component) - { - return IsEnabled() && level <= GetComponentLevel(component); - } - - - // enable/disable messages at wxLOG_Verbose level (only relevant if the - // current log level is greater or equal to it) - // - // notice that verbose mode can be activated by the standard command-line - // '--verbose' option - static void SetVerbose(bool bVerbose = true) { ms_bVerbose = bVerbose; } - - // check if verbose messages are enabled - static bool GetVerbose() { return ms_bVerbose; } + static bool EnableLogging(bool doIt = true) + { bool doLogOld = ms_doLog; ms_doLog = doIt; return doLogOld; } + // static sink function - see DoLog() for function to overload in the + // derived classes + static void OnLog(wxLogLevel level, const wxChar *szString, time_t t); // message buffering - // ----------------- // flush shows all messages if they're not logged immediately (FILE - // and iostream logs don't need it, but wxLogGui does to avoid showing + // and iostream logs don't need it, but wxGuiLog does to avoid showing // 17 modal dialogs one after another) virtual void Flush(); - // flush the active target if any and also output any pending messages from - // background threads - static void FlushActive(); + // flush the active target if any + static void FlushActive() + { + if ( !ms_suspendCount ) + { + wxLog *log = GetActiveTarget(); + if ( log ) + log->Flush(); + } + } - // only one sink is active at each moment get current log target, will call - // wxAppTraits::CreateLogTarget() to create one if none exists + // only one sink is active at each moment + // get current log target, will call wxApp::CreateLogTarget() to + // create one if none exists static wxLog *GetActiveTarget(); - // change log target, logger may be NULL - static wxLog *SetActiveTarget(wxLog *logger); - -#if wxUSE_THREADS - // change log target for the current thread only, shouldn't be called from - // the main thread as it doesn't use thread-specific log target - static wxLog *SetThreadActiveTarget(wxLog *logger); -#endif // wxUSE_THREADS + // change log target, pLogger may be NULL + static wxLog *SetActiveTarget(wxLog *pLogger); // suspend the message flushing of the main target until the next call // to Resume() - this is mainly for internal use (to prevent wxYield() @@ -453,9 +168,19 @@ public: // must be called for each Suspend()! static void Resume() { ms_suspendCount--; } + // functions controlling the default wxLog behaviour + // verbose mode is activated by standard command-line '-verbose' + // option + static void SetVerbose(bool bVerbose = true) { ms_bVerbose = bVerbose; } + + // Set log level. Log messages with level > logLevel will not be logged. + static void SetLogLevel(wxLogLevel logLevel) { ms_logLevel = logLevel; } + +#if wxABI_VERSION >= 20805 /* 2.8.5+ only */ // should GetActiveTarget() try to create a new log object if the // current is NULL? static void DontCreateOnDemand(); +#endif // Make GetActiveTarget() create a new log object again. static void DoCreateOnDemand(); @@ -468,8 +193,12 @@ public: // gets duplicate counting status static bool GetRepetitionCounting() { return ms_bRepetCounting; } + // trace mask (see wxTraceXXX constants for details) + static void SetTraceMask(wxTraceMask ulMask) { ms_ulTraceMask = ulMask; } + // add string trace mask - static void AddTraceMask(const wxString& str); + static void AddTraceMask(const wxString& str) + { ms_aTraceMasks.push_back(str); } // add string trace mask static void RemoveTraceMask(const wxString& str); @@ -477,88 +206,41 @@ public: // remove all string trace masks static void ClearTraceMasks(); - // get string trace masks: note that this is MT-unsafe if other threads can - // call AddTraceMask() concurrently - static const wxArrayString& GetTraceMasks(); + // get string trace masks + static const wxArrayString &GetTraceMasks() { return ms_aTraceMasks; } + + // sets the timestamp string: this is used as strftime() format string + // for the log targets which add time stamps to the messages - set it + // to NULL to disable time stamping completely. + static void SetTimestamp(const wxChar *ts) { ms_timestamp = ts; } + + + // accessors + + // gets the verbose status + static bool GetVerbose() { return ms_bVerbose; } + + // get trace mask + static wxTraceMask GetTraceMask() { return ms_ulTraceMask; } // is this trace mask in the list? - static bool IsAllowedTraceMask(const wxString& mask); + static bool IsAllowedTraceMask(const wxChar *mask); + + // return the current loglevel limit + static wxLogLevel GetLogLevel() { return ms_logLevel; } + + // get the current timestamp format string (may be NULL) + static const wxChar *GetTimestamp() { return ms_timestamp; } - // log formatting - // ----------------- + // helpers - // Change wxLogFormatter object used by wxLog to format the log messages. - // - // wxLog takes ownership of the pointer passed in but the caller is - // responsible for deleting the returned pointer. - wxLogFormatter* SetFormatter(wxLogFormatter* formatter); - - - // All the time stamp related functions below only work when the default - // wxLogFormatter is being used. Defining a custom formatter overrides them - // as it could use its own time stamp format or format messages without - // using time stamp at all. - - - // sets the time stamp string format: this is used as strftime() format - // string for the log targets which add time stamps to the messages; set - // it to empty string to disable time stamping completely. - static void SetTimestamp(const wxString& ts) { ms_timestamp = ts; } - - // disable time stamping of log messages - static void DisableTimestamp() { SetTimestamp(wxEmptyString); } - - - // get the current timestamp format string (maybe empty) - static const wxString& GetTimestamp() { return ms_timestamp; } - - - - // helpers: all functions in this section are mostly for internal use only, - // don't call them from your code even if they are not formally deprecated - - // put the time stamp into the string if ms_timestamp is not empty (don't - // change it otherwise); the first overload uses the current time. + // put the time stamp into the string if ms_timestamp != NULL (don't + // change it otherwise) static void TimeStamp(wxString *str); - static void TimeStamp(wxString *str, time_t t); - // these methods should only be called from derived classes DoLogRecord(), - // DoLogTextAtLevel() and DoLogText() implementations respectively and - // shouldn't be called directly, use logging functions instead - void LogRecord(wxLogLevel level, - const wxString& msg, - const wxLogRecordInfo& info) - { - DoLogRecord(level, msg, info); - } - - void LogTextAtLevel(wxLogLevel level, const wxString& msg) - { - DoLogTextAtLevel(level, msg); - } - - void LogText(const wxString& msg) - { - DoLogText(msg); - } - - // this is a helper used by wxLogXXX() functions, don't call it directly - // and see DoLog() for function to overload in the derived classes - static void OnLog(wxLogLevel level, - const wxString& msg, - const wxLogRecordInfo& info); - - // version called when no information about the location of the log record - // generation is available (but the time stamp is), it mainly exists for - // backwards compatibility, don't use it in new code - static void OnLog(wxLogLevel level, const wxString& msg, time_t t); - - // a helper calling the above overload with current time - static void OnLog(wxLogLevel level, const wxString& msg) - { - OnLog(level, msg, time(NULL)); - } + // make dtor virtual for all derived classes + virtual ~wxLog(); // this method exists for backwards compatibility only, don't use @@ -566,117 +248,35 @@ public: #if WXWIN_COMPATIBILITY_2_6 // this function doesn't do anything any more, don't call it - static wxDEPRECATED_INLINE( - wxChar *SetLogBuffer(wxChar *, size_t = 0), return NULL; - ); -#endif // WXWIN_COMPATIBILITY_2_6 - - // don't use integer masks any more, use string trace masks instead -#if WXWIN_COMPATIBILITY_2_8 - static wxDEPRECATED_INLINE( void SetTraceMask(wxTraceMask ulMask), - ms_ulTraceMask = ulMask; ) - - // this one can't be marked deprecated as it's used in our own wxLogger - // below but it still is deprecated and shouldn't be used - static wxTraceMask GetTraceMask() { return ms_ulTraceMask; } -#endif // WXWIN_COMPATIBILITY_2_8 + wxDEPRECATED( static wxChar *SetLogBuffer(wxChar *buf, size_t size = 0) ); +#endif protected: - // the logging functions that can be overridden: DoLogRecord() is called - // for every "record", i.e. a unit of log output, to be logged and by - // default formats the message and passes it to DoLogTextAtLevel() which in - // turn passes it to DoLogText() by default + // the logging functions that can be overriden - // override this method if you want to change message formatting or do - // dynamic filtering - virtual void DoLogRecord(wxLogLevel level, - const wxString& msg, - const wxLogRecordInfo& info); + // default DoLog() prepends the time stamp and a prefix corresponding + // to the message to szString and then passes it to DoLogString() + virtual void DoLog(wxLogLevel level, const wxChar *szString, time_t t); - // override this method to redirect output to different channels depending - // on its level only; if even the level doesn't matter, override - // DoLogText() instead - virtual void DoLogTextAtLevel(wxLogLevel level, const wxString& msg); + // default DoLogString does nothing but is not pure virtual because if + // you override DoLog() you might not need it at all + virtual void DoLogString(const wxChar *szString, time_t t); - // this function is not pure virtual as it might not be needed if you do - // the logging in overridden DoLogRecord() or DoLogTextAtLevel() directly - // but if you do not override them in your derived class you must override - // this one as the default implementation of it simply asserts - virtual void DoLogText(const wxString& msg); - - - // the rest of the functions are for backwards compatibility only, don't - // use them in new code; if you're updating your existing code you need to - // switch to overriding DoLogRecord/Text() above (although as long as these - // functions exist, log classes using them will continue to work) -#if WXWIN_COMPATIBILITY_2_8 - wxDEPRECATED_BUT_USED_INTERNALLY( - virtual void DoLog(wxLogLevel level, const char *szString, time_t t) - ); - - wxDEPRECATED_BUT_USED_INTERNALLY( - virtual void DoLog(wxLogLevel level, const wchar_t *wzString, time_t t) - ); - - // these shouldn't be used by new code - wxDEPRECATED_BUT_USED_INTERNALLY_INLINE( - virtual void DoLogString(const char *WXUNUSED(szString), - time_t WXUNUSED(t)), - wxEMPTY_PARAMETER_VALUE - ) - - wxDEPRECATED_BUT_USED_INTERNALLY_INLINE( - virtual void DoLogString(const wchar_t *WXUNUSED(wzString), - time_t WXUNUSED(t)), - wxEMPTY_PARAMETER_VALUE - ) -#endif // WXWIN_COMPATIBILITY_2_8 - - - // log a message indicating the number of times the previous message was - // repeated if previous repetition counter is strictly positive, does - // nothing otherwise; return the old value of repetition counter - unsigned LogLastRepeatIfNeeded(); + // log a line containing the number of times the previous message was + // repeated and returns this number (which can be 0) + static unsigned DoLogNumberOfRepeats(); private: -#if wxUSE_THREADS - // called from FlushActive() to really log any buffered messages logged - // from the other threads - void FlushThreadMessages(); - - // these functions are called for non-main thread only by IsEnabled() and - // EnableLogging() respectively - static bool IsThreadLoggingEnabled(); - static bool EnableThreadLogging(bool enable = true); -#endif // wxUSE_THREADS - - // get the active log target for the main thread, auto-creating it if - // necessary - // - // this is called from GetActiveTarget() and OnLog() when they're called - // from the main thread - static wxLog *GetMainThreadActiveTarget(); - - // called from OnLog() if it's called from the main thread or if we have a - // (presumably MT-safe) thread-specific logger and by FlushThreadMessages() - // when it plays back the buffered messages logged from the other threads - void CallDoLogNow(wxLogLevel level, - const wxString& msg, - const wxLogRecordInfo& info); - - - // variables - // ---------------- - - wxLogFormatter *m_formatter; // We own this pointer. - - // static variables // ---------------- - // if true, don't log the same message multiple times, only log it once - // with the number of times it was repeated + // traditional behaviour or counting repetitions static bool ms_bRepetCounting; + static wxString ms_prevString; // previous message that was logged + // how many times the previous message was logged + static unsigned ms_prevCounter; + static time_t ms_prevTimeStamp;// timestamp of the previous message + static wxLogLevel ms_prevLevel; // level of the previous message static wxLog *ms_pLogger; // currently active log sink static bool ms_doLog; // false => all logging disabled @@ -687,21 +287,28 @@ private: static size_t ms_suspendCount; // if positive, logs are not flushed - // format string for strftime(), if empty, time stamping log messages is + // format string for strftime(), if NULL, time stamping log messages is // disabled - static wxString ms_timestamp; + static const wxChar *ms_timestamp; -#if WXWIN_COMPATIBILITY_2_8 static wxTraceMask ms_ulTraceMask; // controls wxLogTrace behaviour -#endif // WXWIN_COMPATIBILITY_2_8 + static wxArrayString ms_aTraceMasks; // more powerful filter for wxLogTrace + + + // this is the replacement of DoLogNumberOfRepeats() (which has to be kept + // to avoid breaking ABI in this version) + unsigned LogLastRepeatIfNeeded(); + + // implementation of the function above which supposes that the caller had + // already locked gs_prevCS + unsigned LogLastRepeatIfNeededUnlocked(); }; // ---------------------------------------------------------------------------- // "trivial" derivations of wxLog // ---------------------------------------------------------------------------- -// log everything except for the debug/trace messages (which are passed to -// wxMessageOutputDebug) to a buffer +// log everything to a buffer class WXDLLIMPEXP_BASE wxLogBuffer : public wxLog { public: @@ -715,12 +322,13 @@ public: virtual void Flush(); protected: - virtual void DoLogTextAtLevel(wxLogLevel level, const wxString& msg); + virtual void DoLog(wxLogLevel level, const wxChar *szString, time_t t); + virtual void DoLogString(const wxChar *szString, time_t t); private: wxString m_str; - wxDECLARE_NO_COPY_CLASS(wxLogBuffer); + DECLARE_NO_COPY_CLASS(wxLogBuffer) }; @@ -729,15 +337,15 @@ class WXDLLIMPEXP_BASE wxLogStderr : public wxLog { public: // redirect log output to a FILE - wxLogStderr(FILE *fp = NULL); + wxLogStderr(FILE *fp = (FILE *) NULL); protected: // implement sink function - virtual void DoLogText(const wxString& msg); + virtual void DoLogString(const wxChar *szString, time_t t); FILE *m_fp; - wxDECLARE_NO_COPY_CLASS(wxLogStderr); + DECLARE_NO_COPY_CLASS(wxLogStderr) }; #if wxUSE_STD_IOSTREAM @@ -751,7 +359,7 @@ public: protected: // implement sink function - virtual void DoLogText(const wxString& msg); + virtual void DoLogString(const wxChar *szString, time_t t); // using ptr here to avoid including from this file wxSTD ostream *m_ostr; @@ -821,13 +429,13 @@ public: virtual void Flush(); // call to avoid destroying the old log target +#if wxABI_VERSION >= 20805 /* 2.8.5+ only */ void DetachOldLog() { m_logOld = NULL; } +#endif protected: - // pass the record to the old logger if needed - virtual void DoLogRecord(wxLogLevel level, - const wxString& msg, - const wxLogRecordInfo& info); + // pass the chain to the old logger if needed + virtual void DoLog(wxLogLevel level, const wxChar *szString, time_t t); private: // the current log target @@ -839,32 +447,17 @@ private: // do we pass the messages to the old logger? bool m_bPassMessages; - wxDECLARE_NO_COPY_CLASS(wxLogChain); + DECLARE_NO_COPY_CLASS(wxLogChain) }; // a chain log target which uses itself as the new logger - -#define wxLogPassThrough wxLogInterposer - -class WXDLLIMPEXP_BASE wxLogInterposer : public wxLogChain +class WXDLLIMPEXP_BASE wxLogPassThrough : public wxLogChain { public: - wxLogInterposer(); + wxLogPassThrough(); private: - wxDECLARE_NO_COPY_CLASS(wxLogInterposer); -}; - -// a temporary interposer which doesn't destroy the old log target -// (calls DetachOldLog) - -class WXDLLIMPEXP_BASE wxLogInterposerTemp : public wxLogChain -{ -public: - wxLogInterposerTemp(); - -private: - wxDECLARE_NO_COPY_CLASS(wxLogInterposerTemp); + DECLARE_NO_COPY_CLASS(wxLogPassThrough) }; #if wxUSE_GUI @@ -872,404 +465,15 @@ private: #include "wx/generic/logg.h" #endif // wxUSE_GUI -// ---------------------------------------------------------------------------- -// wxLogger -// ---------------------------------------------------------------------------- - -// wxLogger is a helper class used by wxLogXXX() functions implementation, -// don't use it directly as it's experimental and subject to change (OTOH it -// might become public in the future if it's deemed to be useful enough) - -// contains information about the context from which a log message originates -// and provides Log() vararg method which forwards to wxLog::OnLog() and passes -// this context to it -class wxLogger -{ -public: - // ctor takes the basic information about the log record - wxLogger(wxLogLevel level, - const char *filename, - int line, - const char *func, - const char *component) - : m_level(level), - m_info(filename, line, func, component) - { - } - - // store extra data in our log record and return this object itself (so - // that further calls to its functions could be chained) - template - wxLogger& Store(const wxString& key, T val) - { - m_info.StoreValue(key, val); - return *this; - } - - // hack for "overloaded" wxLogXXX() functions: calling this method - // indicates that we may have an extra first argument preceding the format - // string and that if we do have it, we should store it in m_info using the - // given key (while by default 0 value will be used) - wxLogger& MaybeStore(const wxString& key, wxUIntPtr value = 0) - { - wxASSERT_MSG( m_optKey.empty(), "can only have one optional value" ); - m_optKey = key; - - m_info.StoreValue(key, value); - return *this; - } - - - // non-vararg function used by wxVLogXXX(): - - // log the message at the level specified in the ctor if this log message - // is enabled - void LogV(const wxString& format, va_list argptr) - { - // remember that fatal errors can't be disabled - if ( m_level == wxLOG_FatalError || - wxLog::IsLevelEnabled(m_level, m_info.component) ) - DoCallOnLog(format, argptr); - } - - // overloads used by functions with optional leading arguments (whose - // values are stored in the key passed to MaybeStore()) - void LogV(long num, const wxString& format, va_list argptr) - { - Store(m_optKey, num); - - LogV(format, argptr); - } - - void LogV(void *ptr, const wxString& format, va_list argptr) - { - Store(m_optKey, wxPtrToUInt(ptr)); - - LogV(format, argptr); - } - - void LogVTrace(const wxString& mask, const wxString& format, va_list argptr) - { - if ( !wxLog::IsAllowedTraceMask(mask) ) - return; - - Store(wxLOG_KEY_TRACE_MASK, mask); - - LogV(format, argptr); - } - - - // vararg functions used by wxLogXXX(): - - // will log the message at the level specified in the ctor - // - // notice that this function supposes that the caller already checked that - // the level was enabled and does no checks itself - WX_DEFINE_VARARG_FUNC_VOID - ( - Log, - 1, (const wxFormatString&), - DoLog, DoLogUtf8 - ) - - // same as Log() but with an extra numeric or pointer parameters: this is - // used to pass an optional value by storing it in m_info under the name - // passed to MaybeStore() and is required to support "overloaded" versions - // of wxLogStatus() and wxLogSysError() - WX_DEFINE_VARARG_FUNC_VOID - ( - Log, - 2, (long, const wxFormatString&), - DoLogWithNum, DoLogWithNumUtf8 - ) - - // unfortunately we can't use "void *" here as we get overload ambiguities - // with Log(wxFormatString, ...) when the first argument is a "char *" or - // "wchar_t *" then -- so we only allow passing wxObject here, which is - // ugly but fine in practice as this overload is only used by wxLogStatus() - // whose first argument is a wxFrame - WX_DEFINE_VARARG_FUNC_VOID - ( - Log, - 2, (wxObject *, const wxFormatString&), - DoLogWithPtr, DoLogWithPtrUtf8 - ) - - // log the message at the level specified as its first argument - // - // as the macros don't have access to the level argument in this case, this - // function does check that the level is enabled itself - WX_DEFINE_VARARG_FUNC_VOID - ( - LogAtLevel, - 2, (wxLogLevel, const wxFormatString&), - DoLogAtLevel, DoLogAtLevelUtf8 - ) - - // special versions for wxLogTrace() which is passed either string or - // integer mask as first argument determining whether the message should be - // logged or not - WX_DEFINE_VARARG_FUNC_VOID - ( - LogTrace, - 2, (const wxString&, const wxFormatString&), - DoLogTrace, DoLogTraceUtf8 - ) - -#if WXWIN_COMPATIBILITY_2_8 - WX_DEFINE_VARARG_FUNC_VOID - ( - LogTrace, - 2, (wxTraceMask, const wxFormatString&), - DoLogTraceMask, DoLogTraceMaskUtf8 - ) -#endif // WXWIN_COMPATIBILITY_2_8 - -#ifdef __WATCOMC__ - // workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351 - WX_VARARG_WATCOM_WORKAROUND(void, Log, - 1, (const wxString&), - (wxFormatString(f1))) - WX_VARARG_WATCOM_WORKAROUND(void, Log, - 1, (const wxCStrData&), - (wxFormatString(f1))) - WX_VARARG_WATCOM_WORKAROUND(void, Log, - 1, (const char*), - (wxFormatString(f1))) - WX_VARARG_WATCOM_WORKAROUND(void, Log, - 1, (const wchar_t*), - (wxFormatString(f1))) - - WX_VARARG_WATCOM_WORKAROUND(void, Log, - 2, (long, const wxString&), - (f1, wxFormatString(f2))) - WX_VARARG_WATCOM_WORKAROUND(void, Log, - 2, (long, const wxCStrData&), - (f1, wxFormatString(f2))) - WX_VARARG_WATCOM_WORKAROUND(void, Log, - 2, (long, const char *), - (f1, wxFormatString(f2))) - WX_VARARG_WATCOM_WORKAROUND(void, Log, - 2, (long, const wchar_t *), - (f1, wxFormatString(f2))) - - WX_VARARG_WATCOM_WORKAROUND(void, Log, - 2, (wxObject *, const wxString&), - (f1, wxFormatString(f2))) - WX_VARARG_WATCOM_WORKAROUND(void, Log, - 2, (wxObject *, const wxCStrData&), - (f1, wxFormatString(f2))) - WX_VARARG_WATCOM_WORKAROUND(void, Log, - 2, (wxObject *, const char *), - (f1, wxFormatString(f2))) - WX_VARARG_WATCOM_WORKAROUND(void, Log, - 2, (wxObject *, const wchar_t *), - (f1, wxFormatString(f2))) - - WX_VARARG_WATCOM_WORKAROUND(void, LogAtLevel, - 2, (wxLogLevel, const wxString&), - (f1, wxFormatString(f2))) - WX_VARARG_WATCOM_WORKAROUND(void, LogAtLevel, - 2, (wxLogLevel, const wxCStrData&), - (f1, wxFormatString(f2))) - WX_VARARG_WATCOM_WORKAROUND(void, LogAtLevel, - 2, (wxLogLevel, const char *), - (f1, wxFormatString(f2))) - WX_VARARG_WATCOM_WORKAROUND(void, LogAtLevel, - 2, (wxLogLevel, const wchar_t *), - (f1, wxFormatString(f2))) - - WX_VARARG_WATCOM_WORKAROUND(void, LogTrace, - 2, (const wxString&, const wxString&), - (f1, wxFormatString(f2))) - WX_VARARG_WATCOM_WORKAROUND(void, LogTrace, - 2, (const wxString&, const wxCStrData&), - (f1, wxFormatString(f2))) - WX_VARARG_WATCOM_WORKAROUND(void, LogTrace, - 2, (const wxString&, const char *), - (f1, wxFormatString(f2))) - WX_VARARG_WATCOM_WORKAROUND(void, LogTrace, - 2, (const wxString&, const wchar_t *), - (f1, wxFormatString(f2))) - -#if WXWIN_COMPATIBILITY_2_8 - WX_VARARG_WATCOM_WORKAROUND(void, LogTrace, - 2, (wxTraceMask, wxTraceMask), - (f1, wxFormatString(f2))) - WX_VARARG_WATCOM_WORKAROUND(void, LogTrace, - 2, (wxTraceMask, const wxCStrData&), - (f1, wxFormatString(f2))) - WX_VARARG_WATCOM_WORKAROUND(void, LogTrace, - 2, (wxTraceMask, const char *), - (f1, wxFormatString(f2))) - WX_VARARG_WATCOM_WORKAROUND(void, LogTrace, - 2, (wxTraceMask, const wchar_t *), - (f1, wxFormatString(f2))) -#endif // WXWIN_COMPATIBILITY_2_8 -#endif // __WATCOMC__ - -private: -#if !wxUSE_UTF8_LOCALE_ONLY - void DoLog(const wxChar *format, ...) - { - va_list argptr; - va_start(argptr, format); - DoCallOnLog(format, argptr); - va_end(argptr); - } - - void DoLogWithNum(long num, const wxChar *format, ...) - { - Store(m_optKey, num); - - va_list argptr; - va_start(argptr, format); - DoCallOnLog(format, argptr); - va_end(argptr); - } - - void DoLogWithPtr(void *ptr, const wxChar *format, ...) - { - Store(m_optKey, wxPtrToUInt(ptr)); - - va_list argptr; - va_start(argptr, format); - DoCallOnLog(format, argptr); - va_end(argptr); - } - - void DoLogAtLevel(wxLogLevel level, const wxChar *format, ...) - { - if ( !wxLog::IsLevelEnabled(level, m_info.component) ) - return; - - va_list argptr; - va_start(argptr, format); - DoCallOnLog(level, format, argptr); - va_end(argptr); - } - - void DoLogTrace(const wxString& mask, const wxChar *format, ...) - { - if ( !wxLog::IsAllowedTraceMask(mask) ) - return; - - Store(wxLOG_KEY_TRACE_MASK, mask); - - va_list argptr; - va_start(argptr, format); - DoCallOnLog(format, argptr); - va_end(argptr); - } - -#if WXWIN_COMPATIBILITY_2_8 - void DoLogTraceMask(wxTraceMask mask, const wxChar *format, ...) - { - if ( (wxLog::GetTraceMask() & mask) != mask ) - return; - - Store(wxLOG_KEY_TRACE_MASK, mask); - - va_list argptr; - va_start(argptr, format); - DoCallOnLog(format, argptr); - va_end(argptr); - } -#endif // WXWIN_COMPATIBILITY_2_8 -#endif // !wxUSE_UTF8_LOCALE_ONLY - -#if wxUSE_UNICODE_UTF8 - void DoLogUtf8(const char *format, ...) - { - va_list argptr; - va_start(argptr, format); - DoCallOnLog(format, argptr); - va_end(argptr); - } - - void DoLogWithNumUtf8(long num, const char *format, ...) - { - Store(m_optKey, num); - - va_list argptr; - va_start(argptr, format); - DoCallOnLog(format, argptr); - va_end(argptr); - } - - void DoLogWithPtrUtf8(void *ptr, const char *format, ...) - { - Store(m_optKey, wxPtrToUInt(ptr)); - - va_list argptr; - va_start(argptr, format); - DoCallOnLog(format, argptr); - va_end(argptr); - } - - void DoLogAtLevelUtf8(wxLogLevel level, const char *format, ...) - { - if ( !wxLog::IsLevelEnabled(level, m_info.component) ) - return; - - va_list argptr; - va_start(argptr, format); - DoCallOnLog(level, format, argptr); - va_end(argptr); - } - - void DoLogTraceUtf8(const wxString& mask, const char *format, ...) - { - if ( !wxLog::IsAllowedTraceMask(mask) ) - return; - - Store(wxLOG_KEY_TRACE_MASK, mask); - - va_list argptr; - va_start(argptr, format); - DoCallOnLog(format, argptr); - va_end(argptr); - } - -#if WXWIN_COMPATIBILITY_2_8 - void DoLogTraceMaskUtf8(wxTraceMask mask, const char *format, ...) - { - if ( (wxLog::GetTraceMask() & mask) != mask ) - return; - - Store(wxLOG_KEY_TRACE_MASK, mask); - - va_list argptr; - va_start(argptr, format); - DoCallOnLog(format, argptr); - va_end(argptr); - } -#endif // WXWIN_COMPATIBILITY_2_8 -#endif // wxUSE_UNICODE_UTF8 - - void DoCallOnLog(wxLogLevel level, const wxString& format, va_list argptr) - { - wxLog::OnLog(level, wxString::FormatV(format, argptr), m_info); - } - - void DoCallOnLog(const wxString& format, va_list argptr) - { - DoCallOnLog(m_level, format, argptr); - } - - - const wxLogLevel m_level; - wxLogRecordInfo m_info; - - wxString m_optKey; - - wxDECLARE_NO_COPY_CLASS(wxLogger); -}; - // ============================================================================ // global functions // ============================================================================ +// ---------------------------------------------------------------------------- +// Log functions should be used by application instead of stdio, iostream &c +// for log messages for easy redirection +// ---------------------------------------------------------------------------- + // ---------------------------------------------------------------------------- // get error code/error message from system in a portable way // ---------------------------------------------------------------------------- @@ -1281,222 +485,36 @@ WXDLLIMPEXP_BASE unsigned long wxSysErrorCode(); WXDLLIMPEXP_BASE const wxChar* wxSysErrorMsg(unsigned long nErrCode = 0); // ---------------------------------------------------------------------------- -// define wxLog() functions which can be used by application instead of -// stdio, iostream &c for log messages for easy redirection +// define wxLog // ---------------------------------------------------------------------------- -/* - The code below is unreadable because it (unfortunately unavoidably) - contains a lot of macro magic but all it does is to define wxLogXXX() such - that you can call them as vararg functions to log a message at the - corresponding level. - - More precisely, it defines: - - - wxLog{FatalError,Error,Warning,Message,Verbose,Debug}() functions - taking the format string and additional vararg arguments if needed. - - wxLogGeneric(wxLogLevel level, const wxString& format, ...) which - takes the log level explicitly. - - wxLogSysError(const wxString& format, ...) and wxLogSysError(long - err, const wxString& format, ...) which log a wxLOG_Error severity - message with the error message corresponding to the system error code - err or the last error. - - wxLogStatus(const wxString& format, ...) which logs the message into - the status bar of the main application window and its overload - wxLogStatus(wxFrame *frame, const wxString& format, ...) which logs it - into the status bar of the specified frame. - - wxLogTrace(Mask mask, const wxString& format, ...) which only logs - the message is the specified mask is enabled. This comes in two kinds: - Mask can be a wxString or a long. Both are deprecated. - - In addition, wxVLogXXX() versions of all the functions above are also - defined. They take a va_list argument instead of "...". - */ - -// creates wxLogger object for the current location -#define wxMAKE_LOGGER(level) \ - wxLogger(wxLOG_##level, __FILE__, __LINE__, __WXFUNCTION__, wxLOG_COMPONENT) - -// this macro generates the expression which logs whatever follows it in -// parentheses at the level specified as argument -#define wxDO_LOG(level) wxMAKE_LOGGER(level).Log - -// this is the non-vararg equivalent -#define wxDO_LOGV(level, format, argptr) \ - wxMAKE_LOGGER(level).LogV(format, argptr) - -// this macro declares wxLog() macro which logs whatever follows it if -// logging at specified level is enabled (notice that if it is false, the -// following arguments are not even evaluated which is good as it avoids -// unnecessary overhead) -// -// Note: the strange if/else construct is needed to make the following code -// -// if ( cond ) -// wxLogError("!!!"); -// else -// ... -// -// work as expected, without it the second "else" would match the "if" -// inside wxLogError(). Unfortunately code like -// -// if ( cond ) -// wxLogError("!!!"); -// -// now provokes "suggest explicit braces to avoid ambiguous 'else'" -// warnings from g++ 4.3 and later with -Wparentheses on but they can be -// easily fixed by adding curly braces around wxLogError() and at least -// the code still does do the right thing. -#define wxDO_LOG_IF_ENABLED(level) \ - if ( !wxLog::IsLevelEnabled(wxLOG_##level, wxLOG_COMPONENT) ) \ - {} \ - else \ - wxDO_LOG(level) - -// wxLogFatalError() is special as it can't be disabled -#define wxLogFatalError wxDO_LOG(FatalError) -#define wxVLogFatalError(format, argptr) wxDO_LOGV(FatalError, format, argptr) - -#define wxLogError wxDO_LOG_IF_ENABLED(Error) -#define wxVLogError(format, argptr) wxDO_LOGV(Error, format, argptr) - -#define wxLogWarning wxDO_LOG_IF_ENABLED(Warning) -#define wxVLogWarning(format, argptr) wxDO_LOGV(Warning, format, argptr) - -#define wxLogMessage wxDO_LOG_IF_ENABLED(Message) -#define wxVLogMessage(format, argptr) wxDO_LOGV(Message, format, argptr) - -// this one is special as it only logs if we're in verbose mode -#define wxLogVerbose \ - if ( !(wxLog::IsLevelEnabled(wxLOG_Info, wxLOG_COMPONENT) && \ - wxLog::GetVerbose()) ) \ - {} \ - else \ - wxDO_LOG(Info) -#define wxVLogVerbose(format, argptr) \ - if ( !(wxLog::IsLevelEnabled(wxLOG_Info, wxLOG_COMPONENT) && \ - wxLog::GetVerbose()) ) \ - {} \ - else \ - wxDO_LOGV(Info, format, argptr) - -// deprecated synonyms for wxLogVerbose() and wxVLogVerbose() -#define wxLogInfo wxLogVerbose -#define wxVLogInfo wxVLogVerbose - - -// another special case: the level is passed as first argument of the function -// and so is not available to the macro -// -// notice that because of this, arguments of wxLogGeneric() are currently -// always evaluated, unlike for the other log functions -#define wxLogGeneric wxMAKE_LOGGER(Max).LogAtLevel -#define wxVLogGeneric(level, format, argptr) \ - if ( !wxLog::IsLevelEnabled(wxLOG_##level, wxLOG_COMPONENT) ) \ - {} \ - else \ - wxDO_LOGV(level, format, argptr) - - -// wxLogSysError() needs to stash the error code value in the log record info -// so it needs special handling too; additional complications arise because the -// error code may or not be present as the first argument -// -// notice that we unfortunately can't avoid the call to wxSysErrorCode() even -// though it may be unneeded if an explicit error code is passed to us because -// the message might not be logged immediately (e.g. it could be queued for -// logging from the main thread later) and so we can't to wait until it is -// logged to determine whether we have last error or not as it will be too late -// and it will have changed already by then (in fact it even changes when -// wxString::Format() is called because of vsnprintf() inside it so it can -// change even much sooner) -#define wxLOG_KEY_SYS_ERROR_CODE "wx.sys_error" - -#define wxLogSysError \ - if ( !wxLog::IsLevelEnabled(wxLOG_Error, wxLOG_COMPONENT) ) \ - {} \ - else \ - wxMAKE_LOGGER(Error).MaybeStore(wxLOG_KEY_SYS_ERROR_CODE, \ - wxSysErrorCode()).Log - -// unfortunately we can't have overloaded macros so we can't define versions -// both with and without error code argument and have to rely on LogV() -// overloads in wxLogger to select between them -#define wxVLogSysError \ - wxMAKE_LOGGER(Error).MaybeStore(wxLOG_KEY_SYS_ERROR_CODE, \ - wxSysErrorCode()).LogV - -#if wxUSE_GUI - // wxLogStatus() is similar to wxLogSysError() as it allows to optionally - // specify the frame to which the message should go - #define wxLOG_KEY_FRAME "wx.frame" - - #define wxLogStatus \ - if ( !wxLog::IsLevelEnabled(wxLOG_Status, wxLOG_COMPONENT) ) \ - {} \ - else \ - wxMAKE_LOGGER(Status).MaybeStore(wxLOG_KEY_FRAME).Log - - #define wxVLogStatus(format, argptr) \ - wxMAKE_LOGGER(Status).MaybeStore(wxLOG_KEY_FRAME).LogV -#endif // wxUSE_GUI - - +#define DECLARE_LOG_FUNCTION(level) \ +extern void WXDLLIMPEXP_BASE wxVLog##level(const wxChar *szFormat, \ + va_list argptr); \ +extern void WXDLLIMPEXP_BASE wxLog##level(const wxChar *szFormat, \ + ...) ATTRIBUTE_PRINTF_1 +#define DECLARE_LOG_FUNCTION2_EXP(level, argclass, arg, expdecl) \ +extern void expdecl wxVLog##level(argclass arg, \ + const wxChar *szFormat, \ + va_list argptr); \ +extern void expdecl wxLog##level(argclass arg, \ + const wxChar *szFormat, \ + ...) ATTRIBUTE_PRINTF_2 #else // !wxUSE_LOG -#undef wxUSE_LOG_DEBUG -#define wxUSE_LOG_DEBUG 0 - -#undef wxUSE_LOG_TRACE -#define wxUSE_LOG_TRACE 0 - -#if defined(__WATCOMC__) || defined(__MINGW32__) - // Mingw has similar problem with wxLogSysError: - #define WX_WATCOM_OR_MINGW_ONLY_CODE( x ) x -#else - #define WX_WATCOM_OR_MINGW_ONLY_CODE( x ) -#endif - -// define macros for defining log functions which do nothing at all -// -// WX_WATCOM_ONLY_CODE is needed to work around -// http://bugzilla.openwatcom.org/show_bug.cgi?id=351 -#define wxDEFINE_EMPTY_LOG_FUNCTION(level) \ - WX_DEFINE_VARARG_FUNC_NOP(wxLog##level, 1, (const wxFormatString&)) \ - WX_WATCOM_ONLY_CODE( \ - WX_DEFINE_VARARG_FUNC_NOP(wxLog##level, 1, (const char*)) \ - WX_DEFINE_VARARG_FUNC_NOP(wxLog##level, 1, (const wchar_t*)) \ - WX_DEFINE_VARARG_FUNC_NOP(wxLog##level, 1, (const wxCStrData&)) \ - ) \ - inline void wxVLog##level(const wxFormatString& WXUNUSED(format), \ - va_list WXUNUSED(argptr)) { } \ - -#define wxDEFINE_EMPTY_LOG_FUNCTION2(level, argclass) \ - WX_DEFINE_VARARG_FUNC_NOP(wxLog##level, 2, (argclass, const wxFormatString&)) \ - WX_WATCOM_OR_MINGW_ONLY_CODE( \ - WX_DEFINE_VARARG_FUNC_NOP(wxLog##level, 2, (argclass, const char*)) \ - WX_DEFINE_VARARG_FUNC_NOP(wxLog##level, 2, (argclass, const wchar_t*)) \ - WX_DEFINE_VARARG_FUNC_NOP(wxLog##level, 2, (argclass, const wxCStrData&)) \ - ) \ - inline void wxVLog##level(argclass WXUNUSED(arg), \ - const wxFormatString& WXUNUSED(format), \ - va_list WXUNUSED(argptr)) {} - -wxDEFINE_EMPTY_LOG_FUNCTION(FatalError); -wxDEFINE_EMPTY_LOG_FUNCTION(Error); -wxDEFINE_EMPTY_LOG_FUNCTION(SysError); -wxDEFINE_EMPTY_LOG_FUNCTION2(SysError, long); -wxDEFINE_EMPTY_LOG_FUNCTION(Warning); -wxDEFINE_EMPTY_LOG_FUNCTION(Message); -wxDEFINE_EMPTY_LOG_FUNCTION(Info); -wxDEFINE_EMPTY_LOG_FUNCTION(Verbose); - -wxDEFINE_EMPTY_LOG_FUNCTION2(Generic, wxLogLevel); - -#if wxUSE_GUI - wxDEFINE_EMPTY_LOG_FUNCTION(Status); - wxDEFINE_EMPTY_LOG_FUNCTION2(Status, wxFrame *); -#endif // wxUSE_GUI +// log functions do nothing at all +#define DECLARE_LOG_FUNCTION(level) \ +inline void wxVLog##level(const wxChar *WXUNUSED(szFormat), \ + va_list WXUNUSED(argptr)) { } \ +inline void wxLog##level(const wxChar *WXUNUSED(szFormat), \ + ...) { } +#define DECLARE_LOG_FUNCTION2_EXP(level, argclass, arg, expdecl) \ +inline void wxVLog##level(argclass WXUNUSED(arg), \ + const wxChar *WXUNUSED(szFormat), \ + va_list WXUNUSED(argptr)) {} \ +inline void wxLog##level(argclass WXUNUSED(arg), \ + const wxChar *WXUNUSED(szFormat), \ + ...) { } // Empty Class to fake wxLogNull class WXDLLIMPEXP_BASE wxLogNull @@ -1514,70 +532,85 @@ public: #endif // wxUSE_LOG/!wxUSE_LOG +#define DECLARE_LOG_FUNCTION2(level, argclass, arg) \ + DECLARE_LOG_FUNCTION2_EXP(level, argclass, arg, WXDLLIMPEXP_BASE) -// debug functions can be completely disabled in optimized builds -// if these log functions are disabled, we prefer to define them as (empty) -// variadic macros as this completely removes them and their argument -// evaluation from the object code but if this is not supported by compiler we -// use empty inline functions instead (defining them as nothing would result in -// compiler warnings) -// -// note that making wxVLogDebug/Trace() themselves (empty inline) functions is -// a bad idea as some compilers are stupid enough to not inline even empty -// functions if their parameters are complicated enough, but by defining them -// as an empty inline function we ensure that even dumbest compilers optimise -// them away -#ifdef __BORLANDC__ - // but Borland gives "W8019: Code has no effect" for wxLogNop() so we need - // to define it differently for it to avoid these warnings (same problem as - // with wxUnusedVar()) - #define wxLogNop() { } -#else +// a generic function for all levels (level is passes as parameter) +DECLARE_LOG_FUNCTION2(Generic, wxLogLevel, level); + +// one function per each level +DECLARE_LOG_FUNCTION(FatalError); +DECLARE_LOG_FUNCTION(Error); +DECLARE_LOG_FUNCTION(Warning); +DECLARE_LOG_FUNCTION(Message); +DECLARE_LOG_FUNCTION(Info); +DECLARE_LOG_FUNCTION(Verbose); + +// this function sends the log message to the status line of the top level +// application frame, if any +DECLARE_LOG_FUNCTION(Status); + +#if wxUSE_GUI + // this one is the same as previous except that it allows to explicitly + class WXDLLIMPEXP_FWD_CORE wxFrame; + // specify the frame to which the output should go + DECLARE_LOG_FUNCTION2_EXP(Status, wxFrame *, pFrame, WXDLLIMPEXP_CORE); +#endif // wxUSE_GUI + +// additional one: as wxLogError, but also logs last system call error code +// and the corresponding error message if available +DECLARE_LOG_FUNCTION(SysError); + +// and another one which also takes the error code (for those broken APIs +// that don't set the errno (like registry APIs in Win32)) +DECLARE_LOG_FUNCTION2(SysError, long, lErrCode); + +// debug functions do nothing in release mode +#if wxUSE_LOG && wxUSE_LOG_DEBUG + DECLARE_LOG_FUNCTION(Debug); + + // there is no more unconditional LogTrace: it is not different from + // LogDebug and it creates overload ambiguities + //DECLARE_LOG_FUNCTION(Trace); + + // this version only logs the message if the mask had been added to the + // list of masks with AddTraceMask() + DECLARE_LOG_FUNCTION2(Trace, const wxChar *, mask); + + // and this one does nothing if all of level bits are not set in + // wxLog::GetActive()->GetTraceMask() -- it's deprecated in favour of + // string identifiers + DECLARE_LOG_FUNCTION2(Trace, wxTraceMask, mask); +#else //!debug || !wxUSE_LOG + // these functions do nothing in release builds, but don't define them as + // nothing as it could result in different code structure in debug and + // release and this could result in trouble when these macros are used + // inside if/else + // + // note that making wxVLogDebug/Trace() themselves (empty inline) functions + // is a bad idea as some compilers are stupid enough to not inline even + // empty functions if their parameters are complicated enough, but by + // defining them as an empty inline function we ensure that even dumbest + // compilers optimise them away inline void wxLogNop() { } -#endif -#if wxUSE_LOG_DEBUG - #define wxLogDebug wxDO_LOG_IF_ENABLED(Debug) - #define wxVLogDebug(format, argptr) wxDO_LOGV(Debug, format, argptr) -#else // !wxUSE_LOG_DEBUG #define wxVLogDebug(fmt, valist) wxLogNop() - - #ifdef HAVE_VARIADIC_MACROS - #define wxLogDebug(fmt, ...) wxLogNop() - #else // !HAVE_VARIADIC_MACROS - WX_DEFINE_VARARG_FUNC_NOP(wxLogDebug, 1, (const wxFormatString&)) - #endif -#endif // wxUSE_LOG_DEBUG/!wxUSE_LOG_DEBUG - -#if wxUSE_LOG_TRACE - #define wxLogTrace \ - if ( !wxLog::IsLevelEnabled(wxLOG_Trace, wxLOG_COMPONENT) ) \ - {} \ - else \ - wxMAKE_LOGGER(Trace).LogTrace - #define wxVLogTrace \ - if ( !wxLog::IsLevelEnabled(wxLOG_Trace, wxLOG_COMPONENT) ) \ - {} \ - else \ - wxMAKE_LOGGER(Trace).LogVTrace -#else // !wxUSE_LOG_TRACE #define wxVLogTrace(mask, fmt, valist) wxLogNop() #ifdef HAVE_VARIADIC_MACROS + // unlike the inline functions below, this completely removes the + // wxLogXXX calls from the object file: + #define wxLogDebug(fmt, ...) wxLogNop() #define wxLogTrace(mask, fmt, ...) wxLogNop() #else // !HAVE_VARIADIC_MACROS - #if WXWIN_COMPATIBILITY_2_8 - WX_DEFINE_VARARG_FUNC_NOP(wxLogTrace, 2, (wxTraceMask, const wxFormatString&)) - #endif - WX_DEFINE_VARARG_FUNC_NOP(wxLogTrace, 2, (const wxString&, const wxFormatString&)) - #ifdef __WATCOMC__ - // workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351 - WX_DEFINE_VARARG_FUNC_NOP(wxLogTrace, 2, (const char*, const char*)) - WX_DEFINE_VARARG_FUNC_NOP(wxLogTrace, 2, (const wchar_t*, const wchar_t*)) - #endif + // note that leaving out "fmt" in the vararg functions provokes a warning + // from SGI CC: "the last argument of the varargs function is unnamed" + inline void wxLogDebug(const wxChar *fmt, ...) { wxUnusedVar(fmt); } + inline void wxLogTrace(wxTraceMask, const wxChar *fmt, ...) { wxUnusedVar(fmt); } + inline void wxLogTrace(const wxChar *, const wxChar *fmt, ...) { wxUnusedVar(fmt); } #endif // HAVE_VARIADIC_MACROS/!HAVE_VARIADIC_MACROS -#endif // wxUSE_LOG_TRACE/!wxUSE_LOG_TRACE +#endif // debug/!debug // wxLogFatalError helper: show the (fatal) error to the user in a safe way, // i.e. without using wxMessageBox() for example because it could crash @@ -1588,46 +621,33 @@ wxSafeShowMessage(const wxString& title, const wxString& text); // debug only logging functions: use them with API name and error code // ---------------------------------------------------------------------------- -#if wxUSE_LOG_DEBUG +#ifdef __WXDEBUG__ // make life easier for people using VC++ IDE: clicking on the message // will take us immediately to the place of the failed API #ifdef __VISUALC__ #define wxLogApiError(api, rc) \ wxLogDebug(wxT("%s(%d): '%s' failed with error 0x%08lx (%s)."), \ - __FILE__, __LINE__, api, \ + __TFILE__, __LINE__, api, \ (long)rc, wxSysErrorMsg(rc)) #else // !VC++ #define wxLogApiError(api, rc) \ wxLogDebug(wxT("In file %s at line %d: '%s' failed with ") \ wxT("error 0x%08lx (%s)."), \ - __FILE__, __LINE__, api, \ + __TFILE__, __LINE__, api, \ (long)rc, wxSysErrorMsg(rc)) #endif // VC++/!VC++ #define wxLogLastError(api) wxLogApiError(api, wxSysErrorCode()) -#else // !wxUSE_LOG_DEBUG +#else //!debug #define wxLogApiError(api, err) wxLogNop() #define wxLogLastError(api) wxLogNop() -#endif // wxUSE_LOG_DEBUG/!wxUSE_LOG_DEBUG +#endif //debug/!debug // wxCocoa has additiional trace masks #if defined(__WXCOCOA__) #include "wx/cocoa/log.h" #endif -#ifdef WX_WATCOM_ONLY_CODE - #undef WX_WATCOM_ONLY_CODE -#endif - -// macro which disables debug logging in release builds: this is done by -// default by wxIMPLEMENT_APP() so usually it doesn't need to be used explicitly -#if defined(NDEBUG) && wxUSE_LOG_DEBUG - #define wxDISABLE_DEBUG_LOGGING_IN_RELEASE_BUILD() \ - wxLog::SetLogLevel(wxLOG_Info) -#else // !NDEBUG - #define wxDISABLE_DEBUG_LOGGING_IN_RELEASE_BUILD() -#endif // NDEBUG/!NDEBUG - #endif // _WX_LOG_H_ diff --git a/Source/3rd Party/wx/include/wx/longlong.h b/Source/3rd Party/wx/include/wx/longlong.h index 7a29d86ef..304001d8d 100644 --- a/Source/3rd Party/wx/include/wx/longlong.h +++ b/Source/3rd Party/wx/include/wx/longlong.h @@ -5,7 +5,7 @@ // Author: Jeffrey C. Ollie , Vadim Zeitlin // Modified by: // Created: 10.02.99 -// RCS-ID: $Id$ +// RCS-ID: $Id: longlong.h 61872 2009-09-09 22:37:05Z VZ $ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -67,8 +67,8 @@ #define wxUSE_LONGLONG_NATIVE 0 #endif - class WXDLLIMPEXP_FWD_BASE wxLongLongWx; - class WXDLLIMPEXP_FWD_BASE wxULongLongWx; + class WXDLLIMPEXP_BASE wxLongLongWx; + class WXDLLIMPEXP_BASE wxULongLongWx; #if defined(__VISUALC__) && !defined(__WIN32__) #define wxLongLong wxLongLongWx #define wxULongLong wxULongLongWx @@ -404,20 +404,15 @@ public: // convert to ulong with range checking in debug mode (only!) unsigned long ToULong() const { - wxASSERT_MSG( m_ll <= ULONG_MAX, + wxASSERT_MSG( m_ll <= LONG_MAX, wxT("wxULongLong to long conversion loss of precision") ); return wx_truncate_cast(unsigned long, m_ll); } // convert to double - // - // For some completely obscure reasons compiling the cast below with - // VC6 in DLL builds only (!) results in "error C2520: conversion from - // unsigned __int64 to double not implemented, use signed __int64" so - // we must use a different version for that compiler. -#ifdef __VISUALC6__ - double ToDouble() const; +#ifdef _MSC_VER + double ToDouble() const { return wx_truncate_cast(double, (__int64) m_ll); } #else double ToDouble() const { return wx_truncate_cast(double, m_ll); } #endif @@ -1080,66 +1075,6 @@ WXDLLIMPEXP_BASE class wxTextInputStream &operator>>(class wxTextInputStream &st #endif -// ---------------------------------------------------------------------------- -// Specialize numeric_limits<> for our long long wrapper classes. -// ---------------------------------------------------------------------------- - -#if wxUSE_LONGLONG_NATIVE - -// VC6 is known to not have __int64 specializations of numeric_limits<> in its -// anyhow so don't bother including it, especially as it results in -// tons of warnings because the standard header itself uses obsolete template -// specialization syntax. -#ifndef __VISUALC6__ - -#include - -namespace std -{ - -#ifdef __clang__ - // libstdc++ (used by Clang) uses struct for numeric_limits; unlike gcc, clang - // warns about this - template<> struct numeric_limits : public numeric_limits {}; - template<> struct numeric_limits : public numeric_limits {}; -#else - template<> class numeric_limits : public numeric_limits {}; - template<> class numeric_limits : public numeric_limits {}; -#endif - -} // namespace std - -#endif // !VC6 - -#endif // wxUSE_LONGLONG_NATIVE - -// ---------------------------------------------------------------------------- -// Specialize wxArgNormalizer to allow using wxLongLong directly with wx pseudo -// vararg functions. -// ---------------------------------------------------------------------------- - -// Notice that this must be done here and not in wx/strvararg.h itself because -// we can't include wx/longlong.h from there as this header itself includes -// wx/string.h which includes wx/strvararg.h too, so to avoid the circular -// dependencies we can only do it here (or add another header just for this but -// it doesn't seem necessary). -#include "wx/strvararg.h" - -template<> -struct WXDLLIMPEXP_BASE wxArgNormalizer -{ - wxArgNormalizer(wxLongLong value, - const wxFormatString *fmt, unsigned index) - : m_value(value) - { - wxASSERT_ARG_TYPE( fmt, index, wxFormatString::Arg_LongLongInt ); - } - - wxLongLong_t get() const { return m_value.GetValue(); } - - wxLongLong m_value; -}; - #endif // wxUSE_LONGLONG #endif // _WX_LONGLONG_H diff --git a/Source/3rd Party/wx/include/wx/math.h b/Source/3rd Party/wx/include/wx/math.h index 1c98bb21a..5ac102151 100644 --- a/Source/3rd Party/wx/include/wx/math.h +++ b/Source/3rd Party/wx/include/wx/math.h @@ -4,7 +4,7 @@ * Author: John Labenski and others * Modified by: * Created: 02/02/03 -* RCS-ID: $Id$ +* RCS-ID: $Id: math.h 62541 2009-11-03 14:10:46Z VZ $ * Copyright: (c) John Labenski * Licence: wxWindows licence */ @@ -22,9 +22,9 @@ #define M_PI 3.1415926535897932384626433832795 #endif -/* Scaling factors for various unit conversions: 1 inch = 2.54 cm */ +/* Scaling factors for various unit conversions */ #ifndef METRIC_CONVERSION_CONSTANT - #define METRIC_CONVERSION_CONSTANT (1/25.4) + #define METRIC_CONVERSION_CONSTANT 0.0393700787 #endif #ifndef mm2inches @@ -57,18 +57,9 @@ #if defined(__VISUALC__) || defined(__BORLANDC__) || defined(__WATCOMC__) #include #define wxFinite(x) _finite(x) -#elif defined(__MINGW64__) || defined(__clang__) - /* - add more compilers with C99 support here: using C99 isfinite() is - preferable to using BSD-ish finite() - */ - #define wxFinite(x) isfinite(x) -#elif ( defined(__GNUG__)||defined(__GNUWIN32__)||defined(__DJGPP__)|| \ +#elif defined(__GNUG__)||defined(__GNUWIN32__)||defined(__DJGPP__)|| \ defined(__SGI_CC__)||defined(__SUNCC__)||defined(__XLC__)|| \ - defined(__HPUX__) ) && ( !defined(wxOSX_USE_IPHONE) || wxOSX_USE_IPHONE == 0 ) -#ifdef __SOLARIS__ -#include -#endif + defined(__HPUX__)||defined(__MWERKS__) #define wxFinite(x) finite(x) #else #define wxFinite(x) ((x) == (x)) @@ -79,7 +70,7 @@ #define wxIsNaN(x) _isnan(x) #elif defined(__GNUG__)||defined(__GNUWIN32__)||defined(__DJGPP__)|| \ defined(__SGI_CC__)||defined(__SUNCC__)||defined(__XLC__)|| \ - defined(__HPUX__) + defined(__HPUX__)||defined(__MWERKS__) #define wxIsNaN(x) isnan(x) #else #define wxIsNaN(x) ((x) != (x)) @@ -95,7 +86,7 @@ // shouldn't be used with doubles, but we get too many of them and // removing these operators is probably not a good idea // - // Maybe we should always compare doubles up to some "epsilon" precision + // Maybe we should alway compare doubles up to some "epsilon" precision #pragma warning(push) // floating-point equality and inequality comparisons are unreliable @@ -116,9 +107,6 @@ inline int wxRound(double x) { - wxASSERT_MSG( x > INT_MIN - 0.5 && x < INT_MAX + 0.5, - wxT("argument out of supported range") ); - #if defined(HAVE_ROUND) return int(round(x)); #else @@ -128,10 +116,12 @@ #endif /* __cplusplus */ -#if defined(__WINDOWS__) && !defined(__WXWINCE__) +#if defined(__WXMSW__) && !defined(__WXWINCE__) #define wxMulDivInt32( a , b , c ) ::MulDiv( a , b , c ) +#elif defined( __WXMAC__ ) + #define wxMulDivInt32( a , b , c ) ( (wxInt32) ( ( (wxInt64)(a) * (wxInt64)(b) ) / (wxInt64)(c) ) ) #else - #define wxMulDivInt32( a , b , c ) (wxRound((a)*(((wxDouble)b)/((wxDouble)c)))) + #define wxMulDivInt32( a , b , c ) ((wxInt32)((a)*(((wxDouble)b)/((wxDouble)c)))) #endif #if wxUSE_APPLE_IEEE @@ -139,15 +129,8 @@ extern "C" { #endif /* functions from common/extended.c */ - WXDLLIMPEXP_BASE wxFloat64 wxConvertFromIeeeExtended(const wxInt8 *bytes); - WXDLLIMPEXP_BASE void wxConvertToIeeeExtended(wxFloat64 num, wxInt8 *bytes); - - /* use wxConvertFromIeeeExtended() and wxConvertToIeeeExtended() instead */ -#if WXWIN_COMPATIBILITY_2_8 - wxDEPRECATED( WXDLLIMPEXP_BASE wxFloat64 ConvertFromIeeeExtended(const wxInt8 *bytes) ); - wxDEPRECATED( WXDLLIMPEXP_BASE void ConvertToIeeeExtended(wxFloat64 num, wxInt8 *bytes) ); -#endif - + WXDLLEXPORT wxFloat64 ConvertFromIeeeExtended(const wxInt8 *bytes); + WXDLLEXPORT void ConvertToIeeeExtended(wxFloat64 num, wxInt8 *bytes); #ifdef __cplusplus } #endif diff --git a/Source/3rd Party/wx/include/wx/matrix.h b/Source/3rd Party/wx/include/wx/matrix.h index 11eb95236..11c688ba4 100644 --- a/Source/3rd Party/wx/include/wx/matrix.h +++ b/Source/3rd Party/wx/include/wx/matrix.h @@ -4,7 +4,7 @@ // Author: Chris Breeze, Julian Smart // Modified by: Klaas Holwerda // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: matrix.h 45498 2007-04-16 13:03:05Z VZ $ // Copyright: (c) Julian Smart, Chris Breeze // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -32,7 +32,7 @@ // at a certain coordinate and angle within another parent picture. // At all times m_isIdentity is set if the matrix itself is an Identity matrix. // It is used where possible to optimize calculations. -class WXDLLIMPEXP_CORE wxTransformMatrix: public wxObject +class WXDLLEXPORT wxTransformMatrix: public wxObject { public: wxTransformMatrix(void); diff --git a/Source/3rd Party/wx/include/wx/mdi.h b/Source/3rd Party/wx/include/wx/mdi.h index 6e7ba5c27..7a9eeca59 100644 --- a/Source/3rd Party/wx/include/wx/mdi.h +++ b/Source/3rd Party/wx/include/wx/mdi.h @@ -1,11 +1,11 @@ ///////////////////////////////////////////////////////////////////////////// // Name: wx/mdi.h // Purpose: wxMDI base header -// Author: Julian Smart (original) -// Vadim Zeitlin (base MDI classes refactoring) -// Copyright: (c) 1998 Julian Smart -// (c) 2008 Vadim Zeitlin -// RCS-ID: $Id$ +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// RCS-ID: $Id: mdi.h 37066 2006-01-23 03:27:34Z MR $ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -16,359 +16,25 @@ #if wxUSE_MDI -#include "wx/frame.h" -#include "wx/menu.h" - -// forward declarations -class WXDLLIMPEXP_FWD_CORE wxMDIParentFrame; -class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame; -class WXDLLIMPEXP_FWD_CORE wxMDIClientWindowBase; -class WXDLLIMPEXP_FWD_CORE wxMDIClientWindow; - -// ---------------------------------------------------------------------------- -// wxMDIParentFrameBase: base class for parent frame for MDI children -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxMDIParentFrameBase : public wxFrame -{ -public: - wxMDIParentFrameBase() - { - m_clientWindow = NULL; - m_currentChild = NULL; -#if wxUSE_MENUS - m_windowMenu = NULL; -#endif // wxUSE_MENUS - } - - /* - Derived classes should provide ctor and Create() with the following - declaration: - - bool Create(wxWindow *parent, - wxWindowID winid, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, - const wxString& name = wxFrameNameStr); - */ - -#if wxUSE_MENUS - virtual ~wxMDIParentFrameBase() - { - delete m_windowMenu; - } -#endif // wxUSE_MENUS - - // accessors - // --------- - - // Get or change the active MDI child window - virtual wxMDIChildFrame *GetActiveChild() const - { return m_currentChild; } - virtual void SetActiveChild(wxMDIChildFrame *child) - { m_currentChild = child; } - - - // Get the client window - wxMDIClientWindowBase *GetClientWindow() const { return m_clientWindow; } - - - // MDI windows menu functions - // -------------------------- - -#if wxUSE_MENUS - // return the pointer to the current window menu or NULL if we don't have - // because of wxFRAME_NO_WINDOW_MENU style - wxMenu* GetWindowMenu() const { return m_windowMenu; } - - // use the given menu instead of the default window menu - // - // menu can be NULL to disable the window menu completely - virtual void SetWindowMenu(wxMenu *menu) - { - if ( menu != m_windowMenu ) - { - delete m_windowMenu; - m_windowMenu = menu; - } - } -#endif // wxUSE_MENUS - - - // standard MDI window management functions - // ---------------------------------------- - - virtual void Cascade() { } - virtual void Tile(wxOrientation WXUNUSED(orient) = wxHORIZONTAL) { } - virtual void ArrangeIcons() { } - virtual void ActivateNext() = 0; - virtual void ActivatePrevious() = 0; - - /* - Derived classes must provide the following function: - - static bool IsTDI(); - */ - - // Create the client window class (don't Create() the window here, just - // return a new object of a wxMDIClientWindow-derived class) - // - // Notice that if you override this method you should use the default - // constructor and Create() and not the constructor creating the window - // when creating the frame or your overridden version is not going to be - // called (as the call to a virtual function from ctor will be dispatched - // to this class version) - virtual wxMDIClientWindow *OnCreateClient(); - -protected: - // This is wxMDIClientWindow for all the native implementations but not for - // the generic MDI version which has its own wxGenericMDIClientWindow and - // so we store it as just a base class pointer because we don't need its - // exact type anyhow - wxMDIClientWindowBase *m_clientWindow; - wxMDIChildFrame *m_currentChild; - -#if wxUSE_MENUS - // the current window menu or NULL if we are not using it - wxMenu *m_windowMenu; -#endif // wxUSE_MENUS -}; - -// ---------------------------------------------------------------------------- -// wxMDIChildFrameBase: child frame managed by wxMDIParentFrame -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxMDIChildFrameBase : public wxFrame -{ -public: - wxMDIChildFrameBase() { m_mdiParent = NULL; } - - /* - Derived classes should provide Create() with the following signature: - - bool Create(wxMDIParentFrame *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr); - - And setting m_mdiParent to parent parameter. - */ - - // MDI children specific methods - virtual void Activate() = 0; - - // Return the MDI parent frame: notice that it may not be the same as - // GetParent() (our parent may be the client window or even its subwindow - // in some implementations) - wxMDIParentFrame *GetMDIParent() const { return m_mdiParent; } - - // Synonym for GetMDIParent(), was used in some other ports - wxMDIParentFrame *GetMDIParentFrame() const { return GetMDIParent(); } - - - // in most ports MDI children frames are not really top-level, the only - // exception are the Mac ports in which MDI children are just normal top - // level windows too - virtual bool IsTopLevel() const { return false; } - - // In all ports keyboard navigation must stop at MDI child frame level and - // can't cross its boundary. Indicate this by overriding this function to - // return true. - virtual bool IsTopNavigationDomain() const { return true; } - - // Raising any frame is supposed to show it but wxFrame Raise() - // implementation doesn't work for MDI child frames in most forms so - // forward this to Activate() which serves the same purpose by default. - virtual void Raise() { Activate(); } - -protected: - wxMDIParentFrame *m_mdiParent; -}; - -// ---------------------------------------------------------------------------- -// wxTDIChildFrame: child frame used by TDI implementations -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxTDIChildFrame : public wxMDIChildFrameBase -{ -public: - // override wxFrame methods for this non top-level window - -#if wxUSE_STATUSBAR - // no status bars - // - // TODO: MDI children should have their own status bars, why not? - virtual wxStatusBar* CreateStatusBar(int WXUNUSED(number) = 1, - long WXUNUSED(style) = 1, - wxWindowID WXUNUSED(id) = 1, - const wxString& WXUNUSED(name) - = wxEmptyString) - { return NULL; } - - virtual wxStatusBar *GetStatusBar() const - { return NULL; } - virtual void SetStatusText(const wxString &WXUNUSED(text), - int WXUNUSED(number)=0) - { } - virtual void SetStatusWidths(int WXUNUSED(n), - const int WXUNUSED(widths)[]) - { } -#endif // wxUSE_STATUSBAR - -#if wxUSE_TOOLBAR - // no toolbar - // - // TODO: again, it should be possible to have tool bars - virtual wxToolBar *CreateToolBar(long WXUNUSED(style), - wxWindowID WXUNUSED(id), - const wxString& WXUNUSED(name)) - { return NULL; } - virtual wxToolBar *GetToolBar() const { return NULL; } -#endif // wxUSE_TOOLBAR - - // no icon - virtual void SetIcons(const wxIconBundle& WXUNUSED(icons)) { } - - // title is used as the tab label - virtual wxString GetTitle() const { return m_title; } - virtual void SetTitle(const wxString& title) = 0; - - // no maximize etc - virtual void Maximize(bool WXUNUSED(maximize) = true) { } - virtual bool IsMaximized() const { return true; } - virtual bool IsAlwaysMaximized() const { return true; } - virtual void Iconize(bool WXUNUSED(iconize) = true) { } - virtual bool IsIconized() const { return false; } - virtual void Restore() { } - - virtual bool ShowFullScreen(bool WXUNUSED(show), - long WXUNUSED(style)) { return false; } - virtual bool IsFullScreen() const { return false; } - - - // we need to override these functions to ensure that a child window is - // created even though we derive from wxFrame -- basically we make it - // behave as just a wxWindow by short-circuiting wxTLW changes to the base - // class behaviour - - virtual void AddChild(wxWindowBase *child) { wxWindow::AddChild(child); } - - virtual bool Destroy() { return wxWindow::Destroy(); } - - // extra platform-specific hacks -#ifdef __WXMSW__ - virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const - { - return wxWindow::MSWGetStyle(flags, exstyle); - } - - virtual WXHWND MSWGetParent() const - { - return wxWindow::MSWGetParent(); - } - - WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) - { - return wxWindow::MSWWindowProc(message, wParam, lParam); - } -#endif // __WXMSW__ - -protected: - virtual void DoGetSize(int *width, int *height) const - { - wxWindow::DoGetSize(width, height); - } - - virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags) - { - wxWindow::DoSetSize(x, y, width, height, sizeFlags); - } - - virtual void DoGetClientSize(int *width, int *height) const - { - wxWindow::DoGetClientSize(width, height); - } - - virtual void DoSetClientSize(int width, int height) - { - wxWindow::DoSetClientSize(width, height); - } - - // no size hints - virtual void DoSetSizeHints(int WXUNUSED(minW), int WXUNUSED(minH), - int WXUNUSED(maxW), int WXUNUSED(maxH), - int WXUNUSED(incW), int WXUNUSED(incH)) { } - - wxString m_title; -}; - -// ---------------------------------------------------------------------------- -// wxMDIClientWindowBase: child of parent frame, parent of children frames -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxMDIClientWindowBase : public wxWindow -{ -public: - /* - The derived class must provide the default ctor only (CreateClient() - will be called later). - */ - - // Can be overridden in the derived classes but the base class version must - // be usually called first to really create the client window. - virtual bool CreateClient(wxMDIParentFrame *parent, - long style = wxVSCROLL | wxHSCROLL) = 0; -}; - -// ---------------------------------------------------------------------------- -// Include the port-specific implementation of the base classes defined above -// ---------------------------------------------------------------------------- - -// wxUSE_GENERIC_MDI_AS_NATIVE may be predefined to force the generic MDI -// implementation use even on the platforms which usually don't use it -// -// notice that generic MDI can still be used without this, but you would need -// to explicitly use wxGenericMDIXXX classes in your code (and currently also -// add src/generic/mdig.cpp to your build as it's not compiled in if generic -// MDI is not used by default -- but this may change later...) -#ifndef wxUSE_GENERIC_MDI_AS_NATIVE - // wxUniv always uses the generic MDI implementation and so do the ports - // without native version (although wxCocoa seems to have one -- but it's - // probably not functional?) - #if defined(__WXCOCOA__) || \ - defined(__WXMOTIF__) || \ - defined(__WXPM__) || \ - defined(__WXUNIVERSAL__) - #define wxUSE_GENERIC_MDI_AS_NATIVE 1 - #else - #define wxUSE_GENERIC_MDI_AS_NATIVE 0 - #endif -#endif // wxUSE_GENERIC_MDI_AS_NATIVE - -#if wxUSE_GENERIC_MDI_AS_NATIVE +#if defined(__WXUNIVERSAL__) #include "wx/generic/mdig.h" #elif defined(__WXMSW__) #include "wx/msw/mdi.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/mdi.h" #elif defined(__WXGTK20__) #include "wx/gtk/mdi.h" #elif defined(__WXGTK__) #include "wx/gtk1/mdi.h" #elif defined(__WXMAC__) - #include "wx/osx/mdi.h" + #include "wx/mac/mdi.h" #elif defined(__WXCOCOA__) #include "wx/cocoa/mdi.h" +#elif defined(__WXPM__) + #include "wx/generic/mdig.h" #endif -inline wxMDIClientWindow *wxMDIParentFrameBase::OnCreateClient() -{ - return new wxMDIClientWindow; -} - #endif // wxUSE_MDI -#endif // _WX_MDI_H_BASE_ +#endif + // _WX_MDI_H_BASE_ diff --git a/Source/3rd Party/wx/include/wx/memconf.h b/Source/3rd Party/wx/include/wx/memconf.h index f794a807b..9508b1fef 100644 --- a/Source/3rd Party/wx/include/wx/memconf.h +++ b/Source/3rd Party/wx/include/wx/memconf.h @@ -6,7 +6,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 22.01.00 -// RCS-ID: $Id$ +// RCS-ID: $Id: memconf.h 35650 2005-09-23 12:56:45Z MR $ // Copyright: (c) 2000 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -46,7 +46,7 @@ public: { } - wxDECLARE_NO_COPY_CLASS(wxMemoryConfig); + DECLARE_NO_COPY_CLASS(wxMemoryConfig) }; #endif // wxUSE_CONFIG diff --git a/Source/3rd Party/wx/include/wx/memory.h b/Source/3rd Party/wx/include/wx/memory.h index adaf21ffb..e4594f66e 100644 --- a/Source/3rd Party/wx/include/wx/memory.h +++ b/Source/3rd Party/wx/include/wx/memory.h @@ -4,22 +4,29 @@ // Author: Arthur Seaton, Julian Smart // Modified by: // Created: 29/01/98 -// RCS-ID: $Id$ +// RCS-ID: $Id: memory.h 39634 2006-06-08 12:51:01Z ABX $ // Copyright: (c) 1998 Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifndef _WX_MEMORY_H_ -#define _WX_MEMORY_H_ +#ifndef _WX_MEMORYH__ +#define _WX_MEMORYH__ #include "wx/defs.h" #include "wx/string.h" #include "wx/msgout.h" -#if wxUSE_MEMORY_TRACING || wxUSE_DEBUG_CONTEXT +/* + The macro which will be expanded to include the file and line number + info, or to be a straight call to the new operator. +*/ + +#if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT #include +#ifdef __WXDEBUG__ + WXDLLIMPEXP_BASE void * wxDebugAlloc(size_t size, wxChar * fileName, int lineNum, bool isObject, bool isVect = false); WXDLLIMPEXP_BASE void wxDebugFree(void * buf, bool isVect = false); @@ -43,14 +50,14 @@ WXDLLIMPEXP_BASE void wxDebugFree(void * buf, bool isVect = false); #if defined(__SUNCC__) #define wxUSE_ARRAY_MEMORY_OPERATORS 0 -#elif !( defined (__VISUALC__) && (__VISUALC__ <= 1020) ) +#elif !( defined (__VISUALC__) && (__VISUALC__ <= 1020) ) || defined( __MWERKS__) #define wxUSE_ARRAY_MEMORY_OPERATORS 1 #elif defined (__SGI_CC_) // only supported by -n32 compilers #ifndef __EDG_ABI_COMPATIBILITY_VERSION #define wxUSE_ARRAY_MEMORY_OPERATORS 0 #endif -#elif !( defined (__VISUALC__) && (__VISUALC__ <= 1020) ) +#elif !( defined (__VISUALC__) && (__VISUALC__ <= 1020) ) || defined( __MWERKS__) #define wxUSE_ARRAY_MEMORY_OPERATORS 1 #else // ::operator new[] is a recent C++ feature, so assume it's not supported @@ -60,7 +67,7 @@ WXDLLIMPEXP_BASE void wxDebugFree(void * buf, bool isVect = false); // devik 2000-8-29: All new/delete ops are now inline because they can't // be marked as dllexport/dllimport. It then leads to weird bugs when // used on MSW as DLL -#if defined(__WINDOWS__) && (defined(WXUSINGDLL) || defined(WXMAKINGDLL_BASE)) +#if defined(__WXMSW__) && (defined(WXUSINGDLL) || defined(WXMAKINGDLL_BASE)) inline void * operator new (size_t size, wxChar * fileName, int lineNum) { return wxDebugAlloc(size, fileName, lineNum, false, false); @@ -108,10 +115,10 @@ void * operator new[] (size_t size, wxChar * fileName, int lineNum); void operator delete[] (void * buf); #endif // wxUSE_ARRAY_MEMORY_OPERATORS -#endif // defined(__WINDOWS__) && (defined(WXUSINGDLL) || defined(WXMAKINGDLL_BASE)) +#endif // defined(__WXMSW__) && (defined(WXUSINGDLL) || defined(WXMAKINGDLL_BASE)) -// VC++ 6.0 -#if ( defined(__VISUALC__) && (__VISUALC__ >= 1200) ) +// VC++ 6.0 and MWERKS +#if ( defined(__VISUALC__) && (__VISUALC__ >= 1200) ) || defined(__MWERKS__) inline void operator delete(void* pData, wxChar* /* fileName */, int /* lineNum */) { wxDebugFree(pData, false); @@ -122,6 +129,7 @@ inline void operator delete[](void* pData, wxChar* /* fileName */, int /* lineNu } #endif // __VISUALC__>=1200 #endif // wxUSE_GLOBAL_MEMORY_OPERATORS +#endif // __WXDEBUG__ //********************************************************************************** @@ -134,7 +142,7 @@ typedef unsigned int wxMarkerType; class WXDLLIMPEXP_BASE wxMemStruct { -friend class WXDLLIMPEXP_FWD_BASE wxDebugContext; // access to the m_next pointer for list traversal. +friend class WXDLLIMPEXP_BASE wxDebugContext; // access to the m_next pointer for list traversal. public: public: @@ -199,9 +207,6 @@ public: typedef void (wxMemStruct::*PmSFV) (); -// Type of the app function that can be installed and called at wxWidgets shutdown -// (after all other registered files with global destructors have been closed down). -typedef void (*wxShutdownNotifyFunction)(); /* Debugging class. This will only have a single instance, but it's @@ -302,8 +307,6 @@ public: // This function is used to output the dump static void OutputDumpLine(const wxChar *szFormat, ...); - static void SetShutdownNotifyFunction(wxShutdownNotifyFunction shutdownFn); - private: // Store these here to allow access to the list without // needing to have a wxMemStruct object. @@ -313,25 +316,23 @@ private: // Set to false if we're not checking all previous nodes when // we do a new. Set to true when we are. static bool m_checkPrevious; - - // Holds a pointer to an optional application function to call at shutdown. - static wxShutdownNotifyFunction sm_shutdownFn; - - // Have to access our shutdown hook - friend class wxDebugContextDumpDelayCounter; }; // Final cleanup (e.g. deleting the log object and doing memory leak checking) // will be delayed until all wxDebugContextDumpDelayCounter objects have been // destructed. Adding one wxDebugContextDumpDelayCounter per file will delay // memory leak checking until after destructing all global objects. - class WXDLLIMPEXP_BASE wxDebugContextDumpDelayCounter { public: - wxDebugContextDumpDelayCounter(); - ~wxDebugContextDumpDelayCounter(); + wxDebugContextDumpDelayCounter() { + sm_count++; + } + ~wxDebugContextDumpDelayCounter() { + sm_count--; + if(!sm_count) DoDump(); + } private: void DoDump(); static int sm_count; @@ -343,13 +344,13 @@ static wxDebugContextDumpDelayCounter wxDebugContextDumpDelayCounter_File; static wxDebugContextDumpDelayCounter wxDebugContextDumpDelayCounter_Extra; // Output a debug message, in a system dependent fashion. -void WXDLLIMPEXP_BASE wxTrace(const wxChar *fmt ...) WX_ATTRIBUTE_PRINTF_1; -void WXDLLIMPEXP_BASE wxTraceLevel(int level, const wxChar *fmt ...) WX_ATTRIBUTE_PRINTF_2; +void WXDLLIMPEXP_BASE wxTrace(const wxChar *fmt ...) ATTRIBUTE_PRINTF_1; +void WXDLLIMPEXP_BASE wxTraceLevel(int level, const wxChar *fmt ...) ATTRIBUTE_PRINTF_2; #define WXTRACE wxTrace #define WXTRACELEVEL wxTraceLevel -#else // wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT +#else // (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT #define WXDEBUG_DUMPDELAYCOUNTER @@ -366,6 +367,7 @@ void WXDLLIMPEXP_BASE wxTraceLevel(int level, const wxChar *fmt ...) WX_ATTRIBUT #define WXTRACE true ? (void)0 : wxTrace #define WXTRACELEVEL true ? (void)0 : wxTraceLevel -#endif // wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT +#endif // (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT -#endif // _WX_MEMORY_H_ +#endif + // _WX_MEMORYH__ diff --git a/Source/3rd Party/wx/include/wx/memtext.h b/Source/3rd Party/wx/include/wx/memtext.h index 48d71911f..16706092a 100644 --- a/Source/3rd Party/wx/include/wx/memtext.h +++ b/Source/3rd Party/wx/include/wx/memtext.h @@ -41,11 +41,11 @@ protected: { return true; } virtual bool OnWrite(wxTextFileType WXUNUSED(typeNew), - const wxMBConv& WXUNUSED(conv) = wxMBConvUTF8()) + const wxMBConv& WXUNUSED(conv) = wxConvUTF8) { return true; } private: - wxDECLARE_NO_COPY_CLASS(wxMemoryText); + DECLARE_NO_COPY_CLASS(wxMemoryText) }; #endif // wxUSE_TEXTBUFFER diff --git a/Source/3rd Party/wx/include/wx/menu.h b/Source/3rd Party/wx/include/wx/menu.h index 70500e8a9..dad76c795 100644 --- a/Source/3rd Party/wx/include/wx/menu.h +++ b/Source/3rd Party/wx/include/wx/menu.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 26.10.99 -// RCS-ID: $Id$ +// RCS-ID: $Id: menu.h 49563 2007-10-31 20:46:21Z VZ $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -27,7 +27,6 @@ // included wx/menu.h #include "wx/menuitem.h" -class WXDLLIMPEXP_FWD_CORE wxFrame; class WXDLLIMPEXP_FWD_CORE wxMenu; class WXDLLIMPEXP_FWD_CORE wxMenuBarBase; class WXDLLIMPEXP_FWD_CORE wxMenuBar; @@ -41,7 +40,7 @@ WX_DECLARE_EXPORTED_LIST(wxMenuItem, wxMenuItemList); // wxMenu // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxMenuBase : public wxEvtHandler +class WXDLLEXPORT wxMenuBase : public wxEvtHandler { public: // create a menu @@ -69,7 +68,7 @@ public: } // append a separator to the menu - wxMenuItem* AppendSeparator() { return Append(wxID_SEPARATOR); } + wxMenuItem* AppendSeparator() { return Append(wxID_SEPARATOR, wxEmptyString); } // append a check item wxMenuItem* AppendCheckItem(int itemid, @@ -238,9 +237,6 @@ public: void SetLabel(int itemid, const wxString& label); wxString GetLabel(int itemid) const; - // Returns the stripped label - wxString GetLabelText(int itemid) const { return wxMenuItem::GetLabelText(GetLabel(itemid)); } - virtual void SetHelpString(int itemid, const wxString& helpString); virtual wxString GetHelpString(int itemid) const; @@ -249,27 +245,16 @@ public: // the title virtual void SetTitle(const wxString& title) { m_title = title; } - const wxString& GetTitle() const { return m_title; } + const wxString GetTitle() const { return m_title; } // event handler void SetEventHandler(wxEvtHandler *handler) { m_eventHandler = handler; } wxEvtHandler *GetEventHandler() const { return m_eventHandler; } - // Invoking window: this is set by wxWindow::PopupMenu() before showing a - // popup menu and reset after it's hidden. Notice that you probably want to - // use GetWindow() below instead of GetInvokingWindow() as the latter only - // returns non-NULL for the top level menus - // - // NB: avoid calling SetInvokingWindow() directly if possible, use - // wxMenuInvokingWindowSetter class below instead - void SetInvokingWindow(wxWindow *win); + // invoking window + void SetInvokingWindow(wxWindow *win) { m_invokingWindow = win; } wxWindow *GetInvokingWindow() const { return m_invokingWindow; } - // the window associated with this menu: this is the invoking window for - // popup menus or the top level window to which the menu bar is attached - // for menus which are part of a menu bar - wxWindow *GetWindow() const; - // style long GetStyle() const { return m_style; } @@ -279,7 +264,7 @@ public: // Updates the UI for a menu and all submenus recursively. source is the // object that has the update event handlers defined for it. If NULL, the // menu or associated window will be used. - void UpdateUI(wxEvtHandler* source = NULL); + void UpdateUI(wxEvtHandler* source = (wxEvtHandler*)NULL); // get the menu bar this menu is attached to (may be NULL, always NULL for // popup menus). Traverse up the menu hierarchy to find it. @@ -389,47 +374,22 @@ protected: static bool ms_locked; - wxDECLARE_NO_COPY_CLASS(wxMenuBase); -}; + DECLARE_NO_COPY_CLASS(wxMenuBase) -#if wxUSE_EXTENDED_RTTI - -// ---------------------------------------------------------------------------- -// XTI accessor -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxMenuInfoHelper : public wxObject -{ public: - wxMenuInfoHelper() { m_menu = NULL; } - virtual ~wxMenuInfoHelper() { } - - bool Create( wxMenu *menu, const wxString &title ) - { - m_menu = menu; - m_title = title; - return true; - } - - wxMenu* GetMenu() const { return m_menu; } - wxString GetTitle() const { return m_title; } - -private: - wxMenu *m_menu; - wxString m_title; - - DECLARE_DYNAMIC_CLASS(wxMenuInfoHelper) -}; - -WX_DECLARE_EXPORTED_LIST(wxMenuInfoHelper, wxMenuInfoHelperList ); +#if wxABI_VERSION >= 20805 + // Returns the stripped label + wxString GetLabelText(int itemid) const { return wxMenuItem::GetLabelFromText(GetLabel(itemid)); } #endif +}; + // ---------------------------------------------------------------------------- // wxMenuBar // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxMenuBarBase : public wxWindow +class WXDLLEXPORT wxMenuBarBase : public wxWindow { public: // default ctor @@ -472,11 +432,8 @@ public: virtual bool IsEnabledTop(size_t WXUNUSED(pos)) const { return true; } // get or change the label of the menu at given position - virtual void SetMenuLabel(size_t pos, const wxString& label) = 0; - virtual wxString GetMenuLabel(size_t pos) const = 0; - - // get the stripped label of the menu at given position - virtual wxString GetMenuLabelText(size_t pos) const { return wxMenuItem::GetLabelText(GetMenuLabel(pos)); } + virtual void SetLabelTop(size_t pos, const wxString& label) = 0; + virtual wxString GetLabelTop(size_t pos) const = 0; // item search // ----------- @@ -539,36 +496,29 @@ public: // update all menu item states in all menus virtual void UpdateMenus(); - virtual bool CanBeOutsideClientArea() const { return true; } - -#if wxUSE_EXTENDED_RTTI - // XTI helpers: - bool AppendMenuInfo( const wxMenuInfoHelper *info ) - { return Append( info->GetMenu(), info->GetTitle() ); } - const wxMenuInfoHelperList& GetMenuInfos() const; -#endif - -#if WXWIN_COMPATIBILITY_2_8 - // get or change the label of the menu at given position - // Deprecated in favour of SetMenuLabel - wxDEPRECATED( void SetLabelTop(size_t pos, const wxString& label) ); - // Deprecated in favour of GetMenuLabelText - wxDEPRECATED( wxString GetLabelTop(size_t pos) const ); -#endif - protected: // the list of all our menus wxMenuList m_menus; -#if wxUSE_EXTENDED_RTTI - // used by XTI - wxMenuInfoHelperList m_menuInfos; -#endif - // the frame we are attached to (may be NULL) wxFrame *m_menuBarFrame; - wxDECLARE_NO_COPY_CLASS(wxMenuBarBase); + DECLARE_NO_COPY_CLASS(wxMenuBarBase) + +public: + +#if wxABI_VERSION >= 20805 + // Replacement for SetLabelTop + void SetMenuLabel(size_t pos, const wxString& label) { SetLabelTop(pos, label); } + + // Gets the original label at the top-level of the menubar + // Implemented per port, since we can't have virtual functions in the stable branch. + // wxString GetMenuLabel(size_t pos) const; + + // Get the text only, from the label at the top-level of the menubar + wxString GetMenuLabelText(size_t pos) const; +#endif + }; // ---------------------------------------------------------------------------- @@ -580,6 +530,8 @@ protected: #else // !wxUSE_BASE_CLASSES_ONLY #if defined(__WXUNIVERSAL__) #include "wx/univ/menu.h" +#elif defined(__WXPALMOS__) + #include "wx/palmos/menu.h" #elif defined(__WXMSW__) #include "wx/msw/menu.h" #elif defined(__WXMOTIF__) @@ -589,7 +541,7 @@ protected: #elif defined(__WXGTK__) #include "wx/gtk1/menu.h" #elif defined(__WXMAC__) - #include "wx/osx/menu.h" + #include "wx/mac/menu.h" #elif defined(__WXCOCOA__) #include "wx/cocoa/menu.h" #elif defined(__WXPM__) @@ -597,35 +549,7 @@ protected: #endif #endif // wxUSE_BASE_CLASSES_ONLY/!wxUSE_BASE_CLASSES_ONLY -// ---------------------------------------------------------------------------- -// Helper class used in the implementation only: sets the invoking window of -// the given menu in its ctor and resets it in dtor. -// ---------------------------------------------------------------------------- - -class wxMenuInvokingWindowSetter -{ -public: - // Ctor sets the invoking window for the given menu. - // - // The menu lifetime must be greater than that of this class. - wxMenuInvokingWindowSetter(wxMenu& menu, wxWindow *win) - : m_menu(menu) - { - menu.SetInvokingWindow(win); - } - - // Dtor resets the invoking window. - ~wxMenuInvokingWindowSetter() - { - m_menu.SetInvokingWindow(NULL); - } - -private: - wxMenu& m_menu; - - wxDECLARE_NO_COPY_CLASS(wxMenuInvokingWindowSetter); -}; - #endif // wxUSE_MENUS -#endif // _WX_MENU_H_BASE_ +#endif + // _WX_MENU_H_BASE_ diff --git a/Source/3rd Party/wx/include/wx/menuitem.h b/Source/3rd Party/wx/include/wx/menuitem.h index 1a49e1199..2a55e582b 100644 --- a/Source/3rd Party/wx/include/wx/menuitem.h +++ b/Source/3rd Party/wx/include/wx/menuitem.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 25.10.99 -// RCS-ID: $Id$ +// RCS-ID: $Id: menuitem.h 49563 2007-10-31 20:46:21Z VZ $ // Copyright: (c) 1999 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -35,16 +35,16 @@ class WXDLLIMPEXP_FWD_CORE wxMenu; // menu or a separator // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxMenuItemBase : public wxObject +class WXDLLEXPORT wxMenuItemBase : public wxObject { public: // creation - static wxMenuItem *New(wxMenu *parentMenu = NULL, + static wxMenuItem *New(wxMenu *parentMenu = (wxMenu *)NULL, int itemid = wxID_SEPARATOR, const wxString& text = wxEmptyString, const wxString& help = wxEmptyString, wxItemKind kind = wxITEM_NORMAL, - wxMenu *subMenu = NULL); + wxMenu *subMenu = (wxMenu *)NULL); // destruction: wxMenuItem will delete its submenu virtual ~wxMenuItemBase(); @@ -56,31 +56,25 @@ public: // get/set id void SetId(int itemid) { m_id = itemid; } int GetId() const { return m_id; } + bool IsSeparator() const { return m_id == wxID_SEPARATOR; } // the item's text (or name) // - // NB: the item's label includes the accelerators and mnemonics info (if + // NB: the item's text includes the accelerators and mnemonics info (if // any), i.e. it may contain '&' or '_' or "\t..." and thus is - // different from the item's text which only contains the text shown - // in the menu. This used to be called SetText. - virtual void SetItemLabel(const wxString& str); + // different from the item's label which only contains the text shown + // in the menu + virtual void SetText(const wxString& str); - // return the item label including any mnemonics and accelerators. - // This used to be called GetText. - virtual wxString GetItemLabel() const { return m_text; } + wxString GetLabel() const { return GetLabelFromText(m_text); } + const wxString& GetText() const { return m_text; } - // return just the text of the item label, without any mnemonics - // This used to be called GetLabel. - virtual wxString GetItemLabelText() const { return GetLabelText(m_text); } - - // return just the text part of the given label (implemented in platform-specific code) - // This used to be called GetLabelFromText. - static wxString GetLabelText(const wxString& label); + // get the label from text (implemented in platform-specific code) + static wxString GetLabelFromText(const wxString& text); // what kind of menu item we are wxItemKind GetKind() const { return m_kind; } void SetKind(wxItemKind kind) { m_kind = kind; } - bool IsSeparator() const { return m_kind == wxITEM_SEPARATOR; } virtual void SetCheckable(bool checkable) { m_kind = checkable ? wxITEM_CHECK : wxITEM_NORMAL; } bool IsCheckable() const @@ -115,37 +109,23 @@ public: virtual void SetAccel(wxAcceleratorEntry *accel); #endif // wxUSE_ACCEL -#if WXWIN_COMPATIBILITY_2_8 // compatibility only, use new functions in the new code - wxDEPRECATED( void SetName(const wxString& str) ); - wxDEPRECATED( wxString GetName() const ); - - // Now use GetItemLabelText - wxDEPRECATED( wxString GetLabel() const ) ; - - // Now use GetItemLabel - wxDEPRECATED( const wxString& GetText() const ); - - // Now use GetLabelText to strip the accelerators - static wxDEPRECATED( wxString GetLabelFromText(const wxString& text) ); - - // Now use SetItemLabel - wxDEPRECATED( virtual void SetText(const wxString& str) ); -#endif // WXWIN_COMPATIBILITY_2_8 + void SetName(const wxString& str) { SetText(str); } + const wxString& GetName() const { return GetText(); } static wxMenuItem *New(wxMenu *parentMenu, int itemid, const wxString& text, const wxString& help, bool isCheckable, - wxMenu *subMenu = NULL) + wxMenu *subMenu = (wxMenu *)NULL) { return New(parentMenu, itemid, text, help, isCheckable ? wxITEM_CHECK : wxITEM_NORMAL, subMenu); } protected: - wxWindowIDRef m_id; // numeric id of the item >= 0 or wxID_ANY or wxID_SEPARATOR + int m_id; // numeric id of the item >= 0 or wxID_ANY or wxID_SEPARATOR wxMenu *m_parentMenu, // the menu we belong to *m_subMenu; // our sub menu or NULL wxString m_text, // label of the item @@ -155,30 +135,39 @@ protected: bool m_isEnabled; // is enabled? // this ctor is for the derived classes only, we're never created directly - wxMenuItemBase(wxMenu *parentMenu = NULL, + wxMenuItemBase(wxMenu *parentMenu = (wxMenu *)NULL, int itemid = wxID_SEPARATOR, const wxString& text = wxEmptyString, const wxString& help = wxEmptyString, wxItemKind kind = wxITEM_NORMAL, - wxMenu *subMenu = NULL); + wxMenu *subMenu = (wxMenu *)NULL); private: // and, if we have one ctor, compiler won't generate a default copy one, so // declare them ourselves - but don't implement as they shouldn't be used wxMenuItemBase(const wxMenuItemBase& item); wxMenuItemBase& operator=(const wxMenuItemBase& item); -}; -#if WXWIN_COMPATIBILITY_2_8 -inline void wxMenuItemBase::SetName(const wxString &str) - { SetItemLabel(str); } -inline wxString wxMenuItemBase::GetName() const - { return GetItemLabel(); } -inline wxString wxMenuItemBase::GetLabel() const - { return GetLabelText(m_text); } -inline const wxString& wxMenuItemBase::GetText() const { return m_text; } -inline void wxMenuItemBase::SetText(const wxString& text) { SetItemLabel(text); } -#endif // WXWIN_COMPATIBILITY_2_8 +public: + +#if wxABI_VERSION >= 20805 + // Sets the label. This function replaces SetText. + void SetItemLabel(const wxString& str) { SetText(str); } + + // return the item label including any mnemonics and accelerators. + // This used to be called GetText. + // We can't implement this in the base class (no new virtuals in stable branch) + // wxString GetItemLabel() const; + + // return just the text of the item label, without any mnemonics + // This used to be called GetLabel. + wxString GetItemLabelText() const { return GetLabelText(m_text); } + + // return just the text part of the given label. In 2.9 and up, this is implemented in + // platform-specific code, but is now implemented in terms of GetLabelFromText. + static wxString GetLabelText(const wxString& label); +#endif +}; // ---------------------------------------------------------------------------- // include the real class declaration @@ -189,6 +178,8 @@ inline void wxMenuItemBase::SetText(const wxString& text) { SetItemLabel(text); #else // !wxUSE_BASE_CLASSES_ONLY #if defined(__WXUNIVERSAL__) #include "wx/univ/menuitem.h" +#elif defined(__WXPALMOS__) + #include "wx/palmos/menuitem.h" #elif defined(__WXMSW__) #include "wx/msw/menuitem.h" #elif defined(__WXMOTIF__) @@ -198,7 +189,7 @@ inline void wxMenuItemBase::SetText(const wxString& text) { SetItemLabel(text); #elif defined(__WXGTK__) #include "wx/gtk1/menuitem.h" #elif defined(__WXMAC__) - #include "wx/osx/menuitem.h" + #include "wx/mac/menuitem.h" #elif defined(__WXCOCOA__) #include "wx/cocoa/menuitem.h" #elif defined(__WXPM__) diff --git a/Source/3rd Party/wx/include/wx/meta/convertible.h b/Source/3rd Party/wx/include/wx/meta/convertible.h deleted file mode 100644 index 4e8d10af7..000000000 --- a/Source/3rd Party/wx/include/wx/meta/convertible.h +++ /dev/null @@ -1,39 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/meta/convertible.h -// Purpose: Test if types are convertible -// Author: Arne Steinarson -// Created: 2008-01-10 -// RCS-ID: $Id$ -// Copyright: (c) 2008 Arne Steinarson -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_META_CONVERTIBLE_H_ -#define _WX_META_CONVERTIBLE_H_ - -// -// Introduce an extra class to make this header compilable with g++3.2 -// -template -struct wxConvertibleTo_SizeHelper -{ - static char Match(B* pb); - static int Match(...); -}; - -// Helper to decide if an object of type D is convertible to type B (the test -// succeeds in particular when D derives from B) -template -struct wxConvertibleTo -{ - enum - { - value = - sizeof(wxConvertibleTo_SizeHelper::Match(static_cast(NULL))) - == - sizeof(char) - }; -}; - -#endif // _WX_META_CONVERTIBLE_H_ - diff --git a/Source/3rd Party/wx/include/wx/meta/if.h b/Source/3rd Party/wx/include/wx/meta/if.h deleted file mode 100644 index ad661d0c7..000000000 --- a/Source/3rd Party/wx/include/wx/meta/if.h +++ /dev/null @@ -1,73 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/meta/if.h -// Purpose: declares wxIf<> metaprogramming construct -// Author: Vaclav Slavik -// Created: 2008-01-22 -// RCS-ID: $Id$ -// Copyright: (c) 2008 Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_META_IF_H_ -#define _WX_META_IF_H_ - -#include "wx/defs.h" - -// NB: This code is intentionally written without partial templates -// specialization, because some older compilers (notably VC6) don't -// support it. - -namespace wxPrivate -{ - -template -struct wxIfImpl - -// broken VC6 needs not just an incomplete template class declaration but a -// "skeleton" declaration of the specialized versions below as it apparently -// tries to look up the types in the generic template definition at some moment -// even though it ends up by using the correct specialization in the end -- but -// without this skeleton it doesn't recognize Result as a class at all below -#if defined(__VISUALC__) && !wxCHECK_VISUALC_VERSION(7) -{ - template struct Result {}; -} -#endif // VC++ <= 6 -; - -// specialization for true: -template <> -struct wxIfImpl -{ - template struct Result - { - typedef TTrue value; - }; -}; - -// specialization for false: -template<> -struct wxIfImpl -{ - template struct Result - { - typedef TFalse value; - }; -}; - -} // namespace wxPrivate - -// wxIf<> template defines nested type "value" which is the same as -// TTrue if the condition Cond (boolean compile-time constant) was met and -// TFalse if it wasn't. -// -// See wxVector in vector.h for usage example -template -struct wxIf -{ - typedef typename wxPrivate::wxIfImpl - ::template Result::value - value; -}; - -#endif // _WX_META_IF_H_ diff --git a/Source/3rd Party/wx/include/wx/meta/implicitconversion.h b/Source/3rd Party/wx/include/wx/meta/implicitconversion.h deleted file mode 100644 index f6d73219e..000000000 --- a/Source/3rd Party/wx/include/wx/meta/implicitconversion.h +++ /dev/null @@ -1,113 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/meta/implicitconversion.h -// Purpose: Determine resulting type from implicit conversion -// Author: Vaclav Slavik -// Created: 2010-10-22 -// RCS-ID: $Id$ -// Copyright: (c) 2010 Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_META_IMPLICITCONVERSION_H_ -#define _WX_META_IMPLICITCONVERSION_H_ - -#include "wx/defs.h" -#include "wx/meta/if.h" - -// C++ hierarchy of data types is: -// -// Long double (highest) -// Double -// Float -// Unsigned long int -// Long int -// Unsigned int -// Int (lowest) -// -// Types lower in the hierarchy are converted into ones higher up if both are -// involved e.g. in arithmetic expressions. - -namespace wxPrivate -{ - -// Helper macro to define a constant inside a template class: it's needed -// because MSVC6 doesn't support initializing static integer members but the -// usual workaround of using enums instead doesn't work for Borland (at least -// in template classes). -#ifdef __VISUALC6__ - #define wxDEFINE_CLASS_INT_CONST(name, value) enum { name = value } -#else - #define wxDEFINE_CLASS_INT_CONST(name, value) static const int name = value -#endif - -template -struct TypeHierarchy -{ - // consider unknown types (e.g. objects, pointers) to be of highest - // level, always convert to them if they occur - wxDEFINE_CLASS_INT_CONST( level, 9999 ); -}; - -#define WX_TYPE_HIERARCHY_LEVEL(level_num, type) \ - template<> struct TypeHierarchy \ - { \ - wxDEFINE_CLASS_INT_CONST( level, level_num ); \ - } - -WX_TYPE_HIERARCHY_LEVEL( 1, char); -WX_TYPE_HIERARCHY_LEVEL( 2, unsigned char); -WX_TYPE_HIERARCHY_LEVEL( 3, short); -WX_TYPE_HIERARCHY_LEVEL( 4, unsigned short); -WX_TYPE_HIERARCHY_LEVEL( 5, int); -WX_TYPE_HIERARCHY_LEVEL( 6, unsigned int); -WX_TYPE_HIERARCHY_LEVEL( 7, long); -WX_TYPE_HIERARCHY_LEVEL( 8, unsigned long); -#ifdef wxLongLong_t -WX_TYPE_HIERARCHY_LEVEL( 9, wxLongLong_t); -WX_TYPE_HIERARCHY_LEVEL(10, wxULongLong_t); -#endif -WX_TYPE_HIERARCHY_LEVEL(11, float); -WX_TYPE_HIERARCHY_LEVEL(12, double); -WX_TYPE_HIERARCHY_LEVEL(13, long double); - -#if wxWCHAR_T_IS_REAL_TYPE - #if SIZEOF_WCHAR_T == SIZEOF_SHORT - template<> struct TypeHierarchy : public TypeHierarchy {}; - #elif SIZEOF_WCHAR_T == SIZEOF_INT - template<> struct TypeHierarchy : public TypeHierarchy {}; - #elif SIZEOF_WCHAR_T == SIZEOF_LONG - template<> struct TypeHierarchy : public TypeHierarchy {}; - #else - #error "weird wchar_t size, please update this code" - #endif -#endif - -#undef WX_TYPE_HIERARCHY_LEVEL - -} // namespace wxPrivate - -// Helper to determine resulting type of implicit conversion in -// an expression with two arithmetic types. -template -struct wxImplicitConversionType -{ - typedef typename wxIf - < - // if T2 is "higher" type, convert to it - (int)(wxPrivate::TypeHierarchy::level) < (int)(wxPrivate::TypeHierarchy::level), - T2, - // otherwise use T1 - T1 - >::value - value; -}; - - -template -struct wxImplicitConversionType3 : public wxImplicitConversionType< - T1, - typename wxImplicitConversionType::value> -{ -}; - -#endif // _WX_META_IMPLICITCONVERSION_H_ diff --git a/Source/3rd Party/wx/include/wx/meta/int2type.h b/Source/3rd Party/wx/include/wx/meta/int2type.h deleted file mode 100644 index 1b1c25539..000000000 --- a/Source/3rd Party/wx/include/wx/meta/int2type.h +++ /dev/null @@ -1,17 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/meta/int2type.h -// Purpose: Generate a unique type from a constant integer -// Author: Arne Steinarson -// Created: 2008-01-10 -// RCS-ID: $Id$ -// Copyright: (c) 2008 Arne Steinarson -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_META_INT2TYPE_H_ -#define _WX_META_INT2TYPE_H_ - -template -struct wxInt2Type { enum { value=N }; }; - -#endif // _WX_META_INT2TYPE_H_ diff --git a/Source/3rd Party/wx/include/wx/meta/movable.h b/Source/3rd Party/wx/include/wx/meta/movable.h deleted file mode 100644 index 24617008d..000000000 --- a/Source/3rd Party/wx/include/wx/meta/movable.h +++ /dev/null @@ -1,45 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/meta/movable.h -// Purpose: Test if a type is movable using memmove() etc. -// Author: Vaclav Slavik -// Created: 2008-01-21 -// RCS-ID: $Id$ -// Copyright: (c) 2008 Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_META_MOVABLE_H_ -#define _WX_META_MOVABLE_H_ - -#include "wx/meta/pod.h" -#include "wx/string.h" // for wxIsMovable specialization - -// Helper to decide if an object of type T is "movable", i.e. if it can be -// copied to another memory location using memmove() or realloc() C functions. -// C++ only gurantees that POD types (including primitive types) are -// movable. -template -struct wxIsMovable -{ - wxDEFINE_TEMPLATE_BOOL_VALUE(wxIsPod::value); -}; - -// Macro to add wxIsMovable specialization for given type that marks it -// as movable: -#define WX_DECLARE_TYPE_MOVABLE(type) \ - template<> struct wxIsMovable \ - { \ - wxDEFINE_TEMPLATE_BOOL_VALUE(true); \ - }; - -// Our implementation of wxString is written in such way that it's safe to move -// it around (unless position cache is used which unfortunately breaks this). -// OTOH, we don't know anything about std::string. -// (NB: we don't put this into string.h and choose to include wx/string.h from -// here instead so that rarely-used wxIsMovable code isn't included by -// everything) -#if !wxUSE_STD_STRING && !wxUSE_STRING_POS_CACHE -WX_DECLARE_TYPE_MOVABLE(wxString) -#endif - -#endif // _WX_META_MOVABLE_H_ diff --git a/Source/3rd Party/wx/include/wx/meta/pod.h b/Source/3rd Party/wx/include/wx/meta/pod.h deleted file mode 100644 index 654517f9c..000000000 --- a/Source/3rd Party/wx/include/wx/meta/pod.h +++ /dev/null @@ -1,88 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/meta/pod.h -// Purpose: Test if a type is POD -// Author: Vaclav Slavik, Jaakko Salli -// Created: 2010-06-14 -// RCS-ID: $Id$ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_META_POD_H_ -#define _WX_META_POD_H_ - -#include "wx/defs.h" - -// -// TODO: Use TR1 is_pod<> implementation where available. VC9 SP1 has it -// in tr1 namespace, VC10 has it in std namespace. GCC 4.2 has it in -// , while GCC 4.3 and later have it in . -// - -// This macro declares something called "value" inside a class declaration. -// -// It has to be used because VC6 doesn't handle initialization of the static -// variables in the class declaration itself while BCC5.82 doesn't understand -// enums (it compiles the template fine but can't use it later) -#if defined(__VISUALC__) && !wxCHECK_VISUALC_VERSION(7) - #define wxDEFINE_TEMPLATE_BOOL_VALUE(val) enum { value = val } -#else - #define wxDEFINE_TEMPLATE_BOOL_VALUE(val) static const bool value = val -#endif - -// Helper to decide if an object of type T is POD (Plain Old Data) -template -struct wxIsPod -{ - wxDEFINE_TEMPLATE_BOOL_VALUE(false); -}; - -// Macro to add wxIsPod specialization for given type that marks it -// as Plain Old Data: -#define WX_DECLARE_TYPE_POD(type) \ - template<> struct wxIsPod \ - { \ - wxDEFINE_TEMPLATE_BOOL_VALUE(true); \ - }; - -WX_DECLARE_TYPE_POD(bool) -WX_DECLARE_TYPE_POD(unsigned char) -WX_DECLARE_TYPE_POD(signed char) -WX_DECLARE_TYPE_POD(unsigned int) -WX_DECLARE_TYPE_POD(signed int) -WX_DECLARE_TYPE_POD(unsigned short int) -WX_DECLARE_TYPE_POD(signed short int) -WX_DECLARE_TYPE_POD(signed long int) -WX_DECLARE_TYPE_POD(unsigned long int) -WX_DECLARE_TYPE_POD(float) -WX_DECLARE_TYPE_POD(double) -WX_DECLARE_TYPE_POD(long double) -#if wxWCHAR_T_IS_REAL_TYPE -WX_DECLARE_TYPE_POD(wchar_t) -#endif -#ifdef wxLongLong_t -WX_DECLARE_TYPE_POD(wxLongLong_t) -WX_DECLARE_TYPE_POD(wxULongLong_t) -#endif - -// Visual C++ 6.0 can't compile partial template specializations and as this is -// only an optimization, we can live with pointers not being recognized as -// POD types under VC6 -#if !defined(__VISUALC__) || wxCHECK_VISUALC_VERSION(7) - -// pointers are Plain Old Data: -template -struct wxIsPod -{ - static const bool value = true; -}; - -template -struct wxIsPod -{ - static const bool value = true; -}; - -#endif // !VC++ < 7 - -#endif // _WX_META_POD_H_ diff --git a/Source/3rd Party/wx/include/wx/metafile.h b/Source/3rd Party/wx/include/wx/metafile.h index 11505cb0f..7d92ab0f3 100644 --- a/Source/3rd Party/wx/include/wx/metafile.h +++ b/Source/3rd Party/wx/include/wx/metafile.h @@ -4,7 +4,7 @@ // Author: wxWidgets team // Modified by: // Created: 13.01.00 -// RCS-ID: $Id$ +// RCS-ID: $Id: metafile.h 39841 2006-06-26 14:37:34Z VZ $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -25,7 +25,11 @@ #if defined(__WXMSW__) #if wxUSE_ENH_METAFILE - #include "wx/msw/enhmeta.h" + #if defined(__WXPALMOS__) + #include "wx/palmos/enhmeta.h" + #else + #include "wx/msw/enhmeta.h" + #endif #if wxUSE_WIN_METAFILES_ALWAYS // use normal metafiles as well @@ -41,12 +45,16 @@ #define wxMETAFILE_IS_ENH #endif // wxUSE_WIN_METAFILES_ALWAYS #else // !wxUSE_ENH_METAFILE - #include "wx/msw/metafile.h" + #if defined(__WXPALMOS__) + #include "wx/palmos/metafile.h" + #else + #include "wx/msw/metafile.h" + #endif #endif #elif defined(__WXPM__) #include "wx/os2/metafile.h" #elif defined(__WXMAC__) - #include "wx/osx/metafile.h" + #include "wx/mac/metafile.h" #endif #endif // wxUSE_METAFILE diff --git a/Source/3rd Party/wx/include/wx/mimetype.h b/Source/3rd Party/wx/include/wx/mimetype.h index 921c53029..8baf854c1 100644 --- a/Source/3rd Party/wx/include/wx/mimetype.h +++ b/Source/3rd Party/wx/include/wx/mimetype.h @@ -5,7 +5,7 @@ // Modified by: // Chris Elliott (biol75@york.ac.uk) 5 Dec 00: write support for Win32 // Created: 23.09.98 -// RCS-ID: $Id$ +// RCS-ID: $Id: mimetype.h 61872 2009-09-09 22:37:05Z VZ $ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows licence (part of wxExtra library) ///////////////////////////////////////////////////////////////////////////// @@ -26,8 +26,6 @@ #include "wx/dynarray.h" #include "wx/arrstr.h" -#include - // fwd decls class WXDLLIMPEXP_FWD_BASE wxIconLocation; class WXDLLIMPEXP_FWD_BASE wxFileTypeImpl; @@ -118,107 +116,16 @@ private: class WXDLLIMPEXP_BASE wxFileTypeInfo { -private: - void DoVarArgInit(const wxString& mimeType, - const wxString& openCmd, - const wxString& printCmd, - const wxString& desc, - va_list argptr); - - void VarArgInit(const wxString *mimeType, - const wxString *openCmd, - const wxString *printCmd, - const wxString *desc, - // the other parameters form a NULL terminated list of - // extensions - ...); - public: - // NB: This is a helper to get implicit conversion of variadic ctor's - // fixed arguments into something that can be passed to VarArgInit(). - // Do not use, it's used by the ctor only. - struct CtorString - { - CtorString(const char *str) : m_str(str) {} - CtorString(const wchar_t *str) : m_str(str) {} - CtorString(const wxString& str) : m_str(str) {} - CtorString(const wxCStrData& str) : m_str(str) {} - CtorString(const wxScopedCharBuffer& str) : m_str(str) {} - CtorString(const wxScopedWCharBuffer& str) : m_str(str) {} - - operator const wxString*() const { return &m_str; } - - wxString m_str; - }; - // ctors - - // Ctor specifying just the MIME type (which is mandatory), the other - // fields can be set later if needed. - wxFileTypeInfo(const wxString& mimeType) - : m_mimeType(mimeType) - { - } - - // Ctor allowing to specify the values of all fields at once: - // - // wxFileTypeInfo(const wxString& mimeType, - // const wxString& openCmd, - // const wxString& printCmd, - // const wxString& desc, - // // the other parameters form a list of extensions for this - // // file type and should be terminated with wxNullPtr (not - // // just NULL!) - // ...); - WX_DEFINE_VARARG_FUNC_CTOR(wxFileTypeInfo, - 4, (const CtorString&, - const CtorString&, - const CtorString&, - const CtorString&), - VarArgInit, VarArgInit) -#ifdef __WATCOMC__ - // workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351 - WX_VARARG_WATCOM_WORKAROUND_CTOR( - wxFileTypeInfo, - 4, (const wxString&, - const wxString&, - const wxString&, - const wxString&), - (CtorString(f1), - CtorString(f2), - CtorString(f3), - CtorString(f4))); - WX_VARARG_WATCOM_WORKAROUND_CTOR( - wxFileTypeInfo, - 4, (const wxCStrData&, - const wxCStrData&, - const wxCStrData&, - const wxCStrData&), - (CtorString(f1), - CtorString(f2), - CtorString(f3), - CtorString(f4))); - WX_VARARG_WATCOM_WORKAROUND_CTOR( - wxFileTypeInfo, - 4, (const char*, - const char*, - const char*, - const char*), - (CtorString(f1), - CtorString(f2), - CtorString(f3), - CtorString(f4))); - WX_VARARG_WATCOM_WORKAROUND_CTOR( - wxFileTypeInfo, - 4, (const wchar_t*, - const wchar_t*, - const wchar_t*, - const wchar_t*), - (CtorString(f1), - CtorString(f2), - CtorString(f3), - CtorString(f4))); -#endif + // a normal item + wxFileTypeInfo(const wxChar *mimeType, + const wxChar *openCmd, + const wxChar *printCmd, + const wxChar *desc, + // the other parameters form a NULL terminated list of + // extensions + ...); // the array elements correspond to the parameters of the ctor above in // the same order @@ -232,16 +139,6 @@ public: bool IsValid() const { return !m_mimeType.empty(); } // setters - // set the open/print commands - void SetOpenCommand(const wxString& command) { m_openCmd = command; } - void SetPrintCommand(const wxString& command) { m_printCmd = command; } - - // set the description - void SetDescription(const wxString& desc) { m_desc = desc; } - - // add another extension corresponding to this file type - void AddExtension(const wxString& ext) { m_exts.push_back(ext); } - // set the icon info void SetIcon(const wxString& iconFile, int iconIndex = 0) { @@ -389,7 +286,7 @@ public: // operations // expand a string in the format of GetOpenCommand (which may contain - // '%s' and '%t' format specifiers for the file name and mime type + // '%s' and '%t' format specificators for the file name and mime type // and %{param} constructions). static wxString ExpandCommand(const wxString& command, const MessageParameters& params); @@ -428,7 +325,7 @@ public: static void Set( wxMimeTypesManagerFactory *factory ); static wxMimeTypesManagerFactory *Get(); - + private: static wxMimeTypesManagerFactory *m_factory; }; @@ -479,13 +376,32 @@ public: // get file type from MIME type (in format /) wxFileType *GetFileTypeFromMimeType(const wxString& mimeType); + // other operations: return true if there were no errors or false if there + // were some unrecognized entries (the good entries are always read anyhow) + // + // FIXME: These ought to be private ?? + + // read in additional file (the standard ones are read automatically) + // in mailcap format (see mimetype.cpp for description) + // + // 'fallback' parameter may be set to true to avoid overriding the + // settings from other, previously parsed, files by this one: normally, + // the files read most recently would override the older files, but with + // fallback == true this won't happen + + bool ReadMailcap(const wxString& filename, bool fallback = false); + // read in additional file in mime.types format + bool ReadMimeTypes(const wxString& filename); + // enumerate all known MIME types // // returns the number of retrieved file types size_t EnumAllFileTypes(wxArrayString& mimetypes); // these functions can be used to provide default values for some of the - // MIME types inside the program itself + // MIME types inside the program itself (you may also use + // ReadMailcap(filenameWithDefaultTypes, true /* use as fallback */) to + // achieve the same goal, but this requires having this info in a file). // // The filetypes array should be terminated by either NULL entry or an // invalid wxFileTypeInfo (i.e. the one created with default ctor) diff --git a/Source/3rd Party/wx/include/wx/minifram.h b/Source/3rd Party/wx/include/wx/minifram.h index 3d0187b47..50df6006a 100644 --- a/Source/3rd Party/wx/include/wx/minifram.h +++ b/Source/3rd Party/wx/include/wx/minifram.h @@ -5,7 +5,7 @@ // Modified by: // Created: // Copyright: (c) Julian Smart -// RCS-ID: $Id$ +// RCS-ID: $Id: minifram.h 49299 2007-10-21 18:07:29Z PC $ // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// @@ -16,7 +16,9 @@ #if wxUSE_MINIFRAME -#if defined(__WXMSW__) +#if defined(__WXPALMOS__) +#include "wx/palmos/minifram.h" +#elif defined(__WXMSW__) #include "wx/msw/minifram.h" #elif defined(__WXMOTIF__) #include "wx/motif/minifram.h" @@ -27,7 +29,7 @@ #elif defined(__WXX11__) #include "wx/x11/minifram.h" #elif defined(__WXMAC__) -#include "wx/osx/minifram.h" +#include "wx/mac/minifram.h" #elif defined(__WXPM__) #include "wx/os2/minifram.h" #else diff --git a/Source/3rd Party/wx/include/wx/module.h b/Source/3rd Party/wx/include/wx/module.h index c1190c74c..7cee6f226 100644 --- a/Source/3rd Party/wx/include/wx/module.h +++ b/Source/3rd Party/wx/include/wx/module.h @@ -4,7 +4,7 @@ // Author: Wolfram Gloger/adapted by Guilhem Lavaux // Modified by: // Created: 04/11/98 -// RCS-ID: $Id$ +// RCS-ID: $Id: module.h 61872 2009-09-09 22:37:05Z VZ $ // Copyright: (c) Wolfram Gloger and Guilhem Lavaux // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -14,7 +14,6 @@ #include "wx/object.h" #include "wx/list.h" -#include "wx/arrstr.h" #include "wx/dynarray.h" // declare a linked list of modules @@ -74,14 +73,6 @@ protected: m_dependencies.Add(dep); } - // same as the version above except it will look up wxClassInfo by name on - // its own - void AddDependency(const char *className) - { - m_namedDependencies.Add(className); - } - - private: // initialize module and Append it to initializedModules list recursively // calling itself to satisfy module dependencies if needed @@ -93,19 +84,11 @@ private: // could be initialized) and also empty m_modules itself static void DoCleanUpModules(const wxModuleList& modules); - // resolve all named dependencies and add them to the normal m_dependencies - bool ResolveNamedDependencies(); - - // module dependencies: contains wxClassInfo pointers for all modules which - // must be initialized before this one + // module dependencies: contains wxArrayClassInfo m_dependencies; - // and the named dependencies: those will be resolved during run-time and - // added to m_dependencies - wxArrayString m_namedDependencies; - - // used internally while initializing/cleaning up modules + // used internally while initiliazing/cleaning up modules enum { State_Registered, // module registered but not initialized yet diff --git a/Source/3rd Party/wx/include/wx/mousemanager.h b/Source/3rd Party/wx/include/wx/mousemanager.h deleted file mode 100644 index b17da8820..000000000 --- a/Source/3rd Party/wx/include/wx/mousemanager.h +++ /dev/null @@ -1,154 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/mousemanager.h -// Purpose: wxMouseEventsManager class declaration -// Author: Vadim Zeitlin -// Created: 2009-04-20 -// RCS-ID: $Id$ -// Copyright: (c) 2009 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MOUSEMANAGER_H_ -#define _WX_MOUSEMANAGER_H_ - -#include "wx/event.h" - -// ---------------------------------------------------------------------------- -// wxMouseEventsManager -// ---------------------------------------------------------------------------- - -/* - This class handles mouse events and synthesizes high-level notifications - such as clicks and drag events from low level mouse button presses and - mouse movement events. It is useful because handling the mouse events is - less obvious than might seem at a first glance: for example, clicks on an - object should only be generated if the mouse was both pressed and released - over it and not just released (so it requires storing the previous state) - and dragging shouldn't start before the mouse moves away far enough. - - This class encapsulates all these dull details for controls containing - multiple items which can be identified by a positive integer index and you - just need to implement its pure virtual functions to use it. - */ -class WXDLLIMPEXP_CORE wxMouseEventsManager : public wxEvtHandler -{ -public: - // a mouse event manager is always associated with a window and must be - // deleted by the window when it is destroyed so if it is created using the - // default ctor Create() must be called later - wxMouseEventsManager() { Init(); } - wxMouseEventsManager(wxWindow *win) { Init(); Create(win); } - bool Create(wxWindow *win); - - virtual ~wxMouseEventsManager(); - -protected: - // called to find the item at the given position: return wxNOT_FOUND (-1) - // if there is no item here - virtual int MouseHitTest(const wxPoint& pos) = 0; - - // called when the user clicked (i.e. pressed and released mouse over the - // same item), should normally generate a notification about this click and - // return true if it was handled or false otherwise, determining whether - // the original mouse event is skipped or not - virtual bool MouseClicked(int item) = 0; - - // called to start dragging the given item, should generate the appropriate - // BEGIN_DRAG event and return false if dragging this item was forbidden - virtual bool MouseDragBegin(int item, const wxPoint& pos) = 0; - - // called while the item is being dragged, should normally update the - // feedback on screen (usually using wxOverlay) - virtual void MouseDragging(int item, const wxPoint& pos) = 0; - - // called when the mouse is released after dragging the item - virtual void MouseDragEnd(int item, const wxPoint& pos) = 0; - - // called when mouse capture is lost while dragging the item, should remove - // the visual feedback drawn by MouseDragging() - virtual void MouseDragCancelled(int item) = 0; - - - // you don't need to override those but you will want to do if it your - // control renders pressed items differently - - // called when the item is becomes pressed, can be used to change its - // appearance - virtual void MouseClickBegin(int WXUNUSED(item)) { } - - // called if the mouse capture was lost while the item was pressed, can be - // used to restore the default item appearance if it was changed in - // MouseClickBegin() - virtual void MouseClickCancelled(int WXUNUSED(item)) { } - -private: - /* - Here is a small diagram explaining the switches between different - states: - - - /---------->NORMAL<--------------- Drag end - / / / | event - / / | | ^ - / / | | | - Click / N | | mouse | mouse up - event / | | down | - | / | | DRAGGING - | / | | ^ - Y|/ N \ v |Y - +-------------+ +--------+ N +-----------+ - |On same item?| |On item?| -----------|Begin drag?| - +-------------+ +--------+ / +-----------+ - ^ | / ^ - | | / | - \ mouse | / mouse moved | - \ up v v far enough / - \--------PRESSED-------------------/ - - - There are also transitions from PRESSED and DRAGGING to NORMAL in case - the mouse capture is lost or Escape key is pressed which are not shown. - */ - enum State - { - State_Normal, // initial, default state - State_Pressed, // mouse was pressed over an item - State_Dragging // the item is being dragged - }; - - // common part of both ctors - void Init(); - - // various event handlers - void OnCaptureLost(wxMouseCaptureLostEvent& event); - void OnLeftDown(wxMouseEvent& event); - void OnLeftUp(wxMouseEvent& event); - void OnMove(wxMouseEvent& event); - - - // the associated window, never NULL except between the calls to the - // default ctor and Create() - wxWindow *m_win; - - // the current state - State m_state; - - // the details of the operation currently in progress, only valid if - // m_state is not normal - - // the item being pressed or dragged (always valid, i.e. != wxNOT_FOUND if - // m_state != State_Normal) - int m_item; - - // the position of the last mouse event of interest: either mouse press in - // State_Pressed or last movement event in State_Dragging - wxPoint m_posLast; - - - DECLARE_EVENT_TABLE() - - wxDECLARE_NO_COPY_CLASS(wxMouseEventsManager); -}; - -#endif // _WX_MOUSEMANAGER_H_ - diff --git a/Source/3rd Party/wx/include/wx/mousestate.h b/Source/3rd Party/wx/include/wx/mousestate.h deleted file mode 100644 index 10b1f9320..000000000 --- a/Source/3rd Party/wx/include/wx/mousestate.h +++ /dev/null @@ -1,152 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/mousestate.h -// Purpose: Declaration of wxMouseState class -// Author: Vadim Zeitlin -// Created: 2008-09-19 (extracted from wx/utils.h) -// RCS-ID: $Id$ -// Copyright: (c) 2008 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MOUSESTATE_H_ -#define _WX_MOUSESTATE_H_ - -#include "wx/gdicmn.h" // for wxPoint -#include "wx/kbdstate.h" - -// the symbolic names for the mouse buttons -enum wxMouseButton -{ - wxMOUSE_BTN_ANY = -1, - wxMOUSE_BTN_NONE = 0, - wxMOUSE_BTN_LEFT = 1, - wxMOUSE_BTN_MIDDLE = 2, - wxMOUSE_BTN_RIGHT = 3, - wxMOUSE_BTN_AUX1 = 4, - wxMOUSE_BTN_AUX2 = 5, - wxMOUSE_BTN_MAX -}; - -// ---------------------------------------------------------------------------- -// wxMouseState contains the information about mouse position, buttons and also -// key modifiers -// ---------------------------------------------------------------------------- - -// wxMouseState is used to hold information about button and modifier state -// and is what is returned from wxGetMouseState. -class WXDLLIMPEXP_CORE wxMouseState : public wxKeyboardState -{ -public: - wxMouseState() - : m_leftDown(false), m_middleDown(false), m_rightDown(false), - m_aux1Down(false), m_aux2Down(false), - m_x(0), m_y(0) - { - } - - // default copy ctor, assignment operator and dtor are ok - - - // accessors for the mouse position - wxCoord GetX() const { return m_x; } - wxCoord GetY() const { return m_y; } - wxPoint GetPosition() const { return wxPoint(m_x, m_y); } - void GetPosition(wxCoord *x, wxCoord *y) const - { - if ( x ) - *x = m_x; - if ( y ) - *y = m_y; - } - - // this overload is for compatibility only - void GetPosition(long *x, long *y) const - { - if ( x ) - *x = m_x; - if ( y ) - *y = m_y; - } - - // accessors for the pressed buttons - bool LeftIsDown() const { return m_leftDown; } - bool MiddleIsDown() const { return m_middleDown; } - bool RightIsDown() const { return m_rightDown; } - bool Aux1IsDown() const { return m_aux1Down; } - bool Aux2IsDown() const { return m_aux2Down; } - - bool ButtonIsDown(wxMouseButton but) const - { - switch ( but ) - { - case wxMOUSE_BTN_ANY: - return LeftIsDown() || MiddleIsDown() || RightIsDown() || - Aux1IsDown() || Aux2IsDown(); - - case wxMOUSE_BTN_LEFT: - return LeftIsDown(); - - case wxMOUSE_BTN_MIDDLE: - return MiddleIsDown(); - - case wxMOUSE_BTN_RIGHT: - return RightIsDown(); - - case wxMOUSE_BTN_AUX1: - return Aux1IsDown(); - - case wxMOUSE_BTN_AUX2: - return Aux2IsDown(); - - case wxMOUSE_BTN_NONE: - case wxMOUSE_BTN_MAX: - wxFAIL_MSG(wxS("invalid parameter")); - return false; - - default: - wxFAIL_MSG(wxS("unknown parameter")); - return false; - } - } - - - // these functions are mostly used by wxWidgets itself - void SetX(wxCoord x) { m_x = x; } - void SetY(wxCoord y) { m_y = y; } - void SetPosition(wxPoint pos) { m_x = pos.x, m_y = pos.y; } - - void SetLeftDown(bool down) { m_leftDown = down; } - void SetMiddleDown(bool down) { m_middleDown = down; } - void SetRightDown(bool down) { m_rightDown = down; } - void SetAux1Down(bool down) { m_aux1Down = down; } - void SetAux2Down(bool down) { m_aux2Down = down; } - - // this mostly makes sense in the derived classes such as wxMouseEvent - void SetState(const wxMouseState& state) { *this = state; } - - // these functions are for compatibility only, they were used in 2.8 - // version of wxMouseState but their names are confusing as wxMouseEvent - // has methods with the same names which do something quite different so - // don't use them any more -#if WXWIN_COMPATIBILITY_2_8 - wxDEPRECATED_INLINE(bool LeftDown() const, return LeftIsDown(); ) - wxDEPRECATED_INLINE(bool MiddleDown() const, return MiddleIsDown(); ) - wxDEPRECATED_INLINE(bool RightDown() const, return RightIsDown(); ) -#endif // WXWIN_COMPATIBILITY_2_8 - - // for compatibility reasons these variables are public as the code using - // wxMouseEvent often uses them directly -- however they should not be - // accessed directly in this class, use the accessors above instead -// private: - bool m_leftDown : 1; - bool m_middleDown : 1; - bool m_rightDown : 1; - bool m_aux1Down : 1; - bool m_aux2Down : 1; - - wxCoord m_x, - m_y; -}; - -#endif // _WX_MOUSESTATE_H_ - diff --git a/Source/3rd Party/wx/include/wx/msgdlg.h b/Source/3rd Party/wx/include/wx/msgdlg.h index db1932f94..dabea34f9 100644 --- a/Source/3rd Party/wx/include/wx/msgdlg.h +++ b/Source/3rd Party/wx/include/wx/msgdlg.h @@ -1,10 +1,10 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/msgdlg.h +// Name: wx/msgdlgg.h // Purpose: common header and base class for wxMessageDialog // Author: Julian Smart // Modified by: // Created: -// RCS-ID: $Id$ +// RCS-ID: $Id: msgdlg.h 61872 2009-09-09 22:37:05Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -16,297 +16,58 @@ #if wxUSE_MSGDLG -#include "wx/dialog.h" -#include "wx/stockitem.h" - -extern WXDLLIMPEXP_DATA_CORE(const char) wxMessageBoxCaptionStr[]; - -// ---------------------------------------------------------------------------- -// wxMessageDialogBase: base class defining wxMessageDialog interface -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxMessageDialogBase : public wxDialog +class WXDLLEXPORT wxMessageDialogBase { -public: - // helper class for SetXXXLabels() methods: it makes it possible to pass - // either a stock id (wxID_CLOSE) or a string ("&Close") to them - class ButtonLabel - { - public: - // ctors are not explicit, objects of this class can be implicitly - // constructed from either stock ids or strings - ButtonLabel(int stockId) - : m_stockId(stockId) - { - wxASSERT_MSG( wxIsStockID(stockId), "invalid stock id" ); - } - - ButtonLabel(const wxString& label) - : m_label(label), m_stockId(wxID_NONE) - { - } - - ButtonLabel(const char *label) - : m_label(label), m_stockId(wxID_NONE) - { - } - - ButtonLabel(const wchar_t *label) - : m_label(label), m_stockId(wxID_NONE) - { - } - - ButtonLabel(const wxCStrData& label) - : m_label(label), m_stockId(wxID_NONE) - { - } - - // default copy ctor and dtor are ok - - // get the string label, whether it was originally specified directly - // or as a stock id -- this is only useful for platforms without native - // stock items id support - wxString GetAsString() const - { - return m_stockId == wxID_NONE - ? m_label - : wxGetStockLabel(m_stockId, wxSTOCK_FOR_BUTTON); - } - - // return the stock id or wxID_NONE if this is not a stock label - int GetStockId() const { return m_stockId; } - - private: - // the label if explicitly given or empty if this is a stock item - const wxString m_label; - - // the stock item id or wxID_NONE if m_label should be used - const int m_stockId; - }; - - // ctors - wxMessageDialogBase() { m_dialogStyle = 0; } - wxMessageDialogBase(wxWindow *parent, - const wxString& message, - const wxString& caption, - long style) - : m_message(message), - m_caption(caption) - { - m_parent = parent; - SetMessageDialogStyle(style); - } - - // virtual dtor for the base class - virtual ~wxMessageDialogBase() { } - - wxString GetCaption() const { return m_caption; } - - virtual void SetMessage(const wxString& message) - { - m_message = message; - } - - wxString GetMessage() const { return m_message; } - - void SetExtendedMessage(const wxString& extendedMessage) - { - m_extendedMessage = extendedMessage; - } - - wxString GetExtendedMessage() const { return m_extendedMessage; } - - // change the dialog style flag +protected: + // common validation of wxMessageDialog style void SetMessageDialogStyle(long style) { - wxASSERT_MSG( ((style & wxYES_NO) == wxYES_NO) || !(style & wxYES_NO), - "wxYES and wxNO may only be used together" ); - - wxASSERT_MSG( !(style & wxYES) || !(style & wxOK), - "wxOK and wxYES/wxNO can't be used together" ); - - wxASSERT_MSG( (style & wxYES) || (style & wxOK), - "one of wxOK and wxYES/wxNO must be used" ); + wxASSERT_MSG( ((style & wxYES_NO) == wxYES_NO) || ((style & wxYES_NO) == 0), + wxT("wxYES and wxNO may only be used together in wxMessageDialog") ); wxASSERT_MSG( (style & wxID_OK) != wxID_OK, - "wxMessageBox: Did you mean wxOK (and not wxID_OK)?" ); - - wxASSERT_MSG( !(style & wxNO_DEFAULT) || (style & wxNO), - "wxNO_DEFAULT is invalid without wxNO" ); - - wxASSERT_MSG( !(style & wxCANCEL_DEFAULT) || (style & wxCANCEL), - "wxCANCEL_DEFAULT is invalid without wxCANCEL" ); - - wxASSERT_MSG( !(style & wxCANCEL_DEFAULT) || !(style & wxNO_DEFAULT), - "only one default button can be specified" ); + wxT("wxMessageBox: Did you mean wxOK (and not wxID_OK)?") ); m_dialogStyle = style; } - - long GetMessageDialogStyle() const { return m_dialogStyle; } - - // customization of the message box buttons - virtual bool SetYesNoLabels(const ButtonLabel& yes,const ButtonLabel& no) + inline long GetMessageDialogStyle() const { - DoSetCustomLabel(m_yes, yes); - DoSetCustomLabel(m_no, no); - return true; + return m_dialogStyle; } - virtual bool SetYesNoCancelLabels(const ButtonLabel& yes, - const ButtonLabel& no, - const ButtonLabel& cancel) - { - DoSetCustomLabel(m_yes, yes); - DoSetCustomLabel(m_no, no); - DoSetCustomLabel(m_cancel, cancel); - return true; - } - - virtual bool SetOKLabel(const ButtonLabel& ok) - { - DoSetCustomLabel(m_ok, ok); - return true; - } - - virtual bool SetOKCancelLabels(const ButtonLabel& ok, - const ButtonLabel& cancel) - { - DoSetCustomLabel(m_ok, ok); - DoSetCustomLabel(m_cancel, cancel); - return true; - } - - virtual bool SetHelpLabel(const ButtonLabel& help) - { - DoSetCustomLabel(m_help, help); - return true; - } - - // test if any custom labels were set - bool HasCustomLabels() const - { - return !(m_ok.empty() && m_cancel.empty() && m_help.empty() && - m_yes.empty() && m_no.empty()); - } - - // these functions return the label to be used for the button which is - // either a custom label explicitly set by the user or the default label, - // i.e. they always return a valid string - wxString GetYesLabel() const - { return m_yes.empty() ? GetDefaultYesLabel() : m_yes; } - wxString GetNoLabel() const - { return m_no.empty() ? GetDefaultNoLabel() : m_no; } - wxString GetOKLabel() const - { return m_ok.empty() ? GetDefaultOKLabel() : m_ok; } - wxString GetCancelLabel() const - { return m_cancel.empty() ? GetDefaultCancelLabel() : m_cancel; } - wxString GetHelpLabel() const - { return m_help.empty() ? GetDefaultHelpLabel() : m_help; } - - // based on message dialog style, returns exactly one of: wxICON_NONE, - // wxICON_ERROR, wxICON_WARNING, wxICON_QUESTION, wxICON_INFORMATION - long GetEffectiveIcon() const - { - if ( m_dialogStyle & wxICON_NONE ) - return wxICON_NONE; - else if ( m_dialogStyle & wxICON_ERROR ) - return wxICON_ERROR; - else if ( m_dialogStyle & wxICON_WARNING ) - return wxICON_WARNING; - else if ( m_dialogStyle & wxICON_QUESTION ) - return wxICON_QUESTION; - else if ( m_dialogStyle & wxICON_INFORMATION ) - return wxICON_INFORMATION; - else if ( m_dialogStyle & wxYES ) - return wxICON_QUESTION; - else - return wxICON_INFORMATION; - } - -protected: - // for the platforms not supporting separate main and extended messages - // this function should be used to combine both of them in a single string - wxString GetFullMessage() const - { - wxString msg = m_message; - if ( !m_extendedMessage.empty() ) - msg << "\n\n" << m_extendedMessage; - - return msg; - } - - wxString m_message, - m_extendedMessage, - m_caption; - long m_dialogStyle; - - // this function is called by our public SetXXXLabels() and should assign - // the value to var with possibly some transformation (e.g. Cocoa version - // currently uses this to remove any accelerators from the button strings - // while GTK+ one handles stock items specifically here) - virtual void DoSetCustomLabel(wxString& var, const ButtonLabel& label) - { - var = label.GetAsString(); - } - - // these functions return the custom label or empty string and should be - // used only in specific circumstances such as creating the buttons with - // these labels (in which case it makes sense to only use a custom label if - // it was really given and fall back on stock label otherwise), use the - // Get{Yes,No,OK,Cancel}Label() methods above otherwise - const wxString& GetCustomYesLabel() const { return m_yes; } - const wxString& GetCustomNoLabel() const { return m_no; } - const wxString& GetCustomOKLabel() const { return m_ok; } - const wxString& GetCustomHelpLabel() const { return m_help; } - const wxString& GetCustomCancelLabel() const { return m_cancel; } - private: - // these functions may be overridden to provide different defaults for the - // default button labels (this is used by wxGTK) - virtual wxString GetDefaultYesLabel() const { return wxGetTranslation("Yes"); } - virtual wxString GetDefaultNoLabel() const { return wxGetTranslation("No"); } - virtual wxString GetDefaultOKLabel() const { return wxGetTranslation("OK"); } - virtual wxString GetDefaultCancelLabel() const { return wxGetTranslation("Cancel"); } - virtual wxString GetDefaultHelpLabel() const { return wxGetTranslation("Help"); } - - // labels for the buttons, initially empty meaning that the defaults should - // be used, use GetYes/No/OK/CancelLabel() to access them - wxString m_yes, - m_no, - m_ok, - m_cancel, - m_help; - - wxDECLARE_NO_COPY_CLASS(wxMessageDialogBase); + long m_dialogStyle; }; +#if defined(__WX_COMPILING_MSGDLGG_CPP__) #include "wx/generic/msgdlgg.h" - -#if defined(__WX_COMPILING_MSGDLGG_CPP__) || \ - defined(__WXUNIVERSAL__) || defined(__WXGPE__) || \ - (defined(__WXGTK__) && !defined(__WXGTK20__)) - - #define wxMessageDialog wxGenericMessageDialog -#elif defined(__WXCOCOA__) - #include "wx/cocoa/msgdlg.h" +#elif defined(__WXUNIVERSAL__) || defined(__WXGPE__) +#include "wx/generic/msgdlgg.h" +#elif defined(__WXPALMOS__) +#include "wx/palmos/msgdlg.h" #elif defined(__WXMSW__) - #include "wx/msw/msgdlg.h" +#include "wx/msw/msgdlg.h" #elif defined(__WXMOTIF__) - #include "wx/motif/msgdlg.h" +#include "wx/motif/msgdlg.h" #elif defined(__WXGTK20__) - #include "wx/gtk/msgdlg.h" +#include "wx/gtk/msgdlg.h" +#elif defined(__WXGTK__) +#include "wx/generic/msgdlgg.h" +#elif defined(__WXGTK__) +#include "wx/generic/msgdlgg.h" #elif defined(__WXMAC__) - #include "wx/osx/msgdlg.h" +#include "wx/mac/msgdlg.h" +#elif defined(__WXCOCOA__) +#include "wx/cocoa/msgdlg.h" #elif defined(__WXPM__) - #include "wx/os2/msgdlg.h" +#include "wx/os2/msgdlg.h" #endif // ---------------------------------------------------------------------------- // wxMessageBox: the simplest way to use wxMessageDialog // ---------------------------------------------------------------------------- -int WXDLLIMPEXP_CORE wxMessageBox(const wxString& message, +int WXDLLEXPORT wxMessageBox(const wxString& message, const wxString& caption = wxMessageBoxCaptionStr, long style = wxOK | wxCENTRE, wxWindow *parent = NULL, @@ -314,4 +75,5 @@ int WXDLLIMPEXP_CORE wxMessageBox(const wxString& message, #endif // wxUSE_MSGDLG -#endif // _WX_MSGDLG_H_BASE_ +#endif + // _WX_MSGDLG_H_BASE_ diff --git a/Source/3rd Party/wx/include/wx/msgout.h b/Source/3rd Party/wx/include/wx/msgout.h index c5e011aa6..63803bfa3 100644 --- a/Source/3rd Party/wx/include/wx/msgout.h +++ b/Source/3rd Party/wx/include/wx/msgout.h @@ -4,7 +4,7 @@ // Author: Mattia Barbon // Modified by: // Created: 17.07.02 -// RCS-ID: $Id$ +// RCS-ID: $Id: msgout.h 35690 2005-09-25 20:23:30Z VZ $ // Copyright: (c) Mattia Barbon // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -17,67 +17,21 @@ // ---------------------------------------------------------------------------- #include "wx/defs.h" -#include "wx/chartype.h" -#include "wx/strvararg.h" +#include "wx/wxchar.h" // ---------------------------------------------------------------------------- // wxMessageOutput is a class abstracting formatted output target, i.e. // something you can printf() to // ---------------------------------------------------------------------------- -// NB: VC6 has a bug that causes linker errors if you have template methods -// in a class using __declspec(dllimport). The solution is to split such -// class into two classes, one that contains the template methods and does -// *not* use WXDLLIMPEXP_BASE and another class that contains the rest -// (with DLL linkage). -class wxMessageOutputBase -{ -public: - virtual ~wxMessageOutputBase() { } - - // show a message to the user - // void Printf(const wxString& format, ...) = 0; - WX_DEFINE_VARARG_FUNC_VOID(Printf, 1, (const wxFormatString&), - DoPrintfWchar, DoPrintfUtf8) -#ifdef __WATCOMC__ - // workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351 - WX_VARARG_WATCOM_WORKAROUND(void, Printf, 1, (const wxString&), - (wxFormatString(f1))); - WX_VARARG_WATCOM_WORKAROUND(void, Printf, 1, (const wxCStrData&), - (wxFormatString(f1))); - WX_VARARG_WATCOM_WORKAROUND(void, Printf, 1, (const char*), - (wxFormatString(f1))); - WX_VARARG_WATCOM_WORKAROUND(void, Printf, 1, (const wchar_t*), - (wxFormatString(f1))); -#endif - - // called by DoPrintf() to output formatted string but can also be called - // directly if no formatting is needed - virtual void Output(const wxString& str) = 0; - -protected: - // NB: this is pure virtual so that it can be implemented in dllexported - // wxMessagOutput class -#if !wxUSE_UTF8_LOCALE_ONLY - virtual void DoPrintfWchar(const wxChar *format, ...) = 0; -#endif -#if wxUSE_UNICODE_UTF8 - virtual void DoPrintfUtf8(const char *format, ...) = 0; -#endif -}; - -#ifdef __VISUALC__ - // "non dll-interface class 'wxStringPrintfMixin' used as base interface - // for dll-interface class 'wxString'" -- this is OK in our case - #pragma warning (push) - #pragma warning (disable:4275) -#endif - -class WXDLLIMPEXP_BASE wxMessageOutput : public wxMessageOutputBase +class WXDLLIMPEXP_BASE wxMessageOutput { public: virtual ~wxMessageOutput() { } + // show a message to the user + virtual void Printf(const wxChar* format, ...) ATTRIBUTE_PRINTF_2 = 0; + // gets the current wxMessageOutput object (may be NULL during // initialization or shutdown) static wxMessageOutput* Get(); @@ -85,90 +39,62 @@ public: // sets the global wxMessageOutput instance; returns the previous one static wxMessageOutput* Set(wxMessageOutput* msgout); -protected: -#if !wxUSE_UTF8_LOCALE_ONLY - virtual void DoPrintfWchar(const wxChar *format, ...); -#endif -#if wxUSE_UNICODE_UTF8 - virtual void DoPrintfUtf8(const char *format, ...); -#endif - private: static wxMessageOutput* ms_msgOut; }; -#ifdef __VISUALC__ - #pragma warning (pop) -#endif +// ---------------------------------------------------------------------------- +// implementation showing the message to the user in "best" possible way: uses +// native message box if available (currently only under Windows) and stderr +// otherwise; unlike wxMessageOutputMessageBox this class is always safe to use +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxMessageOutputBest : public wxMessageOutput +{ +public: + wxMessageOutputBest() { } + + virtual void Printf(const wxChar* format, ...) ATTRIBUTE_PRINTF_2; +}; // ---------------------------------------------------------------------------- -// implementation which sends output to stderr or specified file +// implementation which sends output to stderr // ---------------------------------------------------------------------------- class WXDLLIMPEXP_BASE wxMessageOutputStderr : public wxMessageOutput { public: - wxMessageOutputStderr(FILE *fp = stderr) : m_fp(fp) { } + wxMessageOutputStderr() { } - virtual void Output(const wxString& str); - -protected: - // return the string with "\n" appended if it doesn't already terminate - // with it (in which case it's returned unchanged) - wxString AppendLineFeedIfNeeded(const wxString& str); - - FILE *m_fp; -}; - -// ---------------------------------------------------------------------------- -// implementation showing the message to the user in "best" possible way: -// uses stderr or message box if available according to the flag given to ctor. -// ---------------------------------------------------------------------------- - -enum wxMessageOutputFlags -{ - wxMSGOUT_PREFER_STDERR = 0, // use stderr if available (this is the default) - wxMSGOUT_PREFER_MSGBOX = 1 // always use message box if available -}; - -class WXDLLIMPEXP_BASE wxMessageOutputBest : public wxMessageOutputStderr -{ -public: - wxMessageOutputBest(wxMessageOutputFlags flags = wxMSGOUT_PREFER_STDERR) - : m_flags(flags) { } - - virtual void Output(const wxString& str); - -private: - wxMessageOutputFlags m_flags; + virtual void Printf(const wxChar* format, ...) ATTRIBUTE_PRINTF_2; }; // ---------------------------------------------------------------------------- // implementation which shows output in a message box // ---------------------------------------------------------------------------- -#if wxUSE_GUI && wxUSE_MSGDLG +#if wxUSE_GUI class WXDLLIMPEXP_CORE wxMessageOutputMessageBox : public wxMessageOutput { public: wxMessageOutputMessageBox() { } - virtual void Output(const wxString& str); + virtual void Printf(const wxChar* format, ...) ATTRIBUTE_PRINTF_2; }; -#endif // wxUSE_GUI && wxUSE_MSGDLG +#endif // wxUSE_GUI // ---------------------------------------------------------------------------- // implementation using the native way of outputting debug messages // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_BASE wxMessageOutputDebug : public wxMessageOutputStderr +class WXDLLIMPEXP_BASE wxMessageOutputDebug : public wxMessageOutput { public: wxMessageOutputDebug() { } - virtual void Output(const wxString& str); + virtual void Printf(const wxChar* format, ...) ATTRIBUTE_PRINTF_2; }; // ---------------------------------------------------------------------------- @@ -180,7 +106,8 @@ class WXDLLIMPEXP_BASE wxMessageOutputLog : public wxMessageOutput public: wxMessageOutputLog() { } - virtual void Output(const wxString& str); + virtual void Printf(const wxChar* format, ...) ATTRIBUTE_PRINTF_2; }; -#endif // _WX_MSGOUT_H_ +#endif + // _WX_MSGOUT_H_ diff --git a/Source/3rd Party/wx/include/wx/mstream.h b/Source/3rd Party/wx/include/wx/mstream.h index a621f918f..a81452284 100644 --- a/Source/3rd Party/wx/include/wx/mstream.h +++ b/Source/3rd Party/wx/include/wx/mstream.h @@ -4,7 +4,7 @@ // Author: Guilhem Lavaux // Modified by: // Created: 11/07/98 -// RCS-ID: $Id$ +// RCS-ID: $Id: mstream.h 53135 2008-04-12 02:31:04Z VZ $ // Copyright: (c) Guilhem Lavaux // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -25,23 +25,11 @@ class WXDLLIMPEXP_BASE wxMemoryInputStream : public wxInputStream public: wxMemoryInputStream(const void *data, size_t length); wxMemoryInputStream(const wxMemoryOutputStream& stream); - wxMemoryInputStream(wxInputStream& stream, - wxFileOffset lenFile = wxInvalidOffset) - { - InitFromStream(stream, lenFile); - } - wxMemoryInputStream(wxMemoryInputStream& stream) - : wxInputStream() - { - InitFromStream(stream, wxInvalidOffset); - } - virtual ~wxMemoryInputStream(); virtual wxFileOffset GetLength() const { return m_length; } virtual bool IsSeekable() const { return true; } - virtual char Peek(); - virtual bool CanRead() const; + char Peek(); wxStreamBuffer *GetInputStreamBuffer() const { return m_i_streambuf; } @@ -58,14 +46,9 @@ protected: wxFileOffset OnSysTell() const; private: - // common part of ctors taking wxInputStream - void InitFromStream(wxInputStream& stream, wxFileOffset lenFile); - size_t m_length; - // copy ctor is implemented above: it copies the other stream in this one - DECLARE_ABSTRACT_CLASS(wxMemoryInputStream) - wxDECLARE_NO_ASSIGN_CLASS(wxMemoryInputStream); + DECLARE_NO_COPY_CLASS(wxMemoryInputStream) }; class WXDLLIMPEXP_BASE wxMemoryOutputStream : public wxOutputStream @@ -94,8 +77,7 @@ protected: wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode); wxFileOffset OnSysTell() const; - DECLARE_DYNAMIC_CLASS(wxMemoryOutputStream) - wxDECLARE_NO_COPY_CLASS(wxMemoryOutputStream); + DECLARE_NO_COPY_CLASS(wxMemoryOutputStream) }; #if WXWIN_COMPATIBILITY_2_6 diff --git a/Source/3rd Party/wx/include/wx/msw/accel.h b/Source/3rd Party/wx/include/wx/msw/accel.h index 2efa206e6..705146894 100644 --- a/Source/3rd Party/wx/include/wx/msw/accel.h +++ b/Source/3rd Party/wx/include/wx/msw/accel.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 31/7/98 -// RCS-ID: $Id$ +// RCS-ID: $Id: accel.h 53135 2008-04-12 02:31:04Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -18,7 +18,7 @@ class WXDLLIMPEXP_FWD_CORE wxWindow; // the accel table has all accelerators for a given window or menu // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxAcceleratorTable : public wxObject +class WXDLLEXPORT wxAcceleratorTable : public wxObject { public: // default ctor diff --git a/Source/3rd Party/wx/include/wx/msw/anybutton.h b/Source/3rd Party/wx/include/wx/msw/anybutton.h deleted file mode 100644 index bea368f6f..000000000 --- a/Source/3rd Party/wx/include/wx/msw/anybutton.h +++ /dev/null @@ -1,81 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/anybutton.h -// Purpose: wxAnyButton class -// Author: Julian Smart -// Created: 1997-02-01 (extracted from button.h) -// RCS-ID: $Id: anybutton.h 67065 2011-02-27 12:48:26Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_ANYBUTTON_H_ -#define _WX_MSW_ANYBUTTON_H_ - -// ---------------------------------------------------------------------------- -// Common button functionality -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxAnyButton : public wxAnyButtonBase -{ -public: - wxAnyButton() - { - m_imageData = NULL; -#if wxUSE_MARKUP - m_markupText = NULL; -#endif // wxUSE_MARKUP - } - - virtual ~wxAnyButton(); - - // overridden base class methods - virtual void SetLabel(const wxString& label); - virtual bool SetBackgroundColour(const wxColour &colour); - virtual bool SetForegroundColour(const wxColour &colour); - - // implementation from now on - virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); - - virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item); - virtual State GetNormalState() const { return State_Normal; } - - // returns true if the platform should explicitly apply a theme border - virtual bool CanApplyThemeBorder() const { return false; } - -protected: - // usually overridden base class virtuals - virtual wxSize DoGetBestSize() const; - - virtual wxBitmap DoGetBitmap(State which) const; - virtual void DoSetBitmap(const wxBitmap& bitmap, State which); - virtual wxSize DoGetBitmapMargins() const; - virtual void DoSetBitmapMargins(wxCoord x, wxCoord y); - virtual void DoSetBitmapPosition(wxDirection dir); - -#if wxUSE_MARKUP - virtual bool DoSetLabelMarkup(const wxString& markup); -#endif // wxUSE_MARKUP - - // Increases the passed in size to account for the button image. - // - // Should only be called if we do have a button, i.e. if m_imageData is - // non-NULL. - void AdjustForBitmapSize(wxSize& size) const; - - class wxButtonImageData *m_imageData; - -#if wxUSE_MARKUP - class wxMarkupText *m_markupText; -#endif // wxUSE_MARKUP - - // Switches button into owner-drawn mode: this is used if we need to draw - // something not supported by the native control, such as using non default - // colours or a bitmap on pre-XP systems. - void MakeOwnerDrawn(); - bool IsOwnerDrawn() const; - -private: - wxDECLARE_NO_COPY_CLASS(wxAnyButton); -}; - -#endif // _WX_MSW_ANYBUTTON_H_ diff --git a/Source/3rd Party/wx/include/wx/msw/app.h b/Source/3rd Party/wx/include/wx/msw/app.h index 468a08576..4989c9c7a 100644 --- a/Source/3rd Party/wx/include/wx/msw/app.h +++ b/Source/3rd Party/wx/include/wx/msw/app.h @@ -1,10 +1,10 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/app.h +// Name: app.h // Purpose: wxApp class // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: app.h 53157 2008-04-13 12:17:37Z VS $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -23,8 +23,10 @@ class WXDLLIMPEXP_FWD_BASE wxLog; // Represents the application. Derive OnInit and declare // a new App object to start application -class WXDLLIMPEXP_CORE wxApp : public wxAppBase +class WXDLLEXPORT wxApp : public wxAppBase { + DECLARE_DYNAMIC_CLASS(wxApp) + public: wxApp(); virtual ~wxApp(); @@ -33,6 +35,7 @@ public: virtual bool Initialize(int& argc, wxChar **argv); virtual void CleanUp(); + virtual bool Yield(bool onlyIfNeeded = false); virtual void WakeUpIdle(); virtual void SetPrintMode(int mode) { m_printMode = mode; } @@ -47,40 +50,20 @@ public: virtual bool OnExceptionInMainLoop(); #endif // wxUSE_EXCEPTIONS - // MSW-specific from now on - // ------------------------ - - // this suffix should be appended to all our Win32 class names to obtain a - // variant registered without CS_[HV]REDRAW styles - static const wxChar *GetNoRedrawClassSuffix() { return wxT("NR"); } - - // get the name of the registered Win32 class with the given (unique) base - // name: this function constructs the unique class name using this name as - // prefix, checks if the class is already registered and registers it if it - // isn't and returns the name it was registered under (or NULL if it failed) - // - // the registered class will always have CS_[HV]REDRAW and CS_DBLCLKS - // styles as well as any additional styles specified as arguments here; and - // there will be also a companion registered class identical to this one - // but without CS_[HV]REDRAW whose name will be the same one but with - // GetNoRedrawClassSuffix() - // - // the background brush argument must be either a COLOR_XXX standard value - // or (default) -1 meaning that the class paints its background itself - static const wxChar *GetRegisteredClassName(const wxChar *name, - int bgBrushCol = -1, - int extraStyles = 0); - - // return true if this name corresponds to one of the classes we registered - // in the previous GetRegisteredClassName() calls - static bool IsRegisteredClassName(const wxString& name); + // deprecated functions, use wxEventLoop directly instead +#if WXWIN_COMPATIBILITY_2_4 + wxDEPRECATED( void DoMessage(WXMSG *pMsg) ); + wxDEPRECATED( bool DoMessage() ); + wxDEPRECATED( bool ProcessMessage(WXMSG* pMsg) ); +#endif // WXWIN_COMPATIBILITY_2_4 protected: int m_printMode; // wxPRINT_WINDOWS, wxPRINT_POSTSCRIPT public: - // unregister any window classes registered by GetRegisteredClassName() - static void UnregisterWindowClasses(); + // Implementation + static bool RegisterWindowClasses(); + static bool UnregisterWindowClasses(); #if wxUSE_RICHEDIT // initialize the richedit DLL of (at least) given version, return true if @@ -92,39 +75,73 @@ public: // wasn't found at all static int GetComCtl32Version(); - // the same for shell32.dll: returns 400, 471, 500, 600, ... (4.70 not - // currently detected) - static int GetShell32Version(); - // the SW_XXX value to be used for the frames opened by the application // (currently seems unused which is a bug -- TODO) static int m_nCmdShow; protected: DECLARE_EVENT_TABLE() - wxDECLARE_NO_COPY_CLASS(wxApp); - DECLARE_DYNAMIC_CLASS(wxApp) + DECLARE_NO_COPY_CLASS(wxApp) }; +// ---------------------------------------------------------------------------- +// MSW-specific wxEntry() overload and IMPLEMENT_WXWIN_MAIN definition +// ---------------------------------------------------------------------------- + +// we need HINSTANCE declaration to define WinMain() +#include "wx/msw/wrapwin.h" + +#ifndef SW_SHOWNORMAL + #define SW_SHOWNORMAL 1 +#endif + +// WinMain() is always ANSI, even in Unicode build, under normal Windows +// but is always Unicode under CE #ifdef __WXWINCE__ + typedef wchar_t *wxCmdLineArgType; +#else + typedef char *wxCmdLineArgType; +#endif -// under CE provide a dummy implementation of GetComCtl32Version() returning -// the value passing all ">= 470" tests (which are the only ones used in our -// code currently) as commctrl.dll under CE 2.0 and later support comctl32.dll -// functionality -inline int wxApp::GetComCtl32Version() -{ - return 471; -} +extern int WXDLLEXPORT +wxEntry(HINSTANCE hInstance, + HINSTANCE hPrevInstance = NULL, + wxCmdLineArgType pCmdLine = NULL, + int nCmdShow = SW_SHOWNORMAL); -// this is not currently used at all under CE so it's not really clear what do -// we need to return from here -inline int wxApp::GetShell32Version() -{ - return 0; -} +#if defined(__BORLANDC__) && wxUSE_UNICODE + // Borland C++ has the following nonstandard behaviour: when the -WU + // command line flag is used, the linker expects to find wWinMain instead + // of WinMain. This flag causes the compiler to define _UNICODE and + // UNICODE symbols and there's no way to detect its use, so we have to + // define both WinMain and wWinMain so that IMPLEMENT_WXWIN_MAIN works + // for both code compiled with and without -WU. + // See http://sourceforge.net/tracker/?func=detail&atid=309863&aid=1935997&group_id=9863 + // for more details. + #define IMPLEMENT_WXWIN_MAIN_BORLAND_NONSTANDARD \ + extern "C" int WINAPI wWinMain(HINSTANCE hInstance, \ + HINSTANCE hPrevInstance, \ + wchar_t * WXUNUSED(lpCmdLine), \ + int nCmdShow) \ + { \ + /* NB: wxEntry expects lpCmdLine argument to be char*, not */ \ + /* wchar_t*, but fortunately it's not used anywhere */ \ + /* and we can simply pass NULL in: */ \ + return wxEntry(hInstance, hPrevInstance, NULL, nCmdShow); \ + } +#else + #define IMPLEMENT_WXWIN_MAIN_BORLAND_NONSTANDARD +#endif // defined(__BORLANDC__) && wxUSE_UNICODE -#endif // __WXWINCE__ +#define IMPLEMENT_WXWIN_MAIN \ + extern "C" int WINAPI WinMain(HINSTANCE hInstance, \ + HINSTANCE hPrevInstance, \ + wxCmdLineArgType lpCmdLine, \ + int nCmdShow) \ + { \ + return wxEntry(hInstance, hPrevInstance, lpCmdLine, nCmdShow); \ + } \ + IMPLEMENT_WXWIN_MAIN_BORLAND_NONSTANDARD #endif // _WX_APP_H_ diff --git a/Source/3rd Party/wx/include/wx/msw/apptbase.h b/Source/3rd Party/wx/include/wx/msw/apptbase.h index 174f6a494..efab1ed33 100644 --- a/Source/3rd Party/wx/include/wx/msw/apptbase.h +++ b/Source/3rd Party/wx/include/wx/msw/apptbase.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 22.06.2003 -// RCS-ID: $Id$ +// RCS-ID: $Id: apptbase.h 40599 2006-08-13 21:00:32Z VZ $ // Copyright: (c) 2003 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -26,47 +26,20 @@ public: // some opaque data which will be passed later to AfterChildWaitLoop() virtual void *BeforeChildWaitLoop() = 0; + // process pending Windows messages, even in console app + virtual void AlwaysYield() = 0; + // called after starting to wait for the child termination, the parameter // is the return value of BeforeChildWaitLoop() virtual void AfterChildWaitLoop(void *data) = 0; -#if wxUSE_THREADS // wxThread helpers // ---------------- // process a message while waiting for a(nother) thread, should return // false if and only if we have to exit the application virtual bool DoMessageFromThreadWait() = 0; - - // wait for the handle to be signaled, return WAIT_OBJECT_0 if it is or, in - // the GUI code, WAIT_OBJECT_0 + 1 if a Windows message arrived - virtual WXDWORD WaitForThread(WXHANDLE hThread, int flags) = 0; -#endif // wxUSE_THREADS - - -#ifndef __WXWINCE__ - // console helpers - // --------------- - - // this method can be overridden by a derived class to always return true - // or false to force [not] using the console for output to stderr - // - // by default console applications always return true from here while the - // GUI ones only return true if they're being run from console and there is - // no other activity happening in this console - virtual bool CanUseStderr() = 0; - - // write text to the console, return true if ok or false on error - virtual bool WriteToStderr(const wxString& text) = 0; -#endif // !__WXWINCE__ - -protected: -#if wxUSE_THREADS - // implementation of WaitForThread() for the console applications which is - // also used by the GUI code if it doesn't [yet|already] dispatch events - WXDWORD DoSimpleWaitForThread(WXHANDLE hThread); -#endif // wxUSE_THREADS }; #endif // _WX_MSW_APPTBASE_H_ diff --git a/Source/3rd Party/wx/include/wx/msw/apptrait.h b/Source/3rd Party/wx/include/wx/msw/apptrait.h index f74b99b59..6b094ce29 100644 --- a/Source/3rd Party/wx/include/wx/msw/apptrait.h +++ b/Source/3rd Party/wx/include/wx/msw/apptrait.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 21.06.2003 -// RCS-ID: $Id$ +// RCS-ID: $Id: apptrait.h 40599 2006-08-13 21:00:32Z VZ $ // Copyright: (c) 2003 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -19,20 +19,11 @@ class WXDLLIMPEXP_BASE wxConsoleAppTraits : public wxConsoleAppTraitsBase { public: - virtual wxEventLoopBase *CreateEventLoop(); virtual void *BeforeChildWaitLoop(); + virtual void AlwaysYield(); virtual void AfterChildWaitLoop(void *data); -#if wxUSE_TIMER - virtual wxTimerImpl *CreateTimerImpl(wxTimer *timer); -#endif // wxUSE_TIMER -#if wxUSE_THREADS + virtual bool DoMessageFromThreadWait(); - virtual WXDWORD WaitForThread(WXHANDLE hThread, int flags); -#endif // wxUSE_THREADS -#ifndef __WXWINCE__ - virtual bool CanUseStderr() { return true; } - virtual bool WriteToStderr(const wxString& text); -#endif // !__WXWINCE__ }; #if wxUSE_GUI @@ -40,24 +31,15 @@ public: class WXDLLIMPEXP_CORE wxGUIAppTraits : public wxGUIAppTraitsBase { public: - virtual wxEventLoopBase *CreateEventLoop(); virtual void *BeforeChildWaitLoop(); + virtual void AlwaysYield(); virtual void AfterChildWaitLoop(void *data); -#if wxUSE_TIMER - virtual wxTimerImpl *CreateTimerImpl(wxTimer *timer); -#endif // wxUSE_TIMER -#if wxUSE_THREADS - virtual bool DoMessageFromThreadWait(); - virtual WXDWORD WaitForThread(WXHANDLE hThread, int flags); -#endif // wxUSE_THREADS - virtual wxPortId GetToolkitVersion(int *majVer = NULL, int *minVer = NULL) const; -#ifndef __WXWINCE__ - virtual bool CanUseStderr(); - virtual bool WriteToStderr(const wxString& text); -#endif // !__WXWINCE__ + virtual bool DoMessageFromThreadWait(); + virtual wxPortId GetToolkitVersion(int *majVer, int *minVer) const; }; #endif // wxUSE_GUI #endif // _WX_MSW_APPTRAIT_H_ + diff --git a/Source/3rd Party/wx/include/wx/msw/bitmap.h b/Source/3rd Party/wx/include/wx/msw/bitmap.h index a4287c5c2..4e71852a5 100644 --- a/Source/3rd Party/wx/include/wx/msw/bitmap.h +++ b/Source/3rd Party/wx/include/wx/msw/bitmap.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: bitmap.h 49563 2007-10-31 20:46:21Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -25,25 +25,16 @@ class WXDLLIMPEXP_FWD_CORE wxDC; class WXDLLIMPEXP_FWD_CORE wxDIB; #endif class WXDLLIMPEXP_FWD_CORE wxIcon; +class WXDLLIMPEXP_FWD_CORE wxImage; class WXDLLIMPEXP_FWD_CORE wxMask; class WXDLLIMPEXP_FWD_CORE wxPalette; class WXDLLIMPEXP_FWD_CORE wxPixelDataBase; -// What kind of transparency should a bitmap copied from an icon or cursor -// have? -enum wxBitmapTransparency -{ - wxBitmapTransparency_Auto, // default: copy alpha if the source has it - wxBitmapTransparency_None, // never create alpha - wxBitmapTransparency_Always // always use alpha -}; - // ---------------------------------------------------------------------------- // wxBitmap: a mono or colour bitmap -// NOTE: for wxMSW we don't use the wxBitmapBase base class declared in bitmap.h! // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxBitmap : public wxGDIImage +class WXDLLEXPORT wxBitmap : public wxGDIImage { public: // default ctor creates an invalid bitmap, you must Create() it later @@ -57,23 +48,22 @@ public: #ifdef wxNEEDS_CHARPP wxBitmap(char** data) { - *this = wxBitmap(const_cast(data)); + *this = wxBitmap(wx_const_cast(const char* const*, data)); } #endif // Load a file or resource - wxBitmap(const wxString& name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE); + wxBitmap(const wxString& name, wxBitmapType type = wxBITMAP_TYPE_BMP_RESOURCE); // New constructor for generalised creation from data - wxBitmap(const void* data, wxBitmapType type, int width, int height, int depth = 1); + wxBitmap(const void* data, long type, int width, int height, int depth = 1); // Create a new, uninitialized bitmap of the given size and depth (if it // is omitted, will create a bitmap compatible with the display) // // NB: this ctor will create a DIB for 24 and 32bpp bitmaps, use ctor // taking a DC argument if you want to force using DDB in this case - wxBitmap(int width, int height, int depth = -1) { (void)Create(width, height, depth); } - wxBitmap(const wxSize& sz, int depth = -1) { (void)Create(sz, depth); } + wxBitmap(int width, int height, int depth = -1); // Create a bitmap compatible with the given DC wxBitmap(int width, int height, const wxDC& dc); @@ -90,11 +80,7 @@ public: // we must have this, otherwise icons are silently copied into bitmaps using // the copy ctor but the resulting bitmap is invalid! - wxBitmap(const wxIcon& icon, - wxBitmapTransparency transp = wxBitmapTransparency_Auto) - { - CopyFromIcon(icon, transp); - } + wxBitmap(const wxIcon& icon) { CopyFromIcon(icon); } wxBitmap& operator=(const wxIcon& icon) { @@ -114,37 +100,31 @@ public: #if wxUSE_IMAGE wxImage ConvertToImage() const; - wxBitmap ConvertToDisabled(unsigned char brightness = 255) const; #endif // wxUSE_IMAGE // get the given part of bitmap wxBitmap GetSubBitmap( const wxRect& rect ) const; // NB: This should not be called from user code. It is for wx internal - // use only. + // use only. wxBitmap GetSubBitmapOfHDC( const wxRect& rect, WXHDC hdc ) const; // copies the contents and mask of the given (colour) icon to the bitmap - bool CopyFromIcon(const wxIcon& icon, - wxBitmapTransparency transp = wxBitmapTransparency_Auto); + bool CopyFromIcon(const wxIcon& icon); // copies the contents and mask of the given cursor to the bitmap - bool CopyFromCursor(const wxCursor& cursor, - wxBitmapTransparency transp = wxBitmapTransparency_Auto); + bool CopyFromCursor(const wxCursor& cursor); #if wxUSE_WXDIB // copies from a device independent bitmap bool CopyFromDIB(const wxDIB& dib); #endif - virtual bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH); - virtual bool Create(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH) - { return Create(sz.GetWidth(), sz.GetHeight(), depth); } - + virtual bool Create(int width, int height, int depth = -1); virtual bool Create(int width, int height, const wxDC& dc); - virtual bool Create(const void* data, wxBitmapType type, int width, int height, int depth = 1); - virtual bool LoadFile(const wxString& name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE); - virtual bool SaveFile(const wxString& name, wxBitmapType type, const wxPalette *cmap = NULL) const; + virtual bool Create(const void* data, long type, int width, int height, int depth = 1); + virtual bool LoadFile(const wxString& name, long type = wxBITMAP_TYPE_BMP_RESOURCE); + virtual bool SaveFile(const wxString& name, int type, const wxPalette *cmap = NULL); wxBitmapRefData *GetBitmapData() const { return (wxBitmapRefData *)m_refData; } @@ -167,6 +147,13 @@ public: bool HasAlpha() const; void UseAlpha(); +#if WXWIN_COMPATIBILITY_2_4 + // these functions do nothing and are only there for backwards + // compatibility + wxDEPRECATED( int GetQuality() const ); + wxDEPRECATED( void SetQuality(int quality) ); +#endif // WXWIN_COMPATIBILITY_2_4 + // implementation only from now on // ------------------------------- @@ -174,12 +161,14 @@ public: void SetHBITMAP(WXHBITMAP bmp) { SetHandle((WXHANDLE)bmp); } WXHBITMAP GetHBITMAP() const { return (WXHBITMAP)GetHandle(); } +#ifdef __WXDEBUG__ void SetSelectedInto(wxDC *dc); wxDC *GetSelectedInto() const; +#endif // __WXDEBUG__ protected: virtual wxGDIImageRefData *CreateData() const; - virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; + virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const; // creates an uninitialized bitmap, called from Create()s above bool DoCreate(int w, int h, int depth, WXHDC hdc); @@ -197,9 +186,7 @@ protected: private: // common part of CopyFromIcon/CopyFromCursor for Win32 - bool - CopyFromIconOrCursor(const wxGDIImage& icon, - wxBitmapTransparency transp = wxBitmapTransparency_Auto); + bool CopyFromIconOrCursor(const wxGDIImage& icon); DECLARE_DYNAMIC_CLASS(wxBitmap) @@ -209,7 +196,7 @@ private: // wxMask: a mono bitmap used for drawing bitmaps transparently. // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxMask : public wxObject +class WXDLLEXPORT wxMask : public wxObject { public: wxMask(); @@ -247,49 +234,45 @@ protected: DECLARE_DYNAMIC_CLASS(wxMask) }; - // ---------------------------------------------------------------------------- // wxBitmapHandler is a class which knows how to load/save bitmaps to/from file -// NOTE: for wxMSW we don't use the wxBitmapHandler class declared in bitmap.h! // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxBitmapHandler : public wxGDIImageHandler +class WXDLLEXPORT wxBitmapHandler : public wxGDIImageHandler { public: wxBitmapHandler() { } - wxBitmapHandler(const wxString& name, const wxString& ext, wxBitmapType type) - : wxGDIImageHandler(name, ext, type) { } - - // implement wxGDIImageHandler's pure virtuals: - - virtual bool Create(wxGDIImage *image, - const void* data, - wxBitmapType type, - int width, int height, int depth = 1); - virtual bool Load(wxGDIImage *image, - const wxString& name, - wxBitmapType type, - int desiredWidth, int desiredHeight); - virtual bool Save(const wxGDIImage *image, - const wxString& name, - wxBitmapType type) const; - - - // make wxBitmapHandler compatible with the wxBitmapHandler interface - // declared in bitmap.h, even if it's derived from wxGDIImageHandler: + wxBitmapHandler(const wxString& name, const wxString& ext, long type) + : wxGDIImageHandler(name, ext, type) + { + } + // keep wxBitmapHandler derived from wxGDIImageHandler compatible with the + // old class which worked only with bitmaps virtual bool Create(wxBitmap *bitmap, const void* data, - wxBitmapType type, + long flags, int width, int height, int depth = 1); virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, - wxBitmapType type, + long flags, int desiredWidth, int desiredHeight); - virtual bool SaveFile(const wxBitmap *bitmap, + virtual bool SaveFile(wxBitmap *bitmap, const wxString& name, - wxBitmapType type, - const wxPalette *palette = NULL) const; + int type, + const wxPalette *palette = NULL); + + virtual bool Create(wxGDIImage *image, + const void* data, + long flags, + int width, int height, int depth = 1); + virtual bool Load(wxGDIImage *image, + const wxString& name, + long flags, + int desiredWidth, int desiredHeight); + virtual bool Save(wxGDIImage *image, + const wxString& name, + int type); private: DECLARE_DYNAMIC_CLASS(wxBitmapHandler) diff --git a/Source/3rd Party/wx/include/wx/msw/bmpbuttn.h b/Source/3rd Party/wx/include/wx/msw/bmpbuttn.h index 274d2435e..a9173613b 100644 --- a/Source/3rd Party/wx/include/wx/msw/bmpbuttn.h +++ b/Source/3rd Party/wx/include/wx/msw/bmpbuttn.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: bmpbuttn.h 36078 2005-11-03 19:38:20Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -16,10 +16,10 @@ #include "wx/bitmap.h" #include "wx/brush.h" -class WXDLLIMPEXP_CORE wxBitmapButton : public wxBitmapButtonBase +class WXDLLEXPORT wxBitmapButton : public wxBitmapButtonBase { public: - wxBitmapButton() {} + wxBitmapButton() { } wxBitmapButton(wxWindow *parent, wxWindowID id, @@ -42,7 +42,30 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = wxButtonNameStr); + // Implementation + virtual bool SetBackgroundColour(const wxColour& colour); + virtual void SetDefault(); + virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item); + virtual void DrawFace( WXHDC dc, int left, int top, int right, int bottom, bool sel ); + virtual void DrawButtonFocus( WXHDC dc, int left, int top, int right, int bottom, bool sel ); + virtual void DrawButtonDisable( WXHDC dc, int left, int top, int right, int bottom, bool with_marg ); + protected: + // reimplement some base class virtuals + virtual wxSize DoGetBestSize() const; + virtual void OnSetBitmap(); + + // invalidate m_brushDisabled when system colours change + void OnSysColourChanged(wxSysColourChangedEvent& event); + + // change the currently bitmap if we have a hover one + void OnMouseEnterOrLeave(wxMouseEvent& event); + + + // the brush we use to draw disabled buttons + wxBrush m_brushDisabled; + + DECLARE_EVENT_TABLE() DECLARE_DYNAMIC_CLASS_NO_COPY(wxBitmapButton) }; diff --git a/Source/3rd Party/wx/include/wx/msw/brush.h b/Source/3rd Party/wx/include/wx/msw/brush.h index 70890da1d..37de6d77d 100644 --- a/Source/3rd Party/wx/include/wx/msw/brush.h +++ b/Source/3rd Party/wx/include/wx/msw/brush.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: brush.h 53135 2008-04-12 02:31:04Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -12,51 +12,49 @@ #ifndef _WX_BRUSH_H_ #define _WX_BRUSH_H_ +#include "wx/gdicmn.h" +#include "wx/gdiobj.h" +#include "wx/bitmap.h" + class WXDLLIMPEXP_FWD_CORE wxBrush; -class WXDLLIMPEXP_FWD_CORE wxColour; -class WXDLLIMPEXP_FWD_CORE wxBitmap; // ---------------------------------------------------------------------------- // wxBrush // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxBrush : public wxBrushBase +class WXDLLEXPORT wxBrush : public wxBrushBase { public: wxBrush(); - wxBrush(const wxColour& col, wxBrushStyle style = wxBRUSHSTYLE_SOLID); -#if FUTURE_WXWIN_COMPATIBILITY_3_0 - wxDEPRECATED_FUTURE( wxBrush(const wxColour& col, int style) ); -#endif + wxBrush(const wxColour& col, int style = wxSOLID); wxBrush(const wxBitmap& stipple); virtual ~wxBrush(); virtual void SetColour(const wxColour& col); virtual void SetColour(unsigned char r, unsigned char g, unsigned char b); - virtual void SetStyle(wxBrushStyle style); + virtual void SetStyle(int style); virtual void SetStipple(const wxBitmap& stipple); bool operator==(const wxBrush& brush) const; bool operator!=(const wxBrush& brush) const { return !(*this == brush); } wxColour GetColour() const; - wxBrushStyle GetStyle() const; + virtual int GetStyle() const; wxBitmap *GetStipple() const; -#if FUTURE_WXWIN_COMPATIBILITY_3_0 - wxDEPRECATED_FUTURE( void SetStyle(int style) ) - { SetStyle((wxBrushStyle)style); } -#endif + bool Ok() const { return IsOk(); } + bool IsOk() const { return m_refData != NULL; } // return the HBRUSH for this brush virtual WXHANDLE GetResourceHandle() const; protected: - virtual wxGDIRefData *CreateGDIRefData() const; - virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; + virtual wxObjectRefData *CreateRefData() const; + virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const; private: DECLARE_DYNAMIC_CLASS(wxBrush) }; -#endif // _WX_BRUSH_H_ +#endif + // _WX_BRUSH_H_ diff --git a/Source/3rd Party/wx/include/wx/msw/button.h b/Source/3rd Party/wx/include/wx/msw/button.h index 98791722e..e36e44ff6 100644 --- a/Source/3rd Party/wx/include/wx/msw/button.h +++ b/Source/3rd Party/wx/include/wx/msw/button.h @@ -4,22 +4,22 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: button.h 37393 2006-02-08 21:47:09Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifndef _WX_MSW_BUTTON_H_ -#define _WX_MSW_BUTTON_H_ +#ifndef _WX_BUTTON_H_ +#define _WX_BUTTON_H_ // ---------------------------------------------------------------------------- // Pushbutton // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxButton : public wxButtonBase +class WXDLLEXPORT wxButton : public wxButtonBase { public: - wxButton() { Init(); } + wxButton() { } wxButton(wxWindow *parent, wxWindowID id, const wxString& label = wxEmptyString, @@ -29,8 +29,6 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = wxButtonNameStr) { - Init(); - Create(parent, id, label, pos, size, style, validator, name); } @@ -45,15 +43,23 @@ public: virtual ~wxButton(); - virtual wxWindow *SetDefault(); + virtual void SetDefault(); // implementation from now on virtual void Command(wxCommandEvent& event); virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); virtual bool MSWCommand(WXUINT param, WXWORD id); + // coloured buttons support + virtual bool SetBackgroundColour(const wxColour &colour); + virtual bool SetForegroundColour(const wxColour &colour); + + virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item); virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; +private: + void MakeOwnerDrawn(); + protected: // send a notification event, return true if processed bool SendClickEvent(); @@ -65,22 +71,12 @@ protected: // set or unset BS_DEFPUSHBUTTON style static void SetDefaultStyle(wxButton *btn, bool on); - virtual bool DoGetAuthNeeded() const; - virtual void DoSetAuthNeeded(bool show); - - // true if the UAC symbol is shown - bool m_authNeeded; + // usually overridden base class virtuals + virtual wxSize DoGetBestSize() const; private: - void Init() - { - m_authNeeded = false; - } - - void OnCharHook(wxKeyEvent& event); - - wxDECLARE_EVENT_TABLE(); - wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxButton); + DECLARE_DYNAMIC_CLASS_NO_COPY(wxButton) }; -#endif // _WX_MSW_BUTTON_H_ +#endif + // _WX_BUTTON_H_ diff --git a/Source/3rd Party/wx/include/wx/msw/caret.h b/Source/3rd Party/wx/include/wx/msw/caret.h index 843489e0a..90b0d29cc 100644 --- a/Source/3rd Party/wx/include/wx/msw/caret.h +++ b/Source/3rd Party/wx/include/wx/msw/caret.h @@ -1,10 +1,10 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/caret.h +// Name: msw/caret.h // Purpose: wxCaret class - the MSW implementation of wxCaret // Author: Vadim Zeitlin // Modified by: // Created: 23.05.99 -// RCS-ID: $Id$ +// RCS-ID: $Id: caret.h 35650 2005-09-23 12:56:45Z MR $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -12,7 +12,7 @@ #ifndef _WX_CARET_H_ #define _WX_CARET_H_ -class WXDLLIMPEXP_CORE wxCaret : public wxCaretBase +class WXDLLEXPORT wxCaret : public wxCaretBase { public: wxCaret() { Init(); } @@ -56,7 +56,7 @@ protected: private: bool m_hasCaret; - wxDECLARE_NO_COPY_CLASS(wxCaret); + DECLARE_NO_COPY_CLASS(wxCaret) }; #endif // _WX_CARET_H_ diff --git a/Source/3rd Party/wx/include/wx/msw/checkbox.h b/Source/3rd Party/wx/include/wx/msw/checkbox.h index 46d9b5823..6f5605571 100644 --- a/Source/3rd Party/wx/include/wx/msw/checkbox.h +++ b/Source/3rd Party/wx/include/wx/msw/checkbox.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: checkbox.h 37393 2006-02-08 21:47:09Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -13,7 +13,7 @@ #define _WX_CHECKBOX_H_ // Checkbox item (single checkbox) -class WXDLLIMPEXP_CORE wxCheckBox : public wxCheckBoxBase +class WXDLLEXPORT wxCheckBox : public wxCheckBoxBase { public: wxCheckBox() { } @@ -42,16 +42,11 @@ public: virtual bool GetValue() const; // override some base class virtuals - virtual void SetLabel(const wxString& label); - virtual bool MSWCommand(WXUINT param, WXWORD id); virtual void Command(wxCommandEvent& event); virtual bool SetForegroundColour(const wxColour& colour); virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item); - // returns true if the platform should explicitly apply a theme border - virtual bool CanApplyThemeBorder() const { return false; } - protected: virtual wxSize DoGetBestSize() const; diff --git a/Source/3rd Party/wx/include/wx/msw/checklst.h b/Source/3rd Party/wx/include/wx/msw/checklst.h index bd01161f6..5f1272781 100644 --- a/Source/3rd Party/wx/include/wx/msw/checklst.h +++ b/Source/3rd Party/wx/include/wx/msw/checklst.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 16.11.97 -// RCS-ID: $Id$ +// RCS-ID: $Id: checklst.h 49563 2007-10-31 20:46:21Z VZ $ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -19,35 +19,35 @@ class WXDLLIMPEXP_FWD_CORE wxOwnerDrawn; class WXDLLIMPEXP_FWD_CORE wxCheckListBoxItem; // fwd decl, defined in checklst.cpp -class WXDLLIMPEXP_CORE wxCheckListBox : public wxCheckListBoxBase +class WXDLLEXPORT wxCheckListBox : public wxCheckListBoxBase { public: - // ctors - wxCheckListBox(); - wxCheckListBox(wxWindow *parent, wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int nStrings = 0, - const wxString choices[] = NULL, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListBoxNameStr); - wxCheckListBox(wxWindow *parent, wxWindowID id, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListBoxNameStr); + // ctors + wxCheckListBox(); + wxCheckListBox(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int nStrings = 0, + const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr); + wxCheckListBox(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr); - bool Create(wxWindow *parent, wxWindowID id, + bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, int n = 0, const wxString choices[] = NULL, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxListBoxNameStr); - bool Create(wxWindow *parent, wxWindowID id, + bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, const wxArrayString& choices, @@ -55,35 +55,42 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = wxListBoxNameStr); - // items may be checked - virtual bool IsChecked(unsigned int uiIndex) const; - virtual void Check(unsigned int uiIndex, bool bCheck = true); - virtual void Toggle(unsigned int uiIndex); + // override base class virtuals + virtual void Delete(unsigned int n); - // we create our items ourselves and they have non-standard size, - // so we need to override these functions - virtual wxOwnerDrawn *CreateLboxItem(size_t n); - virtual bool MSWOnMeasure(WXMEASUREITEMSTRUCT *item); + virtual bool SetFont( const wxFont &font ); + + // items may be checked + virtual bool IsChecked(unsigned int uiIndex) const; + virtual void Check(unsigned int uiIndex, bool bCheck = true); + + // return the index of the item at this position or wxNOT_FOUND + int HitTest(const wxPoint& pt) const { return DoHitTestItem(pt.x, pt.y); } + int HitTest(wxCoord x, wxCoord y) const { return DoHitTestItem(x, y); } + + // accessors + size_t GetItemHeight() const { return m_nItemHeight; } + + // we create our items ourselves and they have non-standard size, + // so we need to override these functions + virtual wxOwnerDrawn *CreateLboxItem(size_t n); + virtual bool MSWOnMeasure(WXMEASUREITEMSTRUCT *item); protected: - // pressing space or clicking the check box toggles the item - void OnKeyDown(wxKeyEvent& event); - void OnLeftClick(wxMouseEvent& event); + // this can't be called DoHitTest() because wxWindow already has this method + int DoHitTestItem(wxCoord x, wxCoord y) const; - // send an "item checked" event - void SendEvent(unsigned int uiIndex) - { - wxCommandEvent event(wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, GetId()); - event.SetInt(uiIndex); - event.SetEventObject(this); - event.SetString(GetString(uiIndex)); - ProcessCommand(event); - } + // pressing space or clicking the check box toggles the item + void OnKeyDown(wxKeyEvent& event); + void OnLeftClick(wxMouseEvent& event); - wxSize DoGetBestClientSize() const; + wxSize DoGetBestSize() const; - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS_NO_COPY(wxCheckListBox) +private: + size_t m_nItemHeight; // height of checklistbox items (the same for all) + + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS_NO_COPY(wxCheckListBox) }; #endif //_CHECKLST_H diff --git a/Source/3rd Party/wx/include/wx/msw/chkconf.h b/Source/3rd Party/wx/include/wx/msw/chkconf.h index 0e91e3c46..022ca20dd 100644 --- a/Source/3rd Party/wx/include/wx/msw/chkconf.h +++ b/Source/3rd Party/wx/include/wx/msw/chkconf.h @@ -4,7 +4,7 @@ * Author: Julian Smart * Modified by: * Created: 01/02/97 - * RCS-ID: $Id$ + * RCS-ID: $Id: chkconf.h 44436 2007-02-10 02:06:54Z RD $ * Copyright: (c) Julian Smart * Licence: wxWindows licence */ @@ -15,22 +15,6 @@ #define _WX_MSW_CHKCONF_H_ /* ensure that MSW-specific settings are defined */ -#ifndef wxUSE_ACTIVEX -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_ACTIVEX must be defined." -# else -# define wxUSE_ACTIVEX 0 -# endif -#endif /* !defined(wxUSE_ACTIVEX) */ - -#ifndef wxUSE_CRASHREPORT -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_CRASHREPORT must be defined." -# else -# define wxUSE_CRASHREPORT 0 -# endif -#endif /* !defined(wxUSE_CRASHREPORT) */ - #ifndef wxUSE_DC_CACHEING # ifdef wxABORT_ON_CONFIG_ERROR # error "wxUSE_DC_CACHEING must be defined" @@ -39,69 +23,27 @@ # endif #endif /* wxUSE_DC_CACHEING */ -#ifndef wxUSE_DIALUP_MANAGER -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_DIALUP_MANAGER must be defined." -# else -# define wxUSE_DIALUP_MANAGER 0 -# endif -#endif /* !defined(wxUSE_DIALUP_MANAGER) */ -#ifndef wxUSE_MS_HTML_HELP -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_MS_HTML_HELP must be defined." -# else -# define wxUSE_MS_HTML_HELP 0 -# endif -#endif /* !defined(wxUSE_MS_HTML_HELP) */ +/* + * disable the settings which don't work for some compilers + */ -#ifndef wxUSE_INICONF -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_INICONF must be defined." -# else -# define wxUSE_INICONF 0 -# endif -#endif /* !defined(wxUSE_INICONF) */ +/* + * If using PostScript-in-MSW in Univ, must enable PostScript + */ +#if defined(__WXUNIVERSAL__) && wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW && !wxUSE_POSTSCRIPT +# undef wxUSE_POSTSCRIPT +# define wxUSE_POSTSCRIPT 1 +#endif -#ifndef wxUSE_OLE -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_OLE must be defined." -# else -# define wxUSE_OLE 0 -# endif -#endif /* !defined(wxUSE_OLE) */ - -#ifndef wxUSE_OLE_AUTOMATION -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_OLE_AUTOMATION must be defined." -# else -# define wxUSE_OLE_AUTOMATION 0 -# endif -#endif /* !defined(wxUSE_OLE_AUTOMATION) */ - -#ifndef wxUSE_TASKBARICON_BALLOONS -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_TASKBARICON_BALLOONS must be defined." +#ifndef wxUSE_NORLANDER_HEADERS +# if ( wxCHECK_WATCOM_VERSION(1,0) || defined(__WINE__) ) || \ + ((defined(__MINGW32__) || defined(__CYGWIN__)) && ((__GNUC__>2) ||((__GNUC__==2) && (__GNUC_MINOR__>=95)))) +# define wxUSE_NORLANDER_HEADERS 1 # else -# define wxUSE_TASKBARICON_BALLOONS 0 +# define wxUSE_NORLANDER_HEADERS 0 # endif -#endif /* wxUSE_TASKBARICON_BALLOONS */ - -#ifndef wxUSE_UNICODE_MSLU -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_UNICODE_MSLU must be defined." -# else -# define wxUSE_UNICODE_MSLU 0 -# endif -#endif /* wxUSE_UNICODE_MSLU */ - -#ifndef wxUSE_UXTHEME -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_UXTHEME must be defined." -# else -# define wxUSE_UXTHEME 0 -# endif -#endif /* wxUSE_UXTHEME */ +#endif /* * We don't want to give an error if wxUSE_UNICODE_MSLU is enabled but @@ -115,28 +57,13 @@ # define wxUSE_UNICODE_MSLU 0 #endif - /* - * disable the settings which don't work for some compilers + * Don't use MSLU if compiling with Wine */ -#ifndef wxUSE_NORLANDER_HEADERS -# if ( wxCHECK_WATCOM_VERSION(1,0) || defined(__WINE__) ) || \ - ((defined(__MINGW32__) || defined(__CYGWIN__)) && ((__GNUC__>2) ||((__GNUC__==2) && (__GNUC_MINOR__>=95)))) -# define wxUSE_NORLANDER_HEADERS 1 -# else -# define wxUSE_NORLANDER_HEADERS 0 -# endif -#endif - -/* - * See WINVER definition in wx/msw/wrapwin.h for the explanation of this test - * logic. - */ -#if (defined(__VISUALC__) && (__VISUALC__ < 1300)) && \ - (!defined(WINVER) || WINVER < 0x0500) -# undef wxUSE_TASKBARICON_BALLOONS -# define wxUSE_TASKBARICON_BALLOONS 0 +#if wxUSE_UNICODE_MSLU && defined(__WINE__) +# undef wxUSE_UNICODE_MSLU +# define wxUSE_UNICODE_MSLU 0 #endif /* @@ -155,6 +82,12 @@ # define wxUSE_STACKWALKER 0 #endif /* compiler doesn't support SEH */ +/* wxUSE_DEBUG_NEW_ALWAYS doesn't work with CodeWarrior */ +#if defined(__MWERKS__) +# undef wxUSE_DEBUG_NEW_ALWAYS +# define wxUSE_DEBUG_NEW_ALWAYS 0 +#endif + #if defined(__GNUWIN32__) /* These don't work as expected for mingw32 and cygwin32 */ # undef wxUSE_MEMORY_TRACING @@ -218,6 +151,11 @@ */ #ifdef __WIN64__ # if wxUSE_STACKWALKER + /* this is not currently supported under Win64, volunteers needed to + make it work */ +# undef wxUSE_STACKWALKER +# define wxUSE_STACKWALKER 0 + # undef wxUSE_CRASHREPORT # define wxUSE_CRASHREPORT 0 # endif @@ -227,24 +165,18 @@ /* Compiler-specific checks. */ - -/* Borland */ -#ifdef __BORLANDC__ - -#if __BORLANDC__ < 0x500 +#if defined(__BORLANDC__) && (__BORLANDC__ < 0x500) /* BC++ 4.0 can't compile JPEG library */ # undef wxUSE_LIBJPEG # define wxUSE_LIBJPEG 0 #endif /* wxUSE_DEBUG_NEW_ALWAYS = 1 not compatible with BC++ in DLL mode */ -#if defined(WXMAKINGDLL) || defined(WXUSINGDLL) +#if defined(__BORLANDC__) && (defined(WXMAKINGDLL) || defined(WXUSINGDLL)) # undef wxUSE_DEBUG_NEW_ALWAYS # define wxUSE_DEBUG_NEW_ALWAYS 0 #endif -#endif /* __BORLANDC__ */ - /* DMC++ doesn't have definitions for date picker control, so use generic control */ #ifdef __DMC__ @@ -257,34 +189,86 @@ #endif +/* check that MSW-specific options are defined too */ +#ifndef wxUSE_ACTIVEX +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_ACTIVEX must be defined." +# else +# define wxUSE_ACTIVEX 0 +# endif +#endif /* !defined(wxUSE_ACTIVEX) */ + +#ifndef wxUSE_DIALUP_MANAGER +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_DIALUP_MANAGER must be defined." +# else +# define wxUSE_DIALUP_MANAGER 0 +# endif +#endif /* !defined(wxUSE_DIALUP_MANAGER) */ + +#ifndef wxUSE_MS_HTML_HELP +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_MS_HTML_HELP must be defined." +# else +# define wxUSE_MS_HTML_HELP 0 +# endif +#endif /* !defined(wxUSE_MS_HTML_HELP) */ + +#ifndef wxUSE_OLE +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_OLE must be defined." +# else +# define wxUSE_OLE 0 +# endif +#endif /* !defined(wxUSE_OLE) */ + +#ifndef wxUSE_OLE_AUTOMATION +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_OLE_AUTOMATION must be defined." +# else +# define wxUSE_OLE_AUTOMATION 0 +# endif +#endif /* !defined(wxUSE_OLE_AUTOMATION) */ + +#ifndef wxUSE_UNICODE_MSLU +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_UNICODE_MSLU must be defined." +# else +# define wxUSE_UNICODE_MSLU 0 +# endif +#endif /* wxUSE_UNICODE_MSLU */ + +#ifndef wxUSE_UXTHEME +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_UXTHEME must be defined." +# else +# define wxUSE_UXTHEME 0 +# endif +#endif /* wxUSE_UXTHEME */ + +#ifndef wxUSE_UXTHEME_AUTO +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_UXTHEME_AUTO must be defined." +# else +# define wxUSE_UXTHEME_AUTO 0 +# endif +#endif /* wxUSE_UXTHEME_AUTO */ + /* un/redefine the options which we can't compile (after checking that they're defined */ #ifdef __WINE__ -# if wxUSE_ACTIVEX -# undef wxUSE_ACTIVEX -# define wxUSE_ACTIVEX 0 -# endif /* wxUSE_ACTIVEX */ - -# if wxUSE_UNICODE_MSLU -# undef wxUSE_UNICODE_MSLU -# define wxUSE_UNICODE_MSLU 0 -# endif /* wxUSE_UNICODE_MSLU */ -#endif /* __WINE__ */ + /* apparently it doesn't compile under Wine, remove it/when it does */ + #if wxUSE_ACTIVEX + #undef wxUSE_ACTIVEX + #define wxUSE_ACTIVEX 0 + #endif // wxUSE_ACTIVEX +#endif // __WINE__ /* check settings consistency for MSW-specific ones */ -#if wxUSE_CRASHREPORT && !wxUSE_ON_FATAL_EXCEPTION -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_CRASHREPORT requires wxUSE_ON_FATAL_EXCEPTION" -# else -# undef wxUSE_CRASHREPORT -# define wxUSE_CRASHREPORT 0 -# endif -#endif /* wxUSE_CRASHREPORT */ - #if !wxUSE_VARIANT # if wxUSE_ACTIVEX # ifdef wxABORT_ON_CONFIG_ERROR @@ -325,14 +309,6 @@ #endif /* !wxUSE_DYNAMIC_LOADER */ #if !wxUSE_DYNLIB_CLASS -# if wxUSE_DC_TRANSFORM_MATRIX -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_DC_TRANSFORM_MATRIX requires wxUSE_DYNLIB_CLASS" -# else -# undef wxUSE_DC_TRANSFORM_MATRIX -# define wxUSE_DC_TRANSFORM_MATRIX 0 -# endif -# endif # if wxUSE_UXTHEME # ifdef wxABORT_ON_CONFIG_ERROR # error "wxUSE_UXTHEME requires wxUSE_DYNLIB_CLASS" @@ -397,42 +373,15 @@ # define wxUSE_MEDIACTRL 0 # endif # endif -# if wxUSE_WEB -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxWebView requires wxActiveXContainer under MSW" -# else -# undef wxUSE_WEB -# define wxUSE_WEB 0 -# endif -# endif #endif /* !wxUSE_ACTIVEX */ -#if !wxUSE_THREADS -# if wxUSE_FSWATCHER +#if defined(_MSC_VER) && _MSC_VER <= 1200 && wxUSE_GRAPHICS_CONTEXT # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxFileSystemWatcher requires wxThread under MSW" +# error "wxGraphicsContext needs MSVC 7 or newer" # else -# undef wxUSE_FSWATCHER -# define wxUSE_FSWATCHER 0 +# undef wxUSE_GRAPHICS_CONTEXT +# define wxUSE_GRAPHICS_CONTEXT 0 # endif -# endif -#endif /* !wxUSE_THREADS */ - - -#if !wxUSE_OLE_AUTOMATION -# if wxUSE_WEB -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxWebView requires wxUSE_OLE_AUTOMATION under MSW" -# else -# undef wxUSE_WEB -# define wxUSE_WEB 0 -# endif -# endif -#endif /* !wxUSE_OLE_AUTOMATION */ - -#if defined(__WXUNIVERSAL__) && wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW && !wxUSE_POSTSCRIPT -# undef wxUSE_POSTSCRIPT -# define wxUSE_POSTSCRIPT 1 #endif #endif /* _WX_MSW_CHKCONF_H_ */ diff --git a/Source/3rd Party/wx/include/wx/msw/choice.h b/Source/3rd Party/wx/include/wx/msw/choice.h index 26eb9300d..6dccdafa4 100644 --- a/Source/3rd Party/wx/include/wx/msw/choice.h +++ b/Source/3rd Party/wx/include/wx/msw/choice.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: Vadim Zeitlin to derive from wxChoiceBase // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: choice.h 51616 2008-02-09 15:22:15Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -16,7 +16,7 @@ // Choice item // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxChoice : public wxChoiceBase +class WXDLLEXPORT wxChoice : public wxChoiceBase { public: // ctors @@ -66,10 +66,11 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = wxChoiceNameStr); - virtual bool Show(bool show = true); - virtual void SetLabel(const wxString& label); + virtual void Delete(unsigned int n); + virtual void Clear(); + virtual unsigned int GetCount() const; virtual int GetSelection() const; virtual int GetCurrentSelection() const; @@ -79,14 +80,6 @@ public: virtual wxString GetString(unsigned int n) const; virtual void SetString(unsigned int n, const wxString& s); - virtual wxVisualAttributes GetDefaultAttributes() const - { - return GetClassDefaultAttributes(GetWindowVariant()); - } - - static wxVisualAttributes - GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); - // MSW only virtual bool MSWCommand(WXUINT param, WXWORD id); WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); @@ -94,30 +87,17 @@ public: virtual bool MSWShouldPreProcessMessage(WXMSG *pMsg); virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; - // returns true if the platform should explicitly apply a theme border - virtual bool CanApplyThemeBorder() const { return false; } - protected: - // choose the default border for this window - virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } - // common part of all ctors - void Init() - { - m_lastAcceptedSelection = wxID_NONE; - m_heightOwn = wxDefaultCoord; - } - - virtual void DoDeleteOneItem(unsigned int n); - virtual void DoClear(); - - virtual int DoInsertItems(const wxArrayStringsAdapter& items, - unsigned int pos, - void **clientData, wxClientDataType type); + void Init() { m_lastAcceptedSelection = wxID_NONE; } + virtual int DoAppend(const wxString& item); + virtual int DoInsert(const wxString& item, unsigned int pos); virtual void DoMoveWindow(int x, int y, int width, int height); virtual void DoSetItemClientData(unsigned int n, void* clientData); virtual void* DoGetItemClientData(unsigned int n) const; + virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData); + virtual wxClientData* DoGetItemClientObject(unsigned int n) const; // MSW implementation virtual wxSize DoGetBestSize() const; @@ -126,15 +106,9 @@ protected: int width, int height, int sizeFlags = wxSIZE_AUTO); - // Show or hide the popup part of the control. - void MSWDoPopupOrDismiss(bool show); - // update the height of the drop down list to fit the number of items we // have (without changing the visible height) - void MSWUpdateDropDownHeight(); - - // set the height of the visible part of the control to m_heightOwn - void MSWUpdateVisibleHeight(); + void UpdateVisibleHeight(); // create and initialize the control bool CreateAndInit(wxWindow *parent, wxWindowID id, @@ -148,21 +122,12 @@ protected: // free all memory we have (used by Clear() and dtor) void Free(); - // set the height for simple combo box - int SetHeightSimpleComboBox(int nItems) const; - -#if wxUSE_DEFERRED_SIZING - virtual void MSWEndDeferWindowPos(); -#endif // wxUSE_DEFERRED_SIZING // last "completed" selection, i.e. not the transient one while the user is // browsing the popup list: this is only used when != wxID_NONE which is // the case while the drop down is opened int m_lastAcceptedSelection; - // the height of the control itself if it was set explicitly or - // wxDefaultCoord if it hadn't - int m_heightOwn; DECLARE_DYNAMIC_CLASS_NO_COPY(wxChoice) }; diff --git a/Source/3rd Party/wx/include/wx/msw/clipbrd.h b/Source/3rd Party/wx/include/wx/msw/clipbrd.h index a4da27893..a8cf81c3c 100644 --- a/Source/3rd Party/wx/include/wx/msw/clipbrd.h +++ b/Source/3rd Party/wx/include/wx/msw/clipbrd.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: clipbrd.h 49563 2007-10-31 20:46:21Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -14,28 +14,32 @@ #if wxUSE_CLIPBOARD +#include "wx/list.h" +#include "wx/module.h" +#include "wx/dataobj.h" // for wxDataFormat + // These functions superceded by wxClipboard, but retained in order to // implement wxClipboard, and for compatibility. // open/close the clipboard -WXDLLIMPEXP_CORE bool wxOpenClipboard(); -WXDLLIMPEXP_CORE bool wxIsClipboardOpened(); +WXDLLEXPORT bool wxOpenClipboard(); +WXDLLEXPORT bool wxIsClipboardOpened(); #define wxClipboardOpen wxIsClipboardOpened -WXDLLIMPEXP_CORE bool wxCloseClipboard(); +WXDLLEXPORT bool wxCloseClipboard(); // get/set data -WXDLLIMPEXP_CORE bool wxEmptyClipboard(); -WXDLLIMPEXP_CORE bool wxSetClipboardData(wxDataFormat dataFormat, +WXDLLEXPORT bool wxEmptyClipboard(); +WXDLLEXPORT bool wxSetClipboardData(wxDataFormat dataFormat, const void *data, int width = 0, int height = 0); -WXDLLIMPEXP_CORE void* wxGetClipboardData(wxDataFormat dataFormat, +WXDLLEXPORT void* wxGetClipboardData(wxDataFormat dataFormat, long *len = NULL); // clipboard formats -WXDLLIMPEXP_CORE bool wxIsClipboardFormatAvailable(wxDataFormat dataFormat); -WXDLLIMPEXP_CORE wxDataFormat wxEnumClipboardFormats(wxDataFormat dataFormat); -WXDLLIMPEXP_CORE int wxRegisterClipboardFormat(wxChar *formatName); -WXDLLIMPEXP_CORE bool wxGetClipboardFormatName(wxDataFormat dataFormat, +WXDLLEXPORT bool wxIsClipboardFormatAvailable(wxDataFormat dataFormat); +WXDLLEXPORT wxDataFormat wxEnumClipboardFormats(wxDataFormat dataFormat); +WXDLLEXPORT int wxRegisterClipboardFormat(wxChar *formatName); +WXDLLEXPORT bool wxGetClipboardFormatName(wxDataFormat dataFormat, wxChar *formatName, int maxCount); @@ -43,8 +47,11 @@ WXDLLIMPEXP_CORE bool wxGetClipboardFormatName(wxDataFormat dataFormat, // wxClipboard //----------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxClipboard : public wxClipboardBase +class WXDLLIMPEXP_FWD_CORE wxDataObject; +class WXDLLEXPORT wxClipboard : public wxClipboardBase { + DECLARE_DYNAMIC_CLASS(wxClipboard) + public: wxClipboard(); virtual ~wxClipboard(); @@ -78,13 +85,14 @@ public: // eating memory), otherwise the clipboard will be emptied on exit virtual bool Flush(); + // X11 has two clipboards which get selected by this call. Empty on MSW. + void UsePrimarySelection( bool WXUNUSED(primary) = false ) { } + private: IDataObject *m_lastDataObject; bool m_isOpened; - - DECLARE_DYNAMIC_CLASS(wxClipboard) }; #endif // wxUSE_CLIPBOARD - -#endif // _WX_CLIPBRD_H_ +#endif + // _WX_CLIPBRD_H_ diff --git a/Source/3rd Party/wx/include/wx/msw/colordlg.h b/Source/3rd Party/wx/include/wx/msw/colordlg.h index 32006c6dd..fa0913473 100644 --- a/Source/3rd Party/wx/include/wx/msw/colordlg.h +++ b/Source/3rd Party/wx/include/wx/msw/colordlg.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: colordlg.h 37393 2006-02-08 21:47:09Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -12,22 +12,19 @@ #ifndef _WX_COLORDLG_H_ #define _WX_COLORDLG_H_ +#include "wx/defs.h" #include "wx/dialog.h" +#include "wx/cmndata.h" // ---------------------------------------------------------------------------- // wxColourDialog: dialog for choosing a colours // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxColourDialog : public wxDialog +class WXDLLEXPORT wxColourDialog : public wxDialog { public: - wxColourDialog() { Init(); } - wxColourDialog(wxWindow *parent, wxColourData *data = NULL) - { - Init(); - - Create(parent, data); - } + wxColourDialog(); + wxColourDialog(wxWindow *parent, wxColourData *data = NULL); bool Create(wxWindow *parent, wxColourData *data = NULL); @@ -39,36 +36,21 @@ public: virtual int ShowModal(); - // wxMSW-specific implementation from now on - // ----------------------------------------- - - // called from the hook procedure on WM_INITDIALOG reception - virtual void MSWOnInitDone(WXHWND hDlg); - protected: - // common part of all ctors - void Init(); - -#if !(defined(__SMARTPHONE__) && defined(__WXWINCE__)) virtual void DoGetPosition( int *x, int *y ) const; virtual void DoGetSize(int *width, int *height) const; virtual void DoGetClientSize(int *width, int *height) const; - virtual void DoMoveWindow(int x, int y, int width, int height); - virtual void DoCentre(int dir); -#endif // !(__SMARTPHONE__ && __WXWINCE__) + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); wxColourData m_colourData; wxString m_title; - // indicates that the dialog should be centered in this direction if non 0 - // (set by DoCentre(), used by MSWOnInitDone()) - int m_centreDir; - - // true if DoMoveWindow() had been called - bool m_movedWindow; - + wxPoint m_pos; DECLARE_DYNAMIC_CLASS_NO_COPY(wxColourDialog) }; -#endif // _WX_COLORDLG_H_ +#endif + // _WX_COLORDLG_H_ diff --git a/Source/3rd Party/wx/include/wx/msw/colour.h b/Source/3rd Party/wx/include/wx/msw/colour.h index c9dc909b8..d66b838d7 100644 --- a/Source/3rd Party/wx/include/wx/msw/colour.h +++ b/Source/3rd Party/wx/include/wx/msw/colour.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: colour.h 51769 2008-02-13 22:36:43Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -18,17 +18,30 @@ // Colour // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxColour : public wxColourBase +class WXDLLEXPORT wxColour : public wxColourBase { public: // constructors // ------------ - DEFINE_STD_WXCOLOUR_CONSTRUCTORS + + wxColour() { Init(); } + wxColour( ChannelType red, ChannelType green, ChannelType blue, + ChannelType alpha = wxALPHA_OPAQUE ) + { Set(red, green, blue, alpha); } + wxColour( unsigned long colRGB ) { Set(colRGB); } + wxColour(const wxString& colourName) { Init(); Set(colourName); } + wxColour(const wxChar *colourName) { Init(); Set(colourName); } + + + // dtor + virtual ~wxColour(); + // accessors // --------- - virtual bool IsOk() const { return m_isInit; } + bool Ok() const { return IsOk(); } + bool IsOk() const { return m_isInit; } unsigned char Red() const { return m_red; } unsigned char Green() const { return m_green; } @@ -45,10 +58,11 @@ public: && m_alpha == colour.m_alpha; } - bool operator!=(const wxColour& colour) const { return !(*this == colour); } + bool operator != (const wxColour& colour) const { return !(*this == colour); } WXCOLORREF GetPixel() const { return m_pixel; } + public: WXCOLORREF m_pixel; @@ -70,4 +84,5 @@ private: DECLARE_DYNAMIC_CLASS(wxColour) }; -#endif // _WX_COLOUR_H_ +#endif + // _WX_COLOUR_H_ diff --git a/Source/3rd Party/wx/include/wx/msw/combo.h b/Source/3rd Party/wx/include/wx/msw/combo.h index 5f830483b..0cd58b32d 100644 --- a/Source/3rd Party/wx/include/wx/msw/combo.h +++ b/Source/3rd Party/wx/include/wx/msw/combo.h @@ -4,7 +4,7 @@ // Author: Jaakko Salli // Modified by: // Created: Apr-30-2006 -// RCS-ID: $Id$ +// RCS-ID: $Id: combo.h 43881 2006-12-09 19:48:21Z PC $ // Copyright: (c) Jaakko Salli // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -33,9 +33,9 @@ // Define this only if native implementation includes all features #define wxCOMBOCONTROL_FULLY_FEATURED -extern WXDLLIMPEXP_DATA_CORE(const char) wxComboBoxNameStr[]; +extern WXDLLIMPEXP_DATA_CORE(const wxChar) wxComboBoxNameStr[]; -class WXDLLIMPEXP_CORE wxComboCtrl : public wxComboCtrlBase +class WXDLLEXPORT wxComboCtrl : public wxComboCtrlBase { public: // ctors and such @@ -73,29 +73,22 @@ public: static int GetFeatures() { return wxComboCtrlFeatures::All; } #if wxUSE_COMBOCTRL_POPUP_ANIMATION - void OnTimerEvent(wxTimerEvent& WXUNUSED(event)) { DoTimerEvent(); } - + void OnTimerEvent( wxTimerEvent& event ); protected: - void DoTimerEvent(); - virtual bool AnimateShow( const wxRect& rect, int flags ); -#endif // wxUSE_COMBOCTRL_POPUP_ANIMATION +#endif protected: - // Dummy method - we override all functions that call this - virtual WXHWND GetEditHWND() const { return NULL; } - // customization virtual void OnResize(); virtual wxCoord GetNativeTextIndent() const; + virtual void OnThemeChange(); // event handlers void OnPaintEvent( wxPaintEvent& event ); void OnMouseEvent( wxMouseEvent& event ); - virtual bool HasTransparentBackground() { return IsDoubleBuffered(); } - private: void Init(); diff --git a/Source/3rd Party/wx/include/wx/msw/combobox.h b/Source/3rd Party/wx/include/wx/msw/combobox.h index e930a8b23..5d4d7761f 100644 --- a/Source/3rd Party/wx/include/wx/msw/combobox.h +++ b/Source/3rd Party/wx/include/wx/msw/combobox.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: combobox.h 45818 2007-05-05 13:15:47Z RR $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -13,7 +13,6 @@ #define _WX_COMBOBOX_H_ #include "wx/choice.h" -#include "wx/textentry.h" #if wxUSE_COMBOBOX @@ -21,11 +20,10 @@ // Combobox control // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxComboBox : public wxChoice, - public wxTextEntry +class WXDLLEXPORT wxComboBox: public wxChoice { public: - wxComboBox() { Init(); } + wxComboBox() { } wxComboBox(wxWindow *parent, wxWindowID id, const wxString& value = wxEmptyString, @@ -36,11 +34,8 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = wxComboBoxNameStr) { - Init(); Create(parent, id, value, pos, size, n, choices, style, validator, name); - } - wxComboBox(wxWindow *parent, wxWindowID id, const wxString& value, const wxPoint& pos, @@ -50,8 +45,6 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = wxComboBoxNameStr) { - Init(); - Create(parent, id, value, pos, size, choices, style, validator, name); } @@ -75,32 +68,46 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = wxComboBoxNameStr); - // See wxComboBoxBase discussion of IsEmpty(). - bool IsListEmpty() const { return wxItemContainer::IsEmpty(); } - bool IsTextEmpty() const { return wxTextEntry::IsEmpty(); } + // List functions: see wxChoice - // resolve ambiguities among virtual functions inherited from both base - // classes - virtual void Clear(); + // Text field functions virtual wxString GetValue() const; virtual void SetValue(const wxString& value); - virtual wxString GetStringSelection() const - { return wxChoice::GetStringSelection(); } - virtual void Popup() { MSWDoPopupOrDismiss(true); } - virtual void Dismiss() { MSWDoPopupOrDismiss(false); } - virtual void SetSelection(int n) { wxChoice::SetSelection(n); } - virtual void SetSelection(long from, long to) - { wxTextEntry::SetSelection(from, to); } - virtual int GetSelection() const { return wxChoice::GetSelection(); } - virtual void GetSelection(long *from, long *to) const; + // Clipboard operations + virtual void Copy(); + virtual void Cut(); + virtual void Paste(); + virtual bool CanCopy() const; + virtual bool CanCut() const; + virtual bool CanPaste() const; + virtual void SetInsertionPoint(long pos); + virtual void SetInsertionPointEnd(); + virtual long GetInsertionPoint() const; + virtual wxTextPos GetLastPosition() const; + virtual void Replace(long from, long to, const wxString& value); + virtual void Remove(long from, long to); + virtual void SetSelection(int n) { wxChoice::SetSelection(n); } + virtual void SetSelection(long from, long to); + virtual int GetSelection() const { return wxChoice::GetSelection(); } + virtual void GetSelection(long* from, long* to) const; + virtual void SetEditable(bool editable); + + virtual void Undo(); + virtual void Redo(); + virtual bool CanUndo() const; + virtual bool CanRedo() const; + virtual void SelectAll(); virtual bool IsEditable() const; + virtual bool HasSelection() const; // implementation only from now on virtual bool MSWCommand(WXUINT param, WXWORD id); bool MSWProcessEditMsg(WXUINT msg, WXWPARAM wParam, WXLPARAM lParam); virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); bool MSWShouldPreProcessMessage(WXMSG *pMsg); + + WXHWND GetEditHWND() const; // Standard event handling void OnCut(wxCommandEvent& event); @@ -121,49 +128,11 @@ public: virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; -#if wxUSE_UXTHEME - // override wxTextEntry method to work around Windows bug - virtual bool SetHint(const wxString& hint); -#endif // wxUSE_UXTHEME - -protected: -#if wxUSE_TOOLTIPS - virtual void DoSetToolTip(wxToolTip *tip); -#endif - - // this is the implementation of GetEditHWND() which can also be used when - // we don't have the edit control, it simply returns NULL then - // - // try not to use this function unless absolutely necessary (as in the - // message handling code where the edit control might not be created yet - // for the messages we receive during the control creation) as normally - // just testing for IsEditable() and using GetEditHWND() should be enough - WXHWND GetEditHWNDIfAvailable() const; - - virtual void EnableTextChangedEvents(bool enable) - { - m_allowTextEvents = enable; - } - private: - // there are the overridden wxTextEntry methods which should only be called - // when we do have an edit control so they assert if this is not the case - virtual wxWindow *GetEditableWindow(); - virtual WXHWND GetEditHWND() const; - - // common part of all ctors - void Init() - { - m_allowTextEvents = true; - } - - // normally true, false if text events are currently disabled - bool m_allowTextEvents; - DECLARE_DYNAMIC_CLASS_NO_COPY(wxComboBox) DECLARE_EVENT_TABLE() }; #endif // wxUSE_COMBOBOX - -#endif // _WX_COMBOBOX_H_ +#endif + // _WX_COMBOBOX_H_ diff --git a/Source/3rd Party/wx/include/wx/msw/control.h b/Source/3rd Party/wx/include/wx/msw/control.h index 7646487eb..c70454cbc 100644 --- a/Source/3rd Party/wx/include/wx/msw/control.h +++ b/Source/3rd Party/wx/include/wx/msw/control.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: control.h 45498 2007-04-16 13:03:05Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -15,7 +15,7 @@ #include "wx/dynarray.h" // General item class -class WXDLLIMPEXP_CORE wxControl : public wxControlBase +class WXDLLEXPORT wxControl : public wxControlBase { public: wxControl() { } @@ -35,6 +35,7 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = wxControlNameStr); + virtual ~wxControl(); // Simulates an event virtual void Command(wxCommandEvent& event) { ProcessCommand(event); } @@ -122,6 +123,13 @@ protected: // one virtual WXHBRUSH DoMSWControlColor(WXHDC pDC, wxColour colBg, WXHWND hWnd); + // this is a helper for the derived class GetClassDefaultAttributes() + // implementation: it returns the right colours for the classes which + // contain something else (e.g. wxListBox, wxTextCtrl, ...) instead of + // being simple controls (such as wxButton, wxCheckBox, ...) + static wxVisualAttributes + GetCompositeControlsDefaultAttributes(wxWindowVariant variant); + // for controls like radiobuttons which are really composite this array // holds the ids (not HWNDs!) of the sub controls wxArrayLong m_subControls; diff --git a/Source/3rd Party/wx/include/wx/msw/crashrpt.h b/Source/3rd Party/wx/include/wx/msw/crashrpt.h index 19786acac..3933a387d 100644 --- a/Source/3rd Party/wx/include/wx/msw/crashrpt.h +++ b/Source/3rd Party/wx/include/wx/msw/crashrpt.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 13.07.2003 -// RCS-ID: $Id$ +// RCS-ID: $Id: crashrpt.h 34436 2005-05-31 09:20:43Z JS $ // Copyright: (c) 2003 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -94,10 +94,10 @@ struct WXDLLIMPEXP_BASE wxCrashReport { // set the name of the file to which the report is written, it is // constructed from the .exe name by default - static void SetFileName(const wxString& filename); + static void SetFileName(const wxChar *filename); // return the current file name - static wxString GetFileName(); + static const wxChar *GetFileName(); // write the exception report to the file, return true if it could be done // or false otherwise diff --git a/Source/3rd Party/wx/include/wx/msw/ctrlsub.h b/Source/3rd Party/wx/include/wx/msw/ctrlsub.h deleted file mode 100644 index 3a6298801..000000000 --- a/Source/3rd Party/wx/include/wx/msw/ctrlsub.h +++ /dev/null @@ -1,43 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/ctrlsub.h -// Purpose: common functionality of wxItemContainer-derived controls -// Author: Vadim Zeitlin -// Created: 2007-07-25 -// RCS-ID: $Id$ -// Copyright: (c) 2007 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_CTRLSUB_H_ -#define _WX_MSW_CTRLSUB_H_ - -// ---------------------------------------------------------------------------- -// wxControlWithItems -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxControlWithItems : public wxControlWithItemsBase -{ -public: - wxControlWithItems() { } - -protected: - // preallocate memory for inserting the given new items into the control - // using the wm message (normally either LB_INITSTORAGE or CB_INITSTORAGE) - void MSWAllocStorage(const wxArrayStringsAdapter& items, unsigned wm); - - // insert or append a string to the controls using the given message - // (one of {CB,LB}_{ADD,INSERT}STRING, pos must be 0 when appending) - int MSWInsertOrAppendItem(unsigned pos, const wxString& item, unsigned wm); - - // normally the control containing the items is this window itself but if - // the derived control is composed of several windows, this method can be - // overridden to return the real list/combobox control - virtual WXHWND MSWGetItemsHWND() const { return GetHWND(); } - -private: - DECLARE_ABSTRACT_CLASS(wxControlWithItems) - wxDECLARE_NO_COPY_CLASS(wxControlWithItems); -}; - -#endif // _WX_MSW_CTRLSUB_H_ - diff --git a/Source/3rd Party/wx/include/wx/msw/cursor.h b/Source/3rd Party/wx/include/wx/msw/cursor.h index f1df68b64..3cf280d43 100644 --- a/Source/3rd Party/wx/include/wx/msw/cursor.h +++ b/Source/3rd Party/wx/include/wx/msw/cursor.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: cursor.h 49804 2007-11-10 01:09:42Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -17,19 +17,19 @@ class WXDLLIMPEXP_FWD_CORE wxImage; // Cursor -class WXDLLIMPEXP_CORE wxCursor : public wxGDIImage +class WXDLLEXPORT wxCursor : public wxGDIImage { public: // constructors wxCursor(); wxCursor(const wxImage& image); + wxCursor(const char bits[], int width, int height, + int hotSpotX = -1, int hotSpotY = -1, + const char maskBits[] = NULL); wxCursor(const wxString& name, - wxBitmapType type = wxCURSOR_DEFAULT_TYPE, + long flags = wxBITMAP_TYPE_CUR_RESOURCE, int hotSpotX = 0, int hotSpotY = 0); - wxCursor(wxStockCursor id) { InitFromStock(id); } -#if WXWIN_COMPATIBILITY_2_8 - wxCursor(int id) { InitFromStock((wxStockCursor)id); } -#endif + wxCursor(int idCursor); virtual ~wxCursor(); // implementation only @@ -37,8 +37,6 @@ public: WXHCURSOR GetHCURSOR() const { return (WXHCURSOR)GetHandle(); } protected: - void InitFromStock(wxStockCursor); - virtual wxGDIImageRefData *CreateData() const; private: diff --git a/Source/3rd Party/wx/include/wx/msw/dc.h b/Source/3rd Party/wx/include/wx/msw/dc.h index 2bfd30133..97b1444fc 100644 --- a/Source/3rd Party/wx/include/wx/msw/dc.h +++ b/Source/3rd Party/wx/include/wx/msw/dc.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: dc.h 42612 2006-10-29 10:46:49Z SC $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -13,7 +13,6 @@ #define _WX_MSW_DC_H_ #include "wx/defs.h" -#include "wx/dc.h" // --------------------------------------------------------------------------- // macros @@ -43,11 +42,11 @@ public: // this is an ABC: use one of the derived classes to create a DC associated // with a window, screen, printer and so on -class WXDLLIMPEXP_CORE wxMSWDCImpl: public wxDCImpl +class WXDLLEXPORT wxDC : public wxDCBase { public: - wxMSWDCImpl(wxDC *owner, WXHDC hDC); - virtual ~wxMSWDCImpl(); + wxDC(WXHDC hDC) { Init(); m_hDC = hDC; } + virtual ~wxDC(); // implement base class pure virtuals // ---------------------------------- @@ -79,22 +78,14 @@ public: virtual int GetDepth() const; virtual wxSize GetPPI() const; - - virtual void SetMapMode(wxMappingMode mode); + virtual void SetMapMode(int mode); virtual void SetUserScale(double x, double y); + virtual void SetSystemScale(double x, double y); virtual void SetLogicalScale(double x, double y); virtual void SetLogicalOrigin(wxCoord x, wxCoord y); virtual void SetDeviceOrigin(wxCoord x, wxCoord y); virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp); - -#if wxUSE_DC_TRANSFORM_MATRIX - virtual bool CanUseTransformMatrix() const; - virtual bool SetTransformMatrix(const wxAffineMatrix2D& matrix); - virtual wxAffineMatrix2D GetTransformMatrix() const; - virtual void ResetTransformMatrix(); -#endif // wxUSE_DC_TRANSFORM_MATRIX - - virtual void SetLogicalFunction(wxRasterOperationMode function); + virtual void SetLogicalFunction(int function); // implementation from now on // -------------------------- @@ -102,9 +93,10 @@ public: virtual void SetRop(WXHDC cdc); virtual void SelectOldObjects(WXHDC dc); + wxWindow *GetWindow() const { return m_canvas; } void SetWindow(wxWindow *win) { - m_window = win; + m_canvas = win; #if wxUSE_PALETTE // if we have palettes use the correct one for this window @@ -152,6 +144,7 @@ public: protected: void Init() { + m_canvas = NULL; m_bOwnsDC = false; m_hDC = NULL; @@ -167,26 +160,17 @@ protected: // create an uninitialized DC: this should be only used by the derived // classes - wxMSWDCImpl( wxDC *owner ) : wxDCImpl( owner ) { Init(); } + wxDC() { Init(); } - void RealizeScaleAndOrigin(); - -public: - virtual void DoGetFontMetrics(int *height, - int *ascent, - int *descent, - int *internalLeading, - int *externalLeading, - int *averageWidth) const; virtual void DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y, wxCoord *descent = NULL, wxCoord *externalLeading = NULL, - const wxFont *theFont = NULL) const; + wxFont *theFont = NULL) const; virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const; virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col, - wxFloodFillStyle style = wxFLOOD_SURFACE); + int style = wxFLOOD_SURFACE); virtual void DoGradientFillLinear(const wxRect& rect, const wxColour& initialColour, @@ -212,8 +196,8 @@ public: double radius); virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height); -#if wxUSE_SPLINES && !defined(__WXWINCE__) - virtual void DoDrawSpline(const wxPointList *points); +#if wxUSE_SPLINES + virtual void DoDrawSpline(wxList *points); #endif virtual void DoCrossHair(wxCoord x, wxCoord y); @@ -228,20 +212,13 @@ public: virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, wxDC *source, wxCoord xsrc, wxCoord ysrc, - wxRasterOperationMode rop = wxCOPY, bool useMask = false, - wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord); - - virtual bool DoStretchBlit(wxCoord xdest, wxCoord ydest, - wxCoord dstWidth, wxCoord dstHeight, - wxDC *source, - wxCoord xsrc, wxCoord ysrc, - wxCoord srcWidth, wxCoord srcHeight, - wxRasterOperationMode rop = wxCOPY, bool useMask = false, - wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord); + int rop = wxCOPY, bool useMask = false, wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord); + // this is gnarly - we can't even call this function DoSetClippingRegion() + // because of virtual function hiding + virtual void DoSetClippingRegionAsRegion(const wxRegion& region); virtual void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height); - virtual void DoSetDeviceClippingRegion(const wxRegion& region); virtual void DoGetClippingBox(wxCoord *x, wxCoord *y, wxCoord *w, wxCoord *h) const; @@ -251,15 +228,12 @@ public: wxCoord xoffset, wxCoord yoffset); virtual void DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset, - wxPolygonFillMode fillStyle = wxODDEVEN_RULE); + int fillStyle = wxODDEVEN_RULE); virtual void DoDrawPolyPolygon(int n, int count[], wxPoint points[], wxCoord xoffset, wxCoord yoffset, - wxPolygonFillMode fillStyle = wxODDEVEN_RULE); - virtual wxBitmap DoGetAsBitmap(const wxRect *subrect) const - { - return subrect == NULL ? GetSelectedBitmap() - : GetSelectedBitmap().GetSubBitmap(*subrect); - } + int fillStyle = wxODDEVEN_RULE); + virtual wxBitmap DoGetAsBitmap(const wxRect *subrect) const + { return subrect == NULL ? GetSelectedBitmap() : GetSelectedBitmap().GetSubBitmap(*subrect); } #if wxUSE_PALETTE @@ -273,11 +247,10 @@ public: void InitializePalette(); #endif // wxUSE_PALETTE -protected: // common part of DoDrawText() and DoDrawRotatedText() void DrawAnyText(const wxString& text, wxCoord x, wxCoord y); - // common part of DoSetClippingRegion() and DoSetDeviceClippingRegion() + // common part of DoSetClippingRegion() and DoSetClippingRegionAsRegion() void SetClippingHrgn(WXHRGN hrgn); // implementation of DoGetSize() for wxScreen/PrinterDC: this simply @@ -318,12 +291,12 @@ protected: #endif // wxUSE_PALETTE #if wxUSE_DC_CACHEING - static wxObjectList sm_bitmapCache; - static wxObjectList sm_dcCache; + static wxList sm_bitmapCache; + static wxList sm_dcCache; #endif - DECLARE_CLASS(wxMSWDCImpl) - wxDECLARE_NO_COPY_CLASS(wxMSWDCImpl); + DECLARE_DYNAMIC_CLASS(wxDC) + DECLARE_NO_COPY_CLASS(wxDC) }; // ---------------------------------------------------------------------------- @@ -331,27 +304,28 @@ protected: // only/mainly) // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxDCTempImpl : public wxMSWDCImpl +class WXDLLEXPORT wxDCTemp : public wxDC { public: // construct a temporary DC with the specified HDC and size (it should be // specified whenever we know it for this HDC) - wxDCTempImpl(wxDC *owner, WXHDC hdc, const wxSize& size ) - : wxMSWDCImpl( owner, hdc ), + wxDCTemp(WXHDC hdc, const wxSize& size = wxDefaultSize) + : wxDC(hdc), m_size(size) { } - virtual ~wxDCTempImpl() + virtual ~wxDCTemp() { // prevent base class dtor from freeing it SetHDC((WXHDC)NULL); } +protected: virtual void DoGetSize(int *w, int *h) const { wxASSERT_MSG( m_size.IsFullySpecified(), - wxT("size of this DC hadn't been set and is unknown") ); + _T("size of this DC hadn't been set and is unknown") ); if ( w ) *w = m_size.x; @@ -364,16 +338,7 @@ private: // find it ourselves const wxSize m_size; - wxDECLARE_NO_COPY_CLASS(wxDCTempImpl); -}; - -class WXDLLIMPEXP_CORE wxDCTemp : public wxDC -{ -public: - wxDCTemp(WXHDC hdc, const wxSize& size = wxDefaultSize) - : wxDC(new wxDCTempImpl(this, hdc, size)) - { - } + DECLARE_NO_COPY_CLASS(wxDCTemp) }; #endif // _WX_MSW_DC_H_ diff --git a/Source/3rd Party/wx/include/wx/msw/dcclient.h b/Source/3rd Party/wx/include/wx/msw/dcclient.h index 6f1b77e6a..e01171e3e 100644 --- a/Source/3rd Party/wx/include/wx/msw/dcclient.h +++ b/Source/3rd Party/wx/include/wx/msw/dcclient.h @@ -1,10 +1,10 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/dcclient.h +// Name: dcclient.h // Purpose: wxClientDC class // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: dcclient.h 53135 2008-04-12 02:31:04Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -17,8 +17,6 @@ // ---------------------------------------------------------------------------- #include "wx/dc.h" -#include "wx/msw/dc.h" -#include "wx/dcclient.h" #include "wx/dynarray.h" // ---------------------------------------------------------------------------- @@ -34,54 +32,56 @@ WX_DECLARE_EXPORTED_OBJARRAY(wxPaintDCInfo, wxArrayDCInfo); // DC classes // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxWindowDCImpl : public wxMSWDCImpl +class WXDLLEXPORT wxWindowDC : public wxDC { public: // default ctor - wxWindowDCImpl( wxDC *owner ); + wxWindowDC(); // Create a DC corresponding to the whole window - wxWindowDCImpl( wxDC *owner, wxWindow *win ); - - virtual void DoGetSize(int *width, int *height) const; + wxWindowDC(wxWindow *win); protected: // initialize the newly created DC void InitDC(); - DECLARE_CLASS(wxWindowDCImpl) - wxDECLARE_NO_COPY_CLASS(wxWindowDCImpl); + // override some base class virtuals + virtual void DoGetSize(int *width, int *height) const; + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxWindowDC) }; -class WXDLLIMPEXP_CORE wxClientDCImpl : public wxWindowDCImpl +class WXDLLEXPORT wxClientDC : public wxWindowDC { public: // default ctor - wxClientDCImpl( wxDC *owner ); + wxClientDC(); // Create a DC corresponding to the client area of the window - wxClientDCImpl( wxDC *owner, wxWindow *win ); + wxClientDC(wxWindow *win); - virtual ~wxClientDCImpl(); - - virtual void DoGetSize(int *width, int *height) const; + virtual ~wxClientDC(); protected: void InitDC(); - DECLARE_CLASS(wxClientDCImpl) - wxDECLARE_NO_COPY_CLASS(wxClientDCImpl); + // override some base class virtuals + virtual void DoGetSize(int *width, int *height) const; + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxClientDC) }; -class WXDLLIMPEXP_CORE wxPaintDCImpl : public wxClientDCImpl +class WXDLLEXPORT wxPaintDC : public wxClientDC { public: - wxPaintDCImpl( wxDC *owner ); + wxPaintDC(); // Create a DC corresponding for painting the window in OnPaint() - wxPaintDCImpl( wxDC *owner, wxWindow *win ); + wxPaintDC(wxWindow *win); - virtual ~wxPaintDCImpl(); + virtual ~wxPaintDC(); // find the entry for this DC in the cache (keyed by the window) static WXHDC FindDCInCache(wxWindow* win); @@ -92,8 +92,8 @@ protected: // find the entry for this DC in the cache (keyed by the window) wxPaintDCInfo *FindInCache(size_t *index = NULL) const; - DECLARE_CLASS(wxPaintDCImpl) - wxDECLARE_NO_COPY_CLASS(wxPaintDCImpl); +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxPaintDC) }; /* @@ -102,13 +102,16 @@ protected: * message. It is used in HandlePaint and need not be used by an application. */ -class WXDLLIMPEXP_CORE wxPaintDCEx : public wxPaintDC +class WXDLLEXPORT wxPaintDCEx : public wxPaintDC { public: wxPaintDCEx(wxWindow *canvas, WXHDC dc); + virtual ~wxPaintDCEx(); +private: + int saveState; DECLARE_CLASS(wxPaintDCEx) - wxDECLARE_NO_COPY_CLASS(wxPaintDCEx); + DECLARE_NO_COPY_CLASS(wxPaintDCEx) }; #endif diff --git a/Source/3rd Party/wx/include/wx/msw/dcmemory.h b/Source/3rd Party/wx/include/wx/msw/dcmemory.h index a4ef0f9d0..fced2bc4f 100644 --- a/Source/3rd Party/wx/include/wx/msw/dcmemory.h +++ b/Source/3rd Party/wx/include/wx/msw/dcmemory.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: dcmemory.h 48236 2007-08-20 23:43:32Z KO $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -12,33 +12,33 @@ #ifndef _WX_DCMEMORY_H_ #define _WX_DCMEMORY_H_ -#include "wx/dcmemory.h" -#include "wx/msw/dc.h" +#include "wx/dcclient.h" -class WXDLLIMPEXP_CORE wxMemoryDCImpl: public wxMSWDCImpl +class WXDLLEXPORT wxMemoryDC : public wxDC, public wxMemoryDCBase { public: - wxMemoryDCImpl( wxMemoryDC *owner ); - wxMemoryDCImpl( wxMemoryDC *owner, wxBitmap& bitmap ); - wxMemoryDCImpl( wxMemoryDC *owner, wxDC *dc ); // Create compatible DC + wxMemoryDC() { CreateCompatible(NULL); Init(); } + wxMemoryDC(wxBitmap& bitmap) { CreateCompatible(NULL); Init(); SelectObject(bitmap); } + wxMemoryDC(wxDC *dc); // Create compatible DC + +protected: // override some base class virtuals virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height); virtual void DoGetSize(int* width, int* height) const; virtual void DoSelect(const wxBitmap& bitmap); - virtual wxBitmap DoGetAsBitmap(const wxRect* subrect) const + virtual wxBitmap DoGetAsBitmap(const wxRect* subrect) const { return subrect == NULL ? GetSelectedBitmap() : GetSelectedBitmap().GetSubBitmapOfHDC(*subrect, GetHDC() );} -protected: // create DC compatible with the given one or screen if dc == NULL bool CreateCompatible(wxDC *dc); // initialize the newly created DC void Init(); - DECLARE_CLASS(wxMemoryDCImpl) - wxDECLARE_NO_COPY_CLASS(wxMemoryDCImpl); +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxMemoryDC) }; #endif diff --git a/Source/3rd Party/wx/include/wx/msw/dcprint.h b/Source/3rd Party/wx/include/wx/msw/dcprint.h index 2f91ac8d3..948b52e45 100644 --- a/Source/3rd Party/wx/include/wx/msw/dcprint.h +++ b/Source/3rd Party/wx/include/wx/msw/dcprint.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: dcprint.h 42522 2006-10-27 13:07:40Z JS $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -14,20 +14,19 @@ #if wxUSE_PRINTING_ARCHITECTURE -#include "wx/dcprint.h" +#include "wx/dc.h" #include "wx/cmndata.h" -#include "wx/msw/dc.h" -// ------------------------------------------------------------------------ -// wxPrinterDCImpl -// - -class WXDLLIMPEXP_CORE wxPrinterDCImpl : public wxMSWDCImpl +class WXDLLEXPORT wxPrinterDC : public wxDC { public: + // Create a printer DC (obsolete function: use wxPrintData version now) + wxPrinterDC(const wxString& driver, const wxString& device, const wxString& output, bool interactive = true, int orientation = wxPORTRAIT); + // Create from print data - wxPrinterDCImpl( wxPrinterDC *owner, const wxPrintData& data ); - wxPrinterDCImpl( wxPrinterDC *owner, WXHDC theDC ); + wxPrinterDC(const wxPrintData& data); + + wxPrinterDC(WXHDC theDC); // override some base class virtuals virtual bool StartDoc(const wxString& message); @@ -35,7 +34,7 @@ public: virtual void StartPage(); virtual void EndPage(); - virtual wxRect GetPaperRect() const; + wxRect GetPaperRect(); protected: virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, @@ -43,8 +42,7 @@ protected: virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, wxDC *source, wxCoord xsrc, wxCoord ysrc, - wxRasterOperationMode rop = wxCOPY, bool useMask = false, - wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord); + int rop = wxCOPY, bool useMask = false, wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord); virtual void DoGetSize(int *w, int *h) const { GetDeviceSize(w, h); @@ -57,25 +55,14 @@ protected: wxPrintData m_printData; private: - DECLARE_CLASS(wxPrinterDCImpl) - wxDECLARE_NO_COPY_CLASS(wxPrinterDCImpl); + DECLARE_DYNAMIC_CLASS_NO_COPY(wxPrinterDC) }; +// Gets an HDC for the default printer configuration +// WXHDC WXDLLEXPORT wxGetPrinterDC(int orientation); + // Gets an HDC for the specified printer configuration -WXHDC WXDLLIMPEXP_CORE wxGetPrinterDC(const wxPrintData& data); - -// ------------------------------------------------------------------------ -// wxPrinterDCromHDC -// - -class WXDLLIMPEXP_CORE wxPrinterDCFromHDC: public wxPrinterDC -{ -public: - wxPrinterDCFromHDC( WXHDC theDC ) - : wxPrinterDC(new wxPrinterDCImpl(this, theDC)) - { - } -}; +WXHDC WXDLLEXPORT wxGetPrinterDC(const wxPrintData& data); #endif // wxUSE_PRINTING_ARCHITECTURE diff --git a/Source/3rd Party/wx/include/wx/msw/dcscreen.h b/Source/3rd Party/wx/include/wx/msw/dcscreen.h index c0c07eeb7..89c83ae7f 100644 --- a/Source/3rd Party/wx/include/wx/msw/dcscreen.h +++ b/Source/3rd Party/wx/include/wx/msw/dcscreen.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: dcscreen.h 36565 2005-12-25 12:52:53Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -12,22 +12,28 @@ #ifndef _WX_MSW_DCSCREEN_H_ #define _WX_MSW_DCSCREEN_H_ -#include "wx/dcscreen.h" -#include "wx/msw/dc.h" +#include "wx/dc.h" -class WXDLLIMPEXP_CORE wxScreenDCImpl : public wxMSWDCImpl +class WXDLLEXPORT wxScreenDC : public wxDC { public: // Create a DC representing the whole screen - wxScreenDCImpl( wxScreenDC *owner ); + wxScreenDC(); + // Compatibility with X's requirements for drawing on top of all windows: + // they don't do anything under MSW + static bool StartDrawingOnTop(wxWindow* WXUNUSED(window)) { return true; } + static bool StartDrawingOnTop(wxRect* WXUNUSED(rect) = NULL) { return true; } + static bool EndDrawingOnTop() { return true; } + +protected: virtual void DoGetSize(int *w, int *h) const { GetDeviceSize(w, h); } - DECLARE_CLASS(wxScreenDCImpl) - wxDECLARE_NO_COPY_CLASS(wxScreenDCImpl); +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxScreenDC) }; #endif // _WX_MSW_DCSCREEN_H_ diff --git a/Source/3rd Party/wx/include/wx/msw/dde.h b/Source/3rd Party/wx/include/wx/msw/dde.h index d3414a8d6..fe8f23c2f 100644 --- a/Source/3rd Party/wx/include/wx/msw/dde.h +++ b/Source/3rd Party/wx/include/wx/msw/dde.h @@ -1,10 +1,10 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/dde.h +// Name: dde.h // Purpose: DDE class // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: dde.h 53135 2008-04-12 02:31:04Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -41,98 +41,104 @@ class WXDLLIMPEXP_FWD_BASE wxDDEServer; class WXDLLIMPEXP_FWD_BASE wxDDEClient; -class WXDLLIMPEXP_BASE wxDDEConnection : public wxConnectionBase +class WXDLLIMPEXP_BASE wxDDEConnection: public wxConnectionBase { + DECLARE_DYNAMIC_CLASS(wxDDEConnection) public: - wxDDEConnection(void *buffer, size_t size); // use external buffer + wxDDEConnection(wxChar *buffer, int size); // use external buffer wxDDEConnection(); // use internal buffer - virtual ~wxDDEConnection(); + virtual ~wxDDEConnection(void); - // implement base class pure virtual methods - virtual const void *Request(const wxString& item, - size_t *size = NULL, - wxIPCFormat format = wxIPC_TEXT); + // Calls that CLIENT can make + virtual bool Execute(const wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT); + virtual bool Execute(const wxString& str) { return Execute(str, -1, wxIPC_TEXT); } + virtual wxChar *Request(const wxString& item, int *size = NULL, wxIPCFormat format = wxIPC_TEXT); + virtual bool Poke(const wxString& item, wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT); virtual bool StartAdvise(const wxString& item); virtual bool StopAdvise(const wxString& item); - virtual bool Disconnect(); -protected: - virtual bool DoExecute(const void *data, size_t size, wxIPCFormat format); - virtual bool DoPoke(const wxString& item, const void *data, size_t size, - wxIPCFormat format); - virtual bool DoAdvise(const wxString& item, const void *data, size_t size, - wxIPCFormat format); + // Calls that SERVER can make + virtual bool Advise(const wxString& item, wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT); -public: + // Calls that both can make + virtual bool Disconnect(void); + + // Default behaviour is to delete connection and return true + virtual bool OnDisconnect(void); + + public: wxString m_topicName; wxDDEServer* m_server; wxDDEClient* m_client; WXHCONV m_hConv; - const void* m_sendingData; + wxChar* m_sendingData; int m_dataSize; - wxIPCFormat m_dataType; + wxIPCFormat m_dataType; - wxDECLARE_NO_COPY_CLASS(wxDDEConnection); - DECLARE_DYNAMIC_CLASS(wxDDEConnection) + DECLARE_NO_COPY_CLASS(wxDDEConnection) }; -class WXDLLIMPEXP_BASE wxDDEServer : public wxServerBase +class WXDLLIMPEXP_BASE wxDDEServer: public wxServerBase { -public: - wxDDEServer(); - bool Create(const wxString& server_name); - virtual ~wxDDEServer(); + DECLARE_DYNAMIC_CLASS(wxDDEServer) + public: - virtual wxConnectionBase *OnAcceptConnection(const wxString& topic); + wxDDEServer(void); + virtual ~wxDDEServer(void); + bool Create(const wxString& server_name); // Returns false if can't create server (e.g. port + // number is already in use) + virtual wxConnectionBase *OnAcceptConnection(const wxString& topic); - // Find/delete wxDDEConnection corresponding to the HCONV - wxDDEConnection *FindConnection(WXHCONV conv); - bool DeleteConnection(WXHCONV conv); - wxString& GetServiceName() const { return (wxString&) m_serviceName; } + //////////////////////////////////////////////////////////// + // Implementation - wxDDEConnectionList& GetConnections() const - { return (wxDDEConnectionList&) m_connections; } + // Find/delete wxDDEConnection corresponding to the HCONV + wxDDEConnection *FindConnection(WXHCONV conv); + bool DeleteConnection(WXHCONV conv); + inline wxString& GetServiceName(void) const { return (wxString&) m_serviceName; } + inline wxDDEConnectionList& GetConnections(void) const + { + return (wxDDEConnectionList&) m_connections; + } protected: int m_lastError; wxString m_serviceName; wxDDEConnectionList m_connections; - - DECLARE_DYNAMIC_CLASS(wxDDEServer) }; class WXDLLIMPEXP_BASE wxDDEClient: public wxClientBase { -public: - wxDDEClient(); - virtual ~wxDDEClient(); + DECLARE_DYNAMIC_CLASS(wxDDEClient) + public: + wxDDEClient(void); + virtual ~wxDDEClient(void); + bool ValidHost(const wxString& host); + virtual wxConnectionBase *MakeConnection(const wxString& host, const wxString& server, const wxString& topic); + // Call this to make a connection. + // Returns NULL if cannot. + virtual wxConnectionBase *OnMakeConnection(void); // Tailor this to return own connection. - bool ValidHost(const wxString& host); + //////////////////////////////////////////////////////////// + // Implementation - // Call this to make a connection. Returns NULL if cannot. - virtual wxConnectionBase *MakeConnection(const wxString& host, - const wxString& server, - const wxString& topic); + // Find/delete wxDDEConnection corresponding to the HCONV + wxDDEConnection *FindConnection(WXHCONV conv); + bool DeleteConnection(WXHCONV conv); - // Tailor this to return own connection. - virtual wxConnectionBase *OnMakeConnection(); - - // Find/delete wxDDEConnection corresponding to the HCONV - wxDDEConnection *FindConnection(WXHCONV conv); - bool DeleteConnection(WXHCONV conv); - - wxDDEConnectionList& GetConnections() const - { return (wxDDEConnectionList&) m_connections; } + inline wxDDEConnectionList& GetConnections(void) const + { + return (wxDDEConnectionList&) m_connections; + } protected: int m_lastError; wxDDEConnectionList m_connections; - - DECLARE_DYNAMIC_CLASS(wxDDEClient) }; void WXDLLIMPEXP_BASE wxDDEInitialize(); void WXDLLIMPEXP_BASE wxDDECleanUp(); -#endif // _WX_DDE_H_ +#endif + // _WX_DDE_H_ diff --git a/Source/3rd Party/wx/include/wx/msw/debughlp.h b/Source/3rd Party/wx/include/wx/msw/debughlp.h index 61c944c22..65ca85d82 100644 --- a/Source/3rd Party/wx/include/wx/msw/debughlp.h +++ b/Source/3rd Party/wx/include/wx/msw/debughlp.h @@ -1,10 +1,10 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/debughlp.h +// Name: wx/msw/wrapdbgh.h // Purpose: wraps dbghelp.h standard file // Author: Vadim Zeitlin // Modified by: // Created: 2005-01-08 (extracted from msw/crashrpt.cpp) -// RCS-ID: $Id$ +// RCS-ID: $Id: debughlp.h 31443 2005-01-18 10:10:23Z ABX $ // Copyright: (c) 2003-2005 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -146,9 +146,9 @@ public: PGET_MODULE_BASE_ROUTINE, PTRANSLATE_ADDRESS_ROUTINE); typedef BOOL (WINAPI *SymFromAddr_t)(HANDLE, DWORD64, PDWORD64, PSYMBOL_INFO); - typedef LPVOID (WINAPI *SymFunctionTableAccess_t)(HANDLE, DWORD_PTR); - typedef DWORD_PTR (WINAPI *SymGetModuleBase_t)(HANDLE, DWORD_PTR); - typedef BOOL (WINAPI *SymGetLineFromAddr_t)(HANDLE, DWORD_PTR, + typedef LPVOID (WINAPI *SymFunctionTableAccess_t)(HANDLE, DWORD); + typedef DWORD (WINAPI *SymGetModuleBase_t)(HANDLE, DWORD); + typedef BOOL (WINAPI *SymGetLineFromAddr_t)(HANDLE, DWORD, PDWORD, PIMAGEHLP_LINE); typedef BOOL (WINAPI *SymSetContext_t)(HANDLE, PIMAGEHLP_STACK_FRAME, PIMAGEHLP_CONTEXT); @@ -164,44 +164,23 @@ public: CONST PMINIDUMP_USER_STREAM_INFORMATION, CONST PMINIDUMP_CALLBACK_INFORMATION); - // The macro called by wxDO_FOR_ALL_SYM_FUNCS() below takes 2 arguments: - // the name of the function in the program code, which never has "64" - // suffix, and the name of the function in the DLL which can have "64" - // suffix in some cases. These 2 helper macros call the macro with the - // correct arguments in both cases. - #define wxSYM_CALL(what, name) what(name, name) -#if defined(_M_AMD64) - #define wxSYM_CALL_64(what, name) what(name, name ## 64) - - // Also undo all the "helpful" definitions done by imagehlp.h that map 32 - // bit functions to 64 bit ones, we don't need this as we do it ourselves. - #undef StackWalk - #undef SymFunctionTableAccess - #undef SymGetModuleBase - #undef SymGetLineFromAddr - #undef EnumerateLoadedModules -#else - #define wxSYM_CALL_64(what, name) what(name, name) -#endif - #define wxDO_FOR_ALL_SYM_FUNCS(what) \ - wxSYM_CALL_64(what, StackWalk); \ - wxSYM_CALL_64(what, SymFunctionTableAccess); \ - wxSYM_CALL_64(what, SymGetModuleBase); \ - wxSYM_CALL_64(what, SymGetLineFromAddr); \ - wxSYM_CALL_64(what, EnumerateLoadedModules); \ - \ - wxSYM_CALL(what, SymGetOptions); \ - wxSYM_CALL(what, SymSetOptions); \ - wxSYM_CALL(what, SymInitialize); \ - wxSYM_CALL(what, SymFromAddr); \ - wxSYM_CALL(what, SymSetContext); \ - wxSYM_CALL(what, SymEnumSymbols); \ - wxSYM_CALL(what, SymGetTypeInfo); \ - wxSYM_CALL(what, SymCleanup); \ - wxSYM_CALL(what, MiniDumpWriteDump) + what(SymGetOptions); \ + what(SymSetOptions); \ + what(SymInitialize); \ + what(StackWalk); \ + what(SymFromAddr); \ + what(SymFunctionTableAccess); \ + what(SymGetModuleBase); \ + what(SymGetLineFromAddr); \ + what(SymSetContext); \ + what(SymEnumSymbols); \ + what(SymGetTypeInfo); \ + what(SymCleanup); \ + what(EnumerateLoadedModules); \ + what(MiniDumpWriteDump) - #define wxDECLARE_SYM_FUNCTION(func, name) static func ## _t func + #define wxDECLARE_SYM_FUNCTION(func) static func ## _t func wxDO_FOR_ALL_SYM_FUNCS(wxDECLARE_SYM_FUNCTION); diff --git a/Source/3rd Party/wx/include/wx/msw/dialog.h b/Source/3rd Party/wx/include/wx/msw/dialog.h index 7822d7a05..15f8ba10f 100644 --- a/Source/3rd Party/wx/include/wx/msw/dialog.h +++ b/Source/3rd Party/wx/include/wx/msw/dialog.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: dialog.h 53135 2008-04-12 02:31:04Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -14,26 +14,17 @@ #include "wx/panel.h" -// this option is always enabled (there doesn't seem to be any good reason to -// disable it) for desktop Windows versions but Windows CE dialogs are usually -// not resizable and never show resize gripper anyhow so don't use it there -#ifdef __WXWINCE__ - #define wxUSE_DIALOG_SIZEGRIP 0 -#else - #define wxUSE_DIALOG_SIZEGRIP 1 -#endif - -extern WXDLLIMPEXP_DATA_CORE(const char) wxDialogNameStr[]; +extern WXDLLEXPORT_DATA(const wxChar) wxDialogNameStr[]; class WXDLLIMPEXP_FWD_CORE wxDialogModalData; #if wxUSE_TOOLBAR && (defined(__SMARTPHONE__) || defined(__POCKETPC__)) class WXDLLIMPEXP_FWD_CORE wxToolBar; -extern WXDLLIMPEXP_DATA_CORE(const char) wxToolBarNameStr[]; +extern WXDLLEXPORT_DATA(const wxChar) wxToolBarNameStr[]; #endif // Dialog boxes -class WXDLLIMPEXP_CORE wxDialog : public wxDialogBase +class WXDLLEXPORT wxDialog : public wxDialogBase { public: wxDialog() { Init(); } @@ -92,9 +83,7 @@ public: // override some base class virtuals virtual bool Show(bool show = true); -#if wxUSE_DIALOG_SIZEGRIP - virtual void SetWindowStyleFlag(long style); -#endif // wxUSE_DIALOG_SIZEGRIP + virtual void Raise(); #ifdef __POCKETPC__ // Responds to the OK button in a PocketPC titlebar. This @@ -107,26 +96,34 @@ public: // Windows callbacks WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam); +#if WXWIN_COMPATIBILITY_2_6 + // use the other ctor + wxDEPRECATED( wxDialog(wxWindow *parent, + const wxString& title, bool modal, + int x = wxDefaultCoord, int y = wxDefaultCoord, int width = 500, int height = 500, + long style = wxDEFAULT_DIALOG_STYLE, + const wxString& name = wxDialogNameStr) ); + + // just call Show() or ShowModal() + wxDEPRECATED( void SetModal(bool flag) ); + + // use IsModal() + wxDEPRECATED( bool IsModalShowing() const ); +#endif // WXWIN_COMPATIBILITY_2_6 + protected: + // find the window to use as parent for this dialog if none has been + // specified explicitly by the user + // + // may return NULL + wxWindow *FindSuitableParent() const; + // common part of all ctors void Init(); private: -#if wxUSE_DIALOG_SIZEGRIP - // these functions deal with the gripper window shown in the corner of - // resizable dialogs - void CreateGripper(); - void DestroyGripper(); - void ShowGripper(bool show); - void ResizeGripper(); - - // this function is used to adjust Z-order of new children relative to the - // gripper if we have one - void OnWindowCreate(wxWindowCreateEvent& event); - - // gripper window for a resizable dialog, NULL if we're not resizable - WXHWND m_hGripper; -#endif // wxUSE_DIALOG_SIZEGRIP + wxWindow* m_oldFocus; + bool m_endModalCalled; // allow for closing within InitDialog #if wxUSE_TOOLBAR && defined(__POCKETPC__) wxToolBar* m_dialogToolBar; @@ -136,7 +133,7 @@ private: wxDialogModalData *m_modalData; DECLARE_DYNAMIC_CLASS(wxDialog) - wxDECLARE_NO_COPY_CLASS(wxDialog); + DECLARE_NO_COPY_CLASS(wxDialog) }; #endif diff --git a/Source/3rd Party/wx/include/wx/msw/dib.h b/Source/3rd Party/wx/include/wx/msw/dib.h index af8ae120a..71ae02bb7 100644 --- a/Source/3rd Party/wx/include/wx/msw/dib.h +++ b/Source/3rd Party/wx/include/wx/msw/dib.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 03.03.03 (replaces the old file with the same name) -// RCS-ID: $Id$ +// RCS-ID: $Id: dib.h 49804 2007-11-10 01:09:42Z VZ $ // Copyright: (c) 1997-2003 wxWidgets team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -12,21 +12,18 @@ #ifndef _WX_MSW_DIB_H_ #define _WX_MSW_DIB_H_ +class WXDLLIMPEXP_FWD_CORE wxBitmap; class WXDLLIMPEXP_FWD_CORE wxPalette; #include "wx/msw/private.h" #if wxUSE_WXDIB -#ifdef __WXMSW__ - #include "wx/bitmap.h" -#endif // __WXMSW__ - // ---------------------------------------------------------------------------- // wxDIB: represents a DIB section // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxDIB +class WXDLLEXPORT wxDIB { public: // ctors and such @@ -40,11 +37,9 @@ public: wxDIB(int width, int height, int depth) { Init(); (void)Create(width, height, depth); } -#ifdef __WXMSW__ // create a DIB from the DDB wxDIB(const wxBitmap& bmp) { Init(); (void)Create(bmp); } -#endif // __WXMSW__ // create a DIB from the Windows DDB wxDIB(HBITMAP hbmp) @@ -58,9 +53,7 @@ public: // same as the corresponding ctors but with return value bool Create(int width, int height, int depth); -#ifdef __WXMSW__ - bool Create(const wxBitmap& bmp) { return Create(GetHbitmapOf(bmp)); } -#endif + bool Create(const wxBitmap& bmp); bool Create(HBITMAP hbmp); bool Load(const wxString& filename); @@ -145,28 +138,12 @@ public: // ------------------ #if wxUSE_IMAGE - // Possible formats for DIBs created by the functions below. - enum PixelFormat - { - PixelFormat_PreMultiplied = 0, - PixelFormat_NotPreMultiplied = 1 - }; - - // Create a DIB from the given image, the DIB will be either 24 or 32 (if - // the image has alpha channel) bpp. - // - // By default the DIB stores pixel data in pre-multiplied format so that it - // can be used with ::AlphaBlend() but it is also possible to disable - // pre-multiplication for the DIB to be usable with ImageList_Draw() which - // does pre-multiplication internally. - wxDIB(const wxImage& image, PixelFormat pf = PixelFormat_PreMultiplied) - { - Init(); - (void)Create(image, pf); - } + // create a DIB from the given image, the DIB will be either 24 or 32 (if + // the image has alpha channel) bpp + wxDIB(const wxImage& image) { Init(); (void)Create(image); } // same as the above ctor but with the return code - bool Create(const wxImage& image, PixelFormat pf = PixelFormat_PreMultiplied); + bool Create(const wxImage& image); // create wxImage having the same data as this DIB wxImage ConvertToImage() const; @@ -223,6 +200,11 @@ private: // the case bool m_ownsHandle; + // if true, we have alpha, if false we don't (note that we can still have + // m_depth == 32 but the last component is then simply padding and not + // alpha) + bool m_hasAlpha; + // DIBs can't be copied wxDIB(const wxDIB&); @@ -238,6 +220,7 @@ void wxDIB::Init() { m_handle = 0; m_ownsHandle = true; + m_hasAlpha = false; m_data = NULL; diff --git a/Source/3rd Party/wx/include/wx/msw/dirdlg.h b/Source/3rd Party/wx/include/wx/msw/dirdlg.h index 825c3b75d..8e27d57e3 100644 --- a/Source/3rd Party/wx/include/wx/msw/dirdlg.h +++ b/Source/3rd Party/wx/include/wx/msw/dirdlg.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: dirdlg.h 38956 2006-04-30 09:44:29Z RR $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -12,7 +12,7 @@ #ifndef _WX_DIRDLG_H_ #define _WX_DIRDLG_H_ -class WXDLLIMPEXP_CORE wxDirDialog : public wxDirDialogBase +class WXDLLEXPORT wxDirDialog : public wxDirDialogBase { public: wxDirDialog(wxWindow *parent, @@ -28,11 +28,6 @@ public: virtual int ShowModal(); private: - // The real implementations of ShowModal(), used for Windows versions - // before and since Vista. - int ShowSHBrowseForFolder(WXHWND owner); - int ShowIFileDialog(WXHWND owner); - DECLARE_DYNAMIC_CLASS_NO_COPY(wxDirDialog) }; diff --git a/Source/3rd Party/wx/include/wx/msw/dragimag.h b/Source/3rd Party/wx/include/wx/msw/dragimag.h index 03211aac5..ce944200e 100644 --- a/Source/3rd Party/wx/include/wx/msw/dragimag.h +++ b/Source/3rd Party/wx/include/wx/msw/dragimag.h @@ -5,7 +5,7 @@ // Author: Julian Smart // Modified by: // Created: 08/04/99 -// RCS-ID: $Id$ +// RCS-ID: $Id: dragimag.h 45845 2007-05-05 19:00:35Z PC $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -99,7 +99,7 @@ * wxDragImage */ -class WXDLLIMPEXP_CORE wxDragImage: public wxObject +class WXDLLEXPORT wxDragImage: public wxObject { public: @@ -114,6 +114,14 @@ public: Create(image, cursor); } + // Deprecated form of the above + wxDragImage(const wxBitmap& image, const wxCursor& cursor, const wxPoint& cursorHotspot) + { + Init(); + + Create(image, cursor, cursorHotspot); + } + wxDragImage(const wxIcon& image, const wxCursor& cursor = wxNullCursor) { Init(); @@ -121,6 +129,14 @@ public: Create(image, cursor); } + // Deprecated form of the above + wxDragImage(const wxIcon& image, const wxCursor& cursor, const wxPoint& cursorHotspot) + { + Init(); + + Create(image, cursor, cursorHotspot); + } + wxDragImage(const wxString& str, const wxCursor& cursor = wxNullCursor) { Init(); @@ -128,6 +144,14 @@ public: Create(str, cursor); } + // Deprecated form of the above + wxDragImage(const wxString& str, const wxCursor& cursor, const wxPoint& cursorHotspot) + { + Init(); + + Create(str, cursor, cursorHotspot); + } + #if wxUSE_TREECTRL wxDragImage(const wxTreeCtrl& treeCtrl, wxTreeItemId& id) { @@ -156,12 +180,27 @@ public: // Create a drag image from a bitmap and optional cursor bool Create(const wxBitmap& image, const wxCursor& cursor = wxNullCursor); + bool Create(const wxBitmap& image, const wxCursor& cursor, const wxPoint& WXUNUSED(cursorHotspot)) + { + wxLogDebug(wxT("wxDragImage::Create: use of a cursor hotspot is now deprecated. Please omit this argument.")); + return Create(image, cursor); + } // Create a drag image from an icon and optional cursor bool Create(const wxIcon& image, const wxCursor& cursor = wxNullCursor); + bool Create(const wxIcon& image, const wxCursor& cursor, const wxPoint& WXUNUSED(cursorHotspot)) + { + wxLogDebug(wxT("wxDragImage::Create: use of a cursor hotspot is now deprecated. Please omit this argument.")); + return Create(image, cursor); + } // Create a drag image from a string and optional cursor bool Create(const wxString& str, const wxCursor& cursor = wxNullCursor); + bool Create(const wxString& str, const wxCursor& cursor, const wxPoint& WXUNUSED(cursorHotspot)) + { + wxLogDebug(wxT("wxDragImage::Create: use of a cursor hotspot is now deprecated. Please omit this argument.")); + return Create(str, cursor); + } #if wxUSE_TREECTRL // Create a drag image for the given tree control item @@ -175,7 +214,7 @@ public: // Begin drag. hotspot is the location of the drag position relative to the upper-left // corner of the image. - bool BeginDrag(const wxPoint& hotspot, wxWindow* window, bool fullScreen = false, wxRect* rect = NULL); + bool BeginDrag(const wxPoint& hotspot, wxWindow* window, bool fullScreen = false, wxRect* rect = (wxRect*) NULL); // Begin drag. hotspot is the location of the drag position relative to the upper-left // corner of the image. This is full screen only. fullScreenRect gives the @@ -209,16 +248,6 @@ public: WXHIMAGELIST GetCursorHIMAGELIST() const { return m_hCursorImageList; } #endif - // don't use in new code, use versions without hot spot parameter -#if WXWIN_COMPATIBILITY_2_8 - wxDEPRECATED_CONSTRUCTOR( wxDragImage(const wxBitmap& image, const wxCursor& cursor, const wxPoint& cursorHotspot) ); - wxDEPRECATED_CONSTRUCTOR( wxDragImage(const wxString& str, const wxCursor& cursor, const wxPoint& cursorHotspot) ); - wxDEPRECATED_CONSTRUCTOR( wxDragImage(const wxIcon& image, const wxCursor& cursor, const wxPoint& cursorHotspot) ); - wxDEPRECATED( bool Create(const wxBitmap& image, const wxCursor& cursor, const wxPoint& cursorHotspot) ); - wxDEPRECATED( bool Create(const wxIcon& image, const wxCursor& cursor, const wxPoint& cursorHotspot) ); - wxDEPRECATED( bool Create(const wxString& str, const wxCursor& cursor, const wxPoint& cursorHotspot) ); -#endif // WXWIN_COMPATIBILITY_2_8 - protected: WXHIMAGELIST m_hImageList; @@ -237,7 +266,7 @@ protected: private: DECLARE_DYNAMIC_CLASS(wxDragImage) - wxDECLARE_NO_COPY_CLASS(wxDragImage); + DECLARE_NO_COPY_CLASS(wxDragImage) }; #endif // wxUSE_DRAGIMAGE diff --git a/Source/3rd Party/wx/include/wx/msw/enhmeta.h b/Source/3rd Party/wx/include/wx/msw/enhmeta.h index d2c7e1dce..59631b5af 100644 --- a/Source/3rd Party/wx/include/wx/msw/enhmeta.h +++ b/Source/3rd Party/wx/include/wx/msw/enhmeta.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 13.01.00 -// RCS-ID: $Id$ +// RCS-ID: $Id: enhmeta.h 60850 2009-06-01 10:16:13Z JS $ // Copyright: (c) 2000 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -13,22 +13,24 @@ #define _WX_MSW_ENHMETA_H_ #include "wx/dc.h" -#include "wx/gdiobj.h" #if wxUSE_DRAG_AND_DROP #include "wx/dataobj.h" #endif +// Change this to 1 if you set wxUSE_HIGH_QUALITY_PREVIEW_IN_WXMSW to 1 in prntbase.cpp +#define wxUSE_ENH_METAFILE_FROM_DC 0 + // ---------------------------------------------------------------------------- // wxEnhMetaFile: encapsulation of Win32 HENHMETAFILE // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxEnhMetaFile : public wxGDIObject +class WXDLLEXPORT wxEnhMetaFile : public wxObject { public: wxEnhMetaFile(const wxString& file = wxEmptyString) : m_filename(file) { Init(); } - wxEnhMetaFile(const wxEnhMetaFile& metafile) : wxGDIObject() + wxEnhMetaFile(const wxEnhMetaFile& metafile) : wxObject() { Init(); Assign(metafile); } wxEnhMetaFile& operator=(const wxEnhMetaFile& metafile) { Free(); Assign(metafile); return *this; } @@ -37,10 +39,11 @@ public: { Free(); } // display the picture stored in the metafile on the given DC - bool Play(wxDC *dc, wxRect *rectBound = NULL); + bool Play(wxDC *dc, wxRect *rectBound = (wxRect *)NULL); // accessors - virtual bool IsOk() const { return m_hMF != 0; } + bool Ok() const { return IsOk(); } + bool IsOk() const { return m_hMF != 0; } wxSize GetSize() const; int GetWidth() const { return GetSize().x; } @@ -62,11 +65,6 @@ protected: void Free(); void Assign(const wxEnhMetaFile& mf); - // we don't use these functions (but probably should) but have to implement - // them as they're pure virtual in the base class - virtual wxGDIRefData *CreateGDIRefData() const; - virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; - private: wxString m_filename; WXHANDLE m_hMF; @@ -78,7 +76,7 @@ private: // wxEnhMetaFileDC: allows to create a wxEnhMetaFile // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxEnhMetaFileDC : public wxDC +class WXDLLEXPORT wxEnhMetaFileDC : public wxDC { public: // the ctor parameters specify the filename (empty for memory metafiles), @@ -87,18 +85,28 @@ public: int width = 0, int height = 0, const wxString& description = wxEmptyString); +#if wxUSE_ENH_METAFILE_FROM_DC // as above, but takes reference DC as first argument to take resolution, // size, font metrics etc. from - wxEXPLICIT wxEnhMetaFileDC(const wxDC& referenceDC, const wxString& filename = wxEmptyString, int width = 0, int height = 0, const wxString& description = wxEmptyString); +#endif + + virtual ~wxEnhMetaFileDC(); // obtain a pointer to the new metafile (caller should delete it) wxEnhMetaFile *Close(); +protected: + virtual void DoGetSize(int *width, int *height) const; + private: + // size passed to ctor and returned by DoGetSize() + int m_width, + m_height; + DECLARE_DYNAMIC_CLASS_NO_COPY(wxEnhMetaFileDC) }; @@ -110,7 +118,7 @@ private: // notice that we want to support both CF_METAFILEPICT and CF_ENHMETAFILE and // so we derive from wxDataObject and not from wxDataObjectSimple -class WXDLLIMPEXP_CORE wxEnhMetaFileDataObject : public wxDataObject +class WXDLLEXPORT wxEnhMetaFileDataObject : public wxDataObject { public: // ctors @@ -137,7 +145,7 @@ public: protected: wxEnhMetaFile m_metafile; - wxDECLARE_NO_COPY_CLASS(wxEnhMetaFileDataObject); + DECLARE_NO_COPY_CLASS(wxEnhMetaFileDataObject) }; @@ -148,7 +156,7 @@ protected: // CF_ENHMETAFILE // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxEnhMetaFileSimpleDataObject : public wxDataObjectSimple +class WXDLLEXPORT wxEnhMetaFileSimpleDataObject : public wxDataObjectSimple { public: // ctors @@ -180,7 +188,7 @@ public: protected: wxEnhMetaFile m_metafile; - wxDECLARE_NO_COPY_CLASS(wxEnhMetaFileSimpleDataObject); + DECLARE_NO_COPY_CLASS(wxEnhMetaFileSimpleDataObject) }; #endif // wxUSE_DRAG_AND_DROP diff --git a/Source/3rd Party/wx/include/wx/msw/evtloop.h b/Source/3rd Party/wx/include/wx/msw/evtloop.h index f7d8fb8a7..d6f4312ac 100644 --- a/Source/3rd Party/wx/include/wx/msw/evtloop.h +++ b/Source/3rd Party/wx/include/wx/msw/evtloop.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 2004-07-31 -// RCS-ID: $Id$ +// RCS-ID: $Id: evtloop.h 36881 2006-01-15 10:13:40Z ABX $ // Copyright: (c) 2003-2004 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -12,51 +12,31 @@ #ifndef _WX_MSW_EVTLOOP_H_ #define _WX_MSW_EVTLOOP_H_ -#if wxUSE_GUI -#include "wx/dynarray.h" -#include "wx/msw/wrapwin.h" #include "wx/window.h" -#endif // ---------------------------------------------------------------------------- // wxEventLoop // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_BASE wxMSWEventLoopBase : public wxEventLoopManual +class WXDLLEXPORT wxEventLoop : public wxEventLoopManual { public: - wxMSWEventLoopBase(); + wxEventLoop(); // implement base class pure virtuals virtual bool Pending() const; + virtual bool Dispatch(); -protected: - // get the next message from queue and return true or return false if we - // got WM_QUIT or an error occurred - bool GetNextMessage(WXMSG *msg); - - // same as above but with a timeout and return value can be -1 meaning that - // time out expired in addition to - int GetNextMessageTimeout(WXMSG *msg, unsigned long timeout); -}; - -#if wxUSE_GUI - -WX_DECLARE_EXPORTED_OBJARRAY(MSG, wxMSGArray); - -class WXDLLIMPEXP_CORE wxGUIEventLoop : public wxMSWEventLoopBase -{ -public: - wxGUIEventLoop() { } - - // process a single message: calls PreProcessMessage() before dispatching - // it - virtual void ProcessMessage(WXMSG *msg); + // MSW-specific methods + // -------------------- // preprocess a message, return true if processed (i.e. no further // dispatching required) virtual bool PreProcessMessage(WXMSG *msg); + // process a single message + virtual void ProcessMessage(WXMSG *msg); + // set the critical window: this is the window such that all the events // except those to this window (and its children) stop to be processed // (typical examples: assert or crash report dialog) @@ -72,48 +52,18 @@ public: return !ms_winCritical || IsChildOfCriticalWindow(win); } - // override/implement base class virtuals - virtual bool Dispatch(); - virtual int DispatchTimeout(unsigned long timeout); - virtual void WakeUp(); - virtual bool YieldFor(long eventsToProcess); - protected: + // override/implement base class virtuals + virtual void WakeUp(); virtual void OnNextIteration(); -private: // check if the given window is a child of ms_winCritical (which must be // non NULL) static bool IsChildOfCriticalWindow(wxWindowMSW *win); - // array of messages used for temporary storage by YieldFor() - wxMSGArray m_arrMSG; // critical window or NULL static wxWindowMSW *ms_winCritical; }; -#else // !wxUSE_GUI - -#if wxUSE_CONSOLE_EVENTLOOP - -class WXDLLIMPEXP_BASE wxConsoleEventLoop : public wxMSWEventLoopBase -{ -public: - wxConsoleEventLoop() { } - - // override/implement base class virtuals - virtual bool Dispatch(); - virtual int DispatchTimeout(unsigned long timeout); - virtual void WakeUp(); - virtual bool YieldFor(long WXUNUSED(eventsToProcess)) { return true; } - - // MSW-specific function to process a single message - virtual void ProcessMessage(WXMSG *msg); -}; - -#endif // wxUSE_CONSOLE_EVENTLOOP - -#endif // wxUSE_GUI/!wxUSE_GUI - #endif // _WX_MSW_EVTLOOP_H_ diff --git a/Source/3rd Party/wx/include/wx/msw/fdrepdlg.h b/Source/3rd Party/wx/include/wx/msw/fdrepdlg.h index dc10512c5..1e534ae85 100644 --- a/Source/3rd Party/wx/include/wx/msw/fdrepdlg.h +++ b/Source/3rd Party/wx/include/wx/msw/fdrepdlg.h @@ -4,7 +4,7 @@ // Author: Markus Greither // Modified by: 31.07.01: VZ: integrated into wxWidgets // Created: 23/03/2001 -// RCS-ID: $Id$ +// RCS-ID: // Copyright: (c) Markus Greither // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -16,7 +16,7 @@ // wxFindReplaceDialog: dialog for searching / replacing text // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxFindReplaceDialog : public wxFindReplaceDialogBase +class WXDLLEXPORT wxFindReplaceDialog : public wxFindReplaceDialogBase { public: // ctors and such @@ -56,7 +56,7 @@ protected: wxFindReplaceDialogImpl *m_impl; DECLARE_DYNAMIC_CLASS(wxFindReplaceDialog) - wxDECLARE_NO_COPY_CLASS(wxFindReplaceDialog); + DECLARE_NO_COPY_CLASS(wxFindReplaceDialog) }; #endif // _WX_MSW_FDREPDLG_H_ diff --git a/Source/3rd Party/wx/include/wx/msw/filedlg.h b/Source/3rd Party/wx/include/wx/msw/filedlg.h index de4416634..4608a2ed9 100644 --- a/Source/3rd Party/wx/include/wx/msw/filedlg.h +++ b/Source/3rd Party/wx/include/wx/msw/filedlg.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: filedlg.h 39402 2006-05-28 23:32:12Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -16,7 +16,7 @@ // wxFileDialog //------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxFileDialog: public wxFileDialogBase +class WXDLLEXPORT wxFileDialog: public wxFileDialogBase { public: wxFileDialog(wxWindow *parent, @@ -29,40 +29,26 @@ public: const wxSize& sz = wxDefaultSize, const wxString& name = wxFileDialogNameStr); + virtual void SetPath(const wxString& path); virtual void GetPaths(wxArrayString& paths) const; virtual void GetFilenames(wxArrayString& files) const; -#ifndef __WXWINCE__ - virtual bool SupportsExtraControl() const { return true; } - void MSWOnInitDialogHook(WXHWND hwnd); -#endif // __WXWINCE__ virtual int ShowModal(); - // wxMSW-specific implementation from now on - // ----------------------------------------- - - // called from the hook procedure on CDN_INITDONE reception - virtual void MSWOnInitDone(WXHWND hDlg); - protected: #if !(defined(__SMARTPHONE__) && defined(__WXWINCE__)) virtual void DoMoveWindow(int x, int y, int width, int height); - virtual void DoCentre(int dir); virtual void DoGetSize( int *width, int *height ) const; virtual void DoGetPosition( int *x, int *y ) const; #endif // !(__SMARTPHONE__ && __WXWINCE__) private: wxArrayString m_fileNames; - - // remember if our SetPosition() or Centre() (which requires special - // treatment) was called bool m_bMovedWindow; - int m_centreDir; // nothing to do if 0 DECLARE_DYNAMIC_CLASS(wxFileDialog) - wxDECLARE_NO_COPY_CLASS(wxFileDialog); + DECLARE_NO_COPY_CLASS(wxFileDialog) }; #endif // _WX_FILEDLG_H_ diff --git a/Source/3rd Party/wx/include/wx/msw/font.h b/Source/3rd Party/wx/include/wx/msw/font.h index 576d7f83d..925355dfb 100644 --- a/Source/3rd Party/wx/include/wx/msw/font.h +++ b/Source/3rd Party/wx/include/wx/msw/font.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: font.h 39411 2006-05-29 00:03:36Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -18,13 +18,12 @@ // wxFont // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxFont : public wxFontBase +class WXDLLEXPORT wxFont : public wxFontBase { public: // ctors and such wxFont() { } -#if FUTURE_WXWIN_COMPATIBILITY_3_0 wxFont(int size, int family, int style, @@ -33,34 +32,9 @@ public: const wxString& face = wxEmptyString, wxFontEncoding encoding = wxFONTENCODING_DEFAULT) { - (void)Create(size, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underlined, face, encoding); - } -#endif - - wxFont(int size, - wxFontFamily family, - wxFontStyle style, - wxFontWeight weight, - bool underlined = false, - const wxString& face = wxEmptyString, - wxFontEncoding encoding = wxFONTENCODING_DEFAULT) - { - Create(size, family, style, weight, underlined, face, encoding); + (void)Create(size, family, style, weight, underlined, face, encoding); } - bool Create(int size, - wxFontFamily family, - wxFontStyle style, - wxFontWeight weight, - bool underlined = false, - const wxString& face = wxEmptyString, - wxFontEncoding encoding = wxFONTENCODING_DEFAULT) - { - return DoCreate(size, wxDefaultSize, false, family, style, - weight, underlined, face, encoding); - } - -#if FUTURE_WXWIN_COMPATIBILITY_3_0 wxFont(const wxSize& pixelSize, int family, int style, @@ -68,19 +42,6 @@ public: bool underlined = false, const wxString& face = wxEmptyString, wxFontEncoding encoding = wxFONTENCODING_DEFAULT) - { - (void)Create(pixelSize, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, - underlined, face, encoding); - } -#endif - - wxFont(const wxSize& pixelSize, - wxFontFamily family, - wxFontStyle style, - wxFontWeight weight, - bool underlined = false, - const wxString& face = wxEmptyString, - wxFontEncoding encoding = wxFONTENCODING_DEFAULT) { (void)Create(pixelSize, family, style, weight, underlined, face, encoding); @@ -91,19 +52,24 @@ public: Create(info, hFont); } - wxFont(int pointSize, - wxFontFamily family, - int flags = wxFONTFLAG_DEFAULT, - const wxString& face = wxEmptyString, - wxFontEncoding encoding = wxFONTENCODING_DEFAULT); - wxFont(const wxString& fontDesc); + bool Create(int size, + int family, + int style, + int weight, + bool underlined = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT) + { + return DoCreate(size, wxDefaultSize, false, family, style, + weight, underlined, face, encoding); + } bool Create(const wxSize& pixelSize, - wxFontFamily family, - wxFontStyle style, - wxFontWeight weight, + int family, + int style, + int weight, bool underlined = false, const wxString& face = wxEmptyString, wxFontEncoding encoding = wxFONTENCODING_DEFAULT) @@ -116,30 +82,31 @@ public: virtual ~wxFont(); + // wxFontBase overridden functions + virtual wxString GetNativeFontInfoDesc() const; + virtual wxString GetNativeFontInfoUserDesc() const; + // implement base class pure virtuals virtual int GetPointSize() const; virtual wxSize GetPixelSize() const; virtual bool IsUsingSizeInPixels() const; - virtual wxFontStyle GetStyle() const; - virtual wxFontWeight GetWeight() const; + virtual int GetFamily() const; + virtual int GetStyle() const; + virtual int GetWeight() const; virtual bool GetUnderlined() const; - virtual bool GetStrikethrough() const; virtual wxString GetFaceName() const; virtual wxFontEncoding GetEncoding() const; virtual const wxNativeFontInfo *GetNativeFontInfo() const; virtual void SetPointSize(int pointSize); virtual void SetPixelSize(const wxSize& pixelSize); - virtual void SetFamily(wxFontFamily family); - virtual void SetStyle(wxFontStyle style); - virtual void SetWeight(wxFontWeight weight); + virtual void SetFamily(int family); + virtual void SetStyle(int style); + virtual void SetWeight(int weight); virtual bool SetFaceName(const wxString& faceName); virtual void SetUnderlined(bool underlined); - virtual void SetStrikethrough(bool strikethrough); virtual void SetEncoding(wxFontEncoding encoding); - wxDECLARE_COMMON_FONT_METHODS(); - virtual bool IsFixedWidth() const; // implementation only from now on @@ -153,24 +120,26 @@ public: // for consistency with other wxMSW classes WXHFONT GetHFONT() const; + /* + virtual bool UseResource(); + virtual bool ReleaseResource(); + */ + protected: // real font creation function, used in all cases bool DoCreate(int size, const wxSize& pixelSize, bool sizeUsingPixels, - wxFontFamily family, - wxFontStyle style, - wxFontWeight weight, + int family, + int style, + int weight, bool underlined = false, const wxString& face = wxEmptyString, wxFontEncoding encoding = wxFONTENCODING_DEFAULT); virtual void DoSetNativeFontInfo(const wxNativeFontInfo& info); - virtual wxFontFamily DoGetFamily() const; - // implement wxObject virtuals which are used by AllocExclusive() - virtual wxGDIRefData *CreateGDIRefData() const; - virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; + void Unshare(); private: DECLARE_DYNAMIC_CLASS(wxFont) diff --git a/Source/3rd Party/wx/include/wx/msw/fontdlg.h b/Source/3rd Party/wx/include/wx/msw/fontdlg.h index 59904f3af..f3c3562d3 100644 --- a/Source/3rd Party/wx/include/wx/msw/fontdlg.h +++ b/Source/3rd Party/wx/include/wx/msw/fontdlg.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: fontdlg.h 38448 2006-03-30 14:04:17Z ABX $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -16,7 +16,7 @@ // wxFontDialog // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxFontDialog : public wxFontDialogBase +class WXDLLEXPORT wxFontDialog : public wxFontDialogBase { public: wxFontDialog() : wxFontDialogBase() { /* must be Create()d later */ } diff --git a/Source/3rd Party/wx/include/wx/msw/frame.h b/Source/3rd Party/wx/include/wx/msw/frame.h index e532de97c..dc3a58be5 100644 --- a/Source/3rd Party/wx/include/wx/msw/frame.h +++ b/Source/3rd Party/wx/include/wx/msw/frame.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: frame.h 45498 2007-04-16 13:03:05Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -12,7 +12,7 @@ #ifndef _WX_FRAME_H_ #define _WX_FRAME_H_ -class WXDLLIMPEXP_CORE wxFrame : public wxFrameBase +class WXDLLEXPORT wxFrame : public wxFrameBase { public: // construction @@ -42,6 +42,7 @@ public: // implement base class pure virtuals virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL); + virtual void Raise(); // implementation only from now on // ------------------------------- @@ -59,7 +60,7 @@ public: // Status bar #if wxUSE_STATUSBAR virtual wxStatusBar* OnCreateStatusBar(int number = 1, - long style = wxSTB_DEFAULT_STYLE, + long style = wxST_SIZEGRIP, wxWindowID id = 0, const wxString& name = wxStatusLineNameStr); @@ -74,10 +75,16 @@ public: { return m_useNativeStatusBar; } #endif // wxUSE_STATUSBAR +#if wxUSE_MENUS + WXHMENU GetWinMenu() const { return m_hMenu; } +#endif // wxUSE_MENUS + // event handlers + bool HandlePaint(); bool HandleSize(int x, int y, WXUINT flag); bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control); bool HandleMenuSelect(WXWORD nItem, WXWORD nFlags, WXHMENU hMenu); + bool HandleMenuLoop(const wxEventType& evtType, WXWORD isPopup); // tooltip management #if wxUSE_TOOLTIPS @@ -85,8 +92,9 @@ public: void SetToolTipCtrl(WXHWND hwndTT) { m_hwndToolTip = hwndTT; } #endif // tooltips - // override the base class function to handle iconized/maximized frames - virtual void SendSizeEvent(int flags = 0); + // a MSW only function which sends a size event to the window using its + // current size - this has an effect of refreshing the window layout + virtual void SendSizeEvent(); virtual wxPoint GetClientAreaOrigin() const; @@ -101,12 +109,6 @@ public: WXWPARAM wParam, WXLPARAM lParam); -#if wxUSE_MENUS - // get the currently active menu: this is the same as the frame menu for - // normal frames but is overridden by wxMDIParentFrame - virtual WXHMENU MSWGetActiveMenu() const { return m_hMenu; } -#endif // wxUSE_MENUS - protected: // common part of all ctors void Init(); @@ -131,17 +133,8 @@ protected: // wxMDIChildFrame bool MSWDoTranslateMessage(wxFrame *frame, WXMSG *msg); -#if wxUSE_MENUS - // handle WM_EXITMENULOOP message for Win95 only - bool HandleExitMenuLoop(WXWORD isPopup); - - // handle WM_(UN)INITMENUPOPUP message to generate wxEVT_MENU_OPEN/CLOSE - bool HandleMenuPopup(wxEventType evtType, WXHMENU hMenu); - - // Command part of HandleMenuPopup() and HandleExitMenuLoop(). - bool DoSendMenuOpenCloseEvent(wxEventType evtType, wxMenu* menu, bool popup); -#endif // wxUSE_MENUS - + // handle WM_INITMENUPOPUP message to generate wxEVT_MENU_OPEN + bool HandleInitMenuPopup(WXHMENU hMenu); virtual bool IsMDIChild() const { return false; } diff --git a/Source/3rd Party/wx/include/wx/msw/fswatcher.h b/Source/3rd Party/wx/include/wx/msw/fswatcher.h deleted file mode 100644 index 2937a0d6f..000000000 --- a/Source/3rd Party/wx/include/wx/msw/fswatcher.h +++ /dev/null @@ -1,38 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/fswatcher.h -// Purpose: wxMSWFileSystemWatcher -// Author: Bartosz Bekier -// Created: 2009-05-26 -// RCS-ID: $Id$ -// Copyright: (c) 2009 Bartosz Bekier -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FSWATCHER_MSW_H_ -#define _WX_FSWATCHER_MSW_H_ - -#include "wx/defs.h" - -#if wxUSE_FSWATCHER - -class WXDLLIMPEXP_BASE wxMSWFileSystemWatcher : public wxFileSystemWatcherBase -{ -public: - wxMSWFileSystemWatcher(); - - wxMSWFileSystemWatcher(const wxFileName& path, - int events = wxFSW_EVENT_ALL); - - // Override the base class function to provide a much more efficient - // implementation for it using the platform native support for watching the - // entire directory trees. - virtual bool AddTree(const wxFileName& path, int events = wxFSW_EVENT_ALL, - const wxString& filter = wxEmptyString); - -protected: - bool Init(); -}; - -#endif // wxUSE_FSWATCHER - -#endif /* _WX_FSWATCHER_MSW_H_ */ diff --git a/Source/3rd Party/wx/include/wx/msw/gauge.h b/Source/3rd Party/wx/include/wx/msw/gauge95.h similarity index 51% rename from Source/3rd Party/wx/include/wx/msw/gauge.h rename to Source/3rd Party/wx/include/wx/msw/gauge95.h index bc887a4c4..c6c74df20 100644 --- a/Source/3rd Party/wx/include/wx/msw/gauge.h +++ b/Source/3rd Party/wx/include/wx/msw/gauge95.h @@ -1,78 +1,70 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/gauge.h -// Purpose: wxGauge implementation for MSW -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_GAUGE_H_ -#define _WX_MSW_GAUGE_H_ - -#if wxUSE_GAUGE - -extern WXDLLIMPEXP_DATA_CORE(const char) wxGaugeNameStr[]; - -// Group box -class WXDLLIMPEXP_CORE wxGauge : public wxGaugeBase -{ -public: - wxGauge() { } - - wxGauge(wxWindow *parent, - wxWindowID id, - int range, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxGA_HORIZONTAL, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxGaugeNameStr) - { - (void)Create(parent, id, range, pos, size, style, validator, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - int range, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxGA_HORIZONTAL, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxGaugeNameStr); - - // set gauge range/value - virtual void SetRange(int range); - virtual void SetValue(int pos); - - // overridden base class virtuals - virtual bool SetForegroundColour(const wxColour& col); - virtual bool SetBackgroundColour(const wxColour& col); - - virtual void Pulse(); - - WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; - - // returns true if the platform should explicitly apply a theme border - virtual bool CanApplyThemeBorder() const { return false; } - -protected: - virtual wxSize DoGetBestSize() const; - -private: - // returns true if the control is currently in indeterminate (a.k.a. - // "marquee") mode - bool IsInIndeterminateMode() const; - - // switch to/from indeterminate mode - void SetIndeterminateMode(); - void SetDeterminateMode(); - - DECLARE_DYNAMIC_CLASS_NO_COPY(wxGauge) -}; - -#endif // wxUSE_GAUGE - -#endif // _WX_MSW_GAUGE_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: gauge95.h +// Purpose: wxGauge95 class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: gauge95.h 43881 2006-12-09 19:48:21Z PC $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _GAUGE95_H_ +#define _GAUGE95_H_ + +#if wxUSE_GAUGE + +extern WXDLLEXPORT_DATA(const wxChar) wxGaugeNameStr[]; + +// Group box +class WXDLLEXPORT wxGauge95 : public wxGaugeBase +{ +public: + wxGauge95() { } + + wxGauge95(wxWindow *parent, + wxWindowID id, + int range, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxGA_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxGaugeNameStr) + { + (void)Create(parent, id, range, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + int range, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxGA_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxGaugeNameStr); + + // set gauge range/value + virtual void SetRange(int range); + virtual void SetValue(int pos); + + // overriden base class virtuals + virtual bool SetForegroundColour(const wxColour& col); + virtual bool SetBackgroundColour(const wxColour& col); + + + void SetIndeterminateMode(); + void SetDeterminateMode(); + void Pulse(); + + WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; + +protected: + virtual wxSize DoGetBestSize() const; + + DECLARE_DYNAMIC_CLASS_NO_COPY(wxGauge95) +}; + +#endif // wxUSE_GAUGE + +#endif + // _GAUGEMSW_H_ diff --git a/Source/3rd Party/wx/include/wx/msw/gdiimage.h b/Source/3rd Party/wx/include/wx/msw/gdiimage.h index 1118db1c9..d78f5b620 100644 --- a/Source/3rd Party/wx/include/wx/msw/gdiimage.h +++ b/Source/3rd Party/wx/include/wx/msw/gdiimage.h @@ -1,11 +1,11 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/gdiimage.h +// Name: include/wx/msw/gdiimage.h // Purpose: wxGDIImage class: base class for wxBitmap, wxIcon, wxCursor // under MSW // Author: Vadim Zeitlin // Modified by: // Created: 20.11.99 -// RCS-ID: $Id$ +// RCS-ID: $Id: gdiimage.h 53135 2008-04-12 02:31:04Z VZ $ // Copyright: (c) 1999 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -30,7 +30,7 @@ WX_DECLARE_EXPORTED_LIST(wxGDIImageHandler, wxGDIImageHandlerList); // wxGDIImageRefData: common data fields for all derived classes // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxGDIImageRefData : public wxGDIRefData +class WXDLLEXPORT wxGDIImageRefData : public wxGDIRefData { public: wxGDIImageRefData() @@ -40,7 +40,7 @@ public: m_handle = 0; } - wxGDIImageRefData(const wxGDIImageRefData& data) : wxGDIRefData() + wxGDIImageRefData(const wxGDIImageRefData& data) : wxGDIRefData(data) { m_width = data.m_width; m_height = data.m_height; @@ -51,7 +51,7 @@ public: } // accessors - virtual bool IsOk() const { return m_handle != 0; } + bool IsOk() const { return m_handle != 0; } void SetSize(int w, int h) { m_width = w; m_height = h; } @@ -76,13 +76,58 @@ public: }; }; +// ---------------------------------------------------------------------------- +// wxGDIImageHandler: a class which knows how to load/save wxGDIImages. +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxGDIImageHandler : public wxObject +{ +public: + // ctor + wxGDIImageHandler() { m_type = wxBITMAP_TYPE_INVALID; } + wxGDIImageHandler(const wxString& name, + const wxString& ext, + long type) + : m_name(name), m_extension(ext) + { + m_type = type; + } + + // accessors + void SetName(const wxString& name) { m_name = name; } + void SetExtension(const wxString& ext) { m_extension = ext; } + void SetType(long type) { m_type = type; } + + const wxString& GetName() const { return m_name; } + const wxString& GetExtension() const { return m_extension; } + long GetType() const { return m_type; } + + // real handler operations: to implement in derived classes + virtual bool Create(wxGDIImage *image, + const void* data, + long flags, + int width, int height, int depth = 1) = 0; + virtual bool Load(wxGDIImage *image, + const wxString& name, + long flags, + int desiredWidth, int desiredHeight) = 0; + virtual bool Save(wxGDIImage *image, + const wxString& name, + int type) = 0; + +protected: + wxString m_name; + wxString m_extension; + long m_type; +}; + // ---------------------------------------------------------------------------- // wxGDIImage: this class supports GDI image handlers which may be registered // dynamically and will be used for loading/saving the images in the specified // format. It also falls back to wxImage if no appropriate image is found. // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxGDIImage : public wxGDIObject +class WXDLLEXPORT wxGDIImage : public wxGDIObject { public: // handlers list interface @@ -109,16 +154,13 @@ public: void SetHandle(WXHANDLE handle) { AllocExclusive(); GetGDIImageData()->m_handle = handle; } + bool Ok() const { return IsOk(); } + bool IsOk() const { return GetHandle() != 0; } + int GetWidth() const { return IsNull() ? 0 : GetGDIImageData()->m_width; } int GetHeight() const { return IsNull() ? 0 : GetGDIImageData()->m_height; } int GetDepth() const { return IsNull() ? 0 : GetGDIImageData()->m_depth; } - wxSize GetSize() const - { - return IsNull() ? wxSize(0,0) : - wxSize(GetGDIImageData()->m_width, GetGDIImageData()->m_height); - } - void SetWidth(int w) { AllocExclusive(); GetGDIImageData()->m_width = w; } void SetHeight(int h) { AllocExclusive(); GetGDIImageData()->m_height = h; } void SetDepth(int d) { AllocExclusive(); GetGDIImageData()->m_depth = d; } @@ -138,61 +180,10 @@ protected: // create the data for the derived class here virtual wxGDIImageRefData *CreateData() const = 0; - // implement the wxGDIObject method in terms of our, more specific, one - virtual wxGDIRefData *CreateGDIRefData() const { return CreateData(); } - - // we can't [efficiently] clone objects of this class - virtual wxGDIRefData * - CloneGDIRefData(const wxGDIRefData *WXUNUSED(data)) const - { - wxFAIL_MSG( wxT("must be implemented if used") ); - - return NULL; - } + // implement the wxObject method in terms of our, more specific, one + virtual wxObjectRefData *CreateRefData() const { return CreateData(); } static wxGDIImageHandlerList ms_handlers; }; -// ---------------------------------------------------------------------------- -// wxGDIImageHandler: a class which knows how to load/save wxGDIImages. -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxGDIImageHandler : public wxObject -{ -public: - // ctor - wxGDIImageHandler() { m_type = wxBITMAP_TYPE_INVALID; } - wxGDIImageHandler(const wxString& name, - const wxString& ext, - wxBitmapType type) - : m_name(name), m_extension(ext), m_type(type) { } - - // accessors - void SetName(const wxString& name) { m_name = name; } - void SetExtension(const wxString& ext) { m_extension = ext; } - void SetType(wxBitmapType type) { m_type = type; } - - const wxString& GetName() const { return m_name; } - const wxString& GetExtension() const { return m_extension; } - wxBitmapType GetType() const { return m_type; } - - // real handler operations: to implement in derived classes - virtual bool Create(wxGDIImage *image, - const void* data, - wxBitmapType flags, - int width, int height, int depth = 1) = 0; - virtual bool Load(wxGDIImage *image, - const wxString& name, - wxBitmapType flags, - int desiredWidth, int desiredHeight) = 0; - virtual bool Save(const wxGDIImage *image, - const wxString& name, - wxBitmapType type) const = 0; - -protected: - wxString m_name; - wxString m_extension; - wxBitmapType m_type; -}; - #endif // _WX_MSW_GDIIMAGE_H_ diff --git a/Source/3rd Party/wx/include/wx/msw/genrcdefs.h b/Source/3rd Party/wx/include/wx/msw/genrcdefs.h index 68c6fc4ac..d96634cfe 100644 --- a/Source/3rd Party/wx/include/wx/msw/genrcdefs.h +++ b/Source/3rd Party/wx/include/wx/msw/genrcdefs.h @@ -2,7 +2,7 @@ * Name: wx/msw/genrcdefs.h * Purpose: Emit preprocessor symbols into rcdefs.h for resource compiler * Author: Mike Wetherell - * RCS-ID: $Id$ + * RCS-ID: $Id: genrcdefs.h 36133 2005-11-08 22:49:46Z MW $ * Copyright: (c) 2005 Mike Wetherell * Licence: wxWindows licence */ diff --git a/Source/3rd Party/wx/include/wx/msw/gsockmsw.h b/Source/3rd Party/wx/include/wx/msw/gsockmsw.h new file mode 100644 index 000000000..6b5149ebb --- /dev/null +++ b/Source/3rd Party/wx/include/wx/msw/gsockmsw.h @@ -0,0 +1,145 @@ +/* ------------------------------------------------------------------------- + * Project: GSocket (Generic Socket) for WX + * Name: gsockmsw.h + * Copyright: (c) Guilhem Lavaux + * Licence: wxWindows Licence + * Purpose: GSocket MSW header + * CVSID: $Id: gsockmsw.h 33948 2005-05-04 18:57:50Z JS $ + * ------------------------------------------------------------------------- + */ + +#ifndef __GSOCK_MSW_H +#define __GSOCK_MSW_H + +#ifndef __GSOCKET_STANDALONE__ +#include "wx/setup.h" +#endif + +#if wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) + +#ifndef __GSOCKET_STANDALONE__ +#include "wx/gsocket.h" +#else +#include "gsocket.h" +#endif + +#include "wx/msw/wrapwin.h" + +#if defined(__CYGWIN__) + //CYGWIN gives annoying warning about runtime stuff if we don't do this +# define USE_SYS_TYPES_FD_SET +# include +#endif + +#if defined(__WXWINCE__) || defined(__CYGWIN__) +#include +#endif + +class GSocketGUIFunctionsTableConcrete: public GSocketGUIFunctionsTable +{ +public: + virtual bool OnInit(); + virtual void OnExit(); + virtual bool CanUseEventLoop(); + virtual bool Init_Socket(GSocket *socket); + virtual void Destroy_Socket(GSocket *socket); + virtual void Enable_Events(GSocket *socket); + virtual void Disable_Events(GSocket *socket); +}; + +/* Definition of GSocket */ +class GSocket +{ +public: + GSocket(); + ~GSocket(); + bool IsOk() { return m_ok; } + void Close(); + void Shutdown(); + GSocketError SetLocal(GAddress *address); + GSocketError SetPeer(GAddress *address); + GAddress *GetLocal(); + GAddress *GetPeer(); + GSocketError SetServer(); + GSocket *WaitConnection(); + bool SetReusable(); + GSocketError Connect(GSocketStream stream); + GSocketError SetNonOriented(); + int Read(char *buffer, int size); + int Write(const char *buffer, int size); + GSocketEventFlags Select(GSocketEventFlags flags); + void SetNonBlocking(bool non_block); + void SetTimeout(unsigned long millis); + GSocketError WXDLLIMPEXP_NET GetError(); + void SetCallback(GSocketEventFlags flags, + GSocketCallback callback, char *cdata); + void UnsetCallback(GSocketEventFlags flags); + GSocketError GetSockOpt(int level, int optname, + void *optval, int *optlen); + GSocketError SetSockOpt(int level, int optname, + const void *optval, int optlen); +protected: + GSocketError Input_Timeout(); + GSocketError Output_Timeout(); + GSocketError Connect_Timeout(); + int Recv_Stream(char *buffer, int size); + int Recv_Dgram(char *buffer, int size); + int Send_Stream(const char *buffer, int size); + int Send_Dgram(const char *buffer, int size); + bool m_ok; + +/* TODO: Make these protected */ +public: + SOCKET m_fd; + GAddress *m_local; + GAddress *m_peer; + GSocketError m_error; + + /* Attributes */ + bool m_non_blocking; + bool m_server; + bool m_stream; + bool m_establishing; + bool m_reusable; + struct timeval m_timeout; + + /* Callbacks */ + GSocketEventFlags m_detected; + GSocketCallback m_cbacks[GSOCK_MAX_EVENT]; + char *m_data[GSOCK_MAX_EVENT]; + int m_msgnumber; +}; + +#ifdef __cplusplus +extern "C" { +#endif + +/* Definition of GAddress */ +struct _GAddress +{ + struct sockaddr *m_addr; + size_t m_len; + + GAddressType m_family; + int m_realfamily; + + GSocketError m_error; +}; + + +/* GAddress */ + +GSocketError _GAddress_translate_from(GAddress *address, + struct sockaddr *addr, int len); +GSocketError _GAddress_translate_to (GAddress *address, + struct sockaddr **addr, int *len); +GSocketError _GAddress_Init_INET(GAddress *address); +GSocketError _GAddress_Init_UNIX(GAddress *address); + +#ifdef __cplusplus +} +#endif + +#endif /* wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) */ + +#endif /* __GSOCK_MSW_H */ diff --git a/Source/3rd Party/wx/include/wx/msw/headerctrl.h b/Source/3rd Party/wx/include/wx/msw/headerctrl.h deleted file mode 100644 index 42b8d57e2..000000000 --- a/Source/3rd Party/wx/include/wx/msw/headerctrl.h +++ /dev/null @@ -1,133 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/headerctrl.h -// Purpose: wxMSW native wxHeaderCtrl -// Author: Vadim Zeitlin -// Created: 2008-12-01 -// RCS-ID: $Id$ -// Copyright: (c) 2008 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_HEADERCTRL_H_ -#define _WX_MSW_HEADERCTRL_H_ - -class WXDLLIMPEXP_FWD_CORE wxImageList; - -// ---------------------------------------------------------------------------- -// wxHeaderCtrl -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxHeaderCtrl : public wxHeaderCtrlBase -{ -public: - wxHeaderCtrl() - { - Init(); - } - - wxHeaderCtrl(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxHD_DEFAULT_STYLE, - const wxString& name = wxHeaderCtrlNameStr) - { - Init(); - - Create(parent, id, pos, size, style, name); - } - - bool Create(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxHD_DEFAULT_STYLE, - const wxString& name = wxHeaderCtrlNameStr); - - virtual ~wxHeaderCtrl(); - - -private: - // implement base class pure virtuals - virtual void DoSetCount(unsigned int count); - virtual unsigned int DoGetCount() const; - virtual void DoUpdate(unsigned int idx); - - virtual void DoScrollHorz(int dx); - - virtual void DoSetColumnsOrder(const wxArrayInt& order); - virtual wxArrayInt DoGetColumnsOrder() const; - - // override wxWindow methods which must be implemented by a new control - virtual wxSize DoGetBestSize() const; - virtual void DoSetSize(int x, int y, - int width, int height, - int sizeFlags = wxSIZE_AUTO); - - // override MSW-specific methods needed for new control - virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; - virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); - - // common part of all ctors - void Init(); - - // wrapper around Header_InsertItem(): insert the item using information - // from the given column at the given index - void DoInsertItem(const wxHeaderColumn& col, unsigned int idx); - - // get the number of currently visible items: this is also the total number - // of items contained in the native control - int GetShownColumnsCount() const; - - // due to the discrepancy for the hidden columns which we know about but - // the native control does not, there can be a difference between the - // column indices we use and the ones used by the native control; these - // functions translate between them - // - // notice that MSWToNativeIdx() shouldn't be called for hidden columns and - // MSWFromNativeIdx() always returns an index of a visible column - int MSWToNativeIdx(int idx); - int MSWFromNativeIdx(int item); - - // this is the same as above but for order, not index - int MSWToNativeOrder(int order); - int MSWFromNativeOrder(int order); - - // get the event type corresponding to a click or double click event - // (depending on dblclk value) with the specified (using MSW convention) - // mouse button - wxEventType GetClickEventType(bool dblclk, int button); - - - // the number of columns in the control, including the hidden ones (not - // taken into account by the native control, see comment in DoGetCount()) - unsigned int m_numColumns; - - // this is a lookup table allowing us to check whether the column with the - // given index is currently shown in the native control, in which case the - // value of this array element with this index is 0, or hidden - // - // notice that this may be different from GetColumn(idx).IsHidden() and in - // fact we need this array precisely because it will be different from it - // in DoUpdate() when the column hidden flag gets toggled and we need it to - // handle this transition correctly - wxArrayInt m_isHidden; - - // the order of our columns: this array contains the index of the column - // shown at the position n as the n-th element - // - // this is necessary only to handle the hidden columns: the native control - // doesn't know about them and so we can't use Header_GetOrderArray() - wxArrayInt m_colIndices; - - // the image list: initially NULL, created on demand - wxImageList *m_imageList; - - // the offset of the window used to emulate scrolling it - int m_scrollOffset; - - wxDECLARE_NO_COPY_CLASS(wxHeaderCtrl); -}; - -#endif // _WX_MSW_HEADERCTRL_H_ - diff --git a/Source/3rd Party/wx/include/wx/msw/helpchm.h b/Source/3rd Party/wx/include/wx/msw/helpchm.h index f4c511831..a6c3e8440 100644 --- a/Source/3rd Party/wx/include/wx/msw/helpchm.h +++ b/Source/3rd Party/wx/include/wx/msw/helpchm.h @@ -1,22 +1,22 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/helpchm.h +// Name: helpchm.h // Purpose: Help system: MS HTML Help implementation // Author: Julian Smart // Modified by: // Created: 16/04/2000 -// RCS-ID: $Id$ +// RCS-ID: $Id: helpchm.h 39725 2006-06-14 17:46:51Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifndef _WX_MSW_HELPCHM_H_ -#define _WX_MSW_HELPCHM_H_ +#ifndef _WX_HELPCHM_H_ +#define _WX_HELPCHM_H_ #if wxUSE_MS_HTML_HELP #include "wx/helpbase.h" -class WXDLLIMPEXP_CORE wxCHMHelpController : public wxHelpControllerBase +class WXDLLEXPORT wxCHMHelpController : public wxHelpControllerBase { public: wxCHMHelpController(wxWindow* parentWindow = NULL): wxHelpControllerBase(parentWindow) { } @@ -45,46 +45,16 @@ public: wxWindow *window); protected: - // get the name of the CHM file we use from our m_helpFile - wxString GetValidFilename() const; - - // Call HtmlHelp() with the provided parameters (both overloads do the same - // thing but allow to avoid casts in the calling code) and return false - // (but don't crash) if HTML help is unavailable - static bool CallHtmlHelp(wxWindow *win, const wxChar *str, - unsigned cmd, WXWPARAM param); - static bool CallHtmlHelp(wxWindow *win, const wxChar *str, - unsigned cmd, const void *param = NULL) - { - return CallHtmlHelp(win, str, cmd, reinterpret_cast(param)); - } - - // even simpler wrappers using GetParentWindow() and GetValidFilename() as - // the first 2 HtmlHelp() parameters - bool CallHtmlHelp(unsigned cmd, WXWPARAM param) - { - return CallHtmlHelp(GetParentWindow(), GetValidFilename().t_str(), - cmd, param); - } - - bool CallHtmlHelp(unsigned cmd, const void *param = NULL) - { - return CallHtmlHelp(cmd, reinterpret_cast(param)); - } - - // wrapper around CallHtmlHelp(HH_DISPLAY_TEXT_POPUP): only one of text and - // contextId parameters can be non-NULL/non-zero - static bool DoDisplayTextPopup(const wxChar *text, - const wxPoint& pos, - int contextId, - wxWindow *window); - + // Append extension if necessary. + wxString GetValidFilename(const wxString& file) const; +protected: wxString m_helpFile; - DECLARE_DYNAMIC_CLASS(wxCHMHelpController) + DECLARE_CLASS(wxCHMHelpController) }; #endif // wxUSE_MS_HTML_HELP -#endif // _WX_MSW_HELPCHM_H_ +#endif +// _WX_HELPCHM_H_ diff --git a/Source/3rd Party/wx/include/wx/msw/helpwin.h b/Source/3rd Party/wx/include/wx/msw/helpwin.h index a8b00e1ab..e563c8e9c 100644 --- a/Source/3rd Party/wx/include/wx/msw/helpwin.h +++ b/Source/3rd Party/wx/include/wx/msw/helpwin.h @@ -1,10 +1,10 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/helpwin.h +// Name: helpwin.h // Purpose: Help system: WinHelp implementation // Author: Julian Smart // Modified by: // Created: 04/01/98 -// RCS-ID: $Id$ +// RCS-ID: $Id: helpwin.h 41020 2006-09-05 20:47:48Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -18,9 +18,9 @@ #include "wx/helpbase.h" -class WXDLLIMPEXP_CORE wxWinHelpController: public wxHelpControllerBase +class WXDLLEXPORT wxWinHelpController: public wxHelpControllerBase { - DECLARE_DYNAMIC_CLASS(wxWinHelpController) + DECLARE_CLASS(wxWinHelpController) public: wxWinHelpController(wxWindow* parentWindow = NULL): wxHelpControllerBase(parentWindow) {} diff --git a/Source/3rd Party/wx/include/wx/msw/htmlhelp.h b/Source/3rd Party/wx/include/wx/msw/htmlhelp.h index ff3622c65..960ee155c 100644 --- a/Source/3rd Party/wx/include/wx/msw/htmlhelp.h +++ b/Source/3rd Party/wx/include/wx/msw/htmlhelp.h @@ -3,9 +3,9 @@ * Copyright 2004 Jacek Caban * * Originally written for the Wine project, and issued under - * the wxWindows licence by kind permission of the author. + * the wxWindows License by kind permission of the author. * - * Licence: wxWindows licence + * License: wxWindows License */ #ifndef __HTMLHELP_H__ diff --git a/Source/3rd Party/wx/include/wx/msw/icon.h b/Source/3rd Party/wx/include/wx/msw/icon.h index ab0c357cf..d716a26a5 100644 --- a/Source/3rd Party/wx/include/wx/msw/icon.h +++ b/Source/3rd Party/wx/include/wx/msw/icon.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: icon.h 42752 2006-10-30 19:26:48Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -24,7 +24,7 @@ // notice that although wxIconRefData inherits from wxBitmapRefData, it is not // a valid wxBitmapRefData -class WXDLLIMPEXP_CORE wxIconRefData : public wxGDIImageRefData +class WXDLLEXPORT wxIconRefData : public wxGDIImageRefData { public: wxIconRefData() { } @@ -37,7 +37,7 @@ public: // Icon // --------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxIcon : public wxGDIImage +class WXDLLEXPORT wxIcon : public wxGDIImage { public: // ctors @@ -48,13 +48,13 @@ public: wxIcon(const char bits[], int width, int height); // from XPM data - wxIcon(const char* const* data) { CreateIconFromXpm(data); } -#ifdef wxNEEDS_CHARPP - wxIcon(char **data) { CreateIconFromXpm(const_cast(data)); } -#endif + wxIcon(const char **data) { CreateIconFromXpm(data); } + + wxIcon(char **data) { CreateIconFromXpm((const char **)data); } + // from resource/file wxIcon(const wxString& name, - wxBitmapType type = wxICON_DEFAULT_TYPE, + long type = wxBITMAP_TYPE_ICO_RESOURCE, int desiredWidth = -1, int desiredHeight = -1); wxIcon(const wxIconLocation& loc); @@ -62,7 +62,7 @@ public: virtual ~wxIcon(); virtual bool LoadFile(const wxString& name, - wxBitmapType type = wxICON_DEFAULT_TYPE, + long type = wxBITMAP_TYPE_ICO_RESOURCE, int desiredWidth = -1, int desiredHeight = -1); // implementation only from now on @@ -85,7 +85,7 @@ protected: virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const; // create from XPM data - void CreateIconFromXpm(const char* const* data); + void CreateIconFromXpm(const char **data); private: DECLARE_DYNAMIC_CLASS(wxIcon) diff --git a/Source/3rd Party/wx/include/wx/msw/imaglist.h b/Source/3rd Party/wx/include/wx/msw/imaglist.h index be5b5cc9c..b31c73539 100644 --- a/Source/3rd Party/wx/include/wx/msw/imaglist.h +++ b/Source/3rd Party/wx/include/wx/msw/imaglist.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: imaglist.h 41271 2006-09-18 04:41:09Z KO $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -18,7 +18,7 @@ // now, the app must take care of ownership issues. That is, the // image lists must be explicitly deleted after the control(s) that uses them // is (are) deleted, or when the app exits. -class WXDLLIMPEXP_CORE wxImageList : public wxObject +class WXDLLEXPORT wxImageList : public wxObject { public: /* @@ -199,7 +199,7 @@ public: protected: WXHIMAGELIST m_hImageList; - DECLARE_DYNAMIC_CLASS_NO_COPY(wxImageList) + DECLARE_DYNAMIC_CLASS(wxImageList) }; #endif diff --git a/Source/3rd Party/wx/include/wx/msw/iniconf.h b/Source/3rd Party/wx/include/wx/msw/iniconf.h new file mode 100644 index 000000000..61b9d0c8d --- /dev/null +++ b/Source/3rd Party/wx/include/wx/msw/iniconf.h @@ -0,0 +1,101 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: include/wx/msw/iniconf.h +// Purpose: INI-file based wxConfigBase implementation +// Author: Vadim Zeitlin +// Modified by: +// Created: 27.07.98 +// RCS-ID: $Id: iniconf.h 62185 2009-09-28 10:02:42Z JS $ +// Copyright: (c) 1998 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _INICONF_H +#define _INICONF_H + +#include "wx/defs.h" + +#if wxUSE_CONFIG + +// ---------------------------------------------------------------------------- +// wxIniConfig is a wxConfig implementation which uses MS Windows INI files to +// store the data. Because INI files don't really support arbitrary nesting of +// groups, we do the following: +// (1) in win.ini file we store all entries in the [vendor] section and +// the value group1/group2/key is mapped to the value group1_group2_key +// in this section, i.e. all path separators are replaced with underscore +// (2) in appname.ini file we map group1/group2/group3/key to the entry +// group2_group3_key in [group1] +// +// Of course, it might lead to indesirable results if '_' is also used in key +// names (i.e. group/key is the same as group_key) and also GetPath() result +// may be not what you would expect it to be. +// +// Another limitation: the keys and section names are never case-sensitive +// which might differ from wxFileConfig it it was compiled with +// wxCONFIG_CASE_SENSITIVE option. +// ---------------------------------------------------------------------------- + +// for this class, "local" file is the file appname.ini and the global file +// is the [vendor] subsection of win.ini (default for "vendor" is to be the +// same as appname). The file name (strAppName parameter) may, in fact, +// contain the full path to the file. If it doesn't, the file is searched for +// in the Windows directory. +class WXDLLEXPORT wxIniConfig : public wxConfigBase +{ +public: + // ctor & dtor + // if strAppName doesn't contain the extension and is not an absolute path, + // ".ini" is appended to it. if strVendor is empty, it's taken to be the + // same as strAppName. + wxIniConfig(const wxString& strAppName = wxEmptyString, const wxString& strVendor = wxEmptyString, + const wxString& localFilename = wxEmptyString, const wxString& globalFilename = wxEmptyString, long style = wxCONFIG_USE_LOCAL_FILE); + virtual ~wxIniConfig(); + + // implement inherited pure virtual functions + virtual void SetPath(const wxString& strPath); + virtual const wxString& GetPath() const; + + virtual bool GetFirstGroup(wxString& str, long& lIndex) const; + virtual bool GetNextGroup (wxString& str, long& lIndex) const; + virtual bool GetFirstEntry(wxString& str, long& lIndex) const; + virtual bool GetNextEntry (wxString& str, long& lIndex) const; + + virtual size_t GetNumberOfEntries(bool bRecursive = false) const; + virtual size_t GetNumberOfGroups(bool bRecursive = false) const; + + virtual bool HasGroup(const wxString& strName) const; + virtual bool HasEntry(const wxString& strName) const; + + // return true if the current group is empty + bool IsEmpty() const; + + virtual bool Flush(bool bCurrentOnly = false); + + virtual bool RenameEntry(const wxString& oldName, const wxString& newName); + virtual bool RenameGroup(const wxString& oldName, const wxString& newName); + + virtual bool DeleteEntry(const wxString& Key, bool bGroupIfEmptyAlso = true); + virtual bool DeleteGroup(const wxString& szKey); + virtual bool DeleteAll(); + +protected: + // read/write + bool DoReadString(const wxString& key, wxString *pStr) const; + bool DoReadLong(const wxString& key, long *plResult) const; + + bool DoWriteString(const wxString& key, const wxString& szValue); + bool DoWriteLong(const wxString& key, long lValue); + +private: + // helpers + wxString GetPrivateKeyName(const wxString& szKey) const; + wxString GetKeyName(const wxString& szKey) const; + + wxString m_strLocalFilename; // name of the private INI file + wxString m_strGroup, // current group in appname.ini file + m_strPath; // the rest of the path (no trailing '_'!) +}; + +#endif // wxUSE_CONFIG + +#endif // _INICONF_H diff --git a/Source/3rd Party/wx/include/wx/msw/init.h b/Source/3rd Party/wx/include/wx/msw/init.h deleted file mode 100644 index 7914e7496..000000000 --- a/Source/3rd Party/wx/include/wx/msw/init.h +++ /dev/null @@ -1,91 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/init.h -// Purpose: Windows-specific wxEntry() overload -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_INIT_H_ -#define _WX_MSW_INIT_H_ - -// ---------------------------------------------------------------------------- -// Windows-specific wxEntry() overload and wxIMPLEMENT_WXWIN_MAIN definition -// ---------------------------------------------------------------------------- - -// we need HINSTANCE declaration to define WinMain() -#include "wx/msw/wrapwin.h" - -#ifndef SW_SHOWNORMAL - #define SW_SHOWNORMAL 1 -#endif - -// WinMain() is always ANSI, even in Unicode build, under normal Windows -// but is always Unicode under CE -#ifdef __WXWINCE__ - typedef wchar_t *wxCmdLineArgType; -#else - typedef char *wxCmdLineArgType; -#endif - -// Windows-only overloads of wxEntry() and wxEntryStart() which take the -// parameters passed to WinMain() instead of those passed to main() -extern WXDLLIMPEXP_CORE bool - wxEntryStart(HINSTANCE hInstance, - HINSTANCE hPrevInstance = NULL, - wxCmdLineArgType pCmdLine = NULL, - int nCmdShow = SW_SHOWNORMAL); - -extern WXDLLIMPEXP_CORE int - wxEntry(HINSTANCE hInstance, - HINSTANCE hPrevInstance = NULL, - wxCmdLineArgType pCmdLine = NULL, - int nCmdShow = SW_SHOWNORMAL); - -#if defined(__BORLANDC__) && wxUSE_UNICODE - // Borland C++ has the following nonstandard behaviour: when the -WU - // command line flag is used, the linker expects to find wWinMain instead - // of WinMain. This flag causes the compiler to define _UNICODE and - // UNICODE symbols and there's no way to detect its use, so we have to - // define both WinMain and wWinMain so that wxIMPLEMENT_WXWIN_MAIN works - // for both code compiled with and without -WU. - // See http://sourceforge.net/tracker/?func=detail&atid=309863&aid=1935997&group_id=9863 - // for more details. - #define wxIMPLEMENT_WXWIN_MAIN_BORLAND_NONSTANDARD \ - extern "C" int WINAPI wWinMain(HINSTANCE hInstance, \ - HINSTANCE hPrevInstance, \ - wchar_t * WXUNUSED(lpCmdLine), \ - int nCmdShow) \ - { \ - wxDISABLE_DEBUG_SUPPORT(); \ - \ - /* NB: wxEntry expects lpCmdLine argument to be char*, not */ \ - /* wchar_t*, but fortunately it's not used anywhere */ \ - /* and we can simply pass NULL in: */ \ - return wxEntry(hInstance, hPrevInstance, NULL, nCmdShow); \ - } -#else - #define wxIMPLEMENT_WXWIN_MAIN_BORLAND_NONSTANDARD -#endif // defined(__BORLANDC__) && wxUSE_UNICODE - -#define wxIMPLEMENT_WXWIN_MAIN \ - extern "C" int WINAPI WinMain(HINSTANCE hInstance, \ - HINSTANCE hPrevInstance, \ - wxCmdLineArgType WXUNUSED(lpCmdLine), \ - int nCmdShow) \ - { \ - wxDISABLE_DEBUG_SUPPORT(); \ - \ - /* NB: We pass NULL in place of lpCmdLine to behave the same as */ \ - /* Borland-specific wWinMain() above. If it becomes needed */ \ - /* to pass lpCmdLine to wxEntry() here, you'll have to fix */ \ - /* wWinMain() above too. */ \ - return wxEntry(hInstance, hPrevInstance, NULL, nCmdShow); \ - } \ - wxIMPLEMENT_WXWIN_MAIN_BORLAND_NONSTANDARD - - -#endif // _WX_MSW_INIT_H_ diff --git a/Source/3rd Party/wx/include/wx/msw/libraries.h b/Source/3rd Party/wx/include/wx/msw/libraries.h index 27f3cbf7b..efd7389e0 100644 --- a/Source/3rd Party/wx/include/wx/msw/libraries.h +++ b/Source/3rd Party/wx/include/wx/msw/libraries.h @@ -3,7 +3,7 @@ * Purpose: Pragmas for linking libs conditionally * Author: Michael Wetherell * Modified by: - * RCS-ID: $Id$ + * RCS-ID: $Id: libraries.h 37045 2006-01-21 22:50:46Z MW $ * Copyright: (c) 2005 Michael Wetherell * Licence: wxWindows licence */ diff --git a/Source/3rd Party/wx/include/wx/msw/listbox.h b/Source/3rd Party/wx/include/wx/msw/listbox.h index 6518aec47..518b78303 100644 --- a/Source/3rd Party/wx/include/wx/msw/listbox.h +++ b/Source/3rd Party/wx/include/wx/msw/listbox.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: listbox.h 66941 2011-02-17 11:01:22Z JS $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -14,6 +14,10 @@ #if wxUSE_LISTBOX +// Fixing spurious selection events breaks binary compatibility, so this is normally 0. +// See ticket #12143 +#define wxUSE_LISTBOX_SELECTION_FIX 0 + // ---------------------------------------------------------------------------- // simple types // ---------------------------------------------------------------------------- @@ -34,11 +38,11 @@ class WXDLLIMPEXP_FWD_BASE wxArrayInt; // List box control // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxListBox : public wxListBoxBase +class WXDLLEXPORT wxListBox : public wxListBoxBase { public: // ctors and such - wxListBox() { Init(); } + wxListBox(); wxListBox(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, @@ -47,8 +51,6 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = wxListBoxNameStr) { - Init(); - Create(parent, id, pos, size, n, choices, style, validator, name); } wxListBox(wxWindow *parent, wxWindowID id, @@ -59,8 +61,6 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = wxListBoxNameStr) { - Init(); - Create(parent, id, pos, size, choices, style, validator, name); } @@ -81,6 +81,10 @@ public: virtual ~wxListBox(); + // implement base class pure virtuals + virtual void Clear(); + virtual void Delete(unsigned int n); + virtual unsigned int GetCount() const; virtual wxString GetString(unsigned int n) const; virtual void SetString(unsigned int n, const wxString& s); @@ -90,15 +94,8 @@ public: virtual int GetSelection() const; virtual int GetSelections(wxArrayInt& aSelections) const; - // return the index of the item at this position or wxNOT_FOUND - int HitTest(const wxPoint& pt) const { return DoHitTestList(pt); } - int HitTest(wxCoord x, wxCoord y) const { return DoHitTestList(wxPoint(x, y)); } - - // ownerdrawn wxListBox and wxCheckListBox support + // wxCheckListBox support #if wxUSE_OWNER_DRAWN - // override base class virtuals - virtual bool SetFont(const wxFont &font); - bool MSWOnMeasure(WXMEASUREITEMSTRUCT *item); bool MSWOnDraw(WXDRAWITEMSTRUCT *item); @@ -110,12 +107,6 @@ public: // get the index of the given item int GetItemIndex(wxOwnerDrawn *item) const { return m_aItems.Index(item); } - - // get rect of the given item index - bool GetItemRect(size_t n, wxRect& rect) const; - - // redraw the given item - bool RefreshItem(size_t n); #endif // wxUSE_OWNER_DRAWN // Windows-specific code to update the horizontal extent of the listbox, if @@ -146,59 +137,43 @@ public: return GetCompositeControlsDefaultAttributes(variant); } - // returns true if the platform should explicitly apply a theme border - virtual bool CanApplyThemeBorder() const { return false; } - - virtual void OnInternalIdle(); - +#if wxUSE_LISTBOX_SELECTION_FIX virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); +#endif protected: - virtual wxSize DoGetBestClientSize() const; - - virtual void DoClear(); - virtual void DoDeleteOneItem(unsigned int n); - virtual void DoSetSelection(int n, bool select); - - virtual int DoInsertItems(const wxArrayStringsAdapter& items, - unsigned int pos, - void **clientData, wxClientDataType type); - + virtual int DoAppend(const wxString& item); + virtual void DoInsertItems(const wxArrayString& items, unsigned int pos); + virtual void DoSetItems(const wxArrayString& items, void **clientData); virtual void DoSetFirstItem(int n); virtual void DoSetItemClientData(unsigned int n, void* clientData); virtual void* DoGetItemClientData(unsigned int n) const; - - // this can't be called DoHitTest() because wxWindow already has this method - virtual int DoHitTestList(const wxPoint& point) const; + virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData); + virtual wxClientData* DoGetItemClientObject(unsigned int n) const; + virtual int DoListHitTest(const wxPoint& point) const; // free memory (common part of Clear() and dtor) void Free(); unsigned int m_noItems; + int m_selected; + + virtual wxSize DoGetBestSize() const; #if wxUSE_OWNER_DRAWN // control items wxListBoxItemsArray m_aItems; #endif -private: - // common part of all ctors - void Init(); - - // call this when items are added to or deleted from the listbox or an - // items text changes - void MSWOnItemsChanged(); - - // flag indicating whether the max horizontal extent should be updated, - // i.e. if we need to call SetHorizontalExtent() from OnInternalIdle() - bool m_updateHorizontalExtent; - +#if wxUSE_LISTBOX_SELECTION_FIX // flag set to true when we get a keyboard event and reset to false when we // get a mouse one: this is used to find the correct item for the selection // event bool m_selectedByKeyboard; +#endif +private: DECLARE_DYNAMIC_CLASS_NO_COPY(wxListBox) }; diff --git a/Source/3rd Party/wx/include/wx/msw/listctrl.h b/Source/3rd Party/wx/include/wx/msw/listctrl.h index d96369245..de4c7d839 100644 --- a/Source/3rd Party/wx/include/wx/msw/listctrl.h +++ b/Source/3rd Party/wx/include/wx/msw/listctrl.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: Agron Selimaj // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: listctrl.h 54419 2008-06-29 01:35:24Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -13,14 +13,8 @@ #define _WX_LISTCTRL_H_ #include "wx/textctrl.h" -#include "wx/dynarray.h" -#include "wx/vector.h" -class wxMSWListItemData; - -// define this symbol to indicate the availability of SetColumnsOrder() and -// related functions -#define wxHAS_LISTCTRL_COLUMN_ORDER +class WXDLLIMPEXP_FWD_CORE wxImageList; /* The wxListCtrl can show lists of items in four different modes: @@ -76,7 +70,7 @@ class wxMSWListItemData; */ -class WXDLLIMPEXP_CORE wxListCtrl: public wxListCtrlBase +class WXDLLEXPORT wxListCtrl: public wxControl { public: /* @@ -120,25 +114,13 @@ public: bool GetColumn(int col, wxListItem& item) const; // Sets information about this column - bool SetColumn(int col, const wxListItem& item); + bool SetColumn(int col, const wxListItem& item) ; // Gets the column width int GetColumnWidth(int col) const; // Sets the column width - bool SetColumnWidth(int col, int width); - - - // Gets the column order from its index or index from its order - int GetColumnOrder(int col) const; - int GetColumnIndexFromOrder(int order) const; - - // Gets the column order for all columns - wxArrayInt GetColumnsOrder() const; - - // Sets the column order for all columns - bool SetColumnsOrder(const wxArrayInt& orders); - + bool SetColumnWidth(int col, int width) ; // Gets the number of items that can fit vertically in the // visible area of the list control (list or report view) @@ -153,48 +135,50 @@ public: wxTextCtrl* GetEditControl() const; // Gets information about the item - bool GetItem(wxListItem& info) const; + bool GetItem(wxListItem& info) const ; // Sets information about the item - bool SetItem(wxListItem& info); + bool SetItem(wxListItem& info) ; // Sets a string field at a particular column long SetItem(long index, int col, const wxString& label, int imageId = -1); // Gets the item state - int GetItemState(long item, long stateMask) const; + int GetItemState(long item, long stateMask) const ; // Sets the item state - bool SetItemState(long item, long state, long stateMask); + bool SetItemState(long item, long state, long stateMask) ; // Sets the item image - bool SetItemImage(long item, int image, int selImage = -1); + bool SetItemImage(long item, int image, int selImage = -1) ; bool SetItemColumnImage(long item, long column, int image); // Gets the item text - wxString GetItemText(long item, int col = 0) const; + wxString GetItemText(long item) const ; // Sets the item text - void SetItemText(long item, const wxString& str); + void SetItemText(long item, const wxString& str) ; // Gets the item data - wxUIntPtr GetItemData(long item) const; + wxUIntPtr GetItemData(long item) const ; // Sets the item data +#if wxABI_VERSION >= 20804 bool SetItemPtrData(long item, wxUIntPtr data); - bool SetItemData(long item, long data) { return SetItemPtrData(item, data); } +#endif // wxABI 2.8.4+ + bool SetItemData(long item, long data); // Gets the item rectangle - bool GetItemRect(long item, wxRect& rect, int code = wxLIST_RECT_BOUNDS) const; + bool GetItemRect(long item, wxRect& rect, int code = wxLIST_RECT_BOUNDS) const ; // Gets the subitem rectangle in report mode - bool GetSubItemRect(long item, long subItem, wxRect& rect, int code = wxLIST_RECT_BOUNDS) const; + bool GetSubItemRect(long item, long subItem, wxRect& rect, int code = wxLIST_RECT_BOUNDS) const ; // Gets the item position - bool GetItemPosition(long item, wxPoint& pos) const; + bool GetItemPosition(long item, wxPoint& pos) const ; // Sets the item position - bool SetItemPosition(long item, const wxPoint& pos); + bool SetItemPosition(long item, const wxPoint& pos) ; // Gets the number of items in the list control int GetItemCount() const; @@ -228,22 +212,22 @@ public: // Gets the index of the topmost visible item when in // list or report view - long GetTopItem() const; + long GetTopItem() const ; // Add or remove a single window style - void SetSingleStyle(long style, bool add = true); + void SetSingleStyle(long style, bool add = true) ; // Set the whole window style - void SetWindowStyleFlag(long style); + void SetWindowStyleFlag(long style) ; // Searches for an item, starting from 'item'. // item can be -1 to find the first item that matches the // specified flags. // Returns the item or -1 if unsuccessful. - long GetNextItem(long item, int geometry = wxLIST_NEXT_ALL, int state = wxLIST_STATE_DONTCARE) const; + long GetNextItem(long item, int geometry = wxLIST_NEXT_ALL, int state = wxLIST_STATE_DONTCARE) const ; // Gets one of the three image lists - wxImageList *GetImageList(int which) const; + wxImageList *GetImageList(int which) const ; // Sets the image list // N.B. There's a quirk in the Win95 list view implementation. @@ -252,8 +236,14 @@ public: // haven't specified wxLIST_MASK_IMAGE when inserting. // So you have to set a NULL small-icon image list to be sure that // the wxLC_LIST mode works without icons. Of course, you may want icons... - void SetImageList(wxImageList *imageList, int which); - void AssignImageList(wxImageList *imageList, int which); + void SetImageList(wxImageList *imageList, int which) ; + void AssignImageList(wxImageList *imageList, int which) ; + + // are we in report mode? + bool InReportView() const { return HasFlag(wxLC_REPORT); } + + // are we in virtual report mode? + bool IsVirtual() const { return HasFlag(wxLC_VIRTUAL); } // refresh items selectively (only useful for virtual list controls) void RefreshItem(long item); @@ -269,7 +259,7 @@ public: bool DeleteItem(long item); // Deletes all items - bool DeleteAllItems(); + bool DeleteAllItems() ; // Deletes a column bool DeleteColumn(int col); @@ -281,13 +271,13 @@ public: void ClearAll(); // Edit the label - wxTextCtrl* EditLabel(long item, wxClassInfo* textControlClass = wxCLASSINFO(wxTextCtrl)); + wxTextCtrl* EditLabel(long item, wxClassInfo* textControlClass = CLASSINFO(wxTextCtrl)); // End label editing, optionally cancelling the edit bool EndEditLabel(bool cancel); // Ensures this item is visible - bool EnsureVisible(long item); + bool EnsureVisible(long item) ; // Find an item whose label matches this string, starting from the item after 'start' // or the beginning if 'start' is -1. @@ -319,6 +309,14 @@ public: // Insert an image/string item long InsertItem(long index, const wxString& label, int imageIndex); + // For list view mode (only), inserts a column. + long InsertColumn(long col, const wxListItem& info); + + long InsertColumn(long col, + const wxString& heading, + int format = wxLIST_FORMAT_LEFT, + int width = -1); + // set the number of items in a virtual list control void SetItemCount(long count); @@ -340,7 +338,7 @@ public: // or zero if the two items are equivalent. // data is arbitrary data to be passed to the sort function. - bool SortItems(wxListCtrlCompare fn, wxIntPtr data); + bool SortItems(wxListCtrlCompare fn, long data); // IMPLEMENTATION virtual bool MSWCommand(WXUINT param, WXWORD id); @@ -384,26 +382,12 @@ protected: // common part of all ctors void Init(); - // Implement constrained best size calculation. - virtual int DoGetBestClientHeight(int width) const - { return MSWGetBestViewRect(width, -1).y; } - virtual int DoGetBestClientWidth(int height) const - { return MSWGetBestViewRect(-1, height).x; } - - wxSize MSWGetBestViewRect(int x, int y) const; - - // Implement base class pure virtual methods. - long DoInsertColumn(long col, const wxListItem& info); - // free memory taken by all internal data void FreeAllInternalData(); - // get the internal data object for this item (may return NULL) - wxMSWListItemData *MSWGetItemData(long item) const; - // get the item attribute, either by quering it for virtual control, or by // returning the one previously set using setter methods for a normal one - wxListItemAttr *DoGetItemColumnAttr(long item, long column) const; + wxListItemAttr *DoGetItemAttr(long item) const; wxTextCtrl* m_textCtrl; // The control used for editing a label @@ -418,9 +402,10 @@ protected: // keep track of inserted/deleted columns long m_count; // Keep track of item count to save calls to // ListView_GetItemCount + bool m_ignoreChangeMessages; - // all wxMSWListItemData objects we use - wxVector m_internalData; + // true if we have any internal data (user data & attributes) + bool m_AnyInternalData; // true if we have any items with custom attributes bool m_hasAnyAttr; @@ -442,12 +427,6 @@ protected: // return the attribute for the item (may return NULL if none) virtual wxListItemAttr *OnGetItemAttr(long item) const; - // return the attribute for the given item and column (may return NULL if none) - virtual wxListItemAttr *OnGetItemColumnAttr(long item, long WXUNUSED(column)) const - { - return OnGetItemAttr(item); - } - private: // process NM_CUSTOMDRAW notification message WXLPARAM OnCustomDraw(WXLPARAM lParam); @@ -462,14 +441,9 @@ private: // destroy m_textCtrl if it's currently valid and reset it to NULL void DeleteEditControl(); - // Intercept Escape and Enter keys to avoid them being stolen from our - // in-place editor control. - void OnCharHook(wxKeyEvent& event); - - DECLARE_DYNAMIC_CLASS(wxListCtrl) DECLARE_EVENT_TABLE() - wxDECLARE_NO_COPY_CLASS(wxListCtrl); + DECLARE_NO_COPY_CLASS(wxListCtrl) }; #endif // _WX_LISTCTRL_H_ diff --git a/Source/3rd Party/wx/include/wx/msw/mdi.h b/Source/3rd Party/wx/include/wx/msw/mdi.h index 8d9965684..46f7f1059 100644 --- a/Source/3rd Party/wx/include/wx/msw/mdi.h +++ b/Source/3rd Party/wx/include/wx/msw/mdi.h @@ -2,29 +2,31 @@ // Name: wx/msw/mdi.h // Purpose: MDI (Multiple Document Interface) classes // Author: Julian Smart -// Modified by: 2008-10-31 Vadim Zeitlin: derive from the base classes +// Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ -// Copyright: (c) 1997 Julian Smart -// (c) 2008 Vadim Zeitlin +// RCS-ID: $Id: mdi.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifndef _WX_MSW_MDI_H_ -#define _WX_MSW_MDI_H_ +#ifndef _WX_MDI_H_ +#define _WX_MDI_H_ #include "wx/frame.h" -class WXDLLIMPEXP_FWD_CORE wxAcceleratorTable; +extern WXDLLEXPORT_DATA(const wxChar) wxStatusLineNameStr[]; + +class WXDLLIMPEXP_FWD_CORE wxMDIClientWindow; +class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame; // --------------------------------------------------------------------------- // wxMDIParentFrame // --------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxMDIParentFrame : public wxMDIParentFrameBase +class WXDLLEXPORT wxMDIParentFrame : public wxFrame { public: - wxMDIParentFrame() { Init(); } + wxMDIParentFrame(); wxMDIParentFrame(wxWindow *parent, wxWindowID id, const wxString& title, @@ -33,8 +35,6 @@ public: long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, const wxString& name = wxFrameNameStr) { - Init(); - Create(parent, id, title, pos, size, style, name); } @@ -48,44 +48,32 @@ public: long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, const wxString& name = wxFrameNameStr); - // override/implement base class [pure] virtual methods - // ---------------------------------------------------- + // accessors + // --------- - static bool IsTDI() { return false; } + // Get the active MDI child window (Windows only) + wxMDIChildFrame *GetActiveChild() const; - // we don't store the active child in m_currentChild so override this - // function to find it dynamically - virtual wxMDIChildFrame *GetActiveChild() const; + // Get the client window + wxMDIClientWindow *GetClientWindow() const { return m_clientWindow; } + // Create the client window class (don't Create the window, + // just return a new class) + virtual wxMDIClientWindow *OnCreateClient(void); + + // MDI windows menu + wxMenu* GetWindowMenu() const { return m_windowMenu; } + void SetWindowMenu(wxMenu* menu) ; + virtual void DoMenuUpdates(wxMenu* menu = NULL); + + // MDI operations + // -------------- virtual void Cascade(); virtual void Tile(wxOrientation orient = wxHORIZONTAL); virtual void ArrangeIcons(); virtual void ActivateNext(); virtual void ActivatePrevious(); -#if wxUSE_MENUS - virtual void SetWindowMenu(wxMenu* menu); - - virtual void DoMenuUpdates(wxMenu* menu = NULL); - - // return the active child menu, if any - virtual WXHMENU MSWGetActiveMenu() const; -#endif // wxUSE_MENUS - - - // implementation only from now on - - // MDI helpers - // ----------- - -#if wxUSE_MENUS - // called by wxMDIChildFrame after it was successfully created - virtual void AddMDIChild(wxMDIChildFrame *child); - - // called by wxMDIChildFrame just before it is destroyed - virtual void RemoveMDIChild(wxMDIChildFrame *child); -#endif // wxUSE_MENUS - // handlers // -------- @@ -96,6 +84,7 @@ public: void OnIconized(wxIconizeEvent& event); bool HandleActivate(int state, bool minimized, WXHWND activate); + bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control); // override window proc for MDI-specific message processing virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); @@ -103,16 +92,7 @@ public: virtual WXLRESULT MSWDefWindowProc(WXUINT, WXWPARAM, WXLPARAM); virtual bool MSWTranslateMessage(WXMSG* msg); -#if wxUSE_MENUS - // override wxFrameBase function to also look in the active child menu bar - // and the "Window" menu - virtual wxMenuItem *FindItemInMenuBar(int menuId) const; -#endif // wxUSE_MENUS - protected: - // override to pass menu/toolbar events to the active child first - virtual bool TryBefore(wxEvent& event); - #if wxUSE_MENUS_NATIVE virtual void InternalSetMenuBar(); #endif // wxUSE_MENUS_NATIVE @@ -122,45 +102,27 @@ protected: // set the size of the MDI client window to match the frame size void UpdateClientSize(); + + wxMDIClientWindow * m_clientWindow; + wxMDIChildFrame * m_currentChild; + wxMenu* m_windowMenu; + + // true if MDI Frame is intercepting commands, not child + bool m_parentFrameActive; + private: - // common part of all ctors - void Init(); - -#if wxUSE_MENUS - // "Window" menu commands event handlers - void OnMDICommand(wxCommandEvent& event); - void OnMDIChild(wxCommandEvent& event); - - - // add/remove window menu if we have it (i.e. m_windowMenu != NULL) - void AddWindowMenu(); - void RemoveWindowMenu(); - - // update the window menu (if we have it) to enable or disable the commands - // which only make sense when we have more than one child - void UpdateWindowMenu(bool enable); - -#if wxUSE_ACCEL - wxAcceleratorTable *m_accelWindowMenu; -#endif // wxUSE_ACCEL -#endif // wxUSE_MENUS - - // return the number of child frames we currently have (maybe 0) - int GetChildFramesCount() const; - - friend class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame; DECLARE_EVENT_TABLE() DECLARE_DYNAMIC_CLASS(wxMDIParentFrame) - wxDECLARE_NO_COPY_CLASS(wxMDIParentFrame); + DECLARE_NO_COPY_CLASS(wxMDIParentFrame) }; // --------------------------------------------------------------------------- // wxMDIChildFrame // --------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxMDIChildFrame : public wxMDIChildFrameBase +class WXDLLEXPORT wxMDIChildFrame : public wxFrame { public: wxMDIChildFrame() { Init(); } @@ -177,6 +139,8 @@ public: Create(parent, id, title, pos, size, style, name); } + virtual ~wxMDIChildFrame(); + bool Create(wxMDIParentFrame *parent, wxWindowID id, const wxString& title, @@ -185,16 +149,12 @@ public: long style = wxDEFAULT_FRAME_STYLE, const wxString& name = wxFrameNameStr); - virtual ~wxMDIChildFrame(); + virtual bool IsTopLevel() const { return false; } - // implement MDI operations - virtual void Activate(); - - // Override some frame operations too + // MDI operations virtual void Maximize(bool maximize = true); virtual void Restore(); - - virtual bool Show(bool show = true); + virtual void Activate(); // Implementation only from now on // ------------------------------- @@ -202,6 +162,7 @@ public: // Handlers bool HandleMDIActivate(long bActivate, WXHWND, WXHWND); bool HandleWindowPosChanging(void *lpPos); + bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control); bool HandleGetMinMaxInfo(void *mmInfo); virtual WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam); @@ -214,10 +175,11 @@ public: void OnIdle(wxIdleEvent& event); + virtual bool Show(bool show = true); + protected: virtual void DoGetScreenPosition(int *x, int *y) const; virtual void DoGetPosition(int *x, int *y) const; - virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags); virtual void DoSetClientSize(int width, int height); virtual void InternalSetMenuBar(); virtual bool IsMDIChild() const { return true; } @@ -240,10 +202,16 @@ private: // wxMDIClientWindow // --------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxMDIClientWindow : public wxMDIClientWindowBase +class WXDLLEXPORT wxMDIClientWindow : public wxWindow { public: wxMDIClientWindow() { Init(); } + wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0) + { + Init(); + + CreateClient(parent, style); + } // Note: this is virtual, to allow overridden behaviour. virtual bool CreateClient(wxMDIParentFrame *parent, @@ -266,4 +234,5 @@ private: DECLARE_DYNAMIC_CLASS_NO_COPY(wxMDIClientWindow) }; -#endif // _WX_MSW_MDI_H_ +#endif + // _WX_MDI_H_ diff --git a/Source/3rd Party/wx/include/wx/msw/menu.h b/Source/3rd Party/wx/include/wx/msw/menu.h index 165bb57ef..b25f77d5d 100644 --- a/Source/3rd Party/wx/include/wx/msw/menu.h +++ b/Source/3rd Party/wx/include/wx/msw/menu.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: Vadim Zeitlin (wxMenuItem is now in separate file) // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: menu.h 49563 2007-10-31 20:46:21Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -25,7 +25,6 @@ class WXDLLIMPEXP_FWD_CORE wxFrame; class WXDLLIMPEXP_FWD_CORE wxToolBar; #endif -class wxMenuRadioItemsData; // Not using a combined wxToolBar/wxMenuBar? then use // a commandbar in WinCE .NET to implement the @@ -46,7 +45,7 @@ class wxMenuRadioItemsData; // Menu // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxMenu : public wxMenuBase +class WXDLLEXPORT wxMenu : public wxMenuBase { public: // ctors & dtor @@ -61,31 +60,23 @@ public: virtual void SetTitle(const wxString& title); - // MSW-only methods - // ---------------- - - // Create a new menu from the given native HMENU. Takes ownership of the - // menu handle and will delete it when this object is destroyed. - static wxMenu *MSWNewFromHMENU(WXHMENU hMenu) { return new wxMenu(hMenu); } - - // implementation only from now on // ------------------------------- + virtual void Attach(wxMenuBarBase *menubar); + bool MSWCommand(WXUINT param, WXWORD id); - // get the native menu handle + // semi-private accessors + // get the window which contains this menu + wxWindow *GetWindow() const; + // get the menu handle WXHMENU GetHMenu() const { return m_hMenu; } - // Return the start and end position of the radio group to which the item - // at the given position belongs. Returns false if there is no radio group - // containing this position. - bool MSWGetRadioGroupRange(int pos, int *start, int *end) const; - #if wxUSE_ACCEL // called by wxMenuBar to build its accel table from the accels of all menus - bool HasAccels() const { return !m_accels.empty(); } - size_t GetAccelCount() const { return m_accels.size(); } + bool HasAccels() const { return !m_accels.IsEmpty(); } + size_t GetAccelCount() const { return m_accels.GetCount(); } size_t CopyAccels(wxAcceleratorEntry *accels) const; // called by wxMenuItem when its accels changes @@ -93,65 +84,29 @@ public: // helper used by wxMenu itself (returns the index in m_accels) int FindAccel(int id) const; - - // used only by wxMDIParentFrame currently but could be useful elsewhere: - // returns a new accelerator table with accelerators for just this menu - // (shouldn't be called if we don't have any accelerators) - wxAcceleratorTable *CreateAccelTable() const; #endif // wxUSE_ACCEL -#if wxUSE_OWNER_DRAWN - - int GetMaxAccelWidth() - { - if (m_maxAccelWidth == -1) - CalculateMaxAccelWidth(); - return m_maxAccelWidth; - } - - void ResetMaxAccelWidth() - { - m_maxAccelWidth = -1; - } - - // get the menu with given handle (recursively) - wxMenu* MSWGetMenu(WXHMENU hMenu); - -private: - void CalculateMaxAccelWidth(); - -#endif // wxUSE_OWNER_DRAWN - protected: virtual wxMenuItem* DoAppend(wxMenuItem *item); virtual wxMenuItem* DoInsert(size_t pos, wxMenuItem *item); virtual wxMenuItem* DoRemove(wxMenuItem *item); private: - // This constructor is private, use MSWNewFromHMENU() to use it. - wxMenu(WXHMENU hMenu); - - // Common part of all ctors, it doesn't create a new HMENU. - void InitNoCreate(); - - // Common part of all ctors except of the one above taking a native menu - // handler: calls InitNoCreate() and also creates a new menu. + // common part of all ctors void Init(); // common part of Append/Insert (behaves as Append is pos == (size_t)-1) bool DoInsertOrAppend(wxMenuItem *item, size_t pos = (size_t)-1); - - // This variable contains the description of the radio item groups and - // allows to find whether an item at the given position is part of the - // group and also where its group starts and ends. - // - // It is initially NULL and only allocated if we have any radio items. - wxMenuRadioItemsData *m_radioData; + // terminate the current radio group, if any + void EndRadioGroup(); // if true, insert a breal before appending the next item bool m_doBreak; + // the position of the first item in the current radio group or -1 + int m_startRadioGroup; + // the menu handle of this menu WXHMENU m_hMenu; @@ -160,17 +115,6 @@ private: wxAcceleratorArray m_accels; #endif // wxUSE_ACCEL -#if wxUSE_OWNER_DRAWN - // true if the menu has any ownerdrawn items - bool m_ownerDrawn; - - // the max width of menu items bitmaps - int m_maxBitmapWidth; - - // the max width of menu items accels - int m_maxAccelWidth; -#endif // wxUSE_OWNER_DRAWN - DECLARE_DYNAMIC_CLASS_NO_COPY(wxMenu) }; @@ -178,7 +122,26 @@ private: // Menu Bar (a la Windows) // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxMenuBar : public wxMenuBarBase +class WXDLLEXPORT wxMenuInfo : public wxObject +{ +public : + wxMenuInfo() { m_menu = NULL; } + virtual ~wxMenuInfo() { } + + void Create( wxMenu *menu , const wxString &title ) + { m_menu = menu; m_title = title; } + wxMenu* GetMenu() const { return m_menu; } + wxString GetTitle() const { return m_title; } +private : + wxMenu *m_menu; + wxString m_title; + + DECLARE_DYNAMIC_CLASS(wxMenuInfo) +}; + +WX_DECLARE_EXPORTED_LIST(wxMenuInfo, wxMenuInfoList ); + +class WXDLLEXPORT wxMenuBar : public wxMenuBarBase { public: // ctors & dtor @@ -191,15 +154,17 @@ public: virtual ~wxMenuBar(); // menubar construction + bool Append( wxMenuInfo *info ) { return Append( info->GetMenu() , info->GetTitle() ); } + const wxMenuInfoList& GetMenuInfos() const; + virtual bool Append( wxMenu *menu, const wxString &title ); virtual bool Insert(size_t pos, wxMenu *menu, const wxString& title); virtual wxMenu *Replace(size_t pos, wxMenu *menu, const wxString& title); virtual wxMenu *Remove(size_t pos); virtual void EnableTop( size_t pos, bool flag ); - virtual bool IsEnabledTop(size_t pos) const; - virtual void SetMenuLabel( size_t pos, const wxString& label ); - virtual wxString GetMenuLabel( size_t pos ) const; + virtual void SetLabelTop( size_t pos, const wxString& label ); + virtual wxString GetLabelTop( size_t pos ) const; // implementation from now on WXHMENU Create(); @@ -218,6 +183,9 @@ public: #endif #if wxUSE_ACCEL + // get the accel table for all the menus + const wxAcceleratorTable& GetAccelTable() const { return m_accelTable; } + // update the accel table (must be called after adding/deleting a menu) void RebuildAccelTable(); #endif // wxUSE_ACCEL @@ -233,18 +201,22 @@ public: void Refresh( bool eraseBackground, const wxRect *rect = (const wxRect *) NULL ) { wxWindow::Refresh(eraseBackground, rect); } - // get the menu with given handle (recursively) - wxMenu* MSWGetMenu(WXHMENU hMenu); - protected: // common part of all ctors void Init(); + wxArrayString m_titles; + wxMenuInfoList m_menuInfos; + WXHMENU m_hMenu; // Return the MSW position for a wxMenu which is sometimes different from // the wxWidgets position. int MSWPositionForWxMenu(wxMenu *menu, int wxpos); +#if wxUSE_ACCEL + // the accelerator table for all accelerators in all our menus + wxAcceleratorTable m_accelTable; +#endif // wxUSE_ACCEL #if defined(__WXWINCE__) && wxUSE_TOOLBAR wxToolBar* m_toolBar; @@ -257,6 +229,13 @@ protected: private: DECLARE_DYNAMIC_CLASS_NO_COPY(wxMenuBar) + +public: + +#if wxABI_VERSION >= 20805 + // Gets the original label at the top-level of the menubar + wxString GetMenuLabel(size_t pos) const; +#endif }; #endif // _WX_MENU_H_ diff --git a/Source/3rd Party/wx/include/wx/msw/menuitem.h b/Source/3rd Party/wx/include/wx/msw/menuitem.h index a79d385cd..641365848 100644 --- a/Source/3rd Party/wx/include/wx/msw/menuitem.h +++ b/Source/3rd Party/wx/include/wx/msw/menuitem.h @@ -1,10 +1,10 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/menuitem.h +// Name: menuitem.h // Purpose: wxMenuItem class // Author: Vadim Zeitlin // Modified by: // Created: 11.11.97 -// RCS-ID: $Id$ +// RCS-ID: $Id: menuitem.h 48053 2007-08-13 17:07:01Z JS $ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -17,33 +17,31 @@ // ---------------------------------------------------------------------------- #if wxUSE_OWNER_DRAWN - #include "wx/ownerdrw.h" - #include "wx/bitmap.h" - - struct tagRECT; + #include "wx/ownerdrw.h" // base class #endif // ---------------------------------------------------------------------------- // wxMenuItem: an item in the menu, optionally implements owner-drawn behaviour // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxMenuItem : public wxMenuItemBase +class WXDLLEXPORT wxMenuItem : public wxMenuItemBase #if wxUSE_OWNER_DRAWN , public wxOwnerDrawn #endif { public: // ctor & dtor - wxMenuItem(wxMenu *parentMenu = NULL, + wxMenuItem(wxMenu *parentMenu = (wxMenu *)NULL, int id = wxID_SEPARATOR, const wxString& name = wxEmptyString, const wxString& help = wxEmptyString, wxItemKind kind = wxITEM_NORMAL, - wxMenu *subMenu = NULL); + wxMenu *subMenu = (wxMenu *)NULL); virtual ~wxMenuItem(); // override base class virtuals - virtual void SetItemLabel(const wxString& strName); + virtual void SetText(const wxString& strName); + virtual void SetCheckable(bool checkable); virtual void Enable(bool bDoEnable = true); virtual void Check(bool bDoCheck = true); @@ -55,94 +53,48 @@ public: // the id for a popup menu is really its menu handle (as required by // ::AppendMenu() API), so this function will return either the id or the - // menu handle depending on what we are - // - // notice that it also returns the id as an unsigned int, as required by - // Win32 API - WXWPARAM GetMSWId() const; + // menu handle depending on what we're + int GetRealId() const; + + // mark item as belonging to the given radio group + void SetAsRadioGroupStart(); + void SetRadioGroupStart(int start); + void SetRadioGroupEnd(int end); -#if WXWIN_COMPATIBILITY_2_8 // compatibility only, don't use in new code - wxDEPRECATED( wxMenuItem(wxMenu *parentMenu, int id, const wxString& text, const wxString& help, bool isCheckable, - wxMenu *subMenu = NULL) - ); -#endif - -#if wxUSE_OWNER_DRAWN - - void SetBitmaps(const wxBitmap& bmpChecked, - const wxBitmap& bmpUnchecked = wxNullBitmap) - { - m_bmpChecked = bmpChecked; - m_bmpUnchecked = bmpUnchecked; - SetOwnerDrawn(true); - } - - void SetBitmap(const wxBitmap& bmp, bool bChecked = true) - { - if ( bChecked ) - m_bmpChecked = bmp; - else - m_bmpUnchecked = bmp; - SetOwnerDrawn(true); - } - - void SetDisabledBitmap(const wxBitmap& bmpDisabled) - { - m_bmpDisabled = bmpDisabled; - SetOwnerDrawn(true); - } - - const wxBitmap& GetBitmap(bool bChecked = true) const - { return (bChecked ? m_bmpChecked : m_bmpUnchecked); } - - const wxBitmap& GetDisabledBitmap() const - { return m_bmpDisabled; } - - int MeasureAccelWidth() const; - - // override wxOwnerDrawn base class virtuals - virtual wxString GetName() const; - virtual bool OnMeasureItem(size_t *pwidth, size_t *pheight); - virtual bool OnDrawItem(wxDC& dc, const wxRect& rc, wxODAction act, wxODStatus stat); - -protected: - virtual void GetFontToUse(wxFont& font) const; - virtual void GetColourToUse(wxODStatus stat, wxColour& colText, wxColour& colBack) const; - -private: - // helper function for draw std menu check mark - void DrawStdCheckMark(WXHDC hdc, const tagRECT* rc, wxODStatus stat); - -#else // !wxUSE_OWNER_DRAWN - // Provide stubs for the public functions above to ensure that the code - // still compiles without wxUSE_OWNER_DRAWN -- it makes sense to just drop - // the bitmaps then instead of failing compilation. - void SetBitmaps(const wxBitmap& WXUNUSED(bmpChecked), - const wxBitmap& WXUNUSED(bmpUnchecked) = wxNullBitmap) { } - void SetBitmap(const wxBitmap& WXUNUSED(bmp), - bool WXUNUSED(bChecked) = true) { } - const wxBitmap& GetBitmap() const { return wxNullBitmap; } -#endif // wxUSE_OWNER_DRAWN/!wxUSE_OWNER_DRAWN + wxMenu *subMenu = (wxMenu *)NULL); private: // common part of all ctors void Init(); + // the positions of the first and last items of the radio group this item + // belongs to or -1: start is the radio group start and is valid for all + // but first radio group items (m_isRadioGroupStart == false), end is valid + // only for the first one + union + { + int start; + int end; + } m_radioGroup; -#if wxUSE_OWNER_DRAWN - // item bitmaps - wxBitmap m_bmpChecked, // bitmap to put near the item - m_bmpUnchecked, // (checked is used also for 'uncheckable' items) - m_bmpDisabled; -#endif // wxUSE_OWNER_DRAWN + // does this item start a radio group? + bool m_isRadioGroupStart; DECLARE_DYNAMIC_CLASS_NO_COPY(wxMenuItem) + +public: + +#if wxABI_VERSION >= 20805 + // return the item label including any mnemonics and accelerators. + // This used to be called GetText. + wxString GetItemLabel() const { return GetText(); } +#endif }; #endif //_MENUITEM_H diff --git a/Source/3rd Party/wx/include/wx/msw/mimetype.h b/Source/3rd Party/wx/include/wx/msw/mimetype.h index c47bbb7a5..9052d07dc 100644 --- a/Source/3rd Party/wx/include/wx/msw/mimetype.h +++ b/Source/3rd Party/wx/include/wx/msw/mimetype.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 23.09.98 -// RCS-ID: $Id$ +// RCS-ID: $Id: mimetype.h 35650 2005-09-23 12:56:45Z MR $ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows licence (part of wxExtra library) ///////////////////////////////////////////////////////////////////////////// @@ -66,7 +66,7 @@ public: private: // helper function: reads the command corresponding to the specified verb // from the registry (returns an empty string if not found) - wxString GetCommand(const wxString& verb) const; + wxString GetCommand(const wxChar *verb) const; // get the registry path for the given verb wxString GetVerbPath(const wxString& verb) const; @@ -102,6 +102,12 @@ public: size_t EnumAllFileTypes(wxArrayString& mimetypes); + // this are NOPs under Windows + bool ReadMailcap(const wxString& WXUNUSED(filename), bool WXUNUSED(fallback) = true) + { return true; } + bool ReadMimeTypes(const wxString& WXUNUSED(filename)) + { return true; } + // create a new filetype association wxFileType *Associate(const wxFileTypeInfo& ftInfo); diff --git a/Source/3rd Party/wx/include/wx/msw/minifram.h b/Source/3rd Party/wx/include/wx/msw/minifram.h index 23f47b744..d2e23d9cf 100644 --- a/Source/3rd Party/wx/include/wx/msw/minifram.h +++ b/Source/3rd Party/wx/include/wx/msw/minifram.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: minifram.h 35650 2005-09-23 12:56:45Z MR $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -14,7 +14,7 @@ #include "wx/frame.h" -class WXDLLIMPEXP_CORE wxMiniFrame : public wxFrame +class WXDLLEXPORT wxMiniFrame : public wxFrame { public: wxMiniFrame() { } diff --git a/Source/3rd Party/wx/include/wx/msw/missing.h b/Source/3rd Party/wx/include/wx/msw/missing.h index 32a31d42c..c84134bdf 100644 --- a/Source/3rd Party/wx/include/wx/msw/missing.h +++ b/Source/3rd Party/wx/include/wx/msw/missing.h @@ -3,7 +3,7 @@ // Purpose: Declarations for parts of the Win32 SDK that are missing in // the versions that come with some compilers // Created: 2002/04/23 -// RCS-ID: $Id$ +// RCS-ID: $Id: missing.h 48436 2007-08-28 19:26:16Z JS $ // Copyright: (c) 2002 Mattia Barbon // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -29,26 +29,19 @@ #define WM_CONTEXTMENU 0x007B #endif -#ifndef WM_CHANGEUISTATE - #define WM_CHANGEUISTATE 0x0127 -#endif - +// Needed by toplevel.cpp #ifndef WM_UPDATEUISTATE #define WM_UPDATEUISTATE 0x0128 #endif -#ifndef WM_QUERYUISTATE - #define WM_QUERYUISTATE 0x0129 +#ifndef WM_CHANGEUISTATE + #define WM_CHANGEUISTATE 0x0127 #endif #ifndef WM_PRINTCLIENT #define WM_PRINTCLIENT 0x318 #endif -#ifndef DT_HIDEPREFIX - #define DT_HIDEPREFIX 0x00100000 -#endif - // Needed by toplevel.cpp #ifndef UIS_SET #define UIS_SET 1 @@ -77,9 +70,6 @@ #ifndef WM_MOUSEWHEEL #define WM_MOUSEWHEEL 0x020A #endif - #ifndef WM_MOUSEHWHEEL - #define WM_MOUSEHWHEEL 0x020E - #endif #ifndef WHEEL_DELTA #define WHEEL_DELTA 120 #endif @@ -97,7 +87,6 @@ #define VK_OEM_5 0xDC #define VK_OEM_6 0xDD #define VK_OEM_7 0xDE - #define VK_OEM_102 0xE2 #endif #ifndef VK_OEM_COMMA @@ -149,8 +138,38 @@ #define LWA_ALPHA 2 #endif -#ifndef QS_ALLPOSTMESSAGE -#define QS_ALLPOSTMESSAGE 0 +#if defined __VISUALC__ && __VISUALC__ <= 1200 && !defined MIIM_BITMAP +#define MIIM_STRING 0x00000040 +#define MIIM_BITMAP 0x00000080 +#define MIIM_FTYPE 0x00000100 +#define HBMMENU_CALLBACK ((HBITMAP) -1) +typedef struct tagMENUINFO +{ + DWORD cbSize; + DWORD fMask; + DWORD dwStyle; + UINT cyMax; + HBRUSH hbrBack; + DWORD dwContextHelpID; + DWORD dwMenuData; +} MENUINFO, FAR *LPMENUINFO; +struct wxMENUITEMINFO_ +{ + UINT cbSize; + UINT fMask; + UINT fType; + UINT fState; + UINT wID; + HMENU hSubMenu; + HBITMAP hbmpChecked; + HBITMAP hbmpUnchecked; + DWORD dwItemData; + LPTSTR dwTypeData; + UINT cch; + HBITMAP hbmpItem; +}; +#else +#define wxMENUITEMINFO_ MENUITEMINFO #endif /* @@ -222,42 +241,15 @@ typedef struct wxtagNMLVCUSTOMDRAW_ { #endif // defined __VISUALC__ && __VISUALC__ <= 1100 // ---------------------------------------------------------------------------- -// menu stuff +// ListView common control +// Needed by listctrl.cpp // ---------------------------------------------------------------------------- -#ifndef MIIM_BITMAP - #define MIIM_STRING 0x00000040 - #define MIIM_BITMAP 0x00000080 - #define MIIM_FTYPE 0x00000100 - #define HBMMENU_CALLBACK ((HBITMAP) -1) - - typedef struct tagMENUINFO - { - DWORD cbSize; - DWORD fMask; - DWORD dwStyle; - UINT cyMax; - HBRUSH hbrBack; - DWORD dwContextHelpID; - DWORD dwMenuData; - } MENUINFO, FAR *LPMENUINFO; -#endif // MIIM_BITMAP &c - -// ---------------------------------------------------------------------------- -// definitions related to ListView and Header common controls, needed by -// msw/listctrl.cpp and msw/headerctrl.cpp -// ---------------------------------------------------------------------------- - -#ifndef I_IMAGENONE - #define I_IMAGENONE (-2) -#endif - #ifndef LVS_EX_FULLROWSELECT #define LVS_EX_FULLROWSELECT 0x00000020 #endif -// LVS_EX_LABELTIP is not supported by Windows CE, don't define it there -#if !defined(LVS_EX_LABELTIP) && !defined(__WXWINCE__) +#ifndef LVS_EX_LABELTIP #define LVS_EX_LABELTIP 0x00004000 #endif @@ -269,18 +261,6 @@ typedef struct wxtagNMLVCUSTOMDRAW_ { #define HDN_GETDISPINFOW (HDN_FIRST-29) #endif -#ifndef HDS_HOTTRACK - #define HDS_HOTTRACK 4 -#endif -#ifndef HDS_FLAT - #define HDS_FLAT 0x0200 -#endif - -#ifndef HDF_SORTUP - #define HDF_SORTUP 0x0400 - #define HDF_SORTDOWN 0x0200 -#endif - /* * In addition to the above, the following are required for several compilers. */ @@ -336,7 +316,6 @@ typedef struct wxtagNMLVCUSTOMDRAW_ { #ifdef __DMC__ -#ifndef VER_NT_WORKSTATION typedef struct _OSVERSIONINFOEX { DWORD dwOSVersionInfoSize; DWORD dwMajorVersion; @@ -350,7 +329,6 @@ typedef struct _OSVERSIONINFOEX { BYTE wProductType; BYTE wReserved; } OSVERSIONINFOEX; -#endif // !defined(VER_NT_WORKSTATION) #ifndef _TrackMouseEvent #define _TrackMouseEvent TrackMouseEvent @@ -389,34 +367,6 @@ typedef struct _OSVERSIONINFOEX { #define LVM_GETHEADER (LVM_FIRST+31) #endif -#ifndef HDLAYOUT - #define HDLAYOUT HD_LAYOUT -#endif - -#ifndef HDITEM - #define HDITEM HD_ITEM -#endif - -#ifndef NMHEADER - #define NMHEADER HD_NOTIFY -#endif - -#ifndef HDS_DRAGDROP - #define HDS_DRAGDROP 0x0040 -#endif -#ifndef HDS_FULLDRAG - #define HDS_FULLDRAG 0x0080 -#endif - - -#ifndef HDN_BEGINDRAG - #define HDN_BEGINDRAG (HDN_FIRST - 11) -#endif - -#ifndef HDN_ENDDRAG - #define HDN_ENDDRAG (HDN_FIRST - 10) -#endif - #ifndef LVSICF_NOSCROLL #define LVSICF_NOINVALIDATEALL 0x0001 #define LVSICF_NOSCROLL 0x0002 @@ -518,152 +468,6 @@ typedef struct #endif -#endif - -//Various defines that will be needed by mingw and possibly VC++6 -//Used by the webview library - -#ifndef DISPID_COMMANDSTATECHANGE -#define DISPID_COMMANDSTATECHANGE 105 -#endif - -#ifndef DISPID_NAVIGATECOMPLETE2 -#define DISPID_NAVIGATECOMPLETE2 252 -#endif - -#ifndef DISPID_NAVIGATEERROR -#define DISPID_NAVIGATEERROR 271 -#endif - -#ifndef DISPID_NEWWINDOW3 -#define DISPID_NEWWINDOW3 273 -#endif - -#ifndef INET_E_ERROR_FIRST -#define INET_E_ERROR_FIRST 0x800C0002L -#endif - -#ifndef INET_E_INVALID_URL -#define INET_E_INVALID_URL 0x800C0002L -#endif - -#ifndef INET_E_NO_SESSION -#define INET_E_NO_SESSION 0x800C0003L -#endif - -#ifndef INET_E_CANNOT_CONNECT -#define INET_E_CANNOT_CONNECT 0x800C0004L -#endif - -#ifndef INET_E_RESOURCE_NOT_FOUND -#define INET_E_RESOURCE_NOT_FOUND 0x800C0005L -#endif - -#ifndef INET_E_OBJECT_NOT_FOUND -#define INET_E_OBJECT_NOT_FOUND 0x800C0006L -#endif - -#ifndef INET_E_DATA_NOT_AVAILABLE -#define INET_E_DATA_NOT_AVAILABLE 0x800C0007L -#endif - -#ifndef INET_E_DOWNLOAD_FAILURE -#define INET_E_DOWNLOAD_FAILURE 0x800C0008L -#endif - -#ifndef INET_E_AUTHENTICATION_REQUIRED -#define INET_E_AUTHENTICATION_REQUIRED 0x800C0009L -#endif - -#ifndef INET_E_NO_VALID_MEDIA -#define INET_E_NO_VALID_MEDIA 0x800C000AL -#endif - -#ifndef INET_E_CONNECTION_TIMEOUT -#define INET_E_CONNECTION_TIMEOUT 0x800C000BL -#endif - -#ifndef INET_E_INVALID_REQUEST -#define INET_E_INVALID_REQUEST 0x800C000CL -#endif - -#ifndef INET_E_UNKNOWN_PROTOCOL -#define INET_E_UNKNOWN_PROTOCOL 0x800C000DL -#endif - -#ifndef INET_E_SECURITY_PROBLEM -#define INET_E_SECURITY_PROBLEM 0x800C000EL -#endif - -#ifndef INET_E_CANNOT_LOAD_DATA -#define INET_E_CANNOT_LOAD_DATA 0x800C000FL -#endif - -#ifndef INET_E_CANNOT_INSTANTIATE_OBJECT -#define INET_E_CANNOT_INSTANTIATE_OBJECT 0x800C0010L -#endif - -#ifndef INET_E_QUERYOPTION_UNKNOWN -#define INET_E_QUERYOPTION_UNKNOWN 0x800C0013L -#endif - -#ifndef INET_E_REDIRECT_FAILED -#define INET_E_REDIRECT_FAILED 0x800C0014L -#endif - -#ifndef INET_E_REDIRECT_TO_DIR -#define INET_E_REDIRECT_TO_DIR 0x800C0015L -#endif - -#ifndef INET_E_CANNOT_LOCK_REQUEST -#define INET_E_CANNOT_LOCK_REQUEST 0x800C0016L -#endif - -#ifndef INET_E_USE_EXTEND_BINDING -#define INET_E_USE_EXTEND_BINDING 0x800C0017L -#endif - -#ifndef INET_E_TERMINATED_BIND -#define INET_E_TERMINATED_BIND 0x800C0018L -#endif - -#ifndef INET_E_INVALID_CERTIFICATE -#define INET_E_INVALID_CERTIFICATE 0x800C0019L -#endif - -#ifndef INET_E_CODE_DOWNLOAD_DECLINED -#define INET_E_CODE_DOWNLOAD_DECLINED 0x800C0100L -#endif - -#ifndef INET_E_RESULT_DISPATCHED -#define INET_E_RESULT_DISPATCHED 0x800C0200L -#endif - -#ifndef INET_E_CANNOT_REPLACE_SFP_FILE -#define INET_E_CANNOT_REPLACE_SFP_FILE 0x800C0300L -#endif - -#ifndef INET_E_CODE_INSTALL_BLOCKED_BY_HASH_POLICY -#define INET_E_CODE_INSTALL_BLOCKED_BY_HASH_POLICY 0x800C0500L -#endif - -#ifndef INET_E_CODE_INSTALL_SUPPRESSED -#define INET_E_CODE_INSTALL_SUPPRESSED 0x800C0400L -#endif - -//We need to check if we are using MinGW or mingw-w64 as their -//definitions are different - -#ifdef __MINGW32__ -#include <_mingw.h> -#endif - -#if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR) -typedef enum CommandStateChangeConstants { - CSC_UPDATECOMMANDS = (int) 0xFFFFFFFF, - CSC_NAVIGATEFORWARD = 0x1, - CSC_NAVIGATEBACK = 0x2 -} CommandStateChangeConstants; #endif /* @@ -687,9 +491,5 @@ typedef enum CommandStateChangeConstants { #endif #endif // defined __WINE__ -#ifndef INVALID_FILE_ATTRIBUTES - #define INVALID_FILE_ATTRIBUTES ((DWORD)-1) -#endif - #endif // _WX_MISSING_H_ diff --git a/Source/3rd Party/wx/include/wx/msw/msgdlg.h b/Source/3rd Party/wx/include/wx/msw/msgdlg.h index 56b41c566..690678b8d 100644 --- a/Source/3rd Party/wx/include/wx/msw/msgdlg.h +++ b/Source/3rd Party/wx/include/wx/msw/msgdlg.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: msgdlg.h 37164 2006-01-26 17:20:50Z ABX $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -12,62 +12,31 @@ #ifndef _WX_MSGBOXDLG_H_ #define _WX_MSGBOXDLG_H_ -class WXDLLIMPEXP_CORE wxMessageDialog : public wxMessageDialogBase +#include "wx/defs.h" +#include "wx/dialog.h" + +/* + * Message box dialog + */ + +extern WXDLLEXPORT_DATA(const wxChar) wxMessageBoxCaptionStr[]; + +class WXDLLEXPORT wxMessageDialog: public wxDialog, public wxMessageDialogBase { -public: - wxMessageDialog(wxWindow *parent, - const wxString& message, - const wxString& caption = wxMessageBoxCaptionStr, - long style = wxOK|wxCENTRE, - const wxPoint& WXUNUSED(pos) = wxDefaultPosition) - : wxMessageDialogBase(parent, message, caption, style) - { - m_hook = NULL; - } - - virtual int ShowModal(); - - // implementation-specific - - // return the font used for the text in the message box - static wxFont GetMessageFont(); - +DECLARE_DYNAMIC_CLASS(wxMessageDialog) protected: - // Override this as task dialogs are always centered on parent. - virtual void DoCentre(int dir); + wxString m_caption; + wxString m_message; + wxWindow * m_parent; +public: + wxMessageDialog(wxWindow *parent, const wxString& message, const wxString& caption = wxMessageBoxCaptionStr, + long style = wxOK|wxCENTRE, const wxPoint& pos = wxDefaultPosition); -private: - // hook procedure used to adjust the message box beyond what the standard - // MessageBox() function can do for us - static WXLRESULT wxCALLBACK HookFunction(int code, WXWPARAM, WXLPARAM); + int ShowModal(void); - static const struct ButtonAccessors - { - int id; - wxString (wxMessageDialog::*getter)() const; - } ms_buttons[]; - - // replace the static text control with a text control in order to show - // scrollbar (and also, incidentally, allow text selection) - void ReplaceStaticWithEdit(); - - // adjust the button labels - // - // this is called from HookFunction() and our HWND is valid at this moment - void AdjustButtonLabels(); - - // offset all buttons starting from the first one given by dx to the right - void OffsetButtonsStartingFrom(int first, int dx); - - // used by ShowModal() to display a message box when task dialogs - // aren't available. - int ShowMessageBox(); - - - WXHANDLE m_hook; // HHOOK used to position the message box - - wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxMessageDialog); + DECLARE_NO_COPY_CLASS(wxMessageDialog) }; -#endif // _WX_MSGBOXDLG_H_ +#endif + // _WX_MSGBOXDLG_H_ diff --git a/Source/3rd Party/wx/include/wx/msw/mslu.h b/Source/3rd Party/wx/include/wx/msw/mslu.h index 2af955973..83f4060d7 100644 --- a/Source/3rd Party/wx/include/wx/msw/mslu.h +++ b/Source/3rd Party/wx/include/wx/msw/mslu.h @@ -5,7 +5,7 @@ // Modified by: Vadim Zeitlin to move out various functions to other files // to fix header inter-dependencies // Created: 2002/02/17 -// RCS-ID: $Id$ +// RCS-ID: $Id: mslu.h 42462 2006-10-26 19:06:51Z VZ $ // Copyright: (c) 2002 Vaclav Slavik // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// diff --git a/Source/3rd Party/wx/include/wx/msw/msvcrt.h b/Source/3rd Party/wx/include/wx/msw/msvcrt.h index f211fe401..15c4dfbde 100644 --- a/Source/3rd Party/wx/include/wx/msw/msvcrt.h +++ b/Source/3rd Party/wx/include/wx/msw/msvcrt.h @@ -5,7 +5,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 31.01.1999 -// RCS-ID: $Id$ +// RCS-ID: $Id: msvcrt.h 42363 2006-10-24 23:19:12Z VZ $ // Copyright: (c) Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -14,8 +14,7 @@ // used like this: // wxCrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF); // to turn on memory leak checks for programs compiled with Microsoft Visual -// C++ (5.0+). The macro will not be defined under other compilers or if it -// can't be used with MSVC for whatever reason. +// C++ (5.0+). The macro will expand to nothing under other compilers. #ifndef _MSW_MSVCRT_H_ #define _MSW_MSVCRT_H_ @@ -23,7 +22,7 @@ // use debug CRT functions for memory leak detections in VC++ 5.0+ in debug // builds #undef wxUSE_VC_CRTDBG -#if defined(_DEBUG) && defined(__VISUALC__) && (__VISUALC__ >= 1000) \ +#if defined(__WXDEBUG__) && defined(__VISUALC__) && (__VISUALC__ >= 1000) \ && !defined(UNDER_CE) // it doesn't combine well with wxWin own memory debugging methods #if !wxUSE_GLOBAL_MEMORY_OPERATORS && !wxUSE_MEMORY_TRACING && !defined(__NO_VC_CRTDBG__) @@ -32,6 +31,11 @@ #endif #ifdef wxUSE_VC_CRTDBG + // VC++ uses this macro as debug/release mode indicator + #ifndef _DEBUG + #define _DEBUG + #endif + // Need to undef new if including crtdbg.h which may redefine new itself #ifdef new #undef new @@ -39,7 +43,7 @@ #include #ifndef _CRTBLD - // Needed when building with pure MS SDK + // Need when builded with pure MS SDK #define _CRTBLD #endif @@ -50,7 +54,7 @@ // this define works around a bug with inline declarations of new, see // - // http://support.microsoft.com/kb/q140858/ + // http://support.microsoft.com/support/kb/articles/Q140/8/58.asp // // for the details #define new WXDEBUG_NEW diff --git a/Source/3rd Party/wx/include/wx/msw/nonownedwnd.h b/Source/3rd Party/wx/include/wx/msw/nonownedwnd.h deleted file mode 100644 index e87ae8e7c..000000000 --- a/Source/3rd Party/wx/include/wx/msw/nonownedwnd.h +++ /dev/null @@ -1,39 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/nonownedwnd.h -// Purpose: wxNonOwnedWindow declaration for wxMSW. -// Author: Vadim Zeitlin -// Created: 2011-10-09 -// RCS-ID: $Id: wxhead.h,v 1.12 2010-04-22 12:44:51 zeitlin Exp $ -// Copyright: (c) 2011 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_NONOWNEDWND_H_ -#define _WX_MSW_NONOWNEDWND_H_ - -class wxNonOwnedWindowShapeImpl; - -// ---------------------------------------------------------------------------- -// wxNonOwnedWindow -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxNonOwnedWindow : public wxNonOwnedWindowBase -{ -public: - wxNonOwnedWindow(); - virtual ~wxNonOwnedWindow(); - -protected: - virtual bool DoClearShape(); - virtual bool DoSetRegionShape(const wxRegion& region); -#if wxUSE_GRAPHICS_CONTEXT - virtual bool DoSetPathShape(const wxGraphicsPath& path); - -private: - wxNonOwnedWindowShapeImpl* m_shapeImpl; -#endif // wxUSE_GRAPHICS_CONTEXT - - wxDECLARE_NO_COPY_CLASS(wxNonOwnedWindow); -}; - -#endif // _WX_MSW_NONOWNEDWND_H_ diff --git a/Source/3rd Party/wx/include/wx/msw/notebook.h b/Source/3rd Party/wx/include/wx/msw/notebook.h index e141bf523..5832c2d0e 100644 --- a/Source/3rd Party/wx/include/wx/msw/notebook.h +++ b/Source/3rd Party/wx/include/wx/msw/notebook.h @@ -3,7 +3,7 @@ // Purpose: MSW/GTK compatible notebook (a.k.a. property sheet) // Author: Robert Roebling // Modified by: Vadim Zeitlin for Windows version -// RCS-ID: $Id$ +// RCS-ID: $Id: notebook.h 41797 2006-10-09 12:10:01Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -23,7 +23,41 @@ // wxNotebook // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxNotebook : public wxNotebookBase +class WXDLLEXPORT wxNotebookPageInfo : public wxObject +{ +public : + wxNotebookPageInfo() { m_page = NULL; m_imageId = -1; m_selected = false; } + virtual ~wxNotebookPageInfo() { } + + void Create(wxNotebookPage *page, + const wxString& text, + bool selected, + int imageId) + { + m_page = page; + m_text = text; + m_selected = selected; + m_imageId = imageId; + } + + wxNotebookPage* GetPage() const { return m_page; } + wxString GetText() const { return m_text; } + bool GetSelected() const { return m_selected; } + int GetImageId() const { return m_imageId; } + +private: + wxNotebookPage *m_page; + wxString m_text; + bool m_selected; + int m_imageId; + + DECLARE_DYNAMIC_CLASS(wxNotebookPageInfo) +}; + + +WX_DECLARE_EXPORTED_LIST(wxNotebookPageInfo, wxNotebookPageInfoList ); + +class WXDLLEXPORT wxNotebook : public wxNotebookBase { public: // ctors @@ -52,9 +86,11 @@ public: virtual size_t GetPageCount() const; // set the currently selected page, return the index of the previously - // selected one (or wxNOT_FOUND on error) + // selected one (or -1 on error) // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events int SetSelection(size_t nPage); + // get the currently selected page + int GetSelection() const { return m_nSelection; } // changes selected page without sending events int ChangeSelection(size_t nPage); @@ -96,7 +132,10 @@ public: wxNotebookPage *pPage, const wxString& strText, bool bSelect = false, - int imageId = NO_IMAGE); + int imageId = -1); + + void AddPageInfo( wxNotebookPageInfo* info ) { AddPage( info->GetPage() , info->GetText() , info->GetSelected() , info->GetImageId() ); } + const wxNotebookPageInfoList& GetPageInfos() const; // Windows-only at present. Also, you must use the wxNB_FIXEDWIDTH // style. @@ -111,6 +150,7 @@ public: // callbacks // --------- void OnSize(wxSizeEvent& event); + void OnSelChange(wxNotebookEvent& event); void OnNavigationKey(wxNavigationKeyEvent& event); // base class virtuals @@ -142,10 +182,11 @@ public: return true; } + // return the themed brush for painting our children + virtual WXHBRUSH MSWGetBgBrushForChild(WXHDC hDC, WXHWND hWnd); + // draw child background virtual bool MSWPrintChild(WXHDC hDC, wxWindow *win); - - virtual bool MSWHasInheritableBackground() const { return true; } #endif // wxUSE_UXTHEME // translate wxWin styles to the Windows ones @@ -156,7 +197,7 @@ protected: void Init(); // hides the currently shown page and shows the given one (if not -1) and - // updates m_selection accordingly + // updates m_nSelection accordingly void UpdateSelection(int selNew); // remove one page from the notebook, without deleting @@ -171,9 +212,6 @@ protected: void AdjustPageSize(wxNotebookPage *page); #if wxUSE_UXTHEME - // return the themed brush for painting our children - virtual WXHBRUSH MSWGetCustomBgBrush() { return m_hbrBackground; } - // gets the bitmap of notebook background and returns a brush from it WXHBRUSH QueryBgBitmap(); @@ -194,11 +232,13 @@ protected: // true if we have already subclassed our updown control bool m_hasSubclassedUpdown; - - // true if we already refreshed the current page after showing the window - bool m_doneUpdateHack; #endif // __WXWINCE__ + // the current selection (-1 if none) + int m_nSelection; + + wxNotebookPageInfoList m_pageInfos; + #if wxUSE_UXTHEME // background brush used to paint the tab control WXHBRUSH m_hbrBackground; diff --git a/Source/3rd Party/wx/include/wx/msw/ole/activex.h b/Source/3rd Party/wx/include/wx/msw/ole/activex.h index a599fb2fe..20de45c2d 100644 --- a/Source/3rd Party/wx/include/wx/msw/ole/activex.h +++ b/Source/3rd Party/wx/include/wx/msw/ole/activex.h @@ -4,7 +4,7 @@ // Author: Ryan Norton // Modified by: // Created: 8/18/05 -// RCS-ID: $Id$ +// RCS-ID: $Id: activex.h 41793 2006-10-09 09:32:08Z ABX $ // Copyright: (c) Ryan Norton // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -27,8 +27,6 @@ #include "wx/window.h" #include "wx/variant.h" -class FrameSite; - //--------------------------------------------------------------------------- // MSW COM includes //--------------------------------------------------------------------------- @@ -71,94 +69,78 @@ class FrameSite; // //--------------------------------------------------------------------------- -template -class wxAutoOleInterface -{ -public: - typedef I Interface; - - explicit wxAutoOleInterface(I *pInterface = NULL) : m_interface(pInterface) - {} - wxAutoOleInterface(REFIID riid, IUnknown *pUnk) : m_interface(NULL) - { QueryInterface(riid, pUnk); } - wxAutoOleInterface(REFIID riid, IDispatch *pDispatch) : m_interface(NULL) - { QueryInterface(riid, pDispatch); } - wxAutoOleInterface(REFCLSID clsid, REFIID riid) : m_interface(NULL) - { CreateInstance(clsid, riid); } - wxAutoOleInterface(const wxAutoOleInterface& ti) : m_interface(NULL) - { operator=(ti); } - - wxAutoOleInterface& operator=(const wxAutoOleInterface& ti) - { - if ( ti.m_interface ) - ti.m_interface->AddRef(); - Free(); - m_interface = ti.m_interface; - return *this; - } - - wxAutoOleInterface& operator=(I*& ti) - { - Free(); - m_interface = ti; - return *this; - } - - ~wxAutoOleInterface() { Free(); } - - void Free() - { - if ( m_interface ) - m_interface->Release(); - m_interface = NULL; - } - - HRESULT QueryInterface(REFIID riid, IUnknown *pUnk) - { - Free(); - wxASSERT(pUnk != NULL); - return pUnk->QueryInterface(riid, (void **)&m_interface); - } - - HRESULT CreateInstance(REFCLSID clsid, REFIID riid) - { - Free(); - return CoCreateInstance - ( - clsid, - NULL, - CLSCTX_ALL, - riid, - (void **)&m_interface - ); - } - - operator I*() const {return m_interface; } - I* operator->() {return m_interface; } - I** GetRef() {return &m_interface; } - bool Ok() const { return IsOk(); } - bool IsOk() const { return m_interface != NULL; } - -protected: - I *m_interface; +#define WX_DECLARE_AUTOOLE(wxAutoOleInterface, I) \ +class wxAutoOleInterface \ +{ \ + protected: \ + I *m_interface; \ +\ + public: \ + explicit wxAutoOleInterface(I *pInterface = NULL) : m_interface(pInterface) {} \ + wxAutoOleInterface(REFIID riid, IUnknown *pUnk) : m_interface(NULL) \ + { QueryInterface(riid, pUnk); } \ + wxAutoOleInterface(REFIID riid, IDispatch *pDispatch) : m_interface(NULL) \ + { QueryInterface(riid, pDispatch); } \ + wxAutoOleInterface(REFCLSID clsid, REFIID riid) : m_interface(NULL)\ + { CreateInstance(clsid, riid); }\ + wxAutoOleInterface(const wxAutoOleInterface& ti) : m_interface(NULL)\ + { operator = (ti); }\ +\ + wxAutoOleInterface& operator = (const wxAutoOleInterface& ti)\ + {\ + if (ti.m_interface)\ + ti.m_interface->AddRef();\ + Free();\ + m_interface = ti.m_interface;\ + return *this;\ + }\ +\ + wxAutoOleInterface& operator = (I *&ti)\ + {\ + Free();\ + m_interface = ti;\ + return *this;\ + }\ +\ + ~wxAutoOleInterface() { Free(); }\ +\ + inline void Free()\ + {\ + if (m_interface)\ + m_interface->Release();\ + m_interface = NULL;\ + }\ +\ + HRESULT QueryInterface(REFIID riid, IUnknown *pUnk)\ + {\ + Free();\ + wxASSERT(pUnk != NULL);\ + return pUnk->QueryInterface(riid, (void **) &m_interface);\ + }\ +\ + HRESULT CreateInstance(REFCLSID clsid, REFIID riid)\ + {\ + Free();\ + return CoCreateInstance(clsid, NULL, CLSCTX_ALL, riid, (void **) &m_interface);\ + }\ +\ + inline operator I *() const {return m_interface;}\ + inline I* operator ->() {return m_interface;}\ + inline I** GetRef() {return &m_interface;}\ + inline bool Ok() const { return IsOk(); }\ + inline bool IsOk() const {return m_interface != NULL;}\ }; -#if WXWIN_COMPATIBILITY_2_8 -// this macro is kept for compatibility with older wx versions -#define WX_DECLARE_AUTOOLE(wxAutoOleInterfaceType, I) \ - typedef wxAutoOleInterface wxAutoOleInterfaceType; -#endif // WXWIN_COMPATIBILITY_2_8 +WX_DECLARE_AUTOOLE(wxAutoIDispatch, IDispatch) +WX_DECLARE_AUTOOLE(wxAutoIOleClientSite, IOleClientSite) +WX_DECLARE_AUTOOLE(wxAutoIUnknown, IUnknown) +WX_DECLARE_AUTOOLE(wxAutoIOleObject, IOleObject) +WX_DECLARE_AUTOOLE(wxAutoIOleInPlaceObject, IOleInPlaceObject) +WX_DECLARE_AUTOOLE(wxAutoIOleInPlaceActiveObject, IOleInPlaceActiveObject) +WX_DECLARE_AUTOOLE(wxAutoIOleDocumentView, IOleDocumentView) +WX_DECLARE_AUTOOLE(wxAutoIViewObject, IViewObject) -typedef wxAutoOleInterface wxAutoIDispatch; -typedef wxAutoOleInterface wxAutoIOleClientSite; -typedef wxAutoOleInterface wxAutoIUnknown; -typedef wxAutoOleInterface wxAutoIOleObject; -typedef wxAutoOleInterface wxAutoIOleInPlaceObject; -typedef wxAutoOleInterface wxAutoIOleInPlaceActiveObject; -typedef wxAutoOleInterface wxAutoIOleDocumentView; -typedef wxAutoOleInterface wxAutoIViewObject; - -class WXDLLIMPEXP_CORE wxActiveXContainer : public wxWindow +class wxActiveXContainer : public wxWindow { public: wxActiveXContainer(wxWindow * parent, REFIID iid, IUnknown* pUnk); @@ -168,14 +150,11 @@ public: void OnPaint(wxPaintEvent&); void OnSetFocus(wxFocusEvent&); void OnKillFocus(wxFocusEvent&); - virtual bool MSWTranslateMessage(WXMSG* pMsg); - virtual bool QueryClientSiteInterface(REFIID iid, void **_interface, const char *&desc); protected: friend class FrameSite; friend class wxActiveXEvents; - FrameSite *m_frameSite; wxAutoIDispatch m_Dispatch; wxAutoIOleClientSite m_clientSite; wxAutoIUnknown m_ActiveX; @@ -192,30 +171,9 @@ protected: void CreateActiveX(REFIID, IUnknown*); }; -///\brief Store native event parameters. -///\detail Store OLE 'Invoke' parameters for event handlers that need to access them. -/// These are the exact values for the event as they are passed to the wxActiveXContainer. -struct wxActiveXEventNativeMSW -{ - DISPID dispIdMember; - REFIID riid; - LCID lcid; - WORD wFlags; - DISPPARAMS *pDispParams; - VARIANT *pVarResult; - EXCEPINFO *pExcepInfo; - unsigned int *puArgErr; - - wxActiveXEventNativeMSW - (DISPID a_dispIdMember, REFIID a_riid, LCID a_lcid, WORD a_wFlags, DISPPARAMS *a_pDispParams, - VARIANT *a_pVarResult, EXCEPINFO *a_pExcepInfo, unsigned int *a_puArgErr) - :dispIdMember(a_dispIdMember), riid(a_riid), lcid(a_lcid), wFlags(a_wFlags), pDispParams(a_pDispParams), - pVarResult(a_pVarResult), pExcepInfo(a_pExcepInfo), puArgErr(a_puArgErr) - { } -}; // Events -class WXDLLIMPEXP_CORE wxActiveXEvent : public wxCommandEvent +class wxActiveXEvent : public wxCommandEvent { private: friend class wxActiveXEvents; @@ -226,38 +184,37 @@ public: virtual wxEvent *Clone() const { return new wxActiveXEvent(*this); } - size_t ParamCount() const; + size_t ParamCount() const + { return m_params.GetCount(); } wxString ParamType(size_t idx) const { - wxASSERT(idx < ParamCount()); + wxASSERT(idx < m_params.GetCount()); return m_params[idx].GetType(); } wxString ParamName(size_t idx) const { - wxASSERT(idx < ParamCount()); + wxASSERT(idx < m_params.GetCount()); return m_params[idx].GetName(); } - wxVariant& operator[] (size_t idx); + wxVariant& operator[] (size_t idx) + { + wxASSERT(idx < ParamCount()); + return m_params[idx]; + } DISPID GetDispatchId() const { return m_dispid; } - - wxActiveXEventNativeMSW *GetNativeParameters() const - { return (wxActiveXEventNativeMSW*)GetClientData(); } }; -// #define wxACTIVEX_ID 14001 -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_ACTIVEX, wxActiveXEvent ); - +#define wxACTIVEX_ID 14001 +DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_MEDIA, wxEVT_ACTIVEX, wxACTIVEX_ID) typedef void (wxEvtHandler::*wxActiveXEventFunction)(wxActiveXEvent&); - +#define EVT_ACTIVEX(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_ACTIVEX, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxActiveXEventFunction) & fn, (wxObject *) NULL ), #define wxActiveXEventHandler(func) \ - wxEVENT_HANDLER_CAST( wxActiveXEventFunction, func ) - -#define EVT_ACTIVEX(id, fn) wxDECLARE_EVENT_TABLE_ENTRY(wxEVT_ACTIVEX, id, -1, wxActiveXEventHandler( fn ), NULL ), + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxActiveXEventFunction, &func) #endif // wxUSE_ACTIVEX diff --git a/Source/3rd Party/wx/include/wx/msw/ole/automtn.h b/Source/3rd Party/wx/include/wx/msw/ole/automtn.h index 028819470..9dd1e3763 100644 --- a/Source/3rd Party/wx/include/wx/msw/ole/automtn.h +++ b/Source/3rd Party/wx/include/wx/msw/ole/automtn.h @@ -1,10 +1,10 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/ole/automtn.h +// Name: automtn.h // Purpose: OLE automation utilities // Author: Julian Smart // Modified by: // Created: 11/6/98 -// RCS-ID: $Id$ +// RCS-ID: $Id: automtn.h 45498 2007-04-16 13:03:05Z VZ $ // Copyright: (c) 1998, Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -26,43 +26,27 @@ typedef unsigned short* WXBSTR; #undef GetObject #endif -// Flags used with wxAutomationObject::GetInstance() -enum wxAutomationInstanceFlags -{ - // Only use the existing instance, never create a new one. - wxAutomationInstance_UseExistingOnly = 0, - - // Create a new instance if there are no existing ones. - wxAutomationInstance_CreateIfNeeded = 1, - - // Do not log errors if we failed to get the existing instance because none - // is available. - wxAutomationInstance_SilentIfNone = 2 -}; - /* * wxAutomationObject * Wraps up an IDispatch pointer and invocation; does variant conversion. */ -class WXDLLIMPEXP_CORE wxAutomationObject: public wxObject +class WXDLLEXPORT wxAutomationObject: public wxObject { public: wxAutomationObject(WXIDISPATCH* dispatchPtr = NULL); virtual ~wxAutomationObject(); // Set/get dispatch pointer - void SetDispatchPtr(WXIDISPATCH* dispatchPtr) { m_dispatchPtr = dispatchPtr; } - WXIDISPATCH* GetDispatchPtr() const { return m_dispatchPtr; } - bool IsOk() const { return m_dispatchPtr != NULL; } + inline void SetDispatchPtr(WXIDISPATCH* dispatchPtr) { m_dispatchPtr = dispatchPtr; } + inline WXIDISPATCH* GetDispatchPtr() const { return m_dispatchPtr; } // Get a dispatch pointer from the current object associated - // with a ProgID, such as "Excel.Application" - bool GetInstance(const wxString& progId, - int flags = wxAutomationInstance_CreateIfNeeded) const; + // with a class id, such as "Excel.Application" + bool GetInstance(const wxString& classId) const; - // Get a dispatch pointer from a new instance of the class - bool CreateInstance(const wxString& progId) const; + // Get a dispatch pointer from a new instance of the the class + bool CreateInstance(const wxString& classId) const; // Low-level invocation function. Pass either an array of variants, // or an array of pointers to variants. @@ -80,7 +64,7 @@ public: const wxVariant& arg5 = wxNullVariant, const wxVariant& arg6 = wxNullVariant); // Get/Put property - wxVariant GetProperty(const wxString& property, int noArgs = 0, wxVariant args[] = NULL) const; + wxVariant GetProperty(const wxString& property, int noArgs = 0, wxVariant args[] = (wxVariant*) NULL) const; wxVariant GetPropertyArray(const wxString& property, int noArgs, const wxVariant **args) const; wxVariant GetProperty(const wxString& property, const wxVariant& arg1, const wxVariant& arg2 = wxNullVariant, @@ -103,13 +87,13 @@ public: // A way of initialising another wxAutomationObject with a dispatch object, // without having to deal with nasty IDispatch pointers. - bool GetObject(wxAutomationObject& obj, const wxString& property, int noArgs = 0, wxVariant args[] = NULL) const; + bool GetObject(wxAutomationObject& obj, const wxString& property, int noArgs = 0, wxVariant args[] = (wxVariant*) NULL) const; bool GetObject(wxAutomationObject& obj, const wxString& property, int noArgs, const wxVariant **args) const; public: WXIDISPATCH* m_dispatchPtr; - wxDECLARE_NO_COPY_CLASS(wxAutomationObject); + DECLARE_NO_COPY_CLASS(wxAutomationObject) }; #endif // wxUSE_OLE_AUTOMATION diff --git a/Source/3rd Party/wx/include/wx/msw/ole/dataform.h b/Source/3rd Party/wx/include/wx/msw/ole/dataform.h index a0eb5702a..f94c87f86 100644 --- a/Source/3rd Party/wx/include/wx/msw/ole/dataform.h +++ b/Source/3rd Party/wx/include/wx/msw/ole/dataform.h @@ -1,10 +1,10 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/ole/dataform.h +// Name: msw/ole/dataform.h // Purpose: declaration of the wxDataFormat class // Author: Vadim Zeitlin // Modified by: // Created: 19.10.99 (extracted from msw/ole/dataobj.h) -// RCS-ID: $Id$ +// RCS-ID: $Id: dataform.h 28812 2004-08-16 12:45:46Z ABX $ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -16,21 +16,14 @@ // wxDataFormat identifies the single format of data // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxDataFormat +class WXDLLEXPORT wxDataFormat { public: // the clipboard formats under Win32 are WORD's typedef unsigned short NativeFormat; wxDataFormat(NativeFormat format = wxDF_INVALID) { m_format = format; } - - // we need constructors from all string types as implicit conversions to - // wxString don't apply when we already rely on implicit conversion of a, - // for example, "char *" string to wxDataFormat, and existing code does it - wxDataFormat(const wxString& format) { SetId(format); } - wxDataFormat(const char *format) { SetId(format); } - wxDataFormat(const wchar_t *format) { SetId(format); } - wxDataFormat(const wxCStrData& format) { SetId(format); } + wxDataFormat(const wxChar *format) { SetId(format); } wxDataFormat& operator=(NativeFormat format) { m_format = format; return *this; } @@ -62,7 +55,7 @@ public: // string ids are used for custom types - this SetId() must be used for // application-specific formats wxString GetId() const; - void SetId(const wxString& format); + void SetId(const wxChar *format); // returns true if the format is one of those defined in wxDataFormatId bool IsStandard() const { return m_format > 0 && m_format < wxDF_PRIVATE; } diff --git a/Source/3rd Party/wx/include/wx/msw/ole/dataobj.h b/Source/3rd Party/wx/include/wx/msw/ole/dataobj.h index 152793d5e..71cd44553 100644 --- a/Source/3rd Party/wx/include/wx/msw/ole/dataobj.h +++ b/Source/3rd Party/wx/include/wx/msw/ole/dataobj.h @@ -1,10 +1,10 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/ole/dataobj.h +// Name: msw/ole/dataobj.h // Purpose: declaration of the wxDataObject class // Author: Vadim Zeitlin // Modified by: // Created: 10.05.98 -// RCS-ID: $Id$ +// RCS-ID: $Id: dataobj.h 37406 2006-02-09 03:45:14Z VZ $ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -22,7 +22,7 @@ struct IDataObject; // wxDataObject is a "smart" and polymorphic piece of data. // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxDataObject : public wxDataObjectBase +class WXDLLEXPORT wxDataObject : public wxDataObjectBase { public: // ctor & dtor @@ -59,7 +59,7 @@ public: #define wxGetFormatName(format) wxDataObject::GetFormatName(format) #else // !Debug - #define wxGetFormatName(format) wxT("") + #define wxGetFormatName(format) _T("") #endif // Debug/!Debug // they need to be accessed from wxIDataObject, so made them public, // or wxIDataObject friend @@ -73,7 +73,7 @@ public: private: IDataObject *m_pIDataObject; // pointer to the COM interface - wxDECLARE_NO_COPY_CLASS(wxDataObject); + DECLARE_NO_COPY_CLASS(wxDataObject) }; #endif //_WX_MSW_OLE_DATAOBJ_H diff --git a/Source/3rd Party/wx/include/wx/msw/ole/dataobj2.h b/Source/3rd Party/wx/include/wx/msw/ole/dataobj2.h index cc5e7ba2a..dc1954d0b 100644 --- a/Source/3rd Party/wx/include/wx/msw/ole/dataobj2.h +++ b/Source/3rd Party/wx/include/wx/msw/ole/dataobj2.h @@ -5,7 +5,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 21.10.99 -// RCS-ID: $Id$ +// RCS-ID: $Id: dataobj2.h 40772 2006-08-23 13:38:45Z VZ $ // Copyright: (c) 1999 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -21,7 +21,7 @@ // rarely used). This is ugly, but I haven't found a solution for it yet. // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxBitmapDataObject : public wxBitmapDataObjectBase +class WXDLLEXPORT wxBitmapDataObject : public wxBitmapDataObjectBase { public: // ctors @@ -51,7 +51,7 @@ private: // the DIB data void /* BITMAPINFO */ *m_data; - wxDECLARE_NO_COPY_CLASS(wxBitmapDataObject); + DECLARE_NO_COPY_CLASS(wxBitmapDataObject) }; // ---------------------------------------------------------------------------- @@ -60,7 +60,7 @@ private: // FIXME did I already mention it was ugly? // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxBitmapDataObject2 : public wxBitmapDataObjectBase +class WXDLLEXPORT wxBitmapDataObject2 : public wxBitmapDataObjectBase { public: // ctors @@ -84,14 +84,14 @@ public: { return SetData(len, buf); } private: - wxDECLARE_NO_COPY_CLASS(wxBitmapDataObject2); + DECLARE_NO_COPY_CLASS(wxBitmapDataObject2) }; // ---------------------------------------------------------------------------- // wxFileDataObject - data object for CF_HDROP // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxFileDataObject : public wxFileDataObjectBase +class WXDLLEXPORT wxFileDataObject : public wxFileDataObjectBase { public: wxFileDataObject() { } @@ -112,14 +112,14 @@ public: { return SetData(len, buf); } private: - wxDECLARE_NO_COPY_CLASS(wxFileDataObject); + DECLARE_NO_COPY_CLASS(wxFileDataObject) }; // ---------------------------------------------------------------------------- // wxURLDataObject: data object for URLs // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxURLDataObject : public wxDataObjectComposite +class WXDLLEXPORT wxURLDataObject : public wxDataObjectComposite { public: // initialize with URL in ctor or use SetURL later @@ -140,7 +140,7 @@ private: // last data object we got data in wxDataObjectSimple *m_dataObjectLast; - wxDECLARE_NO_COPY_CLASS(wxURLDataObject); + DECLARE_NO_COPY_CLASS(wxURLDataObject) }; #endif // _WX_MSW_OLE_DATAOBJ2_H diff --git a/Source/3rd Party/wx/include/wx/msw/ole/dropsrc.h b/Source/3rd Party/wx/include/wx/msw/ole/dropsrc.h index e8eb6e257..8646558f9 100644 --- a/Source/3rd Party/wx/include/wx/msw/ole/dropsrc.h +++ b/Source/3rd Party/wx/include/wx/msw/ole/dropsrc.h @@ -1,10 +1,10 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/ole/dropsrc.h +// Name: ole/dropsrc.h // Purpose: declaration of the wxDropSource class // Author: Vadim Zeitlin // Modified by: // Created: 06.03.98 -// RCS-ID: $Id$ +// RCS-ID: $Id: dropsrc.h 49563 2007-10-31 20:46:21Z VZ $ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -30,14 +30,14 @@ class WXDLLIMPEXP_FWD_CORE wxWindow; // the cursor 'name' from the resources under MSW, but will expand to // something else under GTK. If you don't use it, you will have to use #ifdef // in the application code. -#define wxDROP_ICON(name) wxCursor(wxT(#name)) +#define wxDROP_ICON(name) wxCursor(_T(#name)) // ---------------------------------------------------------------------------- // wxDropSource is used to start the drag-&-drop operation on associated // wxDataObject object. It's responsible for giving UI feedback while dragging. // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxDropSource : public wxDropSourceBase +class WXDLLEXPORT wxDropSource : public wxDropSourceBase { public: // ctors: if you use default ctor you must call SetData() later! @@ -71,7 +71,7 @@ protected: private: wxIDropSource *m_pIDropSource; // the pointer to COM interface - wxDECLARE_NO_COPY_CLASS(wxDropSource); + DECLARE_NO_COPY_CLASS(wxDropSource) }; #endif //wxUSE_DRAG_AND_DROP diff --git a/Source/3rd Party/wx/include/wx/msw/ole/droptgt.h b/Source/3rd Party/wx/include/wx/msw/ole/droptgt.h index fe82962f7..a1d44a0ef 100644 --- a/Source/3rd Party/wx/include/wx/msw/ole/droptgt.h +++ b/Source/3rd Party/wx/include/wx/msw/ole/droptgt.h @@ -1,10 +1,10 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/ole/droptgt.h +// Name: ole/droptgt.h // Purpose: declaration of the wxDropTarget class // Author: Vadim Zeitlin // Modified by: // Created: 06.03.98 -// RCS-ID: $Id$ +// RCS-ID: $Id: droptgt.h 35650 2005-09-23 12:56:45Z MR $ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -31,7 +31,7 @@ struct IDataObject; // (all of them, including protected ones which are called by the class itself) // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxDropTarget : public wxDropTargetBase +class WXDLLEXPORT wxDropTarget : public wxDropTargetBase { public: // ctor & dtor @@ -47,27 +47,24 @@ public: virtual bool OnDrop(wxCoord x, wxCoord y); virtual bool GetData(); - // Can only be called during OnXXX methods. - wxDataFormat GetMatchingPair(); - // implementation only from now on // ------------------------------- // do we accept this kind of data? - bool MSWIsAcceptedData(IDataObject *pIDataSource) const; + bool IsAcceptedData(IDataObject *pIDataSource) const; // give us the data source from IDropTarget::Drop() - this is later used by // GetData() when it's called from inside OnData() - void MSWSetDataSource(IDataObject *pIDataSource); + void SetDataSource(IDataObject *pIDataSource); private: // helper used by IsAcceptedData() and GetData() - wxDataFormat MSWGetSupportedFormat(IDataObject *pIDataSource) const; + wxDataFormat GetSupportedFormat(IDataObject *pIDataSource) const; wxIDropTarget *m_pIDropTarget; // the pointer to our COM interface IDataObject *m_pIDataSource; // the pointer to the source data object - wxDECLARE_NO_COPY_CLASS(wxDropTarget); + DECLARE_NO_COPY_CLASS(wxDropTarget) }; #endif //wxUSE_DRAG_AND_DROP diff --git a/Source/3rd Party/wx/include/wx/msw/ole/oleutils.h b/Source/3rd Party/wx/include/wx/msw/ole/oleutils.h index 833acd1ac..635c11b19 100644 --- a/Source/3rd Party/wx/include/wx/msw/ole/oleutils.h +++ b/Source/3rd Party/wx/include/wx/msw/ole/oleutils.h @@ -1,10 +1,10 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/ole/oleutils.h +// Name: oleutils.h // Purpose: OLE helper routines, OLE debugging support &c // Author: Vadim Zeitlin // Modified by: // Created: 19.02.1998 -// RCS-ID: $Id$ +// RCS-ID: $Id: oleutils.h 49804 2007-11-10 01:09:42Z VZ $ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -36,19 +36,12 @@ // return true if ok, false otherwise inline bool wxOleInitialize() { - HRESULT + // we need to initialize OLE library #ifdef __WXWINCE__ - hr = ::CoInitializeEx(NULL, COINIT_MULTITHREADED); + if ( FAILED(::CoInitializeEx(NULL, COINIT_MULTITHREADED)) ) #else - hr = ::OleInitialize(NULL); + if ( FAILED(::OleInitialize(NULL)) ) #endif - - // RPC_E_CHANGED_MODE indicates that OLE had been already initialized - // before, albeit with different mode. Don't consider it to be an error as - // we don't actually care ourselves about the mode used so this allows the - // main application to call OleInitialize() on its own before we do if it - // needs non-default mode. - if ( hr != RPC_E_CHANGED_MODE && FAILED(hr) ) { wxLogError(_("Cannot initialize OLE")); @@ -82,7 +75,7 @@ inline void ReleaseInterface(IUnknown *pIUnk) #define RELEASE_AND_NULL(p) if ( (p) != NULL ) { p->Release(); p = NULL; }; // return true if the iid is in the array -extern WXDLLIMPEXP_CORE bool IsIidFromList(REFIID riid, const IID *aIids[], size_t nCount); +extern bool IsIidFromList(REFIID riid, const IID *aIids[], size_t nCount); // ============================================================================ // IUnknown implementation helpers @@ -140,10 +133,9 @@ private: wxAutoULong m_cRef // macros for declaring supported interfaces -// NB: ADD_IID prepends IID_I whereas ADD_RAW_IID does not +// NB: you should write ADD_INTERFACE(Foo) and not ADD_INTERFACE(IID_IFoo)! #define BEGIN_IID_TABLE(cname) const IID *cname::ms_aIids[] = { #define ADD_IID(iid) &IID_I##iid, -#define ADD_RAW_IID(iid) &iid, #define END_IID_TABLE } // implementation is as straightforward as possible @@ -151,7 +143,7 @@ private: #define IMPLEMENT_IUNKNOWN_METHODS(classname) \ STDMETHODIMP classname::QueryInterface(REFIID riid, void **ppv) \ { \ - wxLogQueryInterface(wxT(#classname), riid); \ + wxLogQueryInterface(_T(#classname), riid); \ \ if ( IsIidFromList(riid, ms_aIids, WXSIZEOF(ms_aIids)) ) { \ *ppv = this; \ @@ -168,14 +160,14 @@ private: \ STDMETHODIMP_(ULONG) classname::AddRef() \ { \ - wxLogAddRef(wxT(#classname), m_cRef); \ + wxLogAddRef(_T(#classname), m_cRef); \ \ return ++m_cRef; \ } \ \ STDMETHODIMP_(ULONG) classname::Release() \ { \ - wxLogRelease(wxT(#classname), m_cRef); \ + wxLogRelease(_T(#classname), m_cRef); \ \ if ( --m_cRef == wxAutoULong(0) ) { \ delete this; \ @@ -192,17 +184,17 @@ private: // VZ: I don't know it's not done for compilers other than VC++ but I leave it // as is. Please note, though, that tracing OLE interface calls may be // incredibly useful when debugging OLE programs. -#if defined(__WXDEBUG__) && (( defined(__VISUALC__) && (__VISUALC__ >= 1000) )) +#if defined(__WXDEBUG__) && ( ( defined(__VISUALC__) && (__VISUALC__ >= 1000) ) || defined(__MWERKS__) ) // ---------------------------------------------------------------------------- // All OLE specific log functions have DebugTrace level (as LogTrace) // ---------------------------------------------------------------------------- // tries to translate riid into a symbolic name, if possible -WXDLLIMPEXP_CORE void wxLogQueryInterface(const wxChar *szInterface, REFIID riid); +void wxLogQueryInterface(const wxChar *szInterface, REFIID riid); // these functions print out the new value of reference counter -WXDLLIMPEXP_CORE void wxLogAddRef (const wxChar *szInterface, ULONG cRef); -WXDLLIMPEXP_CORE void wxLogRelease(const wxChar *szInterface, ULONG cRef); +void wxLogAddRef (const wxChar *szInterface, ULONG cRef); +void wxLogRelease(const wxChar *szInterface, ULONG cRef); #else //!__WXDEBUG__ #define wxLogQueryInterface(szInterface, riid) @@ -212,40 +204,43 @@ WXDLLIMPEXP_CORE void wxLogRelease(const wxChar *szInterface, ULONG cRef); // wrapper around BSTR type (by Vadim Zeitlin) -class WXDLLIMPEXP_CORE wxBasicString +class WXDLLEXPORT wxBasicString { public: // ctors & dtor + wxBasicString(const char *sz); wxBasicString(const wxString& str); - wxBasicString(const wxBasicString& bstr); ~wxBasicString(); - wxBasicString& operator=(const wxBasicString& bstr); + void Init(const char* sz); // accessors - // just get the string - operator BSTR() const { return m_bstrBuf; } - // retrieve a copy of our string - caller must SysFreeString() it later! - BSTR Get() const { return SysAllocString(m_bstrBuf); } + // just get the string + operator BSTR() const { return m_wzBuf; } + // retrieve a copy of our string - caller must SysFreeString() it later! + BSTR Get() const { return SysAllocString(m_wzBuf); } private: - // actual string - BSTR m_bstrBuf; + // @@@ not implemented (but should be) + wxBasicString(const wxBasicString&); + wxBasicString& operator=(const wxBasicString&); + + OLECHAR *m_wzBuf; // actual string }; #if wxUSE_VARIANT // Convert variants class WXDLLIMPEXP_FWD_BASE wxVariant; -WXDLLIMPEXP_CORE bool wxConvertVariantToOle(const wxVariant& variant, VARIANTARG& oleVariant); -WXDLLIMPEXP_CORE bool wxConvertOleToVariant(const VARIANTARG& oleVariant, wxVariant& variant); +WXDLLEXPORT bool wxConvertVariantToOle(const wxVariant& variant, VARIANTARG& oleVariant); +WXDLLEXPORT bool wxConvertOleToVariant(const VARIANTARG& oleVariant, wxVariant& variant); #endif // wxUSE_VARIANT // Convert string to Unicode -WXDLLIMPEXP_CORE BSTR wxConvertStringToOle(const wxString& str); +WXDLLEXPORT BSTR wxConvertStringToOle(const wxString& str); // Convert string from BSTR to wxString -WXDLLIMPEXP_CORE wxString wxConvertStringFromOle(BSTR bStr); +WXDLLEXPORT wxString wxConvertStringFromOle(BSTR bStr); #else // !wxUSE_OLE diff --git a/Source/3rd Party/wx/include/wx/msw/ole/uuid.h b/Source/3rd Party/wx/include/wx/msw/ole/uuid.h index 8ef85de48..0609448ec 100644 --- a/Source/3rd Party/wx/include/wx/msw/ole/uuid.h +++ b/Source/3rd Party/wx/include/wx/msw/ole/uuid.h @@ -1,10 +1,10 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/ole/uuid.h +// Name: ole/uuid.h // Purpose: encapsulates an UUID with some added helper functions // Author: Vadim Zeitlin // Modified by: // Created: 11.07.97 -// RCS-ID: $Id$ +// RCS-ID: $Id: uuid.h 55113 2008-08-18 11:30:10Z VZ $ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows licence // @@ -14,7 +14,7 @@ #ifndef _WX_OLEUUID_H #define _WX_OLEUUID_H -#include "wx/chartype.h" +#include "wx/wxchar.h" // ------------------------------------------------------------------ // UUID (Universally Unique IDentifier) definition // ------------------------------------------------------------------ @@ -44,7 +44,7 @@ typedef unsigned char uchar; // ------------------------------------------------------------------ // uses RPC functions to create/convert Universally Unique Identifiers -class WXDLLIMPEXP_CORE Uuid +class WXDLLEXPORT Uuid { private: UUID m_uuid; @@ -74,9 +74,11 @@ public: bool Set(const wxChar *pc); // from a string, returns true if ok void Set(const UUID& uuid); // from another UUID (never fails) +#if wxABI_VERSION >= 20809 // comparison operators bool operator==(const Uuid& uuid) const; - bool operator!=(const Uuid& uuid) const { return !(*this == uuid); } + bool operator!=(const Uuid& uuid) const; +#endif // wxABI_VERSION >= 2.8.9 // accessors operator const UUID*() const { return &m_uuid; } diff --git a/Source/3rd Party/wx/include/wx/msw/ownerdrw.h b/Source/3rd Party/wx/include/wx/msw/ownerdrw.h deleted file mode 100644 index a6d659b68..000000000 --- a/Source/3rd Party/wx/include/wx/msw/ownerdrw.h +++ /dev/null @@ -1,29 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/ownerdrw.h -// Purpose: wxOwnerDrawn class -// Author: Marcin Malich -// Modified by: -// Created: 2009-09-22 -// RCS-ID: $Id$ -// Copyright: (c) 2009 Marcin Malich -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_OWNERDRW_H_ -#define _WX_OWNERDRW_H_ - -#if wxUSE_OWNER_DRAWN - -class WXDLLIMPEXP_CORE wxOwnerDrawn : public wxOwnerDrawnBase -{ -public: - wxOwnerDrawn() {} - virtual ~wxOwnerDrawn() {} - - virtual bool OnDrawItem(wxDC& dc, const wxRect& rc, - wxODAction act, wxODStatus stat); -}; - -#endif // wxUSE_OWNER_DRAWN - -#endif // _WX_OWNERDRW_H_ diff --git a/Source/3rd Party/wx/include/wx/msw/palette.h b/Source/3rd Party/wx/include/wx/msw/palette.h index 74a6f0900..87b59ec33 100644 --- a/Source/3rd Party/wx/include/wx/msw/palette.h +++ b/Source/3rd Party/wx/include/wx/msw/palette.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: palette.h 53135 2008-04-12 02:31:04Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -14,38 +14,45 @@ #include "wx/gdiobj.h" -class WXDLLIMPEXP_CORE wxPalette : public wxPaletteBase +class WXDLLIMPEXP_FWD_CORE wxPalette; + +class WXDLLEXPORT wxPaletteRefData: public wxGDIRefData +{ + friend class WXDLLIMPEXP_FWD_CORE wxPalette; +public: + wxPaletteRefData(void); + virtual ~wxPaletteRefData(void); +protected: + WXHPALETTE m_hPalette; +}; + +#define M_PALETTEDATA ((wxPaletteRefData *)m_refData) + +class WXDLLEXPORT wxPalette: public wxPaletteBase { public: - wxPalette() { } - wxPalette(int n, - const unsigned char *red, const unsigned char *green, const unsigned char *blue) - { - Create(n, red, green, blue); - } - - bool Create(int n, - const unsigned char *red, const unsigned char *green, const unsigned char *blue); + wxPalette(); + wxPalette(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue); + virtual ~wxPalette(void); + bool Create(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue); + + int GetPixel(unsigned char red, unsigned char green, unsigned char blue) const; + bool GetRGB(int pixel, unsigned char *red, unsigned char *green, unsigned char *blue) const; virtual int GetColoursCount() const; - int - GetPixel(unsigned char red, unsigned char green, unsigned char blue) const; + virtual bool Ok() const { return IsOk(); } + virtual bool IsOk(void) const { return (m_refData != NULL) ; } - bool - GetRGB(int pixel, - unsigned char *red, unsigned char *green, unsigned char *blue) const; + virtual bool FreeResource(bool force = false); // implemetation - WXHPALETTE GetHPALETTE() const; + inline WXHPALETTE GetHPALETTE(void) const { return (M_PALETTEDATA ? M_PALETTEDATA->m_hPalette : 0); } void SetHPALETTE(WXHPALETTE pal); - -protected: - virtual wxGDIRefData *CreateGDIRefData() const; - virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; - + private: DECLARE_DYNAMIC_CLASS(wxPalette) }; -#endif // _WX_PALETTE_H_ +#endif + // _WX_PALETTE_H_ diff --git a/Source/3rd Party/wx/include/wx/msw/panel.h b/Source/3rd Party/wx/include/wx/msw/panel.h deleted file mode 100644 index 0b01f7285..000000000 --- a/Source/3rd Party/wx/include/wx/msw/panel.h +++ /dev/null @@ -1,57 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/panel.h -// Purpose: wxMSW-specific wxPanel class. -// Author: Vadim Zeitlin -// Created: 2011-03-18 -// RCS-ID: $Id$ -// Copyright: (c) 2011 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_PANEL_H_ -#define _WX_MSW_PANEL_H_ - -class WXDLLIMPEXP_FWD_CORE wxBrush; - -// ---------------------------------------------------------------------------- -// wxPanel -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxPanel : public wxPanelBase -{ -public: - wxPanel() { } - - wxPanel(wxWindow *parent, - wxWindowID winid = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxTAB_TRAVERSAL | wxNO_BORDER, - const wxString& name = wxPanelNameStr) - { - Create(parent, winid, pos, size, style, name); - } - - // This is overridden for MSW to return true for all panels that are child - // of a window with themed background (such as wxNotebook) which should - // show through the child panels. - virtual bool HasTransparentBackground(); - - -#if WXWIN_COMPATIBILITY_2_8 - wxDEPRECATED_CONSTRUCTOR( - wxPanel(wxWindow *parent, - int x, int y, int width, int height, - long style = wxTAB_TRAVERSAL | wxNO_BORDER, - const wxString& name = wxPanelNameStr) - { - Create(parent, wxID_ANY, wxPoint(x, y), wxSize(width, height), style, name); - } - ) -#endif // WXWIN_COMPATIBILITY_2_8 - -private: - wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxPanel); -}; - -#endif // _WX_MSW_PANEL_H_ diff --git a/Source/3rd Party/wx/include/wx/msw/pen.h b/Source/3rd Party/wx/include/wx/msw/pen.h index fa1a5cfb3..caf378d33 100644 --- a/Source/3rd Party/wx/include/wx/msw/pen.h +++ b/Source/3rd Party/wx/include/wx/msw/pen.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: Vadim Zeitlin: fixed operator=(), ==(), !=() // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: pen.h 53135 2008-04-12 02:31:04Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -13,66 +13,119 @@ #define _WX_PEN_H_ #include "wx/gdiobj.h" -#include "wx/gdicmn.h" +#include "wx/bitmap.h" +#include "wx/colour.h" + +typedef WXDWORD wxMSWDash; + +class WXDLLIMPEXP_FWD_CORE wxPen; + +// VZ: this class should be made private +class WXDLLEXPORT wxPenRefData : public wxGDIRefData +{ +public: + wxPenRefData(); + wxPenRefData(const wxPenRefData& data); + virtual ~wxPenRefData(); + + bool operator==(const wxPenRefData& data) const + { + // we intentionally don't compare m_hPen fields here + return m_style == data.m_style && + m_width == data.m_width && + m_join == data.m_join && + m_cap == data.m_cap && + m_colour == data.m_colour && + (m_style != wxSTIPPLE || m_stipple.IsSameAs(data.m_stipple)) && + (m_style != wxUSER_DASH || + (m_nbDash == data.m_nbDash && + memcmp(m_dash, data.m_dash, m_nbDash*sizeof(wxDash)) == 0)); + } + +protected: + int m_width; + int m_style; + int m_join; + int m_cap; + wxBitmap m_stipple; + int m_nbDash; + wxDash * m_dash; + wxColour m_colour; + WXHPEN m_hPen; + +private: + friend class WXDLLIMPEXP_FWD_CORE wxPen; + + // Cannot use + // DECLARE_NO_COPY_CLASS(wxPenRefData) + // because copy constructor is explicitly declared above; + // but no copy assignment operator is defined, so declare + // it private to prevent the compiler from defining it: + wxPenRefData& operator=(const wxPenRefData&); +}; + +#define M_PENDATA ((wxPenRefData *)m_refData) +#define wxPENDATA(x) ((wxPenRefData *)(x).m_refData) // ---------------------------------------------------------------------------- // Pen // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxPen : public wxPenBase +class WXDLLEXPORT wxPen : public wxGDIObject { public: - wxPen() { } - wxPen(const wxColour& col, int width = 1, wxPenStyle style = wxPENSTYLE_SOLID); -#if FUTURE_WXWIN_COMPATIBILITY_3_0 - wxDEPRECATED_FUTURE( wxPen(const wxColour& col, int width, int style) ); -#endif - + wxPen(); + wxPen(const wxColour& col, int width = 1, int style = wxSOLID); wxPen(const wxBitmap& stipple, int width); - virtual ~wxPen() { } + virtual ~wxPen(); + + bool operator==(const wxPen& pen) const + { + const wxPenRefData *penData = (wxPenRefData *)pen.m_refData; + + // an invalid pen is only equal to another invalid pen + return m_refData ? penData && *M_PENDATA == *penData : !penData; + } - bool operator==(const wxPen& pen) const; bool operator!=(const wxPen& pen) const { return !(*this == pen); } + virtual bool Ok() const { return IsOk(); } + virtual bool IsOk() const { return (m_refData != NULL); } + // Override in order to recreate the pen void SetColour(const wxColour& col); void SetColour(unsigned char r, unsigned char g, unsigned char b); void SetWidth(int width); - void SetStyle(wxPenStyle style); + void SetStyle(int style); void SetStipple(const wxBitmap& stipple); void SetDashes(int nb_dashes, const wxDash *dash); - void SetJoin(wxPenJoin join); - void SetCap(wxPenCap cap); + void SetJoin(int join); + void SetCap(int cap); - wxColour GetColour() const; - int GetWidth() const; - wxPenStyle GetStyle() const; - wxPenJoin GetJoin() const; - wxPenCap GetCap() const; - int GetDashes(wxDash** ptr) const; - wxDash* GetDash() const; - int GetDashCount() const; - wxBitmap* GetStipple() const; + wxColour& GetColour() const { return (M_PENDATA ? M_PENDATA->m_colour : wxNullColour); } + int GetWidth() const { return (M_PENDATA ? M_PENDATA->m_width : 0); } + int GetStyle() const { return (M_PENDATA ? M_PENDATA->m_style : 0); } + int GetJoin() const { return (M_PENDATA ? M_PENDATA->m_join : 0); } + int GetCap() const { return (M_PENDATA ? M_PENDATA->m_cap : 0); } + int GetDashes(wxDash **ptr) const + { + *ptr = (M_PENDATA ? (wxDash*)M_PENDATA->m_dash : (wxDash*) NULL); + return (M_PENDATA ? M_PENDATA->m_nbDash : 0); + } + wxDash* GetDash() const { return (M_PENDATA ? (wxDash*)M_PENDATA->m_dash : (wxDash*)NULL); } + inline int GetDashCount() const { return (M_PENDATA ? M_PENDATA->m_nbDash : 0); } -#if FUTURE_WXWIN_COMPATIBILITY_3_0 - wxDEPRECATED_FUTURE( void SetStyle(int style) ) - { SetStyle((wxPenStyle)style); } -#endif + inline wxBitmap *GetStipple() const { return (M_PENDATA ? (& M_PENDATA->m_stipple) : (wxBitmap*) NULL); } - // internal: wxGDIObject methods - virtual bool RealizeResource(); - virtual bool FreeResource(bool force = false); - virtual WXHANDLE GetResourceHandle() const; - virtual bool IsFree() const; - -protected: - virtual wxGDIRefData* CreateGDIRefData() const; - virtual wxGDIRefData* CloneGDIRefData(const wxGDIRefData* data) const; - - // same as FreeResource() + RealizeResource() - bool Recreate(); + // Internal + bool RealizeResource(); + bool FreeResource(bool force = false); + WXHANDLE GetResourceHandle() const; + bool IsFree() const; + void Unshare(); +private: DECLARE_DYNAMIC_CLASS(wxPen) }; diff --git a/Source/3rd Party/wx/include/wx/msw/popupwin.h b/Source/3rd Party/wx/include/wx/msw/popupwin.h index 6087a6d4b..56f63fef4 100644 --- a/Source/3rd Party/wx/include/wx/msw/popupwin.h +++ b/Source/3rd Party/wx/include/wx/msw/popupwin.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 06.01.01 -// RCS-ID: $Id$ +// RCS-ID: $Id: popupwin.h 37393 2006-02-08 21:47:09Z VZ $ // Copyright: (c) 2001 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -16,7 +16,7 @@ // wxPopupWindow // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxPopupWindow : public wxPopupWindowBase +class WXDLLEXPORT wxPopupWindow : public wxPopupWindowBase { public: wxPopupWindow() { } diff --git a/Source/3rd Party/wx/include/wx/msw/printdlg.h b/Source/3rd Party/wx/include/wx/msw/printdlg.h index 77365caa2..25b21a50f 100644 --- a/Source/3rd Party/wx/include/wx/msw/printdlg.h +++ b/Source/3rd Party/wx/include/wx/msw/printdlg.h @@ -1,10 +1,10 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/printdlg.h +// Name: printdlg.h // Purpose: wxPrintDialog, wxPageSetupDialog classes // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: printdlg.h 49804 2007-11-10 01:09:42Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -20,30 +20,28 @@ #include "wx/printdlg.h" class WXDLLIMPEXP_FWD_CORE wxDC; -class WinPrinter; //---------------------------------------------------------------------------- // wxWindowsPrintNativeData //---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxWindowsPrintNativeData: public wxPrintNativeDataBase +class WXDLLEXPORT wxWindowsPrintNativeData: public wxPrintNativeDataBase { public: wxWindowsPrintNativeData(); virtual ~wxWindowsPrintNativeData(); - + virtual bool TransferTo( wxPrintData &data ); virtual bool TransferFrom( const wxPrintData &data ); - + virtual bool Ok() const { return IsOk(); } virtual bool IsOk() const; - - void InitializeDevMode(const wxString &printerName = wxEmptyString, WinPrinter* printer = NULL); + void* GetDevMode() const { return m_devMode; } void SetDevMode(void* data) { m_devMode = data; } void* GetDevNames() const { return m_devNames; } void SetDevNames(void* data) { m_devNames = data; } - + private: void* m_devMode; void* m_devNames; @@ -53,12 +51,12 @@ private: private: DECLARE_DYNAMIC_CLASS(wxWindowsPrintNativeData) }; - + // --------------------------------------------------------------------------- // wxWindowsPrintDialog: the MSW dialog for printing // --------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxWindowsPrintDialog : public wxPrintDialogBase +class WXDLLEXPORT wxWindowsPrintDialog : public wxPrintDialogBase { public: wxWindowsPrintDialog(wxWindow *parent, wxPrintDialogData* data = NULL); @@ -78,24 +76,24 @@ private: wxPrinterDC* m_printerDC; bool m_destroyDC; wxWindow* m_dialogParent; - + private: bool ConvertToNative( wxPrintDialogData &data ); bool ConvertFromNative( wxPrintDialogData &data ); - + // holds MSW handle void* m_printDlg; private: - wxDECLARE_NO_COPY_CLASS(wxWindowsPrintDialog); + DECLARE_NO_COPY_CLASS(wxWindowsPrintDialog) DECLARE_CLASS(wxWindowsPrintDialog) }; // --------------------------------------------------------------------------- -// wxWindowsPageSetupDialog: the MSW page setup dialog +// wxWindowsPageSetupDialog: the MSW page setup dialog // --------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxWindowsPageSetupDialog: public wxPageSetupDialogBase +class WXDLLEXPORT wxWindowsPageSetupDialog: public wxPageSetupDialogBase { public: wxWindowsPageSetupDialog(); @@ -107,12 +105,12 @@ public: bool ConvertToNative( wxPageSetupDialogData &data ); bool ConvertFromNative( wxPageSetupDialogData &data ); - virtual wxPageSetupDialogData& GetPageSetupDialogData() { return m_pageSetupData; } + virtual wxPageSetupData& GetPageSetupDialogData() { return m_pageSetupData; } private: wxPageSetupDialogData m_pageSetupData; wxWindow* m_dialogParent; - + // holds MSW handle void* m_pageDlg; diff --git a/Source/3rd Party/wx/include/wx/msw/printwin.h b/Source/3rd Party/wx/include/wx/msw/printwin.h index 10c4f4376..4240682a6 100644 --- a/Source/3rd Party/wx/include/wx/msw/printwin.h +++ b/Source/3rd Party/wx/include/wx/msw/printwin.h @@ -1,10 +1,10 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/printwin.h +// Name: printwin.h // Purpose: wxWindowsPrinter, wxWindowsPrintPreview classes // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: printwin.h 42522 2006-10-27 13:07:40Z JS $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -18,12 +18,13 @@ // Represents the printer: manages printing a wxPrintout object // --------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxWindowsPrinter : public wxPrinterBase +class WXDLLEXPORT wxWindowsPrinter : public wxPrinterBase { DECLARE_DYNAMIC_CLASS(wxWindowsPrinter) public: wxWindowsPrinter(wxPrintDialogData *data = NULL); + virtual ~wxWindowsPrinter(); virtual bool Print(wxWindow *parent, wxPrintout *printout, @@ -33,7 +34,9 @@ public: virtual bool Setup(wxWindow *parent); private: - wxDECLARE_NO_COPY_CLASS(wxWindowsPrinter); + WXFARPROC m_lpAbortProc; + + DECLARE_NO_COPY_CLASS(wxWindowsPrinter) }; // --------------------------------------------------------------------------- @@ -41,7 +44,7 @@ private: // wxPrintout. // --------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxWindowsPrintPreview : public wxPrintPreviewBase +class WXDLLEXPORT wxWindowsPrintPreview : public wxPrintPreviewBase { public: wxWindowsPrintPreview(wxPrintout *printout, @@ -55,11 +58,7 @@ public: virtual bool Print(bool interactive); virtual void DetermineScaling(); -protected: -#if wxUSE_ENH_METAFILE - virtual bool RenderPageIntoBitmap(wxBitmap& bmp, int pageNum); -#endif - +private: DECLARE_DYNAMIC_CLASS_NO_COPY(wxWindowsPrintPreview) }; diff --git a/Source/3rd Party/wx/include/wx/msw/private.h b/Source/3rd Party/wx/include/wx/msw/private.h index 2c3e9fa4c..c4d37c8c3 100644 --- a/Source/3rd Party/wx/include/wx/msw/private.h +++ b/Source/3rd Party/wx/include/wx/msw/private.h @@ -6,7 +6,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: private.h 62189 2009-09-28 16:02:08Z JS $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -23,10 +23,6 @@ #include "wx/log.h" -#if wxUSE_GUI - #include "wx/window.h" -#endif // wxUSE_GUI - class WXDLLIMPEXP_FWD_CORE wxFont; class WXDLLIMPEXP_FWD_CORE wxWindow; class WXDLLIMPEXP_FWD_CORE wxWindowBase; @@ -46,13 +42,13 @@ class WXDLLIMPEXP_FWD_CORE wxWindowBase; #if wxUSE_GUI -extern WXDLLIMPEXP_DATA_CORE(HICON) wxSTD_FRAME_ICON; -extern WXDLLIMPEXP_DATA_CORE(HICON) wxSTD_MDIPARENTFRAME_ICON; -extern WXDLLIMPEXP_DATA_CORE(HICON) wxSTD_MDICHILDFRAME_ICON; -extern WXDLLIMPEXP_DATA_CORE(HICON) wxDEFAULT_FRAME_ICON; -extern WXDLLIMPEXP_DATA_CORE(HICON) wxDEFAULT_MDIPARENTFRAME_ICON; -extern WXDLLIMPEXP_DATA_CORE(HICON) wxDEFAULT_MDICHILDFRAME_ICON; -extern WXDLLIMPEXP_DATA_CORE(HFONT) wxSTATUS_LINE_FONT; +extern WXDLLEXPORT_DATA(HICON) wxSTD_FRAME_ICON; +extern WXDLLEXPORT_DATA(HICON) wxSTD_MDIPARENTFRAME_ICON; +extern WXDLLEXPORT_DATA(HICON) wxSTD_MDICHILDFRAME_ICON; +extern WXDLLEXPORT_DATA(HICON) wxDEFAULT_FRAME_ICON; +extern WXDLLEXPORT_DATA(HICON) wxDEFAULT_MDIPARENTFRAME_ICON; +extern WXDLLEXPORT_DATA(HICON) wxDEFAULT_MDICHILDFRAME_ICON; +extern WXDLLEXPORT_DATA(HFONT) wxSTATUS_LINE_FONT; #endif // wxUSE_GUI @@ -62,13 +58,6 @@ extern WXDLLIMPEXP_DATA_CORE(HFONT) wxSTATUS_LINE_FONT; extern WXDLLIMPEXP_DATA_BASE(HINSTANCE) wxhInstance; -extern "C" -{ - WXDLLIMPEXP_BASE HINSTANCE wxGetInstance(); -} - -WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst); - // --------------------------------------------------------------------------- // define things missing from some compilers' headers // --------------------------------------------------------------------------- @@ -169,9 +158,9 @@ extern LONG APIENTRY _EXPORT // This one is a macro so that it can be tested with #ifdef, it will be // undefined if it cannot be implemented for a given compiler. -// Vc++, bcc, dmc, ow, mingw akk have _get_osfhandle() and Cygwin has -// get_osfhandle. Others are currently unknown, e.g. Salford, Intel, Visual -// Age. +// Vc++, bcc, dmc, ow, mingw, codewarrior (and rsxnt) have _get_osfhandle. +// Cygwin has get_osfhandle. Others are currently unknown, e.g. Salford, +// Intel, Visual Age. #if defined(__WXWINCE__) #define wxGetOSFHandle(fd) ((HANDLE)fd) #define wxOpenOSFHandle(h, flags) ((int)wxPtrToUInt(h)) @@ -181,7 +170,8 @@ extern LONG APIENTRY _EXPORT || defined(__BORLANDC__) \ || defined(__DMC__) \ || defined(__WATCOMC__) \ - || defined(__MINGW32__) + || defined(__MINGW32__) \ + || (defined(__MWERKS__) && defined(__MSL__)) #define wxGetOSFHandle(fd) ((HANDLE)_get_osfhandle(fd)) #define wxOpenOSFHandle(h, flags) (_open_osfhandle(wxPtrToUInt(h), flags)) #define wx_fdopen _fdopen @@ -218,21 +208,6 @@ struct WinStruct : public T }; -// Macros for converting wxString to the type expected by API functions. -// -// Normally it is enough to just use wxString::t_str() which is implicitly -// convertible to LPCTSTR, but in some cases an explicit conversion is required. -// -// In such cases wxMSW_CONV_LPCTSTR() should be used. But if an API function -// takes a non-const pointer, wxMSW_CONV_LPTSTR() which casts away the -// constness (but doesn't make it possible to really modify the returned -// pointer, of course) should be used. And if a string is passed as LPARAM, use -// wxMSW_CONV_LPARAM() which does the required ugly reinterpret_cast<> too. -#define wxMSW_CONV_LPCTSTR(s) static_cast((s).t_str()) -#define wxMSW_CONV_LPTSTR(s) const_cast(wxMSW_CONV_LPCTSTR(s)) -#define wxMSW_CONV_LPARAM(s) reinterpret_cast(wxMSW_CONV_LPCTSTR(s)) - - #if wxUSE_GUI #include "wx/gdicmn.h" @@ -251,10 +226,7 @@ inline COLORREF wxColourToPalRGB(const wxColour& c) inline wxColour wxRGBToColour(COLORREF rgb) { - unsigned char red = (unsigned char)((rgb >> 16) & 0xFF); - unsigned char green = (unsigned char)(((rgb & 0xFFFF) >> 8) & 0xFF); - unsigned char blue = (unsigned char)(rgb & 0xFF) ; - return wxColour(red, green, blue); + return wxColour(GetRValue(rgb), GetGValue(rgb), GetBValue(rgb)); } inline void wxRGBToColour(wxColour& c, COLORREF rgb) @@ -279,7 +251,7 @@ enum wxSTD_COLOUR wxSTD_COL_MAX }; -struct WXDLLIMPEXP_CORE wxCOLORMAP +struct WXDLLEXPORT wxCOLORMAP { COLORREF from, to; }; @@ -313,9 +285,7 @@ inline void wxCopyRectToRECT(const wxRect& rect, RECT& rc) // translations between HIMETRIC units (which OLE likes) and pixels (which are // liked by all the others) - implemented in msw/utilsexc.cpp extern void HIMETRICToPixel(LONG *x, LONG *y); -extern void HIMETRICToPixel(LONG *x, LONG *y, HDC hdcRef); extern void PixelToHIMETRIC(LONG *x, LONG *y); -extern void PixelToHIMETRIC(LONG *x, LONG *y, HDC hdcRef); // Windows convention of the mask is opposed to the wxWidgets one, so we need // to invert the mask each time we pass one/get one to/from Windows @@ -332,22 +302,6 @@ extern HICON wxBitmapToHICON(const wxBitmap& bmp); extern HCURSOR wxBitmapToHCURSOR(const wxBitmap& bmp, int hotSpotX, int hotSpotY); - -#if wxUSE_OWNER_DRAWN - -// Draw the bitmap in specified state (this is used by owner drawn controls) -enum wxDSBStates -{ - wxDSB_NORMAL = 0, - wxDSB_SELECTED, - wxDSB_DISABLED -}; - -extern -BOOL wxDrawStateBitmap(HDC hDC, HBITMAP hBitmap, int x, int y, UINT uState); - -#endif // wxUSE_OWNER_DRAWN - // get (x, y) from DWORD - notice that HI/LOWORD can *not* be used because they // will fail on system with multiple monitors where the coords may be negative // @@ -357,32 +311,21 @@ BOOL wxDrawStateBitmap(HDC hDC, HBITMAP hBitmap, int x, int y, UINT uState); #define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp)) #endif // GET_X_LPARAM -// get the current state of SHIFT/CTRL/ALT keys -inline bool wxIsModifierDown(int vk) -{ - // GetKeyState() returns different negative values on WinME and WinNT, - // so simply test for negative value. - return ::GetKeyState(vk) < 0; -} - +// get the current state of SHIFT/CTRL keys inline bool wxIsShiftDown() { - return wxIsModifierDown(VK_SHIFT); +// return (::GetKeyState(VK_SHIFT) & 0x100) != 0; + // Returns different negative values on WinME and WinNT, + // so simply test for negative value. + return ::GetKeyState(VK_SHIFT) < 0; } inline bool wxIsCtrlDown() { - return wxIsModifierDown(VK_CONTROL); -} - -inline bool wxIsAltDown() -{ - return wxIsModifierDown(VK_MENU); -} - -inline bool wxIsAnyModifierDown() -{ - return wxIsShiftDown() || wxIsCtrlDown() || wxIsAltDown(); +// return (::GetKeyState(VK_CONTROL) & 0x100) != 0; + // Returns different negative values on WinME and WinNT, + // so simply test for negative value. + return ::GetKeyState(VK_CONTROL) < 0; } // wrapper around GetWindowRect() and GetClientRect() APIs doing error checking @@ -392,9 +335,7 @@ inline RECT wxGetWindowRect(HWND hwnd) RECT rect; if ( !::GetWindowRect(hwnd, &rect) ) - { - wxLogLastError(wxT("GetWindowRect")); - } + wxLogLastError(_T("GetWindowRect")); return rect; } @@ -404,9 +345,7 @@ inline RECT wxGetClientRect(HWND hwnd) RECT rect; if ( !::GetClientRect(hwnd, &rect) ) - { - wxLogLastError(wxT("GetClientRect")); - } + wxLogLastError(_T("GetClientRect")); return rect; } @@ -428,16 +367,15 @@ public: private: HDC m_hdc; - wxDECLARE_NO_COPY_CLASS(ScreenHDC); + DECLARE_NO_COPY_CLASS(ScreenHDC) }; // the same as ScreenHDC but for window DCs class WindowHDC { public: - WindowHDC() : m_hwnd(NULL), m_hdc(NULL) { } WindowHDC(HWND hwnd) { m_hdc = ::GetDC(m_hwnd = hwnd); } - ~WindowHDC() { if ( m_hwnd && m_hdc ) { ::ReleaseDC(m_hwnd, m_hdc); } } + ~WindowHDC() { ::ReleaseDC(m_hwnd, m_hdc); } operator HDC() const { return m_hdc; } @@ -445,7 +383,7 @@ private: HWND m_hwnd; HDC m_hdc; - wxDECLARE_NO_COPY_CLASS(WindowHDC); + DECLARE_NO_COPY_CLASS(WindowHDC) }; // the same as ScreenHDC but for memory DCs: creates the HDC compatible with @@ -461,7 +399,7 @@ public: private: HDC m_hdc; - wxDECLARE_NO_COPY_CLASS(MemoryHDC); + DECLARE_NO_COPY_CLASS(MemoryHDC) }; // a class which selects a GDI object into a DC in its ctor and deselects in @@ -472,12 +410,12 @@ private: void DoInit(HGDIOBJ hgdiobj) { m_hgdiobj = ::SelectObject(m_hdc, hgdiobj); } public: - SelectInHDC() : m_hdc(NULL), m_hgdiobj(NULL) { } + SelectInHDC() : m_hdc(NULL) { } SelectInHDC(HDC hdc, HGDIOBJ hgdiobj) : m_hdc(hdc) { DoInit(hgdiobj); } void Init(HDC hdc, HGDIOBJ hgdiobj) { - wxASSERT_MSG( !m_hdc, wxT("initializing twice?") ); + wxASSERT_MSG( !m_hdc, _T("initializing twice?") ); m_hdc = hdc; @@ -493,7 +431,7 @@ private: HDC m_hdc; HGDIOBJ m_hgdiobj; - wxDECLARE_NO_COPY_CLASS(SelectInHDC); + DECLARE_NO_COPY_CLASS(SelectInHDC) }; // a class which cleans up any GDI object @@ -506,7 +444,7 @@ protected: void InitGdiobj(HGDIOBJ gdiobj) { - wxASSERT_MSG( !m_gdiobj, wxT("initializing twice?") ); + wxASSERT_MSG( !m_gdiobj, _T("initializing twice?") ); m_gdiobj = gdiobj; } @@ -559,13 +497,8 @@ public: class AutoHBITMAP : private AutoGDIObject { public: - AutoHBITMAP() - : AutoGDIObject() { } - AutoHBITMAP(HBITMAP hbmp) : AutoGDIObject(hbmp) { } - void Init(HBITMAP hbmp) { InitGdiobj(hbmp); } - operator HBITMAP() const { return (HBITMAP)GetObject(); } }; @@ -604,9 +537,7 @@ public: : m_hdc(hdc) { if ( !::SelectClipRgn(hdc, hrgn) ) - { - wxLogLastError(wxT("SelectClipRgn")); - } + wxLogLastError(_T("SelectClipRgn")); } ~HDCClipper() @@ -617,7 +548,7 @@ public: private: HDC m_hdc; - wxDECLARE_NO_COPY_CLASS(HDCClipper); + DECLARE_NO_COPY_CLASS(HDCClipper) }; // set the given map mode for the life time of this object @@ -635,9 +566,7 @@ private: { m_modeOld = ::SetMapMode(hdc, mm); if ( !m_modeOld ) - { - wxLogLastError(wxT("SelectClipRgn")); - } + wxLogLastError(_T("SelectClipRgn")); } ~HDCMapModeChanger() @@ -650,44 +579,29 @@ private: HDC m_hdc; int m_modeOld; - wxDECLARE_NO_COPY_CLASS(HDCMapModeChanger); + DECLARE_NO_COPY_CLASS(HDCMapModeChanger) }; #define wxCHANGE_HDC_MAP_MODE(hdc, mm) \ HDCMapModeChanger wxMAKE_UNIQUE_NAME(wxHDCMapModeChanger)(hdc, mm) #endif // __WXWINCE__/!__WXWINCE__ -// smart pointer using GlobalAlloc/GlobalFree() +// smart buffeer using GlobalAlloc/GlobalFree() class GlobalPtr { public: - // default ctor, call Init() later - GlobalPtr() - { - m_hGlobal = NULL; - } - // allocates a block of given size - void Init(size_t size, unsigned flags = GMEM_MOVEABLE) + GlobalPtr(size_t size, unsigned flags = GMEM_MOVEABLE) { m_hGlobal = ::GlobalAlloc(flags, size); if ( !m_hGlobal ) - { - wxLogLastError(wxT("GlobalAlloc")); - } - } - - GlobalPtr(size_t size, unsigned flags = GMEM_MOVEABLE) - { - Init(size, flags); + wxLogLastError(_T("GlobalAlloc")); } ~GlobalPtr() { if ( m_hGlobal && ::GlobalFree(m_hGlobal) ) - { - wxLogLastError(wxT("GlobalFree")); - } + wxLogLastError(_T("GlobalFree")); } // implicit conversion @@ -696,7 +610,7 @@ public: private: HGLOBAL m_hGlobal; - wxDECLARE_NO_COPY_CLASS(GlobalPtr); + DECLARE_NO_COPY_CLASS(GlobalPtr) }; // when working with global pointers (which is unfortunately still necessary @@ -705,56 +619,35 @@ private: class GlobalPtrLock { public: - // default ctor, use Init() later -- should only be used if the HGLOBAL can - // be NULL (in which case Init() shouldn't be called) - GlobalPtrLock() + GlobalPtrLock(HGLOBAL hGlobal) : m_hGlobal(hGlobal) { - m_hGlobal = NULL; - m_ptr = NULL; - } - - // initialize the object, may be only called if we were created using the - // default ctor; HGLOBAL must not be NULL - void Init(HGLOBAL hGlobal) - { - m_hGlobal = hGlobal; - - // NB: GlobalLock() is a macro, not a function, hence don't use the - // global scope operator with it (and neither with GlobalUnlock()) m_ptr = GlobalLock(hGlobal); if ( !m_ptr ) - { - wxLogLastError(wxT("GlobalLock")); - } - } - - // initialize the object, HGLOBAL must not be NULL - GlobalPtrLock(HGLOBAL hGlobal) - { - Init(hGlobal); + wxLogLastError(_T("GlobalLock")); } ~GlobalPtrLock() { - if ( m_hGlobal && !GlobalUnlock(m_hGlobal) ) + if ( !GlobalUnlock(m_hGlobal) ) { +#ifdef __WXDEBUG__ // this might happen simply because the block became unlocked DWORD dwLastError = ::GetLastError(); if ( dwLastError != NO_ERROR ) { - wxLogApiError(wxT("GlobalUnlock"), dwLastError); + wxLogApiError(_T("GlobalUnlock"), dwLastError); } +#endif // __WXDEBUG__ } } - void *Get() const { return m_ptr; } operator void *() const { return m_ptr; } private: HGLOBAL m_hGlobal; void *m_ptr; - wxDECLARE_NO_COPY_CLASS(GlobalPtrLock); + DECLARE_NO_COPY_CLASS(GlobalPtrLock) }; // register the class when it is first needed and unregister it in dtor @@ -775,12 +668,12 @@ public: { // we should only be called if we hadn't been initialized yet wxASSERT_MSG( m_registered == -1, - wxT("calling ClassRegistrar::Register() twice?") ); + _T("calling ClassRegistrar::Register() twice?") ); m_registered = ::RegisterClass(&wc) ? 1 : 0; if ( !IsRegistered() ) { - wxLogLastError(wxT("RegisterClassEx()")); + wxLogLastError(_T("RegisterClassEx()")); } else { @@ -799,9 +692,9 @@ public: { if ( IsRegistered() ) { - if ( !::UnregisterClass(m_clsname.t_str(), wxGetInstance()) ) + if ( !::UnregisterClass(m_clsname, wxhInstance) ) { - wxLogLastError(wxT("UnregisterClass")); + wxLogLastError(_T("UnregisterClass")); } } } @@ -843,7 +736,7 @@ private: #define GetHbrushOf(brush) ((HBRUSH)(brush).GetResourceHandle()) #define GetHmenu() ((HMENU)GetHMenu()) -#define GetHmenuOf(menu) ((HMENU)(menu)->GetHMenu()) +#define GetHmenuOf(menu) ((HMENU)menu->GetHMenu()) #define GetHcursor() ((HCURSOR)GetHCURSOR()) #define GetHcursorOf(cursor) ((HCURSOR)(cursor).GetHCURSOR()) @@ -852,7 +745,7 @@ private: #define GetHfontOf(font) ((HFONT)(font).GetHFONT()) #define GetHimagelist() ((HIMAGELIST)GetHIMAGELIST()) -#define GetHimagelistOf(imgl) ((HIMAGELIST)(imgl)->GetHIMAGELIST()) +#define GetHimagelistOf(imgl) ((HIMAGELIST)imgl->GetHIMAGELIST()) #define GetHpalette() ((HPALETTE)GetHPALETTE()) #define GetHpaletteOf(pal) ((HPALETTE)(pal).GetHPALETTE()) @@ -869,6 +762,13 @@ private: // global functions // --------------------------------------------------------------------------- +extern "C" +{ + WXDLLIMPEXP_BASE HINSTANCE wxGetInstance(); +} + +WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst); + // return the full path of the given module inline wxString wxGetFullModuleName(HMODULE hmod) { @@ -880,7 +780,7 @@ inline wxString wxGetFullModuleName(HMODULE hmod) MAX_PATH ) ) { - wxLogLastError(wxT("GetModuleFileName")); + wxLogLastError(_T("GetModuleFileName")); } return fullname; @@ -899,10 +799,9 @@ inline wxString wxGetFullModuleName() // 0x0400 Windows 95, NT4 // 0x0410 Windows 98 // 0x0500 Windows ME, 2000 -// 0x0501 Windows XP, 2003 -// 0x0502 Windows XP SP2, 2003 SP1 -// 0x0600 Windows Vista, 2008 -// 0x0601 Windows 7 +// 0x0501 Windows XP +// 0x0502 Windows 2003 +// 0x0600 Longhorn // // for the other Windows versions 0 is currently returned enum wxWinVersion @@ -922,15 +821,10 @@ enum wxWinVersion wxWinVersion_NT5 = wxWinVersion_5, wxWinVersion_2000 = wxWinVersion_5, wxWinVersion_XP = 0x0501, - wxWinVersion_2003 = 0x0501, - wxWinVersion_XP_SP2 = 0x0502, - wxWinVersion_2003_SP1 = 0x0502, + wxWinVersion_2003 = 0x0502, wxWinVersion_6 = 0x0600, - wxWinVersion_Vista = wxWinVersion_6, - wxWinVersion_NT6 = wxWinVersion_6, - - wxWinVersion_7 = 0x601 + wxWinVersion_NT6 = 0x0600 }; WXDLLIMPEXP_BASE wxWinVersion wxGetWinVersion(); @@ -941,33 +835,30 @@ WXDLLIMPEXP_BASE wxWinVersion wxGetWinVersion(); extern HCURSOR wxGetCurrentBusyCursor(); // from msw/utils.cpp extern const wxCursor *wxGetGlobalCursor(); // from msw/cursor.cpp -// GetCursorPos can fail without populating the POINT. This falls back to GetMessagePos. -WXDLLIMPEXP_CORE void wxGetCursorPosMSW(POINT* pt); +WXDLLEXPORT void wxGetCharSize(WXHWND wnd, int *x, int *y, const wxFont& the_font); +WXDLLEXPORT void wxFillLogFont(LOGFONT *logFont, const wxFont *font); +WXDLLEXPORT wxFont wxCreateFontFromLogFont(const LOGFONT *logFont); +WXDLLEXPORT wxFontEncoding wxGetFontEncFromCharSet(int charset); -WXDLLIMPEXP_CORE void wxGetCharSize(WXHWND wnd, int *x, int *y, const wxFont& the_font); -WXDLLIMPEXP_CORE void wxFillLogFont(LOGFONT *logFont, const wxFont *font); -WXDLLIMPEXP_CORE wxFont wxCreateFontFromLogFont(const LOGFONT *logFont); -WXDLLIMPEXP_CORE wxFontEncoding wxGetFontEncFromCharSet(int charset); - -WXDLLIMPEXP_CORE void wxSliderEvent(WXHWND control, WXWORD wParam, WXWORD pos); -WXDLLIMPEXP_CORE void wxScrollBarEvent(WXHWND hbar, WXWORD wParam, WXWORD pos); +WXDLLEXPORT void wxSliderEvent(WXHWND control, WXWORD wParam, WXWORD pos); +WXDLLEXPORT void wxScrollBarEvent(WXHWND hbar, WXWORD wParam, WXWORD pos); // Find maximum size of window/rectangle -extern WXDLLIMPEXP_CORE void wxFindMaxSize(WXHWND hwnd, RECT *rect); +extern WXDLLEXPORT void wxFindMaxSize(WXHWND hwnd, RECT *rect); // Safely get the window text (i.e. without using fixed size buffer) -extern WXDLLIMPEXP_CORE wxString wxGetWindowText(WXHWND hWnd); +extern WXDLLEXPORT wxString wxGetWindowText(WXHWND hWnd); // get the window class name -extern WXDLLIMPEXP_CORE wxString wxGetWindowClass(WXHWND hWnd); +extern WXDLLEXPORT wxString wxGetWindowClass(WXHWND hWnd); // get the window id (should be unsigned, hence this is not wxWindowID which // is, for mainly historical reasons, signed) -extern WXDLLIMPEXP_CORE int wxGetWindowId(WXHWND hWnd); +extern WXDLLEXPORT WXWORD wxGetWindowId(WXHWND hWnd); // check if hWnd's WNDPROC is wndProc. Return true if yes, false if they are // different -extern WXDLLIMPEXP_CORE bool wxCheckWindowWndProc(WXHWND hWnd, WXFARPROC wndProc); +extern WXDLLEXPORT bool wxCheckWindowWndProc(WXHWND hWnd, WXFARPROC wndProc); // Does this window style specify any border? inline bool wxStyleHasBorder(long style) @@ -976,41 +867,26 @@ inline bool wxStyleHasBorder(long style) wxSUNKEN_BORDER | wxDOUBLE_BORDER)) != 0; } -inline long wxGetWindowExStyle(const wxWindowMSW *win) -{ - return ::GetWindowLong(GetHwndOf(win), GWL_EXSTYLE); -} - -inline bool wxHasWindowExStyle(const wxWindowMSW *win, long style) -{ - return (wxGetWindowExStyle(win) & style) != 0; -} - -inline long wxSetWindowExStyle(const wxWindowMSW *win, long style) -{ - return ::SetWindowLong(GetHwndOf(win), GWL_EXSTYLE, style); -} - // ---------------------------------------------------------------------------- // functions mapping HWND to wxWindow // ---------------------------------------------------------------------------- -// this function simply checks whether the given hwnd corresponds to a wxWindow +// this function simply checks whether the given hWnd corresponds to a wxWindow // and returns either that window if it does or NULL otherwise -extern WXDLLIMPEXP_CORE wxWindow* wxFindWinFromHandle(HWND hwnd); +extern WXDLLEXPORT wxWindow* wxFindWinFromHandle(WXHWND hWnd); // find the window for HWND which is part of some wxWindow, i.e. unlike // wxFindWinFromHandle() above it will also work for "sub controls" of a // wxWindow. // // returns the wxWindow corresponding to the given HWND or NULL. -extern WXDLLIMPEXP_CORE wxWindow *wxGetWindowFromHWND(WXHWND hwnd); +extern WXDLLEXPORT wxWindow *wxGetWindowFromHWND(WXHWND hwnd); // Get the size of an icon -extern WXDLLIMPEXP_CORE wxSize wxGetHiconSize(HICON hicon); +extern WXDLLEXPORT wxSize wxGetHiconSize(HICON hicon); // Lines are drawn differently for WinCE and regular WIN32 -WXDLLIMPEXP_CORE void wxDrawLine(HDC hdc, int x1, int y1, int x2, int y2); +WXDLLEXPORT void wxDrawLine(HDC hdc, int x1, int y1, int x2, int y2); // fill the client rect of the given window on the provided dc using this brush inline void wxFillRect(HWND hwnd, HDC hdc, HBRUSH hbr) diff --git a/Source/3rd Party/wx/include/wx/msw/private/button.h b/Source/3rd Party/wx/include/wx/msw/private/button.h deleted file mode 100644 index 9a642118f..000000000 --- a/Source/3rd Party/wx/include/wx/msw/private/button.h +++ /dev/null @@ -1,77 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/private/button.h -// Purpose: helper functions used with native BUTTON control -// Author: Vadim Zeitlin -// Created: 2008-06-07 -// RCS-ID: $Id$ -// Copyright: (c) 2008 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_PRIVATE_BUTTON_H_ -#define _WX_MSW_PRIVATE_BUTTON_H_ - -// define some standard button constants which may be missing in the headers -#ifndef BS_PUSHLIKE - #define BS_PUSHLIKE 0x00001000L -#endif - -#ifndef BST_UNCHECKED - #define BST_UNCHECKED 0x0000 -#endif - -#ifndef BST_CHECKED - #define BST_CHECKED 0x0001 -#endif - -#ifndef BST_INDETERMINATE - #define BST_INDETERMINATE 0x0002 -#endif - -namespace wxMSWButton -{ - -// returns BS_MULTILINE if the label contains new lines or 0 otherwise -inline int GetMultilineStyle(const wxString& label) -{ - return label.find(wxT('\n')) == wxString::npos ? 0 : BS_MULTILINE; -} - -// update the style of the specified HWND to include or exclude BS_MULTILINE -// depending on whether the label contains the new lines -void UpdateMultilineStyle(HWND hwnd, const wxString& label); - -// flags for ComputeBestSize() and GetFittingSize() -enum -{ - Size_AuthNeeded = 1, - Size_ExactFit = 2 -}; - -// NB: All the functions below are implemented in src/msw/button.cpp - -// Compute the button size (as if wxBU_EXACTFIT were specified, i.e. without -// adjusting it to be of default size if it's smaller) for the given label size -WXDLLIMPEXP_CORE wxSize -GetFittingSize(wxWindow *win, const wxSize& sizeLabel, int flags = 0); - -// Compute the button size (as if wxBU_EXACTFIT were specified) by computing -// its label size and then calling GetFittingSize(). -wxSize ComputeBestFittingSize(wxControl *btn, int flags = 0); - -// Increase the size passed as parameter to be at least the standard button -// size if the control doesn't have wxBU_EXACTFIT style and also cache it as -// the best size and return its value -- this is used in DoGetBestSize() -// implementation. -wxSize IncreaseToStdSizeAndCache(wxControl *btn, const wxSize& size); - -// helper of wxToggleButton::DoGetBestSize() -inline wxSize ComputeBestSize(wxControl *btn, int flags = 0) -{ - return IncreaseToStdSizeAndCache(btn, ComputeBestFittingSize(btn, flags)); -} - -} // namespace wxMSWButton - -#endif // _WX_MSW_PRIVATE_BUTTON_H_ - diff --git a/Source/3rd Party/wx/include/wx/msw/private/comptr.h b/Source/3rd Party/wx/include/wx/msw/private/comptr.h deleted file mode 100644 index fa611f5b4..000000000 --- a/Source/3rd Party/wx/include/wx/msw/private/comptr.h +++ /dev/null @@ -1,130 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/private/comptr.h -// Purpose: Smart pointer for COM interfaces. -// Author: PB -// Created: 2012-04-16 -// RCS-ID: $Id$ -// Copyright: (c) 2012 wxWidgets team -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_PRIVATE_COMPTR_H_ -#define _WX_MSW_PRIVATE_COMPTR_H_ - -// ---------------------------------------------------------------------------- -// wxCOMPtr: A minimalistic smart pointer for use with COM interfaces. -// ---------------------------------------------------------------------------- - -template -class wxCOMPtr -{ -public: - typedef T element_type; - - wxCOMPtr() - : m_ptr(NULL) - { - } - - wxEXPLICIT wxCOMPtr(T* ptr) - : m_ptr(ptr) - { - if ( m_ptr ) - m_ptr->AddRef(); - } - - wxCOMPtr(const wxCOMPtr& ptr) - : m_ptr(ptr.get()) - { - if ( m_ptr ) - m_ptr->AddRef(); - } - - ~wxCOMPtr() - { - if ( m_ptr ) - m_ptr->Release(); - } - - void reset(T* ptr = NULL) - { - if ( m_ptr != ptr) - { - if ( ptr ) - ptr->AddRef(); - if ( m_ptr ) - m_ptr->Release(); - m_ptr = ptr; - } - } - - wxCOMPtr& operator=(const wxCOMPtr& ptr) - { - reset(ptr.get()); - return *this; - } - - wxCOMPtr& operator=(T* ptr) - { - reset(ptr); - return *this; - } - - operator T*() const - { - return m_ptr; - } - - T& operator*() const - { - return *m_ptr; - } - - T* operator->() const - { - return m_ptr; - } - - // It would be better to forbid direct access completely but we do need - // for QueryInterface() and similar functions, so provide it but it can - // only be used to initialize the pointer, not to modify an existing one. - T** operator&() - { - wxASSERT_MSG(!m_ptr, - wxS("Can't get direct access to initialized pointer")); - - return &m_ptr; - } - - T* get() const - { - return m_ptr; - } - - bool operator<(T* ptr) const - { - return get() < ptr; - } - -private: - T* m_ptr; -}; - -// Define a helper for the macro below: we just need a function taking a -// pointer and not returning anything to avoid warnings about unused return -// value of the cast in the macro itself. -namespace wxPrivate { inline void PPV_ARGS_CHECK(void*) { } } - -// Takes the interface name and a pointer to a pointer of the interface type -// and expands into the IID of this interface and the same pointer but after a -// type-safety check. -// -// This is similar to the standard IID_PPV_ARGS macro but takes the pointer -// type instead of relying on the non-standard Microsoft __uuidof(). -#define wxIID_PPV_ARGS(IType, pType) \ - IID_##IType, \ - (wxPrivate::PPV_ARGS_CHECK(static_cast(*pType)), \ - reinterpret_cast(pType)) - -#endif // _WX_MSW_PRIVATE_COMPTR_H_ - diff --git a/Source/3rd Party/wx/include/wx/msw/private/dc.h b/Source/3rd Party/wx/include/wx/msw/private/dc.h deleted file mode 100644 index 18a7d539f..000000000 --- a/Source/3rd Party/wx/include/wx/msw/private/dc.h +++ /dev/null @@ -1,148 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/private/dc.h -// Purpose: private wxMSW helpers for working with HDCs -// Author: Vadim Zeitlin -// Created: 2009-06-16 (extracted from src/msw/dc.cpp) -// RCS-ID: $Id$ -// Copyright: (c) 2009 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _MSW_PRIVATE_DC_H_ -#define _MSW_PRIVATE_DC_H_ - -#include "wx/msw/dc.h" -#include "wx/msw/wrapwin.h" - -namespace wxMSWImpl -{ - -// various classes to change some DC property temporarily - -// text background and foreground colours -class wxTextColoursChanger -{ -public: - wxTextColoursChanger(HDC hdc, const wxMSWDCImpl& dc) - : m_hdc(hdc) - { - Change(dc.GetTextForeground(), dc.GetTextBackground()); - } - - wxTextColoursChanger(HDC hdc, const wxColour& colFg, const wxColour& colBg) - : m_hdc(hdc) - { - Change(colFg, colBg); - } - - wxTextColoursChanger(HDC hdc, COLORREF colFg, COLORREF colBg) - : m_hdc(hdc) - { - Change(colFg, colBg); - } - - ~wxTextColoursChanger() - { - if ( m_oldColFg != CLR_INVALID ) - ::SetTextColor(m_hdc, m_oldColFg); - if ( m_oldColBg != CLR_INVALID ) - ::SetBkColor(m_hdc, m_oldColBg); - } - -protected: - // this ctor doesn't change mode immediately, call Change() later to do it - // only if needed - wxTextColoursChanger(HDC hdc) - : m_hdc(hdc) - { - m_oldColFg = - m_oldColBg = CLR_INVALID; - } - - void Change(const wxColour& colFg, const wxColour& colBg) - { - Change(colFg.IsOk() ? colFg.GetPixel() : CLR_INVALID, - colBg.IsOk() ? colBg.GetPixel() : CLR_INVALID); - } - - void Change(COLORREF colFg, COLORREF colBg) - { - if ( colFg != CLR_INVALID ) - { - m_oldColFg = ::SetTextColor(m_hdc, colFg); - if ( m_oldColFg == CLR_INVALID ) - { - wxLogLastError(wxT("SetTextColor")); - } - } - else - { - m_oldColFg = CLR_INVALID; - } - - if ( colBg != CLR_INVALID ) - { - m_oldColBg = ::SetBkColor(m_hdc, colBg); - if ( m_oldColBg == CLR_INVALID ) - { - wxLogLastError(wxT("SetBkColor")); - } - } - else - { - m_oldColBg = CLR_INVALID; - } - } - -private: - const HDC m_hdc; - COLORREF m_oldColFg, - m_oldColBg; - - wxDECLARE_NO_COPY_CLASS(wxTextColoursChanger); -}; - -// background mode -class wxBkModeChanger -{ -public: - // set background mode to opaque if mode != wxBRUSHSTYLE_TRANSPARENT - wxBkModeChanger(HDC hdc, int mode) - : m_hdc(hdc) - { - Change(mode); - } - - ~wxBkModeChanger() - { - if ( m_oldMode ) - ::SetBkMode(m_hdc, m_oldMode); - } - -protected: - // this ctor doesn't change mode immediately, call Change() later to do it - // only if needed - wxBkModeChanger(HDC hdc) : m_hdc(hdc) { m_oldMode = 0; } - - void Change(int mode) - { - m_oldMode = ::SetBkMode(m_hdc, mode == wxBRUSHSTYLE_TRANSPARENT - ? TRANSPARENT - : OPAQUE); - if ( !m_oldMode ) - { - wxLogLastError(wxT("SetBkMode")); - } - } - -private: - const HDC m_hdc; - int m_oldMode; - - wxDECLARE_NO_COPY_CLASS(wxBkModeChanger); -}; - -} // namespace wxMSWImpl - -#endif // _MSW_PRIVATE_DC_H_ - diff --git a/Source/3rd Party/wx/include/wx/msw/private/fswatcher.h b/Source/3rd Party/wx/include/wx/msw/private/fswatcher.h deleted file mode 100644 index f431cf45a..000000000 --- a/Source/3rd Party/wx/include/wx/msw/private/fswatcher.h +++ /dev/null @@ -1,302 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/private/fswatcher.h -// Purpose: File system watcher impl classes -// Author: Bartosz Bekier -// Created: 2009-05-26 -// RCS-ID: $Id$ -// Copyright: (c) 2009 Bartosz Bekier -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef WX_MSW_PRIVATE_FSWATCHER_H_ -#define WX_MSW_PRIVATE_FSWATCHER_H_ - -#include "wx/filename.h" -#include "wx/vector.h" -#include "wx/msw/private.h" - -// ============================================================================ -// wxFSWatcherEntry implementation & helper declarations -// ============================================================================ - -class wxFSWatcherImplMSW; - -class wxFSWatchEntryMSW : public wxFSWatchInfo -{ -public: - enum - { - BUFFER_SIZE = 4096 // TODO parametrize - }; - - wxFSWatchEntryMSW(const wxFSWatchInfo& winfo) : - wxFSWatchInfo(winfo) - { - // get handle for this path - m_handle = OpenDir(m_path); - m_overlapped = (OVERLAPPED*)calloc(1, sizeof(OVERLAPPED)); - wxZeroMemory(m_buffer); - } - - virtual ~wxFSWatchEntryMSW() - { - wxLogTrace(wxTRACE_FSWATCHER, "Deleting entry '%s'", m_path); - - if (m_handle != INVALID_HANDLE_VALUE) - { - if (!CloseHandle(m_handle)) - { - wxLogSysError(_("Unable to close the handle for '%s'"), - m_path); - } - } - free(m_overlapped); - } - - bool IsOk() const - { - return m_handle != INVALID_HANDLE_VALUE; - } - - HANDLE GetHandle() const - { - return m_handle; - } - - void* GetBuffer() - { - return m_buffer; - } - - OVERLAPPED* GetOverlapped() const - { - return m_overlapped; - } - -private: - // opens dir with all flags, attributes etc. necessary to be later - // asynchronous watched with ReadDirectoryChangesW - static HANDLE OpenDir(const wxString& path) - { - HANDLE handle = CreateFile(path.t_str(), - FILE_LIST_DIRECTORY, - FILE_SHARE_READ | - FILE_SHARE_WRITE | - FILE_SHARE_DELETE, - NULL, - OPEN_EXISTING, - FILE_FLAG_BACKUP_SEMANTICS | - FILE_FLAG_OVERLAPPED, - NULL); - if (handle == INVALID_HANDLE_VALUE) - { - wxLogSysError(_("Failed to open directory \"%s\" for monitoring."), - path); - } - - return handle; - } - - HANDLE m_handle; // handle to opened directory - char m_buffer[BUFFER_SIZE]; // buffer for fs events - OVERLAPPED* m_overlapped; - - wxDECLARE_NO_COPY_CLASS(wxFSWatchEntryMSW); -}; - -// ============================================================================ -// wxFSWatcherImplMSW helper classes implementations -// ============================================================================ - -class wxIOCPService -{ -public: - wxIOCPService() : - m_iocp(INVALID_HANDLE_VALUE) - { - Init(); - } - - ~wxIOCPService() - { - if (m_iocp != INVALID_HANDLE_VALUE) - { - if (!CloseHandle(m_iocp)) - { - wxLogSysError(_("Unable to close I/O completion port handle")); - } - } - m_watches.clear(); - } - - // associates a wxFSWatchEntryMSW with completion port - bool Add(wxSharedPtr watch) - { - wxCHECK_MSG( m_iocp != INVALID_HANDLE_VALUE, false, "IOCP not init" ); - wxCHECK_MSG( watch->IsOk(), false, "Invalid watch" ); - - // associate with IOCP - HANDLE ret = CreateIoCompletionPort(watch->GetHandle(), m_iocp, - (ULONG_PTR)watch.get(), 0); - if (ret == NULL) - { - wxLogSysError(_("Unable to associate handle with " - "I/O completion port")); - return false; - } - else if (ret != m_iocp) - { - wxFAIL_MSG(_("Unexpectedly new I/O completion port was created")); - return false; - } - - // add to watch map - wxFSWatchEntries::value_type val(watch->GetPath(), watch); - return m_watches.insert(val).second; - } - - // Removes a watch we're currently using. Notice that this doesn't happen - // immediately, CompleteRemoval() must be called later when it's really - // safe to delete the watch, i.e. after completion of the IO operation - // using it. - bool ScheduleForRemoval(const wxSharedPtr& watch) - { - wxCHECK_MSG( m_iocp != INVALID_HANDLE_VALUE, false, "IOCP not init" ); - wxCHECK_MSG( watch->IsOk(), false, "Invalid watch" ); - - const wxString path = watch->GetPath(); - wxFSWatchEntries::iterator it = m_watches.find(path); - wxCHECK_MSG( it != m_watches.end(), false, - "Can't remove a watch we don't use" ); - - // We can't just delete the watch here as we can have pending events - // for it and if we destroyed it now, we could get a dangling (or, - // worse, reused to point to another object) pointer in ReadEvents() so - // just remember that this one should be removed when CompleteRemoval() - // is called later. - m_removedWatches.insert(wxFSWatchEntries::value_type(path, watch)); - m_watches.erase(it); - - return true; - } - - // Really remove the watch previously passed to ScheduleForRemoval(). - // - // It's ok to call this for a watch that hadn't been removed before, in - // this case we'll just return false and do nothing. - bool CompleteRemoval(wxFSWatchEntryMSW* watch) - { - wxFSWatchEntries::iterator it = m_removedWatches.find(watch->GetPath()); - if ( it == m_removedWatches.end() ) - return false; - - // Removing the object from the map will result in deleting the watch - // itself as it's not referenced from anywhere else now. - m_removedWatches.erase(it); - - return true; - } - - // post completion packet - bool PostEmptyStatus() - { - wxCHECK_MSG( m_iocp != INVALID_HANDLE_VALUE, false, "IOCP not init" ); - - int ret = PostQueuedCompletionStatus(m_iocp, 0, 0, NULL); - if (!ret) - { - wxLogSysError(_("Unable to post completion status")); - } - - return ret != 0; - } - - // Wait for completion status to arrive. - // This function can block forever in it's wait for completion status. - // Use PostEmptyStatus() to wake it up (and end the worker thread) - bool GetStatus(unsigned long* count, wxFSWatchEntryMSW** watch, - OVERLAPPED** overlapped) - { - wxCHECK_MSG( m_iocp != INVALID_HANDLE_VALUE, false, "IOCP not init" ); - wxCHECK_MSG( count != NULL, false, "Null out parameter 'count'"); - wxCHECK_MSG( watch != NULL, false, "Null out parameter 'watch'"); - wxCHECK_MSG( overlapped != NULL, false, - "Null out parameter 'overlapped'"); - - int ret = GetQueuedCompletionStatus(m_iocp, count, (ULONG_PTR *)watch, - overlapped, INFINITE); - if (!ret) - { - wxLogSysError(_("Unable to dequeue completion packet")); - } - return ret != 0; - } - -protected: - bool Init() - { - m_iocp = CreateIoCompletionPort(INVALID_HANDLE_VALUE, NULL, 0, 0); - if (m_iocp == NULL) - { - wxLogSysError(_("Unable to create I/O completion port")); - } - return m_iocp != NULL; - } - - HANDLE m_iocp; - - // The hash containing all the wxFSWatchEntryMSW objects currently being - // watched keyed by their paths. - wxFSWatchEntries m_watches; - - // Contains the watches which had been removed but are still pending. - wxFSWatchEntries m_removedWatches; -}; - - -class wxIOCPThread : public wxThread -{ -public: - wxIOCPThread(wxFSWatcherImplMSW* service, wxIOCPService* iocp); - - // finishes this thread - bool Finish(); - -protected: - // structure to hold information needed to process one native event - // this is just a dummy holder, so it doesn't take ownership of it's data - struct wxEventProcessingData - { - wxEventProcessingData(const FILE_NOTIFY_INFORMATION* ne, - const wxFSWatchEntryMSW* watch) : - nativeEvent(ne), watch(watch) - {} - - const FILE_NOTIFY_INFORMATION* nativeEvent; - const wxFSWatchEntryMSW* watch; - }; - - virtual ExitCode Entry(); - - // wait for events to occur, read them and send to interested parties - // returns false it empty status was read, which means we whould exit - // true otherwise - bool ReadEvents(); - - void ProcessNativeEvents(wxVector& events); - - void SendEvent(wxFileSystemWatcherEvent& evt); - - static int Native2WatcherFlags(int flags); - - static wxString FileNotifyInformationToString( - const FILE_NOTIFY_INFORMATION& e); - - static wxFileName GetEventPath(const wxFSWatchEntryMSW& watch, - const FILE_NOTIFY_INFORMATION& e); - - wxFSWatcherImplMSW* m_service; - wxIOCPService* m_iocp; -}; - -#endif /* WX_MSW_PRIVATE_FSWATCHER_H_ */ diff --git a/Source/3rd Party/wx/include/wx/msw/private/hiddenwin.h b/Source/3rd Party/wx/include/wx/msw/private/hiddenwin.h deleted file mode 100644 index 080104d75..000000000 --- a/Source/3rd Party/wx/include/wx/msw/private/hiddenwin.h +++ /dev/null @@ -1,31 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/private/hiddenwin.h -// Purpose: Helper for creating a hidden window used by wxMSW internally. -// Author: Vadim Zeitlin -// Created: 2011-09-16 -// RCS-ID: $Id: wxhead.h,v 1.12 2010-04-22 12:44:51 zeitlin Exp $ -// Copyright: (c) 2011 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_PRIVATE_HIDDENWIN_H_ -#define _WX_MSW_PRIVATE_HIDDENWIN_H_ - -#include "wx/msw/private.h" - -/* - Creates a hidden window with supplied window proc registering the class for - it if necessary (i.e. the first time only). Caller is responsible for - destroying the window and unregistering the class (note that this must be - done because wxWidgets may be used as a DLL and so may be loaded/unloaded - multiple times into/from the same process so we can't rely on automatic - Windows class unregistration). - - pclassname is a pointer to a caller stored classname, which must initially be - NULL. classname is the desired wndclass classname. If function successfully - registers the class, pclassname will be set to classname. - */ -extern "C" WXDLLIMPEXP_BASE HWND -wxCreateHiddenWindow(LPCTSTR *pclassname, LPCTSTR classname, WNDPROC wndproc); - -#endif // _WX_MSW_PRIVATE_HIDDENWIN_H_ diff --git a/Source/3rd Party/wx/include/wx/msw/private/keyboard.h b/Source/3rd Party/wx/include/wx/msw/private/keyboard.h deleted file mode 100644 index edd46e3af..000000000 --- a/Source/3rd Party/wx/include/wx/msw/private/keyboard.h +++ /dev/null @@ -1,42 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/private/keyboard.h -// Purpose: Helper keyboard-related functions. -// Author: Vadim Zeitlin -// Created: 2010-09-09 -// RCS-ID: $Id: wxhead.h,v 1.12 2010-04-22 12:44:51 zeitlin Exp $ -// Copyright: (c) 2010 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_PRIVATE_KEYBOARD_H_ -#define _WX_MSW_PRIVATE_KEYBOARD_H_ - -#include "wx/defs.h" - -namespace wxMSWKeyboard -{ - -// ---------------------------------------------------------------------------- -// Functions for translating between MSW virtual keys codes and wx key codes -// -// These functions are currently implemented in src/msw/window.cpp. -// ---------------------------------------------------------------------------- - -// Translate MSW virtual key code to wx key code. lParam is used to distinguish -// between numpad and extended version of the keys, extended is assumed by -// default if lParam == 0. -// -// Returns WXK_NONE if translation couldn't be done at all (this happens e.g. -// for dead keys and in this case uc will be WXK_NONE too) or if the key -// corresponds to a non-Latin-1 character in which case uc is filled with its -// Unicode value. -WXDLLIMPEXP_CORE int VKToWX(WXWORD vk, WXLPARAM lParam = 0, wchar_t *uc = NULL); - -// Translate wxKeyCode enum element (passed as int for compatibility reasons) -// to MSW virtual key code. isExtended is set to true if the key corresponds to -// a non-numpad version of a key that exists both on numpad and outside it. -WXDLLIMPEXP_CORE WXWORD WXToVK(int id, bool *isExtended = NULL); - -} // namespace wxMSWKeyboard - -#endif // _WX_MSW_PRIVATE_KEYBOARD_H_ diff --git a/Source/3rd Party/wx/include/wx/msw/private/metrics.h b/Source/3rd Party/wx/include/wx/msw/private/metrics.h deleted file mode 100644 index ed25d46c3..000000000 --- a/Source/3rd Party/wx/include/wx/msw/private/metrics.h +++ /dev/null @@ -1,49 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/private/metrics.h -// Purpose: various helper functions to retrieve system metrics -// Author: Vadim Zeitlin -// Created: 2008-09-05 -// RCS-ID: $Id$ -// Copyright: (c) 2008 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_PRIVATE_METRICS_H_ -#define _WX_MSW_PRIVATE_METRICS_H_ - -namespace wxMSWImpl -{ - -// return NONCLIENTMETRICS as retrieved by SystemParametersInfo() -// -// currently this is not cached as the values may change when system settings -// do and we don't react to this to invalidate the cache but it could be done -// in the future -// -// MT-safety: this function is only meant to be called from the main thread -inline const NONCLIENTMETRICS& GetNonClientMetrics() -{ - static WinStruct nm; - if ( !::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &nm, 0) ) - { -#if WINVER >= 0x0600 - // a new field has been added to NONCLIENTMETRICS under Vista, so - // the call to SystemParametersInfo() fails if we use the struct - // size incorporating this new value on an older system -- retry - // without it - nm.cbSize -= sizeof(int); - if ( !::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &nm, 0) ) -#endif // WINVER >= 0x0600 - { - // maybe we should initialize the struct with some defaults? - wxLogLastError(wxT("SystemParametersInfo(SPI_GETNONCLIENTMETRICS)")); - } - } - - return nm; -} - -} // namespace wxMSWImpl - -#endif // _WX_MSW_PRIVATE_METRICS_H_ - diff --git a/Source/3rd Party/wx/include/wx/msw/private/msgdlg.h b/Source/3rd Party/wx/include/wx/msw/private/msgdlg.h deleted file mode 100644 index c463fe3d8..000000000 --- a/Source/3rd Party/wx/include/wx/msw/private/msgdlg.h +++ /dev/null @@ -1,94 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/private/msgdlg.h -// Purpose: helper functions used with native message dialog -// Author: Rickard Westerlund -// Created: 2010-07-12 -// RCS-ID: $Id$ -// Copyright: (c) 2010 wxWidgets team -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_PRIVATE_MSGDLG_H_ -#define _WX_MSW_PRIVATE_MSGDLG_H_ - -#include "wx/msw/wrapcctl.h" -#include "wx/scopedarray.h" - -// Macro to help identify if task dialogs are available: we rely on -// TD_WARNING_ICON being defined in the headers for this as this symbol is used -// by the task dialogs only. Also notice that task dialogs are available for -// Unicode applications only. -#if defined(TD_WARNING_ICON) && wxUSE_UNICODE - #define wxHAS_MSW_TASKDIALOG -#endif - -// Provides methods for creating a task dialog. -namespace wxMSWMessageDialog -{ - -#ifdef wxHAS_MSW_TASKDIALOG - class wxMSWTaskDialogConfig - { - public: - enum { MAX_BUTTONS = 4 }; - - wxMSWTaskDialogConfig() - : buttons(new TASKDIALOG_BUTTON[MAX_BUTTONS]), - parent(NULL), - iconId(0), - style(0), - useCustomLabels(false) - { } - - // initializes the object from a message dialog. - wxMSWTaskDialogConfig(const wxMessageDialogBase& dlg); - - wxScopedArray buttons; - wxWindow *parent; - wxString caption; - wxString message; - wxString extendedMessage; - long iconId; - long style; - bool useCustomLabels; - wxString btnYesLabel; - wxString btnNoLabel; - wxString btnOKLabel; - wxString btnCancelLabel; - wxString btnHelpLabel; - - // Will create a task dialog with it's paremeters for it's creation - // stored in the provided TASKDIALOGCONFIG parameter. - // NOTE: The wxMSWTaskDialogConfig object needs to remain accessible - // during the subsequent call to TaskDialogIndirect(). - void MSWCommonTaskDialogInit(TASKDIALOGCONFIG &tdc); - - // Used by MSWCommonTaskDialogInit() to add a regular button or a - // button with a custom label if used. - void AddTaskDialogButton(TASKDIALOGCONFIG &tdc, - int btnCustomId, - int btnCommonId, - const wxString& customLabel); - }; // class wxMSWTaskDialogConfig - - - typedef HRESULT (WINAPI *TaskDialogIndirect_t)(const TASKDIALOGCONFIG *, - int *, int *, BOOL *); - - // Return the pointer to TaskDialogIndirect(). This should only be called - // if HasNativeTaskDialog() returned true and is normally guaranteed to - // succeed in this case. - TaskDialogIndirect_t GetTaskDialogIndirectFunc(); -#endif // wxHAS_MSW_TASKDIALOG - - - // Check if the task dialog is available: this simply checks the OS version - // as we know that it's only present in Vista and later. - bool HasNativeTaskDialog(); - - // Translates standard MSW button IDs like IDCANCEL into an equivalent - // wx constant such as wxCANCEL. - int MSWTranslateReturnCode(int msAns); -}; // namespace wxMSWMessageDialog - -#endif // _WX_MSW_PRIVATE_MSGDLG_H_ diff --git a/Source/3rd Party/wx/include/wx/msw/private/timer.h b/Source/3rd Party/wx/include/wx/msw/private/timer.h deleted file mode 100644 index c9d68e3c9..000000000 --- a/Source/3rd Party/wx/include/wx/msw/private/timer.h +++ /dev/null @@ -1,37 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/private/timer.h -// Purpose: wxTimer class -// Author: Julian Smart -// Created: 01/02/97 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_PRIVATE_TIMER_H_ -#define _WX_MSW_PRIVATE_TIMER_H_ - -#if wxUSE_TIMER - -#include "wx/private/timer.h" -#include "wx/msw/wrapwin.h" // for WPARAM - -class WXDLLIMPEXP_BASE wxMSWTimerImpl : public wxTimerImpl -{ -public: - wxMSWTimerImpl(wxTimer *timer) : wxTimerImpl(timer) { m_id = 0; } - - virtual bool Start(int milliseconds = -1, bool oneShot = false); - virtual void Stop(); - - virtual bool IsRunning() const { return m_id != 0; } - -protected: - // this must be 64 bit under Win64 as WPARAM (storing timer ids) is 64 bit - // there and so the ids may possibly not fit in 32 bits - WPARAM m_id; -}; - -#endif // wxUSE_TIMER - -#endif // _WX_TIMERH_ diff --git a/Source/3rd Party/wx/include/wx/msw/progdlg.h b/Source/3rd Party/wx/include/wx/msw/progdlg.h deleted file mode 100644 index 5d6a4fd71..000000000 --- a/Source/3rd Party/wx/include/wx/msw/progdlg.h +++ /dev/null @@ -1,74 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/progdlg.h -// Purpose: wxProgressDialog -// Author: Rickard Westerlund -// Created: 2010-07-22 -// RCS-ID: $Id$ -// Copyright: (c) 2010 wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_PROGDLG_H_ -#define _WX_PROGDLG_H_ - -class wxProgressDialogTaskRunner; -class wxProgressDialogSharedData; - -class WXDLLIMPEXP_CORE wxProgressDialog : public wxGenericProgressDialog -{ -public: - wxProgressDialog(const wxString& title, const wxString& message, - int maximum = 100, - wxWindow *parent = NULL, - int style = wxPD_APP_MODAL | wxPD_AUTO_HIDE); - - virtual ~wxProgressDialog(); - - virtual bool Update(int value, const wxString& newmsg = wxEmptyString, bool *skip = NULL); - virtual bool Pulse(const wxString& newmsg = wxEmptyString, bool *skip = NULL); - - void Resume(); - - int GetValue() const; - wxString GetMessage() const; - - void SetRange(int maximum); - - // Return whether "Cancel" or "Skip" button was pressed, always return - // false if the corresponding button is not shown. - bool WasSkipped() const; - bool WasCancelled() const; - - virtual void SetTitle(const wxString& title); - virtual wxString GetTitle() const; - - virtual bool Show( bool show = true ); - - // Must provide overload to avoid hiding it (and warnings about it) - virtual void Update() { wxGenericProgressDialog::Update(); } - - virtual WXWidget GetHandle() const; - -private: - // Performs common routines to Update() and Pulse(). Requires the - // shared object to have been entered. - bool DoNativeBeforeUpdate(bool *skip); - - // Updates the various timing informations for both determinate - // and indeterminate modes. Requires the shared object to have - // been entered. - void UpdateExpandedInformation(int value); - - wxProgressDialogTaskRunner *m_taskDialogRunner; - - wxProgressDialogSharedData *m_sharedData; - - // Store the message and title we currently use to be able to return it - // from Get{Message,Title}() - wxString m_message, - m_title; - - wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxProgressDialog); -}; - -#endif // _WX_PROGDLG_H_ diff --git a/Source/3rd Party/wx/include/wx/msw/radiobox.h b/Source/3rd Party/wx/include/wx/msw/radiobox.h index 7b4f57b18..8012dd8b9 100644 --- a/Source/3rd Party/wx/include/wx/msw/radiobox.h +++ b/Source/3rd Party/wx/include/wx/msw/radiobox.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: radiobox.h 53135 2008-04-12 02:31:04Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -20,7 +20,7 @@ class WXDLLIMPEXP_FWD_CORE wxSubwindows; // wxRadioBox // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxRadioBox : public wxStaticBox, public wxRadioBoxBase +class WXDLLEXPORT wxRadioBox : public wxStaticBox, public wxRadioBoxBase { public: wxRadioBox() { Init(); } @@ -32,7 +32,7 @@ public: const wxSize& size = wxDefaultSize, int n = 0, const wxString choices[] = NULL, int majorDim = 0, - long style = wxRA_SPECIFY_COLS, + long style = wxRA_HORIZONTAL, const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr) { @@ -49,7 +49,7 @@ public: const wxSize& size, const wxArrayString& choices, int majorDim = 0, - long style = wxRA_SPECIFY_COLS, + long style = wxRA_HORIZONTAL, const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr) { @@ -68,7 +68,7 @@ public: const wxSize& size = wxDefaultSize, int n = 0, const wxString choices[] = NULL, int majorDim = 0, - long style = wxRA_SPECIFY_COLS, + long style = wxRA_HORIZONTAL, const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr); bool Create(wxWindow *parent, @@ -78,7 +78,7 @@ public: const wxSize& size, const wxArrayString& choices, int majorDim = 0, - long style = wxRA_SPECIFY_COLS, + long style = wxRA_HORIZONTAL, const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr); @@ -117,20 +117,12 @@ public: // it to behave normally virtual bool AcceptsFocus() const { return wxControl::AcceptsFocus(); } - // returns true if the platform should explicitly apply a theme border - virtual bool CanApplyThemeBorder() const { return false; } - void SetLabelFont(const wxFont& WXUNUSED(font)) {} void SetButtonFont(const wxFont& font) { SetFont(font); } - // implementation only from now on // ------------------------------- - // This function can be used to check if the given radio button HWND - // belongs to one of our radio boxes. If it doesn't, NULL is returned. - static wxRadioBox *GetFromRadioButtonHWND(WXHWND hwnd); - virtual bool MSWCommand(WXUINT param, WXWORD id); void Command(wxCommandEvent& event); @@ -149,13 +141,9 @@ protected: // get the total size occupied by the radio box buttons wxSize GetTotalButtonSize(const wxSize& sizeBtn) const; - // Adjust all the buttons to the new window size. - void PositionAllButtons(int x, int y, int width, int height); - virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); - virtual void DoMoveWindow(int x, int y, int width, int height); virtual wxSize DoGetBestSize() const; #if wxUSE_TOOLTIPS @@ -166,16 +154,10 @@ protected: virtual WXHRGN MSWGetRegionWithoutChildren(); #endif // __WXWINCE__ - // resolve ambiguity in base classes - virtual wxBorder GetDefaultBorder() const { return wxRadioBoxBase::GetDefaultBorder(); } // the buttons we contain wxSubwindows *m_radioButtons; - // and the special dummy button used only as a tab group boundary - WXHWND m_dummyHwnd; - wxWindowIDRef m_dummyId; - // array of widths and heights of the buttons, may be wxDefaultCoord if the // corresponding quantity should be computed int *m_radioWidth; @@ -186,7 +168,7 @@ protected: private: DECLARE_DYNAMIC_CLASS(wxRadioBox) - wxDECLARE_NO_COPY_CLASS(wxRadioBox); + DECLARE_NO_COPY_CLASS(wxRadioBox) }; #endif diff --git a/Source/3rd Party/wx/include/wx/msw/radiobut.h b/Source/3rd Party/wx/include/wx/msw/radiobut.h index 8e768d899..6e48bf3f3 100644 --- a/Source/3rd Party/wx/include/wx/msw/radiobut.h +++ b/Source/3rd Party/wx/include/wx/msw/radiobut.h @@ -1,10 +1,10 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/radiobut.h +// Name: radiobut.h // Purpose: wxRadioButton class // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: radiobut.h 41144 2006-09-10 23:08:13Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -12,7 +12,7 @@ #ifndef _WX_RADIOBUT_H_ #define _WX_RADIOBUT_H_ -class WXDLLIMPEXP_CORE wxRadioButton: public wxControl +class WXDLLEXPORT wxRadioButton: public wxControl { public: // ctors and creation functions @@ -53,7 +53,6 @@ public: virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; protected: - virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } virtual wxSize DoGetBestSize() const; private: diff --git a/Source/3rd Party/wx/include/wx/msw/regconf.h b/Source/3rd Party/wx/include/wx/msw/regconf.h index 4b7dd492f..a256e98c8 100644 --- a/Source/3rd Party/wx/include/wx/msw/regconf.h +++ b/Source/3rd Party/wx/include/wx/msw/regconf.h @@ -1,25 +1,27 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/regconf.h +// Name: msw/regconf.h // Purpose: Registry based implementation of wxConfigBase // Author: Vadim Zeitlin // Modified by: // Created: 27.04.98 -// RCS-ID: $Id$ +// RCS-ID: $Id: regconf.h 62185 2009-09-28 10:02:42Z JS $ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// -#ifndef _WX_MSW_REGCONF_H_ -#define _WX_MSW_REGCONF_H_ +#ifndef _REGCONF_H +#define _REGCONF_H #include "wx/defs.h" -#if wxUSE_CONFIG && wxUSE_REGKEY +#if wxUSE_CONFIG + +#ifndef _REGISTRY_H + #include "wx/msw/registry.h" +#endif -#include "wx/msw/registry.h" #include "wx/object.h" #include "wx/confbase.h" -#include "wx/buffer.h" // ---------------------------------------------------------------------------- // wxRegConfig @@ -92,24 +94,23 @@ protected: // implement read/write methods virtual bool DoReadString(const wxString& key, wxString *pStr) const; virtual bool DoReadLong(const wxString& key, long *plResult) const; - virtual bool DoReadBinary(const wxString& key, wxMemoryBuffer* buf) const; virtual bool DoWriteString(const wxString& key, const wxString& szValue); virtual bool DoWriteLong(const wxString& key, long lValue); - virtual bool DoWriteBinary(const wxString& key, const wxMemoryBuffer& buf); private: + // no copy ctor/assignment operator + wxRegConfig(const wxRegConfig&); + wxRegConfig& operator=(const wxRegConfig&); + // these keys are opened during all lifetime of wxRegConfig object wxRegKey m_keyLocalRoot, m_keyLocal, m_keyGlobalRoot, m_keyGlobal; // current path (not '/' terminated) wxString m_strPath; - - wxDECLARE_NO_COPY_CLASS(wxRegConfig); - DECLARE_ABSTRACT_CLASS(wxRegConfig) }; -#endif // wxUSE_CONFIG && wxUSE_REGKEY +#endif // wxUSE_CONFIG -#endif // _WX_MSW_REGCONF_H_ +#endif // _REGCONF_H diff --git a/Source/3rd Party/wx/include/wx/msw/region.h b/Source/3rd Party/wx/include/wx/msw/region.h index 81a3fee13..881214c7e 100644 --- a/Source/3rd Party/wx/include/wx/msw/region.h +++ b/Source/3rd Party/wx/include/wx/msw/region.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: region.h 59602 2009-03-18 10:07:58Z VZ $ // Copyright: (c) 1997-2002 wxWidgets team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -12,7 +12,7 @@ #ifndef _WX_MSW_REGION_H_ #define _WX_MSW_REGION_H_ -class WXDLLIMPEXP_CORE wxRegion : public wxRegionWithCombine +class WXDLLEXPORT wxRegion : public wxRegionWithCombine { public: wxRegion(); @@ -20,7 +20,7 @@ public: wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight); wxRegion(const wxRect& rect); wxRegion(WXHRGN hRegion); // Hangs on to this region - wxRegion(size_t n, const wxPoint *points, wxPolygonFillMode fillStyle = wxODDEVEN_RULE ); + wxRegion(size_t n, const wxPoint *points, int fillStyle = wxODDEVEN_RULE ); #if wxUSE_IMAGE wxRegion( const wxBitmap& bmp) { @@ -43,8 +43,8 @@ public: WXHRGN GetHRGN() const; protected: - virtual wxGDIRefData *CreateGDIRefData() const; - virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; + virtual wxObjectRefData *CreateRefData() const; + virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const; virtual bool DoIsEqual(const wxRegion& region) const; virtual bool DoGetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const; @@ -59,7 +59,7 @@ protected: DECLARE_DYNAMIC_CLASS(wxRegion) }; -class WXDLLIMPEXP_CORE wxRegionIterator : public wxObject +class WXDLLEXPORT wxRegionIterator : public wxObject { public: wxRegionIterator() { Init(); } diff --git a/Source/3rd Party/wx/include/wx/msw/registry.h b/Source/3rd Party/wx/include/wx/msw/registry.h index 9d157b081..04758d280 100644 --- a/Source/3rd Party/wx/include/wx/msw/registry.h +++ b/Source/3rd Party/wx/include/wx/msw/registry.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 03.04.1998 -// RCS-ID: $Id$ +// RCS-ID: $Id: registry.h 49563 2007-10-31 20:46:21Z VZ $ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -12,10 +12,6 @@ #ifndef _WX_MSW_REGISTRY_H_ #define _WX_MSW_REGISTRY_H_ -#include "wx/defs.h" - -#if wxUSE_REGKEY - class WXDLLIMPEXP_FWD_BASE wxOutputStream; // ---------------------------------------------------------------------------- @@ -66,22 +62,6 @@ public: Write // read and write }; - // Different registry views supported under WOW64. - enum WOW64ViewMode - { - // 32 bit registry for 32 bit applications, 64 bit registry - // for 64 bit ones. - WOW64ViewMode_Default, - - // Can be used in 64 bit apps to access 32 bit registry, - // has no effect (i.e. treated as default) in 32 bit apps. - WOW64ViewMode_32, - - // Can be used in 32 bit apps to access 64 bit registry, - // has no effect (i.e. treated as default) in 64 bit apps. - WOW64ViewMode_64 - }; - // information about standard (predefined) registry keys // number of standard keys static const size_t nStdKeys; @@ -92,23 +72,17 @@ public: // get StdKey from root HKEY static StdKey GetStdKeyFromHkey(WXHKEY hkey); - // extracts the std key prefix from the string (return value) and + // extacts the std key prefix from the string (return value) and // leaves only the part after it (i.e. modifies the string passed!) static StdKey ExtractKeyName(wxString& str); // ctors // root key is set to HKCR (the only root key under Win16) - wxRegKey(WOW64ViewMode viewMode = WOW64ViewMode_Default); - + wxRegKey(); // strKey is the full name of the key (i.e. starting with HKEY_xxx...) - wxRegKey(const wxString& strKey, - WOW64ViewMode viewMode = WOW64ViewMode_Default); - + wxRegKey(const wxString& strKey); // strKey is the name of key under (standard key) keyParent - wxRegKey(StdKey keyParent, - const wxString& strKey, - WOW64ViewMode viewMode = WOW64ViewMode_Default); - + wxRegKey(StdKey keyParent, const wxString& strKey); // strKey is the name of key under (previously created) keyParent wxRegKey(const wxRegKey& keyParent, const wxString& strKey); // dtor closes the key @@ -127,8 +101,6 @@ public: // get infomation about the key // get the (full) key name. Abbreviate std root keys if bShortPrefix. wxString GetName(bool bShortPrefix = true) const; - // Retrieves the registry view used by this key. - WOW64ViewMode GetView() const { return m_viewMode; } // return true if the key exists bool Exists() const; // get the info about key (any number of these pointers may be NULL) @@ -148,16 +120,15 @@ public: // create the key: will fail if the key already exists and !bOkIfExists bool Create(bool bOkIfExists = true); // rename a value from old name to new one - bool RenameValue(const wxString& szValueOld, const wxString& szValueNew); + bool RenameValue(const wxChar *szValueOld, const wxChar *szValueNew); // rename the key - bool Rename(const wxString& szNewName); + bool Rename(const wxChar *szNewName); // copy value to another key possibly changing its name (by default it will // remain the same) - bool CopyValue(const wxString& szValue, wxRegKey& keyDst, - const wxString& szNewName = wxEmptyString); - + bool CopyValue(const wxChar *szValue, wxRegKey& keyDst, + const wxChar *szNewName = NULL); // copy the entire contents of the key recursively to another location - bool Copy(const wxString& szNewName); + bool Copy(const wxChar *szNewName); // same as Copy() but using a key and not the name bool Copy(wxRegKey& keyDst); // close the key (will be automatically done in dtor) @@ -167,19 +138,21 @@ public: // deletes this key and all of it's subkeys/values bool DeleteSelf(); // deletes the subkey with all of it's subkeys/values recursively - bool DeleteKey(const wxString& szKey); - // deletes the named value (may be empty string to remove the default value) - bool DeleteValue(const wxString& szValue); + bool DeleteKey(const wxChar *szKey); + // deletes the named value (may be NULL to remove the default value) + bool DeleteValue(const wxChar *szValue); // access to values and subkeys // get value type - ValueType GetValueType(const wxString& szValue) const; + ValueType GetValueType(const wxChar *szValue) const; // returns true if the value contains a number (else it's some string) - bool IsNumericValue(const wxString& szValue) const; + bool IsNumericValue(const wxChar *szValue) const; // assignment operators set the default value of the key wxRegKey& operator=(const wxString& strValue) - { SetValue(wxEmptyString, strValue); return *this; } + { SetValue(NULL, strValue); return *this; } + wxRegKey& operator=(long lValue) + { SetValue(NULL, lValue); return *this; } // query the default value of the key: implicitly or explicitly wxString QueryDefaultValue() const; @@ -188,30 +161,30 @@ public: // named values // set the string value - bool SetValue(const wxString& szValue, const wxString& strValue); + bool SetValue(const wxChar *szValue, const wxString& strValue); // retrieve the string value - bool QueryValue(const wxString& szValue, wxString& strValue) const + bool QueryValue(const wxChar *szValue, wxString& strValue) const { return QueryValue(szValue, strValue, false); } // retrieve raw string value - bool QueryRawValue(const wxString& szValue, wxString& strValue) const + bool QueryRawValue(const wxChar *szValue, wxString& strValue) const { return QueryValue(szValue, strValue, true); } // retrieve either raw or expanded string value - bool QueryValue(const wxString& szValue, wxString& strValue, bool raw) const; + bool QueryValue(const wxChar *szValue, wxString& strValue, bool raw) const; // set the numeric value - bool SetValue(const wxString& szValue, long lValue); + bool SetValue(const wxChar *szValue, long lValue); // return the numeric value - bool QueryValue(const wxString& szValue, long *plValue) const; + bool QueryValue(const wxChar *szValue, long *plValue) const; // set the binary value - bool SetValue(const wxString& szValue, const wxMemoryBuffer& buf); + bool SetValue(const wxChar *szValue, const wxMemoryBuffer& buf); // return the binary value - bool QueryValue(const wxString& szValue, wxMemoryBuffer& buf) const; + bool QueryValue(const wxChar *szValue, wxMemoryBuffer& buf) const; // query existence of a key/value // return true if value exists - bool HasValue(const wxString& szKey) const; + bool HasValue(const wxChar *szKey) const; // return true if given subkey exists - bool HasSubKey(const wxString& szKey) const; + bool HasSubKey(const wxChar *szKey) const; // return true if any subkeys exist bool HasSubkeys() const; // return true if any values exist @@ -259,18 +232,16 @@ private: wxString FormatValue(const wxString& name) const; - WXHKEY m_hKey, // our handle - m_hRootKey; // handle of the top key (i.e. StdKey) - wxString m_strKey; // key name (relative to m_hRootKey) - WOW64ViewMode m_viewMode; // which view to select under WOW64 - AccessMode m_mode; // valid only if key is opened - long m_dwLastError; // last error (0 if none) + WXHKEY m_hKey, // our handle + m_hRootKey; // handle of the top key (i.e. StdKey) + wxString m_strKey; // key name (relative to m_hRootKey) + + AccessMode m_mode; // valid only if key is opened + long m_dwLastError; // last error (0 if none) - wxDECLARE_NO_COPY_CLASS(wxRegKey); + DECLARE_NO_COPY_CLASS(wxRegKey) }; -#endif // wxUSE_REGKEY - #endif // _WX_MSW_REGISTRY_H_ diff --git a/Source/3rd Party/wx/include/wx/msw/richmsgdlg.h b/Source/3rd Party/wx/include/wx/msw/richmsgdlg.h deleted file mode 100644 index 6ef416325..000000000 --- a/Source/3rd Party/wx/include/wx/msw/richmsgdlg.h +++ /dev/null @@ -1,31 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/richmsgdlg.h -// Purpose: wxRichMessageDialog -// Author: Rickard Westerlund -// Created: 2010-07-04 -// RCS-ID: $Id$ -// Copyright: (c) 2010 wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_RICHMSGDLG_H_ -#define _WX_MSW_RICHMSGDLG_H_ - -class WXDLLIMPEXP_CORE wxRichMessageDialog : public wxGenericRichMessageDialog -{ -public: - wxRichMessageDialog(wxWindow *parent, - const wxString& message, - const wxString& caption, - long style) - : wxGenericRichMessageDialog(parent, message, caption, style) - { } - - // overridden base class method showing the native task dialog if possible - virtual int ShowModal(); - -private: - wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxRichMessageDialog); -}; - -#endif // _WX_MSW_RICHMSGDLG_H_ diff --git a/Source/3rd Party/wx/include/wx/msw/scrolbar.h b/Source/3rd Party/wx/include/wx/msw/scrolbar.h index 68d269d46..bfe86c6a8 100644 --- a/Source/3rd Party/wx/include/wx/msw/scrolbar.h +++ b/Source/3rd Party/wx/include/wx/msw/scrolbar.h @@ -1,10 +1,10 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/scrolbar.h +// Name: scrollbar.h // Purpose: wxScrollBar class // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: scrolbar.h 41020 2006-09-05 20:47:48Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -13,7 +13,7 @@ #define _WX_SCROLBAR_H_ // Scrollbar item -class WXDLLIMPEXP_CORE wxScrollBar: public wxScrollBarBase +class WXDLLEXPORT wxScrollBar: public wxScrollBarBase { public: wxScrollBar() { m_pageSize = 0; m_viewSize = 0; m_objectSize = 0; } @@ -58,9 +58,6 @@ public: virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; - // returns true if the platform should explicitly apply a theme border - virtual bool CanApplyThemeBorder() const { return false; } - protected: virtual wxSize DoGetBestSize() const; diff --git a/Source/3rd Party/wx/include/wx/msw/seh.h b/Source/3rd Party/wx/include/wx/msw/seh.h index 1231c930d..23053fab0 100644 --- a/Source/3rd Party/wx/include/wx/msw/seh.h +++ b/Source/3rd Party/wx/include/wx/msw/seh.h @@ -3,7 +3,7 @@ // Purpose: declarations for SEH (structured exceptions handling) support // Author: Vadim Zeitlin // Created: 2006-04-26 -// RCS-ID: $Id$ +// RCS-ID: $Id: seh.h 44451 2007-02-11 02:17:28Z VZ $ // Copyright: (c) 2006 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -55,11 +55,11 @@ // as division by 0 or access violation) to C++ pseudo-exceptions extern void wxSETranslator(unsigned int code, EXCEPTION_POINTERS *ep); - // up to VC 9 this warning ("calling _set_se_translator() requires /EHa") + // up to VC 7.1 this warning ("calling _set_se_translator() requires /EHa") // is harmless and it's easier to suppress it than use different makefiles // for VC5 and 6 (which don't support /EHa at all) and VC7 (which does // accept it but it seems to change nothing for it anyhow) - #if __VISUALC__ < 1600 + #if __VISUALC__ <= 1310 #pragma warning(disable: 4535) #endif diff --git a/Source/3rd Party/wx/include/wx/msw/setup.h b/Source/3rd Party/wx/include/wx/msw/setup.h index acb2276b9..2497beddc 100644 --- a/Source/3rd Party/wx/include/wx/msw/setup.h +++ b/Source/3rd Party/wx/include/wx/msw/setup.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: setup0.h 60190 2009-04-16 00:57:35Z KO $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -27,6 +27,14 @@ // compatibility settings // ---------------------------------------------------------------------------- +// This setting determines the compatibility with 2.4 API: set it to 1 to +// enable it but please consider updating your code instead. +// +// Default is 0 +// +// Recommended setting: 0 (please update your code) +#define WXWIN_COMPATIBILITY_2_4 0 + // This setting determines the compatibility with 2.6 API: set it to 0 to // flag all cases of using deprecated functions. // @@ -35,17 +43,7 @@ // in the version after it completely. // // Recommended setting: 0 (please update your code) -#define WXWIN_COMPATIBILITY_2_6 0 - -// This setting determines the compatibility with 2.8 API: set it to 0 to -// flag all cases of using deprecated functions. -// -// Default is 1 but please try building your code with 0 as the default will -// change to 0 in the next version and the deprecated functions will disappear -// in the version after it completely. -// -// Recommended setting: 0 (please update your code) -#define WXWIN_COMPATIBILITY_2_8 1 +#define WXWIN_COMPATIBILITY_2_6 1 // MSW-only: Set to 0 for accurate dialog units, else 1 for old behaviour when // default system font is used for wxWindow::GetCharWidth/Height() instead of @@ -60,50 +58,6 @@ // debugging settings // ---------------------------------------------------------------------------- -// wxDEBUG_LEVEL will be defined as 1 in wx/debug.h so normally there is no -// need to define it here. You may do it for two reasons: either completely -// disable/compile out the asserts in release version (then do it inside #ifdef -// NDEBUG) or, on the contrary, enable more asserts, including the usually -// disabled ones, in the debug build (then do it inside #ifndef NDEBUG) -// -// #ifdef NDEBUG -// #define wxDEBUG_LEVEL 0 -// #else -// #define wxDEBUG_LEVEL 2 -// #endif - -// wxHandleFatalExceptions() may be used to catch the program faults at run -// time and, instead of terminating the program with a usual GPF message box, -// call the user-defined wxApp::OnFatalException() function. If you set -// wxUSE_ON_FATAL_EXCEPTION to 0, wxHandleFatalExceptions() will not work. -// -// This setting is for Win32 only and can only be enabled if your compiler -// supports Win32 structured exception handling (currently only VC++ does) -// -// Default is 1 -// -// Recommended setting: 1 if your compiler supports it. -#define wxUSE_ON_FATAL_EXCEPTION 1 - -// Set this to 1 to be able to generate a human-readable (unlike -// machine-readable minidump created by wxCrashReport::Generate()) stack back -// trace when your program crashes using wxStackWalker -// -// Default is 1 if supported by the compiler. -// -// Recommended setting: 1, set to 0 if your programs never crash -#define wxUSE_STACKWALKER 1 - -// Set this to 1 to compile in wxDebugReport class which allows you to create -// and optionally upload to your web site a debug report consisting of back -// trace of the crash (if wxUSE_STACKWALKER == 1) and other information. -// -// Default is 1 if supported by the compiler. -// -// Recommended setting: 1, it is compiled into a separate library so there -// is no overhead if you don't use it -#define wxUSE_DEBUGREPORT 1 - // Generic comment about debugging settings: they are very useful if you don't // use any other memory leak detection tools such as Purify/BoundsChecker, but // are probably redundant otherwise. Also, Visual C++ CRT has the same features @@ -111,13 +65,10 @@ // may prefer to use it instead of built in memory debugging code because it is // faster and more fool proof. // -// Using VC++ CRT memory debugging is enabled by default in debug build (_DEBUG -// is defined) if wxUSE_GLOBAL_MEMORY_OPERATORS is *not* enabled (i.e. is 0) +// Using VC++ CRT memory debugging is enabled by default in debug mode +// (__WXDEBUG__) if wxUSE_GLOBAL_MEMORY_OPERATORS is *not* enabled (i.e. is 0) // and if __NO_VC_CRTDBG__ is not defined. -// The rest of the options in this section are obsolete and not supported, -// enable them at your own risk. - // If 1, enables wxDebugContext, for writing error messages to file, etc. If // __WXDEBUG__ is not defined, will still use the normal memory operators. // @@ -151,27 +102,72 @@ // In debug mode, causes new to be defined to be WXDEBUG_NEW (see object.h). If // this causes problems (e.g. link errors), set this to 0. You may need to set // this to 0 if using templates (at least for VC++). This switch is currently -// ignored for MinGW/Cygwin. +// ignored for mingw / cygwin / CodeWarrior // // Default is 0 // // Recommended setting: 0 #define wxUSE_DEBUG_NEW_ALWAYS 0 +// wxHandleFatalExceptions() may be used to catch the program faults at run +// time and, instead of terminating the program with a usual GPF message box, +// call the user-defined wxApp::OnFatalException() function. If you set +// wxUSE_ON_FATAL_EXCEPTION to 0, wxHandleFatalExceptions() will not work. +// +// This setting is for Win32 only and can only be enabled if your compiler +// supports Win32 structured exception handling (currently only VC++ does) +// +// Default is 1 +// +// Recommended setting: 1 if your compiler supports it. +#define wxUSE_ON_FATAL_EXCEPTION 1 + +// Set this to 1 to be able to generate a human-readable (unlike +// machine-readable minidump created by wxCrashReport::Generate()) stack back +// trace when your program crashes using wxStackWalker +// +// Default is 1 if supported by the compiler. +// +// Recommended setting: 1, set to 0 if your programs never crash +#define wxUSE_STACKWALKER 1 + +// Set this to 1 to compile in wxDebugReport class which allows you to create +// and optionally upload to your web site a debug report consisting of back +// trace of the crash (if wxUSE_STACKWALKER == 1) and other information. +// +// Default is 1 if supported by the compiler. +// +// Recommended setting: 1, it is compiled into a separate library so there +// is no overhead if you don't use it +#define wxUSE_DEBUGREPORT 1 // ---------------------------------------------------------------------------- // Unicode support // ---------------------------------------------------------------------------- -// These settings are obsolete: the library is always built in Unicode mode -// now, only set wxUSE_UNICODE to 0 to compile legacy code in ANSI mode if -// absolutely necessary -- updating it is strongly recommended as the ANSI mode -// will disappear completely in future wxWidgets releases. +// Set wxUSE_UNICODE to 1 to compile wxWidgets in Unicode mode: wxChar will be +// defined as wchar_t, wxString will use Unicode internally. If you set this +// to 1, you must use wxT() macro for all literal strings in the program. +// +// Unicode is currently only fully supported under Windows NT/2000/XP +// (Windows 9x doesn't support it and the programs compiled in Unicode mode +// will not run under 9x -- but see wxUSE_UNICODE_MSLU below). +// +// Default is 0 +// +// Recommended setting: 0 (unless you only plan to use Windows NT/2000/XP) #ifndef wxUSE_UNICODE - #define wxUSE_UNICODE 1 + #define wxUSE_UNICODE 0 #endif -// wxUSE_WCHAR_T is required by wxWidgets now, don't change. +// Setting wxUSE_WCHAR_T to 1 gives you some degree of Unicode support without +// compiling the program in Unicode mode. More precisely, it will be possible +// to construct wxString from a wide (Unicode) string and convert any wxString +// to Unicode. +// +// Default is 1 +// +// Recommended setting: 1 #define wxUSE_WCHAR_T 1 // ---------------------------------------------------------------------------- @@ -201,6 +197,15 @@ // Recommended setting: 0 (this is still work in progress...) #define wxUSE_EXTENDED_RTTI 0 +// Set wxUSE_STL to 1 to derive wxList(Foo) and wxArray(Foo) from +// std::list and std::vector, with a compatibility interface, +// and for wxHashMap to be implemented with templates. +// +// Default is 0 +// +// Recommended setting: YMMV +#define wxUSE_STL 0 + // Support for message/error logging. This includes wxLogXXX() functions and // wxLog and derived classes. Don't set this to 0 unless you really know what // you are doing. @@ -252,6 +257,37 @@ // Recommended setting: 1 as setting it to 0 disables many other things #define wxUSE_STREAMS 1 +// Use standard C++ streams if 1 instead of wx streams in some places. If +// disabled (default), wx streams are used everywhere and wxWidgets doesn't +// depend on the standard streams library. +// +// Notice that enabling this does not replace wx streams with std streams +// everywhere, in a lot of places wx streams are used no matter what. +// +// Default is 0 +// +// Recommended setting: 1 if you use the standard streams anyhow and so +// dependency on the standard streams library is not a +// problem +#define wxUSE_STD_IOSTREAM 0 + +// Enable conversion to standard C++ string if 1. +// +// Default is 1 for most compilers. +// +// Currently the Digital Mars and Watcom compilers come without standard C++ +// library headers by default, wxUSE_STD_STRING can be set to 1 if you do have +// them (e.g. from STLPort). +// +// VC++ 5.0 does include standard C++ library header, however they produce +// many warnings that can't be turned off when compiled at warning level 4. +#if defined(__DMC__) || defined(__WATCOMC__) \ + || (defined(_MSC_VER) && _MSC_VER < 1200) + #define wxUSE_STD_STRING 0 +#else + #define wxUSE_STD_STRING 1 +#endif + // Support for positional parameters (e.g. %1$d, %2$s ...) in wxVsnprintf. // Note that if the system's implementation does not support positional // parameters, setting this to 1 forces the use of the wxWidgets implementation @@ -267,118 +303,6 @@ // Recommended setting: 1 if you want to support multiple languages #define wxUSE_PRINTF_POS_PARAMS 1 -// Enable the use of compiler-specific thread local storage keyword, if any. -// This is used for wxTLS_XXX() macros implementation and normally should use -// the compiler-provided support as it's simpler and more efficient, but must -// not use it if wxWidgets is used in a dynamically loaded Win32 (i.e. using -// LoadLibrary()/GetProcAddress()) as this triggers a bug in compiler TLS -// support that results in crashes when any TLS variables are used. So if you -// are building a Win32 DLL using wxWidgets that can be loaded dynamically, set -// this to 0. -// -// Default is 1, but set to 0 if the scenario above is applicable. -#define wxUSE_COMPILER_TLS 1 - -// ---------------------------------------------------------------------------- -// Interoperability with the standard library. -// ---------------------------------------------------------------------------- - -// Set wxUSE_STL to 1 to enable maximal interoperability with the standard -// library, even at the cost of backwards compatibility. -// -// Default is 0 -// -// Recommended setting: 0 as the options below already provide a relatively -// good level of interoperability and changing this option arguably isn't worth -// diverging from the official builds of the library. -#define wxUSE_STL 0 - -// This is not a real option but is used as the default value for -// wxUSE_STD_IOSTREAM, wxUSE_STD_STRING and wxUSE_STD_CONTAINERS. -// -// Currently the Digital Mars and Watcom compilers come without standard C++ -// library headers by default, wxUSE_STD_STRING can be set to 1 if you do have -// them (e.g. from STLPort). -// -// VC++ 5.0 does include standard C++ library headers, however they produce -// many warnings that can't be turned off when compiled at warning level 4. -#if defined(__DMC__) || defined(__WATCOMC__) \ - || (defined(_MSC_VER) && _MSC_VER < 1200) - #define wxUSE_STD_DEFAULT 0 -#else - #define wxUSE_STD_DEFAULT 1 -#endif - -// Use standard C++ containers to implement wxVector<>, wxStack<>, wxDList<> -// and wxHashXXX<> classes. If disabled, wxWidgets own (mostly compatible but -// usually more limited) implementations are used which allows to avoid the -// dependency on the C++ run-time library. -// -// Notice that the compilers mentioned in wxUSE_STD_DEFAULT comment above don't -// support using standard containers and that VC6 needs non-default options for -// such build to avoid getting "fatal error C1076: compiler limit : internal -// heap limit reached; use /Zm to specify a higher limit" in its own standard -// headers, so you need to ensure you do increase the heap size before enabling -// this option for this compiler. -// -// Default is 0 for compatibility reasons. -// -// Recommended setting: 1 unless compatibility with the official wxWidgets -// build and/or the existing code is a concern. -#define wxUSE_STD_CONTAINERS 0 - -// Use standard C++ streams if 1 instead of wx streams in some places. If -// disabled, wx streams are used everywhere and wxWidgets doesn't depend on the -// standard streams library. -// -// Notice that enabling this does not replace wx streams with std streams -// everywhere, in a lot of places wx streams are used no matter what. -// -// Default is 1 if compiler supports it. -// -// Recommended setting: 1 if you use the standard streams anyhow and so -// dependency on the standard streams library is not a -// problem -#define wxUSE_STD_IOSTREAM wxUSE_STD_DEFAULT - -// Enable minimal interoperability with the standard C++ string class if 1. -// "Minimal" means that wxString can be constructed from std::string or -// std::wstring but can't be implicitly converted to them. You need to enable -// the option below for the latter. -// -// Default is 1 for most compilers. -// -// Recommended setting: 1 unless you want to ensure your program doesn't use -// the standard C++ library at all. -#define wxUSE_STD_STRING wxUSE_STD_DEFAULT - -// Make wxString as much interchangeable with std::[w]string as possible, in -// particular allow implicit conversion of wxString to either of these classes. -// This comes at a price (or a benefit, depending on your point of view) of not -// allowing implicit conversion to "const char *" and "const wchar_t *". -// -// Because a lot of existing code relies on these conversions, this option is -// disabled by default but can be enabled for your build if you don't care -// about compatibility. -// -// Default is 0 if wxUSE_STL has its default value or 1 if it is enabled. -// -// Recommended setting: 0 to remain compatible with the official builds of -// wxWidgets. -#define wxUSE_STD_STRING_CONV_IN_WXSTRING wxUSE_STL - -// VC++ 4.2 and above allows and but you can't mix -// them. Set this option to 1 to use , 0 to use . -// -// Note that newer compilers (including VC++ 7.1 and later) don't support -// wxUSE_IOSTREAMH == 1 and so will be used anyhow. -// -// Default is 0. -// -// Recommended setting: 0, only set to 1 if you use a really old compiler -#define wxUSE_IOSTREAMH 0 - - // ---------------------------------------------------------------------------- // non GUI features selection // ---------------------------------------------------------------------------- @@ -396,24 +320,6 @@ // Recommended setting: 1 #define wxUSE_LONGLONG 1 -// Set wxUSE_BASE64 to 1, to compile in Base64 support. This is required for -// storing binary data in wxConfig on most platforms. -// -// Default is 1. -// -// Recommended setting: 1 (but can be safely disabled if you don't use it) -#define wxUSE_BASE64 1 - -// Set this to 1 to be able to use wxEventLoop even in console applications -// (i.e. using base library only, without GUI). This is mostly useful for -// processing socket events but is also necessary to use timers in console -// applications -// -// Default is 1. -// -// Recommended setting: 1 (but can be safely disabled if you don't use it) -#define wxUSE_CONSOLE_EVENTLOOP 1 - // Set wxUSE_(F)FILE to 1 to compile wx(F)File classes. wxFile uses low level // POSIX functions for file access, wxFFile uses ANSI C stdio.h functions. // @@ -449,21 +355,6 @@ // i18n support: _() macro, wxLocale class. Requires wxTextFile. #define wxUSE_INTL 1 -// Provide wxFoo_l() functions similar to standard foo() functions but taking -// an extra locale parameter. -// -// Notice that this is fully implemented only for the systems providing POSIX -// xlocale support or Microsoft Visual C++ >= 8 (which provides proprietary -// almost-equivalent of xlocale functions), otherwise wxFoo_l() functions will -// only work for the current user locale and "C" locale. You can use -// wxHAS_XLOCALE_SUPPORT to test whether the full support is available. -// -// Default is 1 -// -// Recommended setting: 1 but may be disabled if you are writing programs -// running only in C locale anyhow -#define wxUSE_XLOCALE 1 - // Set wxUSE_DATETIME to 1 to compile the wxDateTime and related classes which // allow to manipulate dates, times and time intervals. wxDateTime replaces the // old wxTime and wxDate classes which are still provided for backwards @@ -495,13 +386,6 @@ // Recommended setting: 1 (needed by wxSocket) #define wxUSE_STOPWATCH 1 -// Set wxUSE_FSWATCHER to 1 if you want to enable wxFileSystemWatcher -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_FSWATCHER 1 - // Setting wxUSE_CONFIG to 1 enables the use of wxConfig and related classes // which allow the application to store its settings in the persistent // storage. Setting this to 1 will also enable on-demand creation of the @@ -550,17 +434,6 @@ // Set to 1 to use socket classes #define wxUSE_SOCKETS 1 -// Set to 1 to use ipv6 socket classes (requires wxUSE_SOCKETS) -// -// Notice that currently setting this option under Windows will result in -// programs which can only run on recent OS versions (with ws2_32.dll -// installed) which is why it is disabled by default. -// -// Default is 1. -// -// Recommended setting: 1 if you need IPv6 support -#define wxUSE_IPV6 0 - // Set to 1 to enable virtual file systems (required by wxHTML) #define wxUSE_FILESYSTEM 1 @@ -598,9 +471,6 @@ // Joystick support class #define wxUSE_JOYSTICK 1 -// wxFontEnumerator class -#define wxUSE_FONTENUM 1 - // wxFontMapper class #define wxUSE_FONTMAP 1 @@ -642,14 +512,6 @@ // possible in which case setting this to 0 can gain up to 100KB. #define wxUSE_VARIANT 1 -// Support for wxAny class, the successor for wxVariant. -// -// Default is 1. -// -// Recommended setting: 1 unless you want to reduce the library size by a small amount, -// or your compiler cannot for some reason cope with complexity of templates used. -#define wxUSE_ANY 1 - // Support for regular expression matching via wxRegEx class: enable this to // use POSIX regular expressions in your code. You need to compile regex // library from src/regex to use it under Windows. @@ -673,6 +535,13 @@ // Recommended setting: 1 #define wxUSE_MEDIACTRL 1 +// Use GStreamer for Unix (req a lot of dependancies) +// +// Default is 0 +// +// Recommended setting: 1 (wxMediaCtrl won't work by default without it) +#define wxUSE_GSTREAMER 0 + // Use wxWidget's XRC XML-based resource system. Recommended. // // Default is 1 @@ -695,105 +564,32 @@ // Recommended setting: 1 #define wxUSE_AUI 1 -// Use wxWidget's Ribbon classes for interfaces -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_RIBBON 1 - -// Use wxPropertyGrid. -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_PROPGRID 1 - -// Use wxStyledTextCtrl, a wxWidgets implementation of Scintilla. -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_STC 1 - -// Use wxWidget's web viewing classes -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_WEBVIEW 1 - -// Use the IE wxWebView backend -// -// Default is 1 on MSW -// -// Recommended setting: 1 -#ifdef __WXMSW__ -#define wxUSE_WEBVIEW_IE 1 -#else -#define wxUSE_WEBVIEW_IE 0 -#endif - -// Use the WebKit wxWebView backend -// -// Default is 1 on GTK and OSX -// -// Recommended setting: 1 -#if defined(__WXGTK__) || defined(__WXOSX__) -#define wxUSE_WEBVIEW_WEBKIT 1 -#else -#define wxUSE_WEBVIEW_WEBKIT 0 -#endif // Enable the new wxGraphicsPath and wxGraphicsContext classes for an advanced // 2D drawing API. (Still somewhat experimental) // -// Please note that on Windows gdiplus.dll is loaded dynamically which means -// that nothing special needs to be done as long as you don't use -// wxGraphicsContext at all or only use it on XP and later systems but you -// still do need to distribute it yourself for an application using -// wxGraphicsContext to be runnable on pre-XP systems. -// -// Default is 1 except if you're using a non-Microsoft compiler under Windows -// as only MSVC7+ is known to ship with gdiplus.h. For other compilers (e.g. -// mingw32) you may need to install the headers (and just the headers) -// yourself. If you do, change the setting below manually. -// -// Recommended setting: 1 if supported by the compilation environment - -// notice that we can't use wxCHECK_VISUALC_VERSION() here as this file is -// included from wx/platform.h before wxCHECK_VISUALC_VERSION() is defined -#ifdef _MSC_VER -# if _MSC_VER >= 1310 - // MSVC7.1+ comes with new enough Platform SDK, enable - // wxGraphicsContext support for it -# define wxUSE_GRAPHICS_CONTEXT 1 -# else - // MSVC 6 didn't include GDI+ headers so disable by default, enable it - // here if you use MSVC 6 with a newer SDK -# define wxUSE_GRAPHICS_CONTEXT 0 -# endif -#else - // Disable support for other Windows compilers, enable it if your compiler - // comes with new enough SDK or you installed the headers manually. - // - // Notice that this will be set by configure under non-Windows platforms - // anyhow so the value there is not important. -# define wxUSE_GRAPHICS_CONTEXT 0 -#endif - -// Enable wxGraphicsContext implementation using Cairo library. -// -// This is not needed under Windows and detected automatically by configure -// under other systems, however you may set this to 1 manually if you installed -// Cairo under Windows yourself and prefer to use it instead the native GDI+ -// implementation. +// Please note that on Windows you will need to link with gdiplus.lib (use +// USE_GDIPLUS=1 for makefile builds) and distribute gdiplus.dll with your +// application if you want it to be runnable on pre-XP systems. // // Default is 0 // -// Recommended setting: 0 -#define wxUSE_CAIRO 0 +// Recommended setting: 1 +#ifndef wxUSE_GRAPHICS_CONTEXT +#define wxUSE_GRAPHICS_CONTEXT 0 +#endif +// Enable the new wxCairoContext classes for an advanced +// 2D drawing API. (Still somewhat experimental) +// +// Please note that you will need to link with Cairo for this to work. +// +// Default is 0 +// +// Recommended setting: 1 +#ifndef wxUSE_CAIRO +#define wxUSE_CAIRO 0 +#endif // ---------------------------------------------------------------------------- // Individual GUI controls @@ -807,15 +603,6 @@ // Recommended setting: 1 (don't change except for very special programs) #define wxUSE_CONTROLS 1 -// Support markup in control labels, i.e. provide wxControl::SetLabelMarkup(). -// Currently markup is supported only by a few controls and only some ports but -// their number will increase with time. -// -// Default is 1 -// -// Recommended setting: 1 (may be set to 0 if you want to save on code size) -#define wxUSE_MARKUP 1 - // wxPopupWindow class is a top level transient window. It is currently used // to implement wxTipWindow // @@ -842,7 +629,6 @@ // // Recommended setting: 1 #define wxUSE_ANIMATIONCTRL 1 // wxAnimationCtrl -#define wxUSE_BANNERWINDOW 1 // wxBannerWindow #define wxUSE_BUTTON 1 // wxButton #define wxUSE_BMPBUTTON 1 // wxBitmapButton #define wxUSE_CALENDARCTRL 1 // wxCalendarCtrl @@ -852,22 +638,17 @@ #define wxUSE_COLLPANE 1 // wxCollapsiblePane #define wxUSE_COLOURPICKERCTRL 1 // wxColourPickerCtrl #define wxUSE_COMBOBOX 1 // wxComboBox -#define wxUSE_COMMANDLINKBUTTON 1 // wxCommandLinkButton #define wxUSE_DATAVIEWCTRL 1 // wxDataViewCtrl #define wxUSE_DATEPICKCTRL 1 // wxDatePickerCtrl #define wxUSE_DIRPICKERCTRL 1 // wxDirPickerCtrl -#define wxUSE_EDITABLELISTBOX 1 // wxEditableListBox -#define wxUSE_FILECTRL 1 // wxFileCtrl #define wxUSE_FILEPICKERCTRL 1 // wxFilePickerCtrl #define wxUSE_FONTPICKERCTRL 1 // wxFontPickerCtrl #define wxUSE_GAUGE 1 // wxGauge -#define wxUSE_HEADERCTRL 1 // wxHeaderCtrl #define wxUSE_HYPERLINKCTRL 1 // wxHyperlinkCtrl #define wxUSE_LISTBOX 1 // wxListBox #define wxUSE_LISTCTRL 1 // wxListCtrl #define wxUSE_RADIOBOX 1 // wxRadioBox #define wxUSE_RADIOBTN 1 // wxRadioButton -#define wxUSE_RICHMSGDLG 1 // wxRichMessageDialog #define wxUSE_SCROLLBAR 1 // wxScrollBar #define wxUSE_SEARCHCTRL 1 // wxSearchCtrl #define wxUSE_SLIDER 1 // wxSlider @@ -878,10 +659,8 @@ #define wxUSE_STATTEXT 1 // wxStaticText #define wxUSE_STATBMP 1 // wxStaticBitmap #define wxUSE_TEXTCTRL 1 // wxTextCtrl -#define wxUSE_TIMEPICKCTRL 1 // wxTimePickerCtrl #define wxUSE_TOGGLEBTN 1 // requires wxButton #define wxUSE_TREECTRL 1 // wxTreeCtrl -#define wxUSE_TREELISTCTRL 1 // wxTreeListCtrl // Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR // below either wxStatusBar95 or a generic wxStatusBar will be used. @@ -952,13 +731,13 @@ // Recommended setting: 1 #define wxUSE_TOOLBOOK 1 -// wxTaskBarIcon is a small notification icon shown in the system toolbar or -// dock. +// wxTabDialog is a generic version of wxNotebook but it is incompatible with +// the new class. It shouldn't be used in new code. // -// Default is 1. +// Default is 0. // -// Recommended setting: 1 (but can be set to 0 if you don't need it) -#define wxUSE_TASKBARICON 1 +// Recommended setting: 0 (use wxNotebook) +#define wxUSE_TAB_DIALOG 0 // wxGrid class // @@ -1001,15 +780,6 @@ // Recommended setting: 1 but can be safely set to 0 #define wxUSE_BITMAPCOMBOBOX 1 -// wxRearrangeCtrl is a wxCheckListBox with two buttons allowing to move items -// up and down in it. It is also used as part of wxRearrangeDialog. -// -// Default is 1. -// -// Recommended setting: 1 but can be safely set to 0 (currently used only by -// wxHeaderCtrl) -#define wxUSE_REARRANGECTRL 1 - // ---------------------------------------------------------------------------- // Miscellaneous GUI stuff // ---------------------------------------------------------------------------- @@ -1017,29 +787,6 @@ // wxAcceleratorTable/Entry classes and support for them in wxMenu(Bar) #define wxUSE_ACCEL 1 -// Use the standard art provider. The icons returned by this provider are -// embedded into the library as XPMs so disabling it reduces the library size -// somewhat but this should only be done if you use your own custom art -// provider returning the icons or never use any icons not provided by the -// native art provider (which might not be implemented at all for some -// platforms) or by the Tango icons provider (if it's not itself disabled -// below). -// -// Default is 1. -// -// Recommended setting: 1 unless you use your own custom art provider. -#define wxUSE_ARTPROVIDER_STD 1 - -// Use art provider providing Tango icons: this art provider has higher quality -// icons than the default ones using smaller size XPM icons without -// transparency but the embedded PNG icons add to the library size. -// -// Default is 1 under non-GTK ports. Under wxGTK the native art provider using -// the GTK+ stock icons replaces it so it is normally not necessary. -// -// Recommended setting: 1 but can be turned off to reduce the library size. -#define wxUSE_ARTPROVIDER_TANGO 1 - // Hotkey support (currently Windows only) #define wxUSE_HOTKEY 1 @@ -1072,14 +819,6 @@ // enumerated above, then this class is mostly useless too) #define wxUSE_IMAGLIST 1 -// Use wxInfoBar class. -// -// Default is 1. -// -// Recommended setting: 1 (but can be disabled without problems as nothing -// depends on it) -#define wxUSE_INFOBAR 1 - // Use wxMenu, wxMenuBar, wxMenuItem. // // Default is 1. @@ -1087,25 +826,6 @@ // Recommended setting: 1 (can't be disabled under MSW) #define wxUSE_MENUS 1 -// Use wxNotificationMessage. -// -// wxNotificationMessage allows to show non-intrusive messages to the user -// using balloons, banners, popups or whatever is the appropriate method for -// the current platform. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_NOTIFICATION_MESSAGE 1 - -// wxRichToolTip is a customizable tooltip class which has more functionality -// than the stock (but native, unlike this class) wxToolTip. -// -// Default is 1. -// -// Recommended setting: 1 (but can be safely set to 0 if you don't need it) -#define wxUSE_RICHTOOLTIP 1 - // Use wxSashWindow class. // // Default is 1. @@ -1130,20 +850,6 @@ // wxValidator class and related methods #define wxUSE_VALIDATORS 1 -// Use reference counted ID management: this means that wxWidgets will track -// the automatically allocated ids (those used when you use wxID_ANY when -// creating a window, menu or toolbar item &c) instead of just supposing that -// the program never runs out of them. This is mostly useful only under wxMSW -// where the total ids range is limited to SHRT_MIN..SHRT_MAX and where -// long-running programs can run into problems with ids reuse without this. On -// the other platforms, where the ids have the full int range, this shouldn't -// be necessary. -#ifdef __WXMSW__ -#define wxUSE_AUTOID_MANAGEMENT 1 -#else -#define wxUSE_AUTOID_MANAGEMENT 0 -#endif - // ---------------------------------------------------------------------------- // common dialogs // ---------------------------------------------------------------------------- @@ -1234,13 +940,6 @@ // use this function #define wxUSE_ABOUTDLG 1 -// wxFileHistory class -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_FILE_HISTORY 1 - // ---------------------------------------------------------------------------- // Metafiles support // ---------------------------------------------------------------------------- @@ -1297,16 +996,14 @@ // Setting wxUSE_GLCANVAS to 1 enables OpenGL support. You need to have OpenGL // headers and libraries to be able to compile the library with wxUSE_GLCANVAS -// set to 1 and, under Windows, also to add opengl32.lib and glu32.lib to the -// list of libraries used to link your application (although this is done -// implicitly for Microsoft Visual C++ users). +// set to 1. Note that for some compilers (notably Microsoft Visual C++) you +// will need to manually add opengl32.lib and glu32.lib to the list of +// libraries linked with your program if you use OpenGL. // -// Default is 1 unless the compiler is known to ship without the necessary -// headers (Digital Mars) or the platform doesn't support OpenGL (Windows CE). +// Default is 0. // -// Recommended setting: 1 if you intend to use OpenGL, can be safely set to 0 -// otherwise. -#define wxUSE_GLCANVAS 1 +// Recommended setting: 1 if you intend to use OpenGL, 0 otherwise +#define wxUSE_GLCANVAS 0 // wxRichTextCtrl allows editing of styled text. // @@ -1385,6 +1082,8 @@ // Use wxHTML-based help controller? #define wxUSE_WXHTML_HELP 1 +#define wxUSE_RESOURCES 0 + // 0 for no wxGetResource/wxWriteResource #define wxUSE_CONSTRAINTS 1 // 0 for no window layout constraint system @@ -1394,11 +1093,8 @@ #define wxUSE_MOUSEWHEEL 1 // Include mouse wheel support -// Compile wxUIActionSimulator class? -#define wxUSE_UIACTIONSIMULATOR 1 - // ---------------------------------------------------------------------------- -// wxDC classes for various output formats +// postscript support settings // ---------------------------------------------------------------------------- // Set to 1 for PostScript device context. @@ -1407,19 +1103,50 @@ // Set to 1 to use font metric files in GetTextExtent #define wxUSE_AFM_FOR_POSTSCRIPT 1 -// Set to 1 to compile in support for wxSVGFileDC, a wxDC subclass which allows -// to create files in SVG (Scalable Vector Graphics) format. -#define wxUSE_SVG 1 +// ---------------------------------------------------------------------------- +// database classes +// ---------------------------------------------------------------------------- -// Should wxDC provide SetTransformMatrix() and related methods? +// Define 1 to use ODBC classes +#define wxUSE_ODBC 0 + +// For backward compatibility reasons, this parameter now only controls the +// default scrolling method used by cursors. This default behavior can be +// overriden by setting the second param of wxDB::wxDbGetConnection() or +// wxDb() constructor to indicate whether the connection (and any wxDbTable()s +// that use the connection) should support forward only scrolling of cursors, +// or both forward and backward support for backward scrolling cursors is +// dependent on the data source as well as the ODBC driver being used. +#define wxODBC_FWD_ONLY_CURSORS 1 + +// Default is 0. Set to 1 to use the deprecated classes, enum types, function, +// member variables. With a setting of 1, full backward compatibility with the +// 2.0.x release is possible. It is STRONGLY recommended that this be set to 0, +// as future development will be done only on the non-deprecated +// functions/classes/member variables/etc. +#define wxODBC_BACKWARD_COMPATABILITY 0 + +// ---------------------------------------------------------------------------- +// other compiler (mis)features +// ---------------------------------------------------------------------------- + +// Set this to 0 if your compiler can't cope with omission of prototype +// parameters. // -// Default is 1 but can be set to 0 if this functionality is not used. Notice -// that currently only wxMSW supports this so setting this to 0 doesn't change -// much for non-MSW platforms (although it will still save a few bytes -// probably). +// Default is 1. // -// Recommended setting: 1. -#define wxUSE_DC_TRANSFORM_MATRIX 1 +// Recommended setting: 1 (should never need to set this to 0) +#define REMOVE_UNUSED_ARG 1 + +// VC++ 4.2 and above allows and but you can't mix +// them. Set to 1 for , 0 for . Note that VC++ 7.1 +// and later doesn't support wxUSE_IOSTREAMH == 1 and so will be +// used anyhow. +// +// Default is 1. +// +// Recommended setting: whatever your compiler likes more +#define wxUSE_IOSTREAMH 1 // ---------------------------------------------------------------------------- // image format support @@ -1487,7 +1214,6 @@ /* --- end common options --- */ -/* --- start MSW options --- */ // ---------------------------------------------------------------------------- // Windows-only settings // ---------------------------------------------------------------------------- @@ -1543,11 +1269,15 @@ // Recommended setting: 1, required by wxMediaCtrl #define wxUSE_ACTIVEX 1 -// wxDC caching implementation +// wxDC cacheing implementation #define wxUSE_DC_CACHEING 1 +// Set this to 1 to enable the use of DIB's for wxBitmap to support +// bitmaps > 16MB on Win95/98/Me. Set to 0 to use DDB's only. +#define wxUSE_DIB_FOR_BITMAP 0 + // Set this to 1 to enable wxDIB class used internally for manipulating -// wxBitmap data. +// wxBitmao data. // // Default is 1, set it to 0 only if you don't use wxImage neither // @@ -1558,13 +1288,6 @@ // (just use Windows printing). #define wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW 1 -// Set this to 1 to compile in wxRegKey class. -// -// Default is 1 -// -// Recommended setting: 1, this is used internally by wx in a few places -#define wxUSE_REGKEY 1 - // Set this to 1 to use RICHEDIT controls for wxTextCtrl with style wxTE_RICH // which allows to put more than ~32Kb of text in it even under Win9x (NT // doesn't have such limitation). @@ -1590,28 +1313,16 @@ // Recommended setting: 1, set to 0 for a small library size reduction #define wxUSE_OWNER_DRAWN 1 -// Set this to 1 to enable MSW-specific wxTaskBarIcon::ShowBalloon() method. It -// is required by native wxNotificationMessage implementation. -// -// Default is 1 but disabled in wx/msw/chkconf.h if SDK is too old to contain -// the necessary declarations. -// -// Recommended setting: 1, set to 0 for a tiny library size reduction -#define wxUSE_TASKBARICON_BALLOONS 1 - // Set to 1 to compile MS Windows XP theme engine support #define wxUSE_UXTHEME 1 +// Set to 1 to auto-adapt to MS Windows XP themes where possible +// (notably, wxNotebook pages) +#define wxUSE_UXTHEME_AUTO 1 + // Set to 1 to use InkEdit control (Tablet PC), if available #define wxUSE_INKEDIT 0 -// Set to 1 to enable .INI files based wxConfig implementation (wxIniConfig) -// -// Default is 0. -// -// Recommended setting: 0, nobody uses .INI files any more -#define wxUSE_INICONF 0 - // ---------------------------------------------------------------------------- // Generic versions of native controls // ---------------------------------------------------------------------------- @@ -1624,14 +1335,6 @@ // Recommended setting: 0, this is mainly used for testing #define wxUSE_DATEPICKCTRL_GENERIC 0 -// Set this to 1 to be able to use wxTimePickerCtrlGeneric in addition to the -// native wxTimePickerCtrl for the platforms that have the latter (MSW). -// -// Default is 0. -// -// Recommended setting: 0, this is mainly used for testing -#define wxUSE_TIMEPICKCTRL_GENERIC 0 - // ---------------------------------------------------------------------------- // Crash debugging helpers // ---------------------------------------------------------------------------- @@ -1643,7 +1346,16 @@ // // Recommended setting: 1, set to 0 if your programs never crash #define wxUSE_CRASHREPORT 1 -/* --- end MSW options --- */ + +// ---------------------------------------------------------------------------- +// obsolete settings +// ---------------------------------------------------------------------------- + +// NB: all settings in this section are obsolete and should not be used/changed +// at all, they will disappear + +// Define 1 to use bitmap messages. +#define wxUSE_BITMAP_MESSAGE 1 #endif // _WX_SETUP_H_ diff --git a/Source/3rd Party/wx/include/wx/msw/slider.h b/Source/3rd Party/wx/include/wx/msw/slider95.h similarity index 76% rename from Source/3rd Party/wx/include/wx/msw/slider.h rename to Source/3rd Party/wx/include/wx/msw/slider95.h index 9d3e3a9b0..55415c789 100644 --- a/Source/3rd Party/wx/include/wx/msw/slider.h +++ b/Source/3rd Party/wx/include/wx/msw/slider95.h @@ -1,142 +1,137 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/slider.h -// Purpose: wxSlider class implementation using trackbar control -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_SLIDER_H_ -#define _WX_SLIDER_H_ - -class WXDLLIMPEXP_FWD_CORE wxSubwindows; - -// Slider -class WXDLLIMPEXP_CORE wxSlider : public wxSliderBase -{ -public: - wxSlider() { Init(); } - - wxSlider(wxWindow *parent, - wxWindowID id, - int value, - int minValue, - int maxValue, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSL_HORIZONTAL, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxSliderNameStr) - { - Init(); - - (void)Create(parent, id, value, minValue, maxValue, - pos, size, style, validator, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - int value, - int minValue, int maxValue, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSL_HORIZONTAL, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxSliderNameStr); - - virtual ~wxSlider(); - - // slider methods - virtual int GetValue() const; - virtual void SetValue(int); - - void SetRange(int minValue, int maxValue); - - int GetMin() const { return m_rangeMin; } - int GetMax() const { return m_rangeMax; } - - // Win32-specific slider methods - int GetTickFreq() const { return m_tickFreq; } - void SetPageSize(int pageSize); - int GetPageSize() const; - void ClearSel(); - void ClearTicks(); - void SetLineSize(int lineSize); - int GetLineSize() const; - int GetSelEnd() const; - int GetSelStart() const; - void SetSelection(int minPos, int maxPos); - void SetThumbLength(int len); - int GetThumbLength() const; - void SetTick(int tickPos); - - // implementation only from now on - WXHWND GetStaticMin() const; - WXHWND GetStaticMax() const; - WXHWND GetEditValue() const; - virtual bool ContainsHWND(WXHWND hWnd) const; - - // we should let background show through the slider (and its labels) - virtual bool HasTransparentBackground() { return true; } - - // returns true if the platform should explicitly apply a theme border - virtual bool CanApplyThemeBorder() const { return false; } - - void Command(wxCommandEvent& event); - virtual bool MSWOnScroll(int orientation, WXWORD wParam, - WXWORD pos, WXHWND control); - - virtual bool Show(bool show = true); - virtual bool Enable(bool show = true); - virtual bool SetFont(const wxFont& font); - - virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const; - -protected: - // common part of all ctors - void Init(); - - // format an integer value as string - static wxString Format(int n) { return wxString::Format(wxT("%d"), n); } - - // get the boundig box for the slider and possible labels - wxRect GetBoundingBox() const; - - // Get the height and, if the pointers are non NULL, widths of both labels. - // - // Notice that the return value will be 0 if we don't have wxSL_LABELS - // style but we do fill widthMin and widthMax even if we don't have - // wxSL_MIN_MAX_LABELS style set so the caller should account for it. - int GetLabelsSize(int *widthMin = NULL, int *widthMax = NULL) const; - - - // overridden base class virtuals - virtual void DoGetPosition(int *x, int *y) const; - virtual void DoGetSize(int *width, int *height) const; - virtual void DoMoveWindow(int x, int y, int width, int height); - virtual wxSize DoGetBestSize() const; - - // the labels windows, if any - wxSubwindows *m_labels; - - int m_rangeMin; - int m_rangeMax; - int m_pageSize; - int m_lineSize; - int m_tickFreq; - - // flag needed to detect whether we're getting THUMBRELEASE event because - // of dragging the thumb or scrolling the mouse wheel - bool m_isDragging; - - // Platform-specific implementation of SetTickFreq - virtual void DoSetTickFreq(int freq); - - DECLARE_DYNAMIC_CLASS_NO_COPY(wxSlider) -}; - -#endif // _WX_SLIDER_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/slider95.h +// Purpose: wxSlider class, using the Win95 (and later) trackbar control +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: slider95.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SLIDER95_H_ +#define _WX_SLIDER95_H_ + +class WXDLLIMPEXP_FWD_CORE wxSubwindows; + +// Slider +class WXDLLEXPORT wxSlider : public wxSliderBase +{ +public: + wxSlider() { Init(); } + + wxSlider(wxWindow *parent, + wxWindowID id, + int value, + int minValue, + int maxValue, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSL_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxSliderNameStr) + { + Init(); + + (void)Create(parent, id, value, minValue, maxValue, + pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + int value, + int minValue, int maxValue, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSL_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxSliderNameStr); + + virtual ~wxSlider(); + + // slider methods + virtual int GetValue() const; + virtual void SetValue(int); + + void SetRange(int minValue, int maxValue); + + int GetMin() const { return m_rangeMin; } + int GetMax() const { return m_rangeMax; } + + // Win32-specific slider methods + void SetTickFreq(int n, int pos); + int GetTickFreq() const { return m_tickFreq; } + void SetPageSize(int pageSize); + int GetPageSize() const; + void ClearSel(); + void ClearTicks(); + void SetLineSize(int lineSize); + int GetLineSize() const; + int GetSelEnd() const; + int GetSelStart() const; + void SetSelection(int minPos, int maxPos); + void SetThumbLength(int len); + int GetThumbLength() const; + void SetTick(int tickPos); + + // implementation only from now on + WXHWND GetStaticMin() const; + WXHWND GetStaticMax() const; + WXHWND GetEditValue() const; + virtual bool ContainsHWND(WXHWND hWnd) const; + + // we should let background show through the slider (and its labels) + virtual bool HasTransparentBackground() { return true; } + + + void Command(wxCommandEvent& event); + virtual bool MSWOnScroll(int orientation, WXWORD wParam, + WXWORD pos, WXHWND control); + + virtual bool Show(bool show = true); + virtual bool Enable(bool show = true); + virtual bool SetFont(const wxFont& font); + + virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const; + +protected: + // common part of all ctors + void Init(); + + // format an integer value as string + static wxString Format(int n) { return wxString::Format(_T("%d"), n); } + + // get the boundig box for the slider and possible labels + wxRect GetBoundingBox() const; + + // get the height and, if the pointer is not NULL, width of our labels + int GetLabelsSize(int *width = NULL) const; + + + // overridden base class virtuals + virtual void DoGetPosition(int *x, int *y) const; + virtual void DoGetSize(int *width, int *height) const; + virtual void DoMoveWindow(int x, int y, int width, int height); + virtual wxSize DoGetBestSize() const; + + virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } + + + // the labels windows, if any + wxSubwindows *m_labels; + + int m_rangeMin; + int m_rangeMax; + int m_pageSize; + int m_lineSize; + int m_tickFreq; + + // flag needed to detect whether we're getting THUMBRELEASE event because + // of dragging the thumb or scrolling the mouse wheel + bool m_isDragging; + + DECLARE_DYNAMIC_CLASS_NO_COPY(wxSlider) +}; + +#endif // _WX_SLIDER95_H_ + diff --git a/Source/3rd Party/wx/include/wx/msw/spinbutt.h b/Source/3rd Party/wx/include/wx/msw/spinbutt.h index 458912975..dcfb0a370 100644 --- a/Source/3rd Party/wx/include/wx/msw/spinbutt.h +++ b/Source/3rd Party/wx/include/wx/msw/spinbutt.h @@ -1,10 +1,10 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/spinbutt.h +// Name: wx/univ/spinbutt.h // Purpose: wxSpinButton class // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: spinbutt.h 41316 2006-09-20 14:15:14Z RR $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -17,7 +17,7 @@ #if wxUSE_SPINBTN -class WXDLLIMPEXP_CORE wxSpinButton : public wxSpinButtonBase +class WXDLLEXPORT wxSpinButton : public wxSpinButtonBase { public: // construction @@ -57,9 +57,6 @@ public: // a wxSpinButton can't do anything useful with focus, only wxSpinCtrl can virtual bool AcceptsFocus() const { return false; } - // returns true if the platform should explicitly apply a theme border - virtual bool CanApplyThemeBorder() const { return false; } - protected: virtual wxSize DoGetBestSize() const; diff --git a/Source/3rd Party/wx/include/wx/msw/spinctrl.h b/Source/3rd Party/wx/include/wx/msw/spinctrl.h index 9ec9f9264..08b619450 100644 --- a/Source/3rd Party/wx/include/wx/msw/spinctrl.h +++ b/Source/3rd Party/wx/include/wx/msw/spinctrl.h @@ -1,10 +1,10 @@ //////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/spinctrl.h +// Name: msw/spinctrl.h // Purpose: wxSpinCtrl class declaration for Win32 // Author: Vadim Zeitlin // Modified by: // Created: 22.07.99 -// RCS-ID: $Id$ +// RCS-ID: $Id: spinctrl.h 53135 2008-04-12 02:31:04Z VZ $ // Copyright: (c) Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -27,22 +27,20 @@ WX_DEFINE_EXPORTED_ARRAY_PTR(wxSpinCtrl *, wxArraySpins); // control is clicked. // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxSpinCtrl : public wxSpinButton +class WXDLLEXPORT wxSpinCtrl : public wxSpinButton { public: - wxSpinCtrl() { Init(); } + wxSpinCtrl() { } wxSpinCtrl(wxWindow *parent, wxWindowID id = wxID_ANY, const wxString& value = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxSP_ARROW_KEYS | wxALIGN_RIGHT, + long style = wxSP_ARROW_KEYS, int min = 0, int max = 100, int initial = 0, - const wxString& name = wxT("wxSpinCtrl")) + const wxString& name = _T("wxSpinCtrl")) { - Init(); - Create(parent, id, value, pos, size, style, min, max, initial, name); } @@ -51,9 +49,9 @@ public: const wxString& value = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxSP_ARROW_KEYS | wxALIGN_RIGHT, + long style = wxSP_ARROW_KEYS, int min = 0, int max = 100, int initial = 0, - const wxString& name = wxT("wxSpinCtrl")); + const wxString& name = _T("wxSpinCtrl")); // a wxTextCtrl-like method (but we can't have GetValue returning wxString // because the base class already has one returning int!) @@ -69,7 +67,6 @@ public: virtual void SetValue(int val); virtual int GetValue() const; - virtual void SetRange(int minVal, int maxVal); virtual bool SetFont(const wxFont &font); virtual void SetFocus(); @@ -81,18 +78,6 @@ public: // wxSpinButton doesn't accept focus, but we do virtual bool AcceptsFocus() const { return wxWindow::AcceptsFocus(); } - // we're like wxTextCtrl and not (default) wxButton - virtual wxVisualAttributes GetDefaultAttributes() const - { - return GetClassDefaultAttributes(GetWindowVariant()); - } - - static wxVisualAttributes - GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL) - { - return GetCompositeControlsDefaultAttributes(variant); - } - // for internal use only // get the subclassed window proc of the buddy text @@ -104,22 +89,21 @@ public: // process a WM_COMMAND generated by the buddy text control bool ProcessTextCommand(WXWORD cmd, WXWORD id); - // recognize buddy window as part of this control at wx level - virtual bool ContainsHWND(WXHWND hWnd) const { return hWnd == m_hwndBuddy; } - protected: virtual void DoGetPosition(int *x, int *y) const; virtual void DoMoveWindow(int x, int y, int width, int height); virtual wxSize DoGetBestSize() const; virtual void DoGetSize(int *width, int *height) const; +#if wxABI_VERSION >= 20808 virtual void DoGetClientSize(int *x, int *y) const; +#endif + #if wxUSE_TOOLTIPS virtual void DoSetToolTip( wxToolTip *tip ); #endif // wxUSE_TOOLTIPS - virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); - virtual bool MSWOnScroll(int orientation, WXWORD wParam, - WXWORD pos, WXHWND control); + // the handler for wxSpinButton events + void OnSpinChange(wxSpinEvent& event); // handle processing of special keys void OnChar(wxKeyEvent& event); @@ -141,16 +125,14 @@ protected: WXHWND m_hwndBuddy; WXFARPROC m_wndProcBuddy; - // Block text update event after SetValue() - bool m_blockEvent; + // all existing wxSpinCtrls - this allows to find the one corresponding to + // the given buddy window in GetSpinForTextCtrl() + static wxArraySpins ms_allSpins; private: - // Common part of all ctors. - void Init(); - DECLARE_DYNAMIC_CLASS(wxSpinCtrl) DECLARE_EVENT_TABLE() - wxDECLARE_NO_COPY_CLASS(wxSpinCtrl); + DECLARE_NO_COPY_CLASS(wxSpinCtrl) }; #endif // wxUSE_SPINCTRL diff --git a/Source/3rd Party/wx/include/wx/msw/stackwalk.h b/Source/3rd Party/wx/include/wx/msw/stackwalk.h index 988a2f917..2aeba90c5 100644 --- a/Source/3rd Party/wx/include/wx/msw/stackwalk.h +++ b/Source/3rd Party/wx/include/wx/msw/stackwalk.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 2005-01-08 -// RCS-ID: $Id$ +// RCS-ID: $Id: stackwalk.h 43346 2006-11-12 14:33:03Z RR $ // Copyright: (c) 2005 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -29,7 +29,7 @@ class WXDLLIMPEXP_BASE wxStackFrame : public wxStackFrameBase { private: wxStackFrame *ConstCast() const - { return const_cast(this); } + { return wx_const_cast(wxStackFrame *, this); } size_t DoGetParamCount() const { return m_paramTypes.GetCount(); } @@ -65,7 +65,7 @@ protected: // helper for debug API: it wants to have addresses as DWORDs size_t GetSymAddr() const { - return reinterpret_cast(m_address); + return wx_reinterpret_cast(size_t, m_address); } private: @@ -90,15 +90,13 @@ public: // only wxStackWalker(const char * WXUNUSED(argv0) = NULL) { } - virtual void Walk(size_t skip = 1, size_t maxDepth = wxSTACKWALKER_MAX_DEPTH); -#if wxUSE_ON_FATAL_EXCEPTION - virtual void WalkFromException(size_t maxDepth = wxSTACKWALKER_MAX_DEPTH); -#endif // wxUSE_ON_FATAL_EXCEPTION + virtual void Walk(size_t skip = 1, size_t maxDepth = 200); + virtual void WalkFromException(); // enumerate stack frames from the given context - void WalkFrom(const _CONTEXT *ctx, size_t skip = 1, size_t maxDepth = wxSTACKWALKER_MAX_DEPTH); - void WalkFrom(const _EXCEPTION_POINTERS *ep, size_t skip = 1, size_t maxDepth = wxSTACKWALKER_MAX_DEPTH); + void WalkFrom(const _CONTEXT *ctx, size_t skip = 1); + void WalkFrom(const _EXCEPTION_POINTERS *ep, size_t skip = 1); }; #endif // _WX_MSW_STACKWALK_H_ diff --git a/Source/3rd Party/wx/include/wx/msw/statbmp.h b/Source/3rd Party/wx/include/wx/msw/statbmp.h index aaf99d10a..99bc98595 100644 --- a/Source/3rd Party/wx/include/wx/msw/statbmp.h +++ b/Source/3rd Party/wx/include/wx/msw/statbmp.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: statbmp.h 51824 2008-02-16 01:59:21Z SN $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -16,10 +16,10 @@ #include "wx/icon.h" #include "wx/bitmap.h" -extern WXDLLIMPEXP_DATA_CORE(const char) wxStaticBitmapNameStr[]; +extern WXDLLEXPORT_DATA(const wxChar) wxStaticBitmapNameStr[]; // a control showing an icon or a bitmap -class WXDLLIMPEXP_CORE wxStaticBitmap : public wxStaticBitmapBase +class WXDLLEXPORT wxStaticBitmap : public wxStaticBitmapBase { public: wxStaticBitmap() { Init(); } @@ -54,11 +54,9 @@ public: virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; - // returns true if the platform should explicitly apply a theme border - virtual bool CanApplyThemeBorder() const { return false; } - protected: - virtual wxSize DoGetBestClientSize() const; + virtual wxBorder GetDefaultBorder() const; + virtual wxSize DoGetBestSize() const; // ctor/dtor helpers void Init() { m_isIcon = true; m_image = NULL; m_currentHandle = 0; } @@ -70,12 +68,11 @@ protected: void SetImage(const wxGDIImage* image); void SetImageNoCopy( wxGDIImage* image ); -#ifndef __WXWINCE__ +#if wxABI_VERSION >= 20808 // draw the bitmap ourselves here if the OS can't do it correctly (if it // can we leave it to it) void DoPaintManually(wxPaintEvent& event); -#endif // !__WXWINCE__ - +#endif // we can have either an icon or a bitmap bool m_isIcon; @@ -86,7 +83,7 @@ protected: private: DECLARE_DYNAMIC_CLASS(wxStaticBitmap) - wxDECLARE_NO_COPY_CLASS(wxStaticBitmap); + DECLARE_NO_COPY_CLASS(wxStaticBitmap) }; #endif diff --git a/Source/3rd Party/wx/include/wx/msw/statbox.h b/Source/3rd Party/wx/include/wx/msw/statbox.h index 6db8953d4..99604516d 100644 --- a/Source/3rd Party/wx/include/wx/msw/statbox.h +++ b/Source/3rd Party/wx/include/wx/msw/statbox.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: statbox.h 37393 2006-02-08 21:47:09Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -13,7 +13,7 @@ #define _WX_MSW_STATBOX_H_ // Group box -class WXDLLIMPEXP_CORE wxStaticBox : public wxStaticBoxBase +class WXDLLEXPORT wxStaticBox : public wxStaticBoxBase { public: wxStaticBox() { } @@ -40,12 +40,12 @@ public: virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; - // returns true if the platform should explicitly apply a theme border - virtual bool CanApplyThemeBorder() const { return false; } - protected: virtual wxSize DoGetBestSize() const; + // choose the default border for this window + virtual wxBorder GetDefaultBorder() const; + #ifndef __WXWINCE__ public: virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); diff --git a/Source/3rd Party/wx/include/wx/msw/statbr95.h b/Source/3rd Party/wx/include/wx/msw/statbr95.h new file mode 100644 index 000000000..1e3155ad0 --- /dev/null +++ b/Source/3rd Party/wx/include/wx/msw/statbr95.h @@ -0,0 +1,76 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: msw/statbr95.h +// Purpose: native implementation of wxStatusBar +// Author: Vadim Zeitlin +// Modified by: +// Created: 04.04.98 +// RCS-ID: $Id: statbr95.h 41035 2006-09-06 17:36:22Z PC $ +// Copyright: (c) 1998 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _STATBR95_H +#define _STATBR95_H + +#if wxUSE_NATIVE_STATUSBAR + +class WXDLLEXPORT wxStatusBar95 : public wxStatusBarBase +{ +public: + // ctors and such + wxStatusBar95(); + wxStatusBar95(wxWindow *parent, + wxWindowID id = wxID_ANY, + long style = wxST_SIZEGRIP, + const wxString& name = wxStatusBarNameStr) + { + (void)Create(parent, id, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + long style = wxST_SIZEGRIP, + const wxString& name = wxStatusBarNameStr); + + virtual ~wxStatusBar95(); + + // a status line can have several (<256) fields numbered from 0 + virtual void SetFieldsCount(int number = 1, const int *widths = NULL); + + // each field of status line has it's own text + virtual void SetStatusText(const wxString& text, int number = 0); + virtual wxString GetStatusText(int number = 0) const; + + // set status line fields' widths + virtual void SetStatusWidths(int n, const int widths_field[]); + + // set status line fields' styles + virtual void SetStatusStyles(int n, const int styles[]); + + // sets the minimal vertical size of the status bar + virtual void SetMinHeight(int height); + + // get the position and size of the field's internal bounding rectangle + virtual bool GetFieldRect(int i, wxRect& rect) const; + + // get the border size + virtual int GetBorderX() const; + virtual int GetBorderY() const; + + virtual WXLRESULT MSWWindowProc(WXUINT nMsg, + WXWPARAM wParam, + WXLPARAM lParam); +protected: + void CopyFieldsWidth(const int widths[]); + void SetFieldsWidth(); + + // override base class virtual + void DoMoveWindow(int x, int y, int width, int height); + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxStatusBar95) +}; + +#endif // wxUSE_NATIVE_STATUSBAR + +#endif diff --git a/Source/3rd Party/wx/include/wx/msw/statline.h b/Source/3rd Party/wx/include/wx/msw/statline.h index 9f2af45ca..7b7edf930 100644 --- a/Source/3rd Party/wx/include/wx/msw/statline.h +++ b/Source/3rd Party/wx/include/wx/msw/statline.h @@ -1,9 +1,9 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/statline.h +// Name: msw/statline.h // Purpose: MSW version of wxStaticLine class // Author: Vadim Zeitlin // Created: 28.06.99 -// Version: $Id$ +// Version: $Id: statline.h 43874 2006-12-09 14:52:59Z VZ $ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -15,7 +15,7 @@ // wxStaticLine // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxStaticLine : public wxStaticLineBase +class WXDLLEXPORT wxStaticLine : public wxStaticLineBase { public: // constructors and pseudo-constructors @@ -38,7 +38,7 @@ public: long style = wxLI_HORIZONTAL, const wxString &name = wxStaticLineNameStr ); - // overridden base class virtuals + // overriden base class virtuals virtual bool AcceptsFocus() const { return false; } // usually overridden base class virtuals diff --git a/Source/3rd Party/wx/include/wx/msw/stattext.h b/Source/3rd Party/wx/include/wx/msw/stattext.h index 9208ecafb..2338315cb 100644 --- a/Source/3rd Party/wx/include/wx/msw/stattext.h +++ b/Source/3rd Party/wx/include/wx/msw/stattext.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: stattext.h 37393 2006-02-08 21:47:09Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -12,7 +12,7 @@ #ifndef _WX_STATTEXT_H_ #define _WX_STATTEXT_H_ -class WXDLLIMPEXP_CORE wxStaticText : public wxStaticTextBase +class WXDLLEXPORT wxStaticText : public wxStaticTextBase { public: wxStaticText() { } @@ -44,12 +44,10 @@ public: protected: // implement/override some base class virtuals + virtual wxBorder GetDefaultBorder() const; virtual void DoSetSize(int x, int y, int w, int h, int sizeFlags = wxSIZE_AUTO); - virtual wxSize DoGetBestClientSize() const; - - virtual wxString DoGetLabel() const; - virtual void DoSetLabel(const wxString& str); + virtual wxSize DoGetBestSize() const; DECLARE_DYNAMIC_CLASS_NO_COPY(wxStaticText) }; diff --git a/Source/3rd Party/wx/include/wx/msw/statusbar.h b/Source/3rd Party/wx/include/wx/msw/statusbar.h deleted file mode 100644 index 758b47eef..000000000 --- a/Source/3rd Party/wx/include/wx/msw/statusbar.h +++ /dev/null @@ -1,112 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/statusbar.h -// Purpose: native implementation of wxStatusBar -// Author: Vadim Zeitlin -// Modified by: -// Created: 04.04.98 -// RCS-ID: $Id$ -// Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_STATUSBAR_H_ -#define _WX_MSW_STATUSBAR_H_ - -#if wxUSE_NATIVE_STATUSBAR - -#include "wx/vector.h" -#include "wx/tooltip.h" - -class WXDLLIMPEXP_FWD_CORE wxClientDC; - -class WXDLLIMPEXP_CORE wxStatusBar : public wxStatusBarBase -{ -public: - // ctors and such - wxStatusBar(); - wxStatusBar(wxWindow *parent, - wxWindowID id = wxID_ANY, - long style = wxSTB_DEFAULT_STYLE, - const wxString& name = wxStatusBarNameStr) - { - m_pDC = NULL; - (void)Create(parent, id, style, name); - } - - bool Create(wxWindow *parent, - wxWindowID id = wxID_ANY, - long style = wxSTB_DEFAULT_STYLE, - const wxString& name = wxStatusBarNameStr); - - virtual ~wxStatusBar(); - - // implement base class methods - virtual void SetFieldsCount(int number = 1, const int *widths = NULL); - virtual void SetStatusWidths(int n, const int widths_field[]); - virtual void SetStatusStyles(int n, const int styles[]); - virtual void SetMinHeight(int height); - virtual bool GetFieldRect(int i, wxRect& rect) const; - - virtual int GetBorderX() const; - virtual int GetBorderY() const; - - // override some wxWindow virtual methods too - virtual bool SetFont(const wxFont& font); - - virtual WXLRESULT MSWWindowProc(WXUINT nMsg, - WXWPARAM wParam, - WXLPARAM lParam); - -protected: - // implement base class pure virtual method - virtual void DoUpdateStatusText(int number); - - // override some base class virtuals - virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const; - virtual wxSize DoGetBestSize() const; - virtual void DoMoveWindow(int x, int y, int width, int height); -#if wxUSE_TOOLTIPS - virtual bool MSWProcessMessage(WXMSG* pMsg); - virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM* result); -#endif - - // implementation of the public SetStatusWidths() - void MSWUpdateFieldsWidths(); - - // used by DoUpdateStatusText() - wxClientDC *m_pDC; - -#if wxUSE_TOOLTIPS - // the tooltips used when wxSTB_SHOW_TIPS is given - wxVector m_tooltips; -#endif - -private: - struct MSWBorders - { - int horz, - vert, - between; - }; - - // retrieve all status bar borders using SB_GETBORDERS - MSWBorders MSWGetBorders() const; - - // return the size of the border between the fields - int MSWGetBorderWidth() const; - - struct MSWMetrics - { - int gripWidth, - textMargin; - }; - - // return the various status bar metrics - static const MSWMetrics& MSWGetMetrics(); - - DECLARE_DYNAMIC_CLASS_NO_COPY(wxStatusBar) -}; - -#endif // wxUSE_NATIVE_STATUSBAR - -#endif // _WX_MSW_STATUSBAR_H_ diff --git a/Source/3rd Party/wx/include/wx/msw/stdpaths.h b/Source/3rd Party/wx/include/wx/msw/stdpaths.h index f350cdfff..55f8f2d98 100644 --- a/Source/3rd Party/wx/include/wx/msw/stdpaths.h +++ b/Source/3rd Party/wx/include/wx/msw/stdpaths.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 2004-10-19 -// RCS-ID: $Id$ +// RCS-ID: $Id: stdpaths.h 43340 2006-11-12 12:58:10Z RR $ // Copyright: (c) 2004 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -19,10 +19,6 @@ class WXDLLIMPEXP_BASE wxStandardPaths : public wxStandardPathsBase { public: - // ctor calls IgnoreAppBuildSubDirs() and also sets up the object to use - // both vendor and application name by default - wxStandardPaths(); - // implement base class pure virtuals virtual wxString GetExecutablePath() const; virtual wxString GetConfigDir() const; @@ -33,48 +29,12 @@ public: virtual wxString GetPluginsDir() const; virtual wxString GetDocumentsDir() const; - - // MSW-specific methods - - // This class supposes that data, plugins &c files are located under the - // program directory which is the directory containing the application - // binary itself. But sometimes this binary may be in a subdirectory of the - // main program directory, e.g. this happens in at least the following - // common cases: - // 1. The program is in "bin" subdirectory of the installation directory. - // 2. The program is in "debug" subdirectory of the directory containing - // sources and data files during development - // - // By calling this function you instruct the class to remove the last - // component of the path if it matches its argument. Notice that it may be - // called more than once, e.g. you can call both IgnoreAppSubDir("bin") and - // IgnoreAppSubDir("debug") to take care of both production and development - // cases above but that each call will only remove the last path component. - // Finally note that the argument can contain wild cards so you can also - // call IgnoreAppSubDir("vc*msw*") to ignore all build directories at once - // when using wxWidgets-inspired output directories names. - void IgnoreAppSubDir(const wxString& subdirPattern); - - // This function is used to ignore all common build directories and is - // called from the ctor -- use DontIgnoreAppSubDir() to undo this. - void IgnoreAppBuildSubDirs(); - - // Undo the effects of all preceding IgnoreAppSubDir() calls. - void DontIgnoreAppSubDir(); - - - // Returns the directory corresponding to the specified Windows shell CSIDL - static wxString MSWGetShellDir(int csidl); - protected: // get the path corresponding to the given standard CSIDL_XXX constant static wxString DoGetDirectory(int csidl); // return the directory of the application itself - wxString GetAppDir() const; - - // directory returned by GetAppDir() - mutable wxString m_appDir; + static wxString GetAppDir(); }; // ---------------------------------------------------------------------------- diff --git a/Source/3rd Party/wx/include/wx/msw/subwin.h b/Source/3rd Party/wx/include/wx/msw/subwin.h index 44d296a57..75f8dad6d 100644 --- a/Source/3rd Party/wx/include/wx/msw/subwin.h +++ b/Source/3rd Party/wx/include/wx/msw/subwin.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 2004-12-11 -// RCS-ID: $Id$ +// RCS-ID: $Id: subwin.h 30981 2004-12-13 01:02:32Z VZ $ // Copyright: (c) 2004 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -18,7 +18,7 @@ // wxSubwindows contains all HWNDs making part of a single wx control // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxSubwindows +class WXDLLEXPORT wxSubwindows { public: // the number of subwindows can be specified either as parameter to ctor or @@ -28,11 +28,10 @@ public: // allocate enough space for the given number of windows void Create(size_t n) { - wxASSERT_MSG( !m_hwnds, wxT("Create() called twice?") ); + wxASSERT_MSG( !m_hwnds, _T("Create() called twice?") ); m_count = n; m_hwnds = (HWND *)calloc(n, sizeof(HWND)); - m_ids = new wxWindowIDRef[n]; } // non-virtual dtor, this class is not supposed to be used polymorphically @@ -40,12 +39,10 @@ public: { for ( size_t n = 0; n < m_count; n++ ) { - if ( m_hwnds[n] ) - ::DestroyWindow(m_hwnds[n]); + ::DestroyWindow(m_hwnds[n]); } free(m_hwnds); - delete [] m_ids; } // get the number of subwindows @@ -54,24 +51,15 @@ public: // access a given window HWND& Get(size_t n) { - wxASSERT_MSG( n < m_count, wxT("subwindow index out of range") ); + wxASSERT_MSG( n < m_count, _T("subwindow index out of range") ); return m_hwnds[n]; } + HWND& operator[](size_t n) { return Get(n); } HWND operator[](size_t n) const { - return const_cast(this)->Get(n); - } - - // initialize the given window: id will be stored in wxWindowIDRef ensuring - // that it is not reused while this object exists - void Set(size_t n, HWND hwnd, wxWindowID id) - { - wxASSERT_MSG( n < m_count, wxT("subwindow index out of range") ); - - m_hwnds[n] = hwnd; - m_ids[n] = id; + return wx_const_cast(wxSubwindows *, this)->Get(n); } // check if we have this window @@ -96,8 +84,7 @@ public: int sw = show ? SW_SHOW : SW_HIDE; for ( size_t n = 0; n < m_count; n++ ) { - if ( m_hwnds[n] ) - ::ShowWindow(m_hwnds[n], sw); + ::ShowWindow(m_hwnds[n], sw); } } @@ -106,8 +93,7 @@ public: { for ( size_t n = 0; n < m_count; n++ ) { - if ( m_hwnds[n] ) - ::EnableWindow(m_hwnds[n], enable); + ::EnableWindow(m_hwnds[n], enable); } } @@ -115,17 +101,14 @@ public: void SetFont(const wxFont& font) { HFONT hfont = GetHfontOf(font); - wxCHECK_RET( hfont, wxT("invalid font") ); + wxCHECK_RET( hfont, _T("invalid font") ); for ( size_t n = 0; n < m_count; n++ ) { - if ( m_hwnds[n] ) - { - ::SendMessage(m_hwnds[n], WM_SETFONT, (WPARAM)hfont, 0); + ::SendMessage(m_hwnds[n], WM_SETFONT, (WPARAM)hfont, 0); - // otherwise the window might not be redrawn correctly - ::InvalidateRect(m_hwnds[n], NULL, FALSE /* don't erase bg */); - } + // otherwise the window might not be redrawn correctly + ::InvalidateRect(m_hwnds[n], NULL, FALSE /* don't erase bg */); } } @@ -135,14 +118,10 @@ public: wxRect r; for ( size_t n = 0; n < m_count; n++ ) { - if ( m_hwnds[n] ) - { - RECT rc; + RECT rc; + ::GetWindowRect(m_hwnds[n], &rc); - ::GetWindowRect(m_hwnds[n], &rc); - - r.Union(wxRectFromRECT(rc)); - } + r.Union(wxRectFromRECT(rc)); } return r; @@ -161,11 +140,8 @@ private: // the HWNDs we contain HWND *m_hwnds; - // the IDs of the windows - wxWindowIDRef *m_ids; - - wxDECLARE_NO_COPY_CLASS(wxSubwindows); + DECLARE_NO_COPY_CLASS(wxSubwindows) }; // convenient macro to forward a few methods which are usually propagated to diff --git a/Source/3rd Party/wx/include/wx/msw/toolbar.h b/Source/3rd Party/wx/include/wx/msw/tbar95.h similarity index 69% rename from Source/3rd Party/wx/include/wx/msw/toolbar.h rename to Source/3rd Party/wx/include/wx/msw/tbar95.h index 9b8334747..4b1d4b66d 100644 --- a/Source/3rd Party/wx/include/wx/msw/toolbar.h +++ b/Source/3rd Party/wx/include/wx/msw/tbar95.h @@ -1,182 +1,156 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/toolbar.h -// Purpose: wxToolBar (Windows 95 toolbar) class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_TBAR95_H_ -#define _WX_MSW_TBAR95_H_ - -#if wxUSE_TOOLBAR - -#include "wx/dynarray.h" -#include "wx/imaglist.h" - -class WXDLLIMPEXP_CORE wxToolBar : public wxToolBarBase -{ -public: - // ctors and dtor - wxToolBar() { Init(); } - - wxToolBar(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxNO_BORDER | wxTB_HORIZONTAL, - const wxString& name = wxToolBarNameStr) - { - Init(); - - Create(parent, id, pos, size, style, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxNO_BORDER | wxTB_HORIZONTAL, - const wxString& name = wxToolBarNameStr); - - virtual ~wxToolBar(); - - // override/implement base class virtuals - virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const; - - virtual bool Realize(); - - virtual void SetToolBitmapSize(const wxSize& size); - virtual wxSize GetToolSize() const; - - virtual void SetRows(int nRows); - - virtual void SetToolNormalBitmap(int id, const wxBitmap& bitmap); - virtual void SetToolDisabledBitmap(int id, const wxBitmap& bitmap); - - // implementation only from now on - // ------------------------------- - - virtual void SetWindowStyleFlag(long style); - - virtual bool MSWCommand(WXUINT param, WXWORD id); - virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); - - void OnMouseEvent(wxMouseEvent& event); - void OnSysColourChanged(wxSysColourChangedEvent& event); - void OnEraseBackground(wxEraseEvent& event); - - void SetFocus() {} - - static WXHBITMAP MapBitmap(WXHBITMAP bitmap, int width, int height); - - // override WndProc mainly to process WM_SIZE - virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); - - virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; - - // returns true if the platform should explicitly apply a theme border - virtual bool CanApplyThemeBorder() const { return false; } - -#ifdef wxHAS_MSW_BACKGROUND_ERASE_HOOK - virtual bool MSWEraseBgHook(WXHDC hDC); - virtual WXHBRUSH MSWGetBgBrushForChild(WXHDC hDC, wxWindowMSW *child); -#endif // wxHAS_MSW_BACKGROUND_ERASE_HOOK - - virtual wxToolBarToolBase *CreateTool(int id, - const wxString& label, - const wxBitmap& bmpNormal, - const wxBitmap& bmpDisabled = wxNullBitmap, - wxItemKind kind = wxITEM_NORMAL, - wxObject *clientData = NULL, - const wxString& shortHelp = wxEmptyString, - const wxString& longHelp = wxEmptyString); - - virtual wxToolBarToolBase *CreateTool(wxControl *control, - const wxString& label); -protected: - // common part of all ctors - void Init(); - - // create the native toolbar control - bool MSWCreateToolbar(const wxPoint& pos, const wxSize& size); - - // recreate the control completely - void Recreate(); - - // implement base class pure virtuals - virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool); - virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool); - - virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable); - virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle); - virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle); - - // return the appropriate size and flags for the toolbar control - virtual wxSize DoGetBestSize() const; - - // handlers for various events - bool HandleSize(WXWPARAM wParam, WXLPARAM lParam); -#ifdef wxHAS_MSW_BACKGROUND_ERASE_HOOK - bool HandlePaint(WXWPARAM wParam, WXLPARAM lParam); -#endif // wxHAS_MSW_BACKGROUND_ERASE_HOOK - void HandleMouseMove(WXWPARAM wParam, WXLPARAM lParam); - - // should be called whenever the toolbar size changes - void UpdateSize(); - - // create m_disabledImgList (but doesn't fill it), set it to NULL if it is - // unneeded - void CreateDisabledImageList(); - - // get the Windows toolbar style of this control - long GetMSWToolbarStyle() const; - - - // the big bitmap containing all bitmaps of the toolbar buttons - WXHBITMAP m_hBitmap; - - // the image list with disabled images, may be NULL if we use - // system-provided versions of them - wxImageList *m_disabledImgList; - - // the total number of toolbar elements - size_t m_nButtons; - - // the sum of the sizes of the fixed items (i.e. excluding stretchable - // spaces) in the toolbar direction - int m_totalFixedSize; - - // the tool the cursor is in - wxToolBarToolBase *m_pInTool; - -private: - // makes sure tool bitmap size is sufficient for all tools - void AdjustToolBitmapSize(); - - // update the sizes of stretchable spacers to consume all extra space we - // have - void UpdateStretchableSpacersSize(); - -#ifdef wxHAS_MSW_BACKGROUND_ERASE_HOOK - // do erase the toolbar background, always do it for the entire control as - // the caller sets the clipping region correctly to exclude parts which - // should not be erased - void MSWDoEraseBackground(WXHDC hDC); - - // return the brush to use for erasing the toolbar background - WXHBRUSH MSWGetToolbarBgBrush(); -#endif // wxHAS_MSW_BACKGROUND_ERASE_HOOK - - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxToolBar) - wxDECLARE_NO_COPY_CLASS(wxToolBar); -}; - -#endif // wxUSE_TOOLBAR - -#endif // _WX_MSW_TBAR95_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/tbar95.h +// Purpose: wxToolBar (Windows 95 toolbar) class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: tbar95.h 58446 2009-01-26 23:32:16Z VS $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_TBAR95_H_ +#define _WX_MSW_TBAR95_H_ + +#if wxUSE_TOOLBAR + +#include "wx/dynarray.h" +#include "wx/imaglist.h" + +class WXDLLEXPORT wxToolBar : public wxToolBarBase +{ +public: + // ctors and dtor + wxToolBar() { Init(); } + + wxToolBar(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxNO_BORDER | wxTB_HORIZONTAL, + const wxString& name = wxToolBarNameStr) + { + Init(); + + Create(parent, id, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxNO_BORDER | wxTB_HORIZONTAL, + const wxString& name = wxToolBarNameStr); + + virtual ~wxToolBar(); + + // override/implement base class virtuals + virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const; + + virtual bool Realize(); + + virtual void SetToolBitmapSize(const wxSize& size); + virtual wxSize GetToolSize() const; + + virtual void SetRows(int nRows); + +#if wxABI_VERSION >= 20802 + // TODO: In 2.9 these should probably be virtual, and declared in the base class... + void SetToolNormalBitmap(int id, const wxBitmap& bitmap); + void SetToolDisabledBitmap(int id, const wxBitmap& bitmap); +#endif + + // implementation only from now on + // ------------------------------- + + virtual void SetWindowStyleFlag(long style); + + virtual bool MSWCommand(WXUINT param, WXWORD id); + virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); + + void OnMouseEvent(wxMouseEvent& event); + void OnSysColourChanged(wxSysColourChangedEvent& event); + void OnEraseBackground(wxEraseEvent& event); + + void SetFocus() {} + + static WXHBITMAP MapBitmap(WXHBITMAP bitmap, int width, int height); + + // override WndProc mainly to process WM_SIZE + virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); + + virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; + +protected: + // common part of all ctors + void Init(); + + // create the native toolbar control + bool MSWCreateToolbar(const wxPoint& pos, const wxSize& size); + + // recreate the control completely + void Recreate(); + + // implement base class pure virtuals + virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool); + virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool); + + virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable); + virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle); + virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle); + + virtual wxToolBarToolBase *CreateTool(int id, + const wxString& label, + const wxBitmap& bmpNormal, + const wxBitmap& bmpDisabled, + wxItemKind kind, + wxObject *clientData, + const wxString& shortHelp, + const wxString& longHelp); + virtual wxToolBarToolBase *CreateTool(wxControl *control); + + // return the appropriate size and flags for the toolbar control + virtual wxSize DoGetBestSize() const; + + // handlers for various events + bool HandleSize(WXWPARAM wParam, WXLPARAM lParam); + bool HandlePaint(WXWPARAM wParam, WXLPARAM lParam); + void HandleMouseMove(WXWPARAM wParam, WXLPARAM lParam); + + // should be called whenever the toolbar size changes + void UpdateSize(); + + // create m_disabledImgList (but doesn't fill it), set it to NULL if it is + // unneeded + void CreateDisabledImageList(); + + // get the Windows toolbar style of this control + long GetMSWToolbarStyle() const; + + + // the big bitmap containing all bitmaps of the toolbar buttons + WXHBITMAP m_hBitmap; + + // the image list with disabled images, may be NULL if we use + // system-provided versions of them + wxImageList *m_disabledImgList; + + // the total number of toolbar elements + size_t m_nButtons; + + // the tool the cursor is in + wxToolBarToolBase *m_pInTool; + +private: + // makes sure tool bitmap size is sufficient for all tools + void AdjustToolBitmapSize(); + + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS(wxToolBar) + DECLARE_NO_COPY_CLASS(wxToolBar) +}; + +#endif // wxUSE_TOOLBAR + +#endif // _WX_MSW_TBAR95_H_ + diff --git a/Source/3rd Party/wx/include/wx/msw/textctrl.h b/Source/3rd Party/wx/include/wx/msw/textctrl.h index 4e9054fc4..5790a7c93 100644 --- a/Source/3rd Party/wx/include/wx/msw/textctrl.h +++ b/Source/3rd Party/wx/include/wx/msw/textctrl.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: textctrl.h 52547 2008-03-15 12:33:04Z VS $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -12,7 +12,7 @@ #ifndef _WX_TEXTCTRL_H_ #define _WX_TEXTCTRL_H_ -class WXDLLIMPEXP_CORE wxTextCtrl : public wxTextCtrlBase +class WXDLLEXPORT wxTextCtrl : public wxTextCtrlBase { public: // creation @@ -41,40 +41,45 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = wxTextCtrlNameStr); - // overridden wxTextEntry methods - // ------------------------------ + // implement base class pure virtuals + // ---------------------------------- virtual wxString GetValue() const; - virtual wxString GetRange(long from, long to) const; - virtual bool IsEmpty() const; - virtual void WriteText(const wxString& text); - virtual void AppendText(const wxString& text); - virtual void Clear(); + virtual wxString GetRange(long from, long to) const; virtual int GetLineLength(long lineNo) const; virtual wxString GetLineText(long lineNo) const; virtual int GetNumberOfLines() const; - virtual void SetMaxLength(unsigned long len); - - virtual void GetSelection(long *from, long *to) const; - - virtual void Redo(); - virtual bool CanRedo() const; - - virtual void SetInsertionPointEnd(); - virtual long GetInsertionPoint() const; - virtual wxTextPos GetLastPosition() const; - - // implement base class pure virtuals - // ---------------------------------- - virtual bool IsModified() const; + virtual bool IsEditable() const; + + virtual void GetSelection(long* from, long* to) const; + + // operations + // ---------- + + // editing + virtual void Clear(); + virtual void Replace(long from, long to, const wxString& value); + virtual void Remove(long from, long to); + + // load the control's contents from the file + virtual bool DoLoadFile(const wxString& file, int fileType); + + // clears the dirty flag virtual void MarkDirty(); virtual void DiscardEdits(); + virtual void SetMaxLength(unsigned long len); + + // writing text inserts it at the current position, appending always + // inserts it at the end + virtual void WriteText(const wxString& text); + virtual void AppendText(const wxString& text); + #ifdef __WIN32__ virtual bool EmulateKeyPress(const wxKeyEvent& event); #endif // __WIN32__ @@ -102,17 +107,39 @@ public: return wxTextCtrlBase::HitTest(pt, col, row); } + // Clipboard operations + virtual void Copy(); + virtual void Cut(); + virtual void Paste(); + + virtual bool CanCopy() const; + virtual bool CanCut() const; + virtual bool CanPaste() const; + + // Undo/redo + virtual void Undo(); + virtual void Redo(); + + virtual bool CanUndo() const; + virtual bool CanRedo() const; + + // Insertion point + virtual void SetInsertionPoint(long pos); + virtual void SetInsertionPointEnd(); + virtual long GetInsertionPoint() const; + virtual wxTextPos GetLastPosition() const; + + virtual void SetSelection(long from, long to); + virtual void SetEditable(bool editable); + // Caret handling (Windows only) + bool ShowNativeCaret(bool show = true); bool HideNativeCaret() { return ShowNativeCaret(false); } // Implementation from now on // -------------------------- -#if wxUSE_DRAG_AND_DROP && wxUSE_RICHEDIT - virtual void SetDropTarget(wxDropTarget *dropTarget); -#endif // wxUSE_DRAG_AND_DROP && wxUSE_RICHEDIT - virtual void SetWindowStyleFlag(long style); virtual void Command(wxCommandEvent& event); @@ -125,11 +152,10 @@ public: int GetRichVersion() const { return m_verRichEdit; } bool IsRich() const { return m_verRichEdit != 0; } - // rich edit controls are not compatible with normal ones and we must set - // the colours and font for them otherwise + // rich edit controls are not compatible with normal ones and wem ust set + // the colours for them otherwise virtual bool SetBackgroundColour(const wxColour& colour); virtual bool SetForegroundColour(const wxColour& colour); - virtual bool SetFont(const wxFont& font); #else bool IsRich() const { return false; } #endif // wxUSE_RICHEDIT @@ -142,10 +168,7 @@ public: virtual void AdoptAttributesFromHWND(); - virtual bool AcceptsFocusFromKeyboard() const; - - // returns true if the platform should explicitly apply a theme border - virtual bool CanApplyThemeBorder() const; + virtual bool AcceptsFocus() const; // callbacks void OnDropFiles(wxDropFilesEvent& event); @@ -180,13 +203,12 @@ public: virtual bool MSWShouldPreProcessMessage(WXMSG* pMsg); virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; + virtual wxVisualAttributes GetDefaultAttributes() const; protected: // common part of all ctors void Init(); - virtual bool DoLoadFile(const wxString& file, int fileType); - // creates the control of appropriate class (plain or rich edit) with the // styles corresponding to m_windowStyle // @@ -198,8 +220,6 @@ protected: virtual void DoSetValue(const wxString &value, int flags = 0); - virtual wxPoint DoPositionToCoords(long pos) const; - // return true if this control has a user-set limit on amount of text (i.e. // the limit is due to a previous call to SetMaxLength() and not built in) bool HasSpaceLimit(unsigned int *len) const; @@ -225,8 +245,11 @@ protected: void DoWriteText(const wxString& text, int flags = SetValue_SendEvent | SetValue_SelectionOnly); - // set the selection (possibly without scrolling the caret into view) - void DoSetSelection(long from, long to, int flags); + // set the selection possibly without scrolling the caret into view + void DoSetSelection(long from, long to, bool scrollCaret = true); + + // return true if there is a non empty selection in the control + bool HasSelection() const; // get the length of the line containing the character at the given // position @@ -238,23 +261,9 @@ protected: virtual wxSize DoGetBestSize() const; #if wxUSE_RICHEDIT - // Apply the character-related parts of wxTextAttr to the given selection - // or the entire control if start == end == -1. - // - // This function is private and should only be called for rich edit - // controls and with (from, to) already in correct order, i.e. from <= to. - bool MSWSetCharFormat(const wxTextAttr& attr, long from = -1, long to = -1); - - // Same as above for paragraph-related parts of wxTextAttr. Note that this - // can only be applied to the selection as RichEdit doesn't support setting - // the paragraph styles globally. - bool MSWSetParaFormat(const wxTextAttr& attr, long from, long to); - - // we're using RICHEDIT (and not simple EDIT) control if this field is not - // 0, it also gives the version of the RICHEDIT control being used - // (although not directly: 1 is for 1.0, 2 is for either 2.0 or 3.0 as we - // can't nor really need to distinguish between them and 4 is for 4.1) + // 0, it also gives the version of the RICHEDIT control being used (1, 2 or + // 3 so far) int m_verRichEdit; #endif // wxUSE_RICHEDIT @@ -263,15 +272,6 @@ protected: int m_updatesCount; private: - virtual void EnableTextChangedEvents(bool enable) - { - m_updatesCount = enable ? -1 : -2; - } - - // implement wxTextEntry pure virtual: it implements all the operations for - // the simple EDIT controls - virtual WXHWND GetEditHWND() const { return m_hWnd; } - void OnKeyDown(wxKeyEvent& event); DECLARE_EVENT_TABLE() @@ -287,4 +287,5 @@ private: }; -#endif // _WX_TEXTCTRL_H_ +#endif + // _WX_TEXTCTRL_H_ diff --git a/Source/3rd Party/wx/include/wx/msw/textentry.h b/Source/3rd Party/wx/include/wx/msw/textentry.h deleted file mode 100644 index f7154f306..000000000 --- a/Source/3rd Party/wx/include/wx/msw/textentry.h +++ /dev/null @@ -1,101 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/textentry.h -// Purpose: wxMSW-specific wxTextEntry implementation -// Author: Vadim Zeitlin -// Created: 2007-09-26 -// RCS-ID: $Id$ -// Copyright: (c) 2007 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_TEXTENTRY_H_ -#define _WX_MSW_TEXTENTRY_H_ - -class wxTextAutoCompleteData; // private class used only by wxTextEntry itself - -// ---------------------------------------------------------------------------- -// wxTextEntry: common part of wxComboBox and (single line) wxTextCtrl -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxTextEntry : public wxTextEntryBase -{ -public: - wxTextEntry(); - virtual ~wxTextEntry(); - - // implement wxTextEntryBase pure virtual methods - virtual void WriteText(const wxString& text); - virtual void Remove(long from, long to); - - virtual void Copy(); - virtual void Cut(); - virtual void Paste(); - - virtual void Undo(); - virtual void Redo(); - virtual bool CanUndo() const; - virtual bool CanRedo() const; - - virtual void SetInsertionPoint(long pos); - virtual long GetInsertionPoint() const; - virtual long GetLastPosition() const; - - virtual void SetSelection(long from, long to) - { DoSetSelection(from, to); } - virtual void GetSelection(long *from, long *to) const; - - virtual bool IsEditable() const; - virtual void SetEditable(bool editable); - - virtual void SetMaxLength(unsigned long len); - -#if wxUSE_UXTHEME - virtual bool SetHint(const wxString& hint); - virtual wxString GetHint() const; -#endif // wxUSE_UXTHEME - -protected: - virtual wxString DoGetValue() const; - - // this is really a hook for multiline text controls as the single line - // ones don't need to ever scroll to show the selection but having it here - // allows us to put Remove() in the base class - enum - { - SetSel_NoScroll = 0, // don't do anything special - SetSel_Scroll = 1 // default: scroll to make the selection visible - }; - virtual void DoSetSelection(long from, long to, int flags = SetSel_Scroll); - - // margins functions - virtual bool DoSetMargins(const wxPoint& pt); - virtual wxPoint DoGetMargins() const; - - // auto-completion uses COM under Windows so they won't work without - // wxUSE_OLE as OleInitialize() is not called then -#if wxUSE_OLE - virtual bool DoAutoCompleteStrings(const wxArrayString& choices); - virtual bool DoAutoCompleteFileNames(int flags); - virtual bool DoAutoCompleteCustom(wxTextCompleter *completer); -#endif // wxUSE_OLE - -private: - // implement this to return the HWND of the EDIT control - virtual WXHWND GetEditHWND() const = 0; - -#if wxUSE_OLE - // Get the auto-complete object creating it if necessary. Returns NULL if - // creating it failed. - wxTextAutoCompleteData *GetOrCreateCompleter(); - - // Various auto-completion-related stuff, only used if any of AutoComplete() - // methods are called. Use the function above to access it. - wxTextAutoCompleteData *m_autoCompleteData; - - // It needs to call our GetEditableWindow() and GetEditHWND() methods. - friend class wxTextAutoCompleteData; -#endif // wxUSE_OLE -}; - -#endif // _WX_MSW_TEXTENTRY_H_ - diff --git a/Source/3rd Party/wx/include/wx/msw/tglbtn.h b/Source/3rd Party/wx/include/wx/msw/tglbtn.h index 9656dbf8f..ae45202c2 100644 --- a/Source/3rd Party/wx/include/wx/msw/tglbtn.h +++ b/Source/3rd Party/wx/include/wx/msw/tglbtn.h @@ -5,21 +5,21 @@ // Author: John Norris, minor changes by Axel Schlueter // Modified by: // Created: 08.02.01 -// RCS-ID: $Id$ +// RCS-ID: $Id: tglbtn.h 37393 2006-02-08 21:47:09Z VZ $ // Copyright: (c) 2000 Johnny C. Norris II -// Licence: wxWindows licence +// License: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_TOGGLEBUTTON_H_ #define _WX_TOGGLEBUTTON_H_ -#include "wx/bitmap.h" +extern WXDLLEXPORT_DATA(const wxChar) wxCheckBoxNameStr[]; // Checkbox item (single checkbox) -class WXDLLIMPEXP_CORE wxToggleButton : public wxToggleButtonBase +class WXDLLEXPORT wxToggleButton : public wxControl { public: - wxToggleButton() { Init(); } + wxToggleButton() {} wxToggleButton(wxWindow *parent, wxWindowID id, const wxString& label, @@ -46,66 +46,15 @@ public: virtual bool MSWCommand(WXUINT param, WXWORD id); virtual void Command(wxCommandEvent& event); - - virtual State GetNormalState() const; - - // returns true if the platform should explicitly apply a theme border - virtual bool CanApplyThemeBorder() const { return false; } - -protected: - virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } - virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const; - void Init(); - - // current state of the button (when owner-drawn) - bool m_state; +protected: + virtual wxSize DoGetBestSize() const; + virtual wxBorder GetDefaultBorder() const; private: DECLARE_DYNAMIC_CLASS_NO_COPY(wxToggleButton) }; -//----------------------------------------------------------------------------- -// wxBitmapToggleButton -//----------------------------------------------------------------------------- - - -class WXDLLIMPEXP_CORE wxBitmapToggleButton: public wxToggleButton -{ -public: - // construction/destruction - wxBitmapToggleButton() {} - wxBitmapToggleButton(wxWindow *parent, - wxWindowID id, - const wxBitmap& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxCheckBoxNameStr) - { - Create(parent, id, label, pos, size, style, validator, name); - } - - // Create the control - bool Create(wxWindow *parent, - wxWindowID id, - const wxBitmap& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxCheckBoxNameStr); - - // deprecated synonym for SetBitmapLabel() - wxDEPRECATED_INLINE( void SetLabel(const wxBitmap& bitmap), - SetBitmapLabel(bitmap); ) - // prevent virtual function hiding - virtual void SetLabel(const wxString& label) { wxToggleButton::SetLabel(label); } - -private: - DECLARE_DYNAMIC_CLASS(wxBitmapToggleButton) -}; - #endif // _WX_TOGGLEBUTTON_H_ diff --git a/Source/3rd Party/wx/include/wx/msw/timer.h b/Source/3rd Party/wx/include/wx/msw/timer.h new file mode 100644 index 000000000..449543300 --- /dev/null +++ b/Source/3rd Party/wx/include/wx/msw/timer.h @@ -0,0 +1,40 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: timer.h +// Purpose: wxTimer class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: timer.h 41020 2006-09-05 20:47:48Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TIMER_H_ +#define _WX_TIMER_H_ + +class WXDLLEXPORT wxTimer : public wxTimerBase +{ +friend void wxProcessTimer(wxTimer& timer); + +public: + wxTimer() { Init(); } + wxTimer(wxEvtHandler *owner, int id = wxID_ANY) : wxTimerBase(owner, id) + { Init(); } + virtual ~wxTimer(); + + virtual bool Start(int milliseconds = -1, bool oneShot = false); + virtual void Stop(); + + virtual bool IsRunning() const { return m_id != 0; } + +protected: + void Init(); + + unsigned long m_id; + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxTimer) +}; + +#endif + // _WX_TIMERH_ diff --git a/Source/3rd Party/wx/include/wx/msw/tooltip.h b/Source/3rd Party/wx/include/wx/msw/tooltip.h index 7972c0833..3e623a39a 100644 --- a/Source/3rd Party/wx/include/wx/msw/tooltip.h +++ b/Source/3rd Party/wx/include/wx/msw/tooltip.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 31.01.99 -// RCS-ID: $Id$ +// RCS-ID: $Id: tooltip.h 49563 2007-10-31 20:46:21Z VZ $ // Copyright: (c) 1999 Robert Roebling, Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -13,23 +13,16 @@ #define _WX_MSW_TOOLTIP_H_ #include "wx/object.h" -#include "wx/gdicmn.h" class WXDLLIMPEXP_FWD_CORE wxWindow; -class wxToolTipOtherWindows; -class WXDLLIMPEXP_CORE wxToolTip : public wxObject +class WXDLLEXPORT wxToolTip : public wxObject { public: // ctor & dtor wxToolTip(const wxString &tip); virtual ~wxToolTip(); - // ctor used by wxStatusBar to associate a tooltip to a portion of - // the status bar window: - wxToolTip(wxWindow* win, unsigned int id, - const wxString &tip, const wxRect& rc); - // accessors // tip text void SetTip(const wxString& tip); @@ -44,44 +37,20 @@ public: static void Enable(bool flag); // set the delay after which the tooltip appears static void SetDelay(long milliseconds); - // set the delay after which the tooltip disappears or how long the - // tooltip remains visible - static void SetAutoPop(long milliseconds); - // set the delay between subsequent tooltips to appear - static void SetReshow(long milliseconds); - // set maximum width for the new tooltips: -1 disables wrapping - // entirely, 0 restores the default behaviour - static void SetMaxWidth(int width); // implementation only from now on // ------------------------------- - // should be called in response to WM_MOUSEMOVE + // should be called in responde to WM_MOUSEMOVE static void RelayEvent(WXMSG *msg); // add a window to the tooltip control - void AddOtherWindow(WXHWND hwnd); + void Add(WXHWND hwnd); // remove any tooltip from the window - static void Remove(WXHWND hwnd, unsigned int id, const wxRect& rc); - - // Set the rectangle we're associated with. This rectangle is only used for - // the main window, not any sub-windows added with Add() so in general it - // makes sense to use it for tooltips associated with a single window only. - void SetRect(const wxRect& rc); + static void Remove(WXHWND hwnd); private: - // Adds a window other than our main m_window to this tooltip. - void DoAddHWND(WXHWND hWnd); - - // Perform the specified operation for the given window only. - void DoSetTip(WXHWND hWnd); - void DoRemove(WXHWND hWnd); - - // Call the given function for all windows we're associated with. - void DoForAllWindows(void (wxToolTip::*func)(WXHWND)); - - // the one and only one tooltip control we use - never access it directly // but use GetToolTipCtrl() which will create it when needed static WXHWND ms_hwndTT; @@ -89,21 +58,14 @@ private: // create the tooltip ctrl if it doesn't exist yet and return its HWND static WXHWND GetToolTipCtrl(); - // new tooltip maximum width, defaults to min(display width, 400) - static int ms_maxWidth; - // remove this tooltip from the tooltip control void Remove(); wxString m_text; // tooltip text - wxWindow* m_window; // main window we're associated with - wxToolTipOtherWindows *m_others; // other windows associated with it or NULL - wxRect m_rect; // the rect of the window for which this tooltip is shown - // (or a rect with width/height == 0 to show it for the entire window) - unsigned int m_id; // the id of this tooltip (ignored when m_rect width/height is 0) + wxWindow *m_window; // window we're associated with DECLARE_ABSTRACT_CLASS(wxToolTip) - wxDECLARE_NO_COPY_CLASS(wxToolTip); + DECLARE_NO_COPY_CLASS(wxToolTip) }; #endif // _WX_MSW_TOOLTIP_H_ diff --git a/Source/3rd Party/wx/include/wx/msw/toplevel.h b/Source/3rd Party/wx/include/wx/msw/toplevel.h index b51f57b39..30ddeeda9 100644 --- a/Source/3rd Party/wx/include/wx/msw/toplevel.h +++ b/Source/3rd Party/wx/include/wx/msw/toplevel.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 20.09.01 -// RCS-ID: $Id$ +// RCS-ID: $Id: toplevel.h 50999 2008-01-03 01:13:44Z VZ $ // Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -16,7 +16,7 @@ // wxTopLevelWindowMSW // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxTopLevelWindowMSW : public wxTopLevelWindowBase +class WXDLLEXPORT wxTopLevelWindowMSW : public wxTopLevelWindowBase { public: // constructors and such @@ -52,17 +52,19 @@ public: virtual bool IsMaximized() const; virtual void Iconize(bool iconize = true); virtual bool IsIconized() const; + virtual void SetIcon(const wxIcon& icon); virtual void SetIcons(const wxIconBundle& icons ); virtual void Restore(); - + virtual void SetLayoutDirection(wxLayoutDirection dir); +#ifndef __WXWINCE__ + virtual bool SetShape(const wxRegion& region); +#endif // __WXWINCE__ virtual void RequestUserAttention(int flags = wxUSER_ATTENTION_INFO); virtual bool Show(bool show = true); - virtual void Raise(); - virtual void ShowWithoutActivating(); virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL); virtual bool IsFullScreen() const { return m_fsIsShowing; } @@ -74,20 +76,7 @@ public: virtual bool SetTransparent(wxByte alpha); virtual bool CanSetTransparent(); - - // MSW-specific methods - // -------------------- - - // Return the menu representing the "system" menu of the window. You can - // call wxMenu::AppendWhatever() methods on it but removing items from it - // is in general not a good idea. - // - // The pointer returned by this method belongs to the window and will be - // deleted when the window itself is, do not delete it yourself. May return - // NULL if getting the system menu failed. - wxMenu *MSWGetSystemMenu() const; - - + // implementation from now on // -------------------------- @@ -119,9 +108,6 @@ public: // window proc for the frames WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam); - // returns true if the platform should explicitly apply a theme border - virtual bool CanApplyThemeBorder() const { return false; } - protected: // common part of all ctors void Init(); @@ -141,30 +127,6 @@ protected: // common part of Iconize(), Maximize() and Restore() void DoShowWindow(int nShowCmd); - // override those to return the normal window coordinates even when the - // window is minimized -#ifndef __WXWINCE__ - virtual void DoGetPosition(int *x, int *y) const; - virtual void DoGetSize(int *width, int *height) const; -#endif // __WXWINCE__ - - // Top level windows have different freeze semantics on Windows - virtual void DoFreeze(); - virtual void DoThaw(); - - // helper of SetIcons(): calls gets the icon with the size specified by the - // given system metrics (SM_C{X|Y}[SM]ICON) from the bundle and sets it - // using WM_SETICON with the specified wParam (ICOM_SMALL or ICON_BIG); - // returns true if the icon was set - bool DoSelectAndSetIcon(const wxIconBundle& icons, int smX, int smY, int i); - - // override wxWindow virtual method to use CW_USEDEFAULT if necessary - virtual void MSWGetCreateWindowCoords(const wxPoint& pos, - const wxSize& size, - int& x, int& y, - int& w, int& h) const; - - // is the window currently iconized? bool m_iconized; @@ -179,16 +141,7 @@ protected: bool m_fsIsMaximized; bool m_fsIsShowing; - // Save the current focus to m_winLastFocused if we're not iconized (the - // focus is always NULL when we're iconized). - void DoSaveLastFocus(); - - // Restore focus to m_winLastFocused if possible and needed. - void DoRestoreLastFocus(); - - // The last focused child: we remember it when we're deactivated and - // restore focus to it when we're activated (this is done here) or restored - // from iconic state (done by wxFrame). + // the last focused child: we restore focus to it on activation wxWindow *m_winLastFocused; #if defined(__SMARTPHONE__) && defined(__WXWINCE__) @@ -227,17 +180,18 @@ protected: #endif // __SMARTPHONE__ && __WXWINCE__ private: + // helper of SetIcons(): calls gets the icon with the size specified by the + // given system metrics (SM_C{X|Y}[SM]ICON) from the bundle and sets it + // using WM_SETICON with the specified wParam (ICOM_SMALL or ICON_BIG) + void DoSelectAndSetIcon(const wxIconBundle& icons, int smX, int smY, int i); + #if defined(__SMARTPHONE__) || defined(__POCKETPC__) void* m_activateInfo; #endif - // The system menu: initially NULL but can be set (once) by - // MSWGetSystemMenu(). Owned by this window. - wxMenu *m_menuSystem; - DECLARE_EVENT_TABLE() - wxDECLARE_NO_COPY_CLASS(wxTopLevelWindowMSW); + DECLARE_NO_COPY_CLASS(wxTopLevelWindowMSW) }; #endif // _WX_MSW_TOPLEVEL_H_ diff --git a/Source/3rd Party/wx/include/wx/msw/treectrl.h b/Source/3rd Party/wx/include/wx/msw/treectrl.h index 09f4c3e1d..d3a6a2e35 100644 --- a/Source/3rd Party/wx/include/wx/msw/treectrl.h +++ b/Source/3rd Party/wx/include/wx/msw/treectrl.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: Vadim Zeitlin to be less MSW-specific on 10/10/98 // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: treectrl.h 49563 2007-10-31 20:46:21Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -50,7 +50,7 @@ WX_DECLARE_EXPORTED_VOIDPTR_HASH_MAP(wxTreeItemAttr *, wxMapTreeAttr); // wxTreeCtrl // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxTreeCtrl : public wxTreeCtrlBase +class WXDLLEXPORT wxTreeCtrl : public wxTreeCtrlBase { public: // creation @@ -127,11 +127,6 @@ public: virtual wxTreeItemId GetRootItem() const; virtual wxTreeItemId GetSelection() const; virtual size_t GetSelections(wxArrayTreeItemIds& selections) const; - virtual wxTreeItemId GetFocusedItem() const; - - virtual void ClearFocusedItem(); - virtual void SetFocusedItem(const wxTreeItemId& item); - virtual wxTreeItemId GetItemParent(const wxTreeItemId& item) const; virtual wxTreeItemId GetFirstChild(const wxTreeItemId& item, @@ -166,13 +161,12 @@ public: virtual void Unselect(); virtual void UnselectAll(); virtual void SelectItem(const wxTreeItemId& item, bool select = true); - virtual void SelectChildren(const wxTreeItemId& parent); virtual void EnsureVisible(const wxTreeItemId& item); virtual void ScrollTo(const wxTreeItemId& item); virtual wxTextCtrl *EditLabel(const wxTreeItemId& item, - wxClassInfo* textCtrlClass = wxCLASSINFO(wxTextCtrl)); + wxClassInfo* textCtrlClass = CLASSINFO(wxTextCtrl)); virtual wxTextCtrl *GetEditControl() const; virtual void EndEditLabel(const wxTreeItemId& WXUNUSED(item), bool discardChanges = false) @@ -186,6 +180,34 @@ public: wxRect& rect, bool textOnly = false) const; + // deprecated + // ---------- + +#if WXWIN_COMPATIBILITY_2_4 + // these methods are deprecated and will be removed in future versions of + // wxWidgets, they're here for compatibility only, don't use them in new + // code (the comments indicate why these methods are now useless and how to + // replace them) + + // use Expand, Collapse, CollapseAndReset or Toggle + wxDEPRECATED( void ExpandItem(const wxTreeItemId& item, int action) ); + + // use Set/GetImageList and Set/GetStateImageList + // Use base class GetImageList() + wxDEPRECATED( void SetImageList(wxImageList *imageList, int) ); + + // use Set/GetItemImage directly + wxDEPRECATED( int GetItemSelectedImage(const wxTreeItemId& item) const ); + wxDEPRECATED( void SetItemSelectedImage(const wxTreeItemId& item, int image) ); + + // use the versions taking wxTreeItemIdValue cookies + wxDEPRECATED( wxTreeItemId GetFirstChild(const wxTreeItemId& item, + long& cookie) const ); + wxDEPRECATED( wxTreeItemId GetNextChild(const wxTreeItemId& item, + long& cookie) const ); +#endif // WXWIN_COMPATIBILITY_2_4 + + // implementation // -------------- @@ -208,8 +230,13 @@ public: virtual bool SetBackgroundColour(const wxColour &colour); virtual bool SetForegroundColour(const wxColour &colour); - // returns true if the platform should explicitly apply a theme border - virtual bool CanApplyThemeBorder() const { return false; } + // get/set the check state for the item (only for wxTR_MULTIPLE) + bool IsItemChecked(const wxTreeItemId& item) const; + void SetItemCheck(const wxTreeItemId& item, bool check = true); + + // set/get the item state.image (state == -1 means cycle to the next one) + void SetState(const wxTreeItemId& node, int state); + int GetState(const wxTreeItemId& node); protected: // SetImageList helper @@ -221,9 +248,6 @@ protected: // end edit label void DoEndEditLabel(bool discardChanges = false); - virtual int DoGetItemState(const wxTreeItemId& item) const; - virtual void DoSetItemState(const wxTreeItemId& item, int state); - virtual wxTreeItemId DoInsertItem(const wxTreeItemId& parent, size_t pos, const wxString& text, @@ -239,28 +263,6 @@ protected: // obtain the user data for the lParam member of TV_ITEM class wxTreeItemParam *GetItemParam(const wxTreeItemId& item) const; - // update the event to include the items client data and pass it to - // HandleWindowEvent(), return true if it processed it - bool HandleTreeEvent(wxTreeEvent& event) const; - - // pass the event to HandleTreeEvent() and return true if the event was - // either unprocessed or not vetoed - bool IsTreeEventAllowed(wxTreeEvent& event) const - { - return !HandleTreeEvent(event) || event.IsAllowed(); - } - - // generate a wxEVT_KEY_DOWN event from the specified WPARAM/LPARAM values - // having the same meaning as for WM_KEYDOWN, return true if it was - // processed - bool MSWHandleTreeKeyDownEvent(WXWPARAM wParam, WXLPARAM lParam); - - // handle a key event in a multi-selection control, should be only called - // for keys which can be used to change the selection - // - // return true if the key was processed, false otherwise - bool MSWHandleSelectionKey(unsigned vkey); - // data used only while editing the item label: wxTextCtrl *m_textCtrl; // text control in which it is edited @@ -276,13 +278,6 @@ private: void DoExpand(const wxTreeItemId& item, int flag); - void DoSelectItem(const wxTreeItemId& item, bool select = true); - void DoUnselectItem(const wxTreeItemId& item); - void DoToggleItemSelection(const wxTreeItemId& item); - - void DoUnselectAll(); - void DoSelectChildren(const wxTreeItemId& parent); - void DeleteTextCtrl(); // return true if the item is the hidden root one (i.e. it's the root item @@ -290,14 +285,6 @@ private: bool IsHiddenRoot(const wxTreeItemId& item) const; - // check if the given flags (taken from TV_HITTESTINFO structure) - // indicate a position "on item": this is less trivial than just checking - // for TVHT_ONITEM because we consider that points to the left and right of - // item text are also "on item" when wxTR_FULL_ROW_HIGHLIGHT is used as the - // item visually spans the entire breadth of the window then - bool MSWIsOnItem(unsigned flags) const; - - // the hash storing the items attributes (indexed by item ids) wxMapTreeAttr m_attrs; @@ -316,27 +303,11 @@ private: wxTreeItemId m_htSelStart, m_htClickedItem; wxPoint m_ptClick; - // whether dragging has started - bool m_dragStarted; - - // whether focus was lost between subsequent clicks of a single item - bool m_focusLost; - - // set when we are changing selection ourselves (only used in multi - // selection mode) - bool m_changingSelection; - - // whether we need to trigger a state image click event - bool m_triggerStateImageClick; - - // whether we need to deselect other items on mouse up - bool m_mouseUpDeselect; - friend class wxTreeItemIndirectData; friend class wxTreeSortHelper; DECLARE_DYNAMIC_CLASS(wxTreeCtrl) - wxDECLARE_NO_COPY_CLASS(wxTreeCtrl); + DECLARE_NO_COPY_CLASS(wxTreeCtrl) }; #endif // wxUSE_TREECTRL diff --git a/Source/3rd Party/wx/include/wx/msw/uxtheme.h b/Source/3rd Party/wx/include/wx/msw/uxtheme.h index d95eeac01..23e745fc9 100644 --- a/Source/3rd Party/wx/include/wx/msw/uxtheme.h +++ b/Source/3rd Party/wx/include/wx/msw/uxtheme.h @@ -1,12 +1,12 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/uxtheme.h +// Name: include/wx/msw/uxtheme.h // Purpose: wxUxThemeEngine class: support for XP themes // Author: John Platts, Vadim Zeitlin // Modified by: // Created: 2003 -// RCS-ID: $Id$ +// RCS-ID: $Id: uxtheme.h 42725 2006-10-30 15:37:42Z VZ $ // Copyright: (c) 2003 John Platts, Vadim Zeitlin -// Licence: wxWindows licence +// License: wxWindows licence /////////////////////////////////////////////////////////////////////////////// #ifndef _WX_UXTHEME_H_ @@ -17,74 +17,6 @@ #include "wx/msw/private.h" // we use GetHwndOf() #include "wx/msw/uxthemep.h" -// Amazingly, GetThemeFont() and GetThemeSysFont() functions use LOGFONTA under -// XP but LOGFONTW (even in non-Unicode build) under later versions of Windows. -// If we declare them as taking LOGFONT below, the code would be able to -// silently pass LOGFONTA to them in ANSI build and would crash at run-time -// under Windows Vista/7 because of a buffer overrun (LOGFONTA being smaller -// than LOGFONTW expected by these functions). If we we declare them as taking -// LOGFONTW, the code wouldn't work correctly under XP. So we use a special -// wxUxThemeFont class to encapsulate this and intentionally change the LOGFONT -// output parameters of the theme functions to take it instead. - -class wxUxThemeFont -{ -public: - // Trivial default ctor. - wxUxThemeFont() { } - - // Just some unique type. - struct Ptr { }; - -#if wxUSE_UNICODE - // In Unicode build we always use LOGFONT anyhow so this class is - // completely trivial. - Ptr *GetPtr() { return reinterpret_cast(&m_lfW); } - const LOGFONTW& GetLOGFONT() { return m_lfW; } -#else // !wxUSE_UNICODE - // Return either LOGFONTA or LOGFONTW pointer as required by the current - // Windows version. - Ptr *GetPtr() - { - return UseLOGFONTW() ? reinterpret_cast(&m_lfW) - : reinterpret_cast(&m_lfA); - } - - // This method returns LOGFONT (i.e. LOGFONTA in ANSI build and LOGFONTW in - // Unicode one) which can be used with other, normal, Windows or wx - // functions. Internally it may need to transform LOGFONTW to LOGFONTA. - const LOGFONTA& GetLOGFONT() - { - if ( UseLOGFONTW() ) - { - // Most of the fields are the same in LOGFONTA and LOGFONTW so just - // copy everything by default. - memcpy(&m_lfA, &m_lfW, sizeof(m_lfA)); - - // But the face name must be converted from Unicode. - WideCharToMultiByte(CP_ACP, 0, m_lfW.lfFaceName, -1, - m_lfA.lfFaceName, sizeof(m_lfA.lfFaceName), - NULL, NULL); - } - - return m_lfA; - } - -private: - static bool UseLOGFONTW() - { - return wxGetWinVersion() >= wxWinVersion_Vista; - } - - LOGFONTA m_lfA; -#endif // wxUSE_UNICODE/!wxUSE_UNICODE - -private: - LOGFONTW m_lfW; - - wxDECLARE_NO_COPY_CLASS(wxUxThemeFont); -}; - typedef HTHEME (__stdcall *PFNWXUOPENTHEMEDATA)(HWND, const wchar_t *); typedef HRESULT (__stdcall *PFNWXUCLOSETHEMEDATA)(HTHEME); typedef HRESULT (__stdcall *PFNWXUDRAWTHEMEBACKGROUND)(HTHEME, HDC, int, int, const RECT *, const RECT *); @@ -107,7 +39,7 @@ typedef HRESULT (__stdcall *PFNWXUGETTHEMEBOOL)(HTHEME, int, int, int, BOOL *); typedef HRESULT (__stdcall *PFNWXUGETTHEMEINT)(HTHEME, int, int, int, int *); typedef HRESULT (__stdcall *PFNWXUGETTHEMEENUMVALUE)(HTHEME, int, int, int, int *); typedef HRESULT (__stdcall *PFNWXUGETTHEMEPOSITION)(HTHEME, int, int, int, POINT *); -typedef HRESULT (__stdcall *PFNWXUGETTHEMEFONT)(HTHEME, HDC, int, int, int, wxUxThemeFont::Ptr *); +typedef HRESULT (__stdcall *PFNWXUGETTHEMEFONT)(HTHEME, HDC, int, int, int, LOGFONT *); typedef HRESULT (__stdcall *PFNWXUGETTHEMERECT)(HTHEME, int, int, int, RECT *); typedef HRESULT (__stdcall *PFNWXUGETTHEMEMARGINS)(HTHEME, HDC, int, int, int, RECT *, MARGINS *); typedef HRESULT (__stdcall *PFNWXUGETTHEMEINTLIST)(HTHEME, int, int, int, INTLIST*); @@ -118,7 +50,7 @@ typedef COLORREF(__stdcall *PFNWXUGETTHEMESYSCOLOR)(HTHEME, int); typedef HBRUSH (__stdcall *PFNWXUGETTHEMESYSCOLORBRUSH)(HTHEME, int); typedef BOOL (__stdcall *PFNWXUGETTHEMESYSBOOL)(HTHEME, int); typedef int (__stdcall *PFNWXUGETTHEMESYSSIZE)(HTHEME, int); -typedef HRESULT (__stdcall *PFNWXUGETTHEMESYSFONT)(HTHEME, int, wxUxThemeFont::Ptr *); +typedef HRESULT (__stdcall *PFNWXUGETTHEMESYSFONT)(HTHEME, int, LOGFONT *); typedef HRESULT (__stdcall *PFNWXUGETTHEMESYSSTRING)(HTHEME, int, wchar_t *, int); typedef HRESULT (__stdcall *PFNWXUGETTHEMESYSINT)(HTHEME, int, int *); typedef BOOL (__stdcall *PFNWXUISTHEMEACTIVE)(); @@ -147,7 +79,7 @@ typedef HRESULT (__stdcall *PFNWXUENABLETHEMING)(BOOL); #define wxUX_THEME_DECLARE(type, func) type func(...) { return 0; } #endif -class WXDLLIMPEXP_CORE wxUxThemeEngine +class WXDLLEXPORT wxUxThemeEngine { public: // get the theme engine or NULL if themes are not available @@ -236,7 +168,7 @@ private: friend class wxUxThemeModule; #endif // wxUSE_UXTHEME - wxDECLARE_NO_COPY_CLASS(wxUxThemeEngine); + DECLARE_NO_COPY_CLASS(wxUxThemeEngine) }; #if wxUSE_UXTHEME @@ -291,7 +223,7 @@ public: private: HTHEME m_hTheme; - wxDECLARE_NO_COPY_CLASS(wxUxThemeHandle); + DECLARE_NO_COPY_CLASS(wxUxThemeHandle) }; #endif // _WX_UXTHEME_H_ diff --git a/Source/3rd Party/wx/include/wx/msw/uxthemep.h b/Source/3rd Party/wx/include/wx/msw/uxthemep.h index 6f52b694a..bc2fda91d 100644 --- a/Source/3rd Party/wx/include/wx/msw/uxthemep.h +++ b/Source/3rd Party/wx/include/wx/msw/uxthemep.h @@ -4,9 +4,9 @@ * Copyright (C) 2003 Kevin Koltzau * * Originally written for the Wine project, and issued under - * the wxWindows licence by kind permission of the author. + * the wxWindows License by kind permission of the author. * - * Licence: wxWindows licence + * License: wxWindows License */ #ifndef __WINE_UXTHEME_H diff --git a/Source/3rd Party/wx/include/wx/msw/window.h b/Source/3rd Party/wx/include/wx/msw/window.h index 22c3147ad..b765ac1db 100644 --- a/Source/3rd Party/wx/include/wx/msw/window.h +++ b/Source/3rd Party/wx/include/wx/msw/window.h @@ -5,7 +5,7 @@ // Modified by: Vadim Zeitlin on 13.05.99: complete refont of message handling, // elimination of Default(), ... // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: window.h 53929 2008-06-02 18:27:16Z RD $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -13,23 +13,24 @@ #ifndef _WX_WINDOW_H_ #define _WX_WINDOW_H_ -#include "wx/settings.h" // solely for wxSystemColour +// --------------------------------------------------------------------------- +// constants +// --------------------------------------------------------------------------- -// if this is set to 1, we use deferred window sizing to reduce flicker when -// resizing complicated window hierarchies, but this can in theory result in -// different behaviour than the old code so we keep the possibility to use it -// by setting this to 0 (in the future this should be removed completely) -#ifdef __WXWINCE__ - #define wxUSE_DEFERRED_SIZING 0 -#else - #define wxUSE_DEFERRED_SIZING 1 +#if WXWIN_COMPATIBILITY_2_4 +// they're unused by wxWidgets... +enum +{ + wxKEY_SHIFT = 1, + wxKEY_CTRL = 2 +}; #endif // --------------------------------------------------------------------------- // wxWindow declaration for MSW // --------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxWindowMSW : public wxWindowBase +class WXDLLEXPORT wxWindowMSW : public wxWindowBase { friend class wxSpinCtrl; friend class wxSlider; @@ -67,17 +68,8 @@ public: virtual void Raise(); virtual void Lower(); - virtual bool Show(bool show = true); - virtual bool ShowWithEffect(wxShowEffect effect, - unsigned timeout = 0) - { - return MSWShowWithEffect(true, effect, timeout); - } - virtual bool HideWithEffect(wxShowEffect effect, - unsigned timeout = 0) - { - return MSWShowWithEffect(false, effect, timeout); - } + virtual bool Show( bool show = true ); + virtual bool Enable( bool enable = true ); virtual void SetFocus(); virtual void SetFocusFromKbd(); @@ -89,6 +81,9 @@ public: virtual void Refresh( bool eraseBackground = true, const wxRect *rect = (const wxRect *) NULL ); virtual void Update(); + virtual void Freeze(); + virtual void Thaw(); + virtual bool IsFrozen() const { return m_frozenness > 0; } virtual void SetWindowStyleFlag(long style); virtual void SetExtraStyle(long exStyle); @@ -97,6 +92,12 @@ public: virtual int GetCharHeight() const; virtual int GetCharWidth() const; + virtual void GetTextExtent(const wxString& string, + int *x, int *y, + int *descent = (int *) NULL, + int *externalLeading = (int *) NULL, + const wxFont *theFont = (const wxFont *) NULL) + const; virtual void SetScrollbar( int orient, int pos, int thumbVisible, int range, bool refresh = true ); @@ -105,7 +106,7 @@ public: virtual int GetScrollThumb( int orient ) const; virtual int GetScrollRange( int orient ) const; virtual void ScrollWindow( int dx, int dy, - const wxRect* rect = NULL ); + const wxRect* rect = (wxRect *) NULL ); virtual bool ScrollLines(int lines); virtual bool ScrollPages(int pages); @@ -123,6 +124,12 @@ public: // Accept files for dragging virtual void DragAcceptFiles(bool accept); +#if WXWIN_COMPATIBILITY_2_4 + wxDEPRECATED( bool GetUseCtl3D() const ); + wxDEPRECATED( bool GetTransparentBackground() const ); + wxDEPRECATED( void SetTransparent(bool t = true) ); +#endif // WXWIN_COMPATIBILITY_2_4 + #ifndef __WXUNIVERSAL__ // Native resource loading (implemented in src/msw/nativdlg.cpp) // FIXME: should they really be all virtual? @@ -156,29 +163,6 @@ public: // does this window have deferred position and/or size? bool IsSizeDeferred() const; - // these functions allow to register a global handler for the given Windows - // message: it will be called from MSWWindowProc() of any window which gets - // this event if it's not processed before (i.e. unlike a hook procedure it - // does not override the normal processing) - // - // notice that if you want to process a message for a given window only you - // should override its MSWWindowProc() instead - - // type of the handler: it is called with the message parameters (except - // that the window object is passed instead of window handle) and should - // return true if it handled the message or false if it should be passed to - // DefWindowProc() - typedef bool (*MSWMessageHandler)(wxWindowMSW *win, - WXUINT nMsg, - WXWPARAM wParam, - WXLPARAM lParam); - - // install a handler, shouldn't be called more than one for the same message - static bool MSWRegisterMessageHandler(int msg, MSWMessageHandler handler); - - // unregister a previously registered handler - static void MSWUnregisterMessageHandler(int msg, MSWMessageHandler handler); - // implementation from now on // ========================== @@ -187,6 +171,7 @@ public: // -------------- void OnPaint(wxPaintEvent& event); + void OnEraseBackground(wxEraseEvent& event); #ifdef __WXWINCE__ void OnInitDialog(wxInitDialogEvent& event); #endif @@ -234,12 +219,24 @@ public: // created yet) void MSWUpdateStyle(long flagsOld, long exflagsOld); +#if wxABI_VERSION >= 20805 + // Helper for getting an appropriate theme style for the application. Unnecessary in + // 2.9 and above. + wxBorder GetThemedBorderStyle() const; +#endif + + // translate wxWidgets coords into Windows ones suitable to be passed to + // ::CreateWindow() + // + // returns true if non default coords are returned, false otherwise + bool MSWGetCreateWindowCoords(const wxPoint& pos, + const wxSize& size, + int& x, int& y, + int& w, int& h) const; + // get the HWND to be used as parent of this window with CreateWindow() virtual WXHWND MSWGetParent() const; - // get the Win32 window class name used by all wxWindow objects by default - static const wxChar *MSWGetRegisteredClassName(); - // creates the window of specified Windows class with given style, extended // style, title and geometry (default values // @@ -318,8 +315,6 @@ public: bool HandleSize(int x, int y, WXUINT flag); bool HandleSizing(wxRect& rect); bool HandleGetMinMaxInfo(void *mmInfo); - bool HandleEnterSizeMove(); - bool HandleExitSizeMove(); bool HandleShow(bool show, int status); bool HandleActivate(int flag, bool minimized, WXHWND activate); @@ -345,10 +340,9 @@ public: bool HandleMouseEvent(WXUINT msg, int x, int y, WXUINT flags); bool HandleMouseMove(int x, int y, WXUINT flags); - bool HandleMouseWheel(wxMouseWheelAxis axis, - WXWPARAM wParam, WXLPARAM lParam); + bool HandleMouseWheel(WXWPARAM wParam, WXLPARAM lParam); - bool HandleChar(WXWPARAM wParam, WXLPARAM lParam); + bool HandleChar(WXWPARAM wParam, WXLPARAM lParam, bool isASCII = false); bool HandleKeyDown(WXWPARAM wParam, WXLPARAM lParam); bool HandleKeyUp(WXWPARAM wParam, WXLPARAM lParam); #if wxUSE_ACCEL @@ -367,21 +361,7 @@ public: bool HandlePower(WXWPARAM wParam, WXLPARAM lParam, bool *vetoed); - // The main body of common window proc for all wxWindow objects. It tries - // to handle the given message and returns true if it was handled (the - // appropriate return value is then put in result, which must be non-NULL) - // or false if it wasn't. - // - // This function should be overridden in any new code instead of - // MSWWindowProc() even if currently most of the code overrides - // MSWWindowProc() as it had been written before this function was added. - virtual bool MSWHandleMessage(WXLRESULT *result, - WXUINT message, - WXWPARAM wParam, - WXLPARAM lParam); - - // Common Window procedure for all wxWindow objects: forwards to - // MSWHandleMessage() and MSWDefWindowProc() if the message wasn't handled. + // Window procedure virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); // Calls an appropriate default window procedure @@ -403,50 +383,21 @@ public: virtual void MSWDestroyWindow(); - // Functions dealing with painting the window background. The derived - // classes should normally only need to reimplement MSWGetBgBrush() if they - // need to use a non-solid brush for erasing their background. This - // function is called by MSWGetBgBrushForChild() which only exists for the - // weird wxToolBar case and MSWGetBgBrushForChild() itself is used by - // MSWGetBgBrush() to actually find the right brush to use. - - // The brush returned from here must remain valid at least until the next - // event loop iteration. Returning 0, as is done by default, indicates - // there is no custom background brush. - virtual WXHBRUSH MSWGetCustomBgBrush() { return 0; } - // this function should return the brush to paint the children controls // background or 0 if this window doesn't impose any particular background // on its children // - // the hDC parameter is the DC background will be drawn on, it can be used - // to call SetBrushOrgEx() on it if the returned brush is a bitmap one - // - // child parameter is never NULL, it can be this window itself or one of - // its (grand)children - // // the base class version returns a solid brush if we have a non default // background colour or 0 otherwise - virtual WXHBRUSH MSWGetBgBrushForChild(WXHDC hDC, wxWindowMSW *child); + virtual WXHBRUSH MSWGetBgBrushForChild(WXHDC hDC, WXHWND hWnd); // return the background brush to use for painting the given window by - // querying the parent windows via MSWGetBgBrushForChild() recursively - WXHBRUSH MSWGetBgBrush(WXHDC hDC); - - enum MSWThemeColour - { - ThemeColourText = 0, - ThemeColourBackground, - ThemeColourBorder - }; - - // returns a specific theme colour, or if that is not possible then - // wxSystemSettings::GetColour(fallback) - wxColour MSWGetThemeColour(const wchar_t *themeName, - int themePart, - int themeState, - MSWThemeColour themeColour, - wxSystemColour fallback) const; + // quering the parent windows via their MSWGetBgBrushForChild() recursively + // + // hWndToPaint is normally NULL meaning this window itself, but it can also + // be a child of this window which is used by the static box and could be + // potentially useful for other transparent controls + WXHBRUSH MSWGetBgBrush(WXHDC hDC, WXHWND hWndToPaint = NULL); // gives the parent the possibility to draw its children background, e.g. // this is used by wxNotebook to do it using DrawThemeBackground() @@ -465,42 +416,6 @@ public: return true; } - // This should be overridden to return true for the controls which have - // themed background that should through their children. Currently only - // wxNotebook uses this. - // - // The base class version already returns true if we have a solid - // background colour that should be propagated to our children. - virtual bool MSWHasInheritableBackground() const - { - return InheritsBackgroundColour(); - } - -#if !defined(__WXWINCE__) && !defined(__WXUNIVERSAL__) - #define wxHAS_MSW_BACKGROUND_ERASE_HOOK -#endif - -#ifdef wxHAS_MSW_BACKGROUND_ERASE_HOOK - // allows the child to hook into its parent WM_ERASEBKGND processing: call - // MSWSetEraseBgHook() with a non-NULL window to make parent call - // MSWEraseBgHook() on this window (don't forget to reset it to NULL - // afterwards) - // - // this hack is used by wxToolBar, see comments there - void MSWSetEraseBgHook(wxWindow *child); - - // return true if WM_ERASEBKGND is currently hooked - bool MSWHasEraseBgHook() const; - - // called when the window on which MSWSetEraseBgHook() had been called - // receives WM_ERASEBKGND - virtual bool MSWEraseBgHook(WXHDC WXUNUSED(hDC)) { return false; } -#endif // wxHAS_MSW_BACKGROUND_ERASE_HOOK - - // common part of Show/HideWithEffect() - bool MSWShowWithEffect(bool show, - wxShowEffect effect, - unsigned timeout); // Responds to colour changes: passes event on to children. void OnSysColourChanged(wxSysColourChangedEvent& event); @@ -513,9 +428,11 @@ public: // check if a native double-buffering applies for this window virtual bool IsDoubleBuffered() const; - + +#if wxABI_VERSION >= 20808 void SetDoubleBuffered(bool on); - +#endif + // synthesize a wxEVT_LEAVE_WINDOW event and set m_mouseInWindow to false void GenerateMouseLeave(); @@ -524,17 +441,6 @@ public: virtual void OnInternalIdle(); protected: - // this allows you to implement standard control borders without - // repeating the code in different classes that are not derived from - // wxControl - virtual wxBorder GetDefaultBorderForControl() const; - - // choose the default border for this window - virtual wxBorder GetDefaultBorder() const; - - // Translate wxBORDER_THEME (and other border styles if necessary to the value - // that makes most sense for this Windows environment - virtual wxBorder TranslateBorder(wxBorder border) const; #if wxUSE_MENUS_NATIVE virtual bool DoPopupMenu( wxMenu *menu, int x, int y ); @@ -555,11 +461,6 @@ protected: int m_yThumbSize; // implement the base class pure virtuals - virtual void DoGetTextExtent(const wxString& string, - int *x, int *y, - int *descent = NULL, - int *externalLeading = NULL, - const wxFont *font = NULL) const; virtual void DoClientToScreen( int *x, int *y ) const; virtual void DoScreenToClient( int *x, int *y ) const; virtual void DoGetPosition( int *x, int *y ) const; @@ -570,16 +471,9 @@ protected: int sizeFlags = wxSIZE_AUTO); virtual void DoSetClientSize(int width, int height); - virtual wxSize DoGetBorderSize() const; - virtual void DoCaptureMouse(); virtual void DoReleaseMouse(); - virtual void DoEnable(bool enable); - - virtual void DoFreeze(); - virtual void DoThaw(); - // this simply moves/resizes the given HWND which is supposed to be our // sibling (this is useful for controls which are composite at MSW level // and for which DoMoveWindow() is not enough) @@ -604,29 +498,9 @@ protected: const wxString& ttip); #endif // wxUSE_TOOLTIPS - // This is used by CreateKeyEvent() and also for wxEVT_CHAR[_HOOK] event - // creation. Notice that this method doesn't initialize wxKeyEvent - // m_keyCode and m_uniChar fields. - void InitAnyKeyEvent(wxKeyEvent& event, - WXWPARAM wParam, - WXLPARAM lParam) const; - - // Helper functions used by HandleKeyXXX() methods and some derived - // classes, wParam and lParam have the same meaning as in WM_KEY{DOWN,UP}. - // - // NB: evType here must be wxEVT_KEY_{DOWN,UP} as wParam here contains the - // virtual key code, not character! - wxKeyEvent CreateKeyEvent(wxEventType evType, - WXWPARAM wParam, - WXLPARAM lParam = 0) const; - - // Another helper for creating wxKeyEvent for wxEVT_CHAR and related types. - // - // The wParam and lParam here must come from WM_CHAR event parameters, i.e. - // wParam must be a character and not a virtual code. - wxKeyEvent CreateCharEvent(wxEventType evType, - WXWPARAM wParam, - WXLPARAM lParam) const; + // the helper functions used by HandleChar/KeyXXX methods + wxKeyEvent CreateKeyEvent(wxEventType evType, int id, + WXLPARAM lParam = 0, WXWPARAM wParam = 0) const; // default OnEraseBackground() implementation, return true if we did erase @@ -641,15 +515,6 @@ protected: // for state as the system will decide for us what needs to be set void MSWUpdateUIState(int action, int state = 0); - // translate wxWidgets coords into Windows ones suitable to be passed to - // ::CreateWindow(), called from MSWCreate() - virtual void MSWGetCreateWindowCoords(const wxPoint& pos, - const wxSize& size, - int& x, int& y, - int& w, int& h) const; - - bool MSWEnableHWND(WXHWND hWnd, bool enable); - private: // common part of all ctors void Init(); @@ -660,24 +525,21 @@ private: bool HandleJoystickEvent(WXUINT msg, int x, int y, WXUINT flags); bool HandleNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); -#if wxUSE_DEFERRED_SIZING -protected: - // this function is called after the window was resized to its new size - virtual void MSWEndDeferWindowPos() - { - m_pendingPosition = wxDefaultPosition; - m_pendingSize = wxDefaultSize; - } + // list of disabled children before last call to our Disable() + wxWindowList *m_childrenDisabled; + + // number of calls to Freeze() minus number of calls to Thaw() + unsigned int m_frozenness; // current defer window position operation handle (may be NULL) WXHANDLE m_hDWP; +protected: // When deferred positioning is done these hold the pending changes, and // are used for the default values if another size/pos changes is done on // this window before the group of deferred changes is completed. wxPoint m_pendingPosition; wxSize m_pendingSize; -#endif // wxUSE_DEFERRED_SIZING private: #ifdef __POCKETPC__ @@ -685,10 +547,30 @@ private: #endif DECLARE_DYNAMIC_CLASS(wxWindowMSW) - wxDECLARE_NO_COPY_CLASS(wxWindowMSW); + DECLARE_NO_COPY_CLASS(wxWindowMSW) DECLARE_EVENT_TABLE() }; +// ---------------------------------------------------------------------------- +// inline functions +// ---------------------------------------------------------------------------- + +#if WXWIN_COMPATIBILITY_2_4 + +inline bool wxWindowMSW::GetUseCtl3D() const { return false; } +inline bool wxWindowMSW::GetTransparentBackground() const { return false; } +inline void wxWindowMSW::SetTransparent(bool WXUNUSED(t)) { } + +#endif // WXWIN_COMPATIBILITY_2_4 + +// --------------------------------------------------------------------------- +// global functions +// --------------------------------------------------------------------------- + +// kbd code translation +WXDLLEXPORT int wxCharCodeMSWToWX(int keySym, WXLPARAM lParam = 0); +WXDLLEXPORT WXWORD wxCharCodeWXToMSW(int id, bool *IsVirtual = NULL); + // window creation helper class: before creating a new HWND, instantiate an // object of this class on stack - this allows to process the messages sent to // the window even before CreateWindow() returns @@ -699,4 +581,21 @@ public: ~wxWindowCreationHook(); }; +// ---------------------------------------------------------------------------- +// global objects +// ---------------------------------------------------------------------------- + +// notice that this hash must be defined after wxWindow declaration as it +// needs to "see" its dtor and not just forward declaration +#include "wx/hash.h" + +// pseudo-template HWND <-> wxWindow hash table +#if WXWIN_COMPATIBILITY_2_4 +WX_DECLARE_HASH(wxWindow, wxWindowList, wxWinHashTable); +#else +WX_DECLARE_HASH(wxWindowMSW, wxWindowList, wxWinHashTable); +#endif + +extern wxWinHashTable *wxWinHandleHash; + #endif // _WX_WINDOW_H_ diff --git a/Source/3rd Party/wx/include/wx/msw/winundef.h b/Source/3rd Party/wx/include/wx/msw/winundef.h index 677773a08..b8acb68b7 100644 --- a/Source/3rd Party/wx/include/wx/msw/winundef.h +++ b/Source/3rd Party/wx/include/wx/msw/winundef.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 16.05.99 -// RCS-ID: $Id$ +// RCS-ID: $Id: winundef.h 36044 2005-10-31 19:35:41Z VZ $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -123,11 +123,11 @@ inline HWND APIENTRY FindText(LPFINDREPLACE lpfindreplace) { - #ifdef _UNICODE + #ifdef UNICODE return FindTextW(lpfindreplace); #else return FindTextA(lpfindreplace); - #endif + #endif // !UNICODE } #endif @@ -248,20 +248,26 @@ #endif +/* + When this file is included, sometimes the wxCHECK_W32API_VERSION macro + is undefined. With for example CodeWarrior this gives problems with + the following code: + #if 0 && wxCHECK_W32API_VERSION( 0, 5 ) + Because CodeWarrior does macro expansion before test evaluation. + We define wxCHECK_W32API_VERSION here if it's undefined. +*/ +#if !defined(__GNUG__) && !defined(wxCHECK_W32API_VERSION) + #define wxCHECK_W32API_VERSION(maj, min) (0) +#endif + // StartDoc #ifdef StartDoc #undef StartDoc - - // Work around a bug in very old MinGW headers that didn't define DOCINFOW - // and DOCINFOA but only DOCINFO in both ANSI and Unicode. - #if defined( __GNUG__ ) - #if !wxCHECK_W32API_VERSION( 0, 5 ) - #define DOCINFOW DOCINFO - #define DOCINFOA DOCINFO - #endif + #if defined( __GNUG__ ) && !wxCHECK_W32API_VERSION( 0, 5 ) + #define DOCINFOW DOCINFO + #define DOCINFOA DOCINFO #endif - #ifdef _UNICODE inline int StartDoc(HDC h, CONST DOCINFOW* info) { diff --git a/Source/3rd Party/wx/include/wx/msw/wrapcctl.h b/Source/3rd Party/wx/include/wx/msw/wrapcctl.h index 020e65adf..eaa68be04 100644 --- a/Source/3rd Party/wx/include/wx/msw/wrapcctl.h +++ b/Source/3rd Party/wx/include/wx/msw/wrapcctl.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 03.08.2003 -// RCS-ID: $Id$ +// RCS-ID: $Id: wrapcctl.h 41054 2006-09-07 19:01:45Z ABX $ // Copyright: (c) 2003 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -12,6 +12,28 @@ #ifndef _WX_MSW_WRAPCCTL_H_ #define _WX_MSW_WRAPCCTL_H_ +// define _WIN32_IE to a high value because we always check for the version +// of installed DLLs at runtime anyway (see wxApp::GetComCtl32Version()) unless +// the user really doesn't want it and had defined it to a (presumably lower) +// value +// +// just for the reference, here is the table showing what the different value +// of _WIN32_IE correspond to: +// +// 0x0200 for comctl32.dll 4.00 shipped with Win95/NT 4.0 +// 0x0300 4.70 IE 3.x +// 0x0400 4.71 IE 4.0 +// 0x0401 4.72 IE 4.01 and Win98 +// 0x0500 5.80 IE 5.x +// 0x0500 5.81 Win2k/ME +// 0x0600 6.00 WinXP + +#ifndef _WIN32_IE + // use maximal set of features by default, we check for them during + // run-time anyhow + #define _WIN32_IE 0x0600 +#endif // !defined(_WIN32_IE) + #include "wx/msw/wrapwin.h" #include @@ -35,17 +57,6 @@ inline void wxSetCCUnicodeFormat(HWND WXUNUSED_IN_WINCE(hwnd)) // this is implemented in msw/settings.cpp class wxFont; extern wxFont wxGetCCDefaultFont(); - -// this is just a wrapper for HDITEM which we can't use in the public header -// because we don't want to include commctrl.h (and hence windows.h) from there -struct wxHDITEM : public HDITEM -{ - wxHDITEM() - { - ::ZeroMemory(this, sizeof(*this)); - } -}; - -#endif // wxUSE_GUI +#endif #endif // _WX_MSW_WRAPCCTL_H_ diff --git a/Source/3rd Party/wx/include/wx/msw/wrapcdlg.h b/Source/3rd Party/wx/include/wx/msw/wrapcdlg.h index dc602044c..907515291 100644 --- a/Source/3rd Party/wx/include/wx/msw/wrapcdlg.h +++ b/Source/3rd Party/wx/include/wx/msw/wrapcdlg.h @@ -4,7 +4,7 @@ // Author: Wlodzimierz ABX Skiba // Modified by: // Created: 22.03.2005 -// RCS-ID: $Id$ +// RCS-ID: $Id: wrapcdlg.h 43151 2006-11-07 09:08:33Z JS $ // Copyright: (c) 2005 Wlodzimierz Skiba // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// diff --git a/Source/3rd Party/wx/include/wx/msw/wrapgdip.h b/Source/3rd Party/wx/include/wx/msw/wrapgdip.h deleted file mode 100644 index 3c79fe174..000000000 --- a/Source/3rd Party/wx/include/wx/msw/wrapgdip.h +++ /dev/null @@ -1,32 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/wrapgdip.h -// Purpose: wrapper around header -// Author: Vadim Zeitlin -// Created: 2007-03-15 -// RCS-ID: $Id$ -// Copyright: (c) 2007 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_WRAPGDIP_H_ -#define _WX_MSW_WRAPGDIP_H_ - -#include "wx/msw/wrapwin.h" - -// these macros must be defined before gdiplus.h is included but we explicitly -// prevent windows.h from defining them in wx/msw/wrapwin.h as they conflict -// with standard functions of the same name elsewhere, so we have to pay for it -// by manually redefining them ourselves here -#ifndef max - #define max(a,b) (((a) > (b)) ? (a) : (b)) -#endif - -#ifndef min - #define min(a,b) (((a) < (b)) ? (a) : (b)) -#endif - -#include -using namespace Gdiplus; - -#endif // _WX_MSW_WRAPGDIP_H_ - diff --git a/Source/3rd Party/wx/include/wx/msw/wrapshl.h b/Source/3rd Party/wx/include/wx/msw/wrapshl.h index 7490b0754..282a81c01 100644 --- a/Source/3rd Party/wx/include/wx/msw/wrapshl.h +++ b/Source/3rd Party/wx/include/wx/msw/wrapshl.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 2004-10-19 -// RCS-ID: $Id$ +// RCS-ID: $Id: wrapshl.h 40367 2006-07-29 19:19:50Z VZ $ // Copyright: (c) 2004 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -12,21 +12,16 @@ #ifndef _WX_MSW_WRAPSHL_H_ #define _WX_MSW_WRAPSHL_H_ -#include "wx/msw/wrapwin.h" - #ifdef __WXWINCE__ #include #include #include - #include #endif #include #include "wx/msw/winundef.h" -#include "wx/log.h" - // ---------------------------------------------------------------------------- // wxItemIdList implements RAII on top of ITEMIDLIST // ---------------------------------------------------------------------------- @@ -72,7 +67,7 @@ public: wxString path; if ( !SHGetPathFromIDList(m_pidl, wxStringBuffer(path, MAX_PATH)) ) { - wxLogLastError(wxT("SHGetPathFromIDList")); + wxLogLastError(_T("SHGetPathFromIDList")); } return path; @@ -81,7 +76,7 @@ public: private: LPITEMIDLIST m_pidl; - wxDECLARE_NO_COPY_CLASS(wxItemIdList); + DECLARE_NO_COPY_CLASS(wxItemIdList) }; // enable autocompleting filenames in the text control with given HWND diff --git a/Source/3rd Party/wx/include/wx/msw/wrapwin.h b/Source/3rd Party/wx/include/wx/msw/wrapwin.h index 7d0be0846..d1e6a0a86 100644 --- a/Source/3rd Party/wx/include/wx/msw/wrapwin.h +++ b/Source/3rd Party/wx/include/wx/msw/wrapwin.h @@ -1,9 +1,9 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/wrapwin.h +// Name: msw/wrapwin.h // Purpose: Wrapper around , to be included instead of it // Author: Vaclav Slavik // Created: 2003/07/22 -// RCS-ID: $Id$ +// RCS-ID: $Id: wrapwin.h 53877 2008-05-31 12:43:44Z SN $ // Copyright: (c) 2003 Vaclav Slavik // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -39,30 +39,15 @@ #endif #endif -// define _WIN32_WINNT and _WIN32_IE to the highest possible values because we -// always check for the version of installed DLLs at runtime anyway (see -// wxGetWinVersion() and wxApp::GetComCtl32Version()) unless the user really -// doesn't want to use APIs only available on later OS versions and had defined -// them to (presumably lower) values #ifndef _WIN32_WINNT #define _WIN32_WINNT 0x0600 #endif -#ifndef _WIN32_IE - #define _WIN32_IE 0x0700 -#endif - /* Deal with clash with __WINDOWS__ include guard */ #if defined(__WXWINCE__) && defined(__WINDOWS__) #undef __WINDOWS__ #endif -// For IPv6 support, we must include winsock2.h before winsock.h, and -// windows.h include winsock.h so do it before including it -#if wxUSE_IPV6 - #include -#endif - #include #if defined(__WXWINCE__) && !defined(__WINDOWS__) @@ -72,15 +57,13 @@ // #undef the macros defined in winsows.h which conflict with code elsewhere #include "wx/msw/winundef.h" -// Types DWORD_PTR, ULONG_PTR and so on are used for 64-bit compatability +// Types DWORD_PTR, ULONG_PTR and so on are used for 64-bit compatability // in the WINAPI SDK (they are an integral type that is the size of a -// pointer) on MSVC 7 and later. However, they are not available in older -// Platform SDKs, and since they are typedefs and not #defines we simply +// pointer) on MSVC 7 and later. However, they are not available in older +// Platform SDKs, and since they are typedefs and not #defines we simply // overwrite them if there is a chance that they're not defined #if (!defined(_MSC_VER) || (_MSC_VER < 1300)) && !defined(__WIN64__) #define UINT_PTR unsigned int - #define INT_PTR int - #define HANDLE_PTR unsigned long #define LONG_PTR long #define ULONG_PTR unsigned long #define DWORD_PTR unsigned long @@ -94,7 +77,7 @@ #if wxUSE_GUI -WXDLLIMPEXP_CORE int wxMSLU_DrawStateW(WXHDC dc, WXHBRUSH br, WXFARPROC outputFunc, +WXDLLEXPORT int wxMSLU_DrawStateW(WXHDC dc, WXHBRUSH br, WXFARPROC outputFunc, WXLPARAM lData, WXWPARAM wData, int x, int y, int cx, int cy, unsigned int flags); @@ -102,10 +85,10 @@ WXDLLIMPEXP_CORE int wxMSLU_DrawStateW(WXHDC dc, WXHBRUSH br, WXFARPROC outputFu wxMSLU_DrawStateW((WXHDC)dc,(WXHBRUSH)br,(WXFARPROC)func, \ ld, wd, x, y, cx, cy, flags) -WXDLLIMPEXP_CORE int wxMSLU_GetOpenFileNameW(void *ofn); +WXDLLEXPORT int wxMSLU_GetOpenFileNameW(void *ofn); #define GetOpenFileNameW(ofn) wxMSLU_GetOpenFileNameW((void*)ofn) -WXDLLIMPEXP_CORE int wxMSLU_GetSaveFileNameW(void *ofn); +WXDLLEXPORT int wxMSLU_GetSaveFileNameW(void *ofn); #define GetSaveFileNameW(ofn) wxMSLU_GetSaveFileNameW((void*)ofn) #endif // wxUSE_GUI @@ -114,4 +97,3 @@ WXDLLIMPEXP_CORE int wxMSLU_GetSaveFileNameW(void *ofn); #endif // _WX_WRAPWIN_H_ - diff --git a/Source/3rd Party/wx/include/wx/nativewin.h b/Source/3rd Party/wx/include/wx/nativewin.h deleted file mode 100644 index 500b4e4ed..000000000 --- a/Source/3rd Party/wx/include/wx/nativewin.h +++ /dev/null @@ -1,169 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/nativewin.h -// Purpose: classes allowing to wrap a native window handle -// Author: Vadim Zeitlin -// Created: 2008-03-05 -// RCS-ID: $Id$ -// Copyright: (c) 2008 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_NATIVEWIN_H_ -#define _WX_NATIVEWIN_H_ - -#include "wx/toplevel.h" - -// this symbol can be tested in the user code to see if the current wx port has -// support for creating wxNativeContainerWindow from native windows -// -// be optimistic by default, we undefine it below if we don't have it finally -#define wxHAS_NATIVE_CONTAINER_WINDOW - -// we define the following typedefs for each of the platform supporting native -// windows wrapping: -// -// - wxNativeContainerWindowHandle is the toolkit-level handle of the native -// window, i.e. HWND/GdkWindow*/NSWindow -// -// - wxNativeContainerWindowId is the lowest level identifier of the native -// window, i.e. HWND/GdkNativeWindow/NSWindow (so it's the same as above for -// all platforms except GTK where we also can work with Window/XID) -// -// later we'll also have -// -// - wxNativeWindowHandle for child windows (which will be wrapped by -// wxNativeWindow class), it is HWND/GtkWidget*/ControlRef -#if defined(__WXMSW__) - #include "wx/msw/wrapwin.h" - - typedef HWND wxNativeContainerWindowId; - typedef HWND wxNativeContainerWindowHandle; -#elif defined(__WXGTK__) - typedef unsigned long wxNativeContainerWindowId; - typedef GdkWindow *wxNativeContainerWindowHandle; -#else - // no support for using native windows under this platform yet - #undef wxHAS_NATIVE_CONTAINER_WINDOW -#endif - -#ifdef wxHAS_NATIVE_CONTAINER_WINDOW - -// ---------------------------------------------------------------------------- -// wxNativeContainerWindow: can be used for creating other wxWindows inside it -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxNativeContainerWindow : public wxTopLevelWindow -{ -public: - // default ctor, call Create() later - wxNativeContainerWindow() { } - - // create a window from an existing native window handle - // - // use GetHandle() to check if the creation was successful, it will return - // 0 if the handle was invalid - wxNativeContainerWindow(wxNativeContainerWindowHandle handle) - { - Create(handle); - } - - // same as ctor above but with a return code - bool Create(wxNativeContainerWindowHandle handle); - -#if defined(__WXGTK__) - // this is a convenient ctor for wxGTK applications which can also create - // the objects of this class from the really native window handles and not - // only the GdkWindow objects - // - // wxNativeContainerWindowId is Window (i.e. an XID, i.e. an int) under X11 - // (when GDK_WINDOWING_X11 is defined) or HWND under Win32 - wxNativeContainerWindow(wxNativeContainerWindowId winid) { Create(winid); } - - bool Create(wxNativeContainerWindowId winid); -#endif // wxGTK - - // unlike for the normal windows, dtor will not destroy the native window - // as it normally doesn't belong to us - virtual ~wxNativeContainerWindow(); - - - // provide (trivial) implementation of the base class pure virtuals - virtual void SetTitle(const wxString& WXUNUSED(title)) - { - wxFAIL_MSG( "not implemented for native windows" ); - } - - virtual wxString GetTitle() const - { - wxFAIL_MSG( "not implemented for native windows" ); - - return wxString(); - } - - virtual void Maximize(bool WXUNUSED(maximize) = true) - { - wxFAIL_MSG( "not implemented for native windows" ); - } - - virtual bool IsMaximized() const - { - wxFAIL_MSG( "not implemented for native windows" ); - - return false; - } - - virtual void Iconize(bool WXUNUSED(iconize) = true) - { - wxFAIL_MSG( "not implemented for native windows" ); - } - - virtual bool IsIconized() const - { - // this is called by wxGTK implementation so don't assert - return false; - } - - virtual void Restore() - { - wxFAIL_MSG( "not implemented for native windows" ); - } - - virtual bool ShowFullScreen(bool WXUNUSED(show), - long WXUNUSED(style) = wxFULLSCREEN_ALL) - { - wxFAIL_MSG( "not implemented for native windows" ); - - return false; - } - - virtual bool IsFullScreen() const - { - wxFAIL_MSG( "not implemented for native windows" ); - - return false; - } - -#ifdef __WXMSW__ - virtual bool IsShown() const; -#endif // __WXMSW__ - - // this is an implementation detail: called when the native window is - // destroyed by an outside agency; deletes the C++ object too but can in - // principle be overridden to something else (knowing that the window - // handle of this object and all of its children is invalid any more) - virtual void OnNativeDestroyed(); - -protected: -#ifdef __WXMSW__ - virtual WXLRESULT - MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); -#endif // __WXMSW__ - -private: - wxDECLARE_NO_COPY_CLASS(wxNativeContainerWindow); -}; - -#endif // wxHAS_NATIVE_CONTAINER_WINDOW - -#endif // _WX_NATIVEWIN_H_ - diff --git a/Source/3rd Party/wx/include/wx/nonownedwnd.h b/Source/3rd Party/wx/include/wx/nonownedwnd.h deleted file mode 100644 index efc024922..000000000 --- a/Source/3rd Party/wx/include/wx/nonownedwnd.h +++ /dev/null @@ -1,114 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/nonownedwnd.h -// Purpose: declares wxNonTopLevelWindow class -// Author: Vaclav Slavik -// Modified by: -// Created: 2006-12-24 -// RCS-ID: $Id$ -// Copyright: (c) 2006 TT-Solutions -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_NONOWNEDWND_H_ -#define _WX_NONOWNEDWND_H_ - -#include "wx/window.h" - -// Styles that can be used with any wxNonOwnedWindow: -#define wxFRAME_SHAPED 0x0010 // Create a window that is able to be shaped - -class WXDLLIMPEXP_FWD_CORE wxGraphicsPath; - -// ---------------------------------------------------------------------------- -// wxNonOwnedWindow: a window that is not a child window of another one. -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxNonOwnedWindowBase : public wxWindow -{ -public: - // Set the shape of the window to the given region. - // Returns true if the platform supports this feature (and the - // operation is successful.) - bool SetShape(const wxRegion& region) - { - // This style is in fact only needed by wxOSX/Carbon so once we don't - // use this port any more, we could get rid of this requirement, but - // for now you must specify wxFRAME_SHAPED for SetShape() to work on - // all platforms. - wxCHECK_MSG - ( - HasFlag(wxFRAME_SHAPED), false, - wxS("Shaped windows must be created with the wxFRAME_SHAPED style.") - ); - - return region.IsEmpty() ? DoClearShape() : DoSetRegionShape(region); - } - -#if wxUSE_GRAPHICS_CONTEXT - // Set the shape using the specified path. - bool SetShape(const wxGraphicsPath& path) - { - wxCHECK_MSG - ( - HasFlag(wxFRAME_SHAPED), false, - wxS("Shaped windows must be created with the wxFRAME_SHAPED style.") - ); - - return DoSetPathShape(path); - } -#endif // wxUSE_GRAPHICS_CONTEXT - - - // Overridden base class methods. - // ------------------------------ - - virtual void AdjustForParentClientOrigin(int& WXUNUSED(x), int& WXUNUSED(y), - int WXUNUSED(sizeFlags) = 0) const - { - // Non owned windows positions don't need to be adjusted for parent - // client area origin so simply do nothing here. - } - - virtual void InheritAttributes() - { - // Non owned windows don't inherit attributes from their parent window - // (if the parent frame is red, it doesn't mean that all dialogs shown - // by it should be red as well), so don't do anything here neither. - } - -protected: - virtual bool DoClearShape() - { - return false; - } - - virtual bool DoSetRegionShape(const wxRegion& WXUNUSED(region)) - { - return false; - } - -#if wxUSE_GRAPHICS_CONTEXT - virtual bool DoSetPathShape(const wxGraphicsPath& WXUNUSED(path)) - { - return false; - } -#endif // wxUSE_GRAPHICS_CONTEXT -}; - -#if defined(__WXDFB__) - #include "wx/dfb/nonownedwnd.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/nonownedwnd.h" -#elif defined(__WXMAC__) - #include "wx/osx/nonownedwnd.h" -#elif defined(__WXMSW__) && !defined(__WXWINCE__) - #include "wx/msw/nonownedwnd.h" -#else - // No special class needed in other ports, they can derive both wxTLW and - // wxPopupWindow directly from wxWindow and don't implement SetShape(). - class wxNonOwnedWindow : public wxNonOwnedWindowBase - { - }; -#endif - -#endif // _WX_NONOWNEDWND_H_ diff --git a/Source/3rd Party/wx/include/wx/notebook.h b/Source/3rd Party/wx/include/wx/notebook.h index 80d2425dd..db1dc1361 100644 --- a/Source/3rd Party/wx/include/wx/notebook.h +++ b/Source/3rd Party/wx/include/wx/notebook.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 01.02.01 -// RCS-ID: $Id$ +// RCS-ID: $Id: notebook.h 42152 2006-10-20 09:16:41Z VZ $ // Copyright: (c) 1996-2000 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -54,55 +54,17 @@ enum typedef wxWindow wxNotebookPage; // so far, any window can be a page -extern WXDLLIMPEXP_DATA_CORE(const char) wxNotebookNameStr[]; - -#if wxUSE_EXTENDED_RTTI - -// ---------------------------------------------------------------------------- -// XTI accessor -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxNotebookPageInfo : public wxObject -{ -public: - wxNotebookPageInfo() { m_page = NULL; m_imageId = -1; m_selected = false; } - virtual ~wxNotebookPageInfo() { } - - bool Create(wxNotebookPage *page, - const wxString& text, - bool selected, - int imageId) - { - m_page = page; - m_text = text; - m_selected = selected; - m_imageId = imageId; - return true; - } - - wxNotebookPage* GetPage() const { return m_page; } - wxString GetText() const { return m_text; } - bool GetSelected() const { return m_selected; } - int GetImageId() const { return m_imageId; } - -private: - wxNotebookPage *m_page; - wxString m_text; - bool m_selected; - int m_imageId; - - DECLARE_DYNAMIC_CLASS(wxNotebookPageInfo) -}; - -WX_DECLARE_EXPORTED_LIST(wxNotebookPageInfo, wxNotebookPageInfoList ); +extern WXDLLEXPORT_DATA(const wxChar) wxNotebookNameStr[]; +#if WXWIN_COMPATIBILITY_2_4 + #define wxNOTEBOOK_NAME wxNotebookNameStr #endif // ---------------------------------------------------------------------------- // wxNotebookBase: define wxNotebook interface // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxNotebookBase : public wxBookCtrlBase +class WXDLLEXPORT wxNotebookBase : public wxBookCtrlBase { public: // ctors @@ -110,6 +72,13 @@ public: wxNotebookBase() { } + wxNotebookBase(wxWindow *parent, + wxWindowID winid, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxNotebookNameStr) ; + // wxNotebook-specific additions to wxBookCtrlBase interface // --------------------------------------------------------- @@ -138,45 +107,53 @@ public: bool SendPageChangingEvent(int nPage); // sends the event about page change from old to new (or GetSelection() if - // new is wxNOT_FOUND) - void SendPageChangedEvent(int nPageOld, int nPageNew = wxNOT_FOUND); + // new is -1) + void SendPageChangedEvent(int nPageOld, int nPageNew = -1); - // wxBookCtrlBase overrides this method to return false but we do need - // focus because we have tabs - virtual bool AcceptsFocus() const { return wxControl::AcceptsFocus(); } -#if wxUSE_EXTENDED_RTTI - // XTI accessors - virtual void AddPageInfo( wxNotebookPageInfo* info ); - virtual const wxNotebookPageInfoList& GetPageInfos() const; -#endif - protected: -#if wxUSE_EXTENDED_RTTI - wxNotebookPageInfoList m_pageInfos; -#endif - wxDECLARE_NO_COPY_CLASS(wxNotebookBase); + DECLARE_NO_COPY_CLASS(wxNotebookBase) }; // ---------------------------------------------------------------------------- // notebook event class and related stuff // ---------------------------------------------------------------------------- -// wxNotebookEvent is obsolete and defined for compatibility only (notice that -// we use #define and not typedef to also keep compatibility with the existing -// code which forward declares it) -#define wxNotebookEvent wxBookCtrlEvent -typedef wxBookCtrlEventFunction wxNotebookEventFunction; -#define wxNotebookEventHandler(func) wxBookCtrlEventHandler(func) +class WXDLLEXPORT wxNotebookEvent : public wxBookCtrlBaseEvent +{ +public: + wxNotebookEvent(wxEventType commandType = wxEVT_NULL, int winid = 0, + int nSel = -1, int nOldSel = -1) + : wxBookCtrlBaseEvent(commandType, winid, nSel, nOldSel) + { + } -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxBookCtrlEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, wxBookCtrlEvent ); + wxNotebookEvent(const wxNotebookEvent& event) + : wxBookCtrlBaseEvent(event) + { + } + + virtual wxEvent *Clone() const { return new wxNotebookEvent(*this); } + +private: + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxNotebookEvent) +}; + +BEGIN_DECLARE_EVENT_TYPES() + DECLARE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, 802) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, 803) +END_DECLARE_EVENT_TYPES() + +typedef void (wxEvtHandler::*wxNotebookEventFunction)(wxNotebookEvent&); + +#define wxNotebookEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxNotebookEventFunction, &func) #define EVT_NOTEBOOK_PAGE_CHANGED(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, winid, wxBookCtrlEventHandler(fn)) + wx__DECLARE_EVT1(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, winid, wxNotebookEventHandler(fn)) #define EVT_NOTEBOOK_PAGE_CHANGING(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, winid, wxBookCtrlEventHandler(fn)) + wx__DECLARE_EVT1(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, winid, wxNotebookEventHandler(fn)) // ---------------------------------------------------------------------------- // wxNotebook class itself @@ -193,7 +170,7 @@ wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING #elif defined(__WXGTK__) #include "wx/gtk1/notebook.h" #elif defined(__WXMAC__) - #include "wx/osx/notebook.h" + #include "wx/mac/notebook.h" #elif defined(__WXCOCOA__) #include "wx/cocoa/notebook.h" #elif defined(__WXPM__) diff --git a/Source/3rd Party/wx/include/wx/numdlg.h b/Source/3rd Party/wx/include/wx/numdlg.h index b212a46fa..741bc72fa 100644 --- a/Source/3rd Party/wx/include/wx/numdlg.h +++ b/Source/3rd Party/wx/include/wx/numdlg.h @@ -4,7 +4,7 @@ // Author: John Labenski // Modified by: // Created: 07.02.04 (extracted from wx/textdlg.h) -// RCS-ID: $Id$ +// RCS-ID: $Id: numdlg.h 37157 2006-01-26 15:33:27Z ABX $ // Copyright: (c) John Labenski // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// diff --git a/Source/3rd Party/wx/include/wx/numformatter.h b/Source/3rd Party/wx/include/wx/numformatter.h deleted file mode 100644 index a4064485e..000000000 --- a/Source/3rd Party/wx/include/wx/numformatter.h +++ /dev/null @@ -1,78 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/numformatter.h -// Purpose: wxNumberFormatter class -// Author: Fulvio Senore, Vadim Zeitlin -// Created: 2010-11-06 -// Copyright: (c) 2010 wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_NUMFORMATTER_H_ -#define _WX_NUMFORMATTER_H_ - -#include "wx/string.h" - -// Helper class for formatting numbers with thousands separators which also -// supports parsing the numbers formatted by it. -class WXDLLIMPEXP_BASE wxNumberFormatter -{ -public: - // Bit masks for ToString() - enum Style - { - Style_None = 0x00, - Style_WithThousandsSep = 0x01, - Style_NoTrailingZeroes = 0x02 // Only for floating point numbers - }; - - // Format a number as a string. By default, the thousands separator is - // used, specify Style_None to prevent this. For floating point numbers, - // precision can also be specified. - static wxString ToString(long val, - int style = Style_WithThousandsSep); -#ifdef wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG - static wxString ToString(wxLongLong_t val, - int style = Style_WithThousandsSep); -#endif // wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG - static wxString ToString(double val, - int precision, - int style = Style_WithThousandsSep); - - // Parse a string representing a number, possibly with thousands separator. - // - // Return true on success and stores the result in the provided location - // which must be a valid non-NULL pointer. - static bool FromString(wxString s, long *val); -#ifdef wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG - static bool FromString(wxString s, wxLongLong_t *val); -#endif // wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG - static bool FromString(wxString s, double *val); - - - // Get the decimal separator for the current locale. It is always defined - // and we fall back to returning '.' in case of an error. - static wxChar GetDecimalSeparator(); - - // Get the thousands separator if grouping of the digits is used by the - // current locale. The value returned in sep should be only used if the - // function returns true. - static bool GetThousandsSeparatorIfUsed(wxChar *sep); - -private: - // Post-process the string representing an integer. - static wxString PostProcessIntString(wxString s, int style); - - // Add the thousands separators to a string representing a number without - // the separators. This is used by ToString(Style_WithThousandsSep). - static void AddThousandsSeparators(wxString& s); - - // Remove trailing zeroes and, if there is nothing left after it, the - // decimal separator itself from a string representing a floating point - // number. Also used by ToString(). - static void RemoveTrailingZeroes(wxString& s); - - // Remove all thousands separators from a string representing a number. - static void RemoveThousandsSeparators(wxString& s); -}; - -#endif // _WX_NUMFORMATTER_H_ diff --git a/Source/3rd Party/wx/include/wx/object.h b/Source/3rd Party/wx/include/wx/object.h index 97e7a7e41..37b11e6ec 100644 --- a/Source/3rd Party/wx/include/wx/object.h +++ b/Source/3rd Party/wx/include/wx/object.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: Ron Lee // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: object.h 61872 2009-09-09 22:37:05Z VZ $ // Copyright: (c) 1997 Julian Smart // (c) 2001 Ron Lee // Licence: wxWindows licence @@ -19,49 +19,204 @@ #include "wx/memory.h" -#define wxDECLARE_CLASS_INFO_ITERATORS() \ -class WXDLLIMPEXP_BASE const_iterator \ - { \ - typedef wxHashTable_Node Node; \ - public: \ - typedef const wxClassInfo* value_type; \ - typedef const value_type& const_reference; \ - typedef const_iterator itor; \ - typedef value_type* ptr_type; \ - \ - Node* m_node; \ - wxHashTable* m_table; \ - public: \ - typedef const_reference reference_type; \ - typedef ptr_type pointer_type; \ - \ - const_iterator(Node* node, wxHashTable* table) \ - : m_node(node), m_table(table) { } \ - const_iterator() : m_node(NULL), m_table(NULL) { } \ - value_type operator*() const; \ - itor& operator++(); \ - const itor operator++(int); \ - bool operator!=(const itor& it) const \ - { return it.m_node != m_node; } \ - bool operator==(const itor& it) const \ - { return it.m_node == m_node; } \ - }; \ - \ - static const_iterator begin_classinfo(); \ - static const_iterator end_classinfo() +class WXDLLIMPEXP_FWD_BASE wxObject; -// based on the value of wxUSE_EXTENDED_RTTI symbol, -// only one of the RTTI system will be compiled: -// - the "old" one (defined by rtti.h) or -// - the "new" one (defined by xti.h) +#ifndef wxUSE_EXTENDED_RTTI +#define wxUSE_EXTENDED_RTTI 0 +#endif + +#if wxUSE_EXTENDED_RTTI #include "wx/xti.h" -#include "wx/rtti.h" +#else -#define wxIMPLEMENT_CLASS(name, basename) \ - wxIMPLEMENT_ABSTRACT_CLASS(name, basename) +// ---------------------------------------------------------------------------- +// conditional compilation +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_BASE wxClassInfo; +class WXDLLIMPEXP_FWD_BASE wxHashTable; +class WXDLLIMPEXP_FWD_BASE wxObjectRefData; + +// ---------------------------------------------------------------------------- +// wxClassInfo +// ---------------------------------------------------------------------------- + +typedef wxObject *(*wxObjectConstructorFn)(void); + +class WXDLLIMPEXP_BASE wxClassInfo +{ +public: + wxClassInfo( const wxChar *className, + const wxClassInfo *baseInfo1, + const wxClassInfo *baseInfo2, + int size, + wxObjectConstructorFn ctor ) + : m_className(className) + , m_objectSize(size) + , m_objectConstructor(ctor) + , m_baseInfo1(baseInfo1) + , m_baseInfo2(baseInfo2) + , m_next(sm_first) + { + sm_first = this; + Register(); + } + + ~wxClassInfo(); + + wxObject *CreateObject() const + { return m_objectConstructor ? (*m_objectConstructor)() : 0; } + bool IsDynamic() const { return (NULL != m_objectConstructor); } + + const wxChar *GetClassName() const { return m_className; } + const wxChar *GetBaseClassName1() const + { return m_baseInfo1 ? m_baseInfo1->GetClassName() : NULL; } + const wxChar *GetBaseClassName2() const + { return m_baseInfo2 ? m_baseInfo2->GetClassName() : NULL; } + const wxClassInfo *GetBaseClass1() const { return m_baseInfo1; } + const wxClassInfo *GetBaseClass2() const { return m_baseInfo2; } + int GetSize() const { return m_objectSize; } + + wxObjectConstructorFn GetConstructor() const + { return m_objectConstructor; } + static const wxClassInfo *GetFirst() { return sm_first; } + const wxClassInfo *GetNext() const { return m_next; } + static wxClassInfo *FindClass(const wxChar *className); + + // Climb upwards through inheritance hierarchy. + // Dual inheritance is catered for. + + bool IsKindOf(const wxClassInfo *info) const + { + return info != 0 && + ( info == this || + ( m_baseInfo1 && m_baseInfo1->IsKindOf(info) ) || + ( m_baseInfo2 && m_baseInfo2->IsKindOf(info) ) ); + } + +#if WXWIN_COMPATIBILITY_2_4 + // Initializes parent pointers and hash table for fast searching. + wxDEPRECATED( static void InitializeClasses() ); + // Cleans up hash table used for fast searching. + wxDEPRECATED( static void CleanUpClasses() ); +#endif + +public: + const wxChar *m_className; + int m_objectSize; + wxObjectConstructorFn m_objectConstructor; + + // Pointers to base wxClassInfos: set in InitializeClasses + + const wxClassInfo *m_baseInfo1; + const wxClassInfo *m_baseInfo2; + + // class info object live in a linked list: + // pointers to its head and the next element in it + + static wxClassInfo *sm_first; + wxClassInfo *m_next; + + // FIXME: this should be private (currently used directly by way too + // many clients) + static wxHashTable *sm_classTable; + +private: + // InitializeClasses() helper + static wxClassInfo *GetBaseByName(const wxChar *name); + + DECLARE_NO_COPY_CLASS(wxClassInfo) + +protected: + // registers the class + void Register(); + void Unregister(); +}; + +WXDLLIMPEXP_BASE wxObject *wxCreateDynamicObject(const wxChar *name); + +#if WXWIN_COMPATIBILITY_2_4 +inline void wxClassInfo::InitializeClasses() {} +inline void wxClassInfo::CleanUpClasses() {} +#endif + +// ---------------------------------------------------------------------------- +// Dynamic class macros +// ---------------------------------------------------------------------------- + +#define DECLARE_ABSTRACT_CLASS(name) \ + public: \ + static wxClassInfo ms_classInfo; \ + virtual wxClassInfo *GetClassInfo() const; + +#define DECLARE_DYNAMIC_CLASS_NO_ASSIGN(name) \ + DECLARE_NO_ASSIGN_CLASS(name) \ + DECLARE_DYNAMIC_CLASS(name) + +#define DECLARE_DYNAMIC_CLASS_NO_COPY(name) \ + DECLARE_NO_COPY_CLASS(name) \ + DECLARE_DYNAMIC_CLASS(name) + +#define DECLARE_DYNAMIC_CLASS(name) \ + DECLARE_ABSTRACT_CLASS(name) \ + static wxObject* wxCreateObject(); + +#define DECLARE_CLASS(name) DECLARE_DYNAMIC_CLASS(name) + + +// common part of the macros below +#define wxIMPLEMENT_CLASS_COMMON(name, basename, baseclsinfo2, func) \ + wxClassInfo name::ms_classInfo(wxT(#name), \ + &basename::ms_classInfo, \ + baseclsinfo2, \ + (int) sizeof(name), \ + (wxObjectConstructorFn) func); \ + \ + wxClassInfo *name::GetClassInfo() const \ + { return &name::ms_classInfo; } + +#define wxIMPLEMENT_CLASS_COMMON1(name, basename, func) \ + wxIMPLEMENT_CLASS_COMMON(name, basename, NULL, func) + +#define wxIMPLEMENT_CLASS_COMMON2(name, basename1, basename2, func) \ + wxIMPLEMENT_CLASS_COMMON(name, basename1, &basename2::ms_classInfo, func) + +// ----------------------------------- +// for concrete classes +// ----------------------------------- + + // Single inheritance with one base class +#define IMPLEMENT_DYNAMIC_CLASS(name, basename) \ + wxIMPLEMENT_CLASS_COMMON1(name, basename, name::wxCreateObject) \ + wxObject* name::wxCreateObject() \ + { return new name; } + + // Multiple inheritance with two base classes +#define IMPLEMENT_DYNAMIC_CLASS2(name, basename1, basename2) \ + wxIMPLEMENT_CLASS_COMMON2(name, basename1, basename2, \ + name::wxCreateObject) \ + wxObject* name::wxCreateObject() \ + { return new name; } + +// ----------------------------------- +// for abstract classes +// ----------------------------------- + + // Single inheritance with one base class + +#define IMPLEMENT_ABSTRACT_CLASS(name, basename) \ + wxIMPLEMENT_CLASS_COMMON1(name, basename, NULL) + + // Multiple inheritance with two base classes + +#define IMPLEMENT_ABSTRACT_CLASS2(name, basename1, basename2) \ + wxIMPLEMENT_CLASS_COMMON2(name, basename1, basename2, NULL) + +#define IMPLEMENT_CLASS IMPLEMENT_ABSTRACT_CLASS +#define IMPLEMENT_CLASS2 IMPLEMENT_ABSTRACT_CLASS2 + +#endif // !wxUSE_EXTENDED_RTTI -#define wxIMPLEMENT_CLASS2(name, basename1, basename2) \ - wxIMPLEMENT_ABSTRACT_CLASS2(name, basename1, basename2) // ----------------------------------- // for pluggable classes @@ -83,7 +238,7 @@ public: \ name##PluginSentinel(); \ ~name##PluginSentinel(); \ }; \ -name##PluginSentinel m_pluginsentinel +name##PluginSentinel m_pluginsentinel; #define _IMPLEMENT_DL_SENTINEL(name) \ const wxString name::name##PluginSentinel::sm_className(#name); \ @@ -102,35 +257,35 @@ name##PluginSentinel m_pluginsentinel #endif // wxUSE_NESTED_CLASSES -#define wxDECLARE_PLUGGABLE_CLASS(name) \ - wxDECLARE_DYNAMIC_CLASS(name); _DECLARE_DL_SENTINEL(name, WXDLLIMPEXP_CORE) -#define wxDECLARE_ABSTRACT_PLUGGABLE_CLASS(name) \ - wxDECLARE_ABSTRACT_CLASS(name); _DECLARE_DL_SENTINEL(name, WXDLLIMPEXP_CORE) +#define DECLARE_PLUGGABLE_CLASS(name) \ + DECLARE_DYNAMIC_CLASS(name) _DECLARE_DL_SENTINEL(name, WXDLLEXPORT) +#define DECLARE_ABSTRACT_PLUGGABLE_CLASS(name) \ + DECLARE_ABSTRACT_CLASS(name) _DECLARE_DL_SENTINEL(name, WXDLLEXPORT) -#define wxDECLARE_USER_EXPORTED_PLUGGABLE_CLASS(name, usergoo) \ - wxDECLARE_DYNAMIC_CLASS(name); _DECLARE_DL_SENTINEL(name, usergoo) -#define wxDECLARE_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS(name, usergoo) \ - wxDECLARE_ABSTRACT_CLASS(name); _DECLARE_DL_SENTINEL(name, usergoo) +#define DECLARE_USER_EXPORTED_PLUGGABLE_CLASS(name, usergoo) \ + DECLARE_DYNAMIC_CLASS(name) _DECLARE_DL_SENTINEL(name, usergoo) +#define DECLARE_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS(name, usergoo) \ + DECLARE_ABSTRACT_CLASS(name) _DECLARE_DL_SENTINEL(name, usergoo) -#define wxIMPLEMENT_PLUGGABLE_CLASS(name, basename) \ - wxIMPLEMENT_DYNAMIC_CLASS(name, basename) _IMPLEMENT_DL_SENTINEL(name) -#define wxIMPLEMENT_PLUGGABLE_CLASS2(name, basename1, basename2) \ - wxIMPLEMENT_DYNAMIC_CLASS2(name, basename1, basename2) _IMPLEMENT_DL_SENTINEL(name) -#define wxIMPLEMENT_ABSTRACT_PLUGGABLE_CLASS(name, basename) \ - wxIMPLEMENT_ABSTRACT_CLASS(name, basename) _IMPLEMENT_DL_SENTINEL(name) -#define wxIMPLEMENT_ABSTRACT_PLUGGABLE_CLASS2(name, basename1, basename2) \ - wxIMPLEMENT_ABSTRACT_CLASS2(name, basename1, basename2) _IMPLEMENT_DL_SENTINEL(name) +#define IMPLEMENT_PLUGGABLE_CLASS(name, basename) \ + IMPLEMENT_DYNAMIC_CLASS(name, basename) _IMPLEMENT_DL_SENTINEL(name) +#define IMPLEMENT_PLUGGABLE_CLASS2(name, basename1, basename2) \ + IMPLEMENT_DYNAMIC_CLASS2(name, basename1, basename2) _IMPLEMENT_DL_SENTINEL(name) +#define IMPLEMENT_ABSTRACT_PLUGGABLE_CLASS(name, basename) \ + IMPLEMENT_ABSTRACT_CLASS(name, basename) _IMPLEMENT_DL_SENTINEL(name) +#define IMPLEMENT_ABSTRACT_PLUGGABLE_CLASS2(name, basename1, basename2) \ + IMPLEMENT_ABSTRACT_CLASS2(name, basename1, basename2) _IMPLEMENT_DL_SENTINEL(name) -#define wxIMPLEMENT_USER_EXPORTED_PLUGGABLE_CLASS(name, basename) \ - wxIMPLEMENT_PLUGGABLE_CLASS(name, basename) -#define wxIMPLEMENT_USER_EXPORTED_PLUGGABLE_CLASS2(name, basename1, basename2) \ - wxIMPLEMENT_PLUGGABLE_CLASS2(name, basename1, basename2) -#define wxIMPLEMENT_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS(name, basename) \ - wxIMPLEMENT_ABSTRACT_PLUGGABLE_CLASS(name, basename) -#define wxIMPLEMENT_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS2(name, basename1, basename2) \ - wxIMPLEMENT_ABSTRACT_PLUGGABLE_CLASS2(name, basename1, basename2) +#define IMPLEMENT_USER_EXPORTED_PLUGGABLE_CLASS(name, basename) \ + IMPLEMENT_PLUGGABLE_CLASS(name, basename) +#define IMPLEMENT_USER_EXPORTED_PLUGGABLE_CLASS2(name, basename1, basename2) \ + IMPLEMENT_PLUGGABLE_CLASS2(name, basename1, basename2) +#define IMPLEMENT_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS(name, basename) \ + IMPLEMENT_ABSTRACT_PLUGGABLE_CLASS(name, basename) +#define IMPLEMENT_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS2(name, basename1, basename2) \ + IMPLEMENT_ABSTRACT_PLUGGABLE_CLASS2(name, basename1, basename2) -#define wxCLASSINFO(name) (&name::ms_classInfo) +#define CLASSINFO(name) (&name::ms_classInfo) #define wxIS_KIND_OF(obj, className) obj->IsKindOf(&className::ms_classInfo) @@ -144,8 +299,8 @@ name##PluginSentinel m_pluginsentinel // be replaced by it as long as there are any compilers not supporting it #define wxDynamicCast(obj, className) \ ((className *) wxCheckDynamicCast( \ - const_cast(static_cast(\ - const_cast(static_cast(obj)))), \ + wx_const_cast(wxObject *, wx_static_cast(const wxObject *, \ + wx_const_cast(className *, wx_static_cast(const className *, obj)))), \ &className::ms_classInfo)) // The 'this' pointer is always true, so use this version @@ -153,16 +308,20 @@ name##PluginSentinel m_pluginsentinel #define wxDynamicCastThis(className) \ (IsKindOf(&className::ms_classInfo) ? (className *)(this) : (className *)0) -// FIXME-VC6: dummy argument needed because VC6 doesn't support explicitly -// choosing the template function to call -template -inline T *wxCheckCast(const void *ptr, T * = NULL) +#ifdef __WXDEBUG__ +inline void* wxCheckCast(void *ptr) { - wxASSERT_MSG( wxDynamicCast(ptr, T), "wxStaticCast() used incorrectly" ); - return const_cast(static_cast(ptr)); + wxASSERT_MSG( ptr, wxT("wxStaticCast() used incorrectly") ); + return ptr; } +#define wxStaticCast(obj, className) \ + ((className *)wxCheckCast(wxDynamicCast(obj, className))) -#define wxStaticCast(obj, className) wxCheckCast((obj), (className *)NULL) +#else // !__WXDEBUG__ +#define wxStaticCast(obj, className) \ + wx_const_cast(className *, wx_static_cast(const className *, obj)) + +#endif // __WXDEBUG__ // ---------------------------------------------------------------------------- // set up memory debugging macros @@ -180,7 +339,7 @@ inline T *wxCheckCast(const void *ptr, T * = NULL) _WX_WANT_ARRAY_DELETE_VOID_WXCHAR_INT = void operator delete[] (void* buf, wxChar*, int ) */ -#if wxUSE_MEMORY_TRACING +#if defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING // All compilers get this one #define _WX_WANT_NEW_SIZET_WXCHAR_INT @@ -195,8 +354,9 @@ inline T *wxCheckCast(const void *ptr, T * = NULL) #define _WX_WANT_DELETE_VOID_CONSTCHAR_SIZET #endif -// Only VC++ 6 gets overloaded delete that matches new -#if (defined(__VISUALC__) && (__VISUALC__ >= 1200)) +// Only VC++ 6 and CodeWarrior get overloaded delete that matches new +#if (defined(__VISUALC__) && (__VISUALC__ >= 1200)) || \ + (defined(__MWERKS__) && (__MWERKS__ >= 0x2400)) #define _WX_WANT_DELETE_VOID_WXCHAR_INT #endif @@ -212,141 +372,32 @@ inline T *wxCheckCast(const void *ptr, T * = NULL) #if !defined(__VISUALC__) #define _WX_WANT_ARRAY_DELETE_VOID #endif + + // Only CodeWarrior 6 or higher + #if defined(__MWERKS__) && (__MWERKS__ >= 0x2400) + #define _WX_WANT_ARRAY_DELETE_VOID_WXCHAR_INT + #endif + #endif // wxUSE_ARRAY_MEMORY_OPERATORS -#endif // wxUSE_MEMORY_TRACING - -// ---------------------------------------------------------------------------- -// Compatibility macro aliases DECLARE group -// ---------------------------------------------------------------------------- -// deprecated variants _not_ requiring a semicolon after them and without wx prefix. -// (note that also some wx-prefixed macro do _not_ require a semicolon because -// it's not always possible to force the compire to require it) - -#define DECLARE_CLASS_INFO_ITERATORS() wxDECLARE_CLASS_INFO_ITERATORS(); -#define DECLARE_ABSTRACT_CLASS(n) wxDECLARE_ABSTRACT_CLASS(n); -#define DECLARE_DYNAMIC_CLASS_NO_ASSIGN(n) wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(n); -#define DECLARE_DYNAMIC_CLASS_NO_COPY(n) wxDECLARE_DYNAMIC_CLASS_NO_COPY(n); -#define DECLARE_DYNAMIC_CLASS(n) wxDECLARE_DYNAMIC_CLASS(n); -#define DECLARE_CLASS(n) wxDECLARE_CLASS(n); - -#define DECLARE_PLUGGABLE_CLASS(n) wxDECLARE_PLUGGABLE_CLASS(n); -#define DECLARE_ABSTRACT_PLUGGABLE_CLASS(n) wxDECLARE_ABSTRACT_PLUGGABLE_CLASS(n); -#define DECLARE_USER_EXPORTED_PLUGGABLE_CLASS(n,u) wxDECLARE_USER_EXPORTED_PLUGGABLE_CLASS(n,u); -#define DECLARE_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS(n,u) wxDECLARE_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS(n,u); - -// ---------------------------------------------------------------------------- -// wxRefCounter: ref counted data "manager" -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxRefCounter -{ -public: - wxRefCounter() { m_count = 1; } - - int GetRefCount() const { return m_count; } - - void IncRef() { m_count++; } - void DecRef(); - -protected: - // this object should never be destroyed directly but only as a - // result of a DecRef() call: - virtual ~wxRefCounter() { } - -private: - // our refcount: - int m_count; - - // It doesn't make sense to copy the reference counted objects, a new ref - // counter should be created for a new object instead and compilation - // errors in the code using wxRefCounter due to the lack of copy ctor often - // indicate a problem, e.g. a forgotten copy ctor implementation somewhere. - wxDECLARE_NO_COPY_CLASS(wxRefCounter); -}; +#endif // __WXDEBUG__ && wxUSE_MEMORY_TRACING // ---------------------------------------------------------------------------- // wxObjectRefData: ref counted data meant to be stored in wxObject // ---------------------------------------------------------------------------- -typedef wxRefCounter wxObjectRefData; - -// ---------------------------------------------------------------------------- -// wxObjectDataPtr: helper class to avoid memleaks because of missing calls -// to wxObjectRefData::DecRef -// ---------------------------------------------------------------------------- - -template -class wxObjectDataPtr +class WXDLLIMPEXP_BASE wxObjectRefData { + friend class WXDLLIMPEXP_FWD_BASE wxObject; + public: - typedef T element_type; + wxObjectRefData() : m_count(1) { } + virtual ~wxObjectRefData() { } - wxEXPLICIT wxObjectDataPtr(T *ptr = NULL) : m_ptr(ptr) {} - - // copy ctor - wxObjectDataPtr(const wxObjectDataPtr &tocopy) - : m_ptr(tocopy.m_ptr) - { - if (m_ptr) - m_ptr->IncRef(); - } - - ~wxObjectDataPtr() - { - if (m_ptr) - m_ptr->DecRef(); - } - - T *get() const { return m_ptr; } - - // test for pointer validity: defining conversion to unspecified_bool_type - // and not more obvious bool to avoid implicit conversions to integer types - typedef T *(wxObjectDataPtr::*unspecified_bool_type)() const; - operator unspecified_bool_type() const - { - return m_ptr ? &wxObjectDataPtr::get : NULL; - } - - T& operator*() const - { - wxASSERT(m_ptr != NULL); - return *(m_ptr); - } - - T *operator->() const - { - wxASSERT(m_ptr != NULL); - return get(); - } - - void reset(T *ptr) - { - if (m_ptr) - m_ptr->DecRef(); - m_ptr = ptr; - } - - wxObjectDataPtr& operator=(const wxObjectDataPtr &tocopy) - { - if (m_ptr) - m_ptr->DecRef(); - m_ptr = tocopy.m_ptr; - if (m_ptr) - m_ptr->IncRef(); - return *this; - } - - wxObjectDataPtr& operator=(T *ptr) - { - if (m_ptr) - m_ptr->DecRef(); - m_ptr = ptr; - return *this; - } + int GetRefCount() const { return m_count; } private: - T *m_ptr; + int m_count; }; // ---------------------------------------------------------------------------- @@ -355,7 +406,7 @@ private: class WXDLLIMPEXP_BASE wxObject { - wxDECLARE_ABSTRACT_CLASS(wxObject); + DECLARE_ABSTRACT_CLASS(wxObject) public: wxObject() { m_refData = NULL; } @@ -365,7 +416,7 @@ public: { m_refData = other.m_refData; if (m_refData) - m_refData->IncRef(); + m_refData->m_count++; } wxObject& operator=(const wxObject& other) @@ -377,7 +428,7 @@ public: return *this; } - bool IsKindOf(const wxClassInfo *info) const; + bool IsKindOf(wxClassInfo *info) const; // Turn on the correct set of new and delete operators @@ -451,48 +502,68 @@ inline wxObject *wxCheckDynamicCast(wxObject *obj, wxClassInfo *classInfo) return obj && obj->GetClassInfo()->IsKindOf(classInfo) ? obj : NULL; } -#include "wx/xti2.h" +#if wxUSE_EXTENDED_RTTI +class WXDLLIMPEXP_BASE wxDynamicObject : public wxObject +{ + friend class WXDLLIMPEXP_BASE wxDynamicClassInfo ; +public: + // instantiates this object with an instance of its superclass + wxDynamicObject(wxObject* superClassInstance, const wxDynamicClassInfo *info) ; + virtual ~wxDynamicObject(); + + void SetProperty (const wxChar *propertyName, const wxxVariant &value); + wxxVariant GetProperty (const wxChar *propertyName) const ; + + // get the runtime identity of this object + wxClassInfo *GetClassInfo() const + { +#ifdef _MSC_VER + return (wxClassInfo*) m_classInfo; +#else + return wx_const_cast(wxClassInfo *, m_classInfo); +#endif + } + + wxObject* GetSuperClassInstance() const + { + return m_superClassInstance ; + } +private : + // removes an existing runtime-property + void RemoveProperty( const wxChar *propertyName ) ; + + // renames an existing runtime-property + void RenameProperty( const wxChar *oldPropertyName , const wxChar *newPropertyName ) ; + + wxObject *m_superClassInstance ; + const wxDynamicClassInfo *m_classInfo; + struct wxDynamicObjectInternal; + wxDynamicObjectInternal *m_data; +}; +#endif // ---------------------------------------------------------------------------- // more debugging macros // ---------------------------------------------------------------------------- -#if wxUSE_DEBUG_NEW_ALWAYS +// Redefine new to be the debugging version. This doesn't work with all +// compilers, in which case you need to use WXDEBUG_NEW explicitly if you wish +// to use the debugging version. + +#ifdef __WXDEBUG__ #define WXDEBUG_NEW new(__TFILE__,__LINE__) - #if wxUSE_GLOBAL_MEMORY_OPERATORS - #define new WXDEBUG_NEW - #elif defined(__VISUALC__) - // Including this file redefines new and allows leak reports to - // contain line numbers - #include "wx/msw/msvcrt.h" - #endif -#endif // wxUSE_DEBUG_NEW_ALWAYS - -// ---------------------------------------------------------------------------- -// Compatibility macro aliases IMPLEMENT group -// ---------------------------------------------------------------------------- - -// deprecated variants _not_ requiring a semicolon after them and without wx prefix. -// (note that also some wx-prefixed macro do _not_ require a semicolon because -// it's not always possible to force the compire to require it) - -#define IMPLEMENT_DYNAMIC_CLASS(n,b) wxIMPLEMENT_DYNAMIC_CLASS(n,b) -#define IMPLEMENT_DYNAMIC_CLASS2(n,b1,b2) wxIMPLEMENT_DYNAMIC_CLASS2(n,b1,b2) -#define IMPLEMENT_ABSTRACT_CLASS(n,b) wxIMPLEMENT_ABSTRACT_CLASS(n,b) -#define IMPLEMENT_ABSTRACT_CLASS2(n,b1,b2) wxIMPLEMENT_ABSTRACT_CLASS2(n,b1,b2) -#define IMPLEMENT_CLASS(n,b) wxIMPLEMENT_CLASS(n,b) -#define IMPLEMENT_CLASS2(n,b1,b2) wxIMPLEMENT_CLASS2(n,b1,b2) - -#define IMPLEMENT_PLUGGABLE_CLASS(n,b) wxIMPLEMENT_PLUGGABLE_CLASS(n,b) -#define IMPLEMENT_PLUGGABLE_CLASS2(n,b,b2) wxIMPLEMENT_PLUGGABLE_CLASS2(n,b,b2) -#define IMPLEMENT_ABSTRACT_PLUGGABLE_CLASS(n,b) wxIMPLEMENT_ABSTRACT_PLUGGABLE_CLASS(n,b) -#define IMPLEMENT_ABSTRACT_PLUGGABLE_CLASS2(n,b,b2) wxIMPLEMENT_ABSTRACT_PLUGGABLE_CLASS2(n,b,b2) -#define IMPLEMENT_USER_EXPORTED_PLUGGABLE_CLASS(n,b) wxIMPLEMENT_USER_EXPORTED_PLUGGABLE_CLASS(n,b) -#define IMPLEMENT_USER_EXPORTED_PLUGGABLE_CLASS2(n,b,b2) wxIMPLEMENT_USER_EXPORTED_PLUGGABLE_CLASS2(n,b,b2) -#define IMPLEMENT_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS(n,b) wxIMPLEMENT_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS(n,b) -#define IMPLEMENT_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS2(n,b,b2) wxIMPLEMENT_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS2(n,b,b2) - -#define CLASSINFO(n) wxCLASSINFO(n) + #if wxUSE_DEBUG_NEW_ALWAYS + #if wxUSE_GLOBAL_MEMORY_OPERATORS + #define new WXDEBUG_NEW + #elif defined(__VISUALC__) + // Including this file redefines new and allows leak reports to + // contain line numbers + #include "wx/msw/msvcrt.h" + #endif + #endif // wxUSE_DEBUG_NEW_ALWAYS +#else // !__WXDEBUG__ + #define WXDEBUG_NEW new +#endif // __WXDEBUG__/!__WXDEBUG__ #endif // _WX_OBJECTH__ diff --git a/Source/3rd Party/wx/include/wx/overlay.h b/Source/3rd Party/wx/include/wx/overlay.h index 05ab1c1e2..d0d2a11aa 100644 --- a/Source/3rd Party/wx/include/wx/overlay.h +++ b/Source/3rd Party/wx/include/wx/overlay.h @@ -4,7 +4,7 @@ // Author: Stefan Csomor // Modified by: // Created: 2006-10-20 -// RCS-ID: $Id$ +// RCS-ID: $Id: overlay.h 53135 2008-04-12 02:31:04Z VZ $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -14,7 +14,7 @@ #include "wx/defs.h" -#if defined(__WXMAC__) && wxOSX_USE_CARBON +#if defined(wxMAC_USE_CORE_GRAPHICS) && wxMAC_USE_CORE_GRAPHICS #define wxHAS_NATIVE_OVERLAY 1 #elif defined(__WXDFB__) #define wxHAS_NATIVE_OVERLAY 1 @@ -29,9 +29,9 @@ // ---------------------------------------------------------------------------- class WXDLLIMPEXP_FWD_CORE wxOverlayImpl; -class WXDLLIMPEXP_FWD_CORE wxDC; +class WXDLLIMPEXP_FWD_CORE wxWindowDC; -class WXDLLIMPEXP_CORE wxOverlay +class WXDLLEXPORT wxOverlay { public: wxOverlay(); @@ -50,32 +50,32 @@ private: // returns true if it has been setup bool IsOk(); - void Init(wxDC* dc, int x , int y , int width , int height); + void Init(wxWindowDC* dc, int x , int y , int width , int height); - void BeginDrawing(wxDC* dc); + void BeginDrawing(wxWindowDC* dc); - void EndDrawing(wxDC* dc); + void EndDrawing(wxWindowDC* dc); - void Clear(wxDC* dc); + void Clear(wxWindowDC* dc); wxOverlayImpl* m_impl; bool m_inDrawing; - wxDECLARE_NO_COPY_CLASS(wxOverlay); + DECLARE_NO_COPY_CLASS(wxOverlay) }; -class WXDLLIMPEXP_CORE wxDCOverlay +class WXDLLEXPORT wxDCOverlay { public: // connects this overlay to the corresponding drawing dc, if the overlay is // not initialized yet this call will do so - wxDCOverlay(wxOverlay &overlay, wxDC *dc, int x , int y , int width , int height); + wxDCOverlay(wxOverlay &overlay, wxWindowDC *dc, int x , int y , int width , int height); // convenience wrapper that behaves the same using the entire area of the dc - wxDCOverlay(wxOverlay &overlay, wxDC *dc); + wxDCOverlay(wxOverlay &overlay, wxWindowDC *dc); // removes the connection between the overlay and the dc virtual ~wxDCOverlay(); @@ -84,14 +84,14 @@ public: void Clear(); private: - void Init(wxDC *dc, int x , int y , int width , int height); + void Init(wxWindowDC *dc, int x , int y , int width , int height); wxOverlay& m_overlay; - wxDC* m_dc; + wxWindowDC* m_dc; - wxDECLARE_NO_COPY_CLASS(wxDCOverlay); + DECLARE_NO_COPY_CLASS(wxDCOverlay) }; #endif // _WX_OVERLAY_H_ diff --git a/Source/3rd Party/wx/include/wx/ownerdrw.h b/Source/3rd Party/wx/include/wx/ownerdrw.h index 5811ef62a..fe673cec8 100644 --- a/Source/3rd Party/wx/include/wx/ownerdrw.h +++ b/Source/3rd Party/wx/include/wx/ownerdrw.h @@ -1,25 +1,24 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: wx/ownerdrw.h +// Name: ownerdrw.h // Purpose: interface for owner-drawn GUI elements // Author: Vadim Zeitlin -// Modified by: Marcin Malich +// Modified by: // Created: 11.11.97 -// RCS-ID: $Id$ +// RCS-ID: $Id: ownerdrw.h 62511 2009-10-30 14:11:03Z JMS $ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// -#ifndef _WX_OWNERDRW_H_BASE -#define _WX_OWNERDRW_H_BASE +#ifndef _OWNERDRW_H +#define _OWNERDRW_H #include "wx/defs.h" #if wxUSE_OWNER_DRAWN -#include "wx/font.h" +#include "wx/bitmap.h" #include "wx/colour.h" - -class WXDLLIMPEXP_FWD_CORE wxDC; +#include "wx/font.h" // ---------------------------------------------------------------------------- // wxOwnerDrawn - a mix-in base class, derive from it to implement owner-drawn @@ -30,116 +29,156 @@ class WXDLLIMPEXP_FWD_CORE wxDC; // element or one unchangeable bitmap otherwise. // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxOwnerDrawnBase +class WXDLLEXPORT wxOwnerDrawn { public: - wxOwnerDrawnBase() - { - m_ownerDrawn = false; - m_margin = ms_defaultMargin; - } + // ctor & dtor + wxOwnerDrawn(const wxString& str = wxEmptyString, + bool bCheckable = false, + bool bMenuItem = false); // FIXME kludge for colors + virtual ~wxOwnerDrawn(); - virtual ~wxOwnerDrawnBase() {} + // fix appearance + void SetFont(const wxFont& font) + { m_font = font; m_bOwnerDrawn = true; } - void SetFont(const wxFont& font) - { m_font = font; m_ownerDrawn = true; } + wxFont& GetFont() const { return (wxFont &)m_font; } - wxFont& GetFont() const - { return (wxFont&) m_font; } + void SetTextColour(const wxColour& colText) + { m_colText = colText; m_bOwnerDrawn = true; } + wxColour& GetTextColour() const { return (wxColour&) m_colText; } - void SetTextColour(const wxColour& colText) - { m_colText = colText; m_ownerDrawn = true; } + void SetBackgroundColour(const wxColour& colBack) + { m_colBack = colBack; m_bOwnerDrawn = true; } - wxColour& GetTextColour() const - { return (wxColour&) m_colText; } + wxColour& GetBackgroundColour() const + { return (wxColour&) m_colBack ; } - void SetBackgroundColour(const wxColour& colBack) - { m_colBack = colBack; m_ownerDrawn = true; } + void SetBitmaps(const wxBitmap& bmpChecked, + const wxBitmap& bmpUnchecked = wxNullBitmap) + { m_bmpChecked = bmpChecked; + m_bmpUnchecked = bmpUnchecked; + m_bOwnerDrawn = true; } - wxColour& GetBackgroundColour() const - { return (wxColour&) m_colBack ; } + void SetBitmap(const wxBitmap& bmpChecked) + { m_bmpChecked = bmpChecked; + m_bOwnerDrawn = true; } + void SetDisabledBitmap( const wxBitmap& bmpDisabled ) + { m_bmpDisabled = bmpDisabled; + m_bOwnerDrawn = true; } - void SetMarginWidth(int width) - { m_margin = width; } + const wxBitmap& GetBitmap(bool bChecked = true) const + { return (bChecked ? m_bmpChecked : m_bmpUnchecked); } - int GetMarginWidth() const - { return m_margin; } + const wxBitmap& GetDisabledBitmap() const + { return m_bmpDisabled; } - static int GetDefaultMarginWidth() - { return ms_defaultMargin; } + // the height of the menu checkmark (or bitmap) is determined by the font + // for the current item, but the width should be always the same (for the + // items to be aligned), so by default it's taken to be the same as for + // the last item (and default width for the first one). + // + // NB: default is too small for bitmaps, but ok for checkmarks. + void SetMarginWidth(int nWidth) + { + ms_nLastMarginWidth = m_nMarginWidth = (size_t) nWidth; + if ( ((size_t) nWidth) != ms_nDefaultMarginWidth ) + m_bOwnerDrawn = true; + } + int GetMarginWidth() const { return (int) m_nMarginWidth; } + static int GetDefaultMarginWidth() { return (int) ms_nDefaultMarginWidth; } - // get item name (with mnemonics if exist) - virtual wxString GetName() const = 0; + // accessors + void SetName(const wxString& strName) { m_strName = strName; } + const wxString& GetName() const { return m_strName; } + void SetCheckable(bool checkable) { m_bCheckable = checkable; } + bool IsCheckable() const { return m_bCheckable; } + // this is for menu items only: accel string is drawn right aligned after the + // menu item if not empty + void SetAccelString(const wxString& strAccel) { m_strAccel = strAccel; } // this function might seem strange, but if it returns false it means that // no non-standard attribute are set, so there is no need for this control // to be owner-drawn. Moreover, you can force owner-drawn to false if you // want to change, say, the color for the item but only if it is owner-drawn // (see wxMenuItem::wxMenuItem for example) - bool IsOwnerDrawn() const - { return m_ownerDrawn; } + bool IsOwnerDrawn() const { return m_bOwnerDrawn; } - // switch on/off owner-drawing the item - void SetOwnerDrawn(bool ownerDrawn = true) - { m_ownerDrawn = ownerDrawn; } + // switch on/off owner-drawing the item + void SetOwnerDrawn(bool ownerDrawn = true) { m_bOwnerDrawn = ownerDrawn; } + void ResetOwnerDrawn() { m_bOwnerDrawn = false; } +public: + // constants used in OnDrawItem + // (they have the same values as corresponding Win32 constants) + enum wxODAction + { + wxODDrawAll = 0x0001, // redraw entire control + wxODSelectChanged = 0x0002, // selection changed (see Status.Select) + wxODFocusChanged = 0x0004 // keyboard focus changed (see Status.Focus) + }; - // constants used in OnDrawItem - // (they have the same values as corresponding Win32 constants) - enum wxODAction - { - wxODDrawAll = 0x0001, // redraw entire control - wxODSelectChanged = 0x0002, // selection changed (see Status.Select) - wxODFocusChanged = 0x0004 // keyboard focus changed (see Status.Focus) - }; + enum wxODStatus + { + wxODSelected = 0x0001, // control is currently selected + wxODGrayed = 0x0002, // item is to be grayed + wxODDisabled = 0x0004, // item is to be drawn as disabled + wxODChecked = 0x0008, // item is to be checked + wxODHasFocus = 0x0010, // item has the keyboard focus + wxODDefault = 0x0020, // item is the default item + wxODHidePrefix= 0x0100 // hide keyboard cues (w2k and xp only) + }; - enum wxODStatus - { - wxODSelected = 0x0001, // control is currently selected - wxODGrayed = 0x0002, // item is to be grayed - wxODDisabled = 0x0004, // item is to be drawn as disabled - wxODChecked = 0x0008, // item is to be checked - wxODHasFocus = 0x0010, // item has the keyboard focus - wxODDefault = 0x0020, // item is the default item - wxODHidePrefix= 0x0100 // hide keyboard cues (w2k and xp only) - }; - - // virtual functions to implement drawing (return true if processed) - virtual bool OnMeasureItem(size_t *width, size_t *height); - virtual bool OnDrawItem(wxDC& dc, const wxRect& rc, wxODAction act, wxODStatus stat) = 0; + // virtual functions to implement drawing (return true if processed) + virtual bool OnMeasureItem(size_t *pwidth, size_t *pheight); + virtual bool OnDrawItem(wxDC& dc, const wxRect& rc, wxODAction act, wxODStatus stat); protected: + // return true if this is a menu item + bool IsMenuItem() const; - // get the font and colour to use, whether it is set or not - virtual void GetFontToUse(wxFont& font) const; - virtual void GetColourToUse(wxODStatus stat, wxColour& colText, wxColour& colBack) const; + // get the font to use, whether m_font is set or not + wxFont GetFontToUse() const; + + // Same as wxOwnerDrawn::SetMarginWidth() but does not affect + // ms_nLastMarginWidth. Exists solely to work around bug #4068, + // and will not exist in wxWidgets 2.9.0 and later. + void SetOwnMarginWidth(int nWidth) + { + m_nMarginWidth = (size_t) nWidth; + if ( ((size_t) nWidth) != ms_nDefaultMarginWidth ) + m_bOwnerDrawn = true; + } + + + wxString m_strName, // label for a manu item + m_strAccel; // the accel string ("Ctrl-F17") if any private: - bool m_ownerDrawn; // true if something is non standard + static size_t ms_nDefaultMarginWidth; // menu check mark width + static size_t ms_nLastMarginWidth; // handy for aligning all items - wxFont m_font; // font to use for drawing - wxColour m_colText, // color ----"---"---"---- - m_colBack; // background color + bool m_bCheckable, // used only for menu or check listbox items + m_bOwnerDrawn, // true if something is non standard + m_isMenuItem; // true if this is a menu item - int m_margin; // space occupied by bitmap to the left of the item + wxFont m_font; // font to use for drawing + wxColour m_colText, // color ----"---"---"---- + m_colBack; // background color + wxBitmap m_bmpChecked, // bitmap to put near the item + m_bmpUnchecked, // (checked is used also for 'uncheckable' items) + m_bmpDisabled; - static int ms_defaultMargin; + size_t m_nHeight, // font height + m_nMinHeight, // minimum height, as determined by user's system settings + m_nMarginWidth; // space occupied by bitmap to the left of the item }; -// ---------------------------------------------------------------------------- -// include the platform-specific class declaration -// ---------------------------------------------------------------------------- - -#if defined(__WXMSW__) - #include "wx/msw/ownerdrw.h" -#elif defined(__WXPM__) - #include "wx/os2/ownerdrw.h" -#endif - #endif // wxUSE_OWNER_DRAWN -#endif // _WX_OWNERDRW_H_BASE +#endif + // _OWNERDRW_H diff --git a/Source/3rd Party/wx/include/wx/palette.h b/Source/3rd Party/wx/include/wx/palette.h index 2972af570..3b2e3cb78 100644 --- a/Source/3rd Party/wx/include/wx/palette.h +++ b/Source/3rd Party/wx/include/wx/palette.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: -// RCS-ID: $Id$ +// RCS-ID: $Id: palette.h 61872 2009-09-09 22:37:05Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// @@ -20,26 +20,40 @@ #include "wx/gdiobj.h" // wxPaletteBase -class WXDLLIMPEXP_CORE wxPaletteBase: public wxGDIObject +class WXDLLEXPORT wxPaletteBase: public wxGDIObject { public: virtual ~wxPaletteBase() { } + virtual bool Ok() const { return IsOk(); } + virtual bool IsOk() const = 0; virtual int GetColoursCount() const { wxFAIL_MSG( wxT("not implemented") ); return 0; } }; -#if defined(__WXMSW__) +#if defined(__WXPALMOS__) + #include "wx/palmos/palette.h" +#elif defined(__WXMSW__) #include "wx/msw/palette.h" -#elif defined(__WXX11__) || defined(__WXMOTIF__) - #include "wx/x11/palette.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/palette.h" #elif defined(__WXGTK__) || defined(__WXCOCOA__) #include "wx/generic/paletteg.h" +#elif defined(__WXX11__) + #include "wx/x11/palette.h" +#elif defined(__WXMGL__) + #include "wx/mgl/palette.h" #elif defined(__WXMAC__) - #include "wx/osx/palette.h" + #include "wx/mac/palette.h" #elif defined(__WXPM__) #include "wx/os2/palette.h" #endif +#if WXWIN_COMPATIBILITY_2_4 + #define wxColorMap wxPalette + #define wxColourMap wxPalette +#endif + #endif // wxUSE_PALETTE -#endif // _WX_PALETTE_H_BASE_ +#endif + // _WX_PALETTE_H_BASE_ diff --git a/Source/3rd Party/wx/include/wx/panel.h b/Source/3rd Party/wx/include/wx/panel.h index 4ed7c95a8..260e2b972 100644 --- a/Source/3rd Party/wx/include/wx/panel.h +++ b/Source/3rd Party/wx/include/wx/panel.h @@ -4,70 +4,15 @@ // Author: Julian Smart // Modified by: // Created: -// RCS-ID: $Id$ +// RCS-ID: $Id: panel.h 33948 2005-05-04 18:57:50Z JS $ // Copyright: (c) Julian Smart -// (c) 2011 Vadim Zeitlin // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_PANEL_H_BASE_ #define _WX_PANEL_H_BASE_ -// ---------------------------------------------------------------------------- -// headers and forward declarations -// ---------------------------------------------------------------------------- +#include "wx/generic/panelg.h" -#include "wx/window.h" -#include "wx/containr.h" - -class WXDLLIMPEXP_FWD_CORE wxControlContainer; - -extern WXDLLIMPEXP_DATA_CORE(const char) wxPanelNameStr[]; - -// ---------------------------------------------------------------------------- -// wxPanel contains other controls and implements TAB traversal between them -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxPanelBase : public wxNavigationEnabled -{ -public: - wxPanelBase() { } - - // Derived classes should also provide this constructor: - /* - wxPanelBase(wxWindow *parent, - wxWindowID winid = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxTAB_TRAVERSAL | wxNO_BORDER, - const wxString& name = wxPanelNameStr); - */ - - // Pseudo ctor - bool Create(wxWindow *parent, - wxWindowID winid = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxTAB_TRAVERSAL | wxNO_BORDER, - const wxString& name = wxPanelNameStr); - - - // implementation from now on - // -------------------------- - - virtual void InitDialog(); - -private: - wxDECLARE_NO_COPY_CLASS(wxPanelBase); -}; - -#if defined(__WXUNIVERSAL__) - #include "wx/univ/panel.h" -#elif defined(__WXMSW__) - #include "wx/msw/panel.h" -#else - #define wxHAS_GENERIC_PANEL - #include "wx/generic/panelg.h" #endif - -#endif // _WX_PANELH_BASE_ + // _WX_PANELH_BASE_ diff --git a/Source/3rd Party/wx/include/wx/paper.h b/Source/3rd Party/wx/include/wx/paper.h index d980961d8..fe69bd471 100644 --- a/Source/3rd Party/wx/include/wx/paper.h +++ b/Source/3rd Party/wx/include/wx/paper.h @@ -1,10 +1,10 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/paper.h +// Name: paper.h // Purpose: Paper database types and classes // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: paper.h 53135 2008-04-12 02:31:04Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -30,7 +30,7 @@ #define WXADDPAPER(paperId, platformId, name, w, h) AddPaperType(paperId, 0, name, w, h) #endif -class WXDLLIMPEXP_CORE wxPrintPaperType: public wxObject +class WXDLLEXPORT wxPrintPaperType: public wxObject { public: wxPrintPaperType(); @@ -70,7 +70,7 @@ WX_DECLARE_STRING_HASH_MAP(wxPrintPaperType*, wxStringToPrintPaperTypeHashMap); class WXDLLIMPEXP_FWD_CORE wxPrintPaperTypeList; -class WXDLLIMPEXP_CORE wxPrintPaperDatabase +class WXDLLEXPORT wxPrintPaperDatabase { public: wxPrintPaperDatabase(); @@ -115,7 +115,7 @@ private: // DECLARE_DYNAMIC_CLASS(wxPrintPaperDatabase) }; -extern WXDLLIMPEXP_DATA_CORE(wxPrintPaperDatabase*) wxThePrintPaperDatabase; +extern WXDLLEXPORT_DATA(wxPrintPaperDatabase*) wxThePrintPaperDatabase; #endif diff --git a/Source/3rd Party/wx/include/wx/pen.h b/Source/3rd Party/wx/include/wx/pen.h index 28100cf21..cd28212f5 100644 --- a/Source/3rd Party/wx/include/wx/pen.h +++ b/Source/3rd Party/wx/include/wx/pen.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: -// RCS-ID: $Id$ +// RCS-ID: $Id: pen.h 40865 2006-08-27 09:42:42Z VS $ // Copyright: (c) Julian Smart // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// @@ -12,154 +12,29 @@ #ifndef _WX_PEN_H_BASE_ #define _WX_PEN_H_BASE_ -#include "wx/gdiobj.h" -#include "wx/gdicmn.h" +#include "wx/defs.h" -enum wxPenStyle -{ - wxPENSTYLE_INVALID = -1, - - wxPENSTYLE_SOLID = wxSOLID, - wxPENSTYLE_DOT = wxDOT, - wxPENSTYLE_LONG_DASH = wxLONG_DASH, - wxPENSTYLE_SHORT_DASH = wxSHORT_DASH, - wxPENSTYLE_DOT_DASH = wxDOT_DASH, - wxPENSTYLE_USER_DASH = wxUSER_DASH, - - wxPENSTYLE_TRANSPARENT = wxTRANSPARENT, - - wxPENSTYLE_STIPPLE_MASK_OPAQUE = wxSTIPPLE_MASK_OPAQUE, - wxPENSTYLE_STIPPLE_MASK = wxSTIPPLE_MASK, - wxPENSTYLE_STIPPLE = wxSTIPPLE, - - wxPENSTYLE_BDIAGONAL_HATCH = wxHATCHSTYLE_BDIAGONAL, - wxPENSTYLE_CROSSDIAG_HATCH = wxHATCHSTYLE_CROSSDIAG, - wxPENSTYLE_FDIAGONAL_HATCH = wxHATCHSTYLE_FDIAGONAL, - wxPENSTYLE_CROSS_HATCH = wxHATCHSTYLE_CROSS, - wxPENSTYLE_HORIZONTAL_HATCH = wxHATCHSTYLE_HORIZONTAL, - wxPENSTYLE_VERTICAL_HATCH = wxHATCHSTYLE_VERTICAL, - wxPENSTYLE_FIRST_HATCH = wxHATCHSTYLE_FIRST, - wxPENSTYLE_LAST_HATCH = wxHATCHSTYLE_LAST -}; - -enum wxPenJoin -{ - wxJOIN_INVALID = -1, - - wxJOIN_BEVEL = 120, - wxJOIN_MITER, - wxJOIN_ROUND -}; - -enum wxPenCap -{ - wxCAP_INVALID = -1, - - wxCAP_ROUND = 130, - wxCAP_PROJECTING, - wxCAP_BUTT -}; - - -class WXDLLIMPEXP_CORE wxPenBase : public wxGDIObject -{ -public: - virtual ~wxPenBase() { } - - virtual void SetColour(const wxColour& col) = 0; - virtual void SetColour(unsigned char r, unsigned char g, unsigned char b) = 0; - - virtual void SetWidth(int width) = 0; - virtual void SetStyle(wxPenStyle style) = 0; - virtual void SetStipple(const wxBitmap& stipple) = 0; - virtual void SetDashes(int nb_dashes, const wxDash *dash) = 0; - virtual void SetJoin(wxPenJoin join) = 0; - virtual void SetCap(wxPenCap cap) = 0; - - virtual wxColour GetColour() const = 0; - virtual wxBitmap *GetStipple() const = 0; - virtual wxPenStyle GetStyle() const = 0; - virtual wxPenJoin GetJoin() const = 0; - virtual wxPenCap GetCap() const = 0; - virtual int GetWidth() const = 0; - virtual int GetDashes(wxDash **ptr) const = 0; - - // Convenient helpers for testing whether the pen is a transparent one: - // unlike GetStyle() == wxPENSTYLE_TRANSPARENT, they work correctly even if - // the pen is invalid (they both return false in this case). - bool IsTransparent() const - { - return IsOk() && GetStyle() == wxPENSTYLE_TRANSPARENT; - } - - bool IsNonTransparent() const - { - return IsOk() && GetStyle() != wxPENSTYLE_TRANSPARENT; - } -}; - -#if defined(__WXMSW__) - #include "wx/msw/pen.h" +#if defined(__WXPALMOS__) +#include "wx/palmos/pen.h" +#elif defined(__WXMSW__) +#include "wx/msw/pen.h" #elif defined(__WXMOTIF__) || defined(__WXX11__) - #include "wx/x11/pen.h" +#include "wx/x11/pen.h" #elif defined(__WXGTK20__) - #include "wx/gtk/pen.h" +#include "wx/gtk/pen.h" #elif defined(__WXGTK__) - #include "wx/gtk1/pen.h" +#include "wx/gtk1/pen.h" +#elif defined(__WXMGL__) +#include "wx/mgl/pen.h" #elif defined(__WXDFB__) - #include "wx/dfb/pen.h" +#include "wx/dfb/pen.h" #elif defined(__WXMAC__) - #include "wx/osx/pen.h" +#include "wx/mac/pen.h" #elif defined(__WXCOCOA__) - #include "wx/cocoa/pen.h" +#include "wx/cocoa/pen.h" #elif defined(__WXPM__) - #include "wx/os2/pen.h" +#include "wx/os2/pen.h" #endif -class WXDLLIMPEXP_CORE wxPenList: public wxGDIObjListBase -{ -public: - wxPen *FindOrCreatePen(const wxColour& colour, - int width = 1, - wxPenStyle style = wxPENSTYLE_SOLID); - -#if FUTURE_WXWIN_COMPATIBILITY_3_0 - wxPen *FindOrCreatePen(const wxColour& colour, int width, int style) - { return FindOrCreatePen(colour, width, (wxPenStyle)style); } #endif -#if WXWIN_COMPATIBILITY_2_6 - wxDEPRECATED( void AddPen(wxPen*) ); - wxDEPRECATED( void RemovePen(wxPen*) ); -#endif -}; - -extern WXDLLIMPEXP_DATA_CORE(wxPenList*) wxThePenList; - -// provide comparison operators to allow code such as -// -// if ( pen.GetStyle() == wxTRANSPARENT ) -// -// to compile without warnings which it would otherwise provoke from some -// compilers as it compares elements of different enums -#if FUTURE_WXWIN_COMPATIBILITY_3_0 - -// Unfortunately some compilers have ambiguity issues when enum comparisons are -// overloaded so we have to disable the overloads in this case, see -// wxCOMPILER_NO_OVERLOAD_ON_ENUM definition in wx/platform.h for more details. -#ifndef wxCOMPILER_NO_OVERLOAD_ON_ENUM - -inline bool operator==(wxPenStyle s, wxDeprecatedGUIConstants t) -{ - return static_cast(s) == static_cast(t); -} - -inline bool operator!=(wxPenStyle s, wxDeprecatedGUIConstants t) -{ - return !(s == t); -} - -#endif // wxCOMPILER_NO_OVERLOAD_ON_ENUM - -#endif // FUTURE_WXWIN_COMPATIBILITY_3_0 - -#endif // _WX_PEN_H_BASE_ + // _WX_PEN_H_BASE_ diff --git a/Source/3rd Party/wx/include/wx/persist.h b/Source/3rd Party/wx/include/wx/persist.h deleted file mode 100644 index c94d89b71..000000000 --- a/Source/3rd Party/wx/include/wx/persist.h +++ /dev/null @@ -1,264 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/persist.h -// Purpose: common classes for persistence support -// Author: Vadim Zeitlin -// Created: 2009-01-18 -// RCS-ID: $Id$ -// Copyright: (c) 2009 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_PERSIST_H_ -#define _WX_PERSIST_H_ - -#include "wx/string.h" -#include "wx/hashmap.h" -#include "wx/confbase.h" - -class wxPersistentObject; - -WX_DECLARE_VOIDPTR_HASH_MAP(wxPersistentObject *, wxPersistentObjectsMap); - -// ---------------------------------------------------------------------------- -// global functions -// ---------------------------------------------------------------------------- - -/* - We do _not_ declare this function as doing this would force us to specialize - it for the user classes deriving from the standard persistent classes. - However we do define overloads of wxCreatePersistentObject() for all the wx - classes which means that template wxPersistentObject::Restore() picks up the - right overload to use provided that the header defining the correct overload - is included before calling it. And a compilation error happens if this is - not done. - -template -wxPersistentObject *wxCreatePersistentObject(T *obj); - - */ - -// ---------------------------------------------------------------------------- -// wxPersistenceManager: global aspects of persistent windows -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxPersistenceManager -{ -public: - // Call this method to specify a non-default persistence manager to use. - // This function should usually be called very early to affect creation of - // all persistent controls and the object passed to it must have a lifetime - // long enough to be still alive when the persistent controls are destroyed - // and need it to save their state so typically this would be a global or a - // wxApp member. - static void Set(wxPersistenceManager& manager); - - // accessor to the unique persistence manager object - static wxPersistenceManager& Get(); - - // trivial but virtual dtor - // - // FIXME-VC6: this only needs to be public because of VC6 bug - virtual ~wxPersistenceManager(); - - - // globally disable restoring or saving the persistent properties (both are - // enabled by default) - void DisableSaving() { m_doSave = false; } - void DisableRestoring() { m_doRestore = false; } - - - // register an object with the manager: when using the first overload, - // wxCreatePersistentObject() must be specialized for this object class; - // with the second one the persistent adapter is created by the caller - // - // the object shouldn't be already registered with us - template - wxPersistentObject *Register(T *obj) - { - return Register(obj, wxCreatePersistentObject(obj)); - } - - wxPersistentObject *Register(void *obj, wxPersistentObject *po); - - // check if the object is registered and return the associated - // wxPersistentObject if it is or NULL otherwise - wxPersistentObject *Find(void *obj) const; - - // unregister the object, this is called by wxPersistentObject itself so - // there is usually no need to do it explicitly - // - // deletes the associated wxPersistentObject - void Unregister(void *obj); - - - // save/restore the state of an object - // - // these methods do nothing if DisableSaving/Restoring() was called - // - // Restore() returns true if the object state was really restored - void Save(void *obj); - bool Restore(void *obj); - - // combines both Save() and Unregister() calls - void SaveAndUnregister(void *obj) - { - Save(obj); - Unregister(obj); - } - - // combines both Register() and Restore() calls - template - bool RegisterAndRestore(T *obj) - { - return Register(obj) && Restore(obj); - } - - bool RegisterAndRestore(void *obj, wxPersistentObject *po) - { - return Register(obj, po) && Restore(obj); - } - - - // methods used by the persistent objects to save and restore the data - // - // currently these methods simply use wxConfig::Get() but they may be - // overridden in the derived class (once we allow creating custom - // persistent managers) -#define wxPERSIST_DECLARE_SAVE_RESTORE_FOR(Type) \ - virtual bool SaveValue(const wxPersistentObject& who, \ - const wxString& name, \ - Type value); \ - \ - virtual bool \ - RestoreValue(const wxPersistentObject& who, \ - const wxString& name, \ - Type *value) - - wxPERSIST_DECLARE_SAVE_RESTORE_FOR(bool); - wxPERSIST_DECLARE_SAVE_RESTORE_FOR(int); - wxPERSIST_DECLARE_SAVE_RESTORE_FOR(long); - wxPERSIST_DECLARE_SAVE_RESTORE_FOR(wxString); - -#undef wxPERSIST_DECLARE_SAVE_RESTORE_FOR - -protected: - // ctor is private, use Get() - wxPersistenceManager() - { - m_doSave = - m_doRestore = true; - } - - - // Return the config object to use, by default just the global one but a - // different one could be used by the derived class if needed. - virtual wxConfigBase *GetConfig() const { return wxConfigBase::Get(); } - - // Return the path to use for saving the setting with the given name for - // the specified object (notice that the name is the name of the setting, - // not the name of the object itself which can be retrieved with GetName()). - virtual wxString GetKey(const wxPersistentObject& who, - const wxString& name) const; - - -private: - // map with the registered objects as keys and associated - // wxPersistentObjects as values - wxPersistentObjectsMap m_persistentObjects; - - // true if we should restore/save the settings (it doesn't make much sense - // to use this class when both of them are false but setting one of them to - // false may make sense in some situations) - bool m_doSave, - m_doRestore; - - wxDECLARE_NO_COPY_CLASS(wxPersistenceManager); -}; - -// ---------------------------------------------------------------------------- -// wxPersistentObject: ABC for anything persistent -// ---------------------------------------------------------------------------- - -class wxPersistentObject -{ -public: - // ctor associates us with the object whose options we save/restore - wxPersistentObject(void *obj) : m_obj(obj) { } - - // trivial but virtual dtor - virtual ~wxPersistentObject() { } - - - // methods used by wxPersistenceManager - // ------------------------------------ - - // save/restore the corresponding objects settings - // - // these methods shouldn't be used directly as they don't respect the - // global wxPersistenceManager::DisableSaving/Restoring() settings, use - // wxPersistenceManager methods with the same name instead - virtual void Save() const = 0; - virtual bool Restore() = 0; - - - // get the kind of the objects we correspond to, e.g. "Frame" - virtual wxString GetKind() const = 0; - - // get the name of the object we correspond to, e.g. "Main" - virtual wxString GetName() const = 0; - - - // return the associated object - void *GetObject() const { return m_obj; } - -protected: - // wrappers for wxPersistenceManager methods which don't require passing - // "this" as the first parameter all the time - template - bool SaveValue(const wxString& name, T value) const - { - return wxPersistenceManager::Get().SaveValue(*this, name, value); - } - - template - bool RestoreValue(const wxString& name, T *value) - { - return wxPersistenceManager::Get().RestoreValue(*this, name, value); - } - -private: - void * const m_obj; - - wxDECLARE_NO_COPY_CLASS(wxPersistentObject); -}; - -// FIXME-VC6: VC6 has troubles with template methods of DLL-exported classes, -// apparently it believes they should be defined in the DLL (which -// is, of course, impossible as the DLL doesn't know for which types -// will they be instantiated) instead of compiling them when -// building the main application itself. Because of this problem -// (which only arises in debug build!) we can't use the usual -// RegisterAndRestore(obj) with it and need to explicitly create the -// persistence adapter. To hide this ugliness we define a global -// function which does it for us. -template -inline bool wxPersistentRegisterAndRestore(T *obj) -{ - wxPersistentObject * const pers = wxCreatePersistentObject(obj); - - return wxPersistenceManager::Get().RegisterAndRestore(obj, pers); - -} - -// A helper function which also sets the name for the (wxWindow-derived) object -// before registering and restoring it. -template -inline bool wxPersistentRegisterAndRestore(T *obj, const wxString& name) -{ - obj->SetName(name); - - return wxPersistentRegisterAndRestore(obj); -} - -#endif // _WX_PERSIST_H_ - diff --git a/Source/3rd Party/wx/include/wx/pickerbase.h b/Source/3rd Party/wx/include/wx/pickerbase.h index 0a489a45e..da79f2dea 100644 --- a/Source/3rd Party/wx/include/wx/pickerbase.h +++ b/Source/3rd Party/wx/include/wx/pickerbase.h @@ -5,7 +5,7 @@ // Modified by: // Created: 14/4/2006 // Copyright: (c) Vadim Zeitlin, Francesco Montorsi -// RCS-ID: $Id$ +// RCS-ID: $Id: pickerbase.h 49804 2007-11-10 01:09:42Z VZ $ // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// @@ -19,7 +19,7 @@ class WXDLLIMPEXP_FWD_CORE wxTextCtrl; class WXDLLIMPEXP_FWD_CORE wxToolTip; -extern WXDLLIMPEXP_DATA_CORE(const char) wxButtonNameStr[]; +extern WXDLLEXPORT_DATA(const wxChar) wxButtonNameStr[]; // ---------------------------------------------------------------------------- // wxPickerBase is the base class for the picker controls which support @@ -31,14 +31,13 @@ extern WXDLLIMPEXP_DATA_CORE(const char) wxButtonNameStr[]; // ---------------------------------------------------------------------------- #define wxPB_USE_TEXTCTRL 0x0002 -#define wxPB_SMALL 0x8000 -class WXDLLIMPEXP_CORE wxPickerBase : public wxNavigationEnabled +class WXDLLIMPEXP_CORE wxPickerBase : public wxControl { public: // ctor: text is the associated text control wxPickerBase() : m_text(NULL), m_picker(NULL), m_sizer(NULL) - { } + { m_container.SetContainerWindow(this); } virtual ~wxPickerBase() {} @@ -106,11 +105,6 @@ public: // public API wxControl *GetPickerCtrl() { return m_picker; } - void SetTextCtrl(wxTextCtrl* text) - { m_text = text; } - void SetPickerCtrl(wxControl* picker) - { m_picker = picker; } - // methods that derived class must/may override virtual void UpdatePickerFromTextCtrl() = 0; virtual void UpdateTextCtrlFromPicker() = 0; @@ -127,6 +121,8 @@ protected: void OnTextCtrlUpdate(wxCommandEvent &); void OnTextCtrlKillFocus(wxFocusEvent &); + void OnSize(wxSizeEvent &); + // returns the set of styles for the attached wxTextCtrl // from given wxPickerBase's styles virtual long GetTextCtrlStyle(long style) const @@ -182,6 +178,10 @@ protected: private: DECLARE_ABSTRACT_CLASS(wxPickerBase) + DECLARE_EVENT_TABLE() + + // This class must be something just like a panel... + WX_DECLARE_CONTROL_CONTAINER(); }; diff --git a/Source/3rd Party/wx/include/wx/platform.h b/Source/3rd Party/wx/include/wx/platform.h index 710b273f1..471e28eba 100644 --- a/Source/3rd Party/wx/include/wx/platform.h +++ b/Source/3rd Party/wx/include/wx/platform.h @@ -4,7 +4,7 @@ * Author: Vadim Zeitlin * Modified by: * Created: 29.10.01 (extracted from wx/defs.h) -* RCS-ID: $Id$ +* RCS-ID: $Id: platform.h 63300 2010-01-28 21:36:09Z MW $ * Copyright: (c) 1997-2001 Vadim Zeitlin * Licence: wxWindows licence */ @@ -14,28 +14,52 @@ #ifndef _WX_PLATFORM_H_ #define _WX_PLATFORM_H_ -#ifdef __WXMAC_XCODE__ -# include -# include -# include -# ifndef MAC_OS_X_VERSION_10_4 -# define MAC_OS_X_VERSION_10_4 1040 -# endif -# ifndef MAC_OS_X_VERSION_10_5 -# define MAC_OS_X_VERSION_10_5 1050 -# endif -# ifndef MAC_OS_X_VERSION_10_6 -# define MAC_OS_X_VERSION_10_6 1060 -# endif -# include "wx/osx/config_xcode.h" -# ifndef __WXOSX__ -# define __WXOSX__ 1 -# endif -# ifndef __WXMAC__ -# define __WXMAC__ 1 + +/* + Codewarrior doesn't define any Windows symbols until some headers + are included +*/ +#ifdef __MWERKS__ +# include +#endif + +/* + WXMAC variants + __WXMAC_CLASSIC__ means ppc non-carbon builds, __WXMAC_CARBON__ means + carbon API available (mach or cfm builds) , __WXMAC_OSX__ means mach-o + builds, running under 10.2 + only +*/ +#ifdef __WXMAC__ +# if defined(__MACH__) +# define __WXMAC_OSX__ +# define __WXMAC_CARBON__ +# include +# ifndef MAC_OS_X_VERSION_10_4 +# define MAC_OS_X_VERSION_10_4 1040 +# endif +# ifndef MAC_OS_X_VERSION_10_5 +# define MAC_OS_X_VERSION_10_5 1050 +# endif +# ifdef __WXMAC_XCODE__ +# include +# include "wx/mac/carbon/config_xcode.h" +# endif +# else +# if TARGET_CARBON +# define __WXMAC_CARBON__ +# else +# define __WXMAC_CLASSIC__ +# endif # endif #endif +/* + __WXOSX__ is a common define to wxMac (Carbon) and wxCocoa ports under OS X. + */ +#if defined(__WXMAC_OSX__) || defined(__WXCOCOA__) +# define __WXOSX__ +#endif + /* first define Windows symbols if they're not defined on the command line: we can autodetect everything we need if _WIN32 is defined @@ -44,6 +68,41 @@ # ifndef __WXMSW__ # define __WXMSW__ # endif + +# ifndef _WIN32 +# define _WIN32 +# endif + +# ifndef WIN32 +# define WIN32 +# endif +#endif + +#if defined(__PALMOS__) +# if __PALMOS__ == 0x06000000 +# define __WXPALMOS6__ +# endif +# if __PALMOS__ == 0x05000000 +# define __WXPALMOS5__ +# endif +# ifndef __WXPALMOS__ +# define __WXPALMOS__ +# endif +# ifdef __WXMSW__ +# undef __WXMSW__ +# endif +# ifdef __WINDOWS__ +# undef __WINDOWS__ +# endif +# ifdef __WIN32__ +# undef __WIN32__ +# endif +# ifdef WIN32 +# undef WIN32 +# endif +# ifdef _WIN32 +# undef _WIN32 +# endif #endif #if defined(_WIN64) @@ -66,25 +125,17 @@ # ifndef __WXMSW__ # define __WXMSW__ # endif + +# ifndef __WIN32__ +# define __WIN32__ +# endif #endif /* Win32 */ -#if defined(__WXMSW__) +#if defined(__WXMSW__) || defined(__WIN32__) # if !defined(__WINDOWS__) # define __WINDOWS__ # endif - -# ifndef _WIN32 -# define _WIN32 -# endif - -# ifndef WIN32 -# define WIN32 -# endif - -# ifndef __WIN32__ -# define __WIN32__ -# endif -#endif /* __WXMSW__ */ +#endif /* detect MS SmartPhone */ #if defined( WIN32_PLATFORM_WFSP ) @@ -131,19 +182,10 @@ # endif #endif -#if defined(__WXWINCE__) && defined(_MSC_VER) && (_MSC_VER == 1201) - #define __EVC4__ -#endif - #if defined(__POCKETPC__) || defined(__SMARTPHONE__) || defined(__WXGPE__) # define __WXHANDHELD__ #endif -#ifdef __ANDROID__ -# define __WXANDROID__ -# include "wx/android/config_android.h" -#endif - /* Include wx/setup.h for the Unix platform defines generated by configure and the library compilation options @@ -153,14 +195,6 @@ */ #include "wx/setup.h" -/* - Convenience for any optional classes that use the wxAnyButton base class. - */ -#if wxUSE_TOGGLEBTN || wxUSE_BUTTON - #define wxHAS_ANY_BUTTON -#endif - - /* Hardware platform detection. @@ -217,61 +251,76 @@ # endif #endif /* wxUSE_UNICODE */ +#if defined( __MWERKS__ ) && !defined(__INTEL__) +/* otherwise MSL headers bring in WIN32 dependant APIs */ +#undef UNICODE +#endif /* - test for old versions of Borland C, normally need at least 5.82, Turbo - explorer, available for free at http://www.turboexplorer.com/downloads + Notice that Turbo Explorer (BCC 5.82) is available for free at + http://www.turboexplorer.com/downloads, you can get it if you have trouble + compiling wxWidgets with your current Borland compiler. */ +#if defined(__BORLANDC__) && (__BORLANDC__ < 0x540) +# error "wxWidgets requires a newer version of Borland, we recommend upgrading to 5.82 (Turbo Explorer). You may at your own risk remove this line and try building but be prepared to get build errors." +#endif /* __BORLANDC__ */ - -/* - Older versions of Borland C have some compiler bugs that need - workarounds. Mostly pertains to the free command line compiler 5.5.1. -*/ -#if defined(__BORLANDC__) && (__BORLANDC__ <= 0x551) - /* - The Borland free compiler is unable to handle overloaded enum - comparisons under certain conditions e.g. when any class has a - conversion ctor for an integral type and there's an overload to - compare between an integral type and that class type. - */ -# define wxCOMPILER_NO_OVERLOAD_ON_ENUM - - /* - This is needed to overcome bugs in 5.5.1 STL, linking errors will - result if it is not defined. - */ -# define _RWSTD_COMPILE_INSTANTIATE - - /* - Preprocessor in older Borland compilers have major problems - concatenating with ##. Specifically, if the string operands being - concatenated have special meaning (e.g. L"str", 123i64 etc) - then ## will not concatenate the operands correctly. - - As a workaround, define wxPREPEND* and wxAPPEND* without using - wxCONCAT_HELPER. - */ -# define wxCOMPILER_BROKEN_CONCAT_OPER +#if defined(__BORLANDC__) && (__BORLANDC__ < 0x582) && (__BORLANDC__ > 0x559) +# ifndef _USE_OLD_RW_STL +# error "wxWidgets is incompatible with default Borland C++ 5.6 STL library, please add -D_USE_OLD_RW_STL to your bcc32.cfg to use RogueWave STL implementation." +# endif #endif /* __BORLANDC__ */ /* - Define Watcom-specific macros. + This macro can be used to test the Open Watcom version. */ #ifndef __WATCOMC__ # define wxWATCOM_VERSION(major,minor) 0 # define wxCHECK_WATCOM_VERSION(major,minor) 0 # define wxONLY_WATCOM_EARLIER_THAN(major,minor) 0 -# define WX_WATCOM_ONLY_CODE( x ) +#elif defined(__WATCOMC__) && __WATCOMC__ < 1200 +# error "Only Open Watcom is supported in this release" #else -# if __WATCOMC__ < 1200 -# error "Only Open Watcom is supported in this release" -# endif - # define wxWATCOM_VERSION(major,minor) ( major * 100 + minor * 10 + 1100 ) # define wxCHECK_WATCOM_VERSION(major,minor) ( __WATCOMC__ >= wxWATCOM_VERSION(major,minor) ) # define wxONLY_WATCOM_EARLIER_THAN(major,minor) ( __WATCOMC__ < wxWATCOM_VERSION(major,minor) ) -# define WX_WATCOM_ONLY_CODE( x ) x +#endif + +/* + check the consistency of the settings in setup.h: note that this must be + done after setting wxUSE_UNICODE correctly as it is used in wx/chkconf.h + */ +#include "wx/chkconf.h" + + +/* + some compilers don't support iostream.h any longer, while some of theme + are not updated with yet, so override the users setting here + in such case. + */ +#if defined(_MSC_VER) && (_MSC_VER >= 1310) +# undef wxUSE_IOSTREAMH +# define wxUSE_IOSTREAMH 0 +#elif defined(__DMC__) || defined(__WATCOMC__) +# undef wxUSE_IOSTREAMH +# define wxUSE_IOSTREAMH 1 +#elif defined(__MINGW32__) +# undef wxUSE_IOSTREAMH +# define wxUSE_IOSTREAMH 0 +#endif /* compilers with/without iostream.h */ + +/* + old C++ headers (like ) declare classes in the global namespace + while the new, standard ones (like ) do it in std:: namespace, + unless it's an old gcc version. + + using this macro allows constuctions like "wxSTD iostream" to work in + either case + */ +#if !wxUSE_IOSTREAMH && (!defined(__GNUC__) || ( __GNUC__ > 2 ) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)) +# define wxSTD std:: +#else +# define wxSTD #endif /* @@ -323,18 +372,16 @@ # endif # endif /* SGI */ -# if defined(__SUNPRO_CC) -# ifndef __SUNCC__ -# define __SUNCC__ __SUNPRO_CC -# endif /* Sun CC */ -# endif /* Sun CC */ +# if defined(sun) || defined(__SUN__) +# ifndef __GNUG__ +# ifndef __SUNCC__ +# define __SUNCC__ +# endif /* Sun CC */ +# endif +# endif /* Sun */ # ifdef __EMX__ # define OS2EMX_PLAIN_CHAR -# endif -# if defined(__INNOTEK_LIBC__) - /* Ensure visibility of strnlen declaration */ -# define _GNU_SOURCE # endif /* define __HPUX__ for HP-UX where standard macro is __hpux */ @@ -373,6 +420,17 @@ # endif # endif +/* + OS: Classic Mac OS + */ +#elif defined(applec) || \ + defined(THINK_C) || \ + (defined(__MWERKS__) && !defined(__INTEL__)) + /* MacOS */ +# if !defined(wxSIZE_T_IS_UINT) && !defined(wxSIZE_T_IS_ULONG) +# define wxSIZE_T_IS_ULONG +# endif + /* OS: OS/2 */ @@ -396,6 +454,20 @@ # endif # define wxSIZE_T_IS_UINT +/* + OS: Palm OS + */ +#elif defined(__PALMOS__) +# ifdef __WIN32__ +# error "__WIN32__ should not be defined for PalmOS" +# endif +# ifdef __WINDOWS__ +# error "__WINDOWS__ should not be defined for PalmOS" +# endif +# ifdef __WXMSW__ +# error "__WXMSW__ should not be defined for PalmOS" +# endif + /* OS: Otherwise it must be Windows */ @@ -411,39 +483,10 @@ /* define another standard symbol for Microsoft Visual C++: the standard - one (_MSC_VER) is also defined by some other compilers. + one (_MSC_VER) is also defined by Metrowerks compiler */ -# if defined(_MSC_VER) +# if defined(_MSC_VER) && !defined(__MWERKS__) # define __VISUALC__ _MSC_VER - - /* - define special symbols for different VC version instead of writing tests - for magic numbers such as 1200, 1300 &c repeatedly - */ -# if __VISUALC__ < 1100 -# error "This Visual C++ version is too old and not supported any longer." -# elif __VISUALC__ < 1200 -# define __VISUALC5__ -# elif __VISUALC__ < 1300 -# define __VISUALC6__ -# elif __VISUALC__ < 1400 -# define __VISUALC7__ -# elif __VISUALC__ < 1500 -# define __VISUALC8__ -# elif __VISUALC__ < 1600 -# define __VISUALC9__ -# elif __VISUALC__ < 1700 -# define __VISUALC10__ -# elif __VISUALC__ < 1800 -# define __VISUALC11__ -# elif __VISUALC__ < 1900 -# define __VISUALC12__ -# elif __VISUALC__ < 2000 -# define __VISUALC14__ -# else -# pragma message("Please update wx/platform.h to recognize this VC++ version") -# endif - # elif defined(__BCPLUSPLUS__) && !defined(__BORLANDC__) # define __BORLANDC__ # elif defined(__WATCOMC__) @@ -518,17 +561,6 @@ #define wxNEEDS_CHARPP #endif -/* - This macro can be used to test the Visual C++ version. -*/ -#ifndef __VISUALC__ -# define wxVISUALC_VERSION(major) 0 -# define wxCHECK_VISUALC_VERSION(major) 0 -#else -# define wxVISUALC_VERSION(major) ( (6 + (major >= 14 ? 1 : 0) + major) * 100 ) -# define wxCHECK_VISUALC_VERSION(major) ( __VISUALC__ >= wxVISUALC_VERSION(major) ) -#endif - /* This macro can be used to check that the version of mingw32 compiler is at least maj.min @@ -540,7 +572,8 @@ !defined(__WXPM__) && \ !defined(__WXMOTIF__) && \ !defined(__WXGTK__) && \ - !defined(__WXX11__) + !defined(__WXX11__) && \ + !defined(__WXPALMOS__) # include "wx/msw/gccpriv.h" #else # undef wxCHECK_W32API_VERSION @@ -549,16 +582,13 @@ # define wxCHECK_MINGW32_VERSION(maj, min) (0) #endif -/** - This is similar to wxCHECK_GCC_VERSION but for Sun CC compiler. - */ -#ifdef __SUNCC__ - /* - __SUNCC__ is 0xVRP where V is major version, R release and P patch level - */ - #define wxCHECK_SUNCC_VERSION(maj, min) (__SUNCC__ >= (((maj)<<8) | ((min)<<4))) -#else - #define wxCHECK_SUNCC_VERSION(maj, min) (0) +#if defined (__WXMSW__) +# if !wxONLY_WATCOM_EARLIER_THAN(1, 8) +# define wxHAVE_RAW_BITMAP +# endif +#endif +#if defined(__WXGTK20__) || defined(__WXMAC__) +# define wxHAVE_RAW_BITMAP #endif /* @@ -578,155 +608,6 @@ /* According to Stefan even ancient Mac compilers defined __BIG_ENDIAN__ */ # warning "Compiling wxMac with probably wrong endianness" #endif -/* also the 32/64 bit universal builds must be handled accordingly */ -#ifdef __DARWIN__ -# ifdef __LP64__ -# undef SIZEOF_VOID_P -# undef SIZEOF_LONG -# undef SIZEOF_SIZE_T -# define SIZEOF_VOID_P 8 -# define SIZEOF_LONG 8 -# define SIZEOF_SIZE_T 8 -# else -# undef SIZEOF_VOID_P -# undef SIZEOF_LONG -# undef SIZEOF_SIZE_T -# define SIZEOF_VOID_P 4 -# define SIZEOF_LONG 4 -# define SIZEOF_SIZE_T 4 -# endif -#endif - -/* - Define various OS X symbols before including wx/chkconf.h which uses them. - - __WXOSX_MAC__ means Mac OS X, non embedded - __WXOSX_IPHONE__ means OS X iPhone - */ - -/* - Normally all of __WXOSX_XXX__, __WXOSX__ and __WXMAC__ are defined by - configure but ensure that we also define them if configure was not used for - whatever reason. - - The primary symbol remains __WXOSX_XXX__ one, __WXOSX__ exists to allow - checking for any OS X port (Carbon and Cocoa) and __WXMAC__ is an old name - for it. - */ -#if defined(__WXOSX_CARBON__) || defined(__WXOSX_COCOA__) || defined(__WXOSX_IPHONE__) \ - || (defined(__DARWIN__) && !wxUSE_GUI) -# ifndef __WXOSX__ -# define __WXOSX__ 1 -# endif -# ifndef __WXMAC__ -# define __WXMAC__ 1 -# endif -#endif - -#ifdef __WXOSX__ -/* setup precise defines according to sdk used */ -# include -# if defined(__WXOSX_IPHONE__) -# if !( defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE ) -# error "incorrect SDK for an iPhone build" -# endif -# else -# if wxUSE_GUI && !(defined(__WXOSX_CARBON__) || defined(__WXOSX_COCOA__)) -# error "one of __WXOSX_IPHONE__, __WXOSX_CARBON__ or __WXOSX_COCOA__ must be defined for the GUI build" -# endif -# if !( defined(TARGET_OS_MAC) && TARGET_OS_MAC ) -# error "incorrect SDK for a Mac OS X build" -# endif -# define __WXOSX_MAC__ 1 -# endif -#endif - -#ifdef __WXOSX_MAC__ -# if defined(__MACH__) -# include -# ifndef MAC_OS_X_VERSION_10_4 -# define MAC_OS_X_VERSION_10_4 1040 -# endif -# ifndef MAC_OS_X_VERSION_10_5 -# define MAC_OS_X_VERSION_10_5 1050 -# endif -# ifndef MAC_OS_X_VERSION_10_6 -# define MAC_OS_X_VERSION_10_6 1060 -# endif -# else -# error "only mach-o configurations are supported" -# endif -#endif - -/* - __WXOSX_OR_COCOA__ is a common define to wxOSX (Carbon or Cocoa) and wxCocoa ports under OS X. - - DO NOT use this define in base library code. Although wxMac has its own - private base library (and thus __WXOSX_OR_COCOA__,__WXMAC__ and related defines are - valid there), wxCocoa shares its library with other ports like wxGTK and wxX11. - - To keep wx authors from screwing this up, only enable __WXOSX_OR_COCOA__ for wxCocoa when - not compiling the base library. We determine this by first checking if - wxUSE_BASE is not defined. If it is not defined, then we're not buildling - the base library, and possibly not building wx at all (but actually building - user code that's using wx). If it is defined then we must check to make sure - it is not true. If it is true, we're building base. - - If you want it in the common darwin base library then use __DARWIN__. You - can use any Darwin-available libraries like CoreFoundation but please avoid - using OS X libraries like Carbon or CoreServices. - - */ -#if defined(__WXOSX__) || (defined(__WXCOCOA__) && (!defined(wxUSE_BASE) || !wxUSE_BASE)) -# define __WXOSX_OR_COCOA__ 1 -#endif - -/* - check the consistency of the settings in setup.h: note that this must be - done after setting wxUSE_UNICODE correctly as it is used in wx/chkconf.h - and after defining the compiler macros which are used in it too - */ -#include "wx/chkconf.h" - - -/* - some compilers don't support iostream.h any longer, while some of theme - are not updated with yet, so override the users setting here - in such case. - */ -#if defined(_MSC_VER) && (_MSC_VER >= 1310) -# undef wxUSE_IOSTREAMH -# define wxUSE_IOSTREAMH 0 -#elif defined(__DMC__) || defined(__WATCOMC__) -# undef wxUSE_IOSTREAMH -# define wxUSE_IOSTREAMH 1 -#elif defined(__MINGW32__) -# undef wxUSE_IOSTREAMH -# define wxUSE_IOSTREAMH 0 -#endif /* compilers with/without iostream.h */ - -/* - old C++ headers (like ) declare classes in the global namespace - while the new, standard ones (like ) do it in std:: namespace, - unless it's an old gcc version. - - using this macro allows constuctions like "wxSTD iostream" to work in - either case - */ -#if !wxUSE_IOSTREAMH && (!defined(__GNUC__) || ( __GNUC__ > 2 ) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)) -# define wxSTD std:: -#else -# define wxSTD -#endif - -/* On OpenVMS with the most recent HP C++ compiler some function (i.e. wscanf) - * are only available in the std-namespace. (BUG???) - */ -#if defined( __VMS ) && (__DECCXX_VER >= 70100000) && !defined(__STD_CFRONT) && !defined( __NONAMESPACE_STD ) -# define wxVMS_USE_STD std:: -#else -# define wxVMS_USE_STD -#endif #ifdef __VMS #define XtDisplay XTDISPLAY @@ -742,7 +623,7 @@ * Presently, only Windows and GTK+ support wxEVT_MENU_OPEN. */ #ifndef wxUSE_IDLEMENUUPDATES -# if (defined(__WXMSW__) || defined(__WXGTK__) || defined(__WXOSX__)) && !defined(__WXUNIVERSAL__) +# if (defined(__WXMSW__) || defined(__WXGTK__)) && !defined(__WXUNIVERSAL__) # define wxUSE_IDLEMENUUPDATES 0 # else # define wxUSE_IDLEMENUUPDATES 1 @@ -756,7 +637,7 @@ */ #ifndef wxUSE_FILECONFIG -# if wxUSE_CONFIG && wxUSE_TEXTFILE +# if wxUSE_CONFIG # define wxUSE_FILECONFIG 1 # else # define wxUSE_FILECONFIG 0 @@ -772,28 +653,12 @@ #endif /* - Optionally supported C++ features. - */ - -/* - RTTI: if it is disabled in build/msw/makefile.* then this symbol will - already be defined but it's also possible to do it from configure (with - g++) or by editing project files with MSVC so test for it here too. - */ -#ifndef wxNO_RTTI - /* - Only 4.3 defines __GXX_RTTI by default so its absence is not an - indication of disabled RTTI with the previous versions. - */ -# if wxCHECK_GCC_VERSION(4, 3) -# ifndef __GXX_RTTI -# define wxNO_RTTI -# endif -# elif defined(_MSC_VER) -# ifndef _CPPRTTI -# define wxNO_RTTI -# endif -# endif -#endif /* wxNO_RTTI */ + We need AvailabilityMacros.h for ifdefing out things that don't exist on + OSX 10.2 and lower + FIXME: We need a better way to detect for 10.3 then including a system header +*/ +#ifdef __DARWIN__ + #include +#endif #endif /* _WX_PLATFORM_H_ */ diff --git a/Source/3rd Party/wx/include/wx/platinfo.h b/Source/3rd Party/wx/include/wx/platinfo.h index a203dc9cb..d9382dd2e 100644 --- a/Source/3rd Party/wx/include/wx/platinfo.h +++ b/Source/3rd Party/wx/include/wx/platinfo.h @@ -4,9 +4,9 @@ // Author: Francesco Montorsi // Modified by: // Created: 07.07.2006 (based on wxToolkitInfo) -// RCS-ID: $Id$ +// RCS-ID: $Id: platinfo.h 41807 2006-10-09 15:58:56Z VZ $ // Copyright: (c) 2006 Francesco Montorsi -// Licence: wxWindows licence +// License: wxWindows license /////////////////////////////////////////////////////////////////////////////// #ifndef _WX_PLATINFO_H_ @@ -15,7 +15,7 @@ #include "wx/string.h" // ---------------------------------------------------------------------------- -// wxPlatformInfo enums & structs +// wxPlatformInfo // ---------------------------------------------------------------------------- // VERY IMPORTANT: when changing these enum values, also change the relative @@ -72,14 +72,15 @@ enum wxPortId wxPORT_MSW = 1 << 1, // wxMSW, native toolkit is Windows API wxPORT_MOTIF = 1 << 2, // wxMotif, using [Open]Motif or Lesstif wxPORT_GTK = 1 << 3, // wxGTK, using GTK+ 1.x, 2.x, GPE or Maemo - wxPORT_DFB = 1 << 4, // wxDFB, using wxUniversal + wxPORT_MGL = 1 << 4, // wxMGL, using wxUniversal wxPORT_X11 = 1 << 5, // wxX11, using wxUniversal wxPORT_PM = 1 << 6, // wxOS2, using OS/2 Presentation Manager wxPORT_OS2 = wxPORT_PM, // wxOS2, using OS/2 Presentation Manager - wxPORT_MAC = 1 << 7, // wxOSX (former wxMac), using Cocoa, Carbon or iPhone API - wxPORT_OSX = wxPORT_MAC, // wxOSX, using Cocoa, Carbon or iPhone API + wxPORT_MAC = 1 << 7, // wxMac, using Carbon or Classic Mac API wxPORT_COCOA = 1 << 8, // wxCocoa, using Cocoa NextStep/Mac API - wxPORT_WINCE = 1 << 9 // wxWinCE, toolkit is WinCE SDK API + wxPORT_WINCE = 1 << 9, // wxWinCE, toolkit is WinCE SDK API + wxPORT_PALMOS = 1 << 10, // wxPalmOS, toolkit is PalmOS API + wxPORT_DFB = 1 << 11 // wxDFB, using wxUniversal }; // architecture of the operating system @@ -108,31 +109,6 @@ enum wxEndianness wxENDIAN_MAX }; -// informations about a linux distro returned by the lsb_release utility -struct wxLinuxDistributionInfo -{ - wxString Id; - wxString Release; - wxString CodeName; - wxString Description; - - bool operator==(const wxLinuxDistributionInfo& ldi) const - { - return Id == ldi.Id && - Release == ldi.Release && - CodeName == ldi.CodeName && - Description == ldi.Description; - } - - bool operator!=(const wxLinuxDistributionInfo& ldi) const - { return !(*this == ldi); } -}; - - -// ---------------------------------------------------------------------------- -// wxPlatformInfo -// ---------------------------------------------------------------------------- - // Information about the toolkit that the app is running under and some basic // platform and architecture info class WXDLLIMPEXP_BASE wxPlatformInfo @@ -180,7 +156,6 @@ public: static wxString GetArchName(wxArchitecture arch); static wxString GetEndiannessName(wxEndianness end); - // getters // ----------------- @@ -216,8 +191,6 @@ public: wxOperatingSystemId GetOperatingSystemId() const { return m_os; } - wxLinuxDistributionInfo GetLinuxDistributionInfo() const - { return m_ldi; } wxPortId GetPortId() const { return m_port; } wxArchitecture GetArchitecture() const @@ -241,16 +214,6 @@ public: { return GetArchName(m_arch); } wxString GetEndiannessName() const { return GetEndiannessName(m_endian); } - wxString GetOperatingSystemDescription() const - { return m_osDesc; } - wxString GetDesktopEnvironment() const - { return m_desktopEnv; } - - static wxString GetOperatingSystemDirectory(); - // doesn't make sense to store inside wxPlatformInfo the OS directory, - // thus this function is static; note that this function simply calls - // wxGetOSDirectory() and is here just to make it easier for the user to - // find it that feature (global functions can be difficult to find in the docs) // setters // ----------------- @@ -262,8 +225,6 @@ public: void SetOperatingSystemId(wxOperatingSystemId n) { m_os = n; } - void SetOperatingSystemDescription(const wxString& desc) - { m_osDesc = desc; } void SetPortId(wxPortId n) { m_port = n; } void SetArchitecture(wxArchitecture n) @@ -271,12 +232,6 @@ public: void SetEndianness(wxEndianness n) { m_endian = n; } - void SetDesktopEnvironment(const wxString& de) - { m_desktopEnv = de; } - void SetLinuxDistributionInfo(const wxLinuxDistributionInfo& di) - { m_ldi = di; } - - // miscellaneous // ----------------- @@ -284,13 +239,9 @@ public: { return m_osVersionMajor != -1 && m_osVersionMinor != -1 && m_os != wxOS_UNKNOWN && - !m_osDesc.IsEmpty() && m_tkVersionMajor != -1 && m_tkVersionMinor != -1 && m_port != wxPORT_UNKNOWN && - m_arch != wxARCH_INVALID && - m_endian != wxENDIAN_INVALID; - - // do not check linux-specific info; it's ok to have them empty + m_arch != wxARCH_INVALID && m_endian != wxENDIAN_INVALID; } @@ -314,16 +265,6 @@ protected: // Operating system ID. wxOperatingSystemId m_os; - // Operating system description. - wxString m_osDesc; - - - // linux-specific - // ----------------- - - wxString m_desktopEnv; - wxLinuxDistributionInfo m_ldi; - // toolkit // ----------------- @@ -342,7 +283,7 @@ protected: // others // ----------------- - // architecture of the OS/machine + // architecture of the OS wxArchitecture m_arch; // endianness of the machine @@ -360,7 +301,9 @@ protected: #define wxWinCE wxOS_WINDOWS_CE #define wxWIN32S wxOS_WINDOWS_9X + #define wxPalmOS wxPORT_PALMOS #define wxOS2 wxPORT_OS2 + #define wxMGL wxPORT_MGL #define wxCocoa wxPORT_MAC #define wxMac wxPORT_MAC #define wxMotif wxPORT_MOTIF diff --git a/Source/3rd Party/wx/include/wx/popupwin.h b/Source/3rd Party/wx/include/wx/popupwin.h index 2ea2d0cf5..c72eafeb6 100644 --- a/Source/3rd Party/wx/include/wx/popupwin.h +++ b/Source/3rd Party/wx/include/wx/popupwin.h @@ -4,9 +4,9 @@ // Author: Vadim Zeitlin // Modified by: // Created: 06.01.01 -// RCS-ID: $Id$ +// RCS-ID: $Id: popupwin.h 53135 2008-04-12 02:31:04Z VZ $ // Copyright: (c) 2001 Vadim Zeitlin -// Licence: wxWindows licence +// License: wxWindows licence /////////////////////////////////////////////////////////////////////////////// #ifndef _WX_POPUPWIN_H_BASE_ @@ -16,14 +16,14 @@ #if wxUSE_POPUPWIN -#include "wx/nonownedwnd.h" +#include "wx/window.h" // ---------------------------------------------------------------------------- // wxPopupWindow: a special kind of top level window used for popup menus, // combobox popups and such. // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxPopupWindowBase : public wxNonOwnedWindow +class WXDLLEXPORT wxPopupWindowBase : public wxWindow { public: wxPopupWindowBase() { } @@ -47,7 +47,7 @@ public: virtual bool IsTopLevel() const { return true; } - wxDECLARE_NO_COPY_CLASS(wxPopupWindowBase); + DECLARE_NO_COPY_CLASS(wxPopupWindowBase) }; @@ -64,10 +64,10 @@ public: #include "wx/x11/popupwin.h" #elif defined(__WXMOTIF__) #include "wx/motif/popupwin.h" -#elif defined(__WXDFB__) - #include "wx/dfb/popupwin.h" +#elif defined(__WXMGL__) + #include "wx/mgl/popupwin.h" #elif defined(__WXMAC__) - #include "wx/osx/popupwin.h" + #include "wx/mac/popupwin.h" #else #error "wxPopupWindow is not supported under this platform." #endif @@ -80,7 +80,7 @@ public: class WXDLLIMPEXP_FWD_CORE wxPopupWindowHandler; class WXDLLIMPEXP_FWD_CORE wxPopupFocusHandler; -class WXDLLIMPEXP_CORE wxPopupTransientWindow : public wxPopupWindow +class WXDLLEXPORT wxPopupTransientWindow : public wxPopupWindow { public: // ctors @@ -104,15 +104,12 @@ public: // called when a mouse is pressed while the popup is shown: return true // from here to prevent its normal processing by the popup (which consists - // in dismissing it if the mouse is clicked outside it) + // in dismissing it if the mouse is cilcked outside it) virtual bool ProcessLeftDown(wxMouseEvent& event); // Overridden to grab the input on some plaforms virtual bool Show( bool show = true ); - // Override to implement delayed destruction of this window. - virtual bool Destroy(); - protected: // common part of all ctors void Init(); @@ -130,9 +127,8 @@ protected: // get alerted when child gets deleted from under us void OnDestroy(wxWindowDestroyEvent& event); -#if defined(__WXMSW__) ||(defined(__WXMAC__) && wxOSX_USE_CARBON) - // Check if the mouse needs to be captured or released: we must release - // when it's inside our window if we want the embedded controls to work. +#if defined( __WXMSW__ ) || defined( __WXMAC__ ) + // check if the mouse needs captured or released void OnIdle(wxIdleEvent& event); #endif @@ -152,7 +148,7 @@ protected: DECLARE_EVENT_TABLE() DECLARE_DYNAMIC_CLASS(wxPopupTransientWindow) - wxDECLARE_NO_COPY_CLASS(wxPopupTransientWindow); + DECLARE_NO_COPY_CLASS(wxPopupTransientWindow) }; #if wxUSE_COMBOBOX && defined(__WXUNIVERSAL__) @@ -161,10 +157,10 @@ protected: // wxPopupComboWindow: wxPopupTransientWindow used by wxComboBox // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_FWD_CORE wxComboBox; -class WXDLLIMPEXP_FWD_CORE wxComboCtrl; +class WXDLLEXPORT wxComboBox; +class WXDLLEXPORT wxComboCtrl; -class WXDLLIMPEXP_CORE wxPopupComboWindow : public wxPopupTransientWindow +class WXDLLEXPORT wxPopupComboWindow : public wxPopupTransientWindow { public: wxPopupComboWindow() { m_combo = NULL; } diff --git a/Source/3rd Party/wx/include/wx/position.h b/Source/3rd Party/wx/include/wx/position.h deleted file mode 100644 index 3dfdd6060..000000000 --- a/Source/3rd Party/wx/include/wx/position.h +++ /dev/null @@ -1,60 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/position.h -// Purpose: Common structure and methods for positional information. -// Author: Vadim Zeitlin, Robin Dunn, Brad Anderson, Bryan Petty -// Created: 2007-03-13 -// RCS-ID: $Id$ -// Copyright: (c) 2007 The wxWidgets Team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_POSITION_H_ -#define _WX_POSITION_H_ - -#include "wx/gdicmn.h" - -class WXDLLIMPEXP_CORE wxPosition -{ -public: - wxPosition() : m_row(0), m_column(0) {} - wxPosition(int row, int col) : m_row(row), m_column(col) {} - - // default copy ctor and assignment operator are okay. - - int GetRow() const { return m_row; } - int GetColumn() const { return m_column; } - int GetCol() const { return GetColumn(); } - void SetRow(int row) { m_row = row; } - void SetColumn(int column) { m_column = column; } - void SetCol(int column) { SetColumn(column); } - - bool operator==(const wxPosition& p) const - { return m_row == p.m_row && m_column == p.m_column; } - bool operator!=(const wxPosition& p) const - { return !(*this == p); } - - wxPosition& operator+=(const wxPosition& p) - { m_row += p.m_row; m_column += p.m_column; return *this; } - wxPosition& operator-=(const wxPosition& p) - { m_row -= p.m_row; m_column -= p.m_column; return *this; } - wxPosition& operator+=(const wxSize& s) - { m_row += s.y; m_column += s.x; return *this; } - wxPosition& operator-=(const wxSize& s) - { m_row -= s.y; m_column -= s.x; return *this; } - - wxPosition operator+(const wxPosition& p) const - { return wxPosition(m_row + p.m_row, m_column + p.m_column); } - wxPosition operator-(const wxPosition& p) const - { return wxPosition(m_row - p.m_row, m_column - p.m_column); } - wxPosition operator+(const wxSize& s) const - { return wxPosition(m_row + s.y, m_column + s.x); } - wxPosition operator-(const wxSize& s) const - { return wxPosition(m_row - s.y, m_column - s.x); } - -private: - int m_row; - int m_column; -}; - -#endif // _WX_POSITION_H_ - diff --git a/Source/3rd Party/wx/include/wx/power.h b/Source/3rd Party/wx/include/wx/power.h index c9c73b2cc..66492cb55 100644 --- a/Source/3rd Party/wx/include/wx/power.h +++ b/Source/3rd Party/wx/include/wx/power.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 2006-05-27 -// RCS-ID: $Id$ +// RCS-ID: $Id: power.h 48811 2007-09-19 23:11:28Z RD $ // Copyright: (c) 2006 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -42,16 +42,13 @@ enum wxBatteryState // compiling in the code for handling them which is never going to be invoked // under the other platforms, we define wxHAS_POWER_EVENTS symbol if this event // is available, it should be used to guard all code using wxPowerEvent -#ifdef __WINDOWS__ +#ifdef __WXMSW__ #define wxHAS_POWER_EVENTS class WXDLLIMPEXP_BASE wxPowerEvent : public wxEvent { public: - wxPowerEvent() // just for use by wxRTTI - : m_veto(false) { } - wxPowerEvent(wxEventType evtType) : wxEvent(wxID_NONE, evtType) { m_veto = false; @@ -70,18 +67,23 @@ public: private: bool m_veto; - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxPowerEvent) +#if wxABI_VERSION >= 20806 + DECLARE_ABSTRACT_CLASS(wxPowerEvent) +#endif }; -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_BASE, wxEVT_POWER_SUSPENDING, wxPowerEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_BASE, wxEVT_POWER_SUSPENDED, wxPowerEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_BASE, wxEVT_POWER_SUSPEND_CANCEL, wxPowerEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_BASE, wxEVT_POWER_RESUME, wxPowerEvent ); +BEGIN_DECLARE_EVENT_TYPES() + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_BASE, wxEVT_POWER_SUSPENDING, 406) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_BASE, wxEVT_POWER_SUSPENDED, 407) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_BASE, wxEVT_POWER_SUSPEND_CANCEL, 408) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_BASE, wxEVT_POWER_RESUME, 444) +END_DECLARE_EVENT_TYPES() typedef void (wxEvtHandler::*wxPowerEventFunction)(wxPowerEvent&); #define wxPowerEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxPowerEventFunction, func) + (wxObjectEventFunction)(wxEventFunction) \ + wxStaticCastEvent(wxPowerEventFunction, &func) #define EVT_POWER_SUSPENDING(func) \ wx__DECLARE_EVT0(wxEVT_POWER_SUSPENDING, wxPowerEventHandler(func)) diff --git a/Source/3rd Party/wx/include/wx/print.h b/Source/3rd Party/wx/include/wx/print.h index c78386814..e4cf1e2e7 100644 --- a/Source/3rd Party/wx/include/wx/print.h +++ b/Source/3rd Party/wx/include/wx/print.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: -// RCS-ID: $Id$ +// RCS-ID: $Id: print.h 41240 2006-09-15 16:45:48Z PC $ // Copyright: (c) Julian Smart // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// @@ -22,7 +22,7 @@ #elif defined(__WXMAC__) -#include "wx/osx/printmac.h" +#include "wx/mac/printmac.h" #elif defined(__WXPM__) diff --git a/Source/3rd Party/wx/include/wx/printdlg.h b/Source/3rd Party/wx/include/wx/printdlg.h index 38540df21..4c98d251d 100644 --- a/Source/3rd Party/wx/include/wx/printdlg.h +++ b/Source/3rd Party/wx/include/wx/printdlg.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: -// RCS-ID: $Id$ +// RCS-ID: $Id: printdlg.h 41020 2006-09-05 20:47:48Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// @@ -26,7 +26,7 @@ // wxPrintDialogBase: interface for the dialog for printing // --------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxPrintDialogBase : public wxDialog +class WXDLLEXPORT wxPrintDialogBase : public wxDialog { public: wxPrintDialogBase() { } @@ -36,21 +36,21 @@ public: const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE); - + virtual wxPrintDialogData& GetPrintDialogData() = 0; virtual wxPrintData& GetPrintData() = 0; virtual wxDC *GetPrintDC() = 0; - + private: DECLARE_ABSTRACT_CLASS(wxPrintDialogBase) - wxDECLARE_NO_COPY_CLASS(wxPrintDialogBase); + DECLARE_NO_COPY_CLASS(wxPrintDialogBase) }; // --------------------------------------------------------------------------- // wxPrintDialog: the dialog for printing. // --------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxPrintDialog : public wxObject +class WXDLLEXPORT wxPrintDialog : public wxObject { public: wxPrintDialog(wxWindow *parent, wxPrintDialogData* data = NULL); @@ -62,20 +62,20 @@ public: virtual wxPrintDialogData& GetPrintDialogData(); virtual wxPrintData& GetPrintData(); virtual wxDC *GetPrintDC(); - + private: wxPrintDialogBase *m_pimpl; - + private: DECLARE_DYNAMIC_CLASS(wxPrintDialog) - wxDECLARE_NO_COPY_CLASS(wxPrintDialog); + DECLARE_NO_COPY_CLASS(wxPrintDialog) }; // --------------------------------------------------------------------------- // wxPageSetupDialogBase: interface for the page setup dialog // --------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxPageSetupDialogBase: public wxDialog +class WXDLLEXPORT wxPageSetupDialogBase: public wxDialog { public: wxPageSetupDialogBase() { } @@ -90,14 +90,14 @@ public: private: DECLARE_ABSTRACT_CLASS(wxPageSetupDialogBase) - wxDECLARE_NO_COPY_CLASS(wxPageSetupDialogBase); + DECLARE_NO_COPY_CLASS(wxPageSetupDialogBase) }; // --------------------------------------------------------------------------- // wxPageSetupDialog: the page setup dialog // --------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxPageSetupDialog: public wxObject +class WXDLLEXPORT wxPageSetupDialog: public wxObject { public: wxPageSetupDialog(wxWindow *parent, wxPageSetupDialogData *data = NULL); @@ -110,10 +110,10 @@ public: private: wxPageSetupDialogBase *m_pimpl; - + private: DECLARE_DYNAMIC_CLASS(wxPageSetupDialog) - wxDECLARE_NO_COPY_CLASS(wxPageSetupDialog); + DECLARE_NO_COPY_CLASS(wxPageSetupDialog) }; #endif diff --git a/Source/3rd Party/wx/include/wx/private/fileback.h b/Source/3rd Party/wx/include/wx/private/fileback.h index 9d9f6d882..1ef8a4305 100644 --- a/Source/3rd Party/wx/include/wx/private/fileback.h +++ b/Source/3rd Party/wx/include/wx/private/fileback.h @@ -1,8 +1,8 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/private/fileback.h +// Name: include/wx/private/fileback.h // Purpose: Back an input stream with memory or a file // Author: Mike Wetherell -// RCS-ID: $Id$ +// RCS-ID: $Id: fileback.h 61872 2009-09-09 22:37:05Z VZ $ // Copyright: (c) 2006 Mike Wetherell // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -75,7 +75,7 @@ private: wxBackingFile m_backer; wxFileOffset m_pos; - wxDECLARE_NO_COPY_CLASS(wxBackedInputStream); + DECLARE_NO_COPY_CLASS(wxBackedInputStream) }; #endif // wxUSE_FILESYSTEM diff --git a/Source/3rd Party/wx/include/wx/private/filename.h b/Source/3rd Party/wx/include/wx/private/filename.h index a527fdb88..f25e33c8b 100644 --- a/Source/3rd Party/wx/include/wx/private/filename.h +++ b/Source/3rd Party/wx/include/wx/private/filename.h @@ -1,10 +1,10 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/private/filename.h +// Name: include/wx/private/filename.h // Purpose: Internal declarations for src/common/filename.cpp // Author: Mike Wetherell // Modified by: // Created: 2006-10-22 -// RCS-ID: $Id$ +// RCS-ID: $Id: filename.h 42277 2006-10-23 13:10:12Z MW $ // Copyright: (c) 2006 Mike Wetherell // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// diff --git a/Source/3rd Party/wx/include/wx/private/flagscheck.h b/Source/3rd Party/wx/include/wx/private/flagscheck.h deleted file mode 100644 index 84386bb14..000000000 --- a/Source/3rd Party/wx/include/wx/private/flagscheck.h +++ /dev/null @@ -1,117 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/private/flagscheck.h -// Purpose: helpers for checking that (bit)flags don't overlap -// Author: Vaclav Slavik -// Created: 2008-02-21 -// RCS-ID: $Id$ -// Copyright: (c) 2008 Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_PRIVATE_FLAGSCHECK_H_ -#define _WX_PRIVATE_FLAGSCHECK_H_ - -#include "wx/debug.h" - -// IBM xlC 8 can't parse the template syntax -#if !defined(__IBMCPP__) - -#include "wx/meta/if.h" - -namespace wxPrivate -{ - -// These templates are used to implement wxADD_FLAG macro below. -// -// The idea is that we want to trigger *compilation* error if the flags -// overlap, not just runtime assert failure. We can't implement the check -// using just a simple logical operation, we need checks equivalent to this -// code: -// -// mask = wxFLAG_1; -// assert( (mask & wxFLAG_2) == 0 ); // no overlap -// mask |= wxFLAG_3; -// assert( (mask & wxFLAG_3) == 0 ); // no overlap -// mask |= wxFLAG_3; -// ... -// -// This can be done at compilation time by using templates metaprogramming -// technique that makes the compiler carry on the computation. -// -// NB: If any of this doesn't compile with your compiler and would be too -// hard to make work, it's probably best to disable this code and replace -// the macros below with empty stubs, this isn't anything critical. - -template struct FlagsHaveConflictingValues -{ - // no value here - triggers compilation error -}; - -template struct FlagValue -{ - enum { value = val }; -}; - -// This template adds its template parameter integer 'add' to another integer -// 'all' and produces their OR-combination (all | add). The result is "stored" -// as constant SafelyAddToMask<>::value. Combination of many flags is achieved -// by chaining parameter lists: the 'add' parameter is value member of -// another (different) SafelyAddToMask<> instantiation. -template struct SafelyAddToMask -{ - // This typedefs ensures that no flags in the list conflict. If there's - // any overlap between the already constructed part of the mask ('all') - // and the value being added to it ('add'), the test that is wxIf<>'s - // first parameter will be non-zero and so Added value will be - // FlagsHaveConflictingValues. The next statement will try to use - // AddedValue::value, but there's no such thing in - // FlagsHaveConflictingValues<> and so compilation will fail. - typedef typename wxIf<(all & add) == 0, - FlagValue, - FlagsHaveConflictingValues >::value - AddedValue; - - enum { value = all | AddedValue::value }; -}; - -} // wxPrivate namespace - - - -// This macro is used to ensure that no two flags that can be combined in -// the same integer value have overlapping bits. This is sometimes not entirely -// trivial to ensure, for example in wxWindow styles or flags for wxSizerItem -// that span several enums, some of them used for multiple purposes. -// -// By constructing allowed flags mask using wxADD_FLAG macro and then using -// this mask to check flags passed as arguments, you can ensure that -// -// a) if any of the allowed flags overlap, you will get compilation error -// b) if invalid flag is used, there will be an assert at runtime -// -// Example usage: -// -// static const int SIZER_FLAGS_MASK = -// wxADD_FLAG(wxCENTRE, -// wxADD_FLAG(wxHORIZONTAL, -// wxADD_FLAG(wxVERTICAL, -// ... -// 0))...); -// -// And wherever flags are used: -// -// wxASSERT_VALID_FLAG( m_flag, SIZER_FLAGS_MASK ); - -#define wxADD_FLAG(f, others) \ - ::wxPrivate::SafelyAddToMask::value - -#else - #define wxADD_FLAG(f, others) (f | others) -#endif - -// Checks if flags value 'f' is within the mask of allowed values -#define wxASSERT_VALID_FLAGS(f, mask) \ - wxASSERT_MSG( (f & mask) == f, \ - "invalid flag: not within " #mask ) - -#endif // _WX_PRIVATE_FLAGSCHECK_H_ diff --git a/Source/3rd Party/wx/include/wx/private/fswatcher.h b/Source/3rd Party/wx/include/wx/private/fswatcher.h deleted file mode 100644 index 3b10c41de..000000000 --- a/Source/3rd Party/wx/include/wx/private/fswatcher.h +++ /dev/null @@ -1,92 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/private/fswatcher.h -// Purpose: File system watcher impl classes -// Author: Bartosz Bekier -// Created: 2009-05-26 -// RCS-ID: $Id$ -// Copyright: (c) 2009 Bartosz Bekier -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef WX_PRIVATE_FSWATCHER_H_ -#define WX_PRIVATE_FSWATCHER_H_ - -#include "wx/sharedptr.h" - -#ifdef wxHAS_INOTIFY - class wxFSWatchEntryUnix; - #define wxFSWatchEntry wxFSWatchEntryUnix - WX_DECLARE_STRING_HASH_MAP(wxSharedPtr,wxFSWatchEntries); - #include "wx/unix/private/fswatcher_inotify.h" -#elif defined(wxHAS_KQUEUE) - class wxFSWatchEntryKq; - #define wxFSWatchEntry wxFSWatchEntryKq - WX_DECLARE_STRING_HASH_MAP(wxSharedPtr,wxFSWatchEntries); - #include "wx/unix/private/fswatcher_kqueue.h" -#elif defined(__WINDOWS__) - class wxFSWatchEntryMSW; - #define wxFSWatchEntry wxFSWatchEntryMSW - WX_DECLARE_STRING_HASH_MAP(wxSharedPtr,wxFSWatchEntries); - #include "wx/msw/private/fswatcher.h" -#else - #define wxFSWatchEntry wxFSWatchEntryPolling -#endif - -class wxFSWatcherImpl -{ -public: - wxFSWatcherImpl(wxFileSystemWatcherBase* watcher) : - m_watcher(watcher) - { - } - - virtual ~wxFSWatcherImpl() - { - (void) RemoveAll(); - } - - virtual bool Init() = 0; - - virtual bool Add(const wxFSWatchInfo& winfo) - { - wxCHECK_MSG( m_watches.find(winfo.GetPath()) == m_watches.end(), false, - "Path '%s' is already watched"); - - // construct watch entry - wxSharedPtr watch(new wxFSWatchEntry(winfo)); - - if (!DoAdd(watch)) - return false; - - // add watch to our map (always succeedes, checked above) - wxFSWatchEntries::value_type val(watch->GetPath(), watch); - return m_watches.insert(val).second; - } - - virtual bool Remove(const wxFSWatchInfo& winfo) - { - wxFSWatchEntries::iterator it = m_watches.find(winfo.GetPath()); - wxCHECK_MSG( it != m_watches.end(), false, "Path '%s' is not watched"); - - wxSharedPtr watch = it->second; - m_watches.erase(it); - return DoRemove(watch); - } - - virtual bool RemoveAll() - { - m_watches.clear(); - return true; - } - -protected: - virtual bool DoAdd(wxSharedPtr watch) = 0; - - virtual bool DoRemove(wxSharedPtr watch) = 0; - - wxFSWatchEntries m_watches; - wxFileSystemWatcherBase* m_watcher; -}; - - -#endif /* WX_PRIVATE_FSWATCHER_H_ */ diff --git a/Source/3rd Party/wx/include/wx/private/graphics.h b/Source/3rd Party/wx/include/wx/private/graphics.h deleted file mode 100644 index 90636c67a..000000000 --- a/Source/3rd Party/wx/include/wx/private/graphics.h +++ /dev/null @@ -1,169 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/private/graphics.h -// Purpose: private graphics context header -// Author: Stefan Csomor -// Modified by: -// Created: -// Copyright: (c) Stefan Csomor -// RCS-ID: $Id$ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GRAPHICS_PRIVATE_H_ -#define _WX_GRAPHICS_PRIVATE_H_ - -#if wxUSE_GRAPHICS_CONTEXT - -#include "wx/graphics.h" - -class WXDLLIMPEXP_CORE wxGraphicsObjectRefData : public wxObjectRefData -{ - public : - wxGraphicsObjectRefData( wxGraphicsRenderer* renderer ); - wxGraphicsObjectRefData( const wxGraphicsObjectRefData* data ); - wxGraphicsRenderer* GetRenderer() const ; - virtual wxGraphicsObjectRefData* Clone() const ; - - protected : - wxGraphicsRenderer* m_renderer; -} ; - -class WXDLLIMPEXP_CORE wxGraphicsBitmapData : public wxGraphicsObjectRefData -{ -public : - wxGraphicsBitmapData( wxGraphicsRenderer* renderer) : - wxGraphicsObjectRefData(renderer) {} - - virtual ~wxGraphicsBitmapData() {} - - // returns the native representation - virtual void * GetNativeBitmap() const = 0; -} ; - -class WXDLLIMPEXP_CORE wxGraphicsMatrixData : public wxGraphicsObjectRefData -{ -public : - wxGraphicsMatrixData( wxGraphicsRenderer* renderer) : - wxGraphicsObjectRefData(renderer) {} - - virtual ~wxGraphicsMatrixData() {} - - // concatenates the matrix - virtual void Concat( const wxGraphicsMatrixData *t ) = 0; - - // sets the matrix to the respective values - virtual void Set(wxDouble a=1.0, wxDouble b=0.0, wxDouble c=0.0, wxDouble d=1.0, - wxDouble tx=0.0, wxDouble ty=0.0) = 0; - - // gets the component valuess of the matrix - virtual void Get(wxDouble* a=NULL, wxDouble* b=NULL, wxDouble* c=NULL, - wxDouble* d=NULL, wxDouble* tx=NULL, wxDouble* ty=NULL) const = 0; - - // makes this the inverse matrix - virtual void Invert() = 0; - - // returns true if the elements of the transformation matrix are equal ? - virtual bool IsEqual( const wxGraphicsMatrixData* t) const = 0; - - // return true if this is the identity matrix - virtual bool IsIdentity() const = 0; - - // - // transformation - // - - // add the translation to this matrix - virtual void Translate( wxDouble dx , wxDouble dy ) = 0; - - // add the scale to this matrix - virtual void Scale( wxDouble xScale , wxDouble yScale ) = 0; - - // add the rotation to this matrix (radians) - virtual void Rotate( wxDouble angle ) = 0; - - // - // apply the transforms - // - - // applies that matrix to the point - virtual void TransformPoint( wxDouble *x, wxDouble *y ) const = 0; - - // applies the matrix except for translations - virtual void TransformDistance( wxDouble *dx, wxDouble *dy ) const =0; - - // returns the native representation - virtual void * GetNativeMatrix() const = 0; -} ; - -class WXDLLIMPEXP_CORE wxGraphicsPathData : public wxGraphicsObjectRefData -{ -public : - wxGraphicsPathData(wxGraphicsRenderer* renderer) : wxGraphicsObjectRefData(renderer) {} - virtual ~wxGraphicsPathData() {} - - // - // These are the path primitives from which everything else can be constructed - // - - // begins a new subpath at (x,y) - virtual void MoveToPoint( wxDouble x, wxDouble y ) = 0; - - // adds a straight line from the current point to (x,y) - virtual void AddLineToPoint( wxDouble x, wxDouble y ) = 0; - - // adds a cubic Bezier curve from the current point, using two control points and an end point - virtual void AddCurveToPoint( wxDouble cx1, wxDouble cy1, wxDouble cx2, wxDouble cy2, wxDouble x, wxDouble y ) = 0; - - // adds another path - virtual void AddPath( const wxGraphicsPathData* path ) =0; - - // closes the current sub-path - virtual void CloseSubpath() = 0; - - // gets the last point of the current path, (0,0) if not yet set - virtual void GetCurrentPoint( wxDouble* x, wxDouble* y) const = 0; - - // adds an arc of a circle centering at (x,y) with radius (r) from startAngle to endAngle - virtual void AddArc( wxDouble x, wxDouble y, wxDouble r, wxDouble startAngle, wxDouble endAngle, bool clockwise ) = 0; - - // - // These are convenience functions which - if not available natively will be assembled - // using the primitives from above - // - - // adds a quadratic Bezier curve from the current point, using a control point and an end point - virtual void AddQuadCurveToPoint( wxDouble cx, wxDouble cy, wxDouble x, wxDouble y ); - - // appends a rectangle as a new closed subpath - virtual void AddRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h ); - - // appends an ellipsis as a new closed subpath fitting the passed rectangle - virtual void AddCircle( wxDouble x, wxDouble y, wxDouble r ); - - // appends a an arc to two tangents connecting (current) to (x1,y1) and (x1,y1) to (x2,y2), also a straight line from (current) to (x1,y1) - virtual void AddArcToPoint( wxDouble x1, wxDouble y1 , wxDouble x2, wxDouble y2, wxDouble r ) ; - - // appends an ellipse - virtual void AddEllipse( wxDouble x, wxDouble y, wxDouble w, wxDouble h); - - // appends a rounded rectangle - virtual void AddRoundedRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h, wxDouble radius); - - // returns the native path - virtual void * GetNativePath() const = 0; - - // give the native path returned by GetNativePath() back (there might be some deallocations necessary) - virtual void UnGetNativePath(void *p) const= 0; - - // transforms each point of this path by the matrix - virtual void Transform( const wxGraphicsMatrixData* matrix ) =0; - - // gets the bounding box enclosing all points (possibly including control points) - virtual void GetBox(wxDouble *x, wxDouble *y, wxDouble *w, wxDouble *h) const=0; - - virtual bool Contains( wxDouble x, wxDouble y, wxPolygonFillMode fillStyle = wxODDEVEN_RULE) const=0; -}; - -#endif - -#endif // _WX_GRAPHICS_PRIVATE_H_ diff --git a/Source/3rd Party/wx/include/wx/private/markupparser.h b/Source/3rd Party/wx/include/wx/private/markupparser.h deleted file mode 100644 index 21b98b5d5..000000000 --- a/Source/3rd Party/wx/include/wx/private/markupparser.h +++ /dev/null @@ -1,177 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/private/markupparser.h -// Purpose: Classes for parsing simple markup. -// Author: Vadim Zeitlin -// Created: 2011-02-16 -// RCS-ID: $Id: $ -// Copyright: (c) 2011 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_PRIVATE_MARKUPPARSER_H_ -#define _WX_PRIVATE_MARKUPPARSER_H_ - -#include "wx/string.h" - -// ---------------------------------------------------------------------------- -// wxMarkupSpanAttributes: information about attributes for a markup span. -// ---------------------------------------------------------------------------- - -struct wxMarkupSpanAttributes -{ - enum OptionalBool - { - Unspecified = -1, - No, - Yes - }; - - wxMarkupSpanAttributes() - { - m_sizeKind = Size_Unspecified; - - m_isBold = - m_isItalic = - m_isUnderlined = - m_isStrikethrough = Unspecified; - } - - // If a string is empty, it means that the corresponding attribute is not - // set. - wxString m_fgCol, - m_bgCol, - m_fontFace; - - // There are many ways of specifying the size. First of all, the size may - // be relative in which case m_fontSize is either -1 or +1 meaning that - // it's one step smaller or larger than the current font. Second, it may be - // absolute in which case m_fontSize contains either the size in 1024th of - // a point (Pango convention) or its values are in [-3, 3] interval and map - // to [xx-small, xx-large] CSS-like font size specification. And finally it - // may be not specified at all, of course, in which case the value of - // m_fontSize doesn't matter and it shouldn't be used. - enum - { - Size_Unspecified, - Size_Relative, - Size_Symbolic, - Size_PointParts - } m_sizeKind; - int m_fontSize; - - // If the value is Unspecified, the attribute wasn't given. - OptionalBool m_isBold, - m_isItalic, - m_isUnderlined, - m_isStrikethrough; -}; - -// ---------------------------------------------------------------------------- -// wxMarkupParserOutput: gathers the results of parsing markup. -// ---------------------------------------------------------------------------- - -// A class deriving directly from this one needs to implement all the pure -// virtual functions below but as the handling of all simple tags (bold, italic -// &c) is often very similar, it is usually more convenient to inherit from -// wxMarkupParserFontOutput defined in wx/private/markupparserfont.h instead. -class wxMarkupParserOutput -{ -public: - wxMarkupParserOutput() { } - virtual ~wxMarkupParserOutput() { } - - // Virtual functions called by wxMarkupParser while parsing the markup. - - // Called for a run of normal text. - virtual void OnText(const wxString& text) = 0; - - // These functions correspond to the simple tags without parameters. - virtual void OnBoldStart() = 0; - virtual void OnBoldEnd() = 0; - - virtual void OnItalicStart() = 0; - virtual void OnItalicEnd() = 0; - - virtual void OnUnderlinedStart() = 0; - virtual void OnUnderlinedEnd() = 0; - - virtual void OnStrikethroughStart() = 0; - virtual void OnStrikethroughEnd() = 0; - - virtual void OnBigStart() = 0; - virtual void OnBigEnd() = 0; - - virtual void OnSmallStart() = 0; - virtual void OnSmallEnd() = 0; - - virtual void OnTeletypeStart() = 0; - virtual void OnTeletypeEnd() = 0; - - // The generic span start and end functions. - virtual void OnSpanStart(const wxMarkupSpanAttributes& attrs) = 0; - virtual void OnSpanEnd(const wxMarkupSpanAttributes& attrs) = 0; - -private: - wxDECLARE_NO_COPY_CLASS(wxMarkupParserOutput); -}; - -// ---------------------------------------------------------------------------- -// wxMarkupParser: parses the given markup text into wxMarkupParserOutput. -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxMarkupParser -{ -public: - // Initialize the parser with the object that will receive parsing results. - // This object lifetime must be greater than ours. - explicit wxMarkupParser(wxMarkupParserOutput& output) - : m_output(output) - { - } - - // Parse the entire string and call wxMarkupParserOutput methods. - // - // Return true if the string was successfully parsed or false if it failed - // (presumably because of syntax errors in the markup). - bool Parse(const wxString& text); - - // Quote a normal string, not meant to be interpreted as markup, so that it - // produces the same string when parsed as markup. This means, for example, - // replacing '<' in the input string with "<" to prevent them from being - // interpreted as tag opening characters. - static wxString Quote(const wxString& text); - - // Strip markup from a string, i.e. simply remove all tags and replace - // XML entities with their values (or with "&&" in case of "&" to - // prevent it from being interpreted as mnemonic marker). - static wxString Strip(const wxString& text); - -private: - // Simple struct combining the name of a tag and its attributes. - struct TagAndAttrs - { - TagAndAttrs(const wxString& name_) : name(name_) { } - - wxString name; - wxMarkupSpanAttributes attrs; - }; - - // Call the wxMarkupParserOutput method corresponding to the given tag. - // - // Return false if the tag doesn't match any of the known ones. - bool OutputTag(const TagAndAttrs& tagAndAttrs, bool start); - - // Parse the attributes and fill the provided TagAndAttrs object with the - // information about them. Does nothing if attrs string is empty. - // - // Returns empty string on success of a [fragment of an] error message if - // we failed to parse the attributes. - wxString ParseAttrs(wxString attrs, TagAndAttrs& tagAndAttrs); - - - wxMarkupParserOutput& m_output; - - wxDECLARE_NO_COPY_CLASS(wxMarkupParser); -}; - -#endif // _WX_PRIVATE_MARKUPPARSER_H_ diff --git a/Source/3rd Party/wx/include/wx/private/markupparserattr.h b/Source/3rd Party/wx/include/wx/private/markupparserattr.h deleted file mode 100644 index b1c7d50a2..000000000 --- a/Source/3rd Party/wx/include/wx/private/markupparserattr.h +++ /dev/null @@ -1,232 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/private/markupparserattr.h -// Purpose: Classes mapping markup attributes to wxFont/wxColour. -// Author: Vadim Zeitlin -// Created: 2011-02-18 -// RCS-ID: $Id: wxhead.h,v 1.12 2010-04-22 12:44:51 zeitlin Exp $ -// Copyright: (c) 2011 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_PRIVATE_MARKUPPARSERATTR_H_ -#define _WX_PRIVATE_MARKUPPARSERATTR_H_ - -#include "wx/private/markupparser.h" - -#include "wx/stack.h" - -#include "wx/colour.h" -#include "wx/font.h" - -// ---------------------------------------------------------------------------- -// wxMarkupParserAttrOutput: simplified wxFont-using version of the above. -// ---------------------------------------------------------------------------- - -// This class assumes that wxFont and wxColour are used to perform all the -// markup tags and implements the base class virtual functions in terms of -// OnAttr{Start,End}() only. -// -// Notice that you still must implement OnText() inherited from the base class -// when deriving from this one. -class wxMarkupParserAttrOutput : public wxMarkupParserOutput -{ -public: - // A simple container of font and colours. - struct Attr - { - Attr(const wxFont& font_, - const wxColour& foreground_ = wxColour(), - const wxColour& background_ = wxColour()) - : font(font_), foreground(foreground_), background(background_) - { - } - - wxFont font; - wxColour foreground, - background; - }; - - - // This object must be initialized with the font and colours to use - // initially, i.e. the ones used before any tags in the string. - wxMarkupParserAttrOutput(const wxFont& font, - const wxColour& foreground, - const wxColour& background) - { - m_attrs.push(Attr(font, foreground, background)); - } - - // Indicates the change of the font and/or colours used. Any of the - // fields of the argument may be invalid indicating that the corresponding - // attribute didn't actually change. - virtual void OnAttrStart(const Attr& attr) = 0; - - // Indicates the end of the region affected by the given attributes - // (the same ones that were passed to the matching OnAttrStart(), use - // GetAttr() to get the ones that will be used from now on). - virtual void OnAttrEnd(const Attr& attr) = 0; - - - // Implement all pure virtual methods inherited from the base class in - // terms of our own ones. - virtual void OnBoldStart() { DoChangeFont(&wxFont::Bold); } - virtual void OnBoldEnd() { DoEndAttr(); } - - virtual void OnItalicStart() { DoChangeFont(&wxFont::Italic); } - virtual void OnItalicEnd() { DoEndAttr(); } - - virtual void OnUnderlinedStart() { DoChangeFont(&wxFont::Underlined); } - virtual void OnUnderlinedEnd() { DoEndAttr(); } - - virtual void OnStrikethroughStart() { DoChangeFont(&wxFont::Strikethrough); } - virtual void OnStrikethroughEnd() { DoEndAttr(); } - - virtual void OnBigStart() { DoChangeFont(&wxFont::Larger); } - virtual void OnBigEnd() { DoEndAttr(); } - - virtual void OnSmallStart() { DoChangeFont(&wxFont::Smaller); } - virtual void OnSmallEnd() { DoEndAttr(); } - - virtual void OnTeletypeStart() - { - wxFont font(GetFont()); - font.SetFamily(wxFONTFAMILY_TELETYPE); - DoSetFont(font); - } - virtual void OnTeletypeEnd() { DoEndAttr(); } - - virtual void OnSpanStart(const wxMarkupSpanAttributes& spanAttr) - { - wxFont font(GetFont()); - if ( !spanAttr.m_fontFace.empty() ) - font.SetFaceName(spanAttr.m_fontFace); - - FontModifier()(spanAttr.m_isBold, - font, &wxFont::SetWeight, - wxFONTWEIGHT_NORMAL, wxFONTWEIGHT_BOLD); - - FontModifier()(spanAttr.m_isItalic, - font, &wxFont::SetStyle, - wxFONTSTYLE_NORMAL, wxFONTSTYLE_ITALIC); - - FontModifier()(spanAttr.m_isUnderlined, - font, &wxFont::SetUnderlined, - false, true); - - // TODO: No support for strike-through yet. - - switch ( spanAttr.m_sizeKind ) - { - case wxMarkupSpanAttributes::Size_Unspecified: - break; - - case wxMarkupSpanAttributes::Size_Relative: - if ( spanAttr.m_fontSize > 0 ) - font.MakeLarger(); - else - font.MakeSmaller(); - break; - - case wxMarkupSpanAttributes::Size_Symbolic: - // The values of font size intentionally coincide with the - // values of wxFontSymbolicSize enum elements so simply cast - // one to the other. - font.SetSymbolicSize( - static_cast(spanAttr.m_fontSize) - ); - break; - - case wxMarkupSpanAttributes::Size_PointParts: - font.SetPointSize((spanAttr.m_fontSize + 1023)/1024); - break; - } - - - const Attr attr(font, spanAttr.m_fgCol, spanAttr.m_bgCol); - OnAttrStart(attr); - - m_attrs.push(attr); - } - - virtual void OnSpanEnd(const wxMarkupSpanAttributes& WXUNUSED(spanAttr)) - { - DoEndAttr(); - } - -protected: - // Get the current attributes, i.e. the ones that should be used for - // rendering (or measuring or whatever) the text at the current position in - // the string. - // - // It may be called from OnAttrStart() to get the old attributes used - // before and from OnAttrEnd() to get the new attributes that will be used - // from now on but is mostly meant to be used from overridden OnText() - // implementations. - const Attr& GetAttr() const { return m_attrs.top(); } - - // A shortcut for accessing the font of the current attribute. - const wxFont& GetFont() const { return GetAttr().font; } - -private: - // Change only the font to the given one. Call OnAttrStart() to notify - // about the change and update the attributes stack. - void DoSetFont(const wxFont& font) - { - const Attr attr(font); - - OnAttrStart(attr); - - m_attrs.push(attr); - } - - // Apply the given function to the font currently on top of the font stack, - // push the new font on the stack and call OnAttrStart() with it. - void DoChangeFont(wxFont (wxFont::*func)() const) - { - DoSetFont((GetFont().*func)()); - } - - void DoEndAttr() - { - const Attr attr(m_attrs.top()); - m_attrs.pop(); - - OnAttrEnd(attr); - } - - // A helper class used to apply the given function to a wxFont object - // depending on the value of an OptionalBool. - template - struct FontModifier - { - FontModifier() { } - - void operator()(wxMarkupSpanAttributes::OptionalBool isIt, - wxFont& font, - void (wxFont::*func)(T), - T noValue, - T yesValue) - { - switch ( isIt ) - { - case wxMarkupSpanAttributes::Unspecified: - break; - - case wxMarkupSpanAttributes::No: - (font.*func)(noValue); - break; - - case wxMarkupSpanAttributes::Yes: - (font.*func)(yesValue); - break; - } - } - }; - - - wxStack m_attrs; - - wxDECLARE_NO_COPY_CLASS(wxMarkupParserAttrOutput); -}; - -#endif // _WX_PRIVATE_MARKUPPARSERATTR_H_ diff --git a/Source/3rd Party/wx/include/wx/private/overlay.h b/Source/3rd Party/wx/include/wx/private/overlay.h index f7eff9ccb..9203503ce 100644 --- a/Source/3rd Party/wx/include/wx/private/overlay.h +++ b/Source/3rd Party/wx/include/wx/private/overlay.h @@ -4,7 +4,7 @@ // Author: Stefan Csomor // Modified by: // Created: 2006-10-20 -// RCS-ID: $Id$ +// RCS-ID: $Id: overlay.h 53135 2008-04-12 02:31:04Z VZ $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -17,7 +17,7 @@ #ifdef wxHAS_NATIVE_OVERLAY #if defined(__WXMAC__) - #include "wx/osx/carbon/private/overlay.h" + #include "wx/mac/carbon/private/overlay.h" #elif defined(__WXDFB__) #include "wx/dfb/private/overlay.h" #else @@ -45,13 +45,13 @@ public: // returns true if it has been setup bool IsOk(); - void Init(wxDC* dc, int x , int y , int width , int height); + void Init(wxWindowDC* dc, int x , int y , int width , int height); - void BeginDrawing(wxDC* dc); + void BeginDrawing(wxWindowDC* dc); - void EndDrawing(wxDC* dc); + void EndDrawing(wxWindowDC* dc); - void Clear(wxDC* dc); + void Clear(wxWindowDC* dc); private: wxBitmap m_bmpSaved ; @@ -59,8 +59,13 @@ private: int m_y ; int m_width ; int m_height ; +// this is to enable wxMOTIF and UNIV to compile.... +// currently (10 oct 06) we don't use m_window +// ce - how do we fix this +#if defined(__WXGTK__) || defined(__WXMSW__) wxWindow* m_window ; -}; +#endif +} ; #endif // wxHAS_NATIVE_OVERLAY/!wxHAS_NATIVE_OVERLAY diff --git a/Source/3rd Party/wx/include/wx/private/threadinfo.h b/Source/3rd Party/wx/include/wx/private/threadinfo.h deleted file mode 100644 index e227bf47a..000000000 --- a/Source/3rd Party/wx/include/wx/private/threadinfo.h +++ /dev/null @@ -1,54 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/private/threadinfo.h -// Purpose: declaration of wxThreadSpecificInfo: thread-specific information -// Author: Vadim Zeitlin -// Created: 2009-07-13 -// RCS-ID: $Id$ -// Copyright: (c) 2009 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_PRIVATE_THREADINFO_H_ -#define _WX_PRIVATE_THREADINFO_H_ - -#if wxUSE_THREADS - -#include "wx/tls.h" - -class WXDLLIMPEXP_FWD_BASE wxLog; - -// ---------------------------------------------------------------------------- -// wxThreadSpecificInfo: contains all thread-specific information used by wx -// ---------------------------------------------------------------------------- - -// currently the only thread-specific information we use is the active wxLog -// target but more could be added in the future (e.g. current wxLocale would be -// a likely candidate) and we will group all of them in this struct to avoid -// consuming more TLS slots than necessary as there is only a limited number of -// them - -// NB: this must be a POD to be stored in TLS -struct wxThreadSpecificInfo -{ - // the thread-specific logger or NULL if the thread is using the global one - // (this is not used for the main thread which always uses the global - // logger) - wxLog *logger; - - // true if logging is currently disabled for this thread (this is also not - // used for the main thread which uses wxLog::ms_doLog) - // - // NB: we use a counter-intuitive "disabled" flag instead of "enabled" one - // because the default, for 0-initialized struct, should be to enable - // logging - bool loggingDisabled; -}; - -// currently this is defined in src/common/log.cpp -extern wxTLS_TYPE(wxThreadSpecificInfo) wxThreadInfoVar; -#define wxThreadInfo wxTLS_VALUE(wxThreadInfoVar) - -#endif // wxUSE_THREADS - -#endif // _WX_PRIVATE_THREADINFO_H_ - diff --git a/Source/3rd Party/wx/include/wx/private/timer.h b/Source/3rd Party/wx/include/wx/private/timer.h deleted file mode 100644 index 63e032a8a..000000000 --- a/Source/3rd Party/wx/include/wx/private/timer.h +++ /dev/null @@ -1,73 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/private/timer.h -// Purpose: Base class for wxTimer implementations -// Author: Lukasz Michalski -// Created: 31.10.2006 -// RCS-ID: $Id$ -// Copyright: (c) 2006-2007 wxWidgets dev team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TIMERIMPL_H_BASE_ -#define _WX_TIMERIMPL_H_BASE_ - -#include "wx/defs.h" -#include "wx/event.h" -#include "wx/timer.h" - -// ---------------------------------------------------------------------------- -// wxTimerImpl: abstract base class for wxTimer implementations -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxTimerImpl -{ -public: - // default ctor, SetOwner() must be called after it (wxTimer does it) - wxTimerImpl(wxTimer *owner); - - // this must be called initially but may be also called later - void SetOwner(wxEvtHandler *owner, int timerid); - - // empty but virtual base class dtor, the caller is responsible for - // stopping the timer before it's destroyed (it can't be done from here as - // it's too late) - virtual ~wxTimerImpl() { } - - - // start the timer. When overriding call base version first. - virtual bool Start(int milliseconds = -1, bool oneShot = false); - - // stop the timer, only called if the timer is really running (unlike - // wxTimer::Stop()) - virtual void Stop() = 0; - - // return true if the timer is running - virtual bool IsRunning() const = 0; - - // this should be called by the port-specific code when the timer expires - virtual void Notify() { m_timer->Notify(); } - - // the default implementation of wxTimer::Notify(): generate a wxEVT_TIMER - void SendEvent(); - - - // accessors for wxTimer: - wxEvtHandler *GetOwner() const { return m_owner; } - int GetId() const { return m_idTimer; } - int GetInterval() const { return m_milli; } - bool IsOneShot() const { return m_oneShot; } - -protected: - wxTimer *m_timer; - - wxEvtHandler *m_owner; - - int m_idTimer; // id passed to wxTimerEvent - int m_milli; // the timer interval - bool m_oneShot; // true if one shot - - - wxDECLARE_NO_COPY_CLASS(wxTimerImpl); -}; - -#endif // _WX_TIMERIMPL_H_BASE_ diff --git a/Source/3rd Party/wx/include/wx/private/window.h b/Source/3rd Party/wx/include/wx/private/window.h deleted file mode 100644 index 46f01c818..000000000 --- a/Source/3rd Party/wx/include/wx/private/window.h +++ /dev/null @@ -1,39 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/private/window.h -// Purpose: misc wxWindow helpers -// Author: Vaclav Slavik -// Created: 2010-01-21 -// RCS-ID: $Id$ -// Copyright: (c) 2010 Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_PRIVATE_WINDOW_H_ -#define _WX_PRIVATE_WINDOW_H_ - -#include "wx/gdicmn.h" - -namespace wxPrivate -{ - -// Windows' computes dialog units using average character width over upper- -// and lower-case ASCII alphabet and not using the average character width -// metadata stored in the font; see -// http://support.microsoft.com/default.aspx/kb/145994 for detailed discussion. -// -// This helper function computes font dimensions in the same way. It works with -// either wxDC or wxWindow argument. -template -inline wxSize GetAverageASCIILetterSize(const T& of_what) -{ - const wxStringCharType *TEXT_TO_MEASURE = - wxS("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"); - - wxSize s = of_what.GetTextExtent(TEXT_TO_MEASURE); - s.x = (s.x / 26 + 1) / 2; - return s; -} - -} // namespace wxPrivate - -#endif // _WX_PRIVATE_WINDOW_H_ diff --git a/Source/3rd Party/wx/include/wx/private/wxprintf.h b/Source/3rd Party/wx/include/wx/private/wxprintf.h deleted file mode 100644 index 1cee5026e..000000000 --- a/Source/3rd Party/wx/include/wx/private/wxprintf.h +++ /dev/null @@ -1,935 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/private/wxprintf.h -// Purpose: wxWidgets wxPrintf() implementation -// Author: Ove Kaven -// Modified by: Ron Lee, Francesco Montorsi -// Created: 09/04/99 -// RCS-ID: $Id$ -// Copyright: (c) wxWidgets copyright -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_PRIVATE_WXPRINTF_H_ -#define _WX_PRIVATE_WXPRINTF_H_ - -// --------------------------------------------------------------------------- -// headers and macros -// --------------------------------------------------------------------------- - -#include "wx/crt.h" -#include "wx/log.h" -#include "wx/utils.h" - -#include - -// prefer snprintf over sprintf -#if defined(__VISUALC__) || \ - (defined(__BORLANDC__) && __BORLANDC__ >= 0x540) - #define system_sprintf(buff, max, flags, data) \ - ::_snprintf(buff, max, flags, data) -#elif defined(HAVE_SNPRINTF) - #define system_sprintf(buff, max, flags, data) \ - ::snprintf(buff, max, flags, data) -#else // NB: at least sprintf() should always be available - // since 'max' is not used in this case, wxVsnprintf() should always - // ensure that 'buff' is big enough for all common needs - // (see wxMAX_SVNPRINTF_FLAGBUFFER_LEN and wxMAX_SVNPRINTF_SCRATCHBUFFER_LEN) - #define system_sprintf(buff, max, flags, data) \ - ::sprintf(buff, flags, data) - - #define SYSTEM_SPRINTF_IS_UNSAFE -#endif - -// --------------------------------------------------------------------------- -// printf format string parsing -// --------------------------------------------------------------------------- - -// some limits of our implementation -#define wxMAX_SVNPRINTF_ARGUMENTS 64 -#define wxMAX_SVNPRINTF_FLAGBUFFER_LEN 32 -#define wxMAX_SVNPRINTF_SCRATCHBUFFER_LEN 512 - - -// the conversion specifiers accepted by wxCRT_VsnprintfW -enum wxPrintfArgType -{ - wxPAT_INVALID = -1, - - wxPAT_INT, // %d, %i, %o, %u, %x, %X - wxPAT_LONGINT, // %ld, etc -#ifdef wxLongLong_t - wxPAT_LONGLONGINT, // %Ld, etc -#endif - wxPAT_SIZET, // %zd, etc - - wxPAT_DOUBLE, // %e, %E, %f, %g, %G - wxPAT_LONGDOUBLE, // %le, etc - - wxPAT_POINTER, // %p - - wxPAT_CHAR, // %hc (in ANSI mode: %c, too) - wxPAT_WCHAR, // %lc (in Unicode mode: %c, too) - - wxPAT_PCHAR, // %s (related to a char *) - wxPAT_PWCHAR, // %s (related to a wchar_t *) - - wxPAT_NINT, // %n - wxPAT_NSHORTINT, // %hn - wxPAT_NLONGINT, // %ln - - wxPAT_STAR // '*' used for width or precision -}; - -// an argument passed to wxCRT_VsnprintfW -union wxPrintfArg -{ - int pad_int; // %d, %i, %o, %u, %x, %X - long int pad_longint; // %ld, etc -#ifdef wxLongLong_t - wxLongLong_t pad_longlongint; // %Ld, etc -#endif - size_t pad_sizet; // %zd, etc - - double pad_double; // %e, %E, %f, %g, %G - long double pad_longdouble; // %le, etc - - void *pad_pointer; // %p - - char pad_char; // %hc (in ANSI mode: %c, too) - wchar_t pad_wchar; // %lc (in Unicode mode: %c, too) - - void *pad_str; // %s - - int *pad_nint; // %n - short int *pad_nshortint; // %hn - long int *pad_nlongint; // %ln -}; - -// helper for converting string into either char* or wchar_t* depending -// on the type of wxPrintfConvSpec instantiation: -template struct wxPrintfStringHelper {}; - -template<> struct wxPrintfStringHelper -{ - typedef const wxWX2MBbuf ConvertedType; - static ConvertedType Convert(const wxString& s) { return s.mb_str(); } -}; - -template<> struct wxPrintfStringHelper -{ - typedef const wxWX2WCbuf ConvertedType; - static ConvertedType Convert(const wxString& s) { return s.wc_str(); } -}; - - -// Contains parsed data relative to a conversion specifier given to -// wxCRT_VsnprintfW and parsed from the format string -// NOTE: in C++ there is almost no difference between struct & classes thus -// there is no performance gain by using a struct here... -template -class wxPrintfConvSpec -{ -public: - - // the position of the argument relative to this conversion specifier - size_t m_pos; - - // the type of this conversion specifier - wxPrintfArgType m_type; - - // the minimum and maximum width - // when one of this var is set to -1 it means: use the following argument - // in the stack as minimum/maximum width for this conversion specifier - int m_nMinWidth, m_nMaxWidth; - - // does the argument need to the be aligned to left ? - bool m_bAlignLeft; - - // pointer to the '%' of this conversion specifier in the format string - // NOTE: this points somewhere in the string given to the Parse() function - - // it's task of the caller ensure that memory is still valid ! - const CharType *m_pArgPos; - - // pointer to the last character of this conversion specifier in the - // format string - // NOTE: this points somewhere in the string given to the Parse() function - - // it's task of the caller ensure that memory is still valid ! - const CharType *m_pArgEnd; - - // a little buffer where formatting flags like #+\.hlqLz are stored by Parse() - // for use in Process() - char m_szFlags[wxMAX_SVNPRINTF_FLAGBUFFER_LEN]; - - -public: - - // we don't declare this as a constructor otherwise it would be called - // automatically and we don't want this: to be optimized, wxCRT_VsnprintfW - // calls this function only on really-used instances of this class. - void Init(); - - // Parses the first conversion specifier in the given string, which must - // begin with a '%'. Returns false if the first '%' does not introduce a - // (valid) conversion specifier and thus should be ignored. - bool Parse(const CharType *format); - - // Process this conversion specifier and puts the result in the given - // buffer. Returns the number of characters written in 'buf' or -1 if - // there's not enough space. - int Process(CharType *buf, size_t lenMax, wxPrintfArg *p, size_t written); - - // Loads the argument of this conversion specifier from given va_list. - bool LoadArg(wxPrintfArg *p, va_list &argptr); - -private: - // An helper function of LoadArg() which is used to handle the '*' flag - void ReplaceAsteriskWith(int w); -}; - -template -void wxPrintfConvSpec::Init() -{ - m_nMinWidth = 0; - m_nMaxWidth = 0xFFFF; - m_pos = 0; - m_bAlignLeft = false; - m_pArgPos = m_pArgEnd = NULL; - m_type = wxPAT_INVALID; - - memset(m_szFlags, 0, sizeof(m_szFlags)); - // this character will never be removed from m_szFlags array and - // is important when calling sprintf() in wxPrintfConvSpec::Process() ! - m_szFlags[0] = '%'; -} - -template -bool wxPrintfConvSpec::Parse(const CharType *format) -{ - bool done = false; - - // temporary parse data - size_t flagofs = 1; - bool in_prec, // true if we found the dot in some previous iteration - prec_dot; // true if the dot has been already added to m_szFlags - int ilen = 0; - - m_bAlignLeft = in_prec = prec_dot = false; - m_pArgPos = m_pArgEnd = format; - do - { -#define CHECK_PREC \ - if (in_prec && !prec_dot) \ - { \ - m_szFlags[flagofs++] = '.'; \ - prec_dot = true; \ - } - - // what follows '%'? - const CharType ch = *(++m_pArgEnd); - switch ( ch ) - { - case wxT('\0'): - return false; // not really an argument - - case wxT('%'): - return false; // not really an argument - - case wxT('#'): - case wxT('0'): - case wxT(' '): - case wxT('+'): - case wxT('\''): - CHECK_PREC - m_szFlags[flagofs++] = char(ch); - break; - - case wxT('-'): - CHECK_PREC - m_bAlignLeft = true; - m_szFlags[flagofs++] = char(ch); - break; - - case wxT('.'): - // don't use CHECK_PREC here to avoid warning about the value - // assigned to prec_dot inside it being never used (because - // overwritten just below) from Borland in release build - if (in_prec && !prec_dot) - m_szFlags[flagofs++] = '.'; - in_prec = true; - prec_dot = false; - m_nMaxWidth = 0; - // dot will be auto-added to m_szFlags if non-negative - // number follows - break; - - case wxT('h'): - ilen = -1; - CHECK_PREC - m_szFlags[flagofs++] = char(ch); - break; - - case wxT('l'): - // NB: it's safe to use flagofs-1 as flagofs always start from 1 - if (m_szFlags[flagofs-1] == 'l') // 'll' modifier is the same as 'L' or 'q' - ilen = 2; - else - ilen = 1; - CHECK_PREC - m_szFlags[flagofs++] = char(ch); - break; - - case wxT('q'): - case wxT('L'): - ilen = 2; - CHECK_PREC - m_szFlags[flagofs++] = char(ch); - break; -#ifdef __WINDOWS__ - // under Windows we support the special '%I64' notation as longlong - // integer conversion specifier for MSVC compatibility - // (it behaves exactly as '%lli' or '%Li' or '%qi') - case wxT('I'): - if (*(m_pArgEnd+1) == wxT('6') && - *(m_pArgEnd+2) == wxT('4')) - { - m_pArgEnd++; - m_pArgEnd++; - - ilen = 2; - CHECK_PREC - m_szFlags[flagofs++] = char(ch); - m_szFlags[flagofs++] = '6'; - m_szFlags[flagofs++] = '4'; - break; - } - // else: fall-through, 'I' is MSVC equivalent of C99 'z' -#endif // __WINDOWS__ - - case wxT('z'): - case wxT('Z'): - // 'z' is C99 standard for size_t and ptrdiff_t, 'Z' was used - // for this purpose in libc5 and by wx <= 2.8 - ilen = 3; - CHECK_PREC - m_szFlags[flagofs++] = char(ch); - break; - - case wxT('*'): - if (in_prec) - { - CHECK_PREC - - // tell Process() to use the next argument - // in the stack as maxwidth... - m_nMaxWidth = -1; - } - else - { - // tell Process() to use the next argument - // in the stack as minwidth... - m_nMinWidth = -1; - } - - // save the * in our formatting buffer... - // will be replaced later by Process() - m_szFlags[flagofs++] = char(ch); - break; - - case wxT('1'): case wxT('2'): case wxT('3'): - case wxT('4'): case wxT('5'): case wxT('6'): - case wxT('7'): case wxT('8'): case wxT('9'): - { - int len = 0; - CHECK_PREC - while ( (*m_pArgEnd >= CharType('0')) && - (*m_pArgEnd <= CharType('9')) ) - { - m_szFlags[flagofs++] = char(*m_pArgEnd); - len = len*10 + (*m_pArgEnd - wxT('0')); - m_pArgEnd++; - } - - if (in_prec) - m_nMaxWidth = len; - else - m_nMinWidth = len; - - m_pArgEnd--; // the main loop pre-increments n again - } - break; - - case wxT('$'): // a positional parameter (e.g. %2$s) ? - { - if (m_nMinWidth <= 0) - break; // ignore this formatting flag as no - // numbers are preceding it - - // remove from m_szFlags all digits previously added - do { - flagofs--; - } while (m_szFlags[flagofs] >= '1' && - m_szFlags[flagofs] <= '9'); - - // re-adjust the offset making it point to the - // next free char of m_szFlags - flagofs++; - - m_pos = m_nMinWidth; - m_nMinWidth = 0; - } - break; - - case wxT('d'): - case wxT('i'): - case wxT('o'): - case wxT('u'): - case wxT('x'): - case wxT('X'): - CHECK_PREC - m_szFlags[flagofs++] = char(ch); - if (ilen == 0) - m_type = wxPAT_INT; - else if (ilen == -1) - // NB: 'short int' value passed through '...' - // is promoted to 'int', so we have to get - // an int from stack even if we need a short - m_type = wxPAT_INT; - else if (ilen == 1) - m_type = wxPAT_LONGINT; - else if (ilen == 2) -#ifdef wxLongLong_t - m_type = wxPAT_LONGLONGINT; -#else // !wxLongLong_t - m_type = wxPAT_LONGINT; -#endif // wxLongLong_t/!wxLongLong_t - else if (ilen == 3) - m_type = wxPAT_SIZET; - done = true; - break; - - case wxT('e'): - case wxT('E'): - case wxT('f'): - case wxT('g'): - case wxT('G'): - CHECK_PREC - m_szFlags[flagofs++] = char(ch); - if (ilen == 2) - m_type = wxPAT_LONGDOUBLE; - else - m_type = wxPAT_DOUBLE; - done = true; - break; - - case wxT('p'): - m_type = wxPAT_POINTER; - m_szFlags[flagofs++] = char(ch); - done = true; - break; - - case wxT('c'): - if (ilen == -1) - { - // in Unicode mode %hc == ANSI character - // and in ANSI mode, %hc == %c == ANSI... - m_type = wxPAT_CHAR; - } - else if (ilen == 1) - { - // in ANSI mode %lc == Unicode character - // and in Unicode mode, %lc == %c == Unicode... - m_type = wxPAT_WCHAR; - } - else - { -#if wxUSE_UNICODE - // in Unicode mode, %c == Unicode character - m_type = wxPAT_WCHAR; -#else - // in ANSI mode, %c == ANSI character - m_type = wxPAT_CHAR; -#endif - } - done = true; - break; - - case wxT('s'): - if (ilen == -1) - { - // Unicode mode wx extension: we'll let %hs mean non-Unicode - // strings (when in ANSI mode, %s == %hs == ANSI string) - m_type = wxPAT_PCHAR; - } - else if (ilen == 1) - { - // in Unicode mode, %ls == %s == Unicode string - // in ANSI mode, %ls == Unicode string - m_type = wxPAT_PWCHAR; - } - else - { -#if wxUSE_UNICODE - m_type = wxPAT_PWCHAR; -#else - m_type = wxPAT_PCHAR; -#endif - } - done = true; - break; - - case wxT('n'): - if (ilen == 0) - m_type = wxPAT_NINT; - else if (ilen == -1) - m_type = wxPAT_NSHORTINT; - else if (ilen >= 1) - m_type = wxPAT_NLONGINT; - done = true; - break; - - default: - // bad format, don't consider this an argument; - // leave it unchanged - return false; - } - - if (flagofs == wxMAX_SVNPRINTF_FLAGBUFFER_LEN) - { - wxLogDebug(wxT("Too many flags specified for a single conversion specifier!")); - return false; - } - } - while (!done); - - return true; // parsing was successful -} - -template -void wxPrintfConvSpec::ReplaceAsteriskWith(int width) -{ - char temp[wxMAX_SVNPRINTF_FLAGBUFFER_LEN]; - - // find the first * in our flag buffer - char *pwidth = strchr(m_szFlags, '*'); - wxCHECK_RET(pwidth, wxT("field width must be specified")); - - // save what follows the * (the +1 is to skip the asterisk itself!) - strcpy(temp, pwidth+1); - if (width < 0) - { - pwidth[0] = wxT('-'); - pwidth++; - } - - // replace * with the actual integer given as width -#ifndef SYSTEM_SPRINTF_IS_UNSAFE - int maxlen = (m_szFlags + wxMAX_SVNPRINTF_FLAGBUFFER_LEN - pwidth) / - sizeof(*m_szFlags); -#endif - int offset = system_sprintf(pwidth, maxlen, "%d", abs(width)); - - // restore after the expanded * what was following it - strcpy(pwidth+offset, temp); -} - -template -bool wxPrintfConvSpec::LoadArg(wxPrintfArg *p, va_list &argptr) -{ - // did the '*' width/precision specifier was used ? - if (m_nMaxWidth == -1) - { - // take the maxwidth specifier from the stack - m_nMaxWidth = va_arg(argptr, int); - if (m_nMaxWidth < 0) - m_nMaxWidth = 0; - else - ReplaceAsteriskWith(m_nMaxWidth); - } - - if (m_nMinWidth == -1) - { - // take the minwidth specifier from the stack - m_nMinWidth = va_arg(argptr, int); - - ReplaceAsteriskWith(m_nMinWidth); - if (m_nMinWidth < 0) - { - m_bAlignLeft = !m_bAlignLeft; - m_nMinWidth = -m_nMinWidth; - } - } - - switch (m_type) { - case wxPAT_INT: - p->pad_int = va_arg(argptr, int); - break; - case wxPAT_LONGINT: - p->pad_longint = va_arg(argptr, long int); - break; -#ifdef wxLongLong_t - case wxPAT_LONGLONGINT: - p->pad_longlongint = va_arg(argptr, wxLongLong_t); - break; -#endif // wxLongLong_t - case wxPAT_SIZET: - p->pad_sizet = va_arg(argptr, size_t); - break; - case wxPAT_DOUBLE: - p->pad_double = va_arg(argptr, double); - break; - case wxPAT_LONGDOUBLE: - p->pad_longdouble = va_arg(argptr, long double); - break; - case wxPAT_POINTER: - p->pad_pointer = va_arg(argptr, void *); - break; - - case wxPAT_CHAR: - p->pad_char = (char)va_arg(argptr, int); // char is promoted to int when passed through '...' - break; - case wxPAT_WCHAR: - p->pad_wchar = (wchar_t)va_arg(argptr, int); // char is promoted to int when passed through '...' - break; - - case wxPAT_PCHAR: - case wxPAT_PWCHAR: - p->pad_str = va_arg(argptr, void *); - break; - - case wxPAT_NINT: - p->pad_nint = va_arg(argptr, int *); - break; - case wxPAT_NSHORTINT: - p->pad_nshortint = va_arg(argptr, short int *); - break; - case wxPAT_NLONGINT: - p->pad_nlongint = va_arg(argptr, long int *); - break; - - case wxPAT_STAR: - // this will be handled as part of the next argument - return true; - - case wxPAT_INVALID: - default: - return false; - } - - return true; // loading was successful -} - -template -int wxPrintfConvSpec::Process(CharType *buf, size_t lenMax, wxPrintfArg *p, size_t written) -{ - // buffer to avoid dynamic memory allocation each time for small strings; - // note that this buffer is used only to hold results of number formatting, - // %s directly writes user's string in buf, without using szScratch - char szScratch[wxMAX_SVNPRINTF_SCRATCHBUFFER_LEN]; - size_t lenScratch = 0, lenCur = 0; - -#define APPEND_CH(ch) \ - { \ - if ( lenCur == lenMax ) \ - return -1; \ - \ - buf[lenCur++] = ch; \ - } - - switch ( m_type ) - { - case wxPAT_INT: - lenScratch = system_sprintf(szScratch, wxMAX_SVNPRINTF_SCRATCHBUFFER_LEN, m_szFlags, p->pad_int); - break; - - case wxPAT_LONGINT: - lenScratch = system_sprintf(szScratch, wxMAX_SVNPRINTF_SCRATCHBUFFER_LEN, m_szFlags, p->pad_longint); - break; - -#ifdef wxLongLong_t - case wxPAT_LONGLONGINT: - lenScratch = system_sprintf(szScratch, wxMAX_SVNPRINTF_SCRATCHBUFFER_LEN, m_szFlags, p->pad_longlongint); - break; -#endif // SIZEOF_LONG_LONG - - case wxPAT_SIZET: - lenScratch = system_sprintf(szScratch, wxMAX_SVNPRINTF_SCRATCHBUFFER_LEN, m_szFlags, p->pad_sizet); - break; - - case wxPAT_LONGDOUBLE: - lenScratch = system_sprintf(szScratch, wxMAX_SVNPRINTF_SCRATCHBUFFER_LEN, m_szFlags, p->pad_longdouble); - break; - - case wxPAT_DOUBLE: - lenScratch = system_sprintf(szScratch, wxMAX_SVNPRINTF_SCRATCHBUFFER_LEN, m_szFlags, p->pad_double); - break; - - case wxPAT_POINTER: - lenScratch = system_sprintf(szScratch, wxMAX_SVNPRINTF_SCRATCHBUFFER_LEN, m_szFlags, p->pad_pointer); - break; - - case wxPAT_CHAR: - case wxPAT_WCHAR: - { - wxUniChar ch; - if (m_type == wxPAT_CHAR) - ch = p->pad_char; - else // m_type == wxPAT_WCHAR - ch = p->pad_wchar; - - CharType val = ch; - - size_t i; - - if (!m_bAlignLeft) - for (i = 1; i < (size_t)m_nMinWidth; i++) - APPEND_CH(wxT(' ')); - - APPEND_CH(val); - - if (m_bAlignLeft) - for (i = 1; i < (size_t)m_nMinWidth; i++) - APPEND_CH(wxT(' ')); - } - break; - - case wxPAT_PCHAR: - case wxPAT_PWCHAR: - { - wxString s; - if ( !p->pad_str ) - { - if ( m_nMaxWidth >= 6 ) - s = wxT("(null)"); - } - else if (m_type == wxPAT_PCHAR) - s.assign(static_cast(p->pad_str)); - else // m_type == wxPAT_PWCHAR - s.assign(static_cast(p->pad_str)); - - typename wxPrintfStringHelper::ConvertedType strbuf( - wxPrintfStringHelper::Convert(s)); - - // at this point we are sure that m_nMaxWidth is positive or - // null (see top of wxPrintfConvSpec::LoadArg) - int len = wxMin((unsigned int)m_nMaxWidth, wxStrlen(strbuf)); - - int i; - - if (!m_bAlignLeft) - { - for (i = len; i < m_nMinWidth; i++) - APPEND_CH(wxT(' ')); - } - - len = wxMin((unsigned int)len, lenMax-lenCur); - wxStrncpy(buf+lenCur, strbuf, len); - lenCur += len; - - if (m_bAlignLeft) - { - for (i = len; i < m_nMinWidth; i++) - APPEND_CH(wxT(' ')); - } - } - break; - - case wxPAT_NINT: - *p->pad_nint = written; - break; - - case wxPAT_NSHORTINT: - *p->pad_nshortint = (short int)written; - break; - - case wxPAT_NLONGINT: - *p->pad_nlongint = written; - break; - - case wxPAT_INVALID: - default: - return -1; - } - - // if we used system's sprintf() then we now need to append the s_szScratch - // buffer to the given one... - switch (m_type) - { - case wxPAT_INT: - case wxPAT_LONGINT: -#ifdef wxLongLong_t - case wxPAT_LONGLONGINT: -#endif - case wxPAT_SIZET: - case wxPAT_LONGDOUBLE: - case wxPAT_DOUBLE: - case wxPAT_POINTER: - wxASSERT(lenScratch < wxMAX_SVNPRINTF_SCRATCHBUFFER_LEN); - // NB: 1) we can compare lenMax (for CharType*, i.e. possibly - // wchar_t*) with lenScratch (char*) because this code is - // formatting integers and that will have the same length - // even in UTF-8 (the only case when char* length may be - // more than wchar_t* length of the same string) - // 2) wxStrncpy converts the 2nd argument to 1st argument's - // type transparently if their types differ, so this code - // works for both instantiations - if (lenMax < lenScratch) - { - // fill output buffer and then return -1 - wxStrncpy(buf, szScratch, lenMax); - return -1; - } - wxStrncpy(buf, szScratch, lenScratch); - lenCur += lenScratch; - break; - - default: - break; // all other cases were completed previously - } - - return lenCur; -} - - -// helper that parses format string -template -struct wxPrintfConvSpecParser -{ - typedef wxPrintfConvSpec ConvSpec; - - wxPrintfConvSpecParser(const CharType *fmt) - { - nargs = 0; - posarg_present = - nonposarg_present = false; - - memset(pspec, 0, sizeof(pspec)); - - // parse the format string - for ( const CharType *toparse = fmt; *toparse != wxT('\0'); toparse++ ) - { - // skip everything except format specifications - if ( *toparse != '%' ) - continue; - - // also skip escaped percent signs - if ( toparse[1] == '%' ) - { - toparse++; - continue; - } - - ConvSpec *spec = &specs[nargs]; - spec->Init(); - - // attempt to parse this format specification - if ( !spec->Parse(toparse) ) - continue; - - // advance to the end of this specifier - toparse = spec->m_pArgEnd; - - // special handling for specifications including asterisks: we need - // to reserve an extra slot (or two if asterisks were used for both - // width and precision) in specs array in this case - if ( const char *f = strchr(spec->m_szFlags, '*') ) - { - unsigned numAsterisks = 1; - if ( strchr(++f, '*') ) - numAsterisks++; - - for ( unsigned n = 0; n < numAsterisks; n++ ) - { - if ( nargs++ == wxMAX_SVNPRINTF_ARGUMENTS ) - break; - - // TODO: we need to support specifiers of the form "%2$*1$s" - // (this is the same as "%*s") as if any positional arguments - // are used all asterisks must be positional as well but this - // requires a lot of changes in this code (basically we'd need - // to rewrite Parse() to return "*" and conversion itself as - // separate entries) - if ( posarg_present ) - { - wxFAIL_MSG - ( - wxString::Format - ( - "Format string \"%s\" uses both positional " - "parameters and '*' but this is not currently " - "supported by this implementation, sorry.", - fmt - ) - ); - } - - specs[nargs] = *spec; - - // make an entry for '*' and point to it from pspec - spec->Init(); - spec->m_type = wxPAT_STAR; - pspec[nargs - 1] = spec; - - spec = &specs[nargs]; - } - } - - - // check if this is a positional or normal argument - if ( spec->m_pos > 0 ) - { - // the positional arguments start from number 1 so we need - // to adjust the index - spec->m_pos--; - posarg_present = true; - } - else // not a positional argument... - { - spec->m_pos = nargs; - nonposarg_present = true; - } - - // this conversion specifier is tied to the pos-th argument... - pspec[spec->m_pos] = spec; - - if ( nargs++ == wxMAX_SVNPRINTF_ARGUMENTS ) - break; - } - - - // warn if we lost any arguments (the program probably will crash - // anyhow because of stack corruption...) - if ( nargs == wxMAX_SVNPRINTF_ARGUMENTS ) - { - wxFAIL_MSG - ( - wxString::Format - ( - "wxVsnprintf() currently supports only %d arguments, " - "but format string \"%s\" defines more of them.\n" - "You need to change wxMAX_SVNPRINTF_ARGUMENTS and " - "recompile if more are really needed.", - fmt, wxMAX_SVNPRINTF_ARGUMENTS - ) - ); - } - } - - // total number of valid elements in specs - unsigned nargs; - - // all format specifications in this format string in order of their - // appearance (which may be different from arguments order) - ConvSpec specs[wxMAX_SVNPRINTF_ARGUMENTS]; - - // pointer to specs array element for the N-th argument - ConvSpec *pspec[wxMAX_SVNPRINTF_ARGUMENTS]; - - // true if any positional/non-positional parameters are used - bool posarg_present, - nonposarg_present; -}; - -#undef APPEND_CH -#undef CHECK_PREC - -#endif // _WX_PRIVATE_WXPRINTF_H_ diff --git a/Source/3rd Party/wx/include/wx/prntbase.h b/Source/3rd Party/wx/include/wx/prntbase.h index 4710cd335..4c442a011 100644 --- a/Source/3rd Party/wx/include/wx/prntbase.h +++ b/Source/3rd Party/wx/include/wx/prntbase.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: prntbase.h 62502 2009-10-27 16:39:01Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -22,7 +22,6 @@ #include "wx/scrolwin.h" #include "wx/dialog.h" #include "wx/frame.h" -#include "wx/dc.h" class WXDLLIMPEXP_FWD_CORE wxDC; class WXDLLIMPEXP_FWD_CORE wxButton; @@ -39,9 +38,6 @@ class WXDLLIMPEXP_FWD_CORE wxPreviewControlBar; class WXDLLIMPEXP_FWD_CORE wxPreviewFrame; class WXDLLIMPEXP_FWD_CORE wxPrintFactory; class WXDLLIMPEXP_FWD_CORE wxPrintNativeDataBase; -class WXDLLIMPEXP_FWD_CORE wxPrintPreview; -class wxPrintPageMaxCtrl; -class wxPrintPageTextCtrl; //---------------------------------------------------------------------------- // error consts @@ -54,24 +50,11 @@ enum wxPrinterError wxPRINTER_ERROR }; -// Preview frame modality kind used with wxPreviewFrame::Initialize() -enum wxPreviewFrameModalityKind -{ - // Disable all the other top level windows while the preview is shown. - wxPreviewFrame_AppModal, - - // Disable only the parent window while the preview is shown. - wxPreviewFrame_WindowModal, - - // Don't disable any windows. - wxPreviewFrame_NonModal -}; - //---------------------------------------------------------------------------- // wxPrintFactory //---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxPrintFactory +class WXDLLEXPORT wxPrintFactory { public: wxPrintFactory() {} @@ -94,7 +77,7 @@ public: virtual wxPageSetupDialogBase *CreatePageSetupDialog( wxWindow *parent, wxPageSetupDialogData * data = NULL ) = 0; - virtual wxDCImpl* CreatePrinterDCImpl( wxPrinterDC *owner, const wxPrintData& data ) = 0; + virtual wxDC* CreatePrinterDC( const wxPrintData& data ) = 0; // What to do and what to show in the wxPrintDialog // a) Use the generic print setup dialog or a native one? @@ -118,7 +101,7 @@ private: static wxPrintFactory *m_factory; }; -class WXDLLIMPEXP_CORE wxNativePrintFactory: public wxPrintFactory +class WXDLLEXPORT wxNativePrintFactory: public wxPrintFactory { public: virtual wxPrinterBase *CreatePrinter( wxPrintDialogData *data ); @@ -138,7 +121,7 @@ public: virtual wxPageSetupDialogBase *CreatePageSetupDialog( wxWindow *parent, wxPageSetupDialogData * data = NULL ); - virtual wxDCImpl* CreatePrinterDCImpl( wxPrinterDC *owner, const wxPrintData& data ); + virtual wxDC* CreatePrinterDC( const wxPrintData& data ); virtual bool HasPrintSetupDialog(); virtual wxDialog *CreatePrintSetupDialog( wxWindow *parent, wxPrintData *data ); @@ -155,7 +138,7 @@ public: // wxPrintNativeDataBase //---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxPrintNativeDataBase: public wxObject +class WXDLLEXPORT wxPrintNativeDataBase: public wxObject { public: wxPrintNativeDataBase(); @@ -171,7 +154,7 @@ public: private: DECLARE_CLASS(wxPrintNativeDataBase) - wxDECLARE_NO_COPY_CLASS(wxPrintNativeDataBase); + DECLARE_NO_COPY_CLASS(wxPrintNativeDataBase) }; //---------------------------------------------------------------------------- @@ -182,10 +165,10 @@ private: * Represents the printer: manages printing a wxPrintout object */ -class WXDLLIMPEXP_CORE wxPrinterBase: public wxObject +class WXDLLEXPORT wxPrinterBase: public wxObject { public: - wxPrinterBase(wxPrintDialogData *data = NULL); + wxPrinterBase(wxPrintDialogData *data = (wxPrintDialogData *) NULL); virtual ~wxPrinterBase(); virtual wxWindow *CreateAbortWindow(wxWindow *parent, wxPrintout *printout); @@ -215,17 +198,17 @@ public: private: DECLARE_CLASS(wxPrinterBase) - wxDECLARE_NO_COPY_CLASS(wxPrinterBase); + DECLARE_NO_COPY_CLASS(wxPrinterBase) }; //---------------------------------------------------------------------------- // wxPrinter //---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxPrinter: public wxPrinterBase +class WXDLLEXPORT wxPrinter: public wxPrinterBase { public: - wxPrinter(wxPrintDialogData *data = NULL); + wxPrinter(wxPrintDialogData *data = (wxPrintDialogData *) NULL); virtual ~wxPrinter(); virtual wxWindow *CreateAbortWindow(wxWindow *parent, wxPrintout *printout); @@ -242,7 +225,7 @@ protected: private: DECLARE_CLASS(wxPrinter) - wxDECLARE_NO_COPY_CLASS(wxPrinter); + DECLARE_NO_COPY_CLASS(wxPrinter) }; //---------------------------------------------------------------------------- @@ -256,10 +239,10 @@ private: * object for previewing. */ -class WXDLLIMPEXP_CORE wxPrintout: public wxObject +class WXDLLEXPORT wxPrintout: public wxObject { public: - wxPrintout(const wxString& title = _("Printout")); + wxPrintout(const wxString& title = wxT("Printout")); virtual ~wxPrintout(); virtual bool OnBeginDocument(int startPage, int endPage); @@ -300,26 +283,20 @@ public: void GetPageSizeMM(int *w, int *h) const { *w = m_pageWidthMM; *h = m_pageHeightMM; } void SetPPIScreen(int x, int y) { m_PPIScreenX = x; m_PPIScreenY = y; } - void SetPPIScreen(const wxSize& ppi) { SetPPIScreen(ppi.x, ppi.y); } void GetPPIScreen(int *x, int *y) const { *x = m_PPIScreenX; *y = m_PPIScreenY; } void SetPPIPrinter(int x, int y) { m_PPIPrinterX = x; m_PPIPrinterY = y; } - void SetPPIPrinter(const wxSize& ppi) { SetPPIPrinter(ppi.x, ppi.y); } void GetPPIPrinter(int *x, int *y) const { *x = m_PPIPrinterX; *y = m_PPIPrinterY; } void SetPaperRectPixels(const wxRect& paperRectPixels) { m_paperRectPixels = paperRectPixels; } wxRect GetPaperRectPixels() const { return m_paperRectPixels; } - // This must be called by wxPrintPreview to associate itself with the - // printout it uses. - virtual void SetPreview(wxPrintPreview *preview) { m_preview = preview; } + virtual bool IsPreview() const { return m_isPreview; } - wxPrintPreview *GetPreview() const { return m_preview; } - virtual bool IsPreview() const { return GetPreview() != NULL; } + virtual void SetIsPreview(bool p) { m_isPreview = p; } private: wxString m_printoutTitle; wxDC* m_printoutDC; - wxPrintPreview *m_preview; int m_pageWidthPixels; int m_pageHeightPixels; @@ -334,9 +311,11 @@ private: wxRect m_paperRectPixels; + bool m_isPreview; + private: DECLARE_ABSTRACT_CLASS(wxPrintout) - wxDECLARE_NO_COPY_CLASS(wxPrintout); + DECLARE_NO_COPY_CLASS(wxPrintout) }; //---------------------------------------------------------------------------- @@ -347,7 +326,7 @@ private: * Canvas upon which a preview is drawn. */ -class WXDLLIMPEXP_CORE wxPreviewCanvas: public wxScrolledWindow +class WXDLLEXPORT wxPreviewCanvas: public wxScrolledWindow { public: wxPreviewCanvas(wxPrintPreviewBase *preview, @@ -358,8 +337,6 @@ public: const wxString& name = wxT("canvas")); virtual ~wxPreviewCanvas(); - void SetPreview(wxPrintPreviewBase *preview) { m_printPreview = preview; } - void OnPaint(wxPaintEvent& event); void OnChar(wxKeyEvent &event); // Responds to colour changes @@ -369,13 +346,12 @@ private: #if wxUSE_MOUSEWHEEL void OnMouseWheel(wxMouseEvent& event); #endif // wxUSE_MOUSEWHEEL - void OnIdle(wxIdleEvent& event); wxPrintPreviewBase* m_printPreview; DECLARE_CLASS(wxPreviewCanvas) DECLARE_EVENT_TABLE() - wxDECLARE_NO_COPY_CLASS(wxPreviewCanvas); + DECLARE_NO_COPY_CLASS(wxPreviewCanvas) }; //---------------------------------------------------------------------------- @@ -386,38 +362,20 @@ private: * Default frame for showing preview. */ -class WXDLLIMPEXP_CORE wxPreviewFrame: public wxFrame +class WXDLLEXPORT wxPreviewFrame: public wxFrame { public: wxPreviewFrame(wxPrintPreviewBase *preview, wxWindow *parent, - const wxString& title = _("Print Preview"), + const wxString& title = wxT("Print Preview"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE | wxFRAME_FLOAT_ON_PARENT, const wxString& name = wxFrameNameStr); virtual ~wxPreviewFrame(); - // Either Initialize() or InitializeWithModality() must be called before - // showing the preview frame, the former being just a particular case of - // the latter initializing the frame for being showing app-modally. - - // Notice that we must keep Initialize() with its existing signature to - // avoid breaking the old code that overrides it and we can't reuse the - // same name for the other functions to avoid virtual function hiding - // problem and the associated warnings given by some compilers (e.g. from - // g++ with -Woverloaded-virtual). - virtual void Initialize() - { - InitializeWithModality(wxPreviewFrame_AppModal); - } - - // Also note that this method is not virtual as it doesn't need to be - // overridden: it's never called by wxWidgets (of course, the same is true - // for Initialize() but, again, it must remain virtual for compatibility). - void InitializeWithModality(wxPreviewFrameModalityKind kind); - void OnCloseWindow(wxCloseEvent& event); + virtual void Initialize(); virtual void CreateCanvas(); virtual void CreateControlBar(); @@ -429,15 +387,10 @@ protected: wxPrintPreviewBase* m_printPreview; wxWindowDisabler* m_windowDisabler; - wxPreviewFrameModalityKind m_modalityKind; - - private: - void OnChar(wxKeyEvent& event); - - DECLARE_EVENT_TABLE() DECLARE_CLASS(wxPreviewFrame) - wxDECLARE_NO_COPY_CLASS(wxPreviewFrame); + DECLARE_EVENT_TABLE() + DECLARE_NO_COPY_CLASS(wxPreviewFrame) }; //---------------------------------------------------------------------------- @@ -470,10 +423,8 @@ private: #define wxID_PREVIEW_FIRST 6 #define wxID_PREVIEW_LAST 7 #define wxID_PREVIEW_GOTO 8 -#define wxID_PREVIEW_ZOOM_IN 9 -#define wxID_PREVIEW_ZOOM_OUT 10 -class WXDLLIMPEXP_CORE wxPreviewControlBar: public wxPanel +class WXDLLEXPORT wxPreviewControlBar: public wxPanel { DECLARE_CLASS(wxPreviewControlBar) @@ -488,73 +439,42 @@ public: virtual ~wxPreviewControlBar(); virtual void CreateButtons(); - virtual void SetPageInfo(int minPage, int maxPage); virtual void SetZoomControl(int zoom); virtual int GetZoomControl(); virtual wxPrintPreviewBase *GetPrintPreview() const { return m_printPreview; } - - // Implementation only from now on. void OnWindowClose(wxCommandEvent& event); void OnNext(); void OnPrevious(); void OnFirst(); void OnLast(); - void OnGotoPage(); + void OnGoto(); void OnPrint(); - void OnPrintButton(wxCommandEvent& WXUNUSED(event)) { OnPrint(); } void OnNextButton(wxCommandEvent & WXUNUSED(event)) { OnNext(); } void OnPreviousButton(wxCommandEvent & WXUNUSED(event)) { OnPrevious(); } void OnFirstButton(wxCommandEvent & WXUNUSED(event)) { OnFirst(); } void OnLastButton(wxCommandEvent & WXUNUSED(event)) { OnLast(); } + void OnGotoButton(wxCommandEvent & WXUNUSED(event)) { OnGoto(); } + void OnZoom(wxCommandEvent& event); void OnPaint(wxPaintEvent& event); - void OnUpdateNextButton(wxUpdateUIEvent& event) - { event.Enable(IsNextEnabled()); } - void OnUpdatePreviousButton(wxUpdateUIEvent& event) - { event.Enable(IsPreviousEnabled()); } - void OnUpdateFirstButton(wxUpdateUIEvent& event) - { event.Enable(IsFirstEnabled()); } - void OnUpdateLastButton(wxUpdateUIEvent& event) - { event.Enable(IsLastEnabled()); } - void OnUpdateZoomInButton(wxUpdateUIEvent& event) - { event.Enable(IsZoomInEnabled()); } - void OnUpdateZoomOutButton(wxUpdateUIEvent& event) - { event.Enable(IsZoomOutEnabled()); } - - // These methods are not private because they are called by wxPreviewCanvas. - void DoZoomIn(); - void DoZoomOut(); - protected: wxPrintPreviewBase* m_printPreview; wxButton* m_closeButton; + wxButton* m_nextPageButton; + wxButton* m_previousPageButton; + wxButton* m_printButton; wxChoice* m_zoomControl; - wxPrintPageTextCtrl* m_currentPageText; - wxPrintPageMaxCtrl* m_maxPageText; - + wxButton* m_firstPageButton; + wxButton* m_lastPageButton; + wxButton* m_gotoPageButton; long m_buttonFlags; private: - void DoGotoPage(int page); - - void DoZoom(); - - bool IsNextEnabled() const; - bool IsPreviousEnabled() const; - bool IsFirstEnabled() const; - bool IsLastEnabled() const; - bool IsZoomInEnabled() const; - bool IsZoomOutEnabled() const; - - void OnZoomInButton(wxCommandEvent & WXUNUSED(event)) { DoZoomIn(); } - void OnZoomOutButton(wxCommandEvent & WXUNUSED(event)) { DoZoomOut(); } - void OnZoomChoice(wxCommandEvent& WXUNUSED(event)) { DoZoom(); } - DECLARE_EVENT_TABLE() - wxDECLARE_NO_COPY_CLASS(wxPreviewControlBar); + DECLARE_NO_COPY_CLASS(wxPreviewControlBar) }; //---------------------------------------------------------------------------- @@ -565,12 +485,12 @@ private: * Programmer creates an object of this class to preview a wxPrintout. */ -class WXDLLIMPEXP_CORE wxPrintPreviewBase: public wxObject +class WXDLLEXPORT wxPrintPreviewBase: public wxObject { public: wxPrintPreviewBase(wxPrintout *printout, - wxPrintout *printoutForPrinting = NULL, - wxPrintDialogData *data = NULL); + wxPrintout *printoutForPrinting = (wxPrintout *) NULL, + wxPrintDialogData *data = (wxPrintDialogData *) NULL); wxPrintPreviewBase(wxPrintout *printout, wxPrintout *printoutForPrinting, wxPrintData *data); @@ -596,10 +516,6 @@ public: // The preview canvas should call this from OnPaint virtual bool PaintPage(wxPreviewCanvas *canvas, wxDC& dc); - // Updates rendered page by calling RenderPage() if needed, returns true - // if there was some change. Preview canvas should call it at idle time - virtual bool UpdatePageRendering(); - // This draws a blank page onto the preview canvas virtual bool DrawBlankPage(wxPreviewCanvas *canvas, wxDC& dc); @@ -635,20 +551,11 @@ public: // the currently selected printer. virtual void DetermineScaling() = 0; -protected: - // helpers for RenderPage(): - virtual bool RenderPageIntoDC(wxDC& dc, int pageNum); - // renders preview into m_previewBitmap - virtual bool RenderPageIntoBitmap(wxBitmap& bmp, int pageNum); - - void InvalidatePreviewBitmap(); - protected: wxPrintDialogData m_printDialogData; wxPreviewCanvas* m_previewCanvas; wxFrame* m_previewFrame; wxBitmap* m_previewBitmap; - bool m_previewFailed; wxPrintout* m_previewPrintout; wxPrintout* m_printPrintout; int m_currentPage; @@ -668,7 +575,11 @@ protected: private: void Init(wxPrintout *printout, wxPrintout *printoutForPrinting); - wxDECLARE_NO_COPY_CLASS(wxPrintPreviewBase); + // helpers for RenderPage(): + bool RenderPageIntoDC(wxDC& dc, int pageNum); + bool RenderPageIntoBitmap(wxBitmap& bmp, int pageNum); + + DECLARE_NO_COPY_CLASS(wxPrintPreviewBase) DECLARE_CLASS(wxPrintPreviewBase) }; @@ -676,12 +587,12 @@ private: // wxPrintPreview //---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxPrintPreview: public wxPrintPreviewBase +class WXDLLEXPORT wxPrintPreview: public wxPrintPreviewBase { public: wxPrintPreview(wxPrintout *printout, - wxPrintout *printoutForPrinting = NULL, - wxPrintDialogData *data = NULL); + wxPrintout *printoutForPrinting = (wxPrintout *) NULL, + wxPrintDialogData *data = (wxPrintDialogData *) NULL); wxPrintPreview(wxPrintout *printout, wxPrintout *printoutForPrinting, wxPrintData *data); @@ -698,7 +609,6 @@ public: virtual wxFrame *GetFrame() const; virtual wxPreviewCanvas *GetCanvas() const; virtual bool PaintPage(wxPreviewCanvas *canvas, wxDC& dc); - virtual bool UpdatePageRendering(); virtual bool DrawBlankPage(wxPreviewCanvas *canvas, wxDC& dc); virtual void AdjustScrollbars(wxPreviewCanvas *canvas); virtual bool RenderPage(int pageNum); @@ -722,14 +632,14 @@ private: private: DECLARE_CLASS(wxPrintPreview) - wxDECLARE_NO_COPY_CLASS(wxPrintPreview); + DECLARE_NO_COPY_CLASS(wxPrintPreview) }; //---------------------------------------------------------------------------- // wxPrintAbortDialog //---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxPrintAbortDialog: public wxDialog +class WXDLLEXPORT wxPrintAbortDialog: public wxDialog { public: wxPrintAbortDialog(wxWindow *parent, @@ -746,7 +656,7 @@ public: private: DECLARE_EVENT_TABLE() - wxDECLARE_NO_COPY_CLASS(wxPrintAbortDialog); + DECLARE_NO_COPY_CLASS(wxPrintAbortDialog) }; #endif // wxUSE_PRINTING_ARCHITECTURE diff --git a/Source/3rd Party/wx/include/wx/process.h b/Source/3rd Party/wx/include/wx/process.h index 981b7b5a5..2c2f6185e 100644 --- a/Source/3rd Party/wx/include/wx/process.h +++ b/Source/3rd Party/wx/include/wx/process.h @@ -4,7 +4,7 @@ // Author: Guilhem Lavaux // Modified by: Vadim Zeitlin to check error codes, added Detach() method // Created: 24/06/98 -// RCS-ID: $Id$ +// RCS-ID: $Id: process.h 42713 2006-10-30 11:56:12Z ABX $ // Copyright: (c) 1998 Guilhem Lavaux // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -55,7 +55,7 @@ public: // ctors - wxProcess(wxEvtHandler *parent = NULL, int nId = wxID_ANY) + wxProcess(wxEvtHandler *parent = (wxEvtHandler *) NULL, int nId = wxID_ANY) { Init(parent, nId, wxPROCESS_DEFAULT); } wxProcess(int flags) { Init(NULL, wxID_ANY, flags); } @@ -104,14 +104,9 @@ public: wxInputStream *errStream); #endif // wxUSE_STREAMS - // implementation only - don't use! - // -------------------------------- - - // needs to be public since it needs to be used from wxExecute() global func - void SetPid(long pid) { m_pid = pid; } - protected: void Init(wxEvtHandler *parent, int id, int flags); + void SetPid(long pid) { m_pid = pid; } int m_id; long m_pid; @@ -128,16 +123,16 @@ protected: bool m_redirect; DECLARE_DYNAMIC_CLASS(wxProcess) - wxDECLARE_NO_COPY_CLASS(wxProcess); + DECLARE_NO_COPY_CLASS(wxProcess) }; // ---------------------------------------------------------------------------- // wxProcess events // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_FWD_BASE wxProcessEvent; - -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_BASE, wxEVT_END_PROCESS, wxProcessEvent ); +BEGIN_DECLARE_EVENT_TYPES() + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_BASE, wxEVT_END_PROCESS, 440) +END_DECLARE_EVENT_TYPES() class WXDLLIMPEXP_BASE wxProcessEvent : public wxEvent { @@ -169,7 +164,7 @@ public: typedef void (wxEvtHandler::*wxProcessEventFunction)(wxProcessEvent&); #define wxProcessEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxProcessEventFunction, func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxProcessEventFunction, &func) #define EVT_END_PROCESS(id, func) \ wx__DECLARE_EVT1(wxEVT_END_PROCESS, id, wxProcessEventHandler(func)) diff --git a/Source/3rd Party/wx/include/wx/progdlg.h b/Source/3rd Party/wx/include/wx/progdlg.h index 0e74800c0..196192bce 100644 --- a/Source/3rd Party/wx/include/wx/progdlg.h +++ b/Source/3rd Party/wx/include/wx/progdlg.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: -// RCS-ID: $Id$ +// RCS-ID: $Id: progdlg.h 41089 2006-09-09 13:36:54Z RR $ // Copyright: (c) Julian Smart // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// @@ -14,8 +14,6 @@ #include "wx/defs.h" -#if wxUSE_PROGRESSDLG - /* * wxProgressDialog flags */ @@ -29,28 +27,10 @@ #define wxPD_CAN_SKIP 0x0080 -#include "wx/generic/progdlgg.h" - -#if defined(__WXMSW__) && wxUSE_THREADS && !defined(__WXUNIVERSAL__) - #include "wx/msw/progdlg.h" +#ifdef __WXPALMOS__ + #include "wx/palmos/progdlg.h" #else - class WXDLLIMPEXP_CORE wxProgressDialog - : public wxGenericProgressDialog - { - public: - wxProgressDialog( const wxString& title, const wxString& message, - int maximum = 100, - wxWindow *parent = NULL, - int style = wxPD_APP_MODAL | wxPD_AUTO_HIDE ) - : wxGenericProgressDialog( title, message, maximum, - parent, style ) - { } - - private: - wxDECLARE_DYNAMIC_CLASS_NO_COPY( wxProgressDialog ); - }; -#endif // defined(__WXMSW__) && wxUSE_THREADS - -#endif // wxUSE_PROGRESSDLG + #include "wx/generic/progdlgg.h" +#endif #endif // _WX_PROGDLG_H_BASE_ diff --git a/Source/3rd Party/wx/include/wx/ptr_scpd.h b/Source/3rd Party/wx/include/wx/ptr_scpd.h index 2ed0e6023..19c6588b7 100644 --- a/Source/3rd Party/wx/include/wx/ptr_scpd.h +++ b/Source/3rd Party/wx/include/wx/ptr_scpd.h @@ -1,14 +1,222 @@ -/////////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////// // Name: wx/ptr_scpd.h -// Purpose: compatibility wrapper for wxScoped{Ptr,Array} -// Author: Vadim Zeitlin -// Created: 2009-02-03 -// RCS-ID: $Id$ -// Copyright: (c) 2009 Vadim Zeitlin +// Purpose: scoped smart pointer class +// Author: Jesse Lovelace +// Modified by: +// Created: 06/01/02 +// RCS-ID: $Id: ptr_scpd.h 35688 2005-09-25 19:59:19Z VZ $ +// Copyright: (c) Jesse Lovelace and original Boost authors (see below) // Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////// + +// This class closely follows the implementation of the boost +// library scoped_ptr and is an adaption for c++ macro's in +// the wxWidgets project. The original authors of the boost +// scoped_ptr are given below with their respective copyrights. + +// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. +// Copyright (c) 2001, 2002 Peter Dimov +// +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. +// This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. +// +// See http://www.boost.org/libs/smart_ptr/scoped_ptr.htm for documentation. +// + +#ifndef __WX_SCOPED_POINTER__ +#define __WX_SCOPED_POINTER__ + +#include "wx/defs.h" + +/* + checked deleters are used to make sure that the type being deleted is really + a complete type.: otherwise sizeof() would result in a compile-time error + + do { ... } while ( 0 ) construct is used to have an anonymous scope + (otherwise we could have name clashes between different "complete"s) but + still force a semicolon after the macro +*/ + +#ifdef __WATCOMC__ + #define wxFOR_ONCE(name) for(int name=0; name<1; name++) + #define wxPRE_NO_WARNING_SCOPE(name) wxFOR_ONCE(wxMAKE_UNIQUE_NAME(name)) + #define wxPOST_NO_WARNING_SCOPE(name) +#else + #define wxPRE_NO_WARNING_SCOPE(name) do + #define wxPOST_NO_WARNING_SCOPE(name) while ( wxFalse ) +#endif + +#define wxCHECKED_DELETE(ptr) \ + wxPRE_NO_WARNING_SCOPE(scope_var1) \ + { \ + typedef char complete[sizeof(*ptr)]; \ + delete ptr; \ + } wxPOST_NO_WARNING_SCOPE(scope_var1) + +#define wxCHECKED_DELETE_ARRAY(ptr) \ + wxPRE_NO_WARNING_SCOPE(scope_var2) \ + { \ + typedef char complete[sizeof(*ptr)]; \ + delete [] ptr; \ + } wxPOST_NO_WARNING_SCOPE(scope_var2) + +/* These scoped pointers are *not* assignable and cannot be used + within a container. Look for wxDECLARE_SHARED_PTR for this + functionality. + + In addition, the type being used *must* be complete at the time + that wxDEFINE_SCOPED_* is called or a compiler error will result. + This is because the class checks for the completeness of the type + being used. +*/ + + +#define wxDECLARE_SCOPED_PTR(T, name) \ +class name \ +{ \ +private: \ + T * m_ptr; \ + \ + name(name const &); \ + name & operator=(name const &); \ + \ +public: \ + wxEXPLICIT name(T * ptr = NULL) \ + : m_ptr(ptr) { } \ + \ + ~name(); \ + \ + void reset(T * ptr = NULL) \ + { \ + if (m_ptr != ptr) \ + { \ + delete m_ptr; \ + m_ptr = ptr; \ + } \ + } \ + \ + T *release() \ + { \ + T *ptr = m_ptr; \ + m_ptr = NULL; \ + return ptr; \ + } \ + \ + T & operator*() const \ + { \ + wxASSERT(m_ptr != NULL); \ + return *m_ptr; \ + } \ + \ + T * operator->() const \ + { \ + wxASSERT(m_ptr != NULL); \ + return m_ptr; \ + } \ + \ + T * get() const \ + { \ + return m_ptr; \ + } \ + \ + void swap(name & ot) \ + { \ + T * tmp = ot.m_ptr; \ + ot.m_ptr = m_ptr; \ + m_ptr = tmp; \ + } \ +}; + +#define wxDEFINE_SCOPED_PTR(T, name)\ +name::~name() \ +{ \ + wxCHECKED_DELETE(m_ptr); \ +} + +// this macro can be used for the most common case when you want to declare and +// define the scoped pointer at the same time and want to use the standard +// naming convention: auto pointer to Foo is called FooPtr +#define wxDEFINE_SCOPED_PTR_TYPE(T) \ + wxDECLARE_SCOPED_PTR(T, T ## Ptr) \ + wxDEFINE_SCOPED_PTR(T, T ## Ptr) + +// the same but for arrays instead of simple pointers +#define wxDECLARE_SCOPED_ARRAY(T, name)\ +class name \ +{ \ +private: \ + T * m_ptr; \ + name(name const &); \ + name & operator=(name const &); \ + \ +public: \ + wxEXPLICIT name(T * p = NULL) : m_ptr(p) \ + {} \ + \ + ~name(); \ + void reset(T * p = NULL); \ + \ + T & operator[](long int i) const\ + { \ + wxASSERT(m_ptr != NULL); \ + wxASSERT(i >= 0); \ + return m_ptr[i]; \ + } \ + \ + T * get() const \ + { \ + return m_ptr; \ + } \ + \ + void swap(name & ot) \ + { \ + T * tmp = ot.m_ptr; \ + ot.m_ptr = m_ptr; \ + m_ptr = tmp; \ + } \ +}; + +#define wxDEFINE_SCOPED_ARRAY(T, name) \ +name::~name() \ +{ \ + wxCHECKED_DELETE_ARRAY(m_ptr); \ +} \ +void name::reset(T * p){ \ + if (m_ptr != p) \ + { \ + wxCHECKED_DELETE_ARRAY(m_ptr); \ + m_ptr = p; \ + } \ +} + +// ---------------------------------------------------------------------------- +// "Tied" scoped pointer: same as normal one but also sets the value of +// some other variable to the pointer value +// ---------------------------------------------------------------------------- + +#define wxDEFINE_TIED_SCOPED_PTR_TYPE(T) \ + wxDEFINE_SCOPED_PTR_TYPE(T) \ + class T ## TiedPtr : public T ## Ptr \ + { \ + public: \ + T ## TiedPtr(T **pp, T *p) \ + : T ## Ptr(p), m_pp(pp) \ + { \ + m_pOld = *pp; \ + *pp = p; \ + } \ + \ + ~ T ## TiedPtr() \ + { \ + *m_pp = m_pOld; \ + } \ + \ + private: \ + T **m_pp; \ + T *m_pOld; \ + }; + +#endif // __WX_SCOPED_POINTER__ -// do not include this file in any new code, include either wx/scopedptr.h or -// wx/scopedarray.h (or both) instead -#include "wx/scopedarray.h" -#include "wx/scopedptr.h" diff --git a/Source/3rd Party/wx/include/wx/quantize.h b/Source/3rd Party/wx/include/wx/quantize.h index ac8a71b10..dd43f7a05 100644 --- a/Source/3rd Party/wx/include/wx/quantize.h +++ b/Source/3rd Party/wx/include/wx/quantize.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 22/6/2000 -// RCS-ID: $Id$ +// RCS-ID: $Id: quantize.h 49804 2007-11-10 01:09:42Z VZ $ // Copyright: (c) Julian Smart // Licence: ///////////////////////////////////////////////////////////////////////////// @@ -34,7 +34,7 @@ class WXDLLIMPEXP_FWD_CORE wxPalette; #define wxQUANTIZE_RETURN_8BIT_DATA 0x02 #define wxQUANTIZE_FILL_DESTINATION_IMAGE 0x04 -class WXDLLIMPEXP_CORE wxQuantize: public wxObject +class WXDLLEXPORT wxQuantize: public wxObject { public: DECLARE_DYNAMIC_CLASS(wxQuantize) diff --git a/Source/3rd Party/wx/include/wx/radiobox.h b/Source/3rd Party/wx/include/wx/radiobox.h index d31e28ad5..e54aa7e71 100644 --- a/Source/3rd Party/wx/include/wx/radiobox.h +++ b/Source/3rd Party/wx/include/wx/radiobox.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 10.09.00 -// RCS-ID: $Id$ +// RCS-ID: $Id: radiobox.h 54930 2008-08-02 19:45:23Z VZ $ // Copyright: (c) Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -12,8 +12,6 @@ #ifndef _WX_RADIOBOX_H_BASE_ #define _WX_RADIOBOX_H_BASE_ -#include "wx/defs.h" - #if wxUSE_RADIOBOX #include "wx/ctrlsub.h" @@ -28,7 +26,7 @@ WX_DEFINE_EXPORTED_ARRAY_PTR(wxToolTip *, wxToolTipArray); #endif // wxUSE_TOOLTIPS -extern WXDLLIMPEXP_DATA_CORE(const char) wxRadioBoxNameStr[]; +extern WXDLLEXPORT_DATA(const wxChar) wxRadioBoxNameStr[]; // ---------------------------------------------------------------------------- // wxRadioBoxBase is not a normal base class, but rather a mix-in because the @@ -36,7 +34,7 @@ extern WXDLLIMPEXP_DATA_CORE(const char) wxRadioBoxNameStr[]; // example, it is a wxStaticBox in wxUniv and wxMSW but not in other ports // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxRadioBoxBase : public wxItemContainerImmutable +class WXDLLEXPORT wxRadioBoxBase : public wxItemContainerImmutable { public: virtual ~wxRadioBoxBase(); @@ -87,6 +85,14 @@ public: } + // deprecated functions + // -------------------- + +#if WXWIN_COMPATIBILITY_2_4 + wxDEPRECATED( int GetNumberOfRowsOrCols() const ); + wxDEPRECATED( void SetNumberOfRowsOrCols(int n) ); +#endif // WXWIN_COMPATIBILITY_2_4 + protected: wxRadioBoxBase() { @@ -99,8 +105,6 @@ protected: #endif // wxUSE_TOOLTIPS } - virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } - // return the number of items in major direction (which depends on whether // we have wxRA_SPECIFY_COLS or wxRA_SPECIFY_ROWS style) unsigned int GetMajorDim() const { return m_majorDim; } @@ -163,11 +167,13 @@ private: #elif defined(__WXGTK__) #include "wx/gtk1/radiobox.h" #elif defined(__WXMAC__) - #include "wx/osx/radiobox.h" + #include "wx/mac/radiobox.h" #elif defined(__WXCOCOA__) #include "wx/cocoa/radiobox.h" #elif defined(__WXPM__) #include "wx/os2/radiobox.h" +#elif defined(__WXPALMOS__) + #include "wx/palmos/radiobox.h" #endif #endif // wxUSE_RADIOBOX diff --git a/Source/3rd Party/wx/include/wx/radiobut.h b/Source/3rd Party/wx/include/wx/radiobut.h index 9963507ce..2543ea8dc 100644 --- a/Source/3rd Party/wx/include/wx/radiobut.h +++ b/Source/3rd Party/wx/include/wx/radiobut.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 07.09.00 -// RCS-ID: $Id$ +// RCS-ID: $Id: radiobut.h 37066 2006-01-23 03:27:34Z MR $ // Copyright: (c) Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -33,7 +33,7 @@ #include "wx/control.h" -extern WXDLLIMPEXP_DATA_CORE(const char) wxRadioButtonNameStr[]; +extern WXDLLEXPORT_DATA(const wxChar) wxRadioButtonNameStr[]; #if defined(__WXUNIVERSAL__) #include "wx/univ/radiobut.h" @@ -46,11 +46,13 @@ extern WXDLLIMPEXP_DATA_CORE(const char) wxRadioButtonNameStr[]; #elif defined(__WXGTK__) #include "wx/gtk1/radiobut.h" #elif defined(__WXMAC__) - #include "wx/osx/radiobut.h" + #include "wx/mac/radiobut.h" #elif defined(__WXCOCOA__) #include "wx/cocoa/radiobut.h" #elif defined(__WXPM__) #include "wx/os2/radiobut.h" +#elif defined(__WXPALMOS__) + #include "wx/palmos/radiobut.h" #endif #endif // wxUSE_RADIOBTN diff --git a/Source/3rd Party/wx/include/wx/range.h b/Source/3rd Party/wx/include/wx/range.h deleted file mode 100644 index 563098e6f..000000000 --- a/Source/3rd Party/wx/include/wx/range.h +++ /dev/null @@ -1,29 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/range.h -// Purpose: Range Value Class -// Author: Stefan Csomor -// Modified by: -// Created: 2011-01-07 -// RCS-ID: $Id$ -// Copyright: (c) 2011 Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_RANGE_H_ -#define _WX_RANGE_H_ - -#include "wx/defs.h" - -class wxRange -{ -public : - wxRange(): m_minVal(0), m_maxVal(0) {} - wxRange( int minVal, int maxVal) : m_minVal(minVal), m_maxVal(maxVal) {} - int GetMin() const { return m_minVal; } - int GetMax() const { return m_maxVal; } -private : - int m_minVal; - int m_maxVal; -}; - -#endif // _WX_RANGE_H_ diff --git a/Source/3rd Party/wx/include/wx/rawbmp.h b/Source/3rd Party/wx/include/wx/rawbmp.h index 5548dd6a1..c46028526 100644 --- a/Source/3rd Party/wx/include/wx/rawbmp.h +++ b/Source/3rd Party/wx/include/wx/rawbmp.h @@ -4,20 +4,15 @@ // Author: Eric Kidd, Vadim Zeitlin // Modified by: // Created: 10.03.03 -// RCS-ID: $Id$ +// RCS-ID: $Id: rawbmp.h 41661 2006-10-06 16:34:45Z PC $ // Copyright: (c) 2002 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// -#ifndef _WX_RAWBMP_H_ -#define _WX_RAWBMP_H_ - -#include "wx/defs.h" - -#ifdef wxHAS_RAW_BITMAP +#ifndef _WX_RAWBMP_H_BASE_ +#define _WX_RAWBMP_H_BASE_ #include "wx/image.h" -#include "wx/bitmap.h" // ---------------------------------------------------------------------------- // Abstract Pixel API @@ -77,7 +72,7 @@ */ /* - Note: we do not use WXDLLIMPEXP_CORE with classes in this file because VC++ has + Note: we do not use WXDLLEXPORT with classes in this file because VC++ has problems with exporting inner class defined inside a specialization of a template class from a DLL. Besides, as all the methods are inline it's not really necessary to put them in DLL at all. @@ -172,16 +167,6 @@ typedef wxPixelFormat wxImagePixelFormat; // Under GTK+ 2.X we use GdkPixbuf, which is standard RGB or RGBA typedef wxPixelFormat wxNativePixelFormat; - #define wxPIXEL_FORMAT_ALPHA 3 -#elif defined(__WXPM__) - // Under PM, we can use standard RGB or RGBA - typedef wxPixelFormat wxNativePixelFormat; - - #define wxPIXEL_FORMAT_ALPHA 3 -#elif defined(__WXDFB__) - // Under DirectFB, RGB components are reversed, they're in BGR order - typedef wxPixelFormat wxNativePixelFormat; - #define wxPIXEL_FORMAT_ALPHA 3 #endif @@ -318,6 +303,9 @@ struct wxPixelDataOut // the pixel format we use typedef wxImagePixelFormat PixelFormat; + // the type of the pixel components + typedef typename dummyPixelFormat::ChannelType ChannelType; + // the pixel data we're working with typedef wxPixelDataOut::wxPixelDataIn PixelData; @@ -412,19 +400,11 @@ struct wxPixelDataOut // data access // ----------- - // access to individual colour components - PixelFormat::ChannelType& Red() { return m_pRGB[PixelFormat::RED]; } - PixelFormat::ChannelType& Green() { return m_pRGB[PixelFormat::GREEN]; } - PixelFormat::ChannelType& Blue() { return m_pRGB[PixelFormat::BLUE]; } - PixelFormat::ChannelType& Alpha() { return *m_pAlpha; } - - // address the pixel contents directly (always RGB, without alpha) - // - // this can't be used to modify the image as assigning a 32bpp - // value to 24bpp pixel would overwrite an extra byte in the next - // pixel or beyond the end of image - const typename PixelFormat::PixelType& Data() - { return *(typename PixelFormat::PixelType *)m_pRGB; } + // access to invidividual colour components + ChannelType& Red() { return m_pRGB[PixelFormat::RED]; } + ChannelType& Green() { return m_pRGB[PixelFormat::GREEN]; } + ChannelType& Blue() { return m_pRGB[PixelFormat::BLUE]; } + ChannelType& Alpha() { return *m_pAlpha; } // private: -- see comment in the beginning of the file @@ -440,7 +420,7 @@ struct wxPixelDataOut { m_width = image.GetWidth(); m_height = image.GetHeight(); - m_stride = Iterator::PixelFormat::SizePixel * m_width; + m_stride = Iterator::SizePixel * m_width; } // initializes us with the given region of the specified image @@ -448,7 +428,7 @@ struct wxPixelDataOut const wxPoint& pt, const wxSize& sz) : m_image(image), m_pixels(image) { - m_stride = Iterator::PixelFormat::SizePixel * m_width; + m_stride = Iterator::SizePixel * m_width; InitRect(pt, sz); } @@ -457,7 +437,7 @@ struct wxPixelDataOut wxPixelDataIn(ImageType& image, const wxRect& rect) : m_image(image), m_pixels(image) { - m_stride = Iterator::PixelFormat::SizePixel * m_width; + m_stride = Iterator::SizePixel * m_width; InitRect(rect.GetPosition(), rect.GetSize()); } @@ -545,7 +525,7 @@ struct wxPixelDataOut { m_ptr = NULL; } - + // return true if this iterator is valid bool IsOk() const { return m_ptr != NULL; } @@ -601,7 +581,7 @@ struct wxPixelDataOut // data access // ----------- - // access to individual colour components + // access to invidividual colour components ChannelType& Red() { return m_ptr[PixelFormat::RED]; } ChannelType& Green() { return m_ptr[PixelFormat::GREEN]; } ChannelType& Blue() { return m_ptr[PixelFormat::BLUE]; } @@ -610,10 +590,6 @@ struct wxPixelDataOut // address the pixel contents directly // // warning: the format is platform dependent - // - // warning 2: assigning to Data() only works correctly for 16bpp or - // 32bpp formats but using it for 24bpp ones overwrites - // one extra byte and so can't be done typename PixelFormat::PixelType& Data() { return *(typename PixelFormat::PixelType *)m_ptr; } @@ -655,22 +631,11 @@ struct wxPixelDataOut // dtor unlocks the bitmap ~wxPixelDataIn() { - if ( m_pixels.IsOk() ) - { -#if defined(__WXMSW__) || defined(__WXMAC__) - // this is a hack to mark wxBitmap as using alpha channel - if ( Format::HasAlpha ) - m_bmp.UseAlpha(); -#endif - m_bmp.UngetRawData(*this); - } - // else: don't call UngetRawData() if GetRawData() failed + m_bmp.UngetRawData(*this); } -#if WXWIN_COMPATIBILITY_2_8 - // not needed anymore, calls to it should be simply removed - wxDEPRECATED_INLINE( void UseAlpha(), wxEMPTY_PARAMETER_VALUE ) -#endif + // call this to indicate that we should use the alpha channel + void UseAlpha() { m_bmp.UseAlpha(); } // private: -- see comment in the beginning of the file @@ -691,21 +656,9 @@ struct wxPixelDataOut } }; }; - #endif //wxUSE_GUI -// FIXME-VC6: VC6 doesn't like typename in default template parameters while -// it is necessary with standard-conforming compilers, remove this -// #define and just use typename when we drop VC6 support -#if defined(__VISUALC__) && !wxCHECK_VISUALC_VERSION(7) - #define wxTYPENAME_IN_TEMPLATE_DEFAULT_PARAM -#else - #define wxTYPENAME_IN_TEMPLATE_DEFAULT_PARAM typename -#endif - -template ::Format > +template > class wxPixelData : public wxPixelDataOut::template wxPixelDataIn { @@ -724,6 +677,7 @@ public: } }; + // some "predefined" pixel data classes #if wxUSE_IMAGE typedef wxPixelData wxImagePixelData; @@ -755,5 +709,5 @@ struct wxPixelIterator : public wxPixelData::Iterator { }; -#endif // wxHAS_RAW_BITMAP -#endif // _WX_RAWBMP_H_ +#endif // _WX_RAWBMP_H_BASE_ + diff --git a/Source/3rd Party/wx/include/wx/rearrangectrl.h b/Source/3rd Party/wx/include/wx/rearrangectrl.h deleted file mode 100644 index 063f0ac91..000000000 --- a/Source/3rd Party/wx/include/wx/rearrangectrl.h +++ /dev/null @@ -1,233 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/rearrangectrl.h -// Purpose: various controls for rearranging the items interactively -// Author: Vadim Zeitlin -// Created: 2008-12-15 -// RCS-ID: $Id$ -// Copyright: (c) 2008 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_REARRANGECTRL_H_ -#define _WX_REARRANGECTRL_H_ - -#include "wx/checklst.h" - -#if wxUSE_REARRANGECTRL - -#include "wx/panel.h" -#include "wx/dialog.h" - -#include "wx/arrstr.h" - -extern WXDLLIMPEXP_DATA_CORE(const char) wxRearrangeListNameStr[]; -extern WXDLLIMPEXP_DATA_CORE(const char) wxRearrangeDialogNameStr[]; - -// ---------------------------------------------------------------------------- -// wxRearrangeList: a (check) list box allowing to move items around -// ---------------------------------------------------------------------------- - -// This class works allows to change the order of the items shown in it as well -// as to check or uncheck them individually. The data structure used to allow -// this is the order array which contains the items indices indexed by their -// position with an added twist that the unchecked items are represented by the -// bitwise complement of the corresponding index (for any architecture using -// two's complement for negative numbers representation (i.e. just about any at -// all) this means that a checked item N is represented by -N-1 in unchecked -// state). -// -// So, for example, the array order [1 -3 0] used in conjunction with the items -// array ["first", "second", "third"] means that the items are displayed in the -// order "second", "third", "first" and the "third" item is unchecked while the -// other two are checked. -class WXDLLIMPEXP_CORE wxRearrangeList : public wxCheckListBox -{ -public: - // ctors and such - // -------------- - - // default ctor, call Create() later - wxRearrangeList() { } - - // ctor creating the control, the arguments are the same as for - // wxCheckListBox except for the extra order array which defines the - // (initial) display order of the items as well as their statuses, see the - // description above - wxRearrangeList(wxWindow *parent, - wxWindowID id, - const wxPoint& pos, - const wxSize& size, - const wxArrayInt& order, - const wxArrayString& items, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxRearrangeListNameStr) - { - Create(parent, id, pos, size, order, items, style, validator, name); - } - - // Create() function takes the same parameters as the base class one and - // the order array determining the initial display order - bool Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos, - const wxSize& size, - const wxArrayInt& order, - const wxArrayString& items, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxRearrangeListNameStr); - - - // items order - // ----------- - - // get the current items order; the returned array uses the same convention - // as the one passed to the ctor - const wxArrayInt& GetCurrentOrder() const { return m_order; } - - // return true if the current item can be moved up or down (i.e. just that - // it's not the first or the last one) - bool CanMoveCurrentUp() const; - bool CanMoveCurrentDown() const; - - // move the current item one position up or down, return true if it was moved - // or false if the current item was the first/last one and so nothing was done - bool MoveCurrentUp(); - bool MoveCurrentDown(); - -private: - // swap two items at the given positions in the listbox - void Swap(int pos1, int pos2); - - // event handler for item checking/unchecking - void OnCheck(wxCommandEvent& event); - - - // the current order array - wxArrayInt m_order; - - - DECLARE_EVENT_TABLE() - wxDECLARE_NO_COPY_CLASS(wxRearrangeList); -}; - -// ---------------------------------------------------------------------------- -// wxRearrangeCtrl: composite control containing a wxRearrangeList and buttons -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxRearrangeCtrl : public wxPanel -{ -public: - // ctors/Create function are the same as for wxRearrangeList - wxRearrangeCtrl() - { - Init(); - } - - wxRearrangeCtrl(wxWindow *parent, - wxWindowID id, - const wxPoint& pos, - const wxSize& size, - const wxArrayInt& order, - const wxArrayString& items, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxRearrangeListNameStr) - { - Init(); - - Create(parent, id, pos, size, order, items, style, validator, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos, - const wxSize& size, - const wxArrayInt& order, - const wxArrayString& items, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxRearrangeListNameStr); - - // get the underlying listbox - wxRearrangeList *GetList() const { return m_list; } - -private: - // common part of all ctors - void Init(); - - // event handlers for the buttons - void OnUpdateButtonUI(wxUpdateUIEvent& event); - void OnButton(wxCommandEvent& event); - - - wxRearrangeList *m_list; - - - DECLARE_EVENT_TABLE() - wxDECLARE_NO_COPY_CLASS(wxRearrangeCtrl); -}; - -// ---------------------------------------------------------------------------- -// wxRearrangeDialog: dialog containing a wxRearrangeCtrl -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxRearrangeDialog : public wxDialog -{ -public: - // default ctor, use Create() later - wxRearrangeDialog() { Init(); } - - // ctor for the dialog: message is shown inside the dialog itself, order - // and items are passed to wxRearrangeList used internally - wxRearrangeDialog(wxWindow *parent, - const wxString& message, - const wxString& title, - const wxArrayInt& order, - const wxArrayString& items, - const wxPoint& pos = wxDefaultPosition, - const wxString& name = wxRearrangeDialogNameStr) - { - Init(); - - Create(parent, message, title, order, items, pos, name); - } - - bool Create(wxWindow *parent, - const wxString& message, - const wxString& title, - const wxArrayInt& order, - const wxArrayString& items, - const wxPoint& pos = wxDefaultPosition, - const wxString& name = wxRearrangeDialogNameStr); - - - // methods for the dialog customization - - // add extra contents to the dialog below the wxRearrangeCtrl part: the - // given window (usually a wxPanel containing more control inside it) must - // have the dialog as its parent and will be inserted into it at the right - // place by this method - void AddExtraControls(wxWindow *win); - - // return the wxRearrangeList control used by the dialog - wxRearrangeList *GetList() const; - - - // get the order of items after it was modified by the user - wxArrayInt GetOrder() const; - -private: - // common part of all ctors - void Init() { m_ctrl = NULL; } - - wxRearrangeCtrl *m_ctrl; - - wxDECLARE_NO_COPY_CLASS(wxRearrangeDialog); -}; - -#endif // wxUSE_REARRANGECTRL - -#endif // _WX_REARRANGECTRL_H_ - diff --git a/Source/3rd Party/wx/include/wx/recguard.h b/Source/3rd Party/wx/include/wx/recguard.h index d2f72d441..045c27b26 100644 --- a/Source/3rd Party/wx/include/wx/recguard.h +++ b/Source/3rd Party/wx/include/wx/recguard.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 14.08.2003 -// RCS-ID: $Id$ +// RCS-ID: $Id: recguard.h 61872 2009-09-09 22:37:05Z VZ $ // Copyright: (c) 2003 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// diff --git a/Source/3rd Party/wx/include/wx/regex.h b/Source/3rd Party/wx/include/wx/regex.h index fa89c0c22..87f319126 100644 --- a/Source/3rd Party/wx/include/wx/regex.h +++ b/Source/3rd Party/wx/include/wx/regex.h @@ -4,7 +4,7 @@ // Author: Karsten Ballueder // Modified by: VZ at 13.07.01 (integrated to wxWin) // Created: 05.02.2000 -// RCS-ID: $Id$ +// RCS-ID: $Id: regex.h 57779 2009-01-02 17:35:16Z PC $ // Copyright: (c) 2000 Karsten Ballueder // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -97,9 +97,10 @@ public: // len may be the length of text (ignored by most system regex libs) // // may only be called after successful call to Compile() - bool Matches(const wxString& text, int flags = 0) const; - bool Matches(const wxChar *text, int flags, size_t len) const - { return Matches(wxString(text, len), flags); } + bool Matches(const wxChar *text, int flags = 0) const; + bool Matches(const wxChar *text, int flags, size_t len) const; + bool Matches(const wxString& text, int flags = 0) const + { return Matches(text.c_str(), flags, text.length()); } // get the start index and the length of the match of the expression // (index 0) or a bracketed subexpression (index != 0) @@ -130,16 +131,16 @@ public: // pattern match // // maxMatches may be used to limit the number of replacements made, setting - // it to 1, for example, will only replace first occurrence (if any) of the + // it to 1, for example, will only replace first occurence (if any) of the // pattern in the text while default value of 0 means replace all int Replace(wxString *text, const wxString& replacement, size_t maxMatches = 0) const; - // replace the first occurrence + // replace the first occurence int ReplaceFirst(wxString *text, const wxString& replacement) const { return Replace(text, replacement, 1); } - // replace all occurrences: this is actually a synonym for Replace() + // replace all occurences: this is actually a synonym for Replace() int ReplaceAll(wxString *text, const wxString& replacement) const { return Replace(text, replacement, 0); } diff --git a/Source/3rd Party/wx/include/wx/region.h b/Source/3rd Party/wx/include/wx/region.h index c6c24a5f3..2bbaed5e0 100644 --- a/Source/3rd Party/wx/include/wx/region.h +++ b/Source/3rd Party/wx/include/wx/region.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: -// RCS-ID: $Id$ +// RCS-ID: $Id: region.h 49563 2007-10-31 20:46:21Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// @@ -55,7 +55,7 @@ enum wxRegionOp // wxRegionBase defines wxRegion API // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxRegionBase : public wxGDIObject +class WXDLLEXPORT wxRegionBase : public wxGDIObject { public: // ctors @@ -67,7 +67,7 @@ public: wxRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h); wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight); wxRegion(const wxRect& rect); - wxRegion(size_t n, const wxPoint *points, wxPolygonFillMode fillStyle = wxODDEVEN_RULE); + wxRegion(size_t n, const wxPoint *points, int fillStyle = wxODDEVEN_RULE); wxRegion(const wxBitmap& bmp); wxRegion(const wxBitmap& bmp, const wxColour& transp, int tolerance = 0); #endif // 0 @@ -82,6 +82,9 @@ public: // accessors // --------- + bool Ok() const { return IsOk(); } + bool IsOk() const { return m_refData != NULL; } + // Is region empty? virtual bool IsEmpty() const = 0; bool Empty() const { return IsEmpty(); } @@ -181,13 +184,14 @@ protected: // some ports implement a generic Combine() function while others only // implement individual wxRegion operations, factor out the common code for the // ports with Combine() in this class -#if defined(__WXMSW__) || \ - ( defined(__WXMAC__) && wxOSX_USE_COCOA_OR_CARBON ) || \ +#if defined(__WXPALMOS__) || \ + defined(__WXMSW__) || \ + defined(__WXMAC__) || \ defined(__WXPM__) #define wxHAS_REGION_COMBINE -class WXDLLIMPEXP_CORE wxRegionWithCombine : public wxRegionBase +class WXDLLEXPORT wxRegionWithCombine : public wxRegionBase { public: // these methods are not part of public API as they're not implemented on @@ -212,7 +216,9 @@ protected: #endif // ports with wxRegion::Combine() -#if defined(__WXMSW__) +#if defined(__WXPALMOS__) + #include "wx/palmos/region.h" +#elif defined(__WXMSW__) #include "wx/msw/region.h" #elif defined(__WXGTK20__) #include "wx/gtk/region.h" @@ -220,10 +226,12 @@ protected: #include "wx/gtk1/region.h" #elif defined(__WXMOTIF__) || defined(__WXX11__) #include "wx/x11/region.h" +#elif defined(__WXMGL__) + #include "wx/mgl/region.h" #elif defined(__WXDFB__) #include "wx/dfb/region.h" #elif defined(__WXMAC__) - #include "wx/osx/region.h" + #include "wx/mac/region.h" #elif defined(__WXCOCOA__) #include "wx/cocoa/region.h" #elif defined(__WXPM__) diff --git a/Source/3rd Party/wx/include/wx/renderer.h b/Source/3rd Party/wx/include/wx/renderer.h index 8b4051f49..b28ec8531 100644 --- a/Source/3rd Party/wx/include/wx/renderer.h +++ b/Source/3rd Party/wx/include/wx/renderer.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 20.07.2003 -// RCS-ID: $Id$ +// RCS-ID: $Id: renderer.h 53667 2008-05-20 09:28:48Z VS $ // Copyright: (c) 2003 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -28,24 +28,19 @@ class WXDLLIMPEXP_FWD_CORE wxDC; class WXDLLIMPEXP_FWD_CORE wxWindow; -#include "wx/gdicmn.h" // for wxPoint, wxSize +#include "wx/gdicmn.h" // for wxPoint #include "wx/colour.h" #include "wx/font.h" #include "wx/bitmap.h" #include "wx/string.h" // some platforms have their own renderers, others use the generic one -#if defined(__WXMSW__) || ( defined(__WXMAC__) && wxOSX_USE_COCOA_OR_CARBON ) || defined(__WXGTK__) +#if defined(__WXMSW__) || defined(__WXMAC__) || defined(__WXGTK__) #define wxHAS_NATIVE_RENDERER #else #undef wxHAS_NATIVE_RENDERER #endif -// only MSW and OS X currently provides DrawTitleBarBitmap() method -#if defined(__WXMSW__) || (defined(__WXMAC__) && wxUSE_LIBPNG && wxUSE_IMAGE) - #define wxHAS_DRAW_TITLE_BAR_BITMAP -#endif - // ---------------------------------------------------------------------------- // constants // ---------------------------------------------------------------------------- @@ -61,7 +56,6 @@ enum wxCONTROL_ISSUBMENU = wxCONTROL_SPECIAL, // only for the menu items wxCONTROL_EXPANDED = wxCONTROL_SPECIAL, // only for the tree items wxCONTROL_SIZEGRIP = wxCONTROL_SPECIAL, // only for the status bar panes - wxCONTROL_FLAT = wxCONTROL_SPECIAL, // checkboxes only: flat border wxCONTROL_CURRENT = 0x00000010, // mouse is currently over the control wxCONTROL_SELECTED = 0x00000020, // selected item in e.g. listbox wxCONTROL_CHECKED = 0x00000040, // (check/radio button) is checked @@ -75,25 +69,12 @@ enum wxCONTROL_DIRTY = 0x80000000 }; -// title bar buttons supported by DrawTitleBarBitmap() -// -// NB: they have the same values as wxTOPLEVEL_BUTTON_XXX constants in -// wx/univ/toplevel.h as they really represent the same things -enum wxTitleBarButton -{ - wxTITLEBAR_BUTTON_CLOSE = 0x01000000, - wxTITLEBAR_BUTTON_MAXIMIZE = 0x02000000, - wxTITLEBAR_BUTTON_ICONIZE = 0x04000000, - wxTITLEBAR_BUTTON_RESTORE = 0x08000000, - wxTITLEBAR_BUTTON_HELP = 0x10000000 -}; - // ---------------------------------------------------------------------------- // helper structs // ---------------------------------------------------------------------------- // wxSplitterWindow parameters -struct WXDLLIMPEXP_CORE wxSplitterRenderParams +struct WXDLLEXPORT wxSplitterRenderParams { // the only way to initialize this struct is by using this ctor wxSplitterRenderParams(wxCoord widthSash_, wxCoord border_, bool isSens_) @@ -113,7 +94,7 @@ struct WXDLLIMPEXP_CORE wxSplitterRenderParams // extra optional parameters for DrawHeaderButton -struct WXDLLIMPEXP_CORE wxHeaderButtonParams +struct WXDLLEXPORT wxHeaderButtonParams { wxHeaderButtonParams() : m_labelAlignment(wxALIGN_LEFT) @@ -128,16 +109,15 @@ struct WXDLLIMPEXP_CORE wxHeaderButtonParams int m_labelAlignment; }; -enum wxHeaderSortIconType -{ +enum wxHeaderSortIconType { wxHDR_SORT_ICON_NONE, // Header button has no sort arrow - wxHDR_SORT_ICON_UP, // Header button an up sort arrow icon - wxHDR_SORT_ICON_DOWN // Header button a down sort arrow icon + wxHDR_SORT_ICON_UP, // Header button an an up sort arrow icon + wxHDR_SORT_ICON_DOWN // Header button an a down sort arrow icon }; // wxRendererNative interface version -struct WXDLLIMPEXP_CORE wxRendererVersion +struct WXDLLEXPORT wxRendererVersion { wxRendererVersion(int version_, int age_) : version(version_), age(age_) { } @@ -171,7 +151,7 @@ struct WXDLLIMPEXP_CORE wxRendererVersion // wxRendererNative: abstracts drawing methods needed by the native controls // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxRendererNative +class WXDLLEXPORT wxRendererNative { public: // drawing functions @@ -200,9 +180,6 @@ public: // height if available, or a generic height based on the window's font. virtual int GetHeaderButtonHeight(wxWindow *win) = 0; - // Returns the margin on left and right sides of header button's label - virtual int GetHeaderButtonMargin(wxWindow *win) = 0; - // draw the expanded/collapsed icon for a tree control item virtual void DrawTreeItemButton(wxWindow *win, @@ -249,9 +226,6 @@ public: const wxRect& rect, int flags = 0) = 0; - // Returns the default size of a check box. - virtual wxSize GetCheckBoxSize(wxWindow *win) = 0; - // draw blank button // // flags may use wxCONTROL_PRESSED, wxCONTROL_CURRENT and wxCONTROL_ISDEFAULT @@ -272,56 +246,6 @@ public: const wxRect& rect, int flags = 0) = 0; - // draw the focus rectangle around the label contained in the given rect - // - // only wxCONTROL_SELECTED makes sense in flags here - virtual void DrawFocusRect(wxWindow* win, - wxDC& dc, - const wxRect& rect, - int flags = 0) = 0; - - // Draw a native wxChoice - virtual void DrawChoice(wxWindow* win, - wxDC& dc, - const wxRect& rect, - int flags = 0) = 0; - - // Draw a native wxComboBox - virtual void DrawComboBox(wxWindow* win, - wxDC& dc, - const wxRect& rect, - int flags = 0) = 0; - - // Draw a native wxTextCtrl frame - virtual void DrawTextCtrl(wxWindow* win, - wxDC& dc, - const wxRect& rect, - int flags = 0) = 0; - - // Draw a native wxRadioButton bitmap - virtual void DrawRadioBitmap(wxWindow* win, - wxDC& dc, - const wxRect& rect, - int flags = 0) = 0; - -#ifdef wxHAS_DRAW_TITLE_BAR_BITMAP - // Draw one of the standard title bar buttons - // - // This is currently implemented only for MSW and OS X (for the close - // button only) because there is no way to render standard title bar - // buttons under the other platforms, the best can be done is to use normal - // (only) images which wxArtProvider provides for wxART_HELP and - // wxART_CLOSE (but not any other title bar buttons) - // - // NB: make sure PNG handler is enabled if using this function under OS X - virtual void DrawTitleBarBitmap(wxWindow *win, - wxDC& dc, - const wxRect& rect, - wxTitleBarButton button, - int flags = 0) = 0; -#endif // wxHAS_DRAW_TITLE_BAR_BITMAP - - // geometry functions // ------------------ @@ -375,7 +299,7 @@ public: // wxDelegateRendererNative: allows reuse of renderers code // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxDelegateRendererNative : public wxRendererNative +class WXDLLEXPORT wxDelegateRendererNative : public wxRendererNative { public: wxDelegateRendererNative() @@ -404,9 +328,6 @@ public: virtual int GetHeaderButtonHeight(wxWindow *win) { return m_rendererNative.GetHeaderButtonHeight(win); } - virtual int GetHeaderButtonMargin(wxWindow *win) - { return m_rendererNative.GetHeaderButtonMargin(win); } - virtual void DrawTreeItemButton(wxWindow *win, wxDC& dc, const wxRect& rect, @@ -443,63 +364,21 @@ public: virtual void DrawCheckBox(wxWindow *win, wxDC& dc, const wxRect& rect, - int flags = 0) + int flags = 0 ) { m_rendererNative.DrawCheckBox( win, dc, rect, flags ); } - virtual wxSize GetCheckBoxSize(wxWindow *win) - { return m_rendererNative.GetCheckBoxSize(win); } - virtual void DrawPushButton(wxWindow *win, wxDC& dc, const wxRect& rect, - int flags = 0) + int flags = 0 ) { m_rendererNative.DrawPushButton( win, dc, rect, flags ); } virtual void DrawItemSelectionRect(wxWindow *win, wxDC& dc, const wxRect& rect, - int flags = 0) + int flags = 0 ) { m_rendererNative.DrawItemSelectionRect( win, dc, rect, flags ); } - virtual void DrawFocusRect(wxWindow* win, - wxDC& dc, - const wxRect& rect, - int flags = 0) - { m_rendererNative.DrawFocusRect( win, dc, rect, flags ); } - - virtual void DrawChoice(wxWindow* win, - wxDC& dc, - const wxRect& rect, - int flags = 0) - { m_rendererNative.DrawChoice( win, dc, rect, flags); } - - virtual void DrawComboBox(wxWindow* win, - wxDC& dc, - const wxRect& rect, - int flags = 0) - { m_rendererNative.DrawComboBox( win, dc, rect, flags); } - - virtual void DrawTextCtrl(wxWindow* win, - wxDC& dc, - const wxRect& rect, - int flags = 0) - { m_rendererNative.DrawTextCtrl( win, dc, rect, flags); } - - virtual void DrawRadioBitmap(wxWindow* win, - wxDC& dc, - const wxRect& rect, - int flags = 0) - { m_rendererNative.DrawRadioBitmap(win, dc, rect, flags); } - -#ifdef wxHAS_DRAW_TITLE_BAR_BITMAP - virtual void DrawTitleBarBitmap(wxWindow *win, - wxDC& dc, - const wxRect& rect, - wxTitleBarButton button, - int flags = 0) - { m_rendererNative.DrawTitleBarBitmap(win, dc, rect, button, flags); } -#endif // wxHAS_DRAW_TITLE_BAR_BITMAP - virtual wxSplitterRenderParams GetSplitterParams(const wxWindow *win) { return m_rendererNative.GetSplitterParams(win); } @@ -509,7 +388,7 @@ public: protected: wxRendererNative& m_rendererNative; - wxDECLARE_NO_COPY_CLASS(wxDelegateRendererNative); + DECLARE_NO_COPY_CLASS(wxDelegateRendererNative) }; // ---------------------------------------------------------------------------- @@ -527,4 +406,31 @@ wxRendererNative& wxRendererNative::GetDefault() #endif // !wxHAS_NATIVE_RENDERER + +// ---------------------------------------------------------------------------- +// Other renderer functions to be merged in to wxRenderer class in 2.9, but +// they are standalone functions here to protect the ABI. +// ---------------------------------------------------------------------------- + +#if defined(__WXMSW__) || defined(__WXMAC__) || defined(__WXGTK20__) +#if wxABI_VERSION >= 20808 + +// Draw a native wxChoice +void WXDLLEXPORT wxRenderer_DrawChoice(wxWindow* win, wxDC& dc, + const wxRect& rect, int flags=0); + +// Draw a native wxComboBox +void WXDLLEXPORT wxRenderer_DrawComboBox(wxWindow* win, wxDC& dc, + const wxRect& rect, int flags=0); + +// Draw a native wxTextCtrl frame +void WXDLLEXPORT wxRenderer_DrawTextCtrl(wxWindow* win, wxDC& dc, + const wxRect& rect, int flags=0); + +// Draw a native wxRadioButton (just the graphical portion) +void WXDLLEXPORT wxRenderer_DrawRadioButton(wxWindow* win, wxDC& dc, + const wxRect& rect, int flags=0); +#endif // wxABI_VERSION +#endif // (platforms) + #endif // _WX_RENDERER_H_ diff --git a/Source/3rd Party/wx/include/wx/richmsgdlg.h b/Source/3rd Party/wx/include/wx/richmsgdlg.h deleted file mode 100644 index be3e409d3..000000000 --- a/Source/3rd Party/wx/include/wx/richmsgdlg.h +++ /dev/null @@ -1,89 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/richmsgdlg.h -// Purpose: wxRichMessageDialogBase -// Author: Rickard Westerlund -// Created: 2010-07-03 -// RCS-ID: $Id$ -// Copyright: (c) 2010 wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_RICHMSGDLG_H_BASE_ -#define _WX_RICHMSGDLG_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_RICHMSGDLG - -#include "wx/msgdlg.h" - -// Extends a message dialog with an optional checkbox and user-expandable -// detailed text. -class WXDLLIMPEXP_CORE wxRichMessageDialogBase : public wxGenericMessageDialog -{ -public: - wxRichMessageDialogBase( wxWindow *parent, - const wxString& message, - const wxString& caption, - long style ) - : wxGenericMessageDialog( parent, message, caption, style ), - m_detailsExpanderCollapsedLabel( _("&See details") ), - m_detailsExpanderExpandedLabel( _("&Hide details") ), - m_checkBoxValue( false ) - { } - - void ShowCheckBox(const wxString& checkBoxText, bool checked = false) - { - m_checkBoxText = checkBoxText; - m_checkBoxValue = checked; - } - - wxString GetCheckBoxText() const { return m_checkBoxText; } - - void ShowDetailedText(const wxString& detailedText) - { m_detailedText = detailedText; } - - wxString GetDetailedText() const { return m_detailedText; } - - virtual bool IsCheckBoxChecked() const { return m_checkBoxValue; } - -protected: - const wxString m_detailsExpanderCollapsedLabel; - const wxString m_detailsExpanderExpandedLabel; - - wxString m_checkBoxText; - bool m_checkBoxValue; - wxString m_detailedText; - -private: - void ShowDetails(bool shown); - - wxDECLARE_NO_COPY_CLASS(wxRichMessageDialogBase); -}; - -// Always include the generic version as it's currently used as the base class -// by the MSW native implementation too. -#include "wx/generic/richmsgdlgg.h" - -#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) - #include "wx/msw/richmsgdlg.h" -#else - class WXDLLIMPEXP_CORE wxRichMessageDialog - : public wxGenericRichMessageDialog - { - public: - wxRichMessageDialog( wxWindow *parent, - const wxString& message, - const wxString& caption, - long style ) - : wxGenericRichMessageDialog( parent, message, caption, style ) - { } - - private: - wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxRichMessageDialog); - }; -#endif - -#endif // wxUSE_RICHMSGDLG - -#endif // _WX_RICHMSGDLG_H_BASE_ diff --git a/Source/3rd Party/wx/include/wx/rtti.h b/Source/3rd Party/wx/include/wx/rtti.h deleted file mode 100644 index e28921960..000000000 --- a/Source/3rd Party/wx/include/wx/rtti.h +++ /dev/null @@ -1,320 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/rtti.h -// Purpose: old RTTI macros (use XTI when possible instead) -// Author: Julian Smart -// Modified by: Ron Lee -// Created: 01/02/97 -// RCS-ID: $Id$ -// Copyright: (c) 1997 Julian Smart -// (c) 2001 Ron Lee -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_RTTIH__ -#define _WX_RTTIH__ - -#if !wxUSE_EXTENDED_RTTI // XTI system is meant to replace these macros - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/memory.h" - -// ---------------------------------------------------------------------------- -// forward declarations -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_BASE wxObject; -class WXDLLIMPEXP_FWD_BASE wxString; -class WXDLLIMPEXP_FWD_BASE wxClassInfo; -class WXDLLIMPEXP_FWD_BASE wxHashTable; -class WXDLLIMPEXP_FWD_BASE wxObject; -class WXDLLIMPEXP_FWD_BASE wxPluginLibrary; -class WXDLLIMPEXP_FWD_BASE wxHashTable_Node; - -// ---------------------------------------------------------------------------- -// wxClassInfo -// ---------------------------------------------------------------------------- - -typedef wxObject *(*wxObjectConstructorFn)(void); - -class WXDLLIMPEXP_BASE wxClassInfo -{ - friend class WXDLLIMPEXP_FWD_BASE wxObject; - friend WXDLLIMPEXP_BASE wxObject *wxCreateDynamicObject(const wxString& name); -public: - wxClassInfo( const wxChar *className, - const wxClassInfo *baseInfo1, - const wxClassInfo *baseInfo2, - int size, - wxObjectConstructorFn ctor ) - : m_className(className) - , m_objectSize(size) - , m_objectConstructor(ctor) - , m_baseInfo1(baseInfo1) - , m_baseInfo2(baseInfo2) - , m_next(sm_first) - { - sm_first = this; - Register(); - } - - ~wxClassInfo(); - - wxObject *CreateObject() const - { return m_objectConstructor ? (*m_objectConstructor)() : 0; } - bool IsDynamic() const { return (NULL != m_objectConstructor); } - - const wxChar *GetClassName() const { return m_className; } - const wxChar *GetBaseClassName1() const - { return m_baseInfo1 ? m_baseInfo1->GetClassName() : NULL; } - const wxChar *GetBaseClassName2() const - { return m_baseInfo2 ? m_baseInfo2->GetClassName() : NULL; } - const wxClassInfo *GetBaseClass1() const { return m_baseInfo1; } - const wxClassInfo *GetBaseClass2() const { return m_baseInfo2; } - int GetSize() const { return m_objectSize; } - - wxObjectConstructorFn GetConstructor() const - { return m_objectConstructor; } - static const wxClassInfo *GetFirst() { return sm_first; } - const wxClassInfo *GetNext() const { return m_next; } - static wxClassInfo *FindClass(const wxString& className); - - // Climb upwards through inheritance hierarchy. - // Dual inheritance is catered for. - - bool IsKindOf(const wxClassInfo *info) const - { - return info != 0 && - ( info == this || - ( m_baseInfo1 && m_baseInfo1->IsKindOf(info) ) || - ( m_baseInfo2 && m_baseInfo2->IsKindOf(info) ) ); - } - - wxDECLARE_CLASS_INFO_ITERATORS(); - -private: - const wxChar *m_className; - int m_objectSize; - wxObjectConstructorFn m_objectConstructor; - - // Pointers to base wxClassInfos - - const wxClassInfo *m_baseInfo1; - const wxClassInfo *m_baseInfo2; - - // class info object live in a linked list: - // pointers to its head and the next element in it - - static wxClassInfo *sm_first; - wxClassInfo *m_next; - - static wxHashTable *sm_classTable; - -protected: - // registers the class - void Register(); - void Unregister(); - - wxDECLARE_NO_COPY_CLASS(wxClassInfo); -}; - -WXDLLIMPEXP_BASE wxObject *wxCreateDynamicObject(const wxString& name); - -// ---------------------------------------------------------------------------- -// Dynamic class macros -// ---------------------------------------------------------------------------- - -#define wxDECLARE_ABSTRACT_CLASS(name) \ - public: \ - static wxClassInfo ms_classInfo; \ - virtual wxClassInfo *GetClassInfo() const - -#define wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(name) \ - wxDECLARE_NO_ASSIGN_CLASS(name); \ - wxDECLARE_DYNAMIC_CLASS(name) - -#define wxDECLARE_DYNAMIC_CLASS_NO_COPY(name) \ - wxDECLARE_NO_COPY_CLASS(name); \ - wxDECLARE_DYNAMIC_CLASS(name) - -#define wxDECLARE_DYNAMIC_CLASS(name) \ - wxDECLARE_ABSTRACT_CLASS(name); \ - static wxObject* wxCreateObject() - -#define wxDECLARE_CLASS(name) \ - wxDECLARE_ABSTRACT_CLASS(name) - - -// common part of the macros below -#define wxIMPLEMENT_CLASS_COMMON(name, basename, baseclsinfo2, func) \ - wxClassInfo name::ms_classInfo(wxT(#name), \ - &basename::ms_classInfo, \ - baseclsinfo2, \ - (int) sizeof(name), \ - func); \ - \ - wxClassInfo *name::GetClassInfo() const \ - { return &name::ms_classInfo; } - -#define wxIMPLEMENT_CLASS_COMMON1(name, basename, func) \ - wxIMPLEMENT_CLASS_COMMON(name, basename, NULL, func) - -#define wxIMPLEMENT_CLASS_COMMON2(name, basename1, basename2, func) \ - wxIMPLEMENT_CLASS_COMMON(name, basename1, &basename2::ms_classInfo, func) - -// ----------------------------------- -// for concrete classes -// ----------------------------------- - - // Single inheritance with one base class -#define wxIMPLEMENT_DYNAMIC_CLASS(name, basename) \ - wxIMPLEMENT_CLASS_COMMON1(name, basename, name::wxCreateObject) \ - wxObject* name::wxCreateObject() \ - { return new name; } - - // Multiple inheritance with two base classes -#define wxIMPLEMENT_DYNAMIC_CLASS2(name, basename1, basename2) \ - wxIMPLEMENT_CLASS_COMMON2(name, basename1, basename2, \ - name::wxCreateObject) \ - wxObject* name::wxCreateObject() \ - { return new name; } - -// ----------------------------------- -// for abstract classes -// ----------------------------------- - - // Single inheritance with one base class -#define wxIMPLEMENT_ABSTRACT_CLASS(name, basename) \ - wxIMPLEMENT_CLASS_COMMON1(name, basename, NULL) - - // Multiple inheritance with two base classes -#define wxIMPLEMENT_ABSTRACT_CLASS2(name, basename1, basename2) \ - wxIMPLEMENT_CLASS_COMMON2(name, basename1, basename2, NULL) - -// ----------------------------------- -// XTI-compatible macros -// ----------------------------------- - -#include "wx/flags.h" - -// these macros only do something when wxUSE_EXTENDED_RTTI=1 -// (and in that case they are defined by xti.h); however to avoid -// to be forced to wrap these macros (in user's source files) with -// -// #if wxUSE_EXTENDED_RTTI -// ... -// #endif -// -// blocks, we define them here as empty. - -#define wxEMPTY_PARAMETER_VALUE /**/ - -#define wxBEGIN_ENUM( e ) wxEMPTY_PARAMETER_VALUE -#define wxENUM_MEMBER( v ) wxEMPTY_PARAMETER_VALUE -#define wxEND_ENUM( e ) wxEMPTY_PARAMETER_VALUE - -#define wxIMPLEMENT_SET_STREAMING(SetName,e) wxEMPTY_PARAMETER_VALUE - -#define wxBEGIN_FLAGS( e ) wxEMPTY_PARAMETER_VALUE -#define wxFLAGS_MEMBER( v ) wxEMPTY_PARAMETER_VALUE -#define wxEND_FLAGS( e ) wxEMPTY_PARAMETER_VALUE - -#define wxCOLLECTION_TYPE_INFO( element, collection ) wxEMPTY_PARAMETER_VALUE - -#define wxHANDLER(name,eventClassType) wxEMPTY_PARAMETER_VALUE -#define wxBEGIN_HANDLERS_TABLE(theClass) wxEMPTY_PARAMETER_VALUE -#define wxEND_HANDLERS_TABLE() wxEMPTY_PARAMETER_VALUE - -#define wxIMPLEMENT_DYNAMIC_CLASS_XTI( name, basename, unit ) \ - wxIMPLEMENT_DYNAMIC_CLASS( name, basename ) -#define wxIMPLEMENT_DYNAMIC_CLASS_XTI_CALLBACK( name, basename, unit, callback ) \ - wxIMPLEMENT_DYNAMIC_CLASS( name, basename ) - -#define wxIMPLEMENT_DYNAMIC_CLASS_WITH_COPY_XTI( name, basename, unit ) \ - wxIMPLEMENT_DYNAMIC_CLASS( name, basename) - -#define wxIMPLEMENT_DYNAMIC_CLASS_WITH_COPY_AND_STREAMERS_XTI( name, basename, \ - unit, toString, \ - fromString ) wxEMPTY_PARAMETER_VALUE -#define wxIMPLEMENT_DYNAMIC_CLASS_NO_WXOBJECT_NO_BASE_XTI( name, unit ) wxEMPTY_PARAMETER_VALUE -#define wxIMPLEMENT_DYNAMIC_CLASS_NO_WXOBJECT_XTI( name, basename, unit ) wxEMPTY_PARAMETER_VALUE - -#define wxIMPLEMENT_DYNAMIC_CLASS2_XTI( name, basename, basename2, unit) wxIMPLEMENT_DYNAMIC_CLASS2( name, basename, basename2 ) - -#define wxCONSTRUCTOR_0(klass) \ - wxEMPTY_PARAMETER_VALUE -#define wxCONSTRUCTOR_DUMMY(klass) \ - wxEMPTY_PARAMETER_VALUE -#define wxDIRECT_CONSTRUCTOR_0(klass) \ - wxEMPTY_PARAMETER_VALUE -#define wxCONSTRUCTOR_1(klass,t0,v0) \ - wxEMPTY_PARAMETER_VALUE -#define wxDIRECT_CONSTRUCTOR_1(klass,t0,v0) \ - wxEMPTY_PARAMETER_VALUE -#define wxCONSTRUCTOR_2(klass,t0,v0,t1,v1) \ - wxEMPTY_PARAMETER_VALUE -#define wxDIRECT_CONSTRUCTOR_2(klass,t0,v0,t1,v1) \ - wxEMPTY_PARAMETER_VALUE -#define wxCONSTRUCTOR_3(klass,t0,v0,t1,v1,t2,v2) \ - wxEMPTY_PARAMETER_VALUE -#define wxDIRECT_CONSTRUCTOR_3(klass,t0,v0,t1,v1,t2,v2) \ - wxEMPTY_PARAMETER_VALUE -#define wxCONSTRUCTOR_4(klass,t0,v0,t1,v1,t2,v2,t3,v3) \ - wxEMPTY_PARAMETER_VALUE -#define wxDIRECT_CONSTRUCTOR_4(klass,t0,v0,t1,v1,t2,v2,t3,v3) \ - wxEMPTY_PARAMETER_VALUE -#define wxCONSTRUCTOR_5(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4) \ - wxEMPTY_PARAMETER_VALUE -#define wxDIRECT_CONSTRUCTOR_5(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4) \ - wxEMPTY_PARAMETER_VALUE -#define wxCONSTRUCTOR_6(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5) \ - wxEMPTY_PARAMETER_VALUE -#define wxDIRECT_CONSTRUCTOR_6(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5) \ - wxEMPTY_PARAMETER_VALUE -#define wxCONSTRUCTOR_7(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6) \ - wxEMPTY_PARAMETER_VALUE -#define wxDIRECT_CONSTRUCTOR_7(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6) \ - wxEMPTY_PARAMETER_VALUE -#define wxCONSTRUCTOR_8(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7) \ - wxEMPTY_PARAMETER_VALUE -#define wxDIRECT_CONSTRUCTOR_8(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7) \ - wxEMPTY_PARAMETER_VALUE - -#define wxSETTER( property, Klass, valueType, setterMethod ) wxEMPTY_PARAMETER_VALUE -#define wxGETTER( property, Klass, valueType, gettermethod ) wxEMPTY_PARAMETER_VALUE -#define wxADDER( property, Klass, valueType, addermethod ) wxEMPTY_PARAMETER_VALUE -#define wxCOLLECTION_GETTER( property, Klass, valueType, gettermethod ) wxEMPTY_PARAMETER_VALUE - -#define wxBEGIN_PROPERTIES_TABLE(theClass) wxEMPTY_PARAMETER_VALUE -#define wxEND_PROPERTIES_TABLE() wxEMPTY_PARAMETER_VALUE -#define wxHIDE_PROPERTY( pname ) wxEMPTY_PARAMETER_VALUE - -#define wxPROPERTY( pname, type, setter, getter, defaultValue, flags, help, group) \ - wxEMPTY_PARAMETER_VALUE - -#define wxPROPERTY_FLAGS( pname, flags, type, setter, getter,defaultValue, \ - pflags, help, group) wxEMPTY_PARAMETER_VALUE - -#define wxREADONLY_PROPERTY( pname, type, getter,defaultValue, flags, help, group) \ - wxGETTER( pname, class_t, type, getter ) wxEMPTY_PARAMETER_VALUE - -#define wxREADONLY_PROPERTY_FLAGS( pname, flags, type, getter,defaultValue, \ - pflags, help, group) wxEMPTY_PARAMETER_VALUE - -#define wxPROPERTY_COLLECTION( pname, colltype, addelemtype, adder, getter, \ - flags, help, group ) wxEMPTY_PARAMETER_VALUE - -#define wxREADONLY_PROPERTY_COLLECTION( pname, colltype, addelemtype, getter, \ - flags, help, group) wxEMPTY_PARAMETER_VALUE -#define wxEVENT_PROPERTY( name, eventType, eventClass ) wxEMPTY_PARAMETER_VALUE - -#define wxEVENT_RANGE_PROPERTY( name, eventType, lastEventType, eventClass ) wxEMPTY_PARAMETER_VALUE - -#define wxIMPLEMENT_PROPERTY(name, type) wxEMPTY_PARAMETER_VALUE - -#define wxEMPTY_HANDLERS_TABLE(name) wxEMPTY_PARAMETER_VALUE - -#endif // !wxUSE_EXTENDED_RTTI -#endif // _WX_RTTIH__ diff --git a/Source/3rd Party/wx/include/wx/scopedarray.h b/Source/3rd Party/wx/include/wx/scopedarray.h deleted file mode 100644 index 5be7f354c..000000000 --- a/Source/3rd Party/wx/include/wx/scopedarray.h +++ /dev/null @@ -1,120 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/scopedarray.h -// Purpose: scoped smart pointer class -// Author: Vadim Zeitlin -// Created: 2009-02-03 -// RCS-ID: $Id$ -// Copyright: (c) Jesse Lovelace and original Boost authors (see below) -// (c) 2009 Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_SCOPED_ARRAY_H_ -#define _WX_SCOPED_ARRAY_H_ - -#include "wx/defs.h" -#include "wx/checkeddelete.h" - -// ---------------------------------------------------------------------------- -// wxScopedArray: A scoped array -// ---------------------------------------------------------------------------- - -template -class wxScopedArray -{ -public: - typedef T element_type; - - wxEXPLICIT wxScopedArray(T * array = NULL) : m_array(array) { } - - ~wxScopedArray() { delete [] m_array; } - - // test for pointer validity: defining conversion to unspecified_bool_type - // and not more obvious bool to avoid implicit conversions to integer types - typedef T *(wxScopedArray::*unspecified_bool_type)() const; - operator unspecified_bool_type() const - { - return m_array ? &wxScopedArray::get : NULL; - } - - void reset(T *array = NULL) - { - if ( array != m_array ) - { - delete [] m_array; - m_array = array; - } - } - - T& operator[](size_t n) const { return m_array[n]; } - - T *get() const { return m_array; } - - void swap(wxScopedArray &other) - { - T * const tmp = other.m_array; - other.m_array = m_array; - m_array = tmp; - } - -private: - T *m_array; - - DECLARE_NO_COPY_TEMPLATE_CLASS(wxScopedArray, T) -}; - -// ---------------------------------------------------------------------------- -// old macro based implementation -// ---------------------------------------------------------------------------- - -// the same but for arrays instead of simple pointers -#define wxDECLARE_SCOPED_ARRAY(T, name)\ -class name \ -{ \ -private: \ - T * m_ptr; \ - name(name const &); \ - name & operator=(name const &); \ - \ -public: \ - wxEXPLICIT name(T * p = NULL) : m_ptr(p) \ - {} \ - \ - ~name(); \ - void reset(T * p = NULL); \ - \ - T & operator[](long int i) const\ - { \ - wxASSERT(m_ptr != NULL); \ - wxASSERT(i >= 0); \ - return m_ptr[i]; \ - } \ - \ - T * get() const \ - { \ - return m_ptr; \ - } \ - \ - void swap(name & ot) \ - { \ - T * tmp = ot.m_ptr; \ - ot.m_ptr = m_ptr; \ - m_ptr = tmp; \ - } \ -}; - -#define wxDEFINE_SCOPED_ARRAY(T, name) \ -name::~name() \ -{ \ - wxCHECKED_DELETE_ARRAY(m_ptr); \ -} \ -void name::reset(T * p){ \ - if (m_ptr != p) \ - { \ - wxCHECKED_DELETE_ARRAY(m_ptr); \ - m_ptr = p; \ - } \ -} - -#endif // _WX_SCOPED_ARRAY_H_ - diff --git a/Source/3rd Party/wx/include/wx/scopedptr.h b/Source/3rd Party/wx/include/wx/scopedptr.h deleted file mode 100644 index 1cae0f011..000000000 --- a/Source/3rd Party/wx/include/wx/scopedptr.h +++ /dev/null @@ -1,215 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/scopedptr.h -// Purpose: scoped smart pointer class -// Author: Jesse Lovelace -// Created: 06/01/02 -// RCS-ID: $Id$ -// Copyright: (c) Jesse Lovelace and original Boost authors (see below) -// (c) 2009 Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// This class closely follows the implementation of the boost -// library scoped_ptr and is an adaption for c++ macro's in -// the wxWidgets project. The original authors of the boost -// scoped_ptr are given below with their respective copyrights. - -// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. -// Copyright (c) 2001, 2002 Peter Dimov -// -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. -// This software is provided "as is" without express or implied -// warranty, and with no claim as to its suitability for any purpose. -// -// See http://www.boost.org/libs/smart_ptr/scoped_ptr.htm for documentation. -// - -#ifndef _WX_SCOPED_PTR_H_ -#define _WX_SCOPED_PTR_H_ - -#include "wx/defs.h" -#include "wx/checkeddelete.h" - -// ---------------------------------------------------------------------------- -// wxScopedPtr: A scoped pointer -// ---------------------------------------------------------------------------- - -template -class wxScopedPtr -{ -public: - typedef T element_type; - - wxEXPLICIT wxScopedPtr(T * ptr = NULL) : m_ptr(ptr) { } - - ~wxScopedPtr() { wxCHECKED_DELETE(m_ptr); } - - // test for pointer validity: defining conversion to unspecified_bool_type - // and not more obvious bool to avoid implicit conversions to integer types -#ifdef __BORLANDC__ - // this compiler is too dumb to use unspecified_bool_type operator in tests - // of the form "if ( !ptr )" - typedef bool unspecified_bool_type; -#else - typedef T *(wxScopedPtr::*unspecified_bool_type)() const; -#endif // __BORLANDC__ - operator unspecified_bool_type() const - { - return m_ptr ? &wxScopedPtr::get : NULL; - } - - void reset(T * ptr = NULL) - { - if ( ptr != m_ptr ) - { - wxCHECKED_DELETE(m_ptr); - m_ptr = ptr; - } - } - - T *release() - { - T *ptr = m_ptr; - m_ptr = NULL; - return ptr; - } - - T & operator*() const - { - wxASSERT(m_ptr != NULL); - return *m_ptr; - } - - T * operator->() const - { - wxASSERT(m_ptr != NULL); - return m_ptr; - } - - T * get() const - { - return m_ptr; - } - - void swap(wxScopedPtr& other) - { - T * const tmp = other.m_ptr; - other.m_ptr = m_ptr; - m_ptr = tmp; - } - -private: - T * m_ptr; - - DECLARE_NO_COPY_TEMPLATE_CLASS(wxScopedPtr, T) -}; - -// ---------------------------------------------------------------------------- -// old macro based implementation -// ---------------------------------------------------------------------------- - -/* The type being used *must* be complete at the time - that wxDEFINE_SCOPED_* is called or a compiler error will result. - This is because the class checks for the completeness of the type - being used. */ - -#define wxDECLARE_SCOPED_PTR(T, name) \ -class name \ -{ \ -private: \ - T * m_ptr; \ - \ - name(name const &); \ - name & operator=(name const &); \ - \ -public: \ - wxEXPLICIT name(T * ptr = NULL) \ - : m_ptr(ptr) { } \ - \ - ~name(); \ - \ - void reset(T * ptr = NULL); \ - \ - T *release() \ - { \ - T *ptr = m_ptr; \ - m_ptr = NULL; \ - return ptr; \ - } \ - \ - T & operator*() const \ - { \ - wxASSERT(m_ptr != NULL); \ - return *m_ptr; \ - } \ - \ - T * operator->() const \ - { \ - wxASSERT(m_ptr != NULL); \ - return m_ptr; \ - } \ - \ - T * get() const \ - { \ - return m_ptr; \ - } \ - \ - void swap(name & ot) \ - { \ - T * tmp = ot.m_ptr; \ - ot.m_ptr = m_ptr; \ - m_ptr = tmp; \ - } \ -}; - -#define wxDEFINE_SCOPED_PTR(T, name)\ -void name::reset(T * ptr) \ -{ \ - if (m_ptr != ptr) \ - { \ - wxCHECKED_DELETE(m_ptr); \ - m_ptr = ptr; \ - } \ -} \ -name::~name() \ -{ \ - wxCHECKED_DELETE(m_ptr); \ -} - -// this macro can be used for the most common case when you want to declare and -// define the scoped pointer at the same time and want to use the standard -// naming convention: auto pointer to Foo is called FooPtr -#define wxDEFINE_SCOPED_PTR_TYPE(T) \ - wxDECLARE_SCOPED_PTR(T, T ## Ptr) \ - wxDEFINE_SCOPED_PTR(T, T ## Ptr) - -// ---------------------------------------------------------------------------- -// "Tied" scoped pointer: same as normal one but also sets the value of -// some other variable to the pointer value -// ---------------------------------------------------------------------------- - -#define wxDEFINE_TIED_SCOPED_PTR_TYPE(T) \ - wxDEFINE_SCOPED_PTR_TYPE(T) \ - class T ## TiedPtr : public T ## Ptr \ - { \ - public: \ - T ## TiedPtr(T **pp, T *p) \ - : T ## Ptr(p), m_pp(pp) \ - { \ - m_pOld = *pp; \ - *pp = p; \ - } \ - \ - ~ T ## TiedPtr() \ - { \ - *m_pp = m_pOld; \ - } \ - \ - private: \ - T **m_pp; \ - T *m_pOld; \ - }; - -#endif // _WX_SCOPED_PTR_H_ - diff --git a/Source/3rd Party/wx/include/wx/scopeguard.h b/Source/3rd Party/wx/include/wx/scopeguard.h index 3c80ea8a6..2517e86e4 100644 --- a/Source/3rd Party/wx/include/wx/scopeguard.h +++ b/Source/3rd Party/wx/include/wx/scopeguard.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 03.07.2003 -// RCS-ID: $Id$ +// RCS-ID: $Id: scopeguard.h 44111 2007-01-07 13:28:16Z SN $ // Copyright: (c) 2003 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -51,8 +51,14 @@ #else +#if !defined(__GNUC__) || wxCHECK_GCC_VERSION(2, 95) +// namespace support was first implemented in gcc-2.95, +// so avoid using it for older versions. namespace wxPrivate { +#else +#define wxPrivate +#endif // in the original implementation this was a member template function of // ScopeGuardImplBase but gcc 2.8 which is still used for OS/2 doesn't // support member templates and so we must make it global @@ -75,7 +81,9 @@ namespace wxPrivate void Use(const T& WXUNUSED(t)) { } +#if !defined(__GNUC__) || wxCHECK_GCC_VERSION(2, 95) } // namespace wxPrivate +#endif #define wxPrivateOnScopeExit(n) wxPrivate::OnScopeExit(n) #define wxPrivateUse(n) wxPrivate::Use(n) @@ -95,12 +103,6 @@ class wxScopeGuardImplBase public: wxScopeGuardImplBase() : m_wasDismissed(false) { } - wxScopeGuardImplBase(const wxScopeGuardImplBase& other) - : m_wasDismissed(other.m_wasDismissed) - { - other.Dismiss(); - } - void Dismiss() const { m_wasDismissed = true; } // for OnScopeExit() only (we can't make it friend, unfortunately)! @@ -109,6 +111,12 @@ public: protected: ~wxScopeGuardImplBase() { } + wxScopeGuardImplBase(const wxScopeGuardImplBase& other) + : m_wasDismissed(other.m_wasDismissed) + { + other.Dismiss(); + } + // must be mutable for copy ctor to work mutable bool m_wasDismissed; @@ -116,9 +124,6 @@ private: wxScopeGuardImplBase& operator=(const wxScopeGuardImplBase&); }; -// wxScopeGuard is just a reference, see the explanation in CUJ article -typedef const wxScopeGuardImplBase& wxScopeGuard; - // ---------------------------------------------------------------------------- // wxScopeGuardImpl0: scope guard for actions without parameters // ---------------------------------------------------------------------------- @@ -215,41 +220,6 @@ inline wxScopeGuardImpl2 wxMakeGuard(F fun, P1 p1, P2 p2) return wxScopeGuardImpl2::MakeGuard(fun, p1, p2); } -// ---------------------------------------------------------------------------- -// wxScopeGuardImpl3: scope guard for actions with 3 parameters -// ---------------------------------------------------------------------------- - -template -class wxScopeGuardImpl3 : public wxScopeGuardImplBase -{ -public: - static wxScopeGuardImpl3 MakeGuard(F fun, P1 p1, P2 p2, P3 p3) - { - return wxScopeGuardImpl3(fun, p1, p2, p3); - } - - ~wxScopeGuardImpl3() { wxPrivateOnScopeExit(*this); } - - void Execute() { m_fun(m_p1, m_p2, m_p3); } - -protected: - wxScopeGuardImpl3(F fun, P1 p1, P2 p2, P3 p3) - : m_fun(fun), m_p1(p1), m_p2(p2), m_p3(p3) { } - - F m_fun; - const P1 m_p1; - const P2 m_p2; - const P3 m_p3; - - wxScopeGuardImpl3& operator=(const wxScopeGuardImpl3&); -}; - -template -inline wxScopeGuardImpl3 wxMakeGuard(F fun, P1 p1, P2 p2, P3 p3) -{ - return wxScopeGuardImpl3::MakeGuard(fun, p1, p2, p3); -} - // ============================================================================ // wxScopeGuards for object methods // ============================================================================ @@ -348,125 +318,21 @@ wxMakeObjGuard(Obj& obj, MemFun memFun, P1 p1, P2 p2) MakeObjGuard(obj, memFun, p1, p2); } -template -class wxObjScopeGuardImpl3 : public wxScopeGuardImplBase -{ -public: - static wxObjScopeGuardImpl3 - MakeObjGuard(Obj& obj, MemFun memFun, P1 p1, P2 p2, P3 p3) - { - return wxObjScopeGuardImpl3(obj, memFun, p1, p2, p3); - } - - ~wxObjScopeGuardImpl3() { wxPrivateOnScopeExit(*this); } - - void Execute() { (m_obj.*m_memfun)(m_p1, m_p2, m_p3); } - -protected: - wxObjScopeGuardImpl3(Obj& obj, MemFun memFun, P1 p1, P2 p2, P3 p3) - : m_obj(obj), m_memfun(memFun), m_p1(p1), m_p2(p2), m_p3(p3) { } - - Obj& m_obj; - MemFun m_memfun; - const P1 m_p1; - const P2 m_p2; - const P3 m_p3; -}; - -template -inline wxObjScopeGuardImpl3 -wxMakeObjGuard(Obj& obj, MemFun memFun, P1 p1, P2 p2, P3 p3) -{ - return wxObjScopeGuardImpl3:: - MakeObjGuard(obj, memFun, p1, p2, p3); -} - -// ---------------------------------------------------------------------------- -// wxVariableSetter: use the same technique as for wxScopeGuard to allow -// setting a variable to some value on block exit -// ---------------------------------------------------------------------------- - -namespace wxPrivate -{ - -// empty class just to be able to define a reference to it -class VariableSetterBase : public wxScopeGuardImplBase { }; - -typedef const VariableSetterBase& VariableSetter; - -template -class VariableSetterImpl : public VariableSetterBase -{ -public: - VariableSetterImpl(T& var, U value) - : m_var(var), - m_value(value) - { - } - - ~VariableSetterImpl() { wxPrivateOnScopeExit(*this); } - - void Execute() { m_var = m_value; } - -private: - T& m_var; - const U m_value; - - // suppress the warning about assignment operator not being generated - VariableSetterImpl& operator=(const VariableSetterImpl&); -}; - -template -class VariableNullerImpl : public VariableSetterBase -{ -public: - VariableNullerImpl(T& var) - : m_var(var) - { - } - - ~VariableNullerImpl() { wxPrivateOnScopeExit(*this); } - - void Execute() { m_var = NULL; } - -private: - T& m_var; - - VariableNullerImpl& operator=(const VariableNullerImpl&); -}; - -} // namespace wxPrivate - -template -inline -wxPrivate::VariableSetterImpl wxMakeVarSetter(T& var, U value) -{ - return wxPrivate::VariableSetterImpl(var, value); -} - -// calling wxMakeVarSetter(ptr, NULL) doesn't work because U is deduced to be -// "int" and subsequent assignment of "U" to "T *" fails, so provide a special -// function for this special case -template -inline -wxPrivate::VariableNullerImpl wxMakeVarNuller(T& var) -{ - return wxPrivate::VariableNullerImpl(var); -} - // ============================================================================ -// macros for declaring unnamed scoped guards (which can't be dismissed) +// public stuff // ============================================================================ +// wxScopeGuard is just a reference, see the explanation in CUJ article +typedef const wxScopeGuardImplBase& wxScopeGuard; + +// when an unnamed scope guard is needed, the macros below may be used +// // NB: the original code has a single (and much nicer) ON_BLOCK_EXIT macro // but this results in compiler warnings about unused variables and I // didn't find a way to work around this other than by having different -// macros with different names or using a less natural syntax for passing -// the arguments (e.g. as Boost preprocessor sequences, which would mean -// having to write wxON_BLOCK_EXIT(fwrite, (buf)(size)(n)(fp)) instead of -// wxON_BLOCK_EXIT4(fwrite, buf, size, n, fp)). +// macros with different names -#define wxGuardName wxMAKE_UNIQUE_NAME(wxScopeGuard) +#define wxGuardName wxMAKE_UNIQUE_NAME(scopeGuard) #define wxON_BLOCK_EXIT0_IMPL(n, f) \ wxScopeGuard n = wxMakeGuard(f); \ @@ -480,10 +346,6 @@ wxPrivate::VariableNullerImpl wxMakeVarNuller(T& var) #define wxON_BLOCK_EXIT_OBJ0(o, m) \ wxON_BLOCK_EXIT_OBJ0_IMPL(wxGuardName, o, &m) -#define wxON_BLOCK_EXIT_THIS0(m) \ - wxON_BLOCK_EXIT_OBJ0(*this, m) - - #define wxON_BLOCK_EXIT1_IMPL(n, f, p1) \ wxScopeGuard n = wxMakeGuard(f, p1); \ wxPrivateUse(n) @@ -496,10 +358,6 @@ wxPrivate::VariableNullerImpl wxMakeVarNuller(T& var) #define wxON_BLOCK_EXIT_OBJ1(o, m, p1) \ wxON_BLOCK_EXIT_OBJ1_IMPL(wxGuardName, o, &m, p1) -#define wxON_BLOCK_EXIT_THIS1(m, p1) \ - wxON_BLOCK_EXIT_OBJ1(*this, m, p1) - - #define wxON_BLOCK_EXIT2_IMPL(n, f, p1, p2) \ wxScopeGuard n = wxMakeGuard(f, p1, p2); \ wxPrivateUse(n) @@ -512,40 +370,4 @@ wxPrivate::VariableNullerImpl wxMakeVarNuller(T& var) #define wxON_BLOCK_EXIT_OBJ2(o, m, p1, p2) \ wxON_BLOCK_EXIT_OBJ2_IMPL(wxGuardName, o, &m, p1, p2) -#define wxON_BLOCK_EXIT_THIS2(m, p1, p2) \ - wxON_BLOCK_EXIT_OBJ2(*this, m, p1, p2) - - -#define wxON_BLOCK_EXIT3_IMPL(n, f, p1, p2, p3) \ - wxScopeGuard n = wxMakeGuard(f, p1, p2, p3); \ - wxPrivateUse(n) -#define wxON_BLOCK_EXIT3(f, p1, p2, p3) \ - wxON_BLOCK_EXIT3_IMPL(wxGuardName, f, p1, p2, p3) - -#define wxON_BLOCK_EXIT_OBJ3_IMPL(n, o, m, p1, p2, p3) \ - wxScopeGuard n = wxMakeObjGuard(o, m, p1, p2, p3); \ - wxPrivateUse(n) -#define wxON_BLOCK_EXIT_OBJ3(o, m, p1, p2, p3) \ - wxON_BLOCK_EXIT_OBJ3_IMPL(wxGuardName, o, &m, p1, p2, p3) - -#define wxON_BLOCK_EXIT_THIS3(m, p1, p2, p3) \ - wxON_BLOCK_EXIT_OBJ3(*this, m, p1, p2, p3) - - -#define wxSetterName wxMAKE_UNIQUE_NAME(wxVarSetter) - -#define wxON_BLOCK_EXIT_SET_IMPL(n, var, value) \ - wxPrivate::VariableSetter n = wxMakeVarSetter(var, value); \ - wxPrivateUse(n) - -#define wxON_BLOCK_EXIT_SET(var, value) \ - wxON_BLOCK_EXIT_SET_IMPL(wxSetterName, var, value) - -#define wxON_BLOCK_EXIT_NULL_IMPL(n, var) \ - wxPrivate::VariableSetter n = wxMakeVarNuller(var); \ - wxPrivateUse(n) - -#define wxON_BLOCK_EXIT_NULL(ptr) \ - wxON_BLOCK_EXIT_NULL_IMPL(wxSetterName, ptr) - #endif // _WX_SCOPEGUARD_H_ diff --git a/Source/3rd Party/wx/include/wx/scrolbar.h b/Source/3rd Party/wx/include/wx/scrolbar.h index 99dbc3036..97dab1af9 100644 --- a/Source/3rd Party/wx/include/wx/scrolbar.h +++ b/Source/3rd Party/wx/include/wx/scrolbar.h @@ -1,11 +1,11 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/scrolbar.h +// Name: scrolbar.h // Purpose: wxScrollBar base header // Author: Julian Smart // Modified by: // Created: // Copyright: (c) Julian Smart -// RCS-ID: $Id$ +// RCS-ID: $Id: scrolbar.h 37066 2006-01-23 03:27:34Z MR $ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -18,21 +18,18 @@ #include "wx/control.h" -extern WXDLLIMPEXP_DATA_CORE(const char) wxScrollBarNameStr[]; +extern WXDLLEXPORT_DATA(const wxChar) wxScrollBarNameStr[]; // ---------------------------------------------------------------------------- // wxScrollBar: a scroll bar control // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxScrollBarBase : public wxControl +class WXDLLEXPORT wxScrollBarBase : public wxControl { public: wxScrollBarBase() { } - /* - Derived classes should provide the following method and ctor with the - same parameters: - + // scrollbar construction bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, @@ -40,7 +37,6 @@ public: long style = wxSB_HORIZONTAL, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxScrollBarNameStr); - */ // accessors virtual int GetThumbPosition() const = 0; @@ -56,11 +52,8 @@ public: int range, int pageSize, bool refresh = true) = 0; - // implementation-only - bool IsNeeded() const { return GetRange() > GetThumbSize(); } - private: - wxDECLARE_NO_COPY_CLASS(wxScrollBarBase); + DECLARE_NO_COPY_CLASS(wxScrollBarBase) }; #if defined(__WXUNIVERSAL__) @@ -74,7 +67,7 @@ private: #elif defined(__WXGTK__) #include "wx/gtk1/scrolbar.h" #elif defined(__WXMAC__) - #include "wx/osx/scrolbar.h" + #include "wx/mac/scrolbar.h" #elif defined(__WXCOCOA__) #include "wx/cocoa/scrolbar.h" #elif defined(__WXPM__) diff --git a/Source/3rd Party/wx/include/wx/scrolwin.h b/Source/3rd Party/wx/include/wx/scrolwin.h index 747b6e62e..c5d06fa1e 100644 --- a/Source/3rd Party/wx/include/wx/scrolwin.h +++ b/Source/3rd Party/wx/include/wx/scrolwin.h @@ -1,10 +1,10 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/scrolwin.h +// Name: include/wx/scrolwin.h // Purpose: wxScrolledWindow, wxScrolledControl and wxScrollHelper // Author: Vadim Zeitlin // Modified by: // Created: 30.08.00 -// RCS-ID: $Id$ +// RCS-ID: $Id: scrolwin.h 50864 2007-12-20 18:36:19Z VS $ // Copyright: (c) 2000 Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -15,19 +15,11 @@ #include "wx/panel.h" class WXDLLIMPEXP_FWD_CORE wxScrollHelperEvtHandler; -class WXDLLIMPEXP_FWD_BASE wxTimer; +class WXDLLIMPEXP_FWD_CORE wxTimer; // default scrolled window style: scroll in both directions #define wxScrolledWindowStyle (wxHSCROLL | wxVSCROLL) -// values for the second argument of wxScrollHelper::ShowScrollbars() -enum wxScrollbarVisibility -{ - wxSHOW_SB_NEVER = -1, // never show the scrollbar at all - wxSHOW_SB_DEFAULT, // show scrollbar only if it is needed - wxSHOW_SB_ALWAYS // always show scrollbar, even if not needed -}; - // ---------------------------------------------------------------------------- // The hierarchy of scrolling classes is a bit complicated because we want to // put as much functionality as possible in a mix-in class not deriving from @@ -37,11 +29,11 @@ enum wxScrollbarVisibility // // So we have // -// wxScrollHelperBase +// wxScrollHelper // | // | // \|/ -// wxWindow wxScrollHelper +// wxWindow wxScrollHelperNative // | \ / / // | \ / / // | _| |_ / @@ -56,12 +48,12 @@ enum wxScrollbarVisibility // // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxScrollHelperBase +class WXDLLEXPORT wxScrollHelper { public: // ctor must be given the associated window - wxScrollHelperBase(wxWindow *winToScroll); - virtual ~wxScrollHelperBase(); + wxScrollHelper(wxWindow *winToScroll); + virtual ~wxScrollHelper(); // configure the scrolling virtual void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY, @@ -70,18 +62,13 @@ public: bool noRefresh = false ); // scroll to the given (in logical coords) position - // - // notice that for backwards compatibility reasons Scroll() is virtual as - // the existing code could override it but new code should override - // DoScroll() instead - virtual void Scroll(int x, int y) { DoScroll(x, y); } - virtual void Scroll(const wxPoint& pt) { DoScroll(pt.x, pt.y); } + virtual void Scroll(int x, int y); // get/set the page size for this orientation (wxVERTICAL/wxHORIZONTAL) int GetScrollPageSize(int orient) const; void SetScrollPageSize(int orient, int pageSize); - // get the number of lines the window can scroll, + // get the number of lines the window can scroll, // returns 0 if no scrollbars are there. int GetScrollLines( int orient ) const; @@ -89,17 +76,8 @@ public: void SetScrollRate( int xstep, int ystep ); // get the size of one logical unit in physical ones - void GetScrollPixelsPerUnit(int *pixelsPerUnitX, int *pixelsPerUnitY) const; - - // Set scrollbar visibility: it is possible to show scrollbar only if it is - // needed (i.e. if our virtual size is greater than the current size of the - // associated window), always (as wxALWAYS_SHOW_SB style does) or never (in - // which case you should provide some other way to scroll the window as the - // user wouldn't be able to do it at all) - void ShowScrollbars(wxScrollbarVisibility horz, wxScrollbarVisibility vert) - { - DoShowScrollbars(horz, vert); - } + virtual void GetScrollPixelsPerUnit(int *pixelsPerUnitX, + int *pixelsPerUnitY) const; // Enable/disable Windows scrolling in either direction. If true, wxWidgets // scrolls the canvas and only a bit of the canvas is invalidated; no @@ -108,26 +86,8 @@ public: // actually scroll a non-constant distance virtual void EnableScrolling(bool x_scrolling, bool y_scrolling); - // Disable use of keyboard keys for scrolling. By default cursor movement - // keys (including Home, End, Page Up and Down) are used to scroll the - // window appropriately. If the derived class uses these keys for something - // else, e.g. changing the currently selected item, this function can be - // used to disable this behaviour as it's not only not necessary then but - // can actually be actively harmful if another object forwards a keyboard - // event corresponding to one of the above keys to us using - // ProcessWindowEvent() because the event will always be processed which - // can be undesirable. - void DisableKeyboardScrolling() { m_kbdScrollingEnabled = false; } - // Get the view start - void GetViewStart(int *x, int *y) const { DoGetViewStart(x, y); } - - wxPoint GetViewStart() const - { - wxPoint pt; - DoGetViewStart(&pt.x, &pt.y); - return pt; - } + virtual void GetViewStart(int *x, int *y) const; // Set the scale factor, used in PrepareDC void SetScale(double xs, double ys) { m_scaleX = xs; m_scaleY = ys; } @@ -153,21 +113,21 @@ public: return p2; } - void DoCalcScrolledPosition(int x, int y, int *xx, int *yy) const; - void DoCalcUnscrolledPosition(int x, int y, int *xx, int *yy) const; + virtual void DoCalcScrolledPosition(int x, int y, int *xx, int *yy) const; + virtual void DoCalcUnscrolledPosition(int x, int y, int *xx, int *yy) const; // Adjust the scrollbars - virtual void AdjustScrollbars() = 0; + virtual void AdjustScrollbars(void); // Calculate scroll increment - int CalcScrollInc(wxScrollWinEvent& event); + virtual int CalcScrollInc(wxScrollWinEvent& event); // Normally the wxScrolledWindow will scroll itself, but in some rare // occasions you might want it to scroll [part of] another window (e.g. a // child of it in order to scroll only a portion the area between the // scrollbars (spreadsheet: only cell area will move). - void SetTargetWindow(wxWindow *target); - wxWindow *GetTargetWindow() const; + virtual void SetTargetWindow(wxWindow *target); + virtual wxWindow *GetTargetWindow() const; void SetTargetRect(const wxRect& rect) { m_rectToScroll = rect; } wxRect GetTargetRect() const { return m_rectToScroll; } @@ -202,13 +162,14 @@ public: #if wxUSE_MOUSEWHEEL void HandleOnMouseWheel(wxMouseEvent& event); #endif // wxUSE_MOUSEWHEEL - void HandleOnChildFocus(wxChildFocusEvent& event); -#if WXWIN_COMPATIBILITY_2_8 - wxDEPRECATED( - void OnScroll(wxScrollWinEvent& event) { HandleOnScroll(event); } - ) -#endif // WXWIN_COMPATIBILITY_2_8 +#if wxABI_VERSION >= 20808 + void HandleOnChildFocus(wxChildFocusEvent& event); +#endif + + // FIXME: this is needed for now for wxPlot compilation, should be removed + // once it is fixed! + void OnScroll(wxScrollWinEvent& event) { HandleOnScroll(event); } protected: // get pointer to our scroll rect if we use it or NULL @@ -233,17 +194,12 @@ protected: *h = size.y; } - // implementation of public methods with the same name - virtual void DoGetViewStart(int *x, int *y) const; - virtual void DoScroll(int x, int y) = 0; - virtual void DoShowScrollbars(wxScrollbarVisibility horz, - wxScrollbarVisibility vert) = 0; - // implementations of various wxWindow virtual methods which should be // forwarded to us (this can be done by WX_FORWARD_TO_SCROLL_HELPER()) bool ScrollLayout(); void ScrollDoSetVirtualSize(int x, int y); wxSize ScrollGetBestVirtualSize() const; + wxSize ScrollGetWindowSizeForVirtualSize(const wxSize& size) const; // change just the target window (unlike SetWindow which changes m_win as // well) @@ -252,26 +208,6 @@ protected: // delete the event handler we installed void DeleteEvtHandler(); - // calls wxScrollHelperEvtHandler::ResetDrawnFlag(), see explanation - // in wxScrollHelperEvtHandler::ProcessEvent() - void ResetDrawnFlag(); - - // this function should be overridden to return the size available for - // m_targetWindow inside m_win of the given size - // - // the default implementation is only good for m_targetWindow == m_win - // case, if we're scrolling a subwindow you must override this method - virtual wxSize GetSizeAvailableForScrollTarget(const wxSize& size) - { - // returning just size from here is wrong but it was decided that it is - // not wrong enough to break the existing code (which doesn't override - // this recently added function at all) by adding this assert - // - // wxASSERT_MSG( m_targetWindow == m_win, "must be overridden" ); - - return size; - } - double m_scaleX; double m_scaleY; @@ -295,15 +231,13 @@ protected: bool m_xScrollingEnabled; bool m_yScrollingEnabled; - bool m_kbdScrollingEnabled; - #if wxUSE_MOUSEWHEEL int m_wheelRotation; #endif // wxUSE_MOUSEWHEEL wxScrollHelperEvtHandler *m_handler; - wxDECLARE_NO_COPY_CLASS(wxScrollHelperBase); + DECLARE_NO_COPY_CLASS(wxScrollHelper) }; // this macro can be used in a wxScrollHelper-derived class to forward wxWindow @@ -315,143 +249,66 @@ public: \ virtual void DoSetVirtualSize(int x, int y) \ { ScrollDoSetVirtualSize(x, y); } \ virtual wxSize GetBestVirtualSize() const \ - { return ScrollGetBestVirtualSize(); } + { return ScrollGetBestVirtualSize(); } \ +protected: \ + virtual wxSize GetWindowSizeForVirtualSize(const wxSize& size) const \ + { return ScrollGetWindowSizeForVirtualSize(size); } -// include the declaration of the real wxScrollHelper +// include the declaration of wxScrollHelperNative if needed #if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__) #include "wx/gtk/scrolwin.h" #elif defined(__WXGTK__) && !defined(__WXUNIVERSAL__) #include "wx/gtk1/scrolwin.h" #else - #define wxHAS_GENERIC_SCROLLWIN - #include "wx/generic/scrolwin.h" + typedef wxScrollHelper wxScrollHelperNative; #endif // ---------------------------------------------------------------------------- -// wxScrolled: a wxWindow which knows how to scroll +// wxScrolledWindow: a wxWindow which knows how to scroll // ---------------------------------------------------------------------------- -// helper class for wxScrolled below -struct WXDLLIMPEXP_CORE wxScrolledT_Helper -{ - static wxSize FilterBestSize(const wxWindow *win, - const wxScrollHelper *helper, - const wxSize& origBest); -#ifdef __WXMSW__ - static WXLRESULT FilterMSWWindowProc(WXUINT nMsg, WXLRESULT origResult); -#endif -}; - -// Scrollable window base on window type T. This used to be wxScrolledWindow, -// but wxScrolledWindow includes wxControlContainer functionality and that's -// not always desirable. -template -class wxScrolled : public T, - public wxScrollHelper, - private wxScrolledT_Helper +class WXDLLEXPORT wxScrolledWindow : public wxPanel, + public wxScrollHelperNative { public: - wxScrolled() : wxScrollHelper(this) { } - wxScrolled(wxWindow *parent, - wxWindowID winid = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxScrolledWindowStyle, - const wxString& name = wxPanelNameStr) - : wxScrollHelper(this) - { - Create(parent, winid, pos, size, style, name); - } - - bool Create(wxWindow *parent, - wxWindowID winid, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxScrolledWindowStyle, - const wxString& name = wxPanelNameStr) - { - m_targetWindow = this; - -#ifdef __WXMAC__ - this->MacSetClipChildren(true); -#endif - - this->Connect(wxEVT_PAINT, wxPaintEventHandler(wxScrolled::OnPaint)); - - // by default, we're scrollable in both directions (but if one of the - // styles is specified explicitly, we shouldn't add the other one - // automatically) - if ( !(style & (wxHSCROLL | wxVSCROLL)) ) - style |= wxHSCROLL | wxVSCROLL; - - return T::Create(parent, winid, pos, size, style, name); - } - - // we need to return a special WM_GETDLGCODE value to process just the - // arrows but let the other navigation characters through -#ifdef __WXMSW__ - virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) - { - return FilterMSWWindowProc(nMsg, T::MSWWindowProc(nMsg, wParam, lParam)); - } -#endif // __WXMSW__ - - WX_FORWARD_TO_SCROLL_HELPER() - -protected: - virtual wxSize DoGetBestSize() const - { - return FilterBestSize(this, this, T::DoGetBestSize()); - } - -private: - // this is needed for wxEVT_PAINT processing hack described in - // wxScrollHelperEvtHandler::ProcessEvent() - void OnPaint(wxPaintEvent& event) - { - // the user code didn't really draw the window if we got here, so set - // this flag to try to call OnDraw() later - ResetDrawnFlag(); - event.Skip(); - } - - // VC++ 6 gives warning for the declaration of template member function - // without definition -#ifndef __VISUALC6__ - wxDECLARE_NO_COPY_CLASS(wxScrolled); -#endif -}; - -#ifdef __VISUALC6__ - // disable the warning about non dll-interface class used as base for - // dll-interface class: it's harmless in this case - #pragma warning(push) - #pragma warning(disable:4275) -#endif - -// for compatibility with existing code, we provide wxScrolledWindow -// "typedef" for wxScrolled. It's not a real typedef because we -// want wxScrolledWindow to show in wxRTTI information (the class is widely -// used and likelihood of its wxRTTI information being used too is high): -class WXDLLIMPEXP_CORE wxScrolledWindow : public wxScrolled -{ -public: - wxScrolledWindow() : wxScrolled() {} + wxScrolledWindow() : wxScrollHelperNative(this) { } wxScrolledWindow(wxWindow *parent, wxWindowID winid = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxScrolledWindowStyle, const wxString& name = wxPanelNameStr) - : wxScrolled(parent, winid, pos, size, style, name) {} + : wxScrollHelperNative(this) + { + Create(parent, winid, pos, size, style, name); + } + virtual ~wxScrolledWindow(); + + bool Create(wxWindow *parent, + wxWindowID winid, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxScrolledWindowStyle, + const wxString& name = wxPanelNameStr); + + // we need to return a special WM_GETDLGCODE value to process just the + // arrows but let the other navigation characters through +#ifdef __WXMSW__ + virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); +#endif // __WXMSW__ + + WX_FORWARD_TO_SCROLL_HELPER() + +protected: + // this is needed for wxEVT_PAINT processing hack described in + // wxScrollHelperEvtHandler::ProcessEvent() + void OnPaint(wxPaintEvent& event); + +private: DECLARE_DYNAMIC_CLASS_NO_COPY(wxScrolledWindow) + DECLARE_EVENT_TABLE() }; -typedef wxScrolled wxScrolledCanvas; - -#ifdef __VISUALC6__ - #pragma warning(pop) -#endif - #endif // _WX_SCROLWIN_H_BASE_ + diff --git a/Source/3rd Party/wx/include/wx/selstore.h b/Source/3rd Party/wx/include/wx/selstore.h index 7ae71e366..56b11e4af 100644 --- a/Source/3rd Party/wx/include/wx/selstore.h +++ b/Source/3rd Party/wx/include/wx/selstore.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 08.06.03 (extracted from src/generic/listctrl.cpp) -// RCS-ID: $Id$ +// RCS-ID: $Id: selstore.h 61872 2009-09-09 22:37:05Z VZ $ // Copyright: (c) 2000-2003 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -18,12 +18,14 @@ // wxSelectedIndices is just a sorted array of indices // ---------------------------------------------------------------------------- -inline int CMPFUNC_CONV wxUIntCmp(unsigned n1, unsigned n2) +inline int CMPFUNC_CONV wxSizeTCmpFn(size_t n1, size_t n2) { return (int)(n1 - n2); } -WX_DEFINE_SORTED_EXPORTED_ARRAY_CMP_INT(unsigned, wxUIntCmp, wxSelectedIndices); +WX_DEFINE_SORTED_EXPORTED_ARRAY_CMP_SIZE_T(size_t, + wxSizeTCmpFn, + wxSelectedIndices); // ---------------------------------------------------------------------------- // wxSelectionStore is used to store the selected items in the virtual @@ -37,43 +39,43 @@ WX_DEFINE_SORTED_EXPORTED_ARRAY_CMP_INT(unsigned, wxUIntCmp, wxSelectedIndices); // individual items) without changing its API. // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxSelectionStore +class WXDLLEXPORT wxSelectionStore { public: - wxSelectionStore() : m_itemsSel(wxUIntCmp) { Init(); } + wxSelectionStore() : m_itemsSel(wxSizeTCmpFn) { Init(); } // set the total number of items we handle - void SetItemCount(unsigned count); + void SetItemCount(size_t count) { m_count = count; } // special case of SetItemCount(0) void Clear() { m_itemsSel.Clear(); m_count = 0; m_defaultState = false; } // must be called when a new item is inserted/added - void OnItemAdd(unsigned WXUNUSED(item)) { wxFAIL_MSG( wxT("TODO") ); } + void OnItemAdd(size_t WXUNUSED(item)) { wxFAIL_MSG( wxT("TODO") ); } // must be called when an item is deleted - void OnItemDelete(unsigned item); + void OnItemDelete(size_t item); // select one item, use SelectRange() insted if possible! // // returns true if the items selection really changed - bool SelectItem(unsigned item, bool select = true); + bool SelectItem(size_t item, bool select = true); - // select the range of items (inclusive) + // select the range of items // // return true and fill the itemsChanged array with the indices of items // which have changed state if "few" of them did, otherwise return false // (meaning that too many items changed state to bother counting them // individually) - bool SelectRange(unsigned itemFrom, unsigned itemTo, + bool SelectRange(size_t itemFrom, size_t itemTo, bool select = true, wxArrayInt *itemsChanged = NULL); // return true if the given item is selected - bool IsSelected(unsigned item) const; + bool IsSelected(size_t item) const; // return the total number of selected items - unsigned GetSelectedCount() const + size_t GetSelectedCount() const { return m_defaultState ? m_count - m_itemsSel.GetCount() : m_itemsSel.GetCount(); @@ -84,7 +86,7 @@ private: void Init() { m_defaultState = false; } // the total number of items we handle - unsigned m_count; + size_t m_count; // the default state: normally, false (i.e. off) but maybe set to true if // there are more selected items than non selected ones - this allows to @@ -94,8 +96,9 @@ private: // the array of items whose selection state is different from default wxSelectedIndices m_itemsSel; - wxDECLARE_NO_COPY_CLASS(wxSelectionStore); + DECLARE_NO_COPY_CLASS(wxSelectionStore) }; + #endif // _WX_SELSTORE_H_ diff --git a/Source/3rd Party/wx/include/wx/settings.h b/Source/3rd Party/wx/include/wx/settings.h index 10bfcf6f1..5d732d0d2 100644 --- a/Source/3rd Party/wx/include/wx/settings.h +++ b/Source/3rd Party/wx/include/wx/settings.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: settings.h 67017 2011-02-25 09:37:28Z JS $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -28,15 +28,8 @@ enum wxSystemFont wxSYS_ANSI_VAR_FONT, wxSYS_SYSTEM_FONT, wxSYS_DEVICE_DEFAULT_FONT, - - // don't use: this is here just to make the values of enum elements - // coincide with the corresponding MSW constants wxSYS_DEFAULT_PALETTE, - - // don't use: MSDN says that this is a stock object provided only - // for compatibility with 16-bit Windows versions earlier than 3.0! wxSYS_SYSTEM_FIXED_FONT, - wxSYS_DEFAULT_GUI_FONT, // this was just a temporary aberration, do not use it any more @@ -50,7 +43,8 @@ enum wxSystemFont enum wxSystemColour { wxSYS_COLOUR_SCROLLBAR, - wxSYS_COLOUR_DESKTOP, + wxSYS_COLOUR_BACKGROUND, + wxSYS_COLOUR_DESKTOP = wxSYS_COLOUR_BACKGROUND, wxSYS_COLOUR_ACTIVECAPTION, wxSYS_COLOUR_INACTIVECAPTION, wxSYS_COLOUR_MENU, @@ -65,11 +59,16 @@ enum wxSystemColour wxSYS_COLOUR_HIGHLIGHT, wxSYS_COLOUR_HIGHLIGHTTEXT, wxSYS_COLOUR_BTNFACE, + wxSYS_COLOUR_3DFACE = wxSYS_COLOUR_BTNFACE, wxSYS_COLOUR_BTNSHADOW, + wxSYS_COLOUR_3DSHADOW = wxSYS_COLOUR_BTNSHADOW, wxSYS_COLOUR_GRAYTEXT, wxSYS_COLOUR_BTNTEXT, wxSYS_COLOUR_INACTIVECAPTIONTEXT, wxSYS_COLOUR_BTNHIGHLIGHT, + wxSYS_COLOUR_BTNHILIGHT = wxSYS_COLOUR_BTNHIGHLIGHT, + wxSYS_COLOUR_3DHIGHLIGHT = wxSYS_COLOUR_BTNHIGHLIGHT, + wxSYS_COLOUR_3DHILIGHT = wxSYS_COLOUR_BTNHIGHLIGHT, wxSYS_COLOUR_3DDKSHADOW, wxSYS_COLOUR_3DLIGHT, wxSYS_COLOUR_INFOTEXT, @@ -83,16 +82,7 @@ enum wxSystemColour wxSYS_COLOUR_LISTBOXTEXT, wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT, - wxSYS_COLOUR_MAX, - - // synonyms - wxSYS_COLOUR_BACKGROUND = wxSYS_COLOUR_DESKTOP, - wxSYS_COLOUR_3DFACE = wxSYS_COLOUR_BTNFACE, - wxSYS_COLOUR_3DSHADOW = wxSYS_COLOUR_BTNSHADOW, - wxSYS_COLOUR_BTNHILIGHT = wxSYS_COLOUR_BTNHIGHLIGHT, - wxSYS_COLOUR_3DHIGHLIGHT = wxSYS_COLOUR_BTNHIGHLIGHT, - wxSYS_COLOUR_3DHILIGHT = wxSYS_COLOUR_BTNHIGHLIGHT, - wxSYS_COLOUR_FRAMEBK = wxSYS_COLOUR_BTNFACE + wxSYS_COLOUR_MAX }; // possible values for wxSystemSettings::GetMetric() index parameter @@ -137,8 +127,7 @@ enum wxSystemMetric wxSYS_NETWORK_PRESENT, wxSYS_PENWINDOWS_PRESENT, wxSYS_SHOW_SOUNDS, - wxSYS_SWAP_BUTTONS, - wxSYS_DCLICK_MSEC + wxSYS_SWAP_BUTTONS }; // possible values for wxSystemSettings::HasFeature() parameter @@ -171,7 +160,7 @@ enum wxSystemScreenType // files (i.e. this is not a real base class as we can't override its virtual // functions because it doesn't have any) -class WXDLLIMPEXP_CORE wxSystemSettingsNative +class WXDLLEXPORT wxSystemSettingsNative { public: // get a standard system colour @@ -191,7 +180,7 @@ public: // include the declaration of the real platform-dependent class // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxSystemSettings : public wxSystemSettingsNative +class WXDLLEXPORT wxSystemSettings : public wxSystemSettingsNative { public: #ifdef __WXUNIVERSAL__ @@ -199,10 +188,6 @@ public: // system ones, otherwise wxSystemSettings is just the same as // wxSystemSettingsNative static wxColour GetColour(wxSystemColour index); - - // some metrics are toolkit-dependent and provided by wxUniv, some are - // lowlevel - static int GetMetric(wxSystemMetric index, wxWindow *win = NULL); #endif // __WXUNIVERSAL__ // Get system screen design (desktop, pda, ..) used for @@ -215,6 +200,13 @@ public: // Value static wxSystemScreenType ms_screen; +#if WXWIN_COMPATIBILITY_2_4 + // the backwards compatible versions of wxSystemSettingsNative functions, + // don't use these methods in the new code! + wxDEPRECATED(static wxColour GetSystemColour(int index)); + wxDEPRECATED(static wxFont GetSystemFont(int index)); + wxDEPRECATED(static int GetSystemMetric(int index)); +#endif }; #endif diff --git a/Source/3rd Party/wx/include/wx/sharedptr.h b/Source/3rd Party/wx/include/wx/sharedptr.h deleted file mode 100644 index ed4735f19..000000000 --- a/Source/3rd Party/wx/include/wx/sharedptr.h +++ /dev/null @@ -1,141 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/sharedptr.h -// Purpose: Shared pointer based on the counted_ptr<> template, which -// is in the public domain -// Author: Robert Roebling, Yonat Sharon -// RCS-ID: $Id$ -// Copyright: Robert Roebling -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_SHAREDPTR_H_ -#define _WX_SHAREDPTR_H_ - -#include "wx/defs.h" -#include "wx/atomic.h" - -// ---------------------------------------------------------------------------- -// wxSharedPtr: A smart pointer with non-intrusive reference counting. -// ---------------------------------------------------------------------------- - -template -class wxSharedPtr -{ -public: - typedef T element_type; - - wxEXPLICIT wxSharedPtr( T* ptr = NULL ) - : m_ref(NULL) - { - if (ptr) - m_ref = new reftype(ptr); - } - - ~wxSharedPtr() { Release(); } - wxSharedPtr(const wxSharedPtr& tocopy) { Acquire(tocopy.m_ref); } - - wxSharedPtr& operator=( const wxSharedPtr& tocopy ) - { - if (this != &tocopy) - { - Release(); - Acquire(tocopy.m_ref); - } - return *this; - } - - wxSharedPtr& operator=( T* ptr ) - { - if (get() != ptr) - { - Release(); - if (ptr) - m_ref = new reftype(ptr); - } - return *this; - } - - // test for pointer validity: defining conversion to unspecified_bool_type - // and not more obvious bool to avoid implicit conversions to integer types - typedef T *(wxSharedPtr::*unspecified_bool_type)() const; - operator unspecified_bool_type() const - { - if (m_ref && m_ref->m_ptr) - return &wxSharedPtr::get; - else - return NULL; - } - - T& operator*() const - { - wxASSERT(m_ref != NULL); - wxASSERT(m_ref->m_ptr != NULL); - return *(m_ref->m_ptr); - } - - T* operator->() const - { - wxASSERT(m_ref != NULL); - wxASSERT(m_ref->m_ptr != NULL); - return m_ref->m_ptr; - } - - T* get() const - { - return m_ref ? m_ref->m_ptr : NULL; - } - - void reset( T* ptr = NULL ) - { - Release(); - if (ptr) - m_ref = new reftype(ptr); - } - - bool unique() const { return (m_ref ? m_ref->m_count == 1 : true); } - long use_count() const { return (m_ref ? (long)m_ref->m_count : 0); } - -private: - - struct reftype - { - reftype( T* ptr = NULL, unsigned count = 1 ) : m_ptr(ptr), m_count(count) {} - T* m_ptr; - wxAtomicInt m_count; - }* m_ref; - - void Acquire(reftype* ref) - { - m_ref = ref; - if (ref) - wxAtomicInc( ref->m_count ); - } - - void Release() - { - if (m_ref) - { - wxAtomicDec( m_ref->m_count ); - if (m_ref->m_count == 0) - { - delete m_ref->m_ptr; - delete m_ref; - } - m_ref = NULL; - } - } -}; - -template -bool operator == (wxSharedPtr const &a, wxSharedPtr const &b ) -{ - return a.get() == b.get(); -} - -template -bool operator != (wxSharedPtr const &a, wxSharedPtr const &b ) -{ - return a.get() != b.get(); -} - -#endif // _WX_SHAREDPTR_H_ diff --git a/Source/3rd Party/wx/include/wx/sizer.h b/Source/3rd Party/wx/include/wx/sizer.h index 3c53081c3..e95ab437e 100644 --- a/Source/3rd Party/wx/include/wx/sizer.h +++ b/Source/3rd Party/wx/include/wx/sizer.h @@ -4,7 +4,7 @@ // Author: Robert Roebling and Robin Dunn // Modified by: Ron Lee, Vadim Zeitlin (wxSizerFlags) // Created: -// RCS-ID: $Id$ +// RCS-ID: $Id: sizer.h 52331 2008-03-05 15:02:22Z VS $ // Copyright: (c) Robin Dunn, Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -24,6 +24,8 @@ class WXDLLIMPEXP_FWD_CORE wxButton; class WXDLLIMPEXP_FWD_CORE wxBoxSizer; class WXDLLIMPEXP_FWD_CORE wxSizerItem; class WXDLLIMPEXP_FWD_CORE wxSizer; +class WXDLLIMPEXP_FWD_CORE wxFlexGridSizer; +class WXDLLIMPEXP_FWD_CORE wxGridBagSizer; #ifndef wxUSE_BORDER_BY_DEFAULT #ifdef __SMARTPHONE__ @@ -38,7 +40,7 @@ class WXDLLIMPEXP_FWD_CORE wxSizer; // wxSizerFlags: flags used for an item in the sizer // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxSizerFlags +class WXDLLEXPORT wxSizerFlags { public: // construct the flags object initialized with the given proportion (0 by @@ -58,15 +60,6 @@ public: return *this; } - wxSizerFlags& Expand() - { - m_flags |= wxEXPAND; - return *this; - } - - // notice that Align() replaces the current alignment flags, use specific - // methods below such as Top(), Left() &c if you want to set just the - // vertical or horizontal alignment wxSizerFlags& Align(int alignment) // combination of wxAlignment values { m_flags &= ~wxALIGN_MASK; @@ -75,48 +68,30 @@ public: return *this; } + wxSizerFlags& Expand() + { + m_flags |= wxEXPAND; + return *this; + } + // some shortcuts for Align() - wxSizerFlags& Centre() { return Align(wxALIGN_CENTRE); } + wxSizerFlags& Centre() { return Align(wxCENTRE); } wxSizerFlags& Center() { return Centre(); } + wxSizerFlags& Left() { return Align(wxALIGN_LEFT); } + wxSizerFlags& Right() { return Align(wxALIGN_RIGHT); } - wxSizerFlags& Top() - { - m_flags &= ~(wxALIGN_BOTTOM | wxALIGN_CENTRE_VERTICAL); - return *this; - } - - wxSizerFlags& Left() - { - m_flags &= ~(wxALIGN_RIGHT | wxALIGN_CENTRE_HORIZONTAL); - return *this; - } - - wxSizerFlags& Right() - { - m_flags = (m_flags & ~wxALIGN_CENTRE_HORIZONTAL) | wxALIGN_RIGHT; - return *this; - } - - wxSizerFlags& Bottom() - { - m_flags = (m_flags & ~wxALIGN_CENTRE_VERTICAL) | wxALIGN_BOTTOM; - return *this; - } - +#if wxABI_VERSION >= 20802 + wxSizerFlags& Top() { return Align(wxALIGN_TOP); } + wxSizerFlags& Bottom() { return Align(wxALIGN_BOTTOM); } +#endif // wxABI 2.8.2+ // default border size used by Border() below static int GetDefaultBorder() { #if wxUSE_BORDER_BY_DEFAULT - #ifdef __WXGTK20__ - // GNOME HIG says to use 6px as the base unit: - // http://library.gnome.org/devel/hig-book/stable/design-window.html.en - return 6; - #else // FIXME: default border size shouldn't be hardcoded and at the very // least they should depend on the current font size return 5; - #endif #else return 0; #endif @@ -185,6 +160,7 @@ public: #endif } +#if wxABI_VERSION >= 20802 // setters for the others flags wxSizerFlags& Shaped() { @@ -199,13 +175,12 @@ public: return *this; } +#endif // wx 2.8.2+ +#if wxABI_VERSION >= 20808 // makes the item ignore window's visibility status - wxSizerFlags& ReserveSpaceEvenIfHidden() - { - m_flags |= wxRESERVE_SPACE_EVEN_IF_HIDDEN; - return *this; - } + wxSizerFlags& ReserveSpaceEvenIfHidden(); +#endif // accessors for wxSizer only int GetProportion() const { return m_proportion; } @@ -223,7 +198,7 @@ private: // wxSizerSpacer: used by wxSizerItem to represent a spacer // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxSizerSpacer +class WXDLLEXPORT wxSizerSpacer { public: wxSizerSpacer(const wxSize& size) : m_size(size), m_isShown(true) { } @@ -246,53 +221,53 @@ private: // wxSizerItem // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxSizerItem : public wxObject +class WXDLLEXPORT wxSizerItem : public wxObject { public: // window wxSizerItem( wxWindow *window, - int proportion=0, - int flag=0, - int border=0, - wxObject* userData=NULL ); + int proportion, + int flag, + int border, + wxObject* userData ); // window with flags wxSizerItem(wxWindow *window, const wxSizerFlags& flags) { Init(flags); - DoSetWindow(window); + SetWindow(window); } // subsizer wxSizerItem( wxSizer *sizer, - int proportion=0, - int flag=0, - int border=0, - wxObject* userData=NULL ); + int proportion, + int flag, + int border, + wxObject* userData ); // sizer with flags wxSizerItem(wxSizer *sizer, const wxSizerFlags& flags) { Init(flags); - DoSetSizer(sizer); + SetSizer(sizer); } // spacer wxSizerItem( int width, int height, - int proportion=0, - int flag=0, - int border=0, - wxObject* userData=NULL); + int proportion, + int flag, + int border, + wxObject* userData); // spacer with flags wxSizerItem(int width, int height, const wxSizerFlags& flags) { Init(flags); - DoSetSpacer(wxSize(width, height)); + SetSpacer(width, height); } wxSizerItem(); @@ -335,11 +310,6 @@ public: virtual wxRect GetRect() { return m_rect; } - // set a sizer item id (different from a window id, all sizer items, - // including spacers, can have an associated id) - void SetId(int id) { m_id = id; } - int GetId() const { return m_id; } - bool IsWindow() const { return m_kind == Item_Window; } bool IsSizer() const { return m_kind == Item_Sizer; } bool IsSpacer() const { return m_kind == Item_Spacer; } @@ -369,12 +339,10 @@ public: { return m_kind == Item_Sizer ? m_sizer : NULL; } wxSize GetSpacer() const; - // This function behaves obviously for the windows and spacers but for the + // this function behaves obviously for the windows and spacers but for the // sizers it returns true if any sizer element is shown and only returns - // false if all of them are hidden. Also, it always returns true if - // wxRESERVE_SPACE_EVEN_IF_HIDDEN flag was used. + // false if all of them are hidden bool IsShown() const; - void Show(bool show); void SetUserData(wxObject* userData) @@ -384,57 +352,20 @@ public: wxPoint GetPosition() const { return m_pos; } - // Called once the first component of an item has been decided. This is - // used in algorithms that depend on knowing the size in one direction - // before the min size in the other direction can be known. - // Returns true if it made use of the information (and min size was changed). - bool InformFirstDirection( int direction, int size, int availableOtherDir=-1 ); - // these functions delete the current contents of the item if it's a sizer - // or a spacer but not if it is a window - void AssignWindow(wxWindow *window) - { - Free(); - DoSetWindow(window); - } - - void AssignSizer(wxSizer *sizer) - { - Free(); - DoSetSizer(sizer); - } - - void AssignSpacer(const wxSize& size) - { - Free(); - DoSetSpacer(size); - } - - void AssignSpacer(int w, int h) { AssignSpacer(wxSize(w, h)); } - -#if WXWIN_COMPATIBILITY_2_8 - // these functions do not free the old sizer/spacer and so can easily - // provoke the memory leaks and so shouldn't be used, use Assign() instead - wxDEPRECATED( void SetWindow(wxWindow *window) ); - wxDEPRECATED( void SetSizer(wxSizer *sizer) ); - wxDEPRECATED( void SetSpacer(const wxSize& size) ); - wxDEPRECATED( void SetSpacer(int width, int height) ); -#endif // WXWIN_COMPATIBILITY_2_8 + // these functions do not free old sizer/spacer + void SetWindow(wxWindow *window); + void SetSizer(wxSizer *sizer); + void SetSpacer(const wxSize& size); + void SetSpacer(int width, int height) { SetSpacer(wxSize(width, height)); } protected: // common part of several ctors - void Init() { m_userData = NULL; m_kind = Item_None; } + void Init() { m_userData = NULL; } // common part of ctors taking wxSizerFlags void Init(const wxSizerFlags& flags); - // free current contents - void Free(); - - // common parts of Set/AssignXXX() - void DoSetWindow(wxWindow *window); - void DoSetSizer(wxSizer *sizer); - void DoSetSpacer(const wxSize& size); // discriminated union: depending on m_kind one of the fields is valid enum @@ -457,7 +388,6 @@ protected: int m_proportion; int m_border; int m_flag; - int m_id; // on screen rectangle of this item (not including borders) wxRect m_rect; @@ -470,8 +400,15 @@ protected: wxObject *m_userData; private: + // 2.8-only implementation detail for wxRESERVE_SPACE_EVEN_IF_HIDDEN + bool ShouldAccountFor() const; + DECLARE_CLASS(wxSizerItem) - wxDECLARE_NO_COPY_CLASS(wxSizerItem); + DECLARE_NO_COPY_CLASS(wxSizerItem) + + friend class wxBoxSizer; + friend class wxFlexGridSizer; + friend class wxGridBagSizer; }; WX_DECLARE_EXPORTED_LIST( wxSizerItem, wxSizerItemList ); @@ -481,7 +418,7 @@ WX_DECLARE_EXPORTED_LIST( wxSizerItem, wxSizerItemList ); // wxSizer //--------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxSizer: public wxObject, public wxClientDataContainer +class WXDLLEXPORT wxSizer: public wxObject, public wxClientDataContainer { public: wxSizer() { m_containingWindow = NULL; } @@ -507,10 +444,9 @@ public: wxObject* userData = NULL); wxSizerItem* Add( wxWindow *window, const wxSizerFlags& flags); wxSizerItem* Add( wxSizer *sizer, const wxSizerFlags& flags); - wxSizerItem* Add( int width, int height, const wxSizerFlags& flags); wxSizerItem* Add( wxSizerItem *item); - virtual wxSizerItem *AddSpacer(int size); + wxSizerItem* AddSpacer(int size); wxSizerItem* AddStretchSpacer(int prop = 1); wxSizerItem* Insert(size_t index, @@ -538,15 +474,7 @@ public: wxSizerItem* Insert(size_t index, wxSizer *sizer, const wxSizerFlags& flags); - wxSizerItem* Insert(size_t index, - int width, - int height, - const wxSizerFlags& flags); - - // NB: do _not_ override this function in the derived classes, this one is - // virtual for compatibility reasons only to allow old code overriding - // it to continue to work, override DoInsert() instead in the new code - virtual wxSizerItem* Insert(size_t index, wxSizerItem *item); + virtual wxSizerItem* Insert( size_t index, wxSizerItem *item); wxSizerItem* InsertSpacer(size_t index, int size); wxSizerItem* InsertStretchSpacer(size_t index, int prop = 1); @@ -569,7 +497,6 @@ public: wxObject* userData = NULL); wxSizerItem* Prepend(wxWindow *window, const wxSizerFlags& flags); wxSizerItem* Prepend(wxSizer *sizer, const wxSizerFlags& flags); - wxSizerItem* Prepend(int width, int height, const wxSizerFlags& flags); wxSizerItem* Prepend(wxSizerItem *item); wxSizerItem* PrependSpacer(int size); @@ -600,11 +527,6 @@ public: virtual void Clear( bool delete_windows = false ); virtual void DeleteWindows(); - // Inform sizer about the first direction that has been decided (by parent item) - // Returns true if it made use of the informtion (and recalculated min size) - virtual bool InformFirstDirection( int WXUNUSED(direction), int WXUNUSED(size), int WXUNUSED(availableOtherDir) ) - { return false; } - void SetMinSize( int width, int height ) { DoSetMinSize( width, height ); } void SetMinSize( const wxSize& size ) @@ -635,51 +557,29 @@ public: // Calculate the minimal size or return m_minSize if bigger. wxSize GetMinSize(); - // These virtual functions are used by the layout algorithm: first - // CalcMin() is called to calculate the minimal size of the sizer and - // prepare for laying it out and then RecalcSizes() is called to really - // update all the sizer items - virtual wxSize CalcMin() = 0; virtual void RecalcSizes() = 0; + virtual wxSize CalcMin() = 0; virtual void Layout(); +#if wxABI_VERSION >= 20808 wxSize ComputeFittingClientSize(wxWindow *window); wxSize ComputeFittingWindowSize(wxWindow *window); +#endif wxSize Fit( wxWindow *window ); void FitInside( wxWindow *window ); void SetSizeHints( wxWindow *window ); -#if WXWIN_COMPATIBILITY_2_8 - // This only calls FitInside() since 2.9 - wxDEPRECATED( void SetVirtualSizeHints( wxWindow *window ) ); -#endif + void SetVirtualSizeHints( wxWindow *window ); wxSizerItemList& GetChildren() { return m_children; } - const wxSizerItemList& GetChildren() const - { return m_children; } - void SetDimension(const wxPoint& pos, const wxSize& size) - { - m_position = pos; - m_size = size; - Layout(); - - // This call is required for wxWrapSizer to be able to calculate its - // minimal size correctly. - InformFirstDirection(wxHORIZONTAL, size.x, size.y); - } - void SetDimension(int x, int y, int width, int height) - { SetDimension(wxPoint(x, y), wxSize(width, height)); } - - size_t GetItemCount() const { return m_children.GetCount(); } - bool IsEmpty() const { return m_children.IsEmpty(); } + void SetDimension( int x, int y, int width, int height ); wxSizerItem* GetItem( wxWindow *window, bool recursive = false ); wxSizerItem* GetItem( wxSizer *sizer, bool recursive = false ); wxSizerItem* GetItem( size_t index ); - wxSizerItem* GetItemById( int id, bool recursive = false ); // Manage whether individual scene items are considered // in the layout calculations or not. @@ -712,6 +612,8 @@ protected: // the window this sizer is used in, can be NULL wxWindow *m_containingWindow; + wxSize GetMaxWindowSize( wxWindow *window ) const; + wxSize GetMinWindowSize( wxWindow *window ); wxSize GetMaxClientSize( wxWindow *window ) const; wxSize GetMinClientSize( wxWindow *window ); wxSize VirtualFitSize( wxWindow *window ); @@ -721,10 +623,6 @@ protected: virtual bool DoSetItemMinSize( wxSizer *sizer, int width, int height ); virtual bool DoSetItemMinSize( size_t index, int width, int height ); - // insert a new item into m_children at given index and return the item - // itself - virtual wxSizerItem* DoInsert(size_t index, wxSizerItem *item); - private: DECLARE_CLASS(wxSizer) }; @@ -733,33 +631,17 @@ private: // wxGridSizer //--------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxGridSizer: public wxSizer +class WXDLLEXPORT wxGridSizer: public wxSizer { public: - // ctors specifying the number of columns only: number of rows will be - // deduced automatically depending on the number of sizer elements - wxGridSizer( int cols, int vgap, int hgap ); - wxGridSizer( int cols, const wxSize& gap = wxSize(0, 0) ); - - // ctors specifying the number of rows and columns wxGridSizer( int rows, int cols, int vgap, int hgap ); - wxGridSizer( int rows, int cols, const wxSize& gap ); + wxGridSizer( int cols, int vgap = 0, int hgap = 0 ); virtual void RecalcSizes(); virtual wxSize CalcMin(); - void SetCols( int cols ) - { - wxASSERT_MSG( cols >= 0, "Number of columns must be non-negative"); - m_cols = cols; - } - - void SetRows( int rows ) - { - wxASSERT_MSG( rows >= 0, "Number of rows must be non-negative"); - m_rows = rows; - } - + void SetCols( int cols ) { m_cols = cols; } + void SetRows( int rows ) { m_rows = rows; } void SetVGap( int gap ) { m_vgap = gap; } void SetHGap( int gap ) { m_hgap = gap; } int GetCols() const { return m_cols; } @@ -767,51 +649,17 @@ public: int GetVGap() const { return m_vgap; } int GetHGap() const { return m_hgap; } - int GetEffectiveColsCount() const { return m_cols ? m_cols : CalcCols(); } - int GetEffectiveRowsCount() const { return m_rows ? m_rows : CalcRows(); } - - // return the number of total items and the number of columns and rows - // (for internal use only) - int CalcRowsCols(int& rows, int& cols) const; - protected: - // the number of rows/columns in the sizer, if 0 then it is determined - // dynamically depending on the total number of items int m_rows; int m_cols; - - // gaps between rows and columns int m_vgap; int m_hgap; - virtual wxSizerItem *DoInsert(size_t index, wxSizerItem *item); + // return the number of total items and the number of columns and rows + int CalcRowsCols(int& rows, int& cols) const; void SetItemBounds( wxSizerItem *item, int x, int y, int w, int h ); - // returns the number of columns/rows needed for the current total number - // of children (and the fixed number of rows/columns) - int CalcCols() const - { - wxCHECK_MSG - ( - m_rows, 0, - "Can't calculate number of cols if number of rows is not specified" - ); - - return (m_children.GetCount() + m_rows - 1) / m_rows; - } - - int CalcRows() const - { - wxCHECK_MSG - ( - m_cols, 0, - "Can't calculate number of cols if number of rows is not specified" - ); - - return (m_children.GetCount() + m_cols - 1) / m_cols; - } - private: DECLARE_CLASS(wxGridSizer) }; @@ -820,8 +668,8 @@ private: // wxFlexGridSizer //--------------------------------------------------------------------------- -// values which define the behaviour for resizing wxFlexGridSizer cells in the -// "non-flexible" direction +// the bevaiour for resizing wxFlexGridSizer cells in the "non-flexible" +// direction enum wxFlexSizerGrowMode { // don't resize the cells in non-flexible direction at all @@ -834,21 +682,15 @@ enum wxFlexSizerGrowMode wxFLEX_GROWMODE_ALL }; -class WXDLLIMPEXP_CORE wxFlexGridSizer: public wxGridSizer +class WXDLLEXPORT wxFlexGridSizer: public wxGridSizer { public: - // ctors specifying the number of columns only: number of rows will be - // deduced automatically depending on the number of sizer elements - wxFlexGridSizer( int cols, int vgap, int hgap ); - wxFlexGridSizer( int cols, const wxSize& gap = wxSize(0, 0) ); - - // ctors specifying the number of rows and columns + // ctors/dtor wxFlexGridSizer( int rows, int cols, int vgap, int hgap ); - wxFlexGridSizer( int rows, int cols, const wxSize& gap ); - - // dtor + wxFlexGridSizer( int cols, int vgap = 0, int hgap = 0 ); virtual ~wxFlexGridSizer(); + // set the rows/columns which will grow (the others will remain of the // constant initial size) void AddGrowableRow( size_t idx, int proportion = 0 ); @@ -856,8 +698,6 @@ public: void AddGrowableCol( size_t idx, int proportion = 0 ); void RemoveGrowableCol( size_t idx ); - bool IsRowGrowable( size_t idx ); - bool IsColGrowable( size_t idx ); // the sizer cells may grow in both directions, not grow at all or only // grow in one direction but not the other @@ -881,8 +721,8 @@ public: protected: void AdjustForFlexDirection(); - void AdjustForGrowables(const wxSize& sz); - void FindWidthsAndHeights(int nrows, int ncols); + void AdjustForGrowables(const wxSize& sz, const wxSize& minsz, + int nrows, int ncols); // the heights/widths of all rows/columns wxArrayInt m_rowHeights, @@ -906,93 +746,34 @@ protected: private: DECLARE_CLASS(wxFlexGridSizer) - wxDECLARE_NO_COPY_CLASS(wxFlexGridSizer); + DECLARE_NO_COPY_CLASS(wxFlexGridSizer) }; //--------------------------------------------------------------------------- // wxBoxSizer //--------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxBoxSizer: public wxSizer +class WXDLLEXPORT wxBoxSizer: public wxSizer { public: - wxBoxSizer(int orient) - { - m_orient = orient; - m_totalProportion = 0; + wxBoxSizer( int orient ); - wxASSERT_MSG( m_orient == wxHORIZONTAL || m_orient == wxVERTICAL, - wxT("invalid value for wxBoxSizer orientation") ); - } + void RecalcSizes(); + wxSize CalcMin(); - virtual wxSizerItem *AddSpacer(int size); + int GetOrientation() const + { return m_orient; } - int GetOrientation() const { return m_orient; } - - bool IsVertical() const { return m_orient == wxVERTICAL; } - - void SetOrientation(int orient) { m_orient = orient; } - - // implementation of our resizing logic - virtual wxSize CalcMin(); - virtual void RecalcSizes(); + void SetOrientation(int orient) + { m_orient = orient; } protected: - // helpers for our code: this returns the component of the given wxSize in - // the direction of the sizer and in the other direction, respectively - int GetSizeInMajorDir(const wxSize& sz) const - { - return m_orient == wxHORIZONTAL ? sz.x : sz.y; - } - - int& SizeInMajorDir(wxSize& sz) - { - return m_orient == wxHORIZONTAL ? sz.x : sz.y; - } - - int& PosInMajorDir(wxPoint& pt) - { - return m_orient == wxHORIZONTAL ? pt.x : pt.y; - } - - int GetSizeInMinorDir(const wxSize& sz) const - { - return m_orient == wxHORIZONTAL ? sz.y : sz.x; - } - - int& SizeInMinorDir(wxSize& sz) - { - return m_orient == wxHORIZONTAL ? sz.y : sz.x; - } - - int& PosInMinorDir(wxPoint& pt) - { - return m_orient == wxHORIZONTAL ? pt.y : pt.x; - } - - // another helper: creates wxSize from major and minor components - wxSize SizeFromMajorMinor(int major, int minor) const - { - if ( m_orient == wxHORIZONTAL ) - { - return wxSize(major, minor); - } - else // wxVERTICAL - { - return wxSize(minor, major); - } - } - - - // either wxHORIZONTAL or wxVERTICAL int m_orient; - - // the sum of proportion of all of our elements - int m_totalProportion; - - // the minimal size needed for this sizer as calculated by the last call to - // our CalcMin() - wxSize m_minSize; + int m_stretchable; + int m_minWidth; + int m_minHeight; + int m_fixedWidth; + int m_fixedHeight; private: DECLARE_CLASS(wxBoxSizer) @@ -1006,7 +787,7 @@ private: class WXDLLIMPEXP_FWD_CORE wxStaticBox; -class WXDLLIMPEXP_CORE wxStaticBoxSizer: public wxBoxSizer +class WXDLLEXPORT wxStaticBoxSizer: public wxBoxSizer { public: wxStaticBoxSizer(wxStaticBox *box, int orient); @@ -1031,18 +812,14 @@ protected: private: DECLARE_CLASS(wxStaticBoxSizer) - wxDECLARE_NO_COPY_CLASS(wxStaticBoxSizer); + DECLARE_NO_COPY_CLASS(wxStaticBoxSizer) }; #endif // wxUSE_STATBOX -//--------------------------------------------------------------------------- -// wxStdDialogButtonSizer -//--------------------------------------------------------------------------- - #if wxUSE_BUTTON -class WXDLLIMPEXP_CORE wxStdDialogButtonSizer: public wxBoxSizer +class WXDLLEXPORT wxStdDialogButtonSizer: public wxBoxSizer { public: // Constructor just creates a new wxBoxSizer, not much else. @@ -1076,54 +853,87 @@ public: protected: wxButton *m_buttonAffirmative; // wxID_OK, wxID_YES, wxID_SAVE go here - wxButton *m_buttonApply; // wxID_APPLY + wxButton *m_buttonApply; wxButton *m_buttonNegative; // wxID_NO - wxButton *m_buttonCancel; // wxID_CANCEL, wxID_CLOSE - wxButton *m_buttonHelp; // wxID_HELP, wxID_CONTEXT_HELP + wxButton *m_buttonCancel; + wxButton *m_buttonHelp; private: DECLARE_CLASS(wxStdDialogButtonSizer) - wxDECLARE_NO_COPY_CLASS(wxStdDialogButtonSizer); + DECLARE_NO_COPY_CLASS(wxStdDialogButtonSizer) }; #endif // wxUSE_BUTTON +#if WXWIN_COMPATIBILITY_2_4 +// NB: wxBookCtrlSizer and wxNotebookSizer are deprecated, they +// don't do anything. wxBookCtrlBase::DoGetBestSize does the job now. + +// ---------------------------------------------------------------------------- +// wxBookCtrlSizer +// ---------------------------------------------------------------------------- + +#if wxUSE_BOOKCTRL + +// this sizer works with wxNotebook/wxListbook/... and sizes the control to +// fit its pages +class WXDLLIMPEXP_FWD_CORE wxBookCtrlBase; + +class WXDLLEXPORT wxBookCtrlSizer : public wxSizer +{ +public: +#if WXWIN_COMPATIBILITY_2_6 + wxDEPRECATED( wxBookCtrlSizer(wxBookCtrlBase *bookctrl) ); +#endif // WXWIN_COMPATIBILITY_2_6 + + wxBookCtrlBase *GetControl() const { return m_bookctrl; } + + virtual void RecalcSizes(); + virtual wxSize CalcMin(); + +protected: + // this protected ctor lets us mark the real one above as deprecated + // and still have warning-free build of the library itself: + wxBookCtrlSizer() {} + + wxBookCtrlBase *m_bookctrl; + +private: + DECLARE_CLASS(wxBookCtrlSizer) + DECLARE_NO_COPY_CLASS(wxBookCtrlSizer) +}; + + +#if wxUSE_NOTEBOOK + +// before wxBookCtrlBase we only had wxNotebookSizer, keep it for backwards +// compatibility +class WXDLLIMPEXP_FWD_CORE wxNotebook; + +class WXDLLEXPORT wxNotebookSizer : public wxBookCtrlSizer +{ +public: +#if WXWIN_COMPATIBILITY_2_6 + wxDEPRECATED( wxNotebookSizer(wxNotebook *nb) ); +#endif // WXWIN_COMPATIBILITY_2_6 + + wxNotebook *GetNotebook() const { return (wxNotebook *)m_bookctrl; } + +private: + DECLARE_CLASS(wxNotebookSizer) + DECLARE_NO_COPY_CLASS(wxNotebookSizer) +}; + +#endif // wxUSE_NOTEBOOK + +#endif // wxUSE_BOOKCTRL + +#endif // WXWIN_COMPATIBILITY_2_4 // ---------------------------------------------------------------------------- // inline functions implementation // ---------------------------------------------------------------------------- -#if WXWIN_COMPATIBILITY_2_8 - -inline void wxSizerItem::SetWindow(wxWindow *window) -{ - DoSetWindow(window); -} - -inline void wxSizerItem::SetSizer(wxSizer *sizer) -{ - DoSetSizer(sizer); -} - -inline void wxSizerItem::SetSpacer(const wxSize& size) -{ - DoSetSpacer(size); -} - -inline void wxSizerItem::SetSpacer(int width, int height) -{ - DoSetSpacer(wxSize(width, height)); -} - -#endif // WXWIN_COMPATIBILITY_2_8 - -inline wxSizerItem* -wxSizer::Insert(size_t index, wxSizerItem *item) -{ - return DoInsert(index, item); -} - - inline wxSizerItem* wxSizer::Add( wxSizerItem *item ) { @@ -1160,12 +970,6 @@ wxSizer::Add( wxSizer *sizer, const wxSizerFlags& flags ) return Add( new wxSizerItem(sizer, flags) ); } -inline wxSizerItem* -wxSizer::Add( int width, int height, const wxSizerFlags& flags ) -{ - return Add( new wxSizerItem(width, height, flags) ); -} - inline wxSizerItem* wxSizer::AddSpacer(int size) { @@ -1226,12 +1030,6 @@ wxSizer::Prepend( wxSizer *sizer, const wxSizerFlags& flags ) return Prepend( new wxSizerItem(sizer, flags) ); } -inline wxSizerItem* -wxSizer::Prepend( int width, int height, const wxSizerFlags& flags ) -{ - return Prepend( new wxSizerItem(width, height, flags) ); -} - inline wxSizerItem* wxSizer::Insert( size_t index, wxWindow *window, @@ -1278,12 +1076,6 @@ wxSizer::Insert( size_t index, wxSizer *sizer, const wxSizerFlags& flags ) return Insert( index, new wxSizerItem(sizer, flags) ); } -inline wxSizerItem* -wxSizer::Insert( size_t index, int width, int height, const wxSizerFlags& flags ) -{ - return Insert( index, new wxSizerItem(width, height, flags) ); -} - inline wxSizerItem* wxSizer::InsertSpacer(size_t index, int size) { @@ -1296,4 +1088,5 @@ wxSizer::InsertStretchSpacer(size_t index, int prop) return Insert(index, 0, 0, prop); } + #endif // __WXSIZER_H__ diff --git a/Source/3rd Party/wx/include/wx/slider.h b/Source/3rd Party/wx/include/wx/slider.h index 446f9cef8..77fcef253 100644 --- a/Source/3rd Party/wx/include/wx/slider.h +++ b/Source/3rd Party/wx/include/wx/slider.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 09.02.01 -// RCS-ID: $Id$ +// RCS-ID: $Id: slider.h 38717 2006-04-14 17:01:16Z ABX $ // Copyright: (c) 1996-2001 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -31,6 +31,7 @@ #define wxSL_TICKS 0x0010 #define wxSL_AUTOTICKS wxSL_TICKS // we don't support manual ticks +#define wxSL_LABELS 0x0020 #define wxSL_LEFT 0x0040 #define wxSL_TOP 0x0080 #define wxSL_RIGHT 0x0100 @@ -38,22 +39,19 @@ #define wxSL_BOTH 0x0400 #define wxSL_SELRANGE 0x0800 #define wxSL_INVERSE 0x1000 -#define wxSL_MIN_MAX_LABELS 0x2000 -#define wxSL_VALUE_LABEL 0x4000 -#define wxSL_LABELS (wxSL_MIN_MAX_LABELS|wxSL_VALUE_LABEL) #if WXWIN_COMPATIBILITY_2_6 // obsolete #define wxSL_NOTIFY_DRAG 0x0000 #endif // WXWIN_COMPATIBILITY_2_6 -extern WXDLLIMPEXP_DATA_CORE(const char) wxSliderNameStr[]; +extern WXDLLEXPORT_DATA(const wxChar) wxSliderNameStr[]; // ---------------------------------------------------------------------------- // wxSliderBase: define wxSlider interface // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxSliderBase : public wxControl +class WXDLLEXPORT wxSliderBase : public wxControl { public: /* the ctor of the derived class should have the following form: @@ -95,7 +93,7 @@ public: // warning: most of subsequent methods are currently only implemented in // wxMSW under Win95 and are silently ignored on other platforms - void SetTickFreq(int freq) { DoSetTickFreq(freq); } + virtual void SetTickFreq(int WXUNUSED(n), int WXUNUSED(pos)) { } virtual int GetTickFreq() const { return 0; } virtual void ClearTicks() { } virtual void SetTick(int WXUNUSED(tickPos)) { } @@ -105,16 +103,7 @@ public: virtual int GetSelStart() const { return GetMax(); } virtual void SetSelection(int WXUNUSED(min), int WXUNUSED(max)) { } -#if WXWIN_COMPATIBILITY_2_8 - wxDEPRECATED_INLINE( void SetTickFreq(int freq, int), DoSetTickFreq(freq); ) -#endif - protected: - // Platform-specific implementation of SetTickFreq - virtual void DoSetTickFreq(int WXUNUSED(freq)) { /* unsupported by default */ } - - // choose the default border for this window - virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } // adjust value according to wxSL_INVERSE style virtual int ValueInvertOrNot(int value) const @@ -126,7 +115,7 @@ protected: } private: - wxDECLARE_NO_COPY_CLASS(wxSliderBase); + DECLARE_NO_COPY_CLASS(wxSliderBase) }; // ---------------------------------------------------------------------------- @@ -136,7 +125,10 @@ private: #if defined(__WXUNIVERSAL__) #include "wx/univ/slider.h" #elif defined(__WXMSW__) - #include "wx/msw/slider.h" + #include "wx/msw/slider95.h" + #if WXWIN_COMPATIBILITY_2_4 + #define wxSlider95 wxSlider + #endif #elif defined(__WXMOTIF__) #include "wx/motif/slider.h" #elif defined(__WXGTK20__) @@ -144,11 +136,13 @@ private: #elif defined(__WXGTK__) #include "wx/gtk1/slider.h" #elif defined(__WXMAC__) - #include "wx/osx/slider.h" + #include "wx/mac/slider.h" #elif defined(__WXCOCOA__) #include "wx/cocoa/slider.h" #elif defined(__WXPM__) #include "wx/os2/slider.h" +#elif defined(__WXPALMOS__) + #include "wx/palmos/slider.h" #endif #endif // wxUSE_SLIDER diff --git a/Source/3rd Party/wx/include/wx/snglinst.h b/Source/3rd Party/wx/include/wx/snglinst.h index 9a27229bd..50a856332 100644 --- a/Source/3rd Party/wx/include/wx/snglinst.h +++ b/Source/3rd Party/wx/include/wx/snglinst.h @@ -5,7 +5,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 08.06.01 -// RCS-ID: $Id$ +// RCS-ID: $Id: snglinst.h 49563 2007-10-31 20:46:21Z VZ $ // Copyright: (c) 2001 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -15,9 +15,6 @@ #if wxUSE_SNGLINST_CHECKER -#include "wx/app.h" -#include "wx/utils.h" - // ---------------------------------------------------------------------------- // wxSingleInstanceChecker // ---------------------------------------------------------------------------- @@ -36,11 +33,9 @@ public: Create(name, path); } - // notice that calling Create() is optional now, if you don't do it before - // calling IsAnotherRunning(), CreateDefault() is used automatically - // - // name it is used as the mutex name under Win32 and the lock file name - // under Unix so it should be as unique as possible and must be non-empty + // name must be given and be as unique as possible, it is used as the mutex + // name under Win32 and the lock file name under Unix - + // wxTheApp->GetAppName() may be a good value for this parameter // // path is optional and is ignored under Win32 and used as the directory to // create the lock file in under Unix (default is wxGetHomeDir()) @@ -49,32 +44,8 @@ public: // instance is running - use IsAnotherRunning() to check it bool Create(const wxString& name, const wxString& path = wxEmptyString); - // use the default name, which is a combination of wxTheApp->GetAppName() - // and wxGetUserId() for mutex/lock file - // - // this is called implicitly by IsAnotherRunning() if the checker hadn't - // been created until then - bool CreateDefault() - { - wxCHECK_MSG( wxTheApp, false, "must have application instance" ); - return Create(wxTheApp->GetAppName() + '-' + wxGetUserId()); - } - // is another copy of this program already running? - bool IsAnotherRunning() const - { - if ( !m_impl ) - { - if ( !const_cast(this)->CreateDefault() ) - { - // if creation failed, return false as it's better to not - // prevent this instance from starting up if there is an error - return false; - } - } - - return DoIsAnotherRunning(); - } + bool IsAnotherRunning() const; // dtor is not virtual, this class is not meant to be used polymorphically ~wxSingleInstanceChecker(); @@ -83,13 +54,10 @@ private: // common part of all ctors void Init() { m_impl = NULL; } - // do check if another instance is running, called only if m_impl != NULL - bool DoIsAnotherRunning() const; - // the implementation details (platform specific) class WXDLLIMPEXP_FWD_BASE wxSingleInstanceCheckerImpl *m_impl; - wxDECLARE_NO_COPY_CLASS(wxSingleInstanceChecker); + DECLARE_NO_COPY_CLASS(wxSingleInstanceChecker) }; #endif // wxUSE_SNGLINST_CHECKER diff --git a/Source/3rd Party/wx/include/wx/spinbutt.h b/Source/3rd Party/wx/include/wx/spinbutt.h index 078adaa36..c24f35f01 100644 --- a/Source/3rd Party/wx/include/wx/spinbutt.h +++ b/Source/3rd Party/wx/include/wx/spinbutt.h @@ -4,7 +4,7 @@ // Author: Julian Smart, Vadim Zeitlin // Modified by: // Created: 23.07.99 -// RCS-ID: $Id$ +// RCS-ID: $Id: spinbutt.h 61872 2009-09-09 22:37:05Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -22,7 +22,6 @@ #include "wx/control.h" #include "wx/event.h" -#include "wx/range.h" #define wxSPIN_BUTTON_NAME wxT("wxSpinButton") @@ -37,7 +36,7 @@ // wxSP_WRAP: value wraps at either end // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxSpinButtonBase : public wxControl +class WXDLLEXPORT wxSpinButtonBase : public wxControl { public: // ctor initializes the range with the default (0..100) values @@ -47,7 +46,6 @@ public: virtual int GetValue() const = 0; virtual int GetMin() const { return m_min; } virtual int GetMax() const { return m_max; } - wxRange GetRange() const { return wxRange( GetMin(), GetMax() );} // operations virtual void SetValue(int val) = 0; @@ -58,7 +56,6 @@ public: m_min = minVal; m_max = maxVal; } - void SetRange( const wxRange& range) { SetRange( range.GetMin(), range.GetMax()); } // is this spin button vertically oriented? bool IsVertical() const { return (m_windowStyle & wxSP_VERTICAL) != 0; } @@ -68,7 +65,7 @@ protected: int m_min; int m_max; - wxDECLARE_NO_COPY_CLASS(wxSpinButtonBase); + DECLARE_NO_COPY_CLASS(wxSpinButtonBase) }; // ---------------------------------------------------------------------------- @@ -86,7 +83,7 @@ protected: #elif defined(__WXGTK__) #include "wx/gtk1/spinbutt.h" #elif defined(__WXMAC__) - #include "wx/osx/spinbutt.h" + #include "wx/mac/spinbutt.h" #elif defined(__WXCOCOA__) #include "wx/cocoa/spinbutt.h" #elif defined(__WXPM__) @@ -97,7 +94,7 @@ protected: // the wxSpinButton event // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxSpinEvent : public wxNotifyEvent +class WXDLLEXPORT wxSpinEvent : public wxNotifyEvent { public: wxSpinEvent(wxEventType commandType = wxEVT_NULL, int winid = 0) @@ -105,37 +102,26 @@ public: { } - wxSpinEvent(const wxSpinEvent& event) : wxNotifyEvent(event) {} - // get the current value of the control - int GetValue() const { return m_commandInt; } - void SetValue(int value) { m_commandInt = value; } - int GetPosition() const { return m_commandInt; } void SetPosition(int pos) { m_commandInt = pos; } - virtual wxEvent *Clone() const { return new wxSpinEvent(*this); } - private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSpinEvent) + DECLARE_DYNAMIC_CLASS_NO_COPY(wxSpinEvent) }; typedef void (wxEvtHandler::*wxSpinEventFunction)(wxSpinEvent&); #define wxSpinEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxSpinEventFunction, func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxSpinEventFunction, &func) -// macros for handling spin events: notice that we must use the real values of -// the event type constants and not their references (wxEVT_SPIN[_UP/DOWN]) -// here as otherwise the event tables could end up with non-initialized -// (because of undefined initialization order of the globals defined in -// different translation units) references in them +// macros for handling spin events #define EVT_SPIN_UP(winid, func) \ - wx__DECLARE_EVT1(wxEVT_SPIN_UP, winid, wxSpinEventHandler(func)) + wx__DECLARE_EVT1(wxEVT_SCROLL_LINEUP, winid, wxSpinEventHandler(func)) #define EVT_SPIN_DOWN(winid, func) \ - wx__DECLARE_EVT1(wxEVT_SPIN_DOWN, winid, wxSpinEventHandler(func)) + wx__DECLARE_EVT1(wxEVT_SCROLL_LINEDOWN, winid, wxSpinEventHandler(func)) #define EVT_SPIN(winid, func) \ - wx__DECLARE_EVT1(wxEVT_SPIN, winid, wxSpinEventHandler(func)) + wx__DECLARE_EVT1(wxEVT_SCROLL_THUMBTRACK, winid, wxSpinEventHandler(func)) #endif // wxUSE_SPINBTN diff --git a/Source/3rd Party/wx/include/wx/spinctrl.h b/Source/3rd Party/wx/include/wx/spinctrl.h index 8bad7d433..e27c1892d 100644 --- a/Source/3rd Party/wx/include/wx/spinctrl.h +++ b/Source/3rd Party/wx/include/wx/spinctrl.h @@ -1,10 +1,10 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/spinctrl.h +// Name: spinctrl.h // Purpose: wxSpinCtrlBase class // Author: Vadim Zeitlin // Modified by: // Created: 22.07.99 -// RCS-ID: $Id$ +// RCS-ID: $Id: spinctrl.h 37066 2006-01-23 03:27:34Z MR $ // Copyright: (c) Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -18,126 +18,65 @@ #include "wx/spinbutt.h" // should make wxSpinEvent visible to the app -// Events -class WXDLLIMPEXP_FWD_CORE wxSpinDoubleEvent; - -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_SPINCTRL_UPDATED, wxSpinEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_SPINCTRLDOUBLE_UPDATED, wxSpinDoubleEvent); - // ---------------------------------------------------------------------------- -// A spin ctrl is a text control with a spin button which is usually used to -// prompt the user for a numeric input. -// There are two kinds for number types T=integer or T=double. +// a spin ctrl is a text control with a spin button which is usually used to +// prompt the user for a numeric input // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxSpinCtrlBase : public wxControl +/* there is no generic base class for this control because it's imlpemented + very differently under MSW and other platforms + +class WXDLLEXPORT wxSpinCtrlBase : public wxControl { public: - wxSpinCtrlBase() {} + wxSpinCtrlBase() { Init(); } - // accessor functions that derived classes are expected to have - // T GetValue() const - // T GetMin() const - // T GetMax() const - // T GetIncrement() const - virtual bool GetSnapToTicks() const = 0; - // unsigned GetDigits() const - wxSpinCtrlDouble only + // accessors + virtual int GetValue() const = 0; + virtual int GetMin() const { return m_min; } + virtual int GetMax() const { return m_max; } - // operation functions that derived classes are expected to have + // operations virtual void SetValue(const wxString& value) = 0; - // void SetValue(T val) - // void SetRange(T minVal, T maxVal) - // void SetIncrement(T inc) - virtual void SetSnapToTicks(bool snap_to_ticks) = 0; - // void SetDigits(unsigned digits) - wxSpinCtrlDouble only + virtual void SetValue(int val) = 0; + virtual void SetRange(int minVal, int maxVal) = 0; - // Select text in the textctrl + // as the wxTextCtrl method virtual void SetSelection(long from, long to) = 0; -private: - wxDECLARE_NO_COPY_CLASS(wxSpinCtrlBase); -}; - -// ---------------------------------------------------------------------------- -// wxSpinDoubleEvent - a wxSpinEvent for double valued controls -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxSpinDoubleEvent : public wxNotifyEvent -{ -public: - wxSpinDoubleEvent(wxEventType commandType = wxEVT_NULL, int winid = 0, - double value = 0) - : wxNotifyEvent(commandType, winid), m_value(value) - { - } - - wxSpinDoubleEvent(const wxSpinDoubleEvent& event) - : wxNotifyEvent(event), m_value(event.GetValue()) - { - } - - double GetValue() const { return m_value; } - void SetValue(double value) { m_value = value; } - - virtual wxEvent *Clone() const { return new wxSpinDoubleEvent(*this); } - protected: - double m_value; + // initialize m_min/max with the default values + void Init() { m_min = 0; m_max = 100; } -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSpinDoubleEvent) + int m_min; + int m_max; }; - -// ---------------------------------------------------------------------------- -// wxSpinDoubleEvent event type, see also wxSpinEvent in wx/spinbutt.h -// ---------------------------------------------------------------------------- - -typedef void (wxEvtHandler::*wxSpinDoubleEventFunction)(wxSpinDoubleEvent&); - -#define wxSpinDoubleEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxSpinDoubleEventFunction, func) - -// macros for handling spinctrl events - -#define EVT_SPINCTRL(id, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_SPINCTRL_UPDATED, id, wxSpinEventHandler(fn)) - -#define EVT_SPINCTRLDOUBLE(id, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_SPINCTRLDOUBLE_UPDATED, id, wxSpinDoubleEventHandler(fn)) +*/ // ---------------------------------------------------------------------------- // include the platform-dependent class implementation // ---------------------------------------------------------------------------- -// we may have a native wxSpinCtrl implementation, native wxSpinCtrl and -// wxSpinCtrlDouble implementations or neither, define the appropriate symbols -// and include the generic version if necessary to provide the missing class(es) - -#if defined(__WXUNIVERSAL__) || \ - defined(__WXMOTIF__) || \ - defined(__WXCOCOA__) - // nothing, use generic controls +#if defined(__WXUNIVERSAL__) + #include "wx/generic/spinctlg.h" #elif defined(__WXMSW__) - #define wxHAS_NATIVE_SPINCTRL #include "wx/msw/spinctrl.h" #elif defined(__WXPM__) - #define wxHAS_NATIVE_SPINCTRL #include "wx/os2/spinctrl.h" #elif defined(__WXGTK20__) - #define wxHAS_NATIVE_SPINCTRL - #define wxHAS_NATIVE_SPINCTRLDOUBLE #include "wx/gtk/spinctrl.h" #elif defined(__WXGTK__) - #define wxHAS_NATIVE_SPINCTRL #include "wx/gtk1/spinctrl.h" +#elif defined(__WXMOTIF__) + #include "wx/generic/spinctlg.h" #elif defined(__WXMAC__) - #define wxHAS_NATIVE_SPINCTRL - #include "wx/osx/spinctrl.h" + #include "wx/mac/spinctrl.h" +#elif defined(__WXCOCOA__) + #include "wx/generic/spinctlg.h" #endif // platform -#if !defined(wxHAS_NATIVE_SPINCTRL) || !defined(wxHAS_NATIVE_SPINCTRLDOUBLE) - #include "wx/generic/spinctlg.h" -#endif +#define EVT_SPINCTRL(id, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_SPINCTRL_UPDATED, id, wxSpinEventHandler(fn)) #endif // wxUSE_SPINCTRL diff --git a/Source/3rd Party/wx/include/wx/splitter.h b/Source/3rd Party/wx/include/wx/splitter.h index 04c255961..fb96799f1 100644 --- a/Source/3rd Party/wx/include/wx/splitter.h +++ b/Source/3rd Party/wx/include/wx/splitter.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: -// RCS-ID: $Id$ +// RCS-ID: $Id: splitter.h 38717 2006-04-14 17:01:16Z ABX $ // Copyright: (c) Julian Smart // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// @@ -19,7 +19,6 @@ // ---------------------------------------------------------------------------- #define wxSP_NOBORDER 0x0000 -#define wxSP_THIN_SASH 0x0000 // NB: the default is 3D sash #define wxSP_NOSASH 0x0010 #define wxSP_PERMIT_UNSPLIT 0x0040 #define wxSP_LIVE_UPDATE 0x0080 @@ -35,13 +34,14 @@ #define wxSP_FULLSASH 0 #endif // WXWIN_COMPATIBILITY_2_6 -class WXDLLIMPEXP_FWD_CORE wxSplitterEvent; - -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED, wxSplitterEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING, wxSplitterEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_SPLITTER_DOUBLECLICKED, wxSplitterEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_SPLITTER_UNSPLIT, wxSplitterEvent ); +BEGIN_DECLARE_EVENT_TYPES() + DECLARE_EVENT_TYPE(wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED, 850) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING, 851) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_SPLITTER_DOUBLECLICKED, 852) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_SPLITTER_UNSPLIT, 853) +END_DECLARE_EVENT_TYPES() #include "wx/generic/splitter.h" -#endif // _WX_SPLITTER_H_BASE_ +#endif + // _WX_SPLITTER_H_BASE_ diff --git a/Source/3rd Party/wx/include/wx/srchctrl.h b/Source/3rd Party/wx/include/wx/srchctrl.h index 14025c88e..af831bd0b 100644 --- a/Source/3rd Party/wx/include/wx/srchctrl.h +++ b/Source/3rd Party/wx/include/wx/srchctrl.h @@ -1,9 +1,9 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/srchctrl.h +// Name: srchctrl.h // Purpose: wxSearchCtrlBase class // Author: Vince Harron // Created: 2006-02-18 -// RCS-ID: $Id$ +// RCS-ID: $Id: srchctrl.h 45828 2007-05-05 14:51:51Z VZ $ // Copyright: (c) Vince Harron // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -17,7 +17,8 @@ #include "wx/textctrl.h" -#if !defined(__WXUNIVERSAL__) && defined(__WXMAC__) +#if !defined(__WXUNIVERSAL__) && defined(__WXMAC__) && defined(__WXMAC_OSX__) \ + && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3) // search control was introduced in Mac OS X 10.3 Panther #define wxUSE_NATIVE_SEARCH_CONTROL 1 @@ -26,31 +27,26 @@ // no native version, use the generic one #define wxUSE_NATIVE_SEARCH_CONTROL 0 - #include "wx/compositewin.h" - #include "wx/containr.h" - - class WXDLLIMPEXP_CORE wxSearchCtrlBaseBaseClass - : public wxCompositeWindow< wxNavigationEnabled >, - public wxTextCtrlIface - { - }; + #define wxSearchCtrlBaseBaseClass wxTextCtrlBase #endif // ---------------------------------------------------------------------------- // constants // ---------------------------------------------------------------------------- -extern WXDLLIMPEXP_DATA_CORE(const char) wxSearchCtrlNameStr[]; +extern WXDLLEXPORT_DATA(const wxChar) wxSearchCtrlNameStr[]; -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_SEARCHCTRL_CANCEL_BTN, wxCommandEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_SEARCHCTRL_SEARCH_BTN, wxCommandEvent); +BEGIN_DECLARE_EVENT_TYPES() + DECLARE_EVENT_TYPE(wxEVT_COMMAND_SEARCHCTRL_CANCEL_BTN, 1119) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_SEARCHCTRL_SEARCH_BTN, 1120) +END_DECLARE_EVENT_TYPES() // ---------------------------------------------------------------------------- // a search ctrl is a text control with a search button and a cancel button // it is based on the MacOSX 10.3 control HISearchFieldCreate // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxSearchCtrlBase : public wxSearchCtrlBaseBaseClass +class WXDLLEXPORT wxSearchCtrlBase : public wxSearchCtrlBaseBaseClass { public: wxSearchCtrlBase() { } @@ -68,17 +64,13 @@ public: virtual void ShowCancelButton( bool show ) = 0; virtual bool IsCancelButtonVisible() const = 0; - -private: - // implement wxTextEntry pure virtual method - virtual wxWindow *GetEditableWindow() { return this; } }; // include the platform-dependent class implementation #if wxUSE_NATIVE_SEARCH_CONTROL #if defined(__WXMAC__) - #include "wx/osx/srchctrl.h" + #include "wx/mac/srchctrl.h" #endif #else #include "wx/generic/srchctlg.h" diff --git a/Source/3rd Party/wx/include/wx/sstream.h b/Source/3rd Party/wx/include/wx/sstream.h index dec08ec79..febf2cf0d 100644 --- a/Source/3rd Party/wx/include/wx/sstream.h +++ b/Source/3rd Party/wx/include/wx/sstream.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 2004-09-19 -// RCS-ID: $Id$ +// RCS-ID: $Id: sstream.h 45732 2007-05-01 13:52:19Z VZ $ // Copyright: (c) 2004 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -26,9 +26,9 @@ public: // ctor associates the stream with the given string which makes a copy of // it wxStringInputStream(const wxString& s); + virtual ~wxStringInputStream(); virtual wxFileOffset GetLength() const; - virtual bool IsSeekable() const { return true; } protected: virtual wxFileOffset OnSysSeek(wxFileOffset ofs, wxSeekMode mode); @@ -40,7 +40,7 @@ private: wxString m_str; // the buffer we're reading from - wxCharBuffer m_buf; + char* m_buf; // length of the buffer we're reading from size_t m_len; @@ -48,7 +48,7 @@ private: // position in the stream in bytes, *not* in chars size_t m_pos; - wxDECLARE_NO_COPY_CLASS(wxStringInputStream); + DECLARE_NO_COPY_CLASS(wxStringInputStream) }; // ---------------------------------------------------------------------------- @@ -60,25 +60,19 @@ class WXDLLIMPEXP_BASE wxStringOutputStream : public wxOutputStream public: // The stream will write data either to the provided string or to an // internal string which can be retrieved using GetString() - // - // Note that the conversion object should have the life time greater than - // this stream. - wxStringOutputStream(wxString *pString = NULL, - wxMBConv& conv = wxConvUTF8) - : m_conv(conv) -#if wxUSE_UNICODE - , m_unconv(0) -#endif // wxUSE_UNICODE + wxStringOutputStream(wxString *pString = NULL) { m_str = pString ? pString : &m_strInternal; m_pos = m_str->length() / sizeof(wxChar); } +#if wxABI_VERSION >= 20804 && wxUSE_UNICODE + virtual ~wxStringOutputStream(); +#endif // wx 2.8.4+ + // get the string containing current output const wxString& GetString() const { return *m_str; } - virtual bool IsSeekable() const { return true; } - protected: virtual wxFileOffset OnSysTell() const; virtual size_t OnSysWrite(const void *buffer, size_t size); @@ -93,17 +87,14 @@ private: // position in the stream in bytes, *not* in chars size_t m_pos; - // converter to use: notice that with the default UTF-8 one the input - // stream must contain valid UTF-8 data, use wxConvISO8859_1 to work with - // arbitrary 8 bit data - wxMBConv& m_conv; +#if wxUSE_WCHAR_T + // string encoding converter (UTF8 is the standard) + wxMBConvUTF8 m_conv; +#else + wxMBConv m_conv; +#endif -#if wxUSE_UNICODE - // unconverted data from the last call to OnSysWrite() - wxMemoryBuffer m_unconv; -#endif // wxUSE_UNICODE - - wxDECLARE_NO_COPY_CLASS(wxStringOutputStream); + DECLARE_NO_COPY_CLASS(wxStringOutputStream) }; #endif // wxUSE_STREAMS diff --git a/Source/3rd Party/wx/include/wx/stack.h b/Source/3rd Party/wx/include/wx/stack.h index a5f8c0a30..e58c0675d 100644 --- a/Source/3rd Party/wx/include/wx/stack.h +++ b/Source/3rd Party/wx/include/wx/stack.h @@ -1,10 +1,10 @@ /////////////////////////////////////////////////////////////////////////////// // Name: wx/stack.h // Purpose: STL stack clone -// Author: Lindsay Mathieson, Vadim Zeitlin +// Author: Lindsay Mathieson +// Modified by: // Created: 30.07.2001 -// Copyright: (c) 2001 Lindsay Mathieson (WX_DECLARE_STACK) -// 2011 Vadim Zeitlin +// Copyright: (c) 2001 Lindsay Mathieson // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -13,71 +13,30 @@ #include "wx/vector.h" -#if wxUSE_STD_CONTAINERS - -#include -#define wxStack std::stack - -#else // !wxUSE_STD_CONTAINERS - -// Notice that unlike std::stack, wxStack currently always uses wxVector and -// can't be used with any other underlying container type. -// -// Another difference is that comparison operators between stacks are not -// implemented (but they should be, see 23.2.3.3 of ISO/IEC 14882:1998). - -template -class wxStack -{ -public: - typedef wxVector container_type; - typedef typename container_type::size_type size_type; - typedef typename container_type::value_type value_type; - - wxStack() { } - explicit wxStack(const container_type& cont) : m_cont(cont) { } - - // Default copy ctor, assignment operator and dtor are ok. - - - bool empty() const { return m_cont.empty(); } - size_type size() const { return m_cont.size(); } - - value_type& top() { return m_cont.back(); } - const value_type& top() const { return m_cont.back(); } - - void push(const value_type& val) { m_cont.push_back(val); } - void pop() { m_cont.pop_back(); } - -private: - container_type m_cont; -}; - -#endif // wxUSE_STD_CONTAINERS/!wxUSE_STD_CONTAINERS - - -// Deprecated macro-based class for compatibility only, don't use any more. -#define WX_DECLARE_STACK(obj, cls) \ -class cls : public wxVector \ +#define WX_DECLARE_STACK(obj, cls)\ +class cls : public wxVectorBase\ {\ + WX_DECLARE_VECTORBASE(obj, cls);\ public:\ void push(const obj& o)\ {\ - push_back(o); \ + bool rc = Alloc(size() + 1);\ + wxASSERT(rc);\ + Append(new obj(o));\ };\ \ void pop()\ {\ - pop_back(); \ + RemoveAt(size() - 1);\ };\ \ obj& top()\ {\ - return at(size() - 1);\ + return *(obj *) GetItem(size() - 1);\ };\ const obj& top() const\ {\ - return at(size() - 1); \ + return *(obj *) GetItem(size() - 1);\ };\ } diff --git a/Source/3rd Party/wx/include/wx/stackwalk.h b/Source/3rd Party/wx/include/wx/stackwalk.h index b70d644bb..e051c71f1 100644 --- a/Source/3rd Party/wx/include/wx/stackwalk.h +++ b/Source/3rd Party/wx/include/wx/stackwalk.h @@ -1,10 +1,10 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: wx/stackwalk.h +// Name: wx/wx/stackwalk.h // Purpose: wxStackWalker and related classes, common part // Author: Vadim Zeitlin // Modified by: // Created: 2005-01-07 -// RCS-ID: $Id$ +// RCS-ID: $Id: stackwalk.h 43346 2006-11-12 14:33:03Z RR $ // Copyright: (c) 2004 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -16,9 +16,7 @@ #if wxUSE_STACKWALKER -class WXDLLIMPEXP_FWD_BASE wxStackFrame; - -#define wxSTACKWALKER_MAX_DEPTH (200) +class WXDLLIMPEXP_BASE wxStackFrame; // ---------------------------------------------------------------------------- // wxStackFrame: a single stack level @@ -29,7 +27,7 @@ class WXDLLIMPEXP_BASE wxStackFrameBase private: // put this inline function here so that it is defined before use wxStackFrameBase *ConstCast() const - { return const_cast(this); } + { return wx_const_cast(wxStackFrameBase *, this); } public: wxStackFrameBase(size_t level, void *address = NULL) @@ -132,21 +130,19 @@ public: // number of them (this can be useful when Walk() is called from some known // location and you don't want to see the first few frames anyhow; also // notice that Walk() frame itself is not included if skip >= 1) - virtual void Walk(size_t skip = 1, size_t maxDepth = wxSTACKWALKER_MAX_DEPTH) = 0; + virtual void Walk(size_t skip = 1, size_t maxDepth = 200) = 0; -#if wxUSE_ON_FATAL_EXCEPTION // enumerate stack frames from the location of uncaught exception // // this version can only be called from wxApp::OnFatalException() - virtual void WalkFromException(size_t maxDepth = wxSTACKWALKER_MAX_DEPTH) = 0; -#endif // wxUSE_ON_FATAL_EXCEPTION + virtual void WalkFromException() = 0; protected: // this function must be overrided to process the given frame virtual void OnStackFrame(const wxStackFrame& frame) = 0; }; -#ifdef __WINDOWS__ +#ifdef __WXMSW__ #include "wx/msw/stackwalk.h" #elif defined(__UNIX__) #include "wx/unix/stackwalk.h" diff --git a/Source/3rd Party/wx/include/wx/statbmp.h b/Source/3rd Party/wx/include/wx/statbmp.h index f47dceac1..e32c0cca7 100644 --- a/Source/3rd Party/wx/include/wx/statbmp.h +++ b/Source/3rd Party/wx/include/wx/statbmp.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 25.08.00 -// RCS-ID: $Id$ +// RCS-ID: $Id: statbmp.h 37066 2006-01-23 03:27:34Z MR $ // Copyright: (c) 2000 Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -20,10 +20,10 @@ #include "wx/bitmap.h" #include "wx/icon.h" -extern WXDLLIMPEXP_DATA_CORE(const char) wxStaticBitmapNameStr[]; +extern WXDLLEXPORT_DATA(const wxChar) wxStaticBitmapNameStr[]; // a control showing an icon or a bitmap -class WXDLLIMPEXP_CORE wxStaticBitmapBase : public wxControl +class WXDLLEXPORT wxStaticBitmapBase : public wxControl { public: wxStaticBitmapBase() { } @@ -40,17 +40,14 @@ public: return wxIcon(); } - // overridden base class virtuals + // overriden base class virtuals virtual bool AcceptsFocus() const { return false; } virtual bool HasTransparentBackground() { return true; } protected: - // choose the default border for this window - virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } - virtual wxSize DoGetBestSize() const; - wxDECLARE_NO_COPY_CLASS(wxStaticBitmapBase); + DECLARE_NO_COPY_CLASS(wxStaticBitmapBase) }; #if defined(__WXUNIVERSAL__) @@ -64,7 +61,7 @@ protected: #elif defined(__WXGTK__) #include "wx/gtk1/statbmp.h" #elif defined(__WXMAC__) - #include "wx/osx/statbmp.h" + #include "wx/mac/statbmp.h" #elif defined(__WXCOCOA__) #include "wx/cocoa/statbmp.h" #elif defined(__WXPM__) diff --git a/Source/3rd Party/wx/include/wx/statbox.h b/Source/3rd Party/wx/include/wx/statbox.h index ae0b912f2..182881c93 100644 --- a/Source/3rd Party/wx/include/wx/statbox.h +++ b/Source/3rd Party/wx/include/wx/statbox.h @@ -1,11 +1,11 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/statbox.h +// Name: statbox.h // Purpose: wxStaticBox base header // Author: Julian Smart // Modified by: // Created: // Copyright: (c) Julian Smart -// RCS-ID: $Id$ +// RCS-ID: $Id: statbox.h 37066 2006-01-23 03:27:34Z MR $ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -18,18 +18,18 @@ #include "wx/control.h" -extern WXDLLIMPEXP_DATA_CORE(const char) wxStaticBoxNameStr[]; +extern WXDLLEXPORT_DATA(const wxChar) wxStaticBoxNameStr[]; // ---------------------------------------------------------------------------- // wxStaticBox: a grouping box with a label // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxStaticBoxBase : public wxControl +class WXDLLEXPORT wxStaticBoxBase : public wxControl { public: wxStaticBoxBase() { } - // overridden base class virtuals + // overriden base class virtuals virtual bool AcceptsFocus() const { return false; } virtual bool HasTransparentBackground() { return true; } @@ -46,11 +46,8 @@ public: *borderOther = BORDER; } -protected: - // choose the default border for this window - virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } - - wxDECLARE_NO_COPY_CLASS(wxStaticBoxBase); +private: + DECLARE_NO_COPY_CLASS(wxStaticBoxBase) }; #if defined(__WXUNIVERSAL__) @@ -64,7 +61,7 @@ protected: #elif defined(__WXGTK__) #include "wx/gtk1/statbox.h" #elif defined(__WXMAC__) - #include "wx/osx/statbox.h" + #include "wx/mac/statbox.h" #elif defined(__WXCOCOA__) #include "wx/cocoa/statbox.h" #elif defined(__WXPM__) diff --git a/Source/3rd Party/wx/include/wx/statline.h b/Source/3rd Party/wx/include/wx/statline.h index 4f4ec8725..eac9078f4 100644 --- a/Source/3rd Party/wx/include/wx/statline.h +++ b/Source/3rd Party/wx/include/wx/statline.h @@ -3,7 +3,7 @@ // Purpose: wxStaticLine class interface // Author: Vadim Zeitlin // Created: 28.06.99 -// Version: $Id$ +// Version: $Id: statline.h 43874 2006-12-09 14:52:59Z VZ $ // Copyright: (c) 1999 Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -28,13 +28,13 @@ // ---------------------------------------------------------------------------- // the default name for objects of class wxStaticLine -extern WXDLLIMPEXP_DATA_CORE(const char) wxStaticLineNameStr[]; +extern WXDLLEXPORT_DATA(const wxChar) wxStaticLineNameStr[]; // ---------------------------------------------------------------------------- // wxStaticLine - a line in a dialog // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxStaticLineBase : public wxControl +class WXDLLEXPORT wxStaticLineBase : public wxControl { public: // constructor @@ -46,13 +46,10 @@ public: // get the default size for the "lesser" dimension of the static line static int GetDefaultSize() { return 2; } - // overridden base class virtuals + // overriden base class virtuals virtual bool AcceptsFocus() const { return false; } protected: - // choose the default border for this window - virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } - // set the right size for the right dimension wxSize AdjustSize(const wxSize& size) const { @@ -76,7 +73,7 @@ protected: return AdjustSize(wxDefaultSize); } - wxDECLARE_NO_COPY_CLASS(wxStaticLineBase); + DECLARE_NO_COPY_CLASS(wxStaticLineBase) }; // ---------------------------------------------------------------------------- @@ -94,7 +91,7 @@ protected: #elif defined(__WXPM__) #include "wx/os2/statline.h" #elif defined(__WXMAC__) - #include "wx/osx/statline.h" + #include "wx/mac/statline.h" #elif defined(__WXCOCOA__) #include "wx/cocoa/statline.h" #else // use generic implementation for all other platforms diff --git a/Source/3rd Party/wx/include/wx/stattext.h b/Source/3rd Party/wx/include/wx/stattext.h index 5fe8d1d4a..99862b22e 100644 --- a/Source/3rd Party/wx/include/wx/stattext.h +++ b/Source/3rd Party/wx/include/wx/stattext.h @@ -1,11 +1,11 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/stattext.h +// Name: stattext.h // Purpose: wxStaticText base header // Author: Julian Smart // Modified by: // Created: // Copyright: (c) Julian Smart -// RCS-ID: $Id$ +// RCS-ID: $Id: stattext.h 37066 2006-01-23 03:27:34Z MR $ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -18,74 +18,31 @@ #include "wx/control.h" -/* - * wxStaticText flags - */ -#define wxST_NO_AUTORESIZE 0x0001 -// free 0x0002 bit -#define wxST_ELLIPSIZE_START 0x0004 -#define wxST_ELLIPSIZE_MIDDLE 0x0008 -#define wxST_ELLIPSIZE_END 0x0010 +extern WXDLLEXPORT_DATA(const wxChar) wxStaticTextNameStr[]; -extern WXDLLIMPEXP_DATA_CORE(const char) wxStaticTextNameStr[]; - -class WXDLLIMPEXP_CORE wxStaticTextBase : public wxControl +class WXDLLEXPORT wxStaticTextBase : public wxControl { public: wxStaticTextBase() { } + // in wxGTK wxStaticText doesn't derive from wxStaticTextBase so we have to + // declare this function directly in gtk header +#if !defined(__WXGTK__) || defined(__WXUNIVERSAL__) // wrap the text of the control so that no line is longer than the given // width (if possible: this function won't break words) - // This function will modify the value returned by GetLabel()! + // + // NB: implemented in dlgcmn.cpp for now void Wrap(int width); +#endif // ! native __WXGTK__ - // overridden base virtuals + // overriden base virtuals virtual bool AcceptsFocus() const { return false; } virtual bool HasTransparentBackground() { return true; } - bool IsEllipsized() const - { - return HasFlag(wxST_ELLIPSIZE_START) || - HasFlag(wxST_ELLIPSIZE_MIDDLE) || - HasFlag(wxST_ELLIPSIZE_END); - } - -protected: // functions required for wxST_ELLIPSIZE_* support - - // choose the default border for this window - virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } - - // Calls Ellipsize() on the real label if necessary. Unlike GetLabelText(), - // keeps the mnemonics instead of removing them. - virtual wxString GetEllipsizedLabel() const; - - // Replaces parts of the string with ellipsis according to the ellipsize - // style. Shouldn't be called if we don't have any. - wxString Ellipsize(const wxString& label) const; - - // to be called when updating the size of the static text: - // updates the label redoing ellipsization calculations - void UpdateLabel(); - - // These functions are platform-specific and must be overridden in ports - // which do not natively support ellipsization and they must be implemented - // in a way so that the m_labelOrig member of wxControl is not touched: - - // returns the real label currently displayed inside the control. - virtual wxString DoGetLabel() const { return wxEmptyString; } - - // sets the real label currently displayed inside the control, - // _without_ invalidating the size. The text passed is always markup-free - // but may contain the mnemonic characters. - virtual void DoSetLabel(const wxString& WXUNUSED(str)) { } - private: - wxDECLARE_NO_COPY_CLASS(wxStaticTextBase); + DECLARE_NO_COPY_CLASS(wxStaticTextBase) }; -// see wx/generic/stattextg.h for the explanation -#ifndef wxNO_PORT_STATTEXT_INCLUDE - #if defined(__WXUNIVERSAL__) #include "wx/univ/stattext.h" #elif defined(__WXMSW__) @@ -97,15 +54,16 @@ private: #elif defined(__WXGTK__) #include "wx/gtk1/stattext.h" #elif defined(__WXMAC__) - #include "wx/osx/stattext.h" + #include "wx/mac/stattext.h" #elif defined(__WXCOCOA__) #include "wx/cocoa/stattext.h" #elif defined(__WXPM__) #include "wx/os2/stattext.h" +#elif defined(__WXPALMOS__) + #include "wx/palmos/stattext.h" #endif -#endif // !wxNO_PORT_STATTEXT_INCLUDE - #endif // wxUSE_STATTEXT -#endif // _WX_STATTEXT_H_BASE_ +#endif + // _WX_STATTEXT_H_BASE_ diff --git a/Source/3rd Party/wx/include/wx/statusbr.h b/Source/3rd Party/wx/include/wx/statusbr.h index fcbb55a95..5a19e7503 100644 --- a/Source/3rd Party/wx/include/wx/statusbr.h +++ b/Source/3rd Party/wx/include/wx/statusbr.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 05.02.00 -// RCS-ID: $Id$ +// RCS-ID: $Id: statusbr.h 41035 2006-09-06 17:36:22Z PC $ // Copyright: (c) Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -16,97 +16,28 @@ #if wxUSE_STATUSBAR -#include "wx/control.h" +#include "wx/window.h" #include "wx/list.h" #include "wx/dynarray.h" -extern WXDLLIMPEXP_DATA_CORE(const char) wxStatusBarNameStr[]; +extern WXDLLIMPEXP_DATA_CORE(const wxChar) wxStatusBarNameStr[]; + +WX_DECLARE_LIST(wxString, wxListString); // ---------------------------------------------------------------------------- // wxStatusBar constants // ---------------------------------------------------------------------------- -// wxStatusBar styles -#define wxSTB_SIZEGRIP 0x0010 -#define wxSTB_SHOW_TIPS 0x0020 - -#define wxSTB_ELLIPSIZE_START 0x0040 -#define wxSTB_ELLIPSIZE_MIDDLE 0x0080 -#define wxSTB_ELLIPSIZE_END 0x0100 - -#define wxSTB_DEFAULT_STYLE (wxSTB_SIZEGRIP|wxSTB_ELLIPSIZE_END|wxSTB_SHOW_TIPS|wxFULL_REPAINT_ON_RESIZE) - - -// old compat style name: -#define wxST_SIZEGRIP wxSTB_SIZEGRIP - - -// style flags for wxStatusBar fields +// style flags for fields #define wxSB_NORMAL 0x0000 #define wxSB_FLAT 0x0001 #define wxSB_RAISED 0x0002 -// ---------------------------------------------------------------------------- -// wxStatusBarPane: an helper for wxStatusBar -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxStatusBarPane -{ -public: - wxStatusBarPane(int style = wxSB_NORMAL, size_t width = 0) - : m_nStyle(style), m_nWidth(width) - { m_bEllipsized = false; } - - int GetWidth() const { return m_nWidth; } - int GetStyle() const { return m_nStyle; } - wxString GetText() const { return m_text; } - - - // implementation-only from now on - // ------------------------------- - - bool IsEllipsized() const - { return m_bEllipsized; } - void SetIsEllipsized(bool isEllipsized) { m_bEllipsized = isEllipsized; } - - void SetWidth(int width) { m_nWidth = width; } - void SetStyle(int style) { m_nStyle = style; } - - // set text, return true if it changed or false if it was already set to - // this value - bool SetText(const wxString& text); - - // save the existing text on top of our stack and make the new text - // current; return true if the text really changed - bool PushText(const wxString& text); - - // restore the message saved by the last call to Push() (unless it was - // changed by an intervening call to SetText()) and return true if we - // really restored anything - bool PopText(); - -private: - int m_nStyle; - int m_nWidth; // may be negative, indicating a variable-width field - wxString m_text; - - // the array used to keep the previous values of this pane after a - // PushStatusText() call, its top element is the value to restore after the - // next PopStatusText() call while the currently shown value is always in - // m_text - wxArrayString m_arrStack; - - // is the currently shown value shown with ellipsis in the status bar? - bool m_bEllipsized; -}; - -WX_DECLARE_EXPORTED_OBJARRAY(wxStatusBarPane, wxStatusBarPaneArray); - // ---------------------------------------------------------------------------- // wxStatusBar: a window near the bottom of the frame used for status info // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxStatusBarBase : public wxControl +class WXDLLEXPORT wxStatusBarBase : public wxWindow { public: wxStatusBarBase(); @@ -119,17 +50,14 @@ public: // set the number of fields and call SetStatusWidths(widths) if widths are // given virtual void SetFieldsCount(int number = 1, const int *widths = NULL); - int GetFieldsCount() const { return m_panes.GetCount(); } + int GetFieldsCount() const { return m_nFields; } // field text // ---------- - // just change or get the currently shown text - void SetStatusText(const wxString& text, int number = 0); - wxString GetStatusText(int number = 0) const; + virtual void SetStatusText(const wxString& text, int number = 0) = 0; + virtual wxString GetStatusText(int number = 0) const = 0; - // change the currently shown text to the new one and save the current - // value to be restored by the next call to PopStatusText() void PushStatusText(const wxString& text, int number = 0); void PopStatusText(int number = 0); @@ -144,9 +72,6 @@ public: // -2 grows twice as much as one with width -1 &c) virtual void SetStatusWidths(int n, const int widths[]); - int GetStatusWidth(int n) const - { return m_panes[n].GetWidth(); } - // field styles // ------------ @@ -156,9 +81,6 @@ public: // Setting field styles only works on wxMSW virtual void SetStatusStyles(int n, const int styles[]); - int GetStatusStyle(int n) const - { return m_panes[n].GetStyle(); } - // geometry // -------- @@ -172,59 +94,51 @@ public: virtual int GetBorderX() const = 0; virtual int GetBorderY() const = 0; - wxSize GetBorders() const - { return wxSize(GetBorderX(), GetBorderY()); } - - // miscellaneous - // ------------- - - const wxStatusBarPane& GetField(int n) const - { return m_panes[n]; } - - // wxWindow overrides: - // don't want status bars to accept the focus at all virtual bool AcceptsFocus() const { return false; } - // the client size of a toplevel window doesn't include the status bar - virtual bool CanBeOutsideClientArea() const { return true; } - protected: - // called after the status bar pane text changed and should update its - // display - virtual void DoUpdateStatusText(int number) = 0; + // set the widths array to NULL + void InitWidths(); + // free the status widths arrays + void FreeWidths(); - // wxWindow overrides: + // reset the widths + void ReinitWidths() { FreeWidths(); InitWidths(); } -#if wxUSE_TOOLTIPS - virtual void DoSetToolTip( wxToolTip *tip ) - { - wxASSERT_MSG(!HasFlag(wxSTB_SHOW_TIPS), - "Do not set tooltip(s) manually when using wxSTB_SHOW_TIPS!"); - wxWindow::DoSetToolTip(tip); - } -#endif // wxUSE_TOOLTIPS - virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } + // same, for field styles + void InitStyles(); + void FreeStyles(); + void ReinitStyles() { FreeStyles(); InitStyles(); } - - // internal helpers & data: + // same, for text stacks + void InitStacks(); + void FreeStacks(); + void ReinitStacks() { FreeStacks(); InitStacks(); } // calculate the real field widths for the given total available size wxArrayInt CalculateAbsWidths(wxCoord widthTotal) const; - // should be called to remember if the pane text is currently being show - // ellipsized or not - void SetEllipsizedFlag(int n, bool isEllipsized); + // use these functions to access the stacks of field strings + wxListString *GetStatusStack(int i) const; + wxListString *GetOrCreateStatusStack(int i); + // the current number of fields + int m_nFields; - // the array with the pane infos: - wxStatusBarPaneArray m_panes; + // the widths of the fields in pixels if !NULL, all fields have the same + // width otherwise + int *m_statusWidths; - // if true overrides the width info of the wxStatusBarPanes - bool m_bSameWidthForAllPanes; + // the styles of the fields + int *m_statusStyles; - wxDECLARE_NO_COPY_CLASS(wxStatusBarBase); + // stacks of previous values for PushStatusText/PopStatusText + // this is created on demand, use GetStatusStack/GetOrCreateStatusStack + wxListString **m_statusTextStacks; + + DECLARE_NO_COPY_CLASS(wxStatusBarBase) }; // ---------------------------------------------------------------------------- @@ -233,15 +147,24 @@ protected: #if defined(__WXUNIVERSAL__) #define wxStatusBarUniv wxStatusBar + #include "wx/univ/statusbr.h" -#elif defined(__WXMSW__) && wxUSE_NATIVE_STATUSBAR - #include "wx/msw/statusbar.h" +#elif defined(__WXPALMOS__) + #define wxStatusBarPalm wxStatusBar + + #include "wx/palmos/statusbr.h" +#elif defined(__WIN32__) && wxUSE_NATIVE_STATUSBAR + #define wxStatusBar95 wxStatusBar + + #include "wx/msw/statbr95.h" #elif defined(__WXMAC__) #define wxStatusBarMac wxStatusBar + #include "wx/generic/statusbr.h" - #include "wx/osx/statusbr.h" + #include "wx/mac/statusbr.h" #else #define wxStatusBarGeneric wxStatusBar + #include "wx/generic/statusbr.h" #endif diff --git a/Source/3rd Party/wx/include/wx/stdpaths.h b/Source/3rd Party/wx/include/wx/stdpaths.h index 6feeac4ae..beb8b13b7 100644 --- a/Source/3rd Party/wx/include/wx/stdpaths.h +++ b/Source/3rd Party/wx/include/wx/stdpaths.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 2004-10-17 -// RCS-ID: $Id$ +// RCS-ID: $Id: stdpaths.h 43340 2006-11-12 12:58:10Z RR $ // Copyright: (c) 2004 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -14,21 +14,19 @@ #include "wx/defs.h" +#if wxUSE_STDPATHS + #include "wx/string.h" #include "wx/filefn.h" -class WXDLLIMPEXP_FWD_BASE wxStandardPaths; - // ---------------------------------------------------------------------------- // wxStandardPaths returns the standard locations in the file system // ---------------------------------------------------------------------------- -// NB: This is always compiled in, wxUSE_STDPATHS=0 only disables native -// wxStandardPaths class, but a minimal version is always available class WXDLLIMPEXP_BASE wxStandardPathsBase { public: - // possible resources categories + // possible resources categorires enum ResourceCat { // no special category @@ -41,18 +39,9 @@ public: ResourceCat_Max }; - // what should we use to construct paths unique to this application: - // (AppInfo_AppName and AppInfo_VendorName can be combined together) - enum - { - AppInfo_None = 0, // nothing - AppInfo_AppName = 1, // the application name - AppInfo_VendorName = 2 // the vendor name - }; - // return the global standard paths object - static wxStandardPaths& Get(); + static wxStandardPathsBase& Get(); // return the path (directory+filename) of the running executable or // wxEmptyString if it couldn't be determined. @@ -120,7 +109,7 @@ public: // different under Unix for message catalog category (namely the standard // prefix/share/locale/lang/LC_MESSAGES) virtual wxString - GetLocalizedResourcesDir(const wxString& lang, + GetLocalizedResourcesDir(const wxChar *lang, ResourceCat WXUNUSED(category) = ResourceCat_None) const { @@ -129,72 +118,40 @@ public: // return the "Documents" directory for the current user // - // C:\Documents and Settings\username\My Documents under Windows, + // C:\Documents and Settings\username\Documents under Windows, // $HOME under Unix and ~/Documents under Mac virtual wxString GetDocumentsDir() const; - // return the directory for the documents files used by this application: - // it's a subdirectory of GetDocumentsDir() constructed using the - // application name/vendor if it exists or just GetDocumentsDir() otherwise - virtual wxString GetAppDocumentsDir() const; - // return the temporary directory for the current user virtual wxString GetTempDir() const; - // ctor for the base class - wxStandardPathsBase(); - // virtual dtor for the base class virtual ~wxStandardPathsBase(); - // Information used by AppendAppInfo - void UseAppInfo(int info) - { - m_usedAppInfo = info; - } - - bool UsesAppInfo(int info) const { return (m_usedAppInfo & info) != 0; } - - protected: - // append the path component, with a leading path separator if a - // path separator or dot (.) is not already at the end of dir - static wxString AppendPathComponent(const wxString& dir, const wxString& component); - - // append application information determined by m_usedAppInfo to dir - wxString AppendAppInfo(const wxString& dir) const; - - - // combination of AppInfo_XXX flags used by AppendAppInfo() - int m_usedAppInfo; + // append "/appname" suffix if the app name is set (doesn't append the + // slash if dir already ends with a slash or dot) + static wxString AppendAppName(const wxString& dir); }; -#if wxUSE_STDPATHS - #if defined(__WINDOWS__) - #include "wx/msw/stdpaths.h" - #define wxHAS_NATIVE_STDPATHS - // We want CoreFoundation paths on both CarbonLib and Darwin (for all ports) - #elif defined(__WXMAC__) || defined(__DARWIN__) - #include "wx/osx/core/stdpaths.h" - #define wxHAS_NATIVE_STDPATHS - #elif defined(__OS2__) - #include "wx/os2/stdpaths.h" - #define wxHAS_NATIVE_STDPATHS - #elif defined(__UNIX__) - #include "wx/unix/stdpaths.h" - #define wxHAS_NATIVE_STDPATHS - #endif -#endif +#if defined(__WXMSW__) + #include "wx/msw/stdpaths.h" +// We want CoreFoundation paths on both CarbonLib and Darwin (for all ports) +#elif defined(__WXMAC__) || defined(__DARWIN__) + #include "wx/mac/corefoundation/stdpaths.h" +#elif defined(__OS2__) + #include "wx/os2/stdpaths.h" +#elif defined(__UNIX__) + #include "wx/unix/stdpaths.h" +#elif defined(__PALMOS__) + #include "wx/palmos/stdpaths.h" +#else // ---------------------------------------------------------------------------- // Minimal generic implementation // ---------------------------------------------------------------------------- -// NB: Note that this minimal implementation is compiled in even if -// wxUSE_STDPATHS=0, so that our code can still use wxStandardPaths. - -#ifndef wxHAS_NATIVE_STDPATHS class WXDLLIMPEXP_BASE wxStandardPaths : public wxStandardPathsBase { public: @@ -213,7 +170,10 @@ public: private: wxString m_prefix; }; -#endif // !wxHAS_NATIVE_STDPATHS + +#endif + +#endif // wxUSE_STDPATHS #endif // _WX_STDPATHS_H_ diff --git a/Source/3rd Party/wx/include/wx/stdstream.h b/Source/3rd Party/wx/include/wx/stdstream.h deleted file mode 100644 index 36845673f..000000000 --- a/Source/3rd Party/wx/include/wx/stdstream.h +++ /dev/null @@ -1,123 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/stdstream.h -// Purpose: Header of std::istream and std::ostream derived wrappers for -// wxInputStream and wxOutputStream -// Author: Jonathan Liu -// Created: 2009-05-02 -// RCS-ID: $Id$ -// Copyright: (c) 2009 Jonathan Liu -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_STDSTREAM_H_ -#define _WX_STDSTREAM_H_ - -#include "wx/defs.h" // wxUSE_STD_IOSTREAM - -#if wxUSE_STREAMS && wxUSE_STD_IOSTREAM - -#include "wx/defs.h" -#include "wx/stream.h" -#include "wx/ioswrap.h" - -// ========================================================================== -// wxStdInputStreamBuffer -// ========================================================================== - -class WXDLLIMPEXP_BASE wxStdInputStreamBuffer : public std::streambuf -{ -public: - wxStdInputStreamBuffer(wxInputStream& stream); - virtual ~wxStdInputStreamBuffer() { } - -protected: - virtual std::streambuf *setbuf(char *s, std::streamsize n); - virtual std::streampos seekoff(std::streamoff off, - std::ios_base::seekdir way, - std::ios_base::openmode which = - std::ios_base::in | - std::ios_base::out); - virtual std::streampos seekpos(std::streampos sp, - std::ios_base::openmode which = - std::ios_base::in | - std::ios_base::out); - virtual std::streamsize showmanyc(); - virtual std::streamsize xsgetn(char *s, std::streamsize n); - virtual int underflow(); - virtual int uflow(); - virtual int pbackfail(int c = EOF); - - // Special work around for VC8/9 (this bug was fixed in VC10 and later): - // these versions have non-standard _Xsgetn_s() that it being called from - // the stream code instead of xsgetn() and so our overridden implementation - // never actually gets used. To work around this, forward to it explicitly. -#if defined(__VISUALC8__) || defined(__VISUALC9__) - virtual std::streamsize - _Xsgetn_s(char *s, size_t WXUNUSED(size), std::streamsize n) - { - return xsgetn(s, n); - } -#endif // VC8 or VC9 - - wxInputStream& m_stream; - int m_lastChar; -}; - -// ========================================================================== -// wxStdInputStream -// ========================================================================== - -class WXDLLIMPEXP_BASE wxStdInputStream : public std::istream -{ -public: - wxStdInputStream(wxInputStream& stream); - virtual ~wxStdInputStream() { } - -protected: - wxStdInputStreamBuffer m_streamBuffer; -}; - -// ========================================================================== -// wxStdOutputStreamBuffer -// ========================================================================== - -class WXDLLIMPEXP_BASE wxStdOutputStreamBuffer : public std::streambuf -{ -public: - wxStdOutputStreamBuffer(wxOutputStream& stream); - virtual ~wxStdOutputStreamBuffer() { } - -protected: - virtual std::streambuf *setbuf(char *s, std::streamsize n); - virtual std::streampos seekoff(std::streamoff off, - std::ios_base::seekdir way, - std::ios_base::openmode which = - std::ios_base::in | - std::ios_base::out); - virtual std::streampos seekpos(std::streampos sp, - std::ios_base::openmode which = - std::ios_base::in | - std::ios_base::out); - virtual std::streamsize xsputn(const char *s, std::streamsize n); - virtual int overflow(int c); - - wxOutputStream& m_stream; -}; - -// ========================================================================== -// wxStdOutputStream -// ========================================================================== - -class WXDLLIMPEXP_BASE wxStdOutputStream : public std::ostream -{ -public: - wxStdOutputStream(wxOutputStream& stream); - virtual ~wxStdOutputStream() { } - -protected: - wxStdOutputStreamBuffer m_streamBuffer; -}; - -#endif // wxUSE_STREAMS && wxUSE_STD_IOSTREAM - -#endif // _WX_STDSTREAM_H_ diff --git a/Source/3rd Party/wx/include/wx/stockitem.h b/Source/3rd Party/wx/include/wx/stockitem.h index 675f039df..31ac5213a 100644 --- a/Source/3rd Party/wx/include/wx/stockitem.h +++ b/Source/3rd Party/wx/include/wx/stockitem.h @@ -4,7 +4,7 @@ // Author: Vaclav Slavik // Modified by: // Created: 2004-08-15 -// RCS-ID: $Id$ +// RCS-ID: $Id: stockitem.h 42935 2006-11-02 09:51:49Z JS $ // Copyright: (c) Vaclav Slavik, 2004 // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -13,7 +13,7 @@ #define _WX_STOCKITEM_H_ #include "wx/defs.h" -#include "wx/chartype.h" +#include "wx/wxchar.h" #include "wx/string.h" #include "wx/accel.h" @@ -22,40 +22,32 @@ // ---------------------------------------------------------------------------- // Returns true if the ID is in the list of recognized stock actions -WXDLLIMPEXP_CORE bool wxIsStockID(wxWindowID id); +WXDLLEXPORT bool wxIsStockID(wxWindowID id); // Returns true of the label is empty or label of a stock button with // given ID -WXDLLIMPEXP_CORE bool wxIsStockLabel(wxWindowID id, const wxString& label); +WXDLLEXPORT bool wxIsStockLabel(wxWindowID id, const wxString& label); enum wxStockLabelQueryFlag { wxSTOCK_NOFLAGS = 0, wxSTOCK_WITH_MNEMONIC = 1, - wxSTOCK_WITH_ACCELERATOR = 2, - - // by default, stock items text is returned with ellipsis, if appropriate, - // this flag allows to avoid having it - wxSTOCK_WITHOUT_ELLIPSIS = 4, - - // return label for button, not menu item: buttons should always use - // mnemonics and never use ellipsis - wxSTOCK_FOR_BUTTON = wxSTOCK_WITHOUT_ELLIPSIS | wxSTOCK_WITH_MNEMONIC + wxSTOCK_WITH_ACCELERATOR = 2 }; // Returns label that should be used for given stock UI element (e.g. "&OK" // for wxSTOCK_OK); if wxSTOCK_WITH_MNEMONIC is given, the & character // is included; if wxSTOCK_WITH_ACCELERATOR is given, the stock accelerator // for given ID is concatenated to the label using \t as separator -WXDLLIMPEXP_CORE wxString wxGetStockLabel(wxWindowID id, +WXDLLEXPORT wxString wxGetStockLabel(wxWindowID id, long flags = wxSTOCK_WITH_MNEMONIC); #if wxUSE_ACCEL // Returns the accelerator that should be used for given stock UI element // (e.g. "Ctrl+x" for wxSTOCK_EXIT) - WXDLLIMPEXP_CORE wxAcceleratorEntry wxGetStockAccelerator(wxWindowID id); + WXDLLEXPORT wxAcceleratorEntry wxGetStockAccelerator(wxWindowID id); #endif @@ -67,14 +59,14 @@ enum wxStockHelpStringClient }; // Returns an help string for the given stock UI element and for the given "context". -WXDLLIMPEXP_CORE wxString wxGetStockHelpString(wxWindowID id, +WXDLLEXPORT wxString wxGetStockHelpString(wxWindowID id, wxStockHelpStringClient client = wxSTOCK_MENU); #ifdef __WXGTK20__ // Translates stock ID to GTK+'s stock item string indentifier: -WXDLLIMPEXP_CORE const char *wxGetStockGtkID(wxWindowID id); +WXDLLEXPORT const char *wxGetStockGtkID(wxWindowID id); #endif diff --git a/Source/3rd Party/wx/include/wx/stopwatch.h b/Source/3rd Party/wx/include/wx/stopwatch.h index cd6929446..8733708c8 100644 --- a/Source/3rd Party/wx/include/wx/stopwatch.h +++ b/Source/3rd Party/wx/include/wx/stopwatch.h @@ -1,12 +1,10 @@ ///////////////////////////////////////////////////////////////////////////// // Name: wx/stopwatch.h // Purpose: wxStopWatch and global time-related functions -// Author: Julian Smart (wxTimer), Sylvain Bougnoux (wxStopWatch), -// Vadim Zeitlin (time functions, current wxStopWatch) +// Author: Julian Smart (wxTimer), Sylvain Bougnoux (wxStopWatch) // Created: 26.06.03 (extracted from wx/timer.h) -// RCS-ID: $Id$ +// RCS-ID: $Id: stopwatch.h 61872 2009-09-09 22:37:05Z VZ $ // Copyright: (c) 1998-2003 Julian Smart, Sylvain Bougnoux -// (c) 2011 Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -16,11 +14,6 @@ #include "wx/defs.h" #include "wx/longlong.h" -// Time-related functions are also available via this header for compatibility -// but you should include wx/time.h directly if you need only them and not -// wxStopWatch itself. -#include "wx/time.h" - // ---------------------------------------------------------------------------- // wxStopWatch: measure time intervals with up to 1ms resolution // ---------------------------------------------------------------------------- @@ -33,16 +26,14 @@ public: // ctor starts the stop watch wxStopWatch() { m_pauseCount = 0; Start(); } - // Start the stop watch at the moment t0 expressed in milliseconds (i.e. - // calling Time() immediately afterwards returns t0). This can be used to - // restart an existing stopwatch. + // start the stop watch at the moment t0 void Start(long t0 = 0); // pause the stop watch void Pause() { if ( m_pauseCount++ == 0 ) - m_elapsedBeforePause = GetCurrentClockValue() - m_t0; + m_pause = GetElapsedTime(); } // resume it @@ -52,37 +43,22 @@ public: wxT("Resuming stop watch which is not paused") ); if ( --m_pauseCount == 0 ) - { - DoStart(); - m_t0 -= m_elapsedBeforePause; - } + Start(m_pause); } - // Get elapsed time since the last Start() in microseconds. - wxLongLong TimeInMicro() const; - // get elapsed time since the last Start() in milliseconds - long Time() const { return (TimeInMicro()/1000).ToLong(); } + long Time() const; + +protected: + // returns the elapsed time since t0 + long GetElapsedTime() const; private: - // Really starts the stop watch. The initial time is set to current clock - // value. - void DoStart(); - - // Returns the current clock value in its native units. - wxLongLong GetCurrentClockValue() const; - - // Return the frequency of the clock used in its ticks per second. - wxLongLong GetClockFreq() const; - - - // The clock value when the stop watch was last started. Its units vary - // depending on the platform. + // the time of the last Start() wxLongLong m_t0; - // The elapsed time as of last Pause() call (only valid if m_pauseCount > - // 0) in the same units as m_t0. - wxLongLong m_elapsedBeforePause; + // the time of the last Pause() (only valid if m_pauseCount > 0) + long m_pause; // if > 0, the stop watch is paused, otherwise it is running int m_pauseCount; @@ -102,4 +78,25 @@ private: #endif // wxUSE_LONGLONG && WXWIN_COMPATIBILITY_2_6 +// ---------------------------------------------------------------------------- +// global time functions +// ---------------------------------------------------------------------------- + +// Get number of seconds since local time 00:00:00 Jan 1st 1970. +extern long WXDLLIMPEXP_BASE wxGetLocalTime(); + +// Get number of seconds since GMT 00:00:00, Jan 1st 1970. +extern long WXDLLIMPEXP_BASE wxGetUTCTime(); + +#if wxUSE_LONGLONG + typedef wxLongLong wxMilliClock_t; +#else + typedef double wxMilliClock_t; +#endif // wxUSE_LONGLONG + +// Get number of milliseconds since local time 00:00:00 Jan 1st 1970 +extern wxMilliClock_t WXDLLIMPEXP_BASE wxGetLocalTimeMillis(); + +#define wxGetCurrentTime() wxGetLocalTime() + #endif // _WX_STOPWATCH_H_ diff --git a/Source/3rd Party/wx/include/wx/strconv.h b/Source/3rd Party/wx/include/wx/strconv.h index 526075105..7d167fab7 100644 --- a/Source/3rd Party/wx/include/wx/strconv.h +++ b/Source/3rd Party/wx/include/wx/strconv.h @@ -1,10 +1,10 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: wx/strconv.h +// Name: strconv.h // Purpose: conversion routines for char sets any Unicode // Author: Ove Kaaven, Robert Roebling, Vadim Zeitlin // Modified by: // Created: 29/01/98 -// RCS-ID: $Id$ +// RCS-ID: $Id: strconv.h 45893 2007-05-08 20:05:16Z VZ $ // Copyright: (c) 1998 Ove Kaaven, Robert Roebling // (c) 1998-2006 Vadim Zeitlin // Licence: wxWindows licence @@ -14,7 +14,7 @@ #define _WX_STRCONV_H_ #include "wx/defs.h" -#include "wx/chartype.h" +#include "wx/wxchar.h" #include "wx/buffer.h" #ifdef __DIGITALMARS__ @@ -27,11 +27,15 @@ #include -class WXDLLIMPEXP_FWD_BASE wxString; +#if wxUSE_WCHAR_T // the error value returned by wxMBConv methods #define wxCONV_FAILED ((size_t)-1) +// the default value for some length parameters meaning that the string is +// NUL-terminated +#define wxNO_LEN ((size_t)-1) + // ---------------------------------------------------------------------------- // wxMBConv (abstract base class for conversions) // ---------------------------------------------------------------------------- @@ -57,21 +61,19 @@ public: // there is not enough space for everything, including the trailing NUL // character(s), in the output buffer, wxCONV_FAILED is returned. // - // In the special case when dst is NULL (the value of dstLen is ignored - // then) the return value is the length of the needed buffer but nothing - // happens otherwise. If srcLen is wxNO_LEN, the entire string, up to and + // In the special case when dstLen is 0 (outputBuf may be NULL then) the + // return value is the length of the needed buffer but nothing happens + // otherwise. If srcLen is wxNO_LEN, the entire string, up to and // including the trailing NUL(s), is converted, otherwise exactly srcLen // bytes are. // // Typical usage: // // size_t dstLen = conv.ToWChar(NULL, 0, src); - // if ( dstLen == wxCONV_FAILED ) + // if ( dstLen != wxCONV_FAILED ) // ... handle error ... // wchar_t *wbuf = new wchar_t[dstLen]; // conv.ToWChar(wbuf, dstLen, src); - // ... work with wbuf ... - // delete [] wbuf; // virtual size_t ToWChar(wchar_t *dst, size_t dstLen, const char *src, size_t srcLen = wxNO_LEN) const; @@ -89,29 +91,20 @@ public: // Convenience functions for converting strings which may contain embedded // NULs and don't have to be NUL-terminated. // - // inLen is the length of the buffer including trailing NUL if any or - // wxNO_LEN if the input is NUL-terminated. + // inLen is the length of the buffer including trailing NUL if any: if the + // last 4 bytes of the buffer are all NULs, these functions are more + // efficient as they avoid copying the string, but otherwise a copy is made + // internally which could be quite bad for (very) long strings. // // outLen receives, if not NULL, the length of the converted string or 0 if // the conversion failed (returning 0 and not -1 in this case makes it // difficult to distinguish between failed conversion and empty input but - // this is done for backwards compatibility). Notice that the rules for - // whether outLen accounts or not for the last NUL are the same as for - // To/FromWChar() above: if inLen is specified, outLen is exactly the - // number of characters converted, whether the last one of them was NUL or - // not. But if inLen == wxNO_LEN then outLen doesn't account for the last - // NUL even though it is present. + // this is done for backwards compatibility) const wxWCharBuffer cMB2WC(const char *in, size_t inLen, size_t *outLen) const; const wxCharBuffer cWC2MB(const wchar_t *in, size_t inLen, size_t *outLen) const; - // And yet more convenience functions for converting the entire buffers: - // these are the simplest and least error-prone as you never need to bother - // with lengths/sizes directly. - const wxWCharBuffer cMB2WC(const wxScopedCharBuffer& in) const; - const wxCharBuffer cWC2MB(const wxScopedWCharBuffer& in) const; - // convenience functions for converting MB or WC to/from wxWin default #if wxUSE_UNICODE const wxWCharBuffer cMB2WX(const char *psz) const { return cMB2WC(psz); } @@ -142,12 +135,6 @@ public: // encoding static size_t GetMaxMBNulLen() { return 4 /* for UTF-32 */; } -#if wxUSE_UNICODE_UTF8 - // return true if the converter's charset is UTF-8, i.e. char* strings - // decoded using this object can be directly copied to wxString's internal - // storage without converting to WC and than back to UTF-8 MB string - virtual bool IsUTF8() const { return false; } -#endif // The old conversion functions. The existing classes currently mostly // implement these ones but we're in transition to using To/FromWChar() @@ -188,10 +175,6 @@ public: virtual size_t WC2MB(char *outputBuf, const wchar_t *psz, size_t outputSize) const; virtual wxMBConv *Clone() const { return new wxMBConvLibc; } - -#if wxUSE_UNICODE_UTF8 - virtual bool IsUTF8() const { return wxLocaleIsUtf8; } -#endif }; #ifdef __UNIX__ @@ -206,7 +189,7 @@ public: class WXDLLIMPEXP_BASE wxConvBrokenFileNames : public wxMBConv { public: - wxConvBrokenFileNames(const wxString& charset); + wxConvBrokenFileNames(const wxChar *charset); wxConvBrokenFileNames(const wxConvBrokenFileNames& conv) : wxMBConv(), m_conv(conv.m_conv ? conv.m_conv->Clone() : NULL) @@ -230,17 +213,13 @@ public: return m_conv->GetMBNulLen(); } -#if wxUSE_UNICODE_UTF8 - virtual bool IsUTF8() const { return m_conv->IsUTF8(); } -#endif - virtual wxMBConv *Clone() const { return new wxConvBrokenFileNames(*this); } private: // the conversion object we forward to wxMBConv *m_conv; - wxDECLARE_NO_ASSIGN_CLASS(wxConvBrokenFileNames); + DECLARE_NO_ASSIGN_CLASS(wxConvBrokenFileNames) }; #endif // __UNIX__ @@ -252,113 +231,17 @@ private: class WXDLLIMPEXP_BASE wxMBConvUTF7 : public wxMBConv { public: - wxMBConvUTF7() { } - - // compiler-generated copy ctor, assignment operator and dtor are ok - // (assuming it's ok to copy the shift state -- not really sure about it) - - virtual size_t ToWChar(wchar_t *dst, size_t dstLen, - const char *src, size_t srcLen = wxNO_LEN) const; - virtual size_t FromWChar(char *dst, size_t dstLen, - const wchar_t *src, size_t srcLen = wxNO_LEN) const; + virtual size_t MB2WC(wchar_t *outputBuf, const char *psz, size_t outputSize) const; + virtual size_t WC2MB(char *outputBuf, const wchar_t *psz, size_t outputSize) const; virtual wxMBConv *Clone() const { return new wxMBConvUTF7; } - -private: - // UTF-7 decoder/encoder may be in direct mode or in shifted mode after a - // '+' (and until the '-' or any other non-base64 character) - struct StateMode - { - enum Mode - { - Direct, // pass through state - Shifted // after a '+' (and before '-') - }; - }; - - // the current decoder state: this is only used by ToWChar() if srcLen - // parameter is not wxNO_LEN, when working on the entire NUL-terminated - // strings we neither update nor use the state - class DecoderState : private StateMode - { - private: - // current state: this one is private as we want to enforce the use of - // ToDirect/ToShifted() methods below - Mode mode; - - public: - // the initial state is direct - DecoderState() { mode = Direct; } - - // switch to/from shifted mode - void ToDirect() { mode = Direct; } - void ToShifted() { mode = Shifted; accum = bit = 0; isLSB = false; } - - bool IsDirect() const { return mode == Direct; } - bool IsShifted() const { return mode == Shifted; } - - - // these variables are only used in shifted mode - - unsigned int accum; // accumulator of the bit we've already got - unsigned int bit; // the number of bits consumed mod 8 - unsigned char msb; // the high byte of UTF-16 word - bool isLSB; // whether we're decoding LSB or MSB of UTF-16 word - }; - - DecoderState m_stateDecoder; - - - // encoder state is simpler as we always receive entire Unicode characters - // on input - class EncoderState : private StateMode - { - private: - Mode mode; - - public: - EncoderState() { mode = Direct; } - - void ToDirect() { mode = Direct; } - void ToShifted() { mode = Shifted; accum = bit = 0; } - - bool IsDirect() const { return mode == Direct; } - bool IsShifted() const { return mode == Shifted; } - - unsigned int accum; - unsigned int bit; - }; - - EncoderState m_stateEncoder; }; // ---------------------------------------------------------------------------- // wxMBConvUTF8 (for conversion using UTF8 encoding) // ---------------------------------------------------------------------------- -// this is the real UTF-8 conversion class, it has to be called "strict UTF-8" -// for compatibility reasons: the wxMBConvUTF8 class below also supports lossy -// conversions if it is created with non default options -class WXDLLIMPEXP_BASE wxMBConvStrictUTF8 : public wxMBConv -{ -public: - // compiler-generated default ctor and other methods are ok - - virtual size_t ToWChar(wchar_t *dst, size_t dstLen, - const char *src, size_t srcLen = wxNO_LEN) const; - virtual size_t FromWChar(char *dst, size_t dstLen, - const wchar_t *src, size_t srcLen = wxNO_LEN) const; - - virtual wxMBConv *Clone() const { return new wxMBConvStrictUTF8(); } - -#if wxUSE_UNICODE_UTF8 - // NB: other mapping modes are not, strictly speaking, UTF-8, so we can't - // take the shortcut in that case - virtual bool IsUTF8() const { return true; } -#endif -}; - -class WXDLLIMPEXP_BASE wxMBConvUTF8 : public wxMBConvStrictUTF8 +class WXDLLIMPEXP_BASE wxMBConvUTF8 : public wxMBConv { public: enum @@ -369,20 +252,11 @@ public: }; wxMBConvUTF8(int options = MAP_INVALID_UTF8_NOT) : m_options(options) { } - - virtual size_t ToWChar(wchar_t *dst, size_t dstLen, - const char *src, size_t srcLen = wxNO_LEN) const; - virtual size_t FromWChar(char *dst, size_t dstLen, - const wchar_t *src, size_t srcLen = wxNO_LEN) const; + virtual size_t MB2WC(wchar_t *outputBuf, const char *psz, size_t outputSize) const; + virtual size_t WC2MB(char *outputBuf, const wchar_t *psz, size_t outputSize) const; virtual wxMBConv *Clone() const { return new wxMBConvUTF8(m_options); } -#if wxUSE_UNICODE_UTF8 - // NB: other mapping modes are not, strictly speaking, UTF-8, so we can't - // take the shortcut in that case - virtual bool IsUTF8() const { return m_options == MAP_INVALID_UTF8_NOT; } -#endif - private: int m_options; }; @@ -491,7 +365,7 @@ class WXDLLIMPEXP_BASE wxCSConv : public wxMBConv public: // we can be created either from charset name or from an encoding constant // but we can't have both at once - wxCSConv(const wxString& charset); + wxCSConv(const wxChar *charset); wxCSConv(wxFontEncoding encoding); wxCSConv(const wxCSConv& conv); @@ -503,53 +377,42 @@ public: const char *src, size_t srcLen = wxNO_LEN) const; virtual size_t FromWChar(char *dst, size_t dstLen, const wchar_t *src, size_t srcLen = wxNO_LEN) const; + virtual size_t MB2WC(wchar_t *outputBuf, const char *psz, size_t outputSize) const; + virtual size_t WC2MB(char *outputBuf, const wchar_t *psz, size_t outputSize) const; virtual size_t GetMBNulLen() const; -#if wxUSE_UNICODE_UTF8 - virtual bool IsUTF8() const; -#endif - virtual wxMBConv *Clone() const { return new wxCSConv(*this); } void Clear(); - // return true if the conversion could be initialized successfully +#if wxABI_VERSION >= 20802 + // return true if the conversion could be initilized successfully bool IsOk() const; +#endif // wx 2.8.2+ private: // common part of all ctors void Init(); - // Creates the conversion to use, called from all ctors to initialize - // m_convReal. + // creates m_convReal if necessary + void CreateConvIfNeeded() const; + + // do create m_convReal (unconditionally) wxMBConv *DoCreate() const; - // Set the name (may be only called when m_name == NULL), makes copy of - // the charset string. - void SetName(const char *charset); - - // Set m_encoding field respecting the rules below, i.e. making sure it has - // a valid value if m_name == NULL (thus this should be always called after - // SetName()). - // - // Input encoding may be valid or not. - void SetEncoding(wxFontEncoding encoding); + // set the name (may be only called when m_name == NULL), makes copy of + // charset string + void SetName(const wxChar *charset); - // The encoding we use is specified by the two fields below: - // - // 1. If m_name != NULL, m_encoding corresponds to it if it's one of - // encodings we know about (i.e. member of wxFontEncoding) or is - // wxFONTENCODING_SYSTEM otherwise. - // - // 2. If m_name == NULL, m_encoding is always valid, i.e. not one of - // wxFONTENCODING_{SYSTEM,DEFAULT,MAX}. - char *m_name; + // note that we can't use wxString here because of compilation + // dependencies: we're included from wx/string.h + wxChar *m_name; wxFontEncoding m_encoding; - // The conversion object for our encoding or NULL if we failed to create it - // in which case we fall back to hard-coded ISO8859-1 conversion. + // use CreateConvIfNeeded() before accessing m_convReal! wxMBConv *m_convReal; + bool m_deferred; }; @@ -557,35 +420,14 @@ private: // declare predefined conversion objects // ---------------------------------------------------------------------------- -// Note: this macro is an implementation detail (see the comment in -// strconv.cpp). The wxGet_XXX() and wxGet_XXXPtr() functions shouldn't be -// used by user code and neither should XXXPtr, use the wxConvXXX macro -// instead. -#define WX_DECLARE_GLOBAL_CONV(klass, name) \ - extern WXDLLIMPEXP_DATA_BASE(klass*) name##Ptr; \ - extern WXDLLIMPEXP_BASE klass* wxGet_##name##Ptr(); \ - inline klass& wxGet_##name() \ - { \ - if ( !name##Ptr ) \ - name##Ptr = wxGet_##name##Ptr(); \ - return *name##Ptr; \ - } - - // conversion to be used with all standard functions affected by locale, e.g. // strtol(), strftime(), ... -WX_DECLARE_GLOBAL_CONV(wxMBConv, wxConvLibc) -#define wxConvLibc wxGet_wxConvLibc() +extern WXDLLIMPEXP_DATA_BASE(wxMBConv&) wxConvLibc; // conversion ISO-8859-1/UTF-7/UTF-8 <-> wchar_t -WX_DECLARE_GLOBAL_CONV(wxCSConv, wxConvISO8859_1) -#define wxConvISO8859_1 wxGet_wxConvISO8859_1() - -WX_DECLARE_GLOBAL_CONV(wxMBConvStrictUTF8, wxConvUTF8) -#define wxConvUTF8 wxGet_wxConvUTF8() - -WX_DECLARE_GLOBAL_CONV(wxMBConvUTF7, wxConvUTF7) -#define wxConvUTF7 wxGet_wxConvUTF7() +extern WXDLLIMPEXP_DATA_BASE(wxCSConv&) wxConvISO8859_1; +extern WXDLLIMPEXP_DATA_BASE(wxMBConvUTF7&) wxConvUTF7; +extern WXDLLIMPEXP_DATA_BASE(wxMBConvUTF8&) wxConvUTF8; // conversion used for the file names on the systems where they're not Unicode // (basically anything except Windows) @@ -604,8 +446,7 @@ extern WXDLLIMPEXP_DATA_BASE(wxMBConv *) wxConvFileName; extern WXDLLIMPEXP_DATA_BASE(wxMBConv *) wxConvCurrent; // the conversion corresponding to the current locale -WX_DECLARE_GLOBAL_CONV(wxCSConv, wxConvLocal) -#define wxConvLocal wxGet_wxConvLocal() +extern WXDLLIMPEXP_DATA_BASE(wxCSConv&) wxConvLocal; // the conversion corresponding to the encoding of the standard UI elements // @@ -613,8 +454,6 @@ WX_DECLARE_GLOBAL_CONV(wxCSConv, wxConvLocal) // needs to use a fixed encoding extern WXDLLIMPEXP_DATA_BASE(wxMBConv *) wxConvUI; -#undef WX_DECLARE_GLOBAL_CONV - // ---------------------------------------------------------------------------- // endianness-dependent conversions // ---------------------------------------------------------------------------- @@ -632,11 +471,17 @@ extern WXDLLIMPEXP_DATA_BASE(wxMBConv *) wxConvUI; // ---------------------------------------------------------------------------- // filenames are multibyte on Unix and widechar on Windows +#if defined(__UNIX__) || defined(__WXMAC__) + #define wxMBFILES 1 +#else + #define wxMBFILES 0 +#endif + #if wxMBFILES && wxUSE_UNICODE #define wxFNCONV(name) wxConvFileName->cWX2MB(name) #define wxFNSTRINGCAST wxMBSTRINGCAST #else -#if defined( __WXOSX_OR_COCOA__ ) && wxMBFILES +#if defined( __WXOSX__ ) && wxMBFILES #define wxFNCONV(name) wxConvFileName->cWC2MB( wxConvLocal.cWX2WC(name) ) #else #define wxFNCONV(name) name @@ -644,6 +489,36 @@ extern WXDLLIMPEXP_DATA_BASE(wxMBConv *) wxConvUI; #define wxFNSTRINGCAST WXSTRINGCAST #endif +#else // !wxUSE_WCHAR_T + +// ---------------------------------------------------------------------------- +// stand-ins in absence of wchar_t +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxMBConv +{ +public: + const char* cMB2WX(const char *psz) const { return psz; } + const char* cWX2MB(const char *psz) const { return psz; } + wxMBConv *Clone() const { return NULL; } +}; + +#define wxConvFile wxConvLocal +#define wxConvUI wxConvCurrent + +typedef wxMBConv wxCSConv; + +extern WXDLLIMPEXP_DATA_BASE(wxMBConv) wxConvLibc, + wxConvLocal, + wxConvISO8859_1, + wxConvUTF8; +extern WXDLLIMPEXP_DATA_BASE(wxMBConv *) wxConvCurrent; + +#define wxFNCONV(name) name +#define wxFNSTRINGCAST WXSTRINGCAST + +#endif // wxUSE_WCHAR_T/!wxUSE_WCHAR_T + // ---------------------------------------------------------------------------- // macros for the most common conversions // ---------------------------------------------------------------------------- @@ -652,6 +527,7 @@ extern WXDLLIMPEXP_DATA_BASE(wxMBConv *) wxConvUI; #define wxConvertWX2MB(s) wxConvCurrent->cWX2MB(s) #define wxConvertMB2WX(s) wxConvCurrent->cMB2WX(s) +#if wxABI_VERSION >= 20802 // these functions should be used when the conversions really, really have // to succeed (usually because we pass their results to a standard C // function which would crash if we passed NULL to it), so these functions @@ -664,6 +540,7 @@ extern WXDLLIMPEXP_DATA_BASE(wxMBConv *) wxConvUI; // this function uses wxConvLibc and wxConvUTF8(MAP_INVALID_UTF8_TO_OCTAL) // if it fails extern WXDLLIMPEXP_BASE wxCharBuffer wxSafeConvertWX2MB(const wchar_t *ws); +#endif // wxABI 2.8.2+ #else // ANSI // no conversions to do #define wxConvertWX2MB(s) (s) diff --git a/Source/3rd Party/wx/include/wx/stream.h b/Source/3rd Party/wx/include/wx/stream.h index ff0fe9041..bea273189 100644 --- a/Source/3rd Party/wx/include/wx/stream.h +++ b/Source/3rd Party/wx/include/wx/stream.h @@ -4,7 +4,7 @@ // Author: Guilhem Lavaux, Guillermo Rodriguez Garcia, Vadim Zeitlin // Modified by: // Created: 11/07/98 -// RCS-ID: $Id$ +// RCS-ID: $Id: stream.h 53135 2008-04-12 02:31:04Z VZ $ // Copyright: (c) Guilhem Lavaux // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -52,7 +52,7 @@ const int wxEOF = -1; // wxStreamBase: common (but non virtual!) base for all stream classes // --------------------------------------------------------------------------- -class WXDLLIMPEXP_BASE wxStreamBase : public wxObject +class WXDLLIMPEXP_BASE wxStreamBase { public: wxStreamBase(); @@ -64,7 +64,7 @@ public: bool operator!() const { return !IsOk(); } // reset the stream state - void Reset(wxStreamError error = wxSTREAM_NO_ERROR) { m_lasterror = error; } + void Reset() { m_lasterror = wxSTREAM_NO_ERROR; } // this doesn't make sense for all streams, always test its return value virtual size_t GetSize() const; @@ -82,8 +82,7 @@ protected: friend class wxStreamBuffer; - DECLARE_ABSTRACT_CLASS(wxStreamBase) - wxDECLARE_NO_COPY_CLASS(wxStreamBase); + DECLARE_NO_COPY_CLASS(wxStreamBase) }; // ---------------------------------------------------------------------------- @@ -217,8 +216,7 @@ protected: friend class wxStreamBuffer; - DECLARE_ABSTRACT_CLASS(wxInputStream) - wxDECLARE_NO_COPY_CLASS(wxInputStream); + DECLARE_NO_COPY_CLASS(wxInputStream) }; // ---------------------------------------------------------------------------- @@ -253,8 +251,7 @@ protected: friend class wxStreamBuffer; - DECLARE_ABSTRACT_CLASS(wxOutputStream) - wxDECLARE_NO_COPY_CLASS(wxOutputStream); + DECLARE_NO_COPY_CLASS(wxOutputStream) }; // ============================================================================ @@ -281,8 +278,7 @@ protected: size_t m_currentPos; - DECLARE_DYNAMIC_CLASS(wxCountingOutputStream) - wxDECLARE_NO_COPY_CLASS(wxCountingOutputStream); + DECLARE_NO_COPY_CLASS(wxCountingOutputStream) }; // --------------------------------------------------------------------------- @@ -307,8 +303,7 @@ protected: wxInputStream *m_parent_i_stream; bool m_owns; - DECLARE_ABSTRACT_CLASS(wxFilterInputStream) - wxDECLARE_NO_COPY_CLASS(wxFilterInputStream); + DECLARE_NO_COPY_CLASS(wxFilterInputStream) }; class WXDLLIMPEXP_BASE wxFilterOutputStream : public wxOutputStream @@ -329,8 +324,7 @@ protected: wxOutputStream *m_parent_o_stream; bool m_owns; - DECLARE_ABSTRACT_CLASS(wxFilterOutputStream) - wxDECLARE_NO_COPY_CLASS(wxFilterOutputStream); + DECLARE_NO_COPY_CLASS(wxFilterOutputStream) }; enum wxStreamProtocolType @@ -354,12 +348,12 @@ public: virtual const wxChar * const *GetProtocols(wxStreamProtocolType type = wxSTREAM_PROTOCOL) const = 0; - bool CanHandle(const wxString& protocol, + bool CanHandle(const wxChar *protocol, wxStreamProtocolType type = wxSTREAM_PROTOCOL) const; protected: - wxString::size_type FindExtension(const wxString& location) const; + wxString::size_type FindExtension(const wxChar *location) const; DECLARE_ABSTRACT_CLASS(wxFilterClassFactoryBase) }; @@ -374,7 +368,7 @@ public: virtual wxFilterInputStream *NewStream(wxInputStream *stream) const = 0; virtual wxFilterOutputStream *NewStream(wxOutputStream *stream) const = 0; - static const wxFilterClassFactory *Find(const wxString& protocol, + static const wxFilterClassFactory *Find(const wxChar *protocol, wxStreamProtocolType type = wxSTREAM_PROTOCOL); @@ -416,23 +410,7 @@ public: read_write }; - wxStreamBuffer(wxStreamBase& stream, BufMode mode) - { - InitWithStream(stream, mode); - } - - wxStreamBuffer(size_t bufsize, wxInputStream& stream) - { - InitWithStream(stream, read); - SetBufferIO(bufsize); - } - - wxStreamBuffer(size_t bufsize, wxOutputStream& stream) - { - InitWithStream(stream, write); - SetBufferIO(bufsize); - } - + wxStreamBuffer(wxStreamBase& stream, BufMode mode); wxStreamBuffer(const wxStreamBuffer& buf); virtual ~wxStreamBuffer(); @@ -450,7 +428,6 @@ public: // Buffer control void ResetBuffer(); - void Truncate(); // NB: the buffer must always be allocated with malloc() if takeOwn is // true as it will be deallocated by free() @@ -460,7 +437,7 @@ public: void *GetBufferStart() const { return m_buffer_start; } void *GetBufferEnd() const { return m_buffer_end; } void *GetBufferPos() const { return m_buffer_pos; } - size_t GetBufferSize() const { return m_buffer_end - m_buffer_start; } + size_t GetBufferSize() const { return m_buffer_size; } size_t GetIntPosition() const { return m_buffer_pos - m_buffer_start; } void SetIntPosition(size_t pos) { m_buffer_pos = m_buffer_start + pos; } size_t GetLastAccess() const { return m_buffer_end - m_buffer_start; } @@ -475,7 +452,7 @@ public: // misc accessors wxStreamBase *GetStream() const { return m_stream; } - bool HasBuffer() const { return m_buffer_start != m_buffer_end; } + bool HasBuffer() const { return m_buffer_size != 0; } bool IsFixed() const { return m_fixed; } bool IsFlushable() const { return m_flushable; } @@ -503,9 +480,6 @@ protected: // common part of several ctors void Init(); - // common part of ctors taking wxStreamBase parameter - void InitWithStream(wxStreamBase& stream, BufMode mode); - // init buffer variables to be empty void InitBuffer(); @@ -518,6 +492,10 @@ protected: *m_buffer_end, *m_buffer_pos; + // the buffer size + // FIXME: isn't it the same as m_buffer_end - m_buffer_start? (VZ) + size_t m_buffer_size; + // the stream we're associated with wxStreamBase *m_stream; @@ -529,8 +507,13 @@ protected: m_fixed, m_flushable; - - wxDECLARE_NO_ASSIGN_CLASS(wxStreamBuffer); +private: +// Cannot use +// DECLARE_NO_COPY_CLASS(wxStreamBuffer) +// because copy constructor is explicitly declared above; +// but no copy assignment operator is defined, so declare +// it private to prevent the compiler from defining it: + wxStreamBuffer& operator=(const wxStreamBuffer&); }; // --------------------------------------------------------------------------- @@ -540,19 +523,9 @@ protected: class WXDLLIMPEXP_BASE wxBufferedInputStream : public wxFilterInputStream { public: - // create a buffered stream on top of the specified low-level stream - // - // if a non NULL buffer is given to the stream, it will be deleted by it, - // otherwise a default 1KB buffer will be used + // if a non NULL buffer is given to the stream, it will be deleted by it wxBufferedInputStream(wxInputStream& stream, wxStreamBuffer *buffer = NULL); - - // ctor allowing to specify the buffer size, it's just a more convenient - // alternative to creating wxStreamBuffer, calling its SetBufferIO(bufsize) - // and using the ctor above - wxBufferedInputStream(wxInputStream& stream, size_t bufsize); - - virtual ~wxBufferedInputStream(); char Peek(); @@ -579,7 +552,7 @@ protected: wxStreamBuffer *m_i_streambuf; - wxDECLARE_NO_COPY_CLASS(wxBufferedInputStream); + DECLARE_NO_COPY_CLASS(wxBufferedInputStream) }; // ---------------------------------------------------------------------------- @@ -589,18 +562,9 @@ protected: class WXDLLIMPEXP_BASE wxBufferedOutputStream : public wxFilterOutputStream { public: - // create a buffered stream on top of the specified low-level stream - // - // if a non NULL buffer is given to the stream, it will be deleted by it, - // otherwise a default 1KB buffer will be used + // if a non NULL buffer is given to the stream, it will be deleted by it wxBufferedOutputStream(wxOutputStream& stream, wxStreamBuffer *buffer = NULL); - - // ctor allowing to specify the buffer size, it's just a more convenient - // alternative to creating wxStreamBuffer, calling its SetBufferIO(bufsize) - // and using the ctor above - wxBufferedOutputStream(wxOutputStream& stream, size_t bufsize); - virtual ~wxBufferedOutputStream(); wxOutputStream& Write(const void *buffer, size_t size); @@ -631,7 +595,7 @@ protected: wxStreamBuffer *m_o_streambuf; - wxDECLARE_NO_COPY_CLASS(wxBufferedOutputStream); + DECLARE_NO_COPY_CLASS(wxBufferedOutputStream) }; #if WXWIN_COMPATIBILITY_2_6 @@ -640,54 +604,6 @@ protected: inline wxStreamBuffer *wxBufferedOutputStream::OutputStreamBuffer() const { return m_o_streambuf; } #endif // WXWIN_COMPATIBILITY_2_6 -// --------------------------------------------------------------------------- -// wxWrapperInputStream: forwards all IO to another stream. -// --------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxWrapperInputStream : public wxFilterInputStream -{ -public: - // Constructor fully initializing the stream. The overload taking pointer - // takes ownership of the parent stream, the one taking reference does not. - // - // Notice that this class also has a default ctor but it's protected as the - // derived class is supposed to take care of calling InitParentStream() if - // it's used. - wxWrapperInputStream(wxInputStream& stream); - wxWrapperInputStream(wxInputStream* stream); - - // Override the base class methods to forward to the wrapped stream. - virtual wxFileOffset GetLength() const; - virtual bool IsSeekable() const; - -protected: - virtual size_t OnSysRead(void *buffer, size_t size); - virtual wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode); - virtual wxFileOffset OnSysTell() const; - - // Ensure that our own last error is the same as that of the real stream. - // - // This method is const because the error must be updated even from const - // methods (in other words, it really should have been mutable in the first - // place). - void SynchronizeLastError() const - { - const_cast(this)-> - Reset(m_parent_i_stream->GetLastError()); - } - - // Default constructor, use InitParentStream() later. - wxWrapperInputStream(); - - // Set up the wrapped stream for an object initialized using the default - // constructor. The ownership logic is the same as above. - void InitParentStream(wxInputStream& stream); - void InitParentStream(wxInputStream* stream); - - wxDECLARE_NO_COPY_CLASS(wxWrapperInputStream); -}; - - #endif // wxUSE_STREAMS #endif // _WX_WXSTREAM_H__ diff --git a/Source/3rd Party/wx/include/wx/string.h b/Source/3rd Party/wx/include/wx/string.h index b3e613821..b478747c8 100644 --- a/Source/3rd Party/wx/include/wx/string.h +++ b/Source/3rd Party/wx/include/wx/string.h @@ -1,10 +1,10 @@ /////////////////////////////////////////////////////////////////////////////// // Name: wx/string.h -// Purpose: wxString class +// Purpose: wxString and wxArrayString classes // Author: Vadim Zeitlin // Modified by: // Created: 29/01/98 -// RCS-ID: $Id$ +// RCS-ID: $Id: string.h 61872 2009-09-09 22:37:05Z VZ $ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -15,8 +15,8 @@ missing from string.h. */ -#ifndef _WX_WXSTRING_H__ -#define _WX_WXSTRING_H__ +#ifndef _WX_WXSTRINGH__ +#define _WX_WXSTRINGH__ // ---------------------------------------------------------------------------- // headers @@ -47,59 +47,16 @@ #include // for strcasecmp() #endif // HAVE_STRCASECMP_IN_STRINGS_H -#include "wx/wxcrtbase.h" // for wxChar, wxStrlen() etc. -#include "wx/strvararg.h" +#ifdef __WXPALMOS__ + #include +#endif + +#include "wx/wxchar.h" // for wxChar #include "wx/buffer.h" // for wxCharBuffer #include "wx/strconv.h" // for wxConvertXXX() macros and wxMBConv classes -#include "wx/stringimpl.h" -#include "wx/stringops.h" -#include "wx/unichar.h" - -// by default we cache the mapping of the positions in UTF-8 string to the byte -// offset as this results in noticeable performance improvements for loops over -// strings using indices; comment out this line to disable this -// -// notice that this optimization is well worth using even in debug builds as it -// changes asymptotic complexity of algorithms using indices to iterate over -// wxString back to expected linear from quadratic -// -// also notice that wxTLS_TYPE() (__declspec(thread) in this case) is unsafe to -// use in DLL build under pre-Vista Windows so we disable this code for now, if -// anybody really needs to use UTF-8 build under Windows with this optimization -// it would have to be re-tested and probably corrected -// CS: under OSX release builds the string destructor/cache cleanup sometimes -// crashes, disable until we find the true reason or a better workaround -#if wxUSE_UNICODE_UTF8 && !defined(__WINDOWS__) && !defined(__WXOSX__) - #define wxUSE_STRING_POS_CACHE 1 -#else - #define wxUSE_STRING_POS_CACHE 0 -#endif - -#if wxUSE_STRING_POS_CACHE - #include "wx/tls.h" - - // change this 0 to 1 to enable additional (very expensive) asserts - // verifying that string caching logic works as expected - #if 0 - #define wxSTRING_CACHE_ASSERT(cond) wxASSERT(cond) - #else - #define wxSTRING_CACHE_ASSERT(cond) - #endif -#endif // wxUSE_STRING_POS_CACHE class WXDLLIMPEXP_FWD_BASE wxString; -// unless this symbol is predefined to disable the compatibility functions, do -// use them -#ifndef WXWIN_COMPATIBILITY_STRING_PTR_AS_ITER - #define WXWIN_COMPATIBILITY_STRING_PTR_AS_ITER 1 -#endif - -namespace wxPrivate -{ - template struct wxStringAsBufHelper; -} - // --------------------------------------------------------------------------- // macros // --------------------------------------------------------------------------- @@ -111,6 +68,10 @@ namespace wxPrivate #define wxMBSTRINGCAST (char *)(const char *) #define wxWCSTRINGCAST (wchar_t *)(const wchar_t *) +// implementation only +#define wxASSERT_VALID_INDEX(i) \ + wxASSERT_MSG( (size_t)(i) <= length(), wxT("invalid index in wxString") ) + // ---------------------------------------------------------------------------- // constants // ---------------------------------------------------------------------------- @@ -120,30 +81,33 @@ namespace wxPrivate // deprecated in favour of wxString::npos, don't use in new code // // maximum possible length for a string means "take all string" everywhere -#define wxSTRING_MAXLEN wxString::npos +#define wxSTRING_MAXLEN wxStringBase::npos #endif // WXWIN_COMPATIBILITY_2_6 +// ---------------------------------------------------------------------------- +// global data +// ---------------------------------------------------------------------------- + +// global pointer to empty string +extern WXDLLIMPEXP_DATA_BASE(const wxChar*) wxEmptyString; + // --------------------------------------------------------------------------- // global functions complementing standard C string library replacements for // strlen() and portable strcasecmp() //--------------------------------------------------------------------------- -#if WXWIN_COMPATIBILITY_2_8 -// Use wxXXX() functions from wxcrt.h instead! These functions are for +// Use wxXXX() functions from wxchar.h instead! These functions are for // backwards compatibility only. // checks whether the passed in pointer is NULL and if the string is empty -wxDEPRECATED( inline bool IsEmpty(const char *p) ); inline bool IsEmpty(const char *p) { return (!p || !*p); } // safe version of strlen() (returns 0 if passed NULL pointer) -wxDEPRECATED( inline size_t Strlen(const char *psz) ); inline size_t Strlen(const char *psz) { return psz ? strlen(psz) : 0; } // portable strcasecmp/_stricmp -wxDEPRECATED( inline int Stricmp(const char *psz1, const char *psz2) ); inline int Stricmp(const char *psz1, const char *psz2) { #if defined(__VISUALC__) && defined(__WXWINCE__) @@ -154,10 +118,12 @@ inline int Stricmp(const char *psz1, const char *psz2) } while ( c1 && (c1 == c2) ); return c1 - c2; -#elif defined(__VISUALC__) +#elif defined(__VISUALC__) || ( defined(__MWERKS__) && defined(__INTEL__) ) return _stricmp(psz1, psz2); #elif defined(__SC__) return _stricmp(psz1, psz2); +#elif defined(__SALFORDC__) + return stricmp(psz1, psz2); #elif defined(__BORLANDC__) return stricmp(psz1, psz2); #elif defined(__WATCOMC__) @@ -168,10 +134,19 @@ inline int Stricmp(const char *psz1, const char *psz2) return stricmp(psz1, psz2); #elif defined(__WXPM__) return stricmp(psz1, psz2); -#elif defined(HAVE_STRCASECMP_IN_STRING_H) || \ +#elif defined(__WXPALMOS__) || \ + defined(HAVE_STRCASECMP_IN_STRING_H) || \ defined(HAVE_STRCASECMP_IN_STRINGS_H) || \ defined(__GNUWIN32__) return strcasecmp(psz1, psz2); +#elif defined(__MWERKS__) && !defined(__INTEL__) + register char c1, c2; + do { + c1 = tolower(*psz1++); + c2 = tolower(*psz2++); + } while ( c1 && (c1 == c2) ); + + return c1 - c2; #else // almost all compilers/libraries provide this function (unfortunately under // different names), that's why we don't implement our own which will surely @@ -190,266 +165,506 @@ inline int Stricmp(const char *psz1, const char *psz2) #endif // OS/compiler } -#endif // WXWIN_COMPATIBILITY_2_8 - // ---------------------------------------------------------------------------- -// wxCStrData +// deal with STL/non-STL/non-STL-but-wxUSE_STD_STRING // ---------------------------------------------------------------------------- -// Lightweight object returned by wxString::c_str() and implicitly convertible -// to either const char* or const wchar_t*. -class wxCStrData -{ -private: - // Ctors; for internal use by wxString and wxCStrData only - wxCStrData(const wxString *str, size_t offset = 0, bool owned = false) - : m_str(str), m_offset(offset), m_owned(owned) {} +// in both cases we need to define wxStdString +#if wxUSE_STL || wxUSE_STD_STRING -public: - // Ctor constructs the object from char literal; they are needed to make - // operator?: compile and they intentionally take char*, not const char* - inline wxCStrData(char *buf); - inline wxCStrData(wchar_t *buf); - inline wxCStrData(const wxCStrData& data); +#include "wx/beforestd.h" +#include +#include "wx/afterstd.h" - inline ~wxCStrData(); +#if wxUSE_UNICODE + #ifdef HAVE_STD_WSTRING + typedef std::wstring wxStdString; + #else + typedef std::basic_string wxStdString; + #endif +#else + typedef std::string wxStdString; +#endif - // AsWChar() and AsChar() can't be defined here as they use wxString and so - // must come after it and because of this won't be inlined when called from - // wxString methods (without a lot of work to extract these wxString methods - // from inside the class itself). But we still define them being inline - // below to let compiler inline them from elsewhere. And because of this we - // must declare them as inline here because otherwise some compilers give - // warnings about them, e.g. mingw32 3.4.5 warns about " defined - // locally after being referenced with dllimport linkage" while IRIX - // mipsPro 7.4 warns about "function declared inline after being called". - inline const wchar_t* AsWChar() const; - operator const wchar_t*() const { return AsWChar(); } +#endif // need - inline const char* AsChar() const; - const unsigned char* AsUnsignedChar() const - { return (const unsigned char *) AsChar(); } - operator const char*() const { return AsChar(); } - operator const unsigned char*() const { return AsUnsignedChar(); } +#if wxUSE_STL - operator const void*() const { return AsChar(); } + // we don't need an extra ctor from std::string when copy ctor already does + // the work + #undef wxUSE_STD_STRING + #define wxUSE_STD_STRING 0 - // returns buffers that are valid as long as the associated wxString exists - const wxScopedCharBuffer AsCharBuf() const - { - return wxScopedCharBuffer::CreateNonOwned(AsChar()); - } + #if (defined(__GNUG__) && (__GNUG__ < 3)) || \ + (defined(_MSC_VER) && (_MSC_VER <= 1200)) + #define wxSTRING_BASE_HASNT_CLEAR + #endif - const wxScopedWCharBuffer AsWCharBuf() const - { - return wxScopedWCharBuffer::CreateNonOwned(AsWChar()); - } + typedef wxStdString wxStringBase; +#else // if !wxUSE_STL - inline wxString AsString() const; +#if !defined(HAVE_STD_STRING_COMPARE) && \ + (!defined(__WX_SETUP_H__) || wxUSE_STL == 0) + #define HAVE_STD_STRING_COMPARE +#endif - // returns the value as C string in internal representation (equivalent - // to AsString().wx_str(), but more efficient) - const wxStringCharType *AsInternal() const; - - // allow expressions like "c_str()[0]": - inline wxUniChar operator[](size_t n) const; - wxUniChar operator[](int n) const { return operator[](size_t(n)); } - wxUniChar operator[](long n) const { return operator[](size_t(n)); } -#ifndef wxSIZE_T_IS_UINT - wxUniChar operator[](unsigned int n) const { return operator[](size_t(n)); } -#endif // size_t != unsigned int - - // These operators are needed to emulate the pointer semantics of c_str(): - // expressions like "wxChar *p = str.c_str() + 1;" should continue to work - // (we need both versions to resolve ambiguities). Note that this means - // the 'n' value is interpreted as addition to char*/wchar_t* pointer, it - // is *not* number of Unicode characters in wxString. - wxCStrData operator+(int n) const - { return wxCStrData(m_str, m_offset + n, m_owned); } - wxCStrData operator+(long n) const - { return wxCStrData(m_str, m_offset + n, m_owned); } - wxCStrData operator+(size_t n) const - { return wxCStrData(m_str, m_offset + n, m_owned); } - - // and these for "str.c_str() + (p2 - p1)" (it also works for any integer - // expression but it must be ptrdiff_t and not e.g. int to work in this - // example): - wxCStrData operator-(ptrdiff_t n) const - { - wxASSERT_MSG( n <= (ptrdiff_t)m_offset, - wxT("attempt to construct address before the beginning of the string") ); - return wxCStrData(m_str, m_offset - n, m_owned); - } - - // this operator is needed to make expressions like "*c_str()" or - // "*(c_str() + 2)" work - inline wxUniChar operator*() const; - -private: - // the wxString this object was returned for - const wxString *m_str; - // Offset into c_str() return value. Note that this is *not* offset in - // m_str in Unicode characters. Instead, it is index into the - // char*/wchar_t* buffer returned by c_str(). It's interpretation depends - // on how is the wxCStrData instance used: if it is eventually cast to - // const char*, m_offset will be in bytes form string's start; if it is - // cast to const wchar_t*, it will be in wchar_t values. - size_t m_offset; - // should m_str be deleted, i.e. is it owned by us? - bool m_owned; - - friend class WXDLLIMPEXP_FWD_BASE wxString; -}; - -// ---------------------------------------------------------------------------- -// wxStringPrintfMixin +// --------------------------------------------------------------------------- +// string data prepended with some housekeeping info (used by wxString class), +// is never used directly (but had to be put here to allow inlining) // --------------------------------------------------------------------------- -// NB: VC6 has a bug that causes linker errors if you have template methods -// in a class using __declspec(dllimport). The solution is to split such -// class into two classes, one that contains the template methods and does -// *not* use WXDLLIMPEXP_BASE and another class that contains the rest -// (with DLL linkage). -// -// We only do this for VC6 here, because the code is less efficient -// (Printf() has to use dynamic_cast<>) and because OpenWatcom compiler -// cannot compile this code. - -#if defined(__VISUALC__) && __VISUALC__ < 1300 - #define wxNEEDS_WXSTRING_PRINTF_MIXIN -#endif - -#ifdef wxNEEDS_WXSTRING_PRINTF_MIXIN -// this class contains implementation of wxString's vararg methods, it's -// exported from wxBase DLL -class WXDLLIMPEXP_BASE wxStringPrintfMixinBase +struct WXDLLIMPEXP_BASE wxStringData { -protected: - wxStringPrintfMixinBase() {} + int nRefs; // reference count + size_t nDataLength, // actual string length + nAllocLength; // allocated memory size -#if !wxUSE_UTF8_LOCALE_ONLY - int DoPrintfWchar(const wxChar *format, ...); - static wxString DoFormatWchar(const wxChar *format, ...); + // mimics declaration 'wxChar data[nAllocLength]' + wxChar* data() const { return (wxChar*)(this + 1); } + + // empty string has a special ref count so it's never deleted + bool IsEmpty() const { return (nRefs == -1); } + bool IsShared() const { return (nRefs > 1); } + + // lock/unlock + void Lock() { if ( !IsEmpty() ) nRefs++; } + + // VC++ will refuse to inline Unlock but profiling shows that it is wrong +#if defined(__VISUALC__) && (__VISUALC__ >= 1200) + __forceinline #endif -#if wxUSE_UNICODE_UTF8 - int DoPrintfUtf8(const char *format, ...); - static wxString DoFormatUtf8(const char *format, ...); + // VC++ free must take place in same DLL as allocation when using non dll + // run-time library (e.g. Multithreaded instead of Multithreaded DLL) +#if defined(__VISUALC__) && defined(_MT) && !defined(_DLL) + void Unlock() { if ( !IsEmpty() && --nRefs == 0) Free(); } + // we must not inline deallocation since allocation is not inlined + void Free(); +#else + void Unlock() { if ( !IsEmpty() && --nRefs == 0) free(this); } #endif + + // if we had taken control over string memory (GetWriteBuf), it's + // intentionally put in invalid state + void Validate(bool b) { nRefs = (b ? 1 : 0); } + bool IsValid() const { return (nRefs != 0); } }; -// this class contains template wrappers for wxString's vararg methods, it's -// intentionally *not* exported from the DLL in order to fix the VC6 bug -// described above -class wxStringPrintfMixin : public wxStringPrintfMixinBase +class WXDLLIMPEXP_BASE wxStringBase { -private: - // to further complicate things, we can't return wxString from - // wxStringPrintfMixin::Format() because wxString is not yet declared at - // this point; the solution is to use this fake type trait template - this - // way the compiler won't know the return type until Format() is used - // (this doesn't compile with Watcom, but VC6 compiles it just fine): - template struct StringReturnType - { - typedef wxString type; - }; +#if !wxUSE_STL +friend class WXDLLIMPEXP_FWD_BASE wxArrayString; +#endif +public : + // an 'invalid' value for string index, moved to this place due to a CW bug + static const size_t npos; +protected: + // points to data preceded by wxStringData structure with ref count info + wxChar *m_pchData; + // accessor to string data + wxStringData* GetStringData() const { return (wxStringData*)m_pchData - 1; } + + // string (re)initialization functions + // initializes the string to the empty value (must be called only from + // ctors, use Reinit() otherwise) + void Init() { m_pchData = (wxChar *)wxEmptyString; } + // initializes the string with (a part of) C-string + void InitWith(const wxChar *psz, size_t nPos = 0, size_t nLen = npos); + // as Init, but also frees old data + void Reinit() { GetStringData()->Unlock(); Init(); } + + // memory allocation + // allocates memory for string of length nLen + bool AllocBuffer(size_t nLen); + // copies data to another string + bool AllocCopy(wxString&, int, int) const; + // effectively copies data to string + bool AssignCopy(size_t, const wxChar *); + + // append a (sub)string + bool ConcatSelf(size_t nLen, const wxChar *src, size_t nMaxLen); + bool ConcatSelf(size_t nLen, const wxChar *src) + { return ConcatSelf(nLen, src, nLen); } + + // functions called before writing to the string: they copy it if there + // are other references to our data (should be the only owner when writing) + bool CopyBeforeWrite(); + bool AllocBeforeWrite(size_t); + + // compatibility with wxString + bool Alloc(size_t nLen); public: - // these are duplicated wxString methods, they're also declared below - // if !wxNEEDS_WXSTRING_PRINTF_MIXIN: + // standard types + typedef wxChar value_type; + typedef wxChar char_type; + typedef size_t size_type; + typedef value_type& reference; + typedef const value_type& const_reference; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef value_type *iterator; + typedef const value_type *const_iterator; - // static wxString Format(const wString& format, ...) WX_ATTRIBUTE_PRINTF_1; - WX_DEFINE_VARARG_FUNC_SANS_N0(static typename StringReturnType::type, - Format, 1, (const wxFormatString&), - DoFormatWchar, DoFormatUtf8) - // We have to implement the version without template arguments manually - // because of the StringReturnType<> hack, although WX_DEFINE_VARARG_FUNC - // normally does it itself. It has to be a template so that we can use - // the hack, even though there's no real template parameter. We can't move - // it to wxStrig, because it would shadow these versions of Format() then. - template - inline static typename StringReturnType::type - Format(const T& fmt) - { - // NB: this doesn't compile if T is not (some form of) a string; - // this makes Format's prototype equivalent to - // Format(const wxFormatString& fmt) - return DoFormatWchar(wxFormatString(fmt)); +#define wxSTRING_REVERSE_ITERATOR(name, const_or_not) \ + class name \ + { \ + public: \ + typedef wxChar value_type; \ + typedef const_or_not value_type& reference; \ + typedef const_or_not value_type *pointer; \ + typedef const_or_not value_type *iterator_type; \ + \ + name(iterator_type i) : m_cur(i) { } \ + name(const name& ri) : m_cur(ri.m_cur) { } \ + \ + iterator_type base() const { return m_cur; } \ + \ + reference operator*() const { return *(m_cur - 1); } \ + \ + name& operator++() { --m_cur; return *this; } \ + name operator++(int) { name tmp = *this; --m_cur; return tmp; } \ + name& operator--() { ++m_cur; return *this; } \ + name operator--(int) { name tmp = *this; ++m_cur; return tmp; } \ + \ + bool operator==(name ri) const { return m_cur == ri.m_cur; } \ + bool operator!=(name ri) const { return !(*this == ri); } \ + \ + private: \ + iterator_type m_cur; \ + } + + wxSTRING_REVERSE_ITERATOR(const_reverse_iterator, const); + + #define wxSTRING_CONST + wxSTRING_REVERSE_ITERATOR(reverse_iterator, wxSTRING_CONST); + #undef wxSTRING_CONST + + #undef wxSTRING_REVERSE_ITERATOR + + + // constructors and destructor + // ctor for an empty string + wxStringBase() { Init(); } + // copy ctor + wxStringBase(const wxStringBase& stringSrc) + { + wxASSERT_MSG( stringSrc.GetStringData()->IsValid(), + wxT("did you forget to call UngetWriteBuf()?") ); + + if ( stringSrc.empty() ) { + // nothing to do for an empty string + Init(); } + else { + m_pchData = stringSrc.m_pchData; // share same data + GetStringData()->Lock(); // => one more copy + } + } + // string containing nRepeat copies of ch + wxStringBase(size_type nRepeat, wxChar ch); + // ctor takes first nLength characters from C string + // (default value of npos means take all the string) + wxStringBase(const wxChar *psz) + { InitWith(psz, 0, npos); } + wxStringBase(const wxChar *psz, size_t nLength) + { InitWith(psz, 0, nLength); } + wxStringBase(const wxChar *psz, + const wxMBConv& WXUNUSED(conv), + size_t nLength = npos) + { InitWith(psz, 0, nLength); } + // take nLen chars starting at nPos + wxStringBase(const wxStringBase& str, size_t nPos, size_t nLen) + { + wxASSERT_MSG( str.GetStringData()->IsValid(), + wxT("did you forget to call UngetWriteBuf()?") ); + Init(); + size_t strLen = str.length() - nPos; nLen = strLen < nLen ? strLen : nLen; + InitWith(str.c_str(), nPos, nLen); + } + // take all characters from pStart to pEnd + wxStringBase(const void *pStart, const void *pEnd); - // int Printf(const wxString& format, ...); - WX_DEFINE_VARARG_FUNC(int, Printf, 1, (const wxFormatString&), - DoPrintfWchar, DoPrintfUtf8) - // int sprintf(const wxString& format, ...) WX_ATTRIBUTE_PRINTF_2; - WX_DEFINE_VARARG_FUNC(int, sprintf, 1, (const wxFormatString&), - DoPrintfWchar, DoPrintfUtf8) + // dtor is not virtual, this class must not be inherited from! + ~wxStringBase() + { +#if defined(__VISUALC__) && (__VISUALC__ >= 1200) + //RN - according to the above VC++ does indeed inline this, + //even though it spits out two warnings + #pragma warning (disable:4714) +#endif -protected: - wxStringPrintfMixin() : wxStringPrintfMixinBase() {} + GetStringData()->Unlock(); + } + +#if defined(__VISUALC__) && (__VISUALC__ >= 1200) + //re-enable inlining warning + #pragma warning (default:4714) +#endif + // overloaded assignment + // from another wxString + wxStringBase& operator=(const wxStringBase& stringSrc); + // from a character + wxStringBase& operator=(wxChar ch); + // from a C string + wxStringBase& operator=(const wxChar *psz); + + // return the length of the string + size_type length() const { return GetStringData()->nDataLength; } + // return the length of the string + size_type size() const { return length(); } + // return the maximum size of the string + size_type max_size() const { return npos; } + // resize the string, filling the space with c if c != 0 + void resize(size_t nSize, wxChar ch = wxT('\0')); + // delete the contents of the string + void clear() { erase(0, npos); } + // returns true if the string is empty + bool empty() const { return length() == 0; } + // inform string about planned change in size + void reserve(size_t sz) { Alloc(sz); } + size_type capacity() const { return GetStringData()->nAllocLength; } + + // lib.string.access + // return the character at position n + value_type at(size_type n) const + { wxASSERT_VALID_INDEX( n ); return m_pchData[n]; } + // returns the writable character at position n + reference at(size_type n) + { wxASSERT_VALID_INDEX( n ); CopyBeforeWrite(); return m_pchData[n]; } + + // lib.string.modifiers + // append elements str[pos], ..., str[pos+n] + wxStringBase& append(const wxStringBase& str, size_t pos, size_t n) + { + wxASSERT(pos <= str.length()); + ConcatSelf(n, str.c_str() + pos, str.length() - pos); + return *this; + } + // append a string + wxStringBase& append(const wxStringBase& str) + { ConcatSelf(str.length(), str.c_str()); return *this; } + // append first n (or all if n == npos) characters of sz + wxStringBase& append(const wxChar *sz) + { ConcatSelf(wxStrlen(sz), sz); return *this; } + wxStringBase& append(const wxChar *sz, size_t n) + { ConcatSelf(n, sz); return *this; } + // append n copies of ch + wxStringBase& append(size_t n, wxChar ch); + // append from first to last + wxStringBase& append(const_iterator first, const_iterator last) + { ConcatSelf(last - first, first); return *this; } + + // same as `this_string = str' + wxStringBase& assign(const wxStringBase& str) + { return *this = str; } + // same as ` = str[pos..pos + n] + wxStringBase& assign(const wxStringBase& str, size_t pos, size_t n) + { clear(); return append(str, pos, n); } + // same as `= first n (or all if n == npos) characters of sz' + wxStringBase& assign(const wxChar *sz) + { clear(); return append(sz, wxStrlen(sz)); } + wxStringBase& assign(const wxChar *sz, size_t n) + { clear(); return append(sz, n); } + // same as `= n copies of ch' + wxStringBase& assign(size_t n, wxChar ch) + { clear(); return append(n, ch); } + // assign from first to last + wxStringBase& assign(const_iterator first, const_iterator last) + { clear(); return append(first, last); } + + // first valid index position + const_iterator begin() const { return m_pchData; } + iterator begin(); + // position one after the last valid one + const_iterator end() const { return m_pchData + length(); } + iterator end(); + + // first element of the reversed string + const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); } + reverse_iterator rbegin() { return reverse_iterator(end()); } + // one beyond the end of the reversed string + const_reverse_iterator rend() const { return const_reverse_iterator(begin()); } + reverse_iterator rend() { return reverse_iterator(begin()); } + + // insert another string + wxStringBase& insert(size_t nPos, const wxStringBase& str) + { + wxASSERT( str.GetStringData()->IsValid() ); + return insert(nPos, str.c_str(), str.length()); + } + // insert n chars of str starting at nStart (in str) + wxStringBase& insert(size_t nPos, const wxStringBase& str, size_t nStart, size_t n) + { + wxASSERT( str.GetStringData()->IsValid() ); + wxASSERT( nStart < str.length() ); + size_t strLen = str.length() - nStart; + n = strLen < n ? strLen : n; + return insert(nPos, str.c_str() + nStart, n); + } + // insert first n (or all if n == npos) characters of sz + wxStringBase& insert(size_t nPos, const wxChar *sz, size_t n = npos); + // insert n copies of ch + wxStringBase& insert(size_t nPos, size_t n, wxChar ch) + { return insert(nPos, wxStringBase(n, ch)); } + iterator insert(iterator it, wxChar ch) + { size_t idx = it - begin(); insert(idx, 1, ch); return begin() + idx; } + void insert(iterator it, const_iterator first, const_iterator last) + { insert(it - begin(), first, last - first); } + void insert(iterator it, size_type n, wxChar ch) + { insert(it - begin(), n, ch); } + + // delete characters from nStart to nStart + nLen + wxStringBase& erase(size_type pos = 0, size_type n = npos); + iterator erase(iterator first, iterator last) + { + size_t idx = first - begin(); + erase(idx, last - first); + return begin() + idx; + } + iterator erase(iterator first); + + // explicit conversion to C string (use this with printf()!) + const wxChar* c_str() const { return m_pchData; } + const wxChar* data() const { return m_pchData; } + + // replaces the substring of length nLen starting at nStart + wxStringBase& replace(size_t nStart, size_t nLen, const wxChar* sz); + // replaces the substring of length nLen starting at nStart + wxStringBase& replace(size_t nStart, size_t nLen, const wxStringBase& str) + { return replace(nStart, nLen, str.c_str()); } + // replaces the substring with nCount copies of ch + wxStringBase& replace(size_t nStart, size_t nLen, size_t nCount, wxChar ch); + // replaces a substring with another substring + wxStringBase& replace(size_t nStart, size_t nLen, + const wxStringBase& str, size_t nStart2, size_t nLen2); + // replaces the substring with first nCount chars of sz + wxStringBase& replace(size_t nStart, size_t nLen, + const wxChar* sz, size_t nCount); + wxStringBase& replace(iterator first, iterator last, const_pointer s) + { return replace(first - begin(), last - first, s); } + wxStringBase& replace(iterator first, iterator last, const_pointer s, + size_type n) + { return replace(first - begin(), last - first, s, n); } + wxStringBase& replace(iterator first, iterator last, const wxStringBase& s) + { return replace(first - begin(), last - first, s); } + wxStringBase& replace(iterator first, iterator last, size_type n, wxChar c) + { return replace(first - begin(), last - first, n, c); } + wxStringBase& replace(iterator first, iterator last, + const_iterator first1, const_iterator last1) + { return replace(first - begin(), last - first, first1, last1 - first1); } + + // swap two strings + void swap(wxStringBase& str); + + // All find() functions take the nStart argument which specifies the + // position to start the search on, the default value is 0. All functions + // return npos if there were no match. + + // find a substring + size_t find(const wxStringBase& str, size_t nStart = 0) const; + + // find first n characters of sz + size_t find(const wxChar* sz, size_t nStart = 0, size_t n = npos) const; + + // find the first occurence of character ch after nStart + size_t find(wxChar ch, size_t nStart = 0) const; + + // rfind() family is exactly like find() but works right to left + + // as find, but from the end + size_t rfind(const wxStringBase& str, size_t nStart = npos) const; + + // as find, but from the end + size_t rfind(const wxChar* sz, size_t nStart = npos, + size_t n = npos) const; + // as find, but from the end + size_t rfind(wxChar ch, size_t nStart = npos) const; + + // find first/last occurence of any character in the set + + // as strpbrk() but starts at nStart, returns npos if not found + size_t find_first_of(const wxStringBase& str, size_t nStart = 0) const + { return find_first_of(str.c_str(), nStart); } + // same as above + size_t find_first_of(const wxChar* sz, size_t nStart = 0) const; + size_t find_first_of(const wxChar* sz, size_t nStart, size_t n) const; + // same as find(char, size_t) + size_t find_first_of(wxChar c, size_t nStart = 0) const + { return find(c, nStart); } + // find the last (starting from nStart) char from str in this string + size_t find_last_of (const wxStringBase& str, size_t nStart = npos) const + { return find_last_of(str.c_str(), nStart); } + // same as above + size_t find_last_of (const wxChar* sz, size_t nStart = npos) const; + size_t find_last_of(const wxChar* sz, size_t nStart, size_t n) const; + // same as above + size_t find_last_of(wxChar c, size_t nStart = npos) const + { return rfind(c, nStart); } + + // find first/last occurence of any character not in the set + + // as strspn() (starting from nStart), returns npos on failure + size_t find_first_not_of(const wxStringBase& str, size_t nStart = 0) const + { return find_first_not_of(str.c_str(), nStart); } + // same as above + size_t find_first_not_of(const wxChar* sz, size_t nStart = 0) const; + size_t find_first_not_of(const wxChar* sz, size_t nStart, size_t n) const; + // same as above + size_t find_first_not_of(wxChar ch, size_t nStart = 0) const; + // as strcspn() + size_t find_last_not_of(const wxStringBase& str, size_t nStart = npos) const + { return find_last_not_of(str.c_str(), nStart); } + // same as above + size_t find_last_not_of(const wxChar* sz, size_t nStart = npos) const; + size_t find_last_not_of(const wxChar* sz, size_t nStart, size_t n) const; + // same as above + size_t find_last_not_of(wxChar ch, size_t nStart = npos) const; + + // All compare functions return -1, 0 or 1 if the [sub]string is less, + // equal or greater than the compare() argument. + + // comparison with another string + int compare(const wxStringBase& str) const; + // comparison with a substring + int compare(size_t nStart, size_t nLen, const wxStringBase& str) const; + // comparison of 2 substrings + int compare(size_t nStart, size_t nLen, + const wxStringBase& str, size_t nStart2, size_t nLen2) const; + // comparison with a c string + int compare(const wxChar* sz) const; + // substring comparison with first nCount characters of sz + int compare(size_t nStart, size_t nLen, + const wxChar* sz, size_t nCount = npos) const; + + size_type copy(wxChar* s, size_type n, size_type pos = 0); + + // substring extraction + wxStringBase substr(size_t nStart = 0, size_t nLen = npos) const; + + // string += string + wxStringBase& operator+=(const wxStringBase& s) { return append(s); } + // string += C string + wxStringBase& operator+=(const wxChar *psz) { return append(psz); } + // string += char + wxStringBase& operator+=(wxChar ch) { return append(1, ch); } }; -#endif // wxNEEDS_WXSTRING_PRINTF_MIXIN +#endif // !wxUSE_STL // ---------------------------------------------------------------------------- // wxString: string class trying to be compatible with std::string, MFC // CString and wxWindows 1.x wxString all at once // --------------------------------------------------------------------------- -#ifdef wxNEEDS_WXSTRING_PRINTF_MIXIN - // "non dll-interface class 'wxStringPrintfMixin' used as base interface - // for dll-interface class 'wxString'" -- this is OK in our case - #pragma warning (push) - #pragma warning (disable:4275) +class WXDLLIMPEXP_BASE wxString : public wxStringBase +{ +#if !wxUSE_STL +friend class WXDLLIMPEXP_FWD_BASE wxArrayString; #endif -#if wxUSE_UNICODE_UTF8 -// see the comment near wxString::iterator for why we need this -class WXDLLIMPEXP_BASE wxStringIteratorNode -{ -public: - wxStringIteratorNode() - : m_str(NULL), m_citer(NULL), m_iter(NULL), m_prev(NULL), m_next(NULL) {} - wxStringIteratorNode(const wxString *str, - wxStringImpl::const_iterator *citer) - { DoSet(str, citer, NULL); } - wxStringIteratorNode(const wxString *str, wxStringImpl::iterator *iter) - { DoSet(str, NULL, iter); } - ~wxStringIteratorNode() - { clear(); } - - inline void set(const wxString *str, wxStringImpl::const_iterator *citer) - { clear(); DoSet(str, citer, NULL); } - inline void set(const wxString *str, wxStringImpl::iterator *iter) - { clear(); DoSet(str, NULL, iter); } - - const wxString *m_str; - wxStringImpl::const_iterator *m_citer; - wxStringImpl::iterator *m_iter; - wxStringIteratorNode *m_prev, *m_next; - -private: - inline void clear(); - inline void DoSet(const wxString *str, - wxStringImpl::const_iterator *citer, - wxStringImpl::iterator *iter); - - // the node belongs to a particular iterator instance, it's not copied - // when a copy of the iterator is made - wxDECLARE_NO_COPY_CLASS(wxStringIteratorNode); -}; -#endif // wxUSE_UNICODE_UTF8 - -class WXDLLIMPEXP_BASE wxString -#ifdef wxNEEDS_WXSTRING_PRINTF_MIXIN - : public wxStringPrintfMixin -#endif -{ // NB: special care was taken in arranging the member functions in such order // that all inline functions can be effectively inlined, verify that all // performance critical functions are still inlined if you change order! -public: - // an 'invalid' value for string index, moved to this place due to a CW bug - static const size_t npos; - private: // if we hadn't made these operators private, it would be possible to // compile "wxString s; s = 17;" without any warnings as 17 is implicitly @@ -466,1073 +681,64 @@ private: // try `s << i' or `s.Printf("%d", i)' instead wxString(int); - - // buffer for holding temporary substring when using any of the methods - // that take (char*,size_t) or (wchar_t*,size_t) arguments: - template - struct SubstrBufFromType - { - T data; - size_t len; - - SubstrBufFromType(const T& data_, size_t len_) - : data(data_), len(len_) - { - wxASSERT_MSG( len != npos, "must have real length" ); - } - }; - -#if wxUSE_UNICODE_UTF8 - // even char* -> char* needs conversion, from locale charset to UTF-8 - typedef SubstrBufFromType SubstrBufFromWC; - typedef SubstrBufFromType SubstrBufFromMB; -#elif wxUSE_UNICODE_WCHAR - typedef SubstrBufFromType SubstrBufFromWC; - typedef SubstrBufFromType SubstrBufFromMB; -#else - typedef SubstrBufFromType SubstrBufFromMB; - typedef SubstrBufFromType SubstrBufFromWC; -#endif - - - // Functions implementing primitive operations on string data; wxString - // methods and iterators are implemented in terms of it. The differences - // between UTF-8 and wchar_t* representations of the string are mostly - // contained here. - -#if wxUSE_UNICODE_UTF8 - static SubstrBufFromMB ConvertStr(const char *psz, size_t nLength, - const wxMBConv& conv); - static SubstrBufFromWC ConvertStr(const wchar_t *pwz, size_t nLength, - const wxMBConv& conv); -#elif wxUSE_UNICODE_WCHAR - static SubstrBufFromMB ConvertStr(const char *psz, size_t nLength, - const wxMBConv& conv); -#else - static SubstrBufFromWC ConvertStr(const wchar_t *pwz, size_t nLength, - const wxMBConv& conv); -#endif - -#if !wxUSE_UNICODE_UTF8 // wxUSE_UNICODE_WCHAR or !wxUSE_UNICODE - // returns C string encoded as the implementation expects: - #if wxUSE_UNICODE - static const wchar_t* ImplStr(const wchar_t* str) - { return str ? str : wxT(""); } - static const SubstrBufFromWC ImplStr(const wchar_t* str, size_t n) - { return SubstrBufFromWC(str, (str && n == npos) ? wxWcslen(str) : n); } - static wxScopedWCharBuffer ImplStr(const char* str, - const wxMBConv& conv = wxConvLibc) - { return ConvertStr(str, npos, conv).data; } - static SubstrBufFromMB ImplStr(const char* str, size_t n, - const wxMBConv& conv = wxConvLibc) - { return ConvertStr(str, n, conv); } - #else - static const char* ImplStr(const char* str, - const wxMBConv& WXUNUSED(conv) = wxConvLibc) - { return str ? str : ""; } - static const SubstrBufFromMB ImplStr(const char* str, size_t n, - const wxMBConv& WXUNUSED(conv) = wxConvLibc) - { return SubstrBufFromMB(str, (str && n == npos) ? wxStrlen(str) : n); } - static wxScopedCharBuffer ImplStr(const wchar_t* str) - { return ConvertStr(str, npos, wxConvLibc).data; } - static SubstrBufFromWC ImplStr(const wchar_t* str, size_t n) - { return ConvertStr(str, n, wxConvLibc); } - #endif - - // translates position index in wxString to/from index in underlying - // wxStringImpl: - static size_t PosToImpl(size_t pos) { return pos; } - static void PosLenToImpl(size_t pos, size_t len, - size_t *implPos, size_t *implLen) - { *implPos = pos; *implLen = len; } - static size_t LenToImpl(size_t len) { return len; } - static size_t PosFromImpl(size_t pos) { return pos; } - - // we don't want to define these as empty inline functions as it could - // result in noticeable (and quite unnecessary in non-UTF-8 build) slowdown - // in debug build where the inline functions are not effectively inlined - #define wxSTRING_INVALIDATE_CACHE() - #define wxSTRING_INVALIDATE_CACHED_LENGTH() - #define wxSTRING_UPDATE_CACHED_LENGTH(n) - #define wxSTRING_SET_CACHED_LENGTH(n) - -#else // wxUSE_UNICODE_UTF8 - - static wxScopedCharBuffer ImplStr(const char* str, - const wxMBConv& conv = wxConvLibc) - { return ConvertStr(str, npos, conv).data; } - static SubstrBufFromMB ImplStr(const char* str, size_t n, - const wxMBConv& conv = wxConvLibc) - { return ConvertStr(str, n, conv); } - - static wxScopedCharBuffer ImplStr(const wchar_t* str) - { return ConvertStr(str, npos, wxMBConvUTF8()).data; } - static SubstrBufFromWC ImplStr(const wchar_t* str, size_t n) - { return ConvertStr(str, n, wxMBConvUTF8()); } - -#if wxUSE_STRING_POS_CACHE - // this is an extremely simple cache used by PosToImpl(): each cache element - // contains the string it applies to and the index corresponding to the last - // used position in this wxString in its m_impl string - // - // NB: notice that this struct (and nested Element one) must be a POD or we - // wouldn't be able to use a thread-local variable of this type, in - // particular it should have no ctor -- we rely on statics being - // initialized to 0 instead - struct Cache - { - enum { SIZE = 8 }; - - struct Element - { - const wxString *str; // the string to which this element applies - size_t pos, // the cached index in this string - impl, // the corresponding position in its m_impl - len; // cached length or npos if unknown - - // reset cached index to 0 - void ResetPos() { pos = impl = 0; } - - // reset position and length - void Reset() { ResetPos(); len = npos; } - }; - - // cache the indices mapping for the last few string used - Element cached[SIZE]; - - // the last used index - unsigned lastUsed; - }; - -#ifndef wxHAS_COMPILER_TLS - // we must use an accessor function and not a static variable when the TLS - // variables support is implemented in the library (and not by the compiler) - // because the global s_cache variable could be not yet initialized when a - // ctor of another global object is executed and if that ctor uses any - // wxString methods, bad things happen - // - // however notice that this approach does not work when compiler TLS is used, - // at least not with g++ 4.1.2 under amd64 as it apparently compiles code - // using this accessor incorrectly when optimizations are enabled (-O2 is - // enough) -- luckily we don't need it then neither as static __thread - // variables are initialized by 0 anyhow then and so we can use the variable - // directly - WXEXPORT static Cache& GetCache() - { - static wxTLS_TYPE(Cache) s_cache; - - return wxTLS_VALUE(s_cache); - } - - // this helper struct is used to ensure that GetCache() is called during - // static initialization time, i.e. before any threads creation, as otherwise - // the static s_cache construction inside GetCache() wouldn't be MT-safe - friend struct wxStrCacheInitializer; -#else // wxHAS_COMPILER_TLS - static wxTLS_TYPE(Cache) ms_cache; - static Cache& GetCache() { return wxTLS_VALUE(ms_cache); } -#endif // !wxHAS_COMPILER_TLS/wxHAS_COMPILER_TLS - - static Cache::Element *GetCacheBegin() { return GetCache().cached; } - static Cache::Element *GetCacheEnd() { return GetCacheBegin() + Cache::SIZE; } - static unsigned& LastUsedCacheElement() { return GetCache().lastUsed; } - - // this is used in debug builds only to provide a convenient function, - // callable from a debugger, to show the cache contents - friend struct wxStrCacheDumper; - - // uncomment this to have access to some profiling statistics on program - // termination - //#define wxPROFILE_STRING_CACHE - -#ifdef wxPROFILE_STRING_CACHE - static struct PosToImplCacheStats - { - unsigned postot, // total non-trivial calls to PosToImpl - poshits, // cache hits from PosToImpl() - mishits, // cached position beyond the needed one - sumpos, // sum of all positions, used to compute the - // average position after dividing by postot - sumofs, // sum of all offsets after using the cache, used to - // compute the average after dividing by hits - lentot, // number of total calls to length() - lenhits; // number of cache hits in length() - } ms_cacheStats; - - friend struct wxStrCacheStatsDumper; - - #define wxCACHE_PROFILE_FIELD_INC(field) ms_cacheStats.field++ - #define wxCACHE_PROFILE_FIELD_ADD(field, val) ms_cacheStats.field += (val) -#else // !wxPROFILE_STRING_CACHE - #define wxCACHE_PROFILE_FIELD_INC(field) - #define wxCACHE_PROFILE_FIELD_ADD(field, val) -#endif // wxPROFILE_STRING_CACHE/!wxPROFILE_STRING_CACHE - - // note: it could seem that the functions below shouldn't be inline because - // they are big, contain loops and so the compiler shouldn't be able to - // inline them anyhow, however moving them into string.cpp does decrease the - // code performance by ~5%, at least when using g++ 4.1 so do keep them here - // unless tests show that it's not advantageous any more - - // return the pointer to the cache element for this string or NULL if not - // cached - Cache::Element *FindCacheElement() const - { - // profiling seems to show a small but consistent gain if we use this - // simple loop instead of starting from the last used element (there are - // a lot of misses in this function...) - Cache::Element * const cacheBegin = GetCacheBegin(); -#ifndef wxHAS_COMPILER_TLS - // during destruction tls calls may return NULL, in this case return NULL - // immediately without accessing anything else - if ( cacheBegin == NULL ) - return NULL; -#endif - Cache::Element * const cacheEnd = GetCacheEnd(); - for ( Cache::Element *c = cacheBegin; c != cacheEnd; c++ ) - { - if ( c->str == this ) - return c; - } - - return NULL; - } - - // unlike FindCacheElement(), this one always returns a valid pointer to the - // cache element for this string, it may have valid last cached position and - // its corresponding index in the byte string or not - Cache::Element *GetCacheElement() const - { - Cache::Element * const cacheBegin = GetCacheBegin(); - Cache::Element * const cacheEnd = GetCacheEnd(); - Cache::Element * const cacheStart = cacheBegin + LastUsedCacheElement(); - - // check the last used first, this does no (measurable) harm for a miss - // but does help for simple loops addressing the same string all the time - if ( cacheStart->str == this ) - return cacheStart; - - // notice that we're going to check cacheStart again inside this call but - // profiling shows that it's still faster to use a simple loop like - // inside FindCacheElement() than manually looping with wrapping starting - // from the cache entry after the start one - Cache::Element *c = FindCacheElement(); - if ( !c ) - { - // claim the next cache entry for this string - c = cacheStart; - if ( ++c == cacheEnd ) - c = cacheBegin; - - c->str = this; - c->Reset(); - - // and remember the last used element - LastUsedCacheElement() = c - cacheBegin; - } - - return c; - } - - size_t DoPosToImpl(size_t pos) const - { - wxCACHE_PROFILE_FIELD_INC(postot); - - // NB: although the case of pos == 1 (and offset from cached position - // equal to 1) are common, nothing is gained by writing special code - // for handling them, the compiler (at least g++ 4.1 used) seems to - // optimize the code well enough on its own - - wxCACHE_PROFILE_FIELD_ADD(sumpos, pos); - - Cache::Element * const cache = GetCacheElement(); - - // cached position can't be 0 so if it is, it means that this entry was - // used for length caching only so far, i.e. it doesn't count as a hit - // from our point of view - if ( cache->pos ) - { - wxCACHE_PROFILE_FIELD_INC(poshits); - } - - if ( pos == cache->pos ) - return cache->impl; - - // this seems to happen only rarely so just reset the cache in this case - // instead of complicating code even further by seeking backwards in this - // case - if ( cache->pos > pos ) - { - wxCACHE_PROFILE_FIELD_INC(mishits); - - cache->ResetPos(); - } - - wxCACHE_PROFILE_FIELD_ADD(sumofs, pos - cache->pos); - - - wxStringImpl::const_iterator i(m_impl.begin() + cache->impl); - for ( size_t n = cache->pos; n < pos; n++ ) - wxStringOperations::IncIter(i); - - cache->pos = pos; - cache->impl = i - m_impl.begin(); - - wxSTRING_CACHE_ASSERT( - (int)cache->impl == (begin() + pos).impl() - m_impl.begin() ); - - return cache->impl; - } - - void InvalidateCache() - { - Cache::Element * const cache = FindCacheElement(); - if ( cache ) - cache->Reset(); - } - - void InvalidateCachedLength() - { - Cache::Element * const cache = FindCacheElement(); - if ( cache ) - cache->len = npos; - } - - void SetCachedLength(size_t len) - { - // we optimistically cache the length here even if the string wasn't - // present in the cache before, this seems to do no harm and the - // potential for avoiding length recomputation for long strings looks - // interesting - GetCacheElement()->len = len; - } - - void UpdateCachedLength(ptrdiff_t delta) - { - Cache::Element * const cache = FindCacheElement(); - if ( cache && cache->len != npos ) - { - wxSTRING_CACHE_ASSERT( (ptrdiff_t)cache->len + delta >= 0 ); - - cache->len += delta; - } - } - - #define wxSTRING_INVALIDATE_CACHE() InvalidateCache() - #define wxSTRING_INVALIDATE_CACHED_LENGTH() InvalidateCachedLength() - #define wxSTRING_UPDATE_CACHED_LENGTH(n) UpdateCachedLength(n) - #define wxSTRING_SET_CACHED_LENGTH(n) SetCachedLength(n) -#else // !wxUSE_STRING_POS_CACHE - size_t DoPosToImpl(size_t pos) const - { - return (begin() + pos).impl() - m_impl.begin(); - } - - #define wxSTRING_INVALIDATE_CACHE() - #define wxSTRING_INVALIDATE_CACHED_LENGTH() - #define wxSTRING_UPDATE_CACHED_LENGTH(n) - #define wxSTRING_SET_CACHED_LENGTH(n) -#endif // wxUSE_STRING_POS_CACHE/!wxUSE_STRING_POS_CACHE - - size_t PosToImpl(size_t pos) const - { - return pos == 0 || pos == npos ? pos : DoPosToImpl(pos); - } - - void PosLenToImpl(size_t pos, size_t len, size_t *implPos, size_t *implLen) const; - - size_t LenToImpl(size_t len) const - { - size_t pos, len2; - PosLenToImpl(0, len, &pos, &len2); - return len2; - } - - size_t PosFromImpl(size_t pos) const - { - if ( pos == 0 || pos == npos ) - return pos; - else - return const_iterator(this, m_impl.begin() + pos) - begin(); - } -#endif // !wxUSE_UNICODE_UTF8/wxUSE_UNICODE_UTF8 - -public: - // standard types - typedef wxUniChar value_type; - typedef wxUniChar char_type; - typedef wxUniCharRef reference; - typedef wxChar* pointer; - typedef const wxChar* const_pointer; - - typedef size_t size_type; - typedef wxUniChar const_reference; - -#if wxUSE_STD_STRING - #if wxUSE_UNICODE_UTF8 - // random access is not O(1), as required by Random Access Iterator - #define WX_STR_ITERATOR_TAG std::bidirectional_iterator_tag - #else - #define WX_STR_ITERATOR_TAG std::random_access_iterator_tag - #endif - #define WX_DEFINE_ITERATOR_CATEGORY(cat) typedef cat iterator_category; -#else - // not defining iterator_category at all in this case is better than defining - // it as some dummy type -- at least it results in more intelligible error - // messages - #define WX_DEFINE_ITERATOR_CATEGORY(cat) -#endif - - #define WX_STR_ITERATOR_IMPL(iterator_name, pointer_type, reference_type) \ - private: \ - typedef wxStringImpl::iterator_name underlying_iterator; \ - public: \ - WX_DEFINE_ITERATOR_CATEGORY(WX_STR_ITERATOR_TAG) \ - typedef wxUniChar value_type; \ - typedef int difference_type; \ - typedef reference_type reference; \ - typedef pointer_type pointer; \ - \ - reference operator[](size_t n) const { return *(*this + n); } \ - \ - iterator_name& operator++() \ - { wxStringOperations::IncIter(m_cur); return *this; } \ - iterator_name& operator--() \ - { wxStringOperations::DecIter(m_cur); return *this; } \ - iterator_name operator++(int) \ - { \ - iterator_name tmp = *this; \ - wxStringOperations::IncIter(m_cur); \ - return tmp; \ - } \ - iterator_name operator--(int) \ - { \ - iterator_name tmp = *this; \ - wxStringOperations::DecIter(m_cur); \ - return tmp; \ - } \ - \ - iterator_name& operator+=(ptrdiff_t n) \ - { \ - m_cur = wxStringOperations::AddToIter(m_cur, n); \ - return *this; \ - } \ - iterator_name& operator-=(ptrdiff_t n) \ - { \ - m_cur = wxStringOperations::AddToIter(m_cur, -n); \ - return *this; \ - } \ - \ - difference_type operator-(const iterator_name& i) const \ - { return wxStringOperations::DiffIters(m_cur, i.m_cur); } \ - \ - bool operator==(const iterator_name& i) const \ - { return m_cur == i.m_cur; } \ - bool operator!=(const iterator_name& i) const \ - { return m_cur != i.m_cur; } \ - \ - bool operator<(const iterator_name& i) const \ - { return m_cur < i.m_cur; } \ - bool operator>(const iterator_name& i) const \ - { return m_cur > i.m_cur; } \ - bool operator<=(const iterator_name& i) const \ - { return m_cur <= i.m_cur; } \ - bool operator>=(const iterator_name& i) const \ - { return m_cur >= i.m_cur; } \ - \ - private: \ - /* for internal wxString use only: */ \ - underlying_iterator impl() const { return m_cur; } \ - \ - friend class wxString; \ - friend class wxCStrData; \ - \ - private: \ - underlying_iterator m_cur - - class WXDLLIMPEXP_FWD_BASE const_iterator; - -#if wxUSE_UNICODE_UTF8 - // NB: In UTF-8 build, (non-const) iterator needs to keep reference - // to the underlying wxStringImpl, because UTF-8 is variable-length - // encoding and changing the value pointer to by an iterator (using - // its operator*) requires calling wxStringImpl::replace() if the old - // and new values differ in their encoding's length. - // - // Furthermore, the replace() call may invalid all iterators for the - // string, so we have to keep track of outstanding iterators and update - // them if replace() happens. - // - // This is implemented by maintaining linked list of iterators for every - // string and traversing it in wxUniCharRef::operator=(). Head of the - // list is stored in wxString. (FIXME-UTF8) - - class WXDLLIMPEXP_BASE iterator - { - WX_STR_ITERATOR_IMPL(iterator, wxChar*, wxUniCharRef); - - public: - iterator() {} - iterator(const iterator& i) - : m_cur(i.m_cur), m_node(i.str(), &m_cur) {} - iterator& operator=(const iterator& i) - { - if (&i != this) - { - m_cur = i.m_cur; - m_node.set(i.str(), &m_cur); - } - return *this; - } - - reference operator*() - { return wxUniCharRef::CreateForString(*str(), m_cur); } - - iterator operator+(ptrdiff_t n) const - { return iterator(str(), wxStringOperations::AddToIter(m_cur, n)); } - iterator operator-(ptrdiff_t n) const - { return iterator(str(), wxStringOperations::AddToIter(m_cur, -n)); } - - // Normal iterators need to be comparable with the const_iterators so - // declare the comparison operators and implement them below after the - // full const_iterator declaration. - bool operator==(const const_iterator& i) const; - bool operator!=(const const_iterator& i) const; - bool operator<(const const_iterator& i) const; - bool operator>(const const_iterator& i) const; - bool operator<=(const const_iterator& i) const; - bool operator>=(const const_iterator& i) const; - - private: - iterator(wxString *wxstr, underlying_iterator ptr) - : m_cur(ptr), m_node(wxstr, &m_cur) {} - - wxString* str() const { return const_cast(m_node.m_str); } - - wxStringIteratorNode m_node; - - friend class const_iterator; - }; - - class WXDLLIMPEXP_BASE const_iterator - { - // NB: reference_type is intentionally value, not reference, the character - // may be encoded differently in wxString data: - WX_STR_ITERATOR_IMPL(const_iterator, const wxChar*, wxUniChar); - - public: - const_iterator() {} - const_iterator(const const_iterator& i) - : m_cur(i.m_cur), m_node(i.str(), &m_cur) {} - const_iterator(const iterator& i) - : m_cur(i.m_cur), m_node(i.str(), &m_cur) {} - - const_iterator& operator=(const const_iterator& i) - { - if (&i != this) - { - m_cur = i.m_cur; - m_node.set(i.str(), &m_cur); - } - return *this; - } - const_iterator& operator=(const iterator& i) - { m_cur = i.m_cur; m_node.set(i.str(), &m_cur); return *this; } - - reference operator*() const - { return wxStringOperations::DecodeChar(m_cur); } - - const_iterator operator+(ptrdiff_t n) const - { return const_iterator(str(), wxStringOperations::AddToIter(m_cur, n)); } - const_iterator operator-(ptrdiff_t n) const - { return const_iterator(str(), wxStringOperations::AddToIter(m_cur, -n)); } - - // Notice that comparison operators taking non-const iterator are not - // needed here because of the implicit conversion from non-const iterator - // to const ones ensure that the versions for const_iterator declared - // inside WX_STR_ITERATOR_IMPL can be used. - - private: - // for internal wxString use only: - const_iterator(const wxString *wxstr, underlying_iterator ptr) - : m_cur(ptr), m_node(wxstr, &m_cur) {} - - const wxString* str() const { return m_node.m_str; } - - wxStringIteratorNode m_node; - }; - - size_t IterToImplPos(wxString::iterator i) const - { return wxStringImpl::const_iterator(i.impl()) - m_impl.begin(); } - - iterator GetIterForNthChar(size_t n) - { return iterator(this, m_impl.begin() + PosToImpl(n)); } - const_iterator GetIterForNthChar(size_t n) const - { return const_iterator(this, m_impl.begin() + PosToImpl(n)); } -#else // !wxUSE_UNICODE_UTF8 - - class WXDLLIMPEXP_BASE iterator - { - WX_STR_ITERATOR_IMPL(iterator, wxChar*, wxUniCharRef); - - public: - iterator() {} - iterator(const iterator& i) : m_cur(i.m_cur) {} - - reference operator*() - { return wxUniCharRef::CreateForString(m_cur); } - - iterator operator+(ptrdiff_t n) const - { return iterator(wxStringOperations::AddToIter(m_cur, n)); } - iterator operator-(ptrdiff_t n) const - { return iterator(wxStringOperations::AddToIter(m_cur, -n)); } - - // As in UTF-8 case above, define comparison operators taking - // const_iterator too. - bool operator==(const const_iterator& i) const; - bool operator!=(const const_iterator& i) const; - bool operator<(const const_iterator& i) const; - bool operator>(const const_iterator& i) const; - bool operator<=(const const_iterator& i) const; - bool operator>=(const const_iterator& i) const; - - private: - // for internal wxString use only: - iterator(underlying_iterator ptr) : m_cur(ptr) {} - iterator(wxString *WXUNUSED(str), underlying_iterator ptr) : m_cur(ptr) {} - - friend class const_iterator; - }; - - class WXDLLIMPEXP_BASE const_iterator - { - // NB: reference_type is intentionally value, not reference, the character - // may be encoded differently in wxString data: - WX_STR_ITERATOR_IMPL(const_iterator, const wxChar*, wxUniChar); - - public: - const_iterator() {} - const_iterator(const const_iterator& i) : m_cur(i.m_cur) {} - const_iterator(const iterator& i) : m_cur(i.m_cur) {} - - reference operator*() const - { return wxStringOperations::DecodeChar(m_cur); } - - const_iterator operator+(ptrdiff_t n) const - { return const_iterator(wxStringOperations::AddToIter(m_cur, n)); } - const_iterator operator-(ptrdiff_t n) const - { return const_iterator(wxStringOperations::AddToIter(m_cur, -n)); } - - // As in UTF-8 case above, we don't need comparison operators taking - // iterator because we have an implicit conversion from iterator to - // const_iterator so the operators declared by WX_STR_ITERATOR_IMPL will - // be used. - - private: - // for internal wxString use only: - const_iterator(underlying_iterator ptr) : m_cur(ptr) {} - const_iterator(const wxString *WXUNUSED(str), underlying_iterator ptr) - : m_cur(ptr) {} - }; - - iterator GetIterForNthChar(size_t n) { return begin() + n; } - const_iterator GetIterForNthChar(size_t n) const { return begin() + n; } -#endif // wxUSE_UNICODE_UTF8/!wxUSE_UNICODE_UTF8 - - #undef WX_STR_ITERATOR_TAG - #undef WX_STR_ITERATOR_IMPL - - // This method is mostly used by wxWidgets itself and return the offset of - // the given iterator in bytes relative to the start of the buffer - // representing the current string contents in the current locale encoding. - // - // It is inefficient as it involves converting part of the string to this - // encoding (and also unsafe as it simply returns 0 if the conversion fails) - // and so should be avoided if possible, wx itself only uses it to implement - // backwards-compatible API. - ptrdiff_t IterOffsetInMBStr(const const_iterator& i) const - { - const wxString str(begin(), i); - - // This is logically equivalent to strlen(str.mb_str()) but avoids - // actually converting the string to multibyte and just computes the - // length that it would have after conversion. - size_t ofs = wxConvLibc.FromWChar(NULL, 0, str.wc_str(), str.length()); - return ofs == wxCONV_FAILED ? 0 : static_cast(ofs); - } - - friend class iterator; - friend class const_iterator; - - template - class reverse_iterator_impl - { - public: - typedef T iterator_type; - - WX_DEFINE_ITERATOR_CATEGORY(typename T::iterator_category) - typedef typename T::value_type value_type; - typedef typename T::difference_type difference_type; - typedef typename T::reference reference; - typedef typename T::pointer *pointer; - - reverse_iterator_impl() {} - reverse_iterator_impl(iterator_type i) : m_cur(i) {} - reverse_iterator_impl(const reverse_iterator_impl& ri) - : m_cur(ri.m_cur) {} - - iterator_type base() const { return m_cur; } - - reference operator*() const { return *(m_cur-1); } - reference operator[](size_t n) const { return *(*this + n); } - - reverse_iterator_impl& operator++() - { --m_cur; return *this; } - reverse_iterator_impl operator++(int) - { reverse_iterator_impl tmp = *this; --m_cur; return tmp; } - reverse_iterator_impl& operator--() - { ++m_cur; return *this; } - reverse_iterator_impl operator--(int) - { reverse_iterator_impl tmp = *this; ++m_cur; return tmp; } - - // NB: explicit in the functions below is to keep BCC 5.5 happy - reverse_iterator_impl operator+(ptrdiff_t n) const - { return reverse_iterator_impl(m_cur - n); } - reverse_iterator_impl operator-(ptrdiff_t n) const - { return reverse_iterator_impl(m_cur + n); } - reverse_iterator_impl operator+=(ptrdiff_t n) - { m_cur -= n; return *this; } - reverse_iterator_impl operator-=(ptrdiff_t n) - { m_cur += n; return *this; } - - unsigned operator-(const reverse_iterator_impl& i) const - { return i.m_cur - m_cur; } - - bool operator==(const reverse_iterator_impl& ri) const - { return m_cur == ri.m_cur; } - bool operator!=(const reverse_iterator_impl& ri) const - { return !(*this == ri); } - - bool operator<(const reverse_iterator_impl& i) const - { return m_cur > i.m_cur; } - bool operator>(const reverse_iterator_impl& i) const - { return m_cur < i.m_cur; } - bool operator<=(const reverse_iterator_impl& i) const - { return m_cur >= i.m_cur; } - bool operator>=(const reverse_iterator_impl& i) const - { return m_cur <= i.m_cur; } - - private: - iterator_type m_cur; - }; - - typedef reverse_iterator_impl reverse_iterator; - typedef reverse_iterator_impl const_reverse_iterator; - -private: - // used to transform an expression built using c_str() (and hence of type - // wxCStrData) to an iterator into the string - static const_iterator CreateConstIterator(const wxCStrData& data) - { - return const_iterator(data.m_str, - (data.m_str->begin() + data.m_offset).impl()); - } - - // in UTF-8 STL build, creation from std::string requires conversion under - // non-UTF8 locales, so we can't have and use wxString(wxStringImpl) ctor; - // instead we define dummy type that lets us have wxString ctor for creation - // from wxStringImpl that couldn't be used by user code (in all other builds, - // "standard" ctors can be used): -#if wxUSE_UNICODE_UTF8 && wxUSE_STL_BASED_WXSTRING - struct CtorFromStringImplTag {}; - - wxString(CtorFromStringImplTag* WXUNUSED(dummy), const wxStringImpl& src) - : m_impl(src) {} - - static wxString FromImpl(const wxStringImpl& src) - { return wxString((CtorFromStringImplTag*)NULL, src); } -#else - #if !wxUSE_STL_BASED_WXSTRING - wxString(const wxStringImpl& src) : m_impl(src) { } - // else: already defined as wxString(wxStdString) below - #endif - static wxString FromImpl(const wxStringImpl& src) { return wxString(src); } -#endif - public: // constructors and destructor // ctor for an empty string - wxString() {} - + wxString() : wxStringBase() { } // copy ctor - wxString(const wxString& stringSrc) : m_impl(stringSrc.m_impl) { } - + wxString(const wxStringBase& stringSrc) : wxStringBase(stringSrc) { } + wxString(const wxString& stringSrc) : wxStringBase(stringSrc) { } // string containing nRepeat copies of ch - wxString(wxUniChar ch, size_t nRepeat = 1 ) - { assign(nRepeat, ch); } - wxString(size_t nRepeat, wxUniChar ch) - { assign(nRepeat, ch); } - wxString(wxUniCharRef ch, size_t nRepeat = 1) - { assign(nRepeat, ch); } - wxString(size_t nRepeat, wxUniCharRef ch) - { assign(nRepeat, ch); } - wxString(char ch, size_t nRepeat = 1) - { assign(nRepeat, ch); } - wxString(size_t nRepeat, char ch) - { assign(nRepeat, ch); } - wxString(wchar_t ch, size_t nRepeat = 1) - { assign(nRepeat, ch); } - wxString(size_t nRepeat, wchar_t ch) - { assign(nRepeat, ch); } + wxString(wxChar ch, size_t nRepeat = 1) + : wxStringBase(nRepeat, ch) { } + wxString(size_t nRepeat, wxChar ch) + : wxStringBase(nRepeat, ch) { } + // ctor takes first nLength characters from C string + // (default value of npos means take all the string) + wxString(const wxChar *psz) + : wxStringBase(psz ? psz : wxT("")) { } + wxString(const wxChar *psz, size_t nLength) + : wxStringBase(psz, nLength) { } + wxString(const wxChar *psz, + const wxMBConv& WXUNUSED(conv), + size_t nLength = npos) + : wxStringBase(psz, nLength == npos ? wxStrlen(psz) : nLength) { } - // ctors from char* strings: - wxString(const char *psz) - : m_impl(ImplStr(psz)) {} - wxString(const char *psz, const wxMBConv& conv) - : m_impl(ImplStr(psz, conv)) {} - wxString(const char *psz, size_t nLength) - { assign(psz, nLength); } - wxString(const char *psz, const wxMBConv& conv, size_t nLength) - { - SubstrBufFromMB str(ImplStr(psz, nLength, conv)); - m_impl.assign(str.data, str.len); - } - - // and unsigned char*: - wxString(const unsigned char *psz) - : m_impl(ImplStr((const char*)psz)) {} - wxString(const unsigned char *psz, const wxMBConv& conv) - : m_impl(ImplStr((const char*)psz, conv)) {} - wxString(const unsigned char *psz, size_t nLength) - { assign((const char*)psz, nLength); } - wxString(const unsigned char *psz, const wxMBConv& conv, size_t nLength) - { - SubstrBufFromMB str(ImplStr((const char*)psz, nLength, conv)); - m_impl.assign(str.data, str.len); - } - - // ctors from wchar_t* strings: - wxString(const wchar_t *pwz) - : m_impl(ImplStr(pwz)) {} - wxString(const wchar_t *pwz, const wxMBConv& WXUNUSED(conv)) - : m_impl(ImplStr(pwz)) {} - wxString(const wchar_t *pwz, size_t nLength) - { assign(pwz, nLength); } - wxString(const wchar_t *pwz, const wxMBConv& WXUNUSED(conv), size_t nLength) - { assign(pwz, nLength); } - - wxString(const wxScopedCharBuffer& buf) - { assign(buf.data(), buf.length()); } - wxString(const wxScopedWCharBuffer& buf) - { assign(buf.data(), buf.length()); } - - // NB: this version uses m_impl.c_str() to force making a copy of the - // string, so that "wxString(str.c_str())" idiom for passing strings - // between threads works - wxString(const wxCStrData& cstr) - : m_impl(cstr.AsString().m_impl.c_str()) { } - - // as we provide both ctors with this signature for both char and unsigned - // char string, we need to provide one for wxCStrData to resolve ambiguity - wxString(const wxCStrData& cstr, size_t nLength) - : m_impl(cstr.AsString().Mid(0, nLength).m_impl) {} - - // and because wxString is convertible to wxCStrData and const wxChar * - // we also need to provide this one - wxString(const wxString& str, size_t nLength) - { assign(str, nLength); } - - -#if wxUSE_STRING_POS_CACHE - ~wxString() - { - // we need to invalidate our cache entry as another string could be - // recreated at the same address (unlikely, but still possible, with the - // heap-allocated strings but perfectly common with stack-allocated ones) - InvalidateCache(); - } -#endif // wxUSE_STRING_POS_CACHE - - // even if we're not built with wxUSE_STD_STRING_CONV_IN_WXSTRING == 1 it is - // very convenient to allow implicit conversions from std::string to wxString - // and vice verse as this allows to use the same strings in non-GUI and GUI - // code, however we don't want to unconditionally add this ctor as it would - // make wx lib dependent on libstdc++ on some Linux versions which is bad, so - // instead we ask the client code to define this wxUSE_STD_STRING symbol if - // they need it + // even if we're not built with wxUSE_STL == 1 it is very convenient to allow + // implicit conversions from std::string to wxString as this allows to use + // the same strings in non-GUI and GUI code, however we don't want to + // unconditionally add this ctor as it would make wx lib dependent on + // libstdc++ on some Linux versions which is bad, so instead we ask the + // client code to define this wxUSE_STD_STRING symbol if they need it #if wxUSE_STD_STRING - #if wxUSE_UNICODE_WCHAR - wxString(const wxStdWideString& str) : m_impl(str) {} - #else // UTF-8 or ANSI - wxString(const wxStdWideString& str) - { assign(str.c_str(), str.length()); } - #endif - - #if !wxUSE_UNICODE // ANSI build - // FIXME-UTF8: do this in UTF8 build #if wxUSE_UTF8_LOCALE_ONLY, too - wxString(const std::string& str) : m_impl(str) {} - #else // Unicode - wxString(const std::string& str) - { assign(str.c_str(), str.length()); } - #endif + wxString(const wxStdString& s) + : wxStringBase(s.c_str()) { } #endif // wxUSE_STD_STRING - // Also always provide explicit conversions to std::[w]string in any case, - // see below for the implicit ones. -#if wxUSE_STD_STRING - // We can avoid a copy if we already use this string type internally, - // otherwise we create a copy on the fly: - #if wxUSE_UNICODE_WCHAR && wxUSE_STL_BASED_WXSTRING - #define wxStringToStdWstringRetType const wxStdWideString& - const wxStdWideString& ToStdWstring() const { return m_impl; } - #else - // wxStringImpl is either not std::string or needs conversion - #define wxStringToStdWstringRetType wxStdWideString - wxStdWideString ToStdWstring() const - { -#if wxUSE_UNICODE_WCHAR - wxScopedWCharBuffer buf = - wxScopedWCharBuffer::CreateNonOwned(m_impl.c_str(), m_impl.length()); -#else // !wxUSE_UNICODE_WCHAR - wxScopedWCharBuffer buf(wc_str()); -#endif +#if wxUSE_UNICODE + // from multibyte string + wxString(const char *psz, const wxMBConv& conv, size_t nLength = npos); + // from wxWCharBuffer (i.e. return from wxGetString) + wxString(const wxWCharBuffer& psz) : wxStringBase(psz.data()) { } +#else // ANSI + // from C string (for compilers using unsigned char) + wxString(const unsigned char* psz) + : wxStringBase((const char*)psz) { } + // from part of C string (for compilers using unsigned char) + wxString(const unsigned char* psz, size_t nLength) + : wxStringBase((const char*)psz, nLength) { } - return wxStdWideString(buf.data(), buf.length()); - } - #endif +#if wxUSE_WCHAR_T + // from wide (Unicode) string + wxString(const wchar_t *pwz, + const wxMBConv& conv = wxConvLibc, + size_t nLength = npos); +#endif // !wxUSE_WCHAR_T - #if (!wxUSE_UNICODE || wxUSE_UTF8_LOCALE_ONLY) && wxUSE_STL_BASED_WXSTRING - // wxStringImpl is std::string in the encoding we want - #define wxStringToStdStringRetType const std::string& - const std::string& ToStdString() const { return m_impl; } - #else - // wxStringImpl is either not std::string or needs conversion - #define wxStringToStdStringRetType std::string - std::string ToStdString() const - { - wxScopedCharBuffer buf(mb_str()); - return std::string(buf.data(), buf.length()); - } - #endif - -#if wxUSE_STD_STRING_CONV_IN_WXSTRING - // Implicit conversions to std::[w]string are not provided by default as - // they conflict with the implicit conversions to "const char/wchar_t *" - // which we use for backwards compatibility but do provide them if - // explicitly requested. - operator wxStringToStdStringRetType() const { return ToStdString(); } - operator wxStringToStdWstringRetType() const { return ToStdWstring(); } -#endif // wxUSE_STD_STRING_CONV_IN_WXSTRING - -#undef wxStringToStdStringRetType -#undef wxStringToStdWstringRetType - -#endif // wxUSE_STD_STRING - - wxString Clone() const - { - // make a deep copy of the string, i.e. the returned string will have - // ref count = 1 with refcounted implementation - return wxString::FromImpl(wxStringImpl(m_impl.c_str(), m_impl.length())); - } - - // first valid index position - const_iterator begin() const { return const_iterator(this, m_impl.begin()); } - iterator begin() { return iterator(this, m_impl.begin()); } - // position one after the last valid one - const_iterator end() const { return const_iterator(this, m_impl.end()); } - iterator end() { return iterator(this, m_impl.end()); } - - // first element of the reversed string - const_reverse_iterator rbegin() const - { return const_reverse_iterator(end()); } - reverse_iterator rbegin() - { return reverse_iterator(end()); } - // one beyond the end of the reversed string - const_reverse_iterator rend() const - { return const_reverse_iterator(begin()); } - reverse_iterator rend() - { return reverse_iterator(begin()); } - - // std::string methods: -#if wxUSE_UNICODE_UTF8 - size_t length() const - { -#if wxUSE_STRING_POS_CACHE - wxCACHE_PROFILE_FIELD_INC(lentot); - - Cache::Element * const cache = GetCacheElement(); - - if ( cache->len == npos ) - { - // it's probably not worth trying to be clever and using cache->pos - // here as it's probably 0 anyhow -- you usually call length() before - // starting to index the string - cache->len = end() - begin(); - } - else - { - wxCACHE_PROFILE_FIELD_INC(lenhits); - - wxSTRING_CACHE_ASSERT( (int)cache->len == end() - begin() ); - } - - return cache->len; -#else // !wxUSE_STRING_POS_CACHE - return end() - begin(); -#endif // wxUSE_STRING_POS_CACHE/!wxUSE_STRING_POS_CACHE - } -#else - size_t length() const { return m_impl.length(); } -#endif - - size_type size() const { return length(); } - size_type max_size() const { return npos; } - - bool empty() const { return m_impl.empty(); } - - // NB: these methods don't have a well-defined meaning in UTF-8 case - size_type capacity() const { return m_impl.capacity(); } - void reserve(size_t sz) { m_impl.reserve(sz); } - - void resize(size_t nSize, wxUniChar ch = wxT('\0')) - { - const size_t len = length(); - if ( nSize == len) - return; - -#if wxUSE_UNICODE_UTF8 - if ( nSize < len ) - { - wxSTRING_INVALIDATE_CACHE(); - - // we can't use wxStringImpl::resize() for truncating the string as it - // counts in bytes, not characters - erase(nSize); - return; - } - - // we also can't use (presumably more efficient) resize() if we have to - // append characters taking more than one byte - if ( !ch.IsAscii() ) - { - append(nSize - len, ch); - } - else // can use (presumably faster) resize() version -#endif // wxUSE_UNICODE_UTF8 - { - wxSTRING_INVALIDATE_CACHED_LENGTH(); - - m_impl.resize(nSize, (wxStringCharType)ch); - } - } - - wxString substr(size_t nStart = 0, size_t nLen = npos) const - { - size_t pos, len; - PosLenToImpl(nStart, nLen, &pos, &len); - return FromImpl(m_impl.substr(pos, len)); - } + // from wxCharBuffer + wxString(const wxCharBuffer& psz) + : wxStringBase(psz) { } +#endif // Unicode/ANSI // generic attributes & operations // as standard strlen() @@ -1544,9 +750,18 @@ public: // truncate the string to given length wxString& Truncate(size_t uiLen); // empty string contents - void Empty() { clear(); } + void Empty() + { + Truncate(0); + + wxASSERT_MSG( empty(), wxT("string not empty after call to Empty()?") ); + } // empty the string and free memory - void Clear() { clear(); } + void Clear() + { + wxString tmp(wxEmptyString); + swap(tmp); + } // contents test // Is an ascii value @@ -1558,162 +773,79 @@ public: // data access (all indexes are 0 based) // read access - wxUniChar at(size_t n) const - { return wxStringOperations::DecodeChar(m_impl.begin() + PosToImpl(n)); } - wxUniChar GetChar(size_t n) const + wxChar GetChar(size_t n) const { return at(n); } // read/write access - wxUniCharRef at(size_t n) - { return *GetIterForNthChar(n); } - wxUniCharRef GetWritableChar(size_t n) + wxChar& GetWritableChar(size_t n) { return at(n); } // write access - void SetChar(size_t n, wxUniChar ch) + void SetChar(size_t n, wxChar ch) { at(n) = ch; } // get last character - wxUniChar Last() const - { - wxASSERT_MSG( !empty(), wxT("wxString: index out of bounds") ); - return *rbegin(); - } + wxChar Last() const + { + wxASSERT_MSG( !empty(), wxT("wxString: index out of bounds") ); + + return at(length() - 1); + } // get writable last character - wxUniCharRef Last() - { - wxASSERT_MSG( !empty(), wxT("wxString: index out of bounds") ); - return *rbegin(); - } + wxChar& Last() + { + wxASSERT_MSG( !empty(), wxT("wxString: index out of bounds") ); + return at(length() - 1); + } /* Note that we we must define all of the overloads below to avoid - ambiguity when using str[0]. + ambiguity when using str[0]. Also note that for a conforming compiler we + don't need const version of operatorp[] at all as indexed access to + const string is provided by implicit conversion to "const wxChar *" + below and defining them would only result in ambiguities, but some other + compilers refuse to compile "str[0]" without them. */ - wxUniChar operator[](int n) const - { return at(n); } - wxUniChar operator[](long n) const - { return at(n); } - wxUniChar operator[](size_t n) const - { return at(n); } + +#if defined(__BORLANDC__) || defined(__WATCOMC__) || defined(__MWERKS__) + wxChar operator[](int n) const + { return wxStringBase::at(n); } + wxChar operator[](size_type n) const + { return wxStringBase::at(n); } #ifndef wxSIZE_T_IS_UINT - wxUniChar operator[](unsigned int n) const - { return at(n); } + wxChar operator[](unsigned int n) const + { return wxStringBase::at(n); } #endif // size_t != unsigned int +#endif // broken compiler + // operator versions of GetWriteableChar() - wxUniCharRef operator[](int n) - { return at(n); } - wxUniCharRef operator[](long n) - { return at(n); } - wxUniCharRef operator[](size_t n) - { return at(n); } + wxChar& operator[](int n) + { return wxStringBase::at(n); } + wxChar& operator[](size_type n) + { return wxStringBase::at(n); } #ifndef wxSIZE_T_IS_UINT - wxUniCharRef operator[](unsigned int n) - { return at(n); } + wxChar& operator[](unsigned int n) + { return wxStringBase::at(n); } #endif // size_t != unsigned int + // implicit conversion to C string + operator const wxChar*() const { return c_str(); } - /* - Overview of wxString conversions, implicit and explicit: - - - wxString has a std::[w]string-like c_str() method, however it does - not return a C-style string directly but instead returns wxCStrData - helper object which is convertible to either "char *" narrow string - or "wchar_t *" wide string. Usually the correct conversion will be - applied by the compiler automatically but if this doesn't happen you - need to explicitly choose one using wxCStrData::AsChar() or AsWChar() - methods or another wxString conversion function. - - - One of the places where the conversion does *NOT* happen correctly is - when c_str() is passed to a vararg function such as printf() so you - must *NOT* use c_str() with them. Either use wxPrintf() (all wx - functions do handle c_str() correctly, even if they appear to be - vararg (but they're not, really)) or add an explicit AsChar() or, if - compatibility with previous wxWidgets versions is important, add a - cast to "const char *". - - - In non-STL mode only, wxString is also implicitly convertible to - wxCStrData. The same warning as above applies. - - - c_str() is polymorphic as it can be converted to either narrow or - wide string. If you explicitly need one or the other, choose to use - mb_str() (for narrow) or wc_str() (for wide) instead. Notice that - these functions can return either the pointer to string directly (if - this is what the string uses internally) or a temporary buffer - containing the string and convertible to it. Again, conversion will - usually be done automatically by the compiler but beware of the - vararg functions: you need an explicit cast when using them. - - - There are also non-const versions of mb_str() and wc_str() called - char_str() and wchar_str(). They are only meant to be used with - non-const-correct functions and they always return buffers. - - - Finally wx_str() returns whatever string representation is used by - wxString internally. It may be either a narrow or wide string - depending on wxWidgets build mode but it will always be a raw pointer - (and not a buffer). - */ - - // explicit conversion to wxCStrData - wxCStrData c_str() const { return wxCStrData(this); } - wxCStrData data() const { return c_str(); } - - // implicit conversion to wxCStrData - operator wxCStrData() const { return c_str(); } - - // the first two operators conflict with operators for conversion to - // std::string and they must be disabled if those conversions are enabled; - // the next one only makes sense if conversions to char* are also defined - // and not defining it in STL build also helps us to get more clear error - // messages for the code which relies on implicit conversion to char* in - // STL build -#if !wxUSE_STD_STRING_CONV_IN_WXSTRING - operator const char*() const { return c_str(); } - operator const wchar_t*() const { return c_str(); } - - // implicit conversion to untyped pointer for compatibility with previous - // wxWidgets versions: this is the same as conversion to const char * so it - // may fail! - operator const void*() const { return c_str(); } -#endif // !wxUSE_STD_STRING_CONV_IN_WXSTRING - + // identical to c_str(), for wxWin 1.6x compatibility + const wxChar* wx_str() const { return c_str(); } // identical to c_str(), for MFC compatibility - const wxCStrData GetData() const { return c_str(); } - - // explicit conversion to C string in internal representation (char*, - // wchar_t*, UTF-8-encoded char*, depending on the build): - const wxStringCharType *wx_str() const { return m_impl.c_str(); } + const wxChar* GetData() const { return c_str(); } +#if wxABI_VERSION >= 20804 // conversion to *non-const* multibyte or widestring buffer; modifying // returned buffer won't affect the string, these methods are only useful // for passing values to const-incorrect functions wxWritableCharBuffer char_str(const wxMBConv& conv = wxConvLibc) const - { return mb_str(conv); } - wxWritableWCharBuffer wchar_str() const { return wc_str(); } - - // conversion to the buffer of the given type T (= char or wchar_t) and - // also optionally return the buffer length - // - // this is mostly/only useful for the template functions - // - // FIXME-VC6: the second argument only exists for VC6 which doesn't support - // explicit template function selection, do not use it unless - // you must support VC6! - template - wxCharTypeBuffer tchar_str(size_t *len = NULL, - T * WXUNUSED(dummy) = NULL) const - { -#if wxUSE_UNICODE - // we need a helper dispatcher depending on type - return wxPrivate::wxStringAsBufHelper::Get(*this, len); -#else // ANSI - // T can only be char in ANSI build - if ( len ) - *len = length(); - - return wxCharTypeBuffer::CreateNonOwned(wx_str(), length()); -#endif // Unicode build kind - } + { return mb_str(conv); } +#if wxUSE_WCHAR_T + wxWritableWCharBuffer wchar_str() const { return wc_str(wxConvLibc); } +#endif +#endif // wxABI_VERSION >= 20804 // conversion to/from plain (i.e. 7 bit) ASCII: this is useful for // converting numbers or strings which are certain not to contain special @@ -1722,113 +854,40 @@ public: // the behaviour of these functions with the strings containing anything // else than 7 bit ASCII characters is undefined, use at your own risk. #if wxUSE_UNICODE - static wxString FromAscii(const char *ascii, size_t len); - static wxString FromAscii(const char *ascii); - static wxString FromAscii(char ascii); - const wxScopedCharBuffer ToAscii() const; + static wxString FromAscii(const char *ascii); // string + static wxString FromAscii(const char ascii); // char + const wxCharBuffer ToAscii() const; #else // ANSI static wxString FromAscii(const char *ascii) { return wxString( ascii ); } - static wxString FromAscii(const char *ascii, size_t len) - { return wxString( ascii, len ); } - static wxString FromAscii(char ascii) { return wxString( ascii ); } + static wxString FromAscii(const char ascii) { return wxString( ascii ); } const char *ToAscii() const { return c_str(); } #endif // Unicode/!Unicode - // also provide unsigned char overloads as signed/unsigned doesn't matter - // for 7 bit ASCII characters - static wxString FromAscii(const unsigned char *ascii) - { return FromAscii((const char *)ascii); } - static wxString FromAscii(const unsigned char *ascii, size_t len) - { return FromAscii((const char *)ascii, len); } - +#if wxABI_VERSION >= 20804 // conversion to/from UTF-8: -#if wxUSE_UNICODE_UTF8 - static wxString FromUTF8Unchecked(const char *utf8) - { - if ( !utf8 ) - return wxEmptyString; - - wxASSERT( wxStringOperations::IsValidUtf8String(utf8) ); - return FromImpl(wxStringImpl(utf8)); - } - static wxString FromUTF8Unchecked(const char *utf8, size_t len) - { - if ( !utf8 ) - return wxEmptyString; - if ( len == npos ) - return FromUTF8Unchecked(utf8); - - wxASSERT( wxStringOperations::IsValidUtf8String(utf8, len) ); - return FromImpl(wxStringImpl(utf8, len)); - } - +#if wxUSE_UNICODE static wxString FromUTF8(const char *utf8) - { - if ( !utf8 || !wxStringOperations::IsValidUtf8String(utf8) ) - return ""; - - return FromImpl(wxStringImpl(utf8)); - } + { return wxString(utf8, wxConvUTF8); } + static wxString FromUTF8(const char *utf8, size_t len) + { return wxString(utf8, wxConvUTF8, len); } + const wxCharBuffer utf8_str() const { return mb_str(wxConvUTF8); } + const wxCharBuffer ToUTF8() const { return utf8_str(); } +#elif wxUSE_WCHAR_T // ANSI + static wxString FromUTF8(const char *utf8) + { return wxString(wxConvUTF8.cMB2WC(utf8)); } static wxString FromUTF8(const char *utf8, size_t len) { - if ( len == npos ) - return FromUTF8(utf8); - - if ( !utf8 || !wxStringOperations::IsValidUtf8String(utf8, len) ) - return ""; - - return FromImpl(wxStringImpl(utf8, len)); + size_t wlen; + wxWCharBuffer buf(wxConvUTF8.cMB2WC(utf8, len == npos ? wxNO_LEN : len, &wlen)); + return wxString(buf.data(), wxConvLibc, wlen); } + const wxCharBuffer utf8_str() const + { return wxConvUTF8.cWC2MB(wc_str(wxConvLibc)); } + const wxCharBuffer ToUTF8() const { return utf8_str(); } +#endif // Unicode/ANSI +#endif // wxABI_VERSION >= 20804 - const wxScopedCharBuffer utf8_str() const - { return wxCharBuffer::CreateNonOwned(m_impl.c_str(), m_impl.length()); } - - // this function exists in UTF-8 build only and returns the length of the - // internal UTF-8 representation - size_t utf8_length() const { return m_impl.length(); } -#elif wxUSE_UNICODE_WCHAR - static wxString FromUTF8(const char *utf8, size_t len = npos) - { return wxString(utf8, wxMBConvUTF8(), len); } - static wxString FromUTF8Unchecked(const char *utf8, size_t len = npos) - { - const wxString s(utf8, wxMBConvUTF8(), len); - wxASSERT_MSG( !utf8 || !*utf8 || !s.empty(), - "string must be valid UTF-8" ); - return s; - } - const wxScopedCharBuffer utf8_str() const { return mb_str(wxMBConvUTF8()); } -#else // ANSI - static wxString FromUTF8(const char *utf8) - { return wxString(wxMBConvUTF8().cMB2WC(utf8)); } - static wxString FromUTF8(const char *utf8, size_t len) - { - size_t wlen; - wxScopedWCharBuffer buf(wxMBConvUTF8().cMB2WC(utf8, len == npos ? wxNO_LEN : len, &wlen)); - return wxString(buf.data(), wlen); - } - static wxString FromUTF8Unchecked(const char *utf8, size_t len = npos) - { - size_t wlen; - wxScopedWCharBuffer buf - ( - wxMBConvUTF8().cMB2WC - ( - utf8, - len == npos ? wxNO_LEN : len, - &wlen - ) - ); - wxASSERT_MSG( !utf8 || !*utf8 || wlen, - "string must be valid UTF-8" ); - - return wxString(buf.data(), wlen); - } - const wxScopedCharBuffer utf8_str() const - { return wxMBConvUTF8().cWC2MB(wc_str()); } -#endif - - const wxScopedCharBuffer ToUTF8() const { return utf8_str(); } - +#if wxABI_VERSION >= 20804 // functions for storing binary data in wxString: #if wxUSE_UNICODE static wxString From8BitData(const char *data, size_t len) @@ -1836,17 +895,16 @@ public: // version for NUL-terminated data: static wxString From8BitData(const char *data) { return wxString(data, wxConvISO8859_1); } - const wxScopedCharBuffer To8BitData() const - { return mb_str(wxConvISO8859_1); } + const wxCharBuffer To8BitData() const { return mb_str(wxConvISO8859_1); } #else // ANSI static wxString From8BitData(const char *data, size_t len) { return wxString(data, len); } // version for NUL-terminated data: static wxString From8BitData(const char *data) { return wxString(data); } - const wxScopedCharBuffer To8BitData() const - { return wxScopedCharBuffer::CreateNonOwned(wx_str(), length()); } + const char *To8BitData() const { return c_str(); } #endif // Unicode/ANSI +#endif // wxABI_VERSION >= 20804 // conversions with (possible) format conversions: have to return a // buffer with temporary data @@ -1857,162 +915,71 @@ public: // accepting the file names. The return value is always the same, but the // type differs because a function may either return pointer to the buffer // directly or have to use intermediate buffer for translation. - #if wxUSE_UNICODE - - // this is an optimization: even though using mb_str(wxConvLibc) does the - // same thing (i.e. returns pointer to internal representation as locale is - // always an UTF-8 one) in wxUSE_UTF8_LOCALE_ONLY case, we can avoid the - // extra checks and the temporary buffer construction by providing a - // separate mb_str() overload -#if wxUSE_UTF8_LOCALE_ONLY - const char* mb_str() const { return wx_str(); } - const wxScopedCharBuffer mb_str(const wxMBConv& conv) const - { - return AsCharBuf(conv); - } -#else // !wxUSE_UTF8_LOCALE_ONLY - const wxScopedCharBuffer mb_str(const wxMBConv& conv = wxConvLibc) const - { - return AsCharBuf(conv); - } -#endif // wxUSE_UTF8_LOCALE_ONLY/!wxUSE_UTF8_LOCALE_ONLY + const wxCharBuffer mb_str(const wxMBConv& conv = wxConvLibc) const; const wxWX2MBbuf mbc_str() const { return mb_str(*wxConvCurrent); } -#if wxUSE_UNICODE_WCHAR - const wchar_t* wc_str() const { return wx_str(); } -#elif wxUSE_UNICODE_UTF8 - const wxScopedWCharBuffer wc_str() const - { return AsWCharBuf(wxMBConvStrictUTF8()); } -#endif + const wxChar* wc_str() const { return c_str(); } + // for compatibility with !wxUSE_UNICODE version - const wxWX2WCbuf wc_str(const wxMBConv& WXUNUSED(conv)) const - { return wc_str(); } + const wxChar* wc_str(const wxMBConv& WXUNUSED(conv)) const { return c_str(); } #if wxMBFILES - const wxScopedCharBuffer fn_str() const { return mb_str(wxConvFile); } + const wxCharBuffer fn_str() const { return mb_str(wxConvFile); } #else // !wxMBFILES - const wxWX2WCbuf fn_str() const { return wc_str(); } + const wxChar* fn_str() const { return c_str(); } #endif // wxMBFILES/!wxMBFILES - #else // ANSI - const char* mb_str() const { return wx_str(); } + const wxChar* mb_str() const { return c_str(); } // for compatibility with wxUSE_UNICODE version - const char* mb_str(const wxMBConv& WXUNUSED(conv)) const { return wx_str(); } + const wxChar* mb_str(const wxMBConv& WXUNUSED(conv)) const { return c_str(); } const wxWX2MBbuf mbc_str() const { return mb_str(); } - const wxScopedWCharBuffer wc_str(const wxMBConv& conv = wxConvLibc) const - { return AsWCharBuf(conv); } - - const wxScopedCharBuffer fn_str() const - { return wxConvFile.cWC2WX( wc_str( wxConvLibc ) ); } -#endif // Unicode/ANSI - -#if wxUSE_UNICODE_UTF8 - const wxScopedWCharBuffer t_str() const { return wc_str(); } -#elif wxUSE_UNICODE_WCHAR - const wchar_t* t_str() const { return wx_str(); } +#if wxUSE_WCHAR_T + const wxWCharBuffer wc_str(const wxMBConv& conv) const; +#endif // wxUSE_WCHAR_T +#ifdef __WXOSX__ + const wxCharBuffer fn_str() const { return wxConvFile.cWC2WX( wc_str( wxConvLocal ) ); } #else - const char* t_str() const { return wx_str(); } + const wxChar* fn_str() const { return c_str(); } #endif - +#endif // Unicode/ANSI // overloaded assignment // from another wxString - wxString& operator=(const wxString& stringSrc) - { - if ( this != &stringSrc ) - { - wxSTRING_INVALIDATE_CACHE(); - - m_impl = stringSrc.m_impl; - } - - return *this; - } - - wxString& operator=(const wxCStrData& cstr) - { return *this = cstr.AsString(); } + wxString& operator=(const wxStringBase& stringSrc) + { return (wxString&)wxStringBase::operator=(stringSrc); } // from a character - wxString& operator=(wxUniChar ch) - { - wxSTRING_INVALIDATE_CACHE(); - -#if wxUSE_UNICODE_UTF8 - if ( !ch.IsAscii() ) - m_impl = wxStringOperations::EncodeChar(ch); - else -#endif // wxUSE_UNICODE_UTF8 - m_impl = (wxStringCharType)ch; - return *this; - } - - wxString& operator=(wxUniCharRef ch) - { return operator=((wxUniChar)ch); } - wxString& operator=(char ch) - { return operator=(wxUniChar(ch)); } - wxString& operator=(unsigned char ch) - { return operator=(wxUniChar(ch)); } - wxString& operator=(wchar_t ch) - { return operator=(wxUniChar(ch)); } + wxString& operator=(wxChar ch) + { return (wxString&)wxStringBase::operator=(ch); } // from a C string - STL probably will crash on NULL, // so we need to compensate in that case -#if wxUSE_STL_BASED_WXSTRING - wxString& operator=(const char *psz) - { - wxSTRING_INVALIDATE_CACHE(); +#if wxUSE_STL + wxString& operator=(const wxChar *psz) + { if(psz) wxStringBase::operator=(psz); else Clear(); return *this; } +#else + wxString& operator=(const wxChar *psz) + { return (wxString&)wxStringBase::operator=(psz); } +#endif - if ( psz ) - m_impl = ImplStr(psz); - else - clear(); - - return *this; - } - - wxString& operator=(const wchar_t *pwz) - { - wxSTRING_INVALIDATE_CACHE(); - - if ( pwz ) - m_impl = ImplStr(pwz); - else - clear(); - - return *this; - } -#else // !wxUSE_STL_BASED_WXSTRING - wxString& operator=(const char *psz) - { - wxSTRING_INVALIDATE_CACHE(); - - m_impl = ImplStr(psz); - - return *this; - } - - wxString& operator=(const wchar_t *pwz) - { - wxSTRING_INVALIDATE_CACHE(); - - m_impl = ImplStr(pwz); - - return *this; - } -#endif // wxUSE_STL_BASED_WXSTRING/!wxUSE_STL_BASED_WXSTRING - - wxString& operator=(const unsigned char *psz) - { return operator=((const char*)psz); } - - // from wxScopedWCharBuffer - wxString& operator=(const wxScopedWCharBuffer& s) - { return assign(s); } - // from wxScopedCharBuffer - wxString& operator=(const wxScopedCharBuffer& s) - { return assign(s); } +#if wxUSE_UNICODE + // from wxWCharBuffer + wxString& operator=(const wxWCharBuffer& psz) + { (void) operator=((const wchar_t *)psz); return *this; } +#else // ANSI + // from another kind of C string + wxString& operator=(const unsigned char* psz); +#if wxUSE_WCHAR_T + // from a wide string + wxString& operator=(const wchar_t *pwz); +#endif + // from wxCharBuffer + wxString& operator=(const wxCharBuffer& psz) + { (void) operator=((const char *)psz); return *this; } +#endif // Unicode/ANSI // string concatenation // in place concatenation @@ -2024,8 +991,8 @@ public: // string += string wxString& operator<<(const wxString& s) { -#if WXWIN_COMPATIBILITY_2_8 && !wxUSE_STL_BASED_WXSTRING && !wxUSE_UNICODE_UTF8 - wxASSERT_MSG( s.IsValid(), +#if !wxUSE_STL + wxASSERT_MSG( s.GetStringData()->IsValid(), wxT("did you forget to call UngetWriteBuf()?") ); #endif @@ -2033,24 +1000,23 @@ public: return *this; } // string += C string - wxString& operator<<(const char *psz) + wxString& operator<<(const wxChar *psz) { append(psz); return *this; } - wxString& operator<<(const wchar_t *pwz) - { append(pwz); return *this; } - wxString& operator<<(const wxCStrData& psz) - { append(psz.AsString()); return *this; } // string += char - wxString& operator<<(wxUniChar ch) { append(1, ch); return *this; } - wxString& operator<<(wxUniCharRef ch) { append(1, ch); return *this; } - wxString& operator<<(char ch) { append(1, ch); return *this; } - wxString& operator<<(unsigned char ch) { append(1, ch); return *this; } - wxString& operator<<(wchar_t ch) { append(1, ch); return *this; } + wxString& operator<<(wxChar ch) { append(1, ch); return *this; } // string += buffer (i.e. from wxGetString) - wxString& operator<<(const wxScopedWCharBuffer& s) - { return append(s); } - wxString& operator<<(const wxScopedCharBuffer& s) - { return append(s); } +#if wxUSE_UNICODE + wxString& operator<<(const wxWCharBuffer& s) + { (void)operator<<((const wchar_t *)s); return *this; } + void operator+=(const wxWCharBuffer& s) + { (void)operator<<((const wchar_t *)s); } +#else // !wxUSE_UNICODE + wxString& operator<<(const wxCharBuffer& s) + { (void)operator<<((const char *)s); return *this; } + void operator+=(const wxCharBuffer& s) + { (void)operator<<((const char *)s); } +#endif // wxUSE_UNICODE/!wxUSE_UNICODE // string += C string wxString& Append(const wxString& s) @@ -2062,37 +1028,13 @@ public: append(s); return *this; } - wxString& Append(const char* psz) + wxString& Append(const wxChar* psz) { append(psz); return *this; } - wxString& Append(const wchar_t* pwz) - { append(pwz); return *this; } - wxString& Append(const wxCStrData& psz) - { append(psz); return *this; } - wxString& Append(const wxScopedCharBuffer& psz) - { append(psz); return *this; } - wxString& Append(const wxScopedWCharBuffer& psz) - { append(psz); return *this; } - wxString& Append(const char* psz, size_t nLen) - { append(psz, nLen); return *this; } - wxString& Append(const wchar_t* pwz, size_t nLen) - { append(pwz, nLen); return *this; } - wxString& Append(const wxCStrData& psz, size_t nLen) - { append(psz, nLen); return *this; } - wxString& Append(const wxScopedCharBuffer& psz, size_t nLen) - { append(psz, nLen); return *this; } - wxString& Append(const wxScopedWCharBuffer& psz, size_t nLen) - { append(psz, nLen); return *this; } // append count copies of given character - wxString& Append(wxUniChar ch, size_t count = 1u) - { append(count, ch); return *this; } - wxString& Append(wxUniCharRef ch, size_t count = 1u) - { append(count, ch); return *this; } - wxString& Append(char ch, size_t count = 1u) - { append(count, ch); return *this; } - wxString& Append(unsigned char ch, size_t count = 1u) - { append(count, ch); return *this; } - wxString& Append(wchar_t ch, size_t count = 1u) + wxString& Append(wxChar ch, size_t count = 1u) { append(count, ch); return *this; } + wxString& Append(const wxChar* psz, size_t nLen) + { append(psz, nLen); return *this; } // prepend a string, return the string itself wxString& Prepend(const wxString& str) @@ -2103,18 +1045,14 @@ public: friend wxString WXDLLIMPEXP_BASE operator+(const wxString& string1, const wxString& string2); // string with a single char - friend wxString WXDLLIMPEXP_BASE operator+(const wxString& string, wxUniChar ch); + friend wxString WXDLLIMPEXP_BASE operator+(const wxString& string, wxChar ch); // char with a string - friend wxString WXDLLIMPEXP_BASE operator+(wxUniChar ch, const wxString& string); + friend wxString WXDLLIMPEXP_BASE operator+(wxChar ch, const wxString& string); // string with C string friend wxString WXDLLIMPEXP_BASE operator+(const wxString& string, - const char *psz); - friend wxString WXDLLIMPEXP_BASE operator+(const wxString& string, - const wchar_t *pwz); + const wxChar *psz); // C string with string - friend wxString WXDLLIMPEXP_BASE operator+(const char *psz, - const wxString& string); - friend wxString WXDLLIMPEXP_BASE operator+(const wchar_t *pwz, + friend wxString WXDLLIMPEXP_BASE operator+(const wxChar *psz, const wxString& string); // stream-like functions @@ -2130,18 +1068,20 @@ public: // insert an unsigned long into string wxString& operator<<(unsigned long ul) { return (*this) << Format(wxT("%lu"), ul); } -#ifdef wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG +#if defined wxLongLong_t && !defined wxLongLongIsLong // insert a long long if they exist and aren't longs wxString& operator<<(wxLongLong_t ll) { - return (*this) << Format("%" wxLongLongFmtSpec "d", ll); + const wxChar *fmt = wxT("%") wxLongLongFmtSpec wxT("d"); + return (*this) << Format(fmt, ll); } // insert an unsigned long long wxString& operator<<(wxULongLong_t ull) { - return (*this) << Format("%" wxLongLongFmtSpec "u" , ull); + const wxChar *fmt = wxT("%") wxLongLongFmtSpec wxT("u"); + return (*this) << Format(fmt , ull); } -#endif // wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG +#endif // insert a float into string wxString& operator<<(float f) { return (*this) << Format(wxT("%f"), f); } @@ -2151,56 +1091,21 @@ public: // string comparison // case-sensitive comparison (returns a value < 0, = 0 or > 0) - int Cmp(const char *psz) const - { return compare(psz); } - int Cmp(const wchar_t *pwz) const - { return compare(pwz); } - int Cmp(const wxString& s) const - { return compare(s); } - int Cmp(const wxCStrData& s) const - { return compare(s); } - int Cmp(const wxScopedCharBuffer& s) const - { return compare(s); } - int Cmp(const wxScopedWCharBuffer& s) const - { return compare(s); } + int Cmp(const wxChar *psz) const; + int Cmp(const wxString& s) const; // same as Cmp() but not case-sensitive + int CmpNoCase(const wxChar *psz) const; int CmpNoCase(const wxString& s) const; - // test for the string equality, either considering case or not // (if compareWithCase then the case matters) - bool IsSameAs(const wxString& str, bool compareWithCase = true) const - { -#if !wxUSE_UNICODE_UTF8 - // in UTF-8 build, length() is O(n) and doing this would be _slower_ - if ( length() != str.length() ) - return false; -#endif - return (compareWithCase ? Cmp(str) : CmpNoCase(str)) == 0; - } - bool IsSameAs(const char *str, bool compareWithCase = true) const - { return (compareWithCase ? Cmp(str) : CmpNoCase(str)) == 0; } - bool IsSameAs(const wchar_t *str, bool compareWithCase = true) const - { return (compareWithCase ? Cmp(str) : CmpNoCase(str)) == 0; } - - bool IsSameAs(const wxCStrData& str, bool compareWithCase = true) const - { return IsSameAs(str.AsString(), compareWithCase); } - bool IsSameAs(const wxScopedCharBuffer& str, bool compareWithCase = true) const - { return IsSameAs(str.data(), compareWithCase); } - bool IsSameAs(const wxScopedWCharBuffer& str, bool compareWithCase = true) const - { return IsSameAs(str.data(), compareWithCase); } + bool IsSameAs(const wxChar *psz, bool compareWithCase = true) const + { return (compareWithCase ? Cmp(psz) : CmpNoCase(psz)) == 0; } // comparison with a single character: returns true if equal - bool IsSameAs(wxUniChar c, bool compareWithCase = true) const; - // FIXME-UTF8: remove these overloads - bool IsSameAs(wxUniCharRef c, bool compareWithCase = true) const - { return IsSameAs(wxUniChar(c), compareWithCase); } - bool IsSameAs(char c, bool compareWithCase = true) const - { return IsSameAs(wxUniChar(c), compareWithCase); } - bool IsSameAs(unsigned char c, bool compareWithCase = true) const - { return IsSameAs(wxUniChar(c), compareWithCase); } - bool IsSameAs(wchar_t c, bool compareWithCase = true) const - { return IsSameAs(wxUniChar(c), compareWithCase); } - bool IsSameAs(int c, bool compareWithCase = true) const - { return IsSameAs(wxUniChar(c), compareWithCase); } + bool IsSameAs(wxChar c, bool compareWithCase = true) const + { + return (length() == 1) && (compareWithCase ? GetChar(0u) == c + : wxToupper(GetChar(0u)) == wxToupper(c)); + } // simple sub-string extraction // return substring starting at nFirst of length nCount (or till the end @@ -2214,193 +1119,111 @@ public: // check if the string starts with the given prefix and return the rest // of the string in the provided pointer if it is not NULL; otherwise // return false - bool StartsWith(const wxString& prefix, wxString *rest = NULL) const; + bool StartsWith(const wxChar *prefix, wxString *rest = NULL) const; // check if the string ends with the given suffix and return the // beginning of the string before the suffix in the provided pointer if // it is not NULL; otherwise return false - bool EndsWith(const wxString& suffix, wxString *rest = NULL) const; + bool EndsWith(const wxChar *suffix, wxString *rest = NULL) const; // get first nCount characters wxString Left(size_t nCount) const; // get last nCount characters wxString Right(size_t nCount) const; - // get all characters before the first occurrence of ch - // (returns the whole string if ch not found) and also put everything - // following the first occurrence of ch into rest if it's non-NULL - wxString BeforeFirst(wxUniChar ch, wxString *rest = NULL) const; - // get all characters before the last occurrence of ch - // (returns empty string if ch not found) and also put everything - // following the last occurrence of ch into rest if it's non-NULL - wxString BeforeLast(wxUniChar ch, wxString *rest = NULL) const; - // get all characters after the first occurrence of ch - // (returns empty string if ch not found) - wxString AfterFirst(wxUniChar ch) const; - // get all characters after the last occurrence of ch + // get all characters before the first occurance of ch // (returns the whole string if ch not found) - wxString AfterLast(wxUniChar ch) const; + wxString BeforeFirst(wxChar ch) const; + // get all characters before the last occurence of ch + // (returns empty string if ch not found) + wxString BeforeLast(wxChar ch) const; + // get all characters after the first occurence of ch + // (returns empty string if ch not found) + wxString AfterFirst(wxChar ch) const; + // get all characters after the last occurence of ch + // (returns the whole string if ch not found) + wxString AfterLast(wxChar ch) const; // for compatibility only, use more explicitly named functions above - wxString Before(wxUniChar ch) const { return BeforeLast(ch); } - wxString After(wxUniChar ch) const { return AfterFirst(ch); } + wxString Before(wxChar ch) const { return BeforeLast(ch); } + wxString After(wxChar ch) const { return AfterFirst(ch); } // case conversion // convert to upper case in place, return the string itself wxString& MakeUpper(); // convert to upper case, return the copy of the string - wxString Upper() const { return wxString(*this).MakeUpper(); } + // Here's something to remember: BC++ doesn't like returns in inlines. + wxString Upper() const ; // convert to lower case in place, return the string itself wxString& MakeLower(); // convert to lower case, return the copy of the string - wxString Lower() const { return wxString(*this).MakeLower(); } - // convert the first character to the upper case and the rest to the - // lower one, return the modified string itself - wxString& MakeCapitalized(); - // convert the first character to the upper case and the rest to the - // lower one, return the copy of the string - wxString Capitalize() const { return wxString(*this).MakeCapitalized(); } + wxString Lower() const ; // trimming/padding whitespace (either side) and truncating // remove spaces from left or from right (default) side wxString& Trim(bool bFromRight = true); // add nCount copies chPad in the beginning or at the end (default) - wxString& Pad(size_t nCount, wxUniChar chPad = wxT(' '), bool bFromRight = true); + wxString& Pad(size_t nCount, wxChar chPad = wxT(' '), bool bFromRight = true); // searching and replacing // searching (return starting index, or -1 if not found) - int Find(wxUniChar ch, bool bFromEnd = false) const; // like strchr/strrchr - int Find(wxUniCharRef ch, bool bFromEnd = false) const - { return Find(wxUniChar(ch), bFromEnd); } - int Find(char ch, bool bFromEnd = false) const - { return Find(wxUniChar(ch), bFromEnd); } - int Find(unsigned char ch, bool bFromEnd = false) const - { return Find(wxUniChar(ch), bFromEnd); } - int Find(wchar_t ch, bool bFromEnd = false) const - { return Find(wxUniChar(ch), bFromEnd); } + int Find(wxChar ch, bool bFromEnd = false) const; // like strchr/strrchr // searching (return starting index, or -1 if not found) - int Find(const wxString& sub) const // like strstr - { - size_type idx = find(sub); - return (idx == npos) ? wxNOT_FOUND : (int)idx; - } - int Find(const char *sub) const // like strstr - { - size_type idx = find(sub); - return (idx == npos) ? wxNOT_FOUND : (int)idx; - } - int Find(const wchar_t *sub) const // like strstr - { - size_type idx = find(sub); - return (idx == npos) ? wxNOT_FOUND : (int)idx; - } - - int Find(const wxCStrData& sub) const - { return Find(sub.AsString()); } - int Find(const wxScopedCharBuffer& sub) const - { return Find(sub.data()); } - int Find(const wxScopedWCharBuffer& sub) const - { return Find(sub.data()); } - - // replace first (or all of bReplaceAll) occurrences of substring with + int Find(const wxChar *pszSub) const; // like strstr + // replace first (or all of bReplaceAll) occurences of substring with // another string, returns the number of replacements made - size_t Replace(const wxString& strOld, - const wxString& strNew, + size_t Replace(const wxChar *szOld, + const wxChar *szNew, bool bReplaceAll = true); // check if the string contents matches a mask containing '*' and '?' - bool Matches(const wxString& mask) const; + bool Matches(const wxChar *szMask) const; - // conversion to numbers: all functions return true only if the whole - // string is a number and put the value of this number into the pointer - // provided, the base is the numeric base in which the conversion should be - // done and must be comprised between 2 and 36 or be 0 in which case the - // standard C rules apply (leading '0' => octal, "0x" => hex) - // convert to a signed integer - bool ToLong(long *val, int base = 10) const; - // convert to an unsigned integer - bool ToULong(unsigned long *val, int base = 10) const; - // convert to wxLongLong + // conversion to numbers: all functions return true only if the whole + // string is a number and put the value of this number into the pointer + // provided, the base is the numeric base in which the conversion should be + // done and must be comprised between 2 and 36 or be 0 in which case the + // standard C rules apply (leading '0' => octal, "0x" => hex) + // convert to a signed integer + bool ToLong(long *val, int base = 10) const; + // convert to an unsigned integer + bool ToULong(unsigned long *val, int base = 10) const; + // convert to wxLongLong #if defined(wxLongLong_t) - bool ToLongLong(wxLongLong_t *val, int base = 10) const; - // convert to wxULongLong - bool ToULongLong(wxULongLong_t *val, int base = 10) const; + bool ToLongLong(wxLongLong_t *val, int base = 10) const; + // convert to wxULongLong + bool ToULongLong(wxULongLong_t *val, int base = 10) const; #endif // wxLongLong_t - // convert to a double - bool ToDouble(double *val) const; + // convert to a double + bool ToDouble(double *val) const; - // conversions to numbers using C locale - // convert to a signed integer - bool ToCLong(long *val, int base = 10) const; - // convert to an unsigned integer - bool ToCULong(unsigned long *val, int base = 10) const; - // convert to a double - bool ToCDouble(double *val) const; - // create a string representing the given floating point number with the - // default (like %g) or fixed (if precision >=0) precision - // in the current locale - static wxString FromDouble(double val, int precision = -1); - // in C locale - static wxString FromCDouble(double val, int precision = -1); -#ifndef wxNEEDS_WXSTRING_PRINTF_MIXIN // formatted input/output // as sprintf(), returns the number of characters written or < 0 on error // (take 'this' into account in attribute parameter count) - // int Printf(const wxString& format, ...); - WX_DEFINE_VARARG_FUNC(int, Printf, 1, (const wxFormatString&), - DoPrintfWchar, DoPrintfUtf8) -#ifdef __WATCOMC__ - // workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351 - WX_VARARG_WATCOM_WORKAROUND(int, Printf, 1, (const wxString&), - (wxFormatString(f1))); - WX_VARARG_WATCOM_WORKAROUND(int, Printf, 1, (const wxCStrData&), - (wxFormatString(f1))); - WX_VARARG_WATCOM_WORKAROUND(int, Printf, 1, (const char*), - (wxFormatString(f1))); - WX_VARARG_WATCOM_WORKAROUND(int, Printf, 1, (const wchar_t*), - (wxFormatString(f1))); -#endif -#endif // !wxNEEDS_WXSTRING_PRINTF_MIXIN + int Printf(const wxChar *pszFormat, ...) ATTRIBUTE_PRINTF_2; // as vprintf(), returns the number of characters written or < 0 on error - int PrintfV(const wxString& format, va_list argptr); + int PrintfV(const wxChar* pszFormat, va_list argptr); -#ifndef wxNEEDS_WXSTRING_PRINTF_MIXIN // returns the string containing the result of Printf() to it - // static wxString Format(const wxString& format, ...) WX_ATTRIBUTE_PRINTF_1; - WX_DEFINE_VARARG_FUNC(static wxString, Format, 1, (const wxFormatString&), - DoFormatWchar, DoFormatUtf8) -#ifdef __WATCOMC__ - // workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351 - WX_VARARG_WATCOM_WORKAROUND(static wxString, Format, 1, (const wxString&), - (wxFormatString(f1))); - WX_VARARG_WATCOM_WORKAROUND(static wxString, Format, 1, (const wxCStrData&), - (wxFormatString(f1))); - WX_VARARG_WATCOM_WORKAROUND(static wxString, Format, 1, (const char*), - (wxFormatString(f1))); - WX_VARARG_WATCOM_WORKAROUND(static wxString, Format, 1, (const wchar_t*), - (wxFormatString(f1))); -#endif -#endif + static wxString Format(const wxChar *pszFormat, ...) ATTRIBUTE_PRINTF_1; // the same as above, but takes a va_list - static wxString FormatV(const wxString& format, va_list argptr); + static wxString FormatV(const wxChar *pszFormat, va_list argptr); // raw access to string memory // ensure that string has space for at least nLen characters // only works if the data of this string is not shared - bool Alloc(size_t nLen) { reserve(nLen); return capacity() >= nLen; } + bool Alloc(size_t nLen) { reserve(nLen); /*return capacity() >= nLen;*/ return true; } // minimize the string's memory // only works if the data of this string is not shared bool Shrink(); -#if WXWIN_COMPATIBILITY_2_8 && !wxUSE_STL_BASED_WXSTRING && !wxUSE_UNICODE_UTF8 - // These are deprecated, use wxStringBuffer or wxStringBufferLength instead - // +#if !wxUSE_STL // get writable buffer of at least nLen bytes. Unget() *must* be called // a.s.a.p. to put string back in a reasonable state! - wxDEPRECATED( wxStringCharType *GetWriteBuf(size_t nLen) ); + wxChar *GetWriteBuf(size_t nLen); // call this immediately after GetWriteBuf() has been used - wxDEPRECATED( void UngetWriteBuf() ); - wxDEPRECATED( void UngetWriteBuf(size_t nLen) ); -#endif // WXWIN_COMPATIBILITY_2_8 && !wxUSE_STL_BASED_WXSTRING && wxUSE_UNICODE_UTF8 + void UngetWriteBuf(); + void UngetWriteBuf(size_t nLen); +#endif // wxWidgets version 1 compatibility functions @@ -2412,33 +1235,18 @@ public: // values for first parameter of Strip function enum stripType {leading = 0x1, trailing = 0x2, both = 0x3}; -#ifndef wxNEEDS_WXSTRING_PRINTF_MIXIN // use Printf() // (take 'this' into account in attribute parameter count) - // int sprintf(const wxString& format, ...) WX_ATTRIBUTE_PRINTF_2; - WX_DEFINE_VARARG_FUNC(int, sprintf, 1, (const wxFormatString&), - DoPrintfWchar, DoPrintfUtf8) -#ifdef __WATCOMC__ - // workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351 - WX_VARARG_WATCOM_WORKAROUND(int, sprintf, 1, (const wxString&), - (wxFormatString(f1))); - WX_VARARG_WATCOM_WORKAROUND(int, sprintf, 1, (const wxCStrData&), - (wxFormatString(f1))); - WX_VARARG_WATCOM_WORKAROUND(int, sprintf, 1, (const char*), - (wxFormatString(f1))); - WX_VARARG_WATCOM_WORKAROUND(int, sprintf, 1, (const wchar_t*), - (wxFormatString(f1))); -#endif -#endif // wxNEEDS_WXSTRING_PRINTF_MIXIN + int sprintf(const wxChar *pszFormat, ...) ATTRIBUTE_PRINTF_2; // use Cmp() - int CompareTo(const wxChar* psz, caseCompare cmp = exact) const + inline int CompareTo(const wxChar* psz, caseCompare cmp = exact) const { return cmp == exact ? Cmp(psz) : CmpNoCase(psz); } - // use length() + // use Len size_t Length() const { return length(); } // Count the number of characters - int Freq(wxUniChar ch) const; + int Freq(wxChar ch) const; // use MakeLower void LowerCase() { MakeLower(); } // use MakeUpper @@ -2448,7 +1256,7 @@ public: // use Find (more general variants not yet supported) size_t Index(const wxChar* psz) const { return Find(psz); } - size_t Index(wxUniChar ch) const { return Find(ch); } + size_t Index(wxChar ch) const { return Find(ch); } // use Truncate wxString& Remove(size_t pos) { return Truncate(pos); } wxString& RemoveLast(size_t n = 1) { return Truncate(length() - n); } @@ -2457,13 +1265,10 @@ public: { return (wxString&)erase( nStart, nLen ); } // use Find() - int First( wxUniChar ch ) const { return Find(ch); } - int First( wxUniCharRef ch ) const { return Find(ch); } - int First( char ch ) const { return Find(ch); } - int First( unsigned char ch ) const { return Find(ch); } - int First( wchar_t ch ) const { return Find(ch); } - int First( const wxString& str ) const { return Find(str); } - int Last( wxUniChar ch ) const { return Find(ch, true); } + int First( const wxChar ch ) const { return Find(ch); } + int First( const wxChar* psz ) const { return Find(psz); } + int First( const wxString &str ) const { return Find(str); } + int Last( const wxChar ch ) const { return Find(ch, true); } bool Contains(const wxString& str) const { return Find(str) != wxNOT_FOUND; } // use empty() @@ -2473,1899 +1278,376 @@ public: // take nLen chars starting at nPos wxString(const wxString& str, size_t nPos, size_t nLen) - { assign(str, nPos, nLen); } - // take all characters from first to last + : wxStringBase(str, nPos, nLen) { } + // take all characters from pStart to pEnd + wxString(const void *pStart, const void *pEnd) + : wxStringBase((const wxChar*)pStart, (const wxChar*)pEnd) { } +#if wxUSE_STL wxString(const_iterator first, const_iterator last) - : m_impl(first.impl(), last.impl()) { } -#if WXWIN_COMPATIBILITY_STRING_PTR_AS_ITER - // the 2 overloads below are for compatibility with the existing code using - // pointers instead of iterators - wxString(const char *first, const char *last) - { - SubstrBufFromMB str(ImplStr(first, last - first)); - m_impl.assign(str.data, str.len); - } - wxString(const wchar_t *first, const wchar_t *last) - { - SubstrBufFromWC str(ImplStr(first, last - first)); - m_impl.assign(str.data, str.len); - } - // and this one is needed to compile code adding offsets to c_str() result - wxString(const wxCStrData& first, const wxCStrData& last) - : m_impl(CreateConstIterator(first).impl(), - CreateConstIterator(last).impl()) - { - wxASSERT_MSG( first.m_str == last.m_str, - wxT("pointers must be into the same string") ); - } -#endif // WXWIN_COMPATIBILITY_STRING_PTR_AS_ITER + : wxStringBase(first, last) { } +#endif // lib.string.modifiers // append elements str[pos], ..., str[pos+n] wxString& append(const wxString& str, size_t pos, size_t n) - { - wxSTRING_UPDATE_CACHED_LENGTH(n); - - size_t from, len; - str.PosLenToImpl(pos, n, &from, &len); - m_impl.append(str.m_impl, from, len); - return *this; - } + { return (wxString&)wxStringBase::append(str, pos, n); } // append a string wxString& append(const wxString& str) - { - wxSTRING_UPDATE_CACHED_LENGTH(str.length()); - - m_impl.append(str.m_impl); - return *this; - } - + { return (wxString&)wxStringBase::append(str); } // append first n (or all if n == npos) characters of sz - wxString& append(const char *sz) - { - wxSTRING_INVALIDATE_CACHED_LENGTH(); - - m_impl.append(ImplStr(sz)); - return *this; - } - - wxString& append(const wchar_t *sz) - { - wxSTRING_INVALIDATE_CACHED_LENGTH(); - - m_impl.append(ImplStr(sz)); - return *this; - } - - wxString& append(const char *sz, size_t n) - { - wxSTRING_INVALIDATE_CACHED_LENGTH(); - - SubstrBufFromMB str(ImplStr(sz, n)); - m_impl.append(str.data, str.len); - return *this; - } - wxString& append(const wchar_t *sz, size_t n) - { - wxSTRING_UPDATE_CACHED_LENGTH(n); - - SubstrBufFromWC str(ImplStr(sz, n)); - m_impl.append(str.data, str.len); - return *this; - } - - wxString& append(const wxCStrData& str) - { return append(str.AsString()); } - wxString& append(const wxScopedCharBuffer& str) - { return append(str.data(), str.length()); } - wxString& append(const wxScopedWCharBuffer& str) - { return append(str.data(), str.length()); } - wxString& append(const wxCStrData& str, size_t n) - { return append(str.AsString(), 0, n); } - wxString& append(const wxScopedCharBuffer& str, size_t n) - { return append(str.data(), n); } - wxString& append(const wxScopedWCharBuffer& str, size_t n) - { return append(str.data(), n); } - + wxString& append(const wxChar *sz) + { return (wxString&)wxStringBase::append(sz); } + wxString& append(const wxChar *sz, size_t n) + { return (wxString&)wxStringBase::append(sz, n); } // append n copies of ch - wxString& append(size_t n, wxUniChar ch) - { -#if wxUSE_UNICODE_UTF8 - if ( !ch.IsAscii() ) - { - wxSTRING_INVALIDATE_CACHED_LENGTH(); - - m_impl.append(wxStringOperations::EncodeNChars(n, ch)); - } - else // ASCII -#endif - { - wxSTRING_UPDATE_CACHED_LENGTH(n); - - m_impl.append(n, (wxStringCharType)ch); - } - - return *this; - } - - wxString& append(size_t n, wxUniCharRef ch) - { return append(n, wxUniChar(ch)); } - wxString& append(size_t n, char ch) - { return append(n, wxUniChar(ch)); } - wxString& append(size_t n, unsigned char ch) - { return append(n, wxUniChar(ch)); } - wxString& append(size_t n, wchar_t ch) - { return append(n, wxUniChar(ch)); } - + wxString& append(size_t n, wxChar ch) + { return (wxString&)wxStringBase::append(n, ch); } // append from first to last wxString& append(const_iterator first, const_iterator last) - { - wxSTRING_INVALIDATE_CACHED_LENGTH(); - - m_impl.append(first.impl(), last.impl()); - return *this; - } -#if WXWIN_COMPATIBILITY_STRING_PTR_AS_ITER - wxString& append(const char *first, const char *last) - { return append(first, last - first); } - wxString& append(const wchar_t *first, const wchar_t *last) - { return append(first, last - first); } - wxString& append(const wxCStrData& first, const wxCStrData& last) - { return append(CreateConstIterator(first), CreateConstIterator(last)); } -#endif // WXWIN_COMPATIBILITY_STRING_PTR_AS_ITER + { return (wxString&)wxStringBase::append(first, last); } // same as `this_string = str' wxString& assign(const wxString& str) - { - wxSTRING_SET_CACHED_LENGTH(str.length()); - - m_impl = str.m_impl; - - return *this; - } - - // This is a non-standard-compliant overload taking the first "len" - // characters of the source string. - wxString& assign(const wxString& str, size_t len) - { -#if wxUSE_STRING_POS_CACHE - // It is legal to pass len > str.length() to wxStringImpl::assign() but - // by restricting it here we save some work for that function so it's not - // really less efficient and, at the same time, ensure that we don't - // cache invalid length. - const size_t lenSrc = str.length(); - if ( len > lenSrc ) - len = lenSrc; - - wxSTRING_SET_CACHED_LENGTH(len); -#endif // wxUSE_STRING_POS_CACHE - - m_impl.assign(str.m_impl, 0, str.LenToImpl(len)); - - return *this; - } - + { return (wxString&)wxStringBase::assign(str); } // same as ` = str[pos..pos + n] wxString& assign(const wxString& str, size_t pos, size_t n) - { - size_t from, len; - str.PosLenToImpl(pos, n, &from, &len); - m_impl.assign(str.m_impl, from, len); - - // it's important to call this after PosLenToImpl() above in case str is - // the same string as this one - wxSTRING_SET_CACHED_LENGTH(n); - - return *this; - } - + { return (wxString&)wxStringBase::assign(str, pos, n); } // same as `= first n (or all if n == npos) characters of sz' - wxString& assign(const char *sz) - { - wxSTRING_INVALIDATE_CACHE(); - - m_impl.assign(ImplStr(sz)); - - return *this; - } - - wxString& assign(const wchar_t *sz) - { - wxSTRING_INVALIDATE_CACHE(); - - m_impl.assign(ImplStr(sz)); - - return *this; - } - - wxString& assign(const char *sz, size_t n) - { - wxSTRING_INVALIDATE_CACHE(); - - SubstrBufFromMB str(ImplStr(sz, n)); - m_impl.assign(str.data, str.len); - - return *this; - } - - wxString& assign(const wchar_t *sz, size_t n) - { - wxSTRING_SET_CACHED_LENGTH(n); - - SubstrBufFromWC str(ImplStr(sz, n)); - m_impl.assign(str.data, str.len); - - return *this; - } - - wxString& assign(const wxCStrData& str) - { return assign(str.AsString()); } - wxString& assign(const wxScopedCharBuffer& str) - { return assign(str.data(), str.length()); } - wxString& assign(const wxScopedWCharBuffer& str) - { return assign(str.data(), str.length()); } - wxString& assign(const wxCStrData& str, size_t len) - { return assign(str.AsString(), len); } - wxString& assign(const wxScopedCharBuffer& str, size_t len) - { return assign(str.data(), len); } - wxString& assign(const wxScopedWCharBuffer& str, size_t len) - { return assign(str.data(), len); } - + wxString& assign(const wxChar *sz) + { return (wxString&)wxStringBase::assign(sz); } + wxString& assign(const wxChar *sz, size_t n) + { return (wxString&)wxStringBase::assign(sz, n); } // same as `= n copies of ch' - wxString& assign(size_t n, wxUniChar ch) - { - wxSTRING_SET_CACHED_LENGTH(n); - -#if wxUSE_UNICODE_UTF8 - if ( !ch.IsAscii() ) - m_impl.assign(wxStringOperations::EncodeNChars(n, ch)); - else -#endif - m_impl.assign(n, (wxStringCharType)ch); - - return *this; - } - - wxString& assign(size_t n, wxUniCharRef ch) - { return assign(n, wxUniChar(ch)); } - wxString& assign(size_t n, char ch) - { return assign(n, wxUniChar(ch)); } - wxString& assign(size_t n, unsigned char ch) - { return assign(n, wxUniChar(ch)); } - wxString& assign(size_t n, wchar_t ch) - { return assign(n, wxUniChar(ch)); } - + wxString& assign(size_t n, wxChar ch) + { return (wxString&)wxStringBase::assign(n, ch); } // assign from first to last wxString& assign(const_iterator first, const_iterator last) - { - wxSTRING_INVALIDATE_CACHE(); - - m_impl.assign(first.impl(), last.impl()); - - return *this; - } -#if WXWIN_COMPATIBILITY_STRING_PTR_AS_ITER - wxString& assign(const char *first, const char *last) - { return assign(first, last - first); } - wxString& assign(const wchar_t *first, const wchar_t *last) - { return assign(first, last - first); } - wxString& assign(const wxCStrData& first, const wxCStrData& last) - { return assign(CreateConstIterator(first), CreateConstIterator(last)); } -#endif // WXWIN_COMPATIBILITY_STRING_PTR_AS_ITER + { return (wxString&)wxStringBase::assign(first, last); } // string comparison - int compare(const wxString& str) const; - int compare(const char* sz) const; - int compare(const wchar_t* sz) const; - int compare(const wxCStrData& str) const - { return compare(str.AsString()); } - int compare(const wxScopedCharBuffer& str) const - { return compare(str.data()); } - int compare(const wxScopedWCharBuffer& str) const - { return compare(str.data()); } +#if !defined(HAVE_STD_STRING_COMPARE) + int compare(const wxStringBase& str) const; // comparison with a substring - int compare(size_t nStart, size_t nLen, const wxString& str) const; + int compare(size_t nStart, size_t nLen, const wxStringBase& str) const; // comparison of 2 substrings int compare(size_t nStart, size_t nLen, - const wxString& str, size_t nStart2, size_t nLen2) const; + const wxStringBase& str, size_t nStart2, size_t nLen2) const; + // just like strcmp() + int compare(const wxChar* sz) const; // substring comparison with first nCount characters of sz int compare(size_t nStart, size_t nLen, - const char* sz, size_t nCount = npos) const; - int compare(size_t nStart, size_t nLen, - const wchar_t* sz, size_t nCount = npos) const; + const wxChar* sz, size_t nCount = npos) const; +#endif // !defined HAVE_STD_STRING_COMPARE // insert another string wxString& insert(size_t nPos, const wxString& str) - { insert(GetIterForNthChar(nPos), str.begin(), str.end()); return *this; } + { return (wxString&)wxStringBase::insert(nPos, str); } // insert n chars of str starting at nStart (in str) wxString& insert(size_t nPos, const wxString& str, size_t nStart, size_t n) - { - wxSTRING_UPDATE_CACHED_LENGTH(n); - - size_t from, len; - str.PosLenToImpl(nStart, n, &from, &len); - m_impl.insert(PosToImpl(nPos), str.m_impl, from, len); - - return *this; - } - + { return (wxString&)wxStringBase::insert(nPos, str, nStart, n); } // insert first n (or all if n == npos) characters of sz - wxString& insert(size_t nPos, const char *sz) - { - wxSTRING_INVALIDATE_CACHE(); - - m_impl.insert(PosToImpl(nPos), ImplStr(sz)); - - return *this; - } - - wxString& insert(size_t nPos, const wchar_t *sz) - { - wxSTRING_INVALIDATE_CACHE(); - - m_impl.insert(PosToImpl(nPos), ImplStr(sz)); return *this; - } - - wxString& insert(size_t nPos, const char *sz, size_t n) - { - wxSTRING_UPDATE_CACHED_LENGTH(n); - - SubstrBufFromMB str(ImplStr(sz, n)); - m_impl.insert(PosToImpl(nPos), str.data, str.len); - - return *this; - } - - wxString& insert(size_t nPos, const wchar_t *sz, size_t n) - { - wxSTRING_UPDATE_CACHED_LENGTH(n); - - SubstrBufFromWC str(ImplStr(sz, n)); - m_impl.insert(PosToImpl(nPos), str.data, str.len); - - return *this; - } - + wxString& insert(size_t nPos, const wxChar *sz) + { return (wxString&)wxStringBase::insert(nPos, sz); } + wxString& insert(size_t nPos, const wxChar *sz, size_t n) + { return (wxString&)wxStringBase::insert(nPos, sz, n); } // insert n copies of ch - wxString& insert(size_t nPos, size_t n, wxUniChar ch) - { - wxSTRING_UPDATE_CACHED_LENGTH(n); - -#if wxUSE_UNICODE_UTF8 - if ( !ch.IsAscii() ) - m_impl.insert(PosToImpl(nPos), wxStringOperations::EncodeNChars(n, ch)); - else -#endif - m_impl.insert(PosToImpl(nPos), n, (wxStringCharType)ch); - return *this; - } - - iterator insert(iterator it, wxUniChar ch) - { - wxSTRING_UPDATE_CACHED_LENGTH(1); - -#if wxUSE_UNICODE_UTF8 - if ( !ch.IsAscii() ) - { - size_t pos = IterToImplPos(it); - m_impl.insert(pos, wxStringOperations::EncodeChar(ch)); - return iterator(this, m_impl.begin() + pos); - } - else -#endif - return iterator(this, m_impl.insert(it.impl(), (wxStringCharType)ch)); - } - + wxString& insert(size_t nPos, size_t n, wxChar ch) + { return (wxString&)wxStringBase::insert(nPos, n, ch); } + iterator insert(iterator it, wxChar ch) + { return wxStringBase::insert(it, ch); } void insert(iterator it, const_iterator first, const_iterator last) - { - wxSTRING_INVALIDATE_CACHE(); - - m_impl.insert(it.impl(), first.impl(), last.impl()); - } - -#if WXWIN_COMPATIBILITY_STRING_PTR_AS_ITER - void insert(iterator it, const char *first, const char *last) - { insert(it - begin(), first, last - first); } - void insert(iterator it, const wchar_t *first, const wchar_t *last) - { insert(it - begin(), first, last - first); } - void insert(iterator it, const wxCStrData& first, const wxCStrData& last) - { insert(it, CreateConstIterator(first), CreateConstIterator(last)); } -#endif // WXWIN_COMPATIBILITY_STRING_PTR_AS_ITER - - void insert(iterator it, size_type n, wxUniChar ch) - { - wxSTRING_UPDATE_CACHED_LENGTH(n); - -#if wxUSE_UNICODE_UTF8 - if ( !ch.IsAscii() ) - m_impl.insert(IterToImplPos(it), wxStringOperations::EncodeNChars(n, ch)); - else -#endif - m_impl.insert(it.impl(), n, (wxStringCharType)ch); - } + { wxStringBase::insert(it, first, last); } + void insert(iterator it, size_type n, wxChar ch) + { wxStringBase::insert(it, n, ch); } // delete characters from nStart to nStart + nLen wxString& erase(size_type pos = 0, size_type n = npos) - { - wxSTRING_INVALIDATE_CACHE(); - - size_t from, len; - PosLenToImpl(pos, n, &from, &len); - m_impl.erase(from, len); - - return *this; - } - - // delete characters from first up to last + { return (wxString&)wxStringBase::erase(pos, n); } iterator erase(iterator first, iterator last) - { - wxSTRING_INVALIDATE_CACHE(); - - return iterator(this, m_impl.erase(first.impl(), last.impl())); - } - + { return wxStringBase::erase(first, last); } iterator erase(iterator first) - { - wxSTRING_UPDATE_CACHED_LENGTH(-1); - - return iterator(this, m_impl.erase(first.impl())); - } + { return wxStringBase::erase(first); } #ifdef wxSTRING_BASE_HASNT_CLEAR void clear() { erase(); } -#else - void clear() - { - wxSTRING_SET_CACHED_LENGTH(0); - - m_impl.clear(); - } #endif // replaces the substring of length nLen starting at nStart - wxString& replace(size_t nStart, size_t nLen, const char* sz) - { - wxSTRING_INVALIDATE_CACHE(); - - size_t from, len; - PosLenToImpl(nStart, nLen, &from, &len); - m_impl.replace(from, len, ImplStr(sz)); - - return *this; - } - - wxString& replace(size_t nStart, size_t nLen, const wchar_t* sz) - { - wxSTRING_INVALIDATE_CACHE(); - - size_t from, len; - PosLenToImpl(nStart, nLen, &from, &len); - m_impl.replace(from, len, ImplStr(sz)); - - return *this; - } - + wxString& replace(size_t nStart, size_t nLen, const wxChar* sz) + { return (wxString&)wxStringBase::replace(nStart, nLen, sz); } // replaces the substring of length nLen starting at nStart wxString& replace(size_t nStart, size_t nLen, const wxString& str) - { - wxSTRING_INVALIDATE_CACHE(); - - size_t from, len; - PosLenToImpl(nStart, nLen, &from, &len); - m_impl.replace(from, len, str.m_impl); - - return *this; - } - + { return (wxString&)wxStringBase::replace(nStart, nLen, str); } // replaces the substring with nCount copies of ch - wxString& replace(size_t nStart, size_t nLen, size_t nCount, wxUniChar ch) - { - wxSTRING_INVALIDATE_CACHE(); - - size_t from, len; - PosLenToImpl(nStart, nLen, &from, &len); -#if wxUSE_UNICODE_UTF8 - if ( !ch.IsAscii() ) - m_impl.replace(from, len, wxStringOperations::EncodeNChars(nCount, ch)); - else -#endif - m_impl.replace(from, len, nCount, (wxStringCharType)ch); - - return *this; - } - + wxString& replace(size_t nStart, size_t nLen, size_t nCount, wxChar ch) + { return (wxString&)wxStringBase::replace(nStart, nLen, nCount, ch); } // replaces a substring with another substring wxString& replace(size_t nStart, size_t nLen, const wxString& str, size_t nStart2, size_t nLen2) - { - wxSTRING_INVALIDATE_CACHE(); - - size_t from, len; - PosLenToImpl(nStart, nLen, &from, &len); - - size_t from2, len2; - str.PosLenToImpl(nStart2, nLen2, &from2, &len2); - - m_impl.replace(from, len, str.m_impl, from2, len2); - - return *this; - } - + { return (wxString&)wxStringBase::replace(nStart, nLen, str, + nStart2, nLen2); } // replaces the substring with first nCount chars of sz wxString& replace(size_t nStart, size_t nLen, - const char* sz, size_t nCount) - { - wxSTRING_INVALIDATE_CACHE(); - - size_t from, len; - PosLenToImpl(nStart, nLen, &from, &len); - - SubstrBufFromMB str(ImplStr(sz, nCount)); - - m_impl.replace(from, len, str.data, str.len); - - return *this; - } - - wxString& replace(size_t nStart, size_t nLen, - const wchar_t* sz, size_t nCount) - { - wxSTRING_INVALIDATE_CACHE(); - - size_t from, len; - PosLenToImpl(nStart, nLen, &from, &len); - - SubstrBufFromWC str(ImplStr(sz, nCount)); - - m_impl.replace(from, len, str.data, str.len); - - return *this; - } - - wxString& replace(size_t nStart, size_t nLen, - const wxString& s, size_t nCount) - { - wxSTRING_INVALIDATE_CACHE(); - - size_t from, len; - PosLenToImpl(nStart, nLen, &from, &len); - m_impl.replace(from, len, s.m_impl.c_str(), s.LenToImpl(nCount)); - - return *this; - } - - wxString& replace(iterator first, iterator last, const char* s) - { - wxSTRING_INVALIDATE_CACHE(); - - m_impl.replace(first.impl(), last.impl(), ImplStr(s)); - - return *this; - } - - wxString& replace(iterator first, iterator last, const wchar_t* s) - { - wxSTRING_INVALIDATE_CACHE(); - - m_impl.replace(first.impl(), last.impl(), ImplStr(s)); - - return *this; - } - - wxString& replace(iterator first, iterator last, const char* s, size_type n) - { - wxSTRING_INVALIDATE_CACHE(); - - SubstrBufFromMB str(ImplStr(s, n)); - m_impl.replace(first.impl(), last.impl(), str.data, str.len); - - return *this; - } - - wxString& replace(iterator first, iterator last, const wchar_t* s, size_type n) - { - wxSTRING_INVALIDATE_CACHE(); - - SubstrBufFromWC str(ImplStr(s, n)); - m_impl.replace(first.impl(), last.impl(), str.data, str.len); - - return *this; - } - + const wxChar* sz, size_t nCount) + { return (wxString&)wxStringBase::replace(nStart, nLen, sz, nCount); } + wxString& replace(iterator first, iterator last, const_pointer s) + { return (wxString&)wxStringBase::replace(first, last, s); } + wxString& replace(iterator first, iterator last, const_pointer s, + size_type n) + { return (wxString&)wxStringBase::replace(first, last, s, n); } wxString& replace(iterator first, iterator last, const wxString& s) - { - wxSTRING_INVALIDATE_CACHE(); - - m_impl.replace(first.impl(), last.impl(), s.m_impl); - - return *this; - } - - wxString& replace(iterator first, iterator last, size_type n, wxUniChar ch) - { - wxSTRING_INVALIDATE_CACHE(); - -#if wxUSE_UNICODE_UTF8 - if ( !ch.IsAscii() ) - m_impl.replace(first.impl(), last.impl(), - wxStringOperations::EncodeNChars(n, ch)); - else -#endif - m_impl.replace(first.impl(), last.impl(), n, (wxStringCharType)ch); - - return *this; - } - + { return (wxString&)wxStringBase::replace(first, last, s); } + wxString& replace(iterator first, iterator last, size_type n, wxChar c) + { return (wxString&)wxStringBase::replace(first, last, n, c); } wxString& replace(iterator first, iterator last, const_iterator first1, const_iterator last1) - { - wxSTRING_INVALIDATE_CACHE(); - - m_impl.replace(first.impl(), last.impl(), first1.impl(), last1.impl()); - - return *this; - } - - wxString& replace(iterator first, iterator last, - const char *first1, const char *last1) - { replace(first, last, first1, last1 - first1); return *this; } - wxString& replace(iterator first, iterator last, - const wchar_t *first1, const wchar_t *last1) - { replace(first, last, first1, last1 - first1); return *this; } - - // swap two strings - void swap(wxString& str) - { -#if wxUSE_STRING_POS_CACHE - // we modify not only this string but also the other one directly so we - // need to invalidate cache for both of them (we could also try to - // exchange their cache entries but it seems unlikely to be worth it) - InvalidateCache(); - str.InvalidateCache(); -#endif // wxUSE_STRING_POS_CACHE - - m_impl.swap(str.m_impl); - } - - // find a substring - size_t find(const wxString& str, size_t nStart = 0) const - { return PosFromImpl(m_impl.find(str.m_impl, PosToImpl(nStart))); } - - // find first n characters of sz - size_t find(const char* sz, size_t nStart = 0, size_t n = npos) const - { - SubstrBufFromMB str(ImplStr(sz, n)); - return PosFromImpl(m_impl.find(str.data, PosToImpl(nStart), str.len)); - } - size_t find(const wchar_t* sz, size_t nStart = 0, size_t n = npos) const - { - SubstrBufFromWC str(ImplStr(sz, n)); - return PosFromImpl(m_impl.find(str.data, PosToImpl(nStart), str.len)); - } - size_t find(const wxScopedCharBuffer& s, size_t nStart = 0, size_t n = npos) const - { return find(s.data(), nStart, n); } - size_t find(const wxScopedWCharBuffer& s, size_t nStart = 0, size_t n = npos) const - { return find(s.data(), nStart, n); } - size_t find(const wxCStrData& s, size_t nStart = 0, size_t n = npos) const - { return find(s.AsWChar(), nStart, n); } - - // find the first occurrence of character ch after nStart - size_t find(wxUniChar ch, size_t nStart = 0) const - { -#if wxUSE_UNICODE_UTF8 - if ( !ch.IsAscii() ) - return PosFromImpl(m_impl.find(wxStringOperations::EncodeChar(ch), - PosToImpl(nStart))); - else -#endif - return PosFromImpl(m_impl.find((wxStringCharType)ch, - PosToImpl(nStart))); - - } - size_t find(wxUniCharRef ch, size_t nStart = 0) const - { return find(wxUniChar(ch), nStart); } - size_t find(char ch, size_t nStart = 0) const - { return find(wxUniChar(ch), nStart); } - size_t find(unsigned char ch, size_t nStart = 0) const - { return find(wxUniChar(ch), nStart); } - size_t find(wchar_t ch, size_t nStart = 0) const - { return find(wxUniChar(ch), nStart); } - - // rfind() family is exactly like find() but works right to left - - // as find, but from the end - size_t rfind(const wxString& str, size_t nStart = npos) const - { return PosFromImpl(m_impl.rfind(str.m_impl, PosToImpl(nStart))); } - - // as find, but from the end - size_t rfind(const char* sz, size_t nStart = npos, size_t n = npos) const - { - SubstrBufFromMB str(ImplStr(sz, n)); - return PosFromImpl(m_impl.rfind(str.data, PosToImpl(nStart), str.len)); - } - size_t rfind(const wchar_t* sz, size_t nStart = npos, size_t n = npos) const - { - SubstrBufFromWC str(ImplStr(sz, n)); - return PosFromImpl(m_impl.rfind(str.data, PosToImpl(nStart), str.len)); - } - size_t rfind(const wxScopedCharBuffer& s, size_t nStart = npos, size_t n = npos) const - { return rfind(s.data(), nStart, n); } - size_t rfind(const wxScopedWCharBuffer& s, size_t nStart = npos, size_t n = npos) const - { return rfind(s.data(), nStart, n); } - size_t rfind(const wxCStrData& s, size_t nStart = npos, size_t n = npos) const - { return rfind(s.AsWChar(), nStart, n); } - // as find, but from the end - size_t rfind(wxUniChar ch, size_t nStart = npos) const - { -#if wxUSE_UNICODE_UTF8 - if ( !ch.IsAscii() ) - return PosFromImpl(m_impl.rfind(wxStringOperations::EncodeChar(ch), - PosToImpl(nStart))); - else -#endif - return PosFromImpl(m_impl.rfind((wxStringCharType)ch, - PosToImpl(nStart))); - } - size_t rfind(wxUniCharRef ch, size_t nStart = npos) const - { return rfind(wxUniChar(ch), nStart); } - size_t rfind(char ch, size_t nStart = npos) const - { return rfind(wxUniChar(ch), nStart); } - size_t rfind(unsigned char ch, size_t nStart = npos) const - { return rfind(wxUniChar(ch), nStart); } - size_t rfind(wchar_t ch, size_t nStart = npos) const - { return rfind(wxUniChar(ch), nStart); } - - // find first/last occurrence of any character (not) in the set: -#if wxUSE_STL_BASED_WXSTRING && !wxUSE_UNICODE_UTF8 - // FIXME-UTF8: this is not entirely correct, because it doesn't work if - // sizeof(wchar_t)==2 and surrogates are present in the string; - // should we care? Probably not. - size_t find_first_of(const wxString& str, size_t nStart = 0) const - { return m_impl.find_first_of(str.m_impl, nStart); } - size_t find_first_of(const char* sz, size_t nStart = 0) const - { return m_impl.find_first_of(ImplStr(sz), nStart); } - size_t find_first_of(const wchar_t* sz, size_t nStart = 0) const - { return m_impl.find_first_of(ImplStr(sz), nStart); } - size_t find_first_of(const char* sz, size_t nStart, size_t n) const - { return m_impl.find_first_of(ImplStr(sz), nStart, n); } - size_t find_first_of(const wchar_t* sz, size_t nStart, size_t n) const - { return m_impl.find_first_of(ImplStr(sz), nStart, n); } - size_t find_first_of(wxUniChar c, size_t nStart = 0) const - { return m_impl.find_first_of((wxChar)c, nStart); } - - size_t find_last_of(const wxString& str, size_t nStart = npos) const - { return m_impl.find_last_of(str.m_impl, nStart); } - size_t find_last_of(const char* sz, size_t nStart = npos) const - { return m_impl.find_last_of(ImplStr(sz), nStart); } - size_t find_last_of(const wchar_t* sz, size_t nStart = npos) const - { return m_impl.find_last_of(ImplStr(sz), nStart); } - size_t find_last_of(const char* sz, size_t nStart, size_t n) const - { return m_impl.find_last_of(ImplStr(sz), nStart, n); } - size_t find_last_of(const wchar_t* sz, size_t nStart, size_t n) const - { return m_impl.find_last_of(ImplStr(sz), nStart, n); } - size_t find_last_of(wxUniChar c, size_t nStart = npos) const - { return m_impl.find_last_of((wxChar)c, nStart); } - - size_t find_first_not_of(const wxString& str, size_t nStart = 0) const - { return m_impl.find_first_not_of(str.m_impl, nStart); } - size_t find_first_not_of(const char* sz, size_t nStart = 0) const - { return m_impl.find_first_not_of(ImplStr(sz), nStart); } - size_t find_first_not_of(const wchar_t* sz, size_t nStart = 0) const - { return m_impl.find_first_not_of(ImplStr(sz), nStart); } - size_t find_first_not_of(const char* sz, size_t nStart, size_t n) const - { return m_impl.find_first_not_of(ImplStr(sz), nStart, n); } - size_t find_first_not_of(const wchar_t* sz, size_t nStart, size_t n) const - { return m_impl.find_first_not_of(ImplStr(sz), nStart, n); } - size_t find_first_not_of(wxUniChar c, size_t nStart = 0) const - { return m_impl.find_first_not_of((wxChar)c, nStart); } - - size_t find_last_not_of(const wxString& str, size_t nStart = npos) const - { return m_impl.find_last_not_of(str.m_impl, nStart); } - size_t find_last_not_of(const char* sz, size_t nStart = npos) const - { return m_impl.find_last_not_of(ImplStr(sz), nStart); } - size_t find_last_not_of(const wchar_t* sz, size_t nStart = npos) const - { return m_impl.find_last_not_of(ImplStr(sz), nStart); } - size_t find_last_not_of(const char* sz, size_t nStart, size_t n) const - { return m_impl.find_last_not_of(ImplStr(sz), nStart, n); } - size_t find_last_not_of(const wchar_t* sz, size_t nStart, size_t n) const - { return m_impl.find_last_not_of(ImplStr(sz), nStart, n); } - size_t find_last_not_of(wxUniChar c, size_t nStart = npos) const - { return m_impl.find_last_not_of((wxChar)c, nStart); } -#else - // we can't use std::string implementation in UTF-8 build, because the - // character sets would be interpreted wrongly: - - // as strpbrk() but starts at nStart, returns npos if not found - size_t find_first_of(const wxString& str, size_t nStart = 0) const -#if wxUSE_UNICODE // FIXME-UTF8: temporary - { return find_first_of(str.wc_str(), nStart); } -#else - { return find_first_of(str.mb_str(), nStart); } -#endif - // same as above - size_t find_first_of(const char* sz, size_t nStart = 0) const; - size_t find_first_of(const wchar_t* sz, size_t nStart = 0) const; - size_t find_first_of(const char* sz, size_t nStart, size_t n) const; - size_t find_first_of(const wchar_t* sz, size_t nStart, size_t n) const; - // same as find(char, size_t) - size_t find_first_of(wxUniChar c, size_t nStart = 0) const - { return find(c, nStart); } - // find the last (starting from nStart) char from str in this string - size_t find_last_of (const wxString& str, size_t nStart = npos) const -#if wxUSE_UNICODE // FIXME-UTF8: temporary - { return find_last_of(str.wc_str(), nStart); } -#else - { return find_last_of(str.mb_str(), nStart); } -#endif - // same as above - size_t find_last_of (const char* sz, size_t nStart = npos) const; - size_t find_last_of (const wchar_t* sz, size_t nStart = npos) const; - size_t find_last_of(const char* sz, size_t nStart, size_t n) const; - size_t find_last_of(const wchar_t* sz, size_t nStart, size_t n) const; - // same as above - size_t find_last_of(wxUniChar c, size_t nStart = npos) const - { return rfind(c, nStart); } - - // find first/last occurrence of any character not in the set - - // as strspn() (starting from nStart), returns npos on failure - size_t find_first_not_of(const wxString& str, size_t nStart = 0) const -#if wxUSE_UNICODE // FIXME-UTF8: temporary - { return find_first_not_of(str.wc_str(), nStart); } -#else - { return find_first_not_of(str.mb_str(), nStart); } -#endif - // same as above - size_t find_first_not_of(const char* sz, size_t nStart = 0) const; - size_t find_first_not_of(const wchar_t* sz, size_t nStart = 0) const; - size_t find_first_not_of(const char* sz, size_t nStart, size_t n) const; - size_t find_first_not_of(const wchar_t* sz, size_t nStart, size_t n) const; - // same as above - size_t find_first_not_of(wxUniChar ch, size_t nStart = 0) const; - // as strcspn() - size_t find_last_not_of(const wxString& str, size_t nStart = npos) const -#if wxUSE_UNICODE // FIXME-UTF8: temporary - { return find_last_not_of(str.wc_str(), nStart); } -#else - { return find_last_not_of(str.mb_str(), nStart); } -#endif - // same as above - size_t find_last_not_of(const char* sz, size_t nStart = npos) const; - size_t find_last_not_of(const wchar_t* sz, size_t nStart = npos) const; - size_t find_last_not_of(const char* sz, size_t nStart, size_t n) const; - size_t find_last_not_of(const wchar_t* sz, size_t nStart, size_t n) const; - // same as above - size_t find_last_not_of(wxUniChar ch, size_t nStart = npos) const; -#endif // wxUSE_STL_BASED_WXSTRING && !wxUSE_UNICODE_UTF8 or not - - // provide char/wchar_t/wxUniCharRef overloads for char-finding functions - // above to resolve ambiguities: - size_t find_first_of(wxUniCharRef ch, size_t nStart = 0) const - { return find_first_of(wxUniChar(ch), nStart); } - size_t find_first_of(char ch, size_t nStart = 0) const - { return find_first_of(wxUniChar(ch), nStart); } - size_t find_first_of(unsigned char ch, size_t nStart = 0) const - { return find_first_of(wxUniChar(ch), nStart); } - size_t find_first_of(wchar_t ch, size_t nStart = 0) const - { return find_first_of(wxUniChar(ch), nStart); } - size_t find_last_of(wxUniCharRef ch, size_t nStart = npos) const - { return find_last_of(wxUniChar(ch), nStart); } - size_t find_last_of(char ch, size_t nStart = npos) const - { return find_last_of(wxUniChar(ch), nStart); } - size_t find_last_of(unsigned char ch, size_t nStart = npos) const - { return find_last_of(wxUniChar(ch), nStart); } - size_t find_last_of(wchar_t ch, size_t nStart = npos) const - { return find_last_of(wxUniChar(ch), nStart); } - size_t find_first_not_of(wxUniCharRef ch, size_t nStart = 0) const - { return find_first_not_of(wxUniChar(ch), nStart); } - size_t find_first_not_of(char ch, size_t nStart = 0) const - { return find_first_not_of(wxUniChar(ch), nStart); } - size_t find_first_not_of(unsigned char ch, size_t nStart = 0) const - { return find_first_not_of(wxUniChar(ch), nStart); } - size_t find_first_not_of(wchar_t ch, size_t nStart = 0) const - { return find_first_not_of(wxUniChar(ch), nStart); } - size_t find_last_not_of(wxUniCharRef ch, size_t nStart = npos) const - { return find_last_not_of(wxUniChar(ch), nStart); } - size_t find_last_not_of(char ch, size_t nStart = npos) const - { return find_last_not_of(wxUniChar(ch), nStart); } - size_t find_last_not_of(unsigned char ch, size_t nStart = npos) const - { return find_last_not_of(wxUniChar(ch), nStart); } - size_t find_last_not_of(wchar_t ch, size_t nStart = npos) const - { return find_last_not_of(wxUniChar(ch), nStart); } - - // and additional overloads for the versions taking strings: - size_t find_first_of(const wxCStrData& sz, size_t nStart = 0) const - { return find_first_of(sz.AsString(), nStart); } - size_t find_first_of(const wxScopedCharBuffer& sz, size_t nStart = 0) const - { return find_first_of(sz.data(), nStart); } - size_t find_first_of(const wxScopedWCharBuffer& sz, size_t nStart = 0) const - { return find_first_of(sz.data(), nStart); } - size_t find_first_of(const wxCStrData& sz, size_t nStart, size_t n) const - { return find_first_of(sz.AsWChar(), nStart, n); } - size_t find_first_of(const wxScopedCharBuffer& sz, size_t nStart, size_t n) const - { return find_first_of(sz.data(), nStart, n); } - size_t find_first_of(const wxScopedWCharBuffer& sz, size_t nStart, size_t n) const - { return find_first_of(sz.data(), nStart, n); } - - size_t find_last_of(const wxCStrData& sz, size_t nStart = 0) const - { return find_last_of(sz.AsString(), nStart); } - size_t find_last_of(const wxScopedCharBuffer& sz, size_t nStart = 0) const - { return find_last_of(sz.data(), nStart); } - size_t find_last_of(const wxScopedWCharBuffer& sz, size_t nStart = 0) const - { return find_last_of(sz.data(), nStart); } - size_t find_last_of(const wxCStrData& sz, size_t nStart, size_t n) const - { return find_last_of(sz.AsWChar(), nStart, n); } - size_t find_last_of(const wxScopedCharBuffer& sz, size_t nStart, size_t n) const - { return find_last_of(sz.data(), nStart, n); } - size_t find_last_of(const wxScopedWCharBuffer& sz, size_t nStart, size_t n) const - { return find_last_of(sz.data(), nStart, n); } - - size_t find_first_not_of(const wxCStrData& sz, size_t nStart = 0) const - { return find_first_not_of(sz.AsString(), nStart); } - size_t find_first_not_of(const wxScopedCharBuffer& sz, size_t nStart = 0) const - { return find_first_not_of(sz.data(), nStart); } - size_t find_first_not_of(const wxScopedWCharBuffer& sz, size_t nStart = 0) const - { return find_first_not_of(sz.data(), nStart); } - size_t find_first_not_of(const wxCStrData& sz, size_t nStart, size_t n) const - { return find_first_not_of(sz.AsWChar(), nStart, n); } - size_t find_first_not_of(const wxScopedCharBuffer& sz, size_t nStart, size_t n) const - { return find_first_not_of(sz.data(), nStart, n); } - size_t find_first_not_of(const wxScopedWCharBuffer& sz, size_t nStart, size_t n) const - { return find_first_not_of(sz.data(), nStart, n); } - - size_t find_last_not_of(const wxCStrData& sz, size_t nStart = 0) const - { return find_last_not_of(sz.AsString(), nStart); } - size_t find_last_not_of(const wxScopedCharBuffer& sz, size_t nStart = 0) const - { return find_last_not_of(sz.data(), nStart); } - size_t find_last_not_of(const wxScopedWCharBuffer& sz, size_t nStart = 0) const - { return find_last_not_of(sz.data(), nStart); } - size_t find_last_not_of(const wxCStrData& sz, size_t nStart, size_t n) const - { return find_last_not_of(sz.AsWChar(), nStart, n); } - size_t find_last_not_of(const wxScopedCharBuffer& sz, size_t nStart, size_t n) const - { return find_last_not_of(sz.data(), nStart, n); } - size_t find_last_not_of(const wxScopedWCharBuffer& sz, size_t nStart, size_t n) const - { return find_last_not_of(sz.data(), nStart, n); } + { return (wxString&)wxStringBase::replace(first, last, first1, last1); } // string += string wxString& operator+=(const wxString& s) - { - wxSTRING_INVALIDATE_CACHED_LENGTH(); - - m_impl += s.m_impl; - return *this; - } + { return (wxString&)wxStringBase::operator+=(s); } // string += C string - wxString& operator+=(const char *psz) - { - wxSTRING_INVALIDATE_CACHED_LENGTH(); - - m_impl += ImplStr(psz); - return *this; - } - wxString& operator+=(const wchar_t *pwz) - { - wxSTRING_INVALIDATE_CACHED_LENGTH(); - - m_impl += ImplStr(pwz); - return *this; - } - wxString& operator+=(const wxCStrData& s) - { - wxSTRING_INVALIDATE_CACHED_LENGTH(); - - m_impl += s.AsString().m_impl; - return *this; - } - wxString& operator+=(const wxScopedCharBuffer& s) - { return append(s); } - wxString& operator+=(const wxScopedWCharBuffer& s) - { return append(s); } + wxString& operator+=(const wxChar *psz) + { return (wxString&)wxStringBase::operator+=(psz); } // string += char - wxString& operator+=(wxUniChar ch) - { - wxSTRING_UPDATE_CACHED_LENGTH(1); - -#if wxUSE_UNICODE_UTF8 - if ( !ch.IsAscii() ) - m_impl += wxStringOperations::EncodeChar(ch); - else -#endif - m_impl += (wxStringCharType)ch; - return *this; - } - wxString& operator+=(wxUniCharRef ch) { return *this += wxUniChar(ch); } - wxString& operator+=(int ch) { return *this += wxUniChar(ch); } - wxString& operator+=(char ch) { return *this += wxUniChar(ch); } - wxString& operator+=(unsigned char ch) { return *this += wxUniChar(ch); } - wxString& operator+=(wchar_t ch) { return *this += wxUniChar(ch); } - -private: -#if !wxUSE_STL_BASED_WXSTRING - // helpers for wxStringBuffer and wxStringBufferLength - wxStringCharType *DoGetWriteBuf(size_t nLen) - { - return m_impl.DoGetWriteBuf(nLen); - } - - void DoUngetWriteBuf() - { - wxSTRING_INVALIDATE_CACHE(); - - m_impl.DoUngetWriteBuf(); - } - - void DoUngetWriteBuf(size_t nLen) - { - wxSTRING_INVALIDATE_CACHE(); - - m_impl.DoUngetWriteBuf(nLen); - } -#endif // !wxUSE_STL_BASED_WXSTRING - -#ifndef wxNEEDS_WXSTRING_PRINTF_MIXIN - #if !wxUSE_UTF8_LOCALE_ONLY - int DoPrintfWchar(const wxChar *format, ...); - static wxString DoFormatWchar(const wxChar *format, ...); - #endif - #if wxUSE_UNICODE_UTF8 - int DoPrintfUtf8(const char *format, ...); - static wxString DoFormatUtf8(const char *format, ...); - #endif -#endif - -#if !wxUSE_STL_BASED_WXSTRING - // check string's data validity - bool IsValid() const { return m_impl.GetStringData()->IsValid(); } -#endif - -private: - wxStringImpl m_impl; - - // buffers for compatibility conversion from (char*)c_str() and - // (wchar_t*)c_str(): the pointers returned by these functions should remain - // valid until the string itself is modified for compatibility with the - // existing code and consistency with std::string::c_str() so returning a - // temporary buffer won't do and we need to cache the conversion results - - // TODO-UTF8: benchmark various approaches to keeping compatibility buffers - template - struct ConvertedBuffer - { - // notice that there is no need to initialize m_len here as it's unused - // as long as m_str is NULL - ConvertedBuffer() : m_str(NULL) {} - ~ConvertedBuffer() - { free(m_str); } - - bool Extend(size_t len) - { - // add extra 1 for the trailing NUL - void * const str = realloc(m_str, sizeof(T)*(len + 1)); - if ( !str ) - return false; - - m_str = static_cast(str); - m_len = len; - - return true; - } - - const wxScopedCharTypeBuffer AsScopedBuffer() const - { - return wxScopedCharTypeBuffer::CreateNonOwned(m_str, m_len); - } - - T *m_str; // pointer to the string data - size_t m_len; // length, not size, i.e. in chars and without last NUL - }; - - -#if wxUSE_UNICODE - // common mb_str() and wxCStrData::AsChar() helper: performs the conversion - // and returns either m_convertedToChar.m_str (in which case its m_len is - // also updated) or NULL if it failed - // - // there is an important exception: in wxUSE_UNICODE_UTF8 build if conv is a - // UTF-8 one, we return m_impl.c_str() directly, without doing any conversion - // as optimization and so the caller needs to check for this before using - // m_convertedToChar - // - // NB: AsChar() returns char* in any build, unlike mb_str() - const char *AsChar(const wxMBConv& conv) const; - - // mb_str() implementation helper - wxScopedCharBuffer AsCharBuf(const wxMBConv& conv) const - { -#if wxUSE_UNICODE_UTF8 - // avoid conversion if we can - if ( conv.IsUTF8() ) - { - return wxScopedCharBuffer::CreateNonOwned(m_impl.c_str(), - m_impl.length()); - } -#endif // wxUSE_UNICODE_UTF8 - - // call this solely in order to fill in m_convertedToChar as AsChar() - // updates it as a side effect: this is a bit ugly but it's a completely - // internal function so the users of this class shouldn't care or know - // about it and doing it like this, i.e. having a separate AsChar(), - // allows us to avoid the creation and destruction of a temporary buffer - // when using wxCStrData without duplicating any code - if ( !AsChar(conv) ) - { - // although it would be probably more correct to return NULL buffer - // from here if the conversion fails, a lot of existing code doesn't - // expect mb_str() (or wc_str()) to ever return NULL so return an - // empty string otherwise to avoid crashes in it - // - // also, some existing code does check for the conversion success and - // so asserting here would be bad too -- even if it does mean that - // silently losing data is possible for badly written code - return wxScopedCharBuffer::CreateNonOwned("", 0); - } - - return m_convertedToChar.AsScopedBuffer(); - } - - ConvertedBuffer m_convertedToChar; -#endif // !wxUSE_UNICODE - -#if !wxUSE_UNICODE_WCHAR - // common wc_str() and wxCStrData::AsWChar() helper for both UTF-8 and ANSI - // builds: converts the string contents into m_convertedToWChar and returns - // NULL if the conversion failed (this can only happen in ANSI build) - // - // NB: AsWChar() returns wchar_t* in any build, unlike wc_str() - const wchar_t *AsWChar(const wxMBConv& conv) const; - - // wc_str() implementation helper - wxScopedWCharBuffer AsWCharBuf(const wxMBConv& conv) const - { - if ( !AsWChar(conv) ) - return wxScopedWCharBuffer::CreateNonOwned(L"", 0); - - return m_convertedToWChar.AsScopedBuffer(); - } - - ConvertedBuffer m_convertedToWChar; -#endif // !wxUSE_UNICODE_WCHAR - -#if wxUSE_UNICODE_UTF8 - // FIXME-UTF8: (try to) move this elsewhere (TLS) or solve differently - // assigning to character pointer to by wxString::iterator may - // change the underlying wxStringImpl iterator, so we have to - // keep track of all iterators and update them as necessary: - struct wxStringIteratorNodeHead - { - wxStringIteratorNodeHead() : ptr(NULL) {} - wxStringIteratorNode *ptr; - - // copying is disallowed as it would result in more than one pointer into - // the same linked list - wxDECLARE_NO_COPY_CLASS(wxStringIteratorNodeHead); - }; - - wxStringIteratorNodeHead m_iterators; - - friend class WXDLLIMPEXP_FWD_BASE wxStringIteratorNode; - friend class WXDLLIMPEXP_FWD_BASE wxUniCharRef; -#endif // wxUSE_UNICODE_UTF8 - - friend class WXDLLIMPEXP_FWD_BASE wxCStrData; - friend class wxStringInternalBuffer; - friend class wxStringInternalBufferLength; + wxString& operator+=(wxChar ch) + { return (wxString&)wxStringBase::operator+=(ch); } }; -#ifdef wxNEEDS_WXSTRING_PRINTF_MIXIN - #pragma warning (pop) -#endif - -// string iterator operators that satisfy STL Random Access Iterator -// requirements: -inline wxString::iterator operator+(ptrdiff_t n, wxString::iterator i) - { return i + n; } -inline wxString::const_iterator operator+(ptrdiff_t n, wxString::const_iterator i) - { return i + n; } -inline wxString::reverse_iterator operator+(ptrdiff_t n, wxString::reverse_iterator i) - { return i + n; } -inline wxString::const_reverse_iterator operator+(ptrdiff_t n, wxString::const_reverse_iterator i) - { return i + n; } - // notice that even though for many compilers the friend declarations above are // enough, from the point of view of C++ standard we must have the declarations // here as friend ones are not injected in the enclosing namespace and without // them the code fails to compile with conforming compilers such as xlC or g++4 -wxString WXDLLIMPEXP_BASE operator+(const wxString& string1, const wxString& string2); -wxString WXDLLIMPEXP_BASE operator+(const wxString& string, const char *psz); -wxString WXDLLIMPEXP_BASE operator+(const wxString& string, const wchar_t *pwz); -wxString WXDLLIMPEXP_BASE operator+(const char *psz, const wxString& string); -wxString WXDLLIMPEXP_BASE operator+(const wchar_t *pwz, const wxString& string); - -wxString WXDLLIMPEXP_BASE operator+(const wxString& string, wxUniChar ch); -wxString WXDLLIMPEXP_BASE operator+(wxUniChar ch, const wxString& string); - -inline wxString operator+(const wxString& string, wxUniCharRef ch) - { return string + (wxUniChar)ch; } -inline wxString operator+(const wxString& string, char ch) - { return string + wxUniChar(ch); } -inline wxString operator+(const wxString& string, wchar_t ch) - { return string + wxUniChar(ch); } -inline wxString operator+(wxUniCharRef ch, const wxString& string) - { return (wxUniChar)ch + string; } -inline wxString operator+(char ch, const wxString& string) - { return wxUniChar(ch) + string; } -inline wxString operator+(wchar_t ch, const wxString& string) - { return wxUniChar(ch) + string; } +wxString WXDLLIMPEXP_BASE operator+(const wxString& string1, const wxString& string2); +wxString WXDLLIMPEXP_BASE operator+(const wxString& string, wxChar ch); +wxString WXDLLIMPEXP_BASE operator+(wxChar ch, const wxString& string); +wxString WXDLLIMPEXP_BASE operator+(const wxString& string, const wxChar *psz); +wxString WXDLLIMPEXP_BASE operator+(const wxChar *psz, const wxString& string); -#define wxGetEmptyString() wxString() +// define wxArrayString, for compatibility +#if WXWIN_COMPATIBILITY_2_4 && !wxUSE_STL + #include "wx/arrstr.h" +#endif -// ---------------------------------------------------------------------------- -// helper functions which couldn't be defined inline -// ---------------------------------------------------------------------------- - -namespace wxPrivate -{ - -#if wxUSE_UNICODE_WCHAR - -template <> -struct wxStringAsBufHelper -{ - static wxScopedCharBuffer Get(const wxString& s, size_t *len) +#if wxUSE_STL + // return an empty wxString (not very useful with wxUSE_STL == 1) + inline const wxString wxGetEmptyString() { return wxString(); } +#else // !wxUSE_STL + // return an empty wxString (more efficient than wxString() here) + inline const wxString& wxGetEmptyString() { - wxScopedCharBuffer buf(s.mb_str()); - if ( len ) - *len = buf ? strlen(buf) : 0; - return buf; + return *(wxString *)&wxEmptyString; } -}; - -template <> -struct wxStringAsBufHelper -{ - static wxScopedWCharBuffer Get(const wxString& s, size_t *len) - { - const size_t length = s.length(); - if ( len ) - *len = length; - return wxScopedWCharBuffer::CreateNonOwned(s.wx_str(), length); - } -}; - -#elif wxUSE_UNICODE_UTF8 - -template <> -struct wxStringAsBufHelper -{ - static wxScopedCharBuffer Get(const wxString& s, size_t *len) - { - const size_t length = s.utf8_length(); - if ( len ) - *len = length; - return wxScopedCharBuffer::CreateNonOwned(s.wx_str(), length); - } -}; - -template <> -struct wxStringAsBufHelper -{ - static wxScopedWCharBuffer Get(const wxString& s, size_t *len) - { - wxScopedWCharBuffer wbuf(s.wc_str()); - if ( len ) - *len = wxWcslen(wbuf); - return wbuf; - } -}; - -#endif // Unicode build kind - -} // namespace wxPrivate +#endif // wxUSE_STL/!wxUSE_STL // ---------------------------------------------------------------------------- // wxStringBuffer: a tiny class allowing to get a writable pointer into string // ---------------------------------------------------------------------------- -#if !wxUSE_STL_BASED_WXSTRING -// string buffer for direct access to string data in their native -// representation: -class wxStringInternalBuffer +#if wxUSE_STL + +class WXDLLIMPEXP_BASE wxStringBuffer { public: - typedef wxStringCharType CharType; + wxStringBuffer(wxString& str, size_t lenWanted = 1024) + : m_str(str), m_buf(lenWanted) + { } - wxStringInternalBuffer(wxString& str, size_t lenWanted = 1024) - : m_str(str), m_buf(NULL) - { m_buf = m_str.DoGetWriteBuf(lenWanted); } + ~wxStringBuffer() { m_str.assign(m_buf.data(), wxStrlen(m_buf.data())); } - ~wxStringInternalBuffer() { m_str.DoUngetWriteBuf(); } - - operator wxStringCharType*() const { return m_buf; } + operator wxChar*() { return m_buf.data(); } private: - wxString& m_str; - wxStringCharType *m_buf; + wxString& m_str; +#if wxUSE_UNICODE + wxWCharBuffer m_buf; +#else + wxCharBuffer m_buf; +#endif - wxDECLARE_NO_COPY_CLASS(wxStringInternalBuffer); + DECLARE_NO_COPY_CLASS(wxStringBuffer) }; -class wxStringInternalBufferLength +class WXDLLIMPEXP_BASE wxStringBufferLength { public: - typedef wxStringCharType CharType; + wxStringBufferLength(wxString& str, size_t lenWanted = 1024) + : m_str(str), m_buf(lenWanted), m_len(0), m_lenSet(false) + { } - wxStringInternalBufferLength(wxString& str, size_t lenWanted = 1024) + ~wxStringBufferLength() + { + wxASSERT(m_lenSet); + m_str.assign(m_buf.data(), m_len); + } + + operator wxChar*() { return m_buf.data(); } + void SetLength(size_t length) { m_len = length; m_lenSet = true; } + +private: + wxString& m_str; +#if wxUSE_UNICODE + wxWCharBuffer m_buf; +#else + wxCharBuffer m_buf; +#endif + size_t m_len; + bool m_lenSet; + + DECLARE_NO_COPY_CLASS(wxStringBufferLength) +}; + +#else // if !wxUSE_STL + +class WXDLLIMPEXP_BASE wxStringBuffer +{ +public: + wxStringBuffer(wxString& str, size_t lenWanted = 1024) + : m_str(str), m_buf(NULL) + { m_buf = m_str.GetWriteBuf(lenWanted); } + + ~wxStringBuffer() { m_str.UngetWriteBuf(); } + + operator wxChar*() const { return m_buf; } + +private: + wxString& m_str; + wxChar *m_buf; + + DECLARE_NO_COPY_CLASS(wxStringBuffer) +}; + +class WXDLLIMPEXP_BASE wxStringBufferLength +{ +public: + wxStringBufferLength(wxString& str, size_t lenWanted = 1024) : m_str(str), m_buf(NULL), m_len(0), m_lenSet(false) { - m_buf = m_str.DoGetWriteBuf(lenWanted); + m_buf = m_str.GetWriteBuf(lenWanted); wxASSERT(m_buf != NULL); } - ~wxStringInternalBufferLength() + ~wxStringBufferLength() { wxASSERT(m_lenSet); - m_str.DoUngetWriteBuf(m_len); + m_str.UngetWriteBuf(m_len); } - operator wxStringCharType*() const { return m_buf; } + operator wxChar*() const { return m_buf; } void SetLength(size_t length) { m_len = length; m_lenSet = true; } private: - wxString& m_str; - wxStringCharType *m_buf; - size_t m_len; - bool m_lenSet; - - wxDECLARE_NO_COPY_CLASS(wxStringInternalBufferLength); -}; - -#endif // !wxUSE_STL_BASED_WXSTRING - -template -class wxStringTypeBufferBase -{ -public: - typedef T CharType; - - wxStringTypeBufferBase(wxString& str, size_t lenWanted = 1024) - : m_str(str), m_buf(lenWanted) - { - // for compatibility with old wxStringBuffer which provided direct - // access to wxString internal buffer, initialize ourselves with the - // string initial contents - - // FIXME-VC6: remove the ugly (CharType *)NULL and use normal - // tchar_str - size_t len; - const wxCharTypeBuffer buf(str.tchar_str(&len, (CharType *)NULL)); - if ( buf ) - { - if ( len > lenWanted ) - { - // in this case there is not enough space for terminating NUL, - // ensure that we still put it there - m_buf.data()[lenWanted] = 0; - len = lenWanted - 1; - } - - memcpy(m_buf.data(), buf, (len + 1)*sizeof(CharType)); - } - //else: conversion failed, this can happen when trying to get Unicode - // string contents into a char string - } - - operator CharType*() { return m_buf.data(); } - -protected: wxString& m_str; - wxCharTypeBuffer m_buf; + wxChar *m_buf; + size_t m_len; + bool m_lenSet; + + DECLARE_NO_COPY_CLASS(wxStringBufferLength) }; -template -class wxStringTypeBufferLengthBase : public wxStringTypeBufferBase -{ -public: - wxStringTypeBufferLengthBase(wxString& str, size_t lenWanted = 1024) - : wxStringTypeBufferBase(str, lenWanted), - m_len(0), - m_lenSet(false) - { } - - ~wxStringTypeBufferLengthBase() - { - wxASSERT_MSG( this->m_lenSet, "forgot to call SetLength()" ); - } - - void SetLength(size_t length) { m_len = length; m_lenSet = true; } - -protected: - size_t m_len; - bool m_lenSet; -}; - -template -class wxStringTypeBuffer : public wxStringTypeBufferBase -{ -public: - wxStringTypeBuffer(wxString& str, size_t lenWanted = 1024) - : wxStringTypeBufferBase(str, lenWanted) - { } - - ~wxStringTypeBuffer() - { - this->m_str.assign(this->m_buf.data()); - } - - wxDECLARE_NO_COPY_CLASS(wxStringTypeBuffer); -}; - -template -class wxStringTypeBufferLength : public wxStringTypeBufferLengthBase -{ -public: - wxStringTypeBufferLength(wxString& str, size_t lenWanted = 1024) - : wxStringTypeBufferLengthBase(str, lenWanted) - { } - - ~wxStringTypeBufferLength() - { - this->m_str.assign(this->m_buf.data(), this->m_len); - } - - wxDECLARE_NO_COPY_CLASS(wxStringTypeBufferLength); -}; - -#if wxUSE_STL_BASED_WXSTRING - -WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE( wxStringTypeBufferBase ) - -class wxStringInternalBuffer : public wxStringTypeBufferBase -{ -public: - wxStringInternalBuffer(wxString& str, size_t lenWanted = 1024) - : wxStringTypeBufferBase(str, lenWanted) {} - ~wxStringInternalBuffer() - { m_str.m_impl.assign(m_buf.data()); } - - wxDECLARE_NO_COPY_CLASS(wxStringInternalBuffer); -}; - -WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE( - wxStringTypeBufferLengthBase ) - -class wxStringInternalBufferLength - : public wxStringTypeBufferLengthBase -{ -public: - wxStringInternalBufferLength(wxString& str, size_t lenWanted = 1024) - : wxStringTypeBufferLengthBase(str, lenWanted) {} - - ~wxStringInternalBufferLength() - { - m_str.m_impl.assign(m_buf.data(), m_len); - } - - wxDECLARE_NO_COPY_CLASS(wxStringInternalBufferLength); -}; - -#endif // wxUSE_STL_BASED_WXSTRING - - -#if wxUSE_STL_BASED_WXSTRING || wxUSE_UNICODE_UTF8 -typedef wxStringTypeBuffer wxStringBuffer; -typedef wxStringTypeBufferLength wxStringBufferLength; -#else // if !wxUSE_STL_BASED_WXSTRING && !wxUSE_UNICODE_UTF8 -typedef wxStringInternalBuffer wxStringBuffer; -typedef wxStringInternalBufferLength wxStringBufferLength; -#endif // !wxUSE_STL_BASED_WXSTRING && !wxUSE_UNICODE_UTF8 - -#if wxUSE_UNICODE_UTF8 -typedef wxStringInternalBuffer wxUTF8StringBuffer; -typedef wxStringInternalBufferLength wxUTF8StringBufferLength; -#elif wxUSE_UNICODE_WCHAR - -WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE( wxStringTypeBufferBase ) - -// Note about inlined dtors in the classes below: this is done not for -// performance reasons but just to avoid linking errors in the MSVC DLL build -// under Windows: if a class has non-inline methods it must be declared as -// being DLL-exported but, due to an extremely interesting feature of MSVC 7 -// and later, any template class which is used as a base of a DLL-exported -// class is implicitly made DLL-exported too, as explained at the bottom of -// http://msdn.microsoft.com/en-us/library/twa2aw10.aspx (just to confirm: yes, -// _inheriting_ from a class can change whether it is being exported from DLL) -// -// But this results in link errors because the base template class is not DLL- -// exported, whether it is declared with WXDLLIMPEXP_BASE or not, because it -// does have only inline functions. So the simplest fix is to just make all the -// functions of these classes inline too. - -class wxUTF8StringBuffer : public wxStringTypeBufferBase -{ -public: - wxUTF8StringBuffer(wxString& str, size_t lenWanted = 1024) - : wxStringTypeBufferBase(str, lenWanted) {} - ~wxUTF8StringBuffer() - { - wxMBConvStrictUTF8 conv; - size_t wlen = conv.ToWChar(NULL, 0, m_buf); - wxCHECK_RET( wlen != wxCONV_FAILED, "invalid UTF-8 data in string buffer?" ); - - wxStringInternalBuffer wbuf(m_str, wlen); - conv.ToWChar(wbuf, wlen, m_buf); - } - - wxDECLARE_NO_COPY_CLASS(wxUTF8StringBuffer); -}; - -WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE( wxStringTypeBufferLengthBase ) - -class wxUTF8StringBufferLength : public wxStringTypeBufferLengthBase -{ -public: - wxUTF8StringBufferLength(wxString& str, size_t lenWanted = 1024) - : wxStringTypeBufferLengthBase(str, lenWanted) {} - ~wxUTF8StringBufferLength() - { - wxCHECK_RET(m_lenSet, "length not set"); - - wxMBConvStrictUTF8 conv; - size_t wlen = conv.ToWChar(NULL, 0, m_buf, m_len); - wxCHECK_RET( wlen != wxCONV_FAILED, "invalid UTF-8 data in string buffer?" ); - - wxStringInternalBufferLength wbuf(m_str, wlen); - conv.ToWChar(wbuf, wlen, m_buf, m_len); - wbuf.SetLength(wlen); - } - - wxDECLARE_NO_COPY_CLASS(wxUTF8StringBufferLength); -}; -#endif // wxUSE_UNICODE_UTF8/wxUSE_UNICODE_WCHAR - +#endif // !wxUSE_STL // --------------------------------------------------------------------------- // wxString comparison functions: operator versions are always case sensitive // --------------------------------------------------------------------------- -#define wxCMP_WXCHAR_STRING(p, s, op) 0 op s.Cmp(p) - -wxDEFINE_ALL_COMPARISONS(const wxChar *, const wxString&, wxCMP_WXCHAR_STRING) - -#undef wxCMP_WXCHAR_STRING +// note that when wxUSE_STL == 1 the comparison operators taking std::string +// are used and defining them also for wxString would only result in +// compilation ambiguities when comparing std::string and wxString +#if !wxUSE_STL inline bool operator==(const wxString& s1, const wxString& s2) - { return s1.IsSameAs(s2); } + { return (s1.Len() == s2.Len()) && (s1.Cmp(s2) == 0); } +inline bool operator==(const wxString& s1, const wxChar * s2) + { return s1.Cmp(s2) == 0; } +inline bool operator==(const wxChar * s1, const wxString& s2) + { return s2.Cmp(s1) == 0; } inline bool operator!=(const wxString& s1, const wxString& s2) - { return !s1.IsSameAs(s2); } + { return (s1.Len() != s2.Len()) || (s1.Cmp(s2) != 0); } +inline bool operator!=(const wxString& s1, const wxChar * s2) + { return s1.Cmp(s2) != 0; } +inline bool operator!=(const wxChar * s1, const wxString& s2) + { return s2.Cmp(s1) != 0; } inline bool operator< (const wxString& s1, const wxString& s2) { return s1.Cmp(s2) < 0; } +inline bool operator< (const wxString& s1, const wxChar * s2) + { return s1.Cmp(s2) < 0; } +inline bool operator< (const wxChar * s1, const wxString& s2) + { return s2.Cmp(s1) > 0; } inline bool operator> (const wxString& s1, const wxString& s2) { return s1.Cmp(s2) > 0; } +inline bool operator> (const wxString& s1, const wxChar * s2) + { return s1.Cmp(s2) > 0; } +inline bool operator> (const wxChar * s1, const wxString& s2) + { return s2.Cmp(s1) < 0; } inline bool operator<=(const wxString& s1, const wxString& s2) { return s1.Cmp(s2) <= 0; } +inline bool operator<=(const wxString& s1, const wxChar * s2) + { return s1.Cmp(s2) <= 0; } +inline bool operator<=(const wxChar * s1, const wxString& s2) + { return s2.Cmp(s1) >= 0; } inline bool operator>=(const wxString& s1, const wxString& s2) { return s1.Cmp(s2) >= 0; } +inline bool operator>=(const wxString& s1, const wxChar * s2) + { return s1.Cmp(s2) >= 0; } +inline bool operator>=(const wxChar * s1, const wxString& s2) + { return s2.Cmp(s1) <= 0; } -inline bool operator==(const wxString& s1, const wxCStrData& s2) - { return s1 == s2.AsString(); } -inline bool operator==(const wxCStrData& s1, const wxString& s2) - { return s1.AsString() == s2; } -inline bool operator!=(const wxString& s1, const wxCStrData& s2) - { return s1 != s2.AsString(); } -inline bool operator!=(const wxCStrData& s1, const wxString& s2) - { return s1.AsString() != s2; } - -inline bool operator==(const wxString& s1, const wxScopedWCharBuffer& s2) - { return (s1.Cmp((const wchar_t *)s2) == 0); } -inline bool operator==(const wxScopedWCharBuffer& s1, const wxString& s2) - { return (s2.Cmp((const wchar_t *)s1) == 0); } -inline bool operator!=(const wxString& s1, const wxScopedWCharBuffer& s2) - { return (s1.Cmp((const wchar_t *)s2) != 0); } -inline bool operator!=(const wxScopedWCharBuffer& s1, const wxString& s2) - { return (s2.Cmp((const wchar_t *)s1) != 0); } - -inline bool operator==(const wxString& s1, const wxScopedCharBuffer& s2) - { return (s1.Cmp((const char *)s2) == 0); } -inline bool operator==(const wxScopedCharBuffer& s1, const wxString& s2) - { return (s2.Cmp((const char *)s1) == 0); } -inline bool operator!=(const wxString& s1, const wxScopedCharBuffer& s2) - { return (s1.Cmp((const char *)s2) != 0); } -inline bool operator!=(const wxScopedCharBuffer& s1, const wxString& s2) - { return (s2.Cmp((const char *)s1) != 0); } - -inline wxString operator+(const wxString& string, const wxScopedWCharBuffer& buf) - { return string + (const wchar_t *)buf; } -inline wxString operator+(const wxScopedWCharBuffer& buf, const wxString& string) - { return (const wchar_t *)buf + string; } - -inline wxString operator+(const wxString& string, const wxScopedCharBuffer& buf) - { return string + (const char *)buf; } -inline wxString operator+(const wxScopedCharBuffer& buf, const wxString& string) - { return (const char *)buf + string; } - -// comparison with char -inline bool operator==(const wxUniChar& c, const wxString& s) { return s.IsSameAs(c); } -inline bool operator==(const wxUniCharRef& c, const wxString& s) { return s.IsSameAs(c); } -inline bool operator==(char c, const wxString& s) { return s.IsSameAs(c); } -inline bool operator==(wchar_t c, const wxString& s) { return s.IsSameAs(c); } -inline bool operator==(int c, const wxString& s) { return s.IsSameAs(c); } -inline bool operator==(const wxString& s, const wxUniChar& c) { return s.IsSameAs(c); } -inline bool operator==(const wxString& s, const wxUniCharRef& c) { return s.IsSameAs(c); } -inline bool operator==(const wxString& s, char c) { return s.IsSameAs(c); } -inline bool operator==(const wxString& s, wchar_t c) { return s.IsSameAs(c); } -inline bool operator!=(const wxUniChar& c, const wxString& s) { return !s.IsSameAs(c); } -inline bool operator!=(const wxUniCharRef& c, const wxString& s) { return !s.IsSameAs(c); } -inline bool operator!=(char c, const wxString& s) { return !s.IsSameAs(c); } -inline bool operator!=(wchar_t c, const wxString& s) { return !s.IsSameAs(c); } -inline bool operator!=(int c, const wxString& s) { return !s.IsSameAs(c); } -inline bool operator!=(const wxString& s, const wxUniChar& c) { return !s.IsSameAs(c); } -inline bool operator!=(const wxString& s, const wxUniCharRef& c) { return !s.IsSameAs(c); } -inline bool operator!=(const wxString& s, char c) { return !s.IsSameAs(c); } -inline bool operator!=(const wxString& s, wchar_t c) { return !s.IsSameAs(c); } - - -// wxString iterators comparisons -inline bool wxString::iterator::operator==(const const_iterator& i) const - { return i == *this; } -inline bool wxString::iterator::operator!=(const const_iterator& i) const - { return i != *this; } -inline bool wxString::iterator::operator<(const const_iterator& i) const - { return i > *this; } -inline bool wxString::iterator::operator>(const const_iterator& i) const - { return i < *this; } -inline bool wxString::iterator::operator<=(const const_iterator& i) const - { return i >= *this; } -inline bool wxString::iterator::operator>=(const const_iterator& i) const - { return i <= *this; } - -// comparison with C string in Unicode build #if wxUSE_UNICODE +inline bool operator==(const wxString& s1, const wxWCharBuffer& s2) + { return (s1.Cmp((const wchar_t *)s2) == 0); } +inline bool operator==(const wxWCharBuffer& s1, const wxString& s2) + { return (s2.Cmp((const wchar_t *)s1) == 0); } +inline bool operator!=(const wxString& s1, const wxWCharBuffer& s2) + { return (s1.Cmp((const wchar_t *)s2) != 0); } +inline bool operator!=(const wxWCharBuffer& s1, const wxString& s2) + { return (s2.Cmp((const wchar_t *)s1) != 0); } +#else // !wxUSE_UNICODE +inline bool operator==(const wxString& s1, const wxCharBuffer& s2) + { return (s1.Cmp((const char *)s2) == 0); } +inline bool operator==(const wxCharBuffer& s1, const wxString& s2) + { return (s2.Cmp((const char *)s1) == 0); } +inline bool operator!=(const wxString& s1, const wxCharBuffer& s2) + { return (s1.Cmp((const char *)s2) != 0); } +inline bool operator!=(const wxCharBuffer& s1, const wxString& s2) + { return (s2.Cmp((const char *)s1) != 0); } +#endif // wxUSE_UNICODE/!wxUSE_UNICODE -#define wxCMP_CHAR_STRING(p, s, op) wxString(p) op s +#if wxUSE_UNICODE +inline wxString operator+(const wxString& string, const wxWCharBuffer& buf) + { return string + (const wchar_t *)buf; } +inline wxString operator+(const wxWCharBuffer& buf, const wxString& string) + { return (const wchar_t *)buf + string; } +#else // !wxUSE_UNICODE +inline wxString operator+(const wxString& string, const wxCharBuffer& buf) + { return string + (const char *)buf; } +inline wxString operator+(const wxCharBuffer& buf, const wxString& string) + { return (const char *)buf + string; } +#endif // wxUSE_UNICODE/!wxUSE_UNICODE -wxDEFINE_ALL_COMPARISONS(const char *, const wxString&, wxCMP_CHAR_STRING) +#endif // !wxUSE_STL -#undef wxCMP_CHAR_STRING - -#endif // wxUSE_UNICODE - -// we also need to provide the operators for comparison with wxCStrData to -// resolve ambiguity between operator(const wxChar *,const wxString &) and -// operator(const wxChar *, const wxChar *) for "p == s.c_str()" -// -// notice that these are (shallow) pointer comparisons, not (deep) string ones -#define wxCMP_CHAR_CSTRDATA(p, s, op) p op s.AsChar() -#define wxCMP_WCHAR_CSTRDATA(p, s, op) p op s.AsWChar() - -wxDEFINE_ALL_COMPARISONS(const wchar_t *, const wxCStrData&, wxCMP_WCHAR_CSTRDATA) -wxDEFINE_ALL_COMPARISONS(const char *, const wxCStrData&, wxCMP_CHAR_CSTRDATA) - -#undef wxCMP_CHAR_CSTRDATA -#undef wxCMP_WCHAR_CSTRDATA +// comparison with char (those are not defined by std::[w]string and so should +// be always available) +inline bool operator==(wxChar c, const wxString& s) { return s.IsSameAs(c); } +inline bool operator==(const wxString& s, wxChar c) { return s.IsSameAs(c); } +inline bool operator!=(wxChar c, const wxString& s) { return !s.IsSameAs(c); } +inline bool operator!=(const wxString& s, wxChar c) { return !s.IsSameAs(c); } // --------------------------------------------------------------------------- // Implementation only from here until the end of file // --------------------------------------------------------------------------- +// don't pollute the library user's name space +#undef wxASSERT_VALID_INDEX + #if wxUSE_STD_IOSTREAM #include "wx/iosfwrap.h" WXDLLIMPEXP_BASE wxSTD ostream& operator<<(wxSTD ostream&, const wxString&); -WXDLLIMPEXP_BASE wxSTD ostream& operator<<(wxSTD ostream&, const wxCStrData&); -WXDLLIMPEXP_BASE wxSTD ostream& operator<<(wxSTD ostream&, const wxScopedCharBuffer&); -#ifndef __BORLANDC__ -WXDLLIMPEXP_BASE wxSTD ostream& operator<<(wxSTD ostream&, const wxScopedWCharBuffer&); -#endif -#if wxUSE_UNICODE && defined(HAVE_WOSTREAM) +#endif // wxSTD_STRING_COMPATIBILITY -WXDLLIMPEXP_BASE wxSTD wostream& operator<<(wxSTD wostream&, const wxString&); -WXDLLIMPEXP_BASE wxSTD wostream& operator<<(wxSTD wostream&, const wxCStrData&); -WXDLLIMPEXP_BASE wxSTD wostream& operator<<(wxSTD wostream&, const wxScopedWCharBuffer&); - -#endif // wxUSE_UNICODE && defined(HAVE_WOSTREAM) - -#endif // wxUSE_STD_IOSTREAM - -// --------------------------------------------------------------------------- -// wxCStrData implementation -// --------------------------------------------------------------------------- - -inline wxCStrData::wxCStrData(char *buf) - : m_str(new wxString(buf)), m_offset(0), m_owned(true) {} -inline wxCStrData::wxCStrData(wchar_t *buf) - : m_str(new wxString(buf)), m_offset(0), m_owned(true) {} - -inline wxCStrData::wxCStrData(const wxCStrData& data) - : m_str(data.m_owned ? new wxString(*data.m_str) : data.m_str), - m_offset(data.m_offset), - m_owned(data.m_owned) -{ -} - -inline wxCStrData::~wxCStrData() -{ - if ( m_owned ) - delete const_cast(m_str); // cast to silence warnings -} - -// AsChar() and AsWChar() implementations simply forward to wxString methods - -inline const wchar_t* wxCStrData::AsWChar() const -{ - const wchar_t * const p = -#if wxUSE_UNICODE_WCHAR - m_str->wc_str(); -#elif wxUSE_UNICODE_UTF8 - m_str->AsWChar(wxMBConvStrictUTF8()); -#else - m_str->AsWChar(wxConvLibc); -#endif - - // in Unicode build the string always has a valid Unicode representation - // and even if a conversion is needed (as in UTF8 case) it can't fail - // - // but in ANSI build the string contents might be not convertible to - // Unicode using the current locale encoding so we do need to check for - // errors -#if !wxUSE_UNICODE - if ( !p ) - { - // if conversion fails, return empty string and not NULL to avoid - // crashes in code written with either wxWidgets 2 wxString or - // std::string behaviour in mind: neither of them ever returns NULL - // from its c_str() and so we shouldn't neither - // - // notice that the same is done in AsChar() below and - // wxString::wc_str() and mb_str() for the same reasons - return L""; - } -#endif // !wxUSE_UNICODE - - return p + m_offset; -} - -inline const char* wxCStrData::AsChar() const -{ -#if wxUSE_UNICODE && !wxUSE_UTF8_LOCALE_ONLY - const char * const p = m_str->AsChar(wxConvLibc); - if ( !p ) - return ""; -#else // !wxUSE_UNICODE || wxUSE_UTF8_LOCALE_ONLY - const char * const p = m_str->mb_str(); -#endif // wxUSE_UNICODE && !wxUSE_UTF8_LOCALE_ONLY - - return p + m_offset; -} - -inline wxString wxCStrData::AsString() const -{ - if ( m_offset == 0 ) - return *m_str; - else - return m_str->Mid(m_offset); -} - -inline const wxStringCharType *wxCStrData::AsInternal() const -{ -#if wxUSE_UNICODE_UTF8 - return wxStringOperations::AddToIter(m_str->wx_str(), m_offset); -#else - return m_str->wx_str() + m_offset; -#endif -} - -inline wxUniChar wxCStrData::operator*() const -{ - if ( m_str->empty() ) - return wxUniChar(wxT('\0')); - else - return (*m_str)[m_offset]; -} - -inline wxUniChar wxCStrData::operator[](size_t n) const -{ - // NB: we intentionally use operator[] and not at() here because the former - // works for the terminating NUL while the latter does not - return (*m_str)[m_offset + n]; -} - -// ---------------------------------------------------------------------------- -// more wxCStrData operators -// ---------------------------------------------------------------------------- - -// we need to define those to allow "size_t pos = p - s.c_str()" where p is -// some pointer into the string -inline size_t operator-(const char *p, const wxCStrData& cs) -{ - return p - cs.AsChar(); -} - -inline size_t operator-(const wchar_t *p, const wxCStrData& cs) -{ - return p - cs.AsWChar(); -} - -// ---------------------------------------------------------------------------- -// implementation of wx[W]CharBuffer inline methods using wxCStrData -// ---------------------------------------------------------------------------- - -// FIXME-UTF8: move this to buffer.h -inline wxCharBuffer::wxCharBuffer(const wxCStrData& cstr) - : wxCharTypeBufferBase(cstr.AsCharBuf()) -{ -} - -inline wxWCharBuffer::wxWCharBuffer(const wxCStrData& cstr) - : wxCharTypeBufferBase(cstr.AsWCharBuf()) -{ -} - -#if wxUSE_UNICODE_UTF8 -// ---------------------------------------------------------------------------- -// implementation of wxStringIteratorNode inline methods -// ---------------------------------------------------------------------------- - -void wxStringIteratorNode::DoSet(const wxString *str, - wxStringImpl::const_iterator *citer, - wxStringImpl::iterator *iter) -{ - m_prev = NULL; - m_iter = iter; - m_citer = citer; - m_str = str; - if ( str ) - { - m_next = str->m_iterators.ptr; - const_cast(m_str)->m_iterators.ptr = this; - if ( m_next ) - m_next->m_prev = this; - } - else - { - m_next = NULL; - } -} - -void wxStringIteratorNode::clear() -{ - if ( m_next ) - m_next->m_prev = m_prev; - if ( m_prev ) - m_prev->m_next = m_next; - else if ( m_str ) // first in the list - const_cast(m_str)->m_iterators.ptr = m_next; - - m_next = m_prev = NULL; - m_citer = NULL; - m_iter = NULL; - m_str = NULL; -} -#endif // wxUSE_UNICODE_UTF8 - -#if WXWIN_COMPATIBILITY_2_8 - // lot of code out there doesn't explicitly include wx/crt.h, but uses - // CRT wrappers that are now declared in wx/wxcrt.h and wx/wxcrtvararg.h, - // so let's include this header now that wxString is defined and it's safe - // to do it: - #include "wx/crt.h" -#endif - -// ---------------------------------------------------------------------------- -// Checks on wxString characters -// ---------------------------------------------------------------------------- - -template - inline bool wxStringCheck(const wxString& val) - { - for ( wxString::const_iterator i = val.begin(); - i != val.end(); - ++i ) - if (T(*i) == 0) - return false; - return true; - } - -#endif // _WX_WXSTRING_H_ +#endif // _WX_WXSTRINGH__ diff --git a/Source/3rd Party/wx/include/wx/stringimpl.h b/Source/3rd Party/wx/include/wx/stringimpl.h deleted file mode 100644 index ec0d0b4d5..000000000 --- a/Source/3rd Party/wx/include/wx/stringimpl.h +++ /dev/null @@ -1,565 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/stringimpl.h -// Purpose: wxStringImpl class, implementation of wxString -// Author: Vadim Zeitlin -// Modified by: -// Created: 29/01/98 -// RCS-ID: $Id$ -// Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -/* - This header implements std::string-like string class, wxStringImpl, that is - used by wxString to store the data. Alternatively, if wxUSE_STD_STRING=1, - wxStringImpl is just a typedef to std:: string class. -*/ - -#ifndef _WX_WXSTRINGIMPL_H__ -#define _WX_WXSTRINGIMPL_H__ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/defs.h" // everybody should include this -#include "wx/chartype.h" // for wxChar -#include "wx/wxcrtbase.h" // for wxStrlen() etc. - -#include - -// --------------------------------------------------------------------------- -// macros -// --------------------------------------------------------------------------- - -// implementation only -#define wxASSERT_VALID_INDEX(i) \ - wxASSERT_MSG( (size_t)(i) <= length(), wxT("invalid index in wxString") ) - - -// ---------------------------------------------------------------------------- -// global data -// ---------------------------------------------------------------------------- - -// global pointer to empty string -extern WXDLLIMPEXP_DATA_BASE(const wxChar*) wxEmptyString; -#if wxUSE_UNICODE_UTF8 -// FIXME-UTF8: we should have only one wxEmptyString -extern WXDLLIMPEXP_DATA_BASE(const wxStringCharType*) wxEmptyStringImpl; -#endif - - -// ---------------------------------------------------------------------------- -// deal with various build options -// ---------------------------------------------------------------------------- - -// we use STL-based string internally if we use std::string at all now, there -// should be no reason to prefer our internal implement but if you really need -// it you can predefine wxUSE_STL_BASED_WXSTRING as 0 when building the library -#ifndef wxUSE_STL_BASED_WXSTRING - #define wxUSE_STL_BASED_WXSTRING wxUSE_STD_STRING -#endif - -// in both cases we need to define wxStdString -#if wxUSE_STL_BASED_WXSTRING || wxUSE_STD_STRING - -#include "wx/beforestd.h" -#include -#include "wx/afterstd.h" - -#ifdef HAVE_STD_WSTRING - typedef std::wstring wxStdWideString; -#else - typedef std::basic_string wxStdWideString; -#endif - -#if wxUSE_UNICODE_WCHAR - typedef wxStdWideString wxStdString; -#else - typedef std::string wxStdString; -#endif - -#endif // wxUSE_STL_BASED_WXSTRING || wxUSE_STD_STRING - - -#if wxUSE_STL_BASED_WXSTRING - - // we always want ctor from std::string when using std::string internally - #undef wxUSE_STD_STRING - #define wxUSE_STD_STRING 1 - - // the versions of std::string included with gcc 2.95 and VC6 (for which - // _MSC_VER == 1200) and eVC4 (_MSC_VER == 1201) lack clear() method - #if (defined(__GNUG__) && (__GNUG__ < 3)) || \ - !wxCHECK_VISUALC_VERSION(7) || defined(__EVC4__) - #define wxSTRING_BASE_HASNT_CLEAR - #endif - - typedef wxStdString wxStringImpl; -#else // if !wxUSE_STL_BASED_WXSTRING - -// in non-STL mode, compare() is implemented in wxString and not wxStringImpl -#undef HAVE_STD_STRING_COMPARE - -// --------------------------------------------------------------------------- -// string data prepended with some housekeeping info (used by wxString class), -// is never used directly (but had to be put here to allow inlining) -// --------------------------------------------------------------------------- - -struct WXDLLIMPEXP_BASE wxStringData -{ - int nRefs; // reference count - size_t nDataLength, // actual string length - nAllocLength; // allocated memory size - - // mimics declaration 'wxStringCharType data[nAllocLength]' - wxStringCharType* data() const { return (wxStringCharType*)(this + 1); } - - // empty string has a special ref count so it's never deleted - bool IsEmpty() const { return (nRefs == -1); } - bool IsShared() const { return (nRefs > 1); } - - // lock/unlock - void Lock() { if ( !IsEmpty() ) nRefs++; } - - // VC++ will refuse to inline Unlock but profiling shows that it is wrong -#if defined(__VISUALC__) && (__VISUALC__ >= 1200) - __forceinline -#endif - // VC++ free must take place in same DLL as allocation when using non dll - // run-time library (e.g. Multithreaded instead of Multithreaded DLL) -#if defined(__VISUALC__) && defined(_MT) && !defined(_DLL) - void Unlock() { if ( !IsEmpty() && --nRefs == 0) Free(); } - // we must not inline deallocation since allocation is not inlined - void Free(); -#else - void Unlock() { if ( !IsEmpty() && --nRefs == 0) free(this); } -#endif - - // if we had taken control over string memory (GetWriteBuf), it's - // intentionally put in invalid state - void Validate(bool b) { nRefs = (b ? 1 : 0); } - bool IsValid() const { return (nRefs != 0); } -}; - -class WXDLLIMPEXP_BASE wxStringImpl -{ -public: - // an 'invalid' value for string index, moved to this place due to a CW bug - static const size_t npos; - -protected: - // points to data preceded by wxStringData structure with ref count info - wxStringCharType *m_pchData; - - // accessor to string data - wxStringData* GetStringData() const { return (wxStringData*)m_pchData - 1; } - - // string (re)initialization functions - // initializes the string to the empty value (must be called only from - // ctors, use Reinit() otherwise) -#if wxUSE_UNICODE_UTF8 - void Init() { m_pchData = (wxStringCharType *)wxEmptyStringImpl; } // FIXME-UTF8 -#else - void Init() { m_pchData = (wxStringCharType *)wxEmptyString; } -#endif - // initializes the string with (a part of) C-string - void InitWith(const wxStringCharType *psz, size_t nPos = 0, size_t nLen = npos); - // as Init, but also frees old data - void Reinit() { GetStringData()->Unlock(); Init(); } - - // memory allocation - // allocates memory for string of length nLen - bool AllocBuffer(size_t nLen); - // effectively copies data to string - bool AssignCopy(size_t, const wxStringCharType *); - - // append a (sub)string - bool ConcatSelf(size_t nLen, const wxStringCharType *src, size_t nMaxLen); - bool ConcatSelf(size_t nLen, const wxStringCharType *src) - { return ConcatSelf(nLen, src, nLen); } - - // functions called before writing to the string: they copy it if there - // are other references to our data (should be the only owner when writing) - bool CopyBeforeWrite(); - bool AllocBeforeWrite(size_t); - - // compatibility with wxString - bool Alloc(size_t nLen); - -public: - // standard types - typedef wxStringCharType value_type; - typedef wxStringCharType char_type; - typedef size_t size_type; - typedef value_type& reference; - typedef const value_type& const_reference; - typedef value_type* pointer; - typedef const value_type* const_pointer; - - // macro to define the bulk of iterator and const_iterator classes - #define WX_DEFINE_STRINGIMPL_ITERATOR(iterator_name, ref_type, ptr_type) \ - public: \ - typedef wxStringCharType value_type; \ - typedef ref_type reference; \ - typedef ptr_type pointer; \ - typedef int difference_type; \ - \ - iterator_name() : m_ptr(NULL) { } \ - iterator_name(pointer ptr) : m_ptr(ptr) { } \ - \ - reference operator*() const { return *m_ptr; } \ - \ - iterator_name& operator++() { m_ptr++; return *this; } \ - iterator_name operator++(int) \ - { \ - const iterator_name tmp(*this); \ - m_ptr++; \ - return tmp; \ - } \ - \ - iterator_name& operator--() { m_ptr--; return *this; } \ - iterator_name operator--(int) \ - { \ - const iterator_name tmp(*this); \ - m_ptr--; \ - return tmp; \ - } \ - \ - iterator_name operator+(ptrdiff_t n) const \ - { return iterator_name(m_ptr + n); } \ - iterator_name operator-(ptrdiff_t n) const \ - { return iterator_name(m_ptr - n); } \ - iterator_name& operator+=(ptrdiff_t n) \ - { m_ptr += n; return *this; } \ - iterator_name& operator-=(ptrdiff_t n) \ - { m_ptr -= n; return *this; } \ - \ - difference_type operator-(const iterator_name& i) const \ - { return m_ptr - i.m_ptr; } \ - \ - bool operator==(const iterator_name& i) const \ - { return m_ptr == i.m_ptr; } \ - bool operator!=(const iterator_name& i) const \ - { return m_ptr != i.m_ptr; } \ - \ - bool operator<(const iterator_name& i) const \ - { return m_ptr < i.m_ptr; } \ - bool operator>(const iterator_name& i) const \ - { return m_ptr > i.m_ptr; } \ - bool operator<=(const iterator_name& i) const \ - { return m_ptr <= i.m_ptr; } \ - bool operator>=(const iterator_name& i) const \ - { return m_ptr >= i.m_ptr; } \ - \ - private: \ - /* for wxStringImpl use only */ \ - pointer GetPtr() const { return m_ptr; } \ - \ - friend class wxStringImpl; \ - \ - pointer m_ptr - - // we need to declare const_iterator in wxStringImpl scope, the friend - // declaration inside iterator class itself is not enough, or at least not - // for g++ 3.4 (g++ 4 is ok) - class WXDLLIMPEXP_FWD_BASE const_iterator; - - class WXDLLIMPEXP_BASE iterator - { - WX_DEFINE_STRINGIMPL_ITERATOR(iterator, - wxStringCharType&, - wxStringCharType*); - - friend class const_iterator; - }; - - class WXDLLIMPEXP_BASE const_iterator - { - public: - const_iterator(iterator i) : m_ptr(i.m_ptr) { } - - WX_DEFINE_STRINGIMPL_ITERATOR(const_iterator, - const wxStringCharType&, - const wxStringCharType*); - }; - - #undef WX_DEFINE_STRINGIMPL_ITERATOR - - - // constructors and destructor - // ctor for an empty string - wxStringImpl() { Init(); } - // copy ctor - wxStringImpl(const wxStringImpl& stringSrc) - { - wxASSERT_MSG( stringSrc.GetStringData()->IsValid(), - wxT("did you forget to call UngetWriteBuf()?") ); - - if ( stringSrc.empty() ) { - // nothing to do for an empty string - Init(); - } - else { - m_pchData = stringSrc.m_pchData; // share same data - GetStringData()->Lock(); // => one more copy - } - } - // string containing nRepeat copies of ch - wxStringImpl(size_type nRepeat, wxStringCharType ch); - // ctor takes first nLength characters from C string - // (default value of npos means take all the string) - wxStringImpl(const wxStringCharType *psz) - { InitWith(psz, 0, npos); } - wxStringImpl(const wxStringCharType *psz, size_t nLength) - { InitWith(psz, 0, nLength); } - // take nLen chars starting at nPos - wxStringImpl(const wxStringImpl& str, size_t nPos, size_t nLen) - { - wxASSERT_MSG( str.GetStringData()->IsValid(), - wxT("did you forget to call UngetWriteBuf()?") ); - Init(); - size_t strLen = str.length() - nPos; nLen = strLen < nLen ? strLen : nLen; - InitWith(str.c_str(), nPos, nLen); - } - // take everything between start and end - wxStringImpl(const_iterator start, const_iterator end); - - - // ctor from and conversion to std::string -#if wxUSE_STD_STRING - wxStringImpl(const wxStdString& impl) - { InitWith(impl.c_str(), 0, impl.length()); } - - operator wxStdString() const - { return wxStdString(c_str(), length()); } -#endif - -#if defined(__VISUALC__) && (__VISUALC__ >= 1200) - // disable warning about Unlock() below not being inlined (first, it - // seems to be inlined nevertheless and second, even if it isn't, there - // is nothing we can do about this - #pragma warning(push) - #pragma warning (disable:4714) -#endif - - // dtor is not virtual, this class must not be inherited from! - ~wxStringImpl() - { - GetStringData()->Unlock(); - } - -#if defined(__VISUALC__) && (__VISUALC__ >= 1200) - #pragma warning(pop) -#endif - - // overloaded assignment - // from another wxString - wxStringImpl& operator=(const wxStringImpl& stringSrc); - // from a character - wxStringImpl& operator=(wxStringCharType ch); - // from a C string - wxStringImpl& operator=(const wxStringCharType *psz); - - // return the length of the string - size_type length() const { return GetStringData()->nDataLength; } - // return the length of the string - size_type size() const { return length(); } - // return the maximum size of the string - size_type max_size() const { return npos; } - // resize the string, filling the space with c if c != 0 - void resize(size_t nSize, wxStringCharType ch = '\0'); - // delete the contents of the string - void clear() { erase(0, npos); } - // returns true if the string is empty - bool empty() const { return length() == 0; } - // inform string about planned change in size - void reserve(size_t sz) { Alloc(sz); } - size_type capacity() const { return GetStringData()->nAllocLength; } - - // lib.string.access - // return the character at position n - value_type operator[](size_type n) const { return m_pchData[n]; } - value_type at(size_type n) const - { wxASSERT_VALID_INDEX( n ); return m_pchData[n]; } - // returns the writable character at position n - reference operator[](size_type n) { CopyBeforeWrite(); return m_pchData[n]; } - reference at(size_type n) - { - wxASSERT_VALID_INDEX( n ); - CopyBeforeWrite(); - return m_pchData[n]; - } // FIXME-UTF8: not useful for us...? - - // lib.string.modifiers - // append elements str[pos], ..., str[pos+n] - wxStringImpl& append(const wxStringImpl& str, size_t pos, size_t n) - { - wxASSERT(pos <= str.length()); - ConcatSelf(n, str.c_str() + pos, str.length() - pos); - return *this; - } - // append a string - wxStringImpl& append(const wxStringImpl& str) - { ConcatSelf(str.length(), str.c_str()); return *this; } - // append first n (or all if n == npos) characters of sz - wxStringImpl& append(const wxStringCharType *sz) - { ConcatSelf(wxStrlen(sz), sz); return *this; } - wxStringImpl& append(const wxStringCharType *sz, size_t n) - { ConcatSelf(n, sz); return *this; } - // append n copies of ch - wxStringImpl& append(size_t n, wxStringCharType ch); - // append from first to last - wxStringImpl& append(const_iterator first, const_iterator last) - { ConcatSelf(last - first, first.GetPtr()); return *this; } - - // same as `this_string = str' - wxStringImpl& assign(const wxStringImpl& str) - { return *this = str; } - // same as ` = str[pos..pos + n] - wxStringImpl& assign(const wxStringImpl& str, size_t pos, size_t n) - { return replace(0, npos, str, pos, n); } - // same as `= first n (or all if n == npos) characters of sz' - wxStringImpl& assign(const wxStringCharType *sz) - { return replace(0, npos, sz, wxStrlen(sz)); } - wxStringImpl& assign(const wxStringCharType *sz, size_t n) - { return replace(0, npos, sz, n); } - // same as `= n copies of ch' - wxStringImpl& assign(size_t n, wxStringCharType ch) - { return replace(0, npos, n, ch); } - // assign from first to last - wxStringImpl& assign(const_iterator first, const_iterator last) - { return replace(begin(), end(), first, last); } - - // first valid index position - const_iterator begin() const { return m_pchData; } - iterator begin(); - // position one after the last valid one - const_iterator end() const { return m_pchData + length(); } - iterator end(); - - // insert another string - wxStringImpl& insert(size_t nPos, const wxStringImpl& str) - { - wxASSERT( str.GetStringData()->IsValid() ); - return insert(nPos, str.c_str(), str.length()); - } - // insert n chars of str starting at nStart (in str) - wxStringImpl& insert(size_t nPos, const wxStringImpl& str, size_t nStart, size_t n) - { - wxASSERT( str.GetStringData()->IsValid() ); - wxASSERT( nStart < str.length() ); - size_t strLen = str.length() - nStart; - n = strLen < n ? strLen : n; - return insert(nPos, str.c_str() + nStart, n); - } - // insert first n (or all if n == npos) characters of sz - wxStringImpl& insert(size_t nPos, const wxStringCharType *sz, size_t n = npos); - // insert n copies of ch - wxStringImpl& insert(size_t nPos, size_t n, wxStringCharType ch) - { return insert(nPos, wxStringImpl(n, ch)); } - iterator insert(iterator it, wxStringCharType ch) - { size_t idx = it - begin(); insert(idx, 1, ch); return begin() + idx; } - void insert(iterator it, const_iterator first, const_iterator last) - { insert(it - begin(), first.GetPtr(), last - first); } - void insert(iterator it, size_type n, wxStringCharType ch) - { insert(it - begin(), n, ch); } - - // delete characters from nStart to nStart + nLen - wxStringImpl& erase(size_type pos = 0, size_type n = npos); - iterator erase(iterator first, iterator last) - { - size_t idx = first - begin(); - erase(idx, last - first); - return begin() + idx; - } - iterator erase(iterator first); - - // explicit conversion to C string (use this with printf()!) - const wxStringCharType* c_str() const { return m_pchData; } - const wxStringCharType* data() const { return m_pchData; } - - // replaces the substring of length nLen starting at nStart - wxStringImpl& replace(size_t nStart, size_t nLen, const wxStringCharType* sz) - { return replace(nStart, nLen, sz, npos); } - // replaces the substring of length nLen starting at nStart - wxStringImpl& replace(size_t nStart, size_t nLen, const wxStringImpl& str) - { return replace(nStart, nLen, str.c_str(), str.length()); } - // replaces the substring with nCount copies of ch - wxStringImpl& replace(size_t nStart, size_t nLen, - size_t nCount, wxStringCharType ch) - { return replace(nStart, nLen, wxStringImpl(nCount, ch)); } - // replaces a substring with another substring - wxStringImpl& replace(size_t nStart, size_t nLen, - const wxStringImpl& str, size_t nStart2, size_t nLen2) - { return replace(nStart, nLen, str.substr(nStart2, nLen2)); } - // replaces the substring with first nCount chars of sz - wxStringImpl& replace(size_t nStart, size_t nLen, - const wxStringCharType* sz, size_t nCount); - - wxStringImpl& replace(iterator first, iterator last, const_pointer s) - { return replace(first - begin(), last - first, s); } - wxStringImpl& replace(iterator first, iterator last, const_pointer s, - size_type n) - { return replace(first - begin(), last - first, s, n); } - wxStringImpl& replace(iterator first, iterator last, const wxStringImpl& s) - { return replace(first - begin(), last - first, s); } - wxStringImpl& replace(iterator first, iterator last, size_type n, wxStringCharType c) - { return replace(first - begin(), last - first, n, c); } - wxStringImpl& replace(iterator first, iterator last, - const_iterator first1, const_iterator last1) - { return replace(first - begin(), last - first, first1.GetPtr(), last1 - first1); } - - // swap two strings - void swap(wxStringImpl& str); - - // All find() functions take the nStart argument which specifies the - // position to start the search on, the default value is 0. All functions - // return npos if there were no match. - - // find a substring - size_t find(const wxStringImpl& str, size_t nStart = 0) const; - - // find first n characters of sz - size_t find(const wxStringCharType* sz, size_t nStart = 0, size_t n = npos) const; - - // find the first occurrence of character ch after nStart - size_t find(wxStringCharType ch, size_t nStart = 0) const; - - // rfind() family is exactly like find() but works right to left - - // as find, but from the end - size_t rfind(const wxStringImpl& str, size_t nStart = npos) const; - - // as find, but from the end - size_t rfind(const wxStringCharType* sz, size_t nStart = npos, - size_t n = npos) const; - // as find, but from the end - size_t rfind(wxStringCharType ch, size_t nStart = npos) const; - - size_type copy(wxStringCharType* s, size_type n, size_type pos = 0); - - // substring extraction - wxStringImpl substr(size_t nStart = 0, size_t nLen = npos) const; - - // string += string - wxStringImpl& operator+=(const wxStringImpl& s) { return append(s); } - // string += C string - wxStringImpl& operator+=(const wxStringCharType *psz) { return append(psz); } - // string += char - wxStringImpl& operator+=(wxStringCharType ch) { return append(1, ch); } - - // helpers for wxStringBuffer and wxStringBufferLength - wxStringCharType *DoGetWriteBuf(size_t nLen); - void DoUngetWriteBuf(); - void DoUngetWriteBuf(size_t nLen); - - friend class WXDLLIMPEXP_FWD_BASE wxString; -}; - -#endif // !wxUSE_STL_BASED_WXSTRING - -// don't pollute the library user's name space -#undef wxASSERT_VALID_INDEX - -#endif // _WX_WXSTRINGIMPL_H__ diff --git a/Source/3rd Party/wx/include/wx/stringops.h b/Source/3rd Party/wx/include/wx/stringops.h deleted file mode 100644 index 929dffc37..000000000 --- a/Source/3rd Party/wx/include/wx/stringops.h +++ /dev/null @@ -1,175 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/stringops.h -// Purpose: implementation of wxString primitive operations -// Author: Vaclav Slavik -// Modified by: -// Created: 2007-04-16 -// RCS-ID: $Id$ -// Copyright: (c) 2007 REA Elektronik GmbH -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_WXSTRINGOPS_H__ -#define _WX_WXSTRINGOPS_H__ - -#include "wx/chartype.h" -#include "wx/stringimpl.h" -#include "wx/unichar.h" -#include "wx/buffer.h" - -// This header contains wxStringOperations "namespace" class that implements -// elementary operations on string data as static methods; wxString methods and -// iterators are implemented in terms of it. Two implementations are available, -// one for UTF-8 encoded char* string and one for "raw" wchar_t* strings (or -// char* in ANSI build). - -// FIXME-UTF8: only wchar after we remove ANSI build -#if wxUSE_UNICODE_WCHAR || !wxUSE_UNICODE -struct WXDLLIMPEXP_BASE wxStringOperationsWchar -{ - // moves the iterator to the next Unicode character - template - static void IncIter(Iterator& i) { ++i; } - - // moves the iterator to the previous Unicode character - template - static void DecIter(Iterator& i) { --i; } - - // moves the iterator by n Unicode characters - template - static Iterator AddToIter(const Iterator& i, ptrdiff_t n) - { return i + n; } - - // returns distance of the two iterators in Unicode characters - template - static ptrdiff_t DiffIters(const Iterator& i1, const Iterator& i2) - { return i1 - i2; } - - // encodes the character to a form used to represent it in internal - // representation (returns a string in UTF8 version) - static wxChar EncodeChar(const wxUniChar& ch) { return (wxChar)ch; } - - static wxUniChar DecodeChar(const wxStringImpl::const_iterator& i) - { return *i; } -}; -#endif // wxUSE_UNICODE_WCHAR || !wxUSE_UNICODE - - -#if wxUSE_UNICODE_UTF8 -struct WXDLLIMPEXP_BASE wxStringOperationsUtf8 -{ - // checks correctness of UTF-8 sequence - static bool IsValidUtf8String(const char *c, - size_t len = wxStringImpl::npos); - static bool IsValidUtf8LeadByte(unsigned char c) - { - return (c <= 0x7F) || (c >= 0xC2 && c <= 0xF4); - } - - // table of offsets to skip forward when iterating over UTF-8 sequence - static const unsigned char ms_utf8IterTable[256]; - - - template - static void IncIter(Iterator& i) - { - wxASSERT( IsValidUtf8LeadByte(*i) ); - i += ms_utf8IterTable[(unsigned char)*i]; - } - - template - static void DecIter(Iterator& i) - { - wxASSERT( IsValidUtf8LeadByte(*i) ); - - // Non-lead bytes are all in the 0x80..0xBF range (i.e. 10xxxxxx in - // binary), so we just have to go back until we hit a byte that is - // either < 0x80 (i.e. 0xxxxxxx in binary) or 0xC0..0xFF (11xxxxxx in - // binary; this includes some invalid values, but we can ignore it - // here, because we assume valid UTF-8 input for the purpose of - // efficient implementation). - --i; - while ( ((*i) & 0xC0) == 0x80 /* 2 highest bits are '10' */ ) - --i; - } - - template - static Iterator AddToIter(const Iterator& i, ptrdiff_t n) - { - Iterator out(i); - - if ( n > 0 ) - { - for ( ptrdiff_t j = 0; j < n; ++j ) - IncIter(out); - } - else if ( n < 0 ) - { - for ( ptrdiff_t j = 0; j > n; --j ) - DecIter(out); - } - - return out; - } - - template - static ptrdiff_t DiffIters(Iterator i1, Iterator i2) - { - ptrdiff_t dist = 0; - - if ( i1 < i2 ) - { - while ( i1 != i2 ) - { - IncIter(i1); - dist--; - } - } - else if ( i2 < i1 ) - { - while ( i2 != i1 ) - { - IncIter(i2); - dist++; - } - } - - return dist; - } - - // encodes the character as UTF-8: - typedef wxUniChar::Utf8CharBuffer Utf8CharBuffer; - static Utf8CharBuffer EncodeChar(const wxUniChar& ch) - { return ch.AsUTF8(); } - - // returns n copies of ch encoded in UTF-8 string - static wxCharBuffer EncodeNChars(size_t n, const wxUniChar& ch); - - // returns the length of UTF-8 encoding of the character with lead byte 'c' - static size_t GetUtf8CharLength(char c) - { - wxASSERT( IsValidUtf8LeadByte(c) ); - return ms_utf8IterTable[(unsigned char)c]; - } - - // decodes single UTF-8 character from UTF-8 string - static wxUniChar DecodeChar(wxStringImpl::const_iterator i) - { - if ( (unsigned char)*i < 0x80 ) - return (int)*i; - return DecodeNonAsciiChar(i); - } - -private: - static wxUniChar DecodeNonAsciiChar(wxStringImpl::const_iterator i); -}; -#endif // wxUSE_UNICODE_UTF8 - - -#if wxUSE_UNICODE_UTF8 -typedef wxStringOperationsUtf8 wxStringOperations; -#else -typedef wxStringOperationsWchar wxStringOperations; -#endif - -#endif // _WX_WXSTRINGOPS_H_ diff --git a/Source/3rd Party/wx/include/wx/strvararg.h b/Source/3rd Party/wx/include/wx/strvararg.h deleted file mode 100644 index 095052360..000000000 --- a/Source/3rd Party/wx/include/wx/strvararg.h +++ /dev/null @@ -1,1224 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/strvararg.h -// Purpose: macros for implementing type-safe vararg passing of strings -// Author: Vaclav Slavik -// Created: 2007-02-19 -// RCS-ID: $Id$ -// Copyright: (c) 2007 REA Elektronik GmbH -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_STRVARARG_H_ -#define _WX_STRVARARG_H_ - -#include "wx/platform.h" -#if wxONLY_WATCOM_EARLIER_THAN(1,4) - #error "OpenWatcom version >= 1.4 is required to compile this code" -#endif - -#include "wx/cpp.h" -#include "wx/chartype.h" -#include "wx/strconv.h" -#include "wx/buffer.h" -#include "wx/unichar.h" - -#if defined(HAVE_TYPE_TRAITS) - #include -#elif defined(HAVE_TR1_TYPE_TRAITS) - #ifdef __VISUALC__ - #include - #else - #include - #endif -#endif - -class WXDLLIMPEXP_FWD_BASE wxCStrData; -class WXDLLIMPEXP_FWD_BASE wxString; - -// ---------------------------------------------------------------------------- -// WX_DEFINE_VARARG_FUNC* macros -// ---------------------------------------------------------------------------- - -// This macro is used to implement type-safe wrappers for variadic functions -// that accept strings as arguments. This makes it possible to pass char*, -// wchar_t* or even wxString (as opposed to having to use wxString::c_str()) -// to e.g. wxPrintf(). -// -// This is done by defining a set of N template function taking 1..N arguments -// (currently, N is set to 30 in this header). These functions are just thin -// wrappers around another variadic function ('impl' or 'implUtf8' arguments, -// see below) and the only thing the wrapper does is that it normalizes the -// arguments passed in so that they are of the type expected by variadic -// functions taking string arguments, i.e., char* or wchar_t*, depending on the -// build: -// * char* in the current locale's charset in ANSI build -// * char* with UTF-8 encoding if wxUSE_UNICODE_UTF8 and the app is running -// under an UTF-8 locale -// * wchar_t* if wxUSE_UNICODE_WCHAR or if wxUSE_UNICODE_UTF8 and the current -// locale is not UTF-8 -// -// Note that wxFormatString *must* be used for the format parameter of these -// functions, otherwise the implementation won't work correctly. Furthermore, -// it must be passed by value, not reference, because it's modified by the -// vararg templates internally. -// -// Parameters: -// [ there are examples in square brackets showing values of the parameters -// for the wxFprintf() wrapper for fprintf() function with the following -// prototype: -// int wxFprintf(FILE *stream, const wxString& format, ...); ] -// -// rettype Functions' return type [int] -// name Name of the function [fprintf] -// numfixed The number of leading "fixed" (i.e., not variadic) -// arguments of the function (e.g. "stream" and "format" -// arguments of fprintf()); their type is _not_ converted -// using wxArgNormalizer, unlike the rest of -// the function's arguments [2] -// fixed List of types of the leading "fixed" arguments, in -// parenthesis [(FILE*,const wxString&)] -// impl Name of the variadic function that implements 'name' for -// the native strings representation (wchar_t* if -// wxUSE_UNICODE_WCHAR or wxUSE_UNICODE_UTF8 when running under -// non-UTF8 locale, char* in ANSI build) [wxCrt_Fprintf] -// implUtf8 Like 'impl', but for the UTF-8 char* version to be used -// if wxUSE_UNICODE_UTF8 and running under UTF-8 locale -// (ignored otherwise) [fprintf] -// -#define WX_DEFINE_VARARG_FUNC(rettype, name, numfixed, fixed, impl, implUtf8) \ - _WX_VARARG_DEFINE_FUNC_N0(rettype, name, impl, implUtf8, numfixed, fixed) \ - WX_DEFINE_VARARG_FUNC_SANS_N0(rettype, name, numfixed, fixed, impl, implUtf8) - -// ditto, but without the version with 0 template/vararg arguments -#define WX_DEFINE_VARARG_FUNC_SANS_N0(rettype, name, \ - numfixed, fixed, impl, implUtf8) \ - _WX_VARARG_ITER(_WX_VARARG_MAX_ARGS, \ - _WX_VARARG_DEFINE_FUNC, \ - rettype, name, impl, implUtf8, numfixed, fixed) - -// Like WX_DEFINE_VARARG_FUNC, but for variadic functions that don't return -// a value. -#define WX_DEFINE_VARARG_FUNC_VOID(name, numfixed, fixed, impl, implUtf8) \ - _WX_VARARG_DEFINE_FUNC_VOID_N0(name, impl, implUtf8, numfixed, fixed) \ - _WX_VARARG_ITER(_WX_VARARG_MAX_ARGS, \ - _WX_VARARG_DEFINE_FUNC_VOID, \ - void, name, impl, implUtf8, numfixed, fixed) - -// Like WX_DEFINE_VARARG_FUNC_VOID, but instead of wrapping an implementation -// function, does nothing in defined functions' bodies. -// -// Used to implement wxLogXXX functions if wxUSE_LOG=0. -#define WX_DEFINE_VARARG_FUNC_NOP(name, numfixed, fixed) \ - _WX_VARARG_DEFINE_FUNC_NOP_N0(name, numfixed, fixed) \ - _WX_VARARG_ITER(_WX_VARARG_MAX_ARGS, \ - _WX_VARARG_DEFINE_FUNC_NOP, \ - void, name, dummy, dummy, numfixed, fixed) - -// Like WX_DEFINE_VARARG_FUNC_CTOR, but for defining template constructors -#define WX_DEFINE_VARARG_FUNC_CTOR(name, numfixed, fixed, impl, implUtf8) \ - _WX_VARARG_DEFINE_FUNC_CTOR_N0(name, impl, implUtf8, numfixed, fixed) \ - _WX_VARARG_ITER(_WX_VARARG_MAX_ARGS, \ - _WX_VARARG_DEFINE_FUNC_CTOR, \ - void, name, impl, implUtf8, numfixed, fixed) - - -// ---------------------------------------------------------------------------- -// wxFormatString -// ---------------------------------------------------------------------------- - -// This class must be used for format string argument of the functions -// defined using WX_DEFINE_VARARG_FUNC_* macros. It converts the string to -// char* or wchar_t* for passing to implementation function efficiently (i.e. -// without keeping the converted string in memory for longer than necessary, -// like c_str()). It also converts format string to the correct form that -// accounts for string changes done by wxArgNormalizer<> -// -// Note that this class can _only_ be used for function arguments! -class WXDLLIMPEXP_BASE wxFormatString -{ -public: - wxFormatString(const char *str) - : m_char(wxScopedCharBuffer::CreateNonOwned(str)), m_str(NULL), m_cstr(NULL) {} - wxFormatString(const wchar_t *str) - : m_wchar(wxScopedWCharBuffer::CreateNonOwned(str)), m_str(NULL), m_cstr(NULL) {} - wxFormatString(const wxString& str) - : m_str(&str), m_cstr(NULL) {} - wxFormatString(const wxCStrData& str) - : m_str(NULL), m_cstr(&str) {} - wxFormatString(const wxScopedCharBuffer& str) - : m_char(str), m_str(NULL), m_cstr(NULL) {} - wxFormatString(const wxScopedWCharBuffer& str) - : m_wchar(str), m_str(NULL), m_cstr(NULL) {} - - // Possible argument types. These are or-combinable for wxASSERT_ARG_TYPE - // convenience. Some of the values are or-combined with another value, this - // expresses "supertypes" for use with wxASSERT_ARG_TYPE masks. For example, - // a char* string is also a pointer and an integer is also a char. - enum ArgumentType - { - Arg_Char = 0x0001, // character as char %c - Arg_Pointer = 0x0002, // %p - Arg_String = 0x0004 | Arg_Pointer, // any form of string (%s and %p too) - - Arg_Int = 0x0008 | Arg_Char, // (ints can be used with %c) -#if SIZEOF_INT == SIZEOF_LONG - Arg_LongInt = Arg_Int, -#else - Arg_LongInt = 0x0010, -#endif -#if defined(SIZEOF_LONG_LONG) && SIZEOF_LONG_LONG == SIZEOF_LONG - Arg_LongLongInt = Arg_LongInt, -#elif defined(wxLongLong_t) - Arg_LongLongInt = 0x0020, -#endif - - Arg_Double = 0x0040, - Arg_LongDouble = 0x0080, - -#if defined(wxSIZE_T_IS_UINT) - Arg_Size_t = Arg_Int, -#elif defined(wxSIZE_T_IS_ULONG) - Arg_Size_t = Arg_LongInt, -#elif defined(SIZEOF_LONG_LONG) && SIZEOF_SIZE_T == SIZEOF_LONG_LONG - Arg_Size_t = Arg_LongLongInt, -#else - Arg_Size_t = 0x0100, -#endif - - Arg_IntPtr = 0x0200, // %n -- store # of chars written - Arg_ShortIntPtr = 0x0400, - Arg_LongIntPtr = 0x0800, - - Arg_Unknown = 0x8000 // unrecognized specifier (likely error) - }; - - // returns the type of format specifier for n-th variadic argument (this is - // not necessarily n-th format specifier if positional specifiers are used); - // called by wxArgNormalizer<> specializations to get information about - // n-th variadic argument desired representation - ArgumentType GetArgumentType(unsigned n) const; - - // returns the value passed to ctor, only converted to wxString, similarly - // to other InputAsXXX() methods - wxString InputAsString() const; - -#if !wxUSE_UNICODE_WCHAR - operator const char*() const - { return const_cast(this)->AsChar(); } -private: - // InputAsChar() returns the value passed to ctor, only converted - // to char, while AsChar() takes the string returned by InputAsChar() - // and does format string conversion on it as well (and similarly for - // ..AsWChar() below) - const char* InputAsChar(); - const char* AsChar(); - wxScopedCharBuffer m_convertedChar; -#endif // !wxUSE_UNICODE_WCHAR - -#if wxUSE_UNICODE && !wxUSE_UTF8_LOCALE_ONLY -public: - operator const wchar_t*() const - { return const_cast(this)->AsWChar(); } -private: - const wchar_t* InputAsWChar(); - const wchar_t* AsWChar(); - wxScopedWCharBuffer m_convertedWChar; -#endif // wxUSE_UNICODE && !wxUSE_UTF8_LOCALE_ONLY - -private: - wxScopedCharBuffer m_char; - wxScopedWCharBuffer m_wchar; - - // NB: we can use a pointer here, because wxFormatString is only used - // as function argument, so it has shorter life than the string - // passed to the ctor - const wxString * const m_str; - const wxCStrData * const m_cstr; - - wxDECLARE_NO_ASSIGN_CLASS(wxFormatString); -}; - -// these two helper classes are used to find wxFormatString argument among fixed -// arguments passed to a vararg template -struct wxFormatStringArgument -{ - wxFormatStringArgument(const wxFormatString *s = NULL) : m_str(s) {} - const wxFormatString *m_str; - - // overriding this operator allows us to reuse _WX_VARARG_JOIN macro - wxFormatStringArgument operator,(const wxFormatStringArgument& a) const - { - wxASSERT_MSG( m_str == NULL || a.m_str == NULL, - "can't have two format strings in vararg function" ); - return wxFormatStringArgument(m_str ? m_str : a.m_str); - } - - operator const wxFormatString*() const { return m_str; } -}; - -template -struct wxFormatStringArgumentFinder -{ - static wxFormatStringArgument find(T) - { - // by default, arguments are not format strings, so return "not found" - return wxFormatStringArgument(); - } -}; - -template<> -struct wxFormatStringArgumentFinder -{ - static wxFormatStringArgument find(const wxFormatString& arg) - { return wxFormatStringArgument(&arg); } -}; - -template<> -struct wxFormatStringArgumentFinder - : public wxFormatStringArgumentFinder {}; - -// avoid passing big objects by value to wxFormatStringArgumentFinder::find() -// (and especially wx[W]CharBuffer with its auto_ptr<> style semantics!): -template<> -struct wxFormatStringArgumentFinder - : public wxFormatStringArgumentFinder {}; - -template<> -struct wxFormatStringArgumentFinder - : public wxFormatStringArgumentFinder {}; - -template<> -struct wxFormatStringArgumentFinder - : public wxFormatStringArgumentFinder {}; - -template<> -struct wxFormatStringArgumentFinder - : public wxFormatStringArgumentFinder {}; - -template<> -struct wxFormatStringArgumentFinder - : public wxFormatStringArgumentFinder {}; - - -// ---------------------------------------------------------------------------- -// wxArgNormalizer* converters -// ---------------------------------------------------------------------------- - -#if wxDEBUG_LEVEL - // Check that the format specifier for index-th argument in 'fmt' has - // the correct type (one of wxFormatString::Arg_XXX or-combination in - // 'expected_mask'). - #define wxASSERT_ARG_TYPE(fmt, index, expected_mask) \ - do \ - { \ - if ( !fmt ) \ - break; \ - const int argtype = fmt->GetArgumentType(index); \ - wxASSERT_MSG( (argtype & (expected_mask)) == argtype, \ - "format specifier doesn't match argument type" ); \ - } while ( wxFalse ) -#else - // Just define it to suppress "unused parameter" warnings for the - // parameters which we don't use otherwise - #define wxASSERT_ARG_TYPE(fmt, index, expected_mask) \ - wxUnusedVar(fmt); \ - wxUnusedVar(index) -#endif // wxDEBUG_LEVEL/!wxDEBUG_LEVEL - - -#if defined(HAVE_TYPE_TRAITS) || defined(HAVE_TR1_TYPE_TRAITS) - -// Note: this type is misnamed, so that the error message is easier to -// understand (no error happens for enums, because the IsEnum=true case is -// specialized). -template -struct wxFormatStringSpecifierNonPodType {}; - -template<> -struct wxFormatStringSpecifierNonPodType -{ - enum { value = wxFormatString::Arg_Int }; -}; - -template -struct wxFormatStringSpecifier -{ -#ifdef HAVE_TYPE_TRAITS - typedef std::is_enum is_enum; -#elif defined HAVE_TR1_TYPE_TRAITS - typedef std::tr1::is_enum is_enum; -#endif - enum { value = wxFormatStringSpecifierNonPodType::value }; -}; - -#else // !HAVE_(TR1_)TYPE_TRAITS - -template -struct wxFormatStringSpecifier -{ - // We can't detect enums without is_enum, so the only thing we can - // do is to accept unknown types. However, the only acceptable unknown - // types still are enums, which are promoted to ints, so return Arg_Int - // here. This will at least catch passing of non-POD types through ... at - // runtime. - // - // Furthermore, if the compiler doesn't have partial template - // specialization, we didn't cover pointers either. -#ifdef HAVE_PARTIAL_SPECIALIZATION - enum { value = wxFormatString::Arg_Int }; -#else - enum { value = wxFormatString::Arg_Int | wxFormatString::Arg_Pointer }; -#endif -}; - -#endif // HAVE_TR1_TYPE_TRAITS/!HAVE_TR1_TYPE_TRAITS - - -#ifdef HAVE_PARTIAL_SPECIALIZATION -template -struct wxFormatStringSpecifier -{ - enum { value = wxFormatString::Arg_Pointer }; -}; - -template -struct wxFormatStringSpecifier -{ - enum { value = wxFormatString::Arg_Pointer }; -}; -#endif // !HAVE_PARTIAL_SPECIALIZATION - - -#define wxFORMAT_STRING_SPECIFIER(T, arg) \ - template<> struct wxFormatStringSpecifier \ - { \ - enum { value = arg }; \ - }; - -wxFORMAT_STRING_SPECIFIER(bool, wxFormatString::Arg_Int) -wxFORMAT_STRING_SPECIFIER(int, wxFormatString::Arg_Int) -wxFORMAT_STRING_SPECIFIER(unsigned int, wxFormatString::Arg_Int) -wxFORMAT_STRING_SPECIFIER(short int, wxFormatString::Arg_Int) -wxFORMAT_STRING_SPECIFIER(short unsigned int, wxFormatString::Arg_Int) -wxFORMAT_STRING_SPECIFIER(long int, wxFormatString::Arg_LongInt) -wxFORMAT_STRING_SPECIFIER(long unsigned int, wxFormatString::Arg_LongInt) -#ifdef wxLongLong_t -wxFORMAT_STRING_SPECIFIER(wxLongLong_t, wxFormatString::Arg_LongLongInt) -wxFORMAT_STRING_SPECIFIER(wxULongLong_t, wxFormatString::Arg_LongLongInt) -#endif -wxFORMAT_STRING_SPECIFIER(float, wxFormatString::Arg_Double) -wxFORMAT_STRING_SPECIFIER(double, wxFormatString::Arg_Double) -wxFORMAT_STRING_SPECIFIER(long double, wxFormatString::Arg_LongDouble) - -#if wxWCHAR_T_IS_REAL_TYPE -wxFORMAT_STRING_SPECIFIER(wchar_t, wxFormatString::Arg_Char | wxFormatString::Arg_Int) -#endif - -#if !wxUSE_UNICODE -wxFORMAT_STRING_SPECIFIER(char, wxFormatString::Arg_Char | wxFormatString::Arg_Int) -wxFORMAT_STRING_SPECIFIER(signed char, wxFormatString::Arg_Char | wxFormatString::Arg_Int) -wxFORMAT_STRING_SPECIFIER(unsigned char, wxFormatString::Arg_Char | wxFormatString::Arg_Int) -#endif - -wxFORMAT_STRING_SPECIFIER(char*, wxFormatString::Arg_String) -wxFORMAT_STRING_SPECIFIER(unsigned char*, wxFormatString::Arg_String) -wxFORMAT_STRING_SPECIFIER(signed char*, wxFormatString::Arg_String) -wxFORMAT_STRING_SPECIFIER(const char*, wxFormatString::Arg_String) -wxFORMAT_STRING_SPECIFIER(const unsigned char*, wxFormatString::Arg_String) -wxFORMAT_STRING_SPECIFIER(const signed char*, wxFormatString::Arg_String) -wxFORMAT_STRING_SPECIFIER(wchar_t*, wxFormatString::Arg_String) -wxFORMAT_STRING_SPECIFIER(const wchar_t*, wxFormatString::Arg_String) - -wxFORMAT_STRING_SPECIFIER(int*, wxFormatString::Arg_IntPtr | wxFormatString::Arg_Pointer) -wxFORMAT_STRING_SPECIFIER(short int*, wxFormatString::Arg_ShortIntPtr | wxFormatString::Arg_Pointer) -wxFORMAT_STRING_SPECIFIER(long int*, wxFormatString::Arg_LongIntPtr | wxFormatString::Arg_Pointer) - -#undef wxFORMAT_STRING_SPECIFIER - - -// Converts an argument passed to wxPrint etc. into standard form expected, -// by wxXXX functions, e.g. all strings (wxString, char*, wchar_t*) are -// converted into wchar_t* or char* depending on the build. -template -struct wxArgNormalizer -{ - // Ctor. 'value' is the value passed as variadic argument, 'fmt' is pointer - // to printf-like format string or NULL if the variadic function doesn't - // use format string and 'index' is index of 'value' in variadic arguments - // list (starting at 1) - wxArgNormalizer(T value, - const wxFormatString *fmt, unsigned index) - : m_value(value) - { - wxASSERT_ARG_TYPE( fmt, index, wxFormatStringSpecifier::value ); - } - - // Returns the value in a form that can be safely passed to real vararg - // functions. In case of strings, this is char* in ANSI build and wchar_t* - // in Unicode build. - T get() const { return m_value; } - - T m_value; -}; - -// normalizer for passing arguments to functions working with wchar_t* (and -// until ANSI build is removed, char* in ANSI build as well - FIXME-UTF8) -// string representation -#if !wxUSE_UTF8_LOCALE_ONLY -template -struct wxArgNormalizerWchar : public wxArgNormalizer -{ - wxArgNormalizerWchar(T value, - const wxFormatString *fmt, unsigned index) - : wxArgNormalizer(value, fmt, index) {} -}; -#endif // !wxUSE_UTF8_LOCALE_ONLY - -// normalizer for passing arguments to functions working with UTF-8 encoded -// char* strings -#if wxUSE_UNICODE_UTF8 - template - struct wxArgNormalizerUtf8 : public wxArgNormalizer - { - wxArgNormalizerUtf8(T value, - const wxFormatString *fmt, unsigned index) - : wxArgNormalizer(value, fmt, index) {} - }; - - #define wxArgNormalizerNative wxArgNormalizerUtf8 -#else // wxUSE_UNICODE_WCHAR - #define wxArgNormalizerNative wxArgNormalizerWchar -#endif // wxUSE_UNICODE_UTF8 // wxUSE_UNICODE_UTF8 - - - -// special cases for converting strings: - - -// base class for wxArgNormalizer specializations that need to do conversion; -// CharType is either wxStringCharType or wchar_t in UTF-8 build when wrapping -// widechar CRT function -template -struct wxArgNormalizerWithBuffer -{ - typedef wxScopedCharTypeBuffer CharBuffer; - - wxArgNormalizerWithBuffer() {} - wxArgNormalizerWithBuffer(const CharBuffer& buf, - const wxFormatString *fmt, - unsigned index) - : m_value(buf) - { - wxASSERT_ARG_TYPE( fmt, index, wxFormatString::Arg_String ); - } - - const CharType *get() const { return m_value; } - - CharBuffer m_value; -}; - -// string objects: -template<> -struct WXDLLIMPEXP_BASE wxArgNormalizerNative -{ - wxArgNormalizerNative(const wxString& s, - const wxFormatString *fmt, - unsigned index) - : m_value(s) - { - wxASSERT_ARG_TYPE( fmt, index, wxFormatString::Arg_String ); - } - - const wxStringCharType *get() const; - - const wxString& m_value; -}; - -// c_str() values: -template<> -struct WXDLLIMPEXP_BASE wxArgNormalizerNative -{ - wxArgNormalizerNative(const wxCStrData& value, - const wxFormatString *fmt, - unsigned index) - : m_value(value) - { - wxASSERT_ARG_TYPE( fmt, index, wxFormatString::Arg_String ); - } - - const wxStringCharType *get() const; - - const wxCStrData& m_value; -}; - -// wxString/wxCStrData conversion to wchar_t* value -#if wxUSE_UNICODE_UTF8 && !wxUSE_UTF8_LOCALE_ONLY -template<> -struct WXDLLIMPEXP_BASE wxArgNormalizerWchar - : public wxArgNormalizerWithBuffer -{ - wxArgNormalizerWchar(const wxString& s, - const wxFormatString *fmt, unsigned index); -}; - -template<> -struct WXDLLIMPEXP_BASE wxArgNormalizerWchar - : public wxArgNormalizerWithBuffer -{ - wxArgNormalizerWchar(const wxCStrData& s, - const wxFormatString *fmt, unsigned index); -}; -#endif // wxUSE_UNICODE_UTF8 && !wxUSE_UTF8_LOCALE_ONLY - - -// C string pointers of the wrong type (wchar_t* for ANSI or UTF8 build, -// char* for wchar_t Unicode build or UTF8): -#if wxUSE_UNICODE_WCHAR - -template<> -struct wxArgNormalizerWchar - : public wxArgNormalizerWithBuffer -{ - wxArgNormalizerWchar(const char* s, - const wxFormatString *fmt, unsigned index) - : wxArgNormalizerWithBuffer(wxConvLibc.cMB2WC(s), fmt, index) {} -}; - -#elif wxUSE_UNICODE_UTF8 - -template<> -struct wxArgNormalizerUtf8 - : public wxArgNormalizerWithBuffer -{ - wxArgNormalizerUtf8(const wchar_t* s, - const wxFormatString *fmt, unsigned index) - : wxArgNormalizerWithBuffer(wxConvUTF8.cWC2MB(s), fmt, index) {} -}; - -template<> -struct wxArgNormalizerUtf8 - : public wxArgNormalizerWithBuffer -{ - wxArgNormalizerUtf8(const char* s, - const wxFormatString *fmt, - unsigned index) - { - wxASSERT_ARG_TYPE( fmt, index, wxFormatString::Arg_String ); - - if ( wxLocaleIsUtf8 ) - { - m_value = wxScopedCharBuffer::CreateNonOwned(s); - } - else - { - // convert to widechar string first: - wxScopedWCharBuffer buf(wxConvLibc.cMB2WC(s)); - - // then to UTF-8: - if ( buf ) - m_value = wxConvUTF8.cWC2MB(buf); - } - } -}; - -// UTF-8 build needs conversion to wchar_t* too: -#if !wxUSE_UTF8_LOCALE_ONLY -template<> -struct wxArgNormalizerWchar - : public wxArgNormalizerWithBuffer -{ - wxArgNormalizerWchar(const char* s, - const wxFormatString *fmt, unsigned index) - : wxArgNormalizerWithBuffer(wxConvLibc.cMB2WC(s), fmt, index) {} -}; -#endif // !wxUSE_UTF8_LOCALE_ONLY - -#else // ANSI - FIXME-UTF8 - -template<> -struct wxArgNormalizerWchar - : public wxArgNormalizerWithBuffer -{ - wxArgNormalizerWchar(const wchar_t* s, - const wxFormatString *fmt, unsigned index) - : wxArgNormalizerWithBuffer(wxConvLibc.cWC2MB(s), fmt, index) {} -}; - -#endif // wxUSE_UNICODE_WCHAR/wxUSE_UNICODE_UTF8/ANSI - - -// this macro is used to implement specialization that are exactly same as -// some other specialization, i.e. to "forward" the implementation (e.g. for -// T=wxString and T=const wxString&). Note that the ctor takes BaseT argument, -// not T! -#if wxUSE_UNICODE_UTF8 - #if wxUSE_UTF8_LOCALE_ONLY - #define WX_ARG_NORMALIZER_FORWARD(T, BaseT) \ - _WX_ARG_NORMALIZER_FORWARD_IMPL(wxArgNormalizerUtf8, T, BaseT) - #else // possibly non-UTF8 locales - #define WX_ARG_NORMALIZER_FORWARD(T, BaseT) \ - _WX_ARG_NORMALIZER_FORWARD_IMPL(wxArgNormalizerWchar, T, BaseT); \ - _WX_ARG_NORMALIZER_FORWARD_IMPL(wxArgNormalizerUtf8, T, BaseT) - #endif -#else // wxUSE_UNICODE_WCHAR - #define WX_ARG_NORMALIZER_FORWARD(T, BaseT) \ - _WX_ARG_NORMALIZER_FORWARD_IMPL(wxArgNormalizerWchar, T, BaseT) -#endif // wxUSE_UNICODE_UTF8/wxUSE_UNICODE_WCHAR - -#define _WX_ARG_NORMALIZER_FORWARD_IMPL(Normalizer, T, BaseT) \ - template<> \ - struct Normalizer : public Normalizer \ - { \ - Normalizer(BaseT value, \ - const wxFormatString *fmt, unsigned index) \ - : Normalizer(value, fmt, index) {} \ - } - -// non-reference versions of specializations for string objects -WX_ARG_NORMALIZER_FORWARD(wxString, const wxString&); -WX_ARG_NORMALIZER_FORWARD(wxCStrData, const wxCStrData&); - -// versions for passing non-const pointers: -WX_ARG_NORMALIZER_FORWARD(char*, const char*); -WX_ARG_NORMALIZER_FORWARD(wchar_t*, const wchar_t*); - -// versions for passing wx[W]CharBuffer: -WX_ARG_NORMALIZER_FORWARD(wxScopedCharBuffer, const char*); -WX_ARG_NORMALIZER_FORWARD(const wxScopedCharBuffer&, const char*); -WX_ARG_NORMALIZER_FORWARD(wxScopedWCharBuffer, const wchar_t*); -WX_ARG_NORMALIZER_FORWARD(const wxScopedWCharBuffer&, const wchar_t*); -WX_ARG_NORMALIZER_FORWARD(wxCharBuffer, const char*); -WX_ARG_NORMALIZER_FORWARD(const wxCharBuffer&, const char*); -WX_ARG_NORMALIZER_FORWARD(wxWCharBuffer, const wchar_t*); -WX_ARG_NORMALIZER_FORWARD(const wxWCharBuffer&, const wchar_t*); - -// versions for std::[w]string: -#if wxUSE_STD_STRING - -#include "wx/stringimpl.h" - -#if !wxUSE_UTF8_LOCALE_ONLY -template<> -struct wxArgNormalizerWchar - : public wxArgNormalizerWchar -{ - wxArgNormalizerWchar(const std::string& s, - const wxFormatString *fmt, unsigned index) - : wxArgNormalizerWchar(s.c_str(), fmt, index) {} -}; - -template<> -struct wxArgNormalizerWchar - : public wxArgNormalizerWchar -{ - wxArgNormalizerWchar(const wxStdWideString& s, - const wxFormatString *fmt, unsigned index) - : wxArgNormalizerWchar(s.c_str(), fmt, index) {} -}; -#endif // !wxUSE_UTF8_LOCALE_ONLY - -#if wxUSE_UNICODE_UTF8 -template<> -struct wxArgNormalizerUtf8 - : public wxArgNormalizerUtf8 -{ - wxArgNormalizerUtf8(const std::string& s, - const wxFormatString *fmt, unsigned index) - : wxArgNormalizerUtf8(s.c_str(), fmt, index) {} -}; - -template<> -struct wxArgNormalizerUtf8 - : public wxArgNormalizerUtf8 -{ - wxArgNormalizerUtf8(const wxStdWideString& s, - const wxFormatString *fmt, unsigned index) - : wxArgNormalizerUtf8(s.c_str(), fmt, index) {} -}; -#endif // wxUSE_UNICODE_UTF8 - -WX_ARG_NORMALIZER_FORWARD(std::string, const std::string&); -WX_ARG_NORMALIZER_FORWARD(wxStdWideString, const wxStdWideString&); - -#endif // wxUSE_STD_STRING - - -// versions for wxUniChar, wxUniCharRef: -// (this is same for UTF-8 and Wchar builds, we just convert to wchar_t) -template<> -struct wxArgNormalizer : public wxArgNormalizer -{ - wxArgNormalizer(const wxUniChar& s, - const wxFormatString *fmt, unsigned index) - : wxArgNormalizer(s.GetValue(), fmt, index) {} -}; - -// for wchar_t, default handler does the right thing - -// char has to be treated differently in Unicode builds: a char argument may -// be used either for a character value (which should be converted into -// wxUniChar) or as an integer value (which should be left as-is). We take -// advantage of the fact that both char and wchar_t are converted into int -// in variadic arguments here. -#if wxUSE_UNICODE -template -struct wxArgNormalizerNarrowChar -{ - wxArgNormalizerNarrowChar(T value, - const wxFormatString *fmt, unsigned index) - { - wxASSERT_ARG_TYPE( fmt, index, - wxFormatString::Arg_Char | wxFormatString::Arg_Int ); - - // FIXME-UTF8: which one is better default in absence of fmt string - // (i.e. when used like e.g. Foo("foo", "bar", 'c', NULL)? - if ( !fmt || fmt->GetArgumentType(index) == wxFormatString::Arg_Char ) - m_value = wx_truncate_cast(T, wxUniChar(value).GetValue()); - else - m_value = value; - } - - int get() const { return m_value; } - - T m_value; -}; - -template<> -struct wxArgNormalizer : public wxArgNormalizerNarrowChar -{ - wxArgNormalizer(char value, - const wxFormatString *fmt, unsigned index) - : wxArgNormalizerNarrowChar(value, fmt, index) {} -}; - -template<> -struct wxArgNormalizer - : public wxArgNormalizerNarrowChar -{ - wxArgNormalizer(unsigned char value, - const wxFormatString *fmt, unsigned index) - : wxArgNormalizerNarrowChar(value, fmt, index) {} -}; - -template<> -struct wxArgNormalizer - : public wxArgNormalizerNarrowChar -{ - wxArgNormalizer(signed char value, - const wxFormatString *fmt, unsigned index) - : wxArgNormalizerNarrowChar(value, fmt, index) {} -}; - -#endif // wxUSE_UNICODE - -// convert references: -WX_ARG_NORMALIZER_FORWARD(wxUniChar, const wxUniChar&); -WX_ARG_NORMALIZER_FORWARD(const wxUniCharRef&, const wxUniChar&); -WX_ARG_NORMALIZER_FORWARD(wxUniCharRef, const wxUniChar&); -WX_ARG_NORMALIZER_FORWARD(const wchar_t&, wchar_t); - -WX_ARG_NORMALIZER_FORWARD(const char&, char); -WX_ARG_NORMALIZER_FORWARD(const unsigned char&, unsigned char); -WX_ARG_NORMALIZER_FORWARD(const signed char&, signed char); - - -#undef WX_ARG_NORMALIZER_FORWARD -#undef _WX_ARG_NORMALIZER_FORWARD_IMPL - -// NB: Don't #undef wxASSERT_ARG_TYPE here as it's also used in wx/longlong.h. - -// ---------------------------------------------------------------------------- -// WX_VA_ARG_STRING -// ---------------------------------------------------------------------------- - -// Replacement for va_arg() for use with strings in functions that accept -// strings normalized by wxArgNormalizer: - -struct WXDLLIMPEXP_BASE wxArgNormalizedString -{ - wxArgNormalizedString(const void* ptr) : m_ptr(ptr) {} - - // returns true if non-NULL string was passed in - bool IsValid() const { return m_ptr != NULL; } - operator bool() const { return IsValid(); } - - // extracts the string, returns empty string if NULL was passed in - wxString GetString() const; - operator wxString() const; - -private: - const void *m_ptr; -}; - -#define WX_VA_ARG_STRING(ap) wxArgNormalizedString(va_arg(ap, const void*)) - -// ---------------------------------------------------------------------------- -// implementation of the WX_DEFINE_VARARG_* macros -// ---------------------------------------------------------------------------- - -// NB: The vararg emulation code is limited to 30 variadic and 4 fixed -// arguments at the moment. -// If you need more variadic arguments, you need to -// 1) increase the value of _WX_VARARG_MAX_ARGS -// 2) add _WX_VARARG_JOIN_* and _WX_VARARG_ITER_* up to the new -// _WX_VARARG_MAX_ARGS value to the lists below -// If you need more fixed arguments, you need to -// 1) increase the value of _WX_VARARG_MAX_FIXED_ARGS -// 2) add _WX_VARARG_FIXED_EXPAND_* and _WX_VARARG_FIXED_UNUSED_EXPAND_* -// macros below -#define _WX_VARARG_MAX_ARGS 30 -#define _WX_VARARG_MAX_FIXED_ARGS 4 - -#define _WX_VARARG_JOIN_1(m) m(1) -#define _WX_VARARG_JOIN_2(m) _WX_VARARG_JOIN_1(m), m(2) -#define _WX_VARARG_JOIN_3(m) _WX_VARARG_JOIN_2(m), m(3) -#define _WX_VARARG_JOIN_4(m) _WX_VARARG_JOIN_3(m), m(4) -#define _WX_VARARG_JOIN_5(m) _WX_VARARG_JOIN_4(m), m(5) -#define _WX_VARARG_JOIN_6(m) _WX_VARARG_JOIN_5(m), m(6) -#define _WX_VARARG_JOIN_7(m) _WX_VARARG_JOIN_6(m), m(7) -#define _WX_VARARG_JOIN_8(m) _WX_VARARG_JOIN_7(m), m(8) -#define _WX_VARARG_JOIN_9(m) _WX_VARARG_JOIN_8(m), m(9) -#define _WX_VARARG_JOIN_10(m) _WX_VARARG_JOIN_9(m), m(10) -#define _WX_VARARG_JOIN_11(m) _WX_VARARG_JOIN_10(m), m(11) -#define _WX_VARARG_JOIN_12(m) _WX_VARARG_JOIN_11(m), m(12) -#define _WX_VARARG_JOIN_13(m) _WX_VARARG_JOIN_12(m), m(13) -#define _WX_VARARG_JOIN_14(m) _WX_VARARG_JOIN_13(m), m(14) -#define _WX_VARARG_JOIN_15(m) _WX_VARARG_JOIN_14(m), m(15) -#define _WX_VARARG_JOIN_16(m) _WX_VARARG_JOIN_15(m), m(16) -#define _WX_VARARG_JOIN_17(m) _WX_VARARG_JOIN_16(m), m(17) -#define _WX_VARARG_JOIN_18(m) _WX_VARARG_JOIN_17(m), m(18) -#define _WX_VARARG_JOIN_19(m) _WX_VARARG_JOIN_18(m), m(19) -#define _WX_VARARG_JOIN_20(m) _WX_VARARG_JOIN_19(m), m(20) -#define _WX_VARARG_JOIN_21(m) _WX_VARARG_JOIN_20(m), m(21) -#define _WX_VARARG_JOIN_22(m) _WX_VARARG_JOIN_21(m), m(22) -#define _WX_VARARG_JOIN_23(m) _WX_VARARG_JOIN_22(m), m(23) -#define _WX_VARARG_JOIN_24(m) _WX_VARARG_JOIN_23(m), m(24) -#define _WX_VARARG_JOIN_25(m) _WX_VARARG_JOIN_24(m), m(25) -#define _WX_VARARG_JOIN_26(m) _WX_VARARG_JOIN_25(m), m(26) -#define _WX_VARARG_JOIN_27(m) _WX_VARARG_JOIN_26(m), m(27) -#define _WX_VARARG_JOIN_28(m) _WX_VARARG_JOIN_27(m), m(28) -#define _WX_VARARG_JOIN_29(m) _WX_VARARG_JOIN_28(m), m(29) -#define _WX_VARARG_JOIN_30(m) _WX_VARARG_JOIN_29(m), m(30) - -#define _WX_VARARG_ITER_1(m,a,b,c,d,e,f) m(1,a,b,c,d,e,f) -#define _WX_VARARG_ITER_2(m,a,b,c,d,e,f) _WX_VARARG_ITER_1(m,a,b,c,d,e,f) m(2,a,b,c,d,e,f) -#define _WX_VARARG_ITER_3(m,a,b,c,d,e,f) _WX_VARARG_ITER_2(m,a,b,c,d,e,f) m(3,a,b,c,d,e,f) -#define _WX_VARARG_ITER_4(m,a,b,c,d,e,f) _WX_VARARG_ITER_3(m,a,b,c,d,e,f) m(4,a,b,c,d,e,f) -#define _WX_VARARG_ITER_5(m,a,b,c,d,e,f) _WX_VARARG_ITER_4(m,a,b,c,d,e,f) m(5,a,b,c,d,e,f) -#define _WX_VARARG_ITER_6(m,a,b,c,d,e,f) _WX_VARARG_ITER_5(m,a,b,c,d,e,f) m(6,a,b,c,d,e,f) -#define _WX_VARARG_ITER_7(m,a,b,c,d,e,f) _WX_VARARG_ITER_6(m,a,b,c,d,e,f) m(7,a,b,c,d,e,f) -#define _WX_VARARG_ITER_8(m,a,b,c,d,e,f) _WX_VARARG_ITER_7(m,a,b,c,d,e,f) m(8,a,b,c,d,e,f) -#define _WX_VARARG_ITER_9(m,a,b,c,d,e,f) _WX_VARARG_ITER_8(m,a,b,c,d,e,f) m(9,a,b,c,d,e,f) -#define _WX_VARARG_ITER_10(m,a,b,c,d,e,f) _WX_VARARG_ITER_9(m,a,b,c,d,e,f) m(10,a,b,c,d,e,f) -#define _WX_VARARG_ITER_11(m,a,b,c,d,e,f) _WX_VARARG_ITER_10(m,a,b,c,d,e,f) m(11,a,b,c,d,e,f) -#define _WX_VARARG_ITER_12(m,a,b,c,d,e,f) _WX_VARARG_ITER_11(m,a,b,c,d,e,f) m(12,a,b,c,d,e,f) -#define _WX_VARARG_ITER_13(m,a,b,c,d,e,f) _WX_VARARG_ITER_12(m,a,b,c,d,e,f) m(13,a,b,c,d,e,f) -#define _WX_VARARG_ITER_14(m,a,b,c,d,e,f) _WX_VARARG_ITER_13(m,a,b,c,d,e,f) m(14,a,b,c,d,e,f) -#define _WX_VARARG_ITER_15(m,a,b,c,d,e,f) _WX_VARARG_ITER_14(m,a,b,c,d,e,f) m(15,a,b,c,d,e,f) -#define _WX_VARARG_ITER_16(m,a,b,c,d,e,f) _WX_VARARG_ITER_15(m,a,b,c,d,e,f) m(16,a,b,c,d,e,f) -#define _WX_VARARG_ITER_17(m,a,b,c,d,e,f) _WX_VARARG_ITER_16(m,a,b,c,d,e,f) m(17,a,b,c,d,e,f) -#define _WX_VARARG_ITER_18(m,a,b,c,d,e,f) _WX_VARARG_ITER_17(m,a,b,c,d,e,f) m(18,a,b,c,d,e,f) -#define _WX_VARARG_ITER_19(m,a,b,c,d,e,f) _WX_VARARG_ITER_18(m,a,b,c,d,e,f) m(19,a,b,c,d,e,f) -#define _WX_VARARG_ITER_20(m,a,b,c,d,e,f) _WX_VARARG_ITER_19(m,a,b,c,d,e,f) m(20,a,b,c,d,e,f) -#define _WX_VARARG_ITER_21(m,a,b,c,d,e,f) _WX_VARARG_ITER_20(m,a,b,c,d,e,f) m(21,a,b,c,d,e,f) -#define _WX_VARARG_ITER_22(m,a,b,c,d,e,f) _WX_VARARG_ITER_21(m,a,b,c,d,e,f) m(22,a,b,c,d,e,f) -#define _WX_VARARG_ITER_23(m,a,b,c,d,e,f) _WX_VARARG_ITER_22(m,a,b,c,d,e,f) m(23,a,b,c,d,e,f) -#define _WX_VARARG_ITER_24(m,a,b,c,d,e,f) _WX_VARARG_ITER_23(m,a,b,c,d,e,f) m(24,a,b,c,d,e,f) -#define _WX_VARARG_ITER_25(m,a,b,c,d,e,f) _WX_VARARG_ITER_24(m,a,b,c,d,e,f) m(25,a,b,c,d,e,f) -#define _WX_VARARG_ITER_26(m,a,b,c,d,e,f) _WX_VARARG_ITER_25(m,a,b,c,d,e,f) m(26,a,b,c,d,e,f) -#define _WX_VARARG_ITER_27(m,a,b,c,d,e,f) _WX_VARARG_ITER_26(m,a,b,c,d,e,f) m(27,a,b,c,d,e,f) -#define _WX_VARARG_ITER_28(m,a,b,c,d,e,f) _WX_VARARG_ITER_27(m,a,b,c,d,e,f) m(28,a,b,c,d,e,f) -#define _WX_VARARG_ITER_29(m,a,b,c,d,e,f) _WX_VARARG_ITER_28(m,a,b,c,d,e,f) m(29,a,b,c,d,e,f) -#define _WX_VARARG_ITER_30(m,a,b,c,d,e,f) _WX_VARARG_ITER_29(m,a,b,c,d,e,f) m(30,a,b,c,d,e,f) - - -#define _WX_VARARG_FIXED_EXPAND_1(t1) \ - t1 f1 -#define _WX_VARARG_FIXED_EXPAND_2(t1,t2) \ - t1 f1, t2 f2 -#define _WX_VARARG_FIXED_EXPAND_3(t1,t2,t3) \ - t1 f1, t2 f2, t3 f3 -#define _WX_VARARG_FIXED_EXPAND_4(t1,t2,t3,t4) \ - t1 f1, t2 f2, t3 f3, t4 f4 - -#define _WX_VARARG_FIXED_UNUSED_EXPAND_1(t1) \ - t1 WXUNUSED(f1) -#define _WX_VARARG_FIXED_UNUSED_EXPAND_2(t1,t2) \ - t1 WXUNUSED(f1), t2 WXUNUSED(f2) -#define _WX_VARARG_FIXED_UNUSED_EXPAND_3(t1,t2,t3) \ - t1 WXUNUSED(f1), t2 WXUNUSED(f2), t3 WXUNUSED(f3) -#define _WX_VARARG_FIXED_UNUSED_EXPAND_4(t1,t2,t3,t4) \ - t1 WXUNUSED(f1), t2 WXUNUSED(f2), t3 WXUNUSED(f3), t4 WXUNUSED(f4) - -#define _WX_VARARG_FIXED_TYPEDEFS_1(t1) \ - typedef t1 TF1 -#define _WX_VARARG_FIXED_TYPEDEFS_2(t1,t2) \ - _WX_VARARG_FIXED_TYPEDEFS_1(t1); typedef t2 TF2 -#define _WX_VARARG_FIXED_TYPEDEFS_3(t1,t2,t3) \ - _WX_VARARG_FIXED_TYPEDEFS_2(t1,t2); typedef t3 TF3 -#define _WX_VARARG_FIXED_TYPEDEFS_4(t1,t2,t3,t4) \ - _WX_VARARG_FIXED_TYPEDEFS_3(t1,t2,t3); typedef t4 TF4 - -// This macro expands N-items tuple of fixed arguments types into part of -// function's declaration. For example, -// "_WX_VARARG_FIXED_EXPAND(3, (int, char*, int))" expands into -// "int f1, char* f2, int f3". -#define _WX_VARARG_FIXED_EXPAND(N, args) \ - _WX_VARARG_FIXED_EXPAND_IMPL(N, args) -#define _WX_VARARG_FIXED_EXPAND_IMPL(N, args) \ - _WX_VARARG_FIXED_EXPAND_##N args - -// Ditto for unused arguments -#define _WX_VARARG_FIXED_UNUSED_EXPAND(N, args) \ - _WX_VARARG_FIXED_UNUSED_EXPAND_IMPL(N, args) -#define _WX_VARARG_FIXED_UNUSED_EXPAND_IMPL(N, args) \ - _WX_VARARG_FIXED_UNUSED_EXPAND_##N args - -// Declarates typedefs for fixed arguments types; i-th fixed argument types -// will have TFi typedef. -#define _WX_VARARG_FIXED_TYPEDEFS(N, args) \ - _WX_VARARG_FIXED_TYPEDEFS_IMPL(N, args) -#define _WX_VARARG_FIXED_TYPEDEFS_IMPL(N, args) \ - _WX_VARARG_FIXED_TYPEDEFS_##N args - - -// This macro calls another macro 'm' passed as second argument 'N' times, -// with its only argument set to 1..N, and concatenates the results using -// comma as separator. -// -// An example: -// #define foo(i) x##i -// // this expands to "x1,x2,x3,x4" -// _WX_VARARG_JOIN(4, foo) -// -// -// N must not be greater than _WX_VARARG_MAX_ARGS (=30). -#define _WX_VARARG_JOIN(N, m) _WX_VARARG_JOIN_IMPL(N, m) -#define _WX_VARARG_JOIN_IMPL(N, m) _WX_VARARG_JOIN_##N(m) - - -// This macro calls another macro 'm' passed as second argument 'N' times, with -// its first argument set to 1..N and the remaining arguments set to 'a', 'b', -// 'c', 'd', 'e' and 'f'. The results are separated with whitespace in the -// expansion. -// -// An example: -// // this macro expands to: -// // foo(1,a,b,c,d,e,f) -// // foo(2,a,b,c,d,e,f) -// // foo(3,a,b,c,d,e,f) -// _WX_VARARG_ITER(3, foo, a, b, c, d, e, f) -// -// N must not be greater than _WX_VARARG_MAX_ARGS (=30). -#define _WX_VARARG_ITER(N,m,a,b,c,d,e,f) \ - _WX_VARARG_ITER_IMPL(N,m,a,b,c,d,e,f) -#define _WX_VARARG_ITER_IMPL(N,m,a,b,c,d,e,f) \ - _WX_VARARG_ITER_##N(m,a,b,c,d,e,f) - -// Generates code snippet for i-th "variadic" argument in vararg function's -// prototype: -#define _WX_VARARG_ARG(i) T##i a##i - -// Like _WX_VARARG_ARG_UNUSED, but outputs argument's type with WXUNUSED: -#define _WX_VARARG_ARG_UNUSED(i) T##i WXUNUSED(a##i) - -// Generates code snippet for i-th type in vararg function's template<...>: -#define _WX_VARARG_TEMPL(i) typename T##i - -// Generates code snippet for passing i-th argument of vararg function -// wrapper to its implementation, normalizing it in the process: -#define _WX_VARARG_PASS_WCHAR(i) \ - wxArgNormalizerWchar(a##i, fmt, i).get() -#define _WX_VARARG_PASS_UTF8(i) \ - wxArgNormalizerUtf8(a##i, fmt, i).get() - - -// And the same for fixed arguments, _not_ normalizing it: -#define _WX_VARARG_PASS_FIXED(i) f##i - -#define _WX_VARARG_FIND_FMT(i) \ - (wxFormatStringArgumentFinder::find(f##i)) - -#define _WX_VARARG_FORMAT_STRING(numfixed, fixed) \ - _WX_VARARG_FIXED_TYPEDEFS(numfixed, fixed); \ - const wxFormatString *fmt = \ - (_WX_VARARG_JOIN(numfixed, _WX_VARARG_FIND_FMT)) - -#if wxUSE_UNICODE_UTF8 - #define _WX_VARARG_DO_CALL_UTF8(return_kw, impl, implUtf8, N, numfixed) \ - return_kw implUtf8(_WX_VARARG_JOIN(numfixed, _WX_VARARG_PASS_FIXED), \ - _WX_VARARG_JOIN(N, _WX_VARARG_PASS_UTF8)) - #define _WX_VARARG_DO_CALL0_UTF8(return_kw, impl, implUtf8, numfixed) \ - return_kw implUtf8(_WX_VARARG_JOIN(numfixed, _WX_VARARG_PASS_FIXED)) -#endif // wxUSE_UNICODE_UTF8 - -#define _WX_VARARG_DO_CALL_WCHAR(return_kw, impl, implUtf8, N, numfixed) \ - return_kw impl(_WX_VARARG_JOIN(numfixed, _WX_VARARG_PASS_FIXED), \ - _WX_VARARG_JOIN(N, _WX_VARARG_PASS_WCHAR)) -#define _WX_VARARG_DO_CALL0_WCHAR(return_kw, impl, implUtf8, numfixed) \ - return_kw impl(_WX_VARARG_JOIN(numfixed, _WX_VARARG_PASS_FIXED)) - -#if wxUSE_UNICODE_UTF8 - #if wxUSE_UTF8_LOCALE_ONLY - #define _WX_VARARG_DO_CALL _WX_VARARG_DO_CALL_UTF8 - #define _WX_VARARG_DO_CALL0 _WX_VARARG_DO_CALL0_UTF8 - #else // possibly non-UTF8 locales - #define _WX_VARARG_DO_CALL(return_kw, impl, implUtf8, N, numfixed) \ - if ( wxLocaleIsUtf8 ) \ - _WX_VARARG_DO_CALL_UTF8(return_kw, impl, implUtf8, N, numfixed);\ - else \ - _WX_VARARG_DO_CALL_WCHAR(return_kw, impl, implUtf8, N, numfixed) - - #define _WX_VARARG_DO_CALL0(return_kw, impl, implUtf8, numfixed) \ - if ( wxLocaleIsUtf8 ) \ - _WX_VARARG_DO_CALL0_UTF8(return_kw, impl, implUtf8, numfixed); \ - else \ - _WX_VARARG_DO_CALL0_WCHAR(return_kw, impl, implUtf8, numfixed) - #endif // wxUSE_UTF8_LOCALE_ONLY or not -#else // wxUSE_UNICODE_WCHAR or ANSI - #define _WX_VARARG_DO_CALL _WX_VARARG_DO_CALL_WCHAR - #define _WX_VARARG_DO_CALL0 _WX_VARARG_DO_CALL0_WCHAR -#endif // wxUSE_UNICODE_UTF8 / wxUSE_UNICODE_WCHAR - - -// Macro to be used with _WX_VARARG_ITER in the implementation of -// WX_DEFINE_VARARG_FUNC (see its documentation for the meaning of arguments) -#define _WX_VARARG_DEFINE_FUNC(N, rettype, name, \ - impl, implUtf8, numfixed, fixed) \ - template<_WX_VARARG_JOIN(N, _WX_VARARG_TEMPL)> \ - rettype name(_WX_VARARG_FIXED_EXPAND(numfixed, fixed), \ - _WX_VARARG_JOIN(N, _WX_VARARG_ARG)) \ - { \ - _WX_VARARG_FORMAT_STRING(numfixed, fixed); \ - _WX_VARARG_DO_CALL(return, impl, implUtf8, N, numfixed); \ - } - -#define _WX_VARARG_DEFINE_FUNC_N0(rettype, name, \ - impl, implUtf8, numfixed, fixed) \ - inline rettype name(_WX_VARARG_FIXED_EXPAND(numfixed, fixed)) \ - { \ - _WX_VARARG_DO_CALL0(return, impl, implUtf8, numfixed); \ - } - -// Macro to be used with _WX_VARARG_ITER in the implementation of -// WX_DEFINE_VARARG_FUNC_VOID (see its documentation for the meaning of -// arguments; rettype is ignored and is used only to satisfy _WX_VARARG_ITER's -// requirements). -#define _WX_VARARG_DEFINE_FUNC_VOID(N, rettype, name, \ - impl, implUtf8, numfixed, fixed) \ - template<_WX_VARARG_JOIN(N, _WX_VARARG_TEMPL)> \ - void name(_WX_VARARG_FIXED_EXPAND(numfixed, fixed), \ - _WX_VARARG_JOIN(N, _WX_VARARG_ARG)) \ - { \ - _WX_VARARG_FORMAT_STRING(numfixed, fixed); \ - _WX_VARARG_DO_CALL(wxEMPTY_PARAMETER_VALUE, \ - impl, implUtf8, N, numfixed); \ - } - -#define _WX_VARARG_DEFINE_FUNC_VOID_N0(name, impl, implUtf8, numfixed, fixed) \ - inline void name(_WX_VARARG_FIXED_EXPAND(numfixed, fixed)) \ - { \ - _WX_VARARG_DO_CALL0(wxEMPTY_PARAMETER_VALUE, \ - impl, implUtf8, numfixed); \ - } - -// Macro to be used with _WX_VARARG_ITER in the implementation of -// WX_DEFINE_VARARG_FUNC_CTOR (see its documentation for the meaning of -// arguments; rettype is ignored and is used only to satisfy _WX_VARARG_ITER's -// requirements). -#define _WX_VARARG_DEFINE_FUNC_CTOR(N, rettype, name, \ - impl, implUtf8, numfixed, fixed) \ - template<_WX_VARARG_JOIN(N, _WX_VARARG_TEMPL)> \ - name(_WX_VARARG_FIXED_EXPAND(numfixed, fixed), \ - _WX_VARARG_JOIN(N, _WX_VARARG_ARG)) \ - { \ - _WX_VARARG_FORMAT_STRING(numfixed, fixed); \ - _WX_VARARG_DO_CALL(wxEMPTY_PARAMETER_VALUE, \ - impl, implUtf8, N, numfixed); \ - } - -#define _WX_VARARG_DEFINE_FUNC_CTOR_N0(name, impl, implUtf8, numfixed, fixed) \ - inline name(_WX_VARARG_FIXED_EXPAND(numfixed, fixed)) \ - { \ - _WX_VARARG_DO_CALL0(wxEMPTY_PARAMETER_VALUE, \ - impl, implUtf8, numfixed); \ - } - -// Macro to be used with _WX_VARARG_ITER in the implementation of -// WX_DEFINE_VARARG_FUNC_NOP, i.e. empty stub for a disabled vararg function. -// The rettype and impl arguments are ignored. -#define _WX_VARARG_DEFINE_FUNC_NOP(N, rettype, name, \ - impl, implUtf8, numfixed, fixed) \ - template<_WX_VARARG_JOIN(N, _WX_VARARG_TEMPL)> \ - void name(_WX_VARARG_FIXED_UNUSED_EXPAND(numfixed, fixed), \ - _WX_VARARG_JOIN(N, _WX_VARARG_ARG_UNUSED)) \ - {} - -#define _WX_VARARG_DEFINE_FUNC_NOP_N0(name, numfixed, fixed) \ - inline void name(_WX_VARARG_FIXED_UNUSED_EXPAND(numfixed, fixed)) \ - {} - - -// ---------------------------------------------------------------------------- -// workaround for OpenWatcom bug #351 -// ---------------------------------------------------------------------------- - -#ifdef __WATCOMC__ -// workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351 - -// This macro can be used to forward a 'vararg' template to another one with -// different fixed arguments types. Parameters are same as for -// WX_DEFINE_VARARG_FUNC (rettype=void can be used here), 'convfixed' is how -// to convert fixed arguments. For example, this is typical code for dealing -// with different forms of format string: -// -// WX_DEFINE_VARARG_FUNC_VOID(Printf, 1, (const wxFormatString&), -// DoPrintfWchar, DoPrintfUtf8) -// #ifdef __WATCOMC__ -// WX_VARARG_WATCOM_WORKAROUND(void, Printf, 1, (const wxString&), -// (wxFormatString(f1))) -// WX_VARARG_WATCOM_WORKAROUND(void, Printf, 1, (const char*), -// (wxFormatString(f1))) -// ... -#define WX_VARARG_WATCOM_WORKAROUND(rettype, name, numfixed, fixed, convfixed)\ - _WX_VARARG_ITER(_WX_VARARG_MAX_ARGS, \ - _WX_VARARG_WATCOM_WORKAROUND, \ - rettype, name, convfixed, dummy, numfixed, fixed) - -#define WX_VARARG_WATCOM_WORKAROUND_CTOR(name, numfixed, fixed, convfixed) \ - _WX_VARARG_ITER(_WX_VARARG_MAX_ARGS, \ - _WX_VARARG_WATCOM_WORKAROUND_CTOR, \ - dummy, name, convfixed, dummy, numfixed, fixed) - -#define _WX_VARARG_WATCOM_UNPACK_1(a1) a1 -#define _WX_VARARG_WATCOM_UNPACK_2(a1, a2) a1, a2 -#define _WX_VARARG_WATCOM_UNPACK_3(a1, a2, a3) a1, a2, a3 -#define _WX_VARARG_WATCOM_UNPACK_4(a1, a2, a3, a4) a1, a2, a3, a4 -#define _WX_VARARG_WATCOM_UNPACK(N, convfixed) \ - _WX_VARARG_WATCOM_UNPACK_##N convfixed - -#define _WX_VARARG_PASS_WATCOM(i) a##i - -#define _WX_VARARG_WATCOM_WORKAROUND(N, rettype, name, \ - convfixed, dummy, numfixed, fixed) \ - template<_WX_VARARG_JOIN(N, _WX_VARARG_TEMPL)> \ - rettype name(_WX_VARARG_FIXED_EXPAND(numfixed, fixed), \ - _WX_VARARG_JOIN(N, _WX_VARARG_ARG)) \ - { \ - return name(_WX_VARARG_WATCOM_UNPACK(numfixed, convfixed), \ - _WX_VARARG_JOIN(N, _WX_VARARG_PASS_WATCOM)); \ - } - -#define _WX_VARARG_WATCOM_WORKAROUND_CTOR(N, dummy1, name, \ - convfixed, dummy2, numfixed, fixed) \ - template<_WX_VARARG_JOIN(N, _WX_VARARG_TEMPL)> \ - name(_WX_VARARG_FIXED_EXPAND(numfixed, fixed), \ - _WX_VARARG_JOIN(N, _WX_VARARG_ARG)) \ - { \ - name(_WX_VARARG_WATCOM_UNPACK(numfixed, convfixed), \ - _WX_VARARG_JOIN(N, _WX_VARARG_PASS_WATCOM)); \ - } - -#endif // __WATCOMC__ - -#endif // _WX_STRVARARG_H_ diff --git a/Source/3rd Party/wx/include/wx/sysopt.h b/Source/3rd Party/wx/include/wx/sysopt.h index 11e5de560..5c79a5478 100644 --- a/Source/3rd Party/wx/include/wx/sysopt.h +++ b/Source/3rd Party/wx/include/wx/sysopt.h @@ -1,10 +1,10 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/sysopt.h +// Name: sysopt.h // Purpose: wxSystemOptions // Author: Julian Smart // Modified by: // Created: 2001-07-10 -// RCS-ID: $Id$ +// RCS-ID: $Id: sysopt.h 33004 2005-03-23 20:48:50Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -18,11 +18,7 @@ // Enables an application to influence the wxWidgets implementation // ---------------------------------------------------------------------------- -class -#if wxUSE_SYSTEM_OPTIONS -WXDLLIMPEXP_BASE -#endif -wxSystemOptions : public wxObject +class WXDLLIMPEXP_BASE wxSystemOptions : public wxObject { public: wxSystemOptions() { } diff --git a/Source/3rd Party/wx/include/wx/tarstrm.h b/Source/3rd Party/wx/include/wx/tarstrm.h index 05a27bbbb..c18400225 100644 --- a/Source/3rd Party/wx/include/wx/tarstrm.h +++ b/Source/3rd Party/wx/include/wx/tarstrm.h @@ -2,7 +2,7 @@ // Name: wx/tarstrm.h // Purpose: Streams for Tar files // Author: Mike Wetherell -// RCS-ID: $Id$ +// RCS-ID: $Id: tarstrm.h 43887 2006-12-09 22:28:11Z MW $ // Copyright: (c) 2004 Mike Wetherell // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -22,8 +22,7 @@ // Constants // TypeFlag values -enum wxTarType -{ +enum { wxTAR_REGTYPE = '0', // regular file wxTAR_LNKTYPE = '1', // hard link wxTAR_SYMTYPE = '2', // symbolic link @@ -200,7 +199,7 @@ private: wxTarHeaderRecords *m_HeaderRecs; wxTarHeaderRecords *m_GlobalHeaderRecs; - wxDECLARE_NO_COPY_CLASS(wxTarInputStream); + DECLARE_NO_COPY_CLASS(wxTarInputStream) }; @@ -281,9 +280,8 @@ private: char *m_extendedHdr; size_t m_extendedSize; wxString m_badfit; - bool m_endrecWritten; - wxDECLARE_NO_COPY_CLASS(wxTarOutputStream); + DECLARE_NO_COPY_CLASS(wxTarOutputStream) }; diff --git a/Source/3rd Party/wx/include/wx/tbarbase.h b/Source/3rd Party/wx/include/wx/tbarbase.h index 5187250bd..1c0814955 100644 --- a/Source/3rd Party/wx/include/wx/tbarbase.h +++ b/Source/3rd Party/wx/include/wx/tbarbase.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: tbarbase.h 61872 2009-09-09 22:37:05Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -32,9 +32,9 @@ class WXDLLIMPEXP_FWD_CORE wxImage; // constants // ---------------------------------------------------------------------------- -extern WXDLLIMPEXP_DATA_CORE(const char) wxToolBarNameStr[]; -extern WXDLLIMPEXP_DATA_CORE(const wxSize) wxDefaultSize; -extern WXDLLIMPEXP_DATA_CORE(const wxPoint) wxDefaultPosition; +extern WXDLLEXPORT_DATA(const wxChar) wxToolBarNameStr[]; +extern WXDLLEXPORT_DATA(const wxSize) wxDefaultSize; +extern WXDLLEXPORT_DATA(const wxPoint) wxDefaultPosition; enum wxToolBarToolStyle { @@ -54,54 +54,58 @@ enum wxToolBarToolStyle // for the applications status bar. // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxToolBarToolBase : public wxObject +class WXDLLEXPORT wxToolBarToolBase : public wxObject { public: // ctors & dtor // ------------ - // generic ctor for any kind of tool - wxToolBarToolBase(wxToolBarBase *tbar = NULL, + wxToolBarToolBase(wxToolBarBase *tbar = (wxToolBarBase *)NULL, int toolid = wxID_SEPARATOR, const wxString& label = wxEmptyString, const wxBitmap& bmpNormal = wxNullBitmap, const wxBitmap& bmpDisabled = wxNullBitmap, wxItemKind kind = wxITEM_NORMAL, - wxObject *clientData = NULL, + wxObject *clientData = (wxObject *) NULL, const wxString& shortHelpString = wxEmptyString, const wxString& longHelpString = wxEmptyString) : m_label(label), m_shortHelpString(shortHelpString), m_longHelpString(longHelpString) { - Init - ( - tbar, - toolid == wxID_SEPARATOR ? wxTOOL_STYLE_SEPARATOR - : wxTOOL_STYLE_BUTTON, - toolid == wxID_ANY ? wxWindow::NewControlId() - : toolid, - kind - ); - + m_tbar = tbar; + m_id = toolid; + if (m_id == wxID_ANY) + m_id = wxNewId(); m_clientData = clientData; m_bmpNormal = bmpNormal; m_bmpDisabled = bmpDisabled; + + m_kind = kind; + + m_enabled = true; + m_toggled = false; + + m_toolStyle = toolid == wxID_SEPARATOR ? wxTOOL_STYLE_SEPARATOR + : wxTOOL_STYLE_BUTTON; } - // ctor for controls only - wxToolBarToolBase(wxToolBarBase *tbar, - wxControl *control, - const wxString& label) - : m_label(label) + wxToolBarToolBase(wxToolBarBase *tbar, wxControl *control) { - Init(tbar, wxTOOL_STYLE_CONTROL, control->GetId(), wxITEM_MAX); - + m_tbar = tbar; m_control = control; + m_id = control->GetId(); + + m_kind = wxITEM_MAX; // invalid value + + m_enabled = true; + m_toggled = false; + + m_toolStyle = wxTOOL_STYLE_CONTROL; } - virtual ~wxToolBarToolBase(); + virtual ~wxToolBarToolBase(){} // accessors // --------- @@ -118,12 +122,10 @@ public: wxToolBarBase *GetToolBar() const { return m_tbar; } - // style/kind - bool IsStretchable() const { return m_stretchable; } + // style bool IsButton() const { return m_toolStyle == wxTOOL_STYLE_BUTTON; } bool IsControl() const { return m_toolStyle == wxTOOL_STYLE_CONTROL; } bool IsSeparator() const { return m_toolStyle == wxTOOL_STYLE_SEPARATOR; } - bool IsStretchableSpace() const { return IsSeparator() && IsStretchable(); } int GetStyle() const { return m_toolStyle; } wxItemKind GetKind() const { @@ -132,13 +134,6 @@ public: return m_kind; } - void MakeStretchable() - { - wxASSERT_MSG( IsSeparator(), "only separators can be stretchable" ); - - m_stretchable = true; - } - // state bool IsEnabled() const { return m_enabled; } bool IsToggled() const { return m_toggled; } @@ -170,16 +165,16 @@ public: } // modifiers: return true if the state really changed - virtual bool Enable(bool enable); - virtual bool Toggle(bool toggle); - virtual bool SetToggle(bool toggle); - virtual bool SetShortHelp(const wxString& help); - virtual bool SetLongHelp(const wxString& help); + bool Enable(bool enable); + bool Toggle(bool toggle); + bool SetToggle(bool toggle); + bool SetShortHelp(const wxString& help); + bool SetLongHelp(const wxString& help); void Toggle() { Toggle(!IsToggled()); } - virtual void SetNormalBitmap(const wxBitmap& bmp) { m_bmpNormal = bmp; } - virtual void SetDisabledBitmap(const wxBitmap& bmp) { m_bmpDisabled = bmp; } + void SetNormalBitmap(const wxBitmap& bmp) { m_bmpNormal = bmp; } + void SetDisabledBitmap(const wxBitmap& bmp) { m_bmpDisabled = bmp; } virtual void SetLabel(const wxString& label) { m_label = label; } @@ -196,45 +191,15 @@ public: } // add tool to/remove it from a toolbar - virtual void Detach() { m_tbar = NULL; } + virtual void Detach() { m_tbar = (wxToolBarBase *)NULL; } virtual void Attach(wxToolBarBase *tbar) { m_tbar = tbar; } -#if wxUSE_MENUS - // these methods are only for tools of wxITEM_DROPDOWN kind (but even such - // tools can have a NULL associated menu) - virtual void SetDropdownMenu(wxMenu *menu); - wxMenu *GetDropdownMenu() const { return m_dropdownMenu; } -#endif - protected: - // common part of all ctors - void Init(wxToolBarBase *tbar, - wxToolBarToolStyle style, - int toolid, - wxItemKind kind) - { - m_tbar = tbar; - m_toolStyle = style; - m_id = toolid; - m_kind = kind; - - m_clientData = NULL; - - m_stretchable = false; - m_toggled = false; - m_enabled = true; - -#if wxUSE_MENUS - m_dropdownMenu = NULL; -#endif - - } - wxToolBarBase *m_tbar; // the toolbar to which we belong (may be NULL) // tool parameters - wxToolBarToolStyle m_toolStyle; - wxWindowIDRef m_id; // the tool id, wxID_SEPARATOR for separator + int m_toolStyle; // see enum wxToolBarToolStyle + int m_id; // the tool id, wxID_SEPARATOR for separator wxItemKind m_kind; // for normal buttons may be wxITEM_NORMAL/CHECK/RADIO // as controls have their own client data, no need to waste memory @@ -244,9 +209,6 @@ protected: wxControl *m_control; }; - // true if this tool is stretchable: currently is only value for separators - bool m_stretchable; - // tool state bool m_toggled; bool m_enabled; @@ -262,10 +224,6 @@ protected: wxString m_shortHelpString; wxString m_longHelpString; -#if wxUSE_MENUS - wxMenu *m_dropdownMenu; -#endif - DECLARE_DYNAMIC_CLASS_NO_COPY(wxToolBarToolBase) }; @@ -276,7 +234,7 @@ WX_DECLARE_EXPORTED_LIST(wxToolBarToolBase, wxToolBarToolsList); // the base class for all toolbars // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxToolBarBase : public wxControl +class WXDLLEXPORT wxToolBarBase : public wxControl { public: wxToolBarBase(); @@ -358,17 +316,13 @@ public: virtual wxToolBarToolBase *AddTool (wxToolBarToolBase *tool); virtual wxToolBarToolBase *InsertTool (size_t pos, wxToolBarToolBase *tool); - // add an arbitrary control to the toolbar (notice that the control will be - // deleted by the toolbar and that it will also adjust its position/size) + // add an arbitrary control to the toolbar (notice that + // the control will be deleted by the toolbar and that it will also adjust + // its position/size) // - // the label is optional and, if specified, will be shown near the control // NB: the control should have toolbar as its parent - virtual wxToolBarToolBase * - AddControl(wxControl *control, const wxString& label = wxEmptyString); - - virtual wxToolBarToolBase * - InsertControl(size_t pos, wxControl *control, - const wxString& label = wxEmptyString); + virtual wxToolBarToolBase *AddControl(wxControl *control); + virtual wxToolBarToolBase *InsertControl(size_t pos, wxControl *control); // get the control with the given id or return NULL virtual wxControl *FindControl( int toolid ); @@ -377,12 +331,6 @@ public: virtual wxToolBarToolBase *AddSeparator(); virtual wxToolBarToolBase *InsertSeparator(size_t pos); - // add a stretchable space to the toolbar: this is similar to a separator - // except that it's always blank and that all the extra space the toolbar - // has is [equally] distributed among the stretchable spaces in it - virtual wxToolBarToolBase *AddStretchableSpace(); - virtual wxToolBarToolBase *InsertStretchableSpace(size_t pos); - // remove the tool from the toolbar: the caller is responsible for actually // deleting the pointer virtual wxToolBarToolBase *RemoveTool(int toolid); @@ -396,9 +344,6 @@ public: // must be called after all buttons have been created to finish toolbar // initialisation - // - // derived class versions should call the base one first, before doing - // platform-specific stuff virtual bool Realize(); // tools state @@ -427,12 +372,6 @@ public: virtual void SetToolLongHelp(int toolid, const wxString& helpString); virtual wxString GetToolLongHelp(int toolid) const; - virtual void SetToolNormalBitmap(int WXUNUSED(id), - const wxBitmap& WXUNUSED(bitmap)) {} - virtual void SetToolDisabledBitmap(int WXUNUSED(id), - const wxBitmap& WXUNUSED(bitmap)) {} - - // margins/packing/separation // -------------------------- @@ -473,7 +412,7 @@ public: { return GetToolBitmapSize(); } // returns a (non separator) tool containing the point (x, y) or NULL if - // there is no tool at this point (coordinates are client) + // there is no tool at this point (corrdinates are client) virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const = 0; @@ -481,17 +420,13 @@ public: wxToolBarToolBase *FindById(int toolid) const; // return true if this is a vertical toolbar, otherwise false - bool IsVertical() const; + bool IsVertical() const { return HasFlag(wxTB_LEFT | wxTB_RIGHT); } - // these methods allow to access tools by their index in the toolbar - size_t GetToolsCount() const { return m_tools.GetCount(); } - const wxToolBarToolBase *GetToolByPos(int pos) const { return m_tools[pos]; } -#if WXWIN_COMPATIBILITY_2_8 // the old versions of the various methods kept for compatibility // don't use in the new code! // -------------------------------------------------------------- - wxDEPRECATED_INLINE( + wxToolBarToolBase *AddTool(int toolid, const wxBitmap& bitmap, const wxBitmap& bmpDisabled, @@ -499,23 +434,23 @@ public: wxObject *clientData = NULL, const wxString& shortHelpString = wxEmptyString, const wxString& longHelpString = wxEmptyString) - , + { return AddTool(toolid, wxEmptyString, bitmap, bmpDisabled, toggle ? wxITEM_CHECK : wxITEM_NORMAL, shortHelpString, longHelpString, clientData); - ) - wxDEPRECATED_INLINE( + } + wxToolBarToolBase *AddTool(int toolid, const wxBitmap& bitmap, const wxString& shortHelpString = wxEmptyString, const wxString& longHelpString = wxEmptyString) - , + { return AddTool(toolid, wxEmptyString, bitmap, wxNullBitmap, wxITEM_NORMAL, shortHelpString, longHelpString, NULL); - ) - wxDEPRECATED_INLINE( + } + wxToolBarToolBase *AddTool(int toolid, const wxBitmap& bitmap, const wxBitmap& bmpDisabled, @@ -525,12 +460,12 @@ public: wxObject *clientData = NULL, const wxString& shortHelp = wxEmptyString, const wxString& longHelp = wxEmptyString) - , + { return DoAddTool(toolid, wxEmptyString, bitmap, bmpDisabled, toggle ? wxITEM_CHECK : wxITEM_NORMAL, shortHelp, longHelp, clientData, xPos, yPos); - ) - wxDEPRECATED_INLINE( + } + wxToolBarToolBase *InsertTool(size_t pos, int toolid, const wxBitmap& bitmap, @@ -539,12 +474,11 @@ public: wxObject *clientData = NULL, const wxString& shortHelp = wxEmptyString, const wxString& longHelp = wxEmptyString) - , + { return InsertTool(pos, toolid, wxEmptyString, bitmap, bmpDisabled, toggle ? wxITEM_CHECK : wxITEM_NORMAL, shortHelp, longHelp, clientData); - ) -#endif // WXWIN_COMPATIBILITY_2_8 + } // event handlers // -------------- @@ -567,47 +501,17 @@ public: // use GetToolMargins() instead wxSize GetMargins() const { return GetToolMargins(); } - // Tool factories, - // helper functions to create toolbar tools - // ------------------------- - virtual wxToolBarToolBase *CreateTool(int toolid, - const wxString& label, - const wxBitmap& bmpNormal, - const wxBitmap& bmpDisabled = wxNullBitmap, - wxItemKind kind = wxITEM_NORMAL, - wxObject *clientData = NULL, - const wxString& shortHelp = wxEmptyString, - const wxString& longHelp = wxEmptyString) = 0; - - virtual wxToolBarToolBase *CreateTool(wxControl *control, - const wxString& label) = 0; - - // this one is not virtual but just a simple helper/wrapper around - // CreateTool() for separators - wxToolBarToolBase *CreateSeparator() - { - return CreateTool(wxID_SEPARATOR, - wxEmptyString, - wxNullBitmap, wxNullBitmap, - wxITEM_SEPARATOR, NULL, - wxEmptyString, wxEmptyString); - } - - // implementation only from now on // ------------------------------- + size_t GetToolsCount() const { return m_tools.GetCount(); } + // Do the toolbar button updates (check for EVT_UPDATE_UI handlers) virtual void UpdateWindowUI(long flags = wxUPDATE_UI_NONE) ; // don't want toolbars to accept the focus virtual bool AcceptsFocus() const { return false; } -#if wxUSE_MENUS - // Set dropdown menu - bool SetDropdownMenu(int toolid, wxMenu *menu); -#endif - protected: // to implement in derived classes // ------------------------------- @@ -645,6 +549,17 @@ protected: // called when the tools "can be toggled" flag changes virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle) = 0; + // the functions to create toolbar tools + virtual wxToolBarToolBase *CreateTool(int toolid, + const wxString& label, + const wxBitmap& bmpNormal, + const wxBitmap& bmpDisabled, + wxItemKind kind, + wxObject *clientData, + const wxString& shortHelp, + const wxString& longHelp) = 0; + + virtual wxToolBarToolBase *CreateTool(wxControl *control) = 0; // helper functions // ---------------- @@ -659,21 +574,6 @@ protected: // un-toggle all buttons in the same radio group void UnToggleRadioGroup(wxToolBarToolBase *tool); - // make the size of the buttons big enough to fit the largest bitmap size - void AdjustToolBitmapSize(); - - // calls InsertTool() and deletes the tool if inserting it failed - wxToolBarToolBase *DoInsertNewTool(size_t pos, wxToolBarToolBase *tool) - { - if ( !InsertTool(pos, tool) ) - { - delete tool; - return NULL; - } - - return tool; - } - // the list of all our tools wxToolBarToolsList m_tools; @@ -694,17 +594,11 @@ protected: private: DECLARE_EVENT_TABLE() - wxDECLARE_NO_COPY_CLASS(wxToolBarBase); + DECLARE_NO_COPY_CLASS(wxToolBarBase) }; -// deprecated function for creating the image for disabled buttons, use -// wxImage::ConvertToGreyscale() instead -#if WXWIN_COMPATIBILITY_2_8 - -wxDEPRECATED( bool wxCreateGreyedImage(const wxImage& in, wxImage& out) ); - -#endif // WXWIN_COMPATIBILITY_2_8 - +// Helper function for creating the image for disabled buttons +bool wxCreateGreyedImage(const wxImage& in, wxImage& out) ; #endif // wxUSE_TOOLBAR diff --git a/Source/3rd Party/wx/include/wx/textbuf.h b/Source/3rd Party/wx/include/wx/textbuf.h index 88ba61111..97246b6b2 100644 --- a/Source/3rd Party/wx/include/wx/textbuf.h +++ b/Source/3rd Party/wx/include/wx/textbuf.h @@ -99,10 +99,8 @@ public: size_t GetLineCount() const { return m_aLines.size(); } // the returned line may be modified (but don't add CR/LF at the end!) - wxString& GetLine(size_t n) { return m_aLines[n]; } - const wxString& GetLine(size_t n) const { return m_aLines[n]; } - wxString& operator[](size_t n) { return m_aLines[n]; } - const wxString& operator[](size_t n) const { return m_aLines[n]; } + wxString& GetLine(size_t n) const { return (wxString&)m_aLines[n]; } + wxString& operator[](size_t n) const { return (wxString&)m_aLines[n]; } // the current line has meaning only when you're using // GetFirstLine()/GetNextLine() functions, it doesn't get updated when @@ -134,7 +132,7 @@ public: wxTextFileType GuessType() const; // get the name of the buffer - const wxString& GetName() const { return m_strBufferName; } + const wxChar *GetName() const { return m_strBufferName.c_str(); } // add/remove lines // ---------------- diff --git a/Source/3rd Party/wx/include/wx/textcompleter.h b/Source/3rd Party/wx/include/wx/textcompleter.h deleted file mode 100644 index ca1b29cb2..000000000 --- a/Source/3rd Party/wx/include/wx/textcompleter.h +++ /dev/null @@ -1,87 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/textcompleter.h -// Purpose: Declaration of wxTextCompleter class. -// Author: Vadim Zeitlin -// Created: 2011-04-13 -// RCS-ID: $Id: wxhead.h,v 1.12 2010-04-22 12:44:51 zeitlin Exp $ -// Copyright: (c) 2011 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TEXTCOMPLETER_H_ -#define _WX_TEXTCOMPLETER_H_ - -// ---------------------------------------------------------------------------- -// wxTextCompleter: used by wxTextEnter::AutoComplete() -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxTextCompleter -{ -public: - wxTextCompleter() { } - - // The virtual functions to be implemented by the derived classes: the - // first one is called to start preparing for completions for the given - // prefix and, if it returns true, GetNext() is called until it returns an - // empty string indicating that there are no more completions. - virtual bool Start(const wxString& prefix) = 0; - virtual wxString GetNext() = 0; - - virtual ~wxTextCompleter(); - -private: - wxDECLARE_NO_COPY_CLASS(wxTextCompleter); -}; - -// ---------------------------------------------------------------------------- -// wxTextCompleterSimple: returns the entire set of completions at once -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxTextCompleterSimple : public wxTextCompleter -{ -public: - wxTextCompleterSimple() { } - - // Must be implemented to return all the completions for the given prefix. - virtual void GetCompletions(const wxString& prefix, wxArrayString& res) = 0; - - virtual bool Start(const wxString& prefix); - virtual wxString GetNext(); - -private: - wxArrayString m_completions; - unsigned m_index; - - wxDECLARE_NO_COPY_CLASS(wxTextCompleterSimple); -}; - -// ---------------------------------------------------------------------------- -// wxTextCompleterFixed: Trivial wxTextCompleter implementation which always -// returns the same fixed array of completions. -// ---------------------------------------------------------------------------- - -// NB: This class is private and intentionally not documented as it is -// currently used only for implementation of completion with the fixed list -// of strings only by wxWidgets itself, do not use it outside of wxWidgets. - -class wxTextCompleterFixed : public wxTextCompleterSimple -{ -public: - void SetCompletions(const wxArrayString& strings) - { - m_strings = strings; - } - - virtual void GetCompletions(const wxString& WXUNUSED(prefix), - wxArrayString& res) - { - res = m_strings; - } - -private: - wxArrayString m_strings; -}; - - -#endif // _WX_TEXTCOMPLETER_H_ - diff --git a/Source/3rd Party/wx/include/wx/textctrl.h b/Source/3rd Party/wx/include/wx/textctrl.h index d1c569163..b1b4c0a25 100644 --- a/Source/3rd Party/wx/include/wx/textctrl.h +++ b/Source/3rd Party/wx/include/wx/textctrl.h @@ -1,10 +1,10 @@ /////////////////////////////////////////////////////////////////////////////// // Name: wx/textctrl.h -// Purpose: wxTextAttr and wxTextCtrlBase class - the interface of wxTextCtrl +// Purpose: wxTextCtrlBase class - the interface of wxTextCtrl // Author: Vadim Zeitlin // Modified by: // Created: 13.07.99 -// RCS-ID: $Id$ +// RCS-ID: $Id: textctrl.h 53135 2008-04-12 02:31:04Z VZ $ // Copyright: (c) Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -21,14 +21,16 @@ #if wxUSE_TEXTCTRL #include "wx/control.h" // the base class -#include "wx/textentry.h" // single-line text entry interface #include "wx/dynarray.h" // wxArrayInt #include "wx/gdicmn.h" // wxPoint -// some compilers don't have standard compliant rdbuf() (and MSVC has it only -// in its new iostream library, not in the old one used with iostream.h) +// Open Watcom 1.3 does allow only ios::rdbuf() while +// we want something with streambuf parameter +// Also, can't use streambuf if making or using a DLL :-( + #if defined(__WATCOMC__) || \ - ((defined(__VISUALC5__) || defined(__VISUALC6__)) && wxUSE_IOSTREAMH) + defined(__MWERKS__) || \ + (defined(__WINDOWS__) && (defined(WXUSINGDLL) || defined(WXMAKINGDLL))) #define wxHAS_TEXT_WINDOW_STREAM 0 #elif wxUSE_STD_IOSTREAM #include "wx/ioswrap.h" @@ -37,6 +39,11 @@ #define wxHAS_TEXT_WINDOW_STREAM 0 #endif +#if WXWIN_COMPATIBILITY_2_4 && !wxHAS_TEXT_WINDOW_STREAM + // define old flag if one could use it somewhere + #define NO_TEXT_WINDOW_STREAM +#endif + class WXDLLIMPEXP_FWD_CORE wxTextCtrl; class WXDLLIMPEXP_FWD_CORE wxTextCtrlBase; @@ -44,6 +51,9 @@ class WXDLLIMPEXP_FWD_CORE wxTextCtrlBase; // wxTextCtrl types // ---------------------------------------------------------------------------- +// wxTextPos is the position in the text +typedef long wxTextPos; + // wxTextCoord is the line or row number (which should have been unsigned but // is long for backwards compatibility) typedef long wxTextCoord; @@ -52,7 +62,7 @@ typedef long wxTextCoord; // constants // ---------------------------------------------------------------------------- -extern WXDLLIMPEXP_DATA_CORE(const char) wxTextCtrlNameStr[]; +extern WXDLLEXPORT_DATA(const wxChar) wxTextCtrlNameStr[]; // this is intentionally not enum to avoid warning fixes with // typecasting from enum type to wxTextCoord @@ -64,6 +74,7 @@ const wxTextCoord wxInvalidTextCoord = -2; // ---------------------------------------------------------------------------- #define wxTE_NO_VSCROLL 0x0002 +#define wxTE_AUTO_SCROLL 0x0008 #define wxTE_READONLY 0x0010 #define wxTE_MULTILINE 0x0020 @@ -106,11 +117,6 @@ const wxTextCoord wxInvalidTextCoord = -2; #define wxTE_LINEWRAP wxTE_CHARWRAP #endif // WXWIN_COMPATIBILITY_2_6 -#if WXWIN_COMPATIBILITY_2_8 - // this style is (or at least should be) on by default now, don't use it - #define wxTE_AUTO_SCROLL 0 -#endif // WXWIN_COMPATIBILITY_2_8 - // force using RichEdit version 2.0 or 3.0 instead of 1.0 (default) for // wxTE_RICH controls - can be used together with or instead of wxTE_RICH #define wxTE_RICH2 0x8000 @@ -160,288 +166,39 @@ enum wxTextAttrAlignment }; // Flags to indicate which attributes are being applied -enum wxTextAttrFlags -{ - wxTEXT_ATTR_TEXT_COLOUR = 0x00000001, - wxTEXT_ATTR_BACKGROUND_COLOUR = 0x00000002, - wxTEXT_ATTR_FONT_FACE = 0x00000004, - wxTEXT_ATTR_FONT_POINT_SIZE = 0x00000008, - wxTEXT_ATTR_FONT_PIXEL_SIZE = 0x10000000, - wxTEXT_ATTR_FONT_WEIGHT = 0x00000010, - wxTEXT_ATTR_FONT_ITALIC = 0x00000020, - wxTEXT_ATTR_FONT_UNDERLINE = 0x00000040, - wxTEXT_ATTR_FONT_STRIKETHROUGH = 0x08000000, - wxTEXT_ATTR_FONT_ENCODING = 0x02000000, - wxTEXT_ATTR_FONT_FAMILY = 0x04000000, - wxTEXT_ATTR_FONT_SIZE = \ - ( wxTEXT_ATTR_FONT_POINT_SIZE | wxTEXT_ATTR_FONT_PIXEL_SIZE ), - wxTEXT_ATTR_FONT = \ - ( wxTEXT_ATTR_FONT_FACE | wxTEXT_ATTR_FONT_SIZE | wxTEXT_ATTR_FONT_WEIGHT | \ - wxTEXT_ATTR_FONT_ITALIC | wxTEXT_ATTR_FONT_UNDERLINE | wxTEXT_ATTR_FONT_STRIKETHROUGH | wxTEXT_ATTR_FONT_ENCODING | wxTEXT_ATTR_FONT_FAMILY ), - - wxTEXT_ATTR_ALIGNMENT = 0x00000080, - wxTEXT_ATTR_LEFT_INDENT = 0x00000100, - wxTEXT_ATTR_RIGHT_INDENT = 0x00000200, - wxTEXT_ATTR_TABS = 0x00000400, - wxTEXT_ATTR_PARA_SPACING_AFTER = 0x00000800, - wxTEXT_ATTR_PARA_SPACING_BEFORE = 0x00001000, - wxTEXT_ATTR_LINE_SPACING = 0x00002000, - wxTEXT_ATTR_CHARACTER_STYLE_NAME = 0x00004000, - wxTEXT_ATTR_PARAGRAPH_STYLE_NAME = 0x00008000, - wxTEXT_ATTR_LIST_STYLE_NAME = 0x00010000, - - wxTEXT_ATTR_BULLET_STYLE = 0x00020000, - wxTEXT_ATTR_BULLET_NUMBER = 0x00040000, - wxTEXT_ATTR_BULLET_TEXT = 0x00080000, - wxTEXT_ATTR_BULLET_NAME = 0x00100000, - - wxTEXT_ATTR_BULLET = \ - ( wxTEXT_ATTR_BULLET_STYLE | wxTEXT_ATTR_BULLET_NUMBER | wxTEXT_ATTR_BULLET_TEXT | \ - wxTEXT_ATTR_BULLET_NAME ), - - - wxTEXT_ATTR_URL = 0x00200000, - wxTEXT_ATTR_PAGE_BREAK = 0x00400000, - wxTEXT_ATTR_EFFECTS = 0x00800000, - wxTEXT_ATTR_OUTLINE_LEVEL = 0x01000000, - - /*! - * Character and paragraph combined styles - */ - - wxTEXT_ATTR_CHARACTER = \ - (wxTEXT_ATTR_FONT|wxTEXT_ATTR_EFFECTS| \ - wxTEXT_ATTR_BACKGROUND_COLOUR|wxTEXT_ATTR_TEXT_COLOUR|wxTEXT_ATTR_CHARACTER_STYLE_NAME|wxTEXT_ATTR_URL), - - wxTEXT_ATTR_PARAGRAPH = \ - (wxTEXT_ATTR_ALIGNMENT|wxTEXT_ATTR_LEFT_INDENT|wxTEXT_ATTR_RIGHT_INDENT|wxTEXT_ATTR_TABS|\ - wxTEXT_ATTR_PARA_SPACING_BEFORE|wxTEXT_ATTR_PARA_SPACING_AFTER|wxTEXT_ATTR_LINE_SPACING|\ - wxTEXT_ATTR_BULLET|wxTEXT_ATTR_PARAGRAPH_STYLE_NAME|wxTEXT_ATTR_LIST_STYLE_NAME|wxTEXT_ATTR_OUTLINE_LEVEL|wxTEXT_ATTR_PAGE_BREAK), - - wxTEXT_ATTR_ALL = (wxTEXT_ATTR_CHARACTER|wxTEXT_ATTR_PARAGRAPH) -}; - -/*! - * Styles for wxTextAttr::SetBulletStyle - */ -enum wxTextAttrBulletStyle -{ - wxTEXT_ATTR_BULLET_STYLE_NONE = 0x00000000, - wxTEXT_ATTR_BULLET_STYLE_ARABIC = 0x00000001, - wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER = 0x00000002, - wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER = 0x00000004, - wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER = 0x00000008, - wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER = 0x00000010, - wxTEXT_ATTR_BULLET_STYLE_SYMBOL = 0x00000020, - wxTEXT_ATTR_BULLET_STYLE_BITMAP = 0x00000040, - wxTEXT_ATTR_BULLET_STYLE_PARENTHESES = 0x00000080, - wxTEXT_ATTR_BULLET_STYLE_PERIOD = 0x00000100, - wxTEXT_ATTR_BULLET_STYLE_STANDARD = 0x00000200, - wxTEXT_ATTR_BULLET_STYLE_RIGHT_PARENTHESIS = 0x00000400, - wxTEXT_ATTR_BULLET_STYLE_OUTLINE = 0x00000800, - - wxTEXT_ATTR_BULLET_STYLE_ALIGN_LEFT = 0x00000000, - wxTEXT_ATTR_BULLET_STYLE_ALIGN_RIGHT = 0x00001000, - wxTEXT_ATTR_BULLET_STYLE_ALIGN_CENTRE = 0x00002000 -}; - -/*! - * Styles for wxTextAttr::SetTextEffects - */ -enum wxTextAttrEffects -{ - wxTEXT_ATTR_EFFECT_NONE = 0x00000000, - wxTEXT_ATTR_EFFECT_CAPITALS = 0x00000001, - wxTEXT_ATTR_EFFECT_SMALL_CAPITALS = 0x00000002, - wxTEXT_ATTR_EFFECT_STRIKETHROUGH = 0x00000004, - wxTEXT_ATTR_EFFECT_DOUBLE_STRIKETHROUGH = 0x00000008, - wxTEXT_ATTR_EFFECT_SHADOW = 0x00000010, - wxTEXT_ATTR_EFFECT_EMBOSS = 0x00000020, - wxTEXT_ATTR_EFFECT_OUTLINE = 0x00000040, - wxTEXT_ATTR_EFFECT_ENGRAVE = 0x00000080, - wxTEXT_ATTR_EFFECT_SUPERSCRIPT = 0x00000100, - wxTEXT_ATTR_EFFECT_SUBSCRIPT = 0x00000200 -}; - -/*! - * Line spacing values - */ -enum wxTextAttrLineSpacing -{ - wxTEXT_ATTR_LINE_SPACING_NORMAL = 10, - wxTEXT_ATTR_LINE_SPACING_HALF = 15, - wxTEXT_ATTR_LINE_SPACING_TWICE = 20 -}; +#define wxTEXT_ATTR_TEXT_COLOUR 0x0001 +#define wxTEXT_ATTR_BACKGROUND_COLOUR 0x0002 +#define wxTEXT_ATTR_FONT_FACE 0x0004 +#define wxTEXT_ATTR_FONT_SIZE 0x0008 +#define wxTEXT_ATTR_FONT_WEIGHT 0x0010 +#define wxTEXT_ATTR_FONT_ITALIC 0x0020 +#define wxTEXT_ATTR_FONT_UNDERLINE 0x0040 +#define wxTEXT_ATTR_FONT \ + ( wxTEXT_ATTR_FONT_FACE | wxTEXT_ATTR_FONT_SIZE | wxTEXT_ATTR_FONT_WEIGHT | \ + wxTEXT_ATTR_FONT_ITALIC | wxTEXT_ATTR_FONT_UNDERLINE ) +#define wxTEXT_ATTR_ALIGNMENT 0x0080 +#define wxTEXT_ATTR_LEFT_INDENT 0x0100 +#define wxTEXT_ATTR_RIGHT_INDENT 0x0200 +#define wxTEXT_ATTR_TABS 0x0400 // ---------------------------------------------------------------------------- // wxTextAttr: a structure containing the visual attributes of a text // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxTextAttr +class WXDLLEXPORT wxTextAttr { public: // ctors wxTextAttr() { Init(); } - wxTextAttr(const wxTextAttr& attr) { Init(); Copy(attr); } wxTextAttr(const wxColour& colText, const wxColour& colBack = wxNullColour, const wxFont& font = wxNullFont, wxTextAttrAlignment alignment = wxTEXT_ALIGNMENT_DEFAULT); - // Initialise this object. + // operations void Init(); - // Copy - void Copy(const wxTextAttr& attr); - - // Assignment - void operator= (const wxTextAttr& attr); - - // Equality test - bool operator== (const wxTextAttr& attr) const; - - // Partial equality test. If @a weakTest is @true, attributes of this object do not - // have to be present if those attributes of @a attr are present. If @a weakTest is - // @false, the function will fail if an attribute is present in @a attr but not - // in this object. - bool EqPartial(const wxTextAttr& attr, bool weakTest = true) const; - - // Get attributes from font. - bool GetFontAttributes(const wxFont& font, int flags = wxTEXT_ATTR_FONT); - - // setters - void SetTextColour(const wxColour& colText) { m_colText = colText; m_flags |= wxTEXT_ATTR_TEXT_COLOUR; } - void SetBackgroundColour(const wxColour& colBack) { m_colBack = colBack; m_flags |= wxTEXT_ATTR_BACKGROUND_COLOUR; } - void SetAlignment(wxTextAttrAlignment alignment) { m_textAlignment = alignment; m_flags |= wxTEXT_ATTR_ALIGNMENT; } - void SetTabs(const wxArrayInt& tabs) { m_tabs = tabs; m_flags |= wxTEXT_ATTR_TABS; } - void SetLeftIndent(int indent, int subIndent = 0) { m_leftIndent = indent; m_leftSubIndent = subIndent; m_flags |= wxTEXT_ATTR_LEFT_INDENT; } - void SetRightIndent(int indent) { m_rightIndent = indent; m_flags |= wxTEXT_ATTR_RIGHT_INDENT; } - - void SetFontSize(int pointSize) { m_fontSize = pointSize; m_flags &= ~wxTEXT_ATTR_FONT_SIZE; m_flags |= wxTEXT_ATTR_FONT_POINT_SIZE; } - void SetFontPointSize(int pointSize) { m_fontSize = pointSize; m_flags &= ~wxTEXT_ATTR_FONT_SIZE; m_flags |= wxTEXT_ATTR_FONT_POINT_SIZE; } - void SetFontPixelSize(int pixelSize) { m_fontSize = pixelSize; m_flags &= ~wxTEXT_ATTR_FONT_SIZE; m_flags |= wxTEXT_ATTR_FONT_PIXEL_SIZE; } - void SetFontStyle(wxFontStyle fontStyle) { m_fontStyle = fontStyle; m_flags |= wxTEXT_ATTR_FONT_ITALIC; } - void SetFontWeight(wxFontWeight fontWeight) { m_fontWeight = fontWeight; m_flags |= wxTEXT_ATTR_FONT_WEIGHT; } - void SetFontFaceName(const wxString& faceName) { m_fontFaceName = faceName; m_flags |= wxTEXT_ATTR_FONT_FACE; } - void SetFontUnderlined(bool underlined) { m_fontUnderlined = underlined; m_flags |= wxTEXT_ATTR_FONT_UNDERLINE; } - void SetFontStrikethrough(bool strikethrough) { m_fontStrikethrough = strikethrough; m_flags |= wxTEXT_ATTR_FONT_STRIKETHROUGH; } - void SetFontEncoding(wxFontEncoding encoding) { m_fontEncoding = encoding; m_flags |= wxTEXT_ATTR_FONT_ENCODING; } - void SetFontFamily(wxFontFamily family) { m_fontFamily = family; m_flags |= wxTEXT_ATTR_FONT_FAMILY; } - - // Set font - void SetFont(const wxFont& font, int flags = (wxTEXT_ATTR_FONT & ~wxTEXT_ATTR_FONT_PIXEL_SIZE)) { GetFontAttributes(font, flags); } - - void SetFlags(long flags) { m_flags = flags; } - - void SetCharacterStyleName(const wxString& name) { m_characterStyleName = name; m_flags |= wxTEXT_ATTR_CHARACTER_STYLE_NAME; } - void SetParagraphStyleName(const wxString& name) { m_paragraphStyleName = name; m_flags |= wxTEXT_ATTR_PARAGRAPH_STYLE_NAME; } - void SetListStyleName(const wxString& name) { m_listStyleName = name; SetFlags(GetFlags() | wxTEXT_ATTR_LIST_STYLE_NAME); } - void SetParagraphSpacingAfter(int spacing) { m_paragraphSpacingAfter = spacing; m_flags |= wxTEXT_ATTR_PARA_SPACING_AFTER; } - void SetParagraphSpacingBefore(int spacing) { m_paragraphSpacingBefore = spacing; m_flags |= wxTEXT_ATTR_PARA_SPACING_BEFORE; } - void SetLineSpacing(int spacing) { m_lineSpacing = spacing; m_flags |= wxTEXT_ATTR_LINE_SPACING; } - void SetBulletStyle(int style) { m_bulletStyle = style; m_flags |= wxTEXT_ATTR_BULLET_STYLE; } - void SetBulletNumber(int n) { m_bulletNumber = n; m_flags |= wxTEXT_ATTR_BULLET_NUMBER; } - void SetBulletText(const wxString& text) { m_bulletText = text; m_flags |= wxTEXT_ATTR_BULLET_TEXT; } - void SetBulletFont(const wxString& bulletFont) { m_bulletFont = bulletFont; } - void SetBulletName(const wxString& name) { m_bulletName = name; m_flags |= wxTEXT_ATTR_BULLET_NAME; } - void SetURL(const wxString& url) { m_urlTarget = url; m_flags |= wxTEXT_ATTR_URL; } - void SetPageBreak(bool pageBreak = true) { SetFlags(pageBreak ? (GetFlags() | wxTEXT_ATTR_PAGE_BREAK) : (GetFlags() & ~wxTEXT_ATTR_PAGE_BREAK)); } - void SetTextEffects(int effects) { m_textEffects = effects; SetFlags(GetFlags() | wxTEXT_ATTR_EFFECTS); } - void SetTextEffectFlags(int effects) { m_textEffectFlags = effects; } - void SetOutlineLevel(int level) { m_outlineLevel = level; SetFlags(GetFlags() | wxTEXT_ATTR_OUTLINE_LEVEL); } - - const wxColour& GetTextColour() const { return m_colText; } - const wxColour& GetBackgroundColour() const { return m_colBack; } - wxTextAttrAlignment GetAlignment() const { return m_textAlignment; } - const wxArrayInt& GetTabs() const { return m_tabs; } - long GetLeftIndent() const { return m_leftIndent; } - long GetLeftSubIndent() const { return m_leftSubIndent; } - long GetRightIndent() const { return m_rightIndent; } - long GetFlags() const { return m_flags; } - - int GetFontSize() const { return m_fontSize; } - wxFontStyle GetFontStyle() const { return m_fontStyle; } - wxFontWeight GetFontWeight() const { return m_fontWeight; } - bool GetFontUnderlined() const { return m_fontUnderlined; } - bool GetFontStrikethrough() const { return m_fontStrikethrough; } - const wxString& GetFontFaceName() const { return m_fontFaceName; } - wxFontEncoding GetFontEncoding() const { return m_fontEncoding; } - wxFontFamily GetFontFamily() const { return m_fontFamily; } - - wxFont GetFont() const; - - const wxString& GetCharacterStyleName() const { return m_characterStyleName; } - const wxString& GetParagraphStyleName() const { return m_paragraphStyleName; } - const wxString& GetListStyleName() const { return m_listStyleName; } - int GetParagraphSpacingAfter() const { return m_paragraphSpacingAfter; } - int GetParagraphSpacingBefore() const { return m_paragraphSpacingBefore; } - - int GetLineSpacing() const { return m_lineSpacing; } - int GetBulletStyle() const { return m_bulletStyle; } - int GetBulletNumber() const { return m_bulletNumber; } - const wxString& GetBulletText() const { return m_bulletText; } - const wxString& GetBulletFont() const { return m_bulletFont; } - const wxString& GetBulletName() const { return m_bulletName; } - const wxString& GetURL() const { return m_urlTarget; } - int GetTextEffects() const { return m_textEffects; } - int GetTextEffectFlags() const { return m_textEffectFlags; } - int GetOutlineLevel() const { return m_outlineLevel; } - - // accessors - bool HasTextColour() const { return m_colText.IsOk() && HasFlag(wxTEXT_ATTR_TEXT_COLOUR) ; } - bool HasBackgroundColour() const { return m_colBack.IsOk() && HasFlag(wxTEXT_ATTR_BACKGROUND_COLOUR) ; } - bool HasAlignment() const { return (m_textAlignment != wxTEXT_ALIGNMENT_DEFAULT) && HasFlag(wxTEXT_ATTR_ALIGNMENT) ; } - bool HasTabs() const { return HasFlag(wxTEXT_ATTR_TABS) ; } - bool HasLeftIndent() const { return HasFlag(wxTEXT_ATTR_LEFT_INDENT); } - bool HasRightIndent() const { return HasFlag(wxTEXT_ATTR_RIGHT_INDENT); } - bool HasFontWeight() const { return HasFlag(wxTEXT_ATTR_FONT_WEIGHT); } - bool HasFontSize() const { return HasFlag(wxTEXT_ATTR_FONT_SIZE); } - bool HasFontPointSize() const { return HasFlag(wxTEXT_ATTR_FONT_POINT_SIZE); } - bool HasFontPixelSize() const { return HasFlag(wxTEXT_ATTR_FONT_PIXEL_SIZE); } - bool HasFontItalic() const { return HasFlag(wxTEXT_ATTR_FONT_ITALIC); } - bool HasFontUnderlined() const { return HasFlag(wxTEXT_ATTR_FONT_UNDERLINE); } - bool HasFontStrikethrough() const { return HasFlag(wxTEXT_ATTR_FONT_STRIKETHROUGH); } - bool HasFontFaceName() const { return HasFlag(wxTEXT_ATTR_FONT_FACE); } - bool HasFontEncoding() const { return HasFlag(wxTEXT_ATTR_FONT_ENCODING); } - bool HasFontFamily() const { return HasFlag(wxTEXT_ATTR_FONT_FAMILY); } - bool HasFont() const { return HasFlag(wxTEXT_ATTR_FONT); } - - bool HasParagraphSpacingAfter() const { return HasFlag(wxTEXT_ATTR_PARA_SPACING_AFTER); } - bool HasParagraphSpacingBefore() const { return HasFlag(wxTEXT_ATTR_PARA_SPACING_BEFORE); } - bool HasLineSpacing() const { return HasFlag(wxTEXT_ATTR_LINE_SPACING); } - bool HasCharacterStyleName() const { return HasFlag(wxTEXT_ATTR_CHARACTER_STYLE_NAME) && !m_characterStyleName.IsEmpty(); } - bool HasParagraphStyleName() const { return HasFlag(wxTEXT_ATTR_PARAGRAPH_STYLE_NAME) && !m_paragraphStyleName.IsEmpty(); } - bool HasListStyleName() const { return HasFlag(wxTEXT_ATTR_LIST_STYLE_NAME) || !m_listStyleName.IsEmpty(); } - bool HasBulletStyle() const { return HasFlag(wxTEXT_ATTR_BULLET_STYLE); } - bool HasBulletNumber() const { return HasFlag(wxTEXT_ATTR_BULLET_NUMBER); } - bool HasBulletText() const { return HasFlag(wxTEXT_ATTR_BULLET_TEXT); } - bool HasBulletName() const { return HasFlag(wxTEXT_ATTR_BULLET_NAME); } - bool HasURL() const { return HasFlag(wxTEXT_ATTR_URL); } - bool HasPageBreak() const { return HasFlag(wxTEXT_ATTR_PAGE_BREAK); } - bool HasTextEffects() const { return HasFlag(wxTEXT_ATTR_EFFECTS); } - bool HasTextEffect(int effect) const { return HasFlag(wxTEXT_ATTR_EFFECTS) && ((GetTextEffectFlags() & effect) != 0); } - bool HasOutlineLevel() const { return HasFlag(wxTEXT_ATTR_OUTLINE_LEVEL); } - - bool HasFlag(long flag) const { return (m_flags & flag) != 0; } - void RemoveFlag(long flag) { m_flags &= ~flag; } - void AddFlag(long flag) { m_flags |= flag; } - - // Is this a character style? - bool IsCharacterStyle() const { return HasFlag(wxTEXT_ATTR_CHARACTER); } - bool IsParagraphStyle() const { return HasFlag(wxTEXT_ATTR_PARAGRAPH); } - - // returns false if we have any attributes set, true otherwise - bool IsDefault() const - { - return GetFlags() == 0; - } - - // Merges the given attributes. If compareWith - // is non-NULL, then it will be used to mask out those attributes that are the same in style - // and compareWith, for situations where we don't want to explicitly set inherited attributes. - bool Apply(const wxTextAttr& style, const wxTextAttr* compareWith = NULL); - // merges the attributes of the base and the overlay objects and returns // the result; the parameter attributes take precedence // @@ -457,6 +214,47 @@ public: *this = Merge(*this, overlay); } + + // operators + void operator= (const wxTextAttr& attr); + + // setters + void SetTextColour(const wxColour& colText) { m_colText = colText; m_flags |= wxTEXT_ATTR_TEXT_COLOUR; } + void SetBackgroundColour(const wxColour& colBack) { m_colBack = colBack; m_flags |= wxTEXT_ATTR_BACKGROUND_COLOUR; } + void SetFont(const wxFont& font, long flags = wxTEXT_ATTR_FONT) { m_font = font; m_flags |= flags; } + void SetAlignment(wxTextAttrAlignment alignment) { m_textAlignment = alignment; m_flags |= wxTEXT_ATTR_ALIGNMENT; } + void SetTabs(const wxArrayInt& tabs) { m_tabs = tabs; m_flags |= wxTEXT_ATTR_TABS; } + void SetLeftIndent(int indent, int subIndent = 0) { m_leftIndent = indent; m_leftSubIndent = subIndent; m_flags |= wxTEXT_ATTR_LEFT_INDENT; } + void SetRightIndent(int indent) { m_rightIndent = indent; m_flags |= wxTEXT_ATTR_RIGHT_INDENT; } + void SetFlags(long flags) { m_flags = flags; } + + // accessors + bool HasTextColour() const { return m_colText.Ok() && HasFlag(wxTEXT_ATTR_TEXT_COLOUR) ; } + bool HasBackgroundColour() const { return m_colBack.Ok() && HasFlag(wxTEXT_ATTR_BACKGROUND_COLOUR) ; } + bool HasFont() const { return m_font.Ok() && HasFlag(wxTEXT_ATTR_FONT) ; } + bool HasAlignment() const { return (m_textAlignment != wxTEXT_ALIGNMENT_DEFAULT) && ((m_flags & wxTEXT_ATTR_ALIGNMENT) != 0) ; } + bool HasTabs() const { return (m_flags & wxTEXT_ATTR_TABS) != 0 ; } + bool HasLeftIndent() const { return (m_flags & wxTEXT_ATTR_LEFT_INDENT) != 0 ; } + bool HasRightIndent() const { return (m_flags & wxTEXT_ATTR_RIGHT_INDENT) != 0 ; } + bool HasFlag(long flag) const { return (m_flags & flag) != 0; } + + const wxColour& GetTextColour() const { return m_colText; } + const wxColour& GetBackgroundColour() const { return m_colBack; } + const wxFont& GetFont() const { return m_font; } + wxTextAttrAlignment GetAlignment() const { return m_textAlignment; } + const wxArrayInt& GetTabs() const { return m_tabs; } + long GetLeftIndent() const { return m_leftIndent; } + long GetLeftSubIndent() const { return m_leftSubIndent; } + long GetRightIndent() const { return m_rightIndent; } + long GetFlags() const { return m_flags; } + + // returns false if we have any attributes set, true otherwise + bool IsDefault() const + { + return !HasTextColour() && !HasBackgroundColour() && !HasFont() && !HasAlignment() && + !HasTabs() && !HasLeftIndent() && !HasRightIndent() ; + } + // return the attribute having the valid font and colours: it uses the // attributes set in attr and falls back first to attrDefault and then to // the text control font/colours for those attributes which are not set @@ -464,98 +262,84 @@ public: const wxTextAttr& attrDef, const wxTextCtrlBase *text); - // Compare tabs - static bool TabsEq(const wxArrayInt& tabs1, const wxArrayInt& tabs2); - - // Remove attributes - static bool RemoveStyle(wxTextAttr& destStyle, const wxTextAttr& style); - - // Combine two bitlists, specifying the bits of interest with separate flags. - static bool CombineBitlists(int& valueA, int valueB, int& flagsA, int flagsB); - - // Compare two bitlists - static bool BitlistsEqPartial(int valueA, int valueB, int flags); - - // Split into paragraph and character styles - static bool SplitParaCharStyles(const wxTextAttr& style, wxTextAttr& parStyle, wxTextAttr& charStyle); - private: long m_flags; - - // Paragraph styles + wxColour m_colText, + m_colBack; + wxFont m_font; + wxTextAttrAlignment m_textAlignment; wxArrayInt m_tabs; // array of int: tab stops in 1/10 mm int m_leftIndent; // left indent in 1/10 mm int m_leftSubIndent; // left indent for all but the first // line in a paragraph relative to the // first line, in 1/10 mm int m_rightIndent; // right indent in 1/10 mm - wxTextAttrAlignment m_textAlignment; - - int m_paragraphSpacingAfter; - int m_paragraphSpacingBefore; - int m_lineSpacing; - int m_bulletStyle; - int m_bulletNumber; - int m_textEffects; - int m_textEffectFlags; - int m_outlineLevel; - wxString m_bulletText; - wxString m_bulletFont; - wxString m_bulletName; - wxString m_urlTarget; - wxFontEncoding m_fontEncoding; - - // Character styles - wxColour m_colText, - m_colBack; - int m_fontSize; - wxFontStyle m_fontStyle; - wxFontWeight m_fontWeight; - wxFontFamily m_fontFamily; - bool m_fontUnderlined; - bool m_fontStrikethrough; - wxString m_fontFaceName; - - // Character style - wxString m_characterStyleName; - - // Paragraph style - wxString m_paragraphStyleName; - - // List style - wxString m_listStyleName; }; // ---------------------------------------------------------------------------- -// wxTextAreaBase: multiline text control specific methods +// wxTextCtrl: a single or multiple line text zone where user can enter and +// edit text // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxTextAreaBase +class WXDLLEXPORT wxTextCtrlBase : public wxControl +#if wxHAS_TEXT_WINDOW_STREAM + , public wxSTD streambuf +#endif + { public: - wxTextAreaBase() { } - virtual ~wxTextAreaBase() { } + // creation + // -------- - // lines access - // ------------ + wxTextCtrlBase(){} + virtual ~wxTextCtrlBase(){} + + // accessors + // --------- + + virtual wxString GetValue() const = 0; + virtual bool IsEmpty() const { return GetValue().empty(); } + + virtual void SetValue(const wxString& value) + { DoSetValue(value, SetValue_SendEvent); } + virtual void ChangeValue(const wxString& value) + { DoSetValue(value); } + + virtual wxString GetRange(long from, long to) const; virtual int GetLineLength(long lineNo) const = 0; virtual wxString GetLineText(long lineNo) const = 0; virtual int GetNumberOfLines() const = 0; - - // file IO - // ------- - - bool LoadFile(const wxString& file, int fileType = wxTEXT_TYPE_ANY) - { return DoLoadFile(file, fileType); } - bool SaveFile(const wxString& file = wxEmptyString, - int fileType = wxTEXT_TYPE_ANY); - - // dirty flag handling - // ------------------- - virtual bool IsModified() const = 0; + virtual bool IsEditable() const = 0; + + // more readable flag testing methods + bool IsSingleLine() const { return !HasFlag(wxTE_MULTILINE); } + bool IsMultiLine() const { return !IsSingleLine(); } + + // If the return values from and to are the same, there is no selection. + virtual void GetSelection(long* from, long* to) const = 0; + + virtual wxString GetStringSelection() const; + + // operations + // ---------- + + // editing + virtual void Clear() = 0; + virtual void Replace(long from, long to, const wxString& value) = 0; + virtual void Remove(long from, long to) = 0; + + // load/save the control's contents from/to a file + bool LoadFile(const wxString& file, int fileType = wxTEXT_TYPE_ANY) { return DoLoadFile(file, fileType); } + bool SaveFile(const wxString& file = wxEmptyString, int fileType = wxTEXT_TYPE_ANY); + + // implementation for loading/saving + virtual bool DoLoadFile(const wxString& file, int fileType); + virtual bool DoSaveFile(const wxString& file, int fileType); + + // sets/clears the dirty flag virtual void MarkDirty() = 0; virtual void DiscardEdits() = 0; void SetModified(bool modified) @@ -566,21 +350,26 @@ public: DiscardEdits(); } + // set the max number of characters which may be entered in a single line + // text control + virtual void SetMaxLength(unsigned long WXUNUSED(len)) { } - // styles handling - // --------------- + // writing text inserts it at the current position, appending always + // inserts it at the end + virtual void WriteText(const wxString& text) = 0; + virtual void AppendText(const wxString& text) = 0; + + // insert the character which would have resulted from this key event, + // return true if anything has been inserted + virtual bool EmulateKeyPress(const wxKeyEvent& event); // text control under some platforms supports the text styles: these // methods allow to apply the given text style to the given selection or to // set/get the style which will be used for all appended text - virtual bool SetStyle(long start, long end, const wxTextAttr& style) = 0; - virtual bool GetStyle(long position, wxTextAttr& style) = 0; - virtual bool SetDefaultStyle(const wxTextAttr& style) = 0; - virtual const wxTextAttr& GetDefaultStyle() const { return m_defaultStyle; } - - - // coordinates translation - // ----------------------- + virtual bool SetStyle(long start, long end, const wxTextAttr& style); + virtual bool GetStyle(long position, wxTextAttr& style); + virtual bool SetDefaultStyle(const wxTextAttr& style); + virtual const wxTextAttr& GetDefaultStyle() const; // translate between the position (which is just an index in the text ctrl // considering all its contents as a single strings) and (x, y) coordinates @@ -588,11 +377,6 @@ public: virtual long XYToPosition(long x, long y) const = 0; virtual bool PositionToXY(long pos, long *x, long *y) const = 0; - // translate the given position (which is just an index in the text control) - // to client coordinates - wxPoint PositionToCoords(long pos) const; - - virtual void ShowPosition(long pos) = 0; // find the character at position given in pixels @@ -603,21 +387,66 @@ public: virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, wxTextCoord *col, wxTextCoord *row) const; - virtual wxString GetValue() const = 0; - virtual void SetValue(const wxString& value) = 0; + + // Clipboard operations + virtual void Copy() = 0; + virtual void Cut() = 0; + virtual void Paste() = 0; + + virtual bool CanCopy() const; + virtual bool CanCut() const; + virtual bool CanPaste() const; + + // Undo/redo + virtual void Undo() = 0; + virtual void Redo() = 0; + + virtual bool CanUndo() const = 0; + virtual bool CanRedo() const = 0; + + // Insertion point + virtual void SetInsertionPoint(long pos) = 0; + virtual void SetInsertionPointEnd() = 0; + virtual long GetInsertionPoint() const = 0; + virtual wxTextPos GetLastPosition() const = 0; + + virtual void SetSelection(long from, long to) = 0; + virtual void SelectAll(); + virtual void SetEditable(bool editable) = 0; + + // stream-like insertion operators: these are always available, whether we + // were, or not, compiled with streambuf support + wxTextCtrl& operator<<(const wxString& s); + wxTextCtrl& operator<<(int i); + wxTextCtrl& operator<<(long i); + wxTextCtrl& operator<<(float f); + wxTextCtrl& operator<<(double d); + wxTextCtrl& operator<<(const wxChar c); + + // generate the wxEVT_COMMAND_TEXT_UPDATED event, like SetValue() does + void SendTextUpdatedEvent(); + + // do the window-specific processing after processing the update event + virtual void DoUpdateWindowUI(wxUpdateUIEvent& event); + + virtual bool ShouldInheritColours() const { return false; } protected: - // implementation of loading/saving - virtual bool DoLoadFile(const wxString& file, int fileType); - virtual bool DoSaveFile(const wxString& file, int fileType); + // override streambuf method +#if wxHAS_TEXT_WINDOW_STREAM + int overflow(int i); +#endif // wxHAS_TEXT_WINDOW_STREAM - // Return true if the given position is valid, i.e. positive and less than - // the last position. - virtual bool IsValidPosition(long pos) const = 0; + // flags for DoSetValue(): common part of SetValue() and ChangeValue() and + // also used to implement WriteText() in wxMSW + enum + { + SetValue_SendEvent = 1, + SetValue_SelectionOnly = 2 + }; + + virtual void DoSetValue(const wxString& value, int flags = 0) = 0; - // Default stub implementation of PositionToCoords() always returns - // wxDefaultPosition. - virtual wxPoint DoPositionToCoords(long pos) const; // the name of the last file loaded with LoadFile() which will be used by // SaveFile() by default @@ -626,142 +455,7 @@ protected: // the text style which will be used for any new text added to the control wxTextAttr m_defaultStyle; - - wxDECLARE_NO_COPY_CLASS(wxTextAreaBase); -}; - -// this class defines wxTextCtrl interface, wxTextCtrlBase actually implements -// too much things because it derives from wxTextEntry and not wxTextEntryBase -// and so any classes which "look like" wxTextCtrl (such as wxRichTextCtrl) -// but don't need the (native) implementation bits from wxTextEntry should -// actually derive from this one and not wxTextCtrlBase -class WXDLLIMPEXP_CORE wxTextCtrlIface : public wxTextAreaBase, - public wxTextEntryBase -{ -public: - wxTextCtrlIface() { } - - // wxTextAreaBase overrides - virtual wxString GetValue() const - { - return wxTextEntryBase::GetValue(); - } - virtual void SetValue(const wxString& value) - { - wxTextEntryBase::SetValue(value); - } - -protected: - virtual bool IsValidPosition(long pos) const - { - return pos >= 0 && pos <= GetLastPosition(); - } - -private: - wxDECLARE_NO_COPY_CLASS(wxTextCtrlIface); -}; - -// ---------------------------------------------------------------------------- -// wxTextCtrl: a single or multiple line text zone where user can edit text -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxTextCtrlBase : public wxControl, -#if wxHAS_TEXT_WINDOW_STREAM - public wxSTD streambuf, -#endif - public wxTextAreaBase, - public wxTextEntry -{ -public: - // creation - // -------- - - wxTextCtrlBase() { } - virtual ~wxTextCtrlBase() { } - - - // more readable flag testing methods - bool IsSingleLine() const { return !HasFlag(wxTE_MULTILINE); } - bool IsMultiLine() const { return !IsSingleLine(); } - - // stream-like insertion operators: these are always available, whether we - // were, or not, compiled with streambuf support - wxTextCtrl& operator<<(const wxString& s); - wxTextCtrl& operator<<(int i); - wxTextCtrl& operator<<(long i); - wxTextCtrl& operator<<(float f) { return *this << double(f); } - wxTextCtrl& operator<<(double d); - wxTextCtrl& operator<<(char c) { return *this << wxString(c); } - wxTextCtrl& operator<<(wchar_t c) { return *this << wxString(c); } - - // insert the character which would have resulted from this key event, - // return true if anything has been inserted - virtual bool EmulateKeyPress(const wxKeyEvent& event); - - - // do the window-specific processing after processing the update event - virtual void DoUpdateWindowUI(wxUpdateUIEvent& event); - - virtual bool ShouldInheritColours() const { return false; } - - // work around the problem with having HitTest() both in wxControl and - // wxTextAreaBase base classes - virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, long *pos) const - { - return wxTextAreaBase::HitTest(pt, pos); - } - - virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, - wxTextCoord *col, - wxTextCoord *row) const - { - return wxTextAreaBase::HitTest(pt, col, row); - } - - // we provide stubs for these functions as not all platforms have styles - // support, but we really should leave them pure virtual here - virtual bool SetStyle(long start, long end, const wxTextAttr& style); - virtual bool GetStyle(long position, wxTextAttr& style); - virtual bool SetDefaultStyle(const wxTextAttr& style); - - // wxTextAreaBase overrides - virtual wxString GetValue() const - { - return wxTextEntry::GetValue(); - } - virtual void SetValue(const wxString& value) - { - wxTextEntry::SetValue(value); - } - - // wxWindow overrides - virtual wxVisualAttributes GetDefaultAttributes() const - { - return GetClassDefaultAttributes(GetWindowVariant()); - } - - static wxVisualAttributes - GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL) - { - return GetCompositeControlsDefaultAttributes(variant); - } - -protected: - // override streambuf method -#if wxHAS_TEXT_WINDOW_STREAM - int overflow(int i); -#endif // wxHAS_TEXT_WINDOW_STREAM - - // Another wxTextAreaBase override. - virtual bool IsValidPosition(long pos) const - { - return pos >= 0 && pos <= GetLastPosition(); - } - - // implement the wxTextEntry pure virtual method - virtual wxWindow *GetEditableWindow() { return this; } - - wxDECLARE_NO_COPY_CLASS(wxTextCtrlBase); + DECLARE_NO_COPY_CLASS(wxTextCtrlBase) DECLARE_ABSTRACT_CLASS(wxTextCtrlBase) }; @@ -784,7 +478,7 @@ protected: #elif defined(__WXGTK__) #include "wx/gtk1/textctrl.h" #elif defined(__WXMAC__) - #include "wx/osx/textctrl.h" + #include "wx/mac/textctrl.h" #elif defined(__WXCOCOA__) #include "wx/cocoa/textctrl.h" #elif defined(__WXPM__) @@ -795,26 +489,25 @@ protected: // wxTextCtrl events // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_FWD_CORE wxTextUrlEvent; +#if !WXWIN_COMPATIBILITY_EVENT_TYPES -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_TEXT_UPDATED, wxCommandEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_TEXT_ENTER, wxCommandEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_TEXT_URL, wxTextUrlEvent); -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_TEXT_MAXLEN, wxCommandEvent); +BEGIN_DECLARE_EVENT_TYPES() + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_UPDATED, 7) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_ENTER, 8) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_URL, 13) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_MAXLEN, 14) +END_DECLARE_EVENT_TYPES() -class WXDLLIMPEXP_CORE wxTextUrlEvent : public wxCommandEvent +#endif // !WXWIN_COMPATIBILITY_EVENT_TYPES + +class WXDLLEXPORT wxTextUrlEvent : public wxCommandEvent { public: wxTextUrlEvent(int winid, const wxMouseEvent& evtMouse, long start, long end) - : wxCommandEvent(wxEVT_COMMAND_TEXT_URL, winid), - m_evtMouse(evtMouse), m_start(start), m_end(end) + : wxCommandEvent(wxEVT_COMMAND_TEXT_URL, winid) + , m_evtMouse(evtMouse), m_start(start), m_end(end) { } - wxTextUrlEvent(const wxTextUrlEvent& event) - : wxCommandEvent(event), - m_evtMouse(event.m_evtMouse), - m_start(event.m_start), - m_end(event.m_end) { } // get the mouse event which happend over the URL const wxMouseEvent& GetMouseEvent() const { return m_evtMouse; } @@ -825,8 +518,6 @@ public: // get the end of the URL long GetURLEnd() const { return m_end; } - virtual wxEvent *Clone() const { return new wxTextUrlEvent(*this); } - protected: // the corresponding mouse event wxMouseEvent m_evtMouse; @@ -836,7 +527,7 @@ protected: m_end; private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxTextUrlEvent) + DECLARE_DYNAMIC_CLASS_NO_COPY(wxTextUrlEvent) public: // for wxWin RTTI only, don't use @@ -847,7 +538,7 @@ typedef void (wxEvtHandler::*wxTextUrlEventFunction)(wxTextUrlEvent&); #define wxTextEventHandler(func) wxCommandEventHandler(func) #define wxTextUrlEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxTextUrlEventFunction, func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxTextUrlEventFunction, &func) #define wx__DECLARE_TEXTEVT(evt, id, fn) \ wx__DECLARE_EVT1(wxEVT_COMMAND_TEXT_ ## evt, id, wxTextEventHandler(fn)) @@ -867,7 +558,7 @@ typedef void (wxEvtHandler::*wxTextUrlEventFunction)(wxTextUrlEvent&); // C++ stream to the wxTextCtrl given to its ctor during its lifetime. // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxStreamToTextRedirector +class WXDLLEXPORT wxStreamToTextRedirector { private: void Init(wxTextCtrl *text) diff --git a/Source/3rd Party/wx/include/wx/textdlg.h b/Source/3rd Party/wx/include/wx/textdlg.h index e70cdcd2d..787233d4f 100644 --- a/Source/3rd Party/wx/include/wx/textdlg.h +++ b/Source/3rd Party/wx/include/wx/textdlg.h @@ -1,10 +1,10 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/textdlg.h +// Name: textdlg.h // Purpose: wxTextEntryDialog class // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: textdlg.h 27408 2004-05-23 20:53:33Z JS $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -14,5 +14,10 @@ #include "wx/generic/textdlgg.h" +#if WXWIN_COMPATIBILITY_2_4 + // for wxGetNumberFromUser() + #include "wx/numdlg.h" +#endif // WXWIN_COMPATIBILITY_2_4 + #endif // _WX_TEXTDLG_H_BASE_ diff --git a/Source/3rd Party/wx/include/wx/textentry.h b/Source/3rd Party/wx/include/wx/textentry.h deleted file mode 100644 index 69211806b..000000000 --- a/Source/3rd Party/wx/include/wx/textentry.h +++ /dev/null @@ -1,331 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/textentry.h -// Purpose: declares wxTextEntry interface defining a simple text entry -// Author: Vadim Zeitlin -// Created: 2007-09-24 -// RCS-ID: $Id$ -// Copyright: (c) 2007 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TEXTENTRY_H_ -#define _WX_TEXTENTRY_H_ - -// wxTextPos is the position in the text (currently it's hardly used anywhere -// and should probably be replaced with int anyhow) -typedef long wxTextPos; - -class WXDLLIMPEXP_FWD_BASE wxArrayString; -class WXDLLIMPEXP_FWD_CORE wxTextCompleter; -class WXDLLIMPEXP_FWD_CORE wxTextEntryHintData; -class WXDLLIMPEXP_FWD_CORE wxWindow; - -#include "wx/filefn.h" // for wxFILE and wxDIR only -#include "wx/gdicmn.h" // for wxPoint - -// ---------------------------------------------------------------------------- -// wxTextEntryBase -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxTextEntryBase -{ -public: - wxTextEntryBase() { m_eventsBlock = 0; m_hintData = NULL; } - virtual ~wxTextEntryBase(); - - - // accessing the value - // ------------------- - - // SetValue() generates a text change event, ChangeValue() doesn't - virtual void SetValue(const wxString& value) - { DoSetValue(value, SetValue_SendEvent); } - virtual void ChangeValue(const wxString& value); - - // writing text inserts it at the current position replacing any current - // selection, appending always inserts it at the end and doesn't remove any - // existing text (but it will reset the selection if there is any) - virtual void WriteText(const wxString& text) = 0; - virtual void AppendText(const wxString& text); - - virtual wxString GetValue() const; - virtual wxString GetRange(long from, long to) const; - bool IsEmpty() const { return GetLastPosition() <= 0; } - - - // editing operations - // ------------------ - - virtual void Replace(long from, long to, const wxString& value); - virtual void Remove(long from, long to) = 0; - virtual void Clear() { SetValue(wxString()); } - void RemoveSelection(); - - - // clipboard operations - // -------------------- - - virtual void Copy() = 0; - virtual void Cut() = 0; - virtual void Paste() = 0; - - virtual bool CanCopy() const; - virtual bool CanCut() const; - virtual bool CanPaste() const; - - // undo/redo - // --------- - - virtual void Undo() = 0; - virtual void Redo() = 0; - - virtual bool CanUndo() const = 0; - virtual bool CanRedo() const = 0; - - - // insertion point - // --------------- - - // note that moving insertion point removes any current selection - virtual void SetInsertionPoint(long pos) = 0; - virtual void SetInsertionPointEnd() { SetInsertionPoint(-1); } - virtual long GetInsertionPoint() const = 0; - virtual long GetLastPosition() const = 0; - - - // selection - // --------- - - virtual void SetSelection(long from, long to) = 0; - virtual void SelectAll() { SetSelection(-1, -1); } - virtual void GetSelection(long *from, long *to) const = 0; - bool HasSelection() const; - virtual wxString GetStringSelection() const; - - - // auto-completion - // --------------- - - // these functions allow to auto-complete the text already entered into the - // control using either the given fixed list of strings, the paths from the - // file system or an arbitrary user-defined completer - // - // they all return true if completion was enabled or false on error (most - // commonly meaning that this functionality is not available under the - // current platform) - - bool AutoComplete(const wxArrayString& choices) - { return DoAutoCompleteStrings(choices); } - - bool AutoCompleteFileNames() - { return DoAutoCompleteFileNames(wxFILE); } - - bool AutoCompleteDirectories() - { return DoAutoCompleteFileNames(wxDIR); } - - // notice that we take ownership of the pointer and will delete it - // - // if the pointer is NULL auto-completion is disabled - bool AutoComplete(wxTextCompleter *completer) - { return DoAutoCompleteCustom(completer); } - - - // status - // ------ - - virtual bool IsEditable() const = 0; - virtual void SetEditable(bool editable) = 0; - - - // set the max number of characters which may be entered in a single line - // text control - virtual void SetMaxLength(unsigned long WXUNUSED(len)) { } - - - // hints - // ----- - - // hint is the (usually greyed out) text shown in the control as long as - // it's empty and doesn't have focus, it is typically used in controls used - // for searching to let the user know what is supposed to be entered there - - virtual bool SetHint(const wxString& hint); - virtual wxString GetHint() const; - - - // margins - // ------- - - // margins are the empty space between borders of control and the text - // itself. When setting margin, use value -1 to indicate that specific - // margin should not be changed. - - bool SetMargins(const wxPoint& pt) - { return DoSetMargins(pt); } - bool SetMargins(wxCoord left, wxCoord top = -1) - { return DoSetMargins(wxPoint(left, top)); } - wxPoint GetMargins() const - { return DoGetMargins(); } - - - // implementation only - // ------------------- - - // generate the wxEVT_COMMAND_TEXT_UPDATED event for GetEditableWindow(), - // like SetValue() does and return true if the event was processed - // - // NB: this is public for wxRichTextCtrl use only right now, do not call it - static bool SendTextUpdatedEvent(wxWindow *win); - - // generate the wxEVT_COMMAND_TEXT_UPDATED event for this window - bool SendTextUpdatedEvent() - { - return SendTextUpdatedEvent(GetEditableWindow()); - } - - - // generate the wxEVT_COMMAND_TEXT_UPDATED event for this window if the - // events are not currently disabled - void SendTextUpdatedEventIfAllowed() - { - if ( EventsAllowed() ) - SendTextUpdatedEvent(); - } - - // this function is provided solely for the purpose of forwarding text - // change notifications state from one control to another, e.g. it can be - // used by a wxComboBox which derives from wxTextEntry if it delegates all - // of its methods to another wxTextCtrl - void ForwardEnableTextChangedEvents(bool enable) - { - // it's important to call the functions which update m_eventsBlock here - // and not just our own EnableTextChangedEvents() because our state - // (i.e. the result of EventsAllowed()) must change as well - if ( enable ) - ResumeTextChangedEvents(); - else - SuppressTextChangedEvents(); - } - -protected: - // flags for DoSetValue(): common part of SetValue() and ChangeValue() and - // also used to implement WriteText() in wxMSW - enum - { - SetValue_NoEvent = 0, - SetValue_SendEvent = 1, - SetValue_SelectionOnly = 2 - }; - - virtual void DoSetValue(const wxString& value, int flags); - virtual wxString DoGetValue() const = 0; - - // override this to return the associated window, it will be used for event - // generation and also by generic hints implementation - virtual wxWindow *GetEditableWindow() = 0; - - // margins functions - virtual bool DoSetMargins(const wxPoint& pt); - virtual wxPoint DoGetMargins() const; - - // the derived classes should override these virtual methods to implement - // auto-completion, they do the same thing as their public counterparts but - // have different names to allow overriding just one of them without hiding - // the other one(s) - virtual bool DoAutoCompleteStrings(const wxArrayString& WXUNUSED(choices)) - { return false; } - virtual bool DoAutoCompleteFileNames(int WXUNUSED(flags)) // wxFILE | wxDIR - { return false; } - virtual bool DoAutoCompleteCustom(wxTextCompleter *completer); - - - // class which should be used to temporarily disable text change events - // - // if suppress argument in ctor is false, nothing is done - class EventsSuppressor - { - public: - EventsSuppressor(wxTextEntryBase *text, bool suppress = true) - : m_text(text), - m_suppress(suppress) - { - if ( m_suppress ) - m_text->SuppressTextChangedEvents(); - } - - ~EventsSuppressor() - { - if ( m_suppress ) - m_text->ResumeTextChangedEvents(); - } - - private: - wxTextEntryBase *m_text; - bool m_suppress; - }; - - friend class EventsSuppressor; - -private: - // suppress or resume the text changed events generation: don't use these - // functions directly, use EventsSuppressor class above instead - void SuppressTextChangedEvents() - { - if ( !m_eventsBlock++ ) - EnableTextChangedEvents(false); - } - - void ResumeTextChangedEvents() - { - if ( !--m_eventsBlock ) - EnableTextChangedEvents(true); - } - - - // this must be overridden in the derived classes if our implementation of - // SetValue() or Replace() is used to disable (and enable back) generation - // of the text changed events - // - // initially the generation of the events is enabled - virtual void EnableTextChangedEvents(bool WXUNUSED(enable)) { } - - // return true if the events are currently not suppressed - bool EventsAllowed() const { return m_eventsBlock == 0; } - - - // if this counter is non-null, events are blocked - unsigned m_eventsBlock; - - // hint-related stuff, only allocated if/when SetHint() is used - wxTextEntryHintData *m_hintData; - - // It needs to call our Do{Get,Set}Value() to work with the real control - // contents. - friend class wxTextEntryHintData; -}; - -#ifdef __WXUNIVERSAL__ - // TODO: we need to use wxTextEntryDelegate here, but for now just prevent - // the GTK/MSW classes from being used in wxUniv build - class WXDLLIMPEXP_CORE wxTextEntry : public wxTextEntryBase - { - }; -#elif defined(__WXGTK20__) - #include "wx/gtk/textentry.h" -#elif defined(__WXMAC__) - #include "wx/osx/textentry.h" -#elif defined(__WXMSW__) - #include "wx/msw/textentry.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/textentry.h" -#elif defined(__WXPM__) - #include "wx/os2/textentry.h" -#else - // no platform-specific implementation of wxTextEntry yet - class WXDLLIMPEXP_CORE wxTextEntry : public wxTextEntryBase - { - }; -#endif - -#endif // _WX_TEXTENTRY_H_ - diff --git a/Source/3rd Party/wx/include/wx/textfile.h b/Source/3rd Party/wx/include/wx/textfile.h index f21f0fbd9..5d9bcdb4a 100644 --- a/Source/3rd Party/wx/include/wx/textfile.h +++ b/Source/3rd Party/wx/include/wx/textfile.h @@ -6,7 +6,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 03.04.98 -// RCS-ID: $Id$ +// RCS-ID: $Id: textfile.h 38570 2006-04-05 14:37:47Z VZ $ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -46,7 +46,7 @@ private: wxFile m_file; - wxDECLARE_NO_COPY_CLASS(wxTextFile); + DECLARE_NO_COPY_CLASS(wxTextFile) }; #else // !wxUSE_TEXTFILE diff --git a/Source/3rd Party/wx/include/wx/textwrapper.h b/Source/3rd Party/wx/include/wx/textwrapper.h deleted file mode 100644 index f1f9216d7..000000000 --- a/Source/3rd Party/wx/include/wx/textwrapper.h +++ /dev/null @@ -1,129 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/textwrapper.h -// Purpose: declaration of wxTextWrapper class -// Author: Vadim Zeitlin -// Created: 2009-05-31 (extracted from dlgcmn.cpp via wx/private/stattext.h) -// RCS-ID: $Id$ -// Copyright: (c) 1999, 2009 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TEXTWRAPPER_H_ -#define _WX_TEXTWRAPPER_H_ - -#include "wx/window.h" - -// ---------------------------------------------------------------------------- -// wxTextWrapper -// ---------------------------------------------------------------------------- - -// this class is used to wrap the text on word boundary: wrapping is done by -// calling OnStartLine() and OnOutputLine() functions -class WXDLLIMPEXP_CORE wxTextWrapper -{ -public: - wxTextWrapper() { m_eol = false; } - - // win is used for getting the font, text is the text to wrap, width is the - // max line width or -1 to disable wrapping - void Wrap(wxWindow *win, const wxString& text, int widthMax); - - // we don't need it, but just to avoid compiler warnings - virtual ~wxTextWrapper() { } - -protected: - // line may be empty - virtual void OnOutputLine(const wxString& line) = 0; - - // called at the start of every new line (except the very first one) - virtual void OnNewLine() { } - -private: - // call OnOutputLine() and set m_eol to true - void DoOutputLine(const wxString& line) - { - OnOutputLine(line); - - m_eol = true; - } - - // this function is a destructive inspector: when it returns true it also - // resets the flag to false so calling it again wouldn't return true any - // more - bool IsStartOfNewLine() - { - if ( !m_eol ) - return false; - - m_eol = false; - - return true; - } - - - bool m_eol; - - wxDECLARE_NO_COPY_CLASS(wxTextWrapper); -}; - -#if wxUSE_STATTEXT - -#include "wx/sizer.h" -#include "wx/stattext.h" - -// A class creating a sizer with one static text per line of text. Creation of -// the controls used for each line can be customized by overriding -// OnCreateLine() function. -// -// This class is currently private to wxWidgets and used only by wxDialog -// itself. We may make it public later if there is sufficient interest. -class wxTextSizerWrapper : public wxTextWrapper -{ -public: - wxTextSizerWrapper(wxWindow *win) - { - m_win = win; - m_hLine = 0; - } - - wxSizer *CreateSizer(const wxString& text, int widthMax) - { - m_sizer = new wxBoxSizer(wxVERTICAL); - Wrap(m_win, text, widthMax); - return m_sizer; - } - - wxWindow *GetParent() const { return m_win; } - -protected: - virtual wxWindow *OnCreateLine(const wxString& line) - { - return new wxStaticText(m_win, wxID_ANY, - wxControl::EscapeMnemonics(line)); - } - - virtual void OnOutputLine(const wxString& line) - { - if ( !line.empty() ) - { - m_sizer->Add(OnCreateLine(line)); - } - else // empty line, no need to create a control for it - { - if ( !m_hLine ) - m_hLine = m_win->GetCharHeight(); - - m_sizer->Add(5, m_hLine); - } - } - -private: - wxWindow *m_win; - wxSizer *m_sizer; - int m_hLine; -}; - -#endif // wxUSE_STATTEXT - -#endif // _WX_TEXTWRAPPER_H_ - diff --git a/Source/3rd Party/wx/include/wx/tglbtn.h b/Source/3rd Party/wx/include/wx/tglbtn.h index d34c7d034..c20b9e4a0 100644 --- a/Source/3rd Party/wx/include/wx/tglbtn.h +++ b/Source/3rd Party/wx/include/wx/tglbtn.h @@ -5,9 +5,9 @@ // Author: John Norris, minor changes by Axel Schlueter // Modified by: // Created: 08.02.01 -// RCS-ID: $Id$ +// RCS-ID: $Id: tglbtn.h 39293 2006-05-23 17:53:50Z JS $ // Copyright: (c) 2000 Johnny C. Norris II -// Licence: wxWindows Licence +// License: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_TOGGLEBUTTON_H_BASE_ @@ -18,58 +18,11 @@ #if wxUSE_TOGGLEBTN #include "wx/event.h" -#include "wx/anybutton.h" // base class - -extern WXDLLIMPEXP_DATA_CORE(const char) wxCheckBoxNameStr[]; - -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEvent ); - -// ---------------------------------------------------------------------------- -// wxToggleButtonBase -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxToggleButtonBase : public wxAnyButton -{ -public: - wxToggleButtonBase() { } - - // Get/set the value - virtual void SetValue(bool state) = 0; - virtual bool GetValue() const = 0; - - void UpdateWindowUI(long flags) - { - wxControl::UpdateWindowUI(flags); - - if ( !IsShown() ) - return; - - wxWindow *tlw = wxGetTopLevelParent( this ); - if (tlw && wxPendingDelete.Member( tlw )) - return; - - wxUpdateUIEvent event( GetId() ); - event.SetEventObject(this); - - if (GetEventHandler()->ProcessEvent(event) ) - { - if ( event.GetSetChecked() ) - SetValue( event.GetChecked() ); - } - } - - // Buttons on MSW can look bad if they are not native colours, because - // then they become owner-drawn and not theme-drawn. Disable it here - // in wxToggleButtonBase to make it consistent. - virtual bool ShouldInheritColours() const { return false; } - -protected: - // choose the default border for this window - virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } - - wxDECLARE_NO_COPY_CLASS(wxToggleButtonBase); -}; +#include "wx/control.h" // base class +BEGIN_DECLARE_EVENT_TYPES() + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, 19) +END_DECLARE_EVENT_TYPES() #define EVT_TOGGLEBUTTON(id, fn) \ wx__DECLARE_EVT1(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, id, wxCommandEventHandler(fn)) @@ -78,17 +31,16 @@ protected: #include "wx/univ/tglbtn.h" #elif defined(__WXMSW__) #include "wx/msw/tglbtn.h" - #define wxHAS_BITMAPTOGGLEBUTTON #elif defined(__WXGTK20__) #include "wx/gtk/tglbtn.h" - #define wxHAS_BITMAPTOGGLEBUTTON #elif defined(__WXGTK__) #include "wx/gtk1/tglbtn.h" # elif defined(__WXMOTIF__) #include "wx/motif/tglbtn.h" #elif defined(__WXMAC__) - #include "wx/osx/tglbtn.h" - #define wxHAS_BITMAPTOGGLEBUTTON + #include "wx/mac/tglbtn.h" +#elif defined(__WXPALMOS__) + #include "wx/palmos/tglbtn.h" #elif defined(__WXPM__) #include "wx/os2/tglbtn.h" #endif diff --git a/Source/3rd Party/wx/include/wx/thread.h b/Source/3rd Party/wx/include/wx/thread.h index c5ccdeea2..bd913fe81 100644 --- a/Source/3rd Party/wx/include/wx/thread.h +++ b/Source/3rd Party/wx/include/wx/thread.h @@ -5,7 +5,7 @@ // Modified by: Vadim Zeitlin (modifications partly inspired by omnithreads // package from Olivetti & Oracle Research Laboratory) // Created: 04/13/98 -// RCS-ID: $Id$ +// RCS-ID: $Id: thread.h 66924 2011-02-16 22:58:53Z JS $ // Copyright: (c) Guilhem Lavaux // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -22,6 +22,11 @@ #if wxUSE_THREADS +// Windows headers define it +#ifdef Yield + #undef Yield +#endif + // ---------------------------------------------------------------------------- // constants // ---------------------------------------------------------------------------- @@ -33,7 +38,6 @@ enum wxMutexError wxMUTEX_DEAD_LOCK, // mutex is already locked by the calling thread wxMUTEX_BUSY, // mutex is already locked by another thread wxMUTEX_UNLOCKED, // attempt to unlock a mutex which is not locked - wxMUTEX_TIMEOUT, // LockTimeout() has timed out wxMUTEX_MISC_ERROR // any other error }; @@ -71,21 +75,6 @@ enum wxThreadKind wxTHREAD_JOINABLE }; -enum wxThreadWait -{ - wxTHREAD_WAIT_BLOCK, - wxTHREAD_WAIT_YIELD, // process events while waiting; MSW only - - // For compatibility reasons we use wxTHREAD_WAIT_YIELD by default as this - // was the default behaviour of wxMSW 2.8 but it should be avoided as it's - // dangerous and not portable. -#if WXWIN_COMPATIBILITY_2_8 - wxTHREAD_WAIT_DEFAULT = wxTHREAD_WAIT_YIELD -#else - wxTHREAD_WAIT_DEFAULT = wxTHREAD_WAIT_BLOCK -#endif -}; - // defines the interval of priority enum { @@ -160,10 +149,6 @@ public: // The caller must call Unlock() later if Lock() returned wxMUTEX_NO_ERROR. wxMutexError Lock(); - // Same as Lock() but return wxMUTEX_TIMEOUT if the mutex can't be locked - // during the given number of milliseconds - wxMutexError LockTimeout(unsigned long ms); - // Try to lock the mutex: if it is currently locked, return immediately // with an error. Otherwise the caller must call Unlock(). wxMutexError TryLock(); @@ -176,7 +161,7 @@ protected: friend class wxConditionInternal; - wxDECLARE_NO_COPY_CLASS(wxMutex); + DECLARE_NO_COPY_CLASS(wxMutex) }; // a helper class which locks the mutex in the ctor and unlocks it in the dtor: @@ -219,46 +204,35 @@ private: // in order to avoid any overhead under platforms where critical sections are // just mutexes make all wxCriticalSection class functions inline -#if !defined(__WINDOWS__) +#if !defined(__WXMSW__) && !defined(__WXMAC__) #define wxCRITSECT_IS_MUTEX 1 - #define wxCRITSECT_INLINE WXEXPORT inline + #define wxCRITSECT_INLINE inline #else // MSW #define wxCRITSECT_IS_MUTEX 0 #define wxCRITSECT_INLINE #endif // MSW/!MSW -enum wxCriticalSectionType -{ - // recursive critical section - wxCRITSEC_DEFAULT, - - // non-recursive critical section - wxCRITSEC_NON_RECURSIVE -}; - // you should consider wxCriticalSectionLocker whenever possible instead of // directly working with wxCriticalSection class - it is safer class WXDLLIMPEXP_BASE wxCriticalSection { public: // ctor & dtor - wxCRITSECT_INLINE wxCriticalSection( wxCriticalSectionType critSecType = wxCRITSEC_DEFAULT ); + wxCRITSECT_INLINE wxCriticalSection(); wxCRITSECT_INLINE ~wxCriticalSection(); + // enter the section (the same as locking a mutex) wxCRITSECT_INLINE void Enter(); - // try to enter the section (the same as trying to lock a mutex) - wxCRITSECT_INLINE bool TryEnter(); - // leave the critical section (same as unlocking a mutex) wxCRITSECT_INLINE void Leave(); private: #if wxCRITSECT_IS_MUTEX wxMutex m_mutex; -#elif defined(__WINDOWS__) +#elif defined(__WXMSW__) // we can't allocate any memory in the ctor, so use placement new - // unfortunately, we have to hardcode the sizeof() here because we can't // include windows.h from this public header and we also have to use the @@ -266,6 +240,10 @@ private: // // if CRITICAL_SECTION size changes in Windows, you'll get an assert from // thread.cpp and will need to increase the buffer size + // + // finally, we need this typedef instead of declaring m_buffer directly + // because otherwise the assert mentioned above wouldn't compile with some + // compilers (notably CodeWarrior 8) #ifdef __WIN64__ typedef char wxCritSectBuffer[40]; #else // __WIN32__ @@ -278,19 +256,19 @@ private: wxCritSectBuffer m_buffer; }; +#elif defined(__WXMAC__) + void *m_critRegion ; #endif // Unix&OS2/Win32 - wxDECLARE_NO_COPY_CLASS(wxCriticalSection); + DECLARE_NO_COPY_CLASS(wxCriticalSection) }; #if wxCRITSECT_IS_MUTEX // implement wxCriticalSection using mutexes - inline wxCriticalSection::wxCriticalSection( wxCriticalSectionType critSecType ) - : m_mutex( critSecType == wxCRITSEC_DEFAULT ? wxMUTEX_RECURSIVE : wxMUTEX_DEFAULT ) { } + inline wxCriticalSection::wxCriticalSection() { } inline wxCriticalSection::~wxCriticalSection() { } inline void wxCriticalSection::Enter() { (void)m_mutex.Lock(); } - inline bool wxCriticalSection::TryEnter() { return m_mutex.TryLock() == wxMUTEX_NO_ERROR; } inline void wxCriticalSection::Leave() { (void)m_mutex.Unlock(); } #endif // wxCRITSECT_IS_MUTEX @@ -316,7 +294,7 @@ public: private: wxCriticalSection& m_critsect; - wxDECLARE_NO_COPY_CLASS(wxCriticalSectionLocker); + DECLARE_NO_COPY_CLASS(wxCriticalSectionLocker) }; // ---------------------------------------------------------------------------- @@ -379,7 +357,7 @@ public: private: wxConditionInternal *m_internal; - wxDECLARE_NO_COPY_CLASS(wxCondition); + DECLARE_NO_COPY_CLASS(wxCondition) }; #if WXWIN_COMPATIBILITY_2_6 @@ -424,7 +402,7 @@ public: private: wxSemaphoreInternal *m_internal; - wxDECLARE_NO_COPY_CLASS(wxSemaphore); + DECLARE_NO_COPY_CLASS(wxSemaphore) }; // ---------------------------------------------------------------------------- @@ -462,24 +440,14 @@ public: static wxThread *This(); // Returns true if current thread is the main thread. - // - // Notice that it also returns true if main thread id hadn't been - // initialized yet on the assumption that it's too early in wx startup - // process for any other threads to have been created in this case. - static bool IsMain() - { - return !ms_idMainThread || GetCurrentId() == ms_idMainThread; - } - - // Return the main thread id - static wxThreadIdType GetMainId() { return ms_idMainThread; } + static bool IsMain(); // Release the rest of our time slice letting the other threads run static void Yield(); // Sleep during the specified period of time in milliseconds // - // This is the same as wxMilliSleep(). + // NB: at least under MSW worker threads can not call ::wxSleep()! static void Sleep(unsigned long milliseconds); // get the number of system CPUs - useful with SetConcurrency() @@ -491,7 +459,7 @@ public: // Get the platform specific thread ID and return as a long. This // can be used to uniquely identify threads, even if they are not // wxThreads. This is used by wxPython. - static wxThreadIdType GetCurrentId(); + static wxThreadIdType GetCurrentId(); // sets the concurrency level: this is, roughly, the number of threads // the system tries to schedule to run in parallel. 0 means the @@ -531,14 +499,13 @@ public: // does it! // // will fill the rc pointer with the thread exit code if it's !NULL - wxThreadError Delete(ExitCode *rc = NULL, - wxThreadWait waitMode = wxTHREAD_WAIT_DEFAULT); + wxThreadError Delete(ExitCode *rc = (ExitCode *)NULL); // waits for a joinable thread to finish and returns its exit code // // Returns (ExitCode)-1 on error (for example, if the thread is not // joinable) - ExitCode Wait(wxThreadWait waitMode = wxTHREAD_WAIT_DEFAULT); + ExitCode Wait(); // kills the thread without giving it any chance to clean up - should // not be used under normal circumstances, use Delete() instead. @@ -581,8 +548,10 @@ public: // identifies a thread inside a process wxThreadIdType GetId() const; - wxThreadKind GetKind() const - { return m_isDetached ? wxTHREAD_DETACHED : wxTHREAD_JOINABLE; } + // called when the thread exits - in the context of this thread + // + // NB: this function will not be called if the thread is Kill()ed + virtual void OnExit() { } // Returns true if the thread was asked to terminate: this function should // be called by the thread from time to time, otherwise the main thread @@ -601,35 +570,12 @@ protected: // of this thread. virtual void *Entry() = 0; - - // Callbacks which may be overridden by the derived class to perform some - // specific actions when the thread is deleted or killed. By default they - // do nothing. - - // This one is called by Delete() before actually deleting the thread and - // is executed in the context of the thread that called Delete(). - virtual void OnDelete() {} - - // This one is called by Kill() before killing the thread and is executed - // in the context of the thread that called Kill(). - virtual void OnKill() {} - private: // no copy ctor/assignment operator wxThread(const wxThread&); wxThread& operator=(const wxThread&); - // called when the thread exits - in the context of this thread - // - // NB: this function will not be called if the thread is Kill()ed - virtual void OnExit() { } - friend class wxThreadInternal; - friend class wxThreadModule; - - - // the main thread identifier, should be set on startup - static wxThreadIdType ms_idMainThread; // the (platform-dependent) thread class implementation wxThreadInternal *m_internal; @@ -649,8 +595,8 @@ class WXDLLIMPEXP_BASE wxThreadHelperThread : public wxThread public: // constructor only creates the C++ thread object and doesn't create (or // start) the real thread - wxThreadHelperThread(wxThreadHelper& owner, wxThreadKind kind) - : wxThread(kind), m_owner(owner) + wxThreadHelperThread(wxThreadHelper& owner) + : wxThread(wxTHREAD_JOINABLE), m_owner(owner) { } protected: @@ -677,44 +623,27 @@ class WXDLLIMPEXP_BASE wxThreadHelper private: void KillThread() { - // If wxThreadHelperThread is detached and is about to finish, it will - // set m_thread to NULL so don't delete it then. - // But if KillThread is called before wxThreadHelperThread (in detached mode) - // sets it to NULL, then the thread object still exists and can be killed - wxCriticalSectionLocker locker(m_critSection); - if ( m_thread ) { m_thread->Kill(); - - if ( m_kind == wxTHREAD_JOINABLE ) - delete m_thread; - - m_thread = NULL; + delete m_thread; } } public: // constructor only initializes m_thread to NULL - wxThreadHelper(wxThreadKind kind = wxTHREAD_JOINABLE) - : m_thread(NULL), m_kind(kind) { } + wxThreadHelper() : m_thread(NULL) { } // destructor deletes m_thread virtual ~wxThreadHelper() { KillThread(); } -#if WXWIN_COMPATIBILITY_2_8 - wxDEPRECATED( wxThreadError Create(unsigned int stackSize = 0) ); -#endif - // create a new thread (and optionally set the stack size on platforms that // support/need that), call Run() to start it - wxThreadError CreateThread(wxThreadKind kind = wxTHREAD_JOINABLE, - unsigned int stackSize = 0) + wxThreadError Create(unsigned int stackSize = 0) { KillThread(); - m_kind = kind; - m_thread = new wxThreadHelperThread(*this, m_kind); + m_thread = new wxThreadHelperThread(*this); return m_thread->Create(stackSize); } @@ -724,43 +653,16 @@ public: virtual void *Entry() = 0; // returns a pointer to the thread which can be used to call Run() - wxThread *GetThread() const - { - wxCriticalSectionLocker locker((wxCriticalSection&)m_critSection); - - wxThread* thread = m_thread; - - return thread; - } + wxThread *GetThread() const { return m_thread; } protected: wxThread *m_thread; - wxThreadKind m_kind; - wxCriticalSection m_critSection; // To guard the m_thread variable - - friend class wxThreadHelperThread; }; -#if WXWIN_COMPATIBILITY_2_8 -inline wxThreadError wxThreadHelper::Create(unsigned int stackSize) -{ return CreateThread(m_kind, stackSize); } -#endif - // call Entry() in owner, put it down here to avoid circular declarations inline void *wxThreadHelperThread::Entry() { - void * const result = m_owner.Entry(); - - wxCriticalSectionLocker locker(m_owner.m_critSection); - - // Detached thread will be deleted after returning, so make sure - // wxThreadHelper::GetThread will not return an invalid pointer. - // And that wxThreadHelper::KillThread will not try to kill - // an already deleted thread - if ( m_owner.m_kind == wxTHREAD_DETACHED ) - m_owner.m_thread = NULL; - - return result; + return m_owner.Entry(); } // ---------------------------------------------------------------------------- @@ -786,8 +688,8 @@ inline bool wxIsMainThread() { return wxThread::IsMain(); } #else // !wxUSE_THREADS // no thread support -inline void wxMutexGuiEnter() { } -inline void wxMutexGuiLeave() { } +inline void WXDLLIMPEXP_BASE wxMutexGuiEnter() { } +inline void WXDLLIMPEXP_BASE wxMutexGuiLeave() { } // macros for entering/leaving critical sections which may be used without // having to take them inside "#if wxUSE_THREADS" @@ -840,7 +742,7 @@ public: #if wxUSE_THREADS -#if defined(__WINDOWS__) || defined(__OS2__) || defined(__EMX__) || defined(__WXOSX__) +#if defined(__WXMSW__) || defined(__WXMAC__) || defined(__OS2__) || defined(__EMX__) // unlock GUI if there are threads waiting for and lock it back when // there are no more of them - should be called periodically by the main // thread @@ -852,12 +754,10 @@ public: // wakes up the main thread if it's sleeping inside ::GetMessage() extern void WXDLLIMPEXP_BASE wxWakeUpMainThread(); -#ifndef __WXOSX__ // return true if the main thread is waiting for some other to terminate: // wxApp then should block all "dangerous" messages extern bool WXDLLIMPEXP_BASE wxIsWaitingForThread(); -#endif -#endif // MSW, OS/2 +#endif // MSW, Mac, OS/2 #endif // wxUSE_THREADS diff --git a/Source/3rd Party/wx/include/wx/thrimpl.cpp b/Source/3rd Party/wx/include/wx/thrimpl.cpp index 34f9cfdcc..27780b8ab 100644 --- a/Source/3rd Party/wx/include/wx/thrimpl.cpp +++ b/Source/3rd Party/wx/include/wx/thrimpl.cpp @@ -1,10 +1,10 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/thrimpl.cpp +// Name: include/wx/thrimpl.cpp // Purpose: common part of wxThread Implementations // Author: Vadim Zeitlin // Modified by: // Created: 04.06.02 (extracted from src/*/thread.cpp files) -// RCS-ID: $Id$ +// RCS-ID: $Id: thrimpl.cpp 66922 2011-02-16 22:26:57Z JS $ // Copyright: (c) Vadim Zeitlin (2002) // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -44,14 +44,6 @@ wxMutexError wxMutex::Lock() return m_internal->Lock(); } -wxMutexError wxMutex::LockTimeout(unsigned long ms) -{ - wxCHECK_MSG( m_internal, wxMUTEX_INVALID, - wxT("wxMutex::Lock(): not initialized") ); - - return m_internal->Lock(ms); -} - wxMutexError wxMutex::TryLock() { wxCHECK_MSG( m_internal, wxMUTEX_INVALID, @@ -76,7 +68,7 @@ wxMutexError wxMutex::Unlock() // variables and their events/event semaphores have quite different semantics, // so we reimplement the conditions from scratch using the mutexes and // semaphores -#if defined(__WINDOWS__) || defined(__OS2__) || defined(__EMX__) +#if defined(__WXMSW__) || defined(__OS2__) || defined(__EMX__) class wxConditionInternal { @@ -101,7 +93,7 @@ private: wxMutex& m_mutex; wxSemaphore m_semaphore; - wxDECLARE_NO_COPY_CLASS(wxConditionInternal); + DECLARE_NO_COPY_CLASS(wxConditionInternal) }; wxConditionInternal::wxConditionInternal(wxMutex& mutex) @@ -223,7 +215,7 @@ wxCondError wxConditionInternal::Broadcast() return wxCOND_NO_ERROR; } -#endif // __WINDOWS__ || __OS2__ || __EMX__ +#endif // MSW or OS2 // ---------------------------------------------------------------------------- // wxCondition @@ -338,13 +330,3 @@ wxSemaError wxSemaphore::Post() return m_internal->Post(); } -// ---------------------------------------------------------------------------- -// wxThread -// ---------------------------------------------------------------------------- - -#include "wx/utils.h" - -void wxThread::Sleep(unsigned long milliseconds) -{ - wxMilliSleep(milliseconds); -} diff --git a/Source/3rd Party/wx/include/wx/time.h b/Source/3rd Party/wx/include/wx/time.h deleted file mode 100644 index 1db7179be..000000000 --- a/Source/3rd Party/wx/include/wx/time.h +++ /dev/null @@ -1,77 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/time.h -// Purpose: Miscellaneous time-related functions. -// Author: Vadim Zeitlin -// Created: 2011-11-26 -// RCS-ID: $Id: wxhead.h,v 1.12 2010-04-22 12:44:51 zeitlin Exp $ -// Copyright: (c) 2011 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TIME_H_ -#define _WX_TIME_H_ - -#include "wx/longlong.h" - -// Returns the difference between UTC and local time in seconds. -WXDLLIMPEXP_BASE int wxGetTimeZone(); - -// Get number of seconds since local time 00:00:00 Jan 1st 1970. -extern long WXDLLIMPEXP_BASE wxGetLocalTime(); - -// Get number of seconds since GMT 00:00:00, Jan 1st 1970. -extern long WXDLLIMPEXP_BASE wxGetUTCTime(); - -#if wxUSE_LONGLONG - typedef wxLongLong wxMilliClock_t; - inline long wxMilliClockToLong(wxLongLong ll) { return ll.ToLong(); } -#else - typedef double wxMilliClock_t; - inline long wxMilliClockToLong(double d) { return wx_truncate_cast(long, d); } -#endif // wxUSE_LONGLONG - -// Get number of milliseconds since local time 00:00:00 Jan 1st 1970 -extern wxMilliClock_t WXDLLIMPEXP_BASE wxGetLocalTimeMillis(); - -#if wxUSE_LONGLONG - -// Get the number of milliseconds or microseconds since the Epoch. -wxLongLong WXDLLIMPEXP_BASE wxGetUTCTimeMillis(); -wxLongLong WXDLLIMPEXP_BASE wxGetUTCTimeUSec(); - -#endif // wxUSE_LONGLONG - -#define wxGetCurrentTime() wxGetLocalTime() - -// on some really old systems gettimeofday() doesn't have the second argument, -// define wxGetTimeOfDay() to hide this difference -#ifdef HAVE_GETTIMEOFDAY - #ifdef WX_GETTIMEOFDAY_NO_TZ - #define wxGetTimeOfDay(tv) gettimeofday(tv) - #else - #define wxGetTimeOfDay(tv) gettimeofday((tv), NULL) - #endif -#endif // HAVE_GETTIMEOFDAY - -/* Two wrapper functions for thread safety */ -#ifdef HAVE_LOCALTIME_R -#define wxLocaltime_r localtime_r -#else -WXDLLIMPEXP_BASE struct tm *wxLocaltime_r(const time_t*, struct tm*); -#if wxUSE_THREADS && !defined(__WINDOWS__) && !defined(__WATCOMC__) - // On Windows, localtime _is_ threadsafe! -#warning using pseudo thread-safe wrapper for localtime to emulate localtime_r -#endif -#endif - -#ifdef HAVE_GMTIME_R -#define wxGmtime_r gmtime_r -#else -WXDLLIMPEXP_BASE struct tm *wxGmtime_r(const time_t*, struct tm*); -#if wxUSE_THREADS && !defined(__WINDOWS__) && !defined(__WATCOMC__) - // On Windows, gmtime _is_ threadsafe! -#warning using pseudo thread-safe wrapper for gmtime to emulate gmtime_r -#endif -#endif - -#endif // _WX_TIME_H_ diff --git a/Source/3rd Party/wx/include/wx/timer.h b/Source/3rd Party/wx/include/wx/timer.h index 98939d9a5..f81cd3860 100644 --- a/Source/3rd Party/wx/include/wx/timer.h +++ b/Source/3rd Party/wx/include/wx/timer.h @@ -5,7 +5,7 @@ // Modified by: Vadim Zeitlin (wxTimerBase) // Guillermo Rodriguez (global clean up) // Created: 04/01/98 -// RCS-ID: $Id$ +// RCS-ID: $Id: timer.h 44244 2007-01-18 17:00:52Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -15,13 +15,13 @@ #include "wx/defs.h" -#if wxUSE_TIMER +#if wxUSE_GUI && wxUSE_TIMER #include "wx/object.h" #include "wx/longlong.h" #include "wx/event.h" #include "wx/stopwatch.h" // for backwards compatibility -#include "wx/utils.h" +#include "wx/window.h" // only for NewControlId() // more readable flags for Start(): @@ -32,14 +32,8 @@ // only send the notification once and then stop the timer #define wxTIMER_ONE_SHOT true -class WXDLLIMPEXP_FWD_BASE wxTimerImpl; -class WXDLLIMPEXP_FWD_BASE wxTimerEvent; - -// timer event type -wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_BASE, wxEVT_TIMER, wxTimerEvent); - // the interface of wxTimer class -class WXDLLIMPEXP_BASE wxTimer : public wxEvtHandler +class WXDLLEXPORT wxTimerBase : public wxEvtHandler { public: // ctors and initializers @@ -47,33 +41,29 @@ public: // default: if you don't call SetOwner(), your only chance to get timer // notifications is to override Notify() in the derived class - wxTimer() - { - Init(); - SetOwner(this); - } + wxTimerBase() + { Init(); SetOwner(this); } // ctor which allows to avoid having to override Notify() in the derived // class: the owner will get timer notifications which can be handled with // EVT_TIMER - wxTimer(wxEvtHandler *owner, int timerid = wxID_ANY) - { - Init(); - SetOwner(owner, timerid); - } + wxTimerBase(wxEvtHandler *owner, int timerid = wxID_ANY) + { Init(); SetOwner(owner, timerid); } // same as ctor above - void SetOwner(wxEvtHandler *owner, int timerid = wxID_ANY); + void SetOwner(wxEvtHandler *owner, int timerid = wxID_ANY) + { + m_owner = owner; + m_idTimer = timerid == wxID_ANY ? wxWindow::NewControlId() : timerid; + } - virtual ~wxTimer(); + wxEvtHandler *GetOwner() const { return m_owner; } + virtual ~wxTimerBase(); // working with the timer // ---------------------- - // NB: Start() and Stop() are not supposed to be overridden, they are only - // virtual for historical reasons, only Notify() can be overridden - // start the timer: if milliseconds == -1, use the same value as for the // last Start() // @@ -81,46 +71,68 @@ public: // timer if it is already running virtual bool Start(int milliseconds = -1, bool oneShot = false); - // stop the timer, does nothing if the timer is not running - virtual void Stop(); + // stop the timer + virtual void Stop() = 0; // override this in your wxTimer-derived class if you want to process timer // messages in it, use non default ctor or SetOwner() otherwise virtual void Notify(); - - // accessors - // --------- - - // get the object notified about the timer events - wxEvtHandler *GetOwner() const; + // getting info + // ------------ // return true if the timer is running - bool IsRunning() const; + virtual bool IsRunning() const = 0; // return the timer ID - int GetId() const; + int GetId() const { return m_idTimer; } // get the (last) timer interval in milliseconds - int GetInterval() const; + int GetInterval() const { return m_milli; } // return true if the timer is one shot - bool IsOneShot() const; + bool IsOneShot() const { return m_oneShot; } protected: // common part of all ctors - void Init(); + void Init() + { m_owner = NULL; m_idTimer = wxID_ANY; m_milli = 0; m_oneShot = false; } - wxTimerImpl *m_impl; + wxEvtHandler *m_owner; + int m_idTimer; + int m_milli; // the timer interval + bool m_oneShot; // true if one shot - wxDECLARE_NO_COPY_CLASS(wxTimer); + DECLARE_NO_COPY_CLASS(wxTimerBase) }; +// ---------------------------------------------------------------------------- +// wxTimer itself +// ---------------------------------------------------------------------------- + +#if defined(__WXMSW__) + #include "wx/msw/timer.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/timer.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/timer.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/timer.h" +#elif defined(__WXX11__) || defined(__WXMGL__) || defined(__WXDFB__) + #include "wx/generic/timer.h" +#elif defined (__WXCOCOA__) + #include "wx/cocoa/timer.h" +#elif defined(__WXMAC__) + #include "wx/mac/timer.h" +#elif defined(__WXPM__) + #include "wx/os2/timer.h" +#endif + // ---------------------------------------------------------------------------- // wxTimerRunner: starts the timer in its ctor, stops in the dtor // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_BASE wxTimerRunner +class WXDLLEXPORT wxTimerRunner { public: wxTimerRunner(wxTimer& timer) : m_timer(timer) { } @@ -146,36 +158,31 @@ public: private: wxTimer& m_timer; - wxDECLARE_NO_COPY_CLASS(wxTimerRunner); + DECLARE_NO_COPY_CLASS(wxTimerRunner) }; // ---------------------------------------------------------------------------- // wxTimerEvent // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_BASE wxTimerEvent : public wxEvent +class WXDLLEXPORT wxTimerEvent : public wxEvent { public: - wxTimerEvent() - : wxEvent(wxID_ANY, wxEVT_TIMER) { m_timer=NULL; } - - wxTimerEvent(wxTimer& timer) - : wxEvent(timer.GetId(), wxEVT_TIMER), - m_timer(&timer) + wxTimerEvent(int timerid = 0, int interval = 0) : wxEvent(timerid) { - SetEventObject(timer.GetOwner()); + m_eventType = wxEVT_TIMER; + + m_interval = interval; } // accessors - int GetInterval() const { return m_timer->GetInterval(); } - wxTimer& GetTimer() const { return *m_timer; } + int GetInterval() const { return m_interval; } // implement the base class pure virtual virtual wxEvent *Clone() const { return new wxTimerEvent(*this); } - virtual wxEventCategory GetEventCategory() const { return wxEVT_CATEGORY_TIMER; } private: - wxTimer* m_timer; + int m_interval; DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxTimerEvent) }; @@ -183,11 +190,12 @@ private: typedef void (wxEvtHandler::*wxTimerEventFunction)(wxTimerEvent&); #define wxTimerEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxTimerEventFunction, func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxTimerEventFunction, &func) #define EVT_TIMER(timerid, func) \ wx__DECLARE_EVT1(wxEVT_TIMER, timerid, wxTimerEventHandler(func)) -#endif // wxUSE_TIMER +#endif // wxUSE_GUI && wxUSE_TIMER -#endif // _WX_TIMER_H_BASE_ +#endif + // _WX_TIMER_H_BASE_ diff --git a/Source/3rd Party/wx/include/wx/tipwin.h b/Source/3rd Party/wx/include/wx/tipwin.h index e8225550e..b6c8d350a 100644 --- a/Source/3rd Party/wx/include/wx/tipwin.h +++ b/Source/3rd Party/wx/include/wx/tipwin.h @@ -5,7 +5,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 10.09.00 -// RCS-ID: $Id$ +// RCS-ID: $Id: tipwin.h 53135 2008-04-12 02:31:04Z VZ $ // Copyright: (c) 2000 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -32,7 +32,7 @@ class WXDLLIMPEXP_FWD_CORE wxTipWindowView; // wxTipWindow // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxTipWindow : public wxTipWindowBase +class WXDLLEXPORT wxTipWindow : public wxTipWindowBase { public: // the mandatory ctor parameters are: the parent window and the text to @@ -90,7 +90,7 @@ private: friend class wxTipWindowView; - wxDECLARE_NO_COPY_CLASS(wxTipWindow); + DECLARE_NO_COPY_CLASS(wxTipWindow) }; #endif // wxUSE_TIPWINDOW diff --git a/Source/3rd Party/wx/include/wx/tls.h b/Source/3rd Party/wx/include/wx/tls.h deleted file mode 100644 index 44345a49c..000000000 --- a/Source/3rd Party/wx/include/wx/tls.h +++ /dev/null @@ -1,144 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/tls.h -// Purpose: Implementation of thread local storage -// Author: Vadim Zeitlin -// Created: 2008-08-08 -// RCS-ID: $Id$ -// Copyright: (c) 2008 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TLS_H_ -#define _WX_TLS_H_ - -#include "wx/defs.h" - -// ---------------------------------------------------------------------------- -// check for compiler support of thread-specific variables -// ---------------------------------------------------------------------------- - -// when not using threads at all, there is no need for thread-specific -// values to be really thread-specific -#if !wxUSE_THREADS - #define wxHAS_COMPILER_TLS - #define wxTHREAD_SPECIFIC_DECL -// otherwise try to find the compiler-specific way to handle TLS unless -// explicitly disabled by setting wxUSE_COMPILER_TLS to 0 (it is 1 by default). -#elif wxUSE_COMPILER_TLS -// __thread keyword is not supported correctly by MinGW, at least in some -// configurations, see http://sourceforge.net/support/tracker.php?aid=2837047 -// and when in doubt we prefer to not use it at all. -#if defined(HAVE___THREAD_KEYWORD) && !defined(__MINGW32__) - #define wxHAS_COMPILER_TLS - #define wxTHREAD_SPECIFIC_DECL __thread -// MSVC has its own version which might be supported by some other Windows -// compilers, to be tested -#elif wxCHECK_VISUALC_VERSION(7) - #define wxHAS_COMPILER_TLS - #define wxTHREAD_SPECIFIC_DECL __declspec(thread) -#endif // compilers -#endif // wxUSE_COMPILER_TLS - -// ---------------------------------------------------------------------------- -// define wxTLS_TYPE() -// ---------------------------------------------------------------------------- - -#ifdef wxHAS_COMPILER_TLS - #define wxTLS_TYPE(T) wxTHREAD_SPECIFIC_DECL T - #define wxTLS_PTR(var) (&(var)) - #define wxTLS_VALUE(var) (var) -#else // !wxHAS_COMPILER_TLS - - extern "C" - { - typedef void (*wxTlsDestructorFunction)(void*); - } - - #if defined(__WINDOWS__) - #include "wx/msw/tls.h" - #elif defined(__OS2__) - #include "wx/os2/tls.h" - #elif defined(__UNIX__) - #include "wx/unix/tls.h" - #else - // TODO: we could emulate TLS for such platforms... - #error Neither compiler nor OS support thread-specific variables. - #endif - - #include // for calloc() - - // wxTlsValue represents a thread-specific value of type T but, unlike - // with native compiler thread-specific variables, it behaves like a - // (never NULL) pointer to T and so needs to be dereferenced before use - // - // Note: T must be a POD! - // - // Note: On Unix, thread-specific T value is freed when the thread exits. - // On Windows, thread-specific values are freed later, when given - // wxTlsValue is destroyed. The only exception to this is the - // value for the main thread, which is always freed when - // wxTlsValue is destroyed. - template - class wxTlsValue - { - public: - typedef T ValueType; - - // ctor doesn't do anything, the object is created on first access - wxTlsValue() : m_key(free) {} - - // dtor is only called in the main thread context and so is not enough - // to free memory allocated by us for the other threads, we use - // destructor function when using Pthreads for this (which is not - // called for the main thread as it doesn't call pthread_exit() but - // just to be safe we also reset the key anyhow) - ~wxTlsValue() - { - if ( m_key.Get() ) - m_key.Set(NULL); // this deletes the value - } - - // access the object creating it on demand - ValueType *Get() - { - void *value = m_key.Get(); - if ( !value ) - { - // ValueType must be POD to be used in wxHAS_COMPILER_TLS case - // anyhow (at least gcc doesn't accept non-POD values being - // declared with __thread) so initialize it as a POD too - value = calloc(1, sizeof(ValueType)); - - if ( !m_key.Set(value) ) - { - free(value); - - // this will probably result in a crash in the caller but - // it's arguably better to crash immediately instead of - // slowly dying from out-of-memory errors which would - // happen as the next access to this object would allocate - // another ValueType instance and so on forever - value = NULL; - } - } - - return static_cast(value); - } - - // pointer-like accessors - ValueType *operator->() { return Get(); } - ValueType& operator*() { return *Get(); } - - private: - wxTlsKey m_key; - - DECLARE_NO_COPY_TEMPLATE_CLASS(wxTlsValue, T) - }; - - #define wxTLS_TYPE(T) wxTlsValue - #define wxTLS_PTR(var) ((var).Get()) - #define wxTLS_VALUE(var) (*(var)) -#endif // wxHAS_COMPILER_TLS/!wxHAS_COMPILER_TLS - -#endif // _WX_TLS_H_ - diff --git a/Source/3rd Party/wx/include/wx/tokenzr.h b/Source/3rd Party/wx/include/wx/tokenzr.h index 6e35e0214..e67b20176 100644 --- a/Source/3rd Party/wx/include/wx/tokenzr.h +++ b/Source/3rd Party/wx/include/wx/tokenzr.h @@ -4,7 +4,7 @@ // Author: Guilhem Lavaux // Modified by: (or rather rewritten by) Vadim Zeitlin // Created: 04/22/98 -// RCS-ID: $Id$ +// RCS-ID: $Id: tokenzr.h 61872 2009-09-09 22:37:05Z VZ $ // Copyright: (c) Guilhem Lavaux // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -72,12 +72,12 @@ public: // get current tokenizer state // returns the part of the string which remains to tokenize (*not* the // initial string) - wxString GetString() const { return wxString(m_pos, m_string.end()); } + wxString GetString() const { return m_string.substr(m_pos); } // returns the current position (i.e. one index after the last // returned token or 0 if GetNextToken() has never been called) in the // original string - size_t GetPosition() const { return m_pos - m_string.begin(); } + size_t GetPosition() const { return m_pos; } // misc // get the current mode - can be different from the one passed to the @@ -111,24 +111,10 @@ public: protected: bool IsOk() const { return m_mode != wxTOKEN_INVALID; } - bool DoHasMoreTokens() const; + wxString m_string, // the string we tokenize + m_delims; // all possible delimiters - enum MoreTokensState - { - MoreTokens_Unknown, - MoreTokens_Yes, - MoreTokens_No - }; - - MoreTokensState m_hasMoreTokens; - - wxString m_string; // the string we tokenize - wxString::const_iterator m_stringEnd; - // FIXME-UTF8: use wxWcharBuffer - wxWxCharBuffer m_delims; // all possible delimiters - size_t m_delimsLen; - - wxString::const_iterator m_pos; // the current position in m_string + size_t m_pos; // the current position in m_string wxStringTokenizerMode m_mode; // see wxTOKEN_XXX values diff --git a/Source/3rd Party/wx/include/wx/toolbar.h b/Source/3rd Party/wx/include/wx/toolbar.h index 25941cc0a..a64868e48 100644 --- a/Source/3rd Party/wx/include/wx/toolbar.h +++ b/Source/3rd Party/wx/include/wx/toolbar.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 20.11.99 -// RCS-ID: $Id$ +// RCS-ID: $Id: toolbar.h 42645 2006-10-29 19:12:52Z VZ $ // Copyright: (c) Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -68,18 +68,20 @@ enum #if defined(__WXUNIVERSAL__) #include "wx/univ/toolbar.h" + #elif defined(__WXPALMOS__) + #include "wx/palmos/toolbar.h" #elif defined(__WXMSW__) && (!defined(_WIN32_WCE) || (_WIN32_WCE >= 400 && !defined(__POCKETPC__) && !defined(__SMARTPHONE__))) - #include "wx/msw/toolbar.h" + #include "wx/msw/tbar95.h" #elif defined(__WXWINCE__) #include "wx/msw/wince/tbarwce.h" #elif defined(__WXMOTIF__) #include "wx/motif/toolbar.h" #elif defined(__WXGTK20__) - #include "wx/gtk/toolbar.h" + #include "wx/gtk/tbargtk.h" #elif defined(__WXGTK__) - #include "wx/gtk1/toolbar.h" + #include "wx/gtk1/tbargtk.h" #elif defined(__WXMAC__) - #include "wx/osx/toolbar.h" + #include "wx/mac/toolbar.h" #elif defined(__WXCOCOA__) #include "wx/cocoa/toolbar.h" #elif defined(__WXPM__) diff --git a/Source/3rd Party/wx/include/wx/toolbook.h b/Source/3rd Party/wx/include/wx/toolbook.h index 39c2b7f87..695ffa883 100644 --- a/Source/3rd Party/wx/include/wx/toolbook.h +++ b/Source/3rd Party/wx/include/wx/toolbook.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 2006-01-29 -// RCS-ID: $Id$ +// RCS-ID: $Id: toolbook.h 49804 2007-11-10 01:09:42Z VZ $ // Copyright: (c) 2006 Julian Smart // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -17,31 +17,22 @@ #if wxUSE_TOOLBOOK #include "wx/bookctrl.h" -#include "wx/containr.h" class WXDLLIMPEXP_FWD_CORE wxToolBarBase; class WXDLLIMPEXP_FWD_CORE wxCommandEvent; -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGED, wxBookCtrlEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGING, wxBookCtrlEvent ); +extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGED; +extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGING; // Use wxButtonToolBar -#define wxTBK_BUTTONBAR 0x0100 - -// Use wxTB_HORZ_LAYOUT style for the controlling toolbar -#define wxTBK_HORZ_LAYOUT 0x8000 - -// deprecated synonym, don't use -#if WXWIN_COMPATIBILITY_2_8 - #define wxBK_BUTTONBAR wxTBK_BUTTONBAR -#endif +#define wxBK_BUTTONBAR 0x0100 // ---------------------------------------------------------------------------- // wxToolbook // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxToolbook : public wxNavigationEnabled +class WXDLLEXPORT wxToolbook : public wxBookCtrlBase { public: wxToolbook() @@ -71,15 +62,17 @@ public: // implement base class virtuals + virtual int GetSelection() const; virtual bool SetPageText(size_t n, const wxString& strText); virtual wxString GetPageText(size_t n) const; virtual int GetPageImage(size_t n) const; virtual bool SetPageImage(size_t n, int imageId); + virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const; virtual bool InsertPage(size_t n, wxWindow *page, const wxString& text, bool bSelect = false, - int imageId = NO_IMAGE); + int imageId = -1); virtual int SetSelection(size_t n) { return DoSetSelection(n, SetSelection_SendEvent); } virtual int ChangeSelection(size_t n) { return DoSetSelection(n); } virtual void SetImageList(wxImageList *imageList); @@ -100,6 +93,9 @@ public: protected: virtual wxWindow *DoRemovePage(size_t page); + // get the size which the list control should have + virtual wxSize GetControllerSize() const; + // event handlers void OnToolSelected(wxCommandEvent& event); void OnSize(wxSizeEvent& event); @@ -107,8 +103,11 @@ protected: void UpdateSelectedPage(size_t newsel); - wxBookCtrlEvent* CreatePageChangingEvent() const; - void MakeChangedEvent(wxBookCtrlEvent &event); + wxBookCtrlBaseEvent* CreatePageChangingEvent() const; + void MakeChangedEvent(wxBookCtrlBaseEvent &event); + + // the currently selected page or wxNOT_FOUND if none + int m_selection; // whether the toolbar needs to be realized bool m_needsRealizing; @@ -128,17 +127,36 @@ private: // listbook event class and related stuff // ---------------------------------------------------------------------------- -// wxToolbookEvent is obsolete and defined for compatibility only -#define wxToolbookEvent wxBookCtrlEvent -typedef wxBookCtrlEventFunction wxToolbookEventFunction; -#define wxToolbookEventHandler(func) wxBookCtrlEventHandler(func) +class WXDLLEXPORT wxToolbookEvent : public wxBookCtrlBaseEvent +{ +public: + wxToolbookEvent(wxEventType commandType = wxEVT_NULL, int id = 0, + int nSel = wxNOT_FOUND, int nOldSel = wxNOT_FOUND) + : wxBookCtrlBaseEvent(commandType, id, nSel, nOldSel) + { + } + wxToolbookEvent(const wxToolbookEvent& event) + : wxBookCtrlBaseEvent(event) + { + } + + virtual wxEvent *Clone() const { return new wxToolbookEvent(*this); } + +private: + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxToolbookEvent) +}; + +typedef void (wxEvtHandler::*wxToolbookEventFunction)(wxToolbookEvent&); + +#define wxToolbookEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxToolbookEventFunction, &func) #define EVT_TOOLBOOK_PAGE_CHANGED(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGED, winid, wxBookCtrlEventHandler(fn)) + wx__DECLARE_EVT1(wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGED, winid, wxToolbookEventHandler(fn)) #define EVT_TOOLBOOK_PAGE_CHANGING(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGING, winid, wxBookCtrlEventHandler(fn)) + wx__DECLARE_EVT1(wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGING, winid, wxToolbookEventHandler(fn)) #endif // wxUSE_TOOLBOOK diff --git a/Source/3rd Party/wx/include/wx/tooltip.h b/Source/3rd Party/wx/include/wx/tooltip.h index 2c943dff9..af29741f4 100644 --- a/Source/3rd Party/wx/include/wx/tooltip.h +++ b/Source/3rd Party/wx/include/wx/tooltip.h @@ -1,11 +1,11 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/tooltip.h +// Name: tooltip.h // Purpose: wxToolTip base header // Author: Robert Roebling // Modified by: // Created: // Copyright: (c) Robert Roebling -// RCS-ID: $Id$ +// RCS-ID: $Id: tooltip.h 37066 2006-01-23 03:27:34Z MR $ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -25,7 +25,7 @@ #elif defined(__WXGTK__) #include "wx/gtk1/tooltip.h" #elif defined(__WXMAC__) -#include "wx/osx/tooltip.h" +#include "wx/mac/tooltip.h" #elif defined(__WXCOCOA__) #include "wx/cocoa/tooltip.h" #elif defined(__WXPM__) diff --git a/Source/3rd Party/wx/include/wx/toplevel.h b/Source/3rd Party/wx/include/wx/toplevel.h index f2a5c2af2..2351d7cd9 100644 --- a/Source/3rd Party/wx/include/wx/toplevel.h +++ b/Source/3rd Party/wx/include/wx/toplevel.h @@ -5,7 +5,7 @@ // Author: Vadim Zeitlin, Vaclav Slavik // Modified by: // Created: 06.08.01 -// RCS-ID: $Id$ +// RCS-ID: $Id: toplevel.h 53135 2008-04-12 02:31:04Z VZ $ // Copyright: (c) 2001 Vadim Zeitlin // Vaclav Slavik // Licence: wxWindows licence @@ -18,13 +18,11 @@ // headers // ---------------------------------------------------------------------------- -#include "wx/nonownedwnd.h" +#include "wx/window.h" #include "wx/iconbndl.h" -#include "wx/containr.h" -#include "wx/weakref.h" // the default names for various classes -extern WXDLLIMPEXP_DATA_CORE(const char) wxFrameNameStr[]; +extern WXDLLEXPORT_DATA(const wxChar) wxFrameNameStr[]; class WXDLLIMPEXP_FWD_CORE wxTopLevelWindowBase; @@ -32,59 +30,19 @@ class WXDLLIMPEXP_FWD_CORE wxTopLevelWindowBase; // constants // ---------------------------------------------------------------------------- -/* - Summary of the bits used (some of them are defined in wx/frame.h and - wx/dialog.h and not here): - - +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ - |15|14|13|12|11|10| 9| 8| 7| 6| 5| 4| 3| 2| 1| 0| - +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ - | | | | | | | | | | | | | | | | - | | | | | | | | | | | | | | | \_ wxCENTRE - | | | | | | | | | | | | | | \____ wxFRAME_NO_TASKBAR - | | | | | | | | | | | | | \_______ wxFRAME_TOOL_WINDOW - | | | | | | | | | | | | \__________ wxFRAME_FLOAT_ON_PARENT - | | | | | | | | | | | \_____________ wxFRAME_SHAPED - | | | | | | | | | | \________________ wxDIALOG_NO_PARENT - | | | | | | | | | \___________________ wxRESIZE_BORDER - | | | | | | | | \______________________ wxTINY_CAPTION_VERT - | | | | | | | \_________________________ - | | | | | | \____________________________ wxMAXIMIZE_BOX - | | | | | \_______________________________ wxMINIMIZE_BOX - | | | | \__________________________________ wxSYSTEM_MENU - | | | \_____________________________________ wxCLOSE_BOX - | | \________________________________________ wxMAXIMIZE - | \___________________________________________ wxMINIMIZE - \______________________________________________ wxSTAY_ON_TOP - - - Notice that the 8 lower bits overlap with wxCENTRE and the button selection - bits (wxYES, wxOK wxNO, wxCANCEL, wxAPPLY, wxCLOSE and wxNO_DEFAULT) which - can be combined with the dialog style for several standard dialogs and - hence shouldn't overlap with any styles which can be used for the dialogs. - Additionally, wxCENTRE can be used with frames also. - */ - // style common to both wxFrame and wxDialog #define wxSTAY_ON_TOP 0x8000 #define wxICONIZE 0x4000 #define wxMINIMIZE wxICONIZE #define wxMAXIMIZE 0x2000 -#define wxCLOSE_BOX 0x1000 // == wxHELP so can't be used with it +#define wxCLOSE_BOX 0x1000 #define wxSYSTEM_MENU 0x0800 #define wxMINIMIZE_BOX 0x0400 #define wxMAXIMIZE_BOX 0x0200 - -#define wxTINY_CAPTION 0x0080 // clashes with wxNO_DEFAULT -#define wxRESIZE_BORDER 0x0040 // == wxCLOSE - -#if WXWIN_COMPATIBILITY_2_8 - // HORIZ and VERT styles are equivalent anyhow so don't use different names - // for them - #define wxTINY_CAPTION_HORIZ wxTINY_CAPTION - #define wxTINY_CAPTION_VERT wxTINY_CAPTION -#endif +#define wxTINY_CAPTION_HORIZ 0x0100 +#define wxTINY_CAPTION_VERT 0x0080 +#define wxRESIZE_BORDER 0x0040 #if WXWIN_COMPATIBILITY_2_6 @@ -157,8 +115,7 @@ enum // wxTopLevelWindow: a top level (as opposed to child) window // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxTopLevelWindowBase : - public wxNavigationEnabled +class WXDLLEXPORT wxTopLevelWindowBase : public wxWindow { public: // construction @@ -188,26 +145,20 @@ public: virtual bool IsIconized() const = 0; // get the frame icon - wxIcon GetIcon() const; + const wxIcon& GetIcon() const { return m_icons.GetIcon( -1 ); } // get the frame icons const wxIconBundle& GetIcons() const { return m_icons; } - // set the frame icon: implemented in terms of SetIcons() - void SetIcon(const wxIcon& icon); + // set the frame icon + virtual void SetIcon(const wxIcon& icon) { m_icons = wxIconBundle( icon ); } // set the frame icons - virtual void SetIcons(const wxIconBundle& icons) { m_icons = icons; } + virtual void SetIcons(const wxIconBundle& icons ) { m_icons = icons; } // maximize the window to cover entire screen virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL) = 0; - // shows the window, but doesn't activate it. If the base code is being run, - // it means the port doesn't implement this method yet and so alert the user. - virtual void ShowWithoutActivating() { - wxFAIL_MSG("ShowWithoutActivating not implemented on this platform."); - } - // return true if the frame is in fullscreen mode virtual bool IsFullScreen() const = 0; @@ -217,16 +168,19 @@ public: virtual wxString GetTitle() const = 0; // enable/disable close button [x] - virtual bool EnableCloseButton(bool WXUNUSED(enable) ) { return false; } + virtual bool EnableCloseButton(bool WXUNUSED(enable) ) { return false; } + + // Set the shape of the window to the given region. + // Returns true if the platform supports this feature (and the + // operation is successful.) + virtual bool SetShape(const wxRegion& WXUNUSED(region)) { return false; } // Attracts the users attention to this window if the application is // inactive (should be called when a background event occurs) virtual void RequestUserAttention(int flags = wxUSER_ATTENTION_INFO); // Is this the active frame (highlighted in the taskbar)? - // - // A TLW is active only if it contains the currently focused window. - virtual bool IsActive() { return IsDescendant(FindFocus()); } + virtual bool IsActive() { return wxGetTopLevelParent(FindFocus()) == this; } // this function may be overridden to return false to allow closing the // application even when this top level window is still open @@ -245,10 +199,6 @@ public: void CentreOnScreen(int dir = wxBOTH) { DoCentre(dir | wxCENTRE_ON_SCREEN); } void CenterOnScreen(int dir = wxBOTH) { CentreOnScreen(dir); } - // Get the default size for a new top level window. This is used when - // creating a wxTLW under some platforms if no explicit size given. - static wxSize GetDefaultSize(); - // default item access: we have a permanent default item which is the one // set by the user code but we may also have a temporary default item which @@ -256,6 +206,9 @@ public: // reverts to the "permanent" default as soon as this temporary default // item loses focus + // used to reset default if pointing to removed child + virtual void RemoveChild(wxWindowBase *child); + // get the default item, temporary or permanent wxWindow *GetDefaultItem() const { return m_winTmpDefault ? m_winTmpDefault : m_winDefault; } @@ -279,7 +232,6 @@ public: // override some base class virtuals virtual bool Destroy(); virtual bool IsTopLevel() const { return true; } - virtual bool IsTopNavigationDomain() const { return true; } virtual bool IsVisible() const { return IsShown(); } // event handlers @@ -300,10 +252,10 @@ public: virtual void SetMinSize(const wxSize& minSize); virtual void SetMaxSize(const wxSize& maxSize); - virtual void OSXSetModified(bool modified) { m_modified = modified; } - virtual bool OSXIsModified() const { return m_modified; } - - virtual void SetRepresentedFilename(const wxString& WXUNUSED(filename)) { } + // set size hints for "window manager" + virtual void DoSetSizeHints( int minW, int minH, + int maxW = wxDefaultCoord, int maxH = wxDefaultCoord, + int incW = wxDefaultCoord, int incH = wxDefaultCoord ); protected: // the frame client to screen translation should take account of the @@ -336,28 +288,32 @@ protected: // client area void DoLayout(); + // Get the default size for the new window if no explicit size given. If + // there are better default sizes then these can be changed, just as long + // as they are not too small for TLWs (and not larger than screen). + static wxSize GetDefaultSize(); static int WidthDefault(int w) { return w == wxDefaultCoord ? GetDefaultSize().x : w; } static int HeightDefault(int h) { return h == wxDefaultCoord ? GetDefaultSize().y : h; } - // the frame icon wxIconBundle m_icons; // a default window (usually a button) or NULL - wxWindowRef m_winDefault; + wxWindow *m_winDefault; // a temporary override of m_winDefault, use the latter if NULL - wxWindowRef m_winTmpDefault; + wxWindow *m_winTmpDefault; - bool m_modified; - - wxDECLARE_NO_COPY_CLASS(wxTopLevelWindowBase); + DECLARE_NO_COPY_CLASS(wxTopLevelWindowBase) DECLARE_EVENT_TABLE() }; // include the real class declaration -#if defined(__WXMSW__) +#if defined(__WXPALMOS__) + #include "wx/palmos/toplevel.h" + #define wxTopLevelWindowNative wxTopLevelWindowPalm +#elif defined(__WXMSW__) #include "wx/msw/toplevel.h" #define wxTopLevelWindowNative wxTopLevelWindowMSW #elif defined(__WXGTK20__) @@ -369,11 +325,14 @@ protected: #elif defined(__WXX11__) #include "wx/x11/toplevel.h" #define wxTopLevelWindowNative wxTopLevelWindowX11 +#elif defined(__WXMGL__) + #include "wx/mgl/toplevel.h" + #define wxTopLevelWindowNative wxTopLevelWindowMGL #elif defined(__WXDFB__) #include "wx/dfb/toplevel.h" #define wxTopLevelWindowNative wxTopLevelWindowDFB #elif defined(__WXMAC__) - #include "wx/osx/toplevel.h" + #include "wx/mac/toplevel.h" #define wxTopLevelWindowNative wxTopLevelWindowMac #elif defined(__WXCOCOA__) #include "wx/cocoa/toplevel.h" @@ -389,25 +348,28 @@ protected: #ifdef __WXUNIVERSAL__ #include "wx/univ/toplevel.h" #else // !__WXUNIVERSAL__ - class WXDLLIMPEXP_CORE wxTopLevelWindow : public wxTopLevelWindowNative - { - public: - // construction - wxTopLevelWindow() { } - wxTopLevelWindow(wxWindow *parent, - wxWindowID winid, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr) - : wxTopLevelWindowNative(parent, winid, title, - pos, size, style, name) + #ifdef wxTopLevelWindowNative + class WXDLLEXPORT wxTopLevelWindow : public wxTopLevelWindowNative { - } + public: + // construction + wxTopLevelWindow() { Init(); } + wxTopLevelWindow(wxWindow *parent, + wxWindowID winid, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxFrameNameStr) + { + Init(); + Create(parent, winid, title, pos, size, style, name); + } - DECLARE_DYNAMIC_CLASS_NO_COPY(wxTopLevelWindow) - }; + DECLARE_DYNAMIC_CLASS_NO_COPY(wxTopLevelWindow) + }; + #endif // wxTopLevelWindowNative #endif // __WXUNIVERSAL__/!__WXUNIVERSAL__ + #endif // _WX_TOPLEVEL_BASE_H_ diff --git a/Source/3rd Party/wx/include/wx/tracker.h b/Source/3rd Party/wx/include/wx/tracker.h deleted file mode 100644 index ef2375741..000000000 --- a/Source/3rd Party/wx/include/wx/tracker.h +++ /dev/null @@ -1,92 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/tracker.h -// Purpose: Support class for object lifetime tracking (wxWeakRef) -// Author: Arne Steinarson -// Created: 28 Dec 07 -// RCS-ID: $Id$ -// Copyright: (c) 2007 Arne Steinarson -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TRACKER_H_ -#define _WX_TRACKER_H_ - -#include "wx/defs.h" - -class wxEventConnectionRef; - -// This class represents an object tracker and is stored in a linked list -// in the tracked object. It is only used in one of its derived forms. -class WXDLLIMPEXP_BASE wxTrackerNode -{ -public: - wxTrackerNode() : m_nxt(NULL) { } - virtual ~wxTrackerNode() { } - - virtual void OnObjectDestroy() = 0; - - virtual wxEventConnectionRef *ToEventConnection() { return NULL; } - -private: - wxTrackerNode *m_nxt; - - friend class wxTrackable; // For list access - friend class wxEvtHandler; // For list access -}; - -// Add-on base class for a trackable object. -class WXDLLIMPEXP_BASE wxTrackable -{ -public: - void AddNode(wxTrackerNode *prn) - { - prn->m_nxt = m_first; - m_first = prn; - } - - void RemoveNode(wxTrackerNode *prn) - { - for ( wxTrackerNode **pprn = &m_first; *pprn; pprn = &(*pprn)->m_nxt ) - { - if ( *pprn == prn ) - { - *pprn = prn->m_nxt; - return; - } - } - - wxFAIL_MSG( "removing invalid tracker node" ); - } - - wxTrackerNode *GetFirst() const { return m_first; } - -protected: - // this class is only supposed to be used as a base class but never be - // created nor destroyed directly so all ctors and dtor are protected - - wxTrackable() : m_first(NULL) { } - - // copy ctor and assignment operator intentionally do not copy m_first: the - // objects which track the original trackable shouldn't track the new copy - wxTrackable(const wxTrackable& WXUNUSED(other)) : m_first(NULL) { } - wxTrackable& operator=(const wxTrackable& WXUNUSED(other)) { return *this; } - - // dtor is not virtual: this class is not supposed to be used - // polymorphically and adding a virtual table to it would add unwanted - // overhead - ~wxTrackable() - { - // Notify all registered refs - while ( m_first ) - { - wxTrackerNode * const first = m_first; - m_first = first->m_nxt; - first->OnObjectDestroy(); - } - } - - wxTrackerNode *m_first; -}; - -#endif // _WX_TRACKER_H_ - diff --git a/Source/3rd Party/wx/include/wx/translation.h b/Source/3rd Party/wx/include/wx/translation.h deleted file mode 100644 index ee5341624..000000000 --- a/Source/3rd Party/wx/include/wx/translation.h +++ /dev/null @@ -1,320 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/translation.h -// Purpose: Internationalization and localisation for wxWidgets -// Author: Vadim Zeitlin, Vaclav Slavik, -// Michael N. Filippov -// Created: 2010-04-23 -// RCS-ID: $Id$ -// Copyright: (c) 1998 Vadim Zeitlin -// (c) 2010 Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TRANSLATION_H_ -#define _WX_TRANSLATION_H_ - -#include "wx/defs.h" -#include "wx/string.h" - -#if wxUSE_INTL - -#include "wx/buffer.h" -#include "wx/language.h" -#include "wx/hashmap.h" -#include "wx/strconv.h" -#include "wx/scopedptr.h" - -// ============================================================================ -// global decls -// ============================================================================ - -// ---------------------------------------------------------------------------- -// macros -// ---------------------------------------------------------------------------- - -// gettext() style macros (notice that xgettext should be invoked with -// --keyword="_" --keyword="wxPLURAL:1,2" options -// to extract the strings from the sources) -#ifndef WXINTL_NO_GETTEXT_MACRO - #define _(s) wxGetTranslation((s)) - #define wxPLURAL(sing, plur, n) wxGetTranslation((sing), (plur), n) -#endif - -// another one which just marks the strings for extraction, but doesn't -// perform the translation (use -kwxTRANSLATE with xgettext!) -#define wxTRANSLATE(str) str - -// ---------------------------------------------------------------------------- -// forward decls -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_BASE wxArrayString; -class WXDLLIMPEXP_FWD_BASE wxTranslationsLoader; -class WXDLLIMPEXP_FWD_BASE wxLocale; - -class wxPluralFormsCalculator; -wxDECLARE_SCOPED_PTR(wxPluralFormsCalculator, wxPluralFormsCalculatorPtr) - -// ---------------------------------------------------------------------------- -// wxMsgCatalog corresponds to one loaded message catalog. -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxMsgCatalog -{ -public: - // Ctor is protected, because CreateFromXXX functions must be used, - // but destruction should be unrestricted -#if !wxUSE_UNICODE - ~wxMsgCatalog(); -#endif - - // load the catalog from disk or from data; caller is responsible for - // deleting them if not NULL - static wxMsgCatalog *CreateFromFile(const wxString& filename, - const wxString& domain); - - static wxMsgCatalog *CreateFromData(const wxScopedCharBuffer& data, - const wxString& domain); - - // get name of the catalog - wxString GetDomain() const { return m_domain; } - - // get the translated string: returns NULL if not found - const wxString *GetString(const wxString& sz, unsigned n = UINT_MAX) const; - -protected: - wxMsgCatalog(const wxString& domain) - : m_pNext(NULL), m_domain(domain) -#if !wxUSE_UNICODE - , m_conv(NULL) -#endif - {} - -private: - // variable pointing to the next element in a linked list (or NULL) - wxMsgCatalog *m_pNext; - friend class wxTranslations; - - wxStringToStringHashMap m_messages; // all messages in the catalog - wxString m_domain; // name of the domain - -#if !wxUSE_UNICODE - // the conversion corresponding to this catalog charset if we installed it - // as the global one - wxCSConv *m_conv; -#endif - - wxPluralFormsCalculatorPtr m_pluralFormsCalculator; -}; - -// ---------------------------------------------------------------------------- -// wxTranslations: message catalogs -// ---------------------------------------------------------------------------- - -// this class allows to get translations for strings -class WXDLLIMPEXP_BASE wxTranslations -{ -public: - wxTranslations(); - ~wxTranslations(); - - // returns current translations object, may return NULL - static wxTranslations *Get(); - // sets current translations object (takes ownership; may be NULL) - static void Set(wxTranslations *t); - - // changes loader to non-default one; takes ownership of 'loader' - void SetLoader(wxTranslationsLoader *loader); - - void SetLanguage(wxLanguage lang); - void SetLanguage(const wxString& lang); - - // get languages available for this app - wxArrayString GetAvailableTranslations(const wxString& domain) const; - - // add standard wxWidgets catalog ("wxstd") - bool AddStdCatalog(); - - // add catalog with given domain name and language, looking it up via - // wxTranslationsLoader - bool AddCatalog(const wxString& domain); - bool AddCatalog(const wxString& domain, wxLanguage msgIdLanguage); -#if !wxUSE_UNICODE - bool AddCatalog(const wxString& domain, - wxLanguage msgIdLanguage, - const wxString& msgIdCharset); -#endif - - // check if the given catalog is loaded - bool IsLoaded(const wxString& domain) const; - - // access to translations - const wxString& GetString(const wxString& origString, - const wxString& domain = wxEmptyString) const; - const wxString& GetString(const wxString& origString, - const wxString& origString2, - unsigned n, - const wxString& domain = wxEmptyString) const; - - wxString GetHeaderValue(const wxString& header, - const wxString& domain = wxEmptyString) const; - - // this is hack to work around a problem with wxGetTranslation() which - // returns const wxString& and not wxString, so when it returns untranslated - // string, it needs to have a copy of it somewhere - static const wxString& GetUntranslatedString(const wxString& str); - -private: - // perform loading of the catalog via m_loader - bool LoadCatalog(const wxString& domain, const wxString& lang); - - // find best translation for given domain - wxString ChooseLanguageForDomain(const wxString& domain, - const wxString& msgIdLang); - - // find catalog by name in a linked list, return NULL if !found - wxMsgCatalog *FindCatalog(const wxString& domain) const; - - // same as Set(), without taking ownership; only for wxLocale - static void SetNonOwned(wxTranslations *t); - friend class wxLocale; - -private: - wxString m_lang; - wxTranslationsLoader *m_loader; - - wxMsgCatalog *m_pMsgCat; // pointer to linked list of catalogs -}; - - -// abstraction of translations discovery and loading -class WXDLLIMPEXP_BASE wxTranslationsLoader -{ -public: - wxTranslationsLoader() {} - virtual ~wxTranslationsLoader() {} - - virtual wxMsgCatalog *LoadCatalog(const wxString& domain, - const wxString& lang) = 0; - - virtual wxArrayString GetAvailableTranslations(const wxString& domain) const = 0; -}; - - -// standard wxTranslationsLoader implementation, using filesystem -class WXDLLIMPEXP_BASE wxFileTranslationsLoader - : public wxTranslationsLoader -{ -public: - static void AddCatalogLookupPathPrefix(const wxString& prefix); - - virtual wxMsgCatalog *LoadCatalog(const wxString& domain, - const wxString& lang); - - virtual wxArrayString GetAvailableTranslations(const wxString& domain) const; -}; - - -#ifdef __WINDOWS__ -// loads translations from win32 resources -class WXDLLIMPEXP_BASE wxResourceTranslationsLoader - : public wxTranslationsLoader -{ -public: - virtual wxMsgCatalog *LoadCatalog(const wxString& domain, - const wxString& lang); - - virtual wxArrayString GetAvailableTranslations(const wxString& domain) const; - -protected: - // returns resource type to use for translations - virtual wxString GetResourceType() const { return "MOFILE"; } - - // returns module to load resources from - virtual WXHINSTANCE GetModule() const { return 0; } -}; -#endif // __WINDOWS__ - - -// ---------------------------------------------------------------------------- -// global functions -// ---------------------------------------------------------------------------- - -// get the translation of the string in the current locale -inline const wxString& wxGetTranslation(const wxString& str, - const wxString& domain = wxEmptyString) -{ - wxTranslations *trans = wxTranslations::Get(); - if ( trans ) - return trans->GetString(str, domain); - else - // NB: this function returns reference to a string, so we have to keep - // a copy of it somewhere - return wxTranslations::GetUntranslatedString(str); -} - -inline const wxString& wxGetTranslation(const wxString& str1, - const wxString& str2, - unsigned n, - const wxString& domain = wxEmptyString) -{ - wxTranslations *trans = wxTranslations::Get(); - if ( trans ) - return trans->GetString(str1, str2, n, domain); - else - // NB: this function returns reference to a string, so we have to keep - // a copy of it somewhere - return n == 1 - ? wxTranslations::GetUntranslatedString(str1) - : wxTranslations::GetUntranslatedString(str2); -} - -#else // !wxUSE_INTL - -// the macros should still be defined - otherwise compilation would fail - -#if !defined(WXINTL_NO_GETTEXT_MACRO) - #if !defined(_) - #define _(s) (s) - #endif - #define wxPLURAL(sing, plur, n) ((n) == 1 ? (sing) : (plur)) -#endif - -#define wxTRANSLATE(str) str - -// NB: we use a template here in order to avoid using -// wxLocale::GetUntranslatedString() above, which would be required if -// we returned const wxString&; this way, the compiler should be able to -// optimize wxGetTranslation() away - -template -inline TString wxGetTranslation(TString str) - { return str; } - -template -inline TString wxGetTranslation(TString str, TDomain WXUNUSED(domain)) - { return str; } - -template -inline TString wxGetTranslation(TString str1, TString str2, size_t n) - { return n == 1 ? str1 : str2; } - -template -inline TString wxGetTranslation(TString str1, TString str2, size_t n, - TDomain WXUNUSED(domain)) - { return n == 1 ? str1 : str2; } - -#endif // wxUSE_INTL/!wxUSE_INTL - -// define this one just in case it occurs somewhere (instead of preferred -// wxTRANSLATE) too -#if !defined(WXINTL_NO_GETTEXT_MACRO) - #if !defined(gettext_noop) - #define gettext_noop(str) (str) - #endif - #if !defined(N_) - #define N_(s) (s) - #endif -#endif - -#endif // _WX_TRANSLATION_H_ diff --git a/Source/3rd Party/wx/include/wx/treebase.h b/Source/3rd Party/wx/include/wx/treebase.h index e0a7b7fe7..a89786268 100644 --- a/Source/3rd Party/wx/include/wx/treebase.h +++ b/Source/3rd Party/wx/include/wx/treebase.h @@ -4,7 +4,7 @@ // Author: Julian Smart et al // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: treebase.h 53135 2008-04-12 02:31:04Z VZ $ // Copyright: (c) 1997,1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -23,7 +23,6 @@ #include "wx/window.h" // for wxClientData #include "wx/event.h" #include "wx/dynarray.h" -#include "wx/itemid.h" #if WXWIN_COMPATIBILITY_2_6 @@ -39,19 +38,59 @@ enum #endif // WXWIN_COMPATIBILITY_2_6 // ---------------------------------------------------------------------------- -// wxTreeItemId identifies an element of the tree. It's opaque for the -// application and the only method which can be used by user code is IsOk(). +// wxTreeItemId identifies an element of the tree. In this implementation, it's +// just a trivial wrapper around Win32 HTREEITEM or a pointer to some private +// data structure in the generic version. It's opaque for the application and +// the only method which can be used by user code is IsOk(). // ---------------------------------------------------------------------------- -// This is a class and not a typedef because existing code may forward declare -// wxTreeItemId as a class and we don't want to break it without good reason. -class wxTreeItemId : public wxItemId +// Using this typedef removes an ambiguity when calling Remove() +typedef void *wxTreeItemIdValue; + +class WXDLLEXPORT wxTreeItemId { + friend bool operator==(const wxTreeItemId&, const wxTreeItemId&); public: - wxTreeItemId() : wxItemId() { } - wxTreeItemId(void* pItem) : wxItemId(pItem) { } + // ctors + // 0 is invalid value for HTREEITEM + wxTreeItemId() { m_pItem = 0; } + + // construct wxTreeItemId from the native item id + wxTreeItemId(void *pItem) { m_pItem = pItem; } + + // default copy ctor/assignment operator are ok for us + + // accessors + // is this a valid tree item? + bool IsOk() const { return m_pItem != 0; } + // return true if this item is not valid + bool operator!() const { return !IsOk(); } + + // operations + // invalidate the item + void Unset() { m_pItem = 0; } + +#if WXWIN_COMPATIBILITY_2_4 + // deprecated: only for compatibility, don't work on 64 bit archs + wxTreeItemId(long item) { m_pItem = wxUIntToPtr(item); } + operator long() const { return (long)wxPtrToUInt(m_pItem); } +#else // !WXWIN_COMPATIBILITY_2_4 + operator bool() const { return IsOk(); } +#endif // WXWIN_COMPATIBILITY_2_4/!WXWIN_COMPATIBILITY_2_4 + + wxTreeItemIdValue m_pItem; }; +inline bool operator==(const wxTreeItemId& i1, const wxTreeItemId& i2) +{ + return i1.m_pItem == i2.m_pItem; +} + +inline bool operator!=(const wxTreeItemId& i1, const wxTreeItemId& i2) +{ + return i1.m_pItem != i2.m_pItem; +} + // ---------------------------------------------------------------------------- // wxTreeItemData is some (arbitrary) user class associated with some item. The // main advantage of having this class (compared to old untyped interface) is @@ -66,7 +105,7 @@ public: // always be allocated on the heap! // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxTreeItemData: public wxClientData +class WXDLLEXPORT wxTreeItemData: public wxClientData { friend class WXDLLIMPEXP_FWD_CORE wxTreeCtrl; friend class WXDLLIMPEXP_FWD_CORE wxGenericTreeCtrl; @@ -86,14 +125,12 @@ protected: wxTreeItemId m_pItem; }; -typedef void *wxTreeItemIdValue; - WX_DEFINE_EXPORTED_ARRAY_PTR(wxTreeItemIdValue, wxArrayTreeItemIdsBase); // this is a wrapper around the array class defined above which allow to wok -// with values of natural wxTreeItemId type instead of using wxTreeItemIdValue +// with vaue of natural wxTreeItemId type instead of using wxTreeItemIdValue // and does it without any loss of efficiency -class WXDLLIMPEXP_CORE wxArrayTreeItemIds : public wxArrayTreeItemIdsBase +class WXDLLEXPORT wxArrayTreeItemIds : public wxArrayTreeItemIdsBase { public: void Add(const wxTreeItemId& id) @@ -119,11 +156,6 @@ enum wxTreeItemIcon wxTreeItemIcon_Max }; -// special values for the 'state' parameter of wxTreeCtrl::SetItemState() -static const int wxTREE_ITEMSTATE_NONE = -1; // not state (no display state image) -static const int wxTREE_ITEMSTATE_NEXT = -2; // cycle to the next state -static const int wxTREE_ITEMSTATE_PREV = -3; // cycle to the previous state - // ---------------------------------------------------------------------------- // wxTreeCtrl flags // ---------------------------------------------------------------------------- @@ -136,11 +168,7 @@ static const int wxTREE_ITEMSTATE_PREV = -3; // cycle to the previous state #define wxTR_SINGLE 0x0000 // for convenience #define wxTR_MULTIPLE 0x0020 // can select multiple items - -#if WXWIN_COMPATIBILITY_2_8 - #define wxTR_EXTENDED 0x0040 // deprecated, don't use -#endif // WXWIN_COMPATIBILITY_2_8 - +#define wxTR_EXTENDED 0x0040 // TODO: allow extended selection #define wxTR_HAS_VARIABLE_ROW_HEIGHT 0x0080 // what it says #define wxTR_EDIT_LABELS 0x0200 // can edit item labels @@ -149,15 +177,10 @@ static const int wxTREE_ITEMSTATE_PREV = -3; // cycle to the previous state #define wxTR_FULL_ROW_HIGHLIGHT 0x2000 // highlight full horz space -// make the default control appearance look more native-like depending on the -// platform -#if defined(__WXGTK20__) - #define wxTR_DEFAULT_STYLE (wxTR_HAS_BUTTONS | wxTR_NO_LINES) -#elif defined(__WXMAC__) - #define wxTR_DEFAULT_STYLE \ - (wxTR_HAS_BUTTONS | wxTR_NO_LINES | wxTR_FULL_ROW_HIGHLIGHT) +#ifdef __WXGTK20__ +#define wxTR_DEFAULT_STYLE (wxTR_HAS_BUTTONS | wxTR_NO_LINES) #else - #define wxTR_DEFAULT_STYLE (wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT) +#define wxTR_DEFAULT_STYLE (wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT) #endif #if WXWIN_COMPATIBILITY_2_6 @@ -199,13 +222,13 @@ static const int wxTREE_HITTEST_ONITEM = wxTREE_HITTEST_ONITEMICON | wxTREE_HITTEST_ONITEMLABEL; // tree ctrl default name -extern WXDLLIMPEXP_DATA_CORE(const char) wxTreeCtrlNameStr[]; +extern WXDLLEXPORT_DATA(const wxChar) wxTreeCtrlNameStr[]; // ---------------------------------------------------------------------------- // wxTreeItemAttr: a structure containing the visual attributes of an item // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxTreeItemAttr +class WXDLLEXPORT wxTreeItemAttr { public: // ctors @@ -221,9 +244,9 @@ public: void SetFont(const wxFont& font) { m_font = font; } // accessors - bool HasTextColour() const { return m_colText.IsOk(); } - bool HasBackgroundColour() const { return m_colBack.IsOk(); } - bool HasFont() const { return m_font.IsOk(); } + bool HasTextColour() const { return m_colText.Ok(); } + bool HasBackgroundColour() const { return m_colBack.Ok(); } + bool HasFont() const { return m_font.Ok(); } const wxColour& GetTextColour() const { return m_colText; } const wxColour& GetBackgroundColour() const { return m_colBack; } @@ -244,13 +267,13 @@ private: class WXDLLIMPEXP_FWD_CORE wxTreeCtrlBase; -class WXDLLIMPEXP_CORE wxTreeEvent : public wxNotifyEvent +class WXDLLEXPORT wxTreeEvent : public wxNotifyEvent { public: - wxTreeEvent(wxEventType commandType = wxEVT_NULL, int id = 0); wxTreeEvent(wxEventType commandType, wxTreeCtrlBase *tree, const wxTreeItemId &item = wxTreeItemId()); + wxTreeEvent(wxEventType commandType = wxEVT_NULL, int id = 0); wxTreeEvent(const wxTreeEvent& event); virtual wxEvent *Clone() const { return new wxTreeEvent(*this); } @@ -309,30 +332,32 @@ typedef void (wxEvtHandler::*wxTreeEventFunction)(wxTreeEvent&); // tree control events and macros for handling them // ---------------------------------------------------------------------------- -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_TREE_BEGIN_DRAG, wxTreeEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_TREE_BEGIN_RDRAG, wxTreeEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT, wxTreeEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_TREE_END_LABEL_EDIT, wxTreeEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_TREE_DELETE_ITEM, wxTreeEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_TREE_GET_INFO, wxTreeEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_TREE_SET_INFO, wxTreeEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_TREE_ITEM_EXPANDED, wxTreeEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_TREE_ITEM_EXPANDING, wxTreeEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_TREE_ITEM_COLLAPSED, wxTreeEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_TREE_ITEM_COLLAPSING, wxTreeEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_TREE_SEL_CHANGED, wxTreeEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_TREE_SEL_CHANGING, wxTreeEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_TREE_KEY_DOWN, wxTreeEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_TREE_ITEM_ACTIVATED, wxTreeEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK, wxTreeEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_TREE_ITEM_MIDDLE_CLICK, wxTreeEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_TREE_END_DRAG, wxTreeEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_TREE_STATE_IMAGE_CLICK, wxTreeEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_TREE_ITEM_GETTOOLTIP, wxTreeEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_TREE_ITEM_MENU, wxTreeEvent ); +BEGIN_DECLARE_EVENT_TYPES() + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_BEGIN_DRAG, 600) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_BEGIN_RDRAG, 601) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT, 602) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_END_LABEL_EDIT, 603) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_DELETE_ITEM, 604) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_GET_INFO, 605) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_SET_INFO, 606) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_EXPANDED, 607) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_EXPANDING, 608) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_COLLAPSED, 609) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_COLLAPSING, 610) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_SEL_CHANGED, 611) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_SEL_CHANGING, 612) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_KEY_DOWN, 613) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_ACTIVATED, 614) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK, 615) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_MIDDLE_CLICK, 616) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_END_DRAG, 617) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_STATE_IMAGE_CLICK, 618) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_GETTOOLTIP, 619) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_MENU, 620) +END_DECLARE_EVENT_TYPES() #define wxTreeEventHandler(func) \ - wxEVENT_HANDLER_CAST(wxTreeEventFunction, func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxTreeEventFunction, &func) #define wx__DECLARE_TREEEVT(evt, id, fn) \ wx__DECLARE_EVT1(wxEVT_COMMAND_TREE_ ## evt, id, wxTreeEventHandler(fn)) diff --git a/Source/3rd Party/wx/include/wx/treebook.h b/Source/3rd Party/wx/include/wx/treebook.h index 058e23b74..dba636352 100644 --- a/Source/3rd Party/wx/include/wx/treebook.h +++ b/Source/3rd Party/wx/include/wx/treebook.h @@ -4,7 +4,7 @@ // Author: Evgeniy Tarassov, Vadim Zeitlin // Modified by: // Created: 2005-09-15 -// RCS-ID: $Id$ +// RCS-ID: $Id: treebook.h 49804 2007-11-10 01:09:42Z VZ $ // Copyright: (c) 2005 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -17,8 +17,8 @@ #if wxUSE_TREEBOOK #include "wx/bookctrl.h" -#include "wx/containr.h" #include "wx/treectrl.h" // for wxArrayTreeItemIds +#include "wx/containr.h" typedef wxWindow wxTreebookPage; @@ -28,7 +28,7 @@ class WXDLLIMPEXP_FWD_CORE wxTreeEvent; // wxTreebook // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxTreebook : public wxNavigationEnabled +class WXDLLEXPORT wxTreebook : public wxBookCtrlBase { public: // Constructors and such @@ -75,27 +75,27 @@ public: wxWindow *page, const wxString& text, bool bSelect = false, - int imageId = NO_IMAGE); + int imageId = wxNOT_FOUND); // Inserts a new sub-page to the end of children of the page at given pos. virtual bool InsertSubPage(size_t pos, wxWindow *page, const wxString& text, bool bSelect = false, - int imageId = NO_IMAGE); + int imageId = wxNOT_FOUND); // Adds a new page at top level after all other pages. virtual bool AddPage(wxWindow *page, const wxString& text, bool bSelect = false, - int imageId = NO_IMAGE); + int imageId = wxNOT_FOUND); // Adds a new child-page to the last top-level page inserted. // Useful when constructing 1 level tree structure. virtual bool AddSubPage(wxWindow *page, const wxString& text, bool bSelect = false, - int imageId = NO_IMAGE); + int imageId = wxNOT_FOUND); // Deletes the page and ALL its children. Could trigger page selection // change in a case when selected page is removed. In that case its parent @@ -127,10 +127,12 @@ public: // Standard operations inherited from wxBookCtrlBase // ------------------------------------------------- + virtual int GetSelection() const; virtual bool SetPageText(size_t n, const wxString& strText); virtual wxString GetPageText(size_t n) const; virtual int GetPageImage(size_t n) const; virtual bool SetPageImage(size_t n, int imageId); + virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const; virtual int SetSelection(size_t n) { return DoSetSelection(n, SetSelection_SendEvent); } virtual int ChangeSelection(size_t n) { return DoSetSelection(n); } virtual int HitTest(const wxPoint& pt, long *flags = NULL) const; @@ -152,6 +154,9 @@ protected: // array of page ids and page windows wxArrayTreeItemIds m_treeIds; + // the currently selected page or wxNOT_FOUND if none + int m_selection; + // in the situation when m_selection page is not wxNOT_FOUND but page is // NULL this is the first (sub)child that has a non-NULL page int m_actualSelection; @@ -170,16 +175,16 @@ private: wxWindow *page, const wxString& text, bool bSelect = false, - int imageId = NO_IMAGE); + int imageId = wxNOT_FOUND); bool DoInsertSubPage(size_t pos, wxWindow *page, const wxString& text, bool bSelect = false, - int imageId = NO_IMAGE); + int imageId = wxNOT_FOUND); bool DoAddSubPage(wxWindow *page, const wxString& text, bool bSelect = false, - int imageId = NO_IMAGE); + int imageId = wxNOT_FOUND); // Sets selection in the tree control and updates the page being shown. int DoSetSelection(size_t pos, int flags = 0); @@ -217,11 +222,12 @@ private: // Returns internal number of pages which can be different from // GetPageCount() while performing a page insertion or removal. - size_t DoInternalGetPageCount() const { return m_treeIds.GetCount(); } + size_t DoInternalGetPageCount() const { return m_treeIds.Count(); } DECLARE_EVENT_TABLE() DECLARE_DYNAMIC_CLASS_NO_COPY(wxTreebook) + WX_DECLARE_CONTROL_CONTAINER(); }; @@ -229,28 +235,47 @@ private: // treebook event class and related stuff // ---------------------------------------------------------------------------- -// wxTreebookEvent is obsolete and defined for compatibility only -#define wxTreebookEvent wxBookCtrlEvent -typedef wxBookCtrlEventFunction wxTreebookEventFunction; -#define wxTreebookEventHandler(func) wxBookCtrlEventHandler(func) +class WXDLLEXPORT wxTreebookEvent : public wxBookCtrlBaseEvent +{ +public: + wxTreebookEvent(wxEventType commandType = wxEVT_NULL, int id = 0, + int nSel = wxNOT_FOUND, int nOldSel = wxNOT_FOUND) + : wxBookCtrlBaseEvent(commandType, id, nSel, nOldSel) + { + } + wxTreebookEvent(const wxTreebookEvent& event) + : wxBookCtrlBaseEvent(event) + { + } -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_TREEBOOK_PAGE_CHANGED, wxBookCtrlEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_TREEBOOK_PAGE_CHANGING, wxBookCtrlEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_TREEBOOK_NODE_COLLAPSED, wxBookCtrlEvent ); -wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_TREEBOOK_NODE_EXPANDED, wxBookCtrlEvent ); + virtual wxEvent *Clone() const { return new wxTreebookEvent(*this); } + +private: + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxTreebookEvent) +}; + +extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_TREEBOOK_PAGE_CHANGED; +extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_TREEBOOK_PAGE_CHANGING; +extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_TREEBOOK_NODE_COLLAPSED; +extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_TREEBOOK_NODE_EXPANDED; + +typedef void (wxEvtHandler::*wxTreebookEventFunction)(wxTreebookEvent&); + +#define wxTreebookEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxTreebookEventFunction, &func) #define EVT_TREEBOOK_PAGE_CHANGED(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_TREEBOOK_PAGE_CHANGED, winid, wxBookCtrlEventHandler(fn)) + wx__DECLARE_EVT1(wxEVT_COMMAND_TREEBOOK_PAGE_CHANGED, winid, wxTreebookEventHandler(fn)) #define EVT_TREEBOOK_PAGE_CHANGING(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_TREEBOOK_PAGE_CHANGING, winid, wxBookCtrlEventHandler(fn)) + wx__DECLARE_EVT1(wxEVT_COMMAND_TREEBOOK_PAGE_CHANGING, winid, wxTreebookEventHandler(fn)) #define EVT_TREEBOOK_NODE_COLLAPSED(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_TREEBOOK_NODE_COLLAPSED, winid, wxBookCtrlEventHandler(fn)) + wx__DECLARE_EVT1(wxEVT_COMMAND_TREEBOOK_NODE_COLLAPSED, winid, wxTreebookEventHandler(fn)) #define EVT_TREEBOOK_NODE_EXPANDED(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_TREEBOOK_NODE_EXPANDED, winid, wxBookCtrlEventHandler(fn)) + wx__DECLARE_EVT1(wxEVT_COMMAND_TREEBOOK_NODE_EXPANDED, winid, wxTreebookEventHandler(fn)) #endif // wxUSE_TREEBOOK diff --git a/Source/3rd Party/wx/include/wx/treectrl.h b/Source/3rd Party/wx/include/wx/treectrl.h index 33bd88dda..2b919cbd5 100644 --- a/Source/3rd Party/wx/include/wx/treectrl.h +++ b/Source/3rd Party/wx/include/wx/treectrl.h @@ -5,7 +5,7 @@ // Modified by: // Created: // Copyright: (c) Karsten Ballueder -// RCS-ID: $Id$ +// RCS-ID: $Id: treectrl.h 49563 2007-10-31 20:46:21Z VZ $ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -22,7 +22,7 @@ #include "wx/control.h" #include "wx/treebase.h" -#include "wx/textctrl.h" // wxTextCtrl::ms_classinfo used through wxCLASSINFO macro +#include "wx/textctrl.h" // wxTextCtrl::ms_classinfo used through CLASSINFO macro class WXDLLIMPEXP_FWD_CORE wxImageList; @@ -30,10 +30,23 @@ class WXDLLIMPEXP_FWD_CORE wxImageList; // wxTreeCtrlBase // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxTreeCtrlBase : public wxControl +class WXDLLEXPORT wxTreeCtrlBase : public wxControl { public: - wxTreeCtrlBase(); + wxTreeCtrlBase() + { + m_imageListNormal = + m_imageListState = NULL; + m_ownsImageListNormal = + m_ownsImageListState = false; + + // arbitrary default + m_spacing = 18; + + // quick DoGetBestSize calculation + m_quickBestSize = true; + } + virtual ~wxTreeCtrlBase(); // accessors @@ -105,18 +118,12 @@ public: // get the item's font virtual wxFont GetItemFont(const wxTreeItemId& item) const = 0; - // get the items state - int GetItemState(const wxTreeItemId& item) const - { - return DoGetItemState(item); - } - // modifiers // --------- // set items label virtual void SetItemText(const wxTreeItemId& item, const wxString& text) = 0; - // set one of the images associated with the item (normal by default) + // get one of the images associated with the item (normal by default) virtual void SetItemImage(const wxTreeItemId& item, int image, wxTreeItemIcon which = wxTreeItemIcon_Normal) = 0; @@ -149,9 +156,6 @@ public: virtual void SetItemFont(const wxTreeItemId& item, const wxFont& font) = 0; - // set the items state (special state values: wxTREE_ITEMSTATE_NONE/NEXT/PREV) - void SetItemState(const wxTreeItemId& item, int state); - // item status inquiries // --------------------- @@ -168,8 +172,10 @@ public: virtual bool IsSelected(const wxTreeItemId& item) const = 0; // is item text in bold font? virtual bool IsBold(const wxTreeItemId& item) const = 0; +#if wxABI_VERSION >= 20801 // is the control empty? bool IsEmpty() const; +#endif // wxABI 2.8.1+ // number of children @@ -197,17 +203,6 @@ public: // control with a lot of items (~ O(number of items)). virtual size_t GetSelections(wxArrayTreeItemIds& selections) const = 0; - // get the last item to be clicked when the control has wxTR_MULTIPLE - // equivalent to GetSelection() if not wxTR_MULTIPLE - virtual wxTreeItemId GetFocusedItem() const = 0; - - - // Clears the currently focused item - virtual void ClearFocusedItem() = 0; - // Sets the currently focused item. Item should be valid - virtual void SetFocusedItem(const wxTreeItemId& item) = 0; - - // get the parent of this item (may return NULL if root) virtual wxTreeItemId GetItemParent(const wxTreeItemId& item) const = 0; @@ -297,16 +292,18 @@ public: // expand this item virtual void Expand(const wxTreeItemId& item) = 0; - // expand the item and all its children recursively + // expand the item and all its childs and thats childs void ExpandAllChildren(const wxTreeItemId& item); // expand all items void ExpandAll(); // collapse the item without removing its children virtual void Collapse(const wxTreeItemId& item) = 0; - // collapse the item and all its children +#if wxABI_VERSION >= 20801 + // collapse the item and all its childs and thats childs void CollapseAllChildren(const wxTreeItemId& item); // collapse all items void CollapseAll(); +#endif // wxABI 2.8.1+ // collapse the item and remove all children virtual void CollapseAndReset(const wxTreeItemId& item) = 0; // toggles the current state @@ -318,9 +315,6 @@ public: virtual void UnselectAll() = 0; // select this item virtual void SelectItem(const wxTreeItemId& item, bool select = true) = 0; - // selects all (direct) children for given parent (only for - // multiselection controls) - virtual void SelectChildren(const wxTreeItemId& parent) = 0; // unselect this item void UnselectItem(const wxTreeItemId& item) { SelectItem(item, false); } // toggle item selection @@ -340,7 +334,7 @@ public: // been before. textCtrlClass parameter allows you to create an edit // control of arbitrary user-defined class deriving from wxTextCtrl. virtual wxTextCtrl *EditLabel(const wxTreeItemId& item, - wxClassInfo* textCtrlClass = wxCLASSINFO(wxTextCtrl)) = 0; + wxClassInfo* textCtrlClass = CLASSINFO(wxTextCtrl)) = 0; // returns the same pointer as StartEdit() if the item is being edited, // NULL otherwise (it's assumed that no more than one item may be // edited simultaneously) @@ -397,10 +391,6 @@ public: protected: virtual wxSize DoGetBestSize() const; - // common part of Get/SetItemState() - virtual int DoGetItemState(const wxTreeItemId& item) const = 0; - virtual void DoSetItemState(const wxTreeItemId& item, int state) = 0; - // common part of Append/Prepend/InsertItem() // // pos is the position at which to insert the item or (size_t)-1 to append @@ -439,14 +429,7 @@ protected: bool m_quickBestSize; -private: - // Intercept Escape and Return keys to ensure that our in-place edit - // control always gets them before they're used for dialog navigation or - // anything else. - void OnCharHook(wxKeyEvent& event); - - - wxDECLARE_NO_COPY_CLASS(wxTreeCtrlBase); + DECLARE_NO_COPY_CLASS(wxTreeCtrlBase) }; // ---------------------------------------------------------------------------- @@ -455,6 +438,8 @@ private: #if defined(__WXUNIVERSAL__) #include "wx/generic/treectlg.h" +#elif defined(__WXPALMOS__) + #include "wx/palmos/treectrl.h" #elif defined(__WXMSW__) #include "wx/msw/treectrl.h" #elif defined(__WXMOTIF__) diff --git a/Source/3rd Party/wx/include/wx/txtstrm.h b/Source/3rd Party/wx/include/wx/txtstrm.h index e9ab0ae73..0e2b0c955 100644 --- a/Source/3rd Party/wx/include/wx/txtstrm.h +++ b/Source/3rd Party/wx/include/wx/txtstrm.h @@ -4,7 +4,7 @@ // Author: Guilhem Lavaux // Modified by: // Created: 28/06/1998 -// RCS-ID: $Id$ +// RCS-ID: $Id: txtstrm.h 53135 2008-04-12 02:31:04Z VZ $ // Copyright: (c) Guilhem Lavaux // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -45,8 +45,6 @@ public: #endif ~wxTextInputStream(); - const wxInputStream& GetInputStream() const { return m_input; } - wxUint32 Read32(int base = 10); // base may be between 2 and 36, inclusive, or the special 0 (= C format) wxUint16 Read16(int base = 10); wxUint8 Read8(int base = 10); @@ -95,7 +93,7 @@ protected: wxChar NextChar(); // this should be used instead of GetC() because of Unicode issues wxChar NextNonSeparators(); - wxDECLARE_NO_COPY_CLASS(wxTextInputStream); + DECLARE_NO_COPY_CLASS(wxTextInputStream) }; typedef enum @@ -118,8 +116,6 @@ public: #endif virtual ~wxTextOutputStream(); - const wxOutputStream& GetOutputStream() const { return m_output; } - void SetMode( wxEOL mode = wxEOL_NATIVE ); wxEOL GetMode() { return m_mode; } @@ -131,8 +127,7 @@ public: wxTextOutputStream& PutChar(wxChar c); - void Flush(); - + wxTextOutputStream& operator<<(const wxChar *string); wxTextOutputStream& operator<<(const wxString& string); wxTextOutputStream& operator<<(char c); #if wxUSE_UNICODE && wxWCHAR_T_IS_REAL_TYPE @@ -155,7 +150,7 @@ protected: wxMBConv *m_conv; #endif - wxDECLARE_NO_COPY_CLASS(wxTextOutputStream); + DECLARE_NO_COPY_CLASS(wxTextOutputStream) }; #endif diff --git a/Source/3rd Party/wx/include/wx/typeinfo.h b/Source/3rd Party/wx/include/wx/typeinfo.h deleted file mode 100644 index e2f858084..000000000 --- a/Source/3rd Party/wx/include/wx/typeinfo.h +++ /dev/null @@ -1,148 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/typeinfo.h -// Purpose: wxTypeId implementation -// Author: Jaakko Salli -// Created: 2009-11-19 -// RCS-ID: $Id$ -// Copyright: (c) wxWidgets Team -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TYPEINFO_H_ -#define _WX_TYPEINFO_H_ - -// -// This file defines wxTypeId macro that should be used internally in -// wxWidgets instead of typeid(), for compatibility with builds that do -// not implement C++ RTTI. Also, type defining macros in this file are -// intended for internal use only at this time and may change in future -// versions. -// -// The reason why we need this simple RTTI system in addition to the older -// wxObject-based one is that the latter does not work in template -// classes. -// - -#include "wx/defs.h" - -#ifndef wxNO_RTTI - -// -// Let's trust that Visual C++ versions 9.0 and later implement C++ -// RTTI well enough, so we can use it and work around harmless memory -// leaks reported by the static run-time libraries. -// -#if wxCHECK_VISUALC_VERSION(9) - #define wxTRUST_CPP_RTTI 1 -#else - #define wxTRUST_CPP_RTTI 0 -#endif - -#include -#include - -#define _WX_DECLARE_TYPEINFO_CUSTOM(CLS, IDENTFUNC) -#define WX_DECLARE_TYPEINFO_INLINE(CLS) -#define WX_DECLARE_TYPEINFO(CLS) -#define WX_DEFINE_TYPEINFO(CLS) -#define WX_DECLARE_ABSTRACT_TYPEINFO(CLS) - -#if wxTRUST_CPP_RTTI - -#define wxTypeId typeid - -#else /* !wxTRUST_CPP_RTTI */ - -// -// For improved type-safety, let's make the check using class name -// comparison. Most modern compilers already do this, but we cannot -// rely on all supported compilers to work this well. However, in -// cases where we'd know that typeid() would be flawless (as such), -// wxTypeId could of course simply be defined as typeid. -// - -class wxTypeIdentifier -{ -public: - wxTypeIdentifier(const char* className) - { - m_className = className; - } - - bool operator==(const wxTypeIdentifier& other) - { - return strcmp(m_className, other.m_className) == 0; - } - - bool operator!=(const wxTypeIdentifier& other) - { - return strcmp(m_className, other.m_className) != 0; - } -private: - const char* m_className; -}; - -#define wxTypeId(OBJ) wxTypeIdentifier(typeid(OBJ).name()) - -#endif /* wxTRUST_CPP_RTTI/!wxTRUST_CPP_RTTI */ - -#else // if !wxNO_RTTI - -#define wxTRUST_CPP_RTTI 0 - -// -// When C++ RTTI is not available, we will have to make the type comparison -// using pointer to a dummy static member function. This will fail if -// declared type is used across DLL boundaries, although using -// WX_DECLARE_TYPEINFO() and WX_DEFINE_TYPEINFO() pair instead of -// WX_DECLARE_TYPEINFO_INLINE() should fix this. However, that approach is -// usually not possible when type info needs to be declared for a template -// class. -// - -typedef void (*wxTypeIdentifier)(); - -// Use this macro to declare type info with specified static function -// IDENTFUNC used as type identifier. Usually you should only use -// WX_DECLARE_TYPEINFO() or WX_DECLARE_TYPEINFO_INLINE() however. -#define _WX_DECLARE_TYPEINFO_CUSTOM(CLS, IDENTFUNC) \ -public: \ - virtual wxTypeIdentifier GetWxTypeId() const \ - { \ - return reinterpret_cast \ - (&IDENTFUNC); \ - } - -// Use this macro to declare type info with externally specified -// type identifier, defined with WX_DEFINE_TYPEINFO(). -#define WX_DECLARE_TYPEINFO(CLS) \ -private: \ - static CLS sm_wxClassInfo(); \ -_WX_DECLARE_TYPEINFO_CUSTOM(CLS, sm_wxClassInfo) - -// Use this macro to implement type identifier function required by -// WX_DECLARE_TYPEINFO(). -// NOTE: CLS is required to have default ctor. If it doesn't -// already, you should provide a private dummy one. -#define WX_DEFINE_TYPEINFO(CLS) \ -CLS CLS::sm_wxClassInfo() { return CLS(); } - -// Use this macro to declare type info fully inline in class. -// NOTE: CLS is required to have default ctor. If it doesn't -// already, you should provide a private dummy one. -#define WX_DECLARE_TYPEINFO_INLINE(CLS) \ -private: \ - static CLS sm_wxClassInfo() { return CLS(); } \ -_WX_DECLARE_TYPEINFO_CUSTOM(CLS, sm_wxClassInfo) - -#define wxTypeId(OBJ) (OBJ).GetWxTypeId() - -// Because abstract classes cannot be instantiated, we use -// this macro to define pure virtual type interface for them. -#define WX_DECLARE_ABSTRACT_TYPEINFO(CLS) \ -public: \ - virtual wxTypeIdentifier GetWxTypeId() const = 0; - -#endif // wxNO_RTTI/!wxNO_RTTI - -#endif // _WX_TYPEINFO_H_ diff --git a/Source/3rd Party/wx/include/wx/uiaction.h b/Source/3rd Party/wx/include/wx/uiaction.h deleted file mode 100644 index 4801659c3..000000000 --- a/Source/3rd Party/wx/include/wx/uiaction.h +++ /dev/null @@ -1,89 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/uiaction.h -// Purpose: wxUIActionSimulator interface -// Author: Kevin Ollivier, Steven Lamerton, Vadim Zeitlin -// Modified by: -// Created: 2010-03-06 -// RCS-ID: $Id$ -// Copyright: (c) Kevin Ollivier -// (c) 2010 Steven Lamerton -// (c) 2010 Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_UIACTIONSIMULATOR_H_ -#define _WX_UIACTIONSIMULATOR_H_ - -#include "wx/defs.h" - -#if wxUSE_UIACTIONSIMULATOR - -#include "wx/mousestate.h" // for wxMOUSE_BTN_XXX constants - -class WXDLLIMPEXP_CORE wxUIActionSimulator -{ -public: - wxUIActionSimulator() { } - - - // Default dtor, copy ctor and assignment operator are ok (even though the - // last two don't make much sense for this class). - - - // Mouse simulation - // ---------------- - - // Low level methods - bool MouseMove(long x, long y); - bool MouseMove(const wxPoint& point) { return MouseMove(point.x, point.y); } - - bool MouseDown(int button = wxMOUSE_BTN_LEFT); - bool MouseUp(int button = wxMOUSE_BTN_LEFT); - - // Higher level interface, use it if possible instead - bool MouseClick(int button = wxMOUSE_BTN_LEFT); - bool MouseDblClick(int button = wxMOUSE_BTN_LEFT); - bool MouseDragDrop(long x1, long y1, long x2, long y2, - int button = wxMOUSE_BTN_LEFT); - - - // Keyboard simulation - // ------------------- - - // Low level methods for generating key presses and releases - bool KeyDown(int keycode, int modifiers = wxMOD_NONE) - { return Key(keycode, modifiers, true); } - - bool KeyUp(int keycode, int modifiers = wxMOD_NONE) - { return Key(keycode, modifiers, false); } - - // Higher level methods for generating both the key press and release for a - // single key or for all characters in the ASCII string "text" which can currently - // contain letters, digits and characters for the definition of numbers [+-., ]. - bool Char(int keycode, int modifiers = wxMOD_NONE); - - bool Text(const char *text); - -private: - // This is the common part of Key{Down,Up}() methods: while we keep them - // separate at public API level for consistency with Mouse{Down,Up}(), at - // implementation level it makes more sense to have them in a single - // function. - // - // It calls DoModifiers() to simulate pressing the modifier keys if - // necessary and then DoKey() for the key itself. - bool Key(int keycode, int modifiers, bool isDown); - - // Call DoKey() for all modifier keys whose bits are set in the parameter. - void SimulateModifiers(int modifier, bool isDown); - - - // The low-level port-specific function which really generates the key - // presses. It should generate exactly one key event with the given - // parameters. - bool DoKey(int keycode, int modifiers, bool isDown); -}; - -#endif // wxUSE_UIACTIONSIMULATOR - -#endif // _WX_UIACTIONSIMULATOR_H_ diff --git a/Source/3rd Party/wx/include/wx/unichar.h b/Source/3rd Party/wx/include/wx/unichar.h deleted file mode 100644 index 3a47eda28..000000000 --- a/Source/3rd Party/wx/include/wx/unichar.h +++ /dev/null @@ -1,349 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/unichar.h -// Purpose: wxUniChar and wxUniCharRef classes -// Author: Vaclav Slavik -// Created: 2007-03-19 -// RCS-ID: $Id$ -// Copyright: (c) 2007 REA Elektronik GmbH -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_UNICHAR_H_ -#define _WX_UNICHAR_H_ - -#include "wx/defs.h" -#include "wx/chartype.h" -#include "wx/stringimpl.h" - -class WXDLLIMPEXP_FWD_BASE wxUniCharRef; -class WXDLLIMPEXP_FWD_BASE wxString; - -// This class represents single Unicode character. It can be converted to -// and from char or wchar_t and implements commonly used character operations. -class WXDLLIMPEXP_BASE wxUniChar -{ -public: - // NB: this is not wchar_t on purpose, it needs to represent the entire - // Unicode code points range and wchar_t may be too small for that - // (e.g. on Win32 where wchar_t* is encoded in UTF-16) - typedef wxUint32 value_type; - - wxUniChar() : m_value(0) {} - - // Create the character from 8bit character value encoded in the current - // locale's charset. - wxUniChar(char c) { m_value = From8bit(c); } - wxUniChar(unsigned char c) { m_value = From8bit((char)c); } - - // Create the character from a wchar_t character value. -#if wxWCHAR_T_IS_REAL_TYPE - wxUniChar(wchar_t c) { m_value = c; } -#endif - - wxUniChar(int c) { m_value = c; } - wxUniChar(unsigned int c) { m_value = c; } - wxUniChar(long int c) { m_value = c; } - wxUniChar(unsigned long int c) { m_value = c; } - wxUniChar(short int c) { m_value = c; } - wxUniChar(unsigned short int c) { m_value = c; } - - wxUniChar(const wxUniCharRef& c); - - // Returns Unicode code point value of the character - value_type GetValue() const { return m_value; } - -#if wxUSE_UNICODE_UTF8 - // buffer for single UTF-8 character - struct Utf8CharBuffer - { - char data[5]; - operator const char*() const { return data; } - }; - - // returns the character encoded as UTF-8 - // (NB: implemented in stringops.cpp) - Utf8CharBuffer AsUTF8() const; -#endif // wxUSE_UNICODE_UTF8 - - // Returns true if the character is an ASCII character: - bool IsAscii() const { return m_value < 0x80; } - - // Returns true if the character is representable as a single byte in the - // current locale encoding and return this byte in output argument c (which - // must be non-NULL) - bool GetAsChar(char *c) const - { -#if wxUSE_UNICODE - if ( !IsAscii() ) - { -#if !wxUSE_UTF8_LOCALE_ONLY - if ( GetAsHi8bit(m_value, c) ) - return true; -#endif // !wxUSE_UTF8_LOCALE_ONLY - - return false; - } -#endif // wxUSE_UNICODE - - *c = wx_truncate_cast(char, m_value); - return true; - } - - // Conversions to char and wchar_t types: all of those are needed to be - // able to pass wxUniChars to verious standard narrow and wide character - // functions - operator char() const { return To8bit(m_value); } - operator unsigned char() const { return (unsigned char)To8bit(m_value); } -#if wxWCHAR_T_IS_REAL_TYPE - operator wchar_t() const { return (wchar_t)m_value; } -#endif - operator int() const { return (int)m_value; } - operator unsigned int() const { return (unsigned int)m_value; } - operator long int() const { return (long int)m_value; } - operator unsigned long int() const { return (unsigned long)m_value; } - operator short int() const { return (short int)m_value; } - operator unsigned short int() const { return (unsigned short int)m_value; } - - // We need this operator for the "*p" part of expressions like "for ( - // const_iterator p = begin() + nStart; *p; ++p )". In this case, - // compilation would fail without it because the conversion to bool would - // be ambiguous (there are all these int types conversions...). (And adding - // operator unspecified_bool_type() would only makes the ambiguity worse.) - operator bool() const { return m_value != 0; } - bool operator!() const { return !((bool)*this); } - - // And this one is needed by some (not all, but not using ifdefs makes the - // code easier) compilers to parse "str[0] && *p" successfully - bool operator&&(bool v) const { return (bool)*this && v; } - - // Assignment operators: - wxUniChar& operator=(const wxUniChar& c) { if (&c != this) m_value = c.m_value; return *this; } - wxUniChar& operator=(const wxUniCharRef& c); - wxUniChar& operator=(char c) { m_value = From8bit(c); return *this; } - wxUniChar& operator=(unsigned char c) { m_value = From8bit((char)c); return *this; } -#if wxWCHAR_T_IS_REAL_TYPE - wxUniChar& operator=(wchar_t c) { m_value = c; return *this; } -#endif - wxUniChar& operator=(int c) { m_value = c; return *this; } - wxUniChar& operator=(unsigned int c) { m_value = c; return *this; } - wxUniChar& operator=(long int c) { m_value = c; return *this; } - wxUniChar& operator=(unsigned long int c) { m_value = c; return *this; } - wxUniChar& operator=(short int c) { m_value = c; return *this; } - wxUniChar& operator=(unsigned short int c) { m_value = c; return *this; } - - // Comparison operators: - - // define the given comparison operator for all the types -#define wxDEFINE_UNICHAR_OPERATOR(op) \ - bool operator op(const wxUniChar& c) const { return m_value op c.m_value; }\ - bool operator op(char c) const { return m_value op From8bit(c); } \ - bool operator op(unsigned char c) const { return m_value op From8bit((char)c); } \ - wxIF_WCHAR_T_TYPE( bool operator op(wchar_t c) const { return m_value op (value_type)c; } ) \ - bool operator op(int c) const { return m_value op (value_type)c; } \ - bool operator op(unsigned int c) const { return m_value op (value_type)c; } \ - bool operator op(short int c) const { return m_value op (value_type)c; } \ - bool operator op(unsigned short int c) const { return m_value op (value_type)c; } \ - bool operator op(long int c) const { return m_value op (value_type)c; } \ - bool operator op(unsigned long int c) const { return m_value op (value_type)c; } - - wxFOR_ALL_COMPARISONS(wxDEFINE_UNICHAR_OPERATOR) - -#undef wxDEFINE_UNICHAR_OPERATOR - - // this is needed for expressions like 'Z'-c - int operator-(const wxUniChar& c) const { return m_value - c.m_value; } - int operator-(char c) const { return m_value - From8bit(c); } - int operator-(unsigned char c) const { return m_value - From8bit((char)c); } - int operator-(wchar_t c) const { return m_value - (value_type)c; } - - -private: - // notice that we implement these functions inline for 7-bit ASCII - // characters purely for performance reasons - static value_type From8bit(char c) - { -#if wxUSE_UNICODE - if ( (unsigned char)c < 0x80 ) - return c; - - return FromHi8bit(c); -#else - return c; -#endif - } - - static char To8bit(value_type c) - { -#if wxUSE_UNICODE - if ( c < 0x80 ) - return wx_truncate_cast(char, c); - - return ToHi8bit(c); -#else - return c; -#endif - } - - // helpers of the functions above called to deal with non-ASCII chars - static value_type FromHi8bit(char c); - static char ToHi8bit(value_type v); - static bool GetAsHi8bit(value_type v, char *c); - -private: - value_type m_value; -}; - - -// Writeable reference to a character in wxString. -// -// This class can be used in the same way wxChar is used, except that changing -// its value updates the underlying string object. -class WXDLLIMPEXP_BASE wxUniCharRef -{ -private: - typedef wxStringImpl::iterator iterator; - - // create the reference -#if wxUSE_UNICODE_UTF8 - wxUniCharRef(wxString& str, iterator pos) : m_str(str), m_pos(pos) {} -#else - wxUniCharRef(iterator pos) : m_pos(pos) {} -#endif - -public: - // NB: we have to make this public, because we don't have wxString - // declaration available here and so can't declare wxString::iterator - // as friend; so at least don't use a ctor but a static function - // that must be used explicitly (this is more than using 'explicit' - // keyword on ctor!): -#if wxUSE_UNICODE_UTF8 - static wxUniCharRef CreateForString(wxString& str, iterator pos) - { return wxUniCharRef(str, pos); } -#else - static wxUniCharRef CreateForString(iterator pos) - { return wxUniCharRef(pos); } -#endif - - wxUniChar::value_type GetValue() const { return UniChar().GetValue(); } - -#if wxUSE_UNICODE_UTF8 - wxUniChar::Utf8CharBuffer AsUTF8() const { return UniChar().AsUTF8(); } -#endif // wxUSE_UNICODE_UTF8 - - bool IsAscii() const { return UniChar().IsAscii(); } - bool GetAsChar(char *c) const { return UniChar().GetAsChar(c); } - - // Assignment operators: -#if wxUSE_UNICODE_UTF8 - wxUniCharRef& operator=(const wxUniChar& c); -#else - wxUniCharRef& operator=(const wxUniChar& c) { *m_pos = c; return *this; } -#endif - - wxUniCharRef& operator=(const wxUniCharRef& c) - { if (&c != this) *this = c.UniChar(); return *this; } - - wxUniCharRef& operator=(char c) { return *this = wxUniChar(c); } - wxUniCharRef& operator=(unsigned char c) { return *this = wxUniChar(c); } -#if wxWCHAR_T_IS_REAL_TYPE - wxUniCharRef& operator=(wchar_t c) { return *this = wxUniChar(c); } -#endif - wxUniCharRef& operator=(int c) { return *this = wxUniChar(c); } - wxUniCharRef& operator=(unsigned int c) { return *this = wxUniChar(c); } - wxUniCharRef& operator=(short int c) { return *this = wxUniChar(c); } - wxUniCharRef& operator=(unsigned short int c) { return *this = wxUniChar(c); } - wxUniCharRef& operator=(long int c) { return *this = wxUniChar(c); } - wxUniCharRef& operator=(unsigned long int c) { return *this = wxUniChar(c); } - - // Conversions to the same types as wxUniChar is convertible too: - operator char() const { return UniChar(); } - operator unsigned char() const { return UniChar(); } -#if wxWCHAR_T_IS_REAL_TYPE - operator wchar_t() const { return UniChar(); } -#endif - operator int() const { return UniChar(); } - operator unsigned int() const { return UniChar(); } - operator short int() const { return UniChar(); } - operator unsigned short int() const { return UniChar(); } - operator long int() const { return UniChar(); } - operator unsigned long int() const { return UniChar(); } - - // see wxUniChar::operator bool etc. for explanation - operator bool() const { return (bool)UniChar(); } - bool operator!() const { return !UniChar(); } - bool operator&&(bool v) const { return UniChar() && v; } - - // Comparison operators: -#define wxDEFINE_UNICHARREF_OPERATOR(op) \ - bool operator op(const wxUniCharRef& c) const { return UniChar() op c.UniChar(); }\ - bool operator op(const wxUniChar& c) const { return UniChar() op c; } \ - bool operator op(char c) const { return UniChar() op c; } \ - bool operator op(unsigned char c) const { return UniChar() op c; } \ - wxIF_WCHAR_T_TYPE( bool operator op(wchar_t c) const { return UniChar() op c; } ) \ - bool operator op(int c) const { return UniChar() op c; } \ - bool operator op(unsigned int c) const { return UniChar() op c; } \ - bool operator op(short int c) const { return UniChar() op c; } \ - bool operator op(unsigned short int c) const { return UniChar() op c; } \ - bool operator op(long int c) const { return UniChar() op c; } \ - bool operator op(unsigned long int c) const { return UniChar() op c; } - - wxFOR_ALL_COMPARISONS(wxDEFINE_UNICHARREF_OPERATOR) - -#undef wxDEFINE_UNICHARREF_OPERATOR - - // for expressions like c-'A': - int operator-(const wxUniCharRef& c) const { return UniChar() - c.UniChar(); } - int operator-(const wxUniChar& c) const { return UniChar() - c; } - int operator-(char c) const { return UniChar() - c; } - int operator-(unsigned char c) const { return UniChar() - c; } - int operator-(wchar_t c) const { return UniChar() - c; } - -private: -#if wxUSE_UNICODE_UTF8 - wxUniChar UniChar() const; -#else - wxUniChar UniChar() const { return *m_pos; } -#endif - - friend class WXDLLIMPEXP_FWD_BASE wxUniChar; - -private: - // reference to the string and pointer to the character in string -#if wxUSE_UNICODE_UTF8 - wxString& m_str; -#endif - iterator m_pos; -}; - -inline wxUniChar::wxUniChar(const wxUniCharRef& c) -{ - m_value = c.UniChar().m_value; -} - -inline wxUniChar& wxUniChar::operator=(const wxUniCharRef& c) -{ - m_value = c.UniChar().m_value; - return *this; -} - -// Comparison operators for the case when wxUniChar(Ref) is the second operand -// implemented in terms of member comparison functions - -#define wxCMP_REVERSE(c1, c2, op) c2 op c1 - -wxDEFINE_COMPARISONS(char, const wxUniChar&, wxCMP_REVERSE) -wxDEFINE_COMPARISONS(char, const wxUniCharRef&, wxCMP_REVERSE) - -wxDEFINE_COMPARISONS(wchar_t, const wxUniChar&, wxCMP_REVERSE) -wxDEFINE_COMPARISONS(wchar_t, const wxUniCharRef&, wxCMP_REVERSE) - -wxDEFINE_COMPARISONS(const wxUniChar&, const wxUniCharRef&, wxCMP_REVERSE) - -#undef wxCMP_REVERSE - -// for expressions like c-'A': -inline int operator-(char c1, const wxUniCharRef& c2) { return -(c2 - c1); } -inline int operator-(const wxUniChar& c1, const wxUniCharRef& c2) { return -(c2 - c1); } -inline int operator-(wchar_t c1, const wxUniCharRef& c2) { return -(c2 - c1); } - -#endif /* _WX_UNICHAR_H_ */ diff --git a/Source/3rd Party/wx/include/wx/uri.h b/Source/3rd Party/wx/include/wx/uri.h index 40e474e39..33d843c60 100644 --- a/Source/3rd Party/wx/include/wx/uri.h +++ b/Source/3rd Party/wx/include/wx/uri.h @@ -1,12 +1,11 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/uri.h +// Name: uri.h // Purpose: wxURI - Class for parsing URIs // Author: Ryan Norton -// Vadim Zeitlin (UTF-8 URI support, many other changes) +// Modified By: // Created: 07/01/2004 -// RCS-ID: $Id$ -// Copyright: (c) 2004 Ryan Norton -// 2008 Vadim Zeitlin +// RCS-ID: $Id: uri.h 35650 2005-09-23 12:56:45Z MR $ +// Copyright: (c) Ryan Norton // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// @@ -16,7 +15,6 @@ #include "wx/defs.h" #include "wx/object.h" #include "wx/string.h" -#include "wx/arrstr.h" // Host Type that the server component can be enum wxURIHostType @@ -54,119 +52,84 @@ class WXDLLIMPEXP_BASE wxURI : public wxObject public: wxURI(); wxURI(const wxString& uri); + wxURI(const wxURI& uri); - // default copy ctor, assignment operator and dtor are ok + virtual ~wxURI(); - bool Create(const wxString& uri); + const wxChar* Create(const wxString& uri); - wxURI& operator=(const wxString& string) - { - Create(string); - return *this; - } + bool HasScheme() const { return (m_fields & wxURI_SCHEME) == wxURI_SCHEME; } + bool HasUserInfo() const { return (m_fields & wxURI_USERINFO) == wxURI_USERINFO; } + bool HasServer() const { return (m_fields & wxURI_SERVER) == wxURI_SERVER; } + bool HasPort() const { return (m_fields & wxURI_PORT) == wxURI_PORT; } + bool HasPath() const { return (m_fields & wxURI_PATH) == wxURI_PATH; } + bool HasQuery() const { return (m_fields & wxURI_QUERY) == wxURI_QUERY; } + bool HasFragment() const { return (m_fields & wxURI_FRAGMENT) == wxURI_FRAGMENT; } - bool operator==(const wxURI& uri) const; + const wxString& GetScheme() const { return m_scheme; } + const wxString& GetPath() const { return m_path; } + const wxString& GetQuery() const { return m_query; } + const wxString& GetFragment() const { return m_fragment; } + const wxString& GetPort() const { return m_port; } + const wxString& GetUserInfo() const { return m_userinfo; } + const wxString& GetServer() const { return m_server; } + const wxURIHostType& GetHostType() const { return m_hostType; } - // various accessors - - bool HasScheme() const { return (m_fields & wxURI_SCHEME) != 0; } - bool HasUserInfo() const { return (m_fields & wxURI_USERINFO) != 0; } - bool HasServer() const { return (m_fields & wxURI_SERVER) != 0; } - bool HasPort() const { return (m_fields & wxURI_PORT) != 0; } - bool HasPath() const { return (m_fields & wxURI_PATH) != 0; } - bool HasQuery() const { return (m_fields & wxURI_QUERY) != 0; } - bool HasFragment() const { return (m_fields & wxURI_FRAGMENT) != 0; } - - const wxString& GetScheme() const { return m_scheme; } - const wxString& GetPath() const { return m_path; } - const wxString& GetQuery() const { return m_query; } - const wxString& GetFragment() const { return m_fragment; } - const wxString& GetPort() const { return m_port; } - const wxString& GetUserInfo() const { return m_userinfo; } - const wxString& GetServer() const { return m_server; } - wxURIHostType GetHostType() const { return m_hostType; } - - // these functions only work if the user information part of the URI is in - // the usual (but insecure and hence explicitly recommended against by the - // RFC) "user:password" form + //Note that the following two get functions are explicitly depreciated by RFC 2396 wxString GetUser() const; wxString GetPassword() const; - - // combine all URI components into a single string - // - // BuildURI() returns the real URI suitable for use with network libraries, - // for example, while BuildUnescapedURI() returns a string suitable to be - // shown to the user. - wxString BuildURI() const { return DoBuildURI(&wxURI::Nothing); } - wxString BuildUnescapedURI() const { return DoBuildURI(&wxURI::Unescape); } - - // the escaped URI should contain only ASCII characters, including possible - // escape sequences - static wxString Unescape(const wxString& escapedURI); - + wxString BuildURI() const; + wxString BuildUnescapedURI() const; void Resolve(const wxURI& base, int flags = wxURI_STRICT); bool IsReference() const; + wxURI& operator = (const wxURI& uri); + wxURI& operator = (const wxString& string); + bool operator == (const wxURI& uri) const; + + static wxString Unescape (const wxString& szEscapedURI); + protected: + wxURI& Assign(const wxURI& uri); + void Clear(); - // common part of BuildURI() and BuildUnescapedURI() - wxString DoBuildURI(wxString (*funcDecode)(const wxString&)) const; - - // function which returns its argument unmodified, this is used by - // BuildURI() to tell DoBuildURI() that nothing needs to be done with the - // URI components - static wxString Nothing(const wxString& value) { return value; } - - bool Parse(const char* uri); - - const char* ParseAuthority (const char* uri); - const char* ParseScheme (const char* uri); - const char* ParseUserInfo (const char* uri); - const char* ParseServer (const char* uri); - const char* ParsePort (const char* uri); - const char* ParsePath (const char* uri); - const char* ParseQuery (const char* uri); - const char* ParseFragment (const char* uri); + const wxChar* Parse (const wxChar* uri); + const wxChar* ParseAuthority (const wxChar* uri); + const wxChar* ParseScheme (const wxChar* uri); + const wxChar* ParseUserInfo (const wxChar* uri); + const wxChar* ParseServer (const wxChar* uri); + const wxChar* ParsePort (const wxChar* uri); + const wxChar* ParsePath (const wxChar* uri, + bool bReference = false, + bool bNormalize = true); + const wxChar* ParseQuery (const wxChar* uri); + const wxChar* ParseFragment (const wxChar* uri); - static bool ParseH16(const char*& uri); - static bool ParseIPv4address(const char*& uri); - static bool ParseIPv6address(const char*& uri); - static bool ParseIPvFuture(const char*& uri); + static bool ParseH16(const wxChar*& uri); + static bool ParseIPv4address(const wxChar*& uri); + static bool ParseIPv6address(const wxChar*& uri); + static bool ParseIPvFuture(const wxChar*& uri); - // should be called with i pointing to '%', returns the encoded character - // following it or -1 if invalid and advances i past it (so that it points - // to the last character consumed on return) - static int DecodeEscape(wxString::const_iterator& i); + static void Normalize(wxChar* uri, bool bIgnoreLeads = false); + static void UpTree(const wxChar* uristart, const wxChar*& uri); - // append next character pointer to by p to the string in an escaped form - // and advance p past it - // - // if the next character is '%' and it's followed by 2 hex digits, they are - // not escaped (again) by this function, this allows to keep (backwards- - // compatible) ambiguity about the input format to wxURI::Create(): it can - // be either already escaped or not - void AppendNextEscaped(wxString& s, const char *& p); + static wxChar TranslateEscape(const wxChar* s); + static void Escape (wxString& s, const wxChar& c); + static bool IsEscape(const wxChar*& uri); - // convert hexadecimal digit to its value; return -1 if c isn't valid - static int CharToHex(char c); + static wxChar CharToHex(const wxChar& c); - // split an URI path string in its component segments (including empty and - // "." ones, no post-processing is done) - static wxArrayString SplitInSegments(const wxString& path); - - // various URI grammar helpers - static bool IsUnreserved(char c); - static bool IsReserved(char c); - static bool IsGenDelim(char c); - static bool IsSubDelim(char c); - static bool IsHex(char c); - static bool IsAlpha(char c); - static bool IsDigit(char c); - static bool IsEndPath(char c); + static bool IsUnreserved (const wxChar& c); + static bool IsReserved (const wxChar& c); + static bool IsGenDelim (const wxChar& c); + static bool IsSubDelim (const wxChar& c); + static bool IsHex(const wxChar& c); + static bool IsAlpha(const wxChar& c); + static bool IsDigit(const wxChar& c); wxString m_scheme; wxString m_path; diff --git a/Source/3rd Party/wx/include/wx/ustring.h b/Source/3rd Party/wx/include/wx/ustring.h deleted file mode 100644 index 25aa1b77b..000000000 --- a/Source/3rd Party/wx/include/wx/ustring.h +++ /dev/null @@ -1,750 +0,0 @@ - -// Name: wx/ustring.h -// Purpose: 32-bit string (UCS-4) -// Author: Robert Roebling -// Copyright: (c) Robert Roebling -// RCS-ID: $Id$ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_USTRING_H_ -#define _WX_USTRING_H_ - -#include "wx/defs.h" -#include "wx/string.h" - -#include - -#if SIZEOF_WCHAR_T == 2 -typedef wxWCharBuffer wxU16CharBuffer; -typedef wxScopedWCharBuffer wxScopedU16CharBuffer; -#else -typedef wxCharTypeBuffer wxU16CharBuffer; -typedef wxScopedCharTypeBuffer wxScopedU16CharBuffer; -#endif - -#if SIZEOF_WCHAR_T == 4 -typedef wxWCharBuffer wxU32CharBuffer; -typedef wxScopedWCharBuffer wxScopedU32CharBuffer; -#else -typedef wxCharTypeBuffer wxU32CharBuffer; -typedef wxScopedCharTypeBuffer wxScopedU32CharBuffer; -#endif - -#ifdef __VISUALC__ - // "non dll-interface class 'std::basic_string' used as base - // interface for dll-interface class 'wxString'" -- this is OK in our case - // (and warning is unavoidable anyhow) - #pragma warning(push) - #pragma warning(disable:4275) -#endif - -class WXDLLIMPEXP_BASE wxUString: public std::basic_string -{ -public: - wxUString() { } - - wxUString( const wxChar32 *str ) { assign(str); } - wxUString( const wxScopedU32CharBuffer &buf ) { assign(buf); } - - wxUString( const char *str ) { assign(str); } - wxUString( const wxScopedCharBuffer &buf ) { assign(buf); } - wxUString( const char *str, const wxMBConv &conv ) { assign(str,conv); } - wxUString( const wxScopedCharBuffer &buf, const wxMBConv &conv ) { assign(buf,conv); } - - wxUString( const wxChar16 *str ) { assign(str); } - wxUString( const wxScopedU16CharBuffer &buf ) { assign(buf); } - - wxUString( const wxCStrData *cstr ) { assign(cstr); } - wxUString( const wxString &str ) { assign(str); } - - wxUString( char ch ) { assign(ch); } - wxUString( wxChar16 ch ) { assign(ch); } - wxUString( wxChar32 ch ) { assign(ch); } - wxUString( wxUniChar ch ) { assign(ch); } - wxUString( wxUniCharRef ch ) { assign(ch); } - wxUString( size_type n, char ch ) { assign(n,ch); } - wxUString( size_type n, wxChar16 ch ) { assign(n,ch); } - wxUString( size_type n, wxChar32 ch ) { assign(n,ch); } - wxUString( size_type n, wxUniChar ch ) { assign(n,ch); } - wxUString( size_type n, wxUniCharRef ch ) { assign(n,ch); } - - // static construction - - static wxUString FromAscii( const char *str, size_type n ) - { - wxUString ret; - ret.assignFromAscii( str, n ); - return ret; - } - - static wxUString FromAscii( const char *str ) - { - wxUString ret; - ret.assignFromAscii( str ); - return ret; - } - - static wxUString FromUTF8( const char *str, size_type n ) - { - wxUString ret; - ret.assignFromUTF8( str, n ); - return ret; - } - - static wxUString FromUTF8( const char *str ) - { - wxUString ret; - ret.assignFromUTF8( str ); - return ret; - } - - static wxUString FromUTF16( const wxChar16 *str, size_type n ) - { - wxUString ret; - ret.assignFromUTF16( str, n ); - return ret; - } - - static wxUString FromUTF16( const wxChar16 *str ) - { - wxUString ret; - ret.assignFromUTF16( str ); - return ret; - } - - // assign from encoding - - wxUString &assignFromAscii( const char *str ); - wxUString &assignFromAscii( const char *str, size_type n ); - wxUString &assignFromUTF8( const char *str ); - wxUString &assignFromUTF8( const char *str, size_type n ); - wxUString &assignFromUTF16( const wxChar16* str ); - wxUString &assignFromUTF16( const wxChar16* str, size_type n ); - wxUString &assignFromCString( const char* str ); - wxUString &assignFromCString( const char* str, const wxMBConv &conv ); - - // conversions - - wxScopedCharBuffer utf8_str() const; - wxScopedU16CharBuffer utf16_str() const; - -#if SIZEOF_WCHAR_T == 2 - wxScopedWCharBuffer wc_str() const - { - return utf16_str(); - } -#else - wchar_t *wc_str() const - { - return (wchar_t*) c_str(); - } -#endif - - operator wxString() const - { -#if wxUSE_UNICODE_UTF8 - return wxString::FromUTF8( utf8_str() ); -#else -#if SIZEOF_WCHAR_T == 2 - return wxString( utf16_str() ); -#else - return wxString( c_str() ); -#endif -#endif - } - -#if wxUSE_UNICODE_UTF8 - wxScopedCharBuffer wx_str() - { - return utf8_str(); - } -#else -#if SIZEOF_WCHAR_T == 2 - wxScopedWCharBuffer wx_str() - { - return utf16_str(); - } -#else - const wchar_t* wx_str() - { - return c_str(); - } -#endif -#endif - - // assign - - wxUString &assign( const wxChar32* str ) - { - std::basic_string *base = this; - return (wxUString &) base->assign( str ); - } - - wxUString &assign( const wxChar32* str, size_type n ) - { - std::basic_string *base = this; - return (wxUString &) base->assign( str, n ); - } - - wxUString &assign( const wxUString &str ) - { - std::basic_string *base = this; - return (wxUString &) base->assign( str ); - } - - wxUString &assign( const wxUString &str, size_type pos, size_type n ) - { - std::basic_string *base = this; - return (wxUString &) base->assign( str, pos, n ); - } - - // FIXME-VC6: VC 6.0 stl does not support all types of assign functions - #ifdef __VISUALC6__ - wxUString &assign( wxChar32 ch ) - { - wxChar32 chh[1]; - chh[0] = ch; - std::basic_string *base = this; - return (wxUString &)base->assign(chh); - } - - wxUString &assign( size_type n, wxChar32 ch ) - { - wxU32CharBuffer buffer(n); - wxChar32 *p = buffer.data(); - size_type i; - for (i = 0; i < n; i++) - { - *p = ch; - p++; - } - - std::basic_string *base = this; - return (wxUString &)base->assign(buffer.data()); - } - #else - wxUString &assign( wxChar32 ch ) - { - std::basic_string *base = this; - return (wxUString &) base->assign( (size_type) 1, ch ); - } - - wxUString &assign( size_type n, wxChar32 ch ) - { - std::basic_string *base = this; - return (wxUString &) base->assign( n, ch ); - } - #endif // __VISUALC6__ - - wxUString &assign( const wxScopedU32CharBuffer &buf ) - { - return assign( buf.data() ); - } - - wxUString &assign( const char *str ) - { - return assignFromCString( str ); - } - - wxUString &assign( const wxScopedCharBuffer &buf ) - { - return assignFromCString( buf.data() ); - } - - wxUString &assign( const char *str, const wxMBConv &conv ) - { - return assignFromCString( str, conv ); - } - - wxUString &assign( const wxScopedCharBuffer &buf, const wxMBConv &conv ) - { - return assignFromCString( buf.data(), conv ); - } - - wxUString &assign( const wxChar16 *str ) - { - return assignFromUTF16( str ); - } - - wxUString &assign( const wxScopedU16CharBuffer &buf ) - { - return assignFromUTF16( buf.data() ); - } - - wxUString &assign( const wxCStrData *cstr ) - { -#if SIZEOF_WCHAR_T == 2 - return assignFromUTF16( cstr->AsWChar() ); -#else - return assign( cstr->AsWChar() ); -#endif - } - - wxUString &assign( const wxString &str ) - { -#if wxUSE_UNICODE_UTF8 - return assignFromUTF8( str.wx_str() ); -#else - #if SIZEOF_WCHAR_T == 2 - return assignFromUTF16( str.wc_str() ); - #else - return assign( str.wc_str() ); - #endif -#endif - } - - wxUString &assign( char ch ) - { - char buf[2]; - buf[0] = ch; - buf[1] = 0; - return assignFromCString( buf ); - } - - wxUString &assign( size_type n, char ch ) - { - wxCharBuffer buffer(n); - char *p = buffer.data(); - size_type i; - for (i = 0; i < n; i++) - { - *p = ch; - p++; - } - return assignFromCString( buffer.data() ); - } - - wxUString &assign( wxChar16 ch ) - { - wxChar16 buf[2]; - buf[0] = ch; - buf[1] = 0; - return assignFromUTF16( buf ); - } - - wxUString &assign( size_type n, wxChar16 ch ) - { - wxU16CharBuffer buffer(n); - wxChar16 *p = buffer.data(); - size_type i; - for (i = 0; i < n; i++) - { - *p = ch; - p++; - } - return assignFromUTF16( buffer.data() ); - } - - wxUString &assign( wxUniChar ch ) - { - return assign( (wxChar32) ch.GetValue() ); - } - - wxUString &assign( size_type n, wxUniChar ch ) - { - return assign( n, (wxChar32) ch.GetValue() ); - } - - wxUString &assign( wxUniCharRef ch ) - { - return assign( (wxChar32) ch.GetValue() ); - } - - wxUString &assign( size_type n, wxUniCharRef ch ) - { - return assign( n, (wxChar32) ch.GetValue() ); - } - - // append [STL overload] - - wxUString &append( const wxUString &s ) - { - std::basic_string *base = this; - return (wxUString &) base->append( s ); - } - - wxUString &append( const wxUString &s, size_type pos, size_type n ) - { - std::basic_string *base = this; - return (wxUString &) base->append( s, pos, n ); - } - - wxUString &append( const wxChar32* s ) - { - std::basic_string *base = this; - return (wxUString &) base->append( s ); - } - - wxUString &append( const wxChar32* s, size_type n ) - { - std::basic_string *base = this; - return (wxUString &) base->append( s, n ); - } - - // FIXME-VC6: VC 6.0 stl does not support all types of append functions - #ifdef __VISUALC6__ - wxUString &append( size_type n, wxChar32 c ) - { - wxU32CharBuffer buffer(n); - wxChar32 *p = buffer.data(); - size_type i; - for (i = 0; i < n; i++) - { - *p = c; - p++; - } - - std::basic_string *base = this; - return (wxUString &) base->append(buffer.data()); - } - #else - wxUString &append( size_type n, wxChar32 c ) - { - std::basic_string *base = this; - return (wxUString &) base->append( n, c ); - } - #endif // __VISUALC6__ - - wxUString &append( wxChar32 c ) - { - std::basic_string *base = this; - return (wxUString &) base->append( 1, c ); - } - - // append [wx overload] - - wxUString &append( const wxScopedU16CharBuffer &buf ) - { - return append( buf.data() ); - } - - wxUString &append( const wxScopedU32CharBuffer &buf ) - { - return append( buf.data() ); - } - - wxUString &append( const char *str ) - { - return append( wxUString( str ) ); - } - - wxUString &append( const wxScopedCharBuffer &buf ) - { - return append( wxUString( buf ) ); - } - - wxUString &append( const wxChar16 *str ) - { - return append( wxUString( str ) ); - } - - wxUString &append( const wxString &str ) - { - return append( wxUString( str ) ); - } - - wxUString &append( const wxCStrData *cstr ) - { - return append( wxUString( cstr ) ); - } - - wxUString &append( char ch ) - { - char buf[2]; - buf[0] = ch; - buf[1] = 0; - return append( buf ); - } - - wxUString &append( wxChar16 ch ) - { - wxChar16 buf[2]; - buf[0] = ch; - buf[1] = 0; - return append( buf ); - } - - wxUString &append( wxUniChar ch ) - { - return append( (size_type) 1, (wxChar32) ch.GetValue() ); - } - - wxUString &append( wxUniCharRef ch ) - { - return append( (size_type) 1, (wxChar32) ch.GetValue() ); - } - - - // insert [STL overloads] - - wxUString &insert( size_type pos, const wxUString &s ) - { - std::basic_string *base = this; - return (wxUString &) base->insert( pos, s ); - } - - wxUString &insert( size_type pos, const wxUString &s, size_type pos1, size_type n ) - { - std::basic_string *base = this; - return (wxUString &) base->insert( pos, s, pos1, n ); - } - - wxUString &insert( size_type pos, const wxChar32 *s ) - { - std::basic_string *base = this; - return (wxUString &) base->insert( pos, s ); - } - - wxUString &insert( size_type pos, const wxChar32 *s, size_type n ) - { - std::basic_string *base = this; - return (wxUString &) base->insert( pos, s, n ); - } - - wxUString &insert( size_type pos, size_type n, wxChar32 c ) - { - std::basic_string *base = this; - return (wxUString &) base->insert( pos, n, c ); - } - - - // insert [STL overloads] - - wxUString &insert( size_type n, const char *s ) - { - return insert( n, wxUString( s ) ); - } - - wxUString &insert( size_type n, const wxChar16 *s ) - { - return insert( n, wxUString( s ) ); - } - - wxUString &insert( size_type n, const wxScopedCharBuffer &buf ) - { - return insert( n, wxUString( buf ) ); - } - - wxUString &insert( size_type n, const wxScopedU16CharBuffer &buf ) - { - return insert( n, wxUString( buf ) ); - } - - wxUString &insert( size_type n, const wxScopedU32CharBuffer &buf ) - { - return insert( n, buf.data() ); - } - - wxUString &insert( size_type n, const wxString &s ) - { - return insert( n, wxUString( s ) ); - } - - wxUString &insert( size_type n, const wxCStrData *cstr ) - { - return insert( n, wxUString( cstr ) ); - } - - wxUString &insert( size_type n, char ch ) - { - char buf[2]; - buf[0] = ch; - buf[1] = 0; - return insert( n, buf ); - } - - wxUString &insert( size_type n, wchar_t ch ) - { - wchar_t buf[2]; - buf[0] = ch; - buf[1] = 0; - return insert( n, buf ); - } - - // insert iterator - - iterator insert( iterator it, wxChar32 ch ) - { - std::basic_string *base = this; - return base->insert( it, ch ); - } - - void insert(iterator it, const_iterator first, const_iterator last) - { - std::basic_string *base = this; - base->insert( it, first, last ); - } - - - // operator = - wxUString& operator=(const wxString& s) - { return assign( s ); } - wxUString& operator=(const wxCStrData* s) - { return assign( s ); } - wxUString& operator=(const char *s) - { return assign( s ); } - wxUString& operator=(const wxChar16 *s) - { return assign( s ); } - wxUString& operator=(const wxChar32 *s) - { return assign( s ); } - wxUString& operator=(const wxScopedCharBuffer &s) - { return assign( s ); } - wxUString& operator=(const wxScopedU16CharBuffer &s) - { return assign( s ); } - wxUString& operator=(const wxScopedU32CharBuffer &s) - { return assign( s ); } - wxUString& operator=(const char ch) - { return assign( ch ); } - wxUString& operator=(const wxChar16 ch) - { return assign( ch ); } - wxUString& operator=(const wxChar32 ch) - { return assign( ch ); } - wxUString& operator=(const wxUniChar ch) - { return assign( ch ); } - wxUString& operator=(const wxUniCharRef ch) - { return assign( ch ); } - - // operator += - wxUString& operator+=(const wxUString& s) - { return append( s ); } - wxUString& operator+=(const wxString& s) - { return append( s ); } - wxUString& operator+=(const wxCStrData* s) - { return append( s ); } - wxUString& operator+=(const char *s) - { return append( s ); } - wxUString& operator+=(const wxChar16 *s) - { return append( s ); } - wxUString& operator+=(const wxChar32 *s) - { return append( s ); } - wxUString& operator+=(const wxScopedCharBuffer &s) - { return append( s ); } - wxUString& operator+=(const wxScopedU16CharBuffer &s) - { return append( s ); } - wxUString& operator+=(const wxScopedU32CharBuffer &s) - { return append( s ); } - wxUString& operator+=(const char ch) - { return append( ch ); } - wxUString& operator+=(const wxChar16 ch) - { return append( ch ); } - wxUString& operator+=(const wxChar32 ch) - { return append( ch ); } - wxUString& operator+=(const wxUniChar ch) - { return append( ch ); } - wxUString& operator+=(const wxUniCharRef ch) - { return append( ch ); } - -}; - -#ifdef __VISUALC__ - #pragma warning(pop) -#endif - -inline wxUString operator+(const wxUString &s1, const wxUString &s2) - { wxUString ret( s1 ); ret.append( s2 ); return ret; } -inline wxUString operator+(const wxUString &s1, const char *s2) - { return s1 + wxUString(s2); } -inline wxUString operator+(const wxUString &s1, const wxString &s2) - { return s1 + wxUString(s2); } -inline wxUString operator+(const wxUString &s1, const wxCStrData *s2) - { return s1 + wxUString(s2); } -inline wxUString operator+(const wxUString &s1, const wxChar16* s2) - { return s1 + wxUString(s2); } -inline wxUString operator+(const wxUString &s1, const wxChar32 *s2) - { return s1 + wxUString(s2); } -inline wxUString operator+(const wxUString &s1, const wxScopedCharBuffer &s2) - { return s1 + wxUString(s2); } -inline wxUString operator+(const wxUString &s1, const wxScopedU16CharBuffer &s2) - { return s1 + wxUString(s2); } -inline wxUString operator+(const wxUString &s1, const wxScopedU32CharBuffer &s2) - { return s1 + wxUString(s2); } -inline wxUString operator+(const wxUString &s1, char s2) - { return s1 + wxUString(s2); } -inline wxUString operator+(const wxUString &s1, wxChar32 s2) - { wxUString ret( s1 ); ret.append( s2 ); return ret; } -inline wxUString operator+(const wxUString &s1, wxChar16 s2) - { wxUString ret( s1 ); ret.append( (wxChar32) s2 ); return ret; } -inline wxUString operator+(const wxUString &s1, wxUniChar s2) - { wxUString ret( s1 ); ret.append( (wxChar32) s2.GetValue() ); return ret; } -inline wxUString operator+(const wxUString &s1, wxUniCharRef s2) - { wxUString ret( s1 ); ret.append( (wxChar32) s2.GetValue() ); return ret; } - -inline wxUString operator+(const char *s1, const wxUString &s2) - { return wxUString(s1) + s2; } -inline wxUString operator+(const wxString &s1, const wxUString &s2) - { return wxUString(s1) + s2; } -inline wxUString operator+(const wxCStrData *s1, const wxUString &s2) - { return wxUString(s1) + s2; } -inline wxUString operator+(const wxChar16* s1, const wxUString &s2) - { return wxUString(s1) + s2; } -inline wxUString operator+(const wxChar32 *s1, const wxUString &s2) - { return wxUString(s1) + s2; } -inline wxUString operator+(const wxScopedCharBuffer &s1, const wxUString &s2) - { return wxUString(s1) + s2; } -inline wxUString operator+(const wxScopedU16CharBuffer &s1, const wxUString &s2) - { return wxUString(s1) + s2; } -inline wxUString operator+(const wxScopedU32CharBuffer &s1, const wxUString &s2) - { return wxUString(s1) + s2; } -inline wxUString operator+(char s1, const wxUString &s2) - { return wxUString(s1) + s2; } -inline wxUString operator+(wxChar32 s1, const wxUString &s2 ) - { return wxUString(s1) + s2; } -inline wxUString operator+(wxChar16 s1, const wxUString &s2) - { return wxUString(s1) + s2; } -inline wxUString operator+(wxUniChar s1, const wxUString &s2) - { return wxUString(s1) + s2; } -inline wxUString operator+(wxUniCharRef s1, const wxUString &s2) - { return wxUString(s1) + s2; } - - -inline bool operator==(const wxUString& s1, const wxUString& s2) - { return s1.compare( s2 ) == 0; } -inline bool operator!=(const wxUString& s1, const wxUString& s2) - { return s1.compare( s2 ) != 0; } -inline bool operator< (const wxUString& s1, const wxUString& s2) - { return s1.compare( s2 ) < 0; } -inline bool operator> (const wxUString& s1, const wxUString& s2) - { return s1.compare( s2 ) > 0; } -inline bool operator<=(const wxUString& s1, const wxUString& s2) - { return s1.compare( s2 ) <= 0; } -inline bool operator>=(const wxUString& s1, const wxUString& s2) - { return s1.compare( s2 ) >= 0; } - -#define wxUSTRING_COMP_OPERATORS( T ) \ -inline bool operator==(const wxUString& s1, T s2) \ - { return s1.compare( wxUString(s2) ) == 0; } \ -inline bool operator!=(const wxUString& s1, T s2) \ - { return s1.compare( wxUString(s2) ) != 0; } \ -inline bool operator< (const wxUString& s1, T s2) \ - { return s1.compare( wxUString(s2) ) < 0; } \ -inline bool operator> (const wxUString& s1, T s2) \ - { return s1.compare( wxUString(s2) ) > 0; } \ -inline bool operator<=(const wxUString& s1, T s2) \ - { return s1.compare( wxUString(s2) ) <= 0; } \ -inline bool operator>=(const wxUString& s1, T s2) \ - { return s1.compare( wxUString(s2) ) >= 0; } \ -\ -inline bool operator==(T s2, const wxUString& s1) \ - { return s1.compare( wxUString(s2) ) == 0; } \ -inline bool operator!=(T s2, const wxUString& s1) \ - { return s1.compare( wxUString(s2) ) != 0; } \ -inline bool operator< (T s2, const wxUString& s1) \ - { return s1.compare( wxUString(s2) ) > 0; } \ -inline bool operator> (T s2, const wxUString& s1) \ - { return s1.compare( wxUString(s2) ) < 0; } \ -inline bool operator<=(T s2, const wxUString& s1) \ - { return s1.compare( wxUString(s2) ) >= 0; } \ -inline bool operator>=(T s2, const wxUString& s1) \ - { return s1.compare( wxUString(s2) ) <= 0; } - -wxUSTRING_COMP_OPERATORS( const wxString & ) -wxUSTRING_COMP_OPERATORS( const char * ) -wxUSTRING_COMP_OPERATORS( const wxChar16 * ) -wxUSTRING_COMP_OPERATORS( const wxChar32 * ) -wxUSTRING_COMP_OPERATORS( const wxScopedCharBuffer & ) -wxUSTRING_COMP_OPERATORS( const wxScopedU16CharBuffer & ) -wxUSTRING_COMP_OPERATORS( const wxScopedU32CharBuffer & ) -wxUSTRING_COMP_OPERATORS( const wxCStrData * ) - -#endif // _WX_USTRING_H_ diff --git a/Source/3rd Party/wx/include/wx/utils.h b/Source/3rd Party/wx/include/wx/utils.h index 132aa0274..04a30ec3b 100644 --- a/Source/3rd Party/wx/include/wx/utils.h +++ b/Source/3rd Party/wx/include/wx/utils.h @@ -4,13 +4,13 @@ // Author: Julian Smart // Modified by: // Created: 29/01/98 -// RCS-ID: $Id$ +// RCS-ID: $Id: utils.h 62544 2009-11-03 14:11:30Z VZ $ // Copyright: (c) 1998 Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifndef _WX_UTILS_H_ -#define _WX_UTILS_H_ +#ifndef _WX_UTILSH__ +#define _WX_UTILSH__ // ---------------------------------------------------------------------------- // headers @@ -19,13 +19,8 @@ #include "wx/object.h" #include "wx/list.h" #include "wx/filefn.h" -#include "wx/hashmap.h" -#include "wx/versioninfo.h" -#include "wx/meta/implicitconversion.h" - #if wxUSE_GUI #include "wx/gdicmn.h" - #include "wx/mousestate.h" #endif class WXDLLIMPEXP_FWD_BASE wxArrayString; @@ -35,7 +30,7 @@ class WXDLLIMPEXP_FWD_BASE wxArrayInt; // wxLongLong #include "wx/longlong.h" -// needed for wxOperatingSystemId, wxLinuxDistributionInfo +// need for wxOperatingSystemId #include "wx/platinfo.h" #ifdef __WATCOMC__ @@ -55,50 +50,14 @@ class WXDLLIMPEXP_FWD_BASE wxProcess; class WXDLLIMPEXP_FWD_CORE wxFrame; class WXDLLIMPEXP_FWD_CORE wxWindow; class WXDLLIMPEXP_FWD_CORE wxWindowList; -class WXDLLIMPEXP_FWD_CORE wxEventLoop; // ---------------------------------------------------------------------------- -// Arithmetic functions +// Macros // ---------------------------------------------------------------------------- -template -inline typename wxImplicitConversionType::value -wxMax(T1 a, T2 b) -{ - typedef typename wxImplicitConversionType::value ResultType; - - // Cast both operands to the same type before comparing them to avoid - // warnings about signed/unsigned comparisons from some compilers: - return static_cast(a) > static_cast(b) ? a : b; -} - -template -inline typename wxImplicitConversionType::value -wxMin(T1 a, T2 b) -{ - typedef typename wxImplicitConversionType::value ResultType; - - return static_cast(a) < static_cast(b) ? a : b; -} - -template -inline typename wxImplicitConversionType3::value -wxClip(T1 a, T2 b, T3 c) -{ - typedef typename wxImplicitConversionType3::value ResultType; - - if ( static_cast(a) < static_cast(b) ) - return b; - - if ( static_cast(a) > static_cast(c) ) - return c; - - return a; -} - -// ---------------------------------------------------------------------------- -// wxMemorySize -// ---------------------------------------------------------------------------- +#define wxMax(a,b) (((a) > (b)) ? (a) : (b)) +#define wxMin(a,b) (((a) < (b)) ? (a) : (b)) +#define wxClip(a,b,c) (((a) < (b)) ? (b) : (((a) > (c)) ? (c) : (a))) // wxGetFreeMemory can return huge amount of memory on 32-bit platforms as well // so to always use long long for its result type on all platforms which @@ -113,38 +72,32 @@ wxClip(T1 a, T2 b, T3 c) // String functions (deprecated, use wxString) // ---------------------------------------------------------------------------- -#if WXWIN_COMPATIBILITY_2_8 +// Make a copy of this string using 'new' +#if WXWIN_COMPATIBILITY_2_4 +wxDEPRECATED( WXDLLIMPEXP_BASE wxChar* copystring(const wxChar *s) ); +#endif + // A shorter way of using strcmp -wxDEPRECATED_INLINE(inline bool wxStringEq(const char *s1, const char *s2), - return wxCRT_StrcmpA(s1, s2) == 0; ) - -#if wxUSE_UNICODE -wxDEPRECATED_INLINE(inline bool wxStringEq(const wchar_t *s1, const wchar_t *s2), - return wxCRT_StrcmpW(s1, s2) == 0; ) -#endif // wxUSE_UNICODE - -#endif // WXWIN_COMPATIBILITY_2_8 +#define wxStringEq(s1, s2) (s1 && s2 && (wxStrcmp(s1, s2) == 0)) // ---------------------------------------------------------------------------- // Miscellaneous functions // ---------------------------------------------------------------------------- // Sound the bell +#if !defined __EMX__ && \ + (defined __WXMOTIF__ || defined __WXGTK__ || defined __WXX11__) WXDLLIMPEXP_CORE void wxBell(); - -#if wxUSE_MSGDLG -// Show wxWidgets information -WXDLLIMPEXP_CORE void wxInfoMessageBox(wxWindow* parent); -#endif // wxUSE_MSGDLG - -WXDLLIMPEXP_CORE wxVersionInfo wxGetLibraryVersionInfo(); +#else +WXDLLIMPEXP_BASE void wxBell(); +#endif // Get OS description as a user-readable string WXDLLIMPEXP_BASE wxString wxGetOsDescription(); // Get OS version -WXDLLIMPEXP_BASE wxOperatingSystemId wxGetOsVersion(int *majorVsn = NULL, - int *minorVsn = NULL); +WXDLLIMPEXP_BASE wxOperatingSystemId wxGetOsVersion(int *majorVsn = (int *) NULL, + int *minorVsn = (int *) NULL); // Get platform endianness WXDLLIMPEXP_BASE bool wxIsPlatformLittleEndian(); @@ -152,11 +105,6 @@ WXDLLIMPEXP_BASE bool wxIsPlatformLittleEndian(); // Get platform architecture WXDLLIMPEXP_BASE bool wxIsPlatform64Bit(); -#ifdef __LINUX__ -// Get linux-distro informations -WXDLLIMPEXP_BASE wxLinuxDistributionInfo wxGetLinuxDistributionInfo(); -#endif - // Return a string with the current date/time WXDLLIMPEXP_BASE wxString wxNow(); @@ -165,27 +113,6 @@ WXDLLIMPEXP_BASE const wxChar *wxGetInstallPrefix(); // Return path to wxWin data (/usr/share/wx/%{version}) (Unices) WXDLLIMPEXP_BASE wxString wxGetDataDir(); -#if wxUSE_GUI - -// Get the state of a key (true if pressed, false if not) -// This is generally most useful getting the state of -// the modifier or toggle keys. -WXDLLIMPEXP_CORE bool wxGetKeyState(wxKeyCode key); - -// Don't synthesize KeyUp events holding down a key and producing -// KeyDown events with autorepeat. On by default and always on -// in wxMSW. -WXDLLIMPEXP_CORE bool wxSetDetectableAutoRepeat( bool flag ); - -// Returns the current state of the mouse position, buttons and modifers -WXDLLIMPEXP_CORE wxMouseState wxGetMouseState(); - -#endif // wxUSE_GUI - -// ---------------------------------------------------------------------------- -// wxPlatform -// ---------------------------------------------------------------------------- - /* * Class to make it easier to specify platform-dependent values * @@ -209,7 +136,7 @@ class WXDLLIMPEXP_BASE wxPlatform public: wxPlatform() { Init(); } wxPlatform(const wxPlatform& platform) { Copy(platform); } - void operator = (const wxPlatform& platform) { if (&platform != this) Copy(platform); } + void operator = (const wxPlatform& platform) { Copy(platform); } void Copy(const wxPlatform& platform); // Specify an optional default value @@ -249,7 +176,8 @@ public: operator int() const { return (int) GetInteger(); } operator long() const { return GetInteger(); } operator double() const { return GetDouble(); } - operator const wxString&() const { return GetString(); } + operator const wxString() const { return GetString(); } + operator const wxChar*() const { return (const wxChar*) GetString(); } static void AddPlatform(int platform); static bool Is(int platform); @@ -268,48 +196,130 @@ private: /// Function for testing current platform inline bool wxPlatformIs(int platform) { return wxPlatform::Is(platform); } +#if wxUSE_GUI + +// Get the state of a key (true if pressed, false if not) +// This is generally most useful getting the state of +// the modifier or toggle keys. +WXDLLEXPORT bool wxGetKeyState(wxKeyCode key); + + +// Don't synthesize KeyUp events holding down a key and producing +// KeyDown events with autorepeat. On by default and always on +// in wxMSW. +WXDLLEXPORT bool wxSetDetectableAutoRepeat( bool flag ); + + +// wxMouseState is used to hold information about button and modifier state +// and is what is returned from wxGetMouseState. +class WXDLLEXPORT wxMouseState +{ +public: + wxMouseState() + : m_x(0), m_y(0), + m_leftDown(false), m_middleDown(false), m_rightDown(false), + m_controlDown(false), m_shiftDown(false), m_altDown(false), + m_metaDown(false) + {} + + wxCoord GetX() { return m_x; } + wxCoord GetY() { return m_y; } + + bool LeftDown() { return m_leftDown; } + bool MiddleDown() { return m_middleDown; } + bool RightDown() { return m_rightDown; } + +#if wxABI_VERSION >= 20811 + bool LeftIsDown() { return m_leftDown; } + bool MiddleIsDown() { return m_middleDown; } + bool RightIsDown() { return m_rightDown; } +#endif // wx >= 2.8.11 + + bool ControlDown() { return m_controlDown; } + bool ShiftDown() { return m_shiftDown; } + bool AltDown() { return m_altDown; } + bool MetaDown() { return m_metaDown; } + bool CmdDown() + { +#if defined(__WXMAC__) || defined(__WXCOCOA__) + return MetaDown(); +#else + return ControlDown(); +#endif + } + + void SetX(wxCoord x) { m_x = x; } + void SetY(wxCoord y) { m_y = y; } + + void SetLeftDown(bool down) { m_leftDown = down; } + void SetMiddleDown(bool down) { m_middleDown = down; } + void SetRightDown(bool down) { m_rightDown = down; } + + void SetControlDown(bool down) { m_controlDown = down; } + void SetShiftDown(bool down) { m_shiftDown = down; } + void SetAltDown(bool down) { m_altDown = down; } + void SetMetaDown(bool down) { m_metaDown = down; } + +private: + wxCoord m_x; + wxCoord m_y; + + bool m_leftDown : 1; + bool m_middleDown : 1; + bool m_rightDown : 1; + + bool m_controlDown : 1; + bool m_shiftDown : 1; + bool m_altDown : 1; + bool m_metaDown : 1; +}; + + +// Returns the current state of the mouse position, buttons and modifers +WXDLLEXPORT wxMouseState wxGetMouseState(); + + // ---------------------------------------------------------------------------- // Window ID management // ---------------------------------------------------------------------------- +// Generate a unique ID +WXDLLEXPORT long wxNewId(); + // Ensure subsequent IDs don't clash with this one -WXDLLIMPEXP_BASE void wxRegisterId(long id); +WXDLLEXPORT void wxRegisterId(long id); // Return the current ID -WXDLLIMPEXP_BASE long wxGetCurrentId(); +WXDLLEXPORT long wxGetCurrentId(); -// Generate a unique ID -WXDLLIMPEXP_BASE long wxNewId(); +#endif // wxUSE_GUI // ---------------------------------------------------------------------------- // Various conversions // ---------------------------------------------------------------------------- +// these functions are deprecated, use wxString methods instead! +#if WXWIN_COMPATIBILITY_2_4 + +extern WXDLLIMPEXP_DATA_BASE(const wxChar*) wxFloatToStringStr; +extern WXDLLIMPEXP_DATA_BASE(const wxChar*) wxDoubleToStringStr; + +wxDEPRECATED( WXDLLIMPEXP_BASE void StringToFloat(const wxChar *s, float *number) ); +wxDEPRECATED( WXDLLIMPEXP_BASE wxChar* FloatToString(float number, const wxChar *fmt = wxFloatToStringStr) ); +wxDEPRECATED( WXDLLIMPEXP_BASE void StringToDouble(const wxChar *s, double *number) ); +wxDEPRECATED( WXDLLIMPEXP_BASE wxChar* DoubleToString(double number, const wxChar *fmt = wxDoubleToStringStr) ); +wxDEPRECATED( WXDLLIMPEXP_BASE void StringToInt(const wxChar *s, int *number) ); +wxDEPRECATED( WXDLLIMPEXP_BASE void StringToLong(const wxChar *s, long *number) ); +wxDEPRECATED( WXDLLIMPEXP_BASE wxChar* IntToString(int number) ); +wxDEPRECATED( WXDLLIMPEXP_BASE wxChar* LongToString(long number) ); + +#endif // WXWIN_COMPATIBILITY_2_4 + // Convert 2-digit hex number to decimal WXDLLIMPEXP_BASE int wxHexToDec(const wxString& buf); -// Convert 2-digit hex number to decimal -inline int wxHexToDec(const char* buf) -{ - int firstDigit, secondDigit; - - if (buf[0] >= 'A') - firstDigit = buf[0] - 'A' + 10; - else - firstDigit = buf[0] - '0'; - - if (buf[1] >= 'A') - secondDigit = buf[1] - 'A' + 10; - else - secondDigit = buf[1] - '0'; - - return (firstDigit & 0xF) * 16 + (secondDigit & 0xF ); -} - - // Convert decimal integer to 2-character hex string WXDLLIMPEXP_BASE void wxDecToHex(int dec, wxChar *buf); -WXDLLIMPEXP_BASE void wxDecToHex(int dec, char* ch1, char* ch2); WXDLLIMPEXP_BASE wxString wxDecToHex(int dec); // ---------------------------------------------------------------------------- @@ -329,46 +339,16 @@ enum // under Windows, don't hide the child even if it's IO is redirected (this // is done by default) - wxEXEC_SHOW_CONSOLE = 2, - - // deprecated synonym for wxEXEC_SHOW_CONSOLE, use the new name as it's - // more clear - wxEXEC_NOHIDE = wxEXEC_SHOW_CONSOLE, + wxEXEC_NOHIDE = 2, // under Unix, if the process is the group leader then passing wxKILL_CHILDREN to wxKill // kills all children as well as pid - // under Windows (NT family only), sets the CREATE_NEW_PROCESS_GROUP flag, - // which allows to target Ctrl-Break signal to the spawned process. - // applies to console processes only. wxEXEC_MAKE_GROUP_LEADER = 4, // by default synchronous execution disables all program windows to avoid // that the user interacts with the program while the child process is // running, you can use this flag to prevent this from happening - wxEXEC_NODISABLE = 8, - - // by default, the event loop is run while waiting for synchronous execution - // to complete and this flag can be used to simply block the main process - // until the child process finishes - wxEXEC_NOEVENTS = 16, - - // under Windows, hide the console of the child process if it has one, even - // if its IO is not redirected - wxEXEC_HIDE_CONSOLE = 32, - - // convenient synonym for flags given system()-like behaviour - wxEXEC_BLOCK = wxEXEC_SYNC | wxEXEC_NOEVENTS -}; - -// Map storing environment variables. -typedef wxStringToStringHashMap wxEnvVariableHashMap; - -// Used to pass additional parameters for child process to wxExecute(). Could -// be extended with other fields later. -struct wxExecuteEnv -{ - wxString cwd; // If empty, CWD is not changed. - wxEnvVariableHashMap env; // If empty, environment is unchanged. + wxEXEC_NODISABLE = 8 }; // Execute another program. @@ -376,41 +356,29 @@ struct wxExecuteEnv // If flags contain wxEXEC_SYNC, return -1 on failure and the exit code of the // process if everything was ok. Otherwise (i.e. if wxEXEC_ASYNC), return 0 on // failure and the PID of the launched process if ok. -WXDLLIMPEXP_BASE long wxExecute(const wxString& command, - int flags = wxEXEC_ASYNC, - wxProcess *process = NULL, - const wxExecuteEnv *env = NULL); -WXDLLIMPEXP_BASE long wxExecute(char **argv, - int flags = wxEXEC_ASYNC, - wxProcess *process = NULL, - const wxExecuteEnv *env = NULL); -#if wxUSE_UNICODE -WXDLLIMPEXP_BASE long wxExecute(wchar_t **argv, - int flags = wxEXEC_ASYNC, - wxProcess *process = NULL, - const wxExecuteEnv *env = NULL); -#endif // wxUSE_UNICODE +WXDLLIMPEXP_BASE long wxExecute(wxChar **argv, int flags = wxEXEC_ASYNC, + wxProcess *process = (wxProcess *) NULL); +WXDLLIMPEXP_BASE long wxExecute(const wxString& command, int flags = wxEXEC_ASYNC, + wxProcess *process = (wxProcess *) NULL); // execute the command capturing its output into an array line by line, this is // always synchronous WXDLLIMPEXP_BASE long wxExecute(const wxString& command, wxArrayString& output, - int flags = 0, - const wxExecuteEnv *env = NULL); + int flags = 0); // also capture stderr (also synchronous) WXDLLIMPEXP_BASE long wxExecute(const wxString& command, wxArrayString& output, wxArrayString& error, - int flags = 0, - const wxExecuteEnv *env = NULL); + int flags = 0); -#if defined(__WINDOWS__) && wxUSE_IPC +#if defined(__WXMSW__) && wxUSE_IPC // ask a DDE server to execute the DDE request with given parameters WXDLLIMPEXP_BASE bool wxExecuteDDE(const wxString& ddeServer, const wxString& ddeTopic, const wxString& ddeCommand); -#endif // __WINDOWS__ && wxUSE_IPC +#endif // __WXMSW__ && wxUSE_IPC enum wxSignal { @@ -452,14 +420,12 @@ enum wxKillFlags enum wxShutdownFlags { - wxSHUTDOWN_FORCE = 1,// can be combined with other flags (MSW-only) - wxSHUTDOWN_POWEROFF = 2,// power off the computer - wxSHUTDOWN_REBOOT = 4,// shutdown and reboot - wxSHUTDOWN_LOGOFF = 8 // close session (currently MSW-only) + wxSHUTDOWN_POWEROFF, // power off the computer + wxSHUTDOWN_REBOOT // shutdown and reboot }; // Shutdown or reboot the PC -WXDLLIMPEXP_BASE bool wxShutdown(int flags = wxSHUTDOWN_POWEROFF); +WXDLLIMPEXP_BASE bool wxShutdown(wxShutdownFlags wFlags); // send the given signal to the process (only NONE and KILL are supported under // Windows, all others mean TERM), return 0 if ok and -1 on error @@ -487,10 +453,8 @@ WXDLLIMPEXP_BASE void wxMilliSleep(unsigned long milliseconds); // Sleep for a given amount of microseconds WXDLLIMPEXP_BASE void wxMicroSleep(unsigned long microseconds); -#if WXWIN_COMPATIBILITY_2_8 // Sleep for a given amount of milliseconds (old, bad name), use wxMilliSleep wxDEPRECATED( WXDLLIMPEXP_BASE void wxUsleep(unsigned long milliseconds) ); -#endif // Get the process id of the current process WXDLLIMPEXP_BASE unsigned long wxGetProcessId(); @@ -505,6 +469,15 @@ WXDLLIMPEXP_BASE bool wxHandleFatalExceptions(bool doit = true); #endif // wxUSE_ON_FATAL_EXCEPTION +// flags for wxLaunchDefaultBrowser +enum +{ + wxBROWSER_NEW_WINDOW = 1 +}; + +// Launch url in the user's default internet browser +WXDLLIMPEXP_BASE bool wxLaunchDefaultBrowser(const wxString& url, int flags = 0); + // ---------------------------------------------------------------------------- // Environment variables // ---------------------------------------------------------------------------- @@ -514,37 +487,10 @@ WXDLLIMPEXP_BASE bool wxHandleFatalExceptions(bool doit = true); WXDLLIMPEXP_BASE bool wxGetEnv(const wxString& var, wxString *value); // set the env var name to the given value, return true on success -WXDLLIMPEXP_BASE bool wxSetEnv(const wxString& var, const wxString& value); +WXDLLIMPEXP_BASE bool wxSetEnv(const wxString& var, const wxChar *value); // remove the env var from environment -WXDLLIMPEXP_BASE bool wxUnsetEnv(const wxString& var); - -#if WXWIN_COMPATIBILITY_2_8 -inline bool wxSetEnv(const wxString& var, const char *value) - { return wxSetEnv(var, wxString(value)); } -inline bool wxSetEnv(const wxString& var, const wchar_t *value) - { return wxSetEnv(var, wxString(value)); } -template -inline bool wxSetEnv(const wxString& var, const wxScopedCharTypeBuffer& value) - { return wxSetEnv(var, wxString(value)); } -inline bool wxSetEnv(const wxString& var, const wxCStrData& value) - { return wxSetEnv(var, wxString(value)); } - -// this one is for passing NULL directly - don't use it, use wxUnsetEnv instead -wxDEPRECATED( inline bool wxSetEnv(const wxString& var, int value) ); -inline bool wxSetEnv(const wxString& var, int value) -{ - wxASSERT_MSG( value == 0, "using non-NULL integer as string?" ); - - wxUnusedVar(value); // fix unused parameter warning in release build - - return wxUnsetEnv(var); -} -#endif // WXWIN_COMPATIBILITY_2_8 - -// Retrieve the complete environment by filling specified map. -// Returns true on success or false if an error occurred. -WXDLLIMPEXP_BASE bool wxGetEnvMap(wxEnvVariableHashMap *map); +inline bool wxUnsetEnv(const wxString& var) { return wxSetEnv(var, NULL); } // ---------------------------------------------------------------------------- // Network and username functions. @@ -576,10 +522,13 @@ WXDLLIMPEXP_BASE wxString wxGetUserName(); WXDLLIMPEXP_BASE wxString wxGetHomeDir(); WXDLLIMPEXP_BASE const wxChar* wxGetHomeDir(wxString *pstr); -// Get the user's (by default use the current user name) home dir, -// return empty string on error -WXDLLIMPEXP_BASE wxString wxGetUserHome(const wxString& user = wxEmptyString); - +// Get the user's home dir (caller must copy --- volatile) +// returns NULL is no HOME dir is known +#if defined(__UNIX__) && wxUSE_UNICODE && !defined(__WINE__) +WXDLLIMPEXP_BASE const wxMB2WXbuf wxGetUserHome(const wxString& user = wxEmptyString); +#else +WXDLLIMPEXP_BASE wxChar* wxGetUserHome(const wxString& user = wxEmptyString); +#endif #if wxUSE_LONGLONG typedef wxLongLong wxDiskspaceSize_t; @@ -592,37 +541,8 @@ WXDLLIMPEXP_BASE bool wxGetDiskSpace(const wxString& path, wxDiskspaceSize_t *pTotal = NULL, wxDiskspaceSize_t *pFree = NULL); - - -typedef int (*wxSortCallback)(const void* pItem1, - const void* pItem2, - const void* user_data); - - -WXDLLIMPEXP_BASE void wxQsort(void* pbase, size_t total_elems, - size_t size, wxSortCallback cmp, - const void* user_data); - - #if wxUSE_GUI // GUI only things from now on -// ---------------------------------------------------------------------------- -// Launch default browser -// ---------------------------------------------------------------------------- - -// flags for wxLaunchDefaultBrowser -enum -{ - wxBROWSER_NEW_WINDOW = 0x01, - wxBROWSER_NOBUSYCURSOR = 0x02 -}; - -// Launch url in the user's default internet browser -WXDLLIMPEXP_CORE bool wxLaunchDefaultBrowser(const wxString& url, int flags = 0); - -// Launch document in the user's default application -WXDLLIMPEXP_CORE bool wxLaunchDefaultApplication(const wxString& path, int flags = 0); - // ---------------------------------------------------------------------------- // Menu accelerators related things // ---------------------------------------------------------------------------- @@ -641,13 +561,13 @@ enum }; // strip mnemonics and/or accelerators from the label -WXDLLIMPEXP_CORE wxString +WXDLLEXPORT wxString wxStripMenuCodes(const wxString& str, int flags = wxStrip_All); #if WXWIN_COMPATIBILITY_2_6 // obsolete and deprecated version, do not use, use the above overload instead wxDEPRECATED( - WXDLLIMPEXP_CORE wxChar* wxStripMenuCodes(const wxChar *in, wxChar *out = NULL) + WXDLLEXPORT wxChar* wxStripMenuCodes(const wxChar *in, wxChar *out = NULL) ); #if wxUSE_ACCEL @@ -655,7 +575,7 @@ class WXDLLIMPEXP_FWD_CORE wxAcceleratorEntry; // use wxAcceleratorEntry::Create() or FromString() methods instead wxDEPRECATED( - WXDLLIMPEXP_CORE wxAcceleratorEntry *wxGetAccelFromString(const wxString& label) + WXDLLEXPORT wxAcceleratorEntry *wxGetAccelFromString(const wxString& label) ); #endif // wxUSE_ACCEL @@ -666,68 +586,54 @@ wxDEPRECATED( // ---------------------------------------------------------------------------- // Returns menu item id or wxNOT_FOUND if none. -WXDLLIMPEXP_CORE int wxFindMenuItemId(wxFrame *frame, const wxString& menuString, const wxString& itemString); +WXDLLEXPORT int wxFindMenuItemId(wxFrame *frame, const wxString& menuString, const wxString& itemString); // Find the wxWindow at the given point. wxGenericFindWindowAtPoint // is always present but may be less reliable than a native version. -WXDLLIMPEXP_CORE wxWindow* wxGenericFindWindowAtPoint(const wxPoint& pt); -WXDLLIMPEXP_CORE wxWindow* wxFindWindowAtPoint(const wxPoint& pt); +WXDLLEXPORT wxWindow* wxGenericFindWindowAtPoint(const wxPoint& pt); +WXDLLEXPORT wxWindow* wxFindWindowAtPoint(const wxPoint& pt); // NB: this function is obsolete, use wxWindow::FindWindowByLabel() instead // // Find the window/widget with the given title or label. // Pass a parent to begin the search from, or NULL to look through // all windows. -WXDLLIMPEXP_CORE wxWindow* wxFindWindowByLabel(const wxString& title, wxWindow *parent = NULL); +WXDLLEXPORT wxWindow* wxFindWindowByLabel(const wxString& title, wxWindow *parent = (wxWindow *) NULL); // NB: this function is obsolete, use wxWindow::FindWindowByName() instead // // Find window by name, and if that fails, by label. -WXDLLIMPEXP_CORE wxWindow* wxFindWindowByName(const wxString& name, wxWindow *parent = NULL); +WXDLLEXPORT wxWindow* wxFindWindowByName(const wxString& name, wxWindow *parent = (wxWindow *) NULL); // ---------------------------------------------------------------------------- // Message/event queue helpers // ---------------------------------------------------------------------------- // Yield to other apps/messages and disable user input -WXDLLIMPEXP_CORE bool wxSafeYield(wxWindow *win = NULL, bool onlyIfNeeded = false); +WXDLLEXPORT bool wxSafeYield(wxWindow *win = NULL, bool onlyIfNeeded = false); // Enable or disable input to all top level windows -WXDLLIMPEXP_CORE void wxEnableTopLevelWindows(bool enable = true); +WXDLLEXPORT void wxEnableTopLevelWindows(bool enable = true); // Check whether this window wants to process messages, e.g. Stop button // in long calculations. -WXDLLIMPEXP_CORE bool wxCheckForInterrupt(wxWindow *wnd); +WXDLLEXPORT bool wxCheckForInterrupt(wxWindow *wnd); // Consume all events until no more left -WXDLLIMPEXP_CORE void wxFlushEvents(); +WXDLLEXPORT void wxFlushEvents(); -// a class which disables all windows (except, may be, the given one) in its +// a class which disables all windows (except, may be, thegiven one) in its // ctor and enables them back in its dtor -class WXDLLIMPEXP_CORE wxWindowDisabler +class WXDLLEXPORT wxWindowDisabler { public: - // this ctor conditionally disables all windows: if the argument is false, - // it doesn't do anything - wxWindowDisabler(bool disable = true); - - // ctor disables all windows except winToSkip - wxWindowDisabler(wxWindow *winToSkip); - - // dtor enables back all windows disabled by the ctor + wxWindowDisabler(wxWindow *winToSkip = (wxWindow *)NULL); ~wxWindowDisabler(); private: - // disable all windows except the given one (used by both ctors) - void DoDisable(wxWindow *winToSkip = NULL); - -#if defined(__WXOSX__) && wxOSX_USE_COCOA - wxEventLoop* m_modalEventLoop; -#endif wxWindowList *m_winDisabled; - bool m_disabled; - wxDECLARE_NO_COPY_CLASS(wxWindowDisabler); + DECLARE_NO_COPY_CLASS(wxWindowDisabler) }; // ---------------------------------------------------------------------------- @@ -738,13 +644,13 @@ private: WXDLLIMPEXP_CORE void wxBeginBusyCursor(const wxCursor *cursor = wxHOURGLASS_CURSOR); // Restore cursor to normal -WXDLLIMPEXP_CORE void wxEndBusyCursor(); +WXDLLEXPORT void wxEndBusyCursor(); // true if we're between the above two calls -WXDLLIMPEXP_CORE bool wxIsBusy(); +WXDLLEXPORT bool wxIsBusy(); // Convenience class so we can just create a wxBusyCursor object on the stack -class WXDLLIMPEXP_CORE wxBusyCursor +class WXDLLEXPORT wxBusyCursor { public: wxBusyCursor(const wxCursor* cursor = wxHOURGLASS_CURSOR) @@ -761,16 +667,38 @@ public: static const wxCursor GetBusyCursor(); }; -void WXDLLIMPEXP_CORE wxGetMousePosition( int* x, int* y ); // ---------------------------------------------------------------------------- -// X11 Display access +// Reading and writing resources (eg WIN.INI, .Xdefaults) // ---------------------------------------------------------------------------- -#if defined(__X__) || defined(__WXGTK__) +#if wxUSE_RESOURCES +WXDLLEXPORT bool wxWriteResource(const wxString& section, const wxString& entry, const wxString& value, const wxString& file = wxEmptyString); +WXDLLEXPORT bool wxWriteResource(const wxString& section, const wxString& entry, float value, const wxString& file = wxEmptyString); +WXDLLEXPORT bool wxWriteResource(const wxString& section, const wxString& entry, long value, const wxString& file = wxEmptyString); +WXDLLEXPORT bool wxWriteResource(const wxString& section, const wxString& entry, int value, const wxString& file = wxEmptyString); + +WXDLLEXPORT bool wxGetResource(const wxString& section, const wxString& entry, wxChar **value, const wxString& file = wxEmptyString); +WXDLLEXPORT bool wxGetResource(const wxString& section, const wxString& entry, float *value, const wxString& file = wxEmptyString); +WXDLLEXPORT bool wxGetResource(const wxString& section, const wxString& entry, long *value, const wxString& file = wxEmptyString); +WXDLLEXPORT bool wxGetResource(const wxString& section, const wxString& entry, int *value, const wxString& file = wxEmptyString); +#endif // wxUSE_RESOURCES + +void WXDLLEXPORT wxGetMousePosition( int* x, int* y ); + +// MSW only: get user-defined resource from the .res file. +// Returns NULL or newly-allocated memory, so use delete[] to clean up. +#ifdef __WXMSW__ + extern WXDLLEXPORT const wxChar* wxUserResourceStr; + WXDLLEXPORT wxChar* wxLoadUserResource(const wxString& resourceName, const wxString& resourceType = wxUserResourceStr); +#endif // MSW + +// ---------------------------------------------------------------------------- +// Display and colorss (X only) +// ---------------------------------------------------------------------------- #ifdef __WXGTK__ - WXDLLIMPEXP_CORE void *wxGetDisplay(); + void *wxGetDisplay(); #endif #ifdef __X__ @@ -779,13 +707,18 @@ void WXDLLIMPEXP_CORE wxGetMousePosition( int* x, int* y ); WXDLLIMPEXP_CORE wxString wxGetDisplayName(); #endif // X or GTK+ -// use this function instead of the functions above in implementation code -inline struct _XDisplay *wxGetX11Display() -{ - return (_XDisplay *)wxGetDisplay(); -} +#ifdef __X__ -#endif // X11 || wxGTK +#ifdef __VMS__ // Xlib.h for VMS is not (yet) compatible with C++ + // The resulting warnings are switched off here +#pragma message disable nosimpint +#endif +// #include +#ifdef __VMS__ +#pragma message enable nosimpint +#endif + +#endif //__X__ #endif // wxUSE_GUI @@ -799,46 +732,16 @@ inline struct _XDisplay *wxGetX11Display() #define wx_YIELD_DECLARED // Yield to other apps/messages -WXDLLIMPEXP_CORE bool wxYield(); +WXDLLIMPEXP_BASE bool wxYield(); #endif // wx_YIELD_DECLARED // Like wxYield, but fails silently if the yield is recursive. -WXDLLIMPEXP_CORE bool wxYieldIfNeeded(); +WXDLLIMPEXP_BASE bool wxYieldIfNeeded(); // ---------------------------------------------------------------------------- -// Windows resources access +// Error message functions used by wxWidgets (deprecated, use wxLog) // ---------------------------------------------------------------------------- -// Windows only: get user-defined resource from the .res file. -#ifdef __WINDOWS__ - // default resource type for wxLoadUserResource() - extern WXDLLIMPEXP_DATA_BASE(const wxChar*) wxUserResourceStr; - - // Return the pointer to the resource data. This pointer is read-only, use - // the overload below if you need to modify the data. - // - // Returns true on success, false on failure. Doesn't log an error message - // if the resource is not found (because this could be expected) but does - // log one if any other error occurs. - WXDLLIMPEXP_BASE bool - wxLoadUserResource(const void **outData, - size_t *outLen, - const wxString& resourceName, - const wxString& resourceType = wxUserResourceStr, - WXHINSTANCE module = 0); - - // This function allocates a new buffer and makes a copy of the resource - // data, remember to delete[] the buffer. And avoid using it entirely if - // the overload above can be used. - // - // Returns NULL on failure. - WXDLLIMPEXP_BASE char* - wxLoadUserResource(const wxString& resourceName, - const wxString& resourceType = wxUserResourceStr, - int* pLen = NULL, - WXHINSTANCE module = 0); -#endif // __WINDOWS__ - #endif // _WX_UTILSH__ diff --git a/Source/3rd Party/wx/include/wx/valgen.h b/Source/3rd Party/wx/include/wx/valgen.h index ac6c93942..fd39c7e7d 100644 --- a/Source/3rd Party/wx/include/wx/valgen.h +++ b/Source/3rd Party/wx/include/wx/valgen.h @@ -1,9 +1,10 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/valgen.h +// Name: valgen.h // Purpose: wxGenericValidator class // Author: Kevin Smith +// Modified by: // Created: Jan 22 1999 -// RCS-ID: $Id$ +// RCS-ID: // Copyright: (c) 1999 Julian Smart (assigned from Kevin) // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -15,81 +16,54 @@ #if wxUSE_VALIDATORS -class WXDLLIMPEXP_FWD_BASE wxDateTime; -class WXDLLIMPEXP_FWD_BASE wxFileName; - -// ---------------------------------------------------------------------------- -// wxGenericValidator performs data transfer between many standard controls and -// variables of the type corresponding to their values. -// -// It doesn't do any validation so its name is a slight misnomer. -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxGenericValidator: public wxValidator +class WXDLLEXPORT wxGenericValidator: public wxValidator { +DECLARE_CLASS(wxGenericValidator) public: - // Different constructors: each of them creates a validator which can only - // be used with some controls, the comments before each constructor - // indicate which ones: - // wxCheckBox, wxRadioButton, wx(Bitmap)ToggleButton - wxGenericValidator(bool* val); - // wxChoice, wxGauge, wxRadioBox, wxScrollBar, wxSlider, wxSpinButton - wxGenericValidator(int* val); - // wxComboBox, wxTextCtrl, wxButton, wxStaticText (read-only) - wxGenericValidator(wxString* val); - // wxListBox, wxCheckListBox - wxGenericValidator(wxArrayInt* val); -#if wxUSE_DATETIME - // wxDatePickerCtrl - wxGenericValidator(wxDateTime* val); -#endif // wxUSE_DATETIME - // wxTextCtrl - wxGenericValidator(wxFileName* val); - // wxTextCtrl - wxGenericValidator(float* val); - // wxTextCtrl - wxGenericValidator(double* val); + wxGenericValidator(bool* val); + wxGenericValidator(int* val); + wxGenericValidator(wxString* val); + wxGenericValidator(wxArrayInt* val); + wxGenericValidator(const wxGenericValidator& copyFrom); - wxGenericValidator(const wxGenericValidator& copyFrom); + virtual ~wxGenericValidator(){} - virtual ~wxGenericValidator(){} + // Make a clone of this validator (or return NULL) - currently necessary + // if you're passing a reference to a validator. + // Another possibility is to always pass a pointer to a new validator + // (so the calling code can use a copy constructor of the relevant class). + virtual wxObject *Clone() const { return new wxGenericValidator(*this); } + bool Copy(const wxGenericValidator& val); - // Make a clone of this validator (or return NULL) - currently necessary - // if you're passing a reference to a validator. - // Another possibility is to always pass a pointer to a new validator - // (so the calling code can use a copy constructor of the relevant class). - virtual wxObject *Clone() const { return new wxGenericValidator(*this); } - bool Copy(const wxGenericValidator& val); + // Called when the value in the window must be validated. + // This function can pop up an error message. + virtual bool Validate(wxWindow * WXUNUSED(parent)) { return true; } - // Called when the value in the window must be validated: this is not used - // by this class - virtual bool Validate(wxWindow * WXUNUSED(parent)) { return true; } + // Called to transfer data to the window + virtual bool TransferToWindow(); - // Called to transfer data to the window - virtual bool TransferToWindow(); - - // Called to transfer data to the window - virtual bool TransferFromWindow(); + // Called to transfer data to the window + virtual bool TransferFromWindow(); protected: - void Initialize(); + void Initialize(); - bool* m_pBool; - int* m_pInt; - wxString* m_pString; - wxArrayInt* m_pArrayInt; -#if wxUSE_DATETIME - wxDateTime* m_pDateTime; -#endif // wxUSE_DATETIME - wxFileName* m_pFileName; - float* m_pFloat; - double* m_pDouble; + bool* m_pBool; + int* m_pInt; + wxString* m_pString; + wxArrayInt* m_pArrayInt; private: - DECLARE_CLASS(wxGenericValidator) - wxDECLARE_NO_ASSIGN_CLASS(wxGenericValidator); +// Cannot use +// DECLARE_NO_COPY_CLASS(wxGenericValidator) +// because copy constructor is explicitly declared above; +// but no copy assignment operator is defined, so declare +// it private to prevent the compiler from defining it: + wxGenericValidator& operator=(const wxGenericValidator&); }; -#endif // wxUSE_VALIDATORS +#endif + // wxUSE_VALIDATORS -#endif // _WX_VALGENH__ +#endif + // _WX_VALGENH__ diff --git a/Source/3rd Party/wx/include/wx/validate.h b/Source/3rd Party/wx/include/wx/validate.h index 1dcca1966..ea8c80897 100644 --- a/Source/3rd Party/wx/include/wx/validate.h +++ b/Source/3rd Party/wx/include/wx/validate.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 29/01/98 -// RCS-ID: $Id$ +// RCS-ID: $Id: validate.h 53135 2008-04-12 02:31:04Z VZ $ // Copyright: (c) 1998 Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -33,7 +33,7 @@ class WXDLLIMPEXP_FWD_CORE wxWindowBase; Note that wxValidator and derived classes use reference counting. */ -class WXDLLIMPEXP_CORE wxValidator : public wxEvtHandler +class WXDLLEXPORT wxValidator : public wxEvtHandler { public: wxValidator(); @@ -44,7 +44,7 @@ public: // Another possibility is to always pass a pointer to a new validator // (so the calling code can use a copy constructor of the relevant class). virtual wxObject *Clone() const - { return NULL; } + { return (wxValidator *)NULL; } bool Copy(const wxValidator& val) { m_validatorWindow = val.m_validatorWindow; return true; } @@ -62,23 +62,10 @@ public: wxWindow *GetWindow() const { return (wxWindow *)m_validatorWindow; } void SetWindow(wxWindowBase *win) { m_validatorWindow = win; } - // validators beep by default if invalid key is pressed, this function - // allows to change this - static void SuppressBellOnError(bool suppress = true) - { ms_isSilent = suppress; } - - // test if beep is currently disabled + // validators beep by default if invalid key is pressed, these functions + // allow to change it static bool IsSilent() { return ms_isSilent; } - - // this function is deprecated because it handled its parameter - // unnaturally: it disabled the bell when it was true, not false as could - // be expected; use SuppressBellOnError() instead -#if WXWIN_COMPATIBILITY_2_8 - static wxDEPRECATED_INLINE( - void SetBellOnError(bool doIt = true), - ms_isSilent = doIt; - ) -#endif + static void SetBellOnError(bool doIt = true) { ms_isSilent = doIt; } protected: wxWindowBase *m_validatorWindow; @@ -87,10 +74,10 @@ private: static bool ms_isSilent; DECLARE_DYNAMIC_CLASS(wxValidator) - wxDECLARE_NO_COPY_CLASS(wxValidator); + DECLARE_NO_COPY_CLASS(wxValidator) }; -extern WXDLLIMPEXP_DATA_CORE(const wxValidator) wxDefaultValidator; +extern WXDLLEXPORT_DATA(const wxValidator) wxDefaultValidator; #define wxVALIDATOR_PARAM(val) val @@ -99,8 +86,8 @@ extern WXDLLIMPEXP_DATA_CORE(const wxValidator) wxDefaultValidator; // want to be able to pass wxDefaultValidator to the functions which take // a wxValidator parameter to avoid using "#if wxUSE_VALIDATORS" // everywhere - class WXDLLIMPEXP_FWD_CORE wxValidator; - #define wxDefaultValidator (*reinterpret_cast(NULL)) + class WXDLLEXPORT wxValidator; + #define wxDefaultValidator (*((wxValidator *)NULL)) // this macro allows to avoid warnings about unused parameters when // wxUSE_VALIDATORS == 0 diff --git a/Source/3rd Party/wx/include/wx/valnum.h b/Source/3rd Party/wx/include/wx/valnum.h deleted file mode 100644 index 4f7642dbf..000000000 --- a/Source/3rd Party/wx/include/wx/valnum.h +++ /dev/null @@ -1,463 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/valnum.h -// Purpose: Numeric validator classes. -// Author: Vadim Zeitlin based on the submission of Fulvio Senore -// Created: 2010-11-06 -// Copyright: (c) 2010 wxWidgets team -// (c) 2011 Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_VALNUM_H_ -#define _WX_VALNUM_H_ - -#include "wx/defs.h" - -#if wxUSE_VALIDATORS - -#include "wx/validate.h" - -#include - -// Bit masks used for numeric validator styles. -enum wxNumValidatorStyle -{ - wxNUM_VAL_DEFAULT = 0x0, - wxNUM_VAL_THOUSANDS_SEPARATOR = 0x1, - wxNUM_VAL_ZERO_AS_BLANK = 0x2, - wxNUM_VAL_NO_TRAILING_ZEROES = 0x4 -}; - -// ---------------------------------------------------------------------------- -// Base class for all numeric validators. -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxNumValidatorBase : public wxValidator -{ -public: - // Change the validator style. Usually it's specified during construction. - void SetStyle(int style) { m_style = style; } - - - // Override base class method to not do anything but always return success: - // we don't need this as we do our validation on the fly here. - virtual bool Validate(wxWindow * WXUNUSED(parent)) { return true; } - -protected: - wxNumValidatorBase(int style) - { - m_style = style; - } - - wxNumValidatorBase(const wxNumValidatorBase& other) : wxValidator() - { - m_style = other.m_style; - } - - bool HasFlag(wxNumValidatorStyle style) const - { - return (m_style & style) != 0; - } - - // Get the text entry of the associated control. Normally shouldn't ever - // return NULL (and will assert if it does return it) but the caller should - // still test the return value for safety. - wxTextEntry *GetTextEntry() const; - - // Convert wxNUM_VAL_THOUSANDS_SEPARATOR and wxNUM_VAL_NO_TRAILING_ZEROES - // bits of our style to the corresponding wxNumberFormatter::Style values. - int GetFormatFlags() const; - - // Return true if pressing a '-' key is acceptable for the current control - // contents and insertion point. This is meant to be called from the - // derived class IsCharOk() implementation. - bool IsMinusOk(const wxString& val, int pos) const; - - // Return the string which would result from inserting the given character - // at the specified position. - wxString GetValueAfterInsertingChar(wxString val, int pos, wxChar ch) const - { - val.insert(pos, ch); - return val; - } - -private: - // Check whether the specified character can be inserted in the control at - // the given position in the string representing the current controls - // contents. - // - // Notice that the base class checks for '-' itself so it's never passed to - // this function. - virtual bool IsCharOk(const wxString& val, int pos, wxChar ch) const = 0; - - // NormalizeString the contents of the string if it's a valid number, return - // empty string otherwise. - virtual wxString NormalizeString(const wxString& s) const = 0; - - - // Event handlers. - void OnChar(wxKeyEvent& event); - void OnKillFocus(wxFocusEvent& event); - - - // Determine the current insertion point and text in the associated control. - void GetCurrentValueAndInsertionPoint(wxString& val, int& pos) const; - - - // Combination of wxVAL_NUM_XXX values. - int m_style; - - - wxDECLARE_EVENT_TABLE(); - - wxDECLARE_NO_ASSIGN_CLASS(wxNumValidatorBase); -}; - -namespace wxPrivate -{ - -// This is a helper class used by wxIntegerValidator and wxFloatingPointValidator -// below that implements Transfer{To,From}Window() adapted to the type of the -// variable. -// -// The template argument B is the name of the base class which must derive from -// wxNumValidatorBase and define LongestValueType type and {To,As}String() -// methods i.e. basically be one of wx{Integer,Number}ValidatorBase classes. -// -// The template argument T is just the type handled by the validator that will -// inherit from this one. -template -class wxNumValidator : public B -{ -public: - typedef B BaseValidator; - typedef T ValueType; - - typedef typename BaseValidator::LongestValueType LongestValueType; - - // FIXME-VC6: This compiler fails to compile the assert below with a - // nonsensical error C2248: "'LongestValueType' : cannot access protected - // typedef declared in class 'wxIntegerValidatorBase'" so just disable the - // check for it. -#ifndef __VISUALC6__ - wxCOMPILE_TIME_ASSERT - ( - sizeof(ValueType) <= sizeof(LongestValueType), - UnsupportedType - ); -#endif // __VISUALC6__ - - void SetMin(ValueType min) - { - this->DoSetMin(min); - } - - void SetMax(ValueType max) - { - this->DoSetMax(max); - } - - void SetRange(ValueType min, ValueType max) - { - SetMin(min); - SetMax(max); - } - - virtual bool TransferToWindow() - { - if ( m_value ) - { - wxTextEntry * const control = BaseValidator::GetTextEntry(); - if ( !control ) - return false; - - control->SetValue(NormalizeValue(*m_value)); - } - - return true; - } - - virtual bool TransferFromWindow() - { - if ( m_value ) - { - wxTextEntry * const control = BaseValidator::GetTextEntry(); - if ( !control ) - return false; - - const wxString s(control->GetValue()); - LongestValueType value; - if ( s.empty() && BaseValidator::HasFlag(wxNUM_VAL_ZERO_AS_BLANK) ) - value = 0; - else if ( !BaseValidator::FromString(s, &value) ) - return false; - - if ( !this->IsInRange(value) ) - return false; - - *m_value = static_cast(value); - } - - return true; - } - -protected: - wxNumValidator(ValueType *value, int style) - : BaseValidator(style), - m_value(value) - { - } - - // Implement wxNumValidatorBase virtual method which is the same for - // both integer and floating point numbers. - virtual wxString NormalizeString(const wxString& s) const - { - LongestValueType value; - return BaseValidator::FromString(s, &value) ? NormalizeValue(value) - : wxString(); - } - -private: - // Just a helper which is a common part of TransferToWindow() and - // NormalizeString(): returns string representation of a number honouring - // wxNUM_VAL_ZERO_AS_BLANK flag. - wxString NormalizeValue(LongestValueType value) const - { - wxString s; - if ( value != 0 || !BaseValidator::HasFlag(wxNUM_VAL_ZERO_AS_BLANK) ) - s = this->ToString(value); - - return s; - } - - - ValueType * const m_value; - - wxDECLARE_NO_ASSIGN_CLASS(wxNumValidator); -}; - -} // namespace wxPrivate - -// ---------------------------------------------------------------------------- -// Validators for integer numbers. -// ---------------------------------------------------------------------------- - -// Base class for integer numbers validator. This class contains all non -// type-dependent code of wxIntegerValidator<> and always works with values of -// type LongestValueType. It is not meant to be used directly, please use -// wxIntegerValidator<> only instead. -class WXDLLIMPEXP_CORE wxIntegerValidatorBase : public wxNumValidatorBase -{ -protected: - // Define the type we use here, it should be the maximal-sized integer type - // we support to make it possible to base wxIntegerValidator<> for any type - // on it. -#ifdef wxLongLong_t - typedef wxLongLong_t LongestValueType; -#else - typedef long LongestValueType; -#endif - - wxIntegerValidatorBase(int style) - : wxNumValidatorBase(style) - { - wxASSERT_MSG( !(style & wxNUM_VAL_NO_TRAILING_ZEROES), - "This style doesn't make sense for integers." ); - } - - wxIntegerValidatorBase(const wxIntegerValidatorBase& other) - : wxNumValidatorBase(other) - { - m_min = other.m_min; - m_max = other.m_max; - } - - // Provide methods for wxNumValidator use. - wxString ToString(LongestValueType value) const; - static bool FromString(const wxString& s, LongestValueType *value); - - void DoSetMin(LongestValueType min) { m_min = min; } - void DoSetMax(LongestValueType max) { m_max = max; } - - bool IsInRange(LongestValueType value) const - { - return m_min <= value && value <= m_max; - } - - // Implement wxNumValidatorBase pure virtual method. - virtual bool IsCharOk(const wxString& val, int pos, wxChar ch) const; - -private: - // Minimal and maximal values accepted (inclusive). - LongestValueType m_min, m_max; - - wxDECLARE_NO_ASSIGN_CLASS(wxIntegerValidatorBase); -}; - -// Validator for integer numbers. It can actually work with any integer type -// (short, int or long and long long if supported) and their unsigned versions -// as well. -template -class wxIntegerValidator - : public wxPrivate::wxNumValidator -{ -public: - typedef T ValueType; - - typedef - wxPrivate::wxNumValidator Base; - - // Ctor for an integer validator. - // - // Sets the range appropriately for the type, including setting 0 as the - // minimal value for the unsigned types. - wxIntegerValidator(ValueType *value = NULL, int style = wxNUM_VAL_DEFAULT) - : Base(value, style) - { - this->DoSetMin(std::numeric_limits::min()); - this->DoSetMax(std::numeric_limits::max()); - } - - virtual wxObject *Clone() const { return new wxIntegerValidator(*this); } - -private: - wxDECLARE_NO_ASSIGN_CLASS(wxIntegerValidator); -}; - -// Helper function for creating integer validators which allows to avoid -// explicitly specifying the type as it deduces it from its parameter. -template -inline wxIntegerValidator -wxMakeIntegerValidator(T *value, int style = wxNUM_VAL_DEFAULT) -{ - return wxIntegerValidator(value, style); -} - -// ---------------------------------------------------------------------------- -// Validators for floating point numbers. -// ---------------------------------------------------------------------------- - -// Similar to wxIntegerValidatorBase, this class is not meant to be used -// directly, only wxFloatingPointValidator<> should be used in the user code. -class WXDLLIMPEXP_CORE wxFloatingPointValidatorBase : public wxNumValidatorBase -{ -public: - // Set precision i.e. the number of digits shown (and accepted on input) - // after the decimal point. By default this is set to the maximal precision - // supported by the type handled by the validator. - void SetPrecision(unsigned precision) { m_precision = precision; } - -protected: - // Notice that we can't use "long double" here because it's not supported - // by wxNumberFormatter yet, so restrict ourselves to just double (and - // float). - typedef double LongestValueType; - - wxFloatingPointValidatorBase(int style) - : wxNumValidatorBase(style) - { - } - - wxFloatingPointValidatorBase(const wxFloatingPointValidatorBase& other) - : wxNumValidatorBase(other) - { - m_precision = other.m_precision; - - m_min = other.m_min; - m_max = other.m_max; - } - - // Provide methods for wxNumValidator use. - wxString ToString(LongestValueType value) const; - static bool FromString(const wxString& s, LongestValueType *value); - - void DoSetMin(LongestValueType min) { m_min = min; } - void DoSetMax(LongestValueType max) { m_max = max; } - - bool IsInRange(LongestValueType value) const - { - return m_min <= value && value <= m_max; - } - - // Implement wxNumValidatorBase pure virtual method. - virtual bool IsCharOk(const wxString& val, int pos, wxChar ch) const; - -private: - // Maximum number of decimals digits after the decimal separator. - unsigned m_precision; - - // Minimal and maximal values accepted (inclusive). - LongestValueType m_min, m_max; - - wxDECLARE_NO_ASSIGN_CLASS(wxFloatingPointValidatorBase); -}; - -// Validator for floating point numbers. It can be used with float, double or -// long double values. -template -class wxFloatingPointValidator - : public wxPrivate::wxNumValidator -{ -public: - typedef T ValueType; - typedef wxPrivate::wxNumValidator Base; - - // Ctor using implicit (maximal) precision for this type. - wxFloatingPointValidator(ValueType *value = NULL, - int style = wxNUM_VAL_DEFAULT) - : Base(value, style) - { - DoSetMinMax(); - - this->SetPrecision(std::numeric_limits::digits10); - } - - // Ctor specifying an explicit precision. - wxFloatingPointValidator(int precision, - ValueType *value = NULL, - int style = wxNUM_VAL_DEFAULT) - : Base(value, style) - { - DoSetMinMax(); - - this->SetPrecision(precision); - } - - virtual wxObject *Clone() const - { - return new wxFloatingPointValidator(*this); - } - -private: - void DoSetMinMax() - { - // NB: Do not use min(), it's not the smallest representable value for - // the floating point types but rather the smallest representable - // positive value. - this->DoSetMin(-std::numeric_limits::max()); - this->DoSetMax( std::numeric_limits::max()); - } -}; - -// Helper similar to wxMakeIntValidator(). -// -// NB: Unfortunately we can't just have a wxMakeNumericValidator() which would -// return either wxIntegerValidator<> or wxFloatingPointValidator<> so we -// do need two different functions. -template -inline wxFloatingPointValidator -wxMakeFloatingPointValidator(T *value, int style = wxNUM_VAL_DEFAULT) -{ - return wxFloatingPointValidator(value, style); -} - -template -inline wxFloatingPointValidator -wxMakeFloatingPointValidator(int precision, T *value, int style = wxNUM_VAL_DEFAULT) -{ - return wxFloatingPointValidator(precision, value, style); -} - -#endif // wxUSE_VALIDATORS - -#endif // _WX_VALNUM_H_ diff --git a/Source/3rd Party/wx/include/wx/valtext.h b/Source/3rd Party/wx/include/wx/valtext.h index 18d96582e..7f2e1e693 100644 --- a/Source/3rd Party/wx/include/wx/valtext.h +++ b/Source/3rd Party/wx/include/wx/valtext.h @@ -1,44 +1,40 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/valtext.h +// Name: valtext.h // Purpose: wxTextValidator class // Author: Julian Smart -// Modified by: Francesco Montorsi +// Modified by: // Created: 29/01/98 -// RCS-ID: $Id$ +// RCS-ID: $Id: valtext.h 61872 2009-09-09 22:37:05Z VZ $ // Copyright: (c) 1998 Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifndef _WX_VALTEXT_H_ -#define _WX_VALTEXT_H_ +#ifndef _WX_VALTEXTH__ +#define _WX_VALTEXTH__ #include "wx/defs.h" -#if wxUSE_VALIDATORS && (wxUSE_TEXTCTRL || wxUSE_COMBOBOX) - -class WXDLLIMPEXP_FWD_CORE wxTextEntry; +#if wxUSE_VALIDATORS && wxUSE_TEXTCTRL +#include "wx/textctrl.h" #include "wx/validate.h" -enum wxTextValidatorStyle -{ - wxFILTER_NONE = 0x0, - wxFILTER_EMPTY = 0x1, - wxFILTER_ASCII = 0x2, - wxFILTER_ALPHA = 0x4, - wxFILTER_ALPHANUMERIC = 0x8, - wxFILTER_DIGITS = 0x10, - wxFILTER_NUMERIC = 0x20, - wxFILTER_INCLUDE_LIST = 0x40, - wxFILTER_INCLUDE_CHAR_LIST = 0x80, - wxFILTER_EXCLUDE_LIST = 0x100, - wxFILTER_EXCLUDE_CHAR_LIST = 0x200 -}; +#define wxFILTER_NONE 0x0000 +#define wxFILTER_ASCII 0x0001 +#define wxFILTER_ALPHA 0x0002 +#define wxFILTER_ALPHANUMERIC 0x0004 +#define wxFILTER_NUMERIC 0x0008 +#define wxFILTER_INCLUDE_LIST 0x0010 +#define wxFILTER_EXCLUDE_LIST 0x0020 +#define wxFILTER_INCLUDE_CHAR_LIST 0x0040 +#define wxFILTER_EXCLUDE_CHAR_LIST 0x0080 -class WXDLLIMPEXP_CORE wxTextValidator: public wxValidator +class WXDLLEXPORT wxTextValidator: public wxValidator { +DECLARE_DYNAMIC_CLASS(wxTextValidator) public: - wxTextValidator(long style = wxFILTER_NONE, wxString *val = NULL); + + wxTextValidator(long style = wxFILTER_NONE, wxString *val = 0); wxTextValidator(const wxTextValidator& val); virtual ~wxTextValidator(){} @@ -60,50 +56,67 @@ public: // Called to transfer data from the window virtual bool TransferFromWindow(); - // Filter keystrokes - void OnChar(wxKeyEvent& event); - // ACCESSORS inline long GetStyle() const { return m_validatorStyle; } - void SetStyle(long style); + inline void SetStyle(long style) { m_validatorStyle = style; } - wxTextEntry *GetTextEntry(); +#if WXWIN_COMPATIBILITY_2_4 + wxDEPRECATED( void SetIncludeList(const wxStringList& list) ); + wxDEPRECATED( wxStringList& GetIncludeList() ); + + wxDEPRECATED( void SetExcludeList(const wxStringList& list) ); + wxDEPRECATED( wxStringList& GetExcludeList() ); + + wxDEPRECATED( bool IsInCharIncludeList(const wxString& val) ); + wxDEPRECATED( bool IsNotInCharExcludeList(const wxString& val) ); +#endif - void SetCharIncludes(const wxString& chars); void SetIncludes(const wxArrayString& includes) { m_includes = includes; } inline wxArrayString& GetIncludes() { return m_includes; } - void SetCharExcludes(const wxString& chars); void SetExcludes(const wxArrayString& excludes) { m_excludes = excludes; } inline wxArrayString& GetExcludes() { return m_excludes; } - bool HasFlag(wxTextValidatorStyle style) const - { return (m_validatorStyle & style) != 0; } + bool IsInCharIncludes(const wxString& val); + bool IsNotInCharExcludes(const wxString& val); + + // Filter keystrokes + void OnChar(wxKeyEvent& event); + + +DECLARE_EVENT_TABLE() protected: + long m_validatorStyle; + wxString * m_stringValue; +#if WXWIN_COMPATIBILITY_2_4 + wxStringList m_includeList; + wxStringList m_excludeList; +#endif + wxArrayString m_includes; + wxArrayString m_excludes; - // returns true if all characters of the given string are present in m_includes - bool ContainsOnlyIncludedCharacters(const wxString& val) const; + bool CheckValidator() const + { + wxCHECK_MSG( m_validatorWindow, false, + wxT("No window associated with validator") ); + wxCHECK_MSG( m_validatorWindow->IsKindOf(CLASSINFO(wxTextCtrl)), false, + wxT("wxTextValidator is only for wxTextCtrl's") ); - // returns true if at least one character of the given string is present in m_excludes - bool ContainsExcludedCharacters(const wxString& val) const; - - // returns the error message if the contents of 'val' are invalid - virtual wxString IsValid(const wxString& val) const; - -protected: - long m_validatorStyle; - wxString* m_stringValue; - wxArrayString m_includes; - wxArrayString m_excludes; + return true; + } private: - wxDECLARE_NO_ASSIGN_CLASS(wxTextValidator); - DECLARE_DYNAMIC_CLASS(wxTextValidator) - DECLARE_EVENT_TABLE() +// Cannot use +// DECLARE_NO_COPY_CLASS(wxTextValidator) +// because copy constructor is explicitly declared above; +// but no copy assignment operator is defined, so declare +// it private to prevent the compiler from defining it: + wxTextValidator& operator=(const wxTextValidator&); }; #endif - // wxUSE_VALIDATORS && (wxUSE_TEXTCTRL || wxUSE_COMBOBOX) + // wxUSE_VALIDATORS && wxUSE_TEXTCTRL -#endif // _WX_VALTEXT_H_ +#endif + // _WX_VALTEXTH__ diff --git a/Source/3rd Party/wx/include/wx/variant.h b/Source/3rd Party/wx/include/wx/variant.h index 42302598b..bccf32e88 100644 --- a/Source/3rd Party/wx/include/wx/variant.h +++ b/Source/3rd Party/wx/include/wx/variant.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 10/09/98 -// RCS-ID: $Id$ +// RCS-ID: $Id: variant.h 42997 2006-11-03 21:37:08Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -21,21 +21,26 @@ #include "wx/arrstr.h" #include "wx/list.h" #include "wx/cpp.h" -#include "wx/longlong.h" #if wxUSE_DATETIME #include "wx/datetime.h" #endif // wxUSE_DATETIME -#include "wx/iosfwrap.h" +#if wxUSE_ODBC + #include "wx/db.h" // will #include sqltypes.h +#endif //ODBC -class wxAny; +#include "wx/iosfwrap.h" /* * wxVariantData stores the actual data in a wxVariant object, * to allow it to store any type of data. * Derive from this to provide custom data handling. * + * NB: To prevent addition of extra vtbl pointer to wxVariantData, + * we don't multiple-inherit from wxObjectRefData. Instead, + * we simply replicate the wxObject ref-counting scheme. + * * NB: When you construct a wxVariantData, it will have refcount * of one. Refcount will not be further increased when * it is passed to wxVariant. This simulates old common @@ -54,11 +59,13 @@ class wxAny; * overloading wxVariant with unnecessary functionality. */ -class WXDLLIMPEXP_BASE wxVariantData : public wxObjectRefData +class WXDLLIMPEXP_BASE wxVariantData: public wxObject { friend class wxVariant; public: - wxVariantData() { } + wxVariantData() + : wxObject(), m_count(1) + { } // Override these to provide common functionality virtual bool Eq(wxVariantData& data) const = 0; @@ -76,20 +83,26 @@ public: // If it based on wxObject return the ClassInfo. virtual wxClassInfo* GetValueClassInfo() { return NULL; } - // Implement this to make wxVariant::UnShare work. Returns - // a copy of the data. - virtual wxVariantData* Clone() const { return NULL; } + void IncRef() { m_count++; } + void DecRef() + { + if ( --m_count == 0 ) + delete this; + } -#if wxUSE_ANY - // Converts value to wxAny, if possible. Return true if successful. - virtual bool GetAsAny(wxAny* WXUNUSED(any)) const { return false; } -#endif + int GetRefCount() const { return m_count; } protected: // Protected dtor should make some incompatible code // break more louder. That is, they should do data->DecRef() // instead of delete data. virtual ~wxVariantData() { } + +private: + int m_count; + +private: + DECLARE_ABSTRACT_CLASS(wxVariantData) }; /* @@ -97,10 +110,6 @@ protected: * built in. */ -class WXDLLIMPEXP_FWD_BASE wxVariant; - -WX_DECLARE_LIST_WITH_DECL(wxVariant, wxVariantList, class WXDLLIMPEXP_BASE); - class WXDLLIMPEXP_BASE wxVariant: public wxObject { public: @@ -108,9 +117,6 @@ public: wxVariant(const wxVariant& variant); wxVariant(wxVariantData* data, const wxString& name = wxEmptyString); -#if wxUSE_ANY - wxVariant(const wxAny& any); -#endif virtual ~wxVariant(); // generic assignment @@ -132,17 +138,14 @@ public: // For compatibility with wxWidgets <= 2.6, this doesn't increase // reference count. - wxVariantData* GetData() const - { - return (wxVariantData*) m_refData; - } + wxVariantData* GetData() const { return m_data; } void SetData(wxVariantData* data) ; // make a 'clone' of the object - void Ref(const wxVariant& clone) { wxObject::Ref(clone); } + void Ref(const wxVariant& clone); - // ensure that the data is exclusive to this variant, and not shared - bool Unshare(); + // destroy a reference + void UnRef(); // Make NULL (i.e. delete the data) void MakeNull(); @@ -160,10 +163,6 @@ public: // write contents to a string (e.g. for debugging) wxString MakeString() const; -#if wxUSE_ANY - wxAny GetAny() const; -#endif - // double wxVariant(double val, const wxString& name = wxEmptyString); bool operator== (double value) const; @@ -185,99 +184,59 @@ public: long GetLong() const; // bool +#ifdef HAVE_BOOL wxVariant(bool val, const wxString& name = wxEmptyString); bool operator== (bool value) const; bool operator!= (bool value) const; void operator= (bool value) ; inline operator bool () const { return GetBool(); } bool GetBool() const ; +#endif // wxDateTime #if wxUSE_DATETIME wxVariant(const wxDateTime& val, const wxString& name = wxEmptyString); +#if wxUSE_ODBC + wxVariant(const DATE_STRUCT* valptr, const wxString& name = wxEmptyString); + wxVariant(const TIME_STRUCT* valptr, const wxString& name = wxEmptyString); + wxVariant(const TIMESTAMP_STRUCT* valptr, const wxString& name = wxEmptyString); +#endif bool operator== (const wxDateTime& value) const; bool operator!= (const wxDateTime& value) const; void operator= (const wxDateTime& value) ; +#if wxUSE_ODBC + void operator= (const DATE_STRUCT* value) ; + void operator= (const TIME_STRUCT* value) ; + void operator= (const TIMESTAMP_STRUCT* value) ; +#endif inline operator wxDateTime () const { return GetDateTime(); } wxDateTime GetDateTime() const; #endif // wxString wxVariant(const wxString& val, const wxString& name = wxEmptyString); - // these overloads are necessary to prevent the compiler from using bool - // version instead of wxString one: - wxVariant(const char* val, const wxString& name = wxEmptyString); - wxVariant(const wchar_t* val, const wxString& name = wxEmptyString); - wxVariant(const wxCStrData& val, const wxString& name = wxEmptyString); - wxVariant(const wxScopedCharBuffer& val, const wxString& name = wxEmptyString); - wxVariant(const wxScopedWCharBuffer& val, const wxString& name = wxEmptyString); - + wxVariant(const wxChar* val, const wxString& name = wxEmptyString); // Necessary or VC++ assumes bool! bool operator== (const wxString& value) const; bool operator!= (const wxString& value) const; - wxVariant& operator=(const wxString& value); - // these overloads are necessary to prevent the compiler from using bool - // version instead of wxString one: - wxVariant& operator=(const char* value) - { return *this = wxString(value); } - wxVariant& operator=(const wchar_t* value) - { return *this = wxString(value); } - wxVariant& operator=(const wxCStrData& value) - { return *this = value.AsString(); } - template - wxVariant& operator=(const wxScopedCharTypeBuffer& value) - { return *this = value.data(); } - + void operator= (const wxString& value) ; + void operator= (const wxChar* value) ; // Necessary or VC++ assumes bool! inline operator wxString () const { return MakeString(); } wxString GetString() const; -#if wxUSE_STD_STRING - wxVariant(const std::string& val, const wxString& name = wxEmptyString); - bool operator==(const std::string& value) const - { return operator==(wxString(value)); } - bool operator!=(const std::string& value) const - { return operator!=(wxString(value)); } - wxVariant& operator=(const std::string& value) - { return operator=(wxString(value)); } - operator std::string() const { return (operator wxString()).ToStdString(); } - - wxVariant(const wxStdWideString& val, const wxString& name = wxEmptyString); - bool operator==(const wxStdWideString& value) const - { return operator==(wxString(value)); } - bool operator!=(const wxStdWideString& value) const - { return operator!=(wxString(value)); } - wxVariant& operator=(const wxStdWideString& value) - { return operator=(wxString(value)); } - operator wxStdWideString() const { return (operator wxString()).ToStdWstring(); } -#endif // wxUSE_STD_STRING - - // wxUniChar - wxVariant(const wxUniChar& val, const wxString& name = wxEmptyString); - wxVariant(const wxUniCharRef& val, const wxString& name = wxEmptyString); - wxVariant(char val, const wxString& name = wxEmptyString); - wxVariant(wchar_t val, const wxString& name = wxEmptyString); - bool operator==(const wxUniChar& value) const; - bool operator==(const wxUniCharRef& value) const { return *this == wxUniChar(value); } - bool operator==(char value) const { return *this == wxUniChar(value); } - bool operator==(wchar_t value) const { return *this == wxUniChar(value); } - bool operator!=(const wxUniChar& value) const { return !(*this == value); } - bool operator!=(const wxUniCharRef& value) const { return !(*this == value); } - bool operator!=(char value) const { return !(*this == value); } - bool operator!=(wchar_t value) const { return !(*this == value); } - wxVariant& operator=(const wxUniChar& value); - wxVariant& operator=(const wxUniCharRef& value) { return *this = wxUniChar(value); } - wxVariant& operator=(char value) { return *this = wxUniChar(value); } - wxVariant& operator=(wchar_t value) { return *this = wxUniChar(value); } - operator wxUniChar() const { return GetChar(); } - operator char() const { return GetChar(); } - operator wchar_t() const { return GetChar(); } - wxUniChar GetChar() const; + // wxChar + wxVariant(wxChar val, const wxString& name = wxEmptyString); + bool operator== (wxChar value) const; + bool operator!= (wxChar value) const; + void operator= (wxChar value) ; + inline operator wxChar () const { return GetChar(); } + wxChar GetChar() const ; // wxArrayString wxVariant(const wxArrayString& val, const wxString& name = wxEmptyString); bool operator== (const wxArrayString& value) const; bool operator!= (const wxArrayString& value) const; void operator= (const wxArrayString& value); - operator wxArrayString () const { return GetArrayString(); } + inline operator wxArrayString () const { return GetArrayString(); } wxArrayString GetArrayString() const; // void* @@ -285,7 +244,7 @@ public: bool operator== (void* value) const; bool operator!= (void* value) const; void operator= (void* value); - operator void* () const { return GetVoidPtr(); } + inline operator void* () const { return GetVoidPtr(); } void* GetVoidPtr() const; // wxObject* @@ -295,36 +254,27 @@ public: void operator= (wxObject* value); wxObject* GetWxObjectPtr() const; -#if wxUSE_LONGLONG - // wxLongLong - wxVariant(wxLongLong, const wxString& name = wxEmptyString); - bool operator==(wxLongLong value) const; - bool operator!=(wxLongLong value) const; - void operator=(wxLongLong value); - operator wxLongLong() const { return GetLongLong(); } - wxLongLong GetLongLong() const; - // wxULongLong - wxVariant(wxULongLong, const wxString& name = wxEmptyString); - bool operator==(wxULongLong value) const; - bool operator!=(wxULongLong value) const; - void operator=(wxULongLong value); - operator wxULongLong() const { return GetULongLong(); } - wxULongLong GetULongLong() const; +#if WXWIN_COMPATIBILITY_2_4 + wxDEPRECATED( wxVariant(const wxStringList& val, const wxString& name = wxEmptyString) ); + wxDEPRECATED( bool operator== (const wxStringList& value) const ); + wxDEPRECATED( bool operator!= (const wxStringList& value) const ); + wxDEPRECATED( void operator= (const wxStringList& value) ); + wxDEPRECATED( wxStringList& GetStringList() const ); #endif // ------------------------------ // list operations // ------------------------------ - wxVariant(const wxVariantList& val, const wxString& name = wxEmptyString); // List of variants - bool operator== (const wxVariantList& value) const; - bool operator!= (const wxVariantList& value) const; - void operator= (const wxVariantList& value) ; + wxVariant(const wxList& val, const wxString& name = wxEmptyString); // List of variants + bool operator== (const wxList& value) const; + bool operator!= (const wxList& value) const; + void operator= (const wxList& value) ; // Treat a list variant as an array wxVariant operator[] (size_t idx) const; wxVariant& operator[] (size_t idx) ; - wxVariantList& GetList() const ; + wxList& GetList() const ; // Return the number of elements in a list size_t GetCount() const; @@ -353,124 +303,20 @@ public: bool Convert(bool* value) const; bool Convert(double* value) const; bool Convert(wxString* value) const; - bool Convert(wxUniChar* value) const; - bool Convert(char* value) const; - bool Convert(wchar_t* value) const; + bool Convert(wxChar* value) const; #if wxUSE_DATETIME bool Convert(wxDateTime* value) const; #endif // wxUSE_DATETIME -#if wxUSE_LONGLONG - bool Convert(wxLongLong* value) const; - bool Convert(wxULongLong* value) const; - #ifdef wxLongLong_t - bool Convert(wxLongLong_t* value) const - { - wxLongLong temp; - if ( !Convert(&temp) ) - return false; - *value = temp.GetValue(); - return true; - } - bool Convert(wxULongLong_t* value) const - { - wxULongLong temp; - if ( !Convert(&temp) ) - return false; - *value = temp.GetValue(); - return true; - } - #endif // wxLongLong_t -#endif // wxUSE_LONGLONG // Attributes protected: - virtual wxObjectRefData *CreateRefData() const; - virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const; - + wxVariantData* m_data; wxString m_name; private: DECLARE_DYNAMIC_CLASS(wxVariant) }; - -// -// wxVariant <-> wxAny conversion code -// -#if wxUSE_ANY - -#include "wx/any.h" - -// In order to convert wxAny to wxVariant, we need to be able to associate -// wxAnyValueType with a wxVariantData factory function. -typedef wxVariantData* (*wxVariantDataFactory)(const wxAny& any); - -// Actual Any-to-Variant registration must be postponed to a time when all -// global variables have been initialized. Hence this arrangement. -// wxAnyToVariantRegistration instances are kept in global scope and -// wxAnyValueTypeGlobals in any.cpp will use their data when the time is -// right. -class WXDLLIMPEXP_BASE wxAnyToVariantRegistration -{ -public: - wxAnyToVariantRegistration(wxVariantDataFactory factory); - virtual ~wxAnyToVariantRegistration(); - - virtual wxAnyValueType* GetAssociatedType() = 0; - wxVariantDataFactory GetFactory() const { return m_factory; } -private: - wxVariantDataFactory m_factory; -}; - -template -class wxAnyToVariantRegistrationImpl : public wxAnyToVariantRegistration -{ -public: - wxAnyToVariantRegistrationImpl(wxVariantDataFactory factory) - : wxAnyToVariantRegistration(factory) - { - } - - virtual wxAnyValueType* GetAssociatedType() - { - return wxAnyValueTypeImpl::GetInstance(); - } -private: -}; - -#define DECLARE_WXANY_CONVERSION() \ -virtual bool GetAsAny(wxAny* any) const; \ -static wxVariantData* VariantDataFactory(const wxAny& any); - -#define _REGISTER_WXANY_CONVERSION(T, CLASSNAME, FUNC) \ -static wxAnyToVariantRegistrationImpl \ - gs_##CLASSNAME##AnyToVariantRegistration = \ - wxAnyToVariantRegistrationImpl(&FUNC); - -#define REGISTER_WXANY_CONVERSION(T, CLASSNAME) \ -_REGISTER_WXANY_CONVERSION(T, CLASSNAME, CLASSNAME::VariantDataFactory) - -#define IMPLEMENT_TRIVIAL_WXANY_CONVERSION(T, CLASSNAME) \ -bool CLASSNAME::GetAsAny(wxAny* any) const \ -{ \ - *any = m_value; \ - return true; \ -} \ -wxVariantData* CLASSNAME::VariantDataFactory(const wxAny& any) \ -{ \ - return new CLASSNAME(wxANY_AS(any, T)); \ -} \ -REGISTER_WXANY_CONVERSION(T, CLASSNAME) - -#else // if !wxUSE_ANY - -#define DECLARE_WXANY_CONVERSION() -#define REGISTER_WXANY_CONVERSION(T, CLASSNAME) -#define IMPLEMENT_TRIVIAL_WXANY_CONVERSION(T, CLASSNAME) - -#endif // wxUSE_ANY/!wxUSE_ANY - - #define DECLARE_VARIANT_OBJECT(classname) \ DECLARE_VARIANT_OBJECT_EXPORTED(classname, wxEMPTY_PARAMETER_VALUE) @@ -495,13 +341,15 @@ public:\ virtual wxString GetType() const; \ virtual wxClassInfo* GetValueClassInfo(); \ \ - virtual wxVariantData* Clone() const { return new classname##VariantData(m_value); } \ -\ - DECLARE_WXANY_CONVERSION() \ protected:\ classname m_value; \ +\ +private: \ + DECLARE_CLASS(classname##VariantData) \ };\ \ +IMPLEMENT_CLASS(classname##VariantData, wxVariantData)\ +\ wxString classname##VariantData::GetType() const\ {\ return m_value.GetClassInfo()->GetClassName();\ @@ -514,7 +362,7 @@ wxClassInfo* classname##VariantData::GetValueClassInfo()\ \ expdecl classname& operator << ( classname &value, const wxVariant &variant )\ {\ - wxASSERT( variant.GetType() == #classname );\ + wxASSERT( wxIsKindOf( variant.GetData(), classname##VariantData ) );\ \ classname##VariantData *data = (classname##VariantData*) variant.GetData();\ value = data->GetValue();\ @@ -526,8 +374,7 @@ expdecl wxVariant& operator << ( wxVariant &variant, const classname &value )\ classname##VariantData *data = new classname##VariantData( value );\ variant.SetData( data );\ return variant;\ -} \ -IMPLEMENT_TRIVIAL_WXANY_CONVERSION(classname, classname##VariantData) +} // implements a wxVariantData-derived class using for the Eq() method the // operator== which must have been provided by "classname" @@ -536,7 +383,7 @@ IMPLEMENT_VARIANT_OBJECT_EXPORTED_NO_EQ(classname,wxEMPTY_PARAMETER_VALUE expdec \ bool classname##VariantData::Eq(wxVariantData& data) const \ {\ - wxASSERT( GetType() == data.GetType() );\ + wxASSERT( wxIsKindOf((&data), classname##VariantData) );\ \ classname##VariantData & otherData = (classname##VariantData &) data;\ \ @@ -553,7 +400,7 @@ IMPLEMENT_VARIANT_OBJECT_EXPORTED_NO_EQ(classname,wxEMPTY_PARAMETER_VALUE expdec \ bool classname##VariantData::Eq(wxVariantData& data) const \ {\ - wxASSERT( GetType() == data.GetType() );\ + wxASSERT( wxIsKindOf((&data), classname##VariantData) );\ \ classname##VariantData & otherData = (classname##VariantData &) data;\ \ @@ -569,9 +416,6 @@ bool classname##VariantData::Eq(wxVariantData& data) const \ ((classname*)(var.IsValueKindOf(&classname::ms_classInfo) ?\ var.GetWxObjectPtr() : NULL)); -// Replacement for using wxDynamicCast on a wxVariantData object -#define wxDynamicCastVariantData(data, classname) dynamic_cast(data) - extern wxVariant WXDLLIMPEXP_BASE wxNullVariant; #endif // wxUSE_VARIANT diff --git a/Source/3rd Party/wx/include/wx/vector.h b/Source/3rd Party/wx/include/wx/vector.h index d1b27f049..b05d779ec 100644 --- a/Source/3rd Party/wx/include/wx/vector.h +++ b/Source/3rd Party/wx/include/wx/vector.h @@ -2,10 +2,9 @@ // Name: wx/vector.h // Purpose: STL vector clone // Author: Lindsay Mathieson -// Modified by: Vaclav Slavik - make it a template +// Modified by: // Created: 30.07.2001 -// Copyright: (c) 2001 Lindsay Mathieson , -// 2007 Vaclav Slavik +// Copyright: (c) 2001 Lindsay Mathieson // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -14,252 +13,100 @@ #include "wx/defs.h" -#if wxUSE_STD_CONTAINERS - -#include -#include - -#define wxVector std::vector -template -inline void wxVectorSort(wxVector& v) +class WXDLLIMPEXP_BASE wxVectorBase { - std::sort(v.begin(), v.end()); -} - -#else // !wxUSE_STD_CONTAINERS - -#include "wx/utils.h" -#include "wx/scopeguard.h" -#include "wx/meta/movable.h" -#include "wx/meta/if.h" - -#include "wx/beforestd.h" -#include // for placement new -#include "wx/afterstd.h" - -namespace wxPrivate -{ - -// These templates encapsulate memory operations for use by wxVector; there are -// two implementations, both in generic way for any C++ types and as an -// optimized version for "movable" types that uses realloc() and memmove(). - -// version for movable types: -template -struct wxVectorMemOpsMovable -{ - static void Free(T* array) - { free(array); } - - static T* Realloc(T* old, size_t newCapacity, size_t WXUNUSED(occupiedSize)) - { return (T*)realloc(old, newCapacity * sizeof(T)); } - - static void MemmoveBackward(T* dest, T* source, size_t count) - { memmove(dest, source, count * sizeof(T)); } - - static void MemmoveForward(T* dest, T* source, size_t count) - { memmove(dest, source, count * sizeof(T)); } -}; - -// generic version for non-movable types: -template -struct wxVectorMemOpsGeneric -{ - static void Free(T* array) - { ::operator delete(array); } - - static T* Realloc(T* old, size_t newCapacity, size_t occupiedSize) - { - T *mem = (T*)::operator new(newCapacity * sizeof(T)); - for ( size_t i = 0; i < occupiedSize; i++ ) - { - ::new(mem + i) T(old[i]); - old[i].~T(); - } - ::operator delete(old); - return mem; - } - - static void MemmoveBackward(T* dest, T* source, size_t count) - { - wxASSERT( dest < source ); - T* destptr = dest; - T* sourceptr = source; - for ( size_t i = count; i > 0; --i, ++destptr, ++sourceptr ) - { - ::new(destptr) T(*sourceptr); - sourceptr->~T(); - } - } - - static void MemmoveForward(T* dest, T* source, size_t count) - { - wxASSERT( dest > source ); - T* destptr = dest + count - 1; - T* sourceptr = source + count - 1; - for ( size_t i = count; i > 0; --i, --destptr, --sourceptr ) - { - ::new(destptr) T(*sourceptr); - sourceptr->~T(); - } - } -}; - - -} // namespace wxPrivate - -template -class wxVector -{ -private: - // This cryptic expression means "typedef Ops to wxVectorMemOpsMovable if - // type T is movable type, otherwise to wxVectorMemOpsGeneric". - // - // Note that we use typedef instead of privately deriving from this (which - // would allowed us to omit "Ops::" prefixes below) to keep VC6 happy, - // it can't compile code that derives from wxIf<...>::value. - // - // Note that bcc needs the extra parentheses for non-type template - // arguments to compile this expression. - typedef typename wxIf< (wxIsMovable::value), - wxPrivate::wxVectorMemOpsMovable, - wxPrivate::wxVectorMemOpsGeneric >::value - Ops; - public: typedef size_t size_type; - typedef size_t difference_type; - typedef T value_type; - typedef value_type* pointer; - typedef value_type* iterator; - typedef const value_type* const_iterator; - typedef value_type& reference; +private: + size_type m_allocsize; + size_type m_size, + m_capacity; + void **m_objects; - class reverse_iterator +protected: + bool Alloc(size_type sz) { - public: - reverse_iterator() : m_ptr(NULL) { } - wxEXPLICIT reverse_iterator(iterator it) : m_ptr(it) { } - reverse_iterator(const reverse_iterator& it) : m_ptr(it.m_ptr) { } + // work in multiples of m_allocsize; + sz = (sz / m_allocsize + 1) * m_allocsize; + if (sz <= m_capacity) + return true; - reference operator*() const { return *m_ptr; } - pointer operator->() const { return m_ptr; } - - iterator base() const { return m_ptr; } - - reverse_iterator& operator++() - { --m_ptr; return *this; } - reverse_iterator operator++(int) - { reverse_iterator tmp = *this; --m_ptr; return tmp; } - reverse_iterator& operator--() - { ++m_ptr; return *this; } - reverse_iterator operator--(int) - { reverse_iterator tmp = *this; ++m_ptr; return tmp; } - - reverse_iterator operator+(difference_type n) const - { return reverse_iterator(m_ptr - n); } - reverse_iterator& operator+=(difference_type n) - { m_ptr -= n; return *this; } - reverse_iterator operator-(difference_type n) const - { return reverse_iterator(m_ptr + n); } - reverse_iterator& operator-=(difference_type n) - { m_ptr += n; return *this; } - - reference operator[](difference_type n) const - { return *(*this + n); } - - bool operator ==(const reverse_iterator& it) const - { return m_ptr == it.m_ptr; } - bool operator !=(const reverse_iterator& it) const - { return m_ptr != it.m_ptr; } - - private: - value_type *m_ptr; - }; - - wxVector() : m_size(0), m_capacity(0), m_values(NULL) {} - - wxVector(size_type p_size) - : m_size(0), m_capacity(0), m_values(NULL) - { - reserve(p_size); - for ( size_t n = 0; n < p_size; n++ ) - push_back(value_type()); + // try to realloc + void *mem = realloc(m_objects, sizeof(void *) * sz); + if (! mem) + return false; // failed + // success + m_objects = (void **) mem; + m_capacity = sz; + return true; } - wxVector(size_type p_size, const value_type& v) - : m_size(0), m_capacity(0), m_values(NULL) + // untyped destructor of elements - must be overriden + virtual void Free(void *) = 0; + // untyped copy constructor of elements - must be overriden + virtual void *Copy(const void *) const = 0; + + const void *GetItem(size_type idx) const { - reserve(p_size); - for ( size_t n = 0; n < p_size; n++ ) - push_back(v); + wxASSERT(idx < m_size); + return m_objects[idx]; } - wxVector(const wxVector& c) : m_size(0), m_capacity(0), m_values(NULL) + void Append(void *obj) { - Copy(c); + wxASSERT(m_size < m_capacity); + m_objects[m_size] = obj; + m_size++; } - ~wxVector() + void RemoveAt(size_type idx) + { + wxASSERT(idx < m_size); + Free(m_objects[idx]); + if (idx < m_size - 1) + memcpy( + m_objects + idx, + m_objects + idx + 1, + ( m_size - idx - 1 ) * sizeof(void*) ); + m_size--; + } + + bool copy(const wxVectorBase& vb) { clear(); + if (! Alloc(vb.size())) + return false; + + for (size_type i = 0; i < vb.size(); i++) + { + void *o = vb.Copy(vb.GetItem(i)); + if (! o) + return false; + Append(o); + } + + return true; } - void swap(wxVector& v) - { - wxSwap(m_size, v.m_size); - wxSwap(m_capacity, v.m_capacity); - wxSwap(m_values, v.m_values); - } +public: + wxVectorBase() : m_allocsize(16), m_size(0), m_capacity(0), m_objects(0) {} + virtual ~wxVectorBase() {} // calm down GCC void clear() { - // call destructors of stored objects: - for ( size_type i = 0; i < m_size; i++ ) - { - m_values[i].~T(); - } - - Ops::Free(m_values); - m_values = NULL; - m_size = - m_capacity = 0; + for (size_type i = 0; i < size(); i++) + Free(m_objects[i]); + free(m_objects); + m_objects = 0; + m_size = m_capacity = 0; } void reserve(size_type n) { - if ( n <= m_capacity ) - return; - - // increase the size twice, unless we're already too big or unless - // more is requested - // - // NB: casts to size_type are needed to suppress mingw32 warnings about - // mixing enums and ints in the same expression - const size_type increment = m_size > 0 - ? wxMin(m_size, (size_type)ALLOC_MAX_SIZE) - : (size_type)ALLOC_INITIAL_SIZE; - if ( m_capacity + increment > n ) - n = m_capacity + increment; - - m_values = Ops::Realloc(m_values, n * sizeof(value_type), m_size); - m_capacity = n; - } - - void resize(size_type n) - { - if ( n < m_size ) - Shrink(n); - else if ( n > m_size ) - Extend(n, value_type()); - } - - void resize(size_type n, const value_type& v) - { - if ( n < m_size ) - Shrink(n); - else if ( n > m_size ) - Extend(n, v); + if ( !Alloc(n) ) + { + wxFAIL_MSG( wxT("out of memory in wxVector::reserve()") ); + } } size_type size() const @@ -277,220 +124,89 @@ public: return size() == 0; } - wxVector& operator=(const wxVector& vb) + wxVectorBase& operator = (const wxVectorBase& vb) { - if (this != &vb) - { - clear(); - Copy(vb); - } + wxCHECK(copy(vb), *this); return *this; } - - void push_back(const value_type& v) - { - reserve(size() + 1); - - // use placement new to initialize new object in preallocated place in - // m_values and store 'v' in it: - void* const place = m_values + m_size; - ::new(place) value_type(v); - - // only increase m_size if the ctor didn't throw an exception; notice - // that if it _did_ throw, everything is OK, because we only increased - // vector's capacity so far and possibly written some data to - // uninitialized memory at the end of m_values - m_size++; - } - - void pop_back() - { - erase(end() - 1); - } - - const value_type& at(size_type idx) const - { - wxASSERT(idx < m_size); - return m_values[idx]; - } - - value_type& at(size_type idx) - { - wxASSERT(idx < m_size); - return m_values[idx]; - } - - const value_type& operator[](size_type idx) const { return at(idx); } - value_type& operator[](size_type idx) { return at(idx); } - const value_type& front() const { return at(0); } - value_type& front() { return at(0); } - const value_type& back() const { return at(size() - 1); } - value_type& back() { return at(size() - 1); } - - const_iterator begin() const { return m_values; } - iterator begin() { return m_values; } - const_iterator end() const { return m_values + size(); } - iterator end() { return m_values + size(); } - - reverse_iterator rbegin() { return reverse_iterator(end() - 1); } - reverse_iterator rend() { return reverse_iterator(begin() - 1); } - - iterator insert(iterator it, const value_type& v = value_type()) - { - // NB: this must be done before reserve(), because reserve() - // invalidates iterators! - const size_t idx = it - begin(); - const size_t after = end() - it; - - reserve(size() + 1); - - // the place where the new element is going to be inserted - value_type * const place = m_values + idx; - - // unless we're inserting at the end, move following elements out of - // the way: - if ( after > 0 ) - Ops::MemmoveForward(place + 1, place, after); - - // if the ctor called below throws an exception, we need to move all - // the elements back to their original positions in m_values - wxScopeGuard moveBack = wxMakeGuard( - Ops::MemmoveBackward, place, place + 1, after); - if ( !after ) - moveBack.Dismiss(); - - // use placement new to initialize new object in preallocated place in - // m_values and store 'v' in it: - ::new(place) value_type(v); - - // now that we did successfully add the new element, increment the size - // and disable moving the items back - moveBack.Dismiss(); - m_size++; - - return begin() + idx; - } - - iterator erase(iterator it) - { - return erase(it, it + 1); - } - - iterator erase(iterator first, iterator last) - { - if ( first == last ) - return first; - wxASSERT( first < end() && last <= end() ); - - const size_type idx = first - begin(); - const size_type count = last - first; - const size_type after = end() - last; - - // erase elements by calling their destructors: - for ( iterator i = first; i < last; ++i ) - i->~T(); - - // once that's done, move following elements over to the freed space: - if ( after > 0 ) - { - Ops::MemmoveBackward(m_values + idx, m_values + idx + count, after); - } - - m_size -= count; - - return begin() + idx; - } - -#if WXWIN_COMPATIBILITY_2_8 - wxDEPRECATED( size_type erase(size_type n) ); -#endif // WXWIN_COMPATIBILITY_2_8 - -private: - // VC6 can't compile static const int members - enum { ALLOC_INITIAL_SIZE = 16 }; - enum { ALLOC_MAX_SIZE = 4096 }; - - void Copy(const wxVector& vb) - { - reserve(vb.size()); - - for ( const_iterator i = vb.begin(); i != vb.end(); ++i ) - push_back(*i); - } - -private: - void Shrink(size_type n) - { - for ( size_type i = n; i < m_size; i++ ) - m_values[i].~T(); - m_size = n; - } - - void Extend(size_type n, const value_type& v) - { - reserve(n); - for ( size_type i = m_size; i < n; i++ ) - push_back(v); - } - - size_type m_size, - m_capacity; - value_type *m_values; }; -#if WXWIN_COMPATIBILITY_2_8 -template -inline typename wxVector::size_type wxVector::erase(size_type n) -{ - erase(begin() + n); - return n; -} -#endif // WXWIN_COMPATIBILITY_2_8 - - - -namespace wxPrivate -{ - -// This is a helper for the wxVectorSort function, and should not be used -// directly in user's code. -template -struct wxVectorComparator -{ - static int - Compare(const void* pitem1, const void* pitem2, const void* ) - { - const T& item1 = *reinterpret_cast(pitem1); - const T& item2 = *reinterpret_cast(pitem2); - - if (item1 < item2) - return -1; - else if (item2 < item1) - return 1; - else - return 0; +#define WX_DECLARE_VECTORBASE(obj, cls)\ +protected:\ + virtual void Free(void *o)\ + {\ + delete (obj *) o;\ + }\ + virtual void *Copy(const void *o) const\ + {\ + return new obj(*(obj *) o);\ + }\ +public:\ + cls() {}\ + cls(const cls& c) : wxVectorBase()\ + {\ + wxCHECK2(copy(c), return);\ + }\ + ~cls()\ + {\ + clear();\ } -}; -} // namespace wxPrivate - - - -template -void wxVectorSort(wxVector& v) -{ - wxQsort(v.begin(), v.size(), sizeof(T), - wxPrivate::wxVectorComparator::Compare, NULL); +#define _WX_DECLARE_VECTOR(obj, cls, exp)\ +class exp cls : public wxVectorBase\ +{\ + WX_DECLARE_VECTORBASE(obj, cls)\ +public:\ + void push_back(const obj& o)\ + {\ + wxCHECK2(Alloc(size() + 1), return);\ + Append(new obj(o));\ + }\ + void pop_back()\ + {\ + RemoveAt(size() - 1);\ + }\ + const obj& at(size_type idx) const\ + {\ + return *(obj *) GetItem(idx);\ + }\ + obj& at(size_type idx)\ + {\ + return *(obj *) GetItem(idx);\ + }\ + const obj& operator[](size_type idx) const\ + {\ + return at(idx);\ + }\ + obj& operator[](size_type idx)\ + {\ + return at(idx);\ + }\ + const obj& front() const\ + {\ + return at(0);\ + }\ + obj& front()\ + {\ + return at(0);\ + }\ + const obj& back() const\ + {\ + return at(size() - 1);\ + }\ + obj& back()\ + {\ + return at(size() - 1);\ + }\ + size_type erase(size_type idx)\ + {\ + RemoveAt(idx);\ + return idx;\ + }\ } - - -#endif // wxUSE_STD_CONTAINERS/!wxUSE_STD_CONTAINERS - -#if WXWIN_COMPATIBILITY_2_8 - #define WX_DECLARE_VECTORBASE(obj, cls) typedef wxVector cls - #define _WX_DECLARE_VECTOR(obj, cls, exp) WX_DECLARE_VECTORBASE(obj, cls) - #define WX_DECLARE_VECTOR(obj, cls) WX_DECLARE_VECTORBASE(obj, cls) -#endif // WXWIN_COMPATIBILITY_2_8 +#define WX_DECLARE_VECTOR(obj, cls) \ + _WX_DECLARE_VECTOR(obj, cls, WXDLLEXPORT) #endif // _WX_VECTOR_H_ + diff --git a/Source/3rd Party/wx/include/wx/version.h b/Source/3rd Party/wx/include/wx/version.h index 314c8deda..11cf33112 100644 --- a/Source/3rd Party/wx/include/wx/version.h +++ b/Source/3rd Party/wx/include/wx/version.h @@ -4,7 +4,7 @@ * Author: Julian Smart * Modified by: Ryan Norton (Converted to C) * Created: 29/01/98 - * RCS-ID: $Id$ + * RCS-ID: $Id: version.h 66910 2011-02-16 20:53:53Z JS $ * Copyright: (c) 1998 Julian Smart * Licence: wxWindows licence */ @@ -27,10 +27,10 @@ /* NB: this file is parsed by automatic tools so don't change its format! */ #define wxMAJOR_VERSION 2 -#define wxMINOR_VERSION 9 -#define wxRELEASE_NUMBER 4 +#define wxMINOR_VERSION 8 +#define wxRELEASE_NUMBER 12 #define wxSUBRELEASE_NUMBER 0 -#define wxVERSION_STRING wxT("wxWidgets 2.9.4") +#define wxVERSION_STRING wxT("wxWidgets 2.8.12") /* nothing to update below this line when updating the version */ /* ---------------------------------------------------------------------------- */ diff --git a/Source/3rd Party/wx/include/wx/versioninfo.h b/Source/3rd Party/wx/include/wx/versioninfo.h deleted file mode 100644 index 59cb34c2b..000000000 --- a/Source/3rd Party/wx/include/wx/versioninfo.h +++ /dev/null @@ -1,78 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// 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 = wxString(), - int major = 0, - int minor = 0, - 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/Source/3rd Party/wx/include/wx/vidmode.h b/Source/3rd Party/wx/include/wx/vidmode.h index 3fe733c93..343d0de94 100644 --- a/Source/3rd Party/wx/include/wx/vidmode.h +++ b/Source/3rd Party/wx/include/wx/vidmode.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 27.09.2003 (extracted from wx/display.h) -// RCS-ID: $Id$ +// RCS-ID: $Id: vidmode.h 27408 2004-05-23 20:53:33Z JS $ // Copyright: (c) 2003 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -16,7 +16,7 @@ // wxVideoMode: a simple struct containing video mode parameters for a display // ---------------------------------------------------------------------------- -struct WXDLLIMPEXP_CORE wxVideoMode +struct WXDLLEXPORT wxVideoMode { wxVideoMode(int width = 0, int height = 0, int depth = 0, int freq = 0) { @@ -54,7 +54,6 @@ struct WXDLLIMPEXP_CORE wxVideoMode int GetWidth() const { return w; } int GetHeight() const { return h; } int GetDepth() const { return bpp; } - int GetRefresh() const { return refresh; } // returns true if the object has been initialized bool IsOk() const { return w && h; } diff --git a/Source/3rd Party/wx/include/wx/vlbox.h b/Source/3rd Party/wx/include/wx/vlbox.h index ef68ee006..4aa3bf5d3 100644 --- a/Source/3rd Party/wx/include/wx/vlbox.h +++ b/Source/3rd Party/wx/include/wx/vlbox.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 31.05.03 -// RCS-ID: $Id$ +// RCS-ID: $Id: vlbox.h 61872 2009-09-09 22:37:05Z VZ $ // Copyright: (c) 2003 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -16,7 +16,8 @@ #include "wx/bitmap.h" class WXDLLIMPEXP_FWD_CORE wxSelectionStore; -extern WXDLLIMPEXP_DATA_CORE(const char) wxVListBoxNameStr[]; + +#define wxVListBoxNameStr wxT("wxVListBox") // ---------------------------------------------------------------------------- // wxVListBox @@ -31,7 +32,7 @@ extern WXDLLIMPEXP_DATA_CORE(const char) wxVListBoxNameStr[]; It emits the same events as wxListBox and the same event macros may be used with it. */ -class WXDLLIMPEXP_CORE wxVListBox : public wxVScrolledWindow +class WXDLLEXPORT wxVListBox : public wxVScrolledWindow { public: // constructors and such @@ -74,7 +75,7 @@ public: // --------- // get the number of items in the control - size_t GetItemCount() const { return GetRowCount(); } + size_t GetItemCount() const { return GetLineCount(); } // does this control use multiple selection? bool HasMultipleSelection() const { return m_selStore != NULL; } @@ -126,15 +127,13 @@ public: // get the background colour of selected cells const wxColour& GetSelectionBackground() const { return m_colBgSel; } - // get the item rect, returns empty rect if the item is not visible - wxRect GetItemRect(size_t n) const; // operations // ---------- // set the number of items to be shown in the control // - // this is just a synonym for wxVScrolledWindow::SetRowCount() + // this is just a synonym for wxVScrolledWindow::SetLineCount() virtual void SetItemCount(size_t count); // delete all items from the control @@ -190,9 +189,6 @@ public: // change the background colour of the selected cells void SetSelectionBackground(const wxColour& col); - // refreshes only the selected items - void RefreshSelected(); - virtual wxVisualAttributes GetDefaultAttributes() const { @@ -203,8 +199,6 @@ public: GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); protected: - virtual wxBorder GetDefaultBorder() const { return wxBORDER_THEME; } - // the derived class must implement this function to actually draw the item // with the given index on the provided DC virtual void OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const = 0; @@ -229,11 +223,11 @@ protected: // current virtual void OnDrawBackground(wxDC& dc, const wxRect& rect, size_t n) const; - // we implement OnGetRowHeight() in terms of OnMeasureItem() because this + // we implement OnGetLineHeight() in terms of OnMeasureItem() because this // allows us to add borders to the items easily // // this function is not supposed to be overridden by the derived classes - virtual wxCoord OnGetRowHeight(size_t line) const; + virtual wxCoord OnGetLineHeight(size_t line) const; // event handlers @@ -241,15 +235,13 @@ protected: void OnKeyDown(wxKeyEvent& event); void OnLeftDown(wxMouseEvent& event); void OnLeftDClick(wxMouseEvent& event); - void OnSetOrKillFocus(wxFocusEvent& event); - void OnSize(wxSizeEvent& event); + // common part of all ctors void Init(); // send the wxEVT_COMMAND_LISTBOX_SELECTED event void SendSelectedEvent(); - virtual void InitEvent(wxCommandEvent& event, int n); // common implementation of SelectAll() and DeselectAll() bool DoSelectAll(bool select); @@ -272,14 +264,6 @@ protected: // common part of keyboard and mouse handling processing code void DoHandleItemClick(int item, int flags); - // paint the background of the given item using the provided colour if it's - // valid, otherwise just return false and do nothing (this is used by - // OnDrawBackground()) - bool DoDrawSolidBackground(const wxColour& col, - wxDC& dc, - const wxRect& rect, - size_t n) const; - private: // the current item or wxNOT_FOUND // @@ -304,7 +288,7 @@ private: wxColour m_colBgSel; DECLARE_EVENT_TABLE() - wxDECLARE_NO_COPY_CLASS(wxVListBox); + DECLARE_NO_COPY_CLASS(wxVListBox) DECLARE_ABSTRACT_CLASS(wxVListBox) }; diff --git a/Source/3rd Party/wx/include/wx/volume.h b/Source/3rd Party/wx/include/wx/volume.h index 40aa99beb..7a958b98a 100644 --- a/Source/3rd Party/wx/include/wx/volume.h +++ b/Source/3rd Party/wx/include/wx/volume.h @@ -4,13 +4,13 @@ // Author: George Policello // Modified by: // Created: 28 Jan 02 -// RCS-ID: $Id$ +// RCS-ID: $Id: volume.h 39399 2006-05-28 23:08:31Z ABX $ // Copyright: (c) 2002 George Policello // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// // ---------------------------------------------------------------------------- -// wxFSVolume represents a volume/drive in a file system +// wxFSVolume represents a volume/drive/mount point in a file system // ---------------------------------------------------------------------------- #ifndef _WX_FSVOLUME_H_ @@ -23,7 +23,7 @@ #include "wx/arrstr.h" // the volume flags -enum wxFSVolumeFlags +enum { // is the volume mounted? wxFS_VOL_MOUNTED = 0x0001, diff --git a/Source/3rd Party/wx/include/wx/vscroll.h b/Source/3rd Party/wx/include/wx/vscroll.h index 221e635ee..9063e108b 100644 --- a/Source/3rd Party/wx/include/wx/vscroll.h +++ b/Source/3rd Party/wx/include/wx/vscroll.h @@ -1,10 +1,10 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/vscroll.h -// Purpose: Variable scrolled windows (wx[V/H/HV]ScrolledWindow) +// Name: include/wx/vscroll.h +// Purpose: wxVScrolledWindow: generalization of wxScrolledWindow // Author: Vadim Zeitlin -// Modified by: Brad Anderson, Bryan Petty +// Modified by: // Created: 30.05.03 -// RCS-ID: $Id$ +// RCS-ID: $Id: vscroll.h 38917 2006-04-26 00:17:52Z VZ $ // Copyright: (c) 2003 Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -12,683 +12,34 @@ #ifndef _WX_VSCROLL_H_ #define _WX_VSCROLL_H_ -#include "wx/panel.h" -#include "wx/position.h" +#include "wx/panel.h" // base class -class WXDLLIMPEXP_FWD_CORE wxVarScrollHelperEvtHandler; - - -// Using the same techniques as the wxScrolledWindow class | -// hierarchy, the wx[V/H/HV]ScrolledWindow classes are slightly | -// more complex (compare with the diagram outlined in | -// scrolwin.h) for the purpose of reducing code duplication | -// through the use of mix-in classes. | -// | -// wxVarScrollHelperBase | -// / \ | -// / \ | -// V V | -// wxVarHScrollHelper wxVarVScrollHelper | -// | \ / | | -// | \ / | | -// | V V | | -// | wxVarHVScrollHelper | | -// | | | | -// | | V | -// | wxPanel | wxVarVScrollLegacyAdaptor | -// | / \ \ | | | -// | / \ `-----|----------. | | -// | / \ | \ | | -// | / \ | \ | | -// V V \ | V V | -// wxHScrolledWindow \ | wxVScrolledWindow | -// V V | -// wxHVScrolledWindow | -// | -// | -// Border added to suppress GCC multi-line comment warnings ->| - - -// =========================================================================== -// wxVarScrollHelperBase -// =========================================================================== - -// Provides all base common scroll calculations needed for either orientation, -// automatic scrollbar functionality, saved scroll positions, functionality -// for changing the target window to be scrolled, as well as defining all -// required virtual functions that need to be implemented for any orientation -// specific work. - -class WXDLLIMPEXP_CORE wxVarScrollHelperBase -{ -public: - // constructors and such - // --------------------- - - wxVarScrollHelperBase(wxWindow *winToScroll); - virtual ~wxVarScrollHelperBase(); - - // operations - // ---------- - - // with physical scrolling on, the device origin is changed properly when - // a wxPaintDC is prepared, children are actually moved and laid out - // properly, and the contents of the window (pixels) are actually moved - void EnablePhysicalScrolling(bool scrolling = true) - { m_physicalScrolling = scrolling; } - - // wxNOT_FOUND if none, i.e. if it is below the last item - int VirtualHitTest(wxCoord coord) const; - - // recalculate all our parameters and redisplay all units - virtual void RefreshAll(); - - // accessors - // --------- - - // get the first currently visible unit - size_t GetVisibleBegin() const { return m_unitFirst; } - - // get the last currently visible unit - size_t GetVisibleEnd() const - { return m_unitFirst + m_nUnitsVisible; } - - // is this unit currently visible? - bool IsVisible(size_t unit) const - { return unit >= m_unitFirst && unit < GetVisibleEnd(); } - - // translate between scrolled and unscrolled coordinates - int CalcScrolledPosition(int coord) const - { return DoCalcScrolledPosition(coord); } - int CalcUnscrolledPosition(int coord) const - { return DoCalcUnscrolledPosition(coord); } - - virtual int DoCalcScrolledPosition(int coord) const; - virtual int DoCalcUnscrolledPosition(int coord) const; - - // update the thumb size shown by the scrollbar - virtual void UpdateScrollbar(); - void RemoveScrollbar(); - - // Normally the wxScrolledWindow will scroll itself, but in some rare - // occasions you might want it to scroll [part of] another window (e.g. a - // child of it in order to scroll only a portion the area between the - // scrollbars (spreadsheet: only cell area will move). - virtual void SetTargetWindow(wxWindow *target); - virtual wxWindow *GetTargetWindow() const { return m_targetWindow; } - - // Override this function to draw the graphic (or just process EVT_PAINT) - //virtual void OnDraw(wxDC& WXUNUSED(dc)) { } - - // change the DC origin according to the scroll position. To properly - // forward calls to wxWindow::Layout use WX_FORWARD_TO_SCROLL_HELPER() - // derived class - virtual void DoPrepareDC(wxDC& dc); - - // the methods to be called from the window event handlers - void HandleOnScroll(wxScrollWinEvent& event); - void HandleOnSize(wxSizeEvent& event); -#if wxUSE_MOUSEWHEEL - void HandleOnMouseWheel(wxMouseEvent& event); -#endif // wxUSE_MOUSEWHEEL - - // these functions must be overidden in the derived class to return - // orientation specific data (e.g. the width for vertically scrolling - // derivatives in the case of GetOrientationTargetSize()) - virtual int GetOrientationTargetSize() const = 0; - virtual int GetNonOrientationTargetSize() const = 0; - virtual wxOrientation GetOrientation() const = 0; - -protected: - // all *Unit* functions are protected to be exposed by - // wxVarScrollHelperBase implementations (with appropriate names) - - // get the number of units this window contains (previously set by - // SetUnitCount()) - size_t GetUnitCount() const { return m_unitMax; } - - // set the number of units the helper contains: the derived class must - // provide the sizes for all units with indices up to the one given here - // in its OnGetUnitSize() - void SetUnitCount(size_t count); - - // redraw the specified unit - virtual void RefreshUnit(size_t unit); - - // redraw all units in the specified range (inclusive) - virtual void RefreshUnits(size_t from, size_t to); - - // scroll to the specified unit: it will become the first visible unit in - // the window - // - // return true if we scrolled the window, false if nothing was done - bool DoScrollToUnit(size_t unit); - - // scroll by the specified number of units/pages - virtual bool DoScrollUnits(int units); - virtual bool DoScrollPages(int pages); - - // this function must be overridden in the derived class and it should - // return the size of the given unit in pixels - virtual wxCoord OnGetUnitSize(size_t n) const = 0; - - // this function doesn't have to be overridden but it may be useful to do - // it if calculating the units' sizes is a relatively expensive operation - // as it gives the user code a possibility to calculate several of them at - // once - // - // OnGetUnitsSizeHint() is normally called just before OnGetUnitSize() but - // you shouldn't rely on the latter being called for all units in the - // interval specified here. It is also possible that OnGetUnitHeight() will - // be called for the units outside of this interval, so this is really just - // a hint, not a promise. - // - // finally note that unitMin is inclusive, while unitMax is exclusive, as - // usual - virtual void OnGetUnitsSizeHint(size_t WXUNUSED(unitMin), - size_t WXUNUSED(unitMax)) const - { } - - // when the number of units changes, we try to estimate the total size - // of all units which is a rather expensive operation in terms of unit - // access, so if the user code may estimate the average size - // better/faster than we do, it should override this function to implement - // its own logic - // - // this function should return the best guess for the total size it may - // make - virtual wxCoord EstimateTotalSize() const { return DoEstimateTotalSize(); } - - wxCoord DoEstimateTotalSize() const; - - // find the index of the unit we need to show to fit the specified unit on - // the opposite side either fully or partially (depending on fullyVisible) - size_t FindFirstVisibleFromLast(size_t last, - bool fullyVisible = false) const; - - // get the total size of the units between unitMin (inclusive) and - // unitMax (exclusive) - wxCoord GetUnitsSize(size_t unitMin, size_t unitMax) const; - - // get the offset of the first visible unit - wxCoord GetScrollOffset() const - { return GetUnitsSize(0, GetVisibleBegin()); } - - // get the size of the target window - wxSize GetTargetSize() const { return m_targetWindow->GetClientSize(); } - - void GetTargetSize(int *w, int *h) - { - wxSize size = GetTargetSize(); - if ( w ) - *w = size.x; - if ( h ) - *h = size.y; - } - - // calculate the new scroll position based on scroll event type - size_t GetNewScrollPosition(wxScrollWinEvent& event) const; - - // replacement implementation of wxWindow::Layout virtual method. To - // properly forward calls to wxWindow::Layout use - // WX_FORWARD_TO_SCROLL_HELPER() derived class - bool ScrollLayout(); - -#ifdef __WXMAC__ - // queue mac window update after handling scroll event - virtual void UpdateMacScrollWindow() { } -#endif // __WXMAC__ - - // change the target window - void DoSetTargetWindow(wxWindow *target); - - // delete the event handler we installed - void DeleteEvtHandler(); - - // helper function abstracting the orientation test: with vertical - // orientation, it assigns the first value to x and the second one to y, - // with horizontal orientation it reverses them, i.e. the first value is - // assigned to y and the second one to x - void AssignOrient(wxCoord& x, wxCoord& y, wxCoord first, wxCoord second); - - // similar to "oriented assignment" above but does "oriented increment": - // for vertical orientation, y is incremented by the given value and x if - // left unchanged, for horizontal orientation x is incremented - void IncOrient(wxCoord& x, wxCoord& y, wxCoord inc); - -private: - - // the window that receives the scroll events and the window to actually - // scroll, respectively - wxWindow *m_win, - *m_targetWindow; - - // the total number of (logical) units - size_t m_unitMax; - - // the total (estimated) size - wxCoord m_sizeTotal; - - // the first currently visible unit - size_t m_unitFirst; - - // the number of currently visible units (including the last, possibly only - // partly, visible one) - size_t m_nUnitsVisible; - - // accumulated mouse wheel rotation -#if wxUSE_MOUSEWHEEL - int m_sumWheelRotation; -#endif - - // do child scrolling (used in DoPrepareDC()) - bool m_physicalScrolling; - - // handler injected into target window to forward some useful events to us - wxVarScrollHelperEvtHandler *m_handler; -}; - - - -// =========================================================================== -// wxVarVScrollHelper -// =========================================================================== - -// Provides public API functions targeted for vertical-specific scrolling, -// wrapping the functionality of wxVarScrollHelperBase. - -class WXDLLIMPEXP_CORE wxVarVScrollHelper : public wxVarScrollHelperBase -{ -public: - // constructors and such - // --------------------- - - // ctor must be given the associated window - wxVarVScrollHelper(wxWindow *winToScroll) - : wxVarScrollHelperBase(winToScroll) - { - } - - // operators - - void SetRowCount(size_t rowCount) { SetUnitCount(rowCount); } - bool ScrollToRow(size_t row) { return DoScrollToUnit(row); } - - virtual bool ScrollRows(int rows) - { return DoScrollUnits(rows); } - virtual bool ScrollRowPages(int pages) - { return DoScrollPages(pages); } - - virtual void RefreshRow(size_t row) - { RefreshUnit(row); } - virtual void RefreshRows(size_t from, size_t to) - { RefreshUnits(from, to); } - - // accessors - - size_t GetRowCount() const { return GetUnitCount(); } - size_t GetVisibleRowsBegin() const { return GetVisibleBegin(); } - size_t GetVisibleRowsEnd() const { return GetVisibleEnd(); } - bool IsRowVisible(size_t row) const { return IsVisible(row); } - - virtual int GetOrientationTargetSize() const - { return GetTargetWindow()->GetClientSize().y; } - virtual int GetNonOrientationTargetSize() const - { return GetTargetWindow()->GetClientSize().x; } - virtual wxOrientation GetOrientation() const { return wxVERTICAL; } - -protected: - // this function must be overridden in the derived class and it should - // return the size of the given row in pixels - virtual wxCoord OnGetRowHeight(size_t n) const = 0; - wxCoord OnGetUnitSize(size_t n) const { return OnGetRowHeight(n); } - - virtual void OnGetRowsHeightHint(size_t WXUNUSED(rowMin), - size_t WXUNUSED(rowMax)) const { } - - // forward calls to OnGetRowsHeightHint() - virtual void OnGetUnitsSizeHint(size_t unitMin, size_t unitMax) const - { OnGetRowsHeightHint(unitMin, unitMax); } - - // again, if not overridden, it will fall back on default method - virtual wxCoord EstimateTotalHeight() const - { return DoEstimateTotalSize(); } - - // forward calls to EstimateTotalHeight() - virtual wxCoord EstimateTotalSize() const { return EstimateTotalHeight(); } - - wxCoord GetRowsHeight(size_t rowMin, size_t rowMax) const - { return GetUnitsSize(rowMin, rowMax); } -}; - - - -// =========================================================================== -// wxVarHScrollHelper -// =========================================================================== - -// Provides public API functions targeted for horizontal-specific scrolling, -// wrapping the functionality of wxVarScrollHelperBase. - -class WXDLLIMPEXP_CORE wxVarHScrollHelper : public wxVarScrollHelperBase -{ -public: - // constructors and such - // --------------------- - - // ctor must be given the associated window - wxVarHScrollHelper(wxWindow *winToScroll) - : wxVarScrollHelperBase(winToScroll) - { - } - - // operators - - void SetColumnCount(size_t columnCount) - { SetUnitCount(columnCount); } - - bool ScrollToColumn(size_t column) - { return DoScrollToUnit(column); } - virtual bool ScrollColumns(int columns) - { return DoScrollUnits(columns); } - virtual bool ScrollColumnPages(int pages) - { return DoScrollPages(pages); } - - virtual void RefreshColumn(size_t column) - { RefreshUnit(column); } - virtual void RefreshColumns(size_t from, size_t to) - { RefreshUnits(from, to); } - - // accessors - - size_t GetColumnCount() const - { return GetUnitCount(); } - size_t GetVisibleColumnsBegin() const - { return GetVisibleBegin(); } - size_t GetVisibleColumnsEnd() const - { return GetVisibleEnd(); } - bool IsColumnVisible(size_t column) const - { return IsVisible(column); } - - - virtual int GetOrientationTargetSize() const - { return GetTargetWindow()->GetClientSize().x; } - virtual int GetNonOrientationTargetSize() const - { return GetTargetWindow()->GetClientSize().y; } - virtual wxOrientation GetOrientation() const { return wxHORIZONTAL; } - -protected: - // this function must be overridden in the derived class and it should - // return the size of the given column in pixels - virtual wxCoord OnGetColumnWidth(size_t n) const = 0; - wxCoord OnGetUnitSize(size_t n) const { return OnGetColumnWidth(n); } - - virtual void OnGetColumnsWidthHint(size_t WXUNUSED(columnMin), - size_t WXUNUSED(columnMax)) const - { } - - // forward calls to OnGetColumnsWidthHint() - virtual void OnGetUnitsSizeHint(size_t unitMin, size_t unitMax) const - { OnGetColumnsWidthHint(unitMin, unitMax); } - - // again, if not overridden, it will fall back on default method - virtual wxCoord EstimateTotalWidth() const { return DoEstimateTotalSize(); } - - // forward calls to EstimateTotalWidth() - virtual wxCoord EstimateTotalSize() const { return EstimateTotalWidth(); } - - wxCoord GetColumnsWidth(size_t columnMin, size_t columnMax) const - { return GetUnitsSize(columnMin, columnMax); } -}; - - - -// =========================================================================== -// wxVarHVScrollHelper -// =========================================================================== - -// Provides public API functions targeted at functions with similar names in -// both wxVScrollHelper and wxHScrollHelper so class scope doesn't need to be -// specified (since we are using multiple inheritance). It also provides -// functions to make changing values for both orientations at the same time -// easier. - -class WXDLLIMPEXP_CORE wxVarHVScrollHelper : public wxVarVScrollHelper, - public wxVarHScrollHelper -{ -public: - // constructors and such - // --------------------- - - // ctor must be given the associated window - wxVarHVScrollHelper(wxWindow *winToScroll) - : wxVarVScrollHelper(winToScroll), wxVarHScrollHelper(winToScroll) { } - - // operators - // --------- - - // set the number of units the window contains for each axis: the derived - // class must provide the widths and heights for all units with indices up - // to each of the one given here in its OnGetColumnWidth() and - // OnGetRowHeight() - void SetRowColumnCount(size_t rowCount, size_t columnCount); - - - // with physical scrolling on, the device origin is changed properly when - // a wxPaintDC is prepared, children are actually moved and laid out - // properly, and the contents of the window (pixels) are actually moved - void EnablePhysicalScrolling(bool vscrolling = true, bool hscrolling = true) - { - wxVarVScrollHelper::EnablePhysicalScrolling(vscrolling); - wxVarHScrollHelper::EnablePhysicalScrolling(hscrolling); - } - - // scroll to the specified row/column: it will become the first visible - // cell in the window - // - // return true if we scrolled the window, false if nothing was done - bool ScrollToRowColumn(size_t row, size_t column); - bool ScrollToRowColumn(const wxPosition &pos) - { return ScrollToRowColumn(pos.GetRow(), pos.GetColumn()); } - - // redraw the specified cell - virtual void RefreshRowColumn(size_t row, size_t column); - virtual void RefreshRowColumn(const wxPosition &pos) - { RefreshRowColumn(pos.GetRow(), pos.GetColumn()); } - - // redraw the specified regions (inclusive). If the target window for - // both orientations is the same the rectangle of cells is refreshed; if - // the target windows differ the entire client size opposite the - // orientation direction is refreshed between the specified limits - virtual void RefreshRowsColumns(size_t fromRow, size_t toRow, - size_t fromColumn, size_t toColumn); - virtual void RefreshRowsColumns(const wxPosition& from, - const wxPosition& to) - { - RefreshRowsColumns(from.GetRow(), to.GetRow(), - from.GetColumn(), to.GetColumn()); - } - - // locate the virtual position from the given device coordinates - wxPosition VirtualHitTest(wxCoord x, wxCoord y) const; - wxPosition VirtualHitTest(const wxPoint &pos) const - { return VirtualHitTest(pos.x, pos.y); } - - // change the DC origin according to the scroll position. To properly - // forward calls to wxWindow::Layout use WX_FORWARD_TO_SCROLL_HELPER() - // derived class. We use this version to call both base classes' - // DoPrepareDC() - virtual void DoPrepareDC(wxDC& dc); - - // replacement implementation of wxWindow::Layout virtual method. To - // properly forward calls to wxWindow::Layout use - // WX_FORWARD_TO_SCROLL_HELPER() derived class. We use this version to - // call both base classes' ScrollLayout() - bool ScrollLayout(); - - // accessors - // --------- - - // get the number of units this window contains (previously set by - // Set[Column/Row/RowColumn/Unit]Count()) - wxSize GetRowColumnCount() const; - - // get the first currently visible units - wxPosition GetVisibleBegin() const; - wxPosition GetVisibleEnd() const; - - // is this cell currently visible? - bool IsVisible(size_t row, size_t column) const; - bool IsVisible(const wxPosition &pos) const - { return IsVisible(pos.GetRow(), pos.GetColumn()); } -}; - - - -#if WXWIN_COMPATIBILITY_2_8 - -// =========================================================================== -// wxVarVScrollLegacyAdaptor -// =========================================================================== - -// Provides backwards compatible API for applications originally built using -// wxVScrolledWindow in 2.6 or 2.8. Originally, wxVScrolledWindow referred -// to scrolling "lines". We use "units" in wxVarScrollHelperBase to avoid -// implying any orientation (since the functions are used for both horizontal -// and vertical scrolling in derived classes). And in the new -// wxVScrolledWindow and wxHScrolledWindow classes, we refer to them as -// "rows" and "columns", respectively. This is to help clear some confusion -// in not only those classes, but also in wxHVScrolledWindow where functions -// are inherited from both. - -class WXDLLIMPEXP_CORE wxVarVScrollLegacyAdaptor : public wxVarVScrollHelper -{ -public: - // constructors and such - // --------------------- - wxVarVScrollLegacyAdaptor(wxWindow *winToScroll) - : wxVarVScrollHelper(winToScroll) - { - } - - // accessors - // --------- - - // this is the same as GetVisibleRowsBegin(), exists to match - // GetLastVisibleLine() and for backwards compatibility only - wxDEPRECATED( size_t GetFirstVisibleLine() const ); - - // get the last currently visible line - // - // this function is unsafe as it returns (size_t)-1 (i.e. a huge positive - // number) if the control is empty, use GetVisibleRowsEnd() instead, this - // one is kept for backwards compatibility - wxDEPRECATED( size_t GetLastVisibleLine() const ); - - // "line" to "unit" compatibility functions - // ---------------------------------------- - - // get the number of lines this window contains (set by SetLineCount()) - wxDEPRECATED( size_t GetLineCount() const ); - - // set the number of lines the helper contains: the derived class must - // provide the sizes for all lines with indices up to the one given here - // in its OnGetLineHeight() - wxDEPRECATED( void SetLineCount(size_t count) ); - - // redraw the specified line - wxDEPRECATED( virtual void RefreshLine(size_t line) ); - - // redraw all lines in the specified range (inclusive) - wxDEPRECATED( virtual void RefreshLines(size_t from, size_t to) ); - - // scroll to the specified line: it will become the first visible line in - // the window - // - // return true if we scrolled the window, false if nothing was done - wxDEPRECATED( bool ScrollToLine(size_t line) ); - - // scroll by the specified number of lines/pages - wxDEPRECATED( virtual bool ScrollLines(int lines) ); - wxDEPRECATED( virtual bool ScrollPages(int pages) ); - -protected: - // unless the code has been updated to override OnGetRowHeight() instead, - // this function must be overridden in the derived class and it should - // return the height of the given row in pixels - wxDEPRECATED_BUT_USED_INTERNALLY( - virtual wxCoord OnGetLineHeight(size_t n) const ); - - // forwards the calls from base class pure virtual function to pure virtual - // OnGetLineHeight instead (backwards compatible name) - // note that we don't need to forward OnGetUnitSize() as it is already - // forwarded to OnGetRowHeight() in wxVarVScrollHelper - virtual wxCoord OnGetRowHeight(size_t n) const; - - // this function doesn't have to be overridden but it may be useful to do - // it if calculating the lines heights is a relatively expensive operation - // as it gives the user code a possibility to calculate several of them at - // once - // - // OnGetLinesHint() is normally called just before OnGetLineHeight() but you - // shouldn't rely on the latter being called for all lines in the interval - // specified here. It is also possible that OnGetLineHeight() will be - // called for the lines outside of this interval, so this is really just a - // hint, not a promise. - // - // finally note that lineMin is inclusive, while lineMax is exclusive, as - // usual - wxDEPRECATED_BUT_USED_INTERNALLY( virtual void OnGetLinesHint( - size_t lineMin, size_t lineMax) const ); - - // forwards the calls from base class pure virtual function to pure virtual - // OnGetLinesHint instead (backwards compatible name) - void OnGetRowsHeightHint(size_t rowMin, size_t rowMax) const; -}; - -#else // !WXWIN_COMPATIBILITY_2_8 - -// shortcut to avoid checking compatibility modes later -// remove this and all references to wxVarVScrollLegacyAdaptor once -// wxWidgets 2.6 and 2.8 compatibility is removed -typedef wxVarVScrollHelper wxVarVScrollLegacyAdaptor; - -#endif // WXWIN_COMPATIBILITY_2_8/!WXWIN_COMPATIBILITY_2_8 - - -// this macro must be used in declaration of wxVarScrollHelperBase-derived -// classes -#define WX_FORWARD_TO_VAR_SCROLL_HELPER() \ -public: \ - virtual void PrepareDC(wxDC& dc) { DoPrepareDC(dc); } \ - virtual bool Layout() { return ScrollLayout(); } - - - -// =========================================================================== +// ---------------------------------------------------------------------------- // wxVScrolledWindow -// =========================================================================== +// ---------------------------------------------------------------------------- -// In the name of this class, "V" may stand for "variable" because it can be -// used for scrolling rows of variable heights; "virtual", because it is not -// necessary to know the heights of all rows in advance -- only those which -// are shown on the screen need to be measured; or even "vertical", because -// this class only supports scrolling vertically. +/* + In the name of this class, "V" may stand for "variable" because it can be + used for scrolling lines of variable heights; "virtual" because it is not + necessary to know the heights of all lines in advance -- only those which + are shown on the screen need to be measured; or, even, "vertical" because + this class only supports scrolling in one direction currently (this could + and probably will change in the future however). -// In any case, this is a generalization of the wxScrolledWindow class which -// can be only used when all rows have the same heights. It lacks some other -// wxScrolledWindow features however, notably it can't scroll only a rectangle -// of the window and not its entire client area. - -class WXDLLIMPEXP_CORE wxVScrolledWindow : public wxPanel, - public wxVarVScrollLegacyAdaptor + In any case, this is a generalization of the wxScrolledWindow class which + can be only used when all lines have the same height. It lacks some other + wxScrolledWindow features however, notably it currently lacks support for + horizontal scrolling; it can't scroll another window nor only a rectangle + of the window and not its entire client area. + */ +class WXDLLEXPORT wxVScrolledWindow : public wxPanel { public: // constructors and such // --------------------- // default ctor, you must call Create() later - wxVScrolledWindow() : wxVarVScrollLegacyAdaptor(this) { } + wxVScrolledWindow() { Init(); } // normal ctor, no need to call Create() after this one // @@ -700,8 +51,9 @@ public: const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = wxPanelNameStr) - : wxVarVScrollLegacyAdaptor(this) { + Init(); + (void)Create(parent, id, pos, size, style, name); } @@ -719,158 +71,153 @@ public: return wxPanel::Create(parent, id, pos, size, style | wxVSCROLL, name); } -#if WXWIN_COMPATIBILITY_2_8 - // Make sure we prefer our version of HitTest rather than wxWindow's - // These functions should no longer be masked in favor of VirtualHitTest() - int HitTest(wxCoord WXUNUSED(x), wxCoord y) const - { return wxVarVScrollHelper::VirtualHitTest(y); } - int HitTest(const wxPoint& pt) const - { return HitTest(pt.x, pt.y); } -#endif // WXWIN_COMPATIBILITY_2_8 - WX_FORWARD_TO_VAR_SCROLL_HELPER() + // operations + // ---------- + + // set the number of lines the window contains: the derived class must + // provide the heights for all lines with indices up to the one given here + // in its OnGetLineHeight() + void SetLineCount(size_t count); + + // scroll to the specified line: it will become the first visible line in + // the window + // + // return true if we scrolled the window, false if nothing was done + bool ScrollToLine(size_t line); + + // scroll by the specified number of lines/pages + virtual bool ScrollLines(int lines); + virtual bool ScrollPages(int pages); + + // redraw the specified line + virtual void RefreshLine(size_t line); + + // redraw all lines in the specified range (inclusive) + virtual void RefreshLines(size_t from, size_t to); + + // return the item at the specified (in physical coordinates) position or. + + // wxNOT_FOUND if none, i.e. if it is below the last item + int HitTest(wxCoord x, wxCoord y) const; + int HitTest(const wxPoint& pt) const { return HitTest(pt.x, pt.y); } + + // recalculate all our parameters and redisplay all lines + virtual void RefreshAll(); + + + // accessors + // --------- + + // get the number of lines this window contains (previously set by + // SetLineCount()) + size_t GetLineCount() const { return m_lineMax; } + + // get the first currently visible line + size_t GetVisibleBegin() const { return m_lineFirst; } + + // get the first currently visible line + size_t GetVisibleEnd() const { return m_lineFirst + m_nVisible; } + + // is this line currently visible? + bool IsVisible(size_t line) const + { return line >= GetVisibleBegin() && line < GetVisibleEnd(); } + + + // this is the same as GetVisibleBegin(), exists to match + // GetLastVisibleLine() and for backwards compatibility only + size_t GetFirstVisibleLine() const { return m_lineFirst; } + + // get the last currently visible line + // + // this function is unsafe as it returns (size_t)-1 (i.e. a huge positive + // number) if the control is empty, use GetVisibleEnd() instead, this one + // is kept for backwards compatibility + size_t GetLastVisibleLine() const { return GetVisibleEnd() - 1; } + + // layout the children (including the sizer if needed) + virtual bool Layout(); -#ifdef __WXMAC__ protected: - virtual void UpdateMacScrollWindow() { Update(); } -#endif // __WXMAC__ + // this function must be overridden in the derived class and it should + // return the height of the given line in pixels + virtual wxCoord OnGetLineHeight(size_t n) const = 0; + + // this function doesn't have to be overridden but it may be useful to do + // it if calculating the lines heights is a relatively expensive operation + // as it gives the user code a possibility to calculate several of them at + // once + // + // OnGetLinesHint() is normally called just before OnGetLineHeight() but you + // shouldn't rely on the latter being called for all lines in the interval + // specified here. It is also possible that OnGetLineHeight() will be + // called for the lines outside of this interval, so this is really just a + // hint, not a promise. + // + // finally note that lineMin is inclusive, while lineMax is exclusive, as + // usual + virtual void OnGetLinesHint(size_t WXUNUSED(lineMin), + size_t WXUNUSED(lineMax)) const { } + + // when the number of lines changes, we try to estimate the total height + // of all lines which is a rather expensive operation in terms of lines + // access, so if the user code may estimate the average height + // better/faster than we do, it should override this function to implement + // its own logic + // + // this function should return the best guess for the total height it may + // make + virtual wxCoord EstimateTotalHeight() const; + + + // the event handlers + void OnSize(wxSizeEvent& event); + void OnScroll(wxScrollWinEvent& event); +#if wxUSE_MOUSEWHEEL + void OnMouseWheel(wxMouseEvent& event); +#endif + + // find the index of the line we need to show at the top of the window such + // that the last (fully or partially) visible line is the given one + size_t FindFirstFromBottom(size_t lineLast, bool fullyVisible = false); + + // get the total height of the lines between lineMin (inclusive) and + // lineMax (exclusive) + wxCoord GetLinesHeight(size_t lineMin, size_t lineMax) const; + + // update the thumb size shown by the scrollbar + void UpdateScrollbar(); + + // remove the scrollbar completely because we don't need it + void RemoveScrollbar(); private: - wxDECLARE_NO_COPY_CLASS(wxVScrolledWindow); + // common part of all ctors + void Init(); + + + // the total number of (logical) lines + size_t m_lineMax; + + // the total (estimated) height + wxCoord m_heightTotal; + + // the first currently visible line + size_t m_lineFirst; + + // the number of currently visible lines (including the last, possibly only + // partly, visible one) + size_t m_nVisible; + + // accumulated mouse wheel rotation +#if wxUSE_MOUSEWHEEL + int m_sumWheelRotation; +#endif + + DECLARE_EVENT_TABLE() + DECLARE_NO_COPY_CLASS(wxVScrolledWindow) DECLARE_ABSTRACT_CLASS(wxVScrolledWindow) }; - - -// =========================================================================== -// wxHScrolledWindow -// =========================================================================== - -// In the name of this class, "H" stands for "horizontal" because it can be -// used for scrolling columns of variable widths. It is not necessary to know -// the widths of all columns in advance -- only those which are shown on the -// screen need to be measured. - -// This is a generalization of the wxScrolledWindow class which can be only -// used when all columns have the same width. It lacks some other -// wxScrolledWindow features however, notably it can't scroll only a rectangle -// of the window and not its entire client area. - -class WXDLLIMPEXP_CORE wxHScrolledWindow : public wxPanel, - public wxVarHScrollHelper -{ -public: - // constructors and such - // --------------------- - - // default ctor, you must call Create() later - wxHScrolledWindow() : wxVarHScrollHelper(this) { } - - // normal ctor, no need to call Create() after this one - // - // note that wxHSCROLL is always automatically added to our style, there is - // no need to specify it explicitly - wxHScrolledWindow(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxPanelNameStr) - : wxVarHScrollHelper(this) - { - (void)Create(parent, id, pos, size, style, name); - } - - // same as the previous ctor but returns status code: true if ok - // - // just as with the ctor above, wxHSCROLL style is always used, there is no - // need to specify it - bool Create(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxPanelNameStr) - { - return wxPanel::Create(parent, id, pos, size, style | wxHSCROLL, name); - } - - WX_FORWARD_TO_VAR_SCROLL_HELPER() - -#ifdef __WXMAC__ -protected: - virtual void UpdateMacScrollWindow() { Update(); } -#endif // __WXMAC__ - -private: - wxDECLARE_NO_COPY_CLASS(wxHScrolledWindow); - DECLARE_ABSTRACT_CLASS(wxHScrolledWindow) -}; - - - -// =========================================================================== -// wxHVScrolledWindow -// =========================================================================== - -// This window inherits all functionality of both vertical and horizontal -// scrolled windows automatically handling everything needed to scroll both -// axis simultaneously. - -class WXDLLIMPEXP_CORE wxHVScrolledWindow : public wxPanel, - public wxVarHVScrollHelper -{ -public: - // constructors and such - // --------------------- - - // default ctor, you must call Create() later - wxHVScrolledWindow() - : wxPanel(), - wxVarHVScrollHelper(this) { } - - // normal ctor, no need to call Create() after this one - // - // note that wxVSCROLL and wxHSCROLL are always automatically added to our - // style, there is no need to specify them explicitly - wxHVScrolledWindow(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxPanelNameStr) - : wxPanel(), - wxVarHVScrollHelper(this) - { - (void)Create(parent, id, pos, size, style, name); - } - - // same as the previous ctor but returns status code: true if ok - // - // just as with the ctor above, wxVSCROLL and wxHSCROLL styles are always - // used, there is no need to specify them - bool Create(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxPanelNameStr) - { - return wxPanel::Create(parent, id, pos, size, - style | wxVSCROLL | wxHSCROLL, name); - } - - WX_FORWARD_TO_VAR_SCROLL_HELPER() - -#ifdef __WXMAC__ -protected: - virtual void UpdateMacScrollWindow() { Update(); } -#endif // __WXMAC__ - -private: - wxDECLARE_NO_COPY_CLASS(wxHVScrolledWindow); - DECLARE_ABSTRACT_CLASS(wxHVScrolledWindow) -}; - #endif // _WX_VSCROLL_H_ diff --git a/Source/3rd Party/wx/include/wx/weakref.h b/Source/3rd Party/wx/include/wx/weakref.h deleted file mode 100644 index 4558b110c..000000000 --- a/Source/3rd Party/wx/include/wx/weakref.h +++ /dev/null @@ -1,353 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/weakref.h -// Purpose: wxWeakRef - Generic weak references for wxWidgets -// Author: Arne Steinarson -// Created: 27 Dec 07 -// RCS-ID: $Id$ -// Copyright: (c) 2007 Arne Steinarson -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_WEAKREF_H_ -#define _WX_WEAKREF_H_ - -#include "wx/tracker.h" - - -// Some compilers (VC6, Borland, g++ < 3.3) have problem with template specialization. -// However, this is only used for optimization purposes (a smaller wxWeakRef pointer) -// (and the corner case of wxWeakRef). So for those compilers, we can fall -// back to the non-optimal case, where we use the same type of weak ref (static one) -// in all cases. See defs.h for various setting these defines depending on compiler. - -#if !defined(HAVE_PARTIAL_SPECIALIZATION) || \ - !defined(HAVE_TEMPLATE_OVERLOAD_RESOLUTION) || \ - (defined(__GNUC__) && !wxCHECK_GCC_VERSION(3, 3)) - #define USE_ONLY_STATIC_WEAKREF -#endif - - -#ifndef USE_ONLY_STATIC_WEAKREF - -// Avoid including this for simpler compilers -#include "wx/meta/convertible.h" -#include "wx/meta/int2type.h" - -template -struct wxIsStaticTrackable -{ - enum { value = wxConvertibleTo::value }; -}; - -#endif // !USE_ONLY_STATIC_WEAKREF - - -// Weak ref implementation when T has wxTrackable as a known base class -template -class wxWeakRefStatic : public wxTrackerNode -{ -public: - wxWeakRefStatic() : m_pobj(NULL) { } - - void Release() - { - // Release old object if any - if ( m_pobj ) - { - // Remove ourselves from object tracker list - wxTrackable *pt = static_cast(m_pobj); - pt->RemoveNode(this); - m_pobj = NULL; - } - } - - virtual void OnObjectDestroy() - { - // Tracked object itself removes us from list of trackers - wxASSERT(m_pobj != NULL); - m_pobj = NULL; - } - -protected: - void Assign(T* pobj) - { - if ( m_pobj == pobj ) - return; - - Release(); - - // Now set new trackable object - if ( pobj ) - { - // Add ourselves to object tracker list - wxTrackable *pt = static_cast(pobj); - pt->AddNode(this); - m_pobj = pobj; - } - } - - void AssignCopy(const wxWeakRefStatic& wr) - { - Assign( wr.m_pobj ); - } - - T *m_pobj; -}; - - - -#ifndef USE_ONLY_STATIC_WEAKREF - -template -struct wxWeakRefImpl; - -// Intermediate class, to select the static case above. -template -struct wxWeakRefImpl : public wxWeakRefStatic -{ - enum { value = 1 }; -}; - -// Weak ref implementation when T does not have wxTrackable as known base class -template -struct wxWeakRefImpl : public wxTrackerNode -{ - void Release() - { - // Release old object if any - if ( m_pobj ) - { - // Remove ourselves from object tracker list - m_ptbase->RemoveNode(this); - m_pobj = NULL; - m_ptbase = NULL; - } - } - - virtual void OnObjectDestroy() - { - // Tracked object itself removes us from list of trackers - wxASSERT(m_pobj != NULL); - m_pobj = NULL; - m_ptbase = NULL; - } - -protected: - wxWeakRefImpl() : m_pobj(NULL), m_ptbase(NULL) { } - - // Assign receives most derived class here and can use that - template - void Assign( TDerived* pobj ) - { - AssignHelper( pobj, wxInt2Type::value>() ); - } - - template - void AssignHelper(TDerived* pobj, wxInt2Type) - { - wxTrackable *ptbase = static_cast(pobj); - DoAssign( pobj, ptbase ); - } - -#ifndef wxNO_RTTI - void AssignHelper(T* pobj, wxInt2Type) - { - // A last way to get a trackable pointer - wxTrackable *ptbase = dynamic_cast(pobj); - if ( ptbase ) - { - DoAssign( pobj, ptbase ); - } - else - { - wxFAIL_MSG( "Tracked class should inherit from wxTrackable" ); - - Release(); - } - } -#endif // RTTI enabled - - void AssignCopy(const wxWeakRefImpl& wr) - { - DoAssign(wr.m_pobj, wr.m_ptbase); - } - - void DoAssign( T* pobj, wxTrackable *ptbase ) { - if( m_pobj==pobj ) return; - Release(); - - // Now set new trackable object - if( pobj ) - { - // Add ourselves to object tracker list - wxASSERT( ptbase ); - ptbase->AddNode( this ); - m_pobj = pobj; - m_ptbase = ptbase; - } - } - - T *m_pobj; - wxTrackable *m_ptbase; -}; - -#endif // #ifndef USE_ONLY_STATIC_WEAKREF - - - -// A weak reference to an object of type T, where T has base wxTrackable -// (usually statically but if not dynamic_cast<> is tried). -template -class wxWeakRef : public -#ifdef USE_ONLY_STATIC_WEAKREF - wxWeakRefStatic -#else - wxWeakRefImpl::value != 0> -#endif -{ -public: - typedef T element_type; - - // Default ctor - wxWeakRef() { } - - // Enabling this ctor for VC6 results in mysterious compilation failures in - // wx/window.h when assigning wxWindow pointers (FIXME-VC6) -#ifndef __VISUALC6__ - // Ctor from the object of this type: this is needed as the template ctor - // below is not used by at least g++4 when a literal NULL is used - wxWeakRef(T *pobj) - { - this->Assign(pobj); - } -#endif // !__VISUALC6__ - - // When we have the full type here, static_cast<> will always work - // (or give a straight compiler error). - template - wxWeakRef(TDerived* pobj) - { - this->Assign(pobj); - } - - // We need this copy ctor, since otherwise a default compiler (binary) copy - // happens (if embedded as an object member). - wxWeakRef(const wxWeakRef& wr) - { - this->Assign(wr.get()); - } - - wxWeakRef& operator=(const wxWeakRef& wr) - { - this->AssignCopy(wr); - return *this; - } - - virtual ~wxWeakRef() { this->Release(); } - - // Smart pointer functions - T& operator*() const { return *this->m_pobj; } - T* operator->() const { return this->m_pobj; } - - T* get() const { return this->m_pobj; } - operator T*() const { return this->m_pobj; } -}; - - -#ifndef wxNO_RTTI - -// Weak ref implementation assign objects are queried for wxTrackable -// using dynamic_cast<> -template -class wxWeakRefDynamic : public wxTrackerNode -{ -public: - wxWeakRefDynamic() : m_pobj(NULL) { } - - wxWeakRefDynamic(T* pobj) : m_pobj(pobj) - { - Assign(pobj); - } - - wxWeakRefDynamic(const wxWeakRef& wr) - { - Assign(wr.get()); - } - - virtual ~wxWeakRefDynamic() { Release(); } - - // Smart pointer functions - T& operator*() const { wxASSERT(m_pobj); return *m_pobj; } - T* operator->() const { wxASSERT(m_pobj); return m_pobj; } - - T* get() const { return m_pobj; } - operator T* () const { return m_pobj; } - - T* operator = (T* pobj) { Assign(pobj); return m_pobj; } - - // Assign from another weak ref, point to same object - T* operator = (const wxWeakRef &wr) { Assign( wr.get() ); return m_pobj; } - - void Release() - { - // Release old object if any - if( m_pobj ) - { - // Remove ourselves from object tracker list - wxTrackable *pt = dynamic_cast(m_pobj); - wxASSERT(pt); - pt->RemoveNode(this); - m_pobj = NULL; - } - } - - virtual void OnObjectDestroy() - { - wxASSERT_MSG(m_pobj, "tracked object should have removed us itself"); - - m_pobj = NULL; - } - -protected: - void Assign(T *pobj) - { - if ( m_pobj == pobj ) - return; - - Release(); - - // Now set new trackable object - if ( pobj ) - { - // Add ourselves to object tracker list - wxTrackable *pt = dynamic_cast(pobj); - if ( pt ) - { - pt->AddNode(this); - m_pobj = pobj; - } - else - { - // If the object we want to track does not support wxTackable, then - // log a message and keep the NULL object pointer. - wxFAIL_MSG( "Tracked class should inherit from wxTrackable" ); - } - } - } - - T *m_pobj; -}; - -#endif // RTTI enabled - - -// Provide some basic types of weak references -class WXDLLIMPEXP_FWD_BASE wxEvtHandler; -class WXDLLIMPEXP_FWD_CORE wxWindow; - - -typedef wxWeakRef wxEvtHandlerRef; -typedef wxWeakRef wxWindowRef; - -#endif // _WX_WEAKREF_H_ - diff --git a/Source/3rd Party/wx/include/wx/wfstream.h b/Source/3rd Party/wx/include/wx/wfstream.h index 1454683a8..ead92d641 100644 --- a/Source/3rd Party/wx/include/wx/wfstream.h +++ b/Source/3rd Party/wx/include/wx/wfstream.h @@ -4,7 +4,7 @@ // Author: Guilhem Lavaux // Modified by: // Created: 11/07/98 -// RCS-ID: $Id$ +// RCS-ID: $Id: wfstream.h 61872 2009-09-09 22:37:05Z VZ $ // Copyright: (c) Guilhem Lavaux // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -53,7 +53,7 @@ protected: wxFile *m_file; bool m_file_destroy; - wxDECLARE_NO_COPY_CLASS(wxFileInputStream); + DECLARE_NO_COPY_CLASS(wxFileInputStream) }; class WXDLLIMPEXP_BASE wxFileOutputStream : public wxOutputStream @@ -83,7 +83,7 @@ protected: wxFile *m_file; bool m_file_destroy; - wxDECLARE_NO_COPY_CLASS(wxFileOutputStream); + DECLARE_NO_COPY_CLASS(wxFileOutputStream) }; class WXDLLIMPEXP_BASE wxTempFileOutputStream : public wxOutputStream @@ -93,8 +93,8 @@ public: virtual ~wxTempFileOutputStream(); bool Close() { return Commit(); } - WXDLLIMPEXP_INLINE_BASE virtual bool Commit() { return m_file->Commit(); } - WXDLLIMPEXP_INLINE_BASE virtual void Discard() { m_file->Discard(); } + virtual bool Commit() { return m_file->Commit(); } + virtual void Discard() { m_file->Discard(); } wxFileOffset GetLength() const { return m_file->Length(); } bool IsSeekable() const { return true; } @@ -108,7 +108,7 @@ protected: private: wxTempFile *m_file; - wxDECLARE_NO_COPY_CLASS(wxTempFileOutputStream); + DECLARE_NO_COPY_CLASS(wxTempFileOutputStream) }; class WXDLLIMPEXP_BASE wxFileStream : public wxFileInputStream, @@ -116,35 +116,9 @@ class WXDLLIMPEXP_BASE wxFileStream : public wxFileInputStream, { public: wxFileStream(const wxString& fileName); - virtual bool IsOk() const; - - // override (some) virtual functions inherited from both classes to resolve - // ambiguities (this wouldn't be necessary if wxStreamBase were a virtual - // base class but it isn't) - - virtual bool IsSeekable() const - { - return wxFileInputStream::IsSeekable(); - } - - virtual wxFileOffset GetLength() const - { - return wxFileInputStream::GetLength(); - } - -protected: - virtual wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode) - { - return wxFileInputStream::OnSysSeek(pos, mode); - } - - virtual wxFileOffset OnSysTell() const - { - return wxFileInputStream::OnSysTell(); - } private: - wxDECLARE_NO_COPY_CLASS(wxFileStream); + DECLARE_NO_COPY_CLASS(wxFileStream) }; #endif //wxUSE_FILE @@ -158,7 +132,7 @@ private: class WXDLLIMPEXP_BASE wxFFileInputStream : public wxInputStream { public: - wxFFileInputStream(const wxString& fileName, const wxString& mode = "rb"); + wxFFileInputStream(const wxString& fileName, const wxChar *mode = wxT("rb")); wxFFileInputStream(wxFFile& file); wxFFileInputStream(FILE *file); virtual ~wxFFileInputStream(); @@ -180,13 +154,13 @@ protected: wxFFile *m_file; bool m_file_destroy; - wxDECLARE_NO_COPY_CLASS(wxFFileInputStream); + DECLARE_NO_COPY_CLASS(wxFFileInputStream) }; class WXDLLIMPEXP_BASE wxFFileOutputStream : public wxOutputStream { public: - wxFFileOutputStream(const wxString& fileName, const wxString& mode = "wb"); + wxFFileOutputStream(const wxString& fileName, const wxChar *mode = wxT("w+b")); wxFFileOutputStream(wxFFile& file); wxFFileOutputStream(FILE *file); virtual ~wxFFileOutputStream(); @@ -196,7 +170,7 @@ public: wxFileOffset GetLength() const; bool Ok() const { return IsOk(); } - virtual bool IsOk() const; + virtual bool IsOk() const ; bool IsSeekable() const { return m_file->GetKind() == wxFILE_KIND_DISK; } protected: @@ -210,43 +184,17 @@ protected: wxFFile *m_file; bool m_file_destroy; - wxDECLARE_NO_COPY_CLASS(wxFFileOutputStream); + DECLARE_NO_COPY_CLASS(wxFFileOutputStream) }; class WXDLLIMPEXP_BASE wxFFileStream : public wxFFileInputStream, public wxFFileOutputStream { public: - wxFFileStream(const wxString& fileName, const wxString& mode = "w+b"); - - // override some virtual functions to resolve ambiguities, just as in - // wxFileStream - - virtual bool IsOk() const; - - virtual bool IsSeekable() const - { - return wxFFileInputStream::IsSeekable(); - } - - virtual wxFileOffset GetLength() const - { - return wxFFileInputStream::GetLength(); - } - -protected: - virtual wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode) - { - return wxFFileInputStream::OnSysSeek(pos, mode); - } - - virtual wxFileOffset OnSysTell() const - { - return wxFFileInputStream::OnSysTell(); - } + wxFFileStream(const wxString& fileName); private: - wxDECLARE_NO_COPY_CLASS(wxFFileStream); + DECLARE_NO_COPY_CLASS(wxFFileStream) }; #endif //wxUSE_FFILE diff --git a/Source/3rd Party/wx/include/wx/window.h b/Source/3rd Party/wx/include/wx/window.h index ed74d891d..fc9e13e88 100644 --- a/Source/3rd Party/wx/include/wx/window.h +++ b/Source/3rd Party/wx/include/wx/window.h @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: Ron Lee // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: window.h 56758 2008-11-13 22:32:21Z VS $ // Copyright: (c) Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -49,19 +49,6 @@ #define wxUSE_MENUS_NATIVE wxUSE_MENUS #endif // __WXUNIVERSAL__/!__WXUNIVERSAL__ - -// Define this macro if the corresponding operating system handles the state -// of children windows automatically when the parent is enabled/disabled. -// Otherwise wx itself must ensure that when the parent is disabled its -// children are disabled too, and their initial state is restored when the -// parent is enabled back. -#if defined(__WXMSW__) || defined(__WXPM__) - // must do everything ourselves - #undef wxHAS_NATIVE_ENABLED_MANAGEMENT -#else - #define wxHAS_NATIVE_ENABLED_MANAGEMENT -#endif - // ---------------------------------------------------------------------------- // forward declarations // ---------------------------------------------------------------------------- @@ -71,7 +58,9 @@ class WXDLLIMPEXP_FWD_CORE wxControl; class WXDLLIMPEXP_FWD_CORE wxCursor; class WXDLLIMPEXP_FWD_CORE wxDC; class WXDLLIMPEXP_FWD_CORE wxDropTarget; +class WXDLLIMPEXP_FWD_CORE wxItemResource; class WXDLLIMPEXP_FWD_CORE wxLayoutConstraints; +class WXDLLIMPEXP_FWD_CORE wxResourceTable; class WXDLLIMPEXP_FWD_CORE wxSizer; class WXDLLIMPEXP_FWD_CORE wxToolTip; class WXDLLIMPEXP_FWD_CORE wxWindowBase; @@ -87,7 +76,7 @@ class WXDLLIMPEXP_FWD_CORE wxAccessible; // ---------------------------------------------------------------------------- // struct containing all the visual attributes of a control -struct WXDLLIMPEXP_CORE wxVisualAttributes +struct WXDLLEXPORT wxVisualAttributes { // the font used for control label/text inside it wxFont font; @@ -115,43 +104,18 @@ enum wxWindowVariant #define wxWINDOW_DEFAULT_VARIANT wxT("window-default-variant") #endif -// valid values for Show/HideWithEffect() -enum wxShowEffect -{ - wxSHOW_EFFECT_NONE, - wxSHOW_EFFECT_ROLL_TO_LEFT, - wxSHOW_EFFECT_ROLL_TO_RIGHT, - wxSHOW_EFFECT_ROLL_TO_TOP, - wxSHOW_EFFECT_ROLL_TO_BOTTOM, - wxSHOW_EFFECT_SLIDE_TO_LEFT, - wxSHOW_EFFECT_SLIDE_TO_RIGHT, - wxSHOW_EFFECT_SLIDE_TO_TOP, - wxSHOW_EFFECT_SLIDE_TO_BOTTOM, - wxSHOW_EFFECT_BLEND, - wxSHOW_EFFECT_EXPAND, - wxSHOW_EFFECT_MAX -}; - -// flags for SendSizeEvent() -enum -{ - wxSEND_EVENT_POST = 1 -}; - // ---------------------------------------------------------------------------- // (pseudo)template list classes // ---------------------------------------------------------------------------- -WX_DECLARE_LIST_3(wxWindow, wxWindowBase, wxWindowList, wxWindowListNode, class WXDLLIMPEXP_CORE); +WX_DECLARE_LIST_3(wxWindow, wxWindowBase, wxWindowList, wxWindowListNode, class WXDLLEXPORT); // ---------------------------------------------------------------------------- // global variables // ---------------------------------------------------------------------------- -extern WXDLLIMPEXP_DATA_CORE(wxWindowList) wxTopLevelWindows; - -// declared here for compatibility only, main declaration is in wx/app.h -extern WXDLLIMPEXP_DATA_BASE(wxList) wxPendingDelete; +extern WXDLLEXPORT_DATA(wxWindowList) wxTopLevelWindows; +extern WXDLLIMPEXP_DATA_CORE(wxList) wxPendingDelete; // ---------------------------------------------------------------------------- // wxWindowBase is the base class for all GUI controls/widgets, this is the public @@ -164,7 +128,7 @@ extern WXDLLIMPEXP_DATA_BASE(wxList) wxPendingDelete; // temporarily switches event handlers). // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxWindowBase : public wxEvtHandler +class WXDLLEXPORT wxWindowBase : public wxEvtHandler { public: // creating the window @@ -174,6 +138,15 @@ public: // Create() wxWindowBase() ; + // pseudo ctor (can't be virtual, called from ctor) + bool CreateBase(wxWindowBase *parent, + wxWindowID winid, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxPanelNameStr); + virtual ~wxWindowBase(); // deleting the window @@ -193,7 +166,7 @@ public: bool DestroyChildren(); // is the window being deleted? - bool IsBeingDeleted() const; + bool IsBeingDeleted() const { return m_isBeingDeleted; } // window attributes // ----------------- @@ -215,6 +188,11 @@ public: wxWindowVariant GetWindowVariant() const { return m_windowVariant; } + // window id uniquely identifies the window among its siblings unless + // it is wxID_ANY which means "don't care" + void SetId( wxWindowID winid ) { m_windowId = winid; } + wxWindowID GetId() const { return m_windowId; } + // get or change the layout direction (LTR or RTL) for this window, // wxLayout_Default is returned if layout direction is not supported virtual wxLayoutDirection GetLayoutDirection() const @@ -228,28 +206,15 @@ public: wxCoord width, wxCoord widthTotal) const; - - // window id uniquely identifies the window among its siblings unless - // it is wxID_ANY which means "don't care" - void SetId( wxWindowID winid ) { m_windowId = winid; } - wxWindowID GetId() const { return m_windowId; } - - // generate a unique id (or count of them consecutively), returns a - // valid id in the auto-id range or wxID_NONE if failed. If using - // autoid management, it will mark the id as reserved until it is - // used (by assigning it to a wxWindowIDRef) or unreserved. - static wxWindowID NewControlId(int count = 1) - { - return wxIdManager::ReserveId(count); - } - - // If an ID generated from NewControlId is not assigned to a wxWindowIDRef, - // it must be unreserved - static void UnreserveControlId(wxWindowID id, int count = 1) - { - wxIdManager::UnreserveId(id, count); - } - + // generate a control id for the controls which were not given one by + // user + static int NewControlId() { return --ms_lastControlId; } + // get the id of the control following the one with the given + // (autogenerated) id + static int NextControlId(int winid) { return winid - 1; } + // get the id of the control preceding the one with the given + // (autogenerated) id + static int PrevControlId(int winid) { return winid + 1; } // moving/resizing // --------------- @@ -361,15 +326,21 @@ public: return wxRect(GetClientAreaOrigin(), GetClientSize()); } +#if wxABI_VERSION >= 20808 // client<->window size conversion - virtual wxSize ClientToWindowSize(const wxSize& size) const; - virtual wxSize WindowToClientSize(const wxSize& size) const; + wxSize ClientToWindowSize(const wxSize& size) const; + wxSize WindowToClientSize(const wxSize& size) const; +#endif // get the size best suited for the window (in fact, minimal // acceptable size using which it will still look "nice" in // most situations) - wxSize GetBestSize() const; - + wxSize GetBestSize() const + { + if (m_bestSizeCache.IsFullySpecified()) + return m_bestSizeCache; + return DoGetBestSize(); + } void GetBestSize(int *w, int *h) const { wxSize s = GetBestSize(); @@ -379,13 +350,6 @@ public: *h = s.y; } - // Determine the best size in the other direction if one of them is - // fixed. This is used with windows that can wrap their contents and - // returns input-independent best size for the others. - int GetBestHeight(int width) const; - int GetBestWidth(int height) const; - - void SetScrollHelper( wxScrollHelper *sh ) { m_scrollHelper = sh; } wxScrollHelper *GetScrollHelper() { return m_scrollHelper; } @@ -399,7 +363,7 @@ public: // This function will merge the window's best size into the window's // minimum size, giving priority to the min size components, and // returns the results. - virtual wxSize GetEffectiveMinSize() const; + wxSize GetEffectiveMinSize() const; wxDEPRECATED( wxSize GetBestFittingSize() const ); // replaced by GetEffectiveMinSize wxDEPRECATED( wxSize GetAdjustedMinSize() const ); // replaced by GetEffectiveMinSize @@ -408,14 +372,14 @@ public: void SetInitialSize(const wxSize& size=wxDefaultSize); wxDEPRECATED( void SetBestFittingSize(const wxSize& size=wxDefaultSize) ); // replaced by SetInitialSize - + // the generic centre function - centers the window on parent by` // default or on screen if it doesn't have parent or // wxCENTER_ON_SCREEN flag is given void Centre(int dir = wxBOTH) { DoCentre(dir); } void Center(int dir = wxBOTH) { DoCentre(dir); } - // centre with respect to the parent window + // centre with respect to the the parent window void CentreOnParent(int dir = wxBOTH) { DoCentre(dir); } void CenterOnParent(int dir = wxBOTH) { CentreOnParent(dir); } @@ -431,7 +395,7 @@ public: // and it is therefore overridden in wxTLW to do that. // In wxWindow(Base), it has (unfortunately) been abused // to mean the same as SetMinSize() and SetMaxSize(). - + virtual void SetSizeHints( int minW, int minH, int maxW = wxDefaultCoord, int maxH = wxDefaultCoord, int incW = wxDefaultCoord, int incH = wxDefaultCoord ) @@ -442,40 +406,34 @@ public: const wxSize& incSize=wxDefaultSize) { DoSetSizeHints(minSize.x, minSize.y, maxSize.x, maxSize.y, incSize.x, incSize.y); } + virtual void DoSetSizeHints( int minW, int minH, + int maxW, int maxH, + int incW, int incH ); -#if WXWIN_COMPATIBILITY_2_8 - // these are useless and do nothing since wxWidgets 2.9 - wxDEPRECATED( virtual void SetVirtualSizeHints( int minW, int minH, - int maxW = wxDefaultCoord, int maxH = wxDefaultCoord ) ); - wxDEPRECATED( void SetVirtualSizeHints( const wxSize& minSize, - const wxSize& maxSize=wxDefaultSize) ); -#endif // WXWIN_COMPATIBILITY_2_8 + // Methods for setting virtual size hints + // FIXME: What are virtual size hints? + + virtual void SetVirtualSizeHints( int minW, int minH, + int maxW = wxDefaultCoord, int maxH = wxDefaultCoord ); + void SetVirtualSizeHints( const wxSize& minSize, + const wxSize& maxSize=wxDefaultSize) + { + SetVirtualSizeHints(minSize.x, minSize.y, maxSize.x, maxSize.y); + } - // Call these to override what GetBestSize() returns. This - // method is only virtual because it is overridden in wxTLW + // Call these to override what GetBestSize() returns. This + // method is only virtual because it is overriden in wxTLW // as a different API for SetSizeHints(). - virtual void SetMinSize(const wxSize& minSize); - virtual void SetMaxSize(const wxSize& maxSize); - - // Like Set*Size, but for client, not window, size - virtual void SetMinClientSize(const wxSize& size) - { SetMinSize(ClientToWindowSize(size)); } - virtual void SetMaxClientSize(const wxSize& size) - { SetMaxSize(ClientToWindowSize(size)); } + virtual void SetMinSize(const wxSize& minSize) { m_minWidth = minSize.x; m_minHeight = minSize.y; } + virtual void SetMaxSize(const wxSize& maxSize) { m_maxWidth = maxSize.x; m_maxHeight = maxSize.y; } // Override these methods to impose restrictions on min/max size. - // The easier way is to call SetMinSize() and SetMaxSize() which + // The easier way is to call SetMinSize() and SetMaxSize() which // will have the same effect. Doing both is non-sense. virtual wxSize GetMinSize() const { return wxSize(m_minWidth, m_minHeight); } virtual wxSize GetMaxSize() const { return wxSize(m_maxWidth, m_maxHeight); } - // Like Get*Size, but for client, not window, size - virtual wxSize GetMinClientSize() const - { return WindowToClientSize(GetMinSize()); } - virtual wxSize GetMaxClientSize() const - { return WindowToClientSize(GetMaxSize()); } - // Get the min and max values one by one int GetMinWidth() const { return GetMinSize().x; } int GetMinHeight() const { return GetMinSize().y; } @@ -487,7 +445,7 @@ public: // windows this is just the client area of the window, but for // some like scrolled windows it is more or less independent of // the screen window size. You may override the DoXXXVirtual - // methods below for classes where that is the case. + // methods below for classes where that is is the case. void SetVirtualSize( const wxSize &size ) { DoSetVirtualSize( size.x, size.y ); } void SetVirtualSize( int x, int y ) { DoSetVirtualSize( x, y ); } @@ -525,36 +483,6 @@ public: // components of the result respectively virtual wxSize GetWindowBorderSize() const; - // wxSizer and friends use this to give a chance to a component to recalc - // its min size once one of the final size components is known. Override - // this function when that is useful (such as for wxStaticText which can - // stretch over several lines). Parameter availableOtherDir - // tells the item how much more space there is available in the opposite - // direction (-1 if unknown). - virtual bool - InformFirstDirection(int direction, int size, int availableOtherDir); - - // sends a size event to the window using its current size -- this has an - // effect of refreshing the window layout - // - // by default the event is sent, i.e. processed immediately, but if flags - // value includes wxSEND_EVENT_POST then it's posted, i.e. only schedule - // for later processing - virtual void SendSizeEvent(int flags = 0); - - // this is a safe wrapper for GetParent()->SendSizeEvent(): it checks that - // we have a parent window and it's not in process of being deleted - // - // this is used by controls such as tool/status bars changes to which must - // also result in parent re-layout - void SendSizeEventToParent(int flags = 0); - - // this is a more readable synonym for SendSizeEvent(wxSEND_EVENT_POST) - void PostSizeEvent() { SendSizeEvent(wxSEND_EVENT_POST); } - - // this is the same as SendSizeEventToParent() but using PostSizeEvent() - void PostSizeEventToParent() { SendSizeEventToParent(wxSEND_EVENT_POST); } - // window state // ------------ @@ -564,43 +492,12 @@ public: virtual bool Show( bool show = true ); bool Hide() { return Show(false); } - // show or hide the window with a special effect, not implemented on - // most platforms (where it is the same as Show()/Hide() respectively) - // - // timeout specifies how long the animation should take, in ms, the - // default value of 0 means to use the default (system-dependent) value - virtual bool ShowWithEffect(wxShowEffect WXUNUSED(effect), - unsigned WXUNUSED(timeout) = 0) - { - return Show(); - } - - virtual bool HideWithEffect(wxShowEffect WXUNUSED(effect), - unsigned WXUNUSED(timeout) = 0) - { - return Hide(); - } - // returns true if window was enabled/disabled, false if nothing done virtual bool Enable( bool enable = true ); bool Disable() { return Enable(false); } virtual bool IsShown() const { return m_isShown; } - // returns true if the window is really enabled and false otherwise, - // whether because it had been explicitly disabled itself or because - // its parent is currently disabled -- then this method returns false - // whatever is the intrinsic state of this window, use IsThisEnabled(0 - // to retrieve it. In other words, this relation always holds: - // - // IsEnabled() == IsThisEnabled() && parent.IsEnabled() - // - bool IsEnabled() const; - - // returns the internal window state independently of the parent(s) - // state, i.e. the state in which the window would be if all its - // parents were enabled (use IsEnabled() above to get the effective - // window state) - bool IsThisEnabled() const { return m_isEnabled; } + virtual bool IsEnabled() const { return m_isEnabled; } // returns true if the window is visible, i.e. IsShown() returns true // if called on it and all its parents up to the first TLW @@ -611,7 +508,7 @@ public: virtual void SetWindowStyleFlag( long style ) { m_windowStyle = style; } virtual long GetWindowStyleFlag() const { return m_windowStyle; } - // just some (somewhat shorter) synonyms + // just some (somewhat shorter) synonims void SetWindowStyle( long style ) { SetWindowStyleFlag(style); } long GetWindowStyle() const { return GetWindowStyleFlag(); } @@ -628,12 +525,9 @@ public: virtual void SetExtraStyle(long exStyle) { m_exStyle = exStyle; } long GetExtraStyle() const { return m_exStyle; } - bool HasExtraStyle(int exFlag) const { return (m_exStyle & exFlag) != 0; } - -#if WXWIN_COMPATIBILITY_2_8 // make the window modal (all other windows unresponsive) - wxDEPRECATED( virtual void MakeModal(bool modal = true) ); -#endif + virtual void MakeModal(bool modal = true); + // (primitive) theming support // --------------------------- @@ -656,73 +550,23 @@ public: static wxWindow *DoFindFocus() /* = 0: implement in derived classes */; - // return true if the window has focus (handles composite windows - // correctly - returns true if GetMainWindowOfCompositeControl() - // has focus) - virtual bool HasFocus() const; - - // can this window have focus in principle? - // - // the difference between AcceptsFocus[FromKeyboard]() and CanAcceptFocus - // [FromKeyboard]() is that the former functions are meant to be - // overridden in the derived classes to simply return false if the - // control can't have focus, while the latter are meant to be used by - // this class clients and take into account the current window state - virtual bool AcceptsFocus() const { return true; } - - // can this window or one of its children accept focus? - // - // usually it's the same as AcceptsFocus() but is overridden for - // container windows - virtual bool AcceptsFocusRecursively() const { return AcceptsFocus(); } + // can this window have focus? + virtual bool AcceptsFocus() const { return IsShown() && IsEnabled(); } // can this window be given focus by keyboard navigation? if not, the // only way to give it focus (provided it accepts it at all) is to // click it virtual bool AcceptsFocusFromKeyboard() const { return AcceptsFocus(); } - - // this is mostly a helper for the various functions using it below - bool CanBeFocused() const { return IsShown() && IsEnabled(); } - - // can this window itself have focus? - bool IsFocusable() const { return AcceptsFocus() && CanBeFocused(); } - - // can this window have focus right now? - // - // if this method returns true, it means that calling SetFocus() will - // put focus either to this window or one of its children, if you need - // to know whether this window accepts focus itself, use IsFocusable() - bool CanAcceptFocus() const - { return AcceptsFocusRecursively() && CanBeFocused(); } - - // can this window be assigned focus from keyboard right now? - bool CanAcceptFocusFromKeyboard() const - { return AcceptsFocusFromKeyboard() && CanBeFocused(); } - - // call this when the return value of AcceptsFocus() changes - virtual void SetCanFocus(bool WXUNUSED(canFocus)) { } - - // navigates inside this window - bool NavigateIn(int flags = wxNavigationKeyEvent::IsForward) - { return DoNavigateIn(flags); } - - // navigates in the specified direction from this window, this is - // equivalent to GetParent()->NavigateIn() - bool Navigate(int flags = wxNavigationKeyEvent::IsForward) - { return m_parent && ((wxWindowBase *)m_parent)->DoNavigateIn(flags); } - - // this function will generate the appropriate call to Navigate() if the - // key event is one normally used for keyboard navigation and return true - // in this case - bool HandleAsNavigationKey(const wxKeyEvent& event); + // navigates in the specified direction by sending a wxNavigationKeyEvent + virtual bool Navigate(int flags = wxNavigationKeyEvent::IsForward); // move this window just before/after the specified one in tab order // (the other window must be our sibling!) void MoveBeforeInTabOrder(wxWindow *win) - { DoMoveInTabOrder(win, OrderBefore); } + { DoMoveInTabOrder(win, MoveBefore); } void MoveAfterInTabOrder(wxWindow *win) - { DoMoveInTabOrder(win, OrderAfter); } + { DoMoveInTabOrder(win, MoveAfter); } // parent/children relations @@ -735,10 +579,12 @@ public: // needed just for extended runtime const wxWindowList& GetWindowChildren() const { return GetChildren() ; } +#if wxABI_VERSION >= 20808 // get the window before/after this one in the parents children list, // returns NULL if this is the first/last window - wxWindow *GetPrevSibling() const { return DoGetSibling(OrderBefore); } - wxWindow *GetNextSibling() const { return DoGetSibling(OrderAfter); } + wxWindow *GetPrevSibling() const { return DoGetSibling(MoveBefore); } + wxWindow *GetNextSibling() const { return DoGetSibling(MoveAfter); } +#endif // wx 2.8.8+ // get the parent or the parent of the parent wxWindow *GetParent() const { return m_parent; } @@ -747,10 +593,6 @@ public: // is this window a top level one? virtual bool IsTopLevel() const; - // is this window a child or grand child of this one (inside the same - // TLW)? - bool IsDescendant(wxWindowBase* win) const; - // it doesn't really change parent, use Reparent() instead void SetParent( wxWindowBase *parent ) { m_parent = (wxWindow *)parent; } // change the real parent of this window, return true if the parent @@ -761,11 +603,6 @@ public: virtual void AddChild( wxWindowBase *child ); virtual void RemoveChild( wxWindowBase *child ); - // returns true if the child is in the client area of the window, i.e. is - // not scrollbar, toolbar etc. - virtual bool IsClientAreaChild(const wxWindow *WXUNUSED(child)) const - { return true; } - // looking for windows // ------------------- @@ -789,7 +626,7 @@ public: // replace the event handler (allows to completely subclass the // window) - void SetEventHandler( wxEvtHandler *handler ); + void SetEventHandler( wxEvtHandler *handler ) { m_eventHandler = handler; } // push/pop event handler: allows to chain a custom event handler to // alreasy existing ones @@ -803,59 +640,6 @@ public: // be there) bool RemoveEventHandler(wxEvtHandler *handler); - // Process an event by calling GetEventHandler()->ProcessEvent(): this - // is a straightforward replacement for ProcessEvent() itself which - // shouldn't be used directly with windows as it doesn't take into - // account any event handlers associated with the window - bool ProcessWindowEvent(wxEvent& event) - { return GetEventHandler()->ProcessEvent(event); } - - // Call GetEventHandler()->ProcessEventLocally(): this should be used - // instead of calling ProcessEventLocally() directly on the window - // itself as this wouldn't take any pushed event handlers into account - // correctly - bool ProcessWindowEventLocally(wxEvent& event) - { return GetEventHandler()->ProcessEventLocally(event); } - - // Process an event by calling GetEventHandler()->ProcessEvent() and - // handling any exceptions thrown by event handlers. It's mostly useful - // when processing wx events when called from C code (e.g. in GTK+ - // callback) when the exception wouldn't correctly propagate to - // wxEventLoop. - bool HandleWindowEvent(wxEvent& event) const; - - // disable wxEvtHandler double-linked list mechanism: - virtual void SetNextHandler(wxEvtHandler *handler); - virtual void SetPreviousHandler(wxEvtHandler *handler); - - - // Watcom doesn't allow reducing access with using access declaration, see - // #10749 -#ifndef __WATCOMC__ -protected: - - // NOTE: we change the access specifier of the following wxEvtHandler functions - // so that the user won't be able to call them directly. - // Calling wxWindow::ProcessEvent in fact only works when there are NO - // event handlers pushed on the window. - // To ensure correct operation, instead of wxWindow::ProcessEvent - // you must always call wxWindow::GetEventHandler()->ProcessEvent() - // or HandleWindowEvent(). - // The same holds for all other wxEvtHandler functions. - - using wxEvtHandler::ProcessEvent; - using wxEvtHandler::ProcessEventLocally; -#if wxUSE_THREADS - using wxEvtHandler::ProcessThreadEvent; -#endif - using wxEvtHandler::SafelyProcessEvent; - using wxEvtHandler::ProcessPendingEvents; - using wxEvtHandler::AddPendingEvent; - using wxEvtHandler::QueueEvent; -#endif // __WATCOMC__ - -public: - // validators // ---------- @@ -901,16 +685,16 @@ public: // dialog units translations // ------------------------- - wxPoint ConvertPixelsToDialog( const wxPoint& pt ) const; - wxPoint ConvertDialogToPixels( const wxPoint& pt ) const; - wxSize ConvertPixelsToDialog( const wxSize& sz ) const + wxPoint ConvertPixelsToDialog( const wxPoint& pt ); + wxPoint ConvertDialogToPixels( const wxPoint& pt ); + wxSize ConvertPixelsToDialog( const wxSize& sz ) { wxPoint pt(ConvertPixelsToDialog(wxPoint(sz.x, sz.y))); return wxSize(pt.x, pt.y); } - wxSize ConvertDialogToPixels( const wxSize& sz ) const + wxSize ConvertDialogToPixels( const wxSize& sz ) { wxPoint pt(ConvertDialogToPixels(wxPoint(sz.x, sz.y))); @@ -958,13 +742,13 @@ public: virtual void ClearBackground(); // freeze the window: don't redraw it until it is thawed - void Freeze(); + virtual void Freeze() { } // thaw the window: redraw it after it had been frozen - void Thaw(); + virtual void Thaw() { } // return true if window had been frozen and not unthawed yet - bool IsFrozen() const { return m_freezeCount != 0; } + virtual bool IsFrozen() const { return false; } // adjust DC for drawing on this window virtual void PrepareDC( wxDC & WXUNUSED(dc) ) { } @@ -1041,22 +825,15 @@ public: wxColour GetForegroundColour() const; // Set/get the background style. - virtual bool SetBackgroundStyle(wxBackgroundStyle style); - wxBackgroundStyle GetBackgroundStyle() const - { return m_backgroundStyle; } + // Pass one of wxBG_STYLE_SYSTEM, wxBG_STYLE_COLOUR, wxBG_STYLE_CUSTOM + virtual bool SetBackgroundStyle(wxBackgroundStyle style) { m_backgroundStyle = style; return true; } + virtual wxBackgroundStyle GetBackgroundStyle() const { return m_backgroundStyle; } // returns true if the control has "transparent" areas such as a // wxStaticText and wxCheckBox and the background should be adapted // from a parent window virtual bool HasTransparentBackground() { return false; } - // Returns true if background transparency is supported for this - // window, i.e. if calling SetBackgroundStyle(wxBG_STYLE_TRANSPARENT) - // has a chance of succeeding. If reason argument is non-NULL, returns a - // user-readable explanation of why it isn't supported if the return - // value is false. - virtual bool IsTransparentBackgroundSupported(wxString* reason = NULL) const; - // set/retrieve the font for the window (SetFont() returns true if the // font really changed) virtual bool SetFont(const wxFont& font) = 0; @@ -1085,21 +862,12 @@ public: // get the width/height/... of the text using current or specified // font - void GetTextExtent(const wxString& string, - int *x, int *y, - int *descent = NULL, - int *externalLeading = NULL, - const wxFont *font = NULL) const - { - DoGetTextExtent(string, x, y, descent, externalLeading, font); - } - - wxSize GetTextExtent(const wxString& string) const - { - wxCoord w, h; - GetTextExtent(string, &w, &h); - return wxSize(w, h); - } + virtual void GetTextExtent(const wxString& string, + int *x, int *y, + int *descent = (int *) NULL, + int *externalLeading = (int *) NULL, + const wxFont *theFont = (const wxFont *) NULL) + const = 0; // client <-> screen coords // ------------------------ @@ -1152,19 +920,10 @@ public: virtual void DoUpdateWindowUI(wxUpdateUIEvent& event) ; #if wxUSE_MENUS - // show popup menu at the given position, generate events for the items - // selected in it bool PopupMenu(wxMenu *menu, const wxPoint& pos = wxDefaultPosition) - { return PopupMenu(menu, pos.x, pos.y); } - bool PopupMenu(wxMenu *menu, int x, int y); - - // simply return the id of the selected item or wxID_NONE without - // generating any events - int GetPopupMenuSelectionFromUser(wxMenu& menu, - const wxPoint& pos = wxDefaultPosition) - { return DoGetPopupMenuSelectionFromUser(menu, pos.x, pos.y); } - int GetPopupMenuSelectionFromUser(wxMenu& menu, int x, int y) - { return DoGetPopupMenuSelectionFromUser(menu, x, y); } + { return DoPopupMenu(menu, pos.x, pos.y); } + bool PopupMenu(wxMenu *menu, int x, int y) + { return DoPopupMenu(menu, x, y); } #endif // wxUSE_MENUS // override this method to return true for controls having multiple pages @@ -1174,16 +933,13 @@ public: // scrollbars // ---------- - // can the window have the scrollbar in this orientation? - bool CanScroll(int orient) const + // does the window have the scrollbar for this orientation? + bool HasScrollbar(int orient) const { return (m_windowStyle & (orient == wxHORIZONTAL ? wxHSCROLL : wxVSCROLL)) != 0; } - // does the window have the scrollbar in this orientation? - bool HasScrollbar(int orient) const; - // configure the window scrollbars virtual void SetScrollbar( int orient, int pos, @@ -1197,7 +953,7 @@ public: // scroll window to the specified position virtual void ScrollWindow( int dx, int dy, - const wxRect* rect = NULL ) = 0; + const wxRect* rect = (wxRect *) NULL ) = 0; // scrolls window by line/page: note that not all controls support this // @@ -1211,20 +967,6 @@ public: bool PageUp() { return ScrollPages(-1); } bool PageDown() { return ScrollPages(1); } - // call this to always show one or both scrollbars, even if the window - // is big enough to not require them - virtual void AlwaysShowScrollbars(bool WXUNUSED(horz) = true, - bool WXUNUSED(vert) = true) - { - } - - // return true if AlwaysShowScrollbars() had been called before for the - // corresponding orientation - virtual bool IsScrollbarAlwaysShown(int WXUNUSED(orient)) const - { - return false; - } - // context-sensitive help // ---------------------- @@ -1233,13 +975,9 @@ public: #if wxUSE_HELP // associate this help text with this window void SetHelpText(const wxString& text); - -#if WXWIN_COMPATIBILITY_2_8 - // Associate this help text with all windows with the same id as this one. - // Don't use this, do wxHelpProvider::Get()->AddHelp(id, text); - wxDEPRECATED( void SetHelpTextForId(const wxString& text) ); -#endif // WXWIN_COMPATIBILITY_2_8 - + // associate this help text with all windows with the same id as this + // one + void SetHelpTextForId(const wxString& text); // get the help string associated with the given position in this window // // notice that pt may be invalid if event origin is keyboard or unknown @@ -1264,28 +1002,22 @@ public: #if wxUSE_TOOLTIPS // the easiest way to set a tooltip for a window is to use this method void SetToolTip( const wxString &tip ); - // attach a tooltip to the window, pointer can be NULL to remove - // existing tooltip + // attach a tooltip to the window void SetToolTip( wxToolTip *tip ) { DoSetToolTip(tip); } +#if wxABI_VERSION >= 20809 // more readable synonym for SetToolTip(NULL) void UnsetToolTip() { SetToolTip(NULL); } +#endif // wxABI_VERSION >= 2.8.9 // get the associated tooltip or NULL if none wxToolTip* GetToolTip() const { return m_tooltip; } - wxString GetToolTipText() const; - - // Use the same tool tip as the given one (which can be NULL to indicate - // that no tooltip should be used) for this window. This is currently only - // used by wxCompositeWindow::DoSetToolTip() implementation and is not part - // of the public wx API. - // - // Returns true if tip was valid and we copied it or false if it was NULL - // and we reset our own tooltip too. - bool CopyToolTip(wxToolTip *tip); + wxString GetToolTipText() const ; #else // !wxUSE_TOOLTIPS // make it much easier to compile apps in an environment // that doesn't support tooltips, such as PocketPC - void SetToolTip(const wxString & WXUNUSED(tip)) { } + void SetToolTip( const wxString & WXUNUSED(tip) ) {} +#if wxABI_VERSION >= 20809 void UnsetToolTip() { } +#endif // wxABI_VERSION >= 2.8.9 #endif // wxUSE_TOOLTIPS/!wxUSE_TOOLTIPS // drag and drop @@ -1296,14 +1028,12 @@ public: virtual void SetDropTarget( wxDropTarget *dropTarget ) = 0; virtual wxDropTarget *GetDropTarget() const { return m_dropTarget; } +#ifndef __WXMSW__ // MSW version is in msw/window.h +#if wxABI_VERSION >= 20810 // Accept files for dragging - virtual void DragAcceptFiles(bool accept) -#ifdef __WXMSW__ - // it does have common implementation but not for MSW which has its own - // native version of it - = 0 -#endif // __WXMSW__ - ; + void DragAcceptFiles(bool accept); +#endif // wxABI_VERSION >= 20810 +#endif // !__WXMSW__ #endif // wxUSE_DRAG_AND_DROP @@ -1392,11 +1122,10 @@ public: // virtual function for implementing internal idle // behaviour - virtual void OnInternalIdle(); + virtual void OnInternalIdle() {} - // Send idle event to window and all subwindows - // Returns true if more idle time is requested. - virtual bool SendIdleEvents(wxIdleEvent& event); + // call internal idle recursively +// void ProcessInternalIdle() ; // get the handle of the window for the underlying window system: this // is only used for wxWin itself or for user code which wants to call @@ -1435,13 +1164,32 @@ public: // behaviour in the most common case virtual bool ShouldInheritColours() const { return false; } - // returns true if the window can be positioned outside of parent's client - // area (normal windows can't, but e.g. menubar or statusbar can): - virtual bool CanBeOutsideClientArea() const { return false; } +protected: + // event handling specific to wxWindow + virtual bool TryValidator(wxEvent& event); + virtual bool TryParent(wxEvent& event); - // returns true if the platform should explicitly apply a theme border. Currently - // used only by Windows - virtual bool CanApplyThemeBorder() const { return true; } + enum MoveKind + { + MoveBefore, // insert before the given window + MoveAfter // insert after the given window + }; + +#if wxABI_VERSION >= 20808 + // common part of GetPrev/NextSibling() + wxWindow *DoGetSibling(MoveKind order) const; +#endif // wx 2.8.8+ + + // common part of MoveBefore/AfterInTabOrder() + virtual void DoMoveInTabOrder(wxWindow *win, MoveKind move); + +#if wxUSE_CONSTRAINTS + // satisfy the constraints for the windows but don't set the window sizes + void SatisfyConstraints(); +#endif // wxUSE_CONSTRAINTS + + // Send the wxWindowDestroyEvent + void SendDestroyEvent(); // returns the main window of composite control; this is the window // that FindFocus returns if the focus is in one of composite control's @@ -1449,77 +1197,9 @@ public: virtual wxWindow *GetMainWindowOfCompositeControl() { return (wxWindow*)this; } - // If this function returns true, keyboard navigation events shouldn't - // escape from it. A typical example of such "navigation domain" is a top - // level window because pressing TAB in one of them must not transfer focus - // to a different top level window. But it's not limited to them, e.g. MDI - // children frames are not top level windows (and their IsTopLevel() - // returns false) but still are self-contained navigation domains as well. - virtual bool IsTopNavigationDomain() const { return false; } - - -protected: - // helper for the derived class Create() methods: the first overload, with - // validator parameter, should be used for child windows while the second - // one is used for top level ones - bool CreateBase(wxWindowBase *parent, - wxWindowID winid, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxPanelNameStr); - - bool CreateBase(wxWindowBase *parent, - wxWindowID winid, - const wxPoint& pos, - const wxSize& size, - long style, - const wxString& name); - - // event handling specific to wxWindow - virtual bool TryBefore(wxEvent& event); - virtual bool TryAfter(wxEvent& event); - - enum WindowOrder - { - OrderBefore, // insert before the given window - OrderAfter // insert after the given window - }; - - // common part of GetPrev/NextSibling() - wxWindow *DoGetSibling(WindowOrder order) const; - - // common part of MoveBefore/AfterInTabOrder() - virtual void DoMoveInTabOrder(wxWindow *win, WindowOrder move); - - // implementation of Navigate() and NavigateIn() - virtual bool DoNavigateIn(int flags); - -#if wxUSE_CONSTRAINTS - // satisfy the constraints for the windows but don't set the window sizes - void SatisfyConstraints(); -#endif // wxUSE_CONSTRAINTS - - // Send the wxWindowDestroyEvent if not done yet and sets m_isBeingDeleted - // to true - void SendDestroyEvent(); - - // this method should be implemented to use operating system specific code - // to really enable/disable the widget, it will only be called when we - // really need to enable/disable window and so no additional checks on the - // widgets state are necessary - virtual void DoEnable(bool WXUNUSED(enable)) { } - - // called when the on-screen widget state changes and provides an - // an opportunity for the widget to update its visual state (colours, - // fonts, anything else) as necessary - virtual void OnEnabled(bool WXUNUSED(enabled)) { } - - // the window id - a number which uniquely identifies a window among // its siblings unless it is wxID_ANY - wxWindowIDRef m_windowId; + wxWindowID m_windowId; // the parent window of this window (or NULL) and the list of the children // of this window @@ -1623,17 +1303,17 @@ protected: wxScrollHelper *m_scrollHelper; + int m_minVirtualWidth; // VirtualSizeHints + int m_minVirtualHeight; + int m_maxVirtualWidth; + int m_maxVirtualHeight; + wxWindowVariant m_windowVariant ; // override this to change the default (i.e. used when no style is // specified) border for the window class virtual wxBorder GetDefaultBorder() const; - // this allows you to implement standard control borders without - // repeating the code in different classes that are not derived from - // wxControl - virtual wxBorder GetDefaultBorderForControl() const { return wxBORDER_THEME; } - // Get the default size for the new window if no explicit size given. TLWs // have their own default size so this is just for non top-level windows. static int WidthDefault(int w) { return w == wxDefaultCoord ? 20 : w; } @@ -1661,13 +1341,6 @@ protected: // overloaded Something()s in terms of DoSomething() which will be the // only one to be virtual. - // text extent - virtual void DoGetTextExtent(const wxString& string, - int *x, int *y, - int *descent = NULL, - int *externalLeading = NULL, - const wxFont *font = NULL) const = 0; - // coordinates translation virtual void DoClientToScreen( int *x, int *y ) const = 0; virtual void DoScreenToClient( int *x, int *y ) const = 0; @@ -1689,20 +1362,15 @@ protected: // same size as it would have after a call to Fit() virtual wxSize DoGetBestSize() const; - // this method can be overridden instead of DoGetBestSize() if it computes - // the best size of the client area of the window only, excluding borders - // (GetBorderSize() will be used to add them) - virtual wxSize DoGetBestClientSize() const { return wxDefaultSize; } + // called from DoGetBestSize() to convert best virtual size (returned by + // the window sizer) to the best size for the window itself; this is + // overridden at wxScrolledWindow level to clump down virtual size to real + virtual wxSize GetWindowSizeForVirtualSize(const wxSize& size) const + { + return size; + } - // These two methods can be overridden to implement intelligent - // width-for-height and/or height-for-width best size determination for the - // window. By default the fixed best size is used. - virtual int DoGetBestClientHeight(int WXUNUSED(width)) const - { return wxDefaultCoord; } - virtual int DoGetBestClientWidth(int WXUNUSED(height)) const - { return wxDefaultCoord; } - - // this is the virtual function to be overridden in any derived class which + // this is the virtual function to be overriden in any derived class which // wants to change how SetSize() or Move() works - it is called by all // versions of these functions in the base class virtual void DoSetSize(int x, int y, @@ -1712,19 +1380,6 @@ protected: // same as DoSetSize() for the client size virtual void DoSetClientSize(int width, int height) = 0; - virtual void DoSetSizeHints( int minW, int minH, - int maxW, int maxH, - int incW, int incH ); - - // return the total size of the window borders, i.e. the sum of the widths - // of the left and the right border in the x component of the returned size - // and the sum of the heights of the top and bottom borders in the y one - // - // NB: this is currently only implemented properly for wxMSW, wxGTK and - // wxUniv and doesn't behave correctly in the presence of scrollbars in - // the other ports - virtual wxSize DoGetBorderSize() const; - // move the window to the specified location and resize it: this is called // from both DoSetSize() and DoSetClientSize() and would usually just // reposition this window except for composite controls which will want to @@ -1757,55 +1412,23 @@ protected: // implements the window variants virtual void DoSetWindowVariant( wxWindowVariant variant ) ; - - // really freeze/thaw the window (should have port-specific implementation) - virtual void DoFreeze() { } - virtual void DoThaw() { } - - // Must be called when mouse capture is lost to send // wxMouseCaptureLostEvent to windows on capture stack. static void NotifyCaptureLost(); private: - // recursively call our own and our children OnEnabled() when the - // enabled/disabled status changed because a parent window had been - // enabled/disabled - void NotifyWindowOnEnableChange(bool enabled); - -#if wxUSE_MENUS - // temporary event handlers used by GetPopupMenuSelectionFromUser() - void InternalOnPopupMenu(wxCommandEvent& event); - void InternalOnPopupMenuUpdate(wxUpdateUIEvent& event); - - // implementation of the public GetPopupMenuSelectionFromUser() method - int DoGetPopupMenuSelectionFromUser(wxMenu& menu, int x, int y); -#endif // wxUSE_MENUS - - // layout the window children when its size changes unless this was - // explicitly disabled with SetAutoLayout(false) - void InternalOnSize(wxSizeEvent& event); - - // base for dialog unit conversion, i.e. average character size - wxSize GetDlgUnitBase() const; + // contains the last id generated by NewControlId + static int ms_lastControlId; // the stack of windows which have captured the mouse static struct WXDLLIMPEXP_FWD_CORE wxWindowNext *ms_winCaptureNext; - // the window that currently has mouse capture static wxWindow *ms_winCaptureCurrent; - // indicates if execution is inside CaptureMouse/ReleaseMouse static bool ms_winCaptureChanging; - - // number of Freeze() calls minus the number of Thaw() calls: we're frozen - // (i.e. not being updated) if it is positive - unsigned int m_freezeCount; - - DECLARE_ABSTRACT_CLASS(wxWindowBase) - wxDECLARE_NO_COPY_CLASS(wxWindowBase); + DECLARE_NO_COPY_CLASS(wxWindowBase) DECLARE_EVENT_TABLE() }; @@ -1838,7 +1461,14 @@ inline void wxWindowBase::SetInitialBestSize(const wxSize& size) // ---------------------------------------------------------------------------- // include the declaration of the platform-specific class -#if defined(__WXMSW__) +#if defined(__WXPALMOS__) + #ifdef __WXUNIVERSAL__ + #define wxWindowNative wxWindowPalm + #else // !wxUniv + #define wxWindowPalm wxWindow + #endif // wxUniv/!wxUniv + #include "wx/palmos/window.h" +#elif defined(__WXMSW__) #ifdef __WXUNIVERSAL__ #define wxWindowNative wxWindowMSW #else // !wxUniv @@ -1868,6 +1498,9 @@ inline void wxWindowBase::SetInitialBestSize(const wxSize& size) #define wxWindowX11 wxWindow #endif // wxUniv #include "wx/x11/window.h" +#elif defined(__WXMGL__) + #define wxWindowNative wxWindowMGL + #include "wx/mgl/window.h" #elif defined(__WXDFB__) #define wxWindowNative wxWindowDFB #include "wx/dfb/window.h" @@ -1877,7 +1510,7 @@ inline void wxWindowBase::SetInitialBestSize(const wxSize& size) #else // !wxUniv #define wxWindowMac wxWindow #endif // wxUniv - #include "wx/osx/window.h" + #include "wx/mac/window.h" #elif defined(__WXCOCOA__) #ifdef __WXUNIVERSAL__ #define wxWindowNative wxWindowCocoa @@ -1911,7 +1544,7 @@ inline void wxWindowBase::SetInitialBestSize(const wxSize& size) inline wxWindow *wxWindowBase::GetGrandParent() const { - return m_parent ? m_parent->GetParent() : NULL; + return m_parent ? m_parent->GetParent() : (wxWindow *)NULL; } // ---------------------------------------------------------------------------- @@ -1920,21 +1553,21 @@ inline wxWindow *wxWindowBase::GetGrandParent() const // Find the wxWindow at the current mouse position, also returning the mouse // position. -extern WXDLLIMPEXP_CORE wxWindow* wxFindWindowAtPointer(wxPoint& pt); +extern WXDLLEXPORT wxWindow* wxFindWindowAtPointer(wxPoint& pt); // Get the current mouse position. -extern WXDLLIMPEXP_CORE wxPoint wxGetMousePosition(); +extern WXDLLEXPORT wxPoint wxGetMousePosition(); // get the currently active window of this application or NULL -extern WXDLLIMPEXP_CORE wxWindow *wxGetActiveWindow(); +extern WXDLLEXPORT wxWindow *wxGetActiveWindow(); // get the (first) top level parent window -WXDLLIMPEXP_CORE wxWindow* wxGetTopLevelParent(wxWindow *win); +WXDLLEXPORT wxWindow* wxGetTopLevelParent(wxWindow *win); #if WXWIN_COMPATIBILITY_2_6 // deprecated (doesn't start with 'wx' prefix), use wxWindow::NewControlId() - wxDEPRECATED( wxWindowID NewControlId() ); - inline wxWindowID NewControlId() { return wxWindowBase::NewControlId(); } + wxDEPRECATED( int NewControlId() ); + inline int NewControlId() { return wxWindowBase::NewControlId(); } #endif // WXWIN_COMPATIBILITY_2_6 #if wxUSE_ACCESSIBILITY @@ -1942,7 +1575,7 @@ WXDLLIMPEXP_CORE wxWindow* wxGetTopLevelParent(wxWindow *win); // accessible object for windows // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxWindowAccessible: public wxAccessible +class WXDLLEXPORT wxWindowAccessible: public wxAccessible { public: wxWindowAccessible(wxWindow* win): wxAccessible(win) { if (win) win->SetAccessible(this); } diff --git a/Source/3rd Party/wx/include/wx/windowid.h b/Source/3rd Party/wx/include/wx/windowid.h deleted file mode 100644 index 117605378..000000000 --- a/Source/3rd Party/wx/include/wx/windowid.h +++ /dev/null @@ -1,190 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/windowid.h -// Purpose: wxWindowID class - a class for managing window ids -// Author: Brian Vanderburg II -// Created: 2007-09-21 -// RCS-ID: $Id$ -// Copyright: (c) 2007 Brian Vanderburg II -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_WINDOWID_H_ -#define _WX_WINDOWID_H_ - -// NB: do not include defs.h as we are included from it - -typedef int wxWindowID; - -// ---------------------------------------------------------------------------- -// wxWindowIDRef: reference counted id value -// ---------------------------------------------------------------------------- - -// A wxWindowIDRef object wraps an id value and marks it as (un)used as -// necessary. All ids returned from wxWindow::NewControlId() should be assigned -// to an instance of this class to ensure that the id is marked as being in -// use. -// -// This class is always defined but it is trivial if wxUSE_AUTOID_MANAGEMENT is -// off. -class WXDLLIMPEXP_CORE wxWindowIDRef -{ -public: - // default ctor - wxWindowIDRef() - { - m_id = wxID_NONE; - } - - // ctor taking id values - wxWindowIDRef(int id) - { - Init(id); - } - - wxWindowIDRef(long id) - { - Init(id); - } - - wxWindowIDRef(const wxWindowIDRef& id) - { - Init(id.m_id); - } - - // dtor - ~wxWindowIDRef() - { - Assign(wxID_NONE); - } - - // assignment - wxWindowIDRef& operator=(int id) - { - Assign(id); - return *this; - } - - wxWindowIDRef& operator=(long id) - { - Assign(id); - return *this; - } - - wxWindowIDRef& operator=(const wxWindowIDRef& id) - { - if (&id != this) - Assign(id.m_id); - return *this; - } - - // access to the stored id value - wxWindowID GetValue() const - { - return m_id; - } - - operator wxWindowID() const - { - return m_id; - } - -private: -#if wxUSE_AUTOID_MANAGEMENT - // common part of all ctors: call Assign() for our new id - void Init(wxWindowID id) - { - // m_id must be initialized before calling Assign() - m_id = wxID_NONE; - Assign(id); - } - - // increase reference count of id, decrease the one of m_id - void Assign(wxWindowID id); -#else // !wxUSE_AUTOID_MANAGEMENT - // trivial stubs for the functions above - void Init(wxWindowID id) - { - m_id = id; - } - - void Assign(wxWindowID id) - { - m_id = id; - } -#endif // wxUSE_AUTOID_MANAGEMENT/!wxUSE_AUTOID_MANAGEMENT - - - wxWindowID m_id; -}; - -// comparison operators -inline bool operator==(const wxWindowIDRef& lhs, const wxWindowIDRef& rhs) -{ - return lhs.GetValue() == rhs.GetValue(); -} - -inline bool operator==(const wxWindowIDRef& lhs, int rhs) -{ - return lhs.GetValue() == rhs; -} - -inline bool operator==(const wxWindowIDRef& lhs, long rhs) -{ - return lhs.GetValue() == rhs; -} - -inline bool operator==(int lhs, const wxWindowIDRef& rhs) -{ - return rhs == lhs; -} - -inline bool operator==(long lhs, const wxWindowIDRef& rhs) -{ - return rhs == lhs; -} - -inline bool operator!=(const wxWindowIDRef& lhs, const wxWindowIDRef& rhs) -{ - return !(lhs == rhs); -} - -inline bool operator!=(const wxWindowIDRef& lhs, int rhs) -{ - return !(lhs == rhs); -} - -inline bool operator!=(const wxWindowIDRef& lhs, long rhs) -{ - return !(lhs == rhs); -} - -inline bool operator!=(int lhs, const wxWindowIDRef& rhs) -{ - return !(lhs == rhs); -} - -inline bool operator!=(long lhs, const wxWindowIDRef& rhs) -{ - return !(lhs == rhs); -} - -// ---------------------------------------------------------------------------- -// wxIdManager -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxIdManager -{ -public: - // This returns an id value and not an wxWindowIDRef. The returned value - // should be assigned a.s.a.p to a wxWindowIDRef. The IDs are marked as - // reserved so that another call to ReserveId before assigning the id to a - // wxWindowIDRef will not use the same ID - static wxWindowID ReserveId(int count = 1); - - // This will release an unused reserved ID. This should only be called - // if the ID returned by ReserveId was NOT assigned to a wxWindowIDRef - // for some purpose, maybe an early return from a function - static void UnreserveId(wxWindowID id, int count = 1); -}; - -#endif // _WX_WINDOWID_H_ diff --git a/Source/3rd Party/wx/include/wx/withimages.h b/Source/3rd Party/wx/include/wx/withimages.h deleted file mode 100644 index d56b37dec..000000000 --- a/Source/3rd Party/wx/include/wx/withimages.h +++ /dev/null @@ -1,97 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/withimages.h -// Purpose: Declaration of a simple wxWithImages class. -// Author: Vadim Zeitlin -// Created: 2011-08-17 -// RCS-ID: $Id: wxhead.h,v 1.12 2010-04-22 12:44:51 zeitlin Exp $ -// Copyright: (c) 2011 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_WITHIMAGES_H_ -#define _WX_WITHIMAGES_H_ - -#include "wx/defs.h" -#include "wx/icon.h" -#include "wx/imaglist.h" - -// ---------------------------------------------------------------------------- -// wxWithImages: mix-in class providing access to wxImageList. -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxWithImages -{ -public: - enum - { - NO_IMAGE = -1 - }; - - wxWithImages() - { - m_imageList = NULL; - m_ownsImageList = false; - } - - virtual ~wxWithImages() - { - FreeIfNeeded(); - } - - // Sets the image list to use, it is *not* deleted by the control. - virtual void SetImageList(wxImageList* imageList) - { - FreeIfNeeded(); - m_imageList = imageList; - } - - // As SetImageList() but we will delete the image list ourselves. - void AssignImageList(wxImageList* imageList) - { - SetImageList(imageList); - m_ownsImageList = true; - } - - // Get pointer (may be NULL) to the associated image list. - wxImageList* GetImageList() const { return m_imageList; } - -protected: - // Return true if we have a valid image list. - bool HasImageList() const { return m_imageList != NULL; } - - // Return the image with the given index from the image list. - // - // If there is no image list or if index == NO_IMAGE, silently returns - // wxNullIcon. - wxIcon GetImage(int iconIndex) const - { - return m_imageList && iconIndex != NO_IMAGE - ? m_imageList->GetIcon(iconIndex) - : wxNullIcon; - } - -private: - // Free the image list if necessary, i.e. if we own it. - void FreeIfNeeded() - { - if ( m_ownsImageList ) - { - delete m_imageList; - m_imageList = NULL; - - // We don't own it any more. - m_ownsImageList = false; - } - } - - - // The associated image list or NULL. - wxImageList* m_imageList; - - // False by default, if true then we delete m_imageList. - bool m_ownsImageList; - - wxDECLARE_NO_COPY_CLASS(wxWithImages); -}; - -#endif // _WX_WITHIMAGES_H_ diff --git a/Source/3rd Party/wx/include/wx/wrapsizer.h b/Source/3rd Party/wx/include/wx/wrapsizer.h deleted file mode 100644 index 3e91a700b..000000000 --- a/Source/3rd Party/wx/include/wx/wrapsizer.h +++ /dev/null @@ -1,100 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/wrapsizer.h -// Purpose: provide wrapping sizer for layout (wxWrapSizer) -// Author: Arne Steinarson -// Created: 2008-05-08 -// RCS-ID: $Id$ -// Copyright: (c) Arne Steinarson -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_WRAPSIZER_H_ -#define _WX_WRAPSIZER_H_ - -#include "wx/sizer.h" - -// flags for wxWrapSizer -enum -{ - wxEXTEND_LAST_ON_EACH_LINE = 1, - // don't leave spacers in the beginning of a new row - wxREMOVE_LEADING_SPACES = 2, - - wxWRAPSIZER_DEFAULT_FLAGS = wxEXTEND_LAST_ON_EACH_LINE | - wxREMOVE_LEADING_SPACES -}; - -// ---------------------------------------------------------------------------- -// A box sizer that can wrap items on several lines when sum of widths exceed -// available line width. -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxWrapSizer : public wxBoxSizer -{ -public: - wxWrapSizer(int orient = wxHORIZONTAL, int flags = wxWRAPSIZER_DEFAULT_FLAGS); - virtual ~wxWrapSizer(); - - // override base class virtual methods - virtual wxSize CalcMin(); - virtual void RecalcSizes(); - - virtual bool InformFirstDirection(int direction, - int size, - int availableOtherDir); - -protected: - // This method is called to decide if an item represents empty space or - // not. We do this to avoid having space-only items first or last on a - // wrapped line (left alignment). - // - // By default only spacers are considered to be empty items but a derived - // class may override this item if some other kind of sizer elements should - // be also considered empty for some reason. - virtual bool IsSpaceItem(wxSizerItem *item) const - { - return item->IsSpacer(); - } - - // helpers of CalcMin() - void CalcMinFromMinor(int totMinor); - void CalcMinFromMajor(int totMajor); - void CalcMinUsingCurrentLayout(); - void CalcMinFittingSize(const wxSize& szBoundary); - void CalcMaxSingleItemSize(); - - // temporarily change the proportion of the last item of the N-th row to - // extend to the end of line if the appropriate flag is set - void AdjustLastRowItemProp(size_t n, wxSizerItem *itemLast); - - // remove all the items from m_rows - void ClearRows(); - - // return the N-th row sizer from m_rows creating it if necessary - wxSizer *GetRowSizer(size_t n); - - // should be called after completion of each row - void FinishRow(size_t n, int rowMajor, int rowMinor, wxSizerItem *itemLast); - - - const int m_flags; // Flags specified in the ctor - - int m_dirInform; // Direction for size information - int m_availSize; // Size available in m_dirInform direction - int m_availableOtherDir; // Size available in the other direction - bool m_lastUsed; // Indicates whether value from InformFirst... has - // been used yet - - // The sizes below are computed by RecalcSizes(), i.e. they don't have - // valid values during the initial call to CalcMin() and they are only - // valid for the current layout (i.e. the current number of rows) - int m_minSizeMinor; // Min size in minor direction - int m_maxSizeMajor; // Size of longest row - int m_minItemMajor; // Size of smallest item in major direction - - wxBoxSizer m_rows; // Sizer containing multiple rows of our items - - DECLARE_DYNAMIC_CLASS_NO_COPY(wxWrapSizer) -}; - -#endif // _WX_WRAPSIZER_H_ diff --git a/Source/3rd Party/wx/include/wx/wupdlock.h b/Source/3rd Party/wx/include/wx/wupdlock.h index 3e4eaf02b..c30ae00b1 100644 --- a/Source/3rd Party/wx/include/wx/wupdlock.h +++ b/Source/3rd Party/wx/include/wx/wupdlock.h @@ -3,7 +3,7 @@ // Purpose: wxWindowUpdateLocker prevents window redrawing // Author: Vadim Zeitlin // Created: 2006-03-06 -// RCS-ID: $Id$ +// RCS-ID: $Id: wupdlock.h 37842 2006-03-07 01:50:21Z VZ $ // Copyright: (c) 2006 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -30,7 +30,7 @@ public: private: wxWindow *m_win; - wxDECLARE_NO_COPY_CLASS(wxWindowUpdateLocker); + DECLARE_NO_COPY_CLASS(wxWindowUpdateLocker) }; #endif // _WX_WUPDLOCK_H_ diff --git a/Source/3rd Party/wx/include/wx/wx.h b/Source/3rd Party/wx/include/wx/wx.h index cbb045cb8..8c71e8ba1 100644 --- a/Source/3rd Party/wx/include/wx/wx.h +++ b/Source/3rd Party/wx/include/wx/wx.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: wx.h 40943 2006-08-31 19:31:43Z ABX $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -29,10 +29,7 @@ #include "wx/memory.h" #include "wx/math.h" #include "wx/stopwatch.h" -#include "wx/timer.h" #include "wx/module.h" -#include "wx/wxcrt.h" -#include "wx/wxcrtvararg.h" #if wxUSE_GUI @@ -62,8 +59,10 @@ #include "wx/icon.h" #include "wx/cursor.h" #include "wx/dialog.h" +#include "wx/timer.h" #include "wx/settings.h" #include "wx/msgdlg.h" +#include "wx/cmndata.h" #include "wx/dataobj.h" #include "wx/control.h" @@ -88,19 +87,12 @@ #include "wx/combobox.h" #include "wx/layout.h" #include "wx/sizer.h" +#include "wx/mdi.h" #include "wx/statusbr.h" #include "wx/choicdlg.h" #include "wx/textdlg.h" #include "wx/filedlg.h" -// this one is included by exactly one file (mdi.cpp) during wx build so even -// although we keep it here for the library users, don't include it to avoid -// bloating the PCH and (worse) rebuilding the entire library when it changes -// when building the library itself -#ifndef WXBUILDING - #include "wx/mdi.h" -#endif - // always include, even if !wxUSE_VALIDATORS because we need wxDefaultValidator #include "wx/validate.h" diff --git a/Source/3rd Party/wx/include/wx/wxchar.h b/Source/3rd Party/wx/include/wx/wxchar.h new file mode 100644 index 000000000..0c33d6c96 --- /dev/null +++ b/Source/3rd Party/wx/include/wx/wxchar.h @@ -0,0 +1,1413 @@ +/* + * Name: wx/wxchar.h + * Purpose: Declarations common to wx char/wchar_t usage (wide chars) + * Author: Joel Farley, Ove Kaaven + * Modified by: Vadim Zeitlin, Robert Roebling, Ron Lee + * Created: 1998/06/12 + * RCS-ID: $Id: wxchar.h 66970 2011-02-19 13:54:14Z VZ $ + * Copyright: (c) 1998-2006 wxWidgets dev team + * Licence: wxWindows licence + */ + +/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ + +#ifndef _WX_WXCHAR_H_ +#define _WX_WXCHAR_H_ + +/* defs.h indirectly includes this file, so don't include it here */ +#include "wx/platform.h" +#include "wx/dlimpexp.h" + +#include /* we use FILE below */ + +#if defined(HAVE_STRTOK_R) && defined(__DARWIN__) && defined(_MSL_USING_MW_C_HEADERS) && _MSL_USING_MW_C_HEADERS + char *strtok_r(char *, const char *, char **); +#endif + +/* check whether we have wchar_t and which size it is if we do */ +#if !defined(wxUSE_WCHAR_T) + #if defined(__UNIX__) + #if defined(HAVE_WCSTR_H) || defined(HAVE_WCHAR_H) || defined(__FreeBSD__) || defined(__DARWIN__) + #define wxUSE_WCHAR_T 1 + #else + #define wxUSE_WCHAR_T 0 + #endif + #elif defined(__GNUWIN32__) && !defined(__MINGW32__) + #define wxUSE_WCHAR_T 0 + #elif defined(__WATCOMC__) + #define wxUSE_WCHAR_T 0 + #elif defined(__VISAGECPP__) && (__IBMCPP__ < 400) + #define wxUSE_WCHAR_T 0 + #else + /* add additional compiler checks if this fails */ + #define wxUSE_WCHAR_T 1 + #endif +#endif /* !defined(wxUSE_WCHAR_T) */ + +/* Unicode support requires wchar_t */ +#if wxUSE_UNICODE && !wxUSE_WCHAR_T + #error "wchar_t must be available in Unicode build" +#endif /* Unicode */ + +/* + Standard headers we need here. + + NB: don't include any wxWidgets headers here because almost all of them include + this one! + */ + +/* Required for wxPrintf() etc */ +#include + +/* Almost all compiler have strdup(), but not quite all: CodeWarrior under Mac */ +/* and VC++ for Windows CE don't provide it */ +#if defined(__VISUALC__) && __VISUALC__ >= 1400 + #define wxStrdupA _strdup +#elif !(defined(__MWERKS__) && defined(__WXMAC__)) && !defined(__WXWINCE__) + /* use #define, not inline wrapper, as it is tested with #ifndef below */ + #define wxStrdupA strdup +#endif + +/* + non Unix compilers which do have wchar.h (but not tchar.h which is included + below and which includes wchar.h anyhow). + + Actually MinGW has tchar.h, but it does not include wchar.h + */ +#if defined(__MWERKS__) || defined(__VISAGECPP__) || defined(__MINGW32__) || defined(__WATCOMC__) + #ifndef HAVE_WCHAR_H + #define HAVE_WCHAR_H + #endif +#endif +#if defined(__MWERKS__) && !defined(__MACH__) + #ifndef HAVE_WCSLEN + #define HAVE_WCSLEN + #endif +#endif + +#if wxUSE_WCHAR_T + #ifdef HAVE_WCHAR_H + /* the current (as of Nov 2002) version of cygwin has a bug in its */ + /* wchar.h -- there is no extern "C" around the declarations in it and */ + /* this results in linking errors later; also, at least on some */ + /* Cygwin versions, wchar.h requires sys/types.h */ + #ifdef __CYGWIN__ + #include + #ifdef __cplusplus + extern "C" { + #endif + #endif /* Cygwin */ + + #include + + #if defined(__CYGWIN__) && defined(__cplusplus) + } + #endif /* Cygwin and C++ */ + + #elif defined(HAVE_WCSTR_H) + /* old compilers have relevant declarations here */ + #include + #elif defined(__FreeBSD__) || defined(__DARWIN__) || defined(__EMX__) + /* include stdlib.h for wchar_t */ + #include + #endif /* HAVE_WCHAR_H */ + + #ifdef HAVE_WIDEC_H + #include + #endif +#endif /* wxUSE_WCHAR_T */ + +/* ---------------------------------------------------------------------------- */ +/* define wxHAVE_TCHAR_SUPPORT for the compilers which support the TCHAR type */ +/* mapped to either char or wchar_t depending on the ASCII/Unicode mode and have */ +/* the function mapping _tfoo() -> foo() or wfoo() */ +/* ---------------------------------------------------------------------------- */ + +/* VC++ and BC++ starting with 5.2 have TCHAR support */ +#ifdef __VISUALC__ + #define wxHAVE_TCHAR_SUPPORT +#elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x520) + #define wxHAVE_TCHAR_SUPPORT + #include + #include +#elif defined(__WATCOMC__) + #define wxHAVE_TCHAR_SUPPORT +#elif defined(__DMC__) + #define wxHAVE_TCHAR_SUPPORT +#elif defined(__WXPALMOS__) + #include +#elif defined(__MINGW32__) && wxCHECK_W32API_VERSION( 1, 0 ) + #define wxHAVE_TCHAR_SUPPORT + #include + #include + #include +#elif 0 && defined(__VISAGECPP__) && (__IBMCPP__ >= 400) + /* VZ: the old VisualAge definitions were completely wrong and had no */ + /* chance at all to work in Unicode build anyhow so let's pretend that */ + /* VisualAge does _not_ support TCHAR for the moment (as indicated by */ + /* "0 &&" above) until someone really has time to delve into Unicode */ + /* issues under OS/2 */ + + /* VisualAge 4.0+ supports TCHAR */ + #define wxHAVE_TCHAR_SUPPORT +#endif /* compilers with (good) TCHAR support */ + +#if defined(__MWERKS__) + /* Metrowerks only has wide char support for OS X >= 10.3 */ + #if !defined(__DARWIN__) || \ + (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3) + #define wxHAVE_MWERKS_UNICODE + #endif + + #ifdef wxHAVE_MWERKS_UNICODE + #define HAVE_WPRINTF 1 + #define HAVE_WCSRTOMBS 1 + #define HAVE_VSWPRINTF 1 + #endif +#endif /* __MWERKS__ */ + +#ifdef wxHAVE_TCHAR_SUPPORT + /* get TCHAR definition if we've got it */ + #include + + /* we surely do have wchar_t if we have TCHAR */ + #ifndef wxUSE_WCHAR_T + #define wxUSE_WCHAR_T 1 + #endif /* !defined(wxUSE_WCHAR_T) */ + + /* and we also do have wcslen() */ + #ifndef HAVE_WCSLEN + #define HAVE_WCSLEN + #endif +#endif /* wxHAVE_TCHAR_SUPPORT */ + +/* ---------------------------------------------------------------------------- */ +/* define wxChar type */ +/* ---------------------------------------------------------------------------- */ + +/* TODO: define wxCharInt to be equal to either int or wint_t? */ + +#if !wxUSE_UNICODE + typedef char wxChar; + typedef signed char wxSChar; + typedef unsigned char wxUChar; +#else /* Unicode */ + /* VZ: note that VC++ defines _T[SU]CHAR simply as wchar_t and not as */ + /* signed/unsigned version of it which (a) makes sense to me (unlike */ + /* char wchar_t is always unsigned) and (b) was how the previous */ + /* definitions worked so keep it like this */ + + /* Sun's SunPro compiler supports the wchar_t type and wide character */ + /* functions, but does not define __WCHAR_TYPE__. Define it here to */ + /* allow unicode enabled builds. */ + #if defined(__SUNPRO_CC) || defined(__SUNPRO_C) + #define __WCHAR_TYPE__ wxchar_t + #endif + + /* GNU libc has __WCHAR_TYPE__ which requires special treatment, see */ + /* comment below */ + #if !defined(__WCHAR_TYPE__) || \ + (!defined(__GNUC__) || wxCHECK_GCC_VERSION(2, 96)) + /* standard case */ + typedef wchar_t wxChar; + typedef wchar_t wxSChar; + typedef wchar_t wxUChar; + #else /* __WCHAR_TYPE__ and gcc < 2.96 */ + /* VS: wxWidgets used to define wxChar as __WCHAR_TYPE__ here. However, */ + /* this doesn't work with new GCC 3.x compilers because wchar_t is */ + /* C++'s builtin type in the new standard. OTOH, old compilers (GCC */ + /* 2.x) won't accept new definition of wx{S,U}Char, therefore we */ + /* have to define wxChar conditionally depending on detected */ + /* compiler & compiler version. */ + /* with old definition of wxChar. */ + typedef __WCHAR_TYPE__ wxChar; + typedef __WCHAR_TYPE__ wxSChar; + typedef __WCHAR_TYPE__ wxUChar; + #endif /* __WCHAR_TYPE__ */ +#endif /* ASCII/Unicode */ + +/* ---------------------------------------------------------------------------- */ +/* define wxT() and related macros */ +/* ---------------------------------------------------------------------------- */ + +#if wxUSE_UNICODE + /* use wxCONCAT_HELPER so that x could be expanded if it's a macro */ + #define wxT(x) wxCONCAT_HELPER(L, x) +#else /* !Unicode */ + #define wxT(x) x +#endif /* Unicode/!Unicode */ + +/* + This macro is defined for forward compatibility with wxWidgets 3. It should + be used in the places where wxWidgets 2 API requires wxT() (in Unicode + build) but wxWidgets 3 doesn't accept it, e.g. wxCmdLineEntryDesc struct + elements initializers. + */ +#define wxT_2(x) wxT(x) + +/* + We define _T() as a synonym of wxT() for backwards compatibility and also + for the benefit of Windows programmers used to it. But this identifier is a + reserved one and this does create problems in practice, notably with Sun CC + which uses it in the recent versions of its standard headers. So avoid + defining it for this compiler at all, unless it was explicitly requested by + predefining wxNEEDS__T macro before including this header or if we're + building wx itself which does need and compiles fine thanks to the special + workarounds for Sun CC in wx/{before,after}std.h. + */ +#ifndef wxNEEDS__T + #if defined(WXBUILDING) || !(defined (__SUNPRO_C) || defined(__SUNPRO_CC)) + #define wxNEEDS__T + #endif +#endif + +#ifdef wxNEEDS__T + /* BSDs define _T() to be something different in ctype.h, override it */ + #if defined(__FreeBSD__) || defined(__DARWIN__) + #include + #endif + #undef _T + + #define _T(x) wxT(x) +#endif /* wxNEEDS__T */ + +/* this macro exists only for forward compatibility with wx 3.0 */ +#define wxS(x) wxT(x) + +/* a helper macro allowing to make another macro Unicode-friendly, see below */ +#define wxAPPLY_T(x) wxT(x) + +/* Unicode-friendly __FILE__, __DATE__ and __TIME__ analogs */ +#ifndef __TFILE__ + #define __TFILE__ wxAPPLY_T(__FILE__) +#endif + +#ifndef __TDATE__ + #define __TDATE__ wxAPPLY_T(__DATE__) +#endif + +#ifndef __TTIME__ + #define __TTIME__ wxAPPLY_T(__TIME__) +#endif + +/* + define wxFoo() function for each standard foo() function whose signature + (exceptionally including the return type) includes any mention of char: + wxFoo() is going to be a Unicode-friendly version of foo(), i.e. will have + the same signature but with char replaced by wxChar which allows us to use + it in Unicode build as well + */ + +#ifdef wxHAVE_TCHAR_SUPPORT + #include + + #if defined(__WATCOMC__) && defined(UNICODE) + #define WXWCHAR_T_CAST(c) (wint_t)(c) + #else + #define WXWCHAR_T_CAST(c) c + #endif + + /* ctype.h functions */ + #define wxIsalnum(c) _istalnum(WXWCHAR_T_CAST(c)) + #define wxIsalpha(c) _istalpha(WXWCHAR_T_CAST(c)) + #define wxIscntrl(c) _istcntrl(WXWCHAR_T_CAST(c)) + #define wxIsdigit(c) _istdigit(WXWCHAR_T_CAST(c)) + #define wxIsgraph(c) _istgraph(WXWCHAR_T_CAST(c)) + #define wxIslower(c) _istlower(WXWCHAR_T_CAST(c)) + #define wxIsprint(c) _istprint(WXWCHAR_T_CAST(c)) + #define wxIspunct(c) _istpunct(WXWCHAR_T_CAST(c)) + #define wxIsspace(c) _istspace(WXWCHAR_T_CAST(c)) + #define wxIsupper(c) _istupper(WXWCHAR_T_CAST(c)) + #define wxIsxdigit(c) _istxdigit(WXWCHAR_T_CAST(c)) + + /* + There is a bug in VC6 C RTL: toxxx() functions dosn't do anything with + signed chars < 0, so "fix" it here. + */ + #define wxTolower(c) _totlower((wxUChar)(c)) + #define wxToupper(c) _totupper((wxUChar)(c)) + + /* locale.h functons */ + #define wxSetlocale _tsetlocale + + /* string.h functions */ + #define wxStrcat _tcscat + #define wxStrchr _tcschr + #define wxStrcmp _tcscmp + #define wxStrcoll _tcscoll + #define wxStrcpy _tcscpy + #define wxStrcspn _tcscspn + #define wxStrdupW _wcsdup /* notice the 'W'! */ + #define wxStrftime _tcsftime + #define wxStricmp _tcsicmp + #define wxStrnicmp _tcsnicmp + #define wxStrlen_ _tcslen /* used in wxStrlen inline function */ + #define wxStrncat _tcsncat + #define wxStrncmp _tcsncmp + #define wxStrncpy _tcsncpy + #define wxStrpbrk _tcspbrk + #define wxStrrchr _tcsrchr + #define wxStrspn _tcsspn + #define wxStrstr _tcsstr + #define wxStrtod _tcstod + #define wxStrtol _tcstol + #define wxStrtoul _tcstoul + #ifdef __VISUALC__ + #if __VISUALC__ >= 1300 && !defined(__WXWINCE__) + #define wxStrtoll _tcstoi64 + #define wxStrtoull _tcstoui64 + #endif /* VC++ 7+ */ + #endif + #define wxStrxfrm _tcsxfrm + + /* stdio.h functions */ + #define wxFgetc _fgettc + #define wxFgetchar _fgettchar + #define wxFgets _fgetts + #if wxUSE_UNICODE_MSLU + WXDLLIMPEXP_BASE FILE * wxMSLU__tfopen(const wxChar *name, const wxChar *mode); + + #define wxFopen wxMSLU__tfopen + #else + #define wxFopen _tfopen + #endif + #define wxFputc _fputtc + #define wxFputchar _fputtchar + #define wxFprintf _ftprintf + #define wxFputs _fputts + #define wxFreopen _tfreopen + #define wxFscanf _ftscanf + #define wxGetc _gettc + #define wxGetchar _gettchar + #define wxGets _getts + #define wxPerror _tperror + #define wxPrintf _tprintf + #define wxPutc(c,f) _puttc(WXWCHAR_T_CAST(c),f) + #define wxPutchar _puttchar + #define wxPuts _putts + #define wxScanf _tscanf + #if defined(__DMC__) + #if wxUSE_UNICODE + /* Digital Mars adds count to _stprintf (C99) so prototype conversion see wxchar.cpp */ + int wxSprintf (wchar_t * __RESTRICT s, const wchar_t * __RESTRICT format, ... ) ; + #else + /* and there is a bug in D Mars tchar.h prior to 8.39.4n, so define as sprintf */ + #define wxSprintf sprintf + #endif + #elif defined(__MINGW32__) && ( defined(_STLPORT_VERSION) && _STLPORT_VERSION >= 0x510 ) + #if wxUSE_UNICODE + /* MinGW with STLPort 5.1 adds count to swprintf (C99) so prototype conversion see wxchar.cpp */ + int wxSprintf (wchar_t*, const wchar_t*, ...); + #else + /* MinGW with STLPort 5.1 has clashing defines for _stprintf so use sprintf */ + #define wxSprintf sprintf + #endif + #else + #define wxSprintf _stprintf + #endif + + #define wxSscanf _stscanf + #define wxTmpnam _ttmpnam + #define wxUngetc _tungetc + #define wxVfprintf _vftprintf + #define wxVprintf _vtprintf + #define wxVsscanf _vstscanf + #define wxVsprintf _vstprintf + + /* special case: these functions are missing under Win9x with Unicows so we */ + /* have to implement them ourselves */ + #if wxUSE_UNICODE_MSLU + WXDLLIMPEXP_BASE int wxMSLU__trename(const wxChar *oldname, const wxChar *newname); + WXDLLIMPEXP_BASE int wxMSLU__tremove(const wxChar *name); + + #define wxRemove wxMSLU__tremove + #define wxRename wxMSLU__trename + #else + #ifdef __WXWINCE__ + /* carefully: wxRemove() must return 0 on success while DeleteFile() + returns 0 on error, so don't just define one as the other */ + int wxRemove(const wxChar *path); + #else + #define wxRemove _tremove + #define wxRename _trename + #endif + #endif + + /* stdlib.h functions */ + #define wxAtoi _ttoi + #define wxAtol _ttol + /* #define wxAtof _tttof -- notice that there is no such thing (why?) */ + /* there are no env vars at all under CE, so no _tgetenv neither */ + #ifdef __WXWINCE__ + /* can't define as inline function as this is a C file... */ + #define wxGetenv(name) ((wxChar *)NULL) + #else + #define wxGetenv _tgetenv + #endif + #define wxSystem _tsystem + + /* time.h functions */ + #define wxAsctime _tasctime + #define wxCtime _tctime + + #define wxMbstowcs mbstowcs + #define wxWcstombs wcstombs +#else /* !TCHAR-aware compilers */ + /* + There are 2 unrelated problems with these functions under Mac: + a) Metrowerks MSL CRT implements them strictly in C99 sense and + doesn't support (very common) extension of allowing to call + mbstowcs(NULL, ...) which makes it pretty useless as you can't + know the size of the needed buffer + b) OS X <= 10.2 declares and even defined these functions but + doesn't really implement them -- they always return an error + + So use our own replacements in both cases. + */ + #if defined(__MWERKS__) && defined(__MSL__) + #define wxNEED_WX_MBSTOWCS + #endif + + #ifdef __DARWIN__ + #if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_2 + #define wxNEED_WX_MBSTOWCS + #endif + #endif + + #ifdef wxNEED_WX_MBSTOWCS + /* even though they are defined and "implemented", they are bad and just + stubs so we need our own - we need these even in ANSI builds!! */ + WXDLLIMPEXP_BASE size_t wxMbstowcs (wchar_t *, const char *, size_t); + WXDLLIMPEXP_BASE size_t wxWcstombs (char *, const wchar_t *, size_t); + #else + #define wxMbstowcs mbstowcs + #define wxWcstombs wcstombs + #endif + + /* + The system C library on Mac OS X 10.2 and below does not support + unicode: in other words all wide-character functions such as towupper et + al. do simply not exist so we need to provide our own in that context, + except for the wchar_t definition/typedef itself. + + We need to do this for both project builder and CodeWarrior as + the latter uses the system C library in Mach builds for wide character + support, which as mentioned does not exist on 10.2 and below. + */ + #if wxUSE_UNICODE && \ + defined(__DARWIN__) && \ + ( MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_2 ) + /* we need everything! */ + #define wxNEED_WX_STRING_H + #define wxNEED_WX_CTYPE_H + + #define wxFgetchar(c) wxFgetc(c, stdin) + #define wxFputc wxPutc + #define wxFputchar(c) wxPutc(c, stdout) + #define wxGetc wxFgetc + #define wxGetchar(c) wxFgetc(c, stdin) + + #include + + #define wxNEED_FGETC + #define wxNEED_FGETS + #define wxNEED_GETS + #define wxNEED_UNGETC + + #define wxNEED_FPUTS + #define wxNEED_PUTS + #define wxNEED_PUTC + + int wxFputs(const wxChar *ch, FILE *stream); + int wxPuts(const wxChar *ws); + int wxPutc(wxChar ch, FILE *stream); + + #ifdef __cplusplus + extern "C" { + #endif + WXDLLIMPEXP_BASE size_t wxStrlen_(const wxChar *s); + #ifdef __cplusplus + } + #endif + + #define wxPutchar(wch) wxPutc(wch, stdout) + + #define wxNEED_PRINTF_CONVERSION + #define wxNEED_WX_STDIO_H + #define wxNEED_WX_STDLIB_H + #define wxNEED_WX_TIME_H + + #elif wxUSE_UNICODE + #include + + /* this is probably glibc-specific */ + #if defined(__WCHAR_TYPE__) && !defined(__MWERKS__) + /* ctype.h functions (wctype.h) */ + #define wxIsalnum iswalnum + #define wxIsalpha iswalpha + #define wxIscntrl iswcntrl + #define wxIsdigit iswdigit + #define wxIsgraph iswgraph + #define wxIslower iswlower + #define wxIsprint iswprint + #define wxIspunct iswpunct + #define wxIsspace iswspace + #define wxIsupper iswupper + #define wxIsxdigit iswxdigit + + #if defined(__GLIBC__) && (__GLIBC__ == 2) && (__GLIBC_MINOR__ == 0) + /* /usr/include/wctype.h incorrectly declares translations */ + /* tables which provokes tons of compile-time warnings -- try */ + /* to correct this */ + #define wxTolower(wc) towctrans((wc), (wctrans_t)__ctype_tolower) + #define wxToupper(wc) towctrans((wc), (wctrans_t)__ctype_toupper) + #else /* !glibc 2.0 */ + #define wxTolower towlower + #define wxToupper towupper + #endif /* gcc/!gcc */ + + /* string.h functions (wchar.h) */ + #define wxStrcat wcscat + #define wxStrchr wcschr + #define wxStrcmp wcscmp + #define wxStrcoll wcscoll + #define wxStrcpy wcscpy + #define wxStrcspn wcscspn + #define wxStrlen_ wxWcslen /* wxStrlen_() is used in wxStrlen() */ + #define wxStrncat wcsncat + #define wxStrncmp wcsncmp + #define wxStrncpy wcsncpy + #define wxStrpbrk wcspbrk + #define wxStrrchr wcsrchr + #define wxStrspn wcsspn + #define wxStrstr wcsstr + #define wxStrtod wcstod + #define wxStrtol wcstol + #define wxStrtoul wcstoul + #ifdef HAVE_WCSTOULL + /* assume that we have wcstoull(), which is also C99, too */ + #define wxStrtoll wcstoll + #define wxStrtoull wcstoull + #endif /* HAVE_WCSTOULL */ + #define wxStrxfrm wcsxfrm + + #define wxFgetc fgetwc + #define wxFgetchar fgetwchar + #define wxFgets fgetws + #define wxFputc fputwc + #define wxFputchar fputwchar + #define wxGetc getwc + #define wxGetchar getwchar + #define wxGets getws + #define wxUngetc ungetwc + + #ifdef HAVE_FPUTWS + #define wxFputs fputws + #else + #define wxNEED_FPUTS + #include + int wxFputs(const wxChar *ch, FILE *stream); + #endif + + #ifdef HAVE_WPUTC + #define wxPutc wputc + #else + #define wxNEED_PUTC + #include + int wxPutc(wxChar ch, FILE *stream); + #endif + + #ifdef HAVE_WPUTCHAR + #define wxPutchar wputchar + #else + #define wxPutchar(wch) wxPutc(wch, stdout) + #endif + + #ifdef HAVE_PUTWS + #define wxPuts putws + #else + #define wxNEED_PUTS + int wxPuts(const wxChar *ws); + #endif + + /* we need %s to %ls conversion for printf and scanf etc */ + #define wxNEED_PRINTF_CONVERSION + + /* glibc doesn't have wide char equivalents of the other stuff so */ + /* use our own versions */ + #define wxNEED_WX_STDIO_H + #define wxNEED_WX_STDLIB_H + #define wxNEED_WX_TIME_H + #elif defined(__MWERKS__) && ( defined(__MSL__) || defined(__MACH__) ) + /* ctype.h functions (wctype.h) */ + #define wxIsalnum iswalnum + #define wxIsalpha iswalpha + #define wxIscntrl iswcntrl + #define wxIsdigit iswdigit + #define wxIsgraph iswgraph + #define wxIslower iswlower + #define wxIsprint iswprint + #define wxIspunct iswpunct + #define wxIsspace iswspace + #define wxIsupper iswupper + #define wxIsxdigit iswxdigit + #define wxTolower towlower + #define wxToupper towupper + + /* string.h functions (wchar.h) */ + #define wxStrcat wcscat + #define wxStrchr wcschr + #define wxStrcmp wcscmp + #define wxStrcoll wcscoll + #define wxStrcpy wcscpy + #define wxStrcspn wcscspn + #define wxStrlen_ wxWcslen /* wxStrlen_() is used in wxStrlen() */ + #define wxStrncat wcsncat + #define wxStrncmp wcsncmp + #define wxStrncpy wcsncpy + #define wxStrpbrk wcspbrk + #define wxStrrchr wcsrchr + #define wxStrspn wcsspn + #define wxStrstr wcsstr + #define wxStrtod wcstod + #define wxStrtol wcstol + #define wxStrtoul wcstoul + #define wxStrxfrm wcsxfrm + + #define wxFgetc fgetwc + #define wxFgetchar fgetwchar + #define wxFgets fgetws + #define wxFputc fputwc + #define wxFputchar fputwchar + #define wxGetc getwc + #define wxGetchar getwchar + #define wxGets getws + #define wxUngetc ungetwc + + #define wxNEED_PRINTF_CONVERSION + + #define wxPutc putwc + #define wxPutchar putwchar + #define wxFputs fputws + + /* stdio.h functions */ + + #define wxNEED_WX_STDIO_H + + /* stdlib.h functions */ + #ifdef __MACH__ + #define wxNEED_WX_STDLIB_H + #else + #define wxAtof watof + #define wxAtoi watoi + #define wxAtol watol + #define wxGetenv(a) ((wxChar*)NULL) + #define wxSystem(a) ((int)NULL) + #endif + /* time.h functions */ + #define wxAsctime wasciitime + #define wxCtime wctime + /* #define wxStrftime wcsftime */ + + #define wxNEED_WX_TIME_H + #else /* !metrowerks for apple */ + #error "Please define wide character functions for your environment" + #endif + #else /* ASCII */ + #include + #include + + /* ctype.h functions */ + #define wxIsalnum isalnum + #define wxIsalpha isalpha + #define wxIscntrl iscntrl + #define wxIsdigit isdigit + #define wxIsgraph isgraph + #define wxIslower islower + #define wxIsprint isprint + #define wxIspunct ispunct + #define wxIsspace isspace + #define wxIsupper isupper + #define wxIsxdigit isxdigit + #define wxTolower tolower + #define wxToupper toupper + + /* locale.h functons */ + #define wxSetlocale setlocale + + /* string.h functions */ + #define wxStrcat strcat + #define wxStrchr strchr + #define wxStrcmp strcmp + #define wxStrcoll strcoll + #define wxStrcpy strcpy + #define wxStrcspn strcspn + + /* wxStricmp and wxStrnicmp are defined below */ + #define wxStrlen_ strlen /* used in wxStrlen inline function */ + #define wxStrncat strncat + #define wxStrncmp strncmp + #define wxStrncpy strncpy + #define wxStrpbrk strpbrk + #define wxStrrchr strrchr + #define wxStrspn strspn + #define wxStrstr strstr + #define wxStrtod strtod + #ifdef HAVE_STRTOK_R + #define wxStrtok(str, sep, last) strtok_r(str, sep, last) + #endif + #define wxStrtol strtol + #define wxStrtoul strtoul + #ifdef HAVE_STRTOULL + /* assume that we have wcstoull(), which is also C99, too */ + #define wxStrtoll strtoll + #define wxStrtoull strtoull + #endif /* HAVE_WCSTOULL */ + #define wxStrxfrm strxfrm + + /* stdio.h functions */ + #define wxFopen fopen + #define wxFreopen freopen + #define wxRemove remove + #define wxRename rename + + #define wxPerror perror + #define wxTmpnam tmpnam + + #define wxFgetc fgetc + #define wxFgetchar fgetchar + #define wxFgets fgets + #define wxFputc fputc + #define wxFputs fputs + #define wxFputchar fputchar + #define wxFprintf fprintf + #define wxFscanf fscanf + #define wxGetc getc + #define wxGetchar getchar + #define wxGets gets + #define wxPrintf printf + #define wxPutc putc + #define wxPutchar putchar + #define wxPuts puts + #define wxScanf scanf + #define wxSprintf sprintf + #define wxSscanf sscanf + #define wxUngetc ungetc + #define wxVfprintf vfprintf + #define wxVprintf vprintf + #define wxVsscanf vsscanf + #define wxVsprintf vsprintf + + /* stdlib.h functions */ + #define wxAtof atof + #define wxAtoi atoi + #define wxAtol atol + #define wxGetenv getenv + #define wxSystem system + + /* time.h functions */ + #define wxAsctime asctime + #define wxCtime ctime + #define wxStrftime strftime + #endif /* Unicode/ASCII */ +#endif /* TCHAR-aware compilers/the others */ + +#ifdef wxStrtoll + #define wxHAS_STRTOLL +#endif + +/* + various special cases + */ + +/* define wxStricmp and wxStrnicmp for various compilers */ + +/* note that in Unicode mode we definitely are going to need our own version */ +#if !defined(wxStricmp) && !wxUSE_UNICODE + #if defined(__BORLANDC__) || defined(__WATCOMC__) || \ + defined(__SALFORDC__) || defined(__VISAGECPP__) || \ + defined(__EMX__) || defined(__DJGPP__) + #define wxStricmp stricmp + #define wxStrnicmp strnicmp + #elif defined(__WXPALMOS__) + /* FIXME: There is no equivalent to strnicmp in the Palm OS API. This + * quick hack should do until one can be written. + */ + #define wxStricmp StrCaselessCompare + #define wxStrnicmp strnicmp + #elif defined(__SYMANTEC__) || defined(__VISUALC__) || \ + (defined(__MWERKS__) && defined(__INTEL__)) + #define wxStricmp _stricmp + #define wxStrnicmp _strnicmp + #elif defined(__UNIX__) || defined(__GNUWIN32__) + #define wxStricmp strcasecmp + #define wxStrnicmp strncasecmp + /* #else -- use wxWidgets implementation */ + #endif +#endif /* !defined(wxStricmp) */ + +/* define wxWcslen() which should be always available if wxUSE_WCHAR_T == 1 (as */ +/* it's used in wx/buffer.h -- and also might be used just below by wxStrlen() */ +/* when wxStrlen_() is #define'd as wxWcslen so do it before defining wxStrlen) */ +#if wxUSE_WCHAR_T + #ifdef HAVE_WCSLEN + #define wxWcslen wcslen + #else + WXDLLIMPEXP_BASE size_t wxWcslen(const wchar_t *s); + #endif +#endif /* wxUSE_WCHAR_T */ + +#ifdef __cplusplus +/* checks whether the passed in pointer is NULL and if the string is empty */ +inline bool wxIsEmpty(const wxChar *p) { return !p || !*p; } + +/* safe version of strlen() (returns 0 if passed NULL pointer) */ +inline size_t wxStrlen(const wxChar *psz) { return psz ? wxStrlen_(psz) : 0; } +#endif + +/* + each of strdup() and wcsdup() may or may not be available but we need both + of them anyhow for wx/buffer.h so we define the missing one(s) in + wxchar.cpp and so we should always have both wxStrdupA and wxStrdupW + defined -- if this is somehow not the case in some situations, please + correct that and not the lines here + */ +#if wxUSE_UNICODE + #define wxStrdup wxStrdupW +#else + #define wxStrdup wxStrdupA +#endif + +#ifdef __cplusplus +WXDLLIMPEXP_BASE bool wxOKlibc(); /* for internal use */ +#endif + +/* printf() family saga */ + +/* + For some systems [v]snprintf() exists in the system libraries but not in the + headers, so we need to declare it ourselves to be able to use it. + */ +#if defined(HAVE_VSNPRINTF) && !defined(HAVE_VSNPRINTF_DECL) +#ifdef __cplusplus + extern "C" +#else + extern +#endif + int vsnprintf(char *str, size_t size, const char *format, va_list ap); +#endif /* !HAVE_VSNPRINTF_DECL */ + +#if defined(HAVE_SNPRINTF) && !defined(HAVE_SNPRINTF_DECL) +#ifdef __cplusplus + extern "C" +#else + extern +#endif + WXDLLIMPEXP_BASE int snprintf(char *str, size_t size, const char *format, ...); +#endif /* !HAVE_SNPRINTF_DECL */ + +/* Wrapper for vsnprintf if it's 3rd parameter is non-const. Note: the + * same isn't done for snprintf below, the builtin wxSnprintf_ is used + * instead since it's already a simple wrapper */ +#if defined __cplusplus && defined HAVE_BROKEN_VSNPRINTF_DECL + inline int wx_fixed_vsnprintf(char *str, size_t size, const char *format, va_list ap) + { + return vsnprintf(str, size, (char*)format, ap); + } +#endif + +/* + MinGW MSVCRT has non-standard vswprintf() (for MSVC compatibility + presumably) and normally _vsnwprintf() is used instead (but as + STLPort 5.1 defines standard vswprintf(), don't do this for it) + */ +#if defined(HAVE_VSWPRINTF) && defined(__MINGW32__) && !( defined(_STLPORT_VERSION) && _STLPORT_VERSION >= 0x510 ) + #undef HAVE_VSWPRINTF +#endif + +#if wxUSE_PRINTF_POS_PARAMS + /* + The systems where vsnprintf() supports positional parameters should + define the HAVE_UNIX98_PRINTF symbol. + + On systems which don't (e.g. Windows) we are forced to use + our wxVsnprintf() implementation. + */ + #if defined(HAVE_UNIX98_PRINTF) + #if wxUSE_UNICODE + #ifdef HAVE_VSWPRINTF + #define wxVsnprintf_ vswprintf + #endif + #else /* ASCII */ + #ifdef HAVE_BROKEN_VSNPRINTF_DECL + #define wxVsnprintf_ wx_fixed_vsnprintf + #else + #define wxVsnprintf_ vsnprintf + #endif + #endif + #else /* !HAVE_UNIX98_PRINTF */ + /* + The only compiler with positional parameters support under Windows + is VC++ 8.0 which provides a new xxprintf_p() functions family. + The 2003 PSDK includes a slightly earlier version of VC8 than the + main release and does not have the printf_p functions. + */ + #if defined _MSC_FULL_VER && _MSC_FULL_VER >= 140050727 && !defined __WXWINCE__ + #if wxUSE_UNICODE + #define wxVsnprintf_ _vswprintf_p + #else + #define wxVsnprintf_ _vsprintf_p + #endif + #endif + #endif /* HAVE_UNIX98_PRINTF/!HAVE_UNIX98_PRINTF */ +#else /* !wxUSE_PRINTF_POS_PARAMS */ + /* + We always want to define safe snprintf() function to be used instead of + sprintf(). Some compilers already have it (or rather vsnprintf() which + we really need...), otherwise we implement it using our own printf() + code. + + We define function with a trailing underscore here because the real one + is a wrapper around it as explained below + */ + + /* first deal with TCHAR-aware compilers which have _vsntprintf */ + #ifndef wxVsnprintf_ + #if defined(__VISUALC__) || \ + (defined(__BORLANDC__) && __BORLANDC__ >= 0x540) + #define wxVsnprintf_ _vsntprintf + #define wxSnprintf_ _sntprintf + #endif + #endif + + /* if this didn't work, define it separately for Unicode and ANSI builds */ + #ifndef wxVsnprintf_ + #if wxUSE_UNICODE + #if defined(HAVE__VSNWPRINTF) + #define wxVsnprintf_ _vsnwprintf + #elif defined(HAVE_VSWPRINTF) + #define wxVsnprintf_ vswprintf + #elif defined(__WATCOMC__) + #define wxVsnprintf_ _vsnwprintf + #define wxSnprintf_ _snwprintf + #endif + #else /* ASCII */ + /* + All versions of CodeWarrior supported by wxWidgets apparently + have both snprintf() and vsnprintf() + */ + #if defined(HAVE_SNPRINTF) \ + || defined(__MWERKS__) || defined(__WATCOMC__) + #ifndef HAVE_BROKEN_SNPRINTF_DECL + #define wxSnprintf_ snprintf + #endif + #endif + #if defined(HAVE_VSNPRINTF) \ + || defined(__MWERKS__) || defined(__WATCOMC__) + #ifdef HAVE_BROKEN_VSNPRINTF_DECL + #define wxVsnprintf_ wx_fixed_vsnprintf + #else + #define wxVsnprintf_ vsnprintf + #endif + #endif + #endif /* Unicode/ASCII */ + #endif /* wxVsnprintf_ */ +#endif /* wxUSE_PRINTF_POS_PARAMS/!wxUSE_PRINTF_POS_PARAMS */ + +#ifndef wxSnprintf_ + /* no snprintf(), cook our own */ + WXDLLIMPEXP_BASE int + wxSnprintf_(wxChar *buf, size_t len, const wxChar *format, ...) ATTRIBUTE_PRINTF_3; +#endif +#ifndef wxVsnprintf_ + /* no (suitable) vsnprintf(), cook our own */ + WXDLLIMPEXP_BASE int + wxVsnprintf_(wxChar *buf, size_t len, const wxChar *format, va_list argptr); + + #define wxUSE_WXVSNPRINTF 1 +#else + #define wxUSE_WXVSNPRINTF 0 +#endif + +/* + In Unicode mode we need to have all standard functions such as wprintf() and + so on but not all systems have them so use our own implementations in this + case. + */ +#if wxUSE_UNICODE && !defined(wxHAVE_TCHAR_SUPPORT) && !defined(HAVE_WPRINTF) + #define wxNEED_WPRINTF +#endif + +/* + More Unicode complications: although both ANSI C and C++ define a number of + wide character functions such as wprintf(), not all environments have them. + Worse, those which do have different behaviours: under Windows, %s format + specifier changes its meaning in Unicode build and expects a Unicode string + while under Unix/POSIX it still means an ASCII string even for wprintf() and + %ls has to be used for wide strings. + + We choose to always emulate Windows behaviour as more useful for us so even + if we have wprintf() we still must wrap it in a non trivial wxPrintf(). + +*/ + +#if defined(wxNEED_PRINTF_CONVERSION) || defined(wxNEED_WPRINTF) + /* + we need to implement all wide character printf and scanf functions + either because we don't have them at all or because they don't have the + semantics we need + */ + int wxScanf( const wxChar *format, ... ) ATTRIBUTE_PRINTF_1; + int wxSscanf( const wxChar *str, const wxChar *format, ... ) ATTRIBUTE_PRINTF_2; + int wxFscanf( FILE *stream, const wxChar *format, ... ) ATTRIBUTE_PRINTF_2; + int wxVsscanf( const wxChar *str, const wxChar *format, va_list ap ); + int wxPrintf( const wxChar *format, ... ) ATTRIBUTE_PRINTF_1; + int wxSprintf( wxChar *str, const wxChar *format, ... ) ATTRIBUTE_PRINTF_2; + int wxFprintf( FILE *stream, const wxChar *format, ... ) ATTRIBUTE_PRINTF_2; + int wxVfprintf( FILE *stream, const wxChar *format, va_list ap ); + int wxVprintf( const wxChar *format, va_list ap ); + int wxVsprintf( wxChar *str, const wxChar *format, va_list ap ); +#endif /* wxNEED_PRINTF_CONVERSION */ + +/* these 2 can be simply mapped to the versions with underscore at the end */ +/* if we don't have to do the conversion */ +/* + However, if we don't have any vswprintf() at all we don't need to redefine + anything as our own wxVsnprintf_() already behaves as needed. +*/ +#if defined(wxNEED_PRINTF_CONVERSION) && defined(wxVsnprintf_) + int wxSnprintf( wxChar *str, size_t size, const wxChar *format, ... ) ATTRIBUTE_PRINTF_3; + int wxVsnprintf( wxChar *str, size_t size, const wxChar *format, va_list ap ); +#else + #define wxSnprintf wxSnprintf_ + #define wxVsnprintf wxVsnprintf_ +#endif + +/* + various functions which might not be available in libc and for which we + provide our own replacements in wxchar.cpp + */ + +/* ctype.h functions */ + +/* RN: Used only under OSX <= 10.2 currently */ +#ifdef wxNEED_WX_CTYPE_H + WXDLLIMPEXP_BASE int wxIsalnum(wxChar ch); + WXDLLIMPEXP_BASE int wxIsalpha(wxChar ch); + WXDLLIMPEXP_BASE int wxIscntrl(wxChar ch); + WXDLLIMPEXP_BASE int wxIsdigit(wxChar ch); + WXDLLIMPEXP_BASE int wxIsgraph(wxChar ch); + WXDLLIMPEXP_BASE int wxIslower(wxChar ch); + WXDLLIMPEXP_BASE int wxIsprint(wxChar ch); + WXDLLIMPEXP_BASE int wxIspunct(wxChar ch); + WXDLLIMPEXP_BASE int wxIsspace(wxChar ch); + WXDLLIMPEXP_BASE int wxIsupper(wxChar ch); + WXDLLIMPEXP_BASE int wxIsxdigit(wxChar ch); + WXDLLIMPEXP_BASE int wxTolower(wxChar ch); + WXDLLIMPEXP_BASE int wxToupper(wxChar ch); +#endif /* wxNEED_WX_CTYPE_H */ + +/* under VC++ 6.0 isspace() returns 1 for 8 bit chars which completely breaks */ +/* the file parsing -- this may be true for 5.0 as well, update #ifdef then */ +#if defined(__VISUALC__) && (__VISUALC__ >= 1200) && !wxUSE_UNICODE + #undef wxIsspace + #define wxIsspace(c) ((((unsigned)c) < 128) && isspace(c)) +#endif /* VC++ */ + +/* + a few compilers don't have the (non standard but common) isascii function, + define it ourselves for them + */ +#ifndef isascii + #if defined(__MWERKS__) + #define wxNEED_ISASCII + #elif defined(_WIN32_WCE) + #if _WIN32_WCE <= 211 + #define wxNEED_ISASCII + #endif + #endif +#endif /* isascii */ + +#ifdef wxNEED_ISASCII + inline int isascii(int c) { return (unsigned)c < 0x80; } +#endif + +#ifdef _WIN32_WCE + #if _WIN32_WCE <= 211 + #define isspace(c) ((c) == wxT(' ') || (c) == wxT('\t')) + #endif +#endif /* _WIN32_WCE */ + +/* + we had goofed and defined wxIsctrl() instead of (correct) wxIscntrl() in the + initial versions of this header -- now it is too late to remove it so + although we fixed the function/macro name above, still provide the + backwards-compatible synonym. + */ +#define wxIsctrl wxIscntrl + +/* string.h functions */ +#ifndef strdup + #if defined(__MWERKS__) && !defined(__MACH__) && (__MSL__ < 0x00008000) + #define wxNEED_STRDUP + #elif defined(__WXWINCE__) + #if _WIN32_WCE <= 211 + #define wxNEED_STRDUP + #endif + #endif +#endif /* strdup */ + +#ifdef wxNEED_STRDUP + WXDLLIMPEXP_BASE char *strdup(const char* s); +#endif + +/* RN: Used only under OSX <= 10.2 currently + The __cplusplus ifdefs are messy, but they are required to build + the regex library, since c does not support function overloading +*/ +#ifdef wxNEED_WX_STRING_H +# ifdef __cplusplus + extern "C" { +# endif + WXDLLIMPEXP_BASE wxChar * wxStrcat(wxChar *dest, const wxChar *src); + WXDLLIMPEXP_BASE const wxChar * wxStrchr(const wxChar *s, wxChar c); + WXDLLIMPEXP_BASE int wxStrcmp(const wxChar *s1, const wxChar *s2); + WXDLLIMPEXP_BASE int wxStrcoll(const wxChar *s1, const wxChar *s2); + WXDLLIMPEXP_BASE wxChar * wxStrcpy(wxChar *dest, const wxChar *src); + WXDLLIMPEXP_BASE size_t wxStrcspn(const wxChar *s, const wxChar *reject); + WXDLLIMPEXP_BASE wxChar * wxStrncat(wxChar *dest, const wxChar *src, size_t n); + WXDLLIMPEXP_BASE int wxStrncmp(const wxChar *s1, const wxChar *s2, size_t n); + WXDLLIMPEXP_BASE wxChar * wxStrncpy(wxChar *dest, const wxChar *src, size_t n); + WXDLLIMPEXP_BASE const wxChar * wxStrpbrk(const wxChar *s, const wxChar *accept); + WXDLLIMPEXP_BASE const wxChar * wxStrrchr(const wxChar *s, wxChar c); + WXDLLIMPEXP_BASE size_t wxStrspn(const wxChar *s, const wxChar *accept); + WXDLLIMPEXP_BASE const wxChar * wxStrstr(const wxChar *haystack, const wxChar *needle); +# ifdef __cplusplus + } +# endif + + /* These functions use C++, so we can't c extern them */ + WXDLLIMPEXP_BASE double wxStrtod(const wxChar *nptr, wxChar **endptr); + WXDLLIMPEXP_BASE long int wxStrtol(const wxChar *nptr, wxChar **endptr, int base); + WXDLLIMPEXP_BASE unsigned long int wxStrtoul(const wxChar *nptr, wxChar **endptr, int base); + WXDLLIMPEXP_BASE size_t wxStrxfrm(wxChar *dest, const wxChar *src, size_t n); + + /* inlined versions */ + #ifdef __cplusplus + inline wxChar * wxStrchr(wxChar *s, wxChar c) + { return (wxChar *)wxStrchr((const wxChar *)s, c); } + inline wxChar * wxStrpbrk(wxChar *s, const wxChar *accept) + { return (wxChar *)wxStrpbrk((const wxChar *)s, accept); } + inline wxChar * wxStrrchr(wxChar *s, wxChar c) + { return (wxChar *)wxStrrchr((const wxChar *)s, c); } + inline wxChar *wxStrstr(wxChar *haystack, const wxChar *needle) + { return (wxChar *)wxStrstr((const wxChar *)haystack, needle); } + #endif + +#endif /* wxNEED_WX_STRING_H */ + +#ifndef wxStrdupA +WXDLLIMPEXP_BASE char *wxStrdupA(const char *psz); +#endif + +#ifndef wxStrdupW +WXDLLIMPEXP_BASE wchar_t *wxStrdupW(const wchar_t *pwz); +#endif + +#ifndef wxStricmp +WXDLLIMPEXP_BASE int wxStricmp(const wxChar *psz1, const wxChar *psz2); +#endif + +#ifndef wxStrnicmp +WXDLLIMPEXP_BASE int wxStrnicmp(const wxChar *psz1, const wxChar *psz2, size_t len); +#endif + +#ifndef wxStrtok +WXDLLIMPEXP_BASE wxChar * wxStrtok(wxChar *psz, const wxChar *delim, wxChar **save_ptr); +#endif + +#ifdef __cplusplus +#ifndef wxSetlocale +class WXDLLIMPEXP_BASE wxWCharBuffer; +WXDLLIMPEXP_BASE wxWCharBuffer wxSetlocale(int category, const wxChar *locale); +#endif +#endif + +/* stdio.h functions */ +#ifdef wxNEED_WX_STDIO_H + #include + WXDLLIMPEXP_BASE FILE * wxFopen(const wxChar *path, const wxChar *mode); + WXDLLIMPEXP_BASE FILE * wxFreopen(const wxChar *path, const wxChar *mode, FILE *stream); + WXDLLIMPEXP_BASE int wxRemove(const wxChar *path); + WXDLLIMPEXP_BASE int wxRename(const wxChar *oldpath, const wxChar *newpath); + + /* *printf() family is handled separately */ +#endif /* wxNEED_WX_STDIO_H */ + + +/* stdlib.h functions */ +#ifndef wxAtof +WXDLLIMPEXP_BASE double wxAtof(const wxChar *psz); +#endif + +/* + mingw32 doesn't provide _tsystem() even though it does provide all the other + stdlib.h functions wrappers so check for it separately: + */ +#if defined(__MINGW32__) && wxUSE_UNICODE && !defined(_tsystem) + #define wxNEED_WXSYSTEM +#endif + +#ifdef wxNEED_WX_STDLIB_H +WXDLLIMPEXP_BASE int wxAtoi(const wxChar *psz); +WXDLLIMPEXP_BASE long wxAtol(const wxChar *psz); +WXDLLIMPEXP_BASE wxChar * wxGetenv(const wxChar *name); +#define wxNEED_WXSYSTEM +#endif + +#ifdef wxNEED_WXSYSTEM +WXDLLIMPEXP_BASE int wxSystem(const wxChar *psz); +#endif + + +/* time.h functions */ +#ifdef wxNEED_WX_TIME_H +#if defined(__MWERKS__) && defined(macintosh) + #include +#endif + /*silent gabby compilers*/ + struct tm; + WXDLLIMPEXP_BASE size_t wxStrftime(wxChar *s, size_t max, + const wxChar *fmt, const struct tm *tm); +#endif /* wxNEED_WX_TIME_H */ + +#ifndef wxCtime +#include +WXDLLIMPEXP_BASE wxChar *wxCtime(const time_t *timep); +#endif + + +/* missing functions in some WinCE versions */ +#ifdef _WIN32_WCE +#if (_WIN32_WCE < 300) +WXDLLIMPEXP_BASE void *calloc( size_t num, size_t size ); +#endif +#endif /* _WIN32_WCE */ + +/* multibyte to wide char conversion functions and macros */ + +#if wxUSE_WCHAR_T + /* multibyte<->widechar conversion */ + WXDLLIMPEXP_BASE size_t wxMB2WC(wchar_t *buf, const char *psz, size_t n); + WXDLLIMPEXP_BASE size_t wxWC2MB(char *buf, const wchar_t *psz, size_t n); + + #if wxUSE_UNICODE + #define wxMB2WX wxMB2WC + #define wxWX2MB wxWC2MB + #define wxWC2WX wxStrncpy + #define wxWX2WC wxStrncpy + #else + #define wxMB2WX wxStrncpy + #define wxWX2MB wxStrncpy + #define wxWC2WX wxWC2MB + #define wxWX2WC wxMB2WC + #endif +#else /* !wxUSE_UNICODE */ +/* Why is this here? +#error ha */ + /* No wxUSE_WCHAR_T: we have to do something (JACS) */ + #define wxMB2WC wxStrncpy + #define wxWC2MB wxStrncpy + #define wxMB2WX wxStrncpy + #define wxWX2MB wxStrncpy + #define wxWC2WX wxWC2MB + #define wxWX2WC wxMB2WC +#endif + +/* + RN: The following are not normal versions of memcpy et al., rather + these are either char or widechar versions depending on + if unicode is used or not. +*/ + +#ifdef __cplusplus + + // + // RN: We could do the usual tricky compiler detection here, + // and use their variant (such as wmemchr, etc.). The problem + // is that these functions are quite rare, even though they are + // part of the current POSIX standard. In addition, most compilers + // (including even MSC) inline them just like we do right in their + // headers. + // + #include + #if wxUSE_UNICODE + //implement our own wmem variants + inline wxChar* wxTmemchr(const wxChar* s, wxChar c, size_t l) + { + for(;l && *s != c;--l, ++s) {} + + if(l) + return (wxChar*)s; + return NULL; + } + + inline int wxTmemcmp(const wxChar* sz1, const wxChar* sz2, size_t len) + { + for(; *sz1 == *sz2 && len; --len, ++sz1, ++sz2) {} + + if(len) + return *sz1 < *sz2 ? -1 : *sz1 > *sz2; + else + return 0; + } + + inline wxChar* wxTmemcpy(wxChar* szOut, const wxChar* szIn, size_t len) + { + return (wxChar*) memcpy(szOut, szIn, len * sizeof(wxChar)); + } + + inline wxChar* wxTmemmove(wxChar* szOut, const wxChar* szIn, size_t len) + { + return (wxChar*) memmove(szOut, szIn, len * sizeof(wxChar)); + } + + inline wxChar* wxTmemset(wxChar* szOut, const wxChar cIn, size_t len) + { + wxChar* szRet = szOut; + + while (len--) + *szOut++ = cIn; + + return szRet; + } + #else /* !wxUSE_UNICODE */ + #if wxABI_VERSION >= 20805 + // for compatibility with earlier versions, these functions take + // "void *" but in the next wx version they will take "char *" so + // don't use them with void pointers (use the standard memxxx() + // with them) + inline char* wxTmemchr(const void* s, int c, size_t len) + { return (char*)memchr(s, c, len); } + inline int wxTmemcmp(const void* sz1, const void* sz2, size_t len) + { return memcmp(sz1, sz2, len); } + inline char* wxTmemcpy(void* szOut, const void* szIn, size_t len) + { return (char*)memcpy(szOut, szIn, len); } + inline char* wxTmemmove(void* szOut, const void* szIn, size_t len) + { return (char*)memmove(szOut, szIn, len); } + inline char* wxTmemset(void* szOut, int c, size_t len) + { return (char*)memset(szOut, c, len); } + #else + # define wxTmemchr memchr + # define wxTmemcmp memcmp + # define wxTmemcpy memcpy + # define wxTmemmove memmove + # define wxTmemset memset + #endif + #endif /* wxUSE_UNICODE/!wxUSE_UNICODE */ + +#endif /*__cplusplus*/ + + +#endif /* _WX_WXCHAR_H_ */ + diff --git a/Source/3rd Party/wx/include/wx/wxcrt.h b/Source/3rd Party/wx/include/wx/wxcrt.h deleted file mode 100644 index 38727d20a..000000000 --- a/Source/3rd Party/wx/include/wx/wxcrt.h +++ /dev/null @@ -1,987 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/wxcrt.h -// Purpose: Type-safe ANSI and Unicode builds compatible wrappers for -// CRT functions -// Author: Joel Farley, Ove Kaaven -// Modified by: Vadim Zeitlin, Robert Roebling, Ron Lee, Vaclav Slavik -// Created: 1998/06/12 -// RCS-ID: $Id$ -// Copyright: (c) 1998-2006 wxWidgets dev team -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_WXCRT_H_ -#define _WX_WXCRT_H_ - -#include "wx/wxcrtbase.h" -#include "wx/string.h" - -#ifndef __WX_SETUP_H__ -// For non-configure builds assume vsscanf is available, if not Visual C or DMC -#if !defined (__VISUALC__) && !defined (__DMC__) - #define HAVE_VSSCANF 1 -#endif -#endif - -// ============================================================================ -// misc functions -// ============================================================================ - -/* checks whether the passed in pointer is NULL and if the string is empty */ -inline bool wxIsEmpty(const char *s) { return !s || !*s; } -inline bool wxIsEmpty(const wchar_t *s) { return !s || !*s; } -inline bool wxIsEmpty(const wxScopedCharBuffer& s) { return wxIsEmpty(s.data()); } -inline bool wxIsEmpty(const wxScopedWCharBuffer& s) { return wxIsEmpty(s.data()); } -inline bool wxIsEmpty(const wxString& s) { return s.empty(); } -inline bool wxIsEmpty(const wxCStrData& s) { return s.AsString().empty(); } - - - -/* multibyte to wide char conversion functions and macros */ - -/* multibyte<->widechar conversion */ -WXDLLIMPEXP_BASE size_t wxMB2WC(wchar_t *buf, const char *psz, size_t n); -WXDLLIMPEXP_BASE size_t wxWC2MB(char *buf, const wchar_t *psz, size_t n); - -#if wxUSE_UNICODE - #define wxMB2WX wxMB2WC - #define wxWX2MB wxWC2MB - #define wxWC2WX wxStrncpy - #define wxWX2WC wxStrncpy -#else - #define wxMB2WX wxStrncpy - #define wxWX2MB wxStrncpy - #define wxWC2WX wxWC2MB - #define wxWX2WC wxMB2WC -#endif - - -// RN: We could do the usual tricky compiler detection here, -// and use their variant (such as wmemchr, etc.). The problem -// is that these functions are quite rare, even though they are -// part of the current POSIX standard. In addition, most compilers -// (including even MSC) inline them just like we do right in their -// headers. -// -#include - -#if wxUSE_UNICODE - //implement our own wmem variants - inline wxChar* wxTmemchr(const wxChar* s, wxChar c, size_t l) - { - for(;l && *s != c;--l, ++s) {} - - if(l) - return const_cast(s); - return NULL; - } - - inline int wxTmemcmp(const wxChar* sz1, const wxChar* sz2, size_t len) - { - for(; *sz1 == *sz2 && len; --len, ++sz1, ++sz2) {} - - if(len) - return *sz1 < *sz2 ? -1 : *sz1 > *sz2; - else - return 0; - } - - inline wxChar* wxTmemcpy(wxChar* szOut, const wxChar* szIn, size_t len) - { - return (wxChar*) memcpy(szOut, szIn, len * sizeof(wxChar)); - } - - inline wxChar* wxTmemmove(wxChar* szOut, const wxChar* szIn, size_t len) - { - return (wxChar*) memmove(szOut, szIn, len * sizeof(wxChar)); - } - - inline wxChar* wxTmemset(wxChar* szOut, const wxChar cIn, size_t len) - { - wxChar* szRet = szOut; - - while (len--) - *szOut++ = cIn; - - return szRet; - } -#endif /* wxUSE_UNICODE */ - -// provide trivial wrappers for char* versions for both ANSI and Unicode builds -// (notice that these intentionally return "char *" and not "void *" unlike the -// standard memxxx() for symmetry with the wide char versions): -inline char* wxTmemchr(const char* s, char c, size_t len) - { return (char*)memchr(s, c, len); } -inline int wxTmemcmp(const char* sz1, const char* sz2, size_t len) - { return memcmp(sz1, sz2, len); } -inline char* wxTmemcpy(char* szOut, const char* szIn, size_t len) - { return (char*)memcpy(szOut, szIn, len); } -inline char* wxTmemmove(char* szOut, const char* szIn, size_t len) - { return (char*)memmove(szOut, szIn, len); } -inline char* wxTmemset(char* szOut, const char cIn, size_t len) - { return (char*)memset(szOut, cIn, len); } - - -// ============================================================================ -// wx wrappers for CRT functions in both char* and wchar_t* versions -// ============================================================================ - -// A few notes on implementation of these wrappers: -// -// We need both char* and wchar_t* versions of functions like wxStrlen() for -// compatibility with both ANSI and Unicode builds. -// -// This makes passing wxString or c_str()/mb_str()/wc_str() result to them -// ambiguous, so we need to provide overrides for that as well (in cases where -// it makes sense). -// -// We can do this without problems for some functions (wxStrlen()), but in some -// cases, we can't stay compatible with both ANSI and Unicode builds, e.g. for -// wxStrcpy(const wxString&), which can only return either char* or wchar_t*. -// In these cases, we preserve ANSI build compatibility by returning char*. - -// ---------------------------------------------------------------------------- -// locale functions -// ---------------------------------------------------------------------------- - -// NB: we can't provide const wchar_t* (= wxChar*) overload, because calling -// wxSetlocale(category, NULL) -- which is a common thing to do -- would be -// ambiguous -WXDLLIMPEXP_BASE char* wxSetlocale(int category, const char *locale); -inline char* wxSetlocale(int category, const wxScopedCharBuffer& locale) - { return wxSetlocale(category, locale.data()); } -inline char* wxSetlocale(int category, const wxString& locale) - { return wxSetlocale(category, locale.mb_str()); } -inline char* wxSetlocale(int category, const wxCStrData& locale) - { return wxSetlocale(category, locale.AsCharBuf()); } - -// ---------------------------------------------------------------------------- -// string functions -// ---------------------------------------------------------------------------- - -/* safe version of strlen() (returns 0 if passed NULL pointer) */ -// NB: these are defined in wxcrtbase.h, see the comment there -// inline size_t wxStrlen(const char *s) { return s ? strlen(s) : 0; } -// inline size_t wxStrlen(const wchar_t *s) { return s ? wxCRT_Strlen_(s) : 0; } -inline size_t wxStrlen(const wxScopedCharBuffer& s) { return wxStrlen(s.data()); } -inline size_t wxStrlen(const wxScopedWCharBuffer& s) { return wxStrlen(s.data()); } -inline size_t wxStrlen(const wxString& s) { return s.length(); } -inline size_t wxStrlen(const wxCStrData& s) { return s.AsString().length(); } - -// this is a function new in 2.9 so we don't care about backwards compatibility and -// so don't need to support wxScopedCharBuffer/wxScopedWCharBuffer overloads -#if defined(wxCRT_StrnlenA) -inline size_t wxStrnlen(const char *str, size_t maxlen) { return wxCRT_StrnlenA(str, maxlen); } -#else -inline size_t wxStrnlen(const char *str, size_t maxlen) -{ - size_t n; - for ( n = 0; n < maxlen; n++ ) - if ( !str[n] ) - break; - - return n; -} -#endif - -#if defined(wxCRT_StrnlenW) -inline size_t wxStrnlen(const wchar_t *str, size_t maxlen) { return wxCRT_StrnlenW(str, maxlen); } -#else -inline size_t wxStrnlen(const wchar_t *str, size_t maxlen) -{ - size_t n; - for ( n = 0; n < maxlen; n++ ) - if ( !str[n] ) - break; - - return n; -} -#endif - -// NB: these are defined in wxcrtbase.h, see the comment there -// inline char* wxStrdup(const char *s) { return wxStrdupA(s); } -// inline wchar_t* wxStrdup(const wchar_t *s) { return wxStrdupW(s); } -inline char* wxStrdup(const wxScopedCharBuffer& s) { return wxStrdup(s.data()); } -inline wchar_t* wxStrdup(const wxScopedWCharBuffer& s) { return wxStrdup(s.data()); } -inline char* wxStrdup(const wxString& s) { return wxStrdup(s.mb_str()); } -inline char* wxStrdup(const wxCStrData& s) { return wxStrdup(s.AsCharBuf()); } - -inline char *wxStrcpy(char *dest, const char *src) - { return wxCRT_StrcpyA(dest, src); } -inline wchar_t *wxStrcpy(wchar_t *dest, const wchar_t *src) - { return wxCRT_StrcpyW(dest, src); } -inline char *wxStrcpy(char *dest, const wxString& src) - { return wxCRT_StrcpyA(dest, src.mb_str()); } -inline char *wxStrcpy(char *dest, const wxCStrData& src) - { return wxCRT_StrcpyA(dest, src.AsCharBuf()); } -inline char *wxStrcpy(char *dest, const wxScopedCharBuffer& src) - { return wxCRT_StrcpyA(dest, src.data()); } -inline wchar_t *wxStrcpy(wchar_t *dest, const wxString& src) - { return wxCRT_StrcpyW(dest, src.wc_str()); } -inline wchar_t *wxStrcpy(wchar_t *dest, const wxCStrData& src) - { return wxCRT_StrcpyW(dest, src.AsWCharBuf()); } -inline wchar_t *wxStrcpy(wchar_t *dest, const wxScopedWCharBuffer& src) - { return wxCRT_StrcpyW(dest, src.data()); } -inline char *wxStrcpy(char *dest, const wchar_t *src) - { return wxCRT_StrcpyA(dest, wxConvLibc.cWC2MB(src)); } -inline wchar_t *wxStrcpy(wchar_t *dest, const char *src) - { return wxCRT_StrcpyW(dest, wxConvLibc.cMB2WC(src)); } - -inline char *wxStrncpy(char *dest, const char *src, size_t n) - { return wxCRT_StrncpyA(dest, src, n); } -inline wchar_t *wxStrncpy(wchar_t *dest, const wchar_t *src, size_t n) - { return wxCRT_StrncpyW(dest, src, n); } -inline char *wxStrncpy(char *dest, const wxString& src, size_t n) - { return wxCRT_StrncpyA(dest, src.mb_str(), n); } -inline char *wxStrncpy(char *dest, const wxCStrData& src, size_t n) - { return wxCRT_StrncpyA(dest, src.AsCharBuf(), n); } -inline char *wxStrncpy(char *dest, const wxScopedCharBuffer& src, size_t n) - { return wxCRT_StrncpyA(dest, src.data(), n); } -inline wchar_t *wxStrncpy(wchar_t *dest, const wxString& src, size_t n) - { return wxCRT_StrncpyW(dest, src.wc_str(), n); } -inline wchar_t *wxStrncpy(wchar_t *dest, const wxCStrData& src, size_t n) - { return wxCRT_StrncpyW(dest, src.AsWCharBuf(), n); } -inline wchar_t *wxStrncpy(wchar_t *dest, const wxScopedWCharBuffer& src, size_t n) - { return wxCRT_StrncpyW(dest, src.data(), n); } -inline char *wxStrncpy(char *dest, const wchar_t *src, size_t n) - { return wxCRT_StrncpyA(dest, wxConvLibc.cWC2MB(src), n); } -inline wchar_t *wxStrncpy(wchar_t *dest, const char *src, size_t n) - { return wxCRT_StrncpyW(dest, wxConvLibc.cMB2WC(src), n); } - -// this is a function new in 2.9 so we don't care about backwards compatibility and -// so don't need to support wchar_t/char overloads -inline size_t wxStrlcpy(char *dest, const char *src, size_t n) -{ - const size_t len = wxCRT_StrlenA(src); - - if ( n ) - { - if ( n-- > len ) - n = len; - wxCRT_StrncpyA(dest, src, n); - dest[n] = '\0'; - } - - return len; -} -inline size_t wxStrlcpy(wchar_t *dest, const wchar_t *src, size_t n) -{ - const size_t len = wxCRT_StrlenW(src); - if ( n ) - { - if ( n-- > len ) - n = len; - wxCRT_StrncpyW(dest, src, n); - dest[n] = L'\0'; - } - - return len; -} - -inline char *wxStrcat(char *dest, const char *src) - { return wxCRT_StrcatA(dest, src); } -inline wchar_t *wxStrcat(wchar_t *dest, const wchar_t *src) - { return wxCRT_StrcatW(dest, src); } -inline char *wxStrcat(char *dest, const wxString& src) - { return wxCRT_StrcatA(dest, src.mb_str()); } -inline char *wxStrcat(char *dest, const wxCStrData& src) - { return wxCRT_StrcatA(dest, src.AsCharBuf()); } -inline char *wxStrcat(char *dest, const wxScopedCharBuffer& src) - { return wxCRT_StrcatA(dest, src.data()); } -inline wchar_t *wxStrcat(wchar_t *dest, const wxString& src) - { return wxCRT_StrcatW(dest, src.wc_str()); } -inline wchar_t *wxStrcat(wchar_t *dest, const wxCStrData& src) - { return wxCRT_StrcatW(dest, src.AsWCharBuf()); } -inline wchar_t *wxStrcat(wchar_t *dest, const wxScopedWCharBuffer& src) - { return wxCRT_StrcatW(dest, src.data()); } -inline char *wxStrcat(char *dest, const wchar_t *src) - { return wxCRT_StrcatA(dest, wxConvLibc.cWC2MB(src)); } -inline wchar_t *wxStrcat(wchar_t *dest, const char *src) - { return wxCRT_StrcatW(dest, wxConvLibc.cMB2WC(src)); } - -inline char *wxStrncat(char *dest, const char *src, size_t n) - { return wxCRT_StrncatA(dest, src, n); } -inline wchar_t *wxStrncat(wchar_t *dest, const wchar_t *src, size_t n) - { return wxCRT_StrncatW(dest, src, n); } -inline char *wxStrncat(char *dest, const wxString& src, size_t n) - { return wxCRT_StrncatA(dest, src.mb_str(), n); } -inline char *wxStrncat(char *dest, const wxCStrData& src, size_t n) - { return wxCRT_StrncatA(dest, src.AsCharBuf(), n); } -inline char *wxStrncat(char *dest, const wxScopedCharBuffer& src, size_t n) - { return wxCRT_StrncatA(dest, src.data(), n); } -inline wchar_t *wxStrncat(wchar_t *dest, const wxString& src, size_t n) - { return wxCRT_StrncatW(dest, src.wc_str(), n); } -inline wchar_t *wxStrncat(wchar_t *dest, const wxCStrData& src, size_t n) - { return wxCRT_StrncatW(dest, src.AsWCharBuf(), n); } -inline wchar_t *wxStrncat(wchar_t *dest, const wxScopedWCharBuffer& src, size_t n) - { return wxCRT_StrncatW(dest, src.data(), n); } -inline char *wxStrncat(char *dest, const wchar_t *src, size_t n) - { return wxCRT_StrncatA(dest, wxConvLibc.cWC2MB(src), n); } -inline wchar_t *wxStrncat(wchar_t *dest, const char *src, size_t n) - { return wxCRT_StrncatW(dest, wxConvLibc.cMB2WC(src), n); } - - -#define WX_STR_DECL(name, T1, T2) name(T1 s1, T2 s2) -#define WX_STR_CALL(func, a1, a2) func(a1, a2) - -// This macro defines string function for all possible variants of arguments, -// except for those taking wxString or wxCStrData as second argument. -// Parameters: -// rettype - return type -// name - name of the (overloaded) function to define -// crtA - function to call for char* versions (takes two arguments) -// crtW - ditto for wchar_t* function -// forString - function to call when the *first* argument is wxString; -// the second argument can be any string type, so this is -// typically a template -#define WX_STR_FUNC_NO_INVERT(rettype, name, crtA, crtW, forString) \ - inline rettype WX_STR_DECL(name, const char *, const char *) \ - { return WX_STR_CALL(crtA, s1, s2); } \ - inline rettype WX_STR_DECL(name, const char *, const wchar_t *) \ - { return WX_STR_CALL(forString, wxString(s1), wxString(s2)); } \ - inline rettype WX_STR_DECL(name, const char *, const wxScopedCharBuffer&) \ - { return WX_STR_CALL(crtA, s1, s2.data()); } \ - inline rettype WX_STR_DECL(name, const char *, const wxScopedWCharBuffer&) \ - { return WX_STR_CALL(forString, wxString(s1), s2.data()); } \ - \ - inline rettype WX_STR_DECL(name, const wchar_t *, const wchar_t *) \ - { return WX_STR_CALL(crtW, s1, s2); } \ - inline rettype WX_STR_DECL(name, const wchar_t *, const char *) \ - { return WX_STR_CALL(forString, wxString(s1), wxString(s2)); } \ - inline rettype WX_STR_DECL(name, const wchar_t *, const wxScopedWCharBuffer&) \ - { return WX_STR_CALL(crtW, s1, s2.data()); } \ - inline rettype WX_STR_DECL(name, const wchar_t *, const wxScopedCharBuffer&) \ - { return WX_STR_CALL(forString, wxString(s1), s2.data()); } \ - \ - inline rettype WX_STR_DECL(name, const wxScopedCharBuffer&, const char *) \ - { return WX_STR_CALL(crtA, s1.data(), s2); } \ - inline rettype WX_STR_DECL(name, const wxScopedCharBuffer&, const wchar_t *) \ - { return WX_STR_CALL(forString, wxString(s1), wxString(s2)); } \ - inline rettype WX_STR_DECL(name, const wxScopedCharBuffer&, const wxScopedCharBuffer&)\ - { return WX_STR_CALL(crtA, s1.data(), s2.data()); } \ - inline rettype WX_STR_DECL(name, const wxScopedCharBuffer&, const wxScopedWCharBuffer&) \ - { return WX_STR_CALL(forString, wxString(s1), wxString(s2)); } \ - \ - inline rettype WX_STR_DECL(name, const wxScopedWCharBuffer&, const wchar_t *) \ - { return WX_STR_CALL(crtW, s1.data(), s2); } \ - inline rettype WX_STR_DECL(name, const wxScopedWCharBuffer&, const char *) \ - { return WX_STR_CALL(forString, wxString(s1), wxString(s2)); } \ - inline rettype WX_STR_DECL(name, const wxScopedWCharBuffer&, const wxScopedWCharBuffer&) \ - { return WX_STR_CALL(crtW, s1.data(), s2.data()); } \ - inline rettype WX_STR_DECL(name, const wxScopedWCharBuffer&, const wxScopedCharBuffer&) \ - { return WX_STR_CALL(forString, wxString(s1), wxString(s2)); } \ - \ - inline rettype WX_STR_DECL(name, const wxString&, const char*) \ - { return WX_STR_CALL(forString, s1, s2); } \ - inline rettype WX_STR_DECL(name, const wxString&, const wchar_t*) \ - { return WX_STR_CALL(forString, s1, s2); } \ - inline rettype WX_STR_DECL(name, const wxString&, const wxScopedCharBuffer&) \ - { return WX_STR_CALL(forString, s1, s2); } \ - inline rettype WX_STR_DECL(name, const wxString&, const wxScopedWCharBuffer&) \ - { return WX_STR_CALL(forString, s1, s2); } \ - inline rettype WX_STR_DECL(name, const wxString&, const wxString&) \ - { return WX_STR_CALL(forString, s1, s2); } \ - inline rettype WX_STR_DECL(name, const wxString&, const wxCStrData&) \ - { return WX_STR_CALL(forString, s1, s2); } \ - \ - inline rettype WX_STR_DECL(name, const wxCStrData&, const char*) \ - { return WX_STR_CALL(forString, s1.AsString(), s2); } \ - inline rettype WX_STR_DECL(name, const wxCStrData&, const wchar_t*) \ - { return WX_STR_CALL(forString, s1.AsString(), s2); } \ - inline rettype WX_STR_DECL(name, const wxCStrData&, const wxScopedCharBuffer&) \ - { return WX_STR_CALL(forString, s1.AsString(), s2); } \ - inline rettype WX_STR_DECL(name, const wxCStrData&, const wxScopedWCharBuffer&) \ - { return WX_STR_CALL(forString, s1.AsString(), s2); } \ - inline rettype WX_STR_DECL(name, const wxCStrData&, const wxString&) \ - { return WX_STR_CALL(forString, s1.AsString(), s2); } \ - inline rettype WX_STR_DECL(name, const wxCStrData&, const wxCStrData&) \ - { return WX_STR_CALL(forString, s1.AsString(), s2); } - -// This defines strcmp-like function, i.e. one returning the result of -// comparison; see WX_STR_FUNC_NO_INVERT for explanation of the arguments -#define WX_STRCMP_FUNC(name, crtA, crtW, forString) \ - WX_STR_FUNC_NO_INVERT(int, name, crtA, crtW, forString) \ - \ - inline int WX_STR_DECL(name, const char *, const wxCStrData&) \ - { return -WX_STR_CALL(forString, s2.AsString(), s1); } \ - inline int WX_STR_DECL(name, const char *, const wxString&) \ - { return -WX_STR_CALL(forString, s2, s1); } \ - \ - inline int WX_STR_DECL(name, const wchar_t *, const wxCStrData&) \ - { return -WX_STR_CALL(forString, s2.AsString(), s1); } \ - inline int WX_STR_DECL(name, const wchar_t *, const wxString&) \ - { return -WX_STR_CALL(forString, s2, s1); } \ - \ - inline int WX_STR_DECL(name, const wxScopedCharBuffer&, const wxCStrData&) \ - { return -WX_STR_CALL(forString, s2.AsString(), s1.data()); } \ - inline int WX_STR_DECL(name, const wxScopedCharBuffer&, const wxString&) \ - { return -WX_STR_CALL(forString, s2, s1.data()); } \ - \ - inline int WX_STR_DECL(name, const wxScopedWCharBuffer&, const wxCStrData&) \ - { return -WX_STR_CALL(forString, s2.AsString(), s1.data()); } \ - inline int WX_STR_DECL(name, const wxScopedWCharBuffer&, const wxString&) \ - { return -WX_STR_CALL(forString, s2, s1.data()); } - - -// This defines a string function that is *not* strcmp-like, i.e. doesn't -// return the result of comparison and so if the second argument is a string, -// it has to be converted to char* or wchar_t* -#define WX_STR_FUNC(rettype, name, crtA, crtW, forString) \ - WX_STR_FUNC_NO_INVERT(rettype, name, crtA, crtW, forString) \ - \ - inline rettype WX_STR_DECL(name, const char *, const wxCStrData&) \ - { return WX_STR_CALL(crtA, s1, s2.AsCharBuf()); } \ - inline rettype WX_STR_DECL(name, const char *, const wxString&) \ - { return WX_STR_CALL(crtA, s1, s2.mb_str()); } \ - \ - inline rettype WX_STR_DECL(name, const wchar_t *, const wxCStrData&) \ - { return WX_STR_CALL(crtW, s1, s2.AsWCharBuf()); } \ - inline rettype WX_STR_DECL(name, const wchar_t *, const wxString&) \ - { return WX_STR_CALL(crtW, s1, s2.wc_str()); } \ - \ - inline rettype WX_STR_DECL(name, const wxScopedCharBuffer&, const wxCStrData&) \ - { return WX_STR_CALL(crtA, s1.data(), s2.AsCharBuf()); } \ - inline rettype WX_STR_DECL(name, const wxScopedCharBuffer&, const wxString&) \ - { return WX_STR_CALL(crtA, s1.data(), s2.mb_str()); } \ - \ - inline rettype WX_STR_DECL(name, const wxScopedWCharBuffer&, const wxCStrData&) \ - { return WX_STR_CALL(crtW, s1.data(), s2.AsWCharBuf()); } \ - inline rettype WX_STR_DECL(name, const wxScopedWCharBuffer&, const wxString&) \ - { return WX_STR_CALL(crtW, s1.data(), s2.wc_str()); } - -template -inline int wxStrcmp_String(const wxString& s1, const T& s2) - { return s1.compare(s2); } -WX_STRCMP_FUNC(wxStrcmp, wxCRT_StrcmpA, wxCRT_StrcmpW, wxStrcmp_String) - -template -inline int wxStricmp_String(const wxString& s1, const T& s2) - { return s1.CmpNoCase(s2); } -WX_STRCMP_FUNC(wxStricmp, wxCRT_StricmpA, wxCRT_StricmpW, wxStricmp_String) - -#if defined(wxCRT_StrcollA) && defined(wxCRT_StrcollW) - -// GCC 3.4 and other compilers have a bug that causes it to fail compilation if -// the template's implementation uses overloaded function declared later (see -// the wxStrcoll() call in wxStrcoll_String()), so we have to -// forward-declare the template and implement it below WX_STRCMP_FUNC. OTOH, -// this fails to compile with VC6, so don't do it for VC. It also causes -// problems with GCC visibility in newer GCC versions. -#if !(defined(__VISUALC__) || (wxCHECK_GCC_VERSION(3,5) && !wxCHECK_GCC_VERSION(4,7))) || defined(__clang__) - #define wxNEEDS_DECL_BEFORE_TEMPLATE -#endif - -#ifdef wxNEEDS_DECL_BEFORE_TEMPLATE -template -inline int wxStrcoll_String(const wxString& s1, const T& s2); -WX_STRCMP_FUNC(wxStrcoll, wxCRT_StrcollA, wxCRT_StrcollW, wxStrcoll_String) -#endif // wxNEEDS_DECL_BEFORE_TEMPLATE - -template -inline int wxStrcoll_String(const wxString& s1, const T& s2) -{ -#if wxUSE_UNICODE - // NB: strcoll() doesn't work correctly on UTF-8 strings, so we have to use - // wc_str() even if wxUSE_UNICODE_UTF8; the (const wchar_t*) cast is - // there just as optimization to avoid going through - // wxStrcoll: - return wxStrcoll((const wchar_t*)s1.wc_str(), s2); -#else - return wxStrcoll((const char*)s1.mb_str(), s2); -#endif -} - -#ifndef wxNEEDS_DECL_BEFORE_TEMPLATE -// this is exactly the same WX_STRCMP_FUNC line as above, insde the -// wxNEEDS_DECL_BEFORE_TEMPLATE case -WX_STRCMP_FUNC(wxStrcoll, wxCRT_StrcollA, wxCRT_StrcollW, wxStrcoll_String) -#endif - -#endif // defined(wxCRT_Strcoll[AW]) - -template -inline size_t wxStrspn_String(const wxString& s1, const T& s2) -{ - size_t pos = s1.find_first_not_of(s2); - return pos == wxString::npos ? s1.length() : pos; -} -WX_STR_FUNC(size_t, wxStrspn, wxCRT_StrspnA, wxCRT_StrspnW, wxStrspn_String) - -template -inline size_t wxStrcspn_String(const wxString& s1, const T& s2) -{ - size_t pos = s1.find_first_of(s2); - return pos == wxString::npos ? s1.length() : pos; -} -WX_STR_FUNC(size_t, wxStrcspn, wxCRT_StrcspnA, wxCRT_StrcspnW, wxStrcspn_String) - -#undef WX_STR_DECL -#undef WX_STR_CALL -#define WX_STR_DECL(name, T1, T2) name(T1 s1, T2 s2, size_t n) -#define WX_STR_CALL(func, a1, a2) func(a1, a2, n) - -template -inline int wxStrncmp_String(const wxString& s1, const T& s2, size_t n) - { return s1.compare(0, n, s2, 0, n); } -WX_STRCMP_FUNC(wxStrncmp, wxCRT_StrncmpA, wxCRT_StrncmpW, wxStrncmp_String) - -template -inline int wxStrnicmp_String(const wxString& s1, const T& s2, size_t n) - { return s1.substr(0, n).CmpNoCase(wxString(s2).substr(0, n)); } -WX_STRCMP_FUNC(wxStrnicmp, wxCRT_StrnicmpA, wxCRT_StrnicmpW, wxStrnicmp_String) - -#undef WX_STR_DECL -#undef WX_STR_CALL -#undef WX_STRCMP_FUNC -#undef WX_STR_FUNC -#undef WX_STR_FUNC_NO_INVERT - -#if defined(wxCRT_StrxfrmA) && defined(wxCRT_StrxfrmW) - -inline size_t wxStrxfrm(char *dest, const char *src, size_t n) - { return wxCRT_StrxfrmA(dest, src, n); } -inline size_t wxStrxfrm(wchar_t *dest, const wchar_t *src, size_t n) - { return wxCRT_StrxfrmW(dest, src, n); } -template -inline size_t wxStrxfrm(T *dest, const wxScopedCharTypeBuffer& src, size_t n) - { return wxStrxfrm(dest, src.data(), n); } -inline size_t wxStrxfrm(char *dest, const wxString& src, size_t n) - { return wxCRT_StrxfrmA(dest, src.mb_str(), n); } -inline size_t wxStrxfrm(wchar_t *dest, const wxString& src, size_t n) - { return wxCRT_StrxfrmW(dest, src.wc_str(), n); } -inline size_t wxStrxfrm(char *dest, const wxCStrData& src, size_t n) - { return wxCRT_StrxfrmA(dest, src.AsCharBuf(), n); } -inline size_t wxStrxfrm(wchar_t *dest, const wxCStrData& src, size_t n) - { return wxCRT_StrxfrmW(dest, src.AsWCharBuf(), n); } - -#endif // defined(wxCRT_Strxfrm[AW]) - -inline char *wxStrtok(char *str, const char *delim, char **saveptr) - { return wxCRT_StrtokA(str, delim, saveptr); } -inline wchar_t *wxStrtok(wchar_t *str, const wchar_t *delim, wchar_t **saveptr) - { return wxCRT_StrtokW(str, delim, saveptr); } -template -inline T *wxStrtok(T *str, const wxScopedCharTypeBuffer& delim, T **saveptr) - { return wxStrtok(str, delim.data(), saveptr); } -inline char *wxStrtok(char *str, const wxCStrData& delim, char **saveptr) - { return wxCRT_StrtokA(str, delim.AsCharBuf(), saveptr); } -inline wchar_t *wxStrtok(wchar_t *str, const wxCStrData& delim, wchar_t **saveptr) - { return wxCRT_StrtokW(str, delim.AsWCharBuf(), saveptr); } -inline char *wxStrtok(char *str, const wxString& delim, char **saveptr) - { return wxCRT_StrtokA(str, delim.mb_str(), saveptr); } -inline wchar_t *wxStrtok(wchar_t *str, const wxString& delim, wchar_t **saveptr) - { return wxCRT_StrtokW(str, delim.wc_str(), saveptr); } - -inline const char *wxStrstr(const char *haystack, const char *needle) - { return wxCRT_StrstrA(haystack, needle); } -inline const wchar_t *wxStrstr(const wchar_t *haystack, const wchar_t *needle) - { return wxCRT_StrstrW(haystack, needle); } -inline const char *wxStrstr(const char *haystack, const wxString& needle) - { return wxCRT_StrstrA(haystack, needle.mb_str()); } -inline const wchar_t *wxStrstr(const wchar_t *haystack, const wxString& needle) - { return wxCRT_StrstrW(haystack, needle.wc_str()); } -// these functions return char* pointer into the non-temporary conversion buffer -// used by c_str()'s implicit conversion to char*, for ANSI build compatibility -inline const char *wxStrstr(const wxString& haystack, const wxString& needle) - { return wxCRT_StrstrA(haystack.c_str(), needle.mb_str()); } -inline const char *wxStrstr(const wxCStrData& haystack, const wxString& needle) - { return wxCRT_StrstrA(haystack, needle.mb_str()); } -inline const char *wxStrstr(const wxCStrData& haystack, const wxCStrData& needle) - { return wxCRT_StrstrA(haystack, needle.AsCharBuf()); } -// if 'needle' is char/wchar_t, then the same is probably wanted as return value -inline const char *wxStrstr(const wxString& haystack, const char *needle) - { return wxCRT_StrstrA(haystack.c_str(), needle); } -inline const char *wxStrstr(const wxCStrData& haystack, const char *needle) - { return wxCRT_StrstrA(haystack, needle); } -inline const wchar_t *wxStrstr(const wxString& haystack, const wchar_t *needle) - { return wxCRT_StrstrW(haystack.c_str(), needle); } -inline const wchar_t *wxStrstr(const wxCStrData& haystack, const wchar_t *needle) - { return wxCRT_StrstrW(haystack, needle); } - -inline const char *wxStrchr(const char *s, char c) - { return wxCRT_StrchrA(s, c); } -inline const wchar_t *wxStrchr(const wchar_t *s, wchar_t c) - { return wxCRT_StrchrW(s, c); } -inline const char *wxStrrchr(const char *s, char c) - { return wxCRT_StrrchrA(s, c); } -inline const wchar_t *wxStrrchr(const wchar_t *s, wchar_t c) - { return wxCRT_StrrchrW(s, c); } -inline const char *wxStrchr(const char *s, const wxUniChar& uc) - { char c; return uc.GetAsChar(&c) ? wxCRT_StrchrA(s, c) : NULL; } -inline const wchar_t *wxStrchr(const wchar_t *s, const wxUniChar& c) - { return wxCRT_StrchrW(s, (wchar_t)c); } -inline const char *wxStrrchr(const char *s, const wxUniChar& uc) - { char c; return uc.GetAsChar(&c) ? wxCRT_StrrchrA(s, c) : NULL; } -inline const wchar_t *wxStrrchr(const wchar_t *s, const wxUniChar& c) - { return wxCRT_StrrchrW(s, (wchar_t)c); } -inline const char *wxStrchr(const char *s, const wxUniCharRef& uc) - { char c; return uc.GetAsChar(&c) ? wxCRT_StrchrA(s, c) : NULL; } -inline const wchar_t *wxStrchr(const wchar_t *s, const wxUniCharRef& c) - { return wxCRT_StrchrW(s, (wchar_t)c); } -inline const char *wxStrrchr(const char *s, const wxUniCharRef& uc) - { char c; return uc.GetAsChar(&c) ? wxCRT_StrrchrA(s, c) : NULL; } -inline const wchar_t *wxStrrchr(const wchar_t *s, const wxUniCharRef& c) - { return wxCRT_StrrchrW(s, (wchar_t)c); } -template -inline const T* wxStrchr(const wxScopedCharTypeBuffer& s, T c) - { return wxStrchr(s.data(), c); } -template -inline const T* wxStrrchr(const wxScopedCharTypeBuffer& s, T c) - { return wxStrrchr(s.data(), c); } -template -inline const T* wxStrchr(const wxScopedCharTypeBuffer& s, const wxUniChar& c) - { return wxStrchr(s.data(), (T)c); } -template -inline const T* wxStrrchr(const wxScopedCharTypeBuffer& s, const wxUniChar& c) - { return wxStrrchr(s.data(), (T)c); } -template -inline const T* wxStrchr(const wxScopedCharTypeBuffer& s, const wxUniCharRef& c) - { return wxStrchr(s.data(), (T)c); } -template -inline const T* wxStrrchr(const wxScopedCharTypeBuffer& s, const wxUniCharRef& c) - { return wxStrrchr(s.data(), (T)c); } -// these functions return char* pointer into the non-temporary conversion buffer -// used by c_str()'s implicit conversion to char*, for ANSI build compatibility -inline const char* wxStrchr(const wxString& s, char c) - { return wxCRT_StrchrA((const char*)s.c_str(), c); } -inline const char* wxStrrchr(const wxString& s, char c) - { return wxCRT_StrrchrA((const char*)s.c_str(), c); } -inline const char* wxStrchr(const wxString& s, int c) - { return wxCRT_StrchrA((const char*)s.c_str(), c); } -inline const char* wxStrrchr(const wxString& s, int c) - { return wxCRT_StrrchrA((const char*)s.c_str(), c); } -inline const char* wxStrchr(const wxString& s, const wxUniChar& uc) - { char c; return uc.GetAsChar(&c) ? wxCRT_StrchrA(s.c_str(), c) : NULL; } -inline const char* wxStrrchr(const wxString& s, const wxUniChar& uc) - { char c; return uc.GetAsChar(&c) ? wxCRT_StrrchrA(s.c_str(), c) : NULL; } -inline const char* wxStrchr(const wxString& s, const wxUniCharRef& uc) - { char c; return uc.GetAsChar(&c) ? wxCRT_StrchrA(s.c_str(), c) : NULL; } -inline const char* wxStrrchr(const wxString& s, const wxUniCharRef& uc) - { char c; return uc.GetAsChar(&c) ? wxCRT_StrrchrA(s.c_str(), c) : NULL; } -inline const wchar_t* wxStrchr(const wxString& s, wchar_t c) - { return wxCRT_StrchrW((const wchar_t*)s.c_str(), c); } -inline const wchar_t* wxStrrchr(const wxString& s, wchar_t c) - { return wxCRT_StrrchrW((const wchar_t*)s.c_str(), c); } -inline const char* wxStrchr(const wxCStrData& s, char c) - { return wxCRT_StrchrA(s.AsChar(), c); } -inline const char* wxStrrchr(const wxCStrData& s, char c) - { return wxCRT_StrrchrA(s.AsChar(), c); } -inline const char* wxStrchr(const wxCStrData& s, int c) - { return wxCRT_StrchrA(s.AsChar(), c); } -inline const char* wxStrrchr(const wxCStrData& s, int c) - { return wxCRT_StrrchrA(s.AsChar(), c); } -inline const char* wxStrchr(const wxCStrData& s, const wxUniChar& uc) - { char c; return uc.GetAsChar(&c) ? wxCRT_StrchrA(s, c) : NULL; } -inline const char* wxStrrchr(const wxCStrData& s, const wxUniChar& uc) - { char c; return uc.GetAsChar(&c) ? wxCRT_StrrchrA(s, c) : NULL; } -inline const char* wxStrchr(const wxCStrData& s, const wxUniCharRef& uc) - { char c; return uc.GetAsChar(&c) ? wxCRT_StrchrA(s, c) : NULL; } -inline const char* wxStrrchr(const wxCStrData& s, const wxUniCharRef& uc) - { char c; return uc.GetAsChar(&c) ? wxCRT_StrrchrA(s, c) : NULL; } -inline const wchar_t* wxStrchr(const wxCStrData& s, wchar_t c) - { return wxCRT_StrchrW(s.AsWChar(), c); } -inline const wchar_t* wxStrrchr(const wxCStrData& s, wchar_t c) - { return wxCRT_StrrchrW(s.AsWChar(), c); } - -inline const char *wxStrpbrk(const char *s, const char *accept) - { return wxCRT_StrpbrkA(s, accept); } -inline const wchar_t *wxStrpbrk(const wchar_t *s, const wchar_t *accept) - { return wxCRT_StrpbrkW(s, accept); } -inline const char *wxStrpbrk(const char *s, const wxString& accept) - { return wxCRT_StrpbrkA(s, accept.mb_str()); } -inline const char *wxStrpbrk(const char *s, const wxCStrData& accept) - { return wxCRT_StrpbrkA(s, accept.AsCharBuf()); } -inline const wchar_t *wxStrpbrk(const wchar_t *s, const wxString& accept) - { return wxCRT_StrpbrkW(s, accept.wc_str()); } -inline const wchar_t *wxStrpbrk(const wchar_t *s, const wxCStrData& accept) - { return wxCRT_StrpbrkW(s, accept.AsWCharBuf()); } -inline const char *wxStrpbrk(const wxString& s, const wxString& accept) - { return wxCRT_StrpbrkA(s.c_str(), accept.mb_str()); } -inline const char *wxStrpbrk(const wxString& s, const char *accept) - { return wxCRT_StrpbrkA(s.c_str(), accept); } -inline const wchar_t *wxStrpbrk(const wxString& s, const wchar_t *accept) - { return wxCRT_StrpbrkW(s.wc_str(), accept); } -inline const char *wxStrpbrk(const wxString& s, const wxCStrData& accept) - { return wxCRT_StrpbrkA(s.c_str(), accept.AsCharBuf()); } -inline const char *wxStrpbrk(const wxCStrData& s, const wxString& accept) - { return wxCRT_StrpbrkA(s.AsChar(), accept.mb_str()); } -inline const char *wxStrpbrk(const wxCStrData& s, const char *accept) - { return wxCRT_StrpbrkA(s.AsChar(), accept); } -inline const wchar_t *wxStrpbrk(const wxCStrData& s, const wchar_t *accept) - { return wxCRT_StrpbrkW(s.AsWChar(), accept); } -inline const char *wxStrpbrk(const wxCStrData& s, const wxCStrData& accept) - { return wxCRT_StrpbrkA(s.AsChar(), accept.AsCharBuf()); } -template -inline const T *wxStrpbrk(const S& s, const wxScopedCharTypeBuffer& accept) - { return wxStrpbrk(s, accept.data()); } - - -/* inlined non-const versions */ -template -inline char *wxStrstr(char *haystack, T needle) - { return const_cast(wxStrstr(const_cast(haystack), needle)); } -template -inline wchar_t *wxStrstr(wchar_t *haystack, T needle) - { return const_cast(wxStrstr(const_cast(haystack), needle)); } - -template -inline char * wxStrchr(char *s, T c) - { return const_cast(wxStrchr(const_cast(s), c)); } -template -inline wchar_t * wxStrchr(wchar_t *s, T c) - { return (wchar_t *)wxStrchr((const wchar_t *)s, c); } -template -inline char * wxStrrchr(char *s, T c) - { return const_cast(wxStrrchr(const_cast(s), c)); } -template -inline wchar_t * wxStrrchr(wchar_t *s, T c) - { return const_cast(wxStrrchr(const_cast(s), c)); } - -template -inline char * wxStrpbrk(char *s, T accept) - { return const_cast(wxStrpbrk(const_cast(s), accept)); } -template -inline wchar_t * wxStrpbrk(wchar_t *s, T accept) - { return const_cast(wxStrpbrk(const_cast(s), accept)); } - - -// ---------------------------------------------------------------------------- -// stdio.h functions -// ---------------------------------------------------------------------------- - -// NB: using fn_str() for mode is a hack to get the same type (char*/wchar_t*) -// as needed, the conversion itself doesn't matter, it's ASCII -inline FILE *wxFopen(const wxString& path, const wxString& mode) - { return wxCRT_Fopen(path.fn_str(), mode.fn_str()); } -inline FILE *wxFreopen(const wxString& path, const wxString& mode, FILE *stream) - { return wxCRT_Freopen(path.fn_str(), mode.fn_str(), stream); } -inline int wxRemove(const wxString& path) - { return wxCRT_Remove(path.fn_str()); } -inline int wxRename(const wxString& oldpath, const wxString& newpath) - { return wxCRT_Rename(oldpath.fn_str(), newpath.fn_str()); } - -extern WXDLLIMPEXP_BASE int wxPuts(const wxString& s); -extern WXDLLIMPEXP_BASE int wxFputs(const wxString& s, FILE *stream); -extern WXDLLIMPEXP_BASE void wxPerror(const wxString& s); - -extern WXDLLIMPEXP_BASE int wxFputc(const wxUniChar& c, FILE *stream); - -#define wxPutc(c, stream) wxFputc(c, stream) -#define wxPutchar(c) wxFputc(c, stdout) -#define wxFputchar(c) wxPutchar(c) - -// NB: We only provide ANSI version of fgets() because fgetws() interprets the -// stream according to current locale, which is rarely what is desired. -inline char *wxFgets(char *s, int size, FILE *stream) - { return wxCRT_FgetsA(s, size, stream); } -// This version calls ANSI version and converts the string using wxConvLibc -extern WXDLLIMPEXP_BASE wchar_t *wxFgets(wchar_t *s, int size, FILE *stream); - -#define wxGets(s) wxGets_is_insecure_and_dangerous_use_wxFgets_instead - -// NB: We only provide ANSI versions of this for the same reasons as in the -// case of wxFgets() above -inline int wxFgetc(FILE *stream) { return wxCRT_FgetcA(stream); } -inline int wxUngetc(int c, FILE *stream) { return wxCRT_UngetcA(c, stream); } - -#define wxGetc(stream) wxFgetc(stream) -#define wxGetchar() wxFgetc(stdin) -#define wxFgetchar() wxGetchar() - -// ---------------------------------------------------------------------------- -// stdlib.h functions -// ---------------------------------------------------------------------------- - -#ifdef wxCRT_AtoiW -inline int wxAtoi(const wxString& str) { return wxCRT_AtoiW(str.wc_str()); } -#else -inline int wxAtoi(const wxString& str) { return wxCRT_AtoiA(str.mb_str()); } -#endif - -#ifdef wxCRT_AtolW -inline long wxAtol(const wxString& str) { return wxCRT_AtolW(str.wc_str()); } -#else -inline long wxAtol(const wxString& str) { return wxCRT_AtolA(str.mb_str()); } -#endif - -#ifdef wxCRT_AtofW -inline double wxAtof(const wxString& str) { return wxCRT_AtofW(str.wc_str()); } -#else -inline double wxAtof(const wxString& str) { return wxCRT_AtofA(str.mb_str()); } -#endif - -inline double wxStrtod(const char *nptr, char **endptr) - { return wxCRT_StrtodA(nptr, endptr); } -inline double wxStrtod(const wchar_t *nptr, wchar_t **endptr) - { return wxCRT_StrtodW(nptr, endptr); } -template -inline double wxStrtod(const wxScopedCharTypeBuffer& nptr, T **endptr) - { return wxStrtod(nptr.data(), endptr); } - -// We implement wxStrto*() like this so that the code compiles when NULL is -// passed in - - if we had just char** and wchar_t** overloads for 'endptr', it -// would be ambiguous. The solution is to use a template so that endptr can be -// any type: when NULL constant is used, the type will be int and we can handle -// that case specially. Otherwise, we infer the type that 'nptr' should be -// converted to from the type of 'endptr'. We need wxStrtoxCharType template -// to make the code compile even for T=int (that's the case when it's not going -// to be ever used, but it still has to compile). -template struct wxStrtoxCharType {}; -template<> struct wxStrtoxCharType -{ - typedef const char* Type; - static char** AsPointer(char **p) { return p; } -}; -template<> struct wxStrtoxCharType -{ - typedef const wchar_t* Type; - static wchar_t** AsPointer(wchar_t **p) { return p; } -}; -template<> struct wxStrtoxCharType -{ - typedef const char* Type; /* this one is never used */ - static char** AsPointer(int WXUNUSED_UNLESS_DEBUG(p)) - { - wxASSERT_MSG( p == 0, "passing non-NULL int is invalid" ); - return NULL; - } -}; - -template -inline double wxStrtod(const wxString& nptr, T endptr) -{ - if ( endptr == 0 ) - { - // when we don't care about endptr, use the string representation that - // doesn't require any conversion (it doesn't matter for this function - // even if its UTF-8): - return wxStrtod(nptr.wx_str(), (wxStringCharType**)NULL); - } - else - { - // note that it is important to use c_str() here and not mb_str() or - // wc_str(), because we store the pointer into (possibly converted) - // buffer in endptr and so it must be valid even when wxStrtod() returns - typedef typename wxStrtoxCharType::Type CharType; - return wxStrtod((CharType)nptr.c_str(), - wxStrtoxCharType::AsPointer(endptr)); - } -} -template -inline double wxStrtod(const wxCStrData& nptr, T endptr) - { return wxStrtod(nptr.AsString(), endptr); } - - -#define WX_STRTOX_FUNC(rettype, name, implA, implW) \ - /* see wxStrtod() above for explanation of this code: */ \ - inline rettype name(const char *nptr, char **endptr, int base) \ - { return implA(nptr, endptr, base); } \ - inline rettype name(const wchar_t *nptr, wchar_t **endptr, int base) \ - { return implW(nptr, endptr, base); } \ - template \ - inline rettype name(const wxScopedCharTypeBuffer& nptr, T **endptr, int)\ - { return name(nptr.data(), endptr); } \ - template \ - inline rettype name(const wxString& nptr, T endptr, int base) \ - { \ - if ( endptr == 0 ) \ - return name(nptr.wx_str(), (wxStringCharType**)NULL, base); \ - else \ - { \ - typedef typename wxStrtoxCharType::Type CharType; \ - return name((CharType)nptr.c_str(), \ - wxStrtoxCharType::AsPointer(endptr), \ - base); \ - } \ - } \ - template \ - inline rettype name(const wxCStrData& nptr, T endptr, int base) \ - { return name(nptr.AsString(), endptr, base); } - -WX_STRTOX_FUNC(long, wxStrtol, wxCRT_StrtolA, wxCRT_StrtolW) -WX_STRTOX_FUNC(unsigned long, wxStrtoul, wxCRT_StrtoulA, wxCRT_StrtoulW) -#ifdef wxLongLong_t -WX_STRTOX_FUNC(wxLongLong_t, wxStrtoll, wxCRT_StrtollA, wxCRT_StrtollW) -WX_STRTOX_FUNC(wxULongLong_t, wxStrtoull, wxCRT_StrtoullA, wxCRT_StrtoullW) -#endif // wxLongLong_t - -#undef WX_STRTOX_FUNC - - -// there is no command interpreter under CE, hence no system() -#ifndef __WXWINCE__ - -// mingw32 doesn't provide _tsystem() even though it provides other stdlib.h -// functions in their wide versions -#ifdef wxCRT_SystemW -inline int wxSystem(const wxString& str) { return wxCRT_SystemW(str.wc_str()); } -#else -inline int wxSystem(const wxString& str) { return wxCRT_SystemA(str.mb_str()); } -#endif - -#endif // !__WXWINCE__/__WXWINCE__ - -inline char* wxGetenv(const char *name) { return wxCRT_GetenvA(name); } -inline wchar_t* wxGetenv(const wchar_t *name) { return wxCRT_GetenvW(name); } -inline char* wxGetenv(const wxString& name) { return wxCRT_GetenvA(name.mb_str()); } -inline char* wxGetenv(const wxCStrData& name) { return wxCRT_GetenvA(name.AsCharBuf()); } -inline char* wxGetenv(const wxScopedCharBuffer& name) { return wxCRT_GetenvA(name.data()); } -inline wchar_t* wxGetenv(const wxScopedWCharBuffer& name) { return wxCRT_GetenvW(name.data()); } - -// ---------------------------------------------------------------------------- -// time.h functions -// ---------------------------------------------------------------------------- - -inline size_t wxStrftime(char *s, size_t max, - const wxString& format, const struct tm *tm) - { return wxCRT_StrftimeA(s, max, format.mb_str(), tm); } - -inline size_t wxStrftime(wchar_t *s, size_t max, - const wxString& format, const struct tm *tm) - { return wxCRT_StrftimeW(s, max, format.wc_str(), tm); } - -// NB: we can't provide both char* and wchar_t* versions for obvious reasons -// and returning wxString wouldn't work either (it would be immediately -// destroyed and if assigned to char*/wchar_t*, the pointer would be -// invalid), so we only keep ASCII version, because the returned value -// is always ASCII anyway -#define wxAsctime asctime -#define wxCtime ctime - - -// ---------------------------------------------------------------------------- -// ctype.h functions -// ---------------------------------------------------------------------------- - -// FIXME-UTF8: we'd be better off implementing these ourselves, as the CRT -// version is locale-dependent -// FIXME-UTF8: these don't work when EOF is passed in because of wxUniChar, -// is this OK or not? - -inline bool wxIsalnum(const wxUniChar& c) { return wxCRT_IsalnumW(c) != 0; } -inline bool wxIsalpha(const wxUniChar& c) { return wxCRT_IsalphaW(c) != 0; } -inline bool wxIscntrl(const wxUniChar& c) { return wxCRT_IscntrlW(c) != 0; } -inline bool wxIsdigit(const wxUniChar& c) { return wxCRT_IsdigitW(c) != 0; } -inline bool wxIsgraph(const wxUniChar& c) { return wxCRT_IsgraphW(c) != 0; } -inline bool wxIslower(const wxUniChar& c) { return wxCRT_IslowerW(c) != 0; } -inline bool wxIsprint(const wxUniChar& c) { return wxCRT_IsprintW(c) != 0; } -inline bool wxIspunct(const wxUniChar& c) { return wxCRT_IspunctW(c) != 0; } -inline bool wxIsspace(const wxUniChar& c) { return wxCRT_IsspaceW(c) != 0; } -inline bool wxIsupper(const wxUniChar& c) { return wxCRT_IsupperW(c) != 0; } -inline bool wxIsxdigit(const wxUniChar& c) { return wxCRT_IsxdigitW(c) != 0; } - -inline wxUniChar wxTolower(const wxUniChar& c) { return wxCRT_TolowerW(c); } -inline wxUniChar wxToupper(const wxUniChar& c) { return wxCRT_ToupperW(c); } - -#if WXWIN_COMPATIBILITY_2_8 -// we had goofed and defined wxIsctrl() instead of (correct) wxIscntrl() in the -// initial versions of this header -- now it is too late to remove it so -// although we fixed the function/macro name above, still provide the -// backwards-compatible synonym. -wxDEPRECATED( inline int wxIsctrl(const wxUniChar& c) ); -inline int wxIsctrl(const wxUniChar& c) { return wxIscntrl(c); } -#endif // WXWIN_COMPATIBILITY_2_8 - -inline bool wxIsascii(const wxUniChar& c) { return c.IsAscii(); } - -#endif /* _WX_WXCRT_H_ */ diff --git a/Source/3rd Party/wx/include/wx/wxcrtbase.h b/Source/3rd Party/wx/include/wx/wxcrtbase.h deleted file mode 100644 index b30de539b..000000000 --- a/Source/3rd Party/wx/include/wx/wxcrtbase.h +++ /dev/null @@ -1,708 +0,0 @@ -/* - * Name: wx/wxcrtbase.h - * Purpose: Type-safe ANSI and Unicode builds compatible wrappers for - * CRT functions - * Author: Joel Farley, Ove Kaaven - * Modified by: Vadim Zeitlin, Robert Roebling, Ron Lee - * Created: 1998/06/12 - * RCS-ID: $Id$ - * Copyright: (c) 1998-2006 wxWidgets dev team - * Licence: wxWindows licence - */ - -/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ - -#ifndef _WX_WXCRTBASE_H_ -#define _WX_WXCRTBASE_H_ - -/* ------------------------------------------------------------------------- - headers and missing declarations - ------------------------------------------------------------------------- */ - -#include "wx/chartype.h" - -/* - Standard headers we need here. - - NB: don't include any wxWidgets headers here because almost all of them - include this one! - - NB2: User code should include wx/crt.h instead of including this - header directly. - - */ - -#include -#include -#include -#include -#include - -#if defined(__WINDOWS__) && !defined(__WXWINCE__) - #include -#endif - -#if defined(HAVE_STRTOK_R) && defined(__DARWIN__) && defined(_MSL_USING_MW_C_HEADERS) && _MSL_USING_MW_C_HEADERS - char *strtok_r(char *, const char *, char **); -#endif - -/* - Using -std=c++{98,0x} option with mingw32 disables most of standard - library extensions, so we can't rely on the presence of common non-ANSI - functions, define a special symbol to test for this. Notice that this - doesn't need to be done for g++ under Linux where _GNU_SOURCE (which is - defined by default) still makes all common extensions available even in - ANSI mode. - */ -#if defined(__MINGW32__) && defined(__STRICT_ANSI__) - #define __WX_STRICT_ANSI_GCC__ -#endif - -/* - a few compilers don't have the (non standard but common) isascii function, - define it ourselves for them - */ -#ifndef isascii - #if defined(__WX_STRICT_ANSI_GCC__) - #define wxNEED_ISASCII - #elif defined(_WIN32_WCE) - #if _WIN32_WCE <= 211 - #define wxNEED_ISASCII - #endif - #endif -#endif /* isascii */ - -#ifdef wxNEED_ISASCII - inline int isascii(int c) { return (unsigned)c < 0x80; } -#endif - -#ifdef _WIN32_WCE - #if _WIN32_WCE <= 211 - #define isspace(c) ((c) == wxT(' ') || (c) == wxT('\t')) - #endif -#endif /* _WIN32_WCE */ - -/* string.h functions */ -#ifndef strdup - #if defined(__WXWINCE__) - #if _WIN32_WCE <= 211 - #define wxNEED_STRDUP - #endif - #endif -#endif /* strdup */ - -#ifdef wxNEED_STRDUP - WXDLLIMPEXP_BASE char *strdup(const char* s); -#endif - -/* missing functions in some WinCE versions */ -#ifdef _WIN32_WCE -#if (_WIN32_WCE < 300) -WXDLLIMPEXP_BASE void *calloc( size_t num, size_t size ); -#endif -#endif /* _WIN32_WCE */ - - -/* ------------------------------------------------------------------------- - UTF-8 locale handling - ------------------------------------------------------------------------- */ - -#ifdef __cplusplus - #if wxUSE_UNICODE_UTF8 - /* flag indicating whether the current locale uses UTF-8 or not; must be - updated every time the locale is changed! */ - #if wxUSE_UTF8_LOCALE_ONLY - #define wxLocaleIsUtf8 true - #else - extern WXDLLIMPEXP_BASE bool wxLocaleIsUtf8; - #endif - /* function used to update the flag: */ - extern WXDLLIMPEXP_BASE void wxUpdateLocaleIsUtf8(); - #else /* !wxUSE_UNICODE_UTF8 */ - inline void wxUpdateLocaleIsUtf8() {} - #endif /* wxUSE_UNICODE_UTF8/!wxUSE_UNICODE_UTF8 */ -#endif /* __cplusplus */ - - -/* ------------------------------------------------------------------------- - string.h - ------------------------------------------------------------------------- */ - -#define wxCRT_StrcatA strcat -#define wxCRT_StrchrA strchr -#define wxCRT_StrcmpA strcmp -#define wxCRT_StrcpyA strcpy -#define wxCRT_StrcspnA strcspn -#define wxCRT_StrlenA strlen -#define wxCRT_StrncatA strncat -#define wxCRT_StrncmpA strncmp -#define wxCRT_StrncpyA strncpy -#define wxCRT_StrpbrkA strpbrk -#define wxCRT_StrrchrA strrchr -#define wxCRT_StrspnA strspn -#define wxCRT_StrstrA strstr - -#define wxCRT_StrcatW wcscat -#define wxCRT_StrchrW wcschr -#define wxCRT_StrcmpW wcscmp -#define wxCRT_StrcpyW wcscpy -#define wxCRT_StrcspnW wcscspn -#define wxCRT_StrncatW wcsncat -#define wxCRT_StrncmpW wcsncmp -#define wxCRT_StrncpyW wcsncpy -#define wxCRT_StrpbrkW wcspbrk -#define wxCRT_StrrchrW wcsrchr -#define wxCRT_StrspnW wcsspn -#define wxCRT_StrstrW wcsstr - -/* these functions are not defined under CE, at least in VC8 CRT */ -#if !defined(__WXWINCE__) - #define wxCRT_StrcollA strcoll - #define wxCRT_StrxfrmA strxfrm - - #define wxCRT_StrcollW wcscoll - #define wxCRT_StrxfrmW wcsxfrm -#endif /* __WXWINCE__ */ - -/* Almost all compiler have strdup(), but VC++ for CE doesn't provide it. - Another special case is gcc in strict ANSI mode: normally it doesn't provide - strdup() but MinGW does provide it under MSVC-compatible name so test for it - before checking __WX_STRICT_ANSI_GCC__. */ -#if (defined(__VISUALC__) && __VISUALC__ >= 1400) || \ - defined(__MINGW32__) - #define wxCRT_StrdupA _strdup -#elif !(defined(__WXWINCE__) || defined(__WX_STRICT_ANSI_GCC__)) - #define wxCRT_StrdupA strdup -#endif - -/* most Windows compilers provide _wcsdup() */ -#if defined(__WINDOWS__) && \ - !(defined(__CYGWIN__) || defined(__WX_STRICT_ANSI_GCC__)) - #define wxCRT_StrdupW _wcsdup -#elif defined(HAVE_WCSDUP) - #define wxCRT_StrdupW wcsdup -#endif - -#ifdef wxHAVE_TCHAR_SUPPORT - /* we surely have wchar_t if we have TCHAR have wcslen() */ - #ifndef HAVE_WCSLEN - #define HAVE_WCSLEN - #endif -#endif /* wxHAVE_TCHAR_SUPPORT */ - -#ifdef HAVE_WCSLEN - #define wxCRT_StrlenW wcslen -#endif - -#define wxCRT_StrtodA strtod -#define wxCRT_StrtolA strtol -#define wxCRT_StrtoulA strtoul -#define wxCRT_StrtodW wcstod -#define wxCRT_StrtolW wcstol -#define wxCRT_StrtoulW wcstoul - -#ifdef __VISUALC__ - #if __VISUALC__ >= 1300 && !defined(__WXWINCE__) - #define wxCRT_StrtollA _strtoi64 - #define wxCRT_StrtoullA _strtoui64 - #define wxCRT_StrtollW _wcstoi64 - #define wxCRT_StrtoullW _wcstoui64 - #endif /* VC++ 7+ */ -#else - #ifdef HAVE_STRTOULL - #define wxCRT_StrtollA strtoll - #define wxCRT_StrtoullA strtoull - #endif /* HAVE_STRTOULL */ - #ifdef HAVE_WCSTOULL - /* assume that we have wcstoull(), which is also C99, too */ - #define wxCRT_StrtollW wcstoll - #define wxCRT_StrtoullW wcstoull - #endif /* HAVE_WCSTOULL */ -#endif - -/* - Only VC8 and later provide strnlen() and wcsnlen() functions under Windows - and it's also only available starting from Windows CE 6.0 only in CE build. - */ -#if wxCHECK_VISUALC_VERSION(8) && (!defined(_WIN32_WCE) || (_WIN32_WCE >= 0x600)) - #ifndef HAVE_STRNLEN - #define HAVE_STRNLEN - #endif - #ifndef HAVE_WCSNLEN - #define HAVE_WCSNLEN - #endif -#endif - -#ifdef HAVE_STRNLEN - #define wxCRT_StrnlenA strnlen -#endif - -#ifdef HAVE_WCSNLEN - #define wxCRT_StrnlenW wcsnlen -#endif - -/* define wxCRT_StricmpA/W and wxCRT_StrnicmpA/W for various compilers */ - -#if defined(__BORLANDC__) || defined(__WATCOMC__) || \ - defined(__VISAGECPP__) || \ - defined(__EMX__) || defined(__DJGPP__) - #define wxCRT_StricmpA stricmp - #define wxCRT_StrnicmpA strnicmp -#elif defined(__SYMANTEC__) || defined(__VISUALC__) - #define wxCRT_StricmpA _stricmp - #define wxCRT_StrnicmpA _strnicmp -#elif defined(__UNIX__) || (defined(__GNUWIN32__) && !defined(__WX_STRICT_ANSI_GCC__)) - #define wxCRT_StricmpA strcasecmp - #define wxCRT_StrnicmpA strncasecmp -/* #else -- use wxWidgets implementation */ -#endif - -#ifdef __VISUALC__ - #define wxCRT_StricmpW _wcsicmp - #define wxCRT_StrnicmpW _wcsnicmp -#elif defined(__UNIX__) - #ifdef HAVE_WCSCASECMP - #define wxCRT_StricmpW wcscasecmp - #endif - #ifdef HAVE_WCSNCASECMP - #define wxCRT_StrnicmpW wcsncasecmp - #endif -/* #else -- use wxWidgets implementation */ -#endif - -#ifdef HAVE_STRTOK_R - #define wxCRT_StrtokA(str, sep, last) strtok_r(str, sep, last) -#endif -/* FIXME-UTF8: detect and use wcstok() if available for wxCRT_StrtokW */ - -/* these are extern "C" because they are used by regex lib: */ -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef wxCRT_StrlenW -WXDLLIMPEXP_BASE size_t wxCRT_StrlenW(const wchar_t *s); -#endif - -#ifndef wxCRT_StrncmpW -WXDLLIMPEXP_BASE int wxCRT_StrncmpW(const wchar_t *s1, const wchar_t *s2, size_t n); -#endif - -#ifdef __cplusplus -} -#endif - -/* FIXME-UTF8: remove this once we are Unicode only */ -#if wxUSE_UNICODE - #define wxCRT_StrlenNative wxCRT_StrlenW - #define wxCRT_StrncmpNative wxCRT_StrncmpW - #define wxCRT_ToupperNative wxCRT_ToupperW - #define wxCRT_TolowerNative wxCRT_TolowerW -#else - #define wxCRT_StrlenNative wxCRT_StrlenA - #define wxCRT_StrncmpNative wxCRT_StrncmpA - #define wxCRT_ToupperNative toupper - #define wxCRT_TolowerNative tolower -#endif - -#ifndef wxCRT_StrcatW -WXDLLIMPEXP_BASE wchar_t *wxCRT_StrcatW(wchar_t *dest, const wchar_t *src); -#endif - -#ifndef wxCRT_StrchrW -WXDLLIMPEXP_BASE const wchar_t *wxCRT_StrchrW(const wchar_t *s, wchar_t c); -#endif - -#ifndef wxCRT_StrcmpW -WXDLLIMPEXP_BASE int wxCRT_StrcmpW(const wchar_t *s1, const wchar_t *s2); -#endif - -#ifndef wxCRT_StrcollW -WXDLLIMPEXP_BASE int wxCRT_StrcollW(const wchar_t *s1, const wchar_t *s2); -#endif - -#ifndef wxCRT_StrcpyW -WXDLLIMPEXP_BASE wchar_t *wxCRT_StrcpyW(wchar_t *dest, const wchar_t *src); -#endif - -#ifndef wxCRT_StrcspnW -WXDLLIMPEXP_BASE size_t wxCRT_StrcspnW(const wchar_t *s, const wchar_t *reject); -#endif - -#ifndef wxCRT_StrncatW -WXDLLIMPEXP_BASE wchar_t *wxCRT_StrncatW(wchar_t *dest, const wchar_t *src, size_t n); -#endif - -#ifndef wxCRT_StrncpyW -WXDLLIMPEXP_BASE wchar_t *wxCRT_StrncpyW(wchar_t *dest, const wchar_t *src, size_t n); -#endif - -#ifndef wxCRT_StrpbrkW -WXDLLIMPEXP_BASE const wchar_t *wxCRT_StrpbrkW(const wchar_t *s, const wchar_t *accept); -#endif - -#ifndef wxCRT_StrrchrW -WXDLLIMPEXP_BASE const wchar_t *wxCRT_StrrchrW(const wchar_t *s, wchar_t c); -#endif - -#ifndef wxCRT_StrspnW -WXDLLIMPEXP_BASE size_t wxCRT_StrspnW(const wchar_t *s, const wchar_t *accept); -#endif - -#ifndef wxCRT_StrstrW -WXDLLIMPEXP_BASE const wchar_t *wxCRT_StrstrW(const wchar_t *haystack, const wchar_t *needle); -#endif - -#ifndef wxCRT_StrtodW -WXDLLIMPEXP_BASE double wxCRT_StrtodW(const wchar_t *nptr, wchar_t **endptr); -#endif - -#ifndef wxCRT_StrtolW -WXDLLIMPEXP_BASE long int wxCRT_StrtolW(const wchar_t *nptr, wchar_t **endptr, int base); -#endif - -#ifndef wxCRT_StrtoulW -WXDLLIMPEXP_BASE unsigned long int wxCRT_StrtoulW(const wchar_t *nptr, wchar_t **endptr, int base); -#endif - -#ifndef wxCRT_StrxfrmW -WXDLLIMPEXP_BASE size_t wxCRT_StrxfrmW(wchar_t *dest, const wchar_t *src, size_t n); -#endif - -#ifndef wxCRT_StrdupA -WXDLLIMPEXP_BASE char *wxCRT_StrdupA(const char *psz); -#endif - -#ifndef wxCRT_StrdupW -WXDLLIMPEXP_BASE wchar_t *wxCRT_StrdupW(const wchar_t *pwz); -#endif - -#ifndef wxCRT_StricmpA -WXDLLIMPEXP_BASE int wxCRT_StricmpA(const char *psz1, const char *psz2); -#endif - -#ifndef wxCRT_StricmpW -WXDLLIMPEXP_BASE int wxCRT_StricmpW(const wchar_t *psz1, const wchar_t *psz2); -#endif - -#ifndef wxCRT_StrnicmpA -WXDLLIMPEXP_BASE int wxCRT_StrnicmpA(const char *psz1, const char *psz2, size_t len); -#endif - -#ifndef wxCRT_StrnicmpW -WXDLLIMPEXP_BASE int wxCRT_StrnicmpW(const wchar_t *psz1, const wchar_t *psz2, size_t len); -#endif - -#ifndef wxCRT_StrtokA -WXDLLIMPEXP_BASE char *wxCRT_StrtokA(char *psz, const char *delim, char **save_ptr); -#endif - -#ifndef wxCRT_StrtokW -WXDLLIMPEXP_BASE wchar_t *wxCRT_StrtokW(wchar_t *psz, const wchar_t *delim, wchar_t **save_ptr); -#endif - -/* supply strtoll and strtoull, if needed */ -#ifdef wxLongLong_t - #ifndef wxCRT_StrtollA - WXDLLIMPEXP_BASE wxLongLong_t wxCRT_StrtollA(const char* nptr, - char** endptr, - int base); - WXDLLIMPEXP_BASE wxULongLong_t wxCRT_StrtoullA(const char* nptr, - char** endptr, - int base); - #endif - #ifndef wxCRT_StrtollW - WXDLLIMPEXP_BASE wxLongLong_t wxCRT_StrtollW(const wchar_t* nptr, - wchar_t** endptr, - int base); - WXDLLIMPEXP_BASE wxULongLong_t wxCRT_StrtoullW(const wchar_t* nptr, - wchar_t** endptr, - int base); - #endif -#endif /* wxLongLong_t */ - - -/* ------------------------------------------------------------------------- - stdio.h - ------------------------------------------------------------------------- */ - -#if defined(__UNIX__) || defined(__WXMAC__) - #define wxMBFILES 1 -#else - #define wxMBFILES 0 -#endif - - -/* these functions are only needed in the form used for filenames (i.e. char* - on Unix, wchar_t* on Windows), so we don't need to use A/W suffix: */ -#if wxMBFILES || !wxUSE_UNICODE /* ANSI filenames */ - - #define wxCRT_Fopen fopen - #define wxCRT_Freopen freopen - #define wxCRT_Remove remove - #define wxCRT_Rename rename - -#else /* Unicode filenames */ - /* special case: these functions are missing under Win9x with Unicows so we - have to implement them ourselves */ - #if wxUSE_UNICODE_MSLU || defined(__WX_STRICT_ANSI_GCC__) - WXDLLIMPEXP_BASE FILE* wxMSLU__wfopen(const wchar_t *name, const wchar_t *mode); - WXDLLIMPEXP_BASE FILE* wxMSLU__wfreopen(const wchar_t *name, const wchar_t *mode, FILE *stream); - WXDLLIMPEXP_BASE int wxMSLU__wrename(const wchar_t *oldname, const wchar_t *newname); - WXDLLIMPEXP_BASE int wxMSLU__wremove(const wchar_t *name); - #define wxCRT_Fopen wxMSLU__wfopen - #define wxCRT_Freopen wxMSLU__wfreopen - #define wxCRT_Remove wxMSLU__wremove - #define wxCRT_Rename wxMSLU__wrename - #else - /* WinCE CRT doesn't provide these functions so use our own */ - #ifdef __WXWINCE__ - WXDLLIMPEXP_BASE int wxCRT_Rename(const wchar_t *src, - const wchar_t *dst); - WXDLLIMPEXP_BASE int wxCRT_Remove(const wchar_t *path); - #else - #define wxCRT_Rename _wrename - #define wxCRT_Remove _wremove - #endif - #define wxCRT_Fopen _wfopen - #define wxCRT_Freopen _wfreopen - #endif - -#endif /* wxMBFILES/!wxMBFILES */ - -#define wxCRT_PutsA puts -#define wxCRT_FputsA fputs -#define wxCRT_FgetsA fgets -#define wxCRT_FputcA fputc -#define wxCRT_FgetcA fgetc -#define wxCRT_UngetcA ungetc - -#ifdef wxHAVE_TCHAR_SUPPORT - #define wxCRT_PutsW _putws - #define wxCRT_FputsW fputws - #define wxCRT_FputcW fputwc -#endif -#ifdef HAVE_FPUTWS - #define wxCRT_FputsW fputws -#endif -#ifdef HAVE_PUTWS - #define wxCRT_PutsW putws -#endif -#ifdef HAVE_FPUTWC - #define wxCRT_FputcW fputwc -#endif -#define wxCRT_FgetsW fgetws - -#ifndef wxCRT_PutsW -WXDLLIMPEXP_BASE int wxCRT_PutsW(const wchar_t *ws); -#endif - -#ifndef wxCRT_FputsW -WXDLLIMPEXP_BASE int wxCRT_FputsW(const wchar_t *ch, FILE *stream); -#endif - -#ifndef wxCRT_FputcW -WXDLLIMPEXP_BASE int wxCRT_FputcW(wchar_t wc, FILE *stream); -#endif - -/* - NB: tmpnam() is unsafe and thus is not wrapped! - Use other wxWidgets facilities instead: - wxFileName::CreateTempFileName, wxTempFile, or wxTempFileOutputStream -*/ -#define wxTmpnam(x) wxTmpnam_is_insecure_use_wxTempFile_instead - -/* FIXME-CE: provide our own perror() using ::GetLastError() */ -#ifndef __WXWINCE__ - -#define wxCRT_PerrorA perror -#ifdef wxHAVE_TCHAR_SUPPORT - #define wxCRT_PerrorW _wperror -#endif - -#endif /* !__WXWINCE__ */ - -/* ------------------------------------------------------------------------- - stdlib.h - ------------------------------------------------------------------------- */ - -/* there are no env vars at all under CE, so no _tgetenv neither */ -#ifdef __WXWINCE__ - /* can't define as inline function as this is a C file... */ - #define wxCRT_GetenvA(name) (name, NULL) - #define wxCRT_GetenvW(name) (name, NULL) -#else - #define wxCRT_GetenvA getenv - #ifdef _tgetenv - #define wxCRT_GetenvW _wgetenv - #endif -#endif - -#ifndef wxCRT_GetenvW -WXDLLIMPEXP_BASE wchar_t * wxCRT_GetenvW(const wchar_t *name); -#endif - - -#define wxCRT_SystemA system -/* mingw32 doesn't provide _tsystem() or _wsystem(): */ -#if defined(_tsystem) - #define wxCRT_SystemW _wsystem -#endif - -#define wxCRT_AtofA atof -#define wxCRT_AtoiA atoi -#define wxCRT_AtolA atol - -#if defined(wxHAVE_TCHAR_SUPPORT) && !defined(__WX_STRICT_ANSI_GCC__) - #define wxCRT_AtoiW _wtoi - #define wxCRT_AtolW _wtol - /* _wtof doesn't exist */ -#else -#ifndef __VMS - #define wxCRT_AtofW(s) wcstod(s, NULL) -#endif - #define wxCRT_AtolW(s) wcstol(s, NULL, 10) - /* wcstoi doesn't exist */ -#endif - -#ifdef __DARWIN__ - #if !defined(__WXOSX_IPHONE__) && MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_2 - #define wxNEED_WX_MBSTOWCS - #endif -#endif - -#ifdef wxNEED_WX_MBSTOWCS - /* even though they are defined and "implemented", they are bad and just - stubs so we need our own - we need these even in ANSI builds!! */ - WXDLLIMPEXP_BASE size_t wxMbstowcs(wchar_t *, const char *, size_t); - WXDLLIMPEXP_BASE size_t wxWcstombs(char *, const wchar_t *, size_t); -#else - #define wxMbstowcs mbstowcs - #define wxWcstombs wcstombs -#endif - - - -/* ------------------------------------------------------------------------- - time.h - ------------------------------------------------------------------------- */ - -#define wxCRT_StrftimeA strftime -#ifdef __SGI__ - /* - IRIX provides not one but two versions of wcsftime(): XPG4 one which - uses "const char*" for the third parameter and so can't be used and the - correct, XPG5, one. Unfortunately we can't just define _XOPEN_SOURCE - high enough to get XPG5 version as this undefines other symbols which - make other functions we use unavailable (see for gory - details). So just declare the XPG5 version ourselves, we're extremely - unlikely to ever be compiled on a system without it. But if we ever do, - a configure test would need to be added for it (and _MIPS_SYMBOL_PRESENT - should be used to check for its presence during run-time, i.e. it would - probably be simpler to just always use our own wxCRT_StrftimeW() below - if it does ever become a problem). - */ -#ifdef __cplusplus - extern "C" -#endif - size_t - _xpg5_wcsftime(wchar_t *, size_t, const wchar_t *, const struct tm * ); - #define wxCRT_StrftimeW _xpg5_wcsftime -#else - /* - Assume it's always available under non-Unix systems as this does seem - to be the case for now. And under Unix we trust configure to detect it - (except for SGI special case above). - */ - #if defined(HAVE_WCSFTIME) || !defined(__UNIX__) - #define wxCRT_StrftimeW wcsftime - #endif -#endif - -#ifndef wxCRT_StrftimeW -WXDLLIMPEXP_BASE size_t wxCRT_StrftimeW(wchar_t *s, size_t max, - const wchar_t *fmt, - const struct tm *tm); -#endif - - - -/* ------------------------------------------------------------------------- - ctype.h - ------------------------------------------------------------------------- */ - -#ifdef __WATCOMC__ - #define WXWCHAR_T_CAST(c) (wint_t)(c) -#else - #define WXWCHAR_T_CAST(c) c -#endif - -#define wxCRT_IsalnumW(c) iswalnum(WXWCHAR_T_CAST(c)) -#define wxCRT_IsalphaW(c) iswalpha(WXWCHAR_T_CAST(c)) -#define wxCRT_IscntrlW(c) iswcntrl(WXWCHAR_T_CAST(c)) -#define wxCRT_IsdigitW(c) iswdigit(WXWCHAR_T_CAST(c)) -#define wxCRT_IsgraphW(c) iswgraph(WXWCHAR_T_CAST(c)) -#define wxCRT_IslowerW(c) iswlower(WXWCHAR_T_CAST(c)) -#define wxCRT_IsprintW(c) iswprint(WXWCHAR_T_CAST(c)) -#define wxCRT_IspunctW(c) iswpunct(WXWCHAR_T_CAST(c)) -#define wxCRT_IsspaceW(c) iswspace(WXWCHAR_T_CAST(c)) -#define wxCRT_IsupperW(c) iswupper(WXWCHAR_T_CAST(c)) -#define wxCRT_IsxdigitW(c) iswxdigit(WXWCHAR_T_CAST(c)) - -#ifdef __GLIBC__ - #if defined(__GLIBC__) && (__GLIBC__ == 2) && (__GLIBC_MINOR__ == 0) - /* /usr/include/wctype.h incorrectly declares translations */ - /* tables which provokes tons of compile-time warnings -- try */ - /* to correct this */ - #define wxCRT_TolowerW(wc) towctrans((wc), (wctrans_t)__ctype_tolower) - #define wxCRT_ToupperW(wc) towctrans((wc), (wctrans_t)__ctype_toupper) - #else /* !glibc 2.0 */ - #define wxCRT_TolowerW towlower - #define wxCRT_ToupperW towupper - #endif -#else /* !__GLIBC__ */ - /* There is a bug in VC6 C RTL: toxxx() functions dosn't do anything - with signed chars < 0, so "fix" it here. */ - #define wxCRT_TolowerW(c) towlower((wxUChar)(wxChar)(c)) - #define wxCRT_ToupperW(c) towupper((wxUChar)(wxChar)(c)) -#endif /* __GLIBC__/!__GLIBC__ */ - - - - - -/* ------------------------------------------------------------------------- - wx wrappers for CRT functions in both char* and wchar_t* versions - ------------------------------------------------------------------------- */ - -#ifdef __cplusplus - -/* NB: this belongs to wxcrt.h and not this header, but it makes life easier - * for buffer.h and stringimpl.h (both of which must be included before - * string.h, which is required by wxcrt.h) to have them here: */ - -/* safe version of strlen() (returns 0 if passed NULL pointer) */ -inline size_t wxStrlen(const char *s) { return s ? wxCRT_StrlenA(s) : 0; } -inline size_t wxStrlen(const wchar_t *s) { return s ? wxCRT_StrlenW(s) : 0; } -#ifndef wxWCHAR_T_IS_WXCHAR16 - WXDLLIMPEXP_BASE size_t wxStrlen(const wxChar16 *s ); -#endif -#ifndef wxWCHAR_T_IS_WXCHAR32 - WXDLLIMPEXP_BASE size_t wxStrlen(const wxChar32 *s ); -#endif -#define wxWcslen wxCRT_StrlenW - -#define wxStrdupA wxCRT_StrdupA -#define wxStrdupW wxCRT_StrdupW -inline char* wxStrdup(const char *s) { return wxCRT_StrdupA(s); } -inline wchar_t* wxStrdup(const wchar_t *s) { return wxCRT_StrdupW(s); } -#ifndef wxWCHAR_T_IS_WXCHAR16 - WXDLLIMPEXP_BASE wxChar16* wxStrdup(const wxChar16* s); -#endif -#ifndef wxWCHAR_T_IS_WXCHAR32 - WXDLLIMPEXP_BASE wxChar32* wxStrdup(const wxChar32* s); -#endif - -#endif /* __cplusplus */ - -#endif /* _WX_WXCRTBASE_H_ */ diff --git a/Source/3rd Party/wx/include/wx/wxcrtvararg.h b/Source/3rd Party/wx/include/wx/wxcrtvararg.h deleted file mode 100644 index a97ca1690..000000000 --- a/Source/3rd Party/wx/include/wx/wxcrtvararg.h +++ /dev/null @@ -1,487 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/wxcrtvararg.h -// Purpose: Type-safe ANSI and Unicode builds compatible wrappers for -// printf(), scanf() and related CRT functions -// Author: Joel Farley, Ove KÃ¥ven -// Modified by: Vadim Zeitlin, Robert Roebling, Ron Lee -// Created: 2007-02-19 -// RCS-ID: $Id$ -// Copyright: (c) 2007 REA Elektronik GmbH -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_WXCRTVARARG_H_ -#define _WX_WXCRTVARARG_H_ - -// NB: User code should include wx/crt.h instead of including this -// header directly. - -#include "wx/wxcrt.h" -#include "wx/strvararg.h" - -#include "wx/string.h" - -// ---------------------------------------------------------------------------- -// CRT functions aliases -// ---------------------------------------------------------------------------- - -/* Required for wxPrintf() etc */ -#include - -/* printf() family saga */ - -/* - For many old Unix systems [v]snprintf()/vsscanf() exists in the system - libraries but not in the headers, so we need to declare it ourselves to be - able to use it. - */ -#ifdef __UNIX__ - -#if defined(HAVE_VSNPRINTF) && !defined(HAVE_VSNPRINTF_DECL) -#ifdef __cplusplus - extern "C" -#else - extern -#endif - int vsnprintf(char *str, size_t size, const char *format, va_list ap); -#endif /* !HAVE_VSNPRINTF_DECL */ - -#if defined(HAVE_SNPRINTF) && !defined(HAVE_SNPRINTF_DECL) -#ifdef __cplusplus - extern "C" -#else - extern -#endif - int snprintf(char *str, size_t size, const char *format, ...); -#endif /* !HAVE_SNPRINTF_DECL */ - -#if defined(HAVE_VSSCANF) && !defined(HAVE_VSSCANF_DECL) -#ifdef __cplusplus - extern "C" -#else - extern -#endif - int vsscanf(const char *str, const char *format, va_list ap); -#endif /* !HAVE_VSSCANF_DECL */ - -/* Wrapper for vsnprintf if it's 3rd parameter is non-const. Note: the - * same isn't done for snprintf below, the builtin wxSnprintf_ is used - * instead since it's already a simple wrapper */ -#if defined __cplusplus && defined HAVE_BROKEN_VSNPRINTF_DECL - inline int wx_fixed_vsnprintf(char *str, size_t size, const char *format, va_list ap) - { - return vsnprintf(str, size, (char*)format, ap); - } -#endif - -#endif /* __UNIX__ */ - -/* - mingw32 normally uses MSVCRT which has non-standard vswprintf() and so - normally _vsnwprintf() is used instead, the only exception is when mingw32 - is used with STLPort which does have a standard vswprintf() starting from - version 5.1 which we can use. - */ -#ifdef __MINGW32__ - #if defined(_STLPORT_VERSION) && _STLPORT_VERSION >= 0x510 - #ifndef HAVE_VSWPRINTF - #define HAVE_VSWPRINTF - #endif - #elif defined(HAVE_VSWPRINTF) - /* can't use non-standard vswprintf() */ - #undef HAVE_VSWPRINTF - #endif -#endif /* __MINGW32__ */ - -#if defined(__WATCOMC__) - #define HAVE_VSWPRINTF 1 -#endif - -#if wxUSE_PRINTF_POS_PARAMS - /* - The systems where vsnprintf() supports positional parameters should - define the HAVE_UNIX98_PRINTF symbol. - - On systems which don't (e.g. Windows) we are forced to use - our wxVsnprintf() implementation. - */ - #if defined(HAVE_UNIX98_PRINTF) - #ifdef HAVE_VSWPRINTF - #define wxCRT_VsnprintfW vswprintf - #endif - #ifdef HAVE_BROKEN_VSNPRINTF_DECL - #define wxCRT_VsnprintfA wx_fixed_vsnprintf - #else - #define wxCRT_VsnprintfA vsnprintf - #endif - #else /* !HAVE_UNIX98_PRINTF */ - /* - The only compiler with positional parameters support under Windows - is VC++ 8.0 which provides a new xxprintf_p() functions family. - The 2003 PSDK includes a slightly earlier version of VC8 than the - main release and does not have the printf_p functions. - */ - #if defined _MSC_FULL_VER && _MSC_FULL_VER >= 140050727 && !defined __WXWINCE__ - #define wxCRT_VsnprintfA _vsprintf_p - #define wxCRT_VsnprintfW _vswprintf_p - #endif - #endif /* HAVE_UNIX98_PRINTF/!HAVE_UNIX98_PRINTF */ -#else /* !wxUSE_PRINTF_POS_PARAMS */ - /* - We always want to define safe snprintf() function to be used instead of - sprintf(). Some compilers already have it (or rather vsnprintf() which - we really need...), otherwise we implement it using our own printf() - code. - - We define function with a trailing underscore here because the real one - is a wrapper around it as explained below - */ - - #if defined(__VISUALC__) || \ - (defined(__BORLANDC__) && __BORLANDC__ >= 0x540) - #define wxCRT_VsnprintfA _vsnprintf - #define wxCRT_VsnprintfW _vsnwprintf - #else - #if defined(HAVE__VSNWPRINTF) - #define wxCRT_VsnprintfW _vsnwprintf - #elif defined(HAVE_VSWPRINTF) - #define wxCRT_VsnprintfW vswprintf - #elif defined(__WATCOMC__) - #define wxCRT_VsnprintfW _vsnwprintf - #endif - - #if defined(HAVE_VSNPRINTF) \ - || defined(__WATCOMC__) - #ifdef HAVE_BROKEN_VSNPRINTF_DECL - #define wxCRT_VsnprintfA wx_fixed_vsnprintf - #else - #define wxCRT_VsnprintfA vsnprintf - #endif - #endif - #endif -#endif /* wxUSE_PRINTF_POS_PARAMS/!wxUSE_PRINTF_POS_PARAMS */ - -#ifndef wxCRT_VsnprintfW - /* no (suitable) vsnprintf(), cook our own */ - WXDLLIMPEXP_BASE int - wxCRT_VsnprintfW(wchar_t *buf, size_t len, const wchar_t *format, va_list argptr); - #define wxUSE_WXVSNPRINTFW 1 -#else - #define wxUSE_WXVSNPRINTFW 0 -#endif - -#ifndef wxCRT_VsnprintfA - /* no (suitable) vsnprintf(), cook our own */ - WXDLLIMPEXP_BASE int - wxCRT_VsnprintfA(char *buf, size_t len, const char *format, va_list argptr); - #define wxUSE_WXVSNPRINTFA 1 -#else - #define wxUSE_WXVSNPRINTFA 0 -#endif - -// for wxString code, define wxUSE_WXVSNPRINTF to indicate that wx -// implementation is used no matter what (in UTF-8 build, either *A or *W -// version may be called): -#if !wxUSE_UNICODE - #define wxUSE_WXVSNPRINTF wxUSE_WXVSNPRINTFA -#elif wxUSE_UNICODE_WCHAR - #define wxUSE_WXVSNPRINTF wxUSE_WXVSNPRINTFW -#elif wxUSE_UTF8_LOCALE_ONLY - #define wxUSE_WXVSNPRINTF wxUSE_WXVSNPRINTFA -#else // UTF-8 under any locale - #define wxUSE_WXVSNPRINTF (wxUSE_WXVSNPRINTFA && wxUSE_WXVSNPRINTFW) -#endif - -#define wxCRT_FprintfA fprintf -#define wxCRT_PrintfA printf -#define wxCRT_VfprintfA vfprintf -#define wxCRT_VprintfA vprintf -#define wxCRT_VsprintfA vsprintf - -/* - In Unicode mode we need to have all standard functions such as wprintf() and - so on but not all systems have them so use our own implementations in this - case. - */ -#if wxUSE_UNICODE && !defined(wxHAVE_TCHAR_SUPPORT) && !defined(HAVE_WPRINTF) - #define wxNEED_WPRINTF -#endif -#if wxUSE_UNICODE && !defined(wxHAVE_TCHAR_SUPPORT) && !defined(HAVE_VSWSCANF) - #define wxNEED_VSWSCANF -#endif - - -#if defined(wxNEED_WPRINTF) - /* - we need to implement all wide character printf functions either because - we don't have them at all or because they don't have the semantics we - need - */ - int wxCRT_PrintfW( const wchar_t *format, ... ); - int wxCRT_FprintfW( FILE *stream, const wchar_t *format, ... ); - int wxCRT_VfprintfW( FILE *stream, const wchar_t *format, va_list ap ); - int wxCRT_VprintfW( const wchar_t *format, va_list ap ); - int wxCRT_VsprintfW( wchar_t *str, const wchar_t *format, va_list ap ); -#else /* !wxNEED_WPRINTF */ - #define wxCRT_FprintfW fwprintf - #define wxCRT_PrintfW wprintf - #define wxCRT_VfprintfW vfwprintf - #define wxCRT_VprintfW vwprintf - - #if defined(__WINDOWS__) && !defined(HAVE_VSWPRINTF) - // only non-standard vswprintf() without buffer size argument can be used here - #define wxCRT_VsprintfW vswprintf - #endif -#endif /* wxNEED_WPRINTF */ - - -/* Required for wxScanf() etc. */ -#define wxCRT_ScanfA scanf -#define wxCRT_SscanfA sscanf -#define wxCRT_FscanfA fscanf -#define wxCRT_VsscanfA vsscanf - -#if defined(wxNEED_WPRINTF) - int wxCRT_ScanfW(const wchar_t *format, ...); - int wxCRT_SscanfW(const wchar_t *str, const wchar_t *format, ...); - int wxCRT_FscanfW(FILE *stream, const wchar_t *format, ...); -#else - #define wxCRT_ScanfW wxVMS_USE_STD wscanf - #define wxCRT_SscanfW wxVMS_USE_STD swscanf - #define wxCRT_FscanfW wxVMS_USE_STD fwscanf -#endif -#ifdef wxNEED_VSWSCANF - int wxCRT_VsscanfW(const wchar_t *str, const wchar_t *format, va_list ap); -#else - #define wxCRT_VsscanfW wxVMS_USE_STD vswscanf -#endif - -// ---------------------------------------------------------------------------- -// user-friendly wrappers to CRT functions -// ---------------------------------------------------------------------------- - -#ifdef __WATCOMC__ - // workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351 - #define wxPrintf wxPrintf_Impl - #define wxFprintf wxFprintf_Impl - #define wxSprintf wxSprintf_Impl - #define wxSnprintf wxSnprintf_Impl -#endif - - // FIXME-UTF8: remove this -#if wxUSE_UNICODE - #define wxCRT_PrintfNative wxCRT_PrintfW - #define wxCRT_FprintfNative wxCRT_FprintfW -#else - #define wxCRT_PrintfNative wxCRT_PrintfA - #define wxCRT_FprintfNative wxCRT_FprintfA -#endif - - -WX_DEFINE_VARARG_FUNC_SANS_N0(int, wxPrintf, 1, (const wxFormatString&), - wxCRT_PrintfNative, wxCRT_PrintfA) -inline int wxPrintf(const wxFormatString& s) -{ - return wxPrintf("%s", s.InputAsString()); -} - -WX_DEFINE_VARARG_FUNC_SANS_N0(int, wxFprintf, 2, (FILE*, const wxFormatString&), - wxCRT_FprintfNative, wxCRT_FprintfA) -inline int wxFprintf(FILE *f, const wxFormatString& s) -{ - return wxFprintf(f, "%s", s.InputAsString()); -} - -// va_list versions of printf functions simply forward to the respective -// CRT function; note that they assume that va_list was created using -// wxArgNormalizer! -#if wxUSE_UNICODE_UTF8 - #if wxUSE_UTF8_LOCALE_ONLY - #define WX_VARARG_VFOO_IMPL(args, implW, implA) \ - return implA args - #else - #define WX_VARARG_VFOO_IMPL(args, implW, implA) \ - if ( wxLocaleIsUtf8 ) return implA args; \ - else return implW args - #endif -#elif wxUSE_UNICODE_WCHAR - #define WX_VARARG_VFOO_IMPL(args, implW, implA) \ - return implW args -#else // ANSI - #define WX_VARARG_VFOO_IMPL(args, implW, implA) \ - return implA args -#endif - -inline int -wxVprintf(const wxString& format, va_list ap) -{ - WX_VARARG_VFOO_IMPL((wxFormatString(format), ap), - wxCRT_VprintfW, wxCRT_VprintfA); -} - -inline int -wxVfprintf(FILE *f, const wxString& format, va_list ap) -{ - WX_VARARG_VFOO_IMPL((f, wxFormatString(format), ap), - wxCRT_VfprintfW, wxCRT_VfprintfA); -} - -#undef WX_VARARG_VFOO_IMPL - - -// wxSprintf() and friends have to be implemented in two forms, one for -// writing to char* buffer and one for writing to wchar_t*: - -#if !wxUSE_UTF8_LOCALE_ONLY -int WXDLLIMPEXP_BASE wxDoSprintfWchar(char *str, const wxChar *format, ...); -#endif -#if wxUSE_UNICODE_UTF8 -int WXDLLIMPEXP_BASE wxDoSprintfUtf8(char *str, const char *format, ...); -#endif -WX_DEFINE_VARARG_FUNC(int, wxSprintf, 2, (char*, const wxFormatString&), - wxDoSprintfWchar, wxDoSprintfUtf8) - -int WXDLLIMPEXP_BASE -wxVsprintf(char *str, const wxString& format, va_list argptr); - -#if !wxUSE_UTF8_LOCALE_ONLY -int WXDLLIMPEXP_BASE wxDoSnprintfWchar(char *str, size_t size, const wxChar *format, ...); -#endif -#if wxUSE_UNICODE_UTF8 -int WXDLLIMPEXP_BASE wxDoSnprintfUtf8(char *str, size_t size, const char *format, ...); -#endif -WX_DEFINE_VARARG_FUNC(int, wxSnprintf, 3, (char*, size_t, const wxFormatString&), - wxDoSnprintfWchar, wxDoSnprintfUtf8) - -int WXDLLIMPEXP_BASE -wxVsnprintf(char *str, size_t size, const wxString& format, va_list argptr); - -#if wxUSE_UNICODE - -#if !wxUSE_UTF8_LOCALE_ONLY -int WXDLLIMPEXP_BASE wxDoSprintfWchar(wchar_t *str, const wxChar *format, ...); -#endif -#if wxUSE_UNICODE_UTF8 -int WXDLLIMPEXP_BASE wxDoSprintfUtf8(wchar_t *str, const char *format, ...); -#endif -WX_DEFINE_VARARG_FUNC(int, wxSprintf, 2, (wchar_t*, const wxFormatString&), - wxDoSprintfWchar, wxDoSprintfUtf8) - -int WXDLLIMPEXP_BASE -wxVsprintf(wchar_t *str, const wxString& format, va_list argptr); - -#if !wxUSE_UTF8_LOCALE_ONLY -int WXDLLIMPEXP_BASE wxDoSnprintfWchar(wchar_t *str, size_t size, const wxChar *format, ...); -#endif -#if wxUSE_UNICODE_UTF8 -int WXDLLIMPEXP_BASE wxDoSnprintfUtf8(wchar_t *str, size_t size, const char *format, ...); -#endif -WX_DEFINE_VARARG_FUNC(int, wxSnprintf, 3, (wchar_t*, size_t, const wxFormatString&), - wxDoSnprintfWchar, wxDoSnprintfUtf8) - -int WXDLLIMPEXP_BASE -wxVsnprintf(wchar_t *str, size_t size, const wxString& format, va_list argptr); - -#endif // wxUSE_UNICODE - -#ifdef __WATCOMC__ - // workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351 - // - // fortunately, OpenWatcom implements __VA_ARGS__, so we can provide macros - // that cast the format argument to wxString: - #undef wxPrintf - #undef wxFprintf - #undef wxSprintf - #undef wxSnprintf - - #define wxPrintf(fmt, ...) \ - wxPrintf_Impl(wxFormatString(fmt), __VA_ARGS__) - #define wxFprintf(f, fmt, ...) \ - wxFprintf_Impl(f, wxFormatString(fmt), __VA_ARGS__) - #define wxSprintf(s, fmt, ...) \ - wxSprintf_Impl(s, wxFormatString(fmt), __VA_ARGS__) - #define wxSnprintf(s, n, fmt, ...) \ - wxSnprintf_Impl(s, n, wxFormatString(fmt), __VA_ARGS__) -#endif // __WATCOMC__ - - -// We can't use wxArgNormalizer for variadic arguments to wxScanf() etc. -// because they are writable, so instead of providing friendly template -// vararg-like functions, we just provide both char* and wchar_t* variants -// of these functions. The type of output variadic arguments for %s must match -// the type of 'str' and 'format' arguments. -// -// For compatibility with earlier wx versions, we also provide wxSscanf() -// version with the first argument (input string) wxString; for this version, -// the type of output string values is determined by the type of format string -// only. - -#define _WX_SCANFUNC_EXTRACT_ARGS_1(x) x -#define _WX_SCANFUNC_EXTRACT_ARGS_2(x,y) x, y -#define _WX_SCANFUNC_EXTRACT_ARGS(N, args) _WX_SCANFUNC_EXTRACT_ARGS_##N args - -#define _WX_VARARG_PASS_WRITABLE(i) a##i - -#define _WX_DEFINE_SCANFUNC(N, dummy1, name, impl, passfixed, numfixed, fixed)\ - template<_WX_VARARG_JOIN(N, _WX_VARARG_TEMPL)> \ - int name(_WX_SCANFUNC_EXTRACT_ARGS(numfixed, fixed), \ - _WX_VARARG_JOIN(N, _WX_VARARG_ARG)) \ - { \ - return impl(_WX_SCANFUNC_EXTRACT_ARGS(numfixed, passfixed), \ - _WX_VARARG_JOIN(N, _WX_VARARG_PASS_WRITABLE)); \ - } - -#define WX_DEFINE_SCANFUNC(name, numfixed, fixed, impl, passfixed) \ - _WX_VARARG_ITER(_WX_VARARG_MAX_ARGS, \ - _WX_DEFINE_SCANFUNC, \ - dummy1, name, impl, passfixed, numfixed, fixed) - -// this is needed to normalize the format string, see src/common/strvararg.cpp -// for more details -#ifdef __WINDOWS__ - #define wxScanfConvertFormatW(fmt) fmt -#else - const wxScopedWCharBuffer - WXDLLIMPEXP_BASE wxScanfConvertFormatW(const wchar_t *format); -#endif - -WX_DEFINE_SCANFUNC(wxScanf, 1, (const char *format), - wxCRT_ScanfA, (format)) -WX_DEFINE_SCANFUNC(wxScanf, 1, (const wchar_t *format), - wxCRT_ScanfW, (wxScanfConvertFormatW(format))) - -WX_DEFINE_SCANFUNC(wxFscanf, 2, (FILE *stream, const char *format), - wxCRT_FscanfA, (stream, format)) -WX_DEFINE_SCANFUNC(wxFscanf, 2, (FILE *stream, const wchar_t *format), - wxCRT_FscanfW, (stream, wxScanfConvertFormatW(format))) - -WX_DEFINE_SCANFUNC(wxSscanf, 2, (const char *str, const char *format), - wxCRT_SscanfA, (str, format)) -WX_DEFINE_SCANFUNC(wxSscanf, 2, (const wchar_t *str, const wchar_t *format), - wxCRT_SscanfW, (str, wxScanfConvertFormatW(format))) -WX_DEFINE_SCANFUNC(wxSscanf, 2, (const wxScopedCharBuffer& str, const char *format), - wxCRT_SscanfA, (str.data(), format)) -WX_DEFINE_SCANFUNC(wxSscanf, 2, (const wxScopedWCharBuffer& str, const wchar_t *format), - wxCRT_SscanfW, (str.data(), wxScanfConvertFormatW(format))) -WX_DEFINE_SCANFUNC(wxSscanf, 2, (const wxString& str, const char *format), - wxCRT_SscanfA, (str.mb_str(), format)) -WX_DEFINE_SCANFUNC(wxSscanf, 2, (const wxString& str, const wchar_t *format), - wxCRT_SscanfW, (str.wc_str(), wxScanfConvertFormatW(format))) -WX_DEFINE_SCANFUNC(wxSscanf, 2, (const wxCStrData& str, const char *format), - wxCRT_SscanfA, (str.AsCharBuf(), format)) -WX_DEFINE_SCANFUNC(wxSscanf, 2, (const wxCStrData& str, const wchar_t *format), - wxCRT_SscanfW, (str.AsWCharBuf(), wxScanfConvertFormatW(format))) - -// Visual C++ doesn't provide vsscanf() -#ifndef __VISUALC___ -int WXDLLIMPEXP_BASE wxVsscanf(const char *str, const char *format, va_list ap); -int WXDLLIMPEXP_BASE wxVsscanf(const wchar_t *str, const wchar_t *format, va_list ap); -int WXDLLIMPEXP_BASE wxVsscanf(const wxScopedCharBuffer& str, const char *format, va_list ap); -int WXDLLIMPEXP_BASE wxVsscanf(const wxScopedWCharBuffer& str, const wchar_t *format, va_list ap); -int WXDLLIMPEXP_BASE wxVsscanf(const wxString& str, const char *format, va_list ap); -int WXDLLIMPEXP_BASE wxVsscanf(const wxString& str, const wchar_t *format, va_list ap); -int WXDLLIMPEXP_BASE wxVsscanf(const wxCStrData& str, const char *format, va_list ap); -int WXDLLIMPEXP_BASE wxVsscanf(const wxCStrData& str, const wchar_t *format, va_list ap); -#endif // !__VISUALC__ - -#endif /* _WX_WXCRTVARARG_H_ */ diff --git a/Source/3rd Party/wx/include/wx/wxprec.h b/Source/3rd Party/wx/include/wx/wxprec.h index 6df252622..184914e6c 100644 --- a/Source/3rd Party/wx/include/wx/wxprec.h +++ b/Source/3rd Party/wx/include/wx/wxprec.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: wxprec.h 39484 2006-05-31 12:18:02Z ABX $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -17,9 +17,10 @@ #if defined(__VISUALC__) || \ defined(__DMC__) || \ defined(__VISAGECPP__) || \ + defined(__MWERKS__) || \ defined(__WATCOMC__) || \ defined(__BORLANDC__) - + // If user did not request NOCPH and we're not building using configure // then assume user wants precompiled headers. @@ -35,9 +36,9 @@ #ifdef WX_PRECOMP -// include "wx/chartype.h" first to ensure that UNICODE macro is correctly set +// include "wx/wxchar.h" first to ensure that UNICODE macro is correctly set // _before_ including -#include "wx/chartype.h" +#include "wx/wxchar.h" // include standard Windows headers #if defined(__WXMSW__) @@ -48,11 +49,21 @@ #include "wx/msw/missing.h" #endif +// include all PalmOS headers at once +#ifdef __WXPALMOS__ +# include +#endif + // include #ifdef __OS2__ # include "wx/os2/private.h" #endif +// include mgl headers +#ifdef __WXMGL__ +# include "wx/mgl/private.h" +#endif + // include the most common wx headers #include "wx/wx.h" diff --git a/Source/3rd Party/wx/include/wx/xlocale.h b/Source/3rd Party/wx/include/wx/xlocale.h deleted file mode 100644 index 8f4c4838e..000000000 --- a/Source/3rd Party/wx/include/wx/xlocale.h +++ /dev/null @@ -1,341 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// Name: wx/xlocale.h -// Purpose: Header to provide some xlocale wrappers -// Author: Brian Vanderburg II, Vadim Zeitlin -// Created: 2008-01-07 -// RCS-ID: $Id$ -// Copyright: (c) 2008 Brian Vanderburg II -// 2008 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -/* - This header defines portable wrappers around xlocale foo_l() functions or - their MSVC proprietary _foo_l() equivalents when they are available and - implements these functions for the "C" locale [only] if they are not. This - allows the program running under the default user locale to still use "C" - locale for operations such as reading data from files where they are stored - using decimal point &c. - - TODO: Currently only the character classification and transformation - functions and number <-> string functions, are implemented, - we also need at least - - formatted IO: scanf_l(), printf_l() &c - - time: strftime_l(), strptime_l() - */ - -#ifndef _WX_XLOCALE_H_ -#define _WX_XLOCALE_H_ - -#include "wx/defs.h" // wxUSE_XLOCALE - -#if wxUSE_XLOCALE - -#include "wx/crt.h" // Includes wx/chartype.h, wx/wxcrt.h(wx/string.h) -#include "wx/intl.h" // wxLanguage - -// The platform-specific locale type -// If wxXLocale_t is not defined, then only "C" locale support is provided -#ifdef wxHAS_XLOCALE_SUPPORT - #if wxCHECK_VISUALC_VERSION(8) && !defined(__WXWINCE__) - typedef _locale_t wxXLocale_t; - #define wxXLOCALE_IDENT(name) _ ## name - #elif defined(HAVE_LOCALE_T) - #include - #include - #include - #include - - #if wxUSE_UNICODE - #include - #endif - - // Locale type and identifier name - typedef locale_t wxXLocale_t; - - #define wxXLOCALE_IDENT(name) name - #else - #error "Unknown xlocale support" - #endif -#endif // wxHAS_XLOCALE_SUPPORT - - -// wxXLocale is a wrapper around the native type representing a locale. -// -// It is not to be confused with wxLocale, which handles actually changing the -// locale, loading message catalogs, etc. This just stores a locale value. -// The similarity of names is unfortunate, but there doesn't seem to be any -// better alternative right now. Perhaps by wxWidgets 4.0 better naming could -// be used, or this class could become wxLocale (a wrapper for the value), and -// some other class could be used to load the language catalogs or something -// that would be clearer -#ifdef wxHAS_XLOCALE_SUPPORT - -class WXDLLIMPEXP_BASE wxXLocale -{ -public: - // Construct an uninitialized locale - wxXLocale() { m_locale = NULL; } - - // Construct from a symbolic language constant - wxXLocale(wxLanguage lang); - - // Construct from the given language string - wxXLocale(const char *loc) { Init(loc); } - - // Destroy the locale - ~wxXLocale() { Free(); } - - - // Get the global "C" locale object - static wxXLocale& GetCLocale(); - - // Check if the object represents a valid locale (notice that without - // wxHAS_XLOCALE_SUPPORT the only valid locale is the "C" one) - bool IsOk() const { return m_locale != NULL; } - - // Get the type - wxXLocale_t Get() const { return m_locale; } - - bool operator== (const wxXLocale& loc) const - { return m_locale == loc.m_locale; } - -private: - // Special ctor for the "C" locale, it's only used internally as the user - // code is supposed to use GetCLocale() - wxXLocale(struct wxXLocaleCTag * WXUNUSED(dummy)) { Init("C"); } - - // Create from the given language string (called from ctors) - void Init(const char *loc); - - // Free the locale if it's non-NULL - void Free(); - - - // The corresponding locale handle, NULL if invalid - wxXLocale_t m_locale; - - - // POSIX xlocale API provides a duplocale() function but MSVC locale API - // doesn't give us any means to copy a _locale_t object so we reduce the - // functionality to least common denominator here -- it shouldn't be a - // problem as copying the locale objects shouldn't be often needed - wxDECLARE_NO_COPY_CLASS(wxXLocale); -}; - -#else // !wxHAS_XLOCALE_SUPPORT - -// Skeleton version supporting only the "C" locale for the systems without -// xlocale support -class WXDLLIMPEXP_BASE wxXLocale -{ -public: - // Construct an uninitialized locale - wxXLocale() { m_isC = false; } - - // Construct from a symbolic language constant: unless the language is - // wxLANGUAGE_ENGLISH_US (which we suppose to be the same as "C" locale) - // the object will be invalid - wxXLocale(wxLanguage lang) - { - m_isC = lang == wxLANGUAGE_ENGLISH_US; - } - - // Construct from the given language string: unless the string is "C" or - // "POSIX" the object will be invalid - wxXLocale(const char *loc) - { - m_isC = loc && (strcmp(loc, "C") == 0 || strcmp(loc, "POSIX") == 0); - } - - // Default copy ctor, assignment operator and dtor are ok (or would be if - // we didn't use DECLARE_NO_COPY_CLASS() for consistency with the xlocale - // version) - - - // Get the global "C" locale object - static wxXLocale& GetCLocale(); - - // Check if the object represents a valid locale (notice that without - // wxHAS_XLOCALE_SUPPORT the only valid locale is the "C" one) - bool IsOk() const { return m_isC; } - -private: - // Special ctor for the "C" locale, it's only used internally as the user - // code is supposed to use GetCLocale() - wxXLocale(struct wxXLocaleCTag * WXUNUSED(dummy)) { m_isC = true; } - - // Without xlocale support this class can only represent "C" locale, if - // this is false the object is invalid - bool m_isC; - - - // although it's not a problem to copy the objects of this class, we use - // this macro in this implementation for consistency with the xlocale-based - // one which can't be copied when using MSVC locale API - wxDECLARE_NO_COPY_CLASS(wxXLocale); -}; - -#endif // wxHAS_XLOCALE_SUPPORT/!wxHAS_XLOCALE_SUPPORT - - -// A shorter synonym for the most commonly used locale object -#define wxCLocale (wxXLocale::GetCLocale()) -extern WXDLLIMPEXP_DATA_BASE(wxXLocale) wxNullXLocale; - -// Wrappers for various functions: -#ifdef wxHAS_XLOCALE_SUPPORT - - // ctype functions - #define wxCRT_Isalnum_lA wxXLOCALE_IDENT(isalnum_l) - #define wxCRT_Isalpha_lA wxXLOCALE_IDENT(isalpha_l) - #define wxCRT_Iscntrl_lA wxXLOCALE_IDENT(iscntrl_l) - #define wxCRT_Isdigit_lA wxXLOCALE_IDENT(isdigit_l) - #define wxCRT_Isgraph_lA wxXLOCALE_IDENT(isgraph_l) - #define wxCRT_Islower_lA wxXLOCALE_IDENT(islower_l) - #define wxCRT_Isprint_lA wxXLOCALE_IDENT(isprint_l) - #define wxCRT_Ispunct_lA wxXLOCALE_IDENT(ispunct_l) - #define wxCRT_Isspace_lA wxXLOCALE_IDENT(isspace_l) - #define wxCRT_Isupper_lA wxXLOCALE_IDENT(isupper_l) - #define wxCRT_Isxdigit_lA wxXLOCALE_IDENT(isxdigit_l) - #define wxCRT_Tolower_lA wxXLOCALE_IDENT(tolower_l) - #define wxCRT_Toupper_lA wxXLOCALE_IDENT(toupper_l) - - inline int wxIsalnum_l(char c, const wxXLocale& loc) - { return wxCRT_Isalnum_lA(static_cast(c), loc.Get()); } - inline int wxIsalpha_l(char c, const wxXLocale& loc) - { return wxCRT_Isalpha_lA(static_cast(c), loc.Get()); } - inline int wxIscntrl_l(char c, const wxXLocale& loc) - { return wxCRT_Iscntrl_lA(static_cast(c), loc.Get()); } - inline int wxIsdigit_l(char c, const wxXLocale& loc) - { return wxCRT_Isdigit_lA(static_cast(c), loc.Get()); } - inline int wxIsgraph_l(char c, const wxXLocale& loc) - { return wxCRT_Isgraph_lA(static_cast(c), loc.Get()); } - inline int wxIslower_l(char c, const wxXLocale& loc) - { return wxCRT_Islower_lA(static_cast(c), loc.Get()); } - inline int wxIsprint_l(char c, const wxXLocale& loc) - { return wxCRT_Isprint_lA(static_cast(c), loc.Get()); } - inline int wxIspunct_l(char c, const wxXLocale& loc) - { return wxCRT_Ispunct_lA(static_cast(c), loc.Get()); } - inline int wxIsspace_l(char c, const wxXLocale& loc) - { return wxCRT_Isspace_lA(static_cast(c), loc.Get()); } - inline int wxIsupper_l(char c, const wxXLocale& loc) - { return wxCRT_Isupper_lA(static_cast(c), loc.Get()); } - inline int wxIsxdigit_l(char c, const wxXLocale& loc) - { return wxCRT_Isxdigit_lA(static_cast(c), loc.Get()); } - inline int wxTolower_l(char c, const wxXLocale& loc) - { return wxCRT_Tolower_lA(static_cast(c), loc.Get()); } - inline int wxToupper_l(char c, const wxXLocale& loc) - { return wxCRT_Toupper_lA(static_cast(c), loc.Get()); } - - - // stdlib functions for numeric <-> string conversion - // NOTE: GNU libc does not have ato[fil]_l functions; - // MSVC++8 does not have _strto[u]ll_l functions; - // thus we take the minimal set of functions provided in both environments: - - #define wxCRT_Strtod_lA wxXLOCALE_IDENT(strtod_l) - #define wxCRT_Strtol_lA wxXLOCALE_IDENT(strtol_l) - #define wxCRT_Strtoul_lA wxXLOCALE_IDENT(strtoul_l) - - inline double wxStrtod_lA(const char *c, char **endptr, const wxXLocale& loc) - { return wxCRT_Strtod_lA(c, endptr, loc.Get()); } - inline long wxStrtol_lA(const char *c, char **endptr, int base, const wxXLocale& loc) - { return wxCRT_Strtol_lA(c, endptr, base, loc.Get()); } - inline unsigned long wxStrtoul_lA(const char *c, char **endptr, int base, const wxXLocale& loc) - { return wxCRT_Strtoul_lA(c, endptr, base, loc.Get()); } - - #if wxUSE_UNICODE - - // ctype functions - #define wxCRT_Isalnum_lW wxXLOCALE_IDENT(iswalnum_l) - #define wxCRT_Isalpha_lW wxXLOCALE_IDENT(iswalpha_l) - #define wxCRT_Iscntrl_lW wxXLOCALE_IDENT(iswcntrl_l) - #define wxCRT_Isdigit_lW wxXLOCALE_IDENT(iswdigit_l) - #define wxCRT_Isgraph_lW wxXLOCALE_IDENT(iswgraph_l) - #define wxCRT_Islower_lW wxXLOCALE_IDENT(iswlower_l) - #define wxCRT_Isprint_lW wxXLOCALE_IDENT(iswprint_l) - #define wxCRT_Ispunct_lW wxXLOCALE_IDENT(iswpunct_l) - #define wxCRT_Isspace_lW wxXLOCALE_IDENT(iswspace_l) - #define wxCRT_Isupper_lW wxXLOCALE_IDENT(iswupper_l) - #define wxCRT_Isxdigit_lW wxXLOCALE_IDENT(iswxdigit_l) - #define wxCRT_Tolower_lW wxXLOCALE_IDENT(towlower_l) - #define wxCRT_Toupper_lW wxXLOCALE_IDENT(towupper_l) - - inline int wxIsalnum_l(wchar_t c, const wxXLocale& loc) - { return wxCRT_Isalnum_lW(c, loc.Get()); } - inline int wxIsalpha_l(wchar_t c, const wxXLocale& loc) - { return wxCRT_Isalpha_lW(c, loc.Get()); } - inline int wxIscntrl_l(wchar_t c, const wxXLocale& loc) - { return wxCRT_Iscntrl_lW(c, loc.Get()); } - inline int wxIsdigit_l(wchar_t c, const wxXLocale& loc) - { return wxCRT_Isdigit_lW(c, loc.Get()); } - inline int wxIsgraph_l(wchar_t c, const wxXLocale& loc) - { return wxCRT_Isgraph_lW(c, loc.Get()); } - inline int wxIslower_l(wchar_t c, const wxXLocale& loc) - { return wxCRT_Islower_lW(c, loc.Get()); } - inline int wxIsprint_l(wchar_t c, const wxXLocale& loc) - { return wxCRT_Isprint_lW(c, loc.Get()); } - inline int wxIspunct_l(wchar_t c, const wxXLocale& loc) - { return wxCRT_Ispunct_lW(c, loc.Get()); } - inline int wxIsspace_l(wchar_t c, const wxXLocale& loc) - { return wxCRT_Isspace_lW(c, loc.Get()); } - inline int wxIsupper_l(wchar_t c, const wxXLocale& loc) - { return wxCRT_Isupper_lW(c, loc.Get()); } - inline int wxIsxdigit_l(wchar_t c, const wxXLocale& loc) - { return wxCRT_Isxdigit_lW(c, loc.Get()); } - inline wchar_t wxTolower_l(wchar_t c, const wxXLocale& loc) - { return wxCRT_Tolower_lW(c, loc.Get()); } - inline wchar_t wxToupper_l(wchar_t c, const wxXLocale& loc) - { return wxCRT_Toupper_lW(c, loc.Get()); } - - - // stdlib functions for numeric <-> string conversion - // (see notes above about missing functions) - #define wxCRT_Strtod_lW wxXLOCALE_IDENT(wcstod_l) - #define wxCRT_Strtol_lW wxXLOCALE_IDENT(wcstol_l) - #define wxCRT_Strtoul_lW wxXLOCALE_IDENT(wcstoul_l) - - inline double wxStrtod_l(const wchar_t *c, wchar_t **endptr, const wxXLocale& loc) - { return wxCRT_Strtod_lW(c, endptr, loc.Get()); } - inline long wxStrtol_l(const wchar_t *c, wchar_t **endptr, int base, const wxXLocale& loc) - { return wxCRT_Strtol_lW(c, endptr, base, loc.Get()); } - inline unsigned long wxStrtoul_l(const wchar_t *c, wchar_t **endptr, int base, const wxXLocale& loc) - { return wxCRT_Strtoul_lW(c, endptr, base, loc.Get()); } - #else // !wxUSE_UNICODE - inline double wxStrtod_l(const char *c, char **endptr, const wxXLocale& loc) - { return wxCRT_Strtod_lA(c, endptr, loc.Get()); } - inline long wxStrtol_l(const char *c, char **endptr, int base, const wxXLocale& loc) - { return wxCRT_Strtol_lA(c, endptr, base, loc.Get()); } - inline unsigned long wxStrtoul_l(const char *c, char **endptr, int base, const wxXLocale& loc) - { return wxCRT_Strtoul_lA(c, endptr, base, loc.Get()); } - #endif // wxUSE_UNICODE -#else // !wxHAS_XLOCALE_SUPPORT - // ctype functions - int WXDLLIMPEXP_BASE wxIsalnum_l(const wxUniChar& c, const wxXLocale& loc); - int WXDLLIMPEXP_BASE wxIsalpha_l(const wxUniChar& c, const wxXLocale& loc); - int WXDLLIMPEXP_BASE wxIscntrl_l(const wxUniChar& c, const wxXLocale& loc); - int WXDLLIMPEXP_BASE wxIsdigit_l(const wxUniChar& c, const wxXLocale& loc); - int WXDLLIMPEXP_BASE wxIsgraph_l(const wxUniChar& c, const wxXLocale& loc); - int WXDLLIMPEXP_BASE wxIslower_l(const wxUniChar& c, const wxXLocale& loc); - int WXDLLIMPEXP_BASE wxIsprint_l(const wxUniChar& c, const wxXLocale& loc); - int WXDLLIMPEXP_BASE wxIspunct_l(const wxUniChar& c, const wxXLocale& loc); - int WXDLLIMPEXP_BASE wxIsspace_l(const wxUniChar& c, const wxXLocale& loc); - int WXDLLIMPEXP_BASE wxIsupper_l(const wxUniChar& c, const wxXLocale& loc); - int WXDLLIMPEXP_BASE wxIsxdigit_l(const wxUniChar& c, const wxXLocale& loc); - int WXDLLIMPEXP_BASE wxTolower_l(const wxUniChar& c, const wxXLocale& loc); - int WXDLLIMPEXP_BASE wxToupper_l(const wxUniChar& c, const wxXLocale& loc); - - // stdlib functions - double WXDLLIMPEXP_BASE wxStrtod_l(const wchar_t* str, wchar_t **endptr, const wxXLocale& loc); - double WXDLLIMPEXP_BASE wxStrtod_l(const char* str, char **endptr, const wxXLocale& loc); - long WXDLLIMPEXP_BASE wxStrtol_l(const wchar_t* str, wchar_t **endptr, int base, const wxXLocale& loc); - long WXDLLIMPEXP_BASE wxStrtol_l(const char* str, char **endptr, int base, const wxXLocale& loc); - unsigned long WXDLLIMPEXP_BASE wxStrtoul_l(const wchar_t* str, wchar_t **endptr, int base, const wxXLocale& loc); - unsigned long WXDLLIMPEXP_BASE wxStrtoul_l(const char* str, char **endptr, int base, const wxXLocale& loc); - -#endif // wxHAS_XLOCALE_SUPPORT/!wxHAS_XLOCALE_SUPPORT - -#endif // wxUSE_XLOCALE - -#endif // _WX_XLOCALE_H_ diff --git a/Source/3rd Party/wx/include/wx/xpmdecod.h b/Source/3rd Party/wx/include/wx/xpmdecod.h index fc141adf1..8cb516ae3 100644 --- a/Source/3rd Party/wx/include/wx/xpmdecod.h +++ b/Source/3rd Party/wx/include/wx/xpmdecod.h @@ -2,7 +2,7 @@ // Name: wx/xpmdecod.h // Purpose: wxXPMDecoder, XPM reader for wxImage and wxBitmap // Author: Vaclav Slavik -// CVS-ID: $Id$ +// CVS-ID: $Id: xpmdecod.h 49804 2007-11-10 01:09:42Z VZ $ // Copyright: (c) 2001 Vaclav Slavik // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -21,7 +21,7 @@ class WXDLLIMPEXP_FWD_BASE wxInputStream; // wxXPMDecoder class // -------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxXPMDecoder +class WXDLLEXPORT wxXPMDecoder { public: // constructor, destructor, etc. @@ -30,20 +30,15 @@ public: #if wxUSE_STREAMS // Is the stream XPM file? - // NOTE: this function modifies the current stream position bool CanRead(wxInputStream& stream); - // Read XPM file from the stream, parse it and create image from it wxImage ReadFile(wxInputStream& stream); #endif - // Read directly from XPM data (as passed to wxBitmap ctor): wxImage ReadData(const char* const* xpm_data); - #ifdef __BORLANDC__ // needed for Borland 5.5 - wxImage ReadData(char** xpm_data) - { return ReadData(const_cast(xpm_data)); } + wxImage ReadData(char** xpm_data) { return ReadData(wx_const_cast(const char* const*, xpm_data)); } #endif }; diff --git a/Source/3rd Party/wx/include/wx/xti.h b/Source/3rd Party/wx/include/wx/xti.h index e75312c15..5fd35efb4 100644 --- a/Source/3rd Party/wx/include/wx/xti.h +++ b/Source/3rd Party/wx/include/wx/xti.h @@ -2,9 +2,9 @@ // Name: wx/xti.h // Purpose: runtime metadata information (extended class info) // Author: Stefan Csomor -// Modified by: Francesco Montorsi +// Modified by: // Created: 27/07/03 -// RCS-ID: $Id$ +// RCS-ID: $Id: xti.h 52488 2008-03-14 14:13:05Z JS $ // Copyright: (c) 1997 Julian Smart // (c) 2003 Stefan Csomor // Licence: wxWindows licence @@ -20,11 +20,11 @@ // This means we have the following domains : // // - Type Information for categorizing built in types as well as custom types -// this includes information about enums, their values and names -// - Type safe value storage : a kind of wxVariant, called right now wxAny -// which will be merged with wxVariant +// this includes information about enums, their values and names +// - Type safe value storage : a kind of wxVariant, called right now wxxVariant +// which will be merged with wxVariant // - Property Information and Property Accessors providing access to a class' -// values and exposed event delegates +// values and exposed event delegates // - Information about event handlers // - extended Class Information for accessing all these @@ -33,96 +33,1588 @@ // ---------------------------------------------------------------------------- #include "wx/defs.h" +#include "wx/memory.h" +#include "wx/flags.h" +#include "wx/string.h" +#include "wx/arrstr.h" +#include "wx/hashmap.h" +#include "wx/log.h" +#include "wx/intl.h" -#if wxUSE_EXTENDED_RTTI +#include -class WXDLLIMPEXP_FWD_BASE wxAny; -class WXDLLIMPEXP_FWD_BASE wxAnyList; -class WXDLLIMPEXP_FWD_BASE wxObject; -class WXDLLIMPEXP_FWD_BASE wxString; -class WXDLLIMPEXP_FWD_BASE wxClassInfo; -class WXDLLIMPEXP_FWD_BASE wxHashTable; -class WXDLLIMPEXP_FWD_BASE wxObject; -class WXDLLIMPEXP_FWD_BASE wxPluginLibrary; -class WXDLLIMPEXP_FWD_BASE wxHashTable; -class WXDLLIMPEXP_FWD_BASE wxHashTable_Node; +// we will move this later to defs.h -class WXDLLIMPEXP_FWD_BASE wxStringToAnyHashMap; -class WXDLLIMPEXP_FWD_BASE wxPropertyInfoMap; -class WXDLLIMPEXP_FWD_BASE wxPropertyAccessor; -class WXDLLIMPEXP_FWD_BASE wxObjectAllocatorAndCreator; -class WXDLLIMPEXP_FWD_BASE wxObjectAllocator; +#if defined(__GNUC__) && !wxCHECK_GCC_VERSION( 3 , 4 ) +# define wxUSE_MEMBER_TEMPLATES 0 +#endif + +#if defined(_MSC_VER) && _MSC_VER <= 1200 +# define wxUSE_MEMBER_TEMPLATES 0 +# define wxUSE_FUNC_TEMPLATE_POINTER 0 +#endif + +#ifndef wxUSE_MEMBER_TEMPLATES +# define wxUSE_MEMBER_TEMPLATES 1 +#endif + +#ifndef wxUSE_FUNC_TEMPLATE_POINTER +# define wxUSE_FUNC_TEMPLATE_POINTER 1 +#endif + +#if wxUSE_MEMBER_TEMPLATES +# define wxTEMPLATED_MEMBER_CALL( method , type ) method() +# define wxTEMPLATED_MEMBER_FIX( type ) +#else +# define wxTEMPLATED_MEMBER_CALL( method , type ) method((type*)NULL) +# define wxTEMPLATED_MEMBER_FIX( type ) type* =NULL +#endif + +#if defined(_MSC_VER) && _MSC_VER <= 1200 +# define wxTEMPLATED_FUNCTION_FIX( type ) , wxTEMPLATED_MEMBER_FIX(type) +# define wxINFUNC_CLASS_TYPE_FIX( type ) typedef type type; +#else +# define wxTEMPLATED_FUNCTION_FIX( type ) +# define wxINFUNC_CLASS_TYPE_FIX( type ) +#endif + +#define EMPTY_MACROVALUE /**/ + +class WXDLLIMPEXP_BASE wxObject; +class WXDLLIMPEXP_BASE wxClassInfo; +class WXDLLIMPEXP_BASE wxDynamicClassInfo; +class WXDLLIMPEXP_BASE wxHashTable; +class WXDLLIMPEXP_BASE wxObjectRefData; +class WXDLLIMPEXP_BASE wxEvent; +class WXDLLIMPEXP_BASE wxEvtHandler; + +typedef void (wxObject::*wxObjectEventFunction)(wxEvent&); + +#if wxUSE_FUNC_TEMPLATE_POINTER +# define wxTO_STRING(type) wxToStringConverter +# define wxTO_STRING_IMP(type) +# define wxFROM_STRING(type) wxFromStringConverter +# define wxFROM_STRING_IMP(type) +#else +# define wxTO_STRING(type) ToString##type +# define wxTO_STRING_IMP(type) inline void ToString##type( const wxxVariant& data , wxString &result ) { wxToStringConverter(data, result); } +# define wxFROM_STRING(type) FromString##type +# define wxFROM_STRING_IMP(type) inline void FromString##type( const wxString& data , wxxVariant &result ) { wxFromStringConverter(data, result); } +#endif + +// ---------------------------------------------------------------------------- +// Enum Support +// +// In the header files there would no change from pure c++ code, in the +// implementation, an enum would have +// to be enumerated eg : +// +// wxBEGIN_ENUM( wxFlavor ) +// wxENUM_MEMBER( Vanilla ) +// wxENUM_MEMBER( Chocolate ) +// wxENUM_MEMBER( Strawberry ) +// wxEND_ENUM( wxFlavor ) +// ---------------------------------------------------------------------------- + +struct WXDLLIMPEXP_BASE wxEnumMemberData +{ + const wxChar* m_name; + int m_value; +}; + +class WXDLLIMPEXP_BASE wxEnumData +{ +public : + wxEnumData( wxEnumMemberData* data ) ; + + // returns true if the member has been found and sets the int value + // pointed to accordingly (if ptr != null ) + // if not found returns false, value left unchanged + bool HasEnumMemberValue( const wxChar *name , int *value = NULL ) const ; + + // returns the value of the member, if not found in debug mode an + // assert is issued, in release 0 is returned + int GetEnumMemberValue(const wxChar *name ) const ; + + // returns the name of the enum member having the passed in value + // returns an emtpy string if not found + const wxChar *GetEnumMemberName(int value) const ; + + // returns the number of members in this enum + int GetEnumCount() const { return m_count ; } + + // returns the value of the nth member + int GetEnumMemberValueByIndex( int n ) const ; + + // returns the value of the nth member + const wxChar *GetEnumMemberNameByIndex( int n ) const ; +private : + wxEnumMemberData *m_members; + int m_count ; +}; + +#define wxBEGIN_ENUM( e ) \ + wxEnumMemberData s_enumDataMembers##e[] = { + +#define wxENUM_MEMBER( v ) { wxT(#v), v } , + +#define wxEND_ENUM( e ) { NULL , 0 } } ; \ + wxEnumData s_enumData##e( s_enumDataMembers##e ) ; \ + wxEnumData *wxGetEnumData(e) { return &s_enumData##e ; } \ + template<> void wxStringReadValue(const wxString& s , e &data ) \ +{ \ + data = (e) s_enumData##e.GetEnumMemberValue(s) ; \ +} \ + template<> void wxStringWriteValue(wxString &s , const e &data ) \ +{ \ + s = s_enumData##e.GetEnumMemberName((int)data) ; \ +} \ + void FromLong##e( long data , wxxVariant& result ) { result = wxxVariant((e)data) ;} \ + void ToLong##e( const wxxVariant& data , long &result ) { result = (long) data.wxTEMPLATED_MEMBER_CALL(Get , e) ;} \ + wxTO_STRING_IMP( e ) \ + wxFROM_STRING_IMP( e ) \ + wxEnumTypeInfo s_typeInfo##e(wxT_ENUM , &s_enumData##e , &wxTO_STRING( e ) , &wxFROM_STRING( e ) , &ToLong##e , &FromLong##e , typeid(e).name() ) ; + +// ---------------------------------------------------------------------------- +// Set Support +// +// in the header : +// +// enum wxFlavor +// { +// Vanilla, +// Chocolate, +// Strawberry, +// }; +// +// typedef wxBitset wxCoupe ; +// +// in the implementation file : +// +// wxBEGIN_ENUM( wxFlavor ) +// wxENUM_MEMBER( Vanilla ) +// wxENUM_MEMBER( Chocolate ) +// wxENUM_MEMBER( Strawberry ) +// wxEND_ENUM( wxFlavor ) +// +// wxIMPLEMENT_SET_STREAMING( wxCoupe , wxFlavor ) +// +// implementation note : no partial specialization for streaming, but a delegation to a +// different class +// +// ---------------------------------------------------------------------------- + +// in order to remove dependancy on string tokenizer +void WXDLLIMPEXP_BASE wxSetStringToArray( const wxString &s , wxArrayString &array ) ; + +template +void wxSetFromString(const wxString &s , wxBitset &data ) +{ + wxEnumData* edata = wxGetEnumData((e) 0) ; + data.reset() ; + + wxArrayString array ; + wxSetStringToArray( s , array ) ; + wxString flag; + for ( int i = 0 ; i < array.Count() ; ++i ) + { + flag = array[i] ; + int ivalue ; + if ( edata->HasEnumMemberValue( flag , &ivalue ) ) + { + data.set( (e) ivalue ) ; + } + } +} + +template +void wxSetToString( wxString &s , const wxBitset &data ) +{ + wxEnumData* edata = wxGetEnumData((e) 0) ; + int count = edata->GetEnumCount() ; + int i ; + s.Clear() ; + for ( i = 0 ; i < count ; i++ ) + { + e value = (e) edata->GetEnumMemberValueByIndex(i) ; + if ( data.test( value ) ) + { + // this could also be done by the templated calls + if ( !s.empty() ) + s +=wxT("|") ; + s += edata->GetEnumMemberNameByIndex(i) ; + } + } +} + +#define wxIMPLEMENT_SET_STREAMING(SetName,e) \ + template<> void wxStringReadValue(const wxString &s , wxBitset &data ) \ +{ \ + wxSetFromString( s , data ) ; \ +} \ + template<> void wxStringWriteValue( wxString &s , const wxBitset &data ) \ +{ \ + wxSetToString( s , data ) ; \ +} \ + void FromLong##SetName( long data , wxxVariant& result ) { result = wxxVariant(SetName((unsigned long)data)) ;} \ + void ToLong##SetName( const wxxVariant& data , long &result ) { result = (long) data.wxTEMPLATED_MEMBER_CALL(Get , SetName).to_ulong() ;} \ + wxTO_STRING_IMP( SetName ) \ + wxFROM_STRING_IMP( SetName ) \ + wxEnumTypeInfo s_typeInfo##SetName(wxT_SET , &s_enumData##e , &wxTO_STRING( SetName ) , &wxFROM_STRING( SetName ) , &ToLong##SetName , &FromLong##SetName, typeid(SetName).name() ) ; \ +} + +template +void wxFlagsFromString(const wxString &s , e &data ) +{ + wxEnumData* edata = wxGetEnumData((e*) 0) ; + data.m_data = 0 ; + + wxArrayString array ; + wxSetStringToArray( s , array ) ; + wxString flag; + for ( size_t i = 0 ; i < array.Count() ; ++i ) + { + flag = array[i] ; + int ivalue ; + if ( edata->HasEnumMemberValue( flag , &ivalue ) ) + { + data.m_data |= ivalue ; + } + } +} + +template +void wxFlagsToString( wxString &s , const e& data ) +{ + wxEnumData* edata = wxGetEnumData((e*) 0) ; + int count = edata->GetEnumCount() ; + int i ; + s.Clear() ; + long dataValue = data.m_data ; + for ( i = 0 ; i < count ; i++ ) + { + int value = edata->GetEnumMemberValueByIndex(i) ; + // make this to allow for multi-bit constants to work + if ( value && ( dataValue & value ) == value ) + { + // clear the flags we just set + dataValue &= ~value ; + // this could also be done by the templated calls + if ( !s.empty() ) + s +=wxT("|") ; + s += edata->GetEnumMemberNameByIndex(i) ; + } + } +} + +#define wxBEGIN_FLAGS( e ) \ + wxEnumMemberData s_enumDataMembers##e[] = { + +#define wxFLAGS_MEMBER( v ) { wxT(#v), v } , + +#define wxEND_FLAGS( e ) { NULL , 0 } } ; \ + wxEnumData s_enumData##e( s_enumDataMembers##e ) ; \ + wxEnumData *wxGetEnumData(e*) { return &s_enumData##e ; } \ + template<> void wxStringReadValue(const wxString &s , e &data ) \ +{ \ + wxFlagsFromString( s , data ) ; \ +} \ + template<> void wxStringWriteValue( wxString &s , const e& data ) \ +{ \ + wxFlagsToString( s , data ) ; \ +} \ + void FromLong##e( long data , wxxVariant& result ) { result = wxxVariant(e(data)) ;} \ + void ToLong##e( const wxxVariant& data , long &result ) { result = (long) data.wxTEMPLATED_MEMBER_CALL(Get , e).m_data ;} \ + wxTO_STRING_IMP( e ) \ + wxFROM_STRING_IMP( e ) \ + wxEnumTypeInfo s_typeInfo##e(wxT_SET , &s_enumData##e , &wxTO_STRING( e ) , &wxFROM_STRING( e ) , &ToLong##e , &FromLong##e, typeid(e).name() ) ; +// ---------------------------------------------------------------------------- +// Type Information +// ---------------------------------------------------------------------------- +// +// +// All data exposed by the RTTI is characterized using the following classes. +// The first characterization is done by wxTypeKind. All enums up to and including +// wxT_CUSTOM represent so called simple types. These cannot be divided any further. +// They can be converted to and from wxStrings, that's all. -#define wx_dynamic_cast(t, x) dynamic_cast(x) +enum wxTypeKind +{ + wxT_VOID = 0, // unknown type + wxT_BOOL, + wxT_CHAR, + wxT_UCHAR, + wxT_INT, + wxT_UINT, + wxT_LONG, + wxT_ULONG, + wxT_FLOAT, + wxT_DOUBLE, + wxT_STRING, // must be wxString + wxT_SET, // must be wxBitset<> template + wxT_ENUM, + wxT_CUSTOM, // user defined type (e.g. wxPoint) -#include "wx/xtitypes.h" -#include "wx/xtihandler.h" + wxT_LAST_SIMPLE_TYPE_KIND = wxT_CUSTOM , + wxT_OBJECT_PTR, // object reference + wxT_OBJECT , // embedded object + wxT_COLLECTION , // collection + + wxT_DELEGATE , // for connecting against an event source + + wxT_LAST_TYPE_KIND = wxT_DELEGATE // sentinel for bad data, asserts, debugging +}; + +class WXDLLIMPEXP_BASE wxxVariant ; +class WXDLLIMPEXP_BASE wxTypeInfo ; + +WX_DECLARE_STRING_HASH_MAP_WITH_DECL( wxTypeInfo* , wxTypeInfoMap , class WXDLLIMPEXP_BASE ) ; + +class WXDLLIMPEXP_BASE wxTypeInfo +{ +public : + typedef void (*converterToString_t)( const wxxVariant& data , wxString &result ) ; + typedef void (*converterFromString_t)( const wxString& data , wxxVariant &result ) ; + + wxTypeInfo(wxTypeKind kind, + converterToString_t to = NULL, converterFromString_t from = NULL, + const wxString &name = wxEmptyString): + m_toString(to), m_fromString(from), m_kind(kind), m_name(name) + { + Register(); + } +#if wxUSE_UNICODE + wxTypeInfo(wxTypeKind kind, + converterToString_t to, converterFromString_t from, + const char *name): + m_toString(to), m_fromString(from), m_kind(kind), m_name(wxString::FromAscii(name)) + { + Register(); + } +#endif + + virtual ~wxTypeInfo() + { + Unregister() ; + } + + // return the kind of this type (wxT_... constants) + wxTypeKind GetKind() const { return m_kind ; } + + // returns the unique name of this type + const wxString& GetTypeName() const { return m_name ; } + + // is this type a delegate type + bool IsDelegateType() const { return m_kind == wxT_DELEGATE ; } + + // is this type a custom type + bool IsCustomType() const { return m_kind == wxT_CUSTOM ; } + + // is this type an object type + bool IsObjectType() const { return m_kind == wxT_OBJECT || m_kind == wxT_OBJECT_PTR ; } + + // can the content of this type be converted to and from strings ? + bool HasStringConverters() const { return m_toString != NULL && m_fromString != NULL ; } + + // convert a wxxVariant holding data of this type into a string + void ConvertToString( const wxxVariant& data , wxString &result ) const + + { if ( m_toString ) (*m_toString)( data , result ) ; else wxLogError( _("String conversions not supported") ) ; } + + // convert a string into a wxxVariant holding the corresponding data in this type + void ConvertFromString( const wxString& data , wxxVariant &result ) const + { if( m_fromString ) (*m_fromString)( data , result ) ; else wxLogError( _("String conversions not supported") ) ; } + +#if wxUSE_UNICODE + static wxTypeInfo *FindType(const char *typeName) { return FindType( wxString::FromAscii(typeName) ) ; } +#endif + static wxTypeInfo *FindType(const wxChar *typeName); + +private : + + void Register(); + void Unregister(); + + converterToString_t m_toString ; + converterFromString_t m_fromString ; + + static wxTypeInfoMap* ms_typeTable ; + + wxTypeKind m_kind; + wxString m_name; +}; + +class WXDLLIMPEXP_BASE wxBuiltInTypeInfo : public wxTypeInfo +{ +public : + wxBuiltInTypeInfo( wxTypeKind kind , converterToString_t to = NULL , converterFromString_t from = NULL , const wxString &name = wxEmptyString ) : + wxTypeInfo( kind , to , from , name ) + { wxASSERT_MSG( GetKind() < wxT_SET , wxT("Illegal Kind for Base Type") ) ; } +#if wxUSE_UNICODE + wxBuiltInTypeInfo( wxTypeKind kind , converterToString_t to , converterFromString_t from , const char *name ) : + wxTypeInfo( kind , to , from , name ) + { wxASSERT_MSG( GetKind() < wxT_SET , wxT("Illegal Kind for Base Type") ) ; } +#endif +} ; + +class WXDLLIMPEXP_BASE wxCustomTypeInfo : public wxTypeInfo +{ +public : + wxCustomTypeInfo( const wxString &name , converterToString_t to , converterFromString_t from ) : + wxTypeInfo( wxT_CUSTOM , to , from , name ) + {} +#if wxUSE_UNICODE + wxCustomTypeInfo( const char *name , converterToString_t to , converterFromString_t from ) : + wxTypeInfo( wxT_CUSTOM , to , from , name ) + {} +#endif +} ; + +class WXDLLIMPEXP_BASE wxEnumTypeInfo : public wxTypeInfo +{ +public : + typedef void (*converterToLong_t)( const wxxVariant& data , long &result ) ; + typedef void (*converterFromLong_t)( long data , wxxVariant &result ) ; + + wxEnumTypeInfo( wxTypeKind kind , wxEnumData* enumInfo , converterToString_t to , converterFromString_t from , + converterToLong_t toLong , converterFromLong_t fromLong , const wxString &name ) : + wxTypeInfo( kind , to , from , name ) , m_toLong( toLong ) , m_fromLong( fromLong ) + { wxASSERT_MSG( kind == wxT_ENUM || kind == wxT_SET , wxT("Illegal Kind for Enum Type")) ; m_enumInfo = enumInfo ;} + +#if wxUSE_UNICODE + wxEnumTypeInfo( wxTypeKind kind , wxEnumData* enumInfo , converterToString_t to , converterFromString_t from , + converterToLong_t toLong , converterFromLong_t fromLong , const char * name ) : + wxTypeInfo( kind , to , from , name ) , m_toLong( toLong ) , m_fromLong( fromLong ) + { wxASSERT_MSG( kind == wxT_ENUM || kind == wxT_SET , wxT("Illegal Kind for Enum Type")) ; m_enumInfo = enumInfo ;} +#endif + const wxEnumData* GetEnumData() const { return m_enumInfo ; } + + // convert a wxxVariant holding data of this type into a long + void ConvertToLong( const wxxVariant& data , long &result ) const + + { if( m_toLong ) (*m_toLong)( data , result ) ; else wxLogError( _("Long Conversions not supported") ) ; } + + // convert a long into a wxxVariant holding the corresponding data in this type + void ConvertFromLong( long data , wxxVariant &result ) const + { if( m_fromLong ) (*m_fromLong)( data , result ) ; else wxLogError( _("Long Conversions not supported") ) ;} + +private : + converterToLong_t m_toLong ; + converterFromLong_t m_fromLong ; + + wxEnumData *m_enumInfo; // Kind == wxT_ENUM or Kind == wxT_SET +} ; + +class WXDLLIMPEXP_BASE wxClassTypeInfo : public wxTypeInfo +{ +public : + wxClassTypeInfo( wxTypeKind kind , wxClassInfo* classInfo , converterToString_t to = NULL , converterFromString_t from = NULL , const wxString &name = wxEmptyString) ; +#if wxUSE_UNICODE + wxClassTypeInfo( wxTypeKind kind , wxClassInfo* classInfo , converterToString_t to , converterFromString_t from , const char *name ) ; +#endif + const wxClassInfo *GetClassInfo() const { return m_classInfo ; } +private : + wxClassInfo *m_classInfo; // Kind == wxT_OBJECT - could be NULL +} ; + +class WXDLLIMPEXP_BASE wxCollectionTypeInfo : public wxTypeInfo +{ +public : + wxCollectionTypeInfo( const wxString &elementName , converterToString_t to , converterFromString_t from , const wxString &name) : + wxTypeInfo( wxT_COLLECTION , to , from , name ) + { m_elementTypeName = elementName ; m_elementType = NULL ;} +#if wxUSE_UNICODE + wxCollectionTypeInfo( const char *elementName , converterToString_t to , converterFromString_t from , const char *name ) : + wxTypeInfo( wxT_COLLECTION , to , from , name ) + { m_elementTypeName = wxString::FromAscii( elementName ) ; m_elementType = NULL ;} +#endif + const wxTypeInfo* GetElementType() const + { + if ( m_elementType == NULL ) + m_elementType = wxTypeInfo::FindType( m_elementTypeName ) ; + return m_elementType ; } +private : + mutable wxTypeInfo * m_elementType ; + wxString m_elementTypeName ; +} ; + +// a delegate is an exposed event source + +class WXDLLIMPEXP_BASE wxDelegateTypeInfo : public wxTypeInfo +{ +public : + wxDelegateTypeInfo( int eventType , wxClassInfo* eventClass , converterToString_t to = NULL , converterFromString_t from = NULL ) ; + wxDelegateTypeInfo( int eventType , int lastEventType, wxClassInfo* eventClass , converterToString_t to = NULL , converterFromString_t from = NULL ) ; + int GetEventType() const { return m_eventType ; } + int GetLastEventType() const { return m_lastEventType ; } + const wxClassInfo* GetEventClass() const { return m_eventClass ; } +private : + const wxClassInfo *m_eventClass; // (extended will merge into classinfo) + int m_eventType ; + int m_lastEventType ; +} ; + +template const wxTypeInfo* wxGetTypeInfo( T * ) { return wxTypeInfo::FindType(typeid(T).name()) ; } + +// this macro is for usage with custom, non-object derived classes and structs, wxPoint is such a custom type + +#if wxUSE_FUNC_TEMPLATE_POINTER +#define wxCUSTOM_TYPE_INFO( e , toString , fromString ) \ + wxCustomTypeInfo s_typeInfo##e(typeid(e).name() , &toString , &fromString) ; +#else +#define wxCUSTOM_TYPE_INFO( e , toString , fromString ) \ + void ToString##e( const wxxVariant& data , wxString &result ) { toString(data, result); } \ + void FromString##e( const wxString& data , wxxVariant &result ) { fromString(data, result); } \ + wxCustomTypeInfo s_typeInfo##e(typeid(e).name() , &ToString##e , &FromString##e) ; +#endif + +#define wxCOLLECTION_TYPE_INFO( element , collection ) \ + wxCollectionTypeInfo s_typeInfo##collection( typeid(element).name() , NULL , NULL , typeid(collection).name() ) ; + +// sometimes a compiler invents specializations that are nowhere called, use this macro to satisfy the refs, currently +// we don't have to play tricks, but if we will have to according to the compiler, we will use that macro for that + +#define wxILLEGAL_TYPE_SPECIALIZATION( a ) + +// ---------------------------------------------------------------------------- +// wxxVariant as typesafe data holder +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxxVariantData +{ +public: + virtual ~wxxVariantData() {} + + // return a heap allocated duplicate + virtual wxxVariantData* Clone() const = 0 ; + + // returns the type info of the contentc + virtual const wxTypeInfo* GetTypeInfo() const = 0 ; +} ; + +template class wxxVariantDataT : public wxxVariantData +{ +public: + wxxVariantDataT(const T& d) : m_data(d) {} + virtual ~wxxVariantDataT() {} + + // get a ref to the stored data + T & Get() { return m_data; } + + // get a const ref to the stored data + const T & Get() const { return m_data; } + + // set the data + void Set(const T& d) { m_data = d; } + + // return a heap allocated duplicate + virtual wxxVariantData* Clone() const { return new wxxVariantDataT( Get() ) ; } + + // returns the type info of the contentc + virtual const wxTypeInfo* GetTypeInfo() const { return wxGetTypeInfo( (T*) NULL ) ; } + +private: + T m_data; +}; + +class WXDLLIMPEXP_BASE wxxVariant +{ +public : + wxxVariant() { m_data = NULL ; } + wxxVariant( wxxVariantData* data , const wxString& name = wxEmptyString ) : m_data(data) , m_name(name) {} + wxxVariant( const wxxVariant &d ) { if ( d.m_data ) m_data = d.m_data->Clone() ; else m_data = NULL ; m_name = d.m_name ; } + + template wxxVariant( const T& data , const wxString& name = wxEmptyString ) : + m_data(new wxxVariantDataT(data) ), m_name(name) {} + + ~wxxVariant() { delete m_data ; } + + // get a ref to the stored data + template T& Get(wxTEMPLATED_MEMBER_FIX(T)) + { + wxxVariantDataT *dataptr = dynamic_cast*> (m_data) ; + wxASSERT_MSG( dataptr , wxString::Format(wxT("Cast to %s not possible"), typeid(T).name()) ) ; + return dataptr->Get() ; + } + + // get a ref to the stored data + template const T& Get(wxTEMPLATED_MEMBER_FIX(T)) const + { + const wxxVariantDataT *dataptr = dynamic_cast*> (m_data) ; + wxASSERT_MSG( dataptr , wxString::Format(wxT("Cast to %s not possible"), typeid(T).name()) ) ; + return dataptr->Get() ; + } + + bool IsEmpty() const { return m_data == NULL ; } + + template bool HasData(wxTEMPLATED_MEMBER_FIX(T)) const + { + const wxxVariantDataT *dataptr = dynamic_cast*> (m_data) ; + return dataptr != NULL ; + } + + // stores the data + template void Set(const T& data) const + { + delete m_data ; + m_data = new wxxVariantDataT(data) ; + } + + wxxVariant& operator=(const wxxVariant &d) + { + delete m_data; + m_data = d.m_data ? d.m_data->Clone() : NULL ; + m_name = d.m_name ; + return *this ; + } + + // gets the stored data casted to a wxObject* , returning NULL if cast is not possible + wxObject* GetAsObject() ; + + // get the typeinfo of the stored object + const wxTypeInfo* GetTypeInfo() const { return m_data->GetTypeInfo() ; } + + // returns this value as string + wxString GetAsString() const + { + wxString s ; + GetTypeInfo()->ConvertToString( *this , s ) ; + return s ; + } + const wxString& GetName() const { return m_name ; } +private : + wxxVariantData* m_data ; + wxString m_name ; +} ; + +#include "wx/dynarray.h" + +WX_DECLARE_OBJARRAY_WITH_DECL(wxxVariant, wxxVariantArray, class WXDLLIMPEXP_BASE); + +// templated streaming, every type must have their specialization for these methods + +template +void wxStringReadValue( const wxString &s , T &data ); + +template +void wxStringWriteValue( wxString &s , const T &data); + +template +void wxToStringConverter( const wxxVariant &v, wxString &s wxTEMPLATED_FUNCTION_FIX(T)) { wxStringWriteValue( s , v.wxTEMPLATED_MEMBER_CALL(Get , T) ) ; } + +template +void wxFromStringConverter( const wxString &s, wxxVariant &v wxTEMPLATED_FUNCTION_FIX(T)) { T d ; wxStringReadValue( s , d ) ; v = wxxVariant(d) ; } + +// ---------------------------------------------------------------------------- +// Property Support +// +// wxPropertyInfo is used to inquire of the property by name. It doesn't +// provide access to the property, only information about it. If you +// want access, look at wxPropertyAccessor. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxSetter +{ +public: + wxSetter( const wxString name ) { m_name = name ; } + virtual ~wxSetter() {} + virtual void Set( wxObject *object, const wxxVariant &variantValue ) const = 0; + const wxString& GetName() const { return m_name ; } +private: + wxString m_name; +}; + +class WXDLLIMPEXP_BASE wxGetter +{ +public: + wxGetter( const wxString name ) { m_name = name ; } + virtual ~wxGetter() {} + virtual void Get( const wxObject *object , wxxVariant& result) const = 0; + const wxString& GetName() const { return m_name ; } +private: + wxString m_name; +}; + +class WXDLLIMPEXP_BASE wxCollectionGetter +{ +public : + wxCollectionGetter( const wxString name ) { m_name = name ; } + virtual ~wxCollectionGetter() {} + virtual void Get( const wxObject *object , wxxVariantArray& result) const = 0; + const wxString& GetName() const { return m_name ; } +private : + wxString m_name ; +} ; + +template void WXDLLIMPEXP_BASE wxCollectionToVariantArray( const coll_t& coll , wxxVariantArray& result ) ; + +class WXDLLIMPEXP_BASE wxAdder +{ +public : + wxAdder( const wxString name ) { m_name = name ; } + virtual ~wxAdder() {} + virtual void Add( wxObject *object, const wxxVariant &variantValue ) const= 0; + const wxString& GetName() const { return m_name ; } +private : + wxString m_name ; +} ; + + +#define wxSETTER( property, Klass, valueType, setterMethod ) \ +class wxSetter##property : public wxSetter \ +{ \ +public: \ + wxINFUNC_CLASS_TYPE_FIX(Klass) \ + wxSetter##property() : wxSetter( wxT(#setterMethod) ) {} \ + virtual ~wxSetter##property() {} \ + void Set( wxObject *object, const wxxVariant &variantValue ) const \ +{ \ + Klass *obj = dynamic_cast(object) ; \ + if ( variantValue.wxTEMPLATED_MEMBER_CALL(HasData, valueType) ) \ + obj->setterMethod(variantValue.wxTEMPLATED_MEMBER_CALL(Get , valueType)) ; \ + else \ + obj->setterMethod(*variantValue.wxTEMPLATED_MEMBER_CALL(Get , valueType*)) ; \ +} \ +} ; + +#define wxGETTER( property, Klass, valueType , gettermethod ) \ +class wxGetter##property : public wxGetter \ +{ \ +public : \ + wxINFUNC_CLASS_TYPE_FIX(Klass) \ + wxGetter##property() : wxGetter( wxT(#gettermethod) ) {} \ + virtual ~wxGetter##property() {} \ + void Get( const wxObject *object , wxxVariant &result) const \ +{ \ + const Klass *obj = dynamic_cast(object) ; \ + result = wxxVariant( obj->gettermethod() ) ; \ +} \ +} ; + +#define wxADDER( property, Klass, valueType , addermethod ) \ +class wxAdder##property : public wxAdder \ +{ \ +public: \ + wxINFUNC_CLASS_TYPE_FIX(Klass) \ + wxAdder##property() : wxAdder( wxT(#addermethod) ) {} \ + virtual ~wxAdder##property() {} \ + void Add( wxObject *object, const wxxVariant &variantValue ) const \ +{ \ + Klass *obj = dynamic_cast(object) ; \ + if ( variantValue.wxTEMPLATED_MEMBER_CALL(HasData, valueType) ) \ + obj->addermethod(variantValue.wxTEMPLATED_MEMBER_CALL(Get , valueType)) ; \ + else \ + obj->addermethod(*variantValue.wxTEMPLATED_MEMBER_CALL(Get , valueType*)) ; \ +} \ +} ; + +#define wxCOLLECTION_GETTER( property, Klass, valueType , gettermethod ) \ +class wxCollectionGetter##property : public wxCollectionGetter \ +{ \ +public : \ + wxINFUNC_CLASS_TYPE_FIX(Klass) \ + wxCollectionGetter##property() : wxCollectionGetter( wxT(#gettermethod) ) {} \ + virtual ~wxCollectionGetter##property() {} \ + void Get( const wxObject *object , wxxVariantArray &result) const \ +{ \ + const Klass *obj = dynamic_cast(object) ; \ + wxCollectionToVariantArray( obj->gettermethod() , result ) ; \ +} \ +} ; + +class WXDLLIMPEXP_BASE wxPropertyAccessor +{ +public : + wxPropertyAccessor( wxSetter *setter , wxGetter *getter , wxAdder *adder , wxCollectionGetter *collectionGetter ) + { m_setter = setter ; m_getter = getter ; m_adder = adder ; m_collectionGetter = collectionGetter ;} + + virtual ~wxPropertyAccessor() {} + + // Setting a simple property (non-collection) + virtual void SetProperty(wxObject *object, const wxxVariant &value) const + { if ( m_setter ) m_setter->Set( object , value ) ; else wxLogError( _("SetProperty called w/o valid setter") ) ;} + + // Getting a simple property (non-collection) + virtual void GetProperty(const wxObject *object, wxxVariant &result) const + { if ( m_getter ) m_getter->Get( object , result ) ; else wxLogError( _("GetProperty called w/o valid getter") ) ;} + + // Adding an element to a collection property + virtual void AddToPropertyCollection(wxObject *object, const wxxVariant &value) const + { if ( m_adder ) m_adder->Add( object , value ) ; else wxLogError( _("AddToPropertyCollection called w/o valid adder") ) ;} + + // Getting a collection property + virtual void GetPropertyCollection( const wxObject *obj, wxxVariantArray &result) const + { if ( m_collectionGetter ) m_collectionGetter->Get( obj , result) ; else wxLogError( _("GetPropertyCollection called w/o valid collection getter") ) ;} + + virtual bool HasSetter() const { return m_setter != NULL ; } + virtual bool HasCollectionGetter() const { return m_collectionGetter != NULL ; } + virtual bool HasGetter() const { return m_getter != NULL ; } + virtual bool HasAdder() const { return m_adder != NULL ; } + + virtual const wxString& GetCollectionGetterName() const + { return m_collectionGetter->GetName() ; } + virtual const wxString& GetGetterName() const + { return m_getter->GetName() ; } + virtual const wxString& GetSetterName() const + { return m_setter->GetName() ; } + virtual const wxString& GetAdderName() const + { return m_adder->GetName() ; } + +protected : + wxSetter *m_setter ; + wxAdder *m_adder ; + wxGetter *m_getter ; + wxCollectionGetter* m_collectionGetter ; +}; + +class WXDLLIMPEXP_BASE wxGenericPropertyAccessor : public wxPropertyAccessor +{ +public : + wxGenericPropertyAccessor( const wxString &propName ) ; + virtual ~wxGenericPropertyAccessor() ; + + void RenameProperty( const wxString& WXUNUSED_UNLESS_DEBUG(oldName), + const wxString& newName ) + { + wxASSERT( oldName == m_propertyName ) ; m_propertyName = newName ; + } + virtual bool HasSetter() const { return true ; } + virtual bool HasGetter() const { return true ; } + virtual bool HasAdder() const { return false ; } + virtual bool HasCollectionGetter() const { return false ; } + + virtual const wxString& GetGetterName() const + { return m_getterName ; } + virtual const wxString& GetSetterName() const + { return m_setterName ; } + + virtual void SetProperty(wxObject *object, const wxxVariant &value) const ; + virtual void GetProperty(const wxObject *object, wxxVariant &value) const ; + + // Adding an element to a collection property + virtual void AddToPropertyCollection(wxObject *WXUNUSED(object), const wxxVariant &WXUNUSED(value)) const + { wxLogError( _("AddToPropertyCollection called on a generic accessor") ) ;} + + // Getting a collection property + virtual void GetPropertyCollection( const wxObject *WXUNUSED(obj), wxxVariantArray &WXUNUSED(result)) const + { wxLogError ( _("GetPropertyCollection called on a generic accessor") ) ;} +private : + struct wxGenericPropertyAccessorInternal ; + wxGenericPropertyAccessorInternal* m_data ; + wxString m_propertyName ; + wxString m_setterName ; + wxString m_getterName ; +} ; + +typedef long wxPropertyInfoFlags ; +enum { + // will be removed in future releases + wxPROP_DEPRECATED = 0x00000001 , + // object graph property, will be streamed with priority (after constructor properties) + wxPROP_OBJECT_GRAPH = 0x00000002 , + // this will only be streamed out and in as enum/set, the internal representation is still a long + wxPROP_ENUM_STORE_LONG = 0x00000004 , + // don't stream out this property, needed eg to avoid streaming out children that are always created by their parents + wxPROP_DONT_STREAM = 0x00000008 , +} ; + +class WXDLLIMPEXP_BASE wxPropertyInfo +{ + friend class WXDLLIMPEXP_BASE wxDynamicClassInfo ; +public : + wxPropertyInfo(wxPropertyInfo* &iter, + wxClassInfo* itsClass, + const wxString& name, + const wxString& typeName, + wxPropertyAccessor *accessor, + wxxVariant dv, + wxPropertyInfoFlags flags = 0, + const wxString& helpString = wxEmptyString, + const wxString& groupString = wxEmptyString) : + m_itsClass(itsClass), + m_name(name), + m_typeInfo(NULL), + m_typeName(typeName) , + m_collectionElementTypeInfo(NULL), + m_accessor(accessor), + m_defaultValue(dv), + m_flags(flags), + m_helpString(helpString), + m_groupString(groupString) + { + Insert(iter); + } + +#if wxUSE_UNICODE + wxPropertyInfo(wxPropertyInfo* &iter, + wxClassInfo* itsClass, + const wxString& name, + const char* typeName, + wxPropertyAccessor *accessor, + wxxVariant dv, + wxPropertyInfoFlags flags = 0, + const wxString& helpString = wxEmptyString, + const wxString& groupString = wxEmptyString) : + m_itsClass(itsClass), + m_name(name), + m_typeInfo(NULL), + m_typeName(wxString::FromAscii(typeName)) , + m_collectionElementTypeInfo(NULL), + m_accessor(accessor), + m_defaultValue(dv), + m_flags(flags), + m_helpString(helpString), + m_groupString(groupString) + { + Insert(iter); + } +#endif + wxPropertyInfo(wxPropertyInfo* &iter, + wxClassInfo* itsClass, + const wxString& name, + wxDelegateTypeInfo* type, + wxPropertyAccessor *accessor, + wxxVariant dv, + wxPropertyInfoFlags flags = 0, + const wxString& helpString = wxEmptyString, + const wxString& groupString = wxEmptyString) : + m_itsClass(itsClass), + m_name(name), + m_typeInfo(type), + m_collectionElementTypeInfo(NULL), + m_accessor(accessor), + m_defaultValue(dv), + m_flags(flags), + m_helpString(helpString), + m_groupString(groupString) + { + Insert(iter); + } + + wxPropertyInfo(wxPropertyInfo* &iter, + wxClassInfo* itsClass, const wxString& name, + const wxString& collectionTypeName, + const wxString& elementTypeName, + wxPropertyAccessor *accessor, + wxPropertyInfoFlags flags = 0, + const wxString& helpString = wxEmptyString, + const wxString& groupString = wxEmptyString) : + m_itsClass(itsClass), + m_name(name), + m_typeInfo(NULL), + m_typeName(collectionTypeName) , + m_collectionElementTypeInfo(NULL), + m_collectionElementTypeName(elementTypeName), + m_accessor(accessor) , + m_flags(flags), + m_helpString(helpString), + m_groupString(groupString) + { + Insert(iter); + } + +#if wxUSE_UNICODE + wxPropertyInfo(wxPropertyInfo* &iter, + wxClassInfo* itsClass, const wxString& name, + const char* collectionTypeName, + const char* elementTypeName, + wxPropertyAccessor *accessor, + wxPropertyInfoFlags flags = 0, + const wxString& helpString = wxEmptyString, + const wxString& groupString = wxEmptyString) : + m_itsClass(itsClass), + m_name(name), + m_typeInfo(NULL), + m_typeName(wxString::FromAscii(collectionTypeName)) , + m_collectionElementTypeInfo(NULL), + m_collectionElementTypeName(wxString::FromAscii(elementTypeName)), + m_accessor(accessor) , + m_flags(flags), + m_helpString(helpString), + m_groupString(groupString) + { + Insert(iter); + } +#endif + ~wxPropertyInfo() ; + + // return the class this property is declared in + const wxClassInfo* GetDeclaringClass() const { return m_itsClass ; } + + // return the name of this property + const wxString& GetName() const { return m_name ; } + + // returns the flags of this property + wxPropertyInfoFlags GetFlags() const { return m_flags ;} + + // returns the short help string of this property + const wxString& GetHelpString() const { return m_helpString ; } + + // returns the group string of this property + const wxString& GetGroupString() const { return m_groupString ; } + + // return the element type info of this property (for collections, otherwise NULL) + const wxTypeInfo * GetCollectionElementTypeInfo() const + { + if ( m_collectionElementTypeInfo == NULL ) + m_collectionElementTypeInfo = wxTypeInfo::FindType(m_collectionElementTypeName) ; + return m_collectionElementTypeInfo ; + } + + // return the type info of this property + const wxTypeInfo * GetTypeInfo() const + { + if ( m_typeInfo == NULL ) + m_typeInfo = wxTypeInfo::FindType(m_typeName) ; + return m_typeInfo ; + } + + // return the accessor for this property + wxPropertyAccessor* GetAccessor() const { return m_accessor ; } + + // returns NULL if this is the last property of this class + wxPropertyInfo* GetNext() const { return m_next ; } + + // returns the default value of this property, its kind may be wxT_VOID if it is not valid + wxxVariant GetDefaultValue() const { return m_defaultValue ; } +private : + void Insert(wxPropertyInfo* &iter) + { + m_next = NULL ; + if ( iter == NULL ) + iter = this ; + else + { + wxPropertyInfo* i = iter ; + while( i->m_next ) + i = i->m_next ; + + i->m_next = this ; + } + } + + wxClassInfo* m_itsClass ; + wxString m_name ; + mutable wxTypeInfo* m_typeInfo ; + wxString m_typeName ; + mutable wxTypeInfo* m_collectionElementTypeInfo ; + wxString m_collectionElementTypeName ; + wxPropertyAccessor* m_accessor ; + wxxVariant m_defaultValue; + wxPropertyInfoFlags m_flags ; + wxString m_helpString ; + wxString m_groupString ; + // string representation of the default value + // to be assigned by the designer to the property + // when the component is dropped on the container. + wxPropertyInfo* m_next ; +}; + +WX_DECLARE_STRING_HASH_MAP_WITH_DECL( wxPropertyInfo* , wxPropertyInfoMap , class WXDLLIMPEXP_BASE ) ; + +#define wxBEGIN_PROPERTIES_TABLE(theClass) \ + wxPropertyInfo *theClass::GetPropertiesStatic() \ +{ \ + typedef theClass class_t; \ + static wxPropertyInfo* first = NULL ; + +#define wxEND_PROPERTIES_TABLE() \ + return first ; } + +#define wxHIDE_PROPERTY( pname ) \ + static wxPropertyInfo _propertyInfo##pname( first , class_t::GetClassInfoStatic() , wxT(#pname) , typeid(void).name() ,NULL , wxxVariant() , wxPROP_DONT_STREAM , wxEmptyString , wxEmptyString ) ; + +#define wxPROPERTY( pname , type , setter , getter , defaultValue , flags , help , group) \ + wxSETTER( pname , class_t , type , setter ) \ + static wxSetter##pname _setter##pname ; \ + wxGETTER( pname , class_t , type , getter ) \ + static wxGetter##pname _getter##pname ; \ + static wxPropertyAccessor _accessor##pname( &_setter##pname , &_getter##pname , NULL , NULL ) ; \ + static wxPropertyInfo _propertyInfo##pname( first , class_t::GetClassInfoStatic() , wxT(#pname) , typeid(type).name() ,&_accessor##pname , wxxVariant(defaultValue) , flags , group , help ) ; + +#define wxPROPERTY_FLAGS( pname , flags , type , setter , getter ,defaultValue , pflags , help , group) \ + wxSETTER( pname , class_t , type , setter ) \ + static wxSetter##pname _setter##pname ; \ + wxGETTER( pname , class_t , type , getter ) \ + static wxGetter##pname _getter##pname ; \ + static wxPropertyAccessor _accessor##pname( &_setter##pname , &_getter##pname , NULL , NULL ) ; \ + static wxPropertyInfo _propertyInfo##pname( first , class_t::GetClassInfoStatic() , wxT(#pname) , typeid(flags).name() ,&_accessor##pname , wxxVariant(defaultValue), wxPROP_ENUM_STORE_LONG | pflags , help , group ) ; + +#define wxREADONLY_PROPERTY( pname , type , getter ,defaultValue , flags , help , group) \ + wxGETTER( pname , class_t , type , getter ) \ + static wxGetter##pname _getter##pname ; \ + static wxPropertyAccessor _accessor##pname( NULL , &_getter##pname , NULL , NULL ) ; \ + static wxPropertyInfo _propertyInfo##pname( first , class_t::GetClassInfoStatic() , wxT(#pname) , typeid(type).name() ,&_accessor##pname , wxxVariant(defaultValue), flags , help , group ) ; + +#define wxREADONLY_PROPERTY_FLAGS( pname , flags , type , getter ,defaultValue , pflags , help , group) \ + wxGETTER( pname , class_t , type , getter ) \ + static wxGetter##pname _getter##pname ; \ + static wxPropertyAccessor _accessor##pname( NULL , &_getter##pname , NULL , NULL ) ; \ + static wxPropertyInfo _propertyInfo##pname( first , class_t::GetClassInfoStatic() , wxT(#pname) , typeid(flags).name() ,&_accessor##pname , wxxVariant(defaultValue), wxPROP_ENUM_STORE_LONG | pflags , help , group ) ; + +#define wxPROPERTY_COLLECTION( pname , colltype , addelemtype , adder , getter , flags , help , group ) \ + wxADDER( pname , class_t , addelemtype , adder ) \ + static wxAdder##pname _adder##pname ; \ + wxCOLLECTION_GETTER( pname , class_t , colltype , getter ) \ + static wxCollectionGetter##pname _collectionGetter##pname ; \ + static wxPropertyAccessor _accessor##pname( NULL , NULL ,&_adder##pname , &_collectionGetter##pname ) ; \ + static wxPropertyInfo _propertyInfo##pname( first , class_t::GetClassInfoStatic() , wxT(#pname) , typeid(colltype).name() ,typeid(addelemtype).name() ,&_accessor##pname , flags , help , group ) ; + +#define wxREADONLY_PROPERTY_COLLECTION( pname , colltype , addelemtype , getter , flags , help , group) \ + wxCOLLECTION_GETTER( pname , class_t , colltype , getter ) \ + static wxCollectionGetter##pname _collectionGetter##pname ; \ + static wxPropertyAccessor _accessor##pname( NULL , NULL , NULL , &_collectionGetter##pname ) ; \ + static wxPropertyInfo _propertyInfo##pname( first ,class_t::GetClassInfoStatic() , wxT(#pname) , typeid(colltype).name() ,typeid(addelemtype).name() ,&_accessor##pname , flags , help , group ) ; + + +#define wxEVENT_PROPERTY( name , eventType , eventClass ) \ + static wxDelegateTypeInfo _typeInfo##name( eventType , CLASSINFO( eventClass ) ) ; \ + static wxPropertyInfo _propertyInfo##name( first ,class_t::GetClassInfoStatic() , wxT(#name) , &_typeInfo##name , NULL , wxxVariant() ) ; \ + +#define wxEVENT_RANGE_PROPERTY( name , eventType , lastEventType , eventClass ) \ + static wxDelegateTypeInfo _typeInfo##name( eventType , lastEventType , CLASSINFO( eventClass ) ) ; \ + static wxPropertyInfo _propertyInfo##name( first , class_t::GetClassInfoStatic() , wxT(#name) , &_typeInfo##name , NULL , wxxVariant() ) ; \ + +// ---------------------------------------------------------------------------- +// Implementation Helper for Simple Properties +// ---------------------------------------------------------------------------- + +#define wxIMPLEMENT_PROPERTY(name, type) \ +private:\ + type m_##name; \ +public: \ + void Set##name( type const & p) { m_##name = p; } \ + type const & Get##name() const { return m_##name; } + +// ---------------------------------------------------------------------------- +// Handler Info +// +// this is describing an event sink +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxHandlerInfo +{ + friend class WXDLLIMPEXP_BASE wxDynamicClassInfo ; +public : + wxHandlerInfo(wxHandlerInfo* &iter, + wxClassInfo* itsClass, + const wxString& name, + wxObjectEventFunction address, + const wxClassInfo* eventClassInfo) : + m_eventFunction(address), + m_name(name), + m_eventClassInfo(eventClassInfo) , + m_itsClass(itsClass) + { + m_next = NULL ; + if ( iter == NULL ) + iter = this ; + else + { + wxHandlerInfo* i = iter ; + while( i->m_next ) + i = i->m_next ; + + i->m_next = this ; + } + } + + ~wxHandlerInfo() ; + + // return the name of this handler + const wxString& GetName() const { return m_name ; } + + // return the class info of the event + const wxClassInfo *GetEventClassInfo() const { return m_eventClassInfo ; } + + // get the handler function pointer + wxObjectEventFunction GetEventFunction() const { return m_eventFunction ; } + + // returns NULL if this is the last handler of this class + wxHandlerInfo* GetNext() const { return m_next ; } + + // return the class this property is declared in + const wxClassInfo* GetDeclaringClass() const { return m_itsClass ; } + +private : + wxObjectEventFunction m_eventFunction ; + wxString m_name; + const wxClassInfo* m_eventClassInfo ; + wxHandlerInfo* m_next ; + wxClassInfo* m_itsClass ; +}; + +#define wxHANDLER(name,eventClassType) \ + static wxHandlerInfo _handlerInfo##name( first , class_t::GetClassInfoStatic() , wxT(#name) , (wxObjectEventFunction) (wxEventFunction) &name , CLASSINFO( eventClassType ) ) ; + +#define wxBEGIN_HANDLERS_TABLE(theClass) \ + wxHandlerInfo *theClass::GetHandlersStatic() \ +{ \ + typedef theClass class_t; \ + static wxHandlerInfo* first = NULL ; + +#define wxEND_HANDLERS_TABLE() \ + return first ; } + +// ---------------------------------------------------------------------------- +// Constructor Bridges +// +// allow to set up constructors with params during runtime +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxConstructorBridge +{ +public : + virtual void Create(wxObject * &o, wxxVariant *args) = 0; +}; + +// a direct constructor bridge calls the operator new for this class and +// passes all params to the constructor. needed for classes that cannot be +// instantiated using alloc-create semantics +class WXDLLIMPEXP_BASE wxDirectConstructorBrigde : public wxConstructorBridge +{ +public : + virtual void Create(wxObject * &o, wxxVariant *args) = 0; +} ; + +// Creator Bridges for all Numbers of Params + +// no params + +template +struct wxConstructorBridge_0 : public wxConstructorBridge +{ + void Create(wxObject * &o, wxxVariant *) + { + Class *obj = dynamic_cast(o); + obj->Create(); + } +}; + +struct wxConstructorBridge_Dummy : public wxConstructorBridge +{ + void Create(wxObject *&, wxxVariant *) + { + } +} ; + +#define wxCONSTRUCTOR_0(klass) \ + wxConstructorBridge_0 constructor##klass ; \ + wxConstructorBridge* klass::ms_constructor = &constructor##klass ; \ + const wxChar *klass::ms_constructorProperties[] = { NULL } ; \ + const int klass::ms_constructorPropertiesCount = 0 ; + +#define wxCONSTRUCTOR_DUMMY(klass) \ + wxConstructorBridge_Dummy constructor##klass ; \ + wxConstructorBridge* klass::ms_constructor = &constructor##klass ; \ + const wxChar *klass::ms_constructorProperties[] = { NULL } ; \ + const int klass::ms_constructorPropertiesCount = 0 ; + +// 1 param + +template +struct wxConstructorBridge_1 : public wxConstructorBridge +{ + void Create(wxObject * &o, wxxVariant *args) + { + Class *obj = dynamic_cast(o); + obj->Create( + args[0].wxTEMPLATED_MEMBER_CALL(Get , T0) + ); + } +}; + +#define wxCONSTRUCTOR_1(klass,t0,v0) \ + wxConstructorBridge_1 constructor##klass ; \ + wxConstructorBridge* klass::ms_constructor = &constructor##klass ; \ + const wxChar *klass::ms_constructorProperties[] = { wxT(#v0) } ; \ + const int klass::ms_constructorPropertiesCount = 1 ; + +// 2 params + +template +struct wxConstructorBridge_2 : public wxConstructorBridge +{ + void Create(wxObject * &o, wxxVariant *args) + { + Class *obj = dynamic_cast(o); + obj->Create( + args[0].wxTEMPLATED_MEMBER_CALL(Get , T0) , + args[1].wxTEMPLATED_MEMBER_CALL(Get , T1) + ); + } +}; + +#define wxCONSTRUCTOR_2(klass,t0,v0,t1,v1) \ + wxConstructorBridge_2 constructor##klass ; \ + wxConstructorBridge* klass::ms_constructor = &constructor##klass ; \ + const wxChar *klass::ms_constructorProperties[] = { wxT(#v0) , wxT(#v1) } ; \ + const int klass::ms_constructorPropertiesCount = 2; + +// direct constructor version + +template +struct wxDirectConstructorBridge_2 : public wxDirectConstructorBrigde +{ + void Create(wxObject * &o, wxxVariant *args) + { + o = new Class( + args[0].wxTEMPLATED_MEMBER_CALL(Get , T0) , + args[1].wxTEMPLATED_MEMBER_CALL(Get , T1) + ); + } +}; + +#define wxDIRECT_CONSTRUCTOR_2(klass,t0,v0,t1,v1) \ + wxDirectConstructorBridge_2 constructor##klass ; \ + wxConstructorBridge* klass::ms_constructor = &constructor##klass ; \ + const wxChar *klass::ms_constructorProperties[] = { wxT(#v0) , wxT(#v1) } ; \ + const int klass::ms_constructorPropertiesCount = 2; + + +// 3 params + +template +struct wxConstructorBridge_3 : public wxConstructorBridge +{ + void Create(wxObject * &o, wxxVariant *args) + { + Class *obj = dynamic_cast(o); + obj->Create( + args[0].wxTEMPLATED_MEMBER_CALL(Get , T0) , + args[1].wxTEMPLATED_MEMBER_CALL(Get , T1) , + args[2].wxTEMPLATED_MEMBER_CALL(Get , T2) + ); + } +}; + +#define wxCONSTRUCTOR_3(klass,t0,v0,t1,v1,t2,v2) \ + wxConstructorBridge_3 constructor##klass ; \ + wxConstructorBridge* klass::ms_constructor = &constructor##klass ; \ + const wxChar *klass::ms_constructorProperties[] = { wxT(#v0) , wxT(#v1) , wxT(#v2) } ; \ + const int klass::ms_constructorPropertiesCount = 3 ; + +// direct constructor version + +template +struct wxDirectConstructorBridge_3 : public wxDirectConstructorBrigde +{ + void Create(wxObject * &o, wxxVariant *args) + { + o = new Class( + args[0].wxTEMPLATED_MEMBER_CALL(Get , T0) , + args[1].wxTEMPLATED_MEMBER_CALL(Get , T1) , + args[2].wxTEMPLATED_MEMBER_CALL(Get , T2) + ); + } +}; + +#define wxDIRECT_CONSTRUCTOR_3(klass,t0,v0,t1,v1,t2,v2) \ + wxDirectConstructorBridge_3 constructor##klass ; \ + wxConstructorBridge* klass::ms_constructor = &constructor##klass ; \ + const wxChar *klass::ms_constructorProperties[] = { wxT(#v0) , wxT(#v1) , wxT(#v2) } ; \ + const int klass::ms_constructorPropertiesCount = 3; + +// 4 params + +template +struct wxConstructorBridge_4 : public wxConstructorBridge +{ + void Create(wxObject * &o, wxxVariant *args) + { + Class *obj = dynamic_cast(o); + obj->Create( + args[0].wxTEMPLATED_MEMBER_CALL(Get , T0) , + args[1].wxTEMPLATED_MEMBER_CALL(Get , T1) , + args[2].wxTEMPLATED_MEMBER_CALL(Get , T2) , + args[3].wxTEMPLATED_MEMBER_CALL(Get , T3) + ); + } +}; + +#define wxCONSTRUCTOR_4(klass,t0,v0,t1,v1,t2,v2,t3,v3) \ + wxConstructorBridge_4 constructor##klass ; \ + wxConstructorBridge* klass::ms_constructor = &constructor##klass ; \ + const wxChar *klass::ms_constructorProperties[] = { wxT(#v0) , wxT(#v1) , wxT(#v2) , wxT(#v3) } ; \ + const int klass::ms_constructorPropertiesCount = 4 ; + +// 5 params + +template +struct wxConstructorBridge_5 : public wxConstructorBridge +{ + void Create(wxObject * &o, wxxVariant *args) + { + Class *obj = dynamic_cast(o); + obj->Create( + args[0].wxTEMPLATED_MEMBER_CALL(Get , T0) , + args[1].wxTEMPLATED_MEMBER_CALL(Get , T1) , + args[2].wxTEMPLATED_MEMBER_CALL(Get , T2) , + args[3].wxTEMPLATED_MEMBER_CALL(Get , T3) , + args[4].wxTEMPLATED_MEMBER_CALL(Get , T4) + ); + } +}; + +#define wxCONSTRUCTOR_5(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4) \ + wxConstructorBridge_5 constructor##klass ; \ + wxConstructorBridge* klass::ms_constructor = &constructor##klass ; \ + const wxChar *klass::ms_constructorProperties[] = { wxT(#v0) , wxT(#v1) , wxT(#v2) , wxT(#v3) , wxT(#v4) } ; \ + const int klass::ms_constructorPropertiesCount = 5; + +// 6 params + +template +struct wxConstructorBridge_6 : public wxConstructorBridge +{ + void Create(wxObject * &o, wxxVariant *args) + { + Class *obj = dynamic_cast(o); + obj->Create( + args[0].wxTEMPLATED_MEMBER_CALL(Get , T0) , + args[1].wxTEMPLATED_MEMBER_CALL(Get , T1) , + args[2].wxTEMPLATED_MEMBER_CALL(Get , T2) , + args[3].wxTEMPLATED_MEMBER_CALL(Get , T3) , + args[4].wxTEMPLATED_MEMBER_CALL(Get , T4) , + args[5].wxTEMPLATED_MEMBER_CALL(Get , T5) + ); + } +}; + +#define wxCONSTRUCTOR_6(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5) \ + wxConstructorBridge_6 constructor##klass ; \ + wxConstructorBridge* klass::ms_constructor = &constructor##klass ; \ + const wxChar *klass::ms_constructorProperties[] = { wxT(#v0) , wxT(#v1) , wxT(#v2) , wxT(#v3) , wxT(#v4) , wxT(#v5) } ; \ + const int klass::ms_constructorPropertiesCount = 6; + +// direct constructor version + +template +struct wxDirectConstructorBridge_6 : public wxDirectConstructorBrigde +{ + void Create(wxObject * &o, wxxVariant *args) + { + o = new Class( + args[0].wxTEMPLATED_MEMBER_CALL(Get , T0) , + args[1].wxTEMPLATED_MEMBER_CALL(Get , T1) , + args[2].wxTEMPLATED_MEMBER_CALL(Get , T2) , + args[3].wxTEMPLATED_MEMBER_CALL(Get , T3) , + args[4].wxTEMPLATED_MEMBER_CALL(Get , T4) , + args[5].wxTEMPLATED_MEMBER_CALL(Get , T5) + ); + } +}; + +#define wxDIRECT_CONSTRUCTOR_6(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5) \ + wxDirectConstructorBridge_6 constructor##klass ; \ + wxConstructorBridge* klass::ms_constructor = &constructor##klass ; \ + const wxChar *klass::ms_constructorProperties[] = { wxT(#v0) , wxT(#v1) , wxT(#v2) , wxT(#v3) , wxT(#v4) , wxT(#v5) } ; \ + const int klass::ms_constructorPropertiesCount = 6; + +// 7 params + +template +struct wxConstructorBridge_7 : public wxConstructorBridge +{ + void Create(wxObject * &o, wxxVariant *args) + { + Class *obj = dynamic_cast(o); + obj->Create( + args[0].wxTEMPLATED_MEMBER_CALL(Get , T0) , + args[1].wxTEMPLATED_MEMBER_CALL(Get , T1) , + args[2].wxTEMPLATED_MEMBER_CALL(Get , T2) , + args[3].wxTEMPLATED_MEMBER_CALL(Get , T3) , + args[4].wxTEMPLATED_MEMBER_CALL(Get , T4) , + args[5].wxTEMPLATED_MEMBER_CALL(Get , T5) , + args[6].wxTEMPLATED_MEMBER_CALL(Get , T6) + ); + } +}; + +#define wxCONSTRUCTOR_7(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6) \ + wxConstructorBridge_7 constructor##klass ; \ + wxConstructorBridge* klass::ms_constructor = &constructor##klass ; \ + const wxChar *klass::ms_constructorProperties[] = { wxT(#v0) , wxT(#v1) , wxT(#v2) , wxT(#v3) , wxT(#v4) , wxT(#v5) , wxT(#v6) } ; \ + const int klass::ms_constructorPropertiesCount = 7; + +// 8 params + +template +struct wxConstructorBridge_8 : public wxConstructorBridge +{ + void Create(wxObject * &o, wxxVariant *args) + { + Class *obj = dynamic_cast(o); + obj->Create( + args[0].wxTEMPLATED_MEMBER_CALL(Get , T0) , + args[1].wxTEMPLATED_MEMBER_CALL(Get , T1) , + args[2].wxTEMPLATED_MEMBER_CALL(Get , T2) , + args[3].wxTEMPLATED_MEMBER_CALL(Get , T3) , + args[4].wxTEMPLATED_MEMBER_CALL(Get , T4) , + args[5].wxTEMPLATED_MEMBER_CALL(Get , T5) , + args[6].wxTEMPLATED_MEMBER_CALL(Get , T6) , + args[7].wxTEMPLATED_MEMBER_CALL(Get , T7) + ); + } +}; + +#define wxCONSTRUCTOR_8(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7) \ + wxConstructorBridge_8 constructor##klass ; \ + wxConstructorBridge* klass::ms_constructor = &constructor##klass ; \ + const wxChar *klass::ms_constructorProperties[] = { wxT(#v0) , wxT(#v1) , wxT(#v2) , wxT(#v3) , wxT(#v4) , wxT(#v5) , wxT(#v6) , wxT(#v7) } ; \ + const int klass::ms_constructorPropertiesCount = 8; // ---------------------------------------------------------------------------- // wxClassInfo // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_BASE wxObjectFunctor -{ -public: - virtual ~wxObjectFunctor(); - - // Invoke the actual event handler: - virtual void operator()(const wxObject *) = 0; -}; - -class WXDLLIMPEXP_FWD_BASE wxPropertyInfo; -class WXDLLIMPEXP_FWD_BASE wxHandlerInfo; - typedef wxObject *(*wxObjectConstructorFn)(void); -typedef wxPropertyInfo *(*wxPropertyInfoFn)(void); -typedef wxHandlerInfo *(*wxHandlerInfoFn)(void); -typedef void (*wxVariantToObjectConverter)( const wxAny &data, wxObjectFunctor* fn ); -typedef wxObject* (*wxVariantToObjectPtrConverter) ( const wxAny& data); -typedef wxAny (*wxObjectToVariantConverter)( wxObject* ); - -WXDLLIMPEXP_BASE wxString wxAnyGetAsString( const wxAny& data); -WXDLLIMPEXP_BASE const wxObject* wxAnyGetAsObjectPtr( const wxAny& data); - -class WXDLLIMPEXP_BASE wxObjectWriter; -class WXDLLIMPEXP_BASE wxObjectWriterCallback; - -typedef bool (*wxObjectStreamingCallback) ( const wxObject *, wxObjectWriter *, \ - wxObjectWriterCallback *, const wxStringToAnyHashMap & ); +typedef wxObject* (*wxVariantToObjectConverter)( wxxVariant &data ) ; +typedef wxxVariant (*wxObjectToVariantConverter)( wxObject* ) ; +class WXDLLIMPEXP_BASE wxWriter; +class WXDLLIMPEXP_BASE wxPersister; +typedef bool (*wxObjectStreamingCallback) ( const wxObject *, wxWriter * , wxPersister * , wxxVariantArray & ) ; class WXDLLIMPEXP_BASE wxClassInfo { - friend class WXDLLIMPEXP_BASE wxPropertyInfo; - friend class /* WXDLLIMPEXP_BASE */ wxHandlerInfo; - friend wxObject *wxCreateDynamicObject(const wxString& name); - + friend class WXDLLIMPEXP_BASE wxPropertyInfo ; + friend class WXDLLIMPEXP_BASE wxHandlerInfo ; public: wxClassInfo(const wxClassInfo **_Parents, - const wxChar *_UnitName, - const wxChar *_ClassName, - int size, - wxObjectConstructorFn ctor, - wxPropertyInfoFn _Props, - wxHandlerInfoFn _Handlers, - wxObjectAllocatorAndCreator* _Constructor, - const wxChar ** _ConstructorProperties, - const int _ConstructorPropertiesCount, - wxVariantToObjectPtrConverter _PtrConverter1, - wxVariantToObjectConverter _Converter2, - wxObjectToVariantConverter _Converter3, - wxObjectStreamingCallback _streamingCallback = NULL) : + const wxChar *_UnitName, + const wxChar *_ClassName, + int size, + wxObjectConstructorFn ctor , + wxPropertyInfo *_Props , + wxHandlerInfo *_Handlers , + wxConstructorBridge* _Constructor , + const wxChar ** _ConstructorProperties , + const int _ConstructorPropertiesCount , + wxVariantToObjectConverter _PtrConverter1 , + wxVariantToObjectConverter _Converter2 , + wxObjectToVariantConverter _Converter3 , + wxObjectStreamingCallback _streamingCallback = NULL + ) : + m_className(_ClassName), m_objectSize(size), m_objectConstructor(ctor), m_next(sm_first), - m_firstPropertyFn(_Props), - m_firstHandlerFn(_Handlers), - m_firstProperty(NULL), - m_firstHandler(NULL), - m_firstInited(false), + m_firstProperty(_Props), + m_firstHandler(_Handlers), m_parents(_Parents), m_unitName(_UnitName), m_constructor(_Constructor), @@ -134,7 +1626,7 @@ public: m_streamingCallback(_streamingCallback) { sm_first = this; - Register(); + Register() ; } wxClassInfo(const wxChar *_UnitName, const wxChar *_ClassName, @@ -143,11 +1635,8 @@ public: m_objectSize(0), m_objectConstructor(NULL), m_next(sm_first), - m_firstPropertyFn(NULL), - m_firstHandlerFn(NULL), m_firstProperty(NULL), m_firstHandler(NULL), - m_firstInited(true), m_parents(_Parents), m_unitName(_UnitName), m_constructor(NULL), @@ -159,211 +1648,177 @@ public: m_streamingCallback(NULL) { sm_first = this; - Register(); + Register() ; } - // ctor compatible with old RTTI system - wxClassInfo(const wxChar *_ClassName, - const wxClassInfo *_Parent1, - const wxClassInfo *_Parent2, - int size, - wxObjectConstructorFn ctor) : - m_className(_ClassName), - m_objectSize(size), - m_objectConstructor(ctor), - m_next(sm_first), - m_firstPropertyFn(NULL), - m_firstHandlerFn(NULL), - m_firstProperty(NULL), - m_firstHandler(NULL), - m_firstInited(true), - m_parents(NULL), - m_unitName(NULL), - m_constructor(NULL), - m_constructorProperties(NULL), - m_constructorPropertiesCount(0), - m_variantOfPtrToObjectConverter(NULL), - m_variantToObjectConverter(NULL), - m_objectToVariantConverter(NULL), - m_streamingCallback(NULL) - { - sm_first = this; - m_parents[0] = _Parent1; - m_parents[1] = _Parent2; - m_parents[2] = NULL; - Register(); - } + virtual ~wxClassInfo() ; - virtual ~wxClassInfo(); - - // allocates an instance of this class, this object does not have to be - // initialized or fully constructed as this call will be followed by a call to Create - virtual wxObject *AllocateObject() const - { return m_objectConstructor ? (*m_objectConstructor)() : 0; } + // allocates an instance of this class, this object does not have to be initialized or fully constructed + // as this call will be followed by a call to Create + virtual wxObject *AllocateObject() const { return m_objectConstructor ? (*m_objectConstructor)() : 0; } // 'old naming' for AllocateObject staying here for backward compatibility - wxObject *CreateObject() const { return AllocateObject(); } + wxObject *CreateObject() const { return AllocateObject() ; } // direct construction call for classes that cannot construct instances via alloc/create - wxObject *ConstructObject(int ParamCount, wxAny *Params) const; + wxObject *ConstructObject(int ParamCount, wxxVariant *Params) const + { + if ( ParamCount != m_constructorPropertiesCount ) + { + wxLogError( _("Illegal Parameter Count for ConstructObject Method") ) ; + return NULL ; + } + wxObject *object = NULL ; + m_constructor->Create( object , Params ) ; + return object ; + } - bool NeedsDirectConstruction() const; - - const wxChar *GetClassName() const - { return m_className; } + bool NeedsDirectConstruction() const { return dynamic_cast( m_constructor) != NULL ; } + + const wxChar *GetClassName() const { return m_className; } const wxChar *GetBaseClassName1() const { return m_parents[0] ? m_parents[0]->GetClassName() : NULL; } const wxChar *GetBaseClassName2() const { return (m_parents[0] && m_parents[1]) ? m_parents[1]->GetClassName() : NULL; } + const wxChar *GetIncludeName() const { return m_unitName ; } + const wxClassInfo **GetParents() const { return m_parents; } + int GetSize() const { return m_objectSize; } + bool IsDynamic() const { return (NULL != m_objectConstructor); } - const wxClassInfo *GetBaseClass1() const - { return m_parents[0]; } - const wxClassInfo *GetBaseClass2() const - { return m_parents[0] ? m_parents[1] : NULL; } - - const wxChar *GetIncludeName() const - { return m_unitName; } - const wxClassInfo **GetParents() const - { return m_parents; } - int GetSize() const - { return m_objectSize; } - bool IsDynamic() const - { return (NULL != m_objectConstructor); } - - wxObjectConstructorFn GetConstructor() const - { return m_objectConstructor; } - const wxClassInfo *GetNext() const - { return m_next; } - - // statics: - - static void CleanUp(); - static wxClassInfo *FindClass(const wxString& className); - static const wxClassInfo *GetFirst() - { return sm_first; } - + wxObjectConstructorFn GetConstructor() const { return m_objectConstructor; } + static const wxClassInfo *GetFirst() { return sm_first; } + const wxClassInfo *GetNext() const { return m_next; } + static wxClassInfo *FindClass(const wxChar *className); // Climb upwards through inheritance hierarchy. // Dual inheritance is catered for. - bool IsKindOf(const wxClassInfo *info) const; + bool IsKindOf(const wxClassInfo *info) const + { + if ( info != 0 ) + { + if ( info == this ) + return true ; - wxDECLARE_CLASS_INFO_ITERATORS(); + for ( int i = 0 ; m_parents[i] ; ++ i ) + { + if ( m_parents[i]->IsKindOf( info ) ) + return true ; + } + } + return false ; + } // if there is a callback registered with that class it will be called // before this object will be written to disk, it can veto streaming out // this object by returning false, if this class has not registered a // callback, the search will go up the inheritance tree if no callback has // been registered true will be returned by default - bool BeforeWriteObject( const wxObject *obj, wxObjectWriter *streamer, - wxObjectWriterCallback *writercallback, const wxStringToAnyHashMap &metadata) const; + bool BeforeWriteObject( const wxObject *obj, wxWriter *streamer , wxPersister *persister , wxxVariantArray &metadata) const ; // gets the streaming callback from this class or any superclass - wxObjectStreamingCallback GetStreamingCallback() const; + wxObjectStreamingCallback GetStreamingCallback() const ; + +#if WXWIN_COMPATIBILITY_2_4 + // Initializes parent pointers and hash table for fast searching. + wxDEPRECATED( static void InitializeClasses() ); + // Cleans up hash table used for fast searching. + wxDEPRECATED( static void CleanUpClasses() ); +#endif + static void CleanUp(); // returns the first property - wxPropertyInfo* GetFirstProperty() const - { EnsureInfosInited(); return m_firstProperty; } + const wxPropertyInfo* GetFirstProperty() const { return m_firstProperty ; } // returns the first handler - wxHandlerInfo* GetFirstHandler() const - { EnsureInfosInited(); return m_firstHandler; } + const wxHandlerInfo* GetFirstHandler() const { return m_firstHandler ; } // Call the Create upon an instance of the class, in the end the object is fully // initialized - virtual bool Create (wxObject *object, int ParamCount, wxAny *Params) const; + virtual void Create (wxObject *object, int ParamCount, wxxVariant *Params) const + { + if ( ParamCount != m_constructorPropertiesCount ) + { + wxLogError( _("Illegal Parameter Count for Create Method") ) ; + return ; + } + m_constructor->Create( object , Params ) ; + } // get number of parameters for constructor - virtual int GetCreateParamCount() const - { return m_constructorPropertiesCount; } + virtual int GetCreateParamCount() const { return m_constructorPropertiesCount; } // get n-th constructor parameter - virtual const wxChar* GetCreateParamName(int n) const - { return m_constructorProperties[n]; } + virtual const wxChar* GetCreateParamName(int n) const { return m_constructorProperties[n] ; } - // Runtime access to objects for simple properties (get/set) by property - // name and variant data - virtual void SetProperty (wxObject *object, const wxChar *propertyName, - const wxAny &value) const; - virtual wxAny GetProperty (wxObject *object, const wxChar *propertyName) const; + // Runtime access to objects for simple properties (get/set) by property name, and variant data + virtual void SetProperty (wxObject *object, const wxChar *propertyName, const wxxVariant &value) const ; + virtual wxxVariant GetProperty (wxObject *object, const wxChar *propertyName) const; // Runtime access to objects for collection properties by property name - virtual wxAnyList GetPropertyCollection(wxObject *object, - const wxChar *propertyName) const; - virtual void AddToPropertyCollection(wxObject *object, const wxChar *propertyName, - const wxAny& value) const; + virtual wxxVariantArray GetPropertyCollection(wxObject *object, const wxChar *propertyName) const ; + virtual void AddToPropertyCollection(wxObject *object, const wxChar *propertyName , const wxxVariant& value) const ; - // we must be able to cast variants to wxObject pointers, templates seem - // not to be suitable - void CallOnAny( const wxAny &data, wxObjectFunctor* functor ) const; + // we must be able to cast variants to wxObject pointers, templates seem not to be suitable + wxObject* VariantToInstance( wxxVariant &data ) const + { + if ( data.GetTypeInfo()->GetKind() == wxT_OBJECT ) + return m_variantToObjectConverter( data ) ; + else + return m_variantOfPtrToObjectConverter( data ) ; + } - wxObject* AnyToObjectPtr( const wxAny &data) const; - - wxAny ObjectPtrToAny( wxObject *object ) const; + wxxVariant InstanceToVariant( wxObject *object ) const { return m_objectToVariantConverter( object ) ; } // find property by name - virtual const wxPropertyInfo *FindPropertyInfo (const wxChar *PropertyName) const; + virtual const wxPropertyInfo *FindPropertyInfo (const wxChar *PropertyName) const ; // find handler by name - virtual const wxHandlerInfo *FindHandlerInfo (const wxChar *handlerName) const; + virtual const wxHandlerInfo *FindHandlerInfo (const wxChar *PropertyName) const ; // find property by name - virtual wxPropertyInfo *FindPropertyInfoInThisClass (const wxChar *PropertyName) const; + virtual wxPropertyInfo *FindPropertyInfoInThisClass (const wxChar *PropertyName) const ; // find handler by name - virtual wxHandlerInfo *FindHandlerInfoInThisClass (const wxChar *handlerName) const; + virtual wxHandlerInfo *FindHandlerInfoInThisClass (const wxChar *PropertyName) const ; - // puts all the properties of this class and its superclasses in the map, - // as long as there is not yet an entry with the same name (overriding mechanism) - void GetProperties( wxPropertyInfoMap &map ) const; - -private: + // puts all the properties of this class and its superclasses in the map, as long as there is not yet + // an entry with the same name (overriding mechanism) + void GetProperties( wxPropertyInfoMap &map ) const ; +public: const wxChar *m_className; int m_objectSize; - wxObjectConstructorFn m_objectConstructor; + wxObjectConstructorFn m_objectConstructor; // class info object live in a linked list: // pointers to its head and the next element in it static wxClassInfo *sm_first; - wxClassInfo *m_next; + wxClassInfo *m_next; + // FIXME: this should be private (currently used directly by way too + // many clients) static wxHashTable *sm_classTable; - wxPropertyInfoFn m_firstPropertyFn; - wxHandlerInfoFn m_firstHandlerFn; - - -protected: - void EnsureInfosInited() const - { - if ( !m_firstInited) - { - if ( m_firstPropertyFn != NULL) - m_firstProperty = (*m_firstPropertyFn)(); - if ( m_firstHandlerFn != NULL) - m_firstHandler = (*m_firstHandlerFn)(); - m_firstInited = true; - } - } - mutable wxPropertyInfo* m_firstProperty; - mutable wxHandlerInfo* m_firstHandler; - +protected : + wxPropertyInfo * m_firstProperty ; + wxHandlerInfo * m_firstHandler ; private: - mutable bool m_firstInited; + const wxClassInfo** m_parents ; + const wxChar* m_unitName; - const wxClassInfo** m_parents; - const wxChar* m_unitName; + wxConstructorBridge* m_constructor ; + const wxChar ** m_constructorProperties ; + const int m_constructorPropertiesCount ; + wxVariantToObjectConverter m_variantOfPtrToObjectConverter ; + wxVariantToObjectConverter m_variantToObjectConverter ; + wxObjectToVariantConverter m_objectToVariantConverter ; + wxObjectStreamingCallback m_streamingCallback ; + const wxPropertyAccessor *FindAccessor (const wxChar *propertyName) const ; - wxObjectAllocatorAndCreator* m_constructor; - const wxChar ** m_constructorProperties; - const int m_constructorPropertiesCount; - wxVariantToObjectPtrConverter m_variantOfPtrToObjectConverter; - wxVariantToObjectConverter m_variantToObjectConverter; - wxObjectToVariantConverter m_objectToVariantConverter; - wxObjectStreamingCallback m_streamingCallback; - const wxPropertyAccessor *FindAccessor (const wxChar *propertyName) const; + // InitializeClasses() helper + static wxClassInfo *GetBaseByName(const wxChar *name) ; protected: // registers the class @@ -373,98 +1828,275 @@ protected: DECLARE_NO_COPY_CLASS(wxClassInfo) }; -WXDLLIMPEXP_BASE wxObject *wxCreateDynamicObject(const wxString& name); + +WXDLLIMPEXP_BASE wxObject *wxCreateDynamicObject(const wxChar *name); // ---------------------------------------------------------------------------- -// wxDynamicClassInfo +// wxDynamicObject // ---------------------------------------------------------------------------- - +// // this object leads to having a pure runtime-instantiation class WXDLLIMPEXP_BASE wxDynamicClassInfo : public wxClassInfo { - friend class WXDLLIMPEXP_BASE wxDynamicObject; - -public: - wxDynamicClassInfo( const wxChar *_UnitName, const wxChar *_ClassName, - const wxClassInfo* superClass ); - virtual ~wxDynamicClassInfo(); + friend class WXDLLIMPEXP_BASE wxDynamicObject ; +public : + wxDynamicClassInfo( const wxChar *_UnitName, const wxChar *_ClassName , const wxClassInfo* superClass ) ; + virtual ~wxDynamicClassInfo() ; // constructs a wxDynamicObject with an instance - virtual wxObject *AllocateObject() const; + virtual wxObject *AllocateObject() const ; // Call the Create method for a class - virtual bool Create (wxObject *object, int ParamCount, wxAny *Params) const; + virtual void Create (wxObject *object, int ParamCount, wxxVariant *Params) const ; // get number of parameters for constructor - virtual int GetCreateParamCount() const; + virtual int GetCreateParamCount() const ; // get i-th constructor parameter - virtual const wxChar* GetCreateParamName(int i) const; + virtual const wxChar* GetCreateParamName(int i) const ; // Runtime access to objects by property name, and variant data - virtual void SetProperty (wxObject *object, const wxChar *PropertyName, - const wxAny &Value) const; - virtual wxAny GetProperty (wxObject *object, const wxChar *PropertyName) const; + virtual void SetProperty (wxObject *object, const wxChar *PropertyName, const wxxVariant &Value) const ; + virtual wxxVariant GetProperty (wxObject *object, const wxChar *PropertyName) const ; // adds a property to this class at runtime - void AddProperty( const wxChar *propertyName, const wxTypeInfo* typeInfo ); + void AddProperty( const wxChar *propertyName , const wxTypeInfo* typeInfo ) ; // removes an existing runtime-property - void RemoveProperty( const wxChar *propertyName ); + void RemoveProperty( const wxChar *propertyName ) ; // renames an existing runtime-property - void RenameProperty( const wxChar *oldPropertyName, const wxChar *newPropertyName ); + void RenameProperty( const wxChar *oldPropertyName , const wxChar *newPropertyName ) ; // as a handler to this class at runtime - void AddHandler( const wxChar *handlerName, wxObjectEventFunction address, - const wxClassInfo* eventClassInfo ); + void AddHandler( const wxChar *handlerName , wxObjectEventFunction address , const wxClassInfo* eventClassInfo ) ; // removes an existing runtime-handler - void RemoveHandler( const wxChar *handlerName ); + void RemoveHandler( const wxChar *handlerName ) ; // renames an existing runtime-handler - void RenameHandler( const wxChar *oldHandlerName, const wxChar *newHandlerName ); - -private: - struct wxDynamicClassInfoInternal; - wxDynamicClassInfoInternal* m_data; -}; + void RenameHandler( const wxChar *oldHandlerName , const wxChar *newHandlerName ) ; +private : + struct wxDynamicClassInfoInternal ; + wxDynamicClassInfoInternal* m_data ; +} ; // ---------------------------------------------------------------------------- -// wxDECLARE class macros +// Dynamic class macros // ---------------------------------------------------------------------------- -#define _DECLARE_DYNAMIC_CLASS(name) \ - public: \ - static wxClassInfo ms_classInfo; \ - static const wxClassInfo* ms_classParents[]; \ - static wxPropertyInfo* GetPropertiesStatic(); \ - static wxHandlerInfo* GetHandlersStatic(); \ - static wxClassInfo *GetClassInfoStatic() \ - { return &name::ms_classInfo; } \ - virtual wxClassInfo *GetClassInfo() const \ - { return &name::ms_classInfo; } +#define _DECLARE_DYNAMIC_CLASS(name) \ + public: \ + static wxClassInfo ms_classInfo; \ + static const wxClassInfo* ms_classParents[] ; \ + static wxPropertyInfo* GetPropertiesStatic() ; \ + static wxHandlerInfo* GetHandlersStatic() ; \ + static wxClassInfo *GetClassInfoStatic() \ +{ return &name::ms_classInfo; } \ + virtual wxClassInfo *GetClassInfo() const \ +{ return &name::ms_classInfo; } -#define wxDECLARE_DYNAMIC_CLASS(name) \ - static wxObjectAllocatorAndCreator* ms_constructor; \ - static const wxChar * ms_constructorProperties[]; \ - static const int ms_constructorPropertiesCount; \ +/* +#define _DECLARE_DYNAMIC_CLASS(name) \ + public: \ + static wxClassInfo ms_class##name; \ + static const wxClassInfo* ms_classParents##name[] ; \ + static wxPropertyInfo* GetPropertiesStatic() ; \ + static wxHandlerInfo* GetHandlersStatic() ; \ + static wxClassInfo *GetClassInfoStatic() \ +{ return &name::ms_class##name; } \ + virtual wxClassInfo *GetClassInfo() const \ +{ return &name::ms_class##name; } +*/ +#define DECLARE_DYNAMIC_CLASS(name) \ + static wxConstructorBridge* ms_constructor ; \ + static const wxChar * ms_constructorProperties[] ; \ + static const int ms_constructorPropertiesCount ; \ _DECLARE_DYNAMIC_CLASS(name) -#define wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(name) \ - wxDECLARE_NO_ASSIGN_CLASS(name); \ - wxDECLARE_DYNAMIC_CLASS(name) +#define DECLARE_DYNAMIC_CLASS_NO_ASSIGN(name) \ + DECLARE_NO_ASSIGN_CLASS(name) \ + DECLARE_DYNAMIC_CLASS(name) -#define wxDECLARE_DYNAMIC_CLASS_NO_COPY(name) \ - wxDECLARE_NO_COPY_CLASS(name); \ - wxDECLARE_DYNAMIC_CLASS(name) +#define DECLARE_DYNAMIC_CLASS_NO_COPY(name) \ + DECLARE_NO_COPY_CLASS(name) \ + DECLARE_DYNAMIC_CLASS(name) -#define wxDECLARE_CLASS(name) \ - wxDECLARE_DYNAMIC_CLASS(name) +#define DECLARE_ABSTRACT_CLASS(name) _DECLARE_DYNAMIC_CLASS(name) +#define DECLARE_CLASS(name) DECLARE_DYNAMIC_CLASS(name) + +// ----------------------------------- +// for concrete classes +// ----------------------------------- + +// Single inheritance with one base class + +#define _TYPEINFO_CLASSES(n , toString , fromString ) \ + wxClassTypeInfo s_typeInfo##n(wxT_OBJECT , &n::ms_classInfo , toString , fromString , typeid(n).name()) ; \ + wxClassTypeInfo s_typeInfoPtr##n(wxT_OBJECT_PTR , &n::ms_classInfo , toString , fromString , typeid(n*).name()) ; + +#define _IMPLEMENT_DYNAMIC_CLASS(name, basename, unit , callback) \ + wxObject* wxConstructorFor##name() \ +{ return new name; } \ + const wxClassInfo* name::ms_classParents[] = { &basename::ms_classInfo ,NULL } ; \ + wxObject* wxVariantOfPtrToObjectConverter##name ( wxxVariant &data ) { return data.wxTEMPLATED_MEMBER_CALL(Get , name*) ; } \ + wxxVariant wxObjectToVariantConverter##name ( wxObject *data ) { return wxxVariant( dynamic_cast (data) ) ; } \ + wxClassInfo name::ms_classInfo(name::ms_classParents , wxT(unit) , wxT(#name), \ + (int) sizeof(name), \ + (wxObjectConstructorFn) wxConstructorFor##name , \ + name::GetPropertiesStatic(),name::GetHandlersStatic(),name::ms_constructor , name::ms_constructorProperties , \ + name::ms_constructorPropertiesCount , wxVariantOfPtrToObjectConverter##name , NULL , wxObjectToVariantConverter##name , callback); + +#define _IMPLEMENT_DYNAMIC_CLASS_WITH_COPY(name, basename, unit, callback ) \ + wxObject* wxConstructorFor##name() \ +{ return new name; } \ + const wxClassInfo* name::ms_classParents[] = { &basename::ms_classInfo ,NULL } ; \ + wxObject* wxVariantToObjectConverter##name ( wxxVariant &data ) { return &data.wxTEMPLATED_MEMBER_CALL(Get , name) ; } \ + wxObject* wxVariantOfPtrToObjectConverter##name ( wxxVariant &data ) { return data.wxTEMPLATED_MEMBER_CALL(Get , name*) ; } \ + wxxVariant wxObjectToVariantConverter##name ( wxObject *data ) { return wxxVariant( dynamic_cast (data) ) ; } \ + wxClassInfo name::ms_classInfo(name::ms_classParents , wxT(unit) , wxT(#name), \ + (int) sizeof(name), \ + (wxObjectConstructorFn) wxConstructorFor##name , \ + name::GetPropertiesStatic(),name::GetHandlersStatic(),name::ms_constructor , name::ms_constructorProperties, \ + name::ms_constructorPropertiesCount , wxVariantOfPtrToObjectConverter##name , wxVariantToObjectConverter##name , wxObjectToVariantConverter##name, callback); + +#define IMPLEMENT_DYNAMIC_CLASS_WITH_COPY( name , basename ) \ + _IMPLEMENT_DYNAMIC_CLASS_WITH_COPY( name , basename , "" , NULL ) \ + _TYPEINFO_CLASSES(name, NULL , NULL) \ + const wxPropertyInfo *name::GetPropertiesStatic() { return (wxPropertyInfo*) NULL ; } \ + const wxHandlerInfo *name::GetHandlersStatic() { return (wxHandlerInfo*) NULL ; } \ + wxCONSTRUCTOR_DUMMY( name ) + +#define IMPLEMENT_DYNAMIC_CLASS( name , basename ) \ + _IMPLEMENT_DYNAMIC_CLASS( name , basename , "" , NULL ) \ + _TYPEINFO_CLASSES(name, NULL , NULL) \ + wxPropertyInfo *name::GetPropertiesStatic() { return (wxPropertyInfo*) NULL ; } \ + wxHandlerInfo *name::GetHandlersStatic() { return (wxHandlerInfo*) NULL ; } \ + wxCONSTRUCTOR_DUMMY( name ) + +#define IMPLEMENT_DYNAMIC_CLASS_XTI( name , basename , unit ) \ + _IMPLEMENT_DYNAMIC_CLASS( name , basename , unit , NULL ) \ + _TYPEINFO_CLASSES(name, NULL , NULL) + +#define IMPLEMENT_DYNAMIC_CLASS_XTI_CALLBACK( name , basename , unit , callback ) \ + _IMPLEMENT_DYNAMIC_CLASS( name , basename , unit , &callback ) \ + _TYPEINFO_CLASSES(name, NULL , NULL) + +#define IMPLEMENT_DYNAMIC_CLASS_WITH_COPY_XTI( name , basename , unit ) \ + _IMPLEMENT_DYNAMIC_CLASS_WITH_COPY( name , basename , unit , NULL ) \ + _TYPEINFO_CLASSES(name, NULL , NULL) + +#define IMPLEMENT_DYNAMIC_CLASS_WITH_COPY_AND_STREAMERS_XTI( name , basename , unit , toString , fromString ) \ + _IMPLEMENT_DYNAMIC_CLASS_WITH_COPY( name , basename , unit , NULL ) \ + _TYPEINFO_CLASSES(name, toString , fromString) + +// this is for classes that do not derive from wxobject, there are no creators for these + +#define IMPLEMENT_DYNAMIC_CLASS_NO_WXOBJECT_NO_BASE_XTI( name , unit ) \ + const wxClassInfo* name::ms_classParents[] = { NULL } ; \ + wxClassInfo name::ms_classInfo(name::ms_classParents , wxEmptyString , wxT(#name), \ + (int) sizeof(name), \ + (wxObjectConstructorFn) 0 , \ + name::GetPropertiesStatic(),name::GetHandlersStatic(),0 , 0 , \ + 0 , 0 , 0 ); \ + _TYPEINFO_CLASSES(name, NULL , NULL) + +// this is for subclasses that still do not derive from wxobject + +#define IMPLEMENT_DYNAMIC_CLASS_NO_WXOBJECT_XTI( name , basename, unit ) \ + const wxClassInfo* name::ms_classParents[] = { &basename::ms_classInfo ,NULL } ; \ + wxClassInfo name::ms_classInfo(name::ms_classParents , wxEmptyString , wxT(#name), \ + (int) sizeof(name), \ + (wxObjectConstructorFn) 0 , \ + name::GetPropertiesStatic(),name::GetHandlersStatic(),0 , 0 , \ + 0 , 0 , 0 ); \ + _TYPEINFO_CLASSES(name, NULL , NULL) + + +// Multiple inheritance with two base classes + +#define _IMPLEMENT_DYNAMIC_CLASS2(name, basename, basename2, unit) \ + wxObject* wxConstructorFor##name() \ +{ return new name; } \ + const wxClassInfo* name::ms_classParents[] = { &basename::ms_classInfo ,&basename2::ms_classInfo , NULL } ; \ + wxObject* wxVariantToObjectConverter##name ( wxxVariant &data ) { return data.wxTEMPLATED_MEMBER_CALL(Get , name*) ; } \ + wxxVariant wxObjectToVariantConverter##name ( wxObject *data ) { return wxxVariant( dynamic_cast (data) ) ; } \ + wxClassInfo name::ms_classInfo(name::ms_classParents , wxT(unit) , wxT(#name), \ + (int) sizeof(name), \ + (wxObjectConstructorFn) wxConstructorFor##name , \ + name::GetPropertiesStatic(),name::GetHandlersStatic(),name::ms_constructor , name::ms_constructorProperties , \ + name::ms_constructorPropertiesCount , wxVariantToObjectConverter##name, wxVariantToObjectConverter##name , wxObjectToVariantConverter##name); \ + +#define IMPLEMENT_DYNAMIC_CLASS2( name , basename , basename2) \ + _IMPLEMENT_DYNAMIC_CLASS2( name , basename , basename2 , "") \ + _TYPEINFO_CLASSES(name, NULL , NULL) \ + wxPropertyInfo *name::GetPropertiesStatic() { return (wxPropertyInfo*) NULL ; } \ + wxHandlerInfo *name::GetHandlersStatic() { return (wxHandlerInfo*) NULL ; } \ + wxCONSTRUCTOR_DUMMY( name ) + +#define IMPLEMENT_DYNAMIC_CLASS2_XTI( name , basename , basename2, unit) \ + _IMPLEMENT_DYNAMIC_CLASS2( name , basename , basename2 , unit) \ + _TYPEINFO_CLASSES(name, NULL , NULL) + + +// ----------------------------------- +// for abstract classes +// ----------------------------------- + +// Single inheritance with one base class + +#define _IMPLEMENT_ABSTRACT_CLASS(name, basename) \ + const wxClassInfo* name::ms_classParents[] = { &basename::ms_classInfo ,NULL } ; \ + wxObject* wxVariantToObjectConverter##name ( wxxVariant &data ) { return data.wxTEMPLATED_MEMBER_CALL(Get , name*) ; } \ + wxObject* wxVariantOfPtrToObjectConverter##name ( wxxVariant &data ) { return data.wxTEMPLATED_MEMBER_CALL(Get , name*) ; } \ + wxxVariant wxObjectToVariantConverter##name ( wxObject *data ) { return wxxVariant( dynamic_cast (data) ) ; } \ + wxClassInfo name::ms_classInfo(name::ms_classParents , wxEmptyString , wxT(#name), \ + (int) sizeof(name), \ + (wxObjectConstructorFn) 0 , \ + name::GetPropertiesStatic(),name::GetHandlersStatic(),0 , 0 , \ + 0 , wxVariantOfPtrToObjectConverter##name ,wxVariantToObjectConverter##name , wxObjectToVariantConverter##name); \ + _TYPEINFO_CLASSES(name, NULL , NULL) + +#define IMPLEMENT_ABSTRACT_CLASS( name , basename ) \ + _IMPLEMENT_ABSTRACT_CLASS( name , basename ) \ + wxHandlerInfo *name::GetHandlersStatic() { return (wxHandlerInfo*) NULL ; } \ + wxPropertyInfo *name::GetPropertiesStatic() { return (wxPropertyInfo*) NULL ; } + +// Multiple inheritance with two base classes + +#define IMPLEMENT_ABSTRACT_CLASS2(name, basename1, basename2) \ + wxClassInfo name::ms_classInfo(wxT(#name), wxT(#basename1), \ + wxT(#basename2), (int) sizeof(name), \ + (wxObjectConstructorFn) 0); + +#define IMPLEMENT_CLASS IMPLEMENT_ABSTRACT_CLASS +#define IMPLEMENT_CLASS2 IMPLEMENT_ABSTRACT_CLASS2 + +#define wxBEGIN_EVENT_TABLE( a , b ) BEGIN_EVENT_TABLE( a , b ) +#define wxEND_EVENT_TABLE() END_EVENT_TABLE() + +// -------------------------------------------------------------------------- +// Collection Support +// -------------------------------------------------------------------------- + +template void wxListCollectionToVariantArray( const collection_t& coll , wxxVariantArray &value ) +{ + iter current = coll.GetFirst() ; + while (current) + { + value.Add( new wxxVariant(current->GetData()) ) ; + current = current->GetNext(); + } +} + +template void wxArrayCollectionToVariantArray( const collection_t& coll , wxxVariantArray &value ) +{ + for( size_t i = 0 ; i < coll.GetCount() ; i++ ) + { + value.Add( new wxxVariant(coll[i]) ) ; + } +} -#define wxDECLARE_ABSTRACT_CLASS(name) _DECLARE_DYNAMIC_CLASS(name) -#define wxCLASSINFO(name) (&name::ms_classInfo) -#endif // wxUSE_EXTENDED_RTTI #endif // _WX_XTIH__ diff --git a/Source/3rd Party/wx/include/wx/xti2.h b/Source/3rd Party/wx/include/wx/xti2.h deleted file mode 100644 index 581f8b11a..000000000 --- a/Source/3rd Party/wx/include/wx/xti2.h +++ /dev/null @@ -1,294 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/wxt2.h -// Purpose: runtime metadata information (extended class info) -// Author: Stefan Csomor -// Modified by: Francesco Montorsi -// Created: 27/07/03 -// RCS-ID: $Id$ -// Copyright: (c) 1997 Julian Smart -// (c) 2003 Stefan Csomor -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XTI2H__ -#define _WX_XTI2H__ - -// ---------------------------------------------------------------------------- -// second part of xti headers, is included from object.h -// ---------------------------------------------------------------------------- - -#if wxUSE_EXTENDED_RTTI - -// ---------------------------------------------------------------------------- -// wxDynamicObject class, its instances connect to a 'super class instance' -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxDynamicObject : public wxObject -{ - friend class WXDLLIMPEXP_FWD_BASE wxDynamicClassInfo ; -public: - // instantiates this object with an instance of its superclass - wxDynamicObject(wxObject* superClassInstance, const wxDynamicClassInfo *info) ; - virtual ~wxDynamicObject(); - - void SetProperty (const wxChar *propertyName, const wxAny &value); - wxAny GetProperty (const wxChar *propertyName) const ; - - // get the runtime identity of this object - wxClassInfo *GetClassInfo() const - { -#ifdef _MSC_VER - return (wxClassInfo*) m_classInfo; -#else - wxDynamicClassInfo *nonconst = const_cast(m_classInfo); - return static_cast(nonconst); -#endif - } - - wxObject* GetSuperClassInstance() const - { - return m_superClassInstance ; - } -private : - // removes an existing runtime-property - void RemoveProperty( const wxChar *propertyName ) ; - - // renames an existing runtime-property - void RenameProperty( const wxChar *oldPropertyName , const wxChar *newPropertyName ) ; - - wxObject *m_superClassInstance ; - const wxDynamicClassInfo *m_classInfo; - struct wxDynamicObjectInternal; - wxDynamicObjectInternal *m_data; -}; - -// ---------------------------------------------------------------------------- -// String conversion templates supporting older compilers -// ---------------------------------------------------------------------------- - -#if wxUSE_FUNC_TEMPLATE_POINTER -# define wxTO_STRING(type) wxToStringConverter -# define wxTO_STRING_IMP(type) -# define wxFROM_STRING(type) wxFromStringConverter -# define wxFROM_STRING_IMP(type) -#else -# define wxTO_STRING(type) ToString##type -# define wxTO_STRING_IMP(type) \ - inline void ToString##type( const wxAny& data, wxString &result ) \ -{ wxToStringConverter(data, result); } - -# define wxFROM_STRING(type) FromString##type -# define wxFROM_STRING_IMP(type) \ - inline void FromString##type( const wxString& data, wxAny &result ) \ -{ wxFromStringConverter(data, result); } -#endif - -#include "wx/xtiprop.h" -#include "wx/xtictor.h" - -// ---------------------------------------------------------------------------- -// wxIMPLEMENT class macros for concrete classes -// ---------------------------------------------------------------------------- - -// Single inheritance with one base class - -#define _DEFAULT_CONSTRUCTOR(name) \ -wxObject* wxConstructorFor##name() \ -{ return new name; } - -#define _DEFAULT_CONVERTERS(name) \ -wxObject* wxVariantOfPtrToObjectConverter##name ( const wxAny &data ) \ -{ return data.As( (name**)NULL ); } \ - wxAny wxObjectToVariantConverter##name ( wxObject *data ) \ -{ return wxAny( wx_dynamic_cast(name*, data) ); } - -#define _TYPEINFO_CLASSES(n, toString, fromString ) \ - wxClassTypeInfo s_typeInfo##n(wxT_OBJECT, &n::ms_classInfo, \ - toString, fromString, typeid(n).name()); \ - wxClassTypeInfo s_typeInfoPtr##n(wxT_OBJECT_PTR, &n::ms_classInfo, \ - toString, fromString, typeid(n*).name()); - -#define _IMPLEMENT_DYNAMIC_CLASS(name, basename, unit, callback) \ - _DEFAULT_CONSTRUCTOR(name) \ - _DEFAULT_CONVERTERS(name) \ - \ - const wxClassInfo* name::ms_classParents[] = \ -{ &basename::ms_classInfo, NULL }; \ - wxClassInfo name::ms_classInfo(name::ms_classParents, wxT(unit), \ - wxT(#name), (int) sizeof(name), (wxObjectConstructorFn) wxConstructorFor##name, \ - name::GetPropertiesStatic, name::GetHandlersStatic, name::ms_constructor, \ - name::ms_constructorProperties, name::ms_constructorPropertiesCount, \ - wxVariantOfPtrToObjectConverter##name, NULL, wxObjectToVariantConverter##name, \ - callback); - -#define _IMPLEMENT_DYNAMIC_CLASS_WITH_COPY(name, basename, unit, callback ) \ - _DEFAULT_CONSTRUCTOR(name) \ - _DEFAULT_CONVERTERS(name) \ - void wxVariantToObjectConverter##name ( const wxAny &data, wxObjectFunctor* fn ) \ - { name o = wxANY_AS(data, name); (*fn)( &o ); } \ - \ - const wxClassInfo* name::ms_classParents[] = { &basename::ms_classInfo,NULL }; \ - wxClassInfo name::ms_classInfo(name::ms_classParents, wxT(unit), \ - wxT(#name), (int) sizeof(name), (wxObjectConstructorFn) wxConstructorFor##name, \ - name::GetPropertiesStatic,name::GetHandlersStatic,name::ms_constructor, \ - name::ms_constructorProperties, name::ms_constructorPropertiesCount, \ - wxVariantOfPtrToObjectConverter##name, wxVariantToObjectConverter##name, \ - wxObjectToVariantConverter##name, callback); - -#define wxIMPLEMENT_DYNAMIC_CLASS_WITH_COPY( name, basename ) \ - _IMPLEMENT_DYNAMIC_CLASS_WITH_COPY( name, basename, "", NULL ) \ - _TYPEINFO_CLASSES(name, NULL, NULL) \ - const wxPropertyInfo *name::GetPropertiesStatic() \ -{ return (wxPropertyInfo*) NULL; } \ - const wxHandlerInfo *name::GetHandlersStatic() \ -{ return (wxHandlerInfo*) NULL; } \ - wxCONSTRUCTOR_DUMMY( name ) - -#define wxIMPLEMENT_DYNAMIC_CLASS( name, basename ) \ - _IMPLEMENT_DYNAMIC_CLASS( name, basename, "", NULL ) \ - _TYPEINFO_CLASSES(name, NULL, NULL) \ - wxPropertyInfo *name::GetPropertiesStatic() \ -{ return (wxPropertyInfo*) NULL; } \ - wxHandlerInfo *name::GetHandlersStatic() \ -{ return (wxHandlerInfo*) NULL; } \ - wxCONSTRUCTOR_DUMMY( name ) - -#define wxIMPLEMENT_DYNAMIC_CLASS_XTI( name, basename, unit ) \ - _IMPLEMENT_DYNAMIC_CLASS( name, basename, unit, NULL ) \ - _TYPEINFO_CLASSES(name, NULL, NULL) - -#define wxIMPLEMENT_DYNAMIC_CLASS_XTI_CALLBACK( name, basename, unit, callback )\ - _IMPLEMENT_DYNAMIC_CLASS( name, basename, unit, &callback ) \ - _TYPEINFO_CLASSES(name, NULL, NULL) - -#define wxIMPLEMENT_DYNAMIC_CLASS_WITH_COPY_XTI( name, basename, unit ) \ - _IMPLEMENT_DYNAMIC_CLASS_WITH_COPY( name, basename, unit, NULL ) \ - _TYPEINFO_CLASSES(name, NULL, NULL) - -#define wxIMPLEMENT_DYNAMIC_CLASS_WITH_COPY_AND_STREAMERS_XTI( name, basename, \ - unit, toString, \ - fromString ) \ - _IMPLEMENT_DYNAMIC_CLASS_WITH_COPY( name, basename, unit, NULL ) \ - _TYPEINFO_CLASSES(name, toString, fromString) - -// this is for classes that do not derive from wxObject, there are no creators for these - -#define wxIMPLEMENT_DYNAMIC_CLASS_NO_WXOBJECT_NO_BASE_XTI( name, unit ) \ - const wxClassInfo* name::ms_classParents[] = { NULL }; \ - wxClassInfo name::ms_classInfo(name::ms_classParents, wxEmptyString, \ - wxT(#name), (int) sizeof(name), (wxObjectConstructorFn) 0, \ - name::GetPropertiesStatic,name::GetHandlersStatic, 0, 0, \ - 0, 0, 0 ); \ - _TYPEINFO_CLASSES(name, NULL, NULL) - -// this is for subclasses that still do not derive from wxObject - -#define wxIMPLEMENT_DYNAMIC_CLASS_NO_WXOBJECT_XTI( name, basename, unit ) \ - const wxClassInfo* name::ms_classParents[] = { &basename::ms_classInfo, NULL }; \ - wxClassInfo name::ms_classInfo(name::ms_classParents, wxEmptyString, \ - wxT(#name), (int) sizeof(name), (wxObjectConstructorFn) 0, \ - name::GetPropertiesStatic,name::GetHandlersStatic, 0, 0, \ - 0, 0, 0 ); \ - _TYPEINFO_CLASSES(name, NULL, NULL) - - -// Multiple inheritance with two base classes - -#define _IMPLEMENT_DYNAMIC_CLASS2(name, basename, basename2, unit, callback) \ - _DEFAULT_CONSTRUCTOR(name) \ - _DEFAULT_CONVERTERS(name) \ - \ - const wxClassInfo* name::ms_classParents[] = \ -{ &basename::ms_classInfo,&basename2::ms_classInfo, NULL }; \ - wxClassInfo name::ms_classInfo(name::ms_classParents, wxT(unit), \ - wxT(#name), (int) sizeof(name), (wxObjectConstructorFn) wxConstructorFor##name, \ - name::GetPropertiesStatic,name::GetHandlersStatic,name::ms_constructor, \ - name::ms_constructorProperties, name::ms_constructorPropertiesCount, \ - wxVariantOfPtrToObjectConverter##name, NULL, wxObjectToVariantConverter##name, \ - callback); - -#define wxIMPLEMENT_DYNAMIC_CLASS2( name, basename, basename2) \ - _IMPLEMENT_DYNAMIC_CLASS2( name, basename, basename2, "", NULL) \ - _TYPEINFO_CLASSES(name, NULL, NULL) \ - wxPropertyInfo *name::GetPropertiesStatic() { return (wxPropertyInfo*) NULL; } \ - wxHandlerInfo *name::GetHandlersStatic() { return (wxHandlerInfo*) NULL; } \ - wxCONSTRUCTOR_DUMMY( name ) - -#define wxIMPLEMENT_DYNAMIC_CLASS2_XTI( name, basename, basename2, unit) \ - _IMPLEMENT_DYNAMIC_CLASS2( name, basename, basename2, unit, NULL) \ - _TYPEINFO_CLASSES(name, NULL, NULL) - - - -// ---------------------------------------------------------------------------- -// wxIMPLEMENT class macros for abstract classes -// ---------------------------------------------------------------------------- - -// Single inheritance with one base class - -#define _IMPLEMENT_ABSTRACT_CLASS(name, basename) \ - _DEFAULT_CONVERTERS(name) \ - \ - const wxClassInfo* name::ms_classParents[] = \ -{ &basename::ms_classInfo,NULL }; \ - wxClassInfo name::ms_classInfo(name::ms_classParents, wxEmptyString, \ - wxT(#name), (int) sizeof(name), (wxObjectConstructorFn) 0, \ - name::GetPropertiesStatic,name::GetHandlersStatic, 0, 0, \ - 0, wxVariantOfPtrToObjectConverter##name,0, \ - wxObjectToVariantConverter##name); \ - _TYPEINFO_CLASSES(name, NULL, NULL) - -#define wxIMPLEMENT_ABSTRACT_CLASS( name, basename ) \ - _IMPLEMENT_ABSTRACT_CLASS( name, basename ) \ - wxHandlerInfo *name::GetHandlersStatic() { return (wxHandlerInfo*) NULL; } \ - wxPropertyInfo *name::GetPropertiesStatic() { return (wxPropertyInfo*) NULL; } - -// Multiple inheritance with two base classes - -#define wxIMPLEMENT_ABSTRACT_CLASS2(name, basename1, basename2) \ - wxClassInfo name::ms_classInfo(wxT(#name), wxT(#basename1), \ - wxT(#basename2), (int) sizeof(name), \ - (wxObjectConstructorFn) 0); - -// templated streaming, every type that can be converted to wxString -// must have their specialization for these methods - -template -void wxStringReadValue( const wxString &s, T &data ); - -template -void wxStringWriteValue( wxString &s, const T &data); - -template -void wxToStringConverter( const wxAny &v, wxString &s ) -{ wxStringWriteValue(s, wxANY_AS(v, T)); } - -template -void wxFromStringConverter( const wxString &s, wxAny &v) -{ T d; wxStringReadValue(s, d); v = wxAny(d); } - -// -------------------------------------------------------------------------- -// Collection Support -// -------------------------------------------------------------------------- - -template void wxListCollectionToAnyList( - const collection_t& coll, wxAnyList &value ) -{ - for ( iter current = coll.GetFirst(); current; - current = current->GetNext() ) - { - value.Append( new wxAny(current->GetData()) ); - } -} - -template void wxArrayCollectionToVariantArray( - const collection_t& coll, wxAnyList &value ) -{ - for( size_t i = 0; i < coll.GetCount(); i++ ) - { - value.Append( new wxAny(coll[i]) ); - } -} - -#endif - -#endif // _WX_XTIH2__ diff --git a/Source/3rd Party/wx/include/wx/zipstrm.h b/Source/3rd Party/wx/include/wx/zipstrm.h index b4c29f8eb..572b88a9f 100644 --- a/Source/3rd Party/wx/include/wx/zipstrm.h +++ b/Source/3rd Party/wx/include/wx/zipstrm.h @@ -2,7 +2,7 @@ // Name: wx/zipstrm.h // Purpose: Streams for Zip files // Author: Mike Wetherell -// RCS-ID: $Id$ +// RCS-ID: $Id: zipstrm.h 53135 2008-04-12 02:31:04Z VZ $ // Copyright: (c) Mike Wetherell // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -346,9 +346,8 @@ private: int m_level; wxFileOffset m_offsetAdjustment; wxString m_Comment; - bool m_endrecWritten; - wxDECLARE_NO_COPY_CLASS(wxZipOutputStream); + DECLARE_NO_COPY_CLASS(wxZipOutputStream) }; @@ -446,7 +445,7 @@ private: friend class wxArchiveFSHandler; #endif - wxDECLARE_NO_COPY_CLASS(wxZipInputStream); + DECLARE_NO_COPY_CLASS(wxZipInputStream) }; diff --git a/Source/3rd Party/wx/include/wx/zstream.h b/Source/3rd Party/wx/include/wx/zstream.h index 78c121e95..cb7011d1f 100644 --- a/Source/3rd Party/wx/include/wx/zstream.h +++ b/Source/3rd Party/wx/include/wx/zstream.h @@ -4,7 +4,7 @@ // Author: Guilhem Lavaux // Modified by: Mike Wetherell // Created: 11/07/98 -// RCS-ID: $Id$ +// RCS-ID: $Id: zstream.h 54688 2008-07-18 08:06:44Z MW $ // Copyright: (c) Guilhem Lavaux // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -16,10 +16,9 @@ #if wxUSE_ZLIB && wxUSE_STREAMS #include "wx/stream.h" -#include "wx/versioninfo.h" // Compression level -enum wxZlibCompressionLevels { +enum { wxZ_DEFAULT_COMPRESSION = -1, wxZ_NO_COMPRESSION = 0, wxZ_BEST_SPEED = 1, @@ -27,7 +26,10 @@ enum wxZlibCompressionLevels { }; // Flags -enum wxZLibFlags { +enum { +#if WXWIN_COMPATIBILITY_2_4 + wxZLIB_24COMPATIBLE = 4, // read v2.4.x data without error +#endif wxZLIB_NO_HEADER = 0, // raw deflate stream, no header or checksum wxZLIB_ZLIB = 1, // zlib header and checksum wxZLIB_GZIP = 2, // gzip header and checksum, requires zlib 1.2.1+ @@ -45,9 +47,6 @@ class WXDLLIMPEXP_BASE wxZlibInputStream: public wxFilterInputStream { static bool CanHandleGZip(); - bool SetDictionary(const char *data, const size_t datalen); - bool SetDictionary(const wxMemoryBuffer &buf); - protected: size_t OnSysRead(void *buffer, size_t size); wxFileOffset OnSysTell() const { return m_pos; } @@ -60,8 +59,11 @@ class WXDLLIMPEXP_BASE wxZlibInputStream: public wxFilterInputStream { unsigned char *m_z_buffer; struct z_stream_s *m_inflate; wxFileOffset m_pos; +#if WXWIN_COMPATIBILITY_2_4 + bool m_24compatibilty; +#endif - wxDECLARE_NO_COPY_CLASS(wxZlibInputStream); + DECLARE_NO_COPY_CLASS(wxZlibInputStream) }; class WXDLLIMPEXP_BASE wxZlibOutputStream: public wxFilterOutputStream { @@ -76,9 +78,6 @@ class WXDLLIMPEXP_BASE wxZlibOutputStream: public wxFilterOutputStream { static bool CanHandleGZip(); - bool SetDictionary(const char *data, const size_t datalen); - bool SetDictionary(const wxMemoryBuffer &buf); - protected: size_t OnSysWrite(const void *buffer, size_t size); wxFileOffset OnSysTell() const { return m_pos; } @@ -94,7 +93,7 @@ class WXDLLIMPEXP_BASE wxZlibOutputStream: public wxFilterOutputStream { struct z_stream_s *m_deflate; wxFileOffset m_pos; - wxDECLARE_NO_COPY_CLASS(wxZlibOutputStream); + DECLARE_NO_COPY_CLASS(wxZlibOutputStream) }; class WXDLLIMPEXP_BASE wxZlibClassFactory: public wxFilterClassFactory @@ -126,11 +125,11 @@ public: wxFilterInputStream *NewStream(wxInputStream& stream) const { return new wxZlibInputStream(stream); } wxFilterOutputStream *NewStream(wxOutputStream& stream) const - { return new wxZlibOutputStream(stream, -1); } + { return new wxZlibOutputStream(stream, -1, wxZLIB_GZIP); } wxFilterInputStream *NewStream(wxInputStream *stream) const { return new wxZlibInputStream(stream); } wxFilterOutputStream *NewStream(wxOutputStream *stream) const - { return new wxZlibOutputStream(stream, -1); } + { return new wxZlibOutputStream(stream, -1, wxZLIB_GZIP); } const wxChar * const *GetProtocols(wxStreamProtocolType type = wxSTREAM_PROTOCOL) const; @@ -139,8 +138,6 @@ private: DECLARE_DYNAMIC_CLASS(wxGzipClassFactory) }; -WXDLLIMPEXP_BASE wxVersionInfo wxGetZlibVersionInfo(); - #endif // wxUSE_ZLIB && wxUSE_STREAMS diff --git a/Source/3rd Party/wx/lib/vc_lib/msw/setup.h b/Source/3rd Party/wx/lib/vc_lib/msw/setup.h deleted file mode 100644 index acb2276b9..000000000 --- a/Source/3rd Party/wx/lib/vc_lib/msw/setup.h +++ /dev/null @@ -1,1649 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/setup.h -// Purpose: Configuration for the library -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_SETUP_H_ -#define _WX_SETUP_H_ - -/* --- start common options --- */ -// ---------------------------------------------------------------------------- -// global settings -// ---------------------------------------------------------------------------- - -// define this to 0 when building wxBase library - this can also be done from -// makefile/project file overriding the value here -#ifndef wxUSE_GUI - #define wxUSE_GUI 1 -#endif // wxUSE_GUI - -// ---------------------------------------------------------------------------- -// compatibility settings -// ---------------------------------------------------------------------------- - -// This setting determines the compatibility with 2.6 API: set it to 0 to -// flag all cases of using deprecated functions. -// -// Default is 1 but please try building your code with 0 as the default will -// change to 0 in the next version and the deprecated functions will disappear -// in the version after it completely. -// -// Recommended setting: 0 (please update your code) -#define WXWIN_COMPATIBILITY_2_6 0 - -// This setting determines the compatibility with 2.8 API: set it to 0 to -// flag all cases of using deprecated functions. -// -// Default is 1 but please try building your code with 0 as the default will -// change to 0 in the next version and the deprecated functions will disappear -// in the version after it completely. -// -// Recommended setting: 0 (please update your code) -#define WXWIN_COMPATIBILITY_2_8 1 - -// MSW-only: Set to 0 for accurate dialog units, else 1 for old behaviour when -// default system font is used for wxWindow::GetCharWidth/Height() instead of -// the current font. -// -// Default is 0 -// -// Recommended setting: 0 -#define wxDIALOG_UNIT_COMPATIBILITY 0 - -// ---------------------------------------------------------------------------- -// debugging settings -// ---------------------------------------------------------------------------- - -// wxDEBUG_LEVEL will be defined as 1 in wx/debug.h so normally there is no -// need to define it here. You may do it for two reasons: either completely -// disable/compile out the asserts in release version (then do it inside #ifdef -// NDEBUG) or, on the contrary, enable more asserts, including the usually -// disabled ones, in the debug build (then do it inside #ifndef NDEBUG) -// -// #ifdef NDEBUG -// #define wxDEBUG_LEVEL 0 -// #else -// #define wxDEBUG_LEVEL 2 -// #endif - -// wxHandleFatalExceptions() may be used to catch the program faults at run -// time and, instead of terminating the program with a usual GPF message box, -// call the user-defined wxApp::OnFatalException() function. If you set -// wxUSE_ON_FATAL_EXCEPTION to 0, wxHandleFatalExceptions() will not work. -// -// This setting is for Win32 only and can only be enabled if your compiler -// supports Win32 structured exception handling (currently only VC++ does) -// -// Default is 1 -// -// Recommended setting: 1 if your compiler supports it. -#define wxUSE_ON_FATAL_EXCEPTION 1 - -// Set this to 1 to be able to generate a human-readable (unlike -// machine-readable minidump created by wxCrashReport::Generate()) stack back -// trace when your program crashes using wxStackWalker -// -// Default is 1 if supported by the compiler. -// -// Recommended setting: 1, set to 0 if your programs never crash -#define wxUSE_STACKWALKER 1 - -// Set this to 1 to compile in wxDebugReport class which allows you to create -// and optionally upload to your web site a debug report consisting of back -// trace of the crash (if wxUSE_STACKWALKER == 1) and other information. -// -// Default is 1 if supported by the compiler. -// -// Recommended setting: 1, it is compiled into a separate library so there -// is no overhead if you don't use it -#define wxUSE_DEBUGREPORT 1 - -// Generic comment about debugging settings: they are very useful if you don't -// use any other memory leak detection tools such as Purify/BoundsChecker, but -// are probably redundant otherwise. Also, Visual C++ CRT has the same features -// as wxWidgets memory debugging subsystem built in since version 5.0 and you -// may prefer to use it instead of built in memory debugging code because it is -// faster and more fool proof. -// -// Using VC++ CRT memory debugging is enabled by default in debug build (_DEBUG -// is defined) if wxUSE_GLOBAL_MEMORY_OPERATORS is *not* enabled (i.e. is 0) -// and if __NO_VC_CRTDBG__ is not defined. - -// The rest of the options in this section are obsolete and not supported, -// enable them at your own risk. - -// If 1, enables wxDebugContext, for writing error messages to file, etc. If -// __WXDEBUG__ is not defined, will still use the normal memory operators. -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_DEBUG_CONTEXT 0 - -// If 1, enables debugging versions of wxObject::new and wxObject::delete *IF* -// __WXDEBUG__ is also defined. -// -// WARNING: this code may not work with all architectures, especially if -// alignment is an issue. This switch is currently ignored for mingw / cygwin -// -// Default is 0 -// -// Recommended setting: 1 if you are not using a memory debugging tool, else 0 -#define wxUSE_MEMORY_TRACING 0 - -// In debug mode, cause new and delete to be redefined globally. -// If this causes problems (e.g. link errors which is a common problem -// especially if you use another library which also redefines the global new -// and delete), set this to 0. -// This switch is currently ignored for mingw / cygwin -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_GLOBAL_MEMORY_OPERATORS 0 - -// In debug mode, causes new to be defined to be WXDEBUG_NEW (see object.h). If -// this causes problems (e.g. link errors), set this to 0. You may need to set -// this to 0 if using templates (at least for VC++). This switch is currently -// ignored for MinGW/Cygwin. -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_DEBUG_NEW_ALWAYS 0 - - -// ---------------------------------------------------------------------------- -// Unicode support -// ---------------------------------------------------------------------------- - -// These settings are obsolete: the library is always built in Unicode mode -// now, only set wxUSE_UNICODE to 0 to compile legacy code in ANSI mode if -// absolutely necessary -- updating it is strongly recommended as the ANSI mode -// will disappear completely in future wxWidgets releases. -#ifndef wxUSE_UNICODE - #define wxUSE_UNICODE 1 -#endif - -// wxUSE_WCHAR_T is required by wxWidgets now, don't change. -#define wxUSE_WCHAR_T 1 - -// ---------------------------------------------------------------------------- -// global features -// ---------------------------------------------------------------------------- - -// Compile library in exception-safe mode? If set to 1, the library will try to -// behave correctly in presence of exceptions (even though it still will not -// use the exceptions itself) and notify the user code about any unhandled -// exceptions. If set to 0, propagation of the exceptions through the library -// code will lead to undefined behaviour -- but the code itself will be -// slightly smaller and faster. -// -// Note that like wxUSE_THREADS this option is automatically set to 0 if -// wxNO_EXCEPTIONS is defined. -// -// Default is 1 -// -// Recommended setting: depends on whether you intend to use C++ exceptions -// in your own code (1 if you do, 0 if you don't) -#define wxUSE_EXCEPTIONS 1 - -// Set wxUSE_EXTENDED_RTTI to 1 to use extended RTTI -// -// Default is 0 -// -// Recommended setting: 0 (this is still work in progress...) -#define wxUSE_EXTENDED_RTTI 0 - -// Support for message/error logging. This includes wxLogXXX() functions and -// wxLog and derived classes. Don't set this to 0 unless you really know what -// you are doing. -// -// Default is 1 -// -// Recommended setting: 1 (always) -#define wxUSE_LOG 1 - -// Recommended setting: 1 -#define wxUSE_LOGWINDOW 1 - -// Recommended setting: 1 -#define wxUSE_LOGGUI 1 - -// Recommended setting: 1 -#define wxUSE_LOG_DIALOG 1 - -// Support for command line parsing using wxCmdLineParser class. -// -// Default is 1 -// -// Recommended setting: 1 (can be set to 0 if you don't use the cmd line) -#define wxUSE_CMDLINE_PARSER 1 - -// Support for multithreaded applications: if 1, compile in thread classes -// (thread.h) and make the library a bit more thread safe. Although thread -// support is quite stable by now, you may still consider recompiling the -// library without it if you have no use for it - this will result in a -// somewhat smaller and faster operation. -// -// Notice that if wxNO_THREADS is defined, wxUSE_THREADS is automatically reset -// to 0 in wx/chkconf.h, so, for example, if you set USE_THREADS to 0 in -// build/msw/config.* file this value will have no effect. -// -// Default is 1 -// -// Recommended setting: 0 unless you do plan to develop MT applications -#define wxUSE_THREADS 1 - -// If enabled, compiles wxWidgets streams classes -// -// wx stream classes are used for image IO, process IO redirection, network -// protocols implementation and much more and so disabling this results in a -// lot of other functionality being lost. -// -// Default is 1 -// -// Recommended setting: 1 as setting it to 0 disables many other things -#define wxUSE_STREAMS 1 - -// Support for positional parameters (e.g. %1$d, %2$s ...) in wxVsnprintf. -// Note that if the system's implementation does not support positional -// parameters, setting this to 1 forces the use of the wxWidgets implementation -// of wxVsnprintf. The standard vsnprintf() supports positional parameters on -// many Unix systems but usually doesn't under Windows. -// -// Positional parameters are very useful when translating a program since using -// them in formatting strings allow translators to correctly reorder the -// translated sentences. -// -// Default is 1 -// -// Recommended setting: 1 if you want to support multiple languages -#define wxUSE_PRINTF_POS_PARAMS 1 - -// Enable the use of compiler-specific thread local storage keyword, if any. -// This is used for wxTLS_XXX() macros implementation and normally should use -// the compiler-provided support as it's simpler and more efficient, but must -// not use it if wxWidgets is used in a dynamically loaded Win32 (i.e. using -// LoadLibrary()/GetProcAddress()) as this triggers a bug in compiler TLS -// support that results in crashes when any TLS variables are used. So if you -// are building a Win32 DLL using wxWidgets that can be loaded dynamically, set -// this to 0. -// -// Default is 1, but set to 0 if the scenario above is applicable. -#define wxUSE_COMPILER_TLS 1 - -// ---------------------------------------------------------------------------- -// Interoperability with the standard library. -// ---------------------------------------------------------------------------- - -// Set wxUSE_STL to 1 to enable maximal interoperability with the standard -// library, even at the cost of backwards compatibility. -// -// Default is 0 -// -// Recommended setting: 0 as the options below already provide a relatively -// good level of interoperability and changing this option arguably isn't worth -// diverging from the official builds of the library. -#define wxUSE_STL 0 - -// This is not a real option but is used as the default value for -// wxUSE_STD_IOSTREAM, wxUSE_STD_STRING and wxUSE_STD_CONTAINERS. -// -// Currently the Digital Mars and Watcom compilers come without standard C++ -// library headers by default, wxUSE_STD_STRING can be set to 1 if you do have -// them (e.g. from STLPort). -// -// VC++ 5.0 does include standard C++ library headers, however they produce -// many warnings that can't be turned off when compiled at warning level 4. -#if defined(__DMC__) || defined(__WATCOMC__) \ - || (defined(_MSC_VER) && _MSC_VER < 1200) - #define wxUSE_STD_DEFAULT 0 -#else - #define wxUSE_STD_DEFAULT 1 -#endif - -// Use standard C++ containers to implement wxVector<>, wxStack<>, wxDList<> -// and wxHashXXX<> classes. If disabled, wxWidgets own (mostly compatible but -// usually more limited) implementations are used which allows to avoid the -// dependency on the C++ run-time library. -// -// Notice that the compilers mentioned in wxUSE_STD_DEFAULT comment above don't -// support using standard containers and that VC6 needs non-default options for -// such build to avoid getting "fatal error C1076: compiler limit : internal -// heap limit reached; use /Zm to specify a higher limit" in its own standard -// headers, so you need to ensure you do increase the heap size before enabling -// this option for this compiler. -// -// Default is 0 for compatibility reasons. -// -// Recommended setting: 1 unless compatibility with the official wxWidgets -// build and/or the existing code is a concern. -#define wxUSE_STD_CONTAINERS 0 - -// Use standard C++ streams if 1 instead of wx streams in some places. If -// disabled, wx streams are used everywhere and wxWidgets doesn't depend on the -// standard streams library. -// -// Notice that enabling this does not replace wx streams with std streams -// everywhere, in a lot of places wx streams are used no matter what. -// -// Default is 1 if compiler supports it. -// -// Recommended setting: 1 if you use the standard streams anyhow and so -// dependency on the standard streams library is not a -// problem -#define wxUSE_STD_IOSTREAM wxUSE_STD_DEFAULT - -// Enable minimal interoperability with the standard C++ string class if 1. -// "Minimal" means that wxString can be constructed from std::string or -// std::wstring but can't be implicitly converted to them. You need to enable -// the option below for the latter. -// -// Default is 1 for most compilers. -// -// Recommended setting: 1 unless you want to ensure your program doesn't use -// the standard C++ library at all. -#define wxUSE_STD_STRING wxUSE_STD_DEFAULT - -// Make wxString as much interchangeable with std::[w]string as possible, in -// particular allow implicit conversion of wxString to either of these classes. -// This comes at a price (or a benefit, depending on your point of view) of not -// allowing implicit conversion to "const char *" and "const wchar_t *". -// -// Because a lot of existing code relies on these conversions, this option is -// disabled by default but can be enabled for your build if you don't care -// about compatibility. -// -// Default is 0 if wxUSE_STL has its default value or 1 if it is enabled. -// -// Recommended setting: 0 to remain compatible with the official builds of -// wxWidgets. -#define wxUSE_STD_STRING_CONV_IN_WXSTRING wxUSE_STL - -// VC++ 4.2 and above allows and but you can't mix -// them. Set this option to 1 to use , 0 to use . -// -// Note that newer compilers (including VC++ 7.1 and later) don't support -// wxUSE_IOSTREAMH == 1 and so will be used anyhow. -// -// Default is 0. -// -// Recommended setting: 0, only set to 1 if you use a really old compiler -#define wxUSE_IOSTREAMH 0 - - -// ---------------------------------------------------------------------------- -// non GUI features selection -// ---------------------------------------------------------------------------- - -// Set wxUSE_LONGLONG to 1 to compile the wxLongLong class. This is a 64 bit -// integer which is implemented in terms of native 64 bit integers if any or -// uses emulation otherwise. -// -// This class is required by wxDateTime and so you should enable it if you want -// to use wxDateTime. For most modern platforms, it will use the native 64 bit -// integers in which case (almost) all of its functions are inline and it -// almost does not take any space, so there should be no reason to switch it -// off. -// -// Recommended setting: 1 -#define wxUSE_LONGLONG 1 - -// Set wxUSE_BASE64 to 1, to compile in Base64 support. This is required for -// storing binary data in wxConfig on most platforms. -// -// Default is 1. -// -// Recommended setting: 1 (but can be safely disabled if you don't use it) -#define wxUSE_BASE64 1 - -// Set this to 1 to be able to use wxEventLoop even in console applications -// (i.e. using base library only, without GUI). This is mostly useful for -// processing socket events but is also necessary to use timers in console -// applications -// -// Default is 1. -// -// Recommended setting: 1 (but can be safely disabled if you don't use it) -#define wxUSE_CONSOLE_EVENTLOOP 1 - -// Set wxUSE_(F)FILE to 1 to compile wx(F)File classes. wxFile uses low level -// POSIX functions for file access, wxFFile uses ANSI C stdio.h functions. -// -// Default is 1 -// -// Recommended setting: 1 (wxFile is highly recommended as it is required by -// i18n code, wxFileConfig and others) -#define wxUSE_FILE 1 -#define wxUSE_FFILE 1 - -// Use wxFSVolume class providing access to the configured/active mount points -// -// Default is 1 -// -// Recommended setting: 1 (but may be safely disabled if you don't use it) -#define wxUSE_FSVOLUME 1 - -// Use wxStandardPaths class which allows to retrieve some standard locations -// in the file system -// -// Default is 1 -// -// Recommended setting: 1 (may be disabled to save space, but not much) -#define wxUSE_STDPATHS 1 - -// use wxTextBuffer class: required by wxTextFile -#define wxUSE_TEXTBUFFER 1 - -// use wxTextFile class: requires wxFile and wxTextBuffer, required by -// wxFileConfig -#define wxUSE_TEXTFILE 1 - -// i18n support: _() macro, wxLocale class. Requires wxTextFile. -#define wxUSE_INTL 1 - -// Provide wxFoo_l() functions similar to standard foo() functions but taking -// an extra locale parameter. -// -// Notice that this is fully implemented only for the systems providing POSIX -// xlocale support or Microsoft Visual C++ >= 8 (which provides proprietary -// almost-equivalent of xlocale functions), otherwise wxFoo_l() functions will -// only work for the current user locale and "C" locale. You can use -// wxHAS_XLOCALE_SUPPORT to test whether the full support is available. -// -// Default is 1 -// -// Recommended setting: 1 but may be disabled if you are writing programs -// running only in C locale anyhow -#define wxUSE_XLOCALE 1 - -// Set wxUSE_DATETIME to 1 to compile the wxDateTime and related classes which -// allow to manipulate dates, times and time intervals. wxDateTime replaces the -// old wxTime and wxDate classes which are still provided for backwards -// compatibility (and implemented in terms of wxDateTime). -// -// Note that this class is relatively new and is still officially in alpha -// stage because some features are not yet (fully) implemented. It is already -// quite useful though and should only be disabled if you are aiming at -// absolutely minimal version of the library. -// -// Requires: wxUSE_LONGLONG -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_DATETIME 1 - -// Set wxUSE_TIMER to 1 to compile wxTimer class -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_TIMER 1 - -// Use wxStopWatch clas. -// -// Default is 1 -// -// Recommended setting: 1 (needed by wxSocket) -#define wxUSE_STOPWATCH 1 - -// Set wxUSE_FSWATCHER to 1 if you want to enable wxFileSystemWatcher -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_FSWATCHER 1 - -// Setting wxUSE_CONFIG to 1 enables the use of wxConfig and related classes -// which allow the application to store its settings in the persistent -// storage. Setting this to 1 will also enable on-demand creation of the -// global config object in wxApp. -// -// See also wxUSE_CONFIG_NATIVE below. -// -// Recommended setting: 1 -#define wxUSE_CONFIG 1 - -// If wxUSE_CONFIG is 1, you may choose to use either the native config -// classes under Windows (using .INI files under Win16 and the registry under -// Win32) or the portable text file format used by the config classes under -// Unix. -// -// Default is 1 to use native classes. Note that you may still use -// wxFileConfig even if you set this to 1 - just the config object created by -// default for the applications needs will be a wxRegConfig or wxIniConfig and -// not wxFileConfig. -// -// Recommended setting: 1 -#define wxUSE_CONFIG_NATIVE 1 - -// If wxUSE_DIALUP_MANAGER is 1, compile in wxDialUpManager class which allows -// to connect/disconnect from the network and be notified whenever the dial-up -// network connection is established/terminated. Requires wxUSE_DYNAMIC_LOADER. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_DIALUP_MANAGER 1 - -// Compile in classes for run-time DLL loading and function calling. -// Required by wxUSE_DIALUP_MANAGER. -// -// This setting is for Win32 only -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_DYNLIB_CLASS 1 - -// experimental, don't use for now -#define wxUSE_DYNAMIC_LOADER 1 - -// Set to 1 to use socket classes -#define wxUSE_SOCKETS 1 - -// Set to 1 to use ipv6 socket classes (requires wxUSE_SOCKETS) -// -// Notice that currently setting this option under Windows will result in -// programs which can only run on recent OS versions (with ws2_32.dll -// installed) which is why it is disabled by default. -// -// Default is 1. -// -// Recommended setting: 1 if you need IPv6 support -#define wxUSE_IPV6 0 - -// Set to 1 to enable virtual file systems (required by wxHTML) -#define wxUSE_FILESYSTEM 1 - -// Set to 1 to enable virtual ZIP filesystem (requires wxUSE_FILESYSTEM) -#define wxUSE_FS_ZIP 1 - -// Set to 1 to enable virtual archive filesystem (requires wxUSE_FILESYSTEM) -#define wxUSE_FS_ARCHIVE 1 - -// Set to 1 to enable virtual Internet filesystem (requires wxUSE_FILESYSTEM) -#define wxUSE_FS_INET 1 - -// wxArchive classes for accessing archives such as zip and tar -#define wxUSE_ARCHIVE_STREAMS 1 - -// Set to 1 to compile wxZipInput/OutputStream classes. -#define wxUSE_ZIPSTREAM 1 - -// Set to 1 to compile wxTarInput/OutputStream classes. -#define wxUSE_TARSTREAM 1 - -// Set to 1 to compile wxZlibInput/OutputStream classes. Also required by -// wxUSE_LIBPNG -#define wxUSE_ZLIB 1 - -// If enabled, the code written by Apple will be used to write, in a portable -// way, float on the disk. See extended.c for the license which is different -// from wxWidgets one. -// -// Default is 1. -// -// Recommended setting: 1 unless you don't like the license terms (unlikely) -#define wxUSE_APPLE_IEEE 1 - -// Joystick support class -#define wxUSE_JOYSTICK 1 - -// wxFontEnumerator class -#define wxUSE_FONTENUM 1 - -// wxFontMapper class -#define wxUSE_FONTMAP 1 - -// wxMimeTypesManager class -#define wxUSE_MIMETYPE 1 - -// wxProtocol and related classes: if you want to use either of wxFTP, wxHTTP -// or wxURL you need to set this to 1. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_PROTOCOL 1 - -// The settings for the individual URL schemes -#define wxUSE_PROTOCOL_FILE 1 -#define wxUSE_PROTOCOL_FTP 1 -#define wxUSE_PROTOCOL_HTTP 1 - -// Define this to use wxURL class. -#define wxUSE_URL 1 - -// Define this to use native platform url and protocol support. -// Currently valid only for MS-Windows. -// Note: if you set this to 1, you can open ftp/http/gopher sites -// and obtain a valid input stream for these sites -// even when you set wxUSE_PROTOCOL_FTP/HTTP to 0. -// Doing so reduces the code size. -// -// This code is experimental and subject to change. -#define wxUSE_URL_NATIVE 0 - -// Support for wxVariant class used in several places throughout the library, -// notably in wxDataViewCtrl API. -// -// Default is 1. -// -// Recommended setting: 1 unless you want to reduce the library size as much as -// possible in which case setting this to 0 can gain up to 100KB. -#define wxUSE_VARIANT 1 - -// Support for wxAny class, the successor for wxVariant. -// -// Default is 1. -// -// Recommended setting: 1 unless you want to reduce the library size by a small amount, -// or your compiler cannot for some reason cope with complexity of templates used. -#define wxUSE_ANY 1 - -// Support for regular expression matching via wxRegEx class: enable this to -// use POSIX regular expressions in your code. You need to compile regex -// library from src/regex to use it under Windows. -// -// Default is 0 -// -// Recommended setting: 1 if your compiler supports it, if it doesn't please -// contribute us a makefile for src/regex for it -#define wxUSE_REGEX 1 - -// wxSystemOptions class -#define wxUSE_SYSTEM_OPTIONS 1 - -// wxSound class -#define wxUSE_SOUND 1 - -// Use wxMediaCtrl -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_MEDIACTRL 1 - -// Use wxWidget's XRC XML-based resource system. Recommended. -// -// Default is 1 -// -// Recommended setting: 1 (requires wxUSE_XML) -#define wxUSE_XRC 1 - -// XML parsing classes. Note that their API will change in the future, so -// using wxXmlDocument and wxXmlNode in your app is not recommended. -// -// Default is the same as wxUSE_XRC, i.e. 1 by default. -// -// Recommended setting: 1 (required by XRC) -#define wxUSE_XML wxUSE_XRC - -// Use wxWidget's AUI docking system -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_AUI 1 - -// Use wxWidget's Ribbon classes for interfaces -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_RIBBON 1 - -// Use wxPropertyGrid. -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_PROPGRID 1 - -// Use wxStyledTextCtrl, a wxWidgets implementation of Scintilla. -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_STC 1 - -// Use wxWidget's web viewing classes -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_WEBVIEW 1 - -// Use the IE wxWebView backend -// -// Default is 1 on MSW -// -// Recommended setting: 1 -#ifdef __WXMSW__ -#define wxUSE_WEBVIEW_IE 1 -#else -#define wxUSE_WEBVIEW_IE 0 -#endif - -// Use the WebKit wxWebView backend -// -// Default is 1 on GTK and OSX -// -// Recommended setting: 1 -#if defined(__WXGTK__) || defined(__WXOSX__) -#define wxUSE_WEBVIEW_WEBKIT 1 -#else -#define wxUSE_WEBVIEW_WEBKIT 0 -#endif - -// Enable the new wxGraphicsPath and wxGraphicsContext classes for an advanced -// 2D drawing API. (Still somewhat experimental) -// -// Please note that on Windows gdiplus.dll is loaded dynamically which means -// that nothing special needs to be done as long as you don't use -// wxGraphicsContext at all or only use it on XP and later systems but you -// still do need to distribute it yourself for an application using -// wxGraphicsContext to be runnable on pre-XP systems. -// -// Default is 1 except if you're using a non-Microsoft compiler under Windows -// as only MSVC7+ is known to ship with gdiplus.h. For other compilers (e.g. -// mingw32) you may need to install the headers (and just the headers) -// yourself. If you do, change the setting below manually. -// -// Recommended setting: 1 if supported by the compilation environment - -// notice that we can't use wxCHECK_VISUALC_VERSION() here as this file is -// included from wx/platform.h before wxCHECK_VISUALC_VERSION() is defined -#ifdef _MSC_VER -# if _MSC_VER >= 1310 - // MSVC7.1+ comes with new enough Platform SDK, enable - // wxGraphicsContext support for it -# define wxUSE_GRAPHICS_CONTEXT 1 -# else - // MSVC 6 didn't include GDI+ headers so disable by default, enable it - // here if you use MSVC 6 with a newer SDK -# define wxUSE_GRAPHICS_CONTEXT 0 -# endif -#else - // Disable support for other Windows compilers, enable it if your compiler - // comes with new enough SDK or you installed the headers manually. - // - // Notice that this will be set by configure under non-Windows platforms - // anyhow so the value there is not important. -# define wxUSE_GRAPHICS_CONTEXT 0 -#endif - -// Enable wxGraphicsContext implementation using Cairo library. -// -// This is not needed under Windows and detected automatically by configure -// under other systems, however you may set this to 1 manually if you installed -// Cairo under Windows yourself and prefer to use it instead the native GDI+ -// implementation. -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_CAIRO 0 - - -// ---------------------------------------------------------------------------- -// Individual GUI controls -// ---------------------------------------------------------------------------- - -// You must set wxUSE_CONTROLS to 1 if you are using any controls at all -// (without it, wxControl class is not compiled) -// -// Default is 1 -// -// Recommended setting: 1 (don't change except for very special programs) -#define wxUSE_CONTROLS 1 - -// Support markup in control labels, i.e. provide wxControl::SetLabelMarkup(). -// Currently markup is supported only by a few controls and only some ports but -// their number will increase with time. -// -// Default is 1 -// -// Recommended setting: 1 (may be set to 0 if you want to save on code size) -#define wxUSE_MARKUP 1 - -// wxPopupWindow class is a top level transient window. It is currently used -// to implement wxTipWindow -// -// Default is 1 -// -// Recommended setting: 1 (may be set to 0 if you don't wxUSE_TIPWINDOW) -#define wxUSE_POPUPWIN 1 - -// wxTipWindow allows to implement the custom tooltips, it is used by the -// context help classes. Requires wxUSE_POPUPWIN. -// -// Default is 1 -// -// Recommended setting: 1 (may be set to 0) -#define wxUSE_TIPWINDOW 1 - -// Each of the settings below corresponds to one wxWidgets control. They are -// all switched on by default but may be disabled if you are sure that your -// program (including any standard dialogs it can show!) doesn't need them and -// if you desperately want to save some space. If you use any of these you must -// set wxUSE_CONTROLS as well. -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_ANIMATIONCTRL 1 // wxAnimationCtrl -#define wxUSE_BANNERWINDOW 1 // wxBannerWindow -#define wxUSE_BUTTON 1 // wxButton -#define wxUSE_BMPBUTTON 1 // wxBitmapButton -#define wxUSE_CALENDARCTRL 1 // wxCalendarCtrl -#define wxUSE_CHECKBOX 1 // wxCheckBox -#define wxUSE_CHECKLISTBOX 1 // wxCheckListBox (requires wxUSE_OWNER_DRAWN) -#define wxUSE_CHOICE 1 // wxChoice -#define wxUSE_COLLPANE 1 // wxCollapsiblePane -#define wxUSE_COLOURPICKERCTRL 1 // wxColourPickerCtrl -#define wxUSE_COMBOBOX 1 // wxComboBox -#define wxUSE_COMMANDLINKBUTTON 1 // wxCommandLinkButton -#define wxUSE_DATAVIEWCTRL 1 // wxDataViewCtrl -#define wxUSE_DATEPICKCTRL 1 // wxDatePickerCtrl -#define wxUSE_DIRPICKERCTRL 1 // wxDirPickerCtrl -#define wxUSE_EDITABLELISTBOX 1 // wxEditableListBox -#define wxUSE_FILECTRL 1 // wxFileCtrl -#define wxUSE_FILEPICKERCTRL 1 // wxFilePickerCtrl -#define wxUSE_FONTPICKERCTRL 1 // wxFontPickerCtrl -#define wxUSE_GAUGE 1 // wxGauge -#define wxUSE_HEADERCTRL 1 // wxHeaderCtrl -#define wxUSE_HYPERLINKCTRL 1 // wxHyperlinkCtrl -#define wxUSE_LISTBOX 1 // wxListBox -#define wxUSE_LISTCTRL 1 // wxListCtrl -#define wxUSE_RADIOBOX 1 // wxRadioBox -#define wxUSE_RADIOBTN 1 // wxRadioButton -#define wxUSE_RICHMSGDLG 1 // wxRichMessageDialog -#define wxUSE_SCROLLBAR 1 // wxScrollBar -#define wxUSE_SEARCHCTRL 1 // wxSearchCtrl -#define wxUSE_SLIDER 1 // wxSlider -#define wxUSE_SPINBTN 1 // wxSpinButton -#define wxUSE_SPINCTRL 1 // wxSpinCtrl -#define wxUSE_STATBOX 1 // wxStaticBox -#define wxUSE_STATLINE 1 // wxStaticLine -#define wxUSE_STATTEXT 1 // wxStaticText -#define wxUSE_STATBMP 1 // wxStaticBitmap -#define wxUSE_TEXTCTRL 1 // wxTextCtrl -#define wxUSE_TIMEPICKCTRL 1 // wxTimePickerCtrl -#define wxUSE_TOGGLEBTN 1 // requires wxButton -#define wxUSE_TREECTRL 1 // wxTreeCtrl -#define wxUSE_TREELISTCTRL 1 // wxTreeListCtrl - -// Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR -// below either wxStatusBar95 or a generic wxStatusBar will be used. -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_STATUSBAR 1 - -// Two status bar implementations are available under Win32: the generic one -// or the wrapper around native control. For native look and feel the native -// version should be used. -// -// Default is 1 for the platforms where native status bar is supported. -// -// Recommended setting: 1 (there is no advantage in using the generic one) -#define wxUSE_NATIVE_STATUSBAR 1 - -// wxToolBar related settings: if wxUSE_TOOLBAR is 0, don't compile any toolbar -// classes at all. Otherwise, use the native toolbar class unless -// wxUSE_TOOLBAR_NATIVE is 0. -// -// Default is 1 for all settings. -// -// Recommended setting: 1 for wxUSE_TOOLBAR and wxUSE_TOOLBAR_NATIVE. -#define wxUSE_TOOLBAR 1 -#define wxUSE_TOOLBAR_NATIVE 1 - -// wxNotebook is a control with several "tabs" located on one of its sides. It -// may be used to logically organise the data presented to the user instead of -// putting everything in one huge dialog. It replaces wxTabControl and related -// classes of wxWin 1.6x. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_NOTEBOOK 1 - -// wxListbook control is similar to wxNotebook but uses wxListCtrl instead of -// the tabs -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_LISTBOOK 1 - -// wxChoicebook control is similar to wxNotebook but uses wxChoice instead of -// the tabs -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_CHOICEBOOK 1 - -// wxTreebook control is similar to wxNotebook but uses wxTreeCtrl instead of -// the tabs -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_TREEBOOK 1 - -// wxToolbook control is similar to wxNotebook but uses wxToolBar instead of -// tabs -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_TOOLBOOK 1 - -// wxTaskBarIcon is a small notification icon shown in the system toolbar or -// dock. -// -// Default is 1. -// -// Recommended setting: 1 (but can be set to 0 if you don't need it) -#define wxUSE_TASKBARICON 1 - -// wxGrid class -// -// Default is 1, set to 0 to cut down compilation time and binaries size if you -// don't use it. -// -// Recommended setting: 1 -// -#define wxUSE_GRID 1 - -// wxMiniFrame class: a frame with narrow title bar -// -// Default is 1. -// -// Recommended setting: 1 (it doesn't cost almost anything) -#define wxUSE_MINIFRAME 1 - -// wxComboCtrl and related classes: combobox with custom popup window and -// not necessarily a listbox. -// -// Default is 1. -// -// Recommended setting: 1 but can be safely set to 0 except for wxUniv where it -// it used by wxComboBox -#define wxUSE_COMBOCTRL 1 - -// wxOwnerDrawnComboBox is a custom combobox allowing to paint the combobox -// items. -// -// Default is 1. -// -// Recommended setting: 1 but can be safely set to 0, except where it is -// needed as a base class for generic wxBitmapComboBox. -#define wxUSE_ODCOMBOBOX 1 - -// wxBitmapComboBox is a combobox that can have images in front of text items. -// -// Default is 1. -// -// Recommended setting: 1 but can be safely set to 0 -#define wxUSE_BITMAPCOMBOBOX 1 - -// wxRearrangeCtrl is a wxCheckListBox with two buttons allowing to move items -// up and down in it. It is also used as part of wxRearrangeDialog. -// -// Default is 1. -// -// Recommended setting: 1 but can be safely set to 0 (currently used only by -// wxHeaderCtrl) -#define wxUSE_REARRANGECTRL 1 - -// ---------------------------------------------------------------------------- -// Miscellaneous GUI stuff -// ---------------------------------------------------------------------------- - -// wxAcceleratorTable/Entry classes and support for them in wxMenu(Bar) -#define wxUSE_ACCEL 1 - -// Use the standard art provider. The icons returned by this provider are -// embedded into the library as XPMs so disabling it reduces the library size -// somewhat but this should only be done if you use your own custom art -// provider returning the icons or never use any icons not provided by the -// native art provider (which might not be implemented at all for some -// platforms) or by the Tango icons provider (if it's not itself disabled -// below). -// -// Default is 1. -// -// Recommended setting: 1 unless you use your own custom art provider. -#define wxUSE_ARTPROVIDER_STD 1 - -// Use art provider providing Tango icons: this art provider has higher quality -// icons than the default ones using smaller size XPM icons without -// transparency but the embedded PNG icons add to the library size. -// -// Default is 1 under non-GTK ports. Under wxGTK the native art provider using -// the GTK+ stock icons replaces it so it is normally not necessary. -// -// Recommended setting: 1 but can be turned off to reduce the library size. -#define wxUSE_ARTPROVIDER_TANGO 1 - -// Hotkey support (currently Windows only) -#define wxUSE_HOTKEY 1 - -// Use wxCaret: a class implementing a "cursor" in a text control (called caret -// under Windows). -// -// Default is 1. -// -// Recommended setting: 1 (can be safely set to 0, not used by the library) -#define wxUSE_CARET 1 - -// Use wxDisplay class: it allows enumerating all displays on a system and -// their geometries as well as finding the display on which the given point or -// window lies. -// -// Default is 1. -// -// Recommended setting: 1 if you need it, can be safely set to 0 otherwise -#define wxUSE_DISPLAY 1 - -// Miscellaneous geometry code: needed for Canvas library -#define wxUSE_GEOMETRY 1 - -// Use wxImageList. This class is needed by wxNotebook, wxTreeCtrl and -// wxListCtrl. -// -// Default is 1. -// -// Recommended setting: 1 (set it to 0 if you don't use any of the controls -// enumerated above, then this class is mostly useless too) -#define wxUSE_IMAGLIST 1 - -// Use wxInfoBar class. -// -// Default is 1. -// -// Recommended setting: 1 (but can be disabled without problems as nothing -// depends on it) -#define wxUSE_INFOBAR 1 - -// Use wxMenu, wxMenuBar, wxMenuItem. -// -// Default is 1. -// -// Recommended setting: 1 (can't be disabled under MSW) -#define wxUSE_MENUS 1 - -// Use wxNotificationMessage. -// -// wxNotificationMessage allows to show non-intrusive messages to the user -// using balloons, banners, popups or whatever is the appropriate method for -// the current platform. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_NOTIFICATION_MESSAGE 1 - -// wxRichToolTip is a customizable tooltip class which has more functionality -// than the stock (but native, unlike this class) wxToolTip. -// -// Default is 1. -// -// Recommended setting: 1 (but can be safely set to 0 if you don't need it) -#define wxUSE_RICHTOOLTIP 1 - -// Use wxSashWindow class. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_SASH 1 - -// Use wxSplitterWindow class. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_SPLITTER 1 - -// Use wxToolTip and wxWindow::Set/GetToolTip() methods. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_TOOLTIPS 1 - -// wxValidator class and related methods -#define wxUSE_VALIDATORS 1 - -// Use reference counted ID management: this means that wxWidgets will track -// the automatically allocated ids (those used when you use wxID_ANY when -// creating a window, menu or toolbar item &c) instead of just supposing that -// the program never runs out of them. This is mostly useful only under wxMSW -// where the total ids range is limited to SHRT_MIN..SHRT_MAX and where -// long-running programs can run into problems with ids reuse without this. On -// the other platforms, where the ids have the full int range, this shouldn't -// be necessary. -#ifdef __WXMSW__ -#define wxUSE_AUTOID_MANAGEMENT 1 -#else -#define wxUSE_AUTOID_MANAGEMENT 0 -#endif - -// ---------------------------------------------------------------------------- -// common dialogs -// ---------------------------------------------------------------------------- - -// On rare occasions (e.g. using DJGPP) may want to omit common dialogs (e.g. -// file selector, printer dialog). Switching this off also switches off the -// printing architecture and interactive wxPrinterDC. -// -// Default is 1 -// -// Recommended setting: 1 (unless it really doesn't work) -#define wxUSE_COMMON_DIALOGS 1 - -// wxBusyInfo displays window with message when app is busy. Works in same way -// as wxBusyCursor -#define wxUSE_BUSYINFO 1 - -// Use single/multiple choice dialogs. -// -// Default is 1 -// -// Recommended setting: 1 (used in the library itself) -#define wxUSE_CHOICEDLG 1 - -// Use colour picker dialog -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_COLOURDLG 1 - -// wxDirDlg class for getting a directory name from user -#define wxUSE_DIRDLG 1 - -// TODO: setting to choose the generic or native one - -// Use file open/save dialogs. -// -// Default is 1 -// -// Recommended setting: 1 (used in many places in the library itself) -#define wxUSE_FILEDLG 1 - -// Use find/replace dialogs. -// -// Default is 1 -// -// Recommended setting: 1 (but may be safely set to 0) -#define wxUSE_FINDREPLDLG 1 - -// Use font picker dialog -// -// Default is 1 -// -// Recommended setting: 1 (used in the library itself) -#define wxUSE_FONTDLG 1 - -// Use wxMessageDialog and wxMessageBox. -// -// Default is 1 -// -// Recommended setting: 1 (used in the library itself) -#define wxUSE_MSGDLG 1 - -// progress dialog class for lengthy operations -#define wxUSE_PROGRESSDLG 1 - -// support for startup tips (wxShowTip &c) -#define wxUSE_STARTUP_TIPS 1 - -// text entry dialog and wxGetTextFromUser function -#define wxUSE_TEXTDLG 1 - -// number entry dialog -#define wxUSE_NUMBERDLG 1 - -// splash screen class -#define wxUSE_SPLASH 1 - -// wizards -#define wxUSE_WIZARDDLG 1 - -// Compile in wxAboutBox() function showing the standard "About" dialog. -// -// Default is 1 -// -// Recommended setting: 1 but can be set to 0 to save some space if you don't -// use this function -#define wxUSE_ABOUTDLG 1 - -// wxFileHistory class -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_FILE_HISTORY 1 - -// ---------------------------------------------------------------------------- -// Metafiles support -// ---------------------------------------------------------------------------- - -// Windows supports the graphics format known as metafile which is, though not -// portable, is widely used under Windows and so is supported by wxWin (under -// Windows only, of course). Win16 (Win3.1) used the so-called "Window -// MetaFiles" or WMFs which were replaced with "Enhanced MetaFiles" or EMFs in -// Win32 (Win9x, NT, 2000). Both of these are supported in wxWin and, by -// default, WMFs will be used under Win16 and EMFs under Win32. This may be -// changed by setting wxUSE_WIN_METAFILES_ALWAYS to 1 and/or setting -// wxUSE_ENH_METAFILE to 0. You may also set wxUSE_METAFILE to 0 to not compile -// in any metafile related classes at all. -// -// Default is 1 for wxUSE_ENH_METAFILE and 0 for wxUSE_WIN_METAFILES_ALWAYS. -// -// Recommended setting: default or 0 for everything for portable programs. -#define wxUSE_METAFILE 1 -#define wxUSE_ENH_METAFILE 1 -#define wxUSE_WIN_METAFILES_ALWAYS 0 - -// ---------------------------------------------------------------------------- -// Big GUI components -// ---------------------------------------------------------------------------- - -// Set to 0 to disable MDI support. -// -// Requires wxUSE_NOTEBOOK under platforms other than MSW. -// -// Default is 1. -// -// Recommended setting: 1, can be safely set to 0. -#define wxUSE_MDI 1 - -// Set to 0 to disable document/view architecture -#define wxUSE_DOC_VIEW_ARCHITECTURE 1 - -// Set to 0 to disable MDI document/view architecture -// -// Requires wxUSE_MDI && wxUSE_DOC_VIEW_ARCHITECTURE -#define wxUSE_MDI_ARCHITECTURE 1 - -// Set to 0 to disable print/preview architecture code -#define wxUSE_PRINTING_ARCHITECTURE 1 - -// wxHTML sublibrary allows to display HTML in wxWindow programs and much, -// much more. -// -// Default is 1. -// -// Recommended setting: 1 (wxHTML is great!), set to 0 if you want compile a -// smaller library. -#define wxUSE_HTML 1 - -// Setting wxUSE_GLCANVAS to 1 enables OpenGL support. You need to have OpenGL -// headers and libraries to be able to compile the library with wxUSE_GLCANVAS -// set to 1 and, under Windows, also to add opengl32.lib and glu32.lib to the -// list of libraries used to link your application (although this is done -// implicitly for Microsoft Visual C++ users). -// -// Default is 1 unless the compiler is known to ship without the necessary -// headers (Digital Mars) or the platform doesn't support OpenGL (Windows CE). -// -// Recommended setting: 1 if you intend to use OpenGL, can be safely set to 0 -// otherwise. -#define wxUSE_GLCANVAS 1 - -// wxRichTextCtrl allows editing of styled text. -// -// Default is 1. -// -// Recommended setting: 1, set to 0 if you want compile a -// smaller library. -#define wxUSE_RICHTEXT 1 - -// ---------------------------------------------------------------------------- -// Data transfer -// ---------------------------------------------------------------------------- - -// Use wxClipboard class for clipboard copy/paste. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_CLIPBOARD 1 - -// Use wxDataObject and related classes. Needed for clipboard and OLE drag and -// drop -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_DATAOBJ 1 - -// Use wxDropTarget and wxDropSource classes for drag and drop (this is -// different from "built in" drag and drop in wxTreeCtrl which is always -// available). Requires wxUSE_DATAOBJ. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_DRAG_AND_DROP 1 - -// Use wxAccessible for enhanced and customisable accessibility. -// Depends on wxUSE_OLE. -// -// Default is 0. -// -// Recommended setting (at present): 0 -#define wxUSE_ACCESSIBILITY 0 - -// ---------------------------------------------------------------------------- -// miscellaneous settings -// ---------------------------------------------------------------------------- - -// wxSingleInstanceChecker class allows to verify at startup if another program -// instance is running. -// -// Default is 1 -// -// Recommended setting: 1 (the class is tiny, disabling it won't save much -// space) -#define wxUSE_SNGLINST_CHECKER 1 - -#define wxUSE_DRAGIMAGE 1 - -#define wxUSE_IPC 1 - // 0 for no interprocess comms -#define wxUSE_HELP 1 - // 0 for no help facility - -// Should we use MS HTML help for wxHelpController? If disabled, neither -// wxCHMHelpController nor wxBestHelpController are available. -// -// Default is 1 under MSW, 0 is always used for the other platforms. -// -// Recommended setting: 1, only set to 0 if you have trouble compiling -// wxCHMHelpController (could be a problem with really ancient compilers) -#define wxUSE_MS_HTML_HELP 1 - - -// Use wxHTML-based help controller? -#define wxUSE_WXHTML_HELP 1 - -#define wxUSE_CONSTRAINTS 1 - // 0 for no window layout constraint system - -#define wxUSE_SPLINES 1 - // 0 for no splines - -#define wxUSE_MOUSEWHEEL 1 - // Include mouse wheel support - -// Compile wxUIActionSimulator class? -#define wxUSE_UIACTIONSIMULATOR 1 - -// ---------------------------------------------------------------------------- -// wxDC classes for various output formats -// ---------------------------------------------------------------------------- - -// Set to 1 for PostScript device context. -#define wxUSE_POSTSCRIPT 0 - -// Set to 1 to use font metric files in GetTextExtent -#define wxUSE_AFM_FOR_POSTSCRIPT 1 - -// Set to 1 to compile in support for wxSVGFileDC, a wxDC subclass which allows -// to create files in SVG (Scalable Vector Graphics) format. -#define wxUSE_SVG 1 - -// Should wxDC provide SetTransformMatrix() and related methods? -// -// Default is 1 but can be set to 0 if this functionality is not used. Notice -// that currently only wxMSW supports this so setting this to 0 doesn't change -// much for non-MSW platforms (although it will still save a few bytes -// probably). -// -// Recommended setting: 1. -#define wxUSE_DC_TRANSFORM_MATRIX 1 - -// ---------------------------------------------------------------------------- -// image format support -// ---------------------------------------------------------------------------- - -// wxImage supports many different image formats which can be configured at -// compile-time. BMP is always supported, others are optional and can be safely -// disabled if you don't plan to use images in such format sometimes saving -// substantial amount of code in the final library. -// -// Some formats require an extra library which is included in wxWin sources -// which is mentioned if it is the case. - -// Set to 1 for wxImage support (recommended). -#define wxUSE_IMAGE 1 - -// Set to 1 for PNG format support (requires libpng). Also requires wxUSE_ZLIB. -#define wxUSE_LIBPNG 1 - -// Set to 1 for JPEG format support (requires libjpeg) -#define wxUSE_LIBJPEG 1 - -// Set to 1 for TIFF format support (requires libtiff) -#define wxUSE_LIBTIFF 1 - -// Set to 1 for TGA format support (loading only) -#define wxUSE_TGA 1 - -// Set to 1 for GIF format support -#define wxUSE_GIF 1 - -// Set to 1 for PNM format support -#define wxUSE_PNM 1 - -// Set to 1 for PCX format support -#define wxUSE_PCX 1 - -// Set to 1 for IFF format support (Amiga format) -#define wxUSE_IFF 0 - -// Set to 1 for XPM format support -#define wxUSE_XPM 1 - -// Set to 1 for MS Icons and Cursors format support -#define wxUSE_ICO_CUR 1 - -// Set to 1 to compile in wxPalette class -#define wxUSE_PALETTE 1 - -// ---------------------------------------------------------------------------- -// wxUniversal-only options -// ---------------------------------------------------------------------------- - -// Set to 1 to enable compilation of all themes, this is the default -#define wxUSE_ALL_THEMES 1 - -// Set to 1 to enable the compilation of individual theme if wxUSE_ALL_THEMES -// is unset, if it is set these options are not used; notice that metal theme -// uses Win32 one -#define wxUSE_THEME_GTK 0 -#define wxUSE_THEME_METAL 0 -#define wxUSE_THEME_MONO 0 -#define wxUSE_THEME_WIN32 0 - - -/* --- end common options --- */ - -/* --- start MSW options --- */ -// ---------------------------------------------------------------------------- -// Windows-only settings -// ---------------------------------------------------------------------------- - -// Set wxUSE_UNICODE_MSLU to 1 if you're compiling wxWidgets in Unicode mode -// and want to run your programs under Windows 9x and not only NT/2000/XP. -// This setting enables use of unicows.dll from MSLU (MS Layer for Unicode, see -// http://www.microsoft.com/globaldev/handson/dev/mslu_announce.mspx). Note -// that you will have to modify the makefiles to include unicows.lib import -// library as the first library (see installation instructions in install.txt -// to learn how to do it when building the library or samples). -// -// If your compiler doesn't have unicows.lib, you can get a version of it at -// http://libunicows.sourceforge.net -// -// Default is 0 -// -// Recommended setting: 0 (1 if you want to deploy Unicode apps on 9x systems) -#ifndef wxUSE_UNICODE_MSLU - #define wxUSE_UNICODE_MSLU 0 -#endif - -// Set this to 1 if you want to use wxWidgets and MFC in the same program. This -// will override some other settings (see below) -// -// Default is 0. -// -// Recommended setting: 0 unless you really have to use MFC -#define wxUSE_MFC 0 - -// Set this to 1 for generic OLE support: this is required for drag-and-drop, -// clipboard, OLE Automation. Only set it to 0 if your compiler is very old and -// can't compile/doesn't have the OLE headers. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_OLE 1 - -// Set this to 1 to enable wxAutomationObject class. -// -// Default is 1. -// -// Recommended setting: 1 if you need to control other applications via OLE -// Automation, can be safely set to 0 otherwise -#define wxUSE_OLE_AUTOMATION 1 - -// Set this to 1 to enable wxActiveXContainer class allowing to embed OLE -// controls in wx. -// -// Default is 1. -// -// Recommended setting: 1, required by wxMediaCtrl -#define wxUSE_ACTIVEX 1 - -// wxDC caching implementation -#define wxUSE_DC_CACHEING 1 - -// Set this to 1 to enable wxDIB class used internally for manipulating -// wxBitmap data. -// -// Default is 1, set it to 0 only if you don't use wxImage neither -// -// Recommended setting: 1 (without it conversion to/from wxImage won't work) -#define wxUSE_WXDIB 1 - -// Set to 0 to disable PostScript print/preview architecture code under Windows -// (just use Windows printing). -#define wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW 1 - -// Set this to 1 to compile in wxRegKey class. -// -// Default is 1 -// -// Recommended setting: 1, this is used internally by wx in a few places -#define wxUSE_REGKEY 1 - -// Set this to 1 to use RICHEDIT controls for wxTextCtrl with style wxTE_RICH -// which allows to put more than ~32Kb of text in it even under Win9x (NT -// doesn't have such limitation). -// -// Default is 1 for compilers which support it -// -// Recommended setting: 1, only set it to 0 if your compiler doesn't have -// or can't compile -#define wxUSE_RICHEDIT 1 - -// Set this to 1 to use extra features of richedit v2 and later controls -// -// Default is 1 for compilers which support it -// -// Recommended setting: 1 -#define wxUSE_RICHEDIT2 1 - -// Set this to 1 to enable support for the owner-drawn menu and listboxes. This -// is required by wxUSE_CHECKLISTBOX. -// -// Default is 1. -// -// Recommended setting: 1, set to 0 for a small library size reduction -#define wxUSE_OWNER_DRAWN 1 - -// Set this to 1 to enable MSW-specific wxTaskBarIcon::ShowBalloon() method. It -// is required by native wxNotificationMessage implementation. -// -// Default is 1 but disabled in wx/msw/chkconf.h if SDK is too old to contain -// the necessary declarations. -// -// Recommended setting: 1, set to 0 for a tiny library size reduction -#define wxUSE_TASKBARICON_BALLOONS 1 - -// Set to 1 to compile MS Windows XP theme engine support -#define wxUSE_UXTHEME 1 - -// Set to 1 to use InkEdit control (Tablet PC), if available -#define wxUSE_INKEDIT 0 - -// Set to 1 to enable .INI files based wxConfig implementation (wxIniConfig) -// -// Default is 0. -// -// Recommended setting: 0, nobody uses .INI files any more -#define wxUSE_INICONF 0 - -// ---------------------------------------------------------------------------- -// Generic versions of native controls -// ---------------------------------------------------------------------------- - -// Set this to 1 to be able to use wxDatePickerCtrlGeneric in addition to the -// native wxDatePickerCtrl -// -// Default is 0. -// -// Recommended setting: 0, this is mainly used for testing -#define wxUSE_DATEPICKCTRL_GENERIC 0 - -// Set this to 1 to be able to use wxTimePickerCtrlGeneric in addition to the -// native wxTimePickerCtrl for the platforms that have the latter (MSW). -// -// Default is 0. -// -// Recommended setting: 0, this is mainly used for testing -#define wxUSE_TIMEPICKCTRL_GENERIC 0 - -// ---------------------------------------------------------------------------- -// Crash debugging helpers -// ---------------------------------------------------------------------------- - -// Set this to 1 to be able to use wxCrashReport::Generate() to create mini -// dumps of your program when it crashes (or at any other moment) -// -// Default is 1 if supported by the compiler (VC++ and recent BC++ only). -// -// Recommended setting: 1, set to 0 if your programs never crash -#define wxUSE_CRASHREPORT 1 -/* --- end MSW options --- */ - -#endif // _WX_SETUP_H_ - diff --git a/Source/3rd Party/wx/lib/vc_lib/msw/wx/msw/rcdefs.h b/Source/3rd Party/wx/lib/vc_lib/msw/wx/msw/rcdefs.h deleted file mode 100644 index 66c9f7fcc..000000000 --- a/Source/3rd Party/wx/lib/vc_lib/msw/wx/msw/rcdefs.h +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - -#ifndef _WX_RCDEFS_H -#define _WX_RCDEFS_H - - -#define WX_MSC_FULL_VER 150030729 - - - - - - - - - - - - - - - -#define WX_CPU_X86 - - - - - - - - - - -#endif diff --git a/Source/3rd Party/wx/lib/vc_lib/msw/wx/setup.h b/Source/3rd Party/wx/lib/vc_lib/msw/wx/setup.h deleted file mode 100644 index acb2276b9..000000000 --- a/Source/3rd Party/wx/lib/vc_lib/msw/wx/setup.h +++ /dev/null @@ -1,1649 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/setup.h -// Purpose: Configuration for the library -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_SETUP_H_ -#define _WX_SETUP_H_ - -/* --- start common options --- */ -// ---------------------------------------------------------------------------- -// global settings -// ---------------------------------------------------------------------------- - -// define this to 0 when building wxBase library - this can also be done from -// makefile/project file overriding the value here -#ifndef wxUSE_GUI - #define wxUSE_GUI 1 -#endif // wxUSE_GUI - -// ---------------------------------------------------------------------------- -// compatibility settings -// ---------------------------------------------------------------------------- - -// This setting determines the compatibility with 2.6 API: set it to 0 to -// flag all cases of using deprecated functions. -// -// Default is 1 but please try building your code with 0 as the default will -// change to 0 in the next version and the deprecated functions will disappear -// in the version after it completely. -// -// Recommended setting: 0 (please update your code) -#define WXWIN_COMPATIBILITY_2_6 0 - -// This setting determines the compatibility with 2.8 API: set it to 0 to -// flag all cases of using deprecated functions. -// -// Default is 1 but please try building your code with 0 as the default will -// change to 0 in the next version and the deprecated functions will disappear -// in the version after it completely. -// -// Recommended setting: 0 (please update your code) -#define WXWIN_COMPATIBILITY_2_8 1 - -// MSW-only: Set to 0 for accurate dialog units, else 1 for old behaviour when -// default system font is used for wxWindow::GetCharWidth/Height() instead of -// the current font. -// -// Default is 0 -// -// Recommended setting: 0 -#define wxDIALOG_UNIT_COMPATIBILITY 0 - -// ---------------------------------------------------------------------------- -// debugging settings -// ---------------------------------------------------------------------------- - -// wxDEBUG_LEVEL will be defined as 1 in wx/debug.h so normally there is no -// need to define it here. You may do it for two reasons: either completely -// disable/compile out the asserts in release version (then do it inside #ifdef -// NDEBUG) or, on the contrary, enable more asserts, including the usually -// disabled ones, in the debug build (then do it inside #ifndef NDEBUG) -// -// #ifdef NDEBUG -// #define wxDEBUG_LEVEL 0 -// #else -// #define wxDEBUG_LEVEL 2 -// #endif - -// wxHandleFatalExceptions() may be used to catch the program faults at run -// time and, instead of terminating the program with a usual GPF message box, -// call the user-defined wxApp::OnFatalException() function. If you set -// wxUSE_ON_FATAL_EXCEPTION to 0, wxHandleFatalExceptions() will not work. -// -// This setting is for Win32 only and can only be enabled if your compiler -// supports Win32 structured exception handling (currently only VC++ does) -// -// Default is 1 -// -// Recommended setting: 1 if your compiler supports it. -#define wxUSE_ON_FATAL_EXCEPTION 1 - -// Set this to 1 to be able to generate a human-readable (unlike -// machine-readable minidump created by wxCrashReport::Generate()) stack back -// trace when your program crashes using wxStackWalker -// -// Default is 1 if supported by the compiler. -// -// Recommended setting: 1, set to 0 if your programs never crash -#define wxUSE_STACKWALKER 1 - -// Set this to 1 to compile in wxDebugReport class which allows you to create -// and optionally upload to your web site a debug report consisting of back -// trace of the crash (if wxUSE_STACKWALKER == 1) and other information. -// -// Default is 1 if supported by the compiler. -// -// Recommended setting: 1, it is compiled into a separate library so there -// is no overhead if you don't use it -#define wxUSE_DEBUGREPORT 1 - -// Generic comment about debugging settings: they are very useful if you don't -// use any other memory leak detection tools such as Purify/BoundsChecker, but -// are probably redundant otherwise. Also, Visual C++ CRT has the same features -// as wxWidgets memory debugging subsystem built in since version 5.0 and you -// may prefer to use it instead of built in memory debugging code because it is -// faster and more fool proof. -// -// Using VC++ CRT memory debugging is enabled by default in debug build (_DEBUG -// is defined) if wxUSE_GLOBAL_MEMORY_OPERATORS is *not* enabled (i.e. is 0) -// and if __NO_VC_CRTDBG__ is not defined. - -// The rest of the options in this section are obsolete and not supported, -// enable them at your own risk. - -// If 1, enables wxDebugContext, for writing error messages to file, etc. If -// __WXDEBUG__ is not defined, will still use the normal memory operators. -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_DEBUG_CONTEXT 0 - -// If 1, enables debugging versions of wxObject::new and wxObject::delete *IF* -// __WXDEBUG__ is also defined. -// -// WARNING: this code may not work with all architectures, especially if -// alignment is an issue. This switch is currently ignored for mingw / cygwin -// -// Default is 0 -// -// Recommended setting: 1 if you are not using a memory debugging tool, else 0 -#define wxUSE_MEMORY_TRACING 0 - -// In debug mode, cause new and delete to be redefined globally. -// If this causes problems (e.g. link errors which is a common problem -// especially if you use another library which also redefines the global new -// and delete), set this to 0. -// This switch is currently ignored for mingw / cygwin -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_GLOBAL_MEMORY_OPERATORS 0 - -// In debug mode, causes new to be defined to be WXDEBUG_NEW (see object.h). If -// this causes problems (e.g. link errors), set this to 0. You may need to set -// this to 0 if using templates (at least for VC++). This switch is currently -// ignored for MinGW/Cygwin. -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_DEBUG_NEW_ALWAYS 0 - - -// ---------------------------------------------------------------------------- -// Unicode support -// ---------------------------------------------------------------------------- - -// These settings are obsolete: the library is always built in Unicode mode -// now, only set wxUSE_UNICODE to 0 to compile legacy code in ANSI mode if -// absolutely necessary -- updating it is strongly recommended as the ANSI mode -// will disappear completely in future wxWidgets releases. -#ifndef wxUSE_UNICODE - #define wxUSE_UNICODE 1 -#endif - -// wxUSE_WCHAR_T is required by wxWidgets now, don't change. -#define wxUSE_WCHAR_T 1 - -// ---------------------------------------------------------------------------- -// global features -// ---------------------------------------------------------------------------- - -// Compile library in exception-safe mode? If set to 1, the library will try to -// behave correctly in presence of exceptions (even though it still will not -// use the exceptions itself) and notify the user code about any unhandled -// exceptions. If set to 0, propagation of the exceptions through the library -// code will lead to undefined behaviour -- but the code itself will be -// slightly smaller and faster. -// -// Note that like wxUSE_THREADS this option is automatically set to 0 if -// wxNO_EXCEPTIONS is defined. -// -// Default is 1 -// -// Recommended setting: depends on whether you intend to use C++ exceptions -// in your own code (1 if you do, 0 if you don't) -#define wxUSE_EXCEPTIONS 1 - -// Set wxUSE_EXTENDED_RTTI to 1 to use extended RTTI -// -// Default is 0 -// -// Recommended setting: 0 (this is still work in progress...) -#define wxUSE_EXTENDED_RTTI 0 - -// Support for message/error logging. This includes wxLogXXX() functions and -// wxLog and derived classes. Don't set this to 0 unless you really know what -// you are doing. -// -// Default is 1 -// -// Recommended setting: 1 (always) -#define wxUSE_LOG 1 - -// Recommended setting: 1 -#define wxUSE_LOGWINDOW 1 - -// Recommended setting: 1 -#define wxUSE_LOGGUI 1 - -// Recommended setting: 1 -#define wxUSE_LOG_DIALOG 1 - -// Support for command line parsing using wxCmdLineParser class. -// -// Default is 1 -// -// Recommended setting: 1 (can be set to 0 if you don't use the cmd line) -#define wxUSE_CMDLINE_PARSER 1 - -// Support for multithreaded applications: if 1, compile in thread classes -// (thread.h) and make the library a bit more thread safe. Although thread -// support is quite stable by now, you may still consider recompiling the -// library without it if you have no use for it - this will result in a -// somewhat smaller and faster operation. -// -// Notice that if wxNO_THREADS is defined, wxUSE_THREADS is automatically reset -// to 0 in wx/chkconf.h, so, for example, if you set USE_THREADS to 0 in -// build/msw/config.* file this value will have no effect. -// -// Default is 1 -// -// Recommended setting: 0 unless you do plan to develop MT applications -#define wxUSE_THREADS 1 - -// If enabled, compiles wxWidgets streams classes -// -// wx stream classes are used for image IO, process IO redirection, network -// protocols implementation and much more and so disabling this results in a -// lot of other functionality being lost. -// -// Default is 1 -// -// Recommended setting: 1 as setting it to 0 disables many other things -#define wxUSE_STREAMS 1 - -// Support for positional parameters (e.g. %1$d, %2$s ...) in wxVsnprintf. -// Note that if the system's implementation does not support positional -// parameters, setting this to 1 forces the use of the wxWidgets implementation -// of wxVsnprintf. The standard vsnprintf() supports positional parameters on -// many Unix systems but usually doesn't under Windows. -// -// Positional parameters are very useful when translating a program since using -// them in formatting strings allow translators to correctly reorder the -// translated sentences. -// -// Default is 1 -// -// Recommended setting: 1 if you want to support multiple languages -#define wxUSE_PRINTF_POS_PARAMS 1 - -// Enable the use of compiler-specific thread local storage keyword, if any. -// This is used for wxTLS_XXX() macros implementation and normally should use -// the compiler-provided support as it's simpler and more efficient, but must -// not use it if wxWidgets is used in a dynamically loaded Win32 (i.e. using -// LoadLibrary()/GetProcAddress()) as this triggers a bug in compiler TLS -// support that results in crashes when any TLS variables are used. So if you -// are building a Win32 DLL using wxWidgets that can be loaded dynamically, set -// this to 0. -// -// Default is 1, but set to 0 if the scenario above is applicable. -#define wxUSE_COMPILER_TLS 1 - -// ---------------------------------------------------------------------------- -// Interoperability with the standard library. -// ---------------------------------------------------------------------------- - -// Set wxUSE_STL to 1 to enable maximal interoperability with the standard -// library, even at the cost of backwards compatibility. -// -// Default is 0 -// -// Recommended setting: 0 as the options below already provide a relatively -// good level of interoperability and changing this option arguably isn't worth -// diverging from the official builds of the library. -#define wxUSE_STL 0 - -// This is not a real option but is used as the default value for -// wxUSE_STD_IOSTREAM, wxUSE_STD_STRING and wxUSE_STD_CONTAINERS. -// -// Currently the Digital Mars and Watcom compilers come without standard C++ -// library headers by default, wxUSE_STD_STRING can be set to 1 if you do have -// them (e.g. from STLPort). -// -// VC++ 5.0 does include standard C++ library headers, however they produce -// many warnings that can't be turned off when compiled at warning level 4. -#if defined(__DMC__) || defined(__WATCOMC__) \ - || (defined(_MSC_VER) && _MSC_VER < 1200) - #define wxUSE_STD_DEFAULT 0 -#else - #define wxUSE_STD_DEFAULT 1 -#endif - -// Use standard C++ containers to implement wxVector<>, wxStack<>, wxDList<> -// and wxHashXXX<> classes. If disabled, wxWidgets own (mostly compatible but -// usually more limited) implementations are used which allows to avoid the -// dependency on the C++ run-time library. -// -// Notice that the compilers mentioned in wxUSE_STD_DEFAULT comment above don't -// support using standard containers and that VC6 needs non-default options for -// such build to avoid getting "fatal error C1076: compiler limit : internal -// heap limit reached; use /Zm to specify a higher limit" in its own standard -// headers, so you need to ensure you do increase the heap size before enabling -// this option for this compiler. -// -// Default is 0 for compatibility reasons. -// -// Recommended setting: 1 unless compatibility with the official wxWidgets -// build and/or the existing code is a concern. -#define wxUSE_STD_CONTAINERS 0 - -// Use standard C++ streams if 1 instead of wx streams in some places. If -// disabled, wx streams are used everywhere and wxWidgets doesn't depend on the -// standard streams library. -// -// Notice that enabling this does not replace wx streams with std streams -// everywhere, in a lot of places wx streams are used no matter what. -// -// Default is 1 if compiler supports it. -// -// Recommended setting: 1 if you use the standard streams anyhow and so -// dependency on the standard streams library is not a -// problem -#define wxUSE_STD_IOSTREAM wxUSE_STD_DEFAULT - -// Enable minimal interoperability with the standard C++ string class if 1. -// "Minimal" means that wxString can be constructed from std::string or -// std::wstring but can't be implicitly converted to them. You need to enable -// the option below for the latter. -// -// Default is 1 for most compilers. -// -// Recommended setting: 1 unless you want to ensure your program doesn't use -// the standard C++ library at all. -#define wxUSE_STD_STRING wxUSE_STD_DEFAULT - -// Make wxString as much interchangeable with std::[w]string as possible, in -// particular allow implicit conversion of wxString to either of these classes. -// This comes at a price (or a benefit, depending on your point of view) of not -// allowing implicit conversion to "const char *" and "const wchar_t *". -// -// Because a lot of existing code relies on these conversions, this option is -// disabled by default but can be enabled for your build if you don't care -// about compatibility. -// -// Default is 0 if wxUSE_STL has its default value or 1 if it is enabled. -// -// Recommended setting: 0 to remain compatible with the official builds of -// wxWidgets. -#define wxUSE_STD_STRING_CONV_IN_WXSTRING wxUSE_STL - -// VC++ 4.2 and above allows and but you can't mix -// them. Set this option to 1 to use , 0 to use . -// -// Note that newer compilers (including VC++ 7.1 and later) don't support -// wxUSE_IOSTREAMH == 1 and so will be used anyhow. -// -// Default is 0. -// -// Recommended setting: 0, only set to 1 if you use a really old compiler -#define wxUSE_IOSTREAMH 0 - - -// ---------------------------------------------------------------------------- -// non GUI features selection -// ---------------------------------------------------------------------------- - -// Set wxUSE_LONGLONG to 1 to compile the wxLongLong class. This is a 64 bit -// integer which is implemented in terms of native 64 bit integers if any or -// uses emulation otherwise. -// -// This class is required by wxDateTime and so you should enable it if you want -// to use wxDateTime. For most modern platforms, it will use the native 64 bit -// integers in which case (almost) all of its functions are inline and it -// almost does not take any space, so there should be no reason to switch it -// off. -// -// Recommended setting: 1 -#define wxUSE_LONGLONG 1 - -// Set wxUSE_BASE64 to 1, to compile in Base64 support. This is required for -// storing binary data in wxConfig on most platforms. -// -// Default is 1. -// -// Recommended setting: 1 (but can be safely disabled if you don't use it) -#define wxUSE_BASE64 1 - -// Set this to 1 to be able to use wxEventLoop even in console applications -// (i.e. using base library only, without GUI). This is mostly useful for -// processing socket events but is also necessary to use timers in console -// applications -// -// Default is 1. -// -// Recommended setting: 1 (but can be safely disabled if you don't use it) -#define wxUSE_CONSOLE_EVENTLOOP 1 - -// Set wxUSE_(F)FILE to 1 to compile wx(F)File classes. wxFile uses low level -// POSIX functions for file access, wxFFile uses ANSI C stdio.h functions. -// -// Default is 1 -// -// Recommended setting: 1 (wxFile is highly recommended as it is required by -// i18n code, wxFileConfig and others) -#define wxUSE_FILE 1 -#define wxUSE_FFILE 1 - -// Use wxFSVolume class providing access to the configured/active mount points -// -// Default is 1 -// -// Recommended setting: 1 (but may be safely disabled if you don't use it) -#define wxUSE_FSVOLUME 1 - -// Use wxStandardPaths class which allows to retrieve some standard locations -// in the file system -// -// Default is 1 -// -// Recommended setting: 1 (may be disabled to save space, but not much) -#define wxUSE_STDPATHS 1 - -// use wxTextBuffer class: required by wxTextFile -#define wxUSE_TEXTBUFFER 1 - -// use wxTextFile class: requires wxFile and wxTextBuffer, required by -// wxFileConfig -#define wxUSE_TEXTFILE 1 - -// i18n support: _() macro, wxLocale class. Requires wxTextFile. -#define wxUSE_INTL 1 - -// Provide wxFoo_l() functions similar to standard foo() functions but taking -// an extra locale parameter. -// -// Notice that this is fully implemented only for the systems providing POSIX -// xlocale support or Microsoft Visual C++ >= 8 (which provides proprietary -// almost-equivalent of xlocale functions), otherwise wxFoo_l() functions will -// only work for the current user locale and "C" locale. You can use -// wxHAS_XLOCALE_SUPPORT to test whether the full support is available. -// -// Default is 1 -// -// Recommended setting: 1 but may be disabled if you are writing programs -// running only in C locale anyhow -#define wxUSE_XLOCALE 1 - -// Set wxUSE_DATETIME to 1 to compile the wxDateTime and related classes which -// allow to manipulate dates, times and time intervals. wxDateTime replaces the -// old wxTime and wxDate classes which are still provided for backwards -// compatibility (and implemented in terms of wxDateTime). -// -// Note that this class is relatively new and is still officially in alpha -// stage because some features are not yet (fully) implemented. It is already -// quite useful though and should only be disabled if you are aiming at -// absolutely minimal version of the library. -// -// Requires: wxUSE_LONGLONG -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_DATETIME 1 - -// Set wxUSE_TIMER to 1 to compile wxTimer class -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_TIMER 1 - -// Use wxStopWatch clas. -// -// Default is 1 -// -// Recommended setting: 1 (needed by wxSocket) -#define wxUSE_STOPWATCH 1 - -// Set wxUSE_FSWATCHER to 1 if you want to enable wxFileSystemWatcher -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_FSWATCHER 1 - -// Setting wxUSE_CONFIG to 1 enables the use of wxConfig and related classes -// which allow the application to store its settings in the persistent -// storage. Setting this to 1 will also enable on-demand creation of the -// global config object in wxApp. -// -// See also wxUSE_CONFIG_NATIVE below. -// -// Recommended setting: 1 -#define wxUSE_CONFIG 1 - -// If wxUSE_CONFIG is 1, you may choose to use either the native config -// classes under Windows (using .INI files under Win16 and the registry under -// Win32) or the portable text file format used by the config classes under -// Unix. -// -// Default is 1 to use native classes. Note that you may still use -// wxFileConfig even if you set this to 1 - just the config object created by -// default for the applications needs will be a wxRegConfig or wxIniConfig and -// not wxFileConfig. -// -// Recommended setting: 1 -#define wxUSE_CONFIG_NATIVE 1 - -// If wxUSE_DIALUP_MANAGER is 1, compile in wxDialUpManager class which allows -// to connect/disconnect from the network and be notified whenever the dial-up -// network connection is established/terminated. Requires wxUSE_DYNAMIC_LOADER. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_DIALUP_MANAGER 1 - -// Compile in classes for run-time DLL loading and function calling. -// Required by wxUSE_DIALUP_MANAGER. -// -// This setting is for Win32 only -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_DYNLIB_CLASS 1 - -// experimental, don't use for now -#define wxUSE_DYNAMIC_LOADER 1 - -// Set to 1 to use socket classes -#define wxUSE_SOCKETS 1 - -// Set to 1 to use ipv6 socket classes (requires wxUSE_SOCKETS) -// -// Notice that currently setting this option under Windows will result in -// programs which can only run on recent OS versions (with ws2_32.dll -// installed) which is why it is disabled by default. -// -// Default is 1. -// -// Recommended setting: 1 if you need IPv6 support -#define wxUSE_IPV6 0 - -// Set to 1 to enable virtual file systems (required by wxHTML) -#define wxUSE_FILESYSTEM 1 - -// Set to 1 to enable virtual ZIP filesystem (requires wxUSE_FILESYSTEM) -#define wxUSE_FS_ZIP 1 - -// Set to 1 to enable virtual archive filesystem (requires wxUSE_FILESYSTEM) -#define wxUSE_FS_ARCHIVE 1 - -// Set to 1 to enable virtual Internet filesystem (requires wxUSE_FILESYSTEM) -#define wxUSE_FS_INET 1 - -// wxArchive classes for accessing archives such as zip and tar -#define wxUSE_ARCHIVE_STREAMS 1 - -// Set to 1 to compile wxZipInput/OutputStream classes. -#define wxUSE_ZIPSTREAM 1 - -// Set to 1 to compile wxTarInput/OutputStream classes. -#define wxUSE_TARSTREAM 1 - -// Set to 1 to compile wxZlibInput/OutputStream classes. Also required by -// wxUSE_LIBPNG -#define wxUSE_ZLIB 1 - -// If enabled, the code written by Apple will be used to write, in a portable -// way, float on the disk. See extended.c for the license which is different -// from wxWidgets one. -// -// Default is 1. -// -// Recommended setting: 1 unless you don't like the license terms (unlikely) -#define wxUSE_APPLE_IEEE 1 - -// Joystick support class -#define wxUSE_JOYSTICK 1 - -// wxFontEnumerator class -#define wxUSE_FONTENUM 1 - -// wxFontMapper class -#define wxUSE_FONTMAP 1 - -// wxMimeTypesManager class -#define wxUSE_MIMETYPE 1 - -// wxProtocol and related classes: if you want to use either of wxFTP, wxHTTP -// or wxURL you need to set this to 1. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_PROTOCOL 1 - -// The settings for the individual URL schemes -#define wxUSE_PROTOCOL_FILE 1 -#define wxUSE_PROTOCOL_FTP 1 -#define wxUSE_PROTOCOL_HTTP 1 - -// Define this to use wxURL class. -#define wxUSE_URL 1 - -// Define this to use native platform url and protocol support. -// Currently valid only for MS-Windows. -// Note: if you set this to 1, you can open ftp/http/gopher sites -// and obtain a valid input stream for these sites -// even when you set wxUSE_PROTOCOL_FTP/HTTP to 0. -// Doing so reduces the code size. -// -// This code is experimental and subject to change. -#define wxUSE_URL_NATIVE 0 - -// Support for wxVariant class used in several places throughout the library, -// notably in wxDataViewCtrl API. -// -// Default is 1. -// -// Recommended setting: 1 unless you want to reduce the library size as much as -// possible in which case setting this to 0 can gain up to 100KB. -#define wxUSE_VARIANT 1 - -// Support for wxAny class, the successor for wxVariant. -// -// Default is 1. -// -// Recommended setting: 1 unless you want to reduce the library size by a small amount, -// or your compiler cannot for some reason cope with complexity of templates used. -#define wxUSE_ANY 1 - -// Support for regular expression matching via wxRegEx class: enable this to -// use POSIX regular expressions in your code. You need to compile regex -// library from src/regex to use it under Windows. -// -// Default is 0 -// -// Recommended setting: 1 if your compiler supports it, if it doesn't please -// contribute us a makefile for src/regex for it -#define wxUSE_REGEX 1 - -// wxSystemOptions class -#define wxUSE_SYSTEM_OPTIONS 1 - -// wxSound class -#define wxUSE_SOUND 1 - -// Use wxMediaCtrl -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_MEDIACTRL 1 - -// Use wxWidget's XRC XML-based resource system. Recommended. -// -// Default is 1 -// -// Recommended setting: 1 (requires wxUSE_XML) -#define wxUSE_XRC 1 - -// XML parsing classes. Note that their API will change in the future, so -// using wxXmlDocument and wxXmlNode in your app is not recommended. -// -// Default is the same as wxUSE_XRC, i.e. 1 by default. -// -// Recommended setting: 1 (required by XRC) -#define wxUSE_XML wxUSE_XRC - -// Use wxWidget's AUI docking system -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_AUI 1 - -// Use wxWidget's Ribbon classes for interfaces -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_RIBBON 1 - -// Use wxPropertyGrid. -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_PROPGRID 1 - -// Use wxStyledTextCtrl, a wxWidgets implementation of Scintilla. -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_STC 1 - -// Use wxWidget's web viewing classes -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_WEBVIEW 1 - -// Use the IE wxWebView backend -// -// Default is 1 on MSW -// -// Recommended setting: 1 -#ifdef __WXMSW__ -#define wxUSE_WEBVIEW_IE 1 -#else -#define wxUSE_WEBVIEW_IE 0 -#endif - -// Use the WebKit wxWebView backend -// -// Default is 1 on GTK and OSX -// -// Recommended setting: 1 -#if defined(__WXGTK__) || defined(__WXOSX__) -#define wxUSE_WEBVIEW_WEBKIT 1 -#else -#define wxUSE_WEBVIEW_WEBKIT 0 -#endif - -// Enable the new wxGraphicsPath and wxGraphicsContext classes for an advanced -// 2D drawing API. (Still somewhat experimental) -// -// Please note that on Windows gdiplus.dll is loaded dynamically which means -// that nothing special needs to be done as long as you don't use -// wxGraphicsContext at all or only use it on XP and later systems but you -// still do need to distribute it yourself for an application using -// wxGraphicsContext to be runnable on pre-XP systems. -// -// Default is 1 except if you're using a non-Microsoft compiler under Windows -// as only MSVC7+ is known to ship with gdiplus.h. For other compilers (e.g. -// mingw32) you may need to install the headers (and just the headers) -// yourself. If you do, change the setting below manually. -// -// Recommended setting: 1 if supported by the compilation environment - -// notice that we can't use wxCHECK_VISUALC_VERSION() here as this file is -// included from wx/platform.h before wxCHECK_VISUALC_VERSION() is defined -#ifdef _MSC_VER -# if _MSC_VER >= 1310 - // MSVC7.1+ comes with new enough Platform SDK, enable - // wxGraphicsContext support for it -# define wxUSE_GRAPHICS_CONTEXT 1 -# else - // MSVC 6 didn't include GDI+ headers so disable by default, enable it - // here if you use MSVC 6 with a newer SDK -# define wxUSE_GRAPHICS_CONTEXT 0 -# endif -#else - // Disable support for other Windows compilers, enable it if your compiler - // comes with new enough SDK or you installed the headers manually. - // - // Notice that this will be set by configure under non-Windows platforms - // anyhow so the value there is not important. -# define wxUSE_GRAPHICS_CONTEXT 0 -#endif - -// Enable wxGraphicsContext implementation using Cairo library. -// -// This is not needed under Windows and detected automatically by configure -// under other systems, however you may set this to 1 manually if you installed -// Cairo under Windows yourself and prefer to use it instead the native GDI+ -// implementation. -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_CAIRO 0 - - -// ---------------------------------------------------------------------------- -// Individual GUI controls -// ---------------------------------------------------------------------------- - -// You must set wxUSE_CONTROLS to 1 if you are using any controls at all -// (without it, wxControl class is not compiled) -// -// Default is 1 -// -// Recommended setting: 1 (don't change except for very special programs) -#define wxUSE_CONTROLS 1 - -// Support markup in control labels, i.e. provide wxControl::SetLabelMarkup(). -// Currently markup is supported only by a few controls and only some ports but -// their number will increase with time. -// -// Default is 1 -// -// Recommended setting: 1 (may be set to 0 if you want to save on code size) -#define wxUSE_MARKUP 1 - -// wxPopupWindow class is a top level transient window. It is currently used -// to implement wxTipWindow -// -// Default is 1 -// -// Recommended setting: 1 (may be set to 0 if you don't wxUSE_TIPWINDOW) -#define wxUSE_POPUPWIN 1 - -// wxTipWindow allows to implement the custom tooltips, it is used by the -// context help classes. Requires wxUSE_POPUPWIN. -// -// Default is 1 -// -// Recommended setting: 1 (may be set to 0) -#define wxUSE_TIPWINDOW 1 - -// Each of the settings below corresponds to one wxWidgets control. They are -// all switched on by default but may be disabled if you are sure that your -// program (including any standard dialogs it can show!) doesn't need them and -// if you desperately want to save some space. If you use any of these you must -// set wxUSE_CONTROLS as well. -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_ANIMATIONCTRL 1 // wxAnimationCtrl -#define wxUSE_BANNERWINDOW 1 // wxBannerWindow -#define wxUSE_BUTTON 1 // wxButton -#define wxUSE_BMPBUTTON 1 // wxBitmapButton -#define wxUSE_CALENDARCTRL 1 // wxCalendarCtrl -#define wxUSE_CHECKBOX 1 // wxCheckBox -#define wxUSE_CHECKLISTBOX 1 // wxCheckListBox (requires wxUSE_OWNER_DRAWN) -#define wxUSE_CHOICE 1 // wxChoice -#define wxUSE_COLLPANE 1 // wxCollapsiblePane -#define wxUSE_COLOURPICKERCTRL 1 // wxColourPickerCtrl -#define wxUSE_COMBOBOX 1 // wxComboBox -#define wxUSE_COMMANDLINKBUTTON 1 // wxCommandLinkButton -#define wxUSE_DATAVIEWCTRL 1 // wxDataViewCtrl -#define wxUSE_DATEPICKCTRL 1 // wxDatePickerCtrl -#define wxUSE_DIRPICKERCTRL 1 // wxDirPickerCtrl -#define wxUSE_EDITABLELISTBOX 1 // wxEditableListBox -#define wxUSE_FILECTRL 1 // wxFileCtrl -#define wxUSE_FILEPICKERCTRL 1 // wxFilePickerCtrl -#define wxUSE_FONTPICKERCTRL 1 // wxFontPickerCtrl -#define wxUSE_GAUGE 1 // wxGauge -#define wxUSE_HEADERCTRL 1 // wxHeaderCtrl -#define wxUSE_HYPERLINKCTRL 1 // wxHyperlinkCtrl -#define wxUSE_LISTBOX 1 // wxListBox -#define wxUSE_LISTCTRL 1 // wxListCtrl -#define wxUSE_RADIOBOX 1 // wxRadioBox -#define wxUSE_RADIOBTN 1 // wxRadioButton -#define wxUSE_RICHMSGDLG 1 // wxRichMessageDialog -#define wxUSE_SCROLLBAR 1 // wxScrollBar -#define wxUSE_SEARCHCTRL 1 // wxSearchCtrl -#define wxUSE_SLIDER 1 // wxSlider -#define wxUSE_SPINBTN 1 // wxSpinButton -#define wxUSE_SPINCTRL 1 // wxSpinCtrl -#define wxUSE_STATBOX 1 // wxStaticBox -#define wxUSE_STATLINE 1 // wxStaticLine -#define wxUSE_STATTEXT 1 // wxStaticText -#define wxUSE_STATBMP 1 // wxStaticBitmap -#define wxUSE_TEXTCTRL 1 // wxTextCtrl -#define wxUSE_TIMEPICKCTRL 1 // wxTimePickerCtrl -#define wxUSE_TOGGLEBTN 1 // requires wxButton -#define wxUSE_TREECTRL 1 // wxTreeCtrl -#define wxUSE_TREELISTCTRL 1 // wxTreeListCtrl - -// Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR -// below either wxStatusBar95 or a generic wxStatusBar will be used. -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_STATUSBAR 1 - -// Two status bar implementations are available under Win32: the generic one -// or the wrapper around native control. For native look and feel the native -// version should be used. -// -// Default is 1 for the platforms where native status bar is supported. -// -// Recommended setting: 1 (there is no advantage in using the generic one) -#define wxUSE_NATIVE_STATUSBAR 1 - -// wxToolBar related settings: if wxUSE_TOOLBAR is 0, don't compile any toolbar -// classes at all. Otherwise, use the native toolbar class unless -// wxUSE_TOOLBAR_NATIVE is 0. -// -// Default is 1 for all settings. -// -// Recommended setting: 1 for wxUSE_TOOLBAR and wxUSE_TOOLBAR_NATIVE. -#define wxUSE_TOOLBAR 1 -#define wxUSE_TOOLBAR_NATIVE 1 - -// wxNotebook is a control with several "tabs" located on one of its sides. It -// may be used to logically organise the data presented to the user instead of -// putting everything in one huge dialog. It replaces wxTabControl and related -// classes of wxWin 1.6x. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_NOTEBOOK 1 - -// wxListbook control is similar to wxNotebook but uses wxListCtrl instead of -// the tabs -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_LISTBOOK 1 - -// wxChoicebook control is similar to wxNotebook but uses wxChoice instead of -// the tabs -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_CHOICEBOOK 1 - -// wxTreebook control is similar to wxNotebook but uses wxTreeCtrl instead of -// the tabs -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_TREEBOOK 1 - -// wxToolbook control is similar to wxNotebook but uses wxToolBar instead of -// tabs -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_TOOLBOOK 1 - -// wxTaskBarIcon is a small notification icon shown in the system toolbar or -// dock. -// -// Default is 1. -// -// Recommended setting: 1 (but can be set to 0 if you don't need it) -#define wxUSE_TASKBARICON 1 - -// wxGrid class -// -// Default is 1, set to 0 to cut down compilation time and binaries size if you -// don't use it. -// -// Recommended setting: 1 -// -#define wxUSE_GRID 1 - -// wxMiniFrame class: a frame with narrow title bar -// -// Default is 1. -// -// Recommended setting: 1 (it doesn't cost almost anything) -#define wxUSE_MINIFRAME 1 - -// wxComboCtrl and related classes: combobox with custom popup window and -// not necessarily a listbox. -// -// Default is 1. -// -// Recommended setting: 1 but can be safely set to 0 except for wxUniv where it -// it used by wxComboBox -#define wxUSE_COMBOCTRL 1 - -// wxOwnerDrawnComboBox is a custom combobox allowing to paint the combobox -// items. -// -// Default is 1. -// -// Recommended setting: 1 but can be safely set to 0, except where it is -// needed as a base class for generic wxBitmapComboBox. -#define wxUSE_ODCOMBOBOX 1 - -// wxBitmapComboBox is a combobox that can have images in front of text items. -// -// Default is 1. -// -// Recommended setting: 1 but can be safely set to 0 -#define wxUSE_BITMAPCOMBOBOX 1 - -// wxRearrangeCtrl is a wxCheckListBox with two buttons allowing to move items -// up and down in it. It is also used as part of wxRearrangeDialog. -// -// Default is 1. -// -// Recommended setting: 1 but can be safely set to 0 (currently used only by -// wxHeaderCtrl) -#define wxUSE_REARRANGECTRL 1 - -// ---------------------------------------------------------------------------- -// Miscellaneous GUI stuff -// ---------------------------------------------------------------------------- - -// wxAcceleratorTable/Entry classes and support for them in wxMenu(Bar) -#define wxUSE_ACCEL 1 - -// Use the standard art provider. The icons returned by this provider are -// embedded into the library as XPMs so disabling it reduces the library size -// somewhat but this should only be done if you use your own custom art -// provider returning the icons or never use any icons not provided by the -// native art provider (which might not be implemented at all for some -// platforms) or by the Tango icons provider (if it's not itself disabled -// below). -// -// Default is 1. -// -// Recommended setting: 1 unless you use your own custom art provider. -#define wxUSE_ARTPROVIDER_STD 1 - -// Use art provider providing Tango icons: this art provider has higher quality -// icons than the default ones using smaller size XPM icons without -// transparency but the embedded PNG icons add to the library size. -// -// Default is 1 under non-GTK ports. Under wxGTK the native art provider using -// the GTK+ stock icons replaces it so it is normally not necessary. -// -// Recommended setting: 1 but can be turned off to reduce the library size. -#define wxUSE_ARTPROVIDER_TANGO 1 - -// Hotkey support (currently Windows only) -#define wxUSE_HOTKEY 1 - -// Use wxCaret: a class implementing a "cursor" in a text control (called caret -// under Windows). -// -// Default is 1. -// -// Recommended setting: 1 (can be safely set to 0, not used by the library) -#define wxUSE_CARET 1 - -// Use wxDisplay class: it allows enumerating all displays on a system and -// their geometries as well as finding the display on which the given point or -// window lies. -// -// Default is 1. -// -// Recommended setting: 1 if you need it, can be safely set to 0 otherwise -#define wxUSE_DISPLAY 1 - -// Miscellaneous geometry code: needed for Canvas library -#define wxUSE_GEOMETRY 1 - -// Use wxImageList. This class is needed by wxNotebook, wxTreeCtrl and -// wxListCtrl. -// -// Default is 1. -// -// Recommended setting: 1 (set it to 0 if you don't use any of the controls -// enumerated above, then this class is mostly useless too) -#define wxUSE_IMAGLIST 1 - -// Use wxInfoBar class. -// -// Default is 1. -// -// Recommended setting: 1 (but can be disabled without problems as nothing -// depends on it) -#define wxUSE_INFOBAR 1 - -// Use wxMenu, wxMenuBar, wxMenuItem. -// -// Default is 1. -// -// Recommended setting: 1 (can't be disabled under MSW) -#define wxUSE_MENUS 1 - -// Use wxNotificationMessage. -// -// wxNotificationMessage allows to show non-intrusive messages to the user -// using balloons, banners, popups or whatever is the appropriate method for -// the current platform. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_NOTIFICATION_MESSAGE 1 - -// wxRichToolTip is a customizable tooltip class which has more functionality -// than the stock (but native, unlike this class) wxToolTip. -// -// Default is 1. -// -// Recommended setting: 1 (but can be safely set to 0 if you don't need it) -#define wxUSE_RICHTOOLTIP 1 - -// Use wxSashWindow class. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_SASH 1 - -// Use wxSplitterWindow class. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_SPLITTER 1 - -// Use wxToolTip and wxWindow::Set/GetToolTip() methods. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_TOOLTIPS 1 - -// wxValidator class and related methods -#define wxUSE_VALIDATORS 1 - -// Use reference counted ID management: this means that wxWidgets will track -// the automatically allocated ids (those used when you use wxID_ANY when -// creating a window, menu or toolbar item &c) instead of just supposing that -// the program never runs out of them. This is mostly useful only under wxMSW -// where the total ids range is limited to SHRT_MIN..SHRT_MAX and where -// long-running programs can run into problems with ids reuse without this. On -// the other platforms, where the ids have the full int range, this shouldn't -// be necessary. -#ifdef __WXMSW__ -#define wxUSE_AUTOID_MANAGEMENT 1 -#else -#define wxUSE_AUTOID_MANAGEMENT 0 -#endif - -// ---------------------------------------------------------------------------- -// common dialogs -// ---------------------------------------------------------------------------- - -// On rare occasions (e.g. using DJGPP) may want to omit common dialogs (e.g. -// file selector, printer dialog). Switching this off also switches off the -// printing architecture and interactive wxPrinterDC. -// -// Default is 1 -// -// Recommended setting: 1 (unless it really doesn't work) -#define wxUSE_COMMON_DIALOGS 1 - -// wxBusyInfo displays window with message when app is busy. Works in same way -// as wxBusyCursor -#define wxUSE_BUSYINFO 1 - -// Use single/multiple choice dialogs. -// -// Default is 1 -// -// Recommended setting: 1 (used in the library itself) -#define wxUSE_CHOICEDLG 1 - -// Use colour picker dialog -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_COLOURDLG 1 - -// wxDirDlg class for getting a directory name from user -#define wxUSE_DIRDLG 1 - -// TODO: setting to choose the generic or native one - -// Use file open/save dialogs. -// -// Default is 1 -// -// Recommended setting: 1 (used in many places in the library itself) -#define wxUSE_FILEDLG 1 - -// Use find/replace dialogs. -// -// Default is 1 -// -// Recommended setting: 1 (but may be safely set to 0) -#define wxUSE_FINDREPLDLG 1 - -// Use font picker dialog -// -// Default is 1 -// -// Recommended setting: 1 (used in the library itself) -#define wxUSE_FONTDLG 1 - -// Use wxMessageDialog and wxMessageBox. -// -// Default is 1 -// -// Recommended setting: 1 (used in the library itself) -#define wxUSE_MSGDLG 1 - -// progress dialog class for lengthy operations -#define wxUSE_PROGRESSDLG 1 - -// support for startup tips (wxShowTip &c) -#define wxUSE_STARTUP_TIPS 1 - -// text entry dialog and wxGetTextFromUser function -#define wxUSE_TEXTDLG 1 - -// number entry dialog -#define wxUSE_NUMBERDLG 1 - -// splash screen class -#define wxUSE_SPLASH 1 - -// wizards -#define wxUSE_WIZARDDLG 1 - -// Compile in wxAboutBox() function showing the standard "About" dialog. -// -// Default is 1 -// -// Recommended setting: 1 but can be set to 0 to save some space if you don't -// use this function -#define wxUSE_ABOUTDLG 1 - -// wxFileHistory class -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_FILE_HISTORY 1 - -// ---------------------------------------------------------------------------- -// Metafiles support -// ---------------------------------------------------------------------------- - -// Windows supports the graphics format known as metafile which is, though not -// portable, is widely used under Windows and so is supported by wxWin (under -// Windows only, of course). Win16 (Win3.1) used the so-called "Window -// MetaFiles" or WMFs which were replaced with "Enhanced MetaFiles" or EMFs in -// Win32 (Win9x, NT, 2000). Both of these are supported in wxWin and, by -// default, WMFs will be used under Win16 and EMFs under Win32. This may be -// changed by setting wxUSE_WIN_METAFILES_ALWAYS to 1 and/or setting -// wxUSE_ENH_METAFILE to 0. You may also set wxUSE_METAFILE to 0 to not compile -// in any metafile related classes at all. -// -// Default is 1 for wxUSE_ENH_METAFILE and 0 for wxUSE_WIN_METAFILES_ALWAYS. -// -// Recommended setting: default or 0 for everything for portable programs. -#define wxUSE_METAFILE 1 -#define wxUSE_ENH_METAFILE 1 -#define wxUSE_WIN_METAFILES_ALWAYS 0 - -// ---------------------------------------------------------------------------- -// Big GUI components -// ---------------------------------------------------------------------------- - -// Set to 0 to disable MDI support. -// -// Requires wxUSE_NOTEBOOK under platforms other than MSW. -// -// Default is 1. -// -// Recommended setting: 1, can be safely set to 0. -#define wxUSE_MDI 1 - -// Set to 0 to disable document/view architecture -#define wxUSE_DOC_VIEW_ARCHITECTURE 1 - -// Set to 0 to disable MDI document/view architecture -// -// Requires wxUSE_MDI && wxUSE_DOC_VIEW_ARCHITECTURE -#define wxUSE_MDI_ARCHITECTURE 1 - -// Set to 0 to disable print/preview architecture code -#define wxUSE_PRINTING_ARCHITECTURE 1 - -// wxHTML sublibrary allows to display HTML in wxWindow programs and much, -// much more. -// -// Default is 1. -// -// Recommended setting: 1 (wxHTML is great!), set to 0 if you want compile a -// smaller library. -#define wxUSE_HTML 1 - -// Setting wxUSE_GLCANVAS to 1 enables OpenGL support. You need to have OpenGL -// headers and libraries to be able to compile the library with wxUSE_GLCANVAS -// set to 1 and, under Windows, also to add opengl32.lib and glu32.lib to the -// list of libraries used to link your application (although this is done -// implicitly for Microsoft Visual C++ users). -// -// Default is 1 unless the compiler is known to ship without the necessary -// headers (Digital Mars) or the platform doesn't support OpenGL (Windows CE). -// -// Recommended setting: 1 if you intend to use OpenGL, can be safely set to 0 -// otherwise. -#define wxUSE_GLCANVAS 1 - -// wxRichTextCtrl allows editing of styled text. -// -// Default is 1. -// -// Recommended setting: 1, set to 0 if you want compile a -// smaller library. -#define wxUSE_RICHTEXT 1 - -// ---------------------------------------------------------------------------- -// Data transfer -// ---------------------------------------------------------------------------- - -// Use wxClipboard class for clipboard copy/paste. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_CLIPBOARD 1 - -// Use wxDataObject and related classes. Needed for clipboard and OLE drag and -// drop -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_DATAOBJ 1 - -// Use wxDropTarget and wxDropSource classes for drag and drop (this is -// different from "built in" drag and drop in wxTreeCtrl which is always -// available). Requires wxUSE_DATAOBJ. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_DRAG_AND_DROP 1 - -// Use wxAccessible for enhanced and customisable accessibility. -// Depends on wxUSE_OLE. -// -// Default is 0. -// -// Recommended setting (at present): 0 -#define wxUSE_ACCESSIBILITY 0 - -// ---------------------------------------------------------------------------- -// miscellaneous settings -// ---------------------------------------------------------------------------- - -// wxSingleInstanceChecker class allows to verify at startup if another program -// instance is running. -// -// Default is 1 -// -// Recommended setting: 1 (the class is tiny, disabling it won't save much -// space) -#define wxUSE_SNGLINST_CHECKER 1 - -#define wxUSE_DRAGIMAGE 1 - -#define wxUSE_IPC 1 - // 0 for no interprocess comms -#define wxUSE_HELP 1 - // 0 for no help facility - -// Should we use MS HTML help for wxHelpController? If disabled, neither -// wxCHMHelpController nor wxBestHelpController are available. -// -// Default is 1 under MSW, 0 is always used for the other platforms. -// -// Recommended setting: 1, only set to 0 if you have trouble compiling -// wxCHMHelpController (could be a problem with really ancient compilers) -#define wxUSE_MS_HTML_HELP 1 - - -// Use wxHTML-based help controller? -#define wxUSE_WXHTML_HELP 1 - -#define wxUSE_CONSTRAINTS 1 - // 0 for no window layout constraint system - -#define wxUSE_SPLINES 1 - // 0 for no splines - -#define wxUSE_MOUSEWHEEL 1 - // Include mouse wheel support - -// Compile wxUIActionSimulator class? -#define wxUSE_UIACTIONSIMULATOR 1 - -// ---------------------------------------------------------------------------- -// wxDC classes for various output formats -// ---------------------------------------------------------------------------- - -// Set to 1 for PostScript device context. -#define wxUSE_POSTSCRIPT 0 - -// Set to 1 to use font metric files in GetTextExtent -#define wxUSE_AFM_FOR_POSTSCRIPT 1 - -// Set to 1 to compile in support for wxSVGFileDC, a wxDC subclass which allows -// to create files in SVG (Scalable Vector Graphics) format. -#define wxUSE_SVG 1 - -// Should wxDC provide SetTransformMatrix() and related methods? -// -// Default is 1 but can be set to 0 if this functionality is not used. Notice -// that currently only wxMSW supports this so setting this to 0 doesn't change -// much for non-MSW platforms (although it will still save a few bytes -// probably). -// -// Recommended setting: 1. -#define wxUSE_DC_TRANSFORM_MATRIX 1 - -// ---------------------------------------------------------------------------- -// image format support -// ---------------------------------------------------------------------------- - -// wxImage supports many different image formats which can be configured at -// compile-time. BMP is always supported, others are optional and can be safely -// disabled if you don't plan to use images in such format sometimes saving -// substantial amount of code in the final library. -// -// Some formats require an extra library which is included in wxWin sources -// which is mentioned if it is the case. - -// Set to 1 for wxImage support (recommended). -#define wxUSE_IMAGE 1 - -// Set to 1 for PNG format support (requires libpng). Also requires wxUSE_ZLIB. -#define wxUSE_LIBPNG 1 - -// Set to 1 for JPEG format support (requires libjpeg) -#define wxUSE_LIBJPEG 1 - -// Set to 1 for TIFF format support (requires libtiff) -#define wxUSE_LIBTIFF 1 - -// Set to 1 for TGA format support (loading only) -#define wxUSE_TGA 1 - -// Set to 1 for GIF format support -#define wxUSE_GIF 1 - -// Set to 1 for PNM format support -#define wxUSE_PNM 1 - -// Set to 1 for PCX format support -#define wxUSE_PCX 1 - -// Set to 1 for IFF format support (Amiga format) -#define wxUSE_IFF 0 - -// Set to 1 for XPM format support -#define wxUSE_XPM 1 - -// Set to 1 for MS Icons and Cursors format support -#define wxUSE_ICO_CUR 1 - -// Set to 1 to compile in wxPalette class -#define wxUSE_PALETTE 1 - -// ---------------------------------------------------------------------------- -// wxUniversal-only options -// ---------------------------------------------------------------------------- - -// Set to 1 to enable compilation of all themes, this is the default -#define wxUSE_ALL_THEMES 1 - -// Set to 1 to enable the compilation of individual theme if wxUSE_ALL_THEMES -// is unset, if it is set these options are not used; notice that metal theme -// uses Win32 one -#define wxUSE_THEME_GTK 0 -#define wxUSE_THEME_METAL 0 -#define wxUSE_THEME_MONO 0 -#define wxUSE_THEME_WIN32 0 - - -/* --- end common options --- */ - -/* --- start MSW options --- */ -// ---------------------------------------------------------------------------- -// Windows-only settings -// ---------------------------------------------------------------------------- - -// Set wxUSE_UNICODE_MSLU to 1 if you're compiling wxWidgets in Unicode mode -// and want to run your programs under Windows 9x and not only NT/2000/XP. -// This setting enables use of unicows.dll from MSLU (MS Layer for Unicode, see -// http://www.microsoft.com/globaldev/handson/dev/mslu_announce.mspx). Note -// that you will have to modify the makefiles to include unicows.lib import -// library as the first library (see installation instructions in install.txt -// to learn how to do it when building the library or samples). -// -// If your compiler doesn't have unicows.lib, you can get a version of it at -// http://libunicows.sourceforge.net -// -// Default is 0 -// -// Recommended setting: 0 (1 if you want to deploy Unicode apps on 9x systems) -#ifndef wxUSE_UNICODE_MSLU - #define wxUSE_UNICODE_MSLU 0 -#endif - -// Set this to 1 if you want to use wxWidgets and MFC in the same program. This -// will override some other settings (see below) -// -// Default is 0. -// -// Recommended setting: 0 unless you really have to use MFC -#define wxUSE_MFC 0 - -// Set this to 1 for generic OLE support: this is required for drag-and-drop, -// clipboard, OLE Automation. Only set it to 0 if your compiler is very old and -// can't compile/doesn't have the OLE headers. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_OLE 1 - -// Set this to 1 to enable wxAutomationObject class. -// -// Default is 1. -// -// Recommended setting: 1 if you need to control other applications via OLE -// Automation, can be safely set to 0 otherwise -#define wxUSE_OLE_AUTOMATION 1 - -// Set this to 1 to enable wxActiveXContainer class allowing to embed OLE -// controls in wx. -// -// Default is 1. -// -// Recommended setting: 1, required by wxMediaCtrl -#define wxUSE_ACTIVEX 1 - -// wxDC caching implementation -#define wxUSE_DC_CACHEING 1 - -// Set this to 1 to enable wxDIB class used internally for manipulating -// wxBitmap data. -// -// Default is 1, set it to 0 only if you don't use wxImage neither -// -// Recommended setting: 1 (without it conversion to/from wxImage won't work) -#define wxUSE_WXDIB 1 - -// Set to 0 to disable PostScript print/preview architecture code under Windows -// (just use Windows printing). -#define wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW 1 - -// Set this to 1 to compile in wxRegKey class. -// -// Default is 1 -// -// Recommended setting: 1, this is used internally by wx in a few places -#define wxUSE_REGKEY 1 - -// Set this to 1 to use RICHEDIT controls for wxTextCtrl with style wxTE_RICH -// which allows to put more than ~32Kb of text in it even under Win9x (NT -// doesn't have such limitation). -// -// Default is 1 for compilers which support it -// -// Recommended setting: 1, only set it to 0 if your compiler doesn't have -// or can't compile -#define wxUSE_RICHEDIT 1 - -// Set this to 1 to use extra features of richedit v2 and later controls -// -// Default is 1 for compilers which support it -// -// Recommended setting: 1 -#define wxUSE_RICHEDIT2 1 - -// Set this to 1 to enable support for the owner-drawn menu and listboxes. This -// is required by wxUSE_CHECKLISTBOX. -// -// Default is 1. -// -// Recommended setting: 1, set to 0 for a small library size reduction -#define wxUSE_OWNER_DRAWN 1 - -// Set this to 1 to enable MSW-specific wxTaskBarIcon::ShowBalloon() method. It -// is required by native wxNotificationMessage implementation. -// -// Default is 1 but disabled in wx/msw/chkconf.h if SDK is too old to contain -// the necessary declarations. -// -// Recommended setting: 1, set to 0 for a tiny library size reduction -#define wxUSE_TASKBARICON_BALLOONS 1 - -// Set to 1 to compile MS Windows XP theme engine support -#define wxUSE_UXTHEME 1 - -// Set to 1 to use InkEdit control (Tablet PC), if available -#define wxUSE_INKEDIT 0 - -// Set to 1 to enable .INI files based wxConfig implementation (wxIniConfig) -// -// Default is 0. -// -// Recommended setting: 0, nobody uses .INI files any more -#define wxUSE_INICONF 0 - -// ---------------------------------------------------------------------------- -// Generic versions of native controls -// ---------------------------------------------------------------------------- - -// Set this to 1 to be able to use wxDatePickerCtrlGeneric in addition to the -// native wxDatePickerCtrl -// -// Default is 0. -// -// Recommended setting: 0, this is mainly used for testing -#define wxUSE_DATEPICKCTRL_GENERIC 0 - -// Set this to 1 to be able to use wxTimePickerCtrlGeneric in addition to the -// native wxTimePickerCtrl for the platforms that have the latter (MSW). -// -// Default is 0. -// -// Recommended setting: 0, this is mainly used for testing -#define wxUSE_TIMEPICKCTRL_GENERIC 0 - -// ---------------------------------------------------------------------------- -// Crash debugging helpers -// ---------------------------------------------------------------------------- - -// Set this to 1 to be able to use wxCrashReport::Generate() to create mini -// dumps of your program when it crashes (or at any other moment) -// -// Default is 1 if supported by the compiler (VC++ and recent BC++ only). -// -// Recommended setting: 1, set to 0 if your programs never crash -#define wxUSE_CRASHREPORT 1 -/* --- end MSW options --- */ - -#endif // _WX_SETUP_H_ - diff --git a/Source/3rd Party/wx/lib/vc_lib/mswd/wx/setup.h b/Source/3rd Party/wx/lib/vc_lib/mswd/wx/setup.h index acb2276b9..2497beddc 100644 --- a/Source/3rd Party/wx/lib/vc_lib/mswd/wx/setup.h +++ b/Source/3rd Party/wx/lib/vc_lib/mswd/wx/setup.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: setup0.h 60190 2009-04-16 00:57:35Z KO $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -27,6 +27,14 @@ // compatibility settings // ---------------------------------------------------------------------------- +// This setting determines the compatibility with 2.4 API: set it to 1 to +// enable it but please consider updating your code instead. +// +// Default is 0 +// +// Recommended setting: 0 (please update your code) +#define WXWIN_COMPATIBILITY_2_4 0 + // This setting determines the compatibility with 2.6 API: set it to 0 to // flag all cases of using deprecated functions. // @@ -35,17 +43,7 @@ // in the version after it completely. // // Recommended setting: 0 (please update your code) -#define WXWIN_COMPATIBILITY_2_6 0 - -// This setting determines the compatibility with 2.8 API: set it to 0 to -// flag all cases of using deprecated functions. -// -// Default is 1 but please try building your code with 0 as the default will -// change to 0 in the next version and the deprecated functions will disappear -// in the version after it completely. -// -// Recommended setting: 0 (please update your code) -#define WXWIN_COMPATIBILITY_2_8 1 +#define WXWIN_COMPATIBILITY_2_6 1 // MSW-only: Set to 0 for accurate dialog units, else 1 for old behaviour when // default system font is used for wxWindow::GetCharWidth/Height() instead of @@ -60,50 +58,6 @@ // debugging settings // ---------------------------------------------------------------------------- -// wxDEBUG_LEVEL will be defined as 1 in wx/debug.h so normally there is no -// need to define it here. You may do it for two reasons: either completely -// disable/compile out the asserts in release version (then do it inside #ifdef -// NDEBUG) or, on the contrary, enable more asserts, including the usually -// disabled ones, in the debug build (then do it inside #ifndef NDEBUG) -// -// #ifdef NDEBUG -// #define wxDEBUG_LEVEL 0 -// #else -// #define wxDEBUG_LEVEL 2 -// #endif - -// wxHandleFatalExceptions() may be used to catch the program faults at run -// time and, instead of terminating the program with a usual GPF message box, -// call the user-defined wxApp::OnFatalException() function. If you set -// wxUSE_ON_FATAL_EXCEPTION to 0, wxHandleFatalExceptions() will not work. -// -// This setting is for Win32 only and can only be enabled if your compiler -// supports Win32 structured exception handling (currently only VC++ does) -// -// Default is 1 -// -// Recommended setting: 1 if your compiler supports it. -#define wxUSE_ON_FATAL_EXCEPTION 1 - -// Set this to 1 to be able to generate a human-readable (unlike -// machine-readable minidump created by wxCrashReport::Generate()) stack back -// trace when your program crashes using wxStackWalker -// -// Default is 1 if supported by the compiler. -// -// Recommended setting: 1, set to 0 if your programs never crash -#define wxUSE_STACKWALKER 1 - -// Set this to 1 to compile in wxDebugReport class which allows you to create -// and optionally upload to your web site a debug report consisting of back -// trace of the crash (if wxUSE_STACKWALKER == 1) and other information. -// -// Default is 1 if supported by the compiler. -// -// Recommended setting: 1, it is compiled into a separate library so there -// is no overhead if you don't use it -#define wxUSE_DEBUGREPORT 1 - // Generic comment about debugging settings: they are very useful if you don't // use any other memory leak detection tools such as Purify/BoundsChecker, but // are probably redundant otherwise. Also, Visual C++ CRT has the same features @@ -111,13 +65,10 @@ // may prefer to use it instead of built in memory debugging code because it is // faster and more fool proof. // -// Using VC++ CRT memory debugging is enabled by default in debug build (_DEBUG -// is defined) if wxUSE_GLOBAL_MEMORY_OPERATORS is *not* enabled (i.e. is 0) +// Using VC++ CRT memory debugging is enabled by default in debug mode +// (__WXDEBUG__) if wxUSE_GLOBAL_MEMORY_OPERATORS is *not* enabled (i.e. is 0) // and if __NO_VC_CRTDBG__ is not defined. -// The rest of the options in this section are obsolete and not supported, -// enable them at your own risk. - // If 1, enables wxDebugContext, for writing error messages to file, etc. If // __WXDEBUG__ is not defined, will still use the normal memory operators. // @@ -151,27 +102,72 @@ // In debug mode, causes new to be defined to be WXDEBUG_NEW (see object.h). If // this causes problems (e.g. link errors), set this to 0. You may need to set // this to 0 if using templates (at least for VC++). This switch is currently -// ignored for MinGW/Cygwin. +// ignored for mingw / cygwin / CodeWarrior // // Default is 0 // // Recommended setting: 0 #define wxUSE_DEBUG_NEW_ALWAYS 0 +// wxHandleFatalExceptions() may be used to catch the program faults at run +// time and, instead of terminating the program with a usual GPF message box, +// call the user-defined wxApp::OnFatalException() function. If you set +// wxUSE_ON_FATAL_EXCEPTION to 0, wxHandleFatalExceptions() will not work. +// +// This setting is for Win32 only and can only be enabled if your compiler +// supports Win32 structured exception handling (currently only VC++ does) +// +// Default is 1 +// +// Recommended setting: 1 if your compiler supports it. +#define wxUSE_ON_FATAL_EXCEPTION 1 + +// Set this to 1 to be able to generate a human-readable (unlike +// machine-readable minidump created by wxCrashReport::Generate()) stack back +// trace when your program crashes using wxStackWalker +// +// Default is 1 if supported by the compiler. +// +// Recommended setting: 1, set to 0 if your programs never crash +#define wxUSE_STACKWALKER 1 + +// Set this to 1 to compile in wxDebugReport class which allows you to create +// and optionally upload to your web site a debug report consisting of back +// trace of the crash (if wxUSE_STACKWALKER == 1) and other information. +// +// Default is 1 if supported by the compiler. +// +// Recommended setting: 1, it is compiled into a separate library so there +// is no overhead if you don't use it +#define wxUSE_DEBUGREPORT 1 // ---------------------------------------------------------------------------- // Unicode support // ---------------------------------------------------------------------------- -// These settings are obsolete: the library is always built in Unicode mode -// now, only set wxUSE_UNICODE to 0 to compile legacy code in ANSI mode if -// absolutely necessary -- updating it is strongly recommended as the ANSI mode -// will disappear completely in future wxWidgets releases. +// Set wxUSE_UNICODE to 1 to compile wxWidgets in Unicode mode: wxChar will be +// defined as wchar_t, wxString will use Unicode internally. If you set this +// to 1, you must use wxT() macro for all literal strings in the program. +// +// Unicode is currently only fully supported under Windows NT/2000/XP +// (Windows 9x doesn't support it and the programs compiled in Unicode mode +// will not run under 9x -- but see wxUSE_UNICODE_MSLU below). +// +// Default is 0 +// +// Recommended setting: 0 (unless you only plan to use Windows NT/2000/XP) #ifndef wxUSE_UNICODE - #define wxUSE_UNICODE 1 + #define wxUSE_UNICODE 0 #endif -// wxUSE_WCHAR_T is required by wxWidgets now, don't change. +// Setting wxUSE_WCHAR_T to 1 gives you some degree of Unicode support without +// compiling the program in Unicode mode. More precisely, it will be possible +// to construct wxString from a wide (Unicode) string and convert any wxString +// to Unicode. +// +// Default is 1 +// +// Recommended setting: 1 #define wxUSE_WCHAR_T 1 // ---------------------------------------------------------------------------- @@ -201,6 +197,15 @@ // Recommended setting: 0 (this is still work in progress...) #define wxUSE_EXTENDED_RTTI 0 +// Set wxUSE_STL to 1 to derive wxList(Foo) and wxArray(Foo) from +// std::list and std::vector, with a compatibility interface, +// and for wxHashMap to be implemented with templates. +// +// Default is 0 +// +// Recommended setting: YMMV +#define wxUSE_STL 0 + // Support for message/error logging. This includes wxLogXXX() functions and // wxLog and derived classes. Don't set this to 0 unless you really know what // you are doing. @@ -252,6 +257,37 @@ // Recommended setting: 1 as setting it to 0 disables many other things #define wxUSE_STREAMS 1 +// Use standard C++ streams if 1 instead of wx streams in some places. If +// disabled (default), wx streams are used everywhere and wxWidgets doesn't +// depend on the standard streams library. +// +// Notice that enabling this does not replace wx streams with std streams +// everywhere, in a lot of places wx streams are used no matter what. +// +// Default is 0 +// +// Recommended setting: 1 if you use the standard streams anyhow and so +// dependency on the standard streams library is not a +// problem +#define wxUSE_STD_IOSTREAM 0 + +// Enable conversion to standard C++ string if 1. +// +// Default is 1 for most compilers. +// +// Currently the Digital Mars and Watcom compilers come without standard C++ +// library headers by default, wxUSE_STD_STRING can be set to 1 if you do have +// them (e.g. from STLPort). +// +// VC++ 5.0 does include standard C++ library header, however they produce +// many warnings that can't be turned off when compiled at warning level 4. +#if defined(__DMC__) || defined(__WATCOMC__) \ + || (defined(_MSC_VER) && _MSC_VER < 1200) + #define wxUSE_STD_STRING 0 +#else + #define wxUSE_STD_STRING 1 +#endif + // Support for positional parameters (e.g. %1$d, %2$s ...) in wxVsnprintf. // Note that if the system's implementation does not support positional // parameters, setting this to 1 forces the use of the wxWidgets implementation @@ -267,118 +303,6 @@ // Recommended setting: 1 if you want to support multiple languages #define wxUSE_PRINTF_POS_PARAMS 1 -// Enable the use of compiler-specific thread local storage keyword, if any. -// This is used for wxTLS_XXX() macros implementation and normally should use -// the compiler-provided support as it's simpler and more efficient, but must -// not use it if wxWidgets is used in a dynamically loaded Win32 (i.e. using -// LoadLibrary()/GetProcAddress()) as this triggers a bug in compiler TLS -// support that results in crashes when any TLS variables are used. So if you -// are building a Win32 DLL using wxWidgets that can be loaded dynamically, set -// this to 0. -// -// Default is 1, but set to 0 if the scenario above is applicable. -#define wxUSE_COMPILER_TLS 1 - -// ---------------------------------------------------------------------------- -// Interoperability with the standard library. -// ---------------------------------------------------------------------------- - -// Set wxUSE_STL to 1 to enable maximal interoperability with the standard -// library, even at the cost of backwards compatibility. -// -// Default is 0 -// -// Recommended setting: 0 as the options below already provide a relatively -// good level of interoperability and changing this option arguably isn't worth -// diverging from the official builds of the library. -#define wxUSE_STL 0 - -// This is not a real option but is used as the default value for -// wxUSE_STD_IOSTREAM, wxUSE_STD_STRING and wxUSE_STD_CONTAINERS. -// -// Currently the Digital Mars and Watcom compilers come without standard C++ -// library headers by default, wxUSE_STD_STRING can be set to 1 if you do have -// them (e.g. from STLPort). -// -// VC++ 5.0 does include standard C++ library headers, however they produce -// many warnings that can't be turned off when compiled at warning level 4. -#if defined(__DMC__) || defined(__WATCOMC__) \ - || (defined(_MSC_VER) && _MSC_VER < 1200) - #define wxUSE_STD_DEFAULT 0 -#else - #define wxUSE_STD_DEFAULT 1 -#endif - -// Use standard C++ containers to implement wxVector<>, wxStack<>, wxDList<> -// and wxHashXXX<> classes. If disabled, wxWidgets own (mostly compatible but -// usually more limited) implementations are used which allows to avoid the -// dependency on the C++ run-time library. -// -// Notice that the compilers mentioned in wxUSE_STD_DEFAULT comment above don't -// support using standard containers and that VC6 needs non-default options for -// such build to avoid getting "fatal error C1076: compiler limit : internal -// heap limit reached; use /Zm to specify a higher limit" in its own standard -// headers, so you need to ensure you do increase the heap size before enabling -// this option for this compiler. -// -// Default is 0 for compatibility reasons. -// -// Recommended setting: 1 unless compatibility with the official wxWidgets -// build and/or the existing code is a concern. -#define wxUSE_STD_CONTAINERS 0 - -// Use standard C++ streams if 1 instead of wx streams in some places. If -// disabled, wx streams are used everywhere and wxWidgets doesn't depend on the -// standard streams library. -// -// Notice that enabling this does not replace wx streams with std streams -// everywhere, in a lot of places wx streams are used no matter what. -// -// Default is 1 if compiler supports it. -// -// Recommended setting: 1 if you use the standard streams anyhow and so -// dependency on the standard streams library is not a -// problem -#define wxUSE_STD_IOSTREAM wxUSE_STD_DEFAULT - -// Enable minimal interoperability with the standard C++ string class if 1. -// "Minimal" means that wxString can be constructed from std::string or -// std::wstring but can't be implicitly converted to them. You need to enable -// the option below for the latter. -// -// Default is 1 for most compilers. -// -// Recommended setting: 1 unless you want to ensure your program doesn't use -// the standard C++ library at all. -#define wxUSE_STD_STRING wxUSE_STD_DEFAULT - -// Make wxString as much interchangeable with std::[w]string as possible, in -// particular allow implicit conversion of wxString to either of these classes. -// This comes at a price (or a benefit, depending on your point of view) of not -// allowing implicit conversion to "const char *" and "const wchar_t *". -// -// Because a lot of existing code relies on these conversions, this option is -// disabled by default but can be enabled for your build if you don't care -// about compatibility. -// -// Default is 0 if wxUSE_STL has its default value or 1 if it is enabled. -// -// Recommended setting: 0 to remain compatible with the official builds of -// wxWidgets. -#define wxUSE_STD_STRING_CONV_IN_WXSTRING wxUSE_STL - -// VC++ 4.2 and above allows and but you can't mix -// them. Set this option to 1 to use , 0 to use . -// -// Note that newer compilers (including VC++ 7.1 and later) don't support -// wxUSE_IOSTREAMH == 1 and so will be used anyhow. -// -// Default is 0. -// -// Recommended setting: 0, only set to 1 if you use a really old compiler -#define wxUSE_IOSTREAMH 0 - - // ---------------------------------------------------------------------------- // non GUI features selection // ---------------------------------------------------------------------------- @@ -396,24 +320,6 @@ // Recommended setting: 1 #define wxUSE_LONGLONG 1 -// Set wxUSE_BASE64 to 1, to compile in Base64 support. This is required for -// storing binary data in wxConfig on most platforms. -// -// Default is 1. -// -// Recommended setting: 1 (but can be safely disabled if you don't use it) -#define wxUSE_BASE64 1 - -// Set this to 1 to be able to use wxEventLoop even in console applications -// (i.e. using base library only, without GUI). This is mostly useful for -// processing socket events but is also necessary to use timers in console -// applications -// -// Default is 1. -// -// Recommended setting: 1 (but can be safely disabled if you don't use it) -#define wxUSE_CONSOLE_EVENTLOOP 1 - // Set wxUSE_(F)FILE to 1 to compile wx(F)File classes. wxFile uses low level // POSIX functions for file access, wxFFile uses ANSI C stdio.h functions. // @@ -449,21 +355,6 @@ // i18n support: _() macro, wxLocale class. Requires wxTextFile. #define wxUSE_INTL 1 -// Provide wxFoo_l() functions similar to standard foo() functions but taking -// an extra locale parameter. -// -// Notice that this is fully implemented only for the systems providing POSIX -// xlocale support or Microsoft Visual C++ >= 8 (which provides proprietary -// almost-equivalent of xlocale functions), otherwise wxFoo_l() functions will -// only work for the current user locale and "C" locale. You can use -// wxHAS_XLOCALE_SUPPORT to test whether the full support is available. -// -// Default is 1 -// -// Recommended setting: 1 but may be disabled if you are writing programs -// running only in C locale anyhow -#define wxUSE_XLOCALE 1 - // Set wxUSE_DATETIME to 1 to compile the wxDateTime and related classes which // allow to manipulate dates, times and time intervals. wxDateTime replaces the // old wxTime and wxDate classes which are still provided for backwards @@ -495,13 +386,6 @@ // Recommended setting: 1 (needed by wxSocket) #define wxUSE_STOPWATCH 1 -// Set wxUSE_FSWATCHER to 1 if you want to enable wxFileSystemWatcher -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_FSWATCHER 1 - // Setting wxUSE_CONFIG to 1 enables the use of wxConfig and related classes // which allow the application to store its settings in the persistent // storage. Setting this to 1 will also enable on-demand creation of the @@ -550,17 +434,6 @@ // Set to 1 to use socket classes #define wxUSE_SOCKETS 1 -// Set to 1 to use ipv6 socket classes (requires wxUSE_SOCKETS) -// -// Notice that currently setting this option under Windows will result in -// programs which can only run on recent OS versions (with ws2_32.dll -// installed) which is why it is disabled by default. -// -// Default is 1. -// -// Recommended setting: 1 if you need IPv6 support -#define wxUSE_IPV6 0 - // Set to 1 to enable virtual file systems (required by wxHTML) #define wxUSE_FILESYSTEM 1 @@ -598,9 +471,6 @@ // Joystick support class #define wxUSE_JOYSTICK 1 -// wxFontEnumerator class -#define wxUSE_FONTENUM 1 - // wxFontMapper class #define wxUSE_FONTMAP 1 @@ -642,14 +512,6 @@ // possible in which case setting this to 0 can gain up to 100KB. #define wxUSE_VARIANT 1 -// Support for wxAny class, the successor for wxVariant. -// -// Default is 1. -// -// Recommended setting: 1 unless you want to reduce the library size by a small amount, -// or your compiler cannot for some reason cope with complexity of templates used. -#define wxUSE_ANY 1 - // Support for regular expression matching via wxRegEx class: enable this to // use POSIX regular expressions in your code. You need to compile regex // library from src/regex to use it under Windows. @@ -673,6 +535,13 @@ // Recommended setting: 1 #define wxUSE_MEDIACTRL 1 +// Use GStreamer for Unix (req a lot of dependancies) +// +// Default is 0 +// +// Recommended setting: 1 (wxMediaCtrl won't work by default without it) +#define wxUSE_GSTREAMER 0 + // Use wxWidget's XRC XML-based resource system. Recommended. // // Default is 1 @@ -695,105 +564,32 @@ // Recommended setting: 1 #define wxUSE_AUI 1 -// Use wxWidget's Ribbon classes for interfaces -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_RIBBON 1 - -// Use wxPropertyGrid. -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_PROPGRID 1 - -// Use wxStyledTextCtrl, a wxWidgets implementation of Scintilla. -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_STC 1 - -// Use wxWidget's web viewing classes -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_WEBVIEW 1 - -// Use the IE wxWebView backend -// -// Default is 1 on MSW -// -// Recommended setting: 1 -#ifdef __WXMSW__ -#define wxUSE_WEBVIEW_IE 1 -#else -#define wxUSE_WEBVIEW_IE 0 -#endif - -// Use the WebKit wxWebView backend -// -// Default is 1 on GTK and OSX -// -// Recommended setting: 1 -#if defined(__WXGTK__) || defined(__WXOSX__) -#define wxUSE_WEBVIEW_WEBKIT 1 -#else -#define wxUSE_WEBVIEW_WEBKIT 0 -#endif // Enable the new wxGraphicsPath and wxGraphicsContext classes for an advanced // 2D drawing API. (Still somewhat experimental) // -// Please note that on Windows gdiplus.dll is loaded dynamically which means -// that nothing special needs to be done as long as you don't use -// wxGraphicsContext at all or only use it on XP and later systems but you -// still do need to distribute it yourself for an application using -// wxGraphicsContext to be runnable on pre-XP systems. -// -// Default is 1 except if you're using a non-Microsoft compiler under Windows -// as only MSVC7+ is known to ship with gdiplus.h. For other compilers (e.g. -// mingw32) you may need to install the headers (and just the headers) -// yourself. If you do, change the setting below manually. -// -// Recommended setting: 1 if supported by the compilation environment - -// notice that we can't use wxCHECK_VISUALC_VERSION() here as this file is -// included from wx/platform.h before wxCHECK_VISUALC_VERSION() is defined -#ifdef _MSC_VER -# if _MSC_VER >= 1310 - // MSVC7.1+ comes with new enough Platform SDK, enable - // wxGraphicsContext support for it -# define wxUSE_GRAPHICS_CONTEXT 1 -# else - // MSVC 6 didn't include GDI+ headers so disable by default, enable it - // here if you use MSVC 6 with a newer SDK -# define wxUSE_GRAPHICS_CONTEXT 0 -# endif -#else - // Disable support for other Windows compilers, enable it if your compiler - // comes with new enough SDK or you installed the headers manually. - // - // Notice that this will be set by configure under non-Windows platforms - // anyhow so the value there is not important. -# define wxUSE_GRAPHICS_CONTEXT 0 -#endif - -// Enable wxGraphicsContext implementation using Cairo library. -// -// This is not needed under Windows and detected automatically by configure -// under other systems, however you may set this to 1 manually if you installed -// Cairo under Windows yourself and prefer to use it instead the native GDI+ -// implementation. +// Please note that on Windows you will need to link with gdiplus.lib (use +// USE_GDIPLUS=1 for makefile builds) and distribute gdiplus.dll with your +// application if you want it to be runnable on pre-XP systems. // // Default is 0 // -// Recommended setting: 0 -#define wxUSE_CAIRO 0 +// Recommended setting: 1 +#ifndef wxUSE_GRAPHICS_CONTEXT +#define wxUSE_GRAPHICS_CONTEXT 0 +#endif +// Enable the new wxCairoContext classes for an advanced +// 2D drawing API. (Still somewhat experimental) +// +// Please note that you will need to link with Cairo for this to work. +// +// Default is 0 +// +// Recommended setting: 1 +#ifndef wxUSE_CAIRO +#define wxUSE_CAIRO 0 +#endif // ---------------------------------------------------------------------------- // Individual GUI controls @@ -807,15 +603,6 @@ // Recommended setting: 1 (don't change except for very special programs) #define wxUSE_CONTROLS 1 -// Support markup in control labels, i.e. provide wxControl::SetLabelMarkup(). -// Currently markup is supported only by a few controls and only some ports but -// their number will increase with time. -// -// Default is 1 -// -// Recommended setting: 1 (may be set to 0 if you want to save on code size) -#define wxUSE_MARKUP 1 - // wxPopupWindow class is a top level transient window. It is currently used // to implement wxTipWindow // @@ -842,7 +629,6 @@ // // Recommended setting: 1 #define wxUSE_ANIMATIONCTRL 1 // wxAnimationCtrl -#define wxUSE_BANNERWINDOW 1 // wxBannerWindow #define wxUSE_BUTTON 1 // wxButton #define wxUSE_BMPBUTTON 1 // wxBitmapButton #define wxUSE_CALENDARCTRL 1 // wxCalendarCtrl @@ -852,22 +638,17 @@ #define wxUSE_COLLPANE 1 // wxCollapsiblePane #define wxUSE_COLOURPICKERCTRL 1 // wxColourPickerCtrl #define wxUSE_COMBOBOX 1 // wxComboBox -#define wxUSE_COMMANDLINKBUTTON 1 // wxCommandLinkButton #define wxUSE_DATAVIEWCTRL 1 // wxDataViewCtrl #define wxUSE_DATEPICKCTRL 1 // wxDatePickerCtrl #define wxUSE_DIRPICKERCTRL 1 // wxDirPickerCtrl -#define wxUSE_EDITABLELISTBOX 1 // wxEditableListBox -#define wxUSE_FILECTRL 1 // wxFileCtrl #define wxUSE_FILEPICKERCTRL 1 // wxFilePickerCtrl #define wxUSE_FONTPICKERCTRL 1 // wxFontPickerCtrl #define wxUSE_GAUGE 1 // wxGauge -#define wxUSE_HEADERCTRL 1 // wxHeaderCtrl #define wxUSE_HYPERLINKCTRL 1 // wxHyperlinkCtrl #define wxUSE_LISTBOX 1 // wxListBox #define wxUSE_LISTCTRL 1 // wxListCtrl #define wxUSE_RADIOBOX 1 // wxRadioBox #define wxUSE_RADIOBTN 1 // wxRadioButton -#define wxUSE_RICHMSGDLG 1 // wxRichMessageDialog #define wxUSE_SCROLLBAR 1 // wxScrollBar #define wxUSE_SEARCHCTRL 1 // wxSearchCtrl #define wxUSE_SLIDER 1 // wxSlider @@ -878,10 +659,8 @@ #define wxUSE_STATTEXT 1 // wxStaticText #define wxUSE_STATBMP 1 // wxStaticBitmap #define wxUSE_TEXTCTRL 1 // wxTextCtrl -#define wxUSE_TIMEPICKCTRL 1 // wxTimePickerCtrl #define wxUSE_TOGGLEBTN 1 // requires wxButton #define wxUSE_TREECTRL 1 // wxTreeCtrl -#define wxUSE_TREELISTCTRL 1 // wxTreeListCtrl // Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR // below either wxStatusBar95 or a generic wxStatusBar will be used. @@ -952,13 +731,13 @@ // Recommended setting: 1 #define wxUSE_TOOLBOOK 1 -// wxTaskBarIcon is a small notification icon shown in the system toolbar or -// dock. +// wxTabDialog is a generic version of wxNotebook but it is incompatible with +// the new class. It shouldn't be used in new code. // -// Default is 1. +// Default is 0. // -// Recommended setting: 1 (but can be set to 0 if you don't need it) -#define wxUSE_TASKBARICON 1 +// Recommended setting: 0 (use wxNotebook) +#define wxUSE_TAB_DIALOG 0 // wxGrid class // @@ -1001,15 +780,6 @@ // Recommended setting: 1 but can be safely set to 0 #define wxUSE_BITMAPCOMBOBOX 1 -// wxRearrangeCtrl is a wxCheckListBox with two buttons allowing to move items -// up and down in it. It is also used as part of wxRearrangeDialog. -// -// Default is 1. -// -// Recommended setting: 1 but can be safely set to 0 (currently used only by -// wxHeaderCtrl) -#define wxUSE_REARRANGECTRL 1 - // ---------------------------------------------------------------------------- // Miscellaneous GUI stuff // ---------------------------------------------------------------------------- @@ -1017,29 +787,6 @@ // wxAcceleratorTable/Entry classes and support for them in wxMenu(Bar) #define wxUSE_ACCEL 1 -// Use the standard art provider. The icons returned by this provider are -// embedded into the library as XPMs so disabling it reduces the library size -// somewhat but this should only be done if you use your own custom art -// provider returning the icons or never use any icons not provided by the -// native art provider (which might not be implemented at all for some -// platforms) or by the Tango icons provider (if it's not itself disabled -// below). -// -// Default is 1. -// -// Recommended setting: 1 unless you use your own custom art provider. -#define wxUSE_ARTPROVIDER_STD 1 - -// Use art provider providing Tango icons: this art provider has higher quality -// icons than the default ones using smaller size XPM icons without -// transparency but the embedded PNG icons add to the library size. -// -// Default is 1 under non-GTK ports. Under wxGTK the native art provider using -// the GTK+ stock icons replaces it so it is normally not necessary. -// -// Recommended setting: 1 but can be turned off to reduce the library size. -#define wxUSE_ARTPROVIDER_TANGO 1 - // Hotkey support (currently Windows only) #define wxUSE_HOTKEY 1 @@ -1072,14 +819,6 @@ // enumerated above, then this class is mostly useless too) #define wxUSE_IMAGLIST 1 -// Use wxInfoBar class. -// -// Default is 1. -// -// Recommended setting: 1 (but can be disabled without problems as nothing -// depends on it) -#define wxUSE_INFOBAR 1 - // Use wxMenu, wxMenuBar, wxMenuItem. // // Default is 1. @@ -1087,25 +826,6 @@ // Recommended setting: 1 (can't be disabled under MSW) #define wxUSE_MENUS 1 -// Use wxNotificationMessage. -// -// wxNotificationMessage allows to show non-intrusive messages to the user -// using balloons, banners, popups or whatever is the appropriate method for -// the current platform. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_NOTIFICATION_MESSAGE 1 - -// wxRichToolTip is a customizable tooltip class which has more functionality -// than the stock (but native, unlike this class) wxToolTip. -// -// Default is 1. -// -// Recommended setting: 1 (but can be safely set to 0 if you don't need it) -#define wxUSE_RICHTOOLTIP 1 - // Use wxSashWindow class. // // Default is 1. @@ -1130,20 +850,6 @@ // wxValidator class and related methods #define wxUSE_VALIDATORS 1 -// Use reference counted ID management: this means that wxWidgets will track -// the automatically allocated ids (those used when you use wxID_ANY when -// creating a window, menu or toolbar item &c) instead of just supposing that -// the program never runs out of them. This is mostly useful only under wxMSW -// where the total ids range is limited to SHRT_MIN..SHRT_MAX and where -// long-running programs can run into problems with ids reuse without this. On -// the other platforms, where the ids have the full int range, this shouldn't -// be necessary. -#ifdef __WXMSW__ -#define wxUSE_AUTOID_MANAGEMENT 1 -#else -#define wxUSE_AUTOID_MANAGEMENT 0 -#endif - // ---------------------------------------------------------------------------- // common dialogs // ---------------------------------------------------------------------------- @@ -1234,13 +940,6 @@ // use this function #define wxUSE_ABOUTDLG 1 -// wxFileHistory class -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_FILE_HISTORY 1 - // ---------------------------------------------------------------------------- // Metafiles support // ---------------------------------------------------------------------------- @@ -1297,16 +996,14 @@ // Setting wxUSE_GLCANVAS to 1 enables OpenGL support. You need to have OpenGL // headers and libraries to be able to compile the library with wxUSE_GLCANVAS -// set to 1 and, under Windows, also to add opengl32.lib and glu32.lib to the -// list of libraries used to link your application (although this is done -// implicitly for Microsoft Visual C++ users). +// set to 1. Note that for some compilers (notably Microsoft Visual C++) you +// will need to manually add opengl32.lib and glu32.lib to the list of +// libraries linked with your program if you use OpenGL. // -// Default is 1 unless the compiler is known to ship without the necessary -// headers (Digital Mars) or the platform doesn't support OpenGL (Windows CE). +// Default is 0. // -// Recommended setting: 1 if you intend to use OpenGL, can be safely set to 0 -// otherwise. -#define wxUSE_GLCANVAS 1 +// Recommended setting: 1 if you intend to use OpenGL, 0 otherwise +#define wxUSE_GLCANVAS 0 // wxRichTextCtrl allows editing of styled text. // @@ -1385,6 +1082,8 @@ // Use wxHTML-based help controller? #define wxUSE_WXHTML_HELP 1 +#define wxUSE_RESOURCES 0 + // 0 for no wxGetResource/wxWriteResource #define wxUSE_CONSTRAINTS 1 // 0 for no window layout constraint system @@ -1394,11 +1093,8 @@ #define wxUSE_MOUSEWHEEL 1 // Include mouse wheel support -// Compile wxUIActionSimulator class? -#define wxUSE_UIACTIONSIMULATOR 1 - // ---------------------------------------------------------------------------- -// wxDC classes for various output formats +// postscript support settings // ---------------------------------------------------------------------------- // Set to 1 for PostScript device context. @@ -1407,19 +1103,50 @@ // Set to 1 to use font metric files in GetTextExtent #define wxUSE_AFM_FOR_POSTSCRIPT 1 -// Set to 1 to compile in support for wxSVGFileDC, a wxDC subclass which allows -// to create files in SVG (Scalable Vector Graphics) format. -#define wxUSE_SVG 1 +// ---------------------------------------------------------------------------- +// database classes +// ---------------------------------------------------------------------------- -// Should wxDC provide SetTransformMatrix() and related methods? +// Define 1 to use ODBC classes +#define wxUSE_ODBC 0 + +// For backward compatibility reasons, this parameter now only controls the +// default scrolling method used by cursors. This default behavior can be +// overriden by setting the second param of wxDB::wxDbGetConnection() or +// wxDb() constructor to indicate whether the connection (and any wxDbTable()s +// that use the connection) should support forward only scrolling of cursors, +// or both forward and backward support for backward scrolling cursors is +// dependent on the data source as well as the ODBC driver being used. +#define wxODBC_FWD_ONLY_CURSORS 1 + +// Default is 0. Set to 1 to use the deprecated classes, enum types, function, +// member variables. With a setting of 1, full backward compatibility with the +// 2.0.x release is possible. It is STRONGLY recommended that this be set to 0, +// as future development will be done only on the non-deprecated +// functions/classes/member variables/etc. +#define wxODBC_BACKWARD_COMPATABILITY 0 + +// ---------------------------------------------------------------------------- +// other compiler (mis)features +// ---------------------------------------------------------------------------- + +// Set this to 0 if your compiler can't cope with omission of prototype +// parameters. // -// Default is 1 but can be set to 0 if this functionality is not used. Notice -// that currently only wxMSW supports this so setting this to 0 doesn't change -// much for non-MSW platforms (although it will still save a few bytes -// probably). +// Default is 1. // -// Recommended setting: 1. -#define wxUSE_DC_TRANSFORM_MATRIX 1 +// Recommended setting: 1 (should never need to set this to 0) +#define REMOVE_UNUSED_ARG 1 + +// VC++ 4.2 and above allows and but you can't mix +// them. Set to 1 for , 0 for . Note that VC++ 7.1 +// and later doesn't support wxUSE_IOSTREAMH == 1 and so will be +// used anyhow. +// +// Default is 1. +// +// Recommended setting: whatever your compiler likes more +#define wxUSE_IOSTREAMH 1 // ---------------------------------------------------------------------------- // image format support @@ -1487,7 +1214,6 @@ /* --- end common options --- */ -/* --- start MSW options --- */ // ---------------------------------------------------------------------------- // Windows-only settings // ---------------------------------------------------------------------------- @@ -1543,11 +1269,15 @@ // Recommended setting: 1, required by wxMediaCtrl #define wxUSE_ACTIVEX 1 -// wxDC caching implementation +// wxDC cacheing implementation #define wxUSE_DC_CACHEING 1 +// Set this to 1 to enable the use of DIB's for wxBitmap to support +// bitmaps > 16MB on Win95/98/Me. Set to 0 to use DDB's only. +#define wxUSE_DIB_FOR_BITMAP 0 + // Set this to 1 to enable wxDIB class used internally for manipulating -// wxBitmap data. +// wxBitmao data. // // Default is 1, set it to 0 only if you don't use wxImage neither // @@ -1558,13 +1288,6 @@ // (just use Windows printing). #define wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW 1 -// Set this to 1 to compile in wxRegKey class. -// -// Default is 1 -// -// Recommended setting: 1, this is used internally by wx in a few places -#define wxUSE_REGKEY 1 - // Set this to 1 to use RICHEDIT controls for wxTextCtrl with style wxTE_RICH // which allows to put more than ~32Kb of text in it even under Win9x (NT // doesn't have such limitation). @@ -1590,28 +1313,16 @@ // Recommended setting: 1, set to 0 for a small library size reduction #define wxUSE_OWNER_DRAWN 1 -// Set this to 1 to enable MSW-specific wxTaskBarIcon::ShowBalloon() method. It -// is required by native wxNotificationMessage implementation. -// -// Default is 1 but disabled in wx/msw/chkconf.h if SDK is too old to contain -// the necessary declarations. -// -// Recommended setting: 1, set to 0 for a tiny library size reduction -#define wxUSE_TASKBARICON_BALLOONS 1 - // Set to 1 to compile MS Windows XP theme engine support #define wxUSE_UXTHEME 1 +// Set to 1 to auto-adapt to MS Windows XP themes where possible +// (notably, wxNotebook pages) +#define wxUSE_UXTHEME_AUTO 1 + // Set to 1 to use InkEdit control (Tablet PC), if available #define wxUSE_INKEDIT 0 -// Set to 1 to enable .INI files based wxConfig implementation (wxIniConfig) -// -// Default is 0. -// -// Recommended setting: 0, nobody uses .INI files any more -#define wxUSE_INICONF 0 - // ---------------------------------------------------------------------------- // Generic versions of native controls // ---------------------------------------------------------------------------- @@ -1624,14 +1335,6 @@ // Recommended setting: 0, this is mainly used for testing #define wxUSE_DATEPICKCTRL_GENERIC 0 -// Set this to 1 to be able to use wxTimePickerCtrlGeneric in addition to the -// native wxTimePickerCtrl for the platforms that have the latter (MSW). -// -// Default is 0. -// -// Recommended setting: 0, this is mainly used for testing -#define wxUSE_TIMEPICKCTRL_GENERIC 0 - // ---------------------------------------------------------------------------- // Crash debugging helpers // ---------------------------------------------------------------------------- @@ -1643,7 +1346,16 @@ // // Recommended setting: 1, set to 0 if your programs never crash #define wxUSE_CRASHREPORT 1 -/* --- end MSW options --- */ + +// ---------------------------------------------------------------------------- +// obsolete settings +// ---------------------------------------------------------------------------- + +// NB: all settings in this section are obsolete and should not be used/changed +// at all, they will disappear + +// Define 1 to use bitmap messages. +#define wxUSE_BITMAP_MESSAGE 1 #endif // _WX_SETUP_H_ diff --git a/Source/3rd Party/wx/lib/vc_lib/mswu/wx/setup.h b/Source/3rd Party/wx/lib/vc_lib/mswu/wx/setup.h deleted file mode 100644 index acb2276b9..000000000 --- a/Source/3rd Party/wx/lib/vc_lib/mswu/wx/setup.h +++ /dev/null @@ -1,1649 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/setup.h -// Purpose: Configuration for the library -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_SETUP_H_ -#define _WX_SETUP_H_ - -/* --- start common options --- */ -// ---------------------------------------------------------------------------- -// global settings -// ---------------------------------------------------------------------------- - -// define this to 0 when building wxBase library - this can also be done from -// makefile/project file overriding the value here -#ifndef wxUSE_GUI - #define wxUSE_GUI 1 -#endif // wxUSE_GUI - -// ---------------------------------------------------------------------------- -// compatibility settings -// ---------------------------------------------------------------------------- - -// This setting determines the compatibility with 2.6 API: set it to 0 to -// flag all cases of using deprecated functions. -// -// Default is 1 but please try building your code with 0 as the default will -// change to 0 in the next version and the deprecated functions will disappear -// in the version after it completely. -// -// Recommended setting: 0 (please update your code) -#define WXWIN_COMPATIBILITY_2_6 0 - -// This setting determines the compatibility with 2.8 API: set it to 0 to -// flag all cases of using deprecated functions. -// -// Default is 1 but please try building your code with 0 as the default will -// change to 0 in the next version and the deprecated functions will disappear -// in the version after it completely. -// -// Recommended setting: 0 (please update your code) -#define WXWIN_COMPATIBILITY_2_8 1 - -// MSW-only: Set to 0 for accurate dialog units, else 1 for old behaviour when -// default system font is used for wxWindow::GetCharWidth/Height() instead of -// the current font. -// -// Default is 0 -// -// Recommended setting: 0 -#define wxDIALOG_UNIT_COMPATIBILITY 0 - -// ---------------------------------------------------------------------------- -// debugging settings -// ---------------------------------------------------------------------------- - -// wxDEBUG_LEVEL will be defined as 1 in wx/debug.h so normally there is no -// need to define it here. You may do it for two reasons: either completely -// disable/compile out the asserts in release version (then do it inside #ifdef -// NDEBUG) or, on the contrary, enable more asserts, including the usually -// disabled ones, in the debug build (then do it inside #ifndef NDEBUG) -// -// #ifdef NDEBUG -// #define wxDEBUG_LEVEL 0 -// #else -// #define wxDEBUG_LEVEL 2 -// #endif - -// wxHandleFatalExceptions() may be used to catch the program faults at run -// time and, instead of terminating the program with a usual GPF message box, -// call the user-defined wxApp::OnFatalException() function. If you set -// wxUSE_ON_FATAL_EXCEPTION to 0, wxHandleFatalExceptions() will not work. -// -// This setting is for Win32 only and can only be enabled if your compiler -// supports Win32 structured exception handling (currently only VC++ does) -// -// Default is 1 -// -// Recommended setting: 1 if your compiler supports it. -#define wxUSE_ON_FATAL_EXCEPTION 1 - -// Set this to 1 to be able to generate a human-readable (unlike -// machine-readable minidump created by wxCrashReport::Generate()) stack back -// trace when your program crashes using wxStackWalker -// -// Default is 1 if supported by the compiler. -// -// Recommended setting: 1, set to 0 if your programs never crash -#define wxUSE_STACKWALKER 1 - -// Set this to 1 to compile in wxDebugReport class which allows you to create -// and optionally upload to your web site a debug report consisting of back -// trace of the crash (if wxUSE_STACKWALKER == 1) and other information. -// -// Default is 1 if supported by the compiler. -// -// Recommended setting: 1, it is compiled into a separate library so there -// is no overhead if you don't use it -#define wxUSE_DEBUGREPORT 1 - -// Generic comment about debugging settings: they are very useful if you don't -// use any other memory leak detection tools such as Purify/BoundsChecker, but -// are probably redundant otherwise. Also, Visual C++ CRT has the same features -// as wxWidgets memory debugging subsystem built in since version 5.0 and you -// may prefer to use it instead of built in memory debugging code because it is -// faster and more fool proof. -// -// Using VC++ CRT memory debugging is enabled by default in debug build (_DEBUG -// is defined) if wxUSE_GLOBAL_MEMORY_OPERATORS is *not* enabled (i.e. is 0) -// and if __NO_VC_CRTDBG__ is not defined. - -// The rest of the options in this section are obsolete and not supported, -// enable them at your own risk. - -// If 1, enables wxDebugContext, for writing error messages to file, etc. If -// __WXDEBUG__ is not defined, will still use the normal memory operators. -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_DEBUG_CONTEXT 0 - -// If 1, enables debugging versions of wxObject::new and wxObject::delete *IF* -// __WXDEBUG__ is also defined. -// -// WARNING: this code may not work with all architectures, especially if -// alignment is an issue. This switch is currently ignored for mingw / cygwin -// -// Default is 0 -// -// Recommended setting: 1 if you are not using a memory debugging tool, else 0 -#define wxUSE_MEMORY_TRACING 0 - -// In debug mode, cause new and delete to be redefined globally. -// If this causes problems (e.g. link errors which is a common problem -// especially if you use another library which also redefines the global new -// and delete), set this to 0. -// This switch is currently ignored for mingw / cygwin -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_GLOBAL_MEMORY_OPERATORS 0 - -// In debug mode, causes new to be defined to be WXDEBUG_NEW (see object.h). If -// this causes problems (e.g. link errors), set this to 0. You may need to set -// this to 0 if using templates (at least for VC++). This switch is currently -// ignored for MinGW/Cygwin. -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_DEBUG_NEW_ALWAYS 0 - - -// ---------------------------------------------------------------------------- -// Unicode support -// ---------------------------------------------------------------------------- - -// These settings are obsolete: the library is always built in Unicode mode -// now, only set wxUSE_UNICODE to 0 to compile legacy code in ANSI mode if -// absolutely necessary -- updating it is strongly recommended as the ANSI mode -// will disappear completely in future wxWidgets releases. -#ifndef wxUSE_UNICODE - #define wxUSE_UNICODE 1 -#endif - -// wxUSE_WCHAR_T is required by wxWidgets now, don't change. -#define wxUSE_WCHAR_T 1 - -// ---------------------------------------------------------------------------- -// global features -// ---------------------------------------------------------------------------- - -// Compile library in exception-safe mode? If set to 1, the library will try to -// behave correctly in presence of exceptions (even though it still will not -// use the exceptions itself) and notify the user code about any unhandled -// exceptions. If set to 0, propagation of the exceptions through the library -// code will lead to undefined behaviour -- but the code itself will be -// slightly smaller and faster. -// -// Note that like wxUSE_THREADS this option is automatically set to 0 if -// wxNO_EXCEPTIONS is defined. -// -// Default is 1 -// -// Recommended setting: depends on whether you intend to use C++ exceptions -// in your own code (1 if you do, 0 if you don't) -#define wxUSE_EXCEPTIONS 1 - -// Set wxUSE_EXTENDED_RTTI to 1 to use extended RTTI -// -// Default is 0 -// -// Recommended setting: 0 (this is still work in progress...) -#define wxUSE_EXTENDED_RTTI 0 - -// Support for message/error logging. This includes wxLogXXX() functions and -// wxLog and derived classes. Don't set this to 0 unless you really know what -// you are doing. -// -// Default is 1 -// -// Recommended setting: 1 (always) -#define wxUSE_LOG 1 - -// Recommended setting: 1 -#define wxUSE_LOGWINDOW 1 - -// Recommended setting: 1 -#define wxUSE_LOGGUI 1 - -// Recommended setting: 1 -#define wxUSE_LOG_DIALOG 1 - -// Support for command line parsing using wxCmdLineParser class. -// -// Default is 1 -// -// Recommended setting: 1 (can be set to 0 if you don't use the cmd line) -#define wxUSE_CMDLINE_PARSER 1 - -// Support for multithreaded applications: if 1, compile in thread classes -// (thread.h) and make the library a bit more thread safe. Although thread -// support is quite stable by now, you may still consider recompiling the -// library without it if you have no use for it - this will result in a -// somewhat smaller and faster operation. -// -// Notice that if wxNO_THREADS is defined, wxUSE_THREADS is automatically reset -// to 0 in wx/chkconf.h, so, for example, if you set USE_THREADS to 0 in -// build/msw/config.* file this value will have no effect. -// -// Default is 1 -// -// Recommended setting: 0 unless you do plan to develop MT applications -#define wxUSE_THREADS 1 - -// If enabled, compiles wxWidgets streams classes -// -// wx stream classes are used for image IO, process IO redirection, network -// protocols implementation and much more and so disabling this results in a -// lot of other functionality being lost. -// -// Default is 1 -// -// Recommended setting: 1 as setting it to 0 disables many other things -#define wxUSE_STREAMS 1 - -// Support for positional parameters (e.g. %1$d, %2$s ...) in wxVsnprintf. -// Note that if the system's implementation does not support positional -// parameters, setting this to 1 forces the use of the wxWidgets implementation -// of wxVsnprintf. The standard vsnprintf() supports positional parameters on -// many Unix systems but usually doesn't under Windows. -// -// Positional parameters are very useful when translating a program since using -// them in formatting strings allow translators to correctly reorder the -// translated sentences. -// -// Default is 1 -// -// Recommended setting: 1 if you want to support multiple languages -#define wxUSE_PRINTF_POS_PARAMS 1 - -// Enable the use of compiler-specific thread local storage keyword, if any. -// This is used for wxTLS_XXX() macros implementation and normally should use -// the compiler-provided support as it's simpler and more efficient, but must -// not use it if wxWidgets is used in a dynamically loaded Win32 (i.e. using -// LoadLibrary()/GetProcAddress()) as this triggers a bug in compiler TLS -// support that results in crashes when any TLS variables are used. So if you -// are building a Win32 DLL using wxWidgets that can be loaded dynamically, set -// this to 0. -// -// Default is 1, but set to 0 if the scenario above is applicable. -#define wxUSE_COMPILER_TLS 1 - -// ---------------------------------------------------------------------------- -// Interoperability with the standard library. -// ---------------------------------------------------------------------------- - -// Set wxUSE_STL to 1 to enable maximal interoperability with the standard -// library, even at the cost of backwards compatibility. -// -// Default is 0 -// -// Recommended setting: 0 as the options below already provide a relatively -// good level of interoperability and changing this option arguably isn't worth -// diverging from the official builds of the library. -#define wxUSE_STL 0 - -// This is not a real option but is used as the default value for -// wxUSE_STD_IOSTREAM, wxUSE_STD_STRING and wxUSE_STD_CONTAINERS. -// -// Currently the Digital Mars and Watcom compilers come without standard C++ -// library headers by default, wxUSE_STD_STRING can be set to 1 if you do have -// them (e.g. from STLPort). -// -// VC++ 5.0 does include standard C++ library headers, however they produce -// many warnings that can't be turned off when compiled at warning level 4. -#if defined(__DMC__) || defined(__WATCOMC__) \ - || (defined(_MSC_VER) && _MSC_VER < 1200) - #define wxUSE_STD_DEFAULT 0 -#else - #define wxUSE_STD_DEFAULT 1 -#endif - -// Use standard C++ containers to implement wxVector<>, wxStack<>, wxDList<> -// and wxHashXXX<> classes. If disabled, wxWidgets own (mostly compatible but -// usually more limited) implementations are used which allows to avoid the -// dependency on the C++ run-time library. -// -// Notice that the compilers mentioned in wxUSE_STD_DEFAULT comment above don't -// support using standard containers and that VC6 needs non-default options for -// such build to avoid getting "fatal error C1076: compiler limit : internal -// heap limit reached; use /Zm to specify a higher limit" in its own standard -// headers, so you need to ensure you do increase the heap size before enabling -// this option for this compiler. -// -// Default is 0 for compatibility reasons. -// -// Recommended setting: 1 unless compatibility with the official wxWidgets -// build and/or the existing code is a concern. -#define wxUSE_STD_CONTAINERS 0 - -// Use standard C++ streams if 1 instead of wx streams in some places. If -// disabled, wx streams are used everywhere and wxWidgets doesn't depend on the -// standard streams library. -// -// Notice that enabling this does not replace wx streams with std streams -// everywhere, in a lot of places wx streams are used no matter what. -// -// Default is 1 if compiler supports it. -// -// Recommended setting: 1 if you use the standard streams anyhow and so -// dependency on the standard streams library is not a -// problem -#define wxUSE_STD_IOSTREAM wxUSE_STD_DEFAULT - -// Enable minimal interoperability with the standard C++ string class if 1. -// "Minimal" means that wxString can be constructed from std::string or -// std::wstring but can't be implicitly converted to them. You need to enable -// the option below for the latter. -// -// Default is 1 for most compilers. -// -// Recommended setting: 1 unless you want to ensure your program doesn't use -// the standard C++ library at all. -#define wxUSE_STD_STRING wxUSE_STD_DEFAULT - -// Make wxString as much interchangeable with std::[w]string as possible, in -// particular allow implicit conversion of wxString to either of these classes. -// This comes at a price (or a benefit, depending on your point of view) of not -// allowing implicit conversion to "const char *" and "const wchar_t *". -// -// Because a lot of existing code relies on these conversions, this option is -// disabled by default but can be enabled for your build if you don't care -// about compatibility. -// -// Default is 0 if wxUSE_STL has its default value or 1 if it is enabled. -// -// Recommended setting: 0 to remain compatible with the official builds of -// wxWidgets. -#define wxUSE_STD_STRING_CONV_IN_WXSTRING wxUSE_STL - -// VC++ 4.2 and above allows and but you can't mix -// them. Set this option to 1 to use , 0 to use . -// -// Note that newer compilers (including VC++ 7.1 and later) don't support -// wxUSE_IOSTREAMH == 1 and so will be used anyhow. -// -// Default is 0. -// -// Recommended setting: 0, only set to 1 if you use a really old compiler -#define wxUSE_IOSTREAMH 0 - - -// ---------------------------------------------------------------------------- -// non GUI features selection -// ---------------------------------------------------------------------------- - -// Set wxUSE_LONGLONG to 1 to compile the wxLongLong class. This is a 64 bit -// integer which is implemented in terms of native 64 bit integers if any or -// uses emulation otherwise. -// -// This class is required by wxDateTime and so you should enable it if you want -// to use wxDateTime. For most modern platforms, it will use the native 64 bit -// integers in which case (almost) all of its functions are inline and it -// almost does not take any space, so there should be no reason to switch it -// off. -// -// Recommended setting: 1 -#define wxUSE_LONGLONG 1 - -// Set wxUSE_BASE64 to 1, to compile in Base64 support. This is required for -// storing binary data in wxConfig on most platforms. -// -// Default is 1. -// -// Recommended setting: 1 (but can be safely disabled if you don't use it) -#define wxUSE_BASE64 1 - -// Set this to 1 to be able to use wxEventLoop even in console applications -// (i.e. using base library only, without GUI). This is mostly useful for -// processing socket events but is also necessary to use timers in console -// applications -// -// Default is 1. -// -// Recommended setting: 1 (but can be safely disabled if you don't use it) -#define wxUSE_CONSOLE_EVENTLOOP 1 - -// Set wxUSE_(F)FILE to 1 to compile wx(F)File classes. wxFile uses low level -// POSIX functions for file access, wxFFile uses ANSI C stdio.h functions. -// -// Default is 1 -// -// Recommended setting: 1 (wxFile is highly recommended as it is required by -// i18n code, wxFileConfig and others) -#define wxUSE_FILE 1 -#define wxUSE_FFILE 1 - -// Use wxFSVolume class providing access to the configured/active mount points -// -// Default is 1 -// -// Recommended setting: 1 (but may be safely disabled if you don't use it) -#define wxUSE_FSVOLUME 1 - -// Use wxStandardPaths class which allows to retrieve some standard locations -// in the file system -// -// Default is 1 -// -// Recommended setting: 1 (may be disabled to save space, but not much) -#define wxUSE_STDPATHS 1 - -// use wxTextBuffer class: required by wxTextFile -#define wxUSE_TEXTBUFFER 1 - -// use wxTextFile class: requires wxFile and wxTextBuffer, required by -// wxFileConfig -#define wxUSE_TEXTFILE 1 - -// i18n support: _() macro, wxLocale class. Requires wxTextFile. -#define wxUSE_INTL 1 - -// Provide wxFoo_l() functions similar to standard foo() functions but taking -// an extra locale parameter. -// -// Notice that this is fully implemented only for the systems providing POSIX -// xlocale support or Microsoft Visual C++ >= 8 (which provides proprietary -// almost-equivalent of xlocale functions), otherwise wxFoo_l() functions will -// only work for the current user locale and "C" locale. You can use -// wxHAS_XLOCALE_SUPPORT to test whether the full support is available. -// -// Default is 1 -// -// Recommended setting: 1 but may be disabled if you are writing programs -// running only in C locale anyhow -#define wxUSE_XLOCALE 1 - -// Set wxUSE_DATETIME to 1 to compile the wxDateTime and related classes which -// allow to manipulate dates, times and time intervals. wxDateTime replaces the -// old wxTime and wxDate classes which are still provided for backwards -// compatibility (and implemented in terms of wxDateTime). -// -// Note that this class is relatively new and is still officially in alpha -// stage because some features are not yet (fully) implemented. It is already -// quite useful though and should only be disabled if you are aiming at -// absolutely minimal version of the library. -// -// Requires: wxUSE_LONGLONG -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_DATETIME 1 - -// Set wxUSE_TIMER to 1 to compile wxTimer class -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_TIMER 1 - -// Use wxStopWatch clas. -// -// Default is 1 -// -// Recommended setting: 1 (needed by wxSocket) -#define wxUSE_STOPWATCH 1 - -// Set wxUSE_FSWATCHER to 1 if you want to enable wxFileSystemWatcher -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_FSWATCHER 1 - -// Setting wxUSE_CONFIG to 1 enables the use of wxConfig and related classes -// which allow the application to store its settings in the persistent -// storage. Setting this to 1 will also enable on-demand creation of the -// global config object in wxApp. -// -// See also wxUSE_CONFIG_NATIVE below. -// -// Recommended setting: 1 -#define wxUSE_CONFIG 1 - -// If wxUSE_CONFIG is 1, you may choose to use either the native config -// classes under Windows (using .INI files under Win16 and the registry under -// Win32) or the portable text file format used by the config classes under -// Unix. -// -// Default is 1 to use native classes. Note that you may still use -// wxFileConfig even if you set this to 1 - just the config object created by -// default for the applications needs will be a wxRegConfig or wxIniConfig and -// not wxFileConfig. -// -// Recommended setting: 1 -#define wxUSE_CONFIG_NATIVE 1 - -// If wxUSE_DIALUP_MANAGER is 1, compile in wxDialUpManager class which allows -// to connect/disconnect from the network and be notified whenever the dial-up -// network connection is established/terminated. Requires wxUSE_DYNAMIC_LOADER. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_DIALUP_MANAGER 1 - -// Compile in classes for run-time DLL loading and function calling. -// Required by wxUSE_DIALUP_MANAGER. -// -// This setting is for Win32 only -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_DYNLIB_CLASS 1 - -// experimental, don't use for now -#define wxUSE_DYNAMIC_LOADER 1 - -// Set to 1 to use socket classes -#define wxUSE_SOCKETS 1 - -// Set to 1 to use ipv6 socket classes (requires wxUSE_SOCKETS) -// -// Notice that currently setting this option under Windows will result in -// programs which can only run on recent OS versions (with ws2_32.dll -// installed) which is why it is disabled by default. -// -// Default is 1. -// -// Recommended setting: 1 if you need IPv6 support -#define wxUSE_IPV6 0 - -// Set to 1 to enable virtual file systems (required by wxHTML) -#define wxUSE_FILESYSTEM 1 - -// Set to 1 to enable virtual ZIP filesystem (requires wxUSE_FILESYSTEM) -#define wxUSE_FS_ZIP 1 - -// Set to 1 to enable virtual archive filesystem (requires wxUSE_FILESYSTEM) -#define wxUSE_FS_ARCHIVE 1 - -// Set to 1 to enable virtual Internet filesystem (requires wxUSE_FILESYSTEM) -#define wxUSE_FS_INET 1 - -// wxArchive classes for accessing archives such as zip and tar -#define wxUSE_ARCHIVE_STREAMS 1 - -// Set to 1 to compile wxZipInput/OutputStream classes. -#define wxUSE_ZIPSTREAM 1 - -// Set to 1 to compile wxTarInput/OutputStream classes. -#define wxUSE_TARSTREAM 1 - -// Set to 1 to compile wxZlibInput/OutputStream classes. Also required by -// wxUSE_LIBPNG -#define wxUSE_ZLIB 1 - -// If enabled, the code written by Apple will be used to write, in a portable -// way, float on the disk. See extended.c for the license which is different -// from wxWidgets one. -// -// Default is 1. -// -// Recommended setting: 1 unless you don't like the license terms (unlikely) -#define wxUSE_APPLE_IEEE 1 - -// Joystick support class -#define wxUSE_JOYSTICK 1 - -// wxFontEnumerator class -#define wxUSE_FONTENUM 1 - -// wxFontMapper class -#define wxUSE_FONTMAP 1 - -// wxMimeTypesManager class -#define wxUSE_MIMETYPE 1 - -// wxProtocol and related classes: if you want to use either of wxFTP, wxHTTP -// or wxURL you need to set this to 1. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_PROTOCOL 1 - -// The settings for the individual URL schemes -#define wxUSE_PROTOCOL_FILE 1 -#define wxUSE_PROTOCOL_FTP 1 -#define wxUSE_PROTOCOL_HTTP 1 - -// Define this to use wxURL class. -#define wxUSE_URL 1 - -// Define this to use native platform url and protocol support. -// Currently valid only for MS-Windows. -// Note: if you set this to 1, you can open ftp/http/gopher sites -// and obtain a valid input stream for these sites -// even when you set wxUSE_PROTOCOL_FTP/HTTP to 0. -// Doing so reduces the code size. -// -// This code is experimental and subject to change. -#define wxUSE_URL_NATIVE 0 - -// Support for wxVariant class used in several places throughout the library, -// notably in wxDataViewCtrl API. -// -// Default is 1. -// -// Recommended setting: 1 unless you want to reduce the library size as much as -// possible in which case setting this to 0 can gain up to 100KB. -#define wxUSE_VARIANT 1 - -// Support for wxAny class, the successor for wxVariant. -// -// Default is 1. -// -// Recommended setting: 1 unless you want to reduce the library size by a small amount, -// or your compiler cannot for some reason cope with complexity of templates used. -#define wxUSE_ANY 1 - -// Support for regular expression matching via wxRegEx class: enable this to -// use POSIX regular expressions in your code. You need to compile regex -// library from src/regex to use it under Windows. -// -// Default is 0 -// -// Recommended setting: 1 if your compiler supports it, if it doesn't please -// contribute us a makefile for src/regex for it -#define wxUSE_REGEX 1 - -// wxSystemOptions class -#define wxUSE_SYSTEM_OPTIONS 1 - -// wxSound class -#define wxUSE_SOUND 1 - -// Use wxMediaCtrl -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_MEDIACTRL 1 - -// Use wxWidget's XRC XML-based resource system. Recommended. -// -// Default is 1 -// -// Recommended setting: 1 (requires wxUSE_XML) -#define wxUSE_XRC 1 - -// XML parsing classes. Note that their API will change in the future, so -// using wxXmlDocument and wxXmlNode in your app is not recommended. -// -// Default is the same as wxUSE_XRC, i.e. 1 by default. -// -// Recommended setting: 1 (required by XRC) -#define wxUSE_XML wxUSE_XRC - -// Use wxWidget's AUI docking system -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_AUI 1 - -// Use wxWidget's Ribbon classes for interfaces -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_RIBBON 1 - -// Use wxPropertyGrid. -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_PROPGRID 1 - -// Use wxStyledTextCtrl, a wxWidgets implementation of Scintilla. -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_STC 1 - -// Use wxWidget's web viewing classes -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_WEBVIEW 1 - -// Use the IE wxWebView backend -// -// Default is 1 on MSW -// -// Recommended setting: 1 -#ifdef __WXMSW__ -#define wxUSE_WEBVIEW_IE 1 -#else -#define wxUSE_WEBVIEW_IE 0 -#endif - -// Use the WebKit wxWebView backend -// -// Default is 1 on GTK and OSX -// -// Recommended setting: 1 -#if defined(__WXGTK__) || defined(__WXOSX__) -#define wxUSE_WEBVIEW_WEBKIT 1 -#else -#define wxUSE_WEBVIEW_WEBKIT 0 -#endif - -// Enable the new wxGraphicsPath and wxGraphicsContext classes for an advanced -// 2D drawing API. (Still somewhat experimental) -// -// Please note that on Windows gdiplus.dll is loaded dynamically which means -// that nothing special needs to be done as long as you don't use -// wxGraphicsContext at all or only use it on XP and later systems but you -// still do need to distribute it yourself for an application using -// wxGraphicsContext to be runnable on pre-XP systems. -// -// Default is 1 except if you're using a non-Microsoft compiler under Windows -// as only MSVC7+ is known to ship with gdiplus.h. For other compilers (e.g. -// mingw32) you may need to install the headers (and just the headers) -// yourself. If you do, change the setting below manually. -// -// Recommended setting: 1 if supported by the compilation environment - -// notice that we can't use wxCHECK_VISUALC_VERSION() here as this file is -// included from wx/platform.h before wxCHECK_VISUALC_VERSION() is defined -#ifdef _MSC_VER -# if _MSC_VER >= 1310 - // MSVC7.1+ comes with new enough Platform SDK, enable - // wxGraphicsContext support for it -# define wxUSE_GRAPHICS_CONTEXT 1 -# else - // MSVC 6 didn't include GDI+ headers so disable by default, enable it - // here if you use MSVC 6 with a newer SDK -# define wxUSE_GRAPHICS_CONTEXT 0 -# endif -#else - // Disable support for other Windows compilers, enable it if your compiler - // comes with new enough SDK or you installed the headers manually. - // - // Notice that this will be set by configure under non-Windows platforms - // anyhow so the value there is not important. -# define wxUSE_GRAPHICS_CONTEXT 0 -#endif - -// Enable wxGraphicsContext implementation using Cairo library. -// -// This is not needed under Windows and detected automatically by configure -// under other systems, however you may set this to 1 manually if you installed -// Cairo under Windows yourself and prefer to use it instead the native GDI+ -// implementation. -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_CAIRO 0 - - -// ---------------------------------------------------------------------------- -// Individual GUI controls -// ---------------------------------------------------------------------------- - -// You must set wxUSE_CONTROLS to 1 if you are using any controls at all -// (without it, wxControl class is not compiled) -// -// Default is 1 -// -// Recommended setting: 1 (don't change except for very special programs) -#define wxUSE_CONTROLS 1 - -// Support markup in control labels, i.e. provide wxControl::SetLabelMarkup(). -// Currently markup is supported only by a few controls and only some ports but -// their number will increase with time. -// -// Default is 1 -// -// Recommended setting: 1 (may be set to 0 if you want to save on code size) -#define wxUSE_MARKUP 1 - -// wxPopupWindow class is a top level transient window. It is currently used -// to implement wxTipWindow -// -// Default is 1 -// -// Recommended setting: 1 (may be set to 0 if you don't wxUSE_TIPWINDOW) -#define wxUSE_POPUPWIN 1 - -// wxTipWindow allows to implement the custom tooltips, it is used by the -// context help classes. Requires wxUSE_POPUPWIN. -// -// Default is 1 -// -// Recommended setting: 1 (may be set to 0) -#define wxUSE_TIPWINDOW 1 - -// Each of the settings below corresponds to one wxWidgets control. They are -// all switched on by default but may be disabled if you are sure that your -// program (including any standard dialogs it can show!) doesn't need them and -// if you desperately want to save some space. If you use any of these you must -// set wxUSE_CONTROLS as well. -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_ANIMATIONCTRL 1 // wxAnimationCtrl -#define wxUSE_BANNERWINDOW 1 // wxBannerWindow -#define wxUSE_BUTTON 1 // wxButton -#define wxUSE_BMPBUTTON 1 // wxBitmapButton -#define wxUSE_CALENDARCTRL 1 // wxCalendarCtrl -#define wxUSE_CHECKBOX 1 // wxCheckBox -#define wxUSE_CHECKLISTBOX 1 // wxCheckListBox (requires wxUSE_OWNER_DRAWN) -#define wxUSE_CHOICE 1 // wxChoice -#define wxUSE_COLLPANE 1 // wxCollapsiblePane -#define wxUSE_COLOURPICKERCTRL 1 // wxColourPickerCtrl -#define wxUSE_COMBOBOX 1 // wxComboBox -#define wxUSE_COMMANDLINKBUTTON 1 // wxCommandLinkButton -#define wxUSE_DATAVIEWCTRL 1 // wxDataViewCtrl -#define wxUSE_DATEPICKCTRL 1 // wxDatePickerCtrl -#define wxUSE_DIRPICKERCTRL 1 // wxDirPickerCtrl -#define wxUSE_EDITABLELISTBOX 1 // wxEditableListBox -#define wxUSE_FILECTRL 1 // wxFileCtrl -#define wxUSE_FILEPICKERCTRL 1 // wxFilePickerCtrl -#define wxUSE_FONTPICKERCTRL 1 // wxFontPickerCtrl -#define wxUSE_GAUGE 1 // wxGauge -#define wxUSE_HEADERCTRL 1 // wxHeaderCtrl -#define wxUSE_HYPERLINKCTRL 1 // wxHyperlinkCtrl -#define wxUSE_LISTBOX 1 // wxListBox -#define wxUSE_LISTCTRL 1 // wxListCtrl -#define wxUSE_RADIOBOX 1 // wxRadioBox -#define wxUSE_RADIOBTN 1 // wxRadioButton -#define wxUSE_RICHMSGDLG 1 // wxRichMessageDialog -#define wxUSE_SCROLLBAR 1 // wxScrollBar -#define wxUSE_SEARCHCTRL 1 // wxSearchCtrl -#define wxUSE_SLIDER 1 // wxSlider -#define wxUSE_SPINBTN 1 // wxSpinButton -#define wxUSE_SPINCTRL 1 // wxSpinCtrl -#define wxUSE_STATBOX 1 // wxStaticBox -#define wxUSE_STATLINE 1 // wxStaticLine -#define wxUSE_STATTEXT 1 // wxStaticText -#define wxUSE_STATBMP 1 // wxStaticBitmap -#define wxUSE_TEXTCTRL 1 // wxTextCtrl -#define wxUSE_TIMEPICKCTRL 1 // wxTimePickerCtrl -#define wxUSE_TOGGLEBTN 1 // requires wxButton -#define wxUSE_TREECTRL 1 // wxTreeCtrl -#define wxUSE_TREELISTCTRL 1 // wxTreeListCtrl - -// Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR -// below either wxStatusBar95 or a generic wxStatusBar will be used. -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_STATUSBAR 1 - -// Two status bar implementations are available under Win32: the generic one -// or the wrapper around native control. For native look and feel the native -// version should be used. -// -// Default is 1 for the platforms where native status bar is supported. -// -// Recommended setting: 1 (there is no advantage in using the generic one) -#define wxUSE_NATIVE_STATUSBAR 1 - -// wxToolBar related settings: if wxUSE_TOOLBAR is 0, don't compile any toolbar -// classes at all. Otherwise, use the native toolbar class unless -// wxUSE_TOOLBAR_NATIVE is 0. -// -// Default is 1 for all settings. -// -// Recommended setting: 1 for wxUSE_TOOLBAR and wxUSE_TOOLBAR_NATIVE. -#define wxUSE_TOOLBAR 1 -#define wxUSE_TOOLBAR_NATIVE 1 - -// wxNotebook is a control with several "tabs" located on one of its sides. It -// may be used to logically organise the data presented to the user instead of -// putting everything in one huge dialog. It replaces wxTabControl and related -// classes of wxWin 1.6x. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_NOTEBOOK 1 - -// wxListbook control is similar to wxNotebook but uses wxListCtrl instead of -// the tabs -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_LISTBOOK 1 - -// wxChoicebook control is similar to wxNotebook but uses wxChoice instead of -// the tabs -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_CHOICEBOOK 1 - -// wxTreebook control is similar to wxNotebook but uses wxTreeCtrl instead of -// the tabs -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_TREEBOOK 1 - -// wxToolbook control is similar to wxNotebook but uses wxToolBar instead of -// tabs -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_TOOLBOOK 1 - -// wxTaskBarIcon is a small notification icon shown in the system toolbar or -// dock. -// -// Default is 1. -// -// Recommended setting: 1 (but can be set to 0 if you don't need it) -#define wxUSE_TASKBARICON 1 - -// wxGrid class -// -// Default is 1, set to 0 to cut down compilation time and binaries size if you -// don't use it. -// -// Recommended setting: 1 -// -#define wxUSE_GRID 1 - -// wxMiniFrame class: a frame with narrow title bar -// -// Default is 1. -// -// Recommended setting: 1 (it doesn't cost almost anything) -#define wxUSE_MINIFRAME 1 - -// wxComboCtrl and related classes: combobox with custom popup window and -// not necessarily a listbox. -// -// Default is 1. -// -// Recommended setting: 1 but can be safely set to 0 except for wxUniv where it -// it used by wxComboBox -#define wxUSE_COMBOCTRL 1 - -// wxOwnerDrawnComboBox is a custom combobox allowing to paint the combobox -// items. -// -// Default is 1. -// -// Recommended setting: 1 but can be safely set to 0, except where it is -// needed as a base class for generic wxBitmapComboBox. -#define wxUSE_ODCOMBOBOX 1 - -// wxBitmapComboBox is a combobox that can have images in front of text items. -// -// Default is 1. -// -// Recommended setting: 1 but can be safely set to 0 -#define wxUSE_BITMAPCOMBOBOX 1 - -// wxRearrangeCtrl is a wxCheckListBox with two buttons allowing to move items -// up and down in it. It is also used as part of wxRearrangeDialog. -// -// Default is 1. -// -// Recommended setting: 1 but can be safely set to 0 (currently used only by -// wxHeaderCtrl) -#define wxUSE_REARRANGECTRL 1 - -// ---------------------------------------------------------------------------- -// Miscellaneous GUI stuff -// ---------------------------------------------------------------------------- - -// wxAcceleratorTable/Entry classes and support for them in wxMenu(Bar) -#define wxUSE_ACCEL 1 - -// Use the standard art provider. The icons returned by this provider are -// embedded into the library as XPMs so disabling it reduces the library size -// somewhat but this should only be done if you use your own custom art -// provider returning the icons or never use any icons not provided by the -// native art provider (which might not be implemented at all for some -// platforms) or by the Tango icons provider (if it's not itself disabled -// below). -// -// Default is 1. -// -// Recommended setting: 1 unless you use your own custom art provider. -#define wxUSE_ARTPROVIDER_STD 1 - -// Use art provider providing Tango icons: this art provider has higher quality -// icons than the default ones using smaller size XPM icons without -// transparency but the embedded PNG icons add to the library size. -// -// Default is 1 under non-GTK ports. Under wxGTK the native art provider using -// the GTK+ stock icons replaces it so it is normally not necessary. -// -// Recommended setting: 1 but can be turned off to reduce the library size. -#define wxUSE_ARTPROVIDER_TANGO 1 - -// Hotkey support (currently Windows only) -#define wxUSE_HOTKEY 1 - -// Use wxCaret: a class implementing a "cursor" in a text control (called caret -// under Windows). -// -// Default is 1. -// -// Recommended setting: 1 (can be safely set to 0, not used by the library) -#define wxUSE_CARET 1 - -// Use wxDisplay class: it allows enumerating all displays on a system and -// their geometries as well as finding the display on which the given point or -// window lies. -// -// Default is 1. -// -// Recommended setting: 1 if you need it, can be safely set to 0 otherwise -#define wxUSE_DISPLAY 1 - -// Miscellaneous geometry code: needed for Canvas library -#define wxUSE_GEOMETRY 1 - -// Use wxImageList. This class is needed by wxNotebook, wxTreeCtrl and -// wxListCtrl. -// -// Default is 1. -// -// Recommended setting: 1 (set it to 0 if you don't use any of the controls -// enumerated above, then this class is mostly useless too) -#define wxUSE_IMAGLIST 1 - -// Use wxInfoBar class. -// -// Default is 1. -// -// Recommended setting: 1 (but can be disabled without problems as nothing -// depends on it) -#define wxUSE_INFOBAR 1 - -// Use wxMenu, wxMenuBar, wxMenuItem. -// -// Default is 1. -// -// Recommended setting: 1 (can't be disabled under MSW) -#define wxUSE_MENUS 1 - -// Use wxNotificationMessage. -// -// wxNotificationMessage allows to show non-intrusive messages to the user -// using balloons, banners, popups or whatever is the appropriate method for -// the current platform. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_NOTIFICATION_MESSAGE 1 - -// wxRichToolTip is a customizable tooltip class which has more functionality -// than the stock (but native, unlike this class) wxToolTip. -// -// Default is 1. -// -// Recommended setting: 1 (but can be safely set to 0 if you don't need it) -#define wxUSE_RICHTOOLTIP 1 - -// Use wxSashWindow class. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_SASH 1 - -// Use wxSplitterWindow class. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_SPLITTER 1 - -// Use wxToolTip and wxWindow::Set/GetToolTip() methods. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_TOOLTIPS 1 - -// wxValidator class and related methods -#define wxUSE_VALIDATORS 1 - -// Use reference counted ID management: this means that wxWidgets will track -// the automatically allocated ids (those used when you use wxID_ANY when -// creating a window, menu or toolbar item &c) instead of just supposing that -// the program never runs out of them. This is mostly useful only under wxMSW -// where the total ids range is limited to SHRT_MIN..SHRT_MAX and where -// long-running programs can run into problems with ids reuse without this. On -// the other platforms, where the ids have the full int range, this shouldn't -// be necessary. -#ifdef __WXMSW__ -#define wxUSE_AUTOID_MANAGEMENT 1 -#else -#define wxUSE_AUTOID_MANAGEMENT 0 -#endif - -// ---------------------------------------------------------------------------- -// common dialogs -// ---------------------------------------------------------------------------- - -// On rare occasions (e.g. using DJGPP) may want to omit common dialogs (e.g. -// file selector, printer dialog). Switching this off also switches off the -// printing architecture and interactive wxPrinterDC. -// -// Default is 1 -// -// Recommended setting: 1 (unless it really doesn't work) -#define wxUSE_COMMON_DIALOGS 1 - -// wxBusyInfo displays window with message when app is busy. Works in same way -// as wxBusyCursor -#define wxUSE_BUSYINFO 1 - -// Use single/multiple choice dialogs. -// -// Default is 1 -// -// Recommended setting: 1 (used in the library itself) -#define wxUSE_CHOICEDLG 1 - -// Use colour picker dialog -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_COLOURDLG 1 - -// wxDirDlg class for getting a directory name from user -#define wxUSE_DIRDLG 1 - -// TODO: setting to choose the generic or native one - -// Use file open/save dialogs. -// -// Default is 1 -// -// Recommended setting: 1 (used in many places in the library itself) -#define wxUSE_FILEDLG 1 - -// Use find/replace dialogs. -// -// Default is 1 -// -// Recommended setting: 1 (but may be safely set to 0) -#define wxUSE_FINDREPLDLG 1 - -// Use font picker dialog -// -// Default is 1 -// -// Recommended setting: 1 (used in the library itself) -#define wxUSE_FONTDLG 1 - -// Use wxMessageDialog and wxMessageBox. -// -// Default is 1 -// -// Recommended setting: 1 (used in the library itself) -#define wxUSE_MSGDLG 1 - -// progress dialog class for lengthy operations -#define wxUSE_PROGRESSDLG 1 - -// support for startup tips (wxShowTip &c) -#define wxUSE_STARTUP_TIPS 1 - -// text entry dialog and wxGetTextFromUser function -#define wxUSE_TEXTDLG 1 - -// number entry dialog -#define wxUSE_NUMBERDLG 1 - -// splash screen class -#define wxUSE_SPLASH 1 - -// wizards -#define wxUSE_WIZARDDLG 1 - -// Compile in wxAboutBox() function showing the standard "About" dialog. -// -// Default is 1 -// -// Recommended setting: 1 but can be set to 0 to save some space if you don't -// use this function -#define wxUSE_ABOUTDLG 1 - -// wxFileHistory class -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_FILE_HISTORY 1 - -// ---------------------------------------------------------------------------- -// Metafiles support -// ---------------------------------------------------------------------------- - -// Windows supports the graphics format known as metafile which is, though not -// portable, is widely used under Windows and so is supported by wxWin (under -// Windows only, of course). Win16 (Win3.1) used the so-called "Window -// MetaFiles" or WMFs which were replaced with "Enhanced MetaFiles" or EMFs in -// Win32 (Win9x, NT, 2000). Both of these are supported in wxWin and, by -// default, WMFs will be used under Win16 and EMFs under Win32. This may be -// changed by setting wxUSE_WIN_METAFILES_ALWAYS to 1 and/or setting -// wxUSE_ENH_METAFILE to 0. You may also set wxUSE_METAFILE to 0 to not compile -// in any metafile related classes at all. -// -// Default is 1 for wxUSE_ENH_METAFILE and 0 for wxUSE_WIN_METAFILES_ALWAYS. -// -// Recommended setting: default or 0 for everything for portable programs. -#define wxUSE_METAFILE 1 -#define wxUSE_ENH_METAFILE 1 -#define wxUSE_WIN_METAFILES_ALWAYS 0 - -// ---------------------------------------------------------------------------- -// Big GUI components -// ---------------------------------------------------------------------------- - -// Set to 0 to disable MDI support. -// -// Requires wxUSE_NOTEBOOK under platforms other than MSW. -// -// Default is 1. -// -// Recommended setting: 1, can be safely set to 0. -#define wxUSE_MDI 1 - -// Set to 0 to disable document/view architecture -#define wxUSE_DOC_VIEW_ARCHITECTURE 1 - -// Set to 0 to disable MDI document/view architecture -// -// Requires wxUSE_MDI && wxUSE_DOC_VIEW_ARCHITECTURE -#define wxUSE_MDI_ARCHITECTURE 1 - -// Set to 0 to disable print/preview architecture code -#define wxUSE_PRINTING_ARCHITECTURE 1 - -// wxHTML sublibrary allows to display HTML in wxWindow programs and much, -// much more. -// -// Default is 1. -// -// Recommended setting: 1 (wxHTML is great!), set to 0 if you want compile a -// smaller library. -#define wxUSE_HTML 1 - -// Setting wxUSE_GLCANVAS to 1 enables OpenGL support. You need to have OpenGL -// headers and libraries to be able to compile the library with wxUSE_GLCANVAS -// set to 1 and, under Windows, also to add opengl32.lib and glu32.lib to the -// list of libraries used to link your application (although this is done -// implicitly for Microsoft Visual C++ users). -// -// Default is 1 unless the compiler is known to ship without the necessary -// headers (Digital Mars) or the platform doesn't support OpenGL (Windows CE). -// -// Recommended setting: 1 if you intend to use OpenGL, can be safely set to 0 -// otherwise. -#define wxUSE_GLCANVAS 1 - -// wxRichTextCtrl allows editing of styled text. -// -// Default is 1. -// -// Recommended setting: 1, set to 0 if you want compile a -// smaller library. -#define wxUSE_RICHTEXT 1 - -// ---------------------------------------------------------------------------- -// Data transfer -// ---------------------------------------------------------------------------- - -// Use wxClipboard class for clipboard copy/paste. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_CLIPBOARD 1 - -// Use wxDataObject and related classes. Needed for clipboard and OLE drag and -// drop -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_DATAOBJ 1 - -// Use wxDropTarget and wxDropSource classes for drag and drop (this is -// different from "built in" drag and drop in wxTreeCtrl which is always -// available). Requires wxUSE_DATAOBJ. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_DRAG_AND_DROP 1 - -// Use wxAccessible for enhanced and customisable accessibility. -// Depends on wxUSE_OLE. -// -// Default is 0. -// -// Recommended setting (at present): 0 -#define wxUSE_ACCESSIBILITY 0 - -// ---------------------------------------------------------------------------- -// miscellaneous settings -// ---------------------------------------------------------------------------- - -// wxSingleInstanceChecker class allows to verify at startup if another program -// instance is running. -// -// Default is 1 -// -// Recommended setting: 1 (the class is tiny, disabling it won't save much -// space) -#define wxUSE_SNGLINST_CHECKER 1 - -#define wxUSE_DRAGIMAGE 1 - -#define wxUSE_IPC 1 - // 0 for no interprocess comms -#define wxUSE_HELP 1 - // 0 for no help facility - -// Should we use MS HTML help for wxHelpController? If disabled, neither -// wxCHMHelpController nor wxBestHelpController are available. -// -// Default is 1 under MSW, 0 is always used for the other platforms. -// -// Recommended setting: 1, only set to 0 if you have trouble compiling -// wxCHMHelpController (could be a problem with really ancient compilers) -#define wxUSE_MS_HTML_HELP 1 - - -// Use wxHTML-based help controller? -#define wxUSE_WXHTML_HELP 1 - -#define wxUSE_CONSTRAINTS 1 - // 0 for no window layout constraint system - -#define wxUSE_SPLINES 1 - // 0 for no splines - -#define wxUSE_MOUSEWHEEL 1 - // Include mouse wheel support - -// Compile wxUIActionSimulator class? -#define wxUSE_UIACTIONSIMULATOR 1 - -// ---------------------------------------------------------------------------- -// wxDC classes for various output formats -// ---------------------------------------------------------------------------- - -// Set to 1 for PostScript device context. -#define wxUSE_POSTSCRIPT 0 - -// Set to 1 to use font metric files in GetTextExtent -#define wxUSE_AFM_FOR_POSTSCRIPT 1 - -// Set to 1 to compile in support for wxSVGFileDC, a wxDC subclass which allows -// to create files in SVG (Scalable Vector Graphics) format. -#define wxUSE_SVG 1 - -// Should wxDC provide SetTransformMatrix() and related methods? -// -// Default is 1 but can be set to 0 if this functionality is not used. Notice -// that currently only wxMSW supports this so setting this to 0 doesn't change -// much for non-MSW platforms (although it will still save a few bytes -// probably). -// -// Recommended setting: 1. -#define wxUSE_DC_TRANSFORM_MATRIX 1 - -// ---------------------------------------------------------------------------- -// image format support -// ---------------------------------------------------------------------------- - -// wxImage supports many different image formats which can be configured at -// compile-time. BMP is always supported, others are optional and can be safely -// disabled if you don't plan to use images in such format sometimes saving -// substantial amount of code in the final library. -// -// Some formats require an extra library which is included in wxWin sources -// which is mentioned if it is the case. - -// Set to 1 for wxImage support (recommended). -#define wxUSE_IMAGE 1 - -// Set to 1 for PNG format support (requires libpng). Also requires wxUSE_ZLIB. -#define wxUSE_LIBPNG 1 - -// Set to 1 for JPEG format support (requires libjpeg) -#define wxUSE_LIBJPEG 1 - -// Set to 1 for TIFF format support (requires libtiff) -#define wxUSE_LIBTIFF 1 - -// Set to 1 for TGA format support (loading only) -#define wxUSE_TGA 1 - -// Set to 1 for GIF format support -#define wxUSE_GIF 1 - -// Set to 1 for PNM format support -#define wxUSE_PNM 1 - -// Set to 1 for PCX format support -#define wxUSE_PCX 1 - -// Set to 1 for IFF format support (Amiga format) -#define wxUSE_IFF 0 - -// Set to 1 for XPM format support -#define wxUSE_XPM 1 - -// Set to 1 for MS Icons and Cursors format support -#define wxUSE_ICO_CUR 1 - -// Set to 1 to compile in wxPalette class -#define wxUSE_PALETTE 1 - -// ---------------------------------------------------------------------------- -// wxUniversal-only options -// ---------------------------------------------------------------------------- - -// Set to 1 to enable compilation of all themes, this is the default -#define wxUSE_ALL_THEMES 1 - -// Set to 1 to enable the compilation of individual theme if wxUSE_ALL_THEMES -// is unset, if it is set these options are not used; notice that metal theme -// uses Win32 one -#define wxUSE_THEME_GTK 0 -#define wxUSE_THEME_METAL 0 -#define wxUSE_THEME_MONO 0 -#define wxUSE_THEME_WIN32 0 - - -/* --- end common options --- */ - -/* --- start MSW options --- */ -// ---------------------------------------------------------------------------- -// Windows-only settings -// ---------------------------------------------------------------------------- - -// Set wxUSE_UNICODE_MSLU to 1 if you're compiling wxWidgets in Unicode mode -// and want to run your programs under Windows 9x and not only NT/2000/XP. -// This setting enables use of unicows.dll from MSLU (MS Layer for Unicode, see -// http://www.microsoft.com/globaldev/handson/dev/mslu_announce.mspx). Note -// that you will have to modify the makefiles to include unicows.lib import -// library as the first library (see installation instructions in install.txt -// to learn how to do it when building the library or samples). -// -// If your compiler doesn't have unicows.lib, you can get a version of it at -// http://libunicows.sourceforge.net -// -// Default is 0 -// -// Recommended setting: 0 (1 if you want to deploy Unicode apps on 9x systems) -#ifndef wxUSE_UNICODE_MSLU - #define wxUSE_UNICODE_MSLU 0 -#endif - -// Set this to 1 if you want to use wxWidgets and MFC in the same program. This -// will override some other settings (see below) -// -// Default is 0. -// -// Recommended setting: 0 unless you really have to use MFC -#define wxUSE_MFC 0 - -// Set this to 1 for generic OLE support: this is required for drag-and-drop, -// clipboard, OLE Automation. Only set it to 0 if your compiler is very old and -// can't compile/doesn't have the OLE headers. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_OLE 1 - -// Set this to 1 to enable wxAutomationObject class. -// -// Default is 1. -// -// Recommended setting: 1 if you need to control other applications via OLE -// Automation, can be safely set to 0 otherwise -#define wxUSE_OLE_AUTOMATION 1 - -// Set this to 1 to enable wxActiveXContainer class allowing to embed OLE -// controls in wx. -// -// Default is 1. -// -// Recommended setting: 1, required by wxMediaCtrl -#define wxUSE_ACTIVEX 1 - -// wxDC caching implementation -#define wxUSE_DC_CACHEING 1 - -// Set this to 1 to enable wxDIB class used internally for manipulating -// wxBitmap data. -// -// Default is 1, set it to 0 only if you don't use wxImage neither -// -// Recommended setting: 1 (without it conversion to/from wxImage won't work) -#define wxUSE_WXDIB 1 - -// Set to 0 to disable PostScript print/preview architecture code under Windows -// (just use Windows printing). -#define wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW 1 - -// Set this to 1 to compile in wxRegKey class. -// -// Default is 1 -// -// Recommended setting: 1, this is used internally by wx in a few places -#define wxUSE_REGKEY 1 - -// Set this to 1 to use RICHEDIT controls for wxTextCtrl with style wxTE_RICH -// which allows to put more than ~32Kb of text in it even under Win9x (NT -// doesn't have such limitation). -// -// Default is 1 for compilers which support it -// -// Recommended setting: 1, only set it to 0 if your compiler doesn't have -// or can't compile -#define wxUSE_RICHEDIT 1 - -// Set this to 1 to use extra features of richedit v2 and later controls -// -// Default is 1 for compilers which support it -// -// Recommended setting: 1 -#define wxUSE_RICHEDIT2 1 - -// Set this to 1 to enable support for the owner-drawn menu and listboxes. This -// is required by wxUSE_CHECKLISTBOX. -// -// Default is 1. -// -// Recommended setting: 1, set to 0 for a small library size reduction -#define wxUSE_OWNER_DRAWN 1 - -// Set this to 1 to enable MSW-specific wxTaskBarIcon::ShowBalloon() method. It -// is required by native wxNotificationMessage implementation. -// -// Default is 1 but disabled in wx/msw/chkconf.h if SDK is too old to contain -// the necessary declarations. -// -// Recommended setting: 1, set to 0 for a tiny library size reduction -#define wxUSE_TASKBARICON_BALLOONS 1 - -// Set to 1 to compile MS Windows XP theme engine support -#define wxUSE_UXTHEME 1 - -// Set to 1 to use InkEdit control (Tablet PC), if available -#define wxUSE_INKEDIT 0 - -// Set to 1 to enable .INI files based wxConfig implementation (wxIniConfig) -// -// Default is 0. -// -// Recommended setting: 0, nobody uses .INI files any more -#define wxUSE_INICONF 0 - -// ---------------------------------------------------------------------------- -// Generic versions of native controls -// ---------------------------------------------------------------------------- - -// Set this to 1 to be able to use wxDatePickerCtrlGeneric in addition to the -// native wxDatePickerCtrl -// -// Default is 0. -// -// Recommended setting: 0, this is mainly used for testing -#define wxUSE_DATEPICKCTRL_GENERIC 0 - -// Set this to 1 to be able to use wxTimePickerCtrlGeneric in addition to the -// native wxTimePickerCtrl for the platforms that have the latter (MSW). -// -// Default is 0. -// -// Recommended setting: 0, this is mainly used for testing -#define wxUSE_TIMEPICKCTRL_GENERIC 0 - -// ---------------------------------------------------------------------------- -// Crash debugging helpers -// ---------------------------------------------------------------------------- - -// Set this to 1 to be able to use wxCrashReport::Generate() to create mini -// dumps of your program when it crashes (or at any other moment) -// -// Default is 1 if supported by the compiler (VC++ and recent BC++ only). -// -// Recommended setting: 1, set to 0 if your programs never crash -#define wxUSE_CRASHREPORT 1 -/* --- end MSW options --- */ - -#endif // _WX_SETUP_H_ - diff --git a/Source/3rd Party/wx/lib/vc_lib/mswud/wx/setup.h b/Source/3rd Party/wx/lib/vc_lib/mswud/wx/setup.h index acb2276b9..2497beddc 100644 --- a/Source/3rd Party/wx/lib/vc_lib/mswud/wx/setup.h +++ b/Source/3rd Party/wx/lib/vc_lib/mswud/wx/setup.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: setup0.h 60190 2009-04-16 00:57:35Z KO $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -27,6 +27,14 @@ // compatibility settings // ---------------------------------------------------------------------------- +// This setting determines the compatibility with 2.4 API: set it to 1 to +// enable it but please consider updating your code instead. +// +// Default is 0 +// +// Recommended setting: 0 (please update your code) +#define WXWIN_COMPATIBILITY_2_4 0 + // This setting determines the compatibility with 2.6 API: set it to 0 to // flag all cases of using deprecated functions. // @@ -35,17 +43,7 @@ // in the version after it completely. // // Recommended setting: 0 (please update your code) -#define WXWIN_COMPATIBILITY_2_6 0 - -// This setting determines the compatibility with 2.8 API: set it to 0 to -// flag all cases of using deprecated functions. -// -// Default is 1 but please try building your code with 0 as the default will -// change to 0 in the next version and the deprecated functions will disappear -// in the version after it completely. -// -// Recommended setting: 0 (please update your code) -#define WXWIN_COMPATIBILITY_2_8 1 +#define WXWIN_COMPATIBILITY_2_6 1 // MSW-only: Set to 0 for accurate dialog units, else 1 for old behaviour when // default system font is used for wxWindow::GetCharWidth/Height() instead of @@ -60,50 +58,6 @@ // debugging settings // ---------------------------------------------------------------------------- -// wxDEBUG_LEVEL will be defined as 1 in wx/debug.h so normally there is no -// need to define it here. You may do it for two reasons: either completely -// disable/compile out the asserts in release version (then do it inside #ifdef -// NDEBUG) or, on the contrary, enable more asserts, including the usually -// disabled ones, in the debug build (then do it inside #ifndef NDEBUG) -// -// #ifdef NDEBUG -// #define wxDEBUG_LEVEL 0 -// #else -// #define wxDEBUG_LEVEL 2 -// #endif - -// wxHandleFatalExceptions() may be used to catch the program faults at run -// time and, instead of terminating the program with a usual GPF message box, -// call the user-defined wxApp::OnFatalException() function. If you set -// wxUSE_ON_FATAL_EXCEPTION to 0, wxHandleFatalExceptions() will not work. -// -// This setting is for Win32 only and can only be enabled if your compiler -// supports Win32 structured exception handling (currently only VC++ does) -// -// Default is 1 -// -// Recommended setting: 1 if your compiler supports it. -#define wxUSE_ON_FATAL_EXCEPTION 1 - -// Set this to 1 to be able to generate a human-readable (unlike -// machine-readable minidump created by wxCrashReport::Generate()) stack back -// trace when your program crashes using wxStackWalker -// -// Default is 1 if supported by the compiler. -// -// Recommended setting: 1, set to 0 if your programs never crash -#define wxUSE_STACKWALKER 1 - -// Set this to 1 to compile in wxDebugReport class which allows you to create -// and optionally upload to your web site a debug report consisting of back -// trace of the crash (if wxUSE_STACKWALKER == 1) and other information. -// -// Default is 1 if supported by the compiler. -// -// Recommended setting: 1, it is compiled into a separate library so there -// is no overhead if you don't use it -#define wxUSE_DEBUGREPORT 1 - // Generic comment about debugging settings: they are very useful if you don't // use any other memory leak detection tools such as Purify/BoundsChecker, but // are probably redundant otherwise. Also, Visual C++ CRT has the same features @@ -111,13 +65,10 @@ // may prefer to use it instead of built in memory debugging code because it is // faster and more fool proof. // -// Using VC++ CRT memory debugging is enabled by default in debug build (_DEBUG -// is defined) if wxUSE_GLOBAL_MEMORY_OPERATORS is *not* enabled (i.e. is 0) +// Using VC++ CRT memory debugging is enabled by default in debug mode +// (__WXDEBUG__) if wxUSE_GLOBAL_MEMORY_OPERATORS is *not* enabled (i.e. is 0) // and if __NO_VC_CRTDBG__ is not defined. -// The rest of the options in this section are obsolete and not supported, -// enable them at your own risk. - // If 1, enables wxDebugContext, for writing error messages to file, etc. If // __WXDEBUG__ is not defined, will still use the normal memory operators. // @@ -151,27 +102,72 @@ // In debug mode, causes new to be defined to be WXDEBUG_NEW (see object.h). If // this causes problems (e.g. link errors), set this to 0. You may need to set // this to 0 if using templates (at least for VC++). This switch is currently -// ignored for MinGW/Cygwin. +// ignored for mingw / cygwin / CodeWarrior // // Default is 0 // // Recommended setting: 0 #define wxUSE_DEBUG_NEW_ALWAYS 0 +// wxHandleFatalExceptions() may be used to catch the program faults at run +// time and, instead of terminating the program with a usual GPF message box, +// call the user-defined wxApp::OnFatalException() function. If you set +// wxUSE_ON_FATAL_EXCEPTION to 0, wxHandleFatalExceptions() will not work. +// +// This setting is for Win32 only and can only be enabled if your compiler +// supports Win32 structured exception handling (currently only VC++ does) +// +// Default is 1 +// +// Recommended setting: 1 if your compiler supports it. +#define wxUSE_ON_FATAL_EXCEPTION 1 + +// Set this to 1 to be able to generate a human-readable (unlike +// machine-readable minidump created by wxCrashReport::Generate()) stack back +// trace when your program crashes using wxStackWalker +// +// Default is 1 if supported by the compiler. +// +// Recommended setting: 1, set to 0 if your programs never crash +#define wxUSE_STACKWALKER 1 + +// Set this to 1 to compile in wxDebugReport class which allows you to create +// and optionally upload to your web site a debug report consisting of back +// trace of the crash (if wxUSE_STACKWALKER == 1) and other information. +// +// Default is 1 if supported by the compiler. +// +// Recommended setting: 1, it is compiled into a separate library so there +// is no overhead if you don't use it +#define wxUSE_DEBUGREPORT 1 // ---------------------------------------------------------------------------- // Unicode support // ---------------------------------------------------------------------------- -// These settings are obsolete: the library is always built in Unicode mode -// now, only set wxUSE_UNICODE to 0 to compile legacy code in ANSI mode if -// absolutely necessary -- updating it is strongly recommended as the ANSI mode -// will disappear completely in future wxWidgets releases. +// Set wxUSE_UNICODE to 1 to compile wxWidgets in Unicode mode: wxChar will be +// defined as wchar_t, wxString will use Unicode internally. If you set this +// to 1, you must use wxT() macro for all literal strings in the program. +// +// Unicode is currently only fully supported under Windows NT/2000/XP +// (Windows 9x doesn't support it and the programs compiled in Unicode mode +// will not run under 9x -- but see wxUSE_UNICODE_MSLU below). +// +// Default is 0 +// +// Recommended setting: 0 (unless you only plan to use Windows NT/2000/XP) #ifndef wxUSE_UNICODE - #define wxUSE_UNICODE 1 + #define wxUSE_UNICODE 0 #endif -// wxUSE_WCHAR_T is required by wxWidgets now, don't change. +// Setting wxUSE_WCHAR_T to 1 gives you some degree of Unicode support without +// compiling the program in Unicode mode. More precisely, it will be possible +// to construct wxString from a wide (Unicode) string and convert any wxString +// to Unicode. +// +// Default is 1 +// +// Recommended setting: 1 #define wxUSE_WCHAR_T 1 // ---------------------------------------------------------------------------- @@ -201,6 +197,15 @@ // Recommended setting: 0 (this is still work in progress...) #define wxUSE_EXTENDED_RTTI 0 +// Set wxUSE_STL to 1 to derive wxList(Foo) and wxArray(Foo) from +// std::list and std::vector, with a compatibility interface, +// and for wxHashMap to be implemented with templates. +// +// Default is 0 +// +// Recommended setting: YMMV +#define wxUSE_STL 0 + // Support for message/error logging. This includes wxLogXXX() functions and // wxLog and derived classes. Don't set this to 0 unless you really know what // you are doing. @@ -252,6 +257,37 @@ // Recommended setting: 1 as setting it to 0 disables many other things #define wxUSE_STREAMS 1 +// Use standard C++ streams if 1 instead of wx streams in some places. If +// disabled (default), wx streams are used everywhere and wxWidgets doesn't +// depend on the standard streams library. +// +// Notice that enabling this does not replace wx streams with std streams +// everywhere, in a lot of places wx streams are used no matter what. +// +// Default is 0 +// +// Recommended setting: 1 if you use the standard streams anyhow and so +// dependency on the standard streams library is not a +// problem +#define wxUSE_STD_IOSTREAM 0 + +// Enable conversion to standard C++ string if 1. +// +// Default is 1 for most compilers. +// +// Currently the Digital Mars and Watcom compilers come without standard C++ +// library headers by default, wxUSE_STD_STRING can be set to 1 if you do have +// them (e.g. from STLPort). +// +// VC++ 5.0 does include standard C++ library header, however they produce +// many warnings that can't be turned off when compiled at warning level 4. +#if defined(__DMC__) || defined(__WATCOMC__) \ + || (defined(_MSC_VER) && _MSC_VER < 1200) + #define wxUSE_STD_STRING 0 +#else + #define wxUSE_STD_STRING 1 +#endif + // Support for positional parameters (e.g. %1$d, %2$s ...) in wxVsnprintf. // Note that if the system's implementation does not support positional // parameters, setting this to 1 forces the use of the wxWidgets implementation @@ -267,118 +303,6 @@ // Recommended setting: 1 if you want to support multiple languages #define wxUSE_PRINTF_POS_PARAMS 1 -// Enable the use of compiler-specific thread local storage keyword, if any. -// This is used for wxTLS_XXX() macros implementation and normally should use -// the compiler-provided support as it's simpler and more efficient, but must -// not use it if wxWidgets is used in a dynamically loaded Win32 (i.e. using -// LoadLibrary()/GetProcAddress()) as this triggers a bug in compiler TLS -// support that results in crashes when any TLS variables are used. So if you -// are building a Win32 DLL using wxWidgets that can be loaded dynamically, set -// this to 0. -// -// Default is 1, but set to 0 if the scenario above is applicable. -#define wxUSE_COMPILER_TLS 1 - -// ---------------------------------------------------------------------------- -// Interoperability with the standard library. -// ---------------------------------------------------------------------------- - -// Set wxUSE_STL to 1 to enable maximal interoperability with the standard -// library, even at the cost of backwards compatibility. -// -// Default is 0 -// -// Recommended setting: 0 as the options below already provide a relatively -// good level of interoperability and changing this option arguably isn't worth -// diverging from the official builds of the library. -#define wxUSE_STL 0 - -// This is not a real option but is used as the default value for -// wxUSE_STD_IOSTREAM, wxUSE_STD_STRING and wxUSE_STD_CONTAINERS. -// -// Currently the Digital Mars and Watcom compilers come without standard C++ -// library headers by default, wxUSE_STD_STRING can be set to 1 if you do have -// them (e.g. from STLPort). -// -// VC++ 5.0 does include standard C++ library headers, however they produce -// many warnings that can't be turned off when compiled at warning level 4. -#if defined(__DMC__) || defined(__WATCOMC__) \ - || (defined(_MSC_VER) && _MSC_VER < 1200) - #define wxUSE_STD_DEFAULT 0 -#else - #define wxUSE_STD_DEFAULT 1 -#endif - -// Use standard C++ containers to implement wxVector<>, wxStack<>, wxDList<> -// and wxHashXXX<> classes. If disabled, wxWidgets own (mostly compatible but -// usually more limited) implementations are used which allows to avoid the -// dependency on the C++ run-time library. -// -// Notice that the compilers mentioned in wxUSE_STD_DEFAULT comment above don't -// support using standard containers and that VC6 needs non-default options for -// such build to avoid getting "fatal error C1076: compiler limit : internal -// heap limit reached; use /Zm to specify a higher limit" in its own standard -// headers, so you need to ensure you do increase the heap size before enabling -// this option for this compiler. -// -// Default is 0 for compatibility reasons. -// -// Recommended setting: 1 unless compatibility with the official wxWidgets -// build and/or the existing code is a concern. -#define wxUSE_STD_CONTAINERS 0 - -// Use standard C++ streams if 1 instead of wx streams in some places. If -// disabled, wx streams are used everywhere and wxWidgets doesn't depend on the -// standard streams library. -// -// Notice that enabling this does not replace wx streams with std streams -// everywhere, in a lot of places wx streams are used no matter what. -// -// Default is 1 if compiler supports it. -// -// Recommended setting: 1 if you use the standard streams anyhow and so -// dependency on the standard streams library is not a -// problem -#define wxUSE_STD_IOSTREAM wxUSE_STD_DEFAULT - -// Enable minimal interoperability with the standard C++ string class if 1. -// "Minimal" means that wxString can be constructed from std::string or -// std::wstring but can't be implicitly converted to them. You need to enable -// the option below for the latter. -// -// Default is 1 for most compilers. -// -// Recommended setting: 1 unless you want to ensure your program doesn't use -// the standard C++ library at all. -#define wxUSE_STD_STRING wxUSE_STD_DEFAULT - -// Make wxString as much interchangeable with std::[w]string as possible, in -// particular allow implicit conversion of wxString to either of these classes. -// This comes at a price (or a benefit, depending on your point of view) of not -// allowing implicit conversion to "const char *" and "const wchar_t *". -// -// Because a lot of existing code relies on these conversions, this option is -// disabled by default but can be enabled for your build if you don't care -// about compatibility. -// -// Default is 0 if wxUSE_STL has its default value or 1 if it is enabled. -// -// Recommended setting: 0 to remain compatible with the official builds of -// wxWidgets. -#define wxUSE_STD_STRING_CONV_IN_WXSTRING wxUSE_STL - -// VC++ 4.2 and above allows and but you can't mix -// them. Set this option to 1 to use , 0 to use . -// -// Note that newer compilers (including VC++ 7.1 and later) don't support -// wxUSE_IOSTREAMH == 1 and so will be used anyhow. -// -// Default is 0. -// -// Recommended setting: 0, only set to 1 if you use a really old compiler -#define wxUSE_IOSTREAMH 0 - - // ---------------------------------------------------------------------------- // non GUI features selection // ---------------------------------------------------------------------------- @@ -396,24 +320,6 @@ // Recommended setting: 1 #define wxUSE_LONGLONG 1 -// Set wxUSE_BASE64 to 1, to compile in Base64 support. This is required for -// storing binary data in wxConfig on most platforms. -// -// Default is 1. -// -// Recommended setting: 1 (but can be safely disabled if you don't use it) -#define wxUSE_BASE64 1 - -// Set this to 1 to be able to use wxEventLoop even in console applications -// (i.e. using base library only, without GUI). This is mostly useful for -// processing socket events but is also necessary to use timers in console -// applications -// -// Default is 1. -// -// Recommended setting: 1 (but can be safely disabled if you don't use it) -#define wxUSE_CONSOLE_EVENTLOOP 1 - // Set wxUSE_(F)FILE to 1 to compile wx(F)File classes. wxFile uses low level // POSIX functions for file access, wxFFile uses ANSI C stdio.h functions. // @@ -449,21 +355,6 @@ // i18n support: _() macro, wxLocale class. Requires wxTextFile. #define wxUSE_INTL 1 -// Provide wxFoo_l() functions similar to standard foo() functions but taking -// an extra locale parameter. -// -// Notice that this is fully implemented only for the systems providing POSIX -// xlocale support or Microsoft Visual C++ >= 8 (which provides proprietary -// almost-equivalent of xlocale functions), otherwise wxFoo_l() functions will -// only work for the current user locale and "C" locale. You can use -// wxHAS_XLOCALE_SUPPORT to test whether the full support is available. -// -// Default is 1 -// -// Recommended setting: 1 but may be disabled if you are writing programs -// running only in C locale anyhow -#define wxUSE_XLOCALE 1 - // Set wxUSE_DATETIME to 1 to compile the wxDateTime and related classes which // allow to manipulate dates, times and time intervals. wxDateTime replaces the // old wxTime and wxDate classes which are still provided for backwards @@ -495,13 +386,6 @@ // Recommended setting: 1 (needed by wxSocket) #define wxUSE_STOPWATCH 1 -// Set wxUSE_FSWATCHER to 1 if you want to enable wxFileSystemWatcher -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_FSWATCHER 1 - // Setting wxUSE_CONFIG to 1 enables the use of wxConfig and related classes // which allow the application to store its settings in the persistent // storage. Setting this to 1 will also enable on-demand creation of the @@ -550,17 +434,6 @@ // Set to 1 to use socket classes #define wxUSE_SOCKETS 1 -// Set to 1 to use ipv6 socket classes (requires wxUSE_SOCKETS) -// -// Notice that currently setting this option under Windows will result in -// programs which can only run on recent OS versions (with ws2_32.dll -// installed) which is why it is disabled by default. -// -// Default is 1. -// -// Recommended setting: 1 if you need IPv6 support -#define wxUSE_IPV6 0 - // Set to 1 to enable virtual file systems (required by wxHTML) #define wxUSE_FILESYSTEM 1 @@ -598,9 +471,6 @@ // Joystick support class #define wxUSE_JOYSTICK 1 -// wxFontEnumerator class -#define wxUSE_FONTENUM 1 - // wxFontMapper class #define wxUSE_FONTMAP 1 @@ -642,14 +512,6 @@ // possible in which case setting this to 0 can gain up to 100KB. #define wxUSE_VARIANT 1 -// Support for wxAny class, the successor for wxVariant. -// -// Default is 1. -// -// Recommended setting: 1 unless you want to reduce the library size by a small amount, -// or your compiler cannot for some reason cope with complexity of templates used. -#define wxUSE_ANY 1 - // Support for regular expression matching via wxRegEx class: enable this to // use POSIX regular expressions in your code. You need to compile regex // library from src/regex to use it under Windows. @@ -673,6 +535,13 @@ // Recommended setting: 1 #define wxUSE_MEDIACTRL 1 +// Use GStreamer for Unix (req a lot of dependancies) +// +// Default is 0 +// +// Recommended setting: 1 (wxMediaCtrl won't work by default without it) +#define wxUSE_GSTREAMER 0 + // Use wxWidget's XRC XML-based resource system. Recommended. // // Default is 1 @@ -695,105 +564,32 @@ // Recommended setting: 1 #define wxUSE_AUI 1 -// Use wxWidget's Ribbon classes for interfaces -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_RIBBON 1 - -// Use wxPropertyGrid. -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_PROPGRID 1 - -// Use wxStyledTextCtrl, a wxWidgets implementation of Scintilla. -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_STC 1 - -// Use wxWidget's web viewing classes -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_WEBVIEW 1 - -// Use the IE wxWebView backend -// -// Default is 1 on MSW -// -// Recommended setting: 1 -#ifdef __WXMSW__ -#define wxUSE_WEBVIEW_IE 1 -#else -#define wxUSE_WEBVIEW_IE 0 -#endif - -// Use the WebKit wxWebView backend -// -// Default is 1 on GTK and OSX -// -// Recommended setting: 1 -#if defined(__WXGTK__) || defined(__WXOSX__) -#define wxUSE_WEBVIEW_WEBKIT 1 -#else -#define wxUSE_WEBVIEW_WEBKIT 0 -#endif // Enable the new wxGraphicsPath and wxGraphicsContext classes for an advanced // 2D drawing API. (Still somewhat experimental) // -// Please note that on Windows gdiplus.dll is loaded dynamically which means -// that nothing special needs to be done as long as you don't use -// wxGraphicsContext at all or only use it on XP and later systems but you -// still do need to distribute it yourself for an application using -// wxGraphicsContext to be runnable on pre-XP systems. -// -// Default is 1 except if you're using a non-Microsoft compiler under Windows -// as only MSVC7+ is known to ship with gdiplus.h. For other compilers (e.g. -// mingw32) you may need to install the headers (and just the headers) -// yourself. If you do, change the setting below manually. -// -// Recommended setting: 1 if supported by the compilation environment - -// notice that we can't use wxCHECK_VISUALC_VERSION() here as this file is -// included from wx/platform.h before wxCHECK_VISUALC_VERSION() is defined -#ifdef _MSC_VER -# if _MSC_VER >= 1310 - // MSVC7.1+ comes with new enough Platform SDK, enable - // wxGraphicsContext support for it -# define wxUSE_GRAPHICS_CONTEXT 1 -# else - // MSVC 6 didn't include GDI+ headers so disable by default, enable it - // here if you use MSVC 6 with a newer SDK -# define wxUSE_GRAPHICS_CONTEXT 0 -# endif -#else - // Disable support for other Windows compilers, enable it if your compiler - // comes with new enough SDK or you installed the headers manually. - // - // Notice that this will be set by configure under non-Windows platforms - // anyhow so the value there is not important. -# define wxUSE_GRAPHICS_CONTEXT 0 -#endif - -// Enable wxGraphicsContext implementation using Cairo library. -// -// This is not needed under Windows and detected automatically by configure -// under other systems, however you may set this to 1 manually if you installed -// Cairo under Windows yourself and prefer to use it instead the native GDI+ -// implementation. +// Please note that on Windows you will need to link with gdiplus.lib (use +// USE_GDIPLUS=1 for makefile builds) and distribute gdiplus.dll with your +// application if you want it to be runnable on pre-XP systems. // // Default is 0 // -// Recommended setting: 0 -#define wxUSE_CAIRO 0 +// Recommended setting: 1 +#ifndef wxUSE_GRAPHICS_CONTEXT +#define wxUSE_GRAPHICS_CONTEXT 0 +#endif +// Enable the new wxCairoContext classes for an advanced +// 2D drawing API. (Still somewhat experimental) +// +// Please note that you will need to link with Cairo for this to work. +// +// Default is 0 +// +// Recommended setting: 1 +#ifndef wxUSE_CAIRO +#define wxUSE_CAIRO 0 +#endif // ---------------------------------------------------------------------------- // Individual GUI controls @@ -807,15 +603,6 @@ // Recommended setting: 1 (don't change except for very special programs) #define wxUSE_CONTROLS 1 -// Support markup in control labels, i.e. provide wxControl::SetLabelMarkup(). -// Currently markup is supported only by a few controls and only some ports but -// their number will increase with time. -// -// Default is 1 -// -// Recommended setting: 1 (may be set to 0 if you want to save on code size) -#define wxUSE_MARKUP 1 - // wxPopupWindow class is a top level transient window. It is currently used // to implement wxTipWindow // @@ -842,7 +629,6 @@ // // Recommended setting: 1 #define wxUSE_ANIMATIONCTRL 1 // wxAnimationCtrl -#define wxUSE_BANNERWINDOW 1 // wxBannerWindow #define wxUSE_BUTTON 1 // wxButton #define wxUSE_BMPBUTTON 1 // wxBitmapButton #define wxUSE_CALENDARCTRL 1 // wxCalendarCtrl @@ -852,22 +638,17 @@ #define wxUSE_COLLPANE 1 // wxCollapsiblePane #define wxUSE_COLOURPICKERCTRL 1 // wxColourPickerCtrl #define wxUSE_COMBOBOX 1 // wxComboBox -#define wxUSE_COMMANDLINKBUTTON 1 // wxCommandLinkButton #define wxUSE_DATAVIEWCTRL 1 // wxDataViewCtrl #define wxUSE_DATEPICKCTRL 1 // wxDatePickerCtrl #define wxUSE_DIRPICKERCTRL 1 // wxDirPickerCtrl -#define wxUSE_EDITABLELISTBOX 1 // wxEditableListBox -#define wxUSE_FILECTRL 1 // wxFileCtrl #define wxUSE_FILEPICKERCTRL 1 // wxFilePickerCtrl #define wxUSE_FONTPICKERCTRL 1 // wxFontPickerCtrl #define wxUSE_GAUGE 1 // wxGauge -#define wxUSE_HEADERCTRL 1 // wxHeaderCtrl #define wxUSE_HYPERLINKCTRL 1 // wxHyperlinkCtrl #define wxUSE_LISTBOX 1 // wxListBox #define wxUSE_LISTCTRL 1 // wxListCtrl #define wxUSE_RADIOBOX 1 // wxRadioBox #define wxUSE_RADIOBTN 1 // wxRadioButton -#define wxUSE_RICHMSGDLG 1 // wxRichMessageDialog #define wxUSE_SCROLLBAR 1 // wxScrollBar #define wxUSE_SEARCHCTRL 1 // wxSearchCtrl #define wxUSE_SLIDER 1 // wxSlider @@ -878,10 +659,8 @@ #define wxUSE_STATTEXT 1 // wxStaticText #define wxUSE_STATBMP 1 // wxStaticBitmap #define wxUSE_TEXTCTRL 1 // wxTextCtrl -#define wxUSE_TIMEPICKCTRL 1 // wxTimePickerCtrl #define wxUSE_TOGGLEBTN 1 // requires wxButton #define wxUSE_TREECTRL 1 // wxTreeCtrl -#define wxUSE_TREELISTCTRL 1 // wxTreeListCtrl // Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR // below either wxStatusBar95 or a generic wxStatusBar will be used. @@ -952,13 +731,13 @@ // Recommended setting: 1 #define wxUSE_TOOLBOOK 1 -// wxTaskBarIcon is a small notification icon shown in the system toolbar or -// dock. +// wxTabDialog is a generic version of wxNotebook but it is incompatible with +// the new class. It shouldn't be used in new code. // -// Default is 1. +// Default is 0. // -// Recommended setting: 1 (but can be set to 0 if you don't need it) -#define wxUSE_TASKBARICON 1 +// Recommended setting: 0 (use wxNotebook) +#define wxUSE_TAB_DIALOG 0 // wxGrid class // @@ -1001,15 +780,6 @@ // Recommended setting: 1 but can be safely set to 0 #define wxUSE_BITMAPCOMBOBOX 1 -// wxRearrangeCtrl is a wxCheckListBox with two buttons allowing to move items -// up and down in it. It is also used as part of wxRearrangeDialog. -// -// Default is 1. -// -// Recommended setting: 1 but can be safely set to 0 (currently used only by -// wxHeaderCtrl) -#define wxUSE_REARRANGECTRL 1 - // ---------------------------------------------------------------------------- // Miscellaneous GUI stuff // ---------------------------------------------------------------------------- @@ -1017,29 +787,6 @@ // wxAcceleratorTable/Entry classes and support for them in wxMenu(Bar) #define wxUSE_ACCEL 1 -// Use the standard art provider. The icons returned by this provider are -// embedded into the library as XPMs so disabling it reduces the library size -// somewhat but this should only be done if you use your own custom art -// provider returning the icons or never use any icons not provided by the -// native art provider (which might not be implemented at all for some -// platforms) or by the Tango icons provider (if it's not itself disabled -// below). -// -// Default is 1. -// -// Recommended setting: 1 unless you use your own custom art provider. -#define wxUSE_ARTPROVIDER_STD 1 - -// Use art provider providing Tango icons: this art provider has higher quality -// icons than the default ones using smaller size XPM icons without -// transparency but the embedded PNG icons add to the library size. -// -// Default is 1 under non-GTK ports. Under wxGTK the native art provider using -// the GTK+ stock icons replaces it so it is normally not necessary. -// -// Recommended setting: 1 but can be turned off to reduce the library size. -#define wxUSE_ARTPROVIDER_TANGO 1 - // Hotkey support (currently Windows only) #define wxUSE_HOTKEY 1 @@ -1072,14 +819,6 @@ // enumerated above, then this class is mostly useless too) #define wxUSE_IMAGLIST 1 -// Use wxInfoBar class. -// -// Default is 1. -// -// Recommended setting: 1 (but can be disabled without problems as nothing -// depends on it) -#define wxUSE_INFOBAR 1 - // Use wxMenu, wxMenuBar, wxMenuItem. // // Default is 1. @@ -1087,25 +826,6 @@ // Recommended setting: 1 (can't be disabled under MSW) #define wxUSE_MENUS 1 -// Use wxNotificationMessage. -// -// wxNotificationMessage allows to show non-intrusive messages to the user -// using balloons, banners, popups or whatever is the appropriate method for -// the current platform. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_NOTIFICATION_MESSAGE 1 - -// wxRichToolTip is a customizable tooltip class which has more functionality -// than the stock (but native, unlike this class) wxToolTip. -// -// Default is 1. -// -// Recommended setting: 1 (but can be safely set to 0 if you don't need it) -#define wxUSE_RICHTOOLTIP 1 - // Use wxSashWindow class. // // Default is 1. @@ -1130,20 +850,6 @@ // wxValidator class and related methods #define wxUSE_VALIDATORS 1 -// Use reference counted ID management: this means that wxWidgets will track -// the automatically allocated ids (those used when you use wxID_ANY when -// creating a window, menu or toolbar item &c) instead of just supposing that -// the program never runs out of them. This is mostly useful only under wxMSW -// where the total ids range is limited to SHRT_MIN..SHRT_MAX and where -// long-running programs can run into problems with ids reuse without this. On -// the other platforms, where the ids have the full int range, this shouldn't -// be necessary. -#ifdef __WXMSW__ -#define wxUSE_AUTOID_MANAGEMENT 1 -#else -#define wxUSE_AUTOID_MANAGEMENT 0 -#endif - // ---------------------------------------------------------------------------- // common dialogs // ---------------------------------------------------------------------------- @@ -1234,13 +940,6 @@ // use this function #define wxUSE_ABOUTDLG 1 -// wxFileHistory class -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_FILE_HISTORY 1 - // ---------------------------------------------------------------------------- // Metafiles support // ---------------------------------------------------------------------------- @@ -1297,16 +996,14 @@ // Setting wxUSE_GLCANVAS to 1 enables OpenGL support. You need to have OpenGL // headers and libraries to be able to compile the library with wxUSE_GLCANVAS -// set to 1 and, under Windows, also to add opengl32.lib and glu32.lib to the -// list of libraries used to link your application (although this is done -// implicitly for Microsoft Visual C++ users). +// set to 1. Note that for some compilers (notably Microsoft Visual C++) you +// will need to manually add opengl32.lib and glu32.lib to the list of +// libraries linked with your program if you use OpenGL. // -// Default is 1 unless the compiler is known to ship without the necessary -// headers (Digital Mars) or the platform doesn't support OpenGL (Windows CE). +// Default is 0. // -// Recommended setting: 1 if you intend to use OpenGL, can be safely set to 0 -// otherwise. -#define wxUSE_GLCANVAS 1 +// Recommended setting: 1 if you intend to use OpenGL, 0 otherwise +#define wxUSE_GLCANVAS 0 // wxRichTextCtrl allows editing of styled text. // @@ -1385,6 +1082,8 @@ // Use wxHTML-based help controller? #define wxUSE_WXHTML_HELP 1 +#define wxUSE_RESOURCES 0 + // 0 for no wxGetResource/wxWriteResource #define wxUSE_CONSTRAINTS 1 // 0 for no window layout constraint system @@ -1394,11 +1093,8 @@ #define wxUSE_MOUSEWHEEL 1 // Include mouse wheel support -// Compile wxUIActionSimulator class? -#define wxUSE_UIACTIONSIMULATOR 1 - // ---------------------------------------------------------------------------- -// wxDC classes for various output formats +// postscript support settings // ---------------------------------------------------------------------------- // Set to 1 for PostScript device context. @@ -1407,19 +1103,50 @@ // Set to 1 to use font metric files in GetTextExtent #define wxUSE_AFM_FOR_POSTSCRIPT 1 -// Set to 1 to compile in support for wxSVGFileDC, a wxDC subclass which allows -// to create files in SVG (Scalable Vector Graphics) format. -#define wxUSE_SVG 1 +// ---------------------------------------------------------------------------- +// database classes +// ---------------------------------------------------------------------------- -// Should wxDC provide SetTransformMatrix() and related methods? +// Define 1 to use ODBC classes +#define wxUSE_ODBC 0 + +// For backward compatibility reasons, this parameter now only controls the +// default scrolling method used by cursors. This default behavior can be +// overriden by setting the second param of wxDB::wxDbGetConnection() or +// wxDb() constructor to indicate whether the connection (and any wxDbTable()s +// that use the connection) should support forward only scrolling of cursors, +// or both forward and backward support for backward scrolling cursors is +// dependent on the data source as well as the ODBC driver being used. +#define wxODBC_FWD_ONLY_CURSORS 1 + +// Default is 0. Set to 1 to use the deprecated classes, enum types, function, +// member variables. With a setting of 1, full backward compatibility with the +// 2.0.x release is possible. It is STRONGLY recommended that this be set to 0, +// as future development will be done only on the non-deprecated +// functions/classes/member variables/etc. +#define wxODBC_BACKWARD_COMPATABILITY 0 + +// ---------------------------------------------------------------------------- +// other compiler (mis)features +// ---------------------------------------------------------------------------- + +// Set this to 0 if your compiler can't cope with omission of prototype +// parameters. // -// Default is 1 but can be set to 0 if this functionality is not used. Notice -// that currently only wxMSW supports this so setting this to 0 doesn't change -// much for non-MSW platforms (although it will still save a few bytes -// probably). +// Default is 1. // -// Recommended setting: 1. -#define wxUSE_DC_TRANSFORM_MATRIX 1 +// Recommended setting: 1 (should never need to set this to 0) +#define REMOVE_UNUSED_ARG 1 + +// VC++ 4.2 and above allows and but you can't mix +// them. Set to 1 for , 0 for . Note that VC++ 7.1 +// and later doesn't support wxUSE_IOSTREAMH == 1 and so will be +// used anyhow. +// +// Default is 1. +// +// Recommended setting: whatever your compiler likes more +#define wxUSE_IOSTREAMH 1 // ---------------------------------------------------------------------------- // image format support @@ -1487,7 +1214,6 @@ /* --- end common options --- */ -/* --- start MSW options --- */ // ---------------------------------------------------------------------------- // Windows-only settings // ---------------------------------------------------------------------------- @@ -1543,11 +1269,15 @@ // Recommended setting: 1, required by wxMediaCtrl #define wxUSE_ACTIVEX 1 -// wxDC caching implementation +// wxDC cacheing implementation #define wxUSE_DC_CACHEING 1 +// Set this to 1 to enable the use of DIB's for wxBitmap to support +// bitmaps > 16MB on Win95/98/Me. Set to 0 to use DDB's only. +#define wxUSE_DIB_FOR_BITMAP 0 + // Set this to 1 to enable wxDIB class used internally for manipulating -// wxBitmap data. +// wxBitmao data. // // Default is 1, set it to 0 only if you don't use wxImage neither // @@ -1558,13 +1288,6 @@ // (just use Windows printing). #define wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW 1 -// Set this to 1 to compile in wxRegKey class. -// -// Default is 1 -// -// Recommended setting: 1, this is used internally by wx in a few places -#define wxUSE_REGKEY 1 - // Set this to 1 to use RICHEDIT controls for wxTextCtrl with style wxTE_RICH // which allows to put more than ~32Kb of text in it even under Win9x (NT // doesn't have such limitation). @@ -1590,28 +1313,16 @@ // Recommended setting: 1, set to 0 for a small library size reduction #define wxUSE_OWNER_DRAWN 1 -// Set this to 1 to enable MSW-specific wxTaskBarIcon::ShowBalloon() method. It -// is required by native wxNotificationMessage implementation. -// -// Default is 1 but disabled in wx/msw/chkconf.h if SDK is too old to contain -// the necessary declarations. -// -// Recommended setting: 1, set to 0 for a tiny library size reduction -#define wxUSE_TASKBARICON_BALLOONS 1 - // Set to 1 to compile MS Windows XP theme engine support #define wxUSE_UXTHEME 1 +// Set to 1 to auto-adapt to MS Windows XP themes where possible +// (notably, wxNotebook pages) +#define wxUSE_UXTHEME_AUTO 1 + // Set to 1 to use InkEdit control (Tablet PC), if available #define wxUSE_INKEDIT 0 -// Set to 1 to enable .INI files based wxConfig implementation (wxIniConfig) -// -// Default is 0. -// -// Recommended setting: 0, nobody uses .INI files any more -#define wxUSE_INICONF 0 - // ---------------------------------------------------------------------------- // Generic versions of native controls // ---------------------------------------------------------------------------- @@ -1624,14 +1335,6 @@ // Recommended setting: 0, this is mainly used for testing #define wxUSE_DATEPICKCTRL_GENERIC 0 -// Set this to 1 to be able to use wxTimePickerCtrlGeneric in addition to the -// native wxTimePickerCtrl for the platforms that have the latter (MSW). -// -// Default is 0. -// -// Recommended setting: 0, this is mainly used for testing -#define wxUSE_TIMEPICKCTRL_GENERIC 0 - // ---------------------------------------------------------------------------- // Crash debugging helpers // ---------------------------------------------------------------------------- @@ -1643,7 +1346,16 @@ // // Recommended setting: 1, set to 0 if your programs never crash #define wxUSE_CRASHREPORT 1 -/* --- end MSW options --- */ + +// ---------------------------------------------------------------------------- +// obsolete settings +// ---------------------------------------------------------------------------- + +// NB: all settings in this section are obsolete and should not be used/changed +// at all, they will disappear + +// Define 1 to use bitmap messages. +#define wxUSE_BITMAP_MESSAGE 1 #endif // _WX_SETUP_H_ diff --git a/Source/3rd Party/wx/src/common/accelcmn.cpp b/Source/3rd Party/wx/src/common/accelcmn.cpp deleted file mode 100644 index 3f6e0c63c..000000000 --- a/Source/3rd Party/wx/src/common/accelcmn.cpp +++ /dev/null @@ -1,386 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/common/accelcmn.cpp -// Purpose: implementation of platform-independent wxAcceleratorEntry parts -// Author: Vadim Zeitlin -// Created: 2007-05-05 -// RCS-ID: $Id$ -// Copyright: (c) 2007 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// for compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_ACCEL - -#ifndef WX_PRECOMP - #include "wx/accel.h" - #include "wx/string.h" - #include "wx/intl.h" - #include "wx/log.h" - #include "wx/crt.h" -#endif //WX_PRECOMP - -wxAcceleratorTable wxNullAcceleratorTable; - -// ============================================================================ -// wxAcceleratorEntry implementation -// ============================================================================ - -static const struct wxKeyName -{ - wxKeyCode code; - const char *name; -} wxKeyNames[] = -{ - { WXK_DELETE, wxTRANSLATE("DEL") }, - { WXK_DELETE, wxTRANSLATE("DELETE") }, - { WXK_BACK, wxTRANSLATE("BACK") }, - { WXK_INSERT, wxTRANSLATE("INS") }, - { WXK_INSERT, wxTRANSLATE("INSERT") }, - { WXK_RETURN, wxTRANSLATE("ENTER") }, - { WXK_RETURN, wxTRANSLATE("RETURN") }, - { WXK_PAGEUP, wxTRANSLATE("PGUP") }, - { WXK_PAGEDOWN, wxTRANSLATE("PGDN") }, - { WXK_LEFT, wxTRANSLATE("LEFT") }, - { WXK_RIGHT, wxTRANSLATE("RIGHT") }, - { WXK_UP, wxTRANSLATE("UP") }, - { WXK_DOWN, wxTRANSLATE("DOWN") }, - { WXK_HOME, wxTRANSLATE("HOME") }, - { WXK_END, wxTRANSLATE("END") }, - { WXK_SPACE, wxTRANSLATE("SPACE") }, - { WXK_TAB, wxTRANSLATE("TAB") }, - { WXK_ESCAPE, wxTRANSLATE("ESC") }, - { WXK_ESCAPE, wxTRANSLATE("ESCAPE") }, - { WXK_CANCEL, wxTRANSLATE("CANCEL") }, - { WXK_CLEAR, wxTRANSLATE("CLEAR") }, - { WXK_MENU, wxTRANSLATE("MENU") }, - { WXK_PAUSE, wxTRANSLATE("PAUSE") }, - { WXK_CAPITAL, wxTRANSLATE("CAPITAL") }, - { WXK_SELECT, wxTRANSLATE("SELECT") }, - { WXK_PRINT, wxTRANSLATE("PRINT") }, - { WXK_EXECUTE, wxTRANSLATE("EXECUTE") }, - { WXK_SNAPSHOT, wxTRANSLATE("SNAPSHOT") }, - { WXK_HELP, wxTRANSLATE("HELP") }, - { WXK_ADD, wxTRANSLATE("ADD") }, - { WXK_SEPARATOR, wxTRANSLATE("SEPARATOR") }, - { WXK_SUBTRACT, wxTRANSLATE("SUBTRACT") }, - { WXK_DECIMAL, wxTRANSLATE("DECIMAL") }, - { WXK_DIVIDE, wxTRANSLATE("DIVIDE") }, - { WXK_NUMLOCK, wxTRANSLATE("NUM_LOCK") }, - { WXK_SCROLL, wxTRANSLATE("SCROLL_LOCK") }, - { WXK_PAGEUP, wxTRANSLATE("PAGEUP") }, - { WXK_PAGEDOWN, wxTRANSLATE("PAGEDOWN") }, - { WXK_NUMPAD_SPACE, wxTRANSLATE("KP_SPACE") }, - { WXK_NUMPAD_TAB, wxTRANSLATE("KP_TAB") }, - { WXK_NUMPAD_ENTER, wxTRANSLATE("KP_ENTER") }, - { WXK_NUMPAD_HOME, wxTRANSLATE("KP_HOME") }, - { WXK_NUMPAD_LEFT, wxTRANSLATE("KP_LEFT") }, - { WXK_NUMPAD_UP, wxTRANSLATE("KP_UP") }, - { WXK_NUMPAD_RIGHT, wxTRANSLATE("KP_RIGHT") }, - { WXK_NUMPAD_DOWN, wxTRANSLATE("KP_DOWN") }, - { WXK_NUMPAD_PAGEUP, wxTRANSLATE("KP_PRIOR") }, - { WXK_NUMPAD_PAGEUP, wxTRANSLATE("KP_PAGEUP") }, - { WXK_NUMPAD_PAGEDOWN, wxTRANSLATE("KP_NEXT") }, - { WXK_NUMPAD_PAGEDOWN, wxTRANSLATE("KP_PAGEDOWN") }, - { WXK_NUMPAD_END, wxTRANSLATE("KP_END") }, - { WXK_NUMPAD_BEGIN, wxTRANSLATE("KP_BEGIN") }, - { WXK_NUMPAD_INSERT, wxTRANSLATE("KP_INSERT") }, - { WXK_NUMPAD_DELETE, wxTRANSLATE("KP_DELETE") }, - { WXK_NUMPAD_EQUAL, wxTRANSLATE("KP_EQUAL") }, - { WXK_NUMPAD_MULTIPLY, wxTRANSLATE("KP_MULTIPLY") }, - { WXK_NUMPAD_ADD, wxTRANSLATE("KP_ADD") }, - { WXK_NUMPAD_SEPARATOR, wxTRANSLATE("KP_SEPARATOR") }, - { WXK_NUMPAD_SUBTRACT, wxTRANSLATE("KP_SUBTRACT") }, - { WXK_NUMPAD_DECIMAL, wxTRANSLATE("KP_DECIMAL") }, - { WXK_NUMPAD_DIVIDE, wxTRANSLATE("KP_DIVIDE") }, - { WXK_WINDOWS_LEFT, wxTRANSLATE("WINDOWS_LEFT") }, - { WXK_WINDOWS_RIGHT, wxTRANSLATE("WINDOWS_RIGHT") }, - { WXK_WINDOWS_MENU, wxTRANSLATE("WINDOWS_MENU") }, - { WXK_COMMAND, wxTRANSLATE("COMMAND") }, -}; - -// return true if the 2 strings refer to the same accel -// -// as accels can be either translated or not, check for both possibilities and -// also compare case-insensitively as the key names case doesn't count -static inline bool CompareAccelString(const wxString& str, const char *accel) -{ - return str.CmpNoCase(accel) == 0 -#if wxUSE_INTL - || str.CmpNoCase(wxGetTranslation(accel)) == 0 -#endif - ; -} - -// return prefixCode+number if the string is of the form "" and -// 0 if it isn't -// -// first and last parameter specify the valid domain for "number" part -static int IsNumberedAccelKey(const wxString& str, - const char *prefix, - wxKeyCode prefixCode, - unsigned first, - unsigned last) -{ - const size_t lenPrefix = wxStrlen(prefix); - if ( !CompareAccelString(str.Left(lenPrefix), prefix) ) - return 0; - - unsigned long num; - if ( !str.Mid(lenPrefix).ToULong(&num) ) - return 0; - - if ( num < first || num > last ) - { - // this must be a mistake, chances that this is a valid name of another - // key are vanishingly small - wxLogDebug(wxT("Invalid key string \"%s\""), str.c_str()); - return 0; - } - - return prefixCode + num - first; -} - -/* static */ -bool -wxAcceleratorEntry::ParseAccel(const wxString& text, int *flagsOut, int *keyOut) -{ - // the parser won't like trailing spaces - wxString label = text; - label.Trim(true); - - // For compatibility with the old wx versions which accepted (and actually - // even required) a TAB character in the string passed to this function we - // ignore anything up to the first TAB. Notice however that the correct - // input consists of just the accelerator itself and nothing else, this is - // done for compatibility and compatibility only. - int posTab = label.Find(wxT('\t')); - if ( posTab == wxNOT_FOUND ) - posTab = 0; - else - posTab++; - - // parse the accelerator string - int accelFlags = wxACCEL_NORMAL; - wxString current; - for ( size_t n = (size_t)posTab; n < label.length(); n++ ) - { - if ( (label[n] == '+') || (label[n] == '-') ) - { - if ( CompareAccelString(current, wxTRANSLATE("ctrl")) ) - accelFlags |= wxACCEL_CTRL; - else if ( CompareAccelString(current, wxTRANSLATE("alt")) ) - accelFlags |= wxACCEL_ALT; - else if ( CompareAccelString(current, wxTRANSLATE("shift")) ) - accelFlags |= wxACCEL_SHIFT; - else if ( CompareAccelString(current, wxTRANSLATE("rawctrl")) ) - accelFlags |= wxACCEL_RAW_CTRL; - else // not a recognized modifier name - { - // we may have "Ctrl-+", for example, but we still want to - // catch typos like "Crtl-A" so only give the warning if we - // have something before the current '+' or '-', else take - // it as a literal symbol - if ( current.empty() ) - { - current += label[n]; - - // skip clearing it below - continue; - } - else - { - wxLogDebug(wxT("Unknown accel modifier: '%s'"), - current.c_str()); - } - } - - current.clear(); - } - else // not special character - { - current += (wxChar) wxTolower(label[n]); - } - } - - int keyCode; - const size_t len = current.length(); - switch ( len ) - { - case 0: - wxLogDebug(wxT("No accel key found, accel string ignored.")); - return false; - - case 1: - // it's just a letter - keyCode = current[0U]; - - // if the key is used with any modifiers, make it an uppercase one - // because Ctrl-A and Ctrl-a are the same; but keep it as is if it's - // used alone as 'a' and 'A' are different - if ( accelFlags != wxACCEL_NORMAL ) - keyCode = wxToupper(keyCode); - break; - - default: - keyCode = IsNumberedAccelKey(current, wxTRANSLATE("F"), - WXK_F1, 1, 12); - if ( !keyCode ) - { - for ( size_t n = 0; n < WXSIZEOF(wxKeyNames); n++ ) - { - const wxKeyName& kn = wxKeyNames[n]; - if ( CompareAccelString(current, kn.name) ) - { - keyCode = kn.code; - break; - } - } - } - - if ( !keyCode ) - keyCode = IsNumberedAccelKey(current, wxTRANSLATE("KP_"), - WXK_NUMPAD0, 0, 9); - if ( !keyCode ) - keyCode = IsNumberedAccelKey(current, wxTRANSLATE("SPECIAL"), - WXK_SPECIAL1, 1, 20); - - if ( !keyCode ) - { - wxLogDebug(wxT("Unrecognized accel key '%s', accel string ignored."), - current.c_str()); - return false; - } - } - - - wxASSERT_MSG( keyCode, wxT("logic error: should have key code here") ); - - if ( flagsOut ) - *flagsOut = accelFlags; - if ( keyOut ) - *keyOut = keyCode; - - return true; -} - -/* static */ -wxAcceleratorEntry *wxAcceleratorEntry::Create(const wxString& str) -{ - const wxString accelStr = str.AfterFirst('\t'); - if ( accelStr.empty() ) - { - // It's ok to pass strings not containing any accelerators at all to - // this function, wxMenuItem code does it and we should just return - // NULL in this case. - return NULL; - } - - int flags, - keyCode; - if ( !ParseAccel(accelStr, &flags, &keyCode) ) - return NULL; - - return new wxAcceleratorEntry(flags, keyCode); -} - -bool wxAcceleratorEntry::FromString(const wxString& str) -{ - return ParseAccel(str, &m_flags, &m_keyCode); -} - -namespace -{ - -wxString PossiblyLocalize(const wxString& str, bool localize) -{ - return localize ? wxGetTranslation(str) : str; -} - -} - -wxString wxAcceleratorEntry::AsPossiblyLocalizedString(bool localized) const -{ - wxString text; - - int flags = GetFlags(); - if ( flags & wxACCEL_ALT ) - text += PossiblyLocalize(wxTRANSLATE("Alt+"), localized); - if ( flags & wxACCEL_CTRL ) - text += PossiblyLocalize(wxTRANSLATE("Ctrl+"), localized); - if ( flags & wxACCEL_SHIFT ) - text += PossiblyLocalize(wxTRANSLATE("Shift+"), localized); -#if defined(__WXMAC__) || defined(__WXCOCOA__) - if ( flags & wxACCEL_RAW_CTRL ) - text += PossiblyLocalize(wxTRANSLATE("RawCtrl+"), localized); -#endif - - const int code = GetKeyCode(); - - if ( code >= WXK_F1 && code <= WXK_F12 ) - text << PossiblyLocalize(wxTRANSLATE("F"), localized) - << code - WXK_F1 + 1; - else if ( code >= WXK_NUMPAD0 && code <= WXK_NUMPAD9 ) - text << PossiblyLocalize(wxTRANSLATE("KP_"), localized) - << code - WXK_NUMPAD0; - else if ( code >= WXK_SPECIAL1 && code <= WXK_SPECIAL20 ) - text << PossiblyLocalize(wxTRANSLATE("SPECIAL"), localized) - << code - WXK_SPECIAL1 + 1; - else // check the named keys - { - size_t n; - for ( n = 0; n < WXSIZEOF(wxKeyNames); n++ ) - { - const wxKeyName& kn = wxKeyNames[n]; - if ( code == kn.code ) - { - text << PossiblyLocalize(kn.name, localized); - break; - } - } - - if ( n == WXSIZEOF(wxKeyNames) ) - { - // must be a simple key - if ( -#if !wxUSE_UNICODE - // we can't call wxIsalnum() for non-ASCII characters in ASCII - // build as they're only defined for the ASCII range (or EOF) - wxIsascii(code) && -#endif // ANSI - wxIsprint(code) ) - { - text << (wxChar)code; - } - else - { - wxFAIL_MSG( wxT("unknown keyboard accelerator code") ); - } - } - } - - return text; -} - -wxAcceleratorEntry *wxGetAccelFromString(const wxString& label) -{ - return wxAcceleratorEntry::Create(label); -} - -#endif // wxUSE_ACCEL - - - diff --git a/Source/3rd Party/wx/src/common/accesscmn.cpp b/Source/3rd Party/wx/src/common/accesscmn.cpp index b5724ae52..14135977e 100644 --- a/Source/3rd Party/wx/src/common/accesscmn.cpp +++ b/Source/3rd Party/wx/src/common/accesscmn.cpp @@ -1,9 +1,9 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: src/common/accesscmn.cpp +// Name: common/accesscmn.cpp // Author: Julian Smart // Modified by: // Created: 2003-02-12 -// RCS-ID: $Id$ +// RCS-ID: $Id: accesscmn.cpp 35650 2005-09-23 12:56:45Z MR $ // Copyright: (c) Julian Smart // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// diff --git a/Source/3rd Party/wx/src/common/affinematrix2d.cpp b/Source/3rd Party/wx/src/common/affinematrix2d.cpp deleted file mode 100644 index 394b57264..000000000 --- a/Source/3rd Party/wx/src/common/affinematrix2d.cpp +++ /dev/null @@ -1,186 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: affinematrix2d.cpp -// Purpose: implementation of wxAffineMatrix2D -// Author: Based on wxTransformMatrix by Chris Breeze, Julian Smart -// Created: 2011-04-05 -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_GEOMETRY - -#include "wx/affinematrix2d.h" -#include "wx/math.h" - -// sets the matrix to the respective values -void wxAffineMatrix2D::Set(const wxMatrix2D &mat2D, const wxPoint2DDouble &tr) -{ - m_11 = mat2D.m_11; - m_12 = mat2D.m_12; - m_21 = mat2D.m_21; - m_22 = mat2D.m_22; - m_tx = tr.m_x; - m_ty = tr.m_y; -} - -// gets the component valuess of the matrix -void wxAffineMatrix2D::Get(wxMatrix2D *mat2D, wxPoint2DDouble *tr) const -{ - mat2D->m_11 = m_11; - mat2D->m_12 = m_12; - mat2D->m_21 = m_21; - mat2D->m_22 = m_22; - - if ( tr ) - { - tr->m_x = m_tx; - tr->m_y = m_ty; - } -} - -// concatenates the matrix -// | t.m_11 t.m_12 0 | | m_11 m_12 0 | -// | t.m_21 t.m_22 0 | x | m_21 m_22 0 | -// | t.m_tx t.m_ty 1 | | m_tx m_ty 1 | -void wxAffineMatrix2D::Concat(const wxAffineMatrix2DBase &t) -{ - wxMatrix2D mat; - wxPoint2DDouble tr; - t.Get(&mat, &tr); - - m_tx += tr.m_x*m_11 + tr.m_y*m_21; - m_ty += tr.m_x*m_12 + tr.m_y*m_22; - wxDouble e11 = mat.m_11*m_11 + mat.m_12*m_21; - wxDouble e12 = mat.m_11*m_12 + mat.m_12*m_22; - wxDouble e21 = mat.m_21*m_11 + mat.m_22*m_21; - m_22 = mat.m_21*m_12 + mat.m_22*m_22; - m_11 = e11; - m_12 = e12; - m_21 = e21; -} - -// makes this its inverse matrix. -// Invert -// | m_11 m_12 0 | -// | m_21 m_22 0 | -// | m_tx m_ty 1 | -bool wxAffineMatrix2D::Invert() -{ - const wxDouble det = m_11*m_22 - m_12*m_21; - - if ( !det ) - return false; - - wxDouble ex = (m_21*m_ty - m_22*m_tx) / det; - m_ty = (-m_11*m_ty + m_12*m_tx) / det; - m_tx = ex; - wxDouble e11 = m_22 / det; - m_12 = -m_12 / det; - m_21 = -m_21 / det; - m_22 = m_11 / det; - m_11 = e11; - - return true; -} - -// returns true if the elements of the transformation matrix are equal -bool wxAffineMatrix2D::IsEqual(const wxAffineMatrix2DBase& t) const -{ - wxMatrix2D mat; - wxPoint2DDouble tr; - t.Get(&mat, &tr); - - return m_11 == mat.m_11 && m_12 == mat.m_12 && - m_21 == mat.m_21 && m_22 == mat.m_22 && - m_tx == tr.m_x && m_ty == tr.m_y; -} - -// -// transformations -// - -// add the translation to this matrix -// | 1 0 0 | | m_11 m_12 0 | -// | 0 1 0 | x | m_21 m_22 0 | -// | dx dy 1 | | m_tx m_ty 1 | -void wxAffineMatrix2D::Translate(wxDouble dx, wxDouble dy) -{ - m_tx += m_11 * dx + m_21 * dy; - m_ty += m_12 * dx + m_22 * dy; -} - -// add the scale to this matrix -// | xScale 0 0 | | m_11 m_12 0 | -// | 0 yScale 0 | x | m_21 m_22 0 | -// | 0 0 1 | | m_tx m_ty 1 | -void wxAffineMatrix2D::Scale(wxDouble xScale, wxDouble yScale) -{ - m_11 *= xScale; - m_12 *= xScale; - m_21 *= yScale; - m_22 *= yScale; -} - -// add the rotation to this matrix (clockwise, radians) -// | cos sin 0 | | m_11 m_12 0 | -// | -sin cos 0 | x | m_21 m_22 0 | -// | 0 0 1 | | m_tx m_ty 1 | -void wxAffineMatrix2D::Rotate(wxDouble cRadians) -{ - wxDouble c = cos(cRadians); - wxDouble s = sin(cRadians); - - wxDouble e11 = c*m_11 + s*m_21; - wxDouble e12 = c*m_12 + s*m_22; - m_21 = c*m_21 - s*m_11; - m_22 = c*m_22 - s*m_12; - m_11 = e11; - m_12 = e12; -} - -// -// apply the transforms -// - -// applies that matrix to the point -// | m_11 m_12 0 | -// | src.m_x src._my 1 | x | m_21 m_22 0 | -// | m_tx m_ty 1 | -wxPoint2DDouble -wxAffineMatrix2D::DoTransformPoint(const wxPoint2DDouble& src) const -{ - if ( IsIdentity() ) - return src; - - return wxPoint2DDouble(src.m_x * m_11 + src.m_y * m_21 + m_tx, - src.m_x * m_12 + src.m_y * m_22 + m_ty); -} - -// applies the matrix except for translations -// | m_11 m_12 0 | -// | src.m_x src._my 0 | x | m_21 m_22 0 | -// | m_tx m_ty 1 | -wxPoint2DDouble -wxAffineMatrix2D::DoTransformDistance(const wxPoint2DDouble& src) const -{ - if ( IsIdentity() ) - return src; - - return wxPoint2DDouble(src.m_x * m_11 + src.m_y * m_21, - src.m_x * m_12 + src.m_y * m_22); -} - -bool wxAffineMatrix2D::IsIdentity() const -{ - return m_11 == 1 && m_12 == 0 && - m_21 == 0 && m_22 == 1 && - m_tx == 0 && m_ty == 0; -} - -#endif // wxUSE_GEOMETRY diff --git a/Source/3rd Party/wx/src/common/anidecod.cpp b/Source/3rd Party/wx/src/common/anidecod.cpp index 938997069..f10817c58 100644 --- a/Source/3rd Party/wx/src/common/anidecod.cpp +++ b/Source/3rd Party/wx/src/common/anidecod.cpp @@ -2,7 +2,7 @@ // Name: src/common/anidecod.cpp // Purpose: wxANIDecoder, ANI reader for wxImage and wxAnimation // Author: Francesco Montorsi -// RCS-ID: $Id$ +// RCS-ID: $Id: anidecod.cpp 43898 2006-12-10 14:18:37Z VZ $ // Copyright: (c) Francesco Montorsi // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -113,10 +113,10 @@ wxColour wxANIDecoder::GetTransparentColour(unsigned int frame) const // ANI reading and decoding //--------------------------------------------------------------------------- -bool wxANIDecoder::DoCanRead(wxInputStream& stream) const +bool wxANIDecoder::CanRead(wxInputStream& stream) const { wxInt32 FCC1, FCC2; - wxUint32 datalen; + wxUint32 datalen ; wxInt32 riff32; memcpy( &riff32, "RIFF", 4 ); @@ -127,11 +127,7 @@ bool wxANIDecoder::DoCanRead(wxInputStream& stream) const wxInt32 anih32; memcpy( &anih32, "anih", 4 ); - if ( stream.IsSeekable() && stream.SeekI(0) == wxInvalidOffset ) - { - return false; - } - + stream.SeekI(0); if ( !stream.Read(&FCC1, 4) ) return false; @@ -158,8 +154,7 @@ bool wxANIDecoder::DoCanRead(wxInputStream& stream) const } else { - if ( stream.SeekI(stream.TellI() + datalen) == wxInvalidOffset ) - return false; + stream.SeekI(stream.TellI() + datalen); } // try to read next data chunk: @@ -225,13 +220,8 @@ bool wxANIDecoder::Load( wxInputStream& stream ) wxInt32 seq32; memcpy( &seq32, "seq ", 4 ); - if ( stream.IsSeekable() && stream.SeekI(0) == wxInvalidOffset ) - { - return false; - } - - if ( !stream.Read(&FCC1, 4) ) - return false; + stream.SeekI(0); + stream.Read(&FCC1, 4); if ( FCC1 != riff32 ) return false; @@ -242,12 +232,10 @@ bool wxANIDecoder::Load( wxInputStream& stream ) m_info.Clear(); // we have a riff file: - while ( !stream.Eof() ) + while ( stream.IsOk() ) { // we always have a data size: - if (!stream.Read(&datalen, 4)) - return false; - + stream.Read(&datalen, 4); datalen = wxINT32_SWAP_ON_BE(datalen); //data should be padded to make even number of bytes @@ -256,8 +244,7 @@ bool wxANIDecoder::Load( wxInputStream& stream ) // now either data or a FCC: if ( (FCC1 == riff32) || (FCC1 == list32) ) { - if (!stream.Read(&FCC2, 4)) - return false; + stream.Read(&FCC2, 4); } else if ( FCC1 == anih32 ) { @@ -268,8 +255,7 @@ bool wxANIDecoder::Load( wxInputStream& stream ) return false; // already parsed an ani header? struct wxANIHeader header; - if (!stream.Read(&header, sizeof(wxANIHeader))) - return false; + stream.Read(&header, sizeof(wxANIHeader)); header.AdjustEndianness(); // we should have a global frame size @@ -294,8 +280,7 @@ bool wxANIDecoder::Load( wxInputStream& stream ) wxASSERT(m_info.GetCount() == m_nFrames); for (unsigned int i=0; i(type_); - - wxAnyTypeToVariantDataFactoryMap& anyToVariant = m_anyToVariant; - wxAnyTypeToVariantDataFactoryMap::const_iterator it; - it = anyToVariant.find(type); - if ( it != anyToVariant.end() ) - return it->second; - - // Not found, handle pre-registrations - size_t i = m_anyToVariantRegs.size(); - while ( i > 0 ) - { - i--; - wxAnyToVariantRegistration* reg = m_anyToVariantRegs[i]; - wxAnyValueType* assocType = reg->GetAssociatedType(); - if ( assocType ) - { - // Both variant data and wxAnyValueType have been - // now been properly initialized, so remove the - // pre-registration entry and move data to anyToVarian - // map. - anyToVariant[assocType] = reg->GetFactory(); - m_anyToVariantRegs.erase( m_anyToVariantRegs.begin() + i ); - } - } - - // Then try again - it = anyToVariant.find(type); - if ( it != anyToVariant.end() ) - return it->second; - - // Finally, attempt to find a compatible type - for ( it = anyToVariant.begin(); it != anyToVariant.end(); it++ ) - { - if ( type->IsSameType(it->first) ) - { - wxVariantDataFactory f = it->second; - anyToVariant[type] = f; - return f; - } - } - - // Nothing found - return NULL; - } - -private: - wxAnyTypeToVariantDataFactoryMap m_anyToVariant; - wxVector m_anyToVariantRegs; -}; - -static wxAnyValueTypeGlobals* g_wxAnyValueTypeGlobals = NULL; - - -WX_IMPLEMENT_ANY_VALUE_TYPE(wxAnyValueTypeImplVariantData) - -void wxPreRegisterAnyToVariant(wxAnyToVariantRegistration* reg) -{ - if ( !g_wxAnyValueTypeGlobals ) - g_wxAnyValueTypeGlobals = new wxAnyValueTypeGlobals(); - g_wxAnyValueTypeGlobals->PreRegisterAnyToVariant(reg); -} - -bool wxConvertAnyToVariant(const wxAny& any, wxVariant* variant) -{ - if ( any.IsNull() ) - { - variant->MakeNull(); - return true; - } - - // (signed) integer is a special case, because there is only one type - // in wxAny, and two ("long" and "longlong") in wxVariant. For better - // backwards compatibility, convert all values that fit in "long", - // and others to "longlong". - if ( wxANY_CHECK_TYPE(any, signed int) ) - { -#ifdef wxLongLong_t - wxLongLong_t ll = 0; - if ( any.GetAs(&ll) ) - { - // NB: Do not use LONG_MAX here. Explicitly using 32-bit - // integer constraint yields more consistent behaviour across - // builds. - if ( ll > wxINT32_MAX || ll < wxINT32_MIN ) - *variant = wxLongLong(ll); - else - *variant = (long) wxLongLong(ll).GetLo(); - } - else - { - return false; - } -#else - long l; - if ( any.GetAs(&l) ) - *variant = l; - else - return false; -#endif - return true; - } - - // Find matching factory function - wxVariantDataFactory f = - g_wxAnyValueTypeGlobals->FindVariantDataFactory(any.GetType()); - - wxVariantData* data = NULL; - - if ( f ) - { - data = f(any); - } - else - { - // Check if wxAny wrapped wxVariantData* - if ( !any.GetAs(&data) ) - { - // Ok, one last chance: while unlikely, it is possible that the - // wxAny actually contains wxVariant. - if ( wxANY_CHECK_TYPE(any, wxVariant) ) - *variant = wxANY_AS(any, wxVariant); - return false; - } - - // Wrapper's GetValue() does not increase reference - // count, se have to do it before the data gets passed - // to a new variant. - data->IncRef(); - } - - variant->SetData(data); - return true; -} - -// -// This class is to make sure that wxAnyValueType instances -// etc. get freed correctly. We must use a separate wxAnyValueTypeGlobals -// because wxModule itself is instantiated too late. -// -class wxAnyValueTypeGlobalsManager : public wxModule -{ - DECLARE_DYNAMIC_CLASS(wxAnyValueTypeGlobalsManager) -public: - wxAnyValueTypeGlobalsManager() : wxModule() { } - virtual ~wxAnyValueTypeGlobalsManager() { } - - virtual bool OnInit() - { - return true; - } - virtual void OnExit() - { - wxDELETE(g_wxAnyValueTypeGlobals); - } -private: -}; - -IMPLEMENT_DYNAMIC_CLASS(wxAnyValueTypeGlobalsManager, wxModule) - -#endif // wxUSE_VARIANT - - -//------------------------------------------------------------------------- -// Dynamic conversion member functions -//------------------------------------------------------------------------- - -// -// Define integer minimum and maximum as helpers -#ifdef wxLongLong_t - #define UseIntMin (wxINT64_MIN) - #define UseIntMax (wxINT64_MAX) - #define UseUintMax (wxUINT64_MAX) -#else - #define UseIntMin (LONG_MIN) - #define UseIntMax (LONG_MAX) - #define UseUintMax (ULONG_MAX) -#endif - -namespace -{ - -const double UseIntMinF = static_cast(UseIntMin); -const double UseIntMaxF = static_cast(UseIntMax); -const double UseUintMaxF = static_cast(UseUintMax); - -} // anonymous namespace - -bool wxAnyValueTypeImplInt::ConvertValue(const wxAnyValueBuffer& src, - wxAnyValueType* dstType, - wxAnyValueBuffer& dst) const -{ - wxAnyBaseIntType value = GetValue(src); - if ( wxANY_VALUE_TYPE_CHECK_TYPE(dstType, wxString) ) - { -#ifdef wxLongLong_t - wxLongLong ll(value); - wxString s = ll.ToString(); -#else - wxString s = wxString::Format(wxS("%ld"), (long)value); -#endif - wxAnyValueTypeImpl::SetValue(s, dst); - } - else if ( wxANY_VALUE_TYPE_CHECK_TYPE(dstType, wxAnyBaseUintType) ) - { - if ( value < 0 ) - return false; - wxAnyBaseUintType ul = (wxAnyBaseUintType) value; - wxAnyValueTypeImplUint::SetValue(ul, dst); - } - else if ( wxANY_VALUE_TYPE_CHECK_TYPE(dstType, double) ) - { - double value2 = static_cast(value); - wxAnyValueTypeImplDouble::SetValue(value2, dst); - } - else if ( wxANY_VALUE_TYPE_CHECK_TYPE(dstType, bool) ) - { - bool value2 = value ? true : false; - wxAnyValueTypeImpl::SetValue(value2, dst); - } - else - return false; - - return true; -} - -bool wxAnyValueTypeImplUint::ConvertValue(const wxAnyValueBuffer& src, - wxAnyValueType* dstType, - wxAnyValueBuffer& dst) const -{ - wxAnyBaseUintType value = GetValue(src); - if ( wxANY_VALUE_TYPE_CHECK_TYPE(dstType, wxString) ) - { -#ifdef wxLongLong_t - wxULongLong ull(value); - wxString s = ull.ToString(); -#else - wxString s = wxString::Format(wxS("%lu"), (long)value); -#endif - wxAnyValueTypeImpl::SetValue(s, dst); - } - else if ( wxANY_VALUE_TYPE_CHECK_TYPE(dstType, wxAnyBaseIntType) ) - { - if ( value > UseIntMax ) - return false; - wxAnyBaseIntType l = (wxAnyBaseIntType) value; - wxAnyValueTypeImplInt::SetValue(l, dst); - } - else if ( wxANY_VALUE_TYPE_CHECK_TYPE(dstType, double) ) - { -#ifndef __VISUALC6__ - double value2 = static_cast(value); -#else - // VC6 doesn't implement conversion from unsigned __int64 to double - wxAnyBaseIntType value0 = static_cast(value); - double value2 = static_cast(value0); -#endif - wxAnyValueTypeImplDouble::SetValue(value2, dst); - } - else if ( wxANY_VALUE_TYPE_CHECK_TYPE(dstType, bool) ) - { - bool value2 = value ? true : false; - wxAnyValueTypeImpl::SetValue(value2, dst); - } - else - return false; - - return true; -} - -// Convert wxString to destination wxAny value type -bool wxAnyConvertString(const wxString& value, - wxAnyValueType* dstType, - wxAnyValueBuffer& dst) -{ - if ( wxANY_VALUE_TYPE_CHECK_TYPE(dstType, wxString) ) - { - wxAnyValueTypeImpl::SetValue(value, dst); - } - else if ( wxANY_VALUE_TYPE_CHECK_TYPE(dstType, wxAnyBaseIntType) ) - { - wxAnyBaseIntType value2; -#ifdef wxLongLong_t - if ( !value.ToLongLong(&value2) ) -#else - if ( !value.ToLong(&value2) ) -#endif - return false; - wxAnyValueTypeImplInt::SetValue(value2, dst); - } - else if ( wxANY_VALUE_TYPE_CHECK_TYPE(dstType, wxAnyBaseUintType) ) - { - wxAnyBaseUintType value2; -#ifdef wxLongLong_t - if ( !value.ToULongLong(&value2) ) -#else - if ( !value.ToULong(&value2) ) -#endif - return false; - wxAnyValueTypeImplUint::SetValue(value2, dst); - } - else if ( wxANY_VALUE_TYPE_CHECK_TYPE(dstType, double) ) - { - double value2; - if ( !value.ToDouble(&value2) ) - return false; - wxAnyValueTypeImplDouble::SetValue(value2, dst); - } - else if ( wxANY_VALUE_TYPE_CHECK_TYPE(dstType, bool) ) - { - bool value2; - wxString s(value); - s.MakeLower(); - if ( s == wxS("true") || - s == wxS("yes") || - s == wxS('1') ) - value2 = true; - else if ( s == wxS("false") || - s == wxS("no") || - s == wxS('0') ) - value2 = false; - else - return false; - - wxAnyValueTypeImpl::SetValue(value2, dst); - } - else - return false; - - return true; -} - -bool wxAnyValueTypeImpl::ConvertValue(const wxAnyValueBuffer& src, - wxAnyValueType* dstType, - wxAnyValueBuffer& dst) const -{ - bool value = GetValue(src); - if ( wxANY_VALUE_TYPE_CHECK_TYPE(dstType, wxAnyBaseIntType) ) - { - wxAnyBaseIntType value2 = static_cast(value); - wxAnyValueTypeImplInt::SetValue(value2, dst); - } - else if ( wxANY_VALUE_TYPE_CHECK_TYPE(dstType, wxAnyBaseUintType) ) - { - wxAnyBaseIntType value2 = static_cast(value); - wxAnyValueTypeImplUint::SetValue(value2, dst); - } - else if ( wxANY_VALUE_TYPE_CHECK_TYPE(dstType, wxString) ) - { - wxString s; - if ( value ) - s = wxS("true"); - else - s = wxS("false"); - wxAnyValueTypeImpl::SetValue(s, dst); - } - else - return false; - - return true; -} - -bool wxAnyValueTypeImplDouble::ConvertValue(const wxAnyValueBuffer& src, - wxAnyValueType* dstType, - wxAnyValueBuffer& dst) const -{ - double value = GetValue(src); - if ( wxANY_VALUE_TYPE_CHECK_TYPE(dstType, wxAnyBaseIntType) ) - { - if ( value < UseIntMinF || value > UseIntMaxF ) - return false; - wxAnyBaseUintType ul = static_cast(value); - wxAnyValueTypeImplUint::SetValue(ul, dst); - } - else if ( wxANY_VALUE_TYPE_CHECK_TYPE(dstType, wxAnyBaseUintType) ) - { - if ( value < 0.0 || value > UseUintMaxF ) - return false; - wxAnyBaseUintType ul = static_cast(value); - wxAnyValueTypeImplUint::SetValue(ul, dst); - } - else if ( wxANY_VALUE_TYPE_CHECK_TYPE(dstType, wxString) ) - { - wxString s = wxString::Format(wxS("%.14g"), value); - wxAnyValueTypeImpl::SetValue(s, dst); - } - else - return false; - - return true; -} - -WX_IMPLEMENT_ANY_VALUE_TYPE(wxAnyValueTypeImplInt) -WX_IMPLEMENT_ANY_VALUE_TYPE(wxAnyValueTypeImplUint) -WX_IMPLEMENT_ANY_VALUE_TYPE(wxAnyValueTypeImpl) -WX_IMPLEMENT_ANY_VALUE_TYPE(wxAnyValueTypeImplDouble) - -WX_IMPLEMENT_ANY_VALUE_TYPE(wxAnyValueTypeImplwxString) -WX_IMPLEMENT_ANY_VALUE_TYPE(wxAnyValueTypeImplConstCharPtr) -WX_IMPLEMENT_ANY_VALUE_TYPE(wxAnyValueTypeImplConstWchar_tPtr) - -#if wxUSE_DATETIME -WX_IMPLEMENT_ANY_VALUE_TYPE(wxAnyValueTypeImpl) -#endif // wxUSE_DATETIME - -//WX_IMPLEMENT_ANY_VALUE_TYPE(wxAnyValueTypeImpl) -//WX_IMPLEMENT_ANY_VALUE_TYPE(wxAnyValueTypeImpl) - -//------------------------------------------------------------------------- -// wxAnyNullValueType implementation -//------------------------------------------------------------------------- - -class wxAnyNullValue -{ -private: - void* m_dummy; -}; - -template <> -class wxAnyValueTypeImpl : public wxAnyValueType -{ - WX_DECLARE_ANY_VALUE_TYPE(wxAnyValueTypeImpl) -public: - // Dummy implementations - virtual void DeleteValue(wxAnyValueBuffer& buf) const - { - wxUnusedVar(buf); - } - - virtual void CopyBuffer(const wxAnyValueBuffer& src, - wxAnyValueBuffer& dst) const - { - wxUnusedVar(src); - wxUnusedVar(dst); - } - - virtual bool ConvertValue(const wxAnyValueBuffer& src, - wxAnyValueType* dstType, - wxAnyValueBuffer& dst) const - { - wxUnusedVar(src); - wxUnusedVar(dstType); - wxUnusedVar(dst); - return false; - } - -#if wxUSE_EXTENDED_RTTI - virtual const wxTypeInfo* GetTypeInfo() const - { - wxFAIL_MSG("Null Type Info not available"); - return NULL; - } -#endif - -private: -}; - -WX_IMPLEMENT_ANY_VALUE_TYPE(wxAnyValueTypeImpl) - -wxAnyValueType* wxAnyNullValueType = - wxAnyValueTypeImpl::GetInstance(); - -#include "wx/listimpl.cpp" -WX_DEFINE_LIST(wxAnyList) - -#endif // wxUSE_ANY diff --git a/Source/3rd Party/wx/src/common/appbase.cpp b/Source/3rd Party/wx/src/common/appbase.cpp index c7df04a99..9bc6833db 100644 --- a/Source/3rd Party/wx/src/common/appbase.cpp +++ b/Source/3rd Party/wx/src/common/appbase.cpp @@ -1,12 +1,12 @@ /////////////////////////////////////////////////////////////////////////////// // Name: src/common/appbase.cpp -// Purpose: implements wxAppConsoleBase class +// Purpose: implements wxAppConsole class // Author: Vadim Zeitlin // Modified by: // Created: 19.06.2003 (extracted from common/appcmn.cpp) -// RCS-ID: $Id$ +// RCS-ID: $Id: appbase.cpp 52093 2008-02-25 13:43:07Z VZ $ // Copyright: (c) 2003 Vadim Zeitlin -// Licence: wxWindows licence +// License: wxWindows license /////////////////////////////////////////////////////////////////////////////// // ============================================================================ @@ -25,7 +25,7 @@ #endif #ifndef WX_PRECOMP - #ifdef __WINDOWS__ + #ifdef __WXMSW__ #include "wx/msw/wrapwin.h" // includes windows.h for MessageBox() #endif #include "wx/list.h" @@ -33,45 +33,46 @@ #include "wx/intl.h" #include "wx/log.h" #include "wx/utils.h" - #include "wx/wxcrtvararg.h" #endif //WX_PRECOMP #include "wx/apptrait.h" #include "wx/cmdline.h" #include "wx/confbase.h" -#include "wx/evtloop.h" #include "wx/filename.h" #include "wx/msgout.h" -#include "wx/scopedptr.h" -#include "wx/sysopt.h" #include "wx/tokenzr.h" -#include "wx/thread.h" -#if wxUSE_EXCEPTIONS && wxUSE_STL - #include - #include -#endif - -#if !defined(__WINDOWS__) || defined(__WXMICROWIN__) +#if !defined(__WXMSW__) || defined(__WXMICROWIN__) #include // for SIGTRAP used by wxTrap() #endif //Win/Unix -#include - #if wxUSE_FONTMAP #include "wx/fontmap.h" #endif // wxUSE_FONTMAP -#if wxDEBUG_LEVEL +#if defined(__DARWIN__) && defined(_MSL_USING_MW_C_HEADERS) && _MSL_USING_MW_C_HEADERS + // For MacTypes.h for Debugger function + #include +#endif + +#if defined(__WXMAC__) + #ifdef __DARWIN__ + #include + #else + #include "wx/mac/private.h" // includes mac headers + #endif +#endif // __WXMAC__ + +#ifdef __WXDEBUG__ #if wxUSE_STACKWALKER #include "wx/stackwalk.h" - #ifdef __WINDOWS__ + #ifdef __WXMSW__ #include "wx/msw/debughlp.h" #endif #endif // wxUSE_STACKWALKER #include "wx/recguard.h" -#endif // wxDEBUG_LEVEL +#endif // __WXDEBUG__ // wxABI_VERSION can be defined when compiling applications but it should be // left undefined when compiling the library itself, it is then set to its @@ -84,22 +85,20 @@ // private functions prototypes // ---------------------------------------------------------------------------- -#if wxDEBUG_LEVEL +#ifdef __WXDEBUG__ // really just show the assert dialog static bool DoShowAssertDialog(const wxString& msg); // prepare for showing the assert dialog, use the given traits or // DoShowAssertDialog() as last fallback to really show it static - void ShowAssertDialog(const wxString& file, - int line, - const wxString& func, - const wxString& cond, - const wxString& msg, + void ShowAssertDialog(const wxChar *szFile, + int nLine, + const wxChar *szFunc, + const wxChar *szCond, + const wxChar *szMsg, wxAppTraits *traits = NULL); -#endif // wxDEBUG_LEVEL -#ifdef __WXDEBUG__ // turn on the trace masks specified in the env variable WXTRACE static void LINKAGEMODE SetTraceMasks(); #endif // __WXDEBUG__ @@ -108,36 +107,23 @@ // global vars // ---------------------------------------------------------------------------- -wxAppConsole *wxAppConsoleBase::ms_appInstance = NULL; +wxAppConsole *wxAppConsole::ms_appInstance = NULL; -wxAppInitializerFunction wxAppConsoleBase::ms_appInitFn = NULL; - -wxSocketManager *wxAppTraitsBase::ms_manager = NULL; - -WXDLLIMPEXP_DATA_BASE(wxList) wxPendingDelete; - -// ---------------------------------------------------------------------------- -// wxEventLoopPtr -// ---------------------------------------------------------------------------- - -// this defines wxEventLoopPtr -wxDEFINE_TIED_SCOPED_PTR_TYPE(wxEventLoopBase) +wxAppInitializerFunction wxAppConsole::ms_appInitFn = NULL; // ============================================================================ -// wxAppConsoleBase implementation +// wxAppConsole implementation // ============================================================================ // ---------------------------------------------------------------------------- // ctor/dtor // ---------------------------------------------------------------------------- -wxAppConsoleBase::wxAppConsoleBase() +wxAppConsole::wxAppConsole() { m_traits = NULL; - m_mainLoop = NULL; - m_bDoPendingEventProcessing = true; - ms_appInstance = static_cast(this); + ms_appInstance = this; #ifdef __WXDEBUG__ SetTraceMasks(); @@ -145,82 +131,47 @@ wxAppConsoleBase::wxAppConsoleBase() // In unicode mode the SetTraceMasks call can cause an apptraits to be // created, but since we are still in the constructor the wrong kind will // be created for GUI apps. Destroy it so it can be created again later. - wxDELETE(m_traits); + delete m_traits; + m_traits = NULL; #endif #endif - - wxEvtHandler::AddFilter(this); } -wxAppConsoleBase::~wxAppConsoleBase() +wxAppConsole::~wxAppConsole() { - wxEvtHandler::RemoveFilter(this); - - // we're being destroyed and using this object from now on may not work or - // even crash so don't leave dangling pointers to it - ms_appInstance = NULL; - delete m_traits; } // ---------------------------------------------------------------------------- -// initialization/cleanup +// initilization/cleanup // ---------------------------------------------------------------------------- -bool wxAppConsoleBase::Initialize(int& WXUNUSED(argc), wxChar **WXUNUSED(argv)) +bool wxAppConsole::Initialize(int& argcOrig, wxChar **argvOrig) { -#if wxUSE_INTL - GetTraits()->SetLocale(); -#endif // wxUSE_INTL + // remember the command line arguments + argc = argcOrig; + argv = argvOrig; + +#ifndef __WXPALMOS__ + if ( m_appName.empty() && argv ) + { + // the application name is, by default, the name of its executable file + wxFileName::SplitPath(argv[0], NULL, &m_appName, NULL); + } +#endif return true; } -wxString wxAppConsoleBase::GetAppName() const +void wxAppConsole::CleanUp() { - wxString name = m_appName; - if ( name.empty() ) - { - if ( argv ) - { - // the application name is, by default, the name of its executable file - wxFileName::SplitPath(argv[0], NULL, &name, NULL); - } - } - return name; -} - -wxString wxAppConsoleBase::GetAppDisplayName() const -{ - // use the explicitly provided display name, if any - if ( !m_appDisplayName.empty() ) - return m_appDisplayName; - - // if the application name was explicitly set, use it as is as capitalizing - // it won't always produce good results - if ( !m_appName.empty() ) - return m_appName; - - // if neither is set, use the capitalized version of the program file as - // it's the most reasonable default - return GetAppName().Capitalize(); -} - -wxEventLoopBase *wxAppConsoleBase::CreateMainLoop() -{ - return GetTraits()->CreateEventLoop(); -} - -void wxAppConsoleBase::CleanUp() -{ - wxDELETE(m_mainLoop); } // ---------------------------------------------------------------------------- // OnXXX() callbacks // ---------------------------------------------------------------------------- -bool wxAppConsoleBase::OnInit() +bool wxAppConsole::OnInit() { #if wxUSE_CMDLINE_PARSER wxCmdLineParser parser(argc, argv); @@ -250,330 +201,110 @@ bool wxAppConsoleBase::OnInit() return true; } -int wxAppConsoleBase::OnRun() -{ - return MainLoop(); -} - -int wxAppConsoleBase::OnExit() +int wxAppConsole::OnExit() { #if wxUSE_CONFIG // delete the config object if any (don't use Get() here, but Set() // because Get() could create a new config object) - delete wxConfigBase::Set(NULL); + delete wxConfigBase::Set((wxConfigBase *) NULL); #endif // wxUSE_CONFIG return 0; } -void wxAppConsoleBase::Exit() +void wxAppConsole::Exit() { - if (m_mainLoop != NULL) - ExitMainLoop(); - else - exit(-1); + exit(-1); } // ---------------------------------------------------------------------------- // traits stuff // ---------------------------------------------------------------------------- -wxAppTraits *wxAppConsoleBase::CreateTraits() +wxAppTraits *wxAppConsole::CreateTraits() { return new wxConsoleAppTraits; } -wxAppTraits *wxAppConsoleBase::GetTraits() +wxAppTraits *wxAppConsole::GetTraits() { // FIXME-MT: protect this with a CS? if ( !m_traits ) { m_traits = CreateTraits(); - wxASSERT_MSG( m_traits, wxT("wxApp::CreateTraits() failed?") ); + wxASSERT_MSG( m_traits, _T("wxApp::CreateTraits() failed?") ); } return m_traits; } -/* static */ -wxAppTraits *wxAppConsoleBase::GetTraitsIfExists() -{ - wxAppConsole * const app = GetInstance(); - return app ? app->GetTraits() : NULL; -} - -// ---------------------------------------------------------------------------- -// wxEventLoop redirection -// ---------------------------------------------------------------------------- - -int wxAppConsoleBase::MainLoop() -{ - wxEventLoopBaseTiedPtr mainLoop(&m_mainLoop, CreateMainLoop()); - - return m_mainLoop ? m_mainLoop->Run() : -1; -} - -void wxAppConsoleBase::ExitMainLoop() -{ - // we should exit from the main event loop, not just any currently active - // (e.g. modal dialog) event loop - if ( m_mainLoop && m_mainLoop->IsRunning() ) - { - m_mainLoop->Exit(0); - } -} - -bool wxAppConsoleBase::Pending() -{ - // use the currently active message loop here, not m_mainLoop, because if - // we're showing a modal dialog (with its own event loop) currently the - // main event loop is not running anyhow - wxEventLoopBase * const loop = wxEventLoopBase::GetActive(); - - return loop && loop->Pending(); -} - -bool wxAppConsoleBase::Dispatch() -{ - // see comment in Pending() - wxEventLoopBase * const loop = wxEventLoopBase::GetActive(); - - return loop && loop->Dispatch(); -} - -bool wxAppConsoleBase::Yield(bool onlyIfNeeded) -{ - wxEventLoopBase * const loop = wxEventLoopBase::GetActive(); - if ( loop ) - return loop->Yield(onlyIfNeeded); - - wxScopedPtr tmpLoop(CreateMainLoop()); - return tmpLoop->Yield(onlyIfNeeded); -} - -void wxAppConsoleBase::WakeUpIdle() -{ - wxEventLoopBase * const loop = wxEventLoopBase::GetActive(); - - if ( loop ) - loop->WakeUp(); -} - -bool wxAppConsoleBase::ProcessIdle() -{ - // synthesize an idle event and check if more of them are needed - wxIdleEvent event; - event.SetEventObject(this); - ProcessEvent(event); +// we must implement CreateXXX() in wxApp itself for backwards compatibility +#if WXWIN_COMPATIBILITY_2_4 #if wxUSE_LOG - // flush the logged messages if any (do this after processing the events - // which could have logged new messages) - wxLog::FlushActive(); + +wxLog *wxAppConsole::CreateLogTarget() +{ + wxAppTraits *traits = GetTraits(); + return traits ? traits->CreateLogTarget() : NULL; +} + +#endif // wxUSE_LOG + +wxMessageOutput *wxAppConsole::CreateMessageOutput() +{ + wxAppTraits *traits = GetTraits(); + return traits ? traits->CreateMessageOutput() : NULL; +} + +#endif // WXWIN_COMPATIBILITY_2_4 + +// ---------------------------------------------------------------------------- +// event processing +// ---------------------------------------------------------------------------- + +void wxAppConsole::ProcessPendingEvents() +{ +#if wxUSE_THREADS + if ( !wxPendingEventsLocker ) + return; #endif - // Garbage collect all objects previously scheduled for destruction. - DeletePendingObjects(); + // ensure that we're the only thread to modify the pending events list + wxENTER_CRIT_SECT( *wxPendingEventsLocker ); - return event.MoreRequested(); -} - -bool wxAppConsoleBase::UsesEventLoop() const -{ - // in console applications we don't know whether we're going to have an - // event loop so assume we won't -- unless we already have one running - return wxEventLoopBase::GetActive() != NULL; -} - -// ---------------------------------------------------------------------------- -// events -// ---------------------------------------------------------------------------- - -/* static */ -bool wxAppConsoleBase::IsMainLoopRunning() -{ - const wxAppConsole * const app = GetInstance(); - - return app && app->m_mainLoop != NULL; -} - -int wxAppConsoleBase::FilterEvent(wxEvent& WXUNUSED(event)) -{ - // process the events normally by default - return Event_Skip; -} - -void wxAppConsoleBase::DelayPendingEventHandler(wxEvtHandler* toDelay) -{ - wxENTER_CRIT_SECT(m_handlersWithPendingEventsLocker); - - // move the handler from the list of handlers with processable pending events - // to the list of handlers with pending events which needs to be processed later - m_handlersWithPendingEvents.Remove(toDelay); - - if (m_handlersWithPendingDelayedEvents.Index(toDelay) == wxNOT_FOUND) - m_handlersWithPendingDelayedEvents.Add(toDelay); - - wxLEAVE_CRIT_SECT(m_handlersWithPendingEventsLocker); -} - -void wxAppConsoleBase::RemovePendingEventHandler(wxEvtHandler* toRemove) -{ - wxENTER_CRIT_SECT(m_handlersWithPendingEventsLocker); - - if (m_handlersWithPendingEvents.Index(toRemove) != wxNOT_FOUND) + if ( !wxPendingEvents ) { - m_handlersWithPendingEvents.Remove(toRemove); - - // check that the handler was present only once in the list - wxASSERT_MSG( m_handlersWithPendingEvents.Index(toRemove) == wxNOT_FOUND, - "Handler occurs twice in the m_handlersWithPendingEvents list!" ); - } - //else: it wasn't in this list at all, it's ok - - if (m_handlersWithPendingDelayedEvents.Index(toRemove) != wxNOT_FOUND) - { - m_handlersWithPendingDelayedEvents.Remove(toRemove); - - // check that the handler was present only once in the list - wxASSERT_MSG( m_handlersWithPendingDelayedEvents.Index(toRemove) == wxNOT_FOUND, - "Handler occurs twice in m_handlersWithPendingDelayedEvents list!" ); - } - //else: it wasn't in this list at all, it's ok - - wxLEAVE_CRIT_SECT(m_handlersWithPendingEventsLocker); -} - -void wxAppConsoleBase::AppendPendingEventHandler(wxEvtHandler* toAppend) -{ - wxENTER_CRIT_SECT(m_handlersWithPendingEventsLocker); - - if ( m_handlersWithPendingEvents.Index(toAppend) == wxNOT_FOUND ) - m_handlersWithPendingEvents.Add(toAppend); - - wxLEAVE_CRIT_SECT(m_handlersWithPendingEventsLocker); -} - -bool wxAppConsoleBase::HasPendingEvents() const -{ - wxENTER_CRIT_SECT(const_cast(this)->m_handlersWithPendingEventsLocker); - - bool has = !m_handlersWithPendingEvents.IsEmpty(); - - wxLEAVE_CRIT_SECT(const_cast(this)->m_handlersWithPendingEventsLocker); - - return has; -} - -void wxAppConsoleBase::SuspendProcessingOfPendingEvents() -{ - m_bDoPendingEventProcessing = false; -} - -void wxAppConsoleBase::ResumeProcessingOfPendingEvents() -{ - m_bDoPendingEventProcessing = true; -} - -void wxAppConsoleBase::ProcessPendingEvents() -{ - if ( m_bDoPendingEventProcessing ) - { - wxENTER_CRIT_SECT(m_handlersWithPendingEventsLocker); - - wxCHECK_RET( m_handlersWithPendingDelayedEvents.IsEmpty(), - "this helper list should be empty" ); - - // iterate until the list becomes empty: the handlers remove themselves - // from it when they don't have any more pending events - while (!m_handlersWithPendingEvents.IsEmpty()) - { - // In ProcessPendingEvents(), new handlers might be added - // and we can safely leave the critical section here. - wxLEAVE_CRIT_SECT(m_handlersWithPendingEventsLocker); - - // NOTE: we always call ProcessPendingEvents() on the first event handler - // with pending events because handlers auto-remove themselves - // from this list (see RemovePendingEventHandler) if they have no - // more pending events. - m_handlersWithPendingEvents[0]->ProcessPendingEvents(); - - wxENTER_CRIT_SECT(m_handlersWithPendingEventsLocker); - } - - // now the wxHandlersWithPendingEvents is surely empty; however some event - // handlers may have moved themselves into wxHandlersWithPendingDelayedEvents - // because of a selective wxYield call in progress. - // Now we need to move them back to wxHandlersWithPendingEvents so the next - // call to this function has the chance of processing them: - if (!m_handlersWithPendingDelayedEvents.IsEmpty()) - { - WX_APPEND_ARRAY(m_handlersWithPendingEvents, m_handlersWithPendingDelayedEvents); - m_handlersWithPendingDelayedEvents.Clear(); - } - - wxLEAVE_CRIT_SECT(m_handlersWithPendingEventsLocker); - } -} - -void wxAppConsoleBase::DeletePendingEvents() -{ - wxENTER_CRIT_SECT(m_handlersWithPendingEventsLocker); - - wxCHECK_RET( m_handlersWithPendingDelayedEvents.IsEmpty(), - "this helper list should be empty" ); - - for (unsigned int i=0; iDeletePendingEvents(); - - m_handlersWithPendingEvents.Clear(); - - wxLEAVE_CRIT_SECT(m_handlersWithPendingEventsLocker); -} - -// ---------------------------------------------------------------------------- -// delayed objects destruction -// ---------------------------------------------------------------------------- - -bool wxAppConsoleBase::IsScheduledForDestruction(wxObject *object) const -{ - return wxPendingDelete.Member(object); -} - -void wxAppConsoleBase::ScheduleForDestruction(wxObject *object) -{ - if ( !UsesEventLoop() ) - { - // we won't be able to delete it later so do it right now - delete object; + wxLEAVE_CRIT_SECT( *wxPendingEventsLocker ); return; } - //else: we either already have or will soon start an event loop - if ( !wxPendingDelete.Member(object) ) - wxPendingDelete.Append(object); -} - -void wxAppConsoleBase::DeletePendingObjects() -{ - wxList::compatibility_iterator node = wxPendingDelete.GetFirst(); + // iterate until the list becomes empty + wxList::compatibility_iterator node = wxPendingEvents->GetFirst(); while (node) { - wxObject *obj = node->GetData(); + wxEvtHandler *handler = (wxEvtHandler *)node->GetData(); + wxPendingEvents->Erase(node); - // remove it from the list first so that if we get back here somehow - // during the object deletion (e.g. wxYield called from its dtor) we - // wouldn't try to delete it the second time - if ( wxPendingDelete.Member(obj) ) - wxPendingDelete.Erase(node); + // In ProcessPendingEvents(), new handlers might be add + // and we can safely leave the critical section here. + wxLEAVE_CRIT_SECT( *wxPendingEventsLocker ); - delete obj; + handler->ProcessPendingEvents(); - // Deleting one object may have deleted other pending - // objects, so start from beginning of list again. - node = wxPendingDelete.GetFirst(); + wxENTER_CRIT_SECT( *wxPendingEventsLocker ); + + node = wxPendingEvents->GetFirst(); } + + wxLEAVE_CRIT_SECT( *wxPendingEventsLocker ); +} + +int wxAppConsole::FilterEvent(wxEvent& WXUNUSED(event)) +{ + // process the events normally by default + return -1; } // ---------------------------------------------------------------------------- @@ -583,70 +314,14 @@ void wxAppConsoleBase::DeletePendingObjects() #if wxUSE_EXCEPTIONS void -wxAppConsoleBase::HandleEvent(wxEvtHandler *handler, - wxEventFunction func, - wxEvent& event) const +wxAppConsole::HandleEvent(wxEvtHandler *handler, + wxEventFunction func, + wxEvent& event) const { // by default, simply call the handler (handler->*func)(event); } -void wxAppConsoleBase::CallEventHandler(wxEvtHandler *handler, - wxEventFunctor& functor, - wxEvent& event) const -{ - // If the functor holds a method then, for backward compatibility, call - // HandleEvent(): - wxEventFunction eventFunction = functor.GetEvtMethod(); - - if ( eventFunction ) - HandleEvent(handler, eventFunction, event); - else - functor(handler, event); -} - -void wxAppConsoleBase::OnUnhandledException() -{ -#ifdef __WXDEBUG__ - // we're called from an exception handler so we can re-throw the exception - // to recover its type - wxString what; - try - { - throw; - } -#if wxUSE_STL - catch ( std::exception& e ) - { - what.Printf("std::exception of type \"%s\", what() = \"%s\"", - typeid(e).name(), e.what()); - } -#endif // wxUSE_STL - catch ( ... ) - { - what = "unknown exception"; - } - - wxMessageOutputBest().Printf( - "*** Caught unhandled %s; terminating\n", what - ); -#endif // __WXDEBUG__ -} - -// ---------------------------------------------------------------------------- -// exceptions support -// ---------------------------------------------------------------------------- - -bool wxAppConsoleBase::OnExceptionInMainLoop() -{ - throw; - - // some compilers are too stupid to know that we never return after throw -#if defined(__DMC__) || (defined(_MSC_VER) && _MSC_VER < 1200) - return false; -#endif -} - #endif // wxUSE_EXCEPTIONS // ---------------------------------------------------------------------------- @@ -655,17 +330,17 @@ bool wxAppConsoleBase::OnExceptionInMainLoop() #if wxUSE_CMDLINE_PARSER -#define OPTION_VERBOSE "verbose" +#define OPTION_VERBOSE _T("verbose") -void wxAppConsoleBase::OnInitCmdLine(wxCmdLineParser& parser) +void wxAppConsole::OnInitCmdLine(wxCmdLineParser& parser) { // the standard command line options static const wxCmdLineEntryDesc cmdLineDesc[] = { { wxCMD_LINE_SWITCH, - "h", - "help", + _T("h"), + _T("help"), gettext_noop("show this help message"), wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP @@ -674,7 +349,7 @@ void wxAppConsoleBase::OnInitCmdLine(wxCmdLineParser& parser) #if wxUSE_LOG { wxCMD_LINE_SWITCH, - NULL, + wxEmptyString, OPTION_VERBOSE, gettext_noop("generate verbose log messages"), wxCMD_LINE_VAL_NONE, @@ -683,13 +358,20 @@ void wxAppConsoleBase::OnInitCmdLine(wxCmdLineParser& parser) #endif // wxUSE_LOG // terminator - wxCMD_LINE_DESC_END + { + wxCMD_LINE_NONE, + wxEmptyString, + wxEmptyString, + wxEmptyString, + wxCMD_LINE_VAL_NONE, + 0x0 + } }; parser.SetDesc(cmdLineDesc); } -bool wxAppConsoleBase::OnCmdLineParsed(wxCmdLineParser& parser) +bool wxAppConsole::OnCmdLineParsed(wxCmdLineParser& parser) { #if wxUSE_LOG if ( parser.Found(OPTION_VERBOSE) ) @@ -703,14 +385,14 @@ bool wxAppConsoleBase::OnCmdLineParsed(wxCmdLineParser& parser) return true; } -bool wxAppConsoleBase::OnCmdLineHelp(wxCmdLineParser& parser) +bool wxAppConsole::OnCmdLineHelp(wxCmdLineParser& parser) { parser.Usage(); return false; } -bool wxAppConsoleBase::OnCmdLineError(wxCmdLineParser& parser) +bool wxAppConsole::OnCmdLineError(wxCmdLineParser& parser) { parser.Usage(); @@ -724,8 +406,8 @@ bool wxAppConsoleBase::OnCmdLineError(wxCmdLineParser& parser) // ---------------------------------------------------------------------------- /* static */ -bool wxAppConsoleBase::CheckBuildOptions(const char *optionsSignature, - const char *componentName) +bool wxAppConsole::CheckBuildOptions(const char *optionsSignature, + const char *componentName) { #if 0 // can't use wxLogTrace, not up and running yet printf("checking build options object '%s' (ptr %p) in '%s'\n", @@ -739,7 +421,7 @@ bool wxAppConsoleBase::CheckBuildOptions(const char *optionsSignature, wxString progName = wxString::FromAscii(componentName); wxString msg; - msg.Printf(wxT("Mismatch between the program and library build versions detected.\nThe library used %s,\nand %s used %s."), + msg.Printf(_T("Mismatch between the program and library build versions detected.\nThe library used %s,\nand %s used %s."), lib.c_str(), progName.c_str(), prog.c_str()); wxLogFatalError(msg.c_str()); @@ -747,38 +429,41 @@ bool wxAppConsoleBase::CheckBuildOptions(const char *optionsSignature, // normally wxLogFatalError doesn't return return false; } +#undef wxCMP return true; } -void wxAppConsoleBase::OnAssertFailure(const wxChar *file, - int line, - const wxChar *func, - const wxChar *cond, - const wxChar *msg) +#ifdef __WXDEBUG__ + +void wxAppConsole::OnAssertFailure(const wxChar *file, + int line, + const wxChar *func, + const wxChar *cond, + const wxChar *msg) { -#if wxDEBUG_LEVEL ShowAssertDialog(file, line, func, cond, msg, GetTraits()); -#else - // this function is still present even in debug level 0 build for ABI - // compatibility reasons but is never called there and so can simply do - // nothing in it - wxUnusedVar(file); - wxUnusedVar(line); - wxUnusedVar(func); - wxUnusedVar(cond); - wxUnusedVar(msg); -#endif // wxDEBUG_LEVEL/!wxDEBUG_LEVEL } -void wxAppConsoleBase::OnAssert(const wxChar *file, - int line, - const wxChar *cond, - const wxChar *msg) +void wxAppConsole::OnAssert(const wxChar *file, + int line, + const wxChar *cond, + const wxChar *msg) { OnAssertFailure(file, line, NULL, cond, msg); } +#endif // __WXDEBUG__ + +#if WXWIN_COMPATIBILITY_2_4 + +bool wxAppConsole::CheckBuildOptions(const wxBuildOptions& buildOptions) +{ + return CheckBuildOptions(buildOptions.m_signature, "your program"); +} + +#endif + // ============================================================================ // other classes implementations // ============================================================================ @@ -816,10 +501,12 @@ wxRendererNative *wxConsoleAppTraitsBase::CreateRenderer() return NULL; } +#ifdef __WXDEBUG__ bool wxConsoleAppTraitsBase::ShowAssertDialog(const wxString& msg) { return wxAppTraitsBase::ShowAssertDialog(msg); } +#endif bool wxConsoleAppTraitsBase::HasStderr() { @@ -827,83 +514,52 @@ bool wxConsoleAppTraitsBase::HasStderr() return true; } +void wxConsoleAppTraitsBase::ScheduleForDestroy(wxObject *object) +{ + delete object; +} + +void wxConsoleAppTraitsBase::RemoveFromPendingDelete(wxObject * WXUNUSED(object)) +{ + // nothing to do +} + +#if wxUSE_SOCKETS +GSocketGUIFunctionsTable* wxConsoleAppTraitsBase::GetSocketGUIFunctionsTable() +{ + return NULL; +} +#endif + // ---------------------------------------------------------------------------- // wxAppTraits // ---------------------------------------------------------------------------- -#if wxUSE_INTL -void wxAppTraitsBase::SetLocale() -{ - wxSetlocale(LC_ALL, ""); - wxUpdateLocaleIsUtf8(); -} -#endif - -#if wxUSE_THREADS -void wxMutexGuiEnterImpl(); -void wxMutexGuiLeaveImpl(); - -void wxAppTraitsBase::MutexGuiEnter() -{ - wxMutexGuiEnterImpl(); -} - -void wxAppTraitsBase::MutexGuiLeave() -{ - wxMutexGuiLeaveImpl(); -} - -void WXDLLIMPEXP_BASE wxMutexGuiEnter() -{ - wxAppTraits * const traits = wxAppConsoleBase::GetTraitsIfExists(); - if ( traits ) - traits->MutexGuiEnter(); -} - -void WXDLLIMPEXP_BASE wxMutexGuiLeave() -{ - wxAppTraits * const traits = wxAppConsoleBase::GetTraitsIfExists(); - if ( traits ) - traits->MutexGuiLeave(); -} -#endif // wxUSE_THREADS +#ifdef __WXDEBUG__ bool wxAppTraitsBase::ShowAssertDialog(const wxString& msgOriginal) { -#if wxDEBUG_LEVEL - wxString msg; + wxString msg = msgOriginal; #if wxUSE_STACKWALKER +#if !defined(__WXMSW__) + // on Unix stack frame generation may take some time, depending on the + // size of the executable mainly... warn the user that we are working + wxFprintf(stderr, wxT("[Debug] Generating a stack trace... please wait")); + fflush(stderr); +#endif + const wxString stackTrace = GetAssertStackTrace(); if ( !stackTrace.empty() ) - { - msg << wxT("\n\nCall stack:\n") << stackTrace; - - wxMessageOutputDebug().Output(msg); - } + msg << _T("\n\nCall stack:\n") << stackTrace; #endif // wxUSE_STACKWALKER - return DoShowAssertDialog(msgOriginal + msg); -#else // !wxDEBUG_LEVEL - wxUnusedVar(msgOriginal); - - return false; -#endif // wxDEBUG_LEVEL/!wxDEBUG_LEVEL + return DoShowAssertDialog(msg); } #if wxUSE_STACKWALKER wxString wxAppTraitsBase::GetAssertStackTrace() { -#if wxDEBUG_LEVEL - -#if !defined(__WINDOWS__) - // on Unix stack frame generation may take some time, depending on the - // size of the executable mainly... warn the user that we are working - wxFprintf(stderr, "Collecting stack trace information, please wait..."); - fflush(stderr); -#endif // !__WINDOWS__ - - wxString stackTrace; class StackDump : public wxStackWalker @@ -918,29 +574,29 @@ wxString wxAppTraitsBase::GetAssertStackTrace() { m_stackTrace << wxString::Format ( - wxT("[%02d] "), + _T("[%02d] "), wx_truncate_cast(int, frame.GetLevel()) ); wxString name = frame.GetName(); if ( !name.empty() ) { - m_stackTrace << wxString::Format(wxT("%-40s"), name.c_str()); + m_stackTrace << wxString::Format(_T("%-40s"), name.c_str()); } else { - m_stackTrace << wxString::Format(wxT("%p"), frame.GetAddress()); + m_stackTrace << wxString::Format(_T("%p"), frame.GetAddress()); } if ( frame.HasSourceLocation() ) { - m_stackTrace << wxT('\t') + m_stackTrace << _T('\t') << frame.GetFileName() - << wxT(':') + << _T(':') << frame.GetLine(); } - m_stackTrace << wxT('\n'); + m_stackTrace << _T('\n'); } private: @@ -961,15 +617,12 @@ wxString wxAppTraitsBase::GetAssertStackTrace() stackTrace = stackTrace.BeforeLast(wxT('\n')); return stackTrace; -#else // !wxDEBUG_LEVEL - // this function is still present for ABI-compatibility even in debug level - // 0 build but is not used there and so can simply do nothing - return wxString(); -#endif // wxDEBUG_LEVEL/!wxDEBUG_LEVEL } #endif // wxUSE_STACKWALKER +#endif // __WXDEBUG__ + // ============================================================================ // global functions implementation // ============================================================================ @@ -996,28 +649,25 @@ void wxWakeUpIdle() //else: do nothing, what can we do? } +#ifdef __WXDEBUG__ + // wxASSERT() helper bool wxAssertIsEqual(int x, int y) { return x == y; } -void wxAbort() -{ -#ifdef __WXWINCE__ - ExitThread(3); -#else - abort(); -#endif -} - -#if wxDEBUG_LEVEL - // break into the debugger void wxTrap() { -#if defined(__WINDOWS__) && !defined(__WXMICROWIN__) +#if defined(__WXMSW__) && !defined(__WXMICROWIN__) DebugBreak(); +#elif defined(__WXMAC__) && !defined(__DARWIN__) + #if __powerc + Debugger(); + #else + SysBreak(); + #endif #elif defined(_MSL_USING_MW_C_HEADERS) && _MSL_USING_MW_C_HEADERS Debugger(); #elif defined(__UNIX__) @@ -1027,18 +677,13 @@ void wxTrap() #endif // Win/Unix } -// default assert handler -static void -wxDefaultAssertHandler(const wxString& file, - int line, - const wxString& func, - const wxString& cond, - const wxString& msg) +// this function is called when an assert fails +void wxOnAssert(const wxChar *szFile, + int nLine, + const char *szFunc, + const wxChar *szCond, + const wxChar *szMsg) { - // If this option is set, we should abort immediately when assert happens. - if ( wxSystemOptions::GetOptionInt("exit-on-assert") ) - wxAbort(); - // FIXME MT-unsafe static int s_bInAssert = 0; @@ -1051,107 +696,23 @@ wxDefaultAssertHandler(const wxString& file, return; } + // __FUNCTION__ is always in ASCII, convert it to wide char if needed + const wxString strFunc = wxString::FromAscii(szFunc); + if ( !wxTheApp ) { // by default, show the assert dialog box -- we can't customize this // behaviour - ShowAssertDialog(file, line, func, cond, msg); + ShowAssertDialog(szFile, nLine, strFunc, szCond, szMsg); } else { // let the app process it as it wants - // FIXME-UTF8: use wc_str(), not c_str(), when ANSI build is removed - wxTheApp->OnAssertFailure(file.c_str(), line, func.c_str(), - cond.c_str(), msg.c_str()); + wxTheApp->OnAssertFailure(szFile, nLine, strFunc, szCond, szMsg); } } -wxAssertHandler_t wxTheAssertHandler = wxDefaultAssertHandler; - -void wxSetDefaultAssertHandler() -{ - wxTheAssertHandler = wxDefaultAssertHandler; -} - -void wxOnAssert(const wxString& file, - int line, - const wxString& func, - const wxString& cond, - const wxString& msg) -{ - wxTheAssertHandler(file, line, func, cond, msg); -} - -void wxOnAssert(const wxString& file, - int line, - const wxString& func, - const wxString& cond) -{ - wxTheAssertHandler(file, line, func, cond, wxString()); -} - -void wxOnAssert(const wxChar *file, - int line, - const char *func, - const wxChar *cond, - const wxChar *msg) -{ - // this is the backwards-compatible version (unless we don't use Unicode) - // so it could be called directly from the user code and this might happen - // even when wxTheAssertHandler is NULL -#if wxUSE_UNICODE - if ( wxTheAssertHandler ) -#endif // wxUSE_UNICODE - wxTheAssertHandler(file, line, func, cond, msg); -} - -void wxOnAssert(const char *file, - int line, - const char *func, - const char *cond, - const wxString& msg) -{ - wxTheAssertHandler(file, line, func, cond, msg); -} - -void wxOnAssert(const char *file, - int line, - const char *func, - const char *cond, - const wxCStrData& msg) -{ - wxTheAssertHandler(file, line, func, cond, msg); -} - -#if wxUSE_UNICODE -void wxOnAssert(const char *file, - int line, - const char *func, - const char *cond) -{ - wxTheAssertHandler(file, line, func, cond, wxString()); -} - -void wxOnAssert(const char *file, - int line, - const char *func, - const char *cond, - const char *msg) -{ - wxTheAssertHandler(file, line, func, cond, msg); -} - -void wxOnAssert(const char *file, - int line, - const char *func, - const char *cond, - const wxChar *msg) -{ - wxTheAssertHandler(file, line, func, cond, msg); -} -#endif // wxUSE_UNICODE - -#endif // wxDEBUG_LEVEL +#endif // __WXDEBUG__ // ============================================================================ // private functions implementation @@ -1172,25 +733,19 @@ static void LINKAGEMODE SetTraceMasks() #endif // wxUSE_LOG } -#endif // __WXDEBUG__ - -#if wxDEBUG_LEVEL - -static bool DoShowAssertDialog(const wxString& msg) { - // under Windows we can show the dialog even in the console mode -#if defined(__WINDOWS__) && !defined(__WXMICROWIN__) + // under MSW we can show the dialog even in the console mode +#if defined(__WXMSW__) && !defined(__WXMICROWIN__) wxString msgDlg(msg); - // this message is intentionally not translated -- it is for developers - // only -- and the less code we use here, less is the danger of recursively - // asserting and dying + // this message is intentionally not translated -- it is for + // developpers only msgDlg += wxT("\nDo you want to stop the program?\n") wxT("You can also choose [Cancel] to suppress ") wxT("further warnings."); - switch ( ::MessageBox(NULL, msgDlg.t_str(), wxT("wxWidgets Debug Alert"), + switch ( ::MessageBox(NULL, msgDlg, _T("wxWidgets Debug Alert"), MB_YESNOCANCEL | MB_ICONSTOP ) ) { case IDYES: @@ -1203,21 +758,25 @@ bool DoShowAssertDialog(const wxString& msg) //case IDNO: nothing to do } -#else // !__WINDOWS__ - wxUnusedVar(msg); -#endif // __WINDOWS__/!__WINDOWS__ +#else // !__WXMSW__ + wxFprintf(stderr, wxT("%s\n"), msg.c_str()); + fflush(stderr); - // continue with the asserts by default + // TODO: ask the user to enter "Y" or "N" on the console? + wxTrap(); +#endif // __WXMSW__/!__WXMSW__ + + // continue with the asserts return false; } -// show the standard assert dialog +// show the assert modal dialog static -void ShowAssertDialog(const wxString& file, - int line, - const wxString& func, - const wxString& cond, - const wxString& msgUser, +void ShowAssertDialog(const wxChar *szFile, + int nLine, + const wxChar *szFunc, + const wxChar *szCond, + const wxChar *szMsg, wxAppTraits *traits) { // this variable can be set to true to suppress "assert failure" messages @@ -1229,20 +788,20 @@ void ShowAssertDialog(const wxString& file, // make life easier for people using VC++ IDE by using this format: like // this, clicking on the message will take us immediately to the place of // the failed assert - msg.Printf(wxT("%s(%d): assert \"%s\" failed"), file, line, cond); + msg.Printf(wxT("%s(%d): assert \"%s\" failed"), szFile, nLine, szCond); // add the function name, if any - if ( !func.empty() ) - msg << wxT(" in ") << func << wxT("()"); + if ( szFunc && *szFunc ) + msg << _T(" in ") << szFunc << _T("()"); // and the message itself - if ( !msgUser.empty() ) + if ( szMsg ) { - msg << wxT(": ") << msgUser; + msg << _T(": ") << szMsg; } else // no message given { - msg << wxT('.'); + msg << _T('.'); } #if wxUSE_THREADS @@ -1250,15 +809,27 @@ void ShowAssertDialog(const wxString& file, // since dialogs cannot be displayed if ( !wxThread::IsMain() ) { - msg += wxString::Format(" [in thread %lx]", wxThread::GetCurrentId()); - } -#endif // wxUSE_THREADS + msg += wxT(" [in child thread]"); - // log the assert in any case - wxMessageOutputDebug().Output(msg); +#if defined(__WXMSW__) && !defined(__WXMICROWIN__) + msg << wxT("\r\n"); + OutputDebugString(msg ); +#else + // send to stderr + wxFprintf(stderr, wxT("%s\n"), msg.c_str()); + fflush(stderr); +#endif + // He-e-e-e-elp!! we're asserting in a child thread + wxTrap(); + } + else +#endif // wxUSE_THREADS if ( !s_bNoAsserts ) { + // send it to the normal log destination + wxLogDebug(_T("%s"), msg.c_str()); + if ( traits ) { // delegate showing assert dialog (if possible) to that class @@ -1272,4 +843,4 @@ void ShowAssertDialog(const wxString& file, } } -#endif // wxDEBUG_LEVEL +#endif // __WXDEBUG__ diff --git a/Source/3rd Party/wx/src/common/appcmn.cpp b/Source/3rd Party/wx/src/common/appcmn.cpp index 9371b0f25..670a35d09 100644 --- a/Source/3rd Party/wx/src/common/appcmn.cpp +++ b/Source/3rd Party/wx/src/common/appcmn.cpp @@ -1,10 +1,10 @@ ///////////////////////////////////////////////////////////////////////////// // Name: src/common/appcmn.cpp -// Purpose: wxAppBase methods common to all platforms +// Purpose: wxAppConsole and wxAppBase methods common to all platforms // Author: Vadim Zeitlin // Modified by: // Created: 18.10.99 -// RCS-ID: $Id$ +// RCS-ID: $Id: appcmn.cpp 47229 2007-07-08 05:31:32Z PC $ // Copyright: (c) Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -32,15 +32,33 @@ #include "wx/msgdlg.h" #include "wx/confbase.h" #include "wx/utils.h" - #include "wx/wxcrtvararg.h" #endif #include "wx/apptrait.h" #include "wx/cmdline.h" +#include "wx/evtloop.h" #include "wx/msgout.h" #include "wx/thread.h" #include "wx/vidmode.h" -#include "wx/evtloop.h" +#include "wx/ptr_scpd.h" + +#ifdef __WXDEBUG__ + #if wxUSE_STACKWALKER + #include "wx/stackwalk.h" + #endif // wxUSE_STACKWALKER +#endif // __WXDEBUG__ + +#if defined(__WXMSW__) + #include "wx/msw/private.h" // includes windows.h for LOGFONT +#endif + +#ifdef __WXMSW__ +#include +#endif + +#if defined(__WXMAC__) + #include "wx/mac/private.h" +#endif #if wxUSE_FONTMAP #include "wx/fontmap.h" @@ -50,6 +68,15 @@ #include "wx/build.h" WX_CHECK_BUILD_OPTIONS("wxCore") +WXDLLIMPEXP_DATA_CORE(wxList) wxPendingDelete; + +// ---------------------------------------------------------------------------- +// wxEventLoopPtr +// ---------------------------------------------------------------------------- + +// this defines wxEventLoopPtr +wxDEFINE_TIED_SCOPED_PTR_TYPE(wxEventLoop) + // ============================================================================ // wxAppBase implementation // ============================================================================ @@ -60,13 +87,15 @@ WX_CHECK_BUILD_OPTIONS("wxCore") wxAppBase::wxAppBase() { - m_topWindow = NULL; - + m_topWindow = (wxWindow *)NULL; + m_useBestVisual = false; m_forceTrueColour = false; - + m_isActive = true; + m_mainLoop = NULL; + // We don't want to exit the app if the user code shows a dialog from its // OnInit() -- but this is what would happen if we set m_exitOnFrameDelete // to Yes initially as this dialog would be the last top level window. @@ -87,14 +116,14 @@ bool wxAppBase::Initialize(int& argcOrig, wxChar **argvOrig) if ( !wxAppConsole::Initialize(argcOrig, argvOrig) ) return false; +#if wxUSE_THREADS + wxPendingEventsLocker = new wxCriticalSection; +#endif + wxInitializeStockLists(); wxBitmap::InitStandardHandlers(); - // for compatibility call the old initialization function too - if ( !OnInitGui() ) - return false; - return true; } @@ -128,9 +157,21 @@ void wxAppBase::CleanUp() wxDeleteStockLists(); - wxDELETE(wxTheColourDatabase); + delete wxTheColourDatabase; + wxTheColourDatabase = NULL; - wxAppConsole::CleanUp(); + delete wxPendingEvents; + wxPendingEvents = NULL; + +#if wxUSE_THREADS + delete wxPendingEventsLocker; + wxPendingEventsLocker = NULL; + + #if wxUSE_VALIDATORS + // If we don't do the following, we get an apparent memory leak. + ((wxEvtHandler&) wxDefaultValidator).ClearEventLocker(); + #endif // wxUSE_VALIDATORS +#endif // wxUSE_THREADS } // ---------------------------------------------------------------------------- @@ -174,8 +215,8 @@ wxLayoutDirection wxAppBase::GetLayoutDirection() const // GUI-specific command line options handling // ---------------------------------------------------------------------------- -#define OPTION_THEME "theme" -#define OPTION_MODE "mode" +#define OPTION_THEME _T("theme") +#define OPTION_MODE _T("mode") void wxAppBase::OnInitCmdLine(wxCmdLineParser& parser) { @@ -188,7 +229,7 @@ void wxAppBase::OnInitCmdLine(wxCmdLineParser& parser) #ifdef __WXUNIVERSAL__ { wxCMD_LINE_OPTION, - NULL, + wxEmptyString, OPTION_THEME, gettext_noop("specify the theme to use"), wxCMD_LINE_VAL_STRING, @@ -196,22 +237,29 @@ void wxAppBase::OnInitCmdLine(wxCmdLineParser& parser) }, #endif // __WXUNIVERSAL__ -#if defined(__WXDFB__) - // VS: this is not specific to wxDFB, all fullscreen (framebuffer) ports +#if defined(__WXMGL__) + // VS: this is not specific to wxMGL, all fullscreen (framebuffer) ports // should provide this option. That's why it is in common/appcmn.cpp - // and not dfb/app.cpp + // and not mgl/app.cpp { wxCMD_LINE_OPTION, - NULL, + wxEmptyString, OPTION_MODE, gettext_noop("specify display mode to use (e.g. 640x480-16)"), wxCMD_LINE_VAL_STRING, 0x0 }, -#endif // __WXDFB__ +#endif // __WXMGL__ // terminator - wxCMD_LINE_DESC_END + { + wxCMD_LINE_NONE, + wxEmptyString, + wxEmptyString, + wxEmptyString, + wxCMD_LINE_VAL_NONE, + 0x0 + } }; parser.SetDesc(cmdLineGUIDesc); @@ -236,12 +284,12 @@ bool wxAppBase::OnCmdLineParsed(wxCmdLineParser& parser) } #endif // __WXUNIVERSAL__ -#if defined(__WXDFB__) +#if defined(__WXMGL__) wxString modeDesc; if ( parser.Found(OPTION_MODE, &modeDesc) ) { unsigned w, h, bpp; - if ( wxSscanf(modeDesc.c_str(), wxT("%ux%u-%u"), &w, &h, &bpp) != 3 ) + if ( wxSscanf(modeDesc.c_str(), _T("%ux%u-%u"), &w, &h, &bpp) != 3 ) { wxLogError(_("Invalid display mode specification '%s'."), modeDesc.c_str()); return false; @@ -250,13 +298,52 @@ bool wxAppBase::OnCmdLineParsed(wxCmdLineParser& parser) if ( !SetDisplayMode(wxVideoMode(w, h, bpp)) ) return false; } -#endif // __WXDFB__ +#endif // __WXMGL__ return wxAppConsole::OnCmdLineParsed(parser); } #endif // wxUSE_CMDLINE_PARSER +// ---------------------------------------------------------------------------- +// main event loop implementation +// ---------------------------------------------------------------------------- + +int wxAppBase::MainLoop() +{ + wxEventLoopTiedPtr mainLoop(&m_mainLoop, new wxEventLoop); + + return m_mainLoop->Run(); +} + +void wxAppBase::ExitMainLoop() +{ + // we should exit from the main event loop, not just any currently active + // (e.g. modal dialog) event loop + if ( m_mainLoop && m_mainLoop->IsRunning() ) + { + m_mainLoop->Exit(0); + } +} + +bool wxAppBase::Pending() +{ + // use the currently active message loop here, not m_mainLoop, because if + // we're showing a modal dialog (with its own event loop) currently the + // main event loop is not running anyhow + wxEventLoop * const loop = wxEventLoop::GetActive(); + + return loop && loop->Pending(); +} + +bool wxAppBase::Dispatch() +{ + // see comment in Pending() + wxEventLoop * const loop = wxEventLoop::GetActive(); + + return loop && loop->Dispatch(); +} + // ---------------------------------------------------------------------------- // OnXXX() hooks // ---------------------------------------------------------------------------- @@ -281,7 +368,7 @@ int wxAppBase::OnRun() } //else: it has been changed, assume the user knows what he is doing - return wxAppConsole::OnRun(); + return MainLoop(); } int wxAppBase::OnExit() @@ -293,6 +380,11 @@ int wxAppBase::OnExit() return wxAppConsole::OnExit(); } +void wxAppBase::Exit() +{ + ExitMainLoop(); +} + wxAppTraits *wxAppBase::CreateTraits() { return new wxGUIAppTraits; @@ -315,53 +407,116 @@ void wxAppBase::SetActive(bool active, wxWindow * WXUNUSED(lastFocus)) (void)ProcessEvent(event); } -bool wxAppBase::SafeYield(wxWindow *win, bool onlyIfNeeded) -{ - wxWindowDisabler wd(win); - - wxEventLoopBase * const loop = wxEventLoopBase::GetActive(); - - return loop && loop->Yield(onlyIfNeeded); -} - -bool wxAppBase::SafeYieldFor(wxWindow *win, long eventsToProcess) -{ - wxWindowDisabler wd(win); - - wxEventLoopBase * const loop = wxEventLoopBase::GetActive(); - - return loop && loop->YieldFor(eventsToProcess); -} - - // ---------------------------------------------------------------------------- // idle handling // ---------------------------------------------------------------------------- +void wxAppBase::DeletePendingObjects() +{ + wxList::compatibility_iterator node = wxPendingDelete.GetFirst(); + while (node) + { + wxObject *obj = node->GetData(); + + // remove it from the list first so that if we get back here somehow + // during the object deletion (e.g. wxYield called from its dtor) we + // wouldn't try to delete it the second time + if ( wxPendingDelete.Member(obj) ) + wxPendingDelete.Erase(node); + + delete obj; + + // Deleting one object may have deleted other pending + // objects, so start from beginning of list again. + node = wxPendingDelete.GetFirst(); + } +} + // Returns true if more time is needed. bool wxAppBase::ProcessIdle() { - // call the base class version first to send the idle event to wxTheApp - // itself - bool needMore = wxAppConsoleBase::ProcessIdle(); + // process pending wx events before sending idle events + ProcessPendingEvents(); + wxIdleEvent event; + bool needMore = false; wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst(); while (node) { wxWindow* win = node->GetData(); - - // Don't send idle events to the windows that are about to be destroyed - // anyhow, this is wasteful and unexpected. - if ( !wxPendingDelete.Member(win) && win->SendIdleEvents(event) ) + if (SendIdleEvents(win, event)) needMore = true; node = node->GetNext(); } + event.SetEventObject(this); + (void) ProcessEvent(event); + if (event.MoreRequested()) + needMore = true; + + // 'Garbage' collection of windows deleted with Close(). + DeletePendingObjects(); + +#if wxUSE_LOG + // flush the logged messages if any + wxLog::FlushActive(); +#endif + wxUpdateUIEvent::ResetUpdateTime(); return needMore; } +// Send idle event to window and all subwindows +bool wxAppBase::SendIdleEvents(wxWindow* win, wxIdleEvent& event) +{ + bool needMore = false; + + win->OnInternalIdle(); + + if (wxIdleEvent::CanSend(win)) + { + event.SetEventObject(win); + win->GetEventHandler()->ProcessEvent(event); + + if (event.MoreRequested()) + needMore = true; + } + wxWindowList::compatibility_iterator node = win->GetChildren().GetFirst(); + while ( node ) + { + wxWindow *child = node->GetData(); + if (SendIdleEvents(child, event)) + needMore = true; + + node = node->GetNext(); + } + + return needMore; +} + +void wxAppBase::OnIdle(wxIdleEvent& WXUNUSED(event)) +{ +} + +// ---------------------------------------------------------------------------- +// exceptions support +// ---------------------------------------------------------------------------- + +#if wxUSE_EXCEPTIONS + +bool wxAppBase::OnExceptionInMainLoop() +{ + throw; + + // some compilers are too stupid to know that we never return after throw +#if defined(__DMC__) || (defined(_MSC_VER) && _MSC_VER < 1200) + return false; +#endif +} + +#endif // wxUSE_EXCEPTIONS + // ---------------------------------------------------------------------------- // wxGUIAppTraitsBase // ---------------------------------------------------------------------------- @@ -371,11 +526,7 @@ bool wxAppBase::ProcessIdle() wxLog *wxGUIAppTraitsBase::CreateLogTarget() { #if wxUSE_LOGGUI -#ifndef __WXOSX_IPHONE__ return new wxLogGui; -#else - return new wxLogStderr; -#endif #else // we must have something! return new wxLogStderr; @@ -390,18 +541,15 @@ wxMessageOutput *wxGUIAppTraitsBase::CreateMessageOutput() // is (according to common practice): // - console apps: to stderr (on any platform) // - GUI apps: stderr on Unix platforms (!) - // stderr if available and message box otherwise on others - // (currently stderr only Windows if app running from console) + // message box under Windows and others #ifdef __UNIX__ return new wxMessageOutputStderr; #else // !__UNIX__ // wxMessageOutputMessageBox doesn't work under Motif #ifdef __WXMOTIF__ return new wxMessageOutputLog; - #elif wxUSE_MSGDLG - return new wxMessageOutputBest(wxMSGOUT_PREFER_STDERR); #else - return new wxMessageOutputStderr; + return new wxMessageOutputMessageBox; #endif #endif // __UNIX__/!__UNIX__ } @@ -421,59 +569,77 @@ wxRendererNative *wxGUIAppTraitsBase::CreateRenderer() return NULL; } +#ifdef __WXDEBUG__ + bool wxGUIAppTraitsBase::ShowAssertDialog(const wxString& msg) { -#if wxDEBUG_LEVEL +#if defined(__WXMSW__) || !wxUSE_MSGDLG // under MSW we prefer to use the base class version using ::MessageBox() // even if wxMessageBox() is available because it has less chances to // double fault our app than our wxMessageBox() - // - // under DFB the message dialog is not always functional right now - // - // and finally we can't use wxMessageBox() if it wasn't compiled in, of - // course -#if !defined(__WXMSW__) && !defined(__WXDFB__) && wxUSE_MSGDLG - - // we can't (safely) show the GUI dialog from another thread, only do it - // for the asserts in the main thread - if ( wxIsMainThread() ) - { - wxString msgDlg = msg; + return wxAppTraitsBase::ShowAssertDialog(msg); +#else // wxUSE_MSGDLG + wxString msgDlg = msg; #if wxUSE_STACKWALKER - const wxString stackTrace = GetAssertStackTrace(); - if ( !stackTrace.empty() ) - msgDlg << wxT("\n\nCall stack:\n") << stackTrace; + // on Unix stack frame generation may take some time, depending on the + // size of the executable mainly... warn the user that we are working + wxFprintf(stderr, wxT("[Debug] Generating a stack trace... please wait")); + fflush(stderr); + + const wxString stackTrace = GetAssertStackTrace(); + if ( !stackTrace.empty() ) + msgDlg << _T("\n\nCall stack:\n") << stackTrace; #endif // wxUSE_STACKWALKER - // this message is intentionally not translated -- it is for - // developpers only - msgDlg += wxT("\nDo you want to stop the program?\n") - wxT("You can also choose [Cancel] to suppress ") - wxT("further warnings."); + // this message is intentionally not translated -- it is for + // developpers only + msgDlg += wxT("\nDo you want to stop the program?\n") + wxT("You can also choose [Cancel] to suppress ") + wxT("further warnings."); - switch ( wxMessageBox(msgDlg, wxT("wxWidgets Debug Alert"), - wxYES_NO | wxCANCEL | wxICON_STOP ) ) +#ifdef __WXMAC__ + // in order to avoid reentrancy problems, use the lowest alert API available + CFOptionFlags exitButton; + wxMacCFStringHolder cfText(msgDlg); + OSStatus err = CFUserNotificationDisplayAlert( + 0, kAlertStopAlert, NULL, NULL, NULL, CFSTR("wxWidgets Debug Alert"), cfText, + CFSTR("Yes"), CFSTR("No"), CFSTR("Cancel"), &exitButton ); + if ( err == noErr ) + { + switch( exitButton ) { - case wxYES: + case 0 : // yes wxTrap(); break; - - case wxCANCEL: + case 2 : // cancel // no more asserts return true; - - //case wxNO: nothing to do + case 1 : // no -> nothing to do + break ; } - - return false; } -#endif // wxUSE_MSGDLG -#endif // wxDEBUG_LEVEL +#else + switch ( wxMessageBox(msgDlg, wxT("wxWidgets Debug Alert"), + wxYES_NO | wxCANCEL | wxICON_STOP ) ) + { + case wxYES: + wxTrap(); + break; - return wxAppTraitsBase::ShowAssertDialog(msg); + case wxCANCEL: + // no more asserts + return true; + + //case wxNO: nothing to do + } +#endif + return false; +#endif // !wxUSE_MSGDLG/wxUSE_MSGDLG } +#endif // __WXDEBUG__ + bool wxGUIAppTraitsBase::HasStderr() { // we consider that under Unix stderr always goes somewhere, even if the @@ -485,3 +651,45 @@ bool wxGUIAppTraitsBase::HasStderr() #endif } +void wxGUIAppTraitsBase::ScheduleForDestroy(wxObject *object) +{ + if ( !wxPendingDelete.Member(object) ) + wxPendingDelete.Append(object); +} + +void wxGUIAppTraitsBase::RemoveFromPendingDelete(wxObject *object) +{ + wxPendingDelete.DeleteObject(object); +} + +#if wxUSE_SOCKETS + +#if defined(__WINDOWS__) + #include "wx/msw/gsockmsw.h" +#elif defined(__UNIX__) || defined(__DARWIN__) || defined(__OS2__) + #include "wx/unix/gsockunx.h" +#elif defined(__WXMAC__) + #include + #define OTUNIXERRORS 1 + #include + #include + #include + + #include "wx/mac/gsockmac.h" +#else + #error "Must include correct GSocket header here" +#endif + +GSocketGUIFunctionsTable* wxGUIAppTraitsBase::GetSocketGUIFunctionsTable() +{ +#if defined(__WXMAC__) && !defined(__DARWIN__) + // NB: wxMac CFM does not have any GUI-specific functions in gsocket.c and + // so it doesn't need this table at all + return NULL; +#else // !__WXMAC__ || __DARWIN__ + static GSocketGUIFunctionsTableConcrete table; + return &table; +#endif // !__WXMAC__ || __DARWIN__ +} + +#endif diff --git a/Source/3rd Party/wx/src/common/arcall.cpp b/Source/3rd Party/wx/src/common/arcall.cpp index 6db1c8981..a66ea703d 100644 --- a/Source/3rd Party/wx/src/common/arcall.cpp +++ b/Source/3rd Party/wx/src/common/arcall.cpp @@ -2,7 +2,7 @@ // Name: src/common/arcall.cpp // Purpose: wxArchive link all archive streams // Author: Mike Wetherell -// RCS-ID: $Id$ +// RCS-ID: $Id: arcall.cpp 42508 2006-10-27 09:53:38Z MW $ // Copyright: (c) 2006 Mike Wetherell // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// diff --git a/Source/3rd Party/wx/src/common/arcfind.cpp b/Source/3rd Party/wx/src/common/arcfind.cpp index 028dabf0a..f983993fc 100644 --- a/Source/3rd Party/wx/src/common/arcfind.cpp +++ b/Source/3rd Party/wx/src/common/arcfind.cpp @@ -2,7 +2,7 @@ // Name: src/common/arcfind.cpp // Purpose: Streams for archive formats // Author: Mike Wetherell -// RCS-ID: $Id$ +// RCS-ID: $Id: arcfind.cpp 42508 2006-10-27 09:53:38Z MW $ // Copyright: (c) Mike Wetherell // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -23,7 +23,7 @@ // the archive classes they use. const wxArchiveClassFactory * -wxArchiveClassFactory::Find(const wxString& protocol, wxStreamProtocolType type) +wxArchiveClassFactory::Find(const wxChar *protocol, wxStreamProtocolType type) { for (const wxArchiveClassFactory *f = GetFirst(); f; f = f->GetNext()) if (f->CanHandle(protocol, type)) diff --git a/Source/3rd Party/wx/src/common/archive.cpp b/Source/3rd Party/wx/src/common/archive.cpp index 7b0ec454f..512e3d738 100644 --- a/Source/3rd Party/wx/src/common/archive.cpp +++ b/Source/3rd Party/wx/src/common/archive.cpp @@ -2,7 +2,7 @@ // Name: src/common/archive.cpp // Purpose: Streams for archive formats // Author: Mike Wetherell -// RCS-ID: $Id$ +// RCS-ID: $Id: archive.cpp 42508 2006-10-27 09:53:38Z MW $ // Copyright: (c) Mike Wetherell // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// diff --git a/Source/3rd Party/wx/src/common/arrstr.cpp b/Source/3rd Party/wx/src/common/arrstr.cpp deleted file mode 100644 index 4bfb2af74..000000000 --- a/Source/3rd Party/wx/src/common/arrstr.cpp +++ /dev/null @@ -1,566 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/arrstr.cpp -// Purpose: wxArrayString class -// Author: Vadim Zeitlin -// Modified by: -// Created: 29/01/98 -// RCS-ID: $Id$ -// Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// =========================================================================== -// headers, declarations, constants -// =========================================================================== - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#include "wx/arrstr.h" - -#include "wx/beforestd.h" -#include -#include -#include "wx/afterstd.h" - -// ============================================================================ -// ArrayString -// ============================================================================ - -wxArrayString::wxArrayString(size_t sz, const char** a) -{ -#if !wxUSE_STD_CONTAINERS - Init(false); -#endif - for (size_t i=0; i < sz; i++) - Add(a[i]); -} - -wxArrayString::wxArrayString(size_t sz, const wchar_t** a) -{ -#if !wxUSE_STD_CONTAINERS - Init(false); -#endif - for (size_t i=0; i < sz; i++) - Add(a[i]); -} - -wxArrayString::wxArrayString(size_t sz, const wxString* a) -{ -#if !wxUSE_STD_CONTAINERS - Init(false); -#endif - for (size_t i=0; i < sz; i++) - Add(a[i]); -} - -#if !wxUSE_STD_CONTAINERS - -// size increment = min(50% of current size, ARRAY_MAXSIZE_INCREMENT) -#define ARRAY_MAXSIZE_INCREMENT 4096 - -#ifndef ARRAY_DEFAULT_INITIAL_SIZE // also defined in dynarray.h -#define ARRAY_DEFAULT_INITIAL_SIZE (16) -#endif - -// ctor -void wxArrayString::Init(bool autoSort) -{ - m_nSize = - m_nCount = 0; - m_pItems = NULL; - m_autoSort = autoSort; -} - -// copy ctor -wxArrayString::wxArrayString(const wxArrayString& src) -{ - Init(src.m_autoSort); - - *this = src; -} - -// assignment operator -wxArrayString& wxArrayString::operator=(const wxArrayString& src) -{ - if ( m_nSize > 0 ) - Clear(); - - Copy(src); - - m_autoSort = src.m_autoSort; - - return *this; -} - -void wxArrayString::Copy(const wxArrayString& src) -{ - if ( src.m_nCount > ARRAY_DEFAULT_INITIAL_SIZE ) - Alloc(src.m_nCount); - - for ( size_t n = 0; n < src.m_nCount; n++ ) - Add(src[n]); -} - -// grow the array -void wxArrayString::Grow(size_t nIncrement) -{ - // only do it if no more place - if ( (m_nSize - m_nCount) < nIncrement ) { - // if ARRAY_DEFAULT_INITIAL_SIZE were set to 0, the initially empty would - // be never resized! - #if ARRAY_DEFAULT_INITIAL_SIZE == 0 - #error "ARRAY_DEFAULT_INITIAL_SIZE must be > 0!" - #endif - - if ( m_nSize == 0 ) { - // was empty, alloc some memory - m_nSize = ARRAY_DEFAULT_INITIAL_SIZE; - if (m_nSize < nIncrement) - m_nSize = nIncrement; - m_pItems = new wxString[m_nSize]; - } - else { - // otherwise when it's called for the first time, nIncrement would be 0 - // and the array would never be expanded - // add 50% but not too much - size_t ndefIncrement = m_nSize < ARRAY_DEFAULT_INITIAL_SIZE - ? ARRAY_DEFAULT_INITIAL_SIZE : m_nSize >> 1; - if ( ndefIncrement > ARRAY_MAXSIZE_INCREMENT ) - ndefIncrement = ARRAY_MAXSIZE_INCREMENT; - if ( nIncrement < ndefIncrement ) - nIncrement = ndefIncrement; - m_nSize += nIncrement; - wxString *pNew = new wxString[m_nSize]; - - // copy data to new location - for ( size_t j = 0; j < m_nCount; j++ ) - pNew[j] = m_pItems[j]; - - // delete old memory (but do not release the strings!) - delete [] m_pItems; - - m_pItems = pNew; - } - } -} - -// deletes all the strings from the list -void wxArrayString::Empty() -{ - m_nCount = 0; -} - -// as Empty, but also frees memory -void wxArrayString::Clear() -{ - m_nSize = - m_nCount = 0; - - wxDELETEA(m_pItems); -} - -// dtor -wxArrayString::~wxArrayString() -{ - delete [] m_pItems; -} - -void wxArrayString::reserve(size_t nSize) -{ - Alloc(nSize); -} - -// pre-allocates memory (frees the previous data!) -void wxArrayString::Alloc(size_t nSize) -{ - // only if old buffer was not big enough - if ( nSize > m_nSize ) { - wxString *pNew = new wxString[nSize]; - if ( !pNew ) - return; - - for ( size_t j = 0; j < m_nCount; j++ ) - pNew[j] = m_pItems[j]; - delete [] m_pItems; - - m_pItems = pNew; - m_nSize = nSize; - } -} - -// minimizes the memory usage by freeing unused memory -void wxArrayString::Shrink() -{ - // only do it if we have some memory to free - if( m_nCount < m_nSize ) { - // allocates exactly as much memory as we need - wxString *pNew = new wxString[m_nCount]; - - // copy data to new location - for ( size_t j = 0; j < m_nCount; j++ ) - pNew[j] = m_pItems[j]; - delete [] m_pItems; - m_pItems = pNew; - m_nSize = m_nCount; - } -} - -// searches the array for an item (forward or backwards) -int wxArrayString::Index(const wxString& str, bool bCase, bool bFromEnd) const -{ - if ( m_autoSort ) { - // use binary search in the sorted array - wxASSERT_MSG( bCase && !bFromEnd, - wxT("search parameters ignored for auto sorted array") ); - - size_t i, - lo = 0, - hi = m_nCount; - int res; - while ( lo < hi ) { - i = (lo + hi)/2; - - res = str.compare(m_pItems[i]); - if ( res < 0 ) - hi = i; - else if ( res > 0 ) - lo = i + 1; - else - return i; - } - - return wxNOT_FOUND; - } - else { - // use linear search in unsorted array - if ( bFromEnd ) { - if ( m_nCount > 0 ) { - size_t ui = m_nCount; - do { - if ( m_pItems[--ui].IsSameAs(str, bCase) ) - return ui; - } - while ( ui != 0 ); - } - } - else { - for( size_t ui = 0; ui < m_nCount; ui++ ) { - if( m_pItems[ui].IsSameAs(str, bCase) ) - return ui; - } - } - } - - return wxNOT_FOUND; -} - -// add item at the end -size_t wxArrayString::Add(const wxString& str, size_t nInsert) -{ - if ( m_autoSort ) { - // insert the string at the correct position to keep the array sorted - size_t i, - lo = 0, - hi = m_nCount; - int res; - while ( lo < hi ) { - i = (lo + hi)/2; - - res = str.Cmp(m_pItems[i]); - if ( res < 0 ) - hi = i; - else if ( res > 0 ) - lo = i + 1; - else { - lo = hi = i; - break; - } - } - - wxASSERT_MSG( lo == hi, wxT("binary search broken") ); - - Insert(str, lo, nInsert); - - return (size_t)lo; - } - else { - Grow(nInsert); - - for (size_t i = 0; i < nInsert; i++) - { - // just append - m_pItems[m_nCount + i] = str; - } - size_t ret = m_nCount; - m_nCount += nInsert; - return ret; - } -} - -// add item at the given position -void wxArrayString::Insert(const wxString& str, size_t nIndex, size_t nInsert) -{ - wxCHECK_RET( nIndex <= m_nCount, wxT("bad index in wxArrayString::Insert") ); - wxCHECK_RET( m_nCount <= m_nCount + nInsert, - wxT("array size overflow in wxArrayString::Insert") ); - - Grow(nInsert); - - for (int j = m_nCount - nIndex - 1; j >= 0; j--) - m_pItems[nIndex + nInsert + j] = m_pItems[nIndex + j]; - - for (size_t i = 0; i < nInsert; i++) - { - m_pItems[nIndex + i] = str; - } - m_nCount += nInsert; -} - -// range insert (STL 23.2.4.3) -void -wxArrayString::insert(iterator it, const_iterator first, const_iterator last) -{ - const int idx = it - begin(); - - // grow it once - Grow(last - first); - - // reset "it" since it can change inside Grow() - it = begin() + idx; - - while ( first != last ) - { - it = insert(it, *first); - - // insert returns an iterator to the last element inserted but we need - // insert the next after this one, that is before the next one - ++it; - - ++first; - } -} - -void wxArrayString::resize(size_type n, value_type v) -{ - if ( n < m_nCount ) - m_nCount = n; - else if ( n > m_nCount ) - Add(v, n - m_nCount); -} - -// expand the array -void wxArrayString::SetCount(size_t count) -{ - Alloc(count); - - wxString s; - while ( m_nCount < count ) - m_pItems[m_nCount++] = s; -} - -// removes item from array (by index) -void wxArrayString::RemoveAt(size_t nIndex, size_t nRemove) -{ - wxCHECK_RET( nIndex < m_nCount, wxT("bad index in wxArrayString::Remove") ); - wxCHECK_RET( nIndex + nRemove <= m_nCount, - wxT("removing too many elements in wxArrayString::Remove") ); - - for ( size_t j = 0; j < m_nCount - nIndex -nRemove; j++) - m_pItems[nIndex + j] = m_pItems[nIndex + nRemove + j]; - - m_nCount -= nRemove; -} - -// removes item from array (by value) -void wxArrayString::Remove(const wxString& sz) -{ - int iIndex = Index(sz); - - wxCHECK_RET( iIndex != wxNOT_FOUND, - wxT("removing inexistent element in wxArrayString::Remove") ); - - RemoveAt(iIndex); -} - -// ---------------------------------------------------------------------------- -// sorting -// ---------------------------------------------------------------------------- - -// we need an adaptor as our predicates use qsort() convention and so return -// negative, null or positive value depending on whether the first item is less -// than, equal to or greater than the other one while we need a real boolean -// predicate now that we use std::sort() -struct wxSortPredicateAdaptor -{ - wxSortPredicateAdaptor(wxArrayString::CompareFunction compareFunction) - : m_compareFunction(compareFunction) - { - } - - bool operator()(const wxString& first, const wxString& second) const - { - return (*m_compareFunction)(first, second) < 0; - } - - wxArrayString::CompareFunction m_compareFunction; -}; - -void wxArrayString::Sort(CompareFunction compareFunction) -{ - wxCHECK_RET( !m_autoSort, wxT("can't use this method with sorted arrays") ); - - std::sort(m_pItems, m_pItems + m_nCount, - wxSortPredicateAdaptor(compareFunction)); -} - -struct wxSortPredicateAdaptor2 -{ - wxSortPredicateAdaptor2(wxArrayString::CompareFunction2 compareFunction) - : m_compareFunction(compareFunction) - { - } - - bool operator()(const wxString& first, const wxString& second) const - { - return (*m_compareFunction)(const_cast(&first), - const_cast(&second)) < 0; - } - - wxArrayString::CompareFunction2 m_compareFunction; -}; - -void wxArrayString::Sort(CompareFunction2 compareFunction) -{ - std::sort(m_pItems, m_pItems + m_nCount, - wxSortPredicateAdaptor2(compareFunction)); -} - -void wxArrayString::Sort(bool reverseOrder) -{ - if ( reverseOrder ) - std::sort(m_pItems, m_pItems + m_nCount, std::greater()); - else // normal sort - std::sort(m_pItems, m_pItems + m_nCount); -} - -bool wxArrayString::operator==(const wxArrayString& a) const -{ - if ( m_nCount != a.m_nCount ) - return false; - - for ( size_t n = 0; n < m_nCount; n++ ) - { - if ( Item(n) != a[n] ) - return false; - } - - return true; -} - -#endif // !wxUSE_STD_CONTAINERS - -// =========================================================================== -// wxJoin and wxSplit -// =========================================================================== - -#include "wx/tokenzr.h" - -wxString wxJoin(const wxArrayString& arr, const wxChar sep, const wxChar escape) -{ - size_t count = arr.size(); - if ( count == 0 ) - return wxEmptyString; - - wxString str; - - // pre-allocate memory using the estimation of the average length of the - // strings in the given array: this is very imprecise, of course, but - // better than nothing - str.reserve(count*(arr[0].length() + arr[count-1].length()) / 2); - - if ( escape == wxT('\0') ) - { - // escaping is disabled: - for ( size_t i = 0; i < count; i++ ) - { - if ( i ) - str += sep; - str += arr[i]; - } - } - else // use escape character - { - for ( size_t n = 0; n < count; n++ ) - { - if ( n ) - str += sep; - - for ( wxString::const_iterator i = arr[n].begin(), - end = arr[n].end(); - i != end; - ++i ) - { - const wxChar ch = *i; - if ( ch == sep ) - str += escape; // escape this separator - str += ch; - } - } - } - - str.Shrink(); // release extra memory if we allocated too much - return str; -} - -wxArrayString wxSplit(const wxString& str, const wxChar sep, const wxChar escape) -{ - if ( escape == wxT('\0') ) - { - // simple case: we don't need to honour the escape character - return wxStringTokenize(str, sep, wxTOKEN_RET_EMPTY_ALL); - } - - wxArrayString ret; - wxString curr; - wxChar prev = wxT('\0'); - - for ( wxString::const_iterator i = str.begin(), - end = str.end(); - i != end; - ++i ) - { - const wxChar ch = *i; - - if ( ch == sep ) - { - if ( prev == escape ) - { - // remove the escape character and don't consider this - // occurrence of 'sep' as a real separator - *curr.rbegin() = sep; - } - else // real separator - { - ret.push_back(curr); - curr.clear(); - } - } - else // normal character - { - curr += ch; - } - - prev = ch; - } - - // add the last token - if ( !curr.empty() || prev == sep ) - ret.Add(curr); - - return ret; -} diff --git a/Source/3rd Party/wx/src/common/artprov.cpp b/Source/3rd Party/wx/src/common/artprov.cpp index 479295c25..15a6415cd 100644 --- a/Source/3rd Party/wx/src/common/artprov.cpp +++ b/Source/3rd Party/wx/src/common/artprov.cpp @@ -4,7 +4,7 @@ // Author: Vaclav Slavik // Modified by: // Created: 18/03/2002 -// RCS-ID: $Id$ +// RCS-ID: $Id: artprov.cpp 57701 2008-12-31 23:40:06Z VS $ // Copyright: (c) Vaclav Slavik // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -30,6 +30,10 @@ #include "wx/module.h" #endif +#ifdef __WXMSW__ + #include "wx/msw/wrapwin.h" +#endif + // =========================================================================== // implementation // =========================================================================== @@ -43,7 +47,6 @@ WX_DEFINE_LIST(wxArtProvidersList) // ---------------------------------------------------------------------------- WX_DECLARE_EXPORTED_STRING_HASH_MAP(wxBitmap, wxArtProviderBitmapsHash); -WX_DECLARE_EXPORTED_STRING_HASH_MAP(wxIconBundle, wxArtProviderIconBundlesHash); class WXDLLEXPORT wxArtProviderCache { @@ -52,22 +55,14 @@ public: void PutBitmap(const wxString& full_id, const wxBitmap& bmp) { m_bitmapsHash[full_id] = bmp; } - bool GetIconBundle(const wxString& full_id, wxIconBundle* bmp); - void PutIconBundle(const wxString& full_id, const wxIconBundle& iconbundle) - { m_iconBundlesHash[full_id] = iconbundle; } - void Clear(); static wxString ConstructHashID(const wxArtID& id, const wxArtClient& client, const wxSize& size); - static wxString ConstructHashID(const wxArtID& id, - const wxArtClient& client); - private: - wxArtProviderBitmapsHash m_bitmapsHash; // cache of wxBitmaps - wxArtProviderIconBundlesHash m_iconBundlesHash; // cache of wxIconBundles + wxArtProviderBitmapsHash m_bitmapsHash; }; bool wxArtProviderCache::GetBitmap(const wxString& full_id, wxBitmap* bmp) @@ -84,43 +79,21 @@ bool wxArtProviderCache::GetBitmap(const wxString& full_id, wxBitmap* bmp) } } -bool wxArtProviderCache::GetIconBundle(const wxString& full_id, wxIconBundle* bmp) -{ - wxArtProviderIconBundlesHash::iterator entry = m_iconBundlesHash.find(full_id); - if ( entry == m_iconBundlesHash.end() ) - { - return false; - } - else - { - *bmp = entry->second; - return true; - } -} - void wxArtProviderCache::Clear() { m_bitmapsHash.clear(); - m_iconBundlesHash.clear(); } -/* static */ wxString -wxArtProviderCache::ConstructHashID(const wxArtID& id, - const wxArtClient& client) +/*static*/ wxString wxArtProviderCache::ConstructHashID( + const wxArtID& id, const wxArtClient& client, + const wxSize& size) { - return id + wxT('-') + client; + wxString str; + str.Printf(wxT("%s-%s-%i-%i"), id.c_str(), client.c_str(), size.x, size.y); + return str; } -/* static */ wxString -wxArtProviderCache::ConstructHashID(const wxArtID& id, - const wxArtClient& client, - const wxSize& size) -{ - return ConstructHashID(id, client) + wxT('-') + - wxString::Format(wxT("%d-%d"), size.x, size.y); -} - // ============================================================================ // wxArtProvider class // ============================================================================ @@ -160,16 +133,21 @@ wxArtProvider::~wxArtProvider() sm_providers->Insert(provider); } -/*static*/ void wxArtProvider::PushBack(wxArtProvider *provider) +/*static*/ void wxArtProvider::Insert(wxArtProvider *provider) { CommonAddingProvider(); sm_providers->Append(provider); } +/*static*/ void wxArtProvider::PushBack(wxArtProvider *provider) +{ + Insert(provider); +} + /*static*/ bool wxArtProvider::Pop() { - wxCHECK_MSG( sm_providers, false, wxT("no wxArtProvider exists") ); - wxCHECK_MSG( !sm_providers->empty(), false, wxT("wxArtProviders stack is empty") ); + wxCHECK_MSG( sm_providers, false, _T("no wxArtProvider exists") ); + wxCHECK_MSG( !sm_providers->empty(), false, _T("wxArtProviders stack is empty") ); delete sm_providers->GetFirst()->GetData(); sm_cache->Clear(); @@ -178,7 +156,7 @@ wxArtProvider::~wxArtProvider() /*static*/ bool wxArtProvider::Remove(wxArtProvider *provider) { - wxCHECK_MSG( sm_providers, false, wxT("no wxArtProvider exists") ); + wxCHECK_MSG( sm_providers, false, _T("no wxArtProvider exists") ); if ( sm_providers->DeleteObject(provider) ) { @@ -204,8 +182,11 @@ wxArtProvider::~wxArtProvider() while ( !sm_providers->empty() ) delete *sm_providers->begin(); - wxDELETE(sm_providers); - wxDELETE(sm_cache); + delete sm_providers; + sm_providers = NULL; + + delete sm_cache; + sm_cache = NULL; } } @@ -218,9 +199,9 @@ wxArtProvider::~wxArtProvider() const wxSize& size) { // safety-check against writing client,id,size instead of id,client,size: - wxASSERT_MSG( client.Last() == wxT('C'), wxT("invalid 'client' parameter") ); + wxASSERT_MSG( client.Last() == _T('C'), _T("invalid 'client' parameter") ); - wxCHECK_MSG( sm_providers, wxNullBitmap, wxT("no wxArtProvider exists") ); + wxCHECK_MSG( sm_providers, wxNullBitmap, _T("no wxArtProvider exists") ); wxString hashId = wxArtProviderCache::ConstructHashID(id, client, size); @@ -231,43 +212,20 @@ wxArtProvider::~wxArtProvider() node; node = node->GetNext()) { bmp = node->GetData()->CreateBitmap(id, client, size); - if ( bmp.IsOk() ) - break; - } - - wxSize sizeNeeded = size; - if ( !bmp.IsOk() ) - { - // no bitmap created -- as a fallback, try if we can find desired - // icon in a bundle - wxIconBundle iconBundle = DoGetIconBundle(id, client); - if ( iconBundle.IsOk() ) + if ( bmp.Ok() ) { - if ( sizeNeeded == wxDefaultSize ) - sizeNeeded = GetNativeSizeHint(client); - - wxIcon icon(iconBundle.GetIcon(sizeNeeded)); - if ( icon.IsOk() ) - { - // this icon may be not of the correct size, it will be - // rescaled below in such case - bmp.CopyFromIcon(icon); - } - } - } - - // if we didn't get the correct size, resize the bitmap #if wxUSE_IMAGE && (!defined(__WXMSW__) || wxUSE_WXDIB) - if ( bmp.IsOk() && sizeNeeded != wxDefaultSize ) - { - if ( bmp.GetSize() != sizeNeeded ) - { - wxImage img = bmp.ConvertToImage(); - img.Rescale(sizeNeeded.x, sizeNeeded.y); - bmp = wxBitmap(img); + if ( size != wxDefaultSize && + (bmp.GetWidth() != size.x || bmp.GetHeight() != size.y) ) + { + wxImage img = bmp.ConvertToImage(); + img.Rescale(size.x, size.y); + bmp = wxBitmap(img); + } +#endif + break; } } -#endif // wxUSE_IMAGE sm_cache->PutBitmap(hashId, bmp); } @@ -275,56 +233,14 @@ wxArtProvider::~wxArtProvider() return bmp; } -/*static*/ -wxIconBundle wxArtProvider::GetIconBundle(const wxArtID& id, const wxArtClient& client) -{ - wxIconBundle iconbundle(DoGetIconBundle(id, client)); - - if ( iconbundle.IsOk() ) - { - return iconbundle; - } - else - { - // fall back to single-icon bundle - return wxIconBundle(GetIcon(id, client)); - } -} - -/*static*/ -wxIconBundle wxArtProvider::DoGetIconBundle(const wxArtID& id, const wxArtClient& client) -{ - // safety-check against writing client,id,size instead of id,client,size: - wxASSERT_MSG( client.Last() == wxT('C'), wxT("invalid 'client' parameter") ); - - wxCHECK_MSG( sm_providers, wxNullIconBundle, wxT("no wxArtProvider exists") ); - - wxString hashId = wxArtProviderCache::ConstructHashID(id, client); - - wxIconBundle iconbundle; - if ( !sm_cache->GetIconBundle(hashId, &iconbundle) ) - { - for (wxArtProvidersList::compatibility_iterator node = sm_providers->GetFirst(); - node; node = node->GetNext()) - { - iconbundle = node->GetData()->CreateIconBundle(id, client); - if ( iconbundle.IsOk() ) - break; - } - - sm_cache->PutIconBundle(hashId, iconbundle); - } - - return iconbundle; -} - /*static*/ wxIcon wxArtProvider::GetIcon(const wxArtID& id, const wxArtClient& client, const wxSize& size) { - wxBitmap bmp = GetBitmap(id, client, size); + wxCHECK_MSG( sm_providers, wxNullIcon, _T("no wxArtProvider exists") ); - if ( !bmp.IsOk() ) + wxBitmap bmp = GetBitmap(id, client, size); + if ( !bmp.Ok() ) return wxNullIcon; wxIcon icon; @@ -332,28 +248,10 @@ wxIconBundle wxArtProvider::DoGetIconBundle(const wxArtID& id, const wxArtClient return icon; } -/* static */ -wxArtID wxArtProvider::GetMessageBoxIconId(int flags) -{ - switch ( flags & wxICON_MASK ) - { - default: - wxFAIL_MSG(wxT("incorrect message box icon flags")); - // fall through - - case wxICON_ERROR: - return wxART_ERROR; - - case wxICON_INFORMATION: - return wxART_INFORMATION; - - case wxICON_WARNING: - return wxART_WARNING; - - case wxICON_QUESTION: - return wxART_QUESTION; - } -} +#if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__) + #include "wx/gtk/private.h" + extern GtkIconSize wxArtClientToIconSize(const wxArtClient& client); +#endif // defined(__WXGTK20__) && !defined(__WXUNIVERSAL__) /*static*/ wxSize wxArtProvider::GetSizeHint(const wxArtClient& client, bool platform_dependent) @@ -365,33 +263,41 @@ wxArtID wxArtProvider::GetMessageBoxIconId(int flags) return node->GetData()->DoGetSizeHint(client); } - return GetNativeSizeHint(client); -} + // else return platform dependent size -#ifndef wxHAS_NATIVE_ART_PROVIDER_IMPL -/*static*/ -wxSize wxArtProvider::GetNativeSizeHint(const wxArtClient& WXUNUSED(client)) -{ - // rather than returning some arbitrary value that doesn't make much - // sense (as 2.8 used to do), tell the caller that we don't have a clue: - return wxDefaultSize; -} - -/*static*/ -void wxArtProvider::InitNativeProvider() -{ -} -#endif // !wxHAS_NATIVE_ART_PROVIDER_IMPL - - -/* static */ -bool wxArtProvider::HasNativeProvider() -{ -#ifdef __WXGTK20__ - return true; +#if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__) + // Gtk has specific sizes for each client, see artgtk.cpp + GtkIconSize gtk_size = wxArtClientToIconSize(client); + // no size hints for this client + if (gtk_size == GTK_ICON_SIZE_INVALID) + return wxDefaultSize; + gint width, height; + gtk_icon_size_lookup( gtk_size, &width, &height); + return wxSize(width, height); +#else // !GTK+ 2 + // NB: These size hints may have to be adjusted per platform + if (client == wxART_TOOLBAR) + return wxSize(16, 15); + else if (client == wxART_MENU) + return wxSize(16, 15); + else if (client == wxART_FRAME_ICON) + { +#ifdef __WXMSW__ + return wxSize(::GetSystemMetrics(SM_CXSMICON), + ::GetSystemMetrics(SM_CYSMICON)); #else - return false; -#endif + return wxSize(16, 16); +#endif // __WXMSW__/!__WXMSW__ + } + else if (client == wxART_CMN_DIALOG || client == wxART_MESSAGE_BOX) + return wxSize(32, 32); + else if (client == wxART_HELP_BROWSER) + return wxSize(16, 15); + else if (client == wxART_BUTTON) + return wxSize(16, 15); + else // wxART_OTHER or perhaps a user's client, no specified size + return wxDefaultSize; +#endif // GTK+ 2/else } // ---------------------------------------------------------------------------- @@ -407,7 +313,7 @@ bool wxArtProvider::HasNativeProvider() /* static */ void wxArtProvider::InsertProvider(wxArtProvider *provider) { - PushBack(provider); + Insert(provider); } /* static */ bool wxArtProvider::PopProvider() @@ -424,13 +330,6 @@ bool wxArtProvider::HasNativeProvider() #endif // WXWIN_COMPATIBILITY_2_6 -#if WXWIN_COMPATIBILITY_2_8 -/* static */ void wxArtProvider::Insert(wxArtProvider *provider) -{ - PushBack(provider); -} -#endif // WXWIN_COMPATIBILITY_2_8 - // ============================================================================ // wxArtProviderModule // ============================================================================ @@ -440,16 +339,8 @@ class wxArtProviderModule: public wxModule public: bool OnInit() { - // The order here is such that the native provider will be used first - // and the standard one last as all these default providers add - // themselves to the bottom of the stack. - wxArtProvider::InitNativeProvider(); -#if wxUSE_ARTPROVIDER_TANGO - wxArtProvider::InitTangoProvider(); -#endif // wxUSE_ARTPROVIDER_TANGO -#if wxUSE_ARTPROVIDER_STD wxArtProvider::InitStdProvider(); -#endif // wxUSE_ARTPROVIDER_STD + wxArtProvider::InitNativeProvider(); return true; } void OnExit() diff --git a/Source/3rd Party/wx/src/common/artstd.cpp b/Source/3rd Party/wx/src/common/artstd.cpp index c3e13be5d..6075ae8f2 100644 --- a/Source/3rd Party/wx/src/common/artstd.cpp +++ b/Source/3rd Party/wx/src/common/artstd.cpp @@ -4,7 +4,7 @@ // Author: Vaclav Slavik // Modified by: // Created: 18/03/2002 -// RCS-ID: $Id$ +// RCS-ID: $Id: artstd.cpp 52561 2008-03-16 00:36:37Z VS $ // Copyright: (c) Vaclav Slavik // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -20,8 +20,6 @@ #pragma hdrstop #endif -#if wxUSE_ARTPROVIDER_STD - #ifndef WX_PRECOMP #include "wx/image.h" #endif @@ -39,15 +37,6 @@ protected: const wxSize& size); }; -// ---------------------------------------------------------------------------- -// wxArtProvider::InitStdProvider -// ---------------------------------------------------------------------------- - -/*static*/ void wxArtProvider::InitStdProvider() -{ - wxArtProvider::PushBack(new wxDefaultArtProvider); -} - // ---------------------------------------------------------------------------- // helper macros // ---------------------------------------------------------------------------- @@ -56,23 +45,61 @@ protected: #define ART(artId, xpmRc) \ if ( id == artId ) return wxBitmap(xpmRc##_xpm); +// There are two ways of getting the standard icon: either via XPMs or via +// wxIcon ctor. This depends on the platform: +#if defined(__WXUNIVERSAL__) + #define CREATE_STD_ICON(iconId, xpmRc) return wxNullBitmap; +#elif defined(__WXGTK__) || defined(__WXMOTIF__) + #define CREATE_STD_ICON(iconId, xpmRc) return wxBitmap(xpmRc##_xpm); +#else + #define CREATE_STD_ICON(iconId, xpmRc) \ + { \ + wxIcon icon(_T(iconId)); \ + wxBitmap bmp; \ + bmp.CopyFromIcon(icon); \ + return bmp; \ + } +#endif + +// Macro used in CreateBitmap to get wxICON_FOO icons: +#define ART_MSGBOX(artId, iconId, xpmRc) \ + if ( id == artId ) \ + { \ + CREATE_STD_ICON(#iconId, xpmRc) \ + } + +// ---------------------------------------------------------------------------- +// wxArtProvider::InitStdProvider +// ---------------------------------------------------------------------------- + +/*static*/ void wxArtProvider::InitStdProvider() +{ + wxArtProvider::Push(new wxDefaultArtProvider); +} + +#if !defined(__WXGTK20__) || defined(__WXUNIVERSAL__) +/*static*/ void wxArtProvider::InitNativeProvider() +{ +} +#endif + + // ---------------------------------------------------------------------------- // XPMs with the art // ---------------------------------------------------------------------------- -#ifndef __WXUNIVERSAL__ - #if defined(__WXGTK__) - #include "../../art/gtk/info.xpm" - #include "../../art/gtk/error.xpm" - #include "../../art/gtk/warning.xpm" - #include "../../art/gtk/question.xpm" - #elif defined(__WXMOTIF__) - #include "../../art/motif/info.xpm" - #include "../../art/motif/error.xpm" - #include "../../art/motif/warning.xpm" - #include "../../art/motif/question.xpm" - #endif -#endif // !__WXUNIVERSAL__ + +#if defined(__WXGTK__) + #include "../../art/gtk/info.xpm" + #include "../../art/gtk/error.xpm" + #include "../../art/gtk/warning.xpm" + #include "../../art/gtk/question.xpm" +#elif defined(__WXMOTIF__) + #include "../../art/motif/info.xpm" + #include "../../art/motif/error.xpm" + #include "../../art/motif/warning.xpm" + #include "../../art/motif/question.xpm" +#endif #if wxUSE_HTML #include "../../art/htmsidep.xpm" @@ -95,8 +122,6 @@ protected: #include "../../art/helpicon.xpm" #include "../../art/tipicon.xpm" #include "../../art/home.xpm" -#include "../../art/first.xpm" -#include "../../art/last.xpm" #include "../../art/repview.xpm" #include "../../art/listview.xpm" #include "../../art/new_dir.xpm" @@ -121,22 +146,19 @@ protected: #include "../../art/new.xpm" #include "../../art/undo.xpm" #include "../../art/redo.xpm" -#include "../../art/plus.xpm" -#include "../../art/minus.xpm" -#include "../../art/close.xpm" #include "../../art/quit.xpm" #include "../../art/find.xpm" #include "../../art/findrepl.xpm" + + wxBitmap wxDefaultArtProvider_CreateBitmap(const wxArtID& id) { -#if !defined(__WXUNIVERSAL__) && (defined(__WXGTK__) || defined(__WXMOTIF__)) // wxMessageBox icons: - ART(wxART_ERROR, error) - ART(wxART_INFORMATION, info) - ART(wxART_WARNING, warning) - ART(wxART_QUESTION, question) -#endif + ART_MSGBOX(wxART_ERROR, wxICON_ERROR, error) + ART_MSGBOX(wxART_INFORMATION, wxICON_INFORMATION, info) + ART_MSGBOX(wxART_WARNING, wxICON_WARNING, warning) + ART_MSGBOX(wxART_QUESTION, wxICON_QUESTION, question) // standard icons: #if wxUSE_HTML @@ -155,8 +177,6 @@ wxBitmap wxDefaultArtProvider_CreateBitmap(const wxArtID& id) ART(wxART_GO_DOWN, down) ART(wxART_GO_TO_PARENT, toparent) ART(wxART_GO_HOME, home) - ART(wxART_GOTO_FIRST, first) - ART(wxART_GOTO_LAST, last) ART(wxART_FILE_OPEN, fileopen) ART(wxART_PRINT, print) ART(wxART_HELP, helpicon) @@ -184,9 +204,6 @@ wxBitmap wxDefaultArtProvider_CreateBitmap(const wxArtID& id) ART(wxART_DELETE, delete) ART(wxART_UNDO, undo) ART(wxART_REDO, redo) - ART(wxART_PLUS, plus) - ART(wxART_MINUS, minus) - ART(wxART_CLOSE, close) ART(wxART_QUIT, quit) ART(wxART_FIND, find) ART(wxART_FIND_AND_REPLACE, findrepl) @@ -207,7 +224,7 @@ wxBitmap wxDefaultArtProvider::CreateBitmap(const wxArtID& id, wxBitmap bmp = wxDefaultArtProvider_CreateBitmap(id); #if wxUSE_IMAGE && (!defined(__WXMSW__) || wxUSE_WXDIB) - if (bmp.IsOk()) + if (bmp.Ok()) { // fit into transparent image with desired size hint from the client if (reqSize == wxDefaultSize) @@ -219,14 +236,9 @@ wxBitmap wxDefaultArtProvider::CreateBitmap(const wxArtID& id, int bmp_w = bmp.GetWidth(); int bmp_h = bmp.GetHeight(); - if (bmp_w == 16 && bmp_h == 15 && bestSize == wxSize(16, 16)) + if ((bmp_h < bestSize.x) && (bmp_w < bestSize.y)) { - // Do nothing in this special but quite common case, because scaling - // with only a pixel difference will look horrible. - } - else if ((bmp_h < bestSize.x) && (bmp_w < bestSize.y)) - { - // the caller wants default size, which is larger than + // the caller wants default size, which is larger than // the image we have; to avoid degrading it visually by // scaling it up, paste it into transparent image instead: wxPoint offset((bestSize.x - bmp_w)/2, (bestSize.y - bmp_h)/2); @@ -253,5 +265,3 @@ wxBitmap wxDefaultArtProvider::CreateBitmap(const wxArtID& id, return bmp; } - -#endif // wxUSE_ARTPROVIDER_STD diff --git a/Source/3rd Party/wx/src/common/arttango.cpp b/Source/3rd Party/wx/src/common/arttango.cpp deleted file mode 100644 index 106c0835b..000000000 --- a/Source/3rd Party/wx/src/common/arttango.cpp +++ /dev/null @@ -1,328 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/common/arttango.cpp -// Purpose: art provider using embedded PNG versions of Tango icons -// Author: Vadim Zeitlin -// Created: 2010-12-27 -// RCS-ID: $Id: wxhead.cpp,v 1.11 2010-04-22 12:44:51 zeitlin Exp $ -// Copyright: (c) 2010 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// for compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_ARTPROVIDER_TANGO - -#ifndef WX_PRECOMP - #include "wx/image.h" - #include "wx/log.h" -#endif // WX_PRECOMP - -#include "wx/artprov.h" - -#include "wx/mstream.h" - -// ---------------------------------------------------------------------------- -// image data -// ---------------------------------------------------------------------------- - -// All files in art/tango in alphabetical order: -#include "../../art/tango/application_x_executable.h" -#include "../../art/tango/dialog_error.h" -#include "../../art/tango/dialog_information.h" -#include "../../art/tango/dialog_warning.h" -#include "../../art/tango/document_new.h" -#include "../../art/tango/document_open.h" -#include "../../art/tango/document_print.h" -#include "../../art/tango/document_save.h" -#include "../../art/tango/document_save_as.h" -#include "../../art/tango/drive_harddisk.h" -#include "../../art/tango/drive_optical.h" -#include "../../art/tango/drive_removable_media.h" -#include "../../art/tango/edit_copy.h" -#include "../../art/tango/edit_cut.h" -#include "../../art/tango/edit_delete.h" -#include "../../art/tango/edit_find.h" -#include "../../art/tango/edit_find_replace.h" -#include "../../art/tango/edit_paste.h" -#include "../../art/tango/edit_redo.h" -#include "../../art/tango/edit_undo.h" -#include "../../art/tango/folder.h" -#include "../../art/tango/folder_new.h" -#include "../../art/tango/folder_open.h" -#include "../../art/tango/go_down.h" -#include "../../art/tango/go_first.h" -#include "../../art/tango/go_home.h" -#include "../../art/tango/go_last.h" -#include "../../art/tango/go_next.h" -#include "../../art/tango/go_previous.h" -#include "../../art/tango/go_up.h" -#include "../../art/tango/image_missing.h" -#include "../../art/tango/text_x_generic.h" -#include "../../art/tango/list_add.h" -#include "../../art/tango/list_remove.h" - -// ---------------------------------------------------------------------------- -// art provider class -// ---------------------------------------------------------------------------- - -namespace -{ - -class wxTangoArtProvider : public wxArtProvider -{ -public: - wxTangoArtProvider() - { - m_imageHandledAdded = false; - } - -protected: - virtual wxBitmap CreateBitmap(const wxArtID& id, - const wxArtClient& client, - const wxSize& size); - -private: - bool m_imageHandledAdded; - - wxDECLARE_NO_COPY_CLASS(wxTangoArtProvider); -}; - -} // anonymous namespace - -// ============================================================================ -// implementation -// ============================================================================ - -wxBitmap -wxTangoArtProvider::CreateBitmap(const wxArtID& id, - const wxArtClient& client, - const wxSize& sizeHint) -{ - // Array indexed by the id names with pointers to image data in 16 and 32 - // pixel sizes as values. The order of the elements in this array is the - // same as the definition order in wx/artprov.h. While it's not very - // logical, this should make it simpler to add new icons later. Notice that - // most elements without Tango equivalents are simply omitted. - - // To avoid repetition use BITMAP_DATA to only specify the image name once - // (this is especially important if we decide to add more image sizes - // later). - #define BITMAP_ARRAY_NAME(name, size) \ - name ## _ ## size ## x ## size ## _png - #define BITMAP_DATA_FOR_SIZE(name, size) \ - BITMAP_ARRAY_NAME(name, size), sizeof(BITMAP_ARRAY_NAME(name, size)) - #define BITMAP_DATA(name) \ - BITMAP_DATA_FOR_SIZE(name, 16), BITMAP_DATA_FOR_SIZE(name, 24) - - static const struct BitmapEntry - { - const char *id; - const unsigned char *data16; - size_t len16; - const unsigned char *data24; - size_t len24; - } s_allBitmaps[] = - { - // Tango does have bookmark-new but no matching bookmark-delete and - // using mismatching icons would be ugly so we don't provide this one - // neither, we should add both of them if Tango ever adds the other one. - //{ wxART_ADD_BOOKMARK, BITMAP_DATA(bookmark_new)}, - //{ wxART_DEL_BOOKMARK, BITMAP_DATA() }, - - { wxART_GO_BACK, BITMAP_DATA(go_previous) }, - { wxART_GO_FORWARD, BITMAP_DATA(go_next) }, - { wxART_GO_UP, BITMAP_DATA(go_up) }, - { wxART_GO_DOWN, BITMAP_DATA(go_down) }, - // wxART_GO_TO_PARENT doesn't seem to exist in Tango - { wxART_GO_HOME, BITMAP_DATA(go_home) }, - { wxART_GOTO_FIRST, BITMAP_DATA(go_first) }, - { wxART_GOTO_LAST, BITMAP_DATA(go_last) }, - - { wxART_FILE_OPEN, BITMAP_DATA(document_open) }, - { wxART_FILE_SAVE, BITMAP_DATA(document_save) }, - { wxART_FILE_SAVE_AS, BITMAP_DATA(document_save_as) }, - { wxART_PRINT, BITMAP_DATA(document_print) }, - - // Should we use help-browser for wxART_HELP? - - { wxART_NEW_DIR, BITMAP_DATA(folder_new) }, - { wxART_HARDDISK, BITMAP_DATA(drive_harddisk) }, - // drive-removable-media seems to be better than media-floppy - { wxART_FLOPPY, BITMAP_DATA(drive_removable_media) }, - { wxART_CDROM, BITMAP_DATA(drive_optical) }, - { wxART_REMOVABLE, BITMAP_DATA(drive_removable_media) }, - - { wxART_FOLDER, BITMAP_DATA(folder) }, - { wxART_FOLDER_OPEN, BITMAP_DATA(folder_open) }, - // wxART_GO_DIR_UP doesn't seem to exist in Tango - - { wxART_EXECUTABLE_FILE, BITMAP_DATA(application_x_executable) }, - { wxART_NORMAL_FILE, BITMAP_DATA(text_x_generic) }, - - // There is no dialog-question in Tango so use the information icon - // too, this is better for consistency and we do have a precedent for - // doing this as Windows Vista/7 does the same thing natively. - { wxART_ERROR, BITMAP_DATA(dialog_error) }, - { wxART_QUESTION, BITMAP_DATA(dialog_information) }, - { wxART_WARNING, BITMAP_DATA(dialog_warning) }, - { wxART_INFORMATION, BITMAP_DATA(dialog_information) }, - - { wxART_MISSING_IMAGE, BITMAP_DATA(image_missing) }, - - { wxART_COPY, BITMAP_DATA(edit_copy) }, - { wxART_CUT, BITMAP_DATA(edit_cut) }, - { wxART_PASTE, BITMAP_DATA(edit_paste) }, - { wxART_DELETE, BITMAP_DATA(edit_delete) }, - { wxART_NEW, BITMAP_DATA(document_new) }, - { wxART_UNDO, BITMAP_DATA(edit_undo) }, - { wxART_REDO, BITMAP_DATA(edit_redo) }, - - { wxART_PLUS, BITMAP_DATA(list_add) }, - { wxART_MINUS, BITMAP_DATA(list_remove) }, - - // Surprisingly Tango doesn't seem to have neither wxART_CLOSE nor - // wxART_QUIT. We could use system-log-out for the latter but it - // doesn't seem quite right. - - { wxART_FIND, BITMAP_DATA(edit_find) }, - { wxART_FIND_AND_REPLACE, BITMAP_DATA(edit_find_replace) }, - }; - - #undef BITMAP_ARRAY_NAME - #undef BITMAP_DATA_FOR_SIZE - #undef BITMAP_DATA - - for ( unsigned n = 0; n < WXSIZEOF(s_allBitmaps); n++ ) - { - const BitmapEntry& entry = s_allBitmaps[n]; - if ( entry.id != id ) - continue; - - // This is one of the bitmaps that we have, determine in which size we - // should return it. - - wxSize size; - bool sizeIsAHint; - if ( sizeHint == wxDefaultSize ) - { - // Use the normal platform-specific icon size. - size = GetNativeSizeHint(client); - - if ( size == wxDefaultSize ) - { - // If we failed to get it, determine the best size more or less - // arbitrarily. This definitely won't look good but then it - // shouldn't normally happen, all platforms should implement - // GetNativeSizeHint() properly. - if ( client == wxART_MENU || client == wxART_BUTTON ) - size = wxSize(16, 16); - else - size = wxSize(24, 24); - } - - // We should return the icon of exactly this size so it's more than - // just a hint. - sizeIsAHint = false; - } - else // We have a size hint - { - // Use it for determining the version of the icon to return. - size = sizeHint; - - // But we don't need to return the image of exactly the same size - // as the hint, after all it's just that, a hint. - sizeIsAHint = true; - } - - enum - { - TangoSize_16, - TangoSize_24 - } tangoSize; - - // We prefer to downscale the image rather than upscale it if possible - // so use the smaller one if we can, otherwise the large one. - if ( size.x <= 16 && size.y <= 16 ) - tangoSize = TangoSize_16; - else - tangoSize = TangoSize_24; - - const unsigned char *data; - size_t len; - switch ( tangoSize ) - { - default: - wxFAIL_MSG( "Unsupported Tango bitmap size" ); - // fall through - - case TangoSize_16: - data = entry.data16; - len = entry.len16; - break; - - case TangoSize_24: - data = entry.data24; - len = entry.len24; - break; - } - - wxMemoryInputStream is(data, len); - - // Before reading the image data from the stream for the first time, - // add the handler for PNG images: we do it here and not in, say, - // InitTangoProvider() to do it as lately as possible and so to avoid - // the asserts about adding an already added handler if the user code - // adds the handler itself. - if ( !m_imageHandledAdded ) - { - // Of course, if the user code did add it already, we have nothing - // to do. - if ( !wxImage::FindHandler(wxBITMAP_TYPE_PNG) ) - wxImage::AddHandler(new wxPNGHandler); - - // In any case, no need to do it again. - m_imageHandledAdded = true; - } - - wxImage image(is, wxBITMAP_TYPE_PNG); - if ( !image.IsOk() ) - { - // This should normally never happen as all the embedded images are - // well-formed. - wxLogDebug("Failed to load embedded PNG image for \"%s\"", id); - return wxNullBitmap; - } - - if ( !sizeIsAHint ) - { - // Notice that this won't do anything if the size is already right. - image.Rescale(size.x, size.y, wxIMAGE_QUALITY_HIGH); - } - - return image; - } - - // Not one of the bitmaps that we support. - return wxNullBitmap; -} - -/* static */ -void wxArtProvider::InitTangoProvider() -{ - wxArtProvider::PushBack(new wxTangoArtProvider); -} - -#endif // wxUSE_ARTPROVIDER_TANGO diff --git a/Source/3rd Party/wx/src/common/base64.cpp b/Source/3rd Party/wx/src/common/base64.cpp deleted file mode 100644 index ead24c7e3..000000000 --- a/Source/3rd Party/wx/src/common/base64.cpp +++ /dev/null @@ -1,241 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/common/base64.cpp -// Purpose: implementation of BASE64 encoding/decoding functions -// Author: Charles Reimers, Vadim Zeitlin -// Created: 2007-06-18 -// RCS-ID: $Id$ -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_BASE64 - -#include "wx/base64.h" - -size_t -wxBase64Encode(char *dst, size_t dstLen, const void *src_, size_t srcLen) -{ - wxCHECK_MSG( src_, wxCONV_FAILED, wxT("NULL input buffer") ); - - const unsigned char *src = static_cast(src_); - - static const char b64[] = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - - - size_t encLen = 0; - - // encode blocks of 3 bytes into 4 base64 characters - for ( ; srcLen >= 3; srcLen -= 3, src += 3 ) - { - encLen += 4; - if ( dst ) - { - if ( encLen > dstLen ) - return wxCONV_FAILED; - - *dst++ = b64[src[0] >> 2]; - *dst++ = b64[((src[0] & 0x03) << 4) | ((src[1] & 0xf0) >> 4)]; - *dst++ = b64[((src[1] & 0x0f) << 2) | ((src[2] & 0xc0) >> 6)]; - *dst++ = b64[src[2] & 0x3f]; - } - } - - // finish with the remaining characters - if ( srcLen ) - { - encLen += 4; - if ( dst ) - { - if ( encLen > dstLen ) - return wxCONV_FAILED; - - // we have definitely one and maybe two bytes remaining - unsigned char next = srcLen == 2 ? src[1] : 0; - *dst++ = b64[src[0] >> 2]; - *dst++ = b64[((src[0] & 0x03) << 4) | ((next & 0xf0) >> 4)]; - *dst++ = srcLen == 2 ? b64[((next & 0x0f) << 2)] : '='; - *dst = '='; - } - } - - return encLen; -} - -size_t -wxBase64Decode(void *dst_, size_t dstLen, - const char *src, size_t srcLen, - wxBase64DecodeMode mode, - size_t *posErr) -{ - wxCHECK_MSG( src, wxCONV_FAILED, wxT("NULL input buffer") ); - - unsigned char *dst = static_cast(dst_); - - size_t decLen = 0; - - if ( srcLen == wxNO_LEN ) - srcLen = strlen(src); - - // this table contains the values, in base 64, of all valid characters and - // special values WSP or INV for white space and invalid characters - // respectively as well as a special PAD value for '=' - enum - { - WSP = 200, - INV, - PAD - }; - - static const unsigned char decode[256] = - { - WSP,INV,INV,INV,INV,INV,INV,INV,INV,WSP,WSP,INV,WSP,WSP,INV,INV, - INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV, - WSP,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,076,INV,INV,INV,077, - 064,065,066,067,070,071,072,073,074,075,INV,INV,INV,PAD,INV,INV, - INV,000,001,002,003,004,005,006,007,010,011,012,013,014,015,016, - 017,020,021,022,023,024,025,026,027,030,031,INV,INV,INV,INV,INV, - INV,032,033,034,035,036,037,040,041,042,043,044,045,046,047,050, - 051,052,053,054,055,056,057,060,061,062,063,INV,INV,INV,INV,INV, - INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV, - INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV, - INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV, - INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV, - INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV, - INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV, - INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV, - INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV, - }; - - // we decode input by groups of 4 characters but things are complicated by - // the fact that there can be whitespace and other junk in it too so keep - // record of where exactly we're inside the current quartet in this var - int n = 0; - unsigned char in[4]; // current quartet - bool end = false; // set when we find padding - size_t padLen = 0; // length lost to padding - const char *p; - for ( p = src; srcLen; p++, srcLen-- ) - { - const unsigned char c = decode[static_cast(*p)]; - switch ( c ) - { - case WSP: - if ( mode == wxBase64DecodeMode_SkipWS ) - continue; - // fall through - - case INV: - if ( mode == wxBase64DecodeMode_Relaxed ) - continue; - - // force the loop to stop and an error to be returned - n = -1; - srcLen = 1; - break; - - case PAD: - // set the flag telling us that we're past the end now - end = true; - - // there can be either a single '=' at the end of a quartet or - // "==" in positions 2 and 3 - if ( n == 3 ) - { - padLen = 1; - in[n++] = '\0'; - } - else if ( (n == 2) && (--srcLen && *++p == '=') ) - { - padLen = 2; - in[n++] = '\0'; - in[n++] = '\0'; - } - else // invalid padding - { - // force the loop terminate with an error - n = -1; - srcLen = 1; - } - break; - - default: - if ( end ) - { - // nothing is allowed after the end so provoke error return - n = -1; - srcLen = 1; - break; - } - - in[n++] = c; - } - - if ( n == 4 ) - { - // got entire block, decode - decLen += 3 - padLen; - if ( dst ) - { - if ( decLen > dstLen ) - return wxCONV_FAILED; - - // undo the bit shifting done during encoding - *dst++ = in[0] << 2 | in[1] >> 4; - - // be careful to not overwrite the output buffer with NUL pad - // bytes - if ( padLen != 2 ) - { - *dst++ = in[1] << 4 | in[2] >> 2; - if ( !padLen ) - *dst++ = in[2] << 6 | in[3]; - } - } - - n = 0; - } - } - - if ( n ) - { - if ( posErr ) - { - // notice that the error was on a previous position as we did one - // extra "p++" in the loop line after it - *posErr = p - src - 1; - } - - return wxCONV_FAILED; - } - - return decLen; -} - -wxMemoryBuffer wxBase64Decode(const char *src, - size_t srcLen, - wxBase64DecodeMode mode, - size_t *posErr) -{ - wxMemoryBuffer buf; - wxCHECK_MSG( src, buf, wxT("NULL input buffer") ); - - if ( srcLen == wxNO_LEN ) - srcLen = strlen(src); - - size_t len = wxBase64DecodedSize(srcLen); - len = wxBase64Decode(buf.GetWriteBuf(len), len, src, srcLen, mode, posErr); - if ( len == wxCONV_FAILED ) - len = 0; - - buf.SetDataLen(len); - - return buf; -} - -#endif // wxUSE_BASE64 diff --git a/Source/3rd Party/wx/src/common/bmpbase.cpp b/Source/3rd Party/wx/src/common/bmpbase.cpp index af56deacb..a1d7c60aa 100644 --- a/Source/3rd Party/wx/src/common/bmpbase.cpp +++ b/Source/3rd Party/wx/src/common/bmpbase.cpp @@ -3,7 +3,7 @@ // Purpose: wxBitmapBase // Author: VaclavSlavik // Created: 2001/04/11 -// RCS-ID: $Id$ +// RCS-ID: $Id: bmpbase.cpp 42752 2006-10-30 19:26:48Z VZ $ // Copyright: (c) 2001, Vaclav Slavik // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -32,11 +32,6 @@ IMPLEMENT_VARIANT_OBJECT_EXPORTED_SHALLOWCMP(wxBitmap,WXDLLEXPORT) IMPLEMENT_VARIANT_OBJECT_EXPORTED_SHALLOWCMP(wxIcon,WXDLLEXPORT) #endif -#if wxUSE_EXTENDED_RTTI -//WX_IMPLEMENT_ANY_VALUE_TYPE(wxAnyValueTypeImpl) -//WX_IMPLEMENT_ANY_VALUE_TYPE(wxAnyValueTypeImpl) -#endif - // ---------------------------------------------------------------------------- // wxBitmapBase // ---------------------------------------------------------------------------- @@ -52,16 +47,16 @@ IMPLEMENT_VARIANT_OBJECT_EXPORTED_SHALLOWCMP(wxIcon,WXDLLEXPORT) IMPLEMENT_ABSTRACT_CLASS(wxBitmapBase, wxGDIObject) -IMPLEMENT_ABSTRACT_CLASS(wxBitmapHandler, wxObject) +IMPLEMENT_ABSTRACT_CLASS(wxBitmapHandlerBase,wxObject) wxList wxBitmapBase::sm_handlers; -void wxBitmapBase::AddHandler(wxBitmapHandler *handler) +void wxBitmapBase::AddHandler(wxBitmapHandlerBase *handler) { sm_handlers.Append(handler); } -void wxBitmapBase::InsertHandler(wxBitmapHandler *handler) +void wxBitmapBase::InsertHandler(wxBitmapHandlerBase *handler) { sm_handlers.Insert(handler); } @@ -131,6 +126,21 @@ void wxBitmapBase::CleanUpHandlers() } } +bool wxBitmapHandlerBase::Create(wxBitmap*, const void*, long, int, int, int) +{ + return false; +} + +bool wxBitmapHandlerBase::LoadFile(wxBitmap*, const wxString&, long, int, int) +{ + return false; +} + +bool wxBitmapHandlerBase::SaveFile(const wxBitmap*, const wxString&, int, const wxPalette*) +{ + return false; +} + class wxBitmapBaseModule: public wxModule { DECLARE_DYNAMIC_CLASS(wxBitmapBaseModule) @@ -156,11 +166,11 @@ wxBitmap::wxBitmap(const char* const* bits) #if wxUSE_IMAGE && wxUSE_XPM wxImage image(bits); - wxCHECK2_MSG(image.IsOk(), return, wxT("invalid bitmap data")); + wxCHECK2_MSG(image.Ok(), return, wxT("invalid bitmap data")); *this = wxBitmap(image); #else - wxFAIL_MSG(wxT("creating bitmaps from XPMs not supported")); + wxFAIL_MSG(_T("creating bitmaps from XPMs not supported")); #endif // wxUSE_IMAGE && wxUSE_XPM } #endif // !(defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXX11__)) diff --git a/Source/3rd Party/wx/src/common/bmpbtncmn.cpp b/Source/3rd Party/wx/src/common/bmpbtncmn.cpp deleted file mode 100644 index 86779429d..000000000 --- a/Source/3rd Party/wx/src/common/bmpbtncmn.cpp +++ /dev/null @@ -1,93 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/bmpbtncmn.cpp -// Purpose: wxBitmapButton common code -// Author: Julian Smart -// Modified by: -// Created: 04/01/98 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_BMPBUTTON - -#include "wx/bmpbuttn.h" - -#ifndef WX_PRECOMP - #include "wx/log.h" - #include "wx/dcmemory.h" - #include "wx/image.h" -#endif - -// ---------------------------------------------------------------------------- -// XTI -// ---------------------------------------------------------------------------- - -wxDEFINE_FLAGS( wxBitmapButtonStyle ) -wxBEGIN_FLAGS( wxBitmapButtonStyle ) - // new style border flags, we put them first to - // use them for streaming out - wxFLAGS_MEMBER(wxBORDER_SIMPLE) - wxFLAGS_MEMBER(wxBORDER_SUNKEN) - wxFLAGS_MEMBER(wxBORDER_DOUBLE) - wxFLAGS_MEMBER(wxBORDER_RAISED) - wxFLAGS_MEMBER(wxBORDER_STATIC) - wxFLAGS_MEMBER(wxBORDER_NONE) - - // old style border flags - wxFLAGS_MEMBER(wxSIMPLE_BORDER) - wxFLAGS_MEMBER(wxSUNKEN_BORDER) - wxFLAGS_MEMBER(wxDOUBLE_BORDER) - wxFLAGS_MEMBER(wxRAISED_BORDER) - wxFLAGS_MEMBER(wxSTATIC_BORDER) - wxFLAGS_MEMBER(wxBORDER) - - // standard window styles - wxFLAGS_MEMBER(wxTAB_TRAVERSAL) - wxFLAGS_MEMBER(wxCLIP_CHILDREN) - wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW) - wxFLAGS_MEMBER(wxWANTS_CHARS) - wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE) - wxFLAGS_MEMBER(wxALWAYS_SHOW_SB ) - wxFLAGS_MEMBER(wxVSCROLL) - wxFLAGS_MEMBER(wxHSCROLL) - - wxFLAGS_MEMBER(wxBU_AUTODRAW) - wxFLAGS_MEMBER(wxBU_LEFT) - wxFLAGS_MEMBER(wxBU_RIGHT) - wxFLAGS_MEMBER(wxBU_TOP) - wxFLAGS_MEMBER(wxBU_BOTTOM) -wxEND_FLAGS( wxBitmapButtonStyle ) - -wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxBitmapButton, wxButton, "wx/bmpbuttn.h") - -wxBEGIN_PROPERTIES_TABLE(wxBitmapButton) - wxPROPERTY_FLAGS( WindowStyle, wxBitmapButtonStyle, long, \ - SetWindowStyleFlag, GetWindowStyleFlag, \ - wxEMPTY_PARAMETER_VALUE, 0 /*flags*/, wxT("Helpstring"), \ - wxT("group")) // style -wxEND_PROPERTIES_TABLE() - -wxEMPTY_HANDLERS_TABLE(wxBitmapButton) - -wxCONSTRUCTOR_5( wxBitmapButton, wxWindow*, Parent, wxWindowID, Id, \ - wxBitmap, Bitmap, wxPoint, Position, wxSize, Size ) - -/* -TODO PROPERTIES : - -long "style" , wxBU_AUTODRAW -bool "default" , 0 -bitmap "selected" , -bitmap "focus" , -bitmap "disabled" , -*/ - -#endif // wxUSE_BMPBUTTON diff --git a/Source/3rd Party/wx/src/common/bookctrl.cpp b/Source/3rd Party/wx/src/common/bookctrl.cpp index 600a9616b..a64fc9ead 100644 --- a/Source/3rd Party/wx/src/common/bookctrl.cpp +++ b/Source/3rd Party/wx/src/common/bookctrl.cpp @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 19.08.03 -// RCS-ID: $Id$ +// RCS-ID: $Id: bookctrl.cpp 53783 2008-05-27 14:15:14Z SC $ // Copyright: (c) 2003 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -53,8 +53,9 @@ END_EVENT_TABLE() void wxBookCtrlBase::Init() { - m_selection = wxNOT_FOUND; m_bookctrl = NULL; + m_imageList = NULL; + m_ownsImageList = false; m_fitToCurrentPage = false; #if defined(__WXWINCE__) @@ -87,6 +88,39 @@ wxBookCtrlBase::Create(wxWindow *parent, ); } +wxBookCtrlBase::~wxBookCtrlBase() +{ + if ( m_ownsImageList ) + { + // may be NULL, ok + delete m_imageList; + } +} + +// ---------------------------------------------------------------------------- +// image list +// ---------------------------------------------------------------------------- + +void wxBookCtrlBase::SetImageList(wxImageList *imageList) +{ + if ( m_ownsImageList ) + { + // may be NULL, ok + delete m_imageList; + + m_ownsImageList = false; + } + + m_imageList = imageList; +} + +void wxBookCtrlBase::AssignImageList(wxImageList* imageList) +{ + SetImageList(imageList); + + m_ownsImageList = true; +} + // ---------------------------------------------------------------------------- // geometry // ---------------------------------------------------------------------------- @@ -103,31 +137,6 @@ void wxBookCtrlBase::DoInvalidateBestSize() wxControl::InvalidateBestSize(); } -wxSize wxBookCtrlBase::CalcSizeFromPage(const wxSize& sizePage) const -{ - // Add the size of the controller and the border between if it's shown. - if ( !m_bookctrl || !m_bookctrl->IsShown() ) - return sizePage; - - const wxSize sizeController = GetControllerSize(); - - wxSize size = sizePage; - if ( IsVertical() ) - { - if ( sizeController.x > sizePage.x ) - size.x = sizeController.x; - size.y += sizeController.y + GetInternalBorder(); - } - else // left/right aligned - { - size.x += sizeController.x + GetInternalBorder(); - if ( sizeController.y > sizePage.y ) - size.y = sizeController.y; - } - - return size; -} - void wxBookCtrlBase::SetPageSize(const wxSize& size) { SetClientSize(CalcSizeFromPage(size)); @@ -174,7 +183,7 @@ wxRect wxBookCtrlBase::GetPageRect() const switch ( GetWindowStyle() & wxBK_ALIGN_MASK ) { default: - wxFAIL_MSG( wxT("unexpected alignment") ); + wxFAIL_MSG( _T("unexpected alignment") ); // fall through case wxBK_TOP: @@ -233,7 +242,7 @@ void wxBookCtrlBase::DoSize() switch ( GetWindowStyle() & wxBK_ALIGN_MASK ) { default: - wxFAIL_MSG( wxT("unexpected alignment") ); + wxFAIL_MSG( _T("unexpected alignment") ); // fall through case wxBK_TOP: @@ -256,14 +265,14 @@ void wxBookCtrlBase::DoSize() // resize all pages to fit the new control size const wxRect pageRect = GetPageRect(); - const unsigned pagesCount = m_pages.GetCount(); + const unsigned pagesCount = m_pages.Count(); for ( unsigned int i = 0; i < pagesCount; ++i ) { wxWindow * const page = m_pages[i]; if ( !page ) { wxASSERT_MSG( AllowNullPage(), - wxT("Null page in a control that does not allow null pages?") ); + _T("Null page in a control that does not allow null pages?") ); continue; } @@ -280,25 +289,23 @@ void wxBookCtrlBase::OnSize(wxSizeEvent& event) wxSize wxBookCtrlBase::GetControllerSize() const { - // For at least some book controls (e.g. wxChoicebook) it may make sense to - // (temporarily?) hide the controller and we shouldn't leave extra space - // for the hidden control in this case. - if ( !m_bookctrl || !m_bookctrl->IsShown() ) - return wxSize(0, 0); + if(!m_bookctrl) + return wxSize(0,0); - const wxSize sizeClient = GetClientSize(); + const wxSize sizeClient = GetClientSize(), + sizeBorder = m_bookctrl->GetSize() - m_bookctrl->GetClientSize(), + sizeCtrl = m_bookctrl->GetBestSize() + sizeBorder; wxSize size; - // Ask for the best width/height considering the other direction. if ( IsVertical() ) { size.x = sizeClient.x; - size.y = m_bookctrl->GetBestHeight(sizeClient.x); + size.y = sizeCtrl.y; } else // left/right aligned { - size.x = m_bookctrl->GetBestWidth(sizeClient.y); + size.x = sizeCtrl.x; size.y = sizeClient.y; } @@ -379,9 +386,9 @@ wxBookCtrlBase::InsertPage(size_t nPage, int WXUNUSED(imageId)) { wxCHECK_MSG( page || AllowNullPage(), false, - wxT("NULL page in wxBookCtrlBase::InsertPage()") ); + _T("NULL page in wxBookCtrlBase::InsertPage()") ); wxCHECK_MSG( nPage <= m_pages.size(), false, - wxT("invalid page index in wxBookCtrlBase::InsertPage()") ); + _T("invalid page index in wxBookCtrlBase::InsertPage()") ); m_pages.Insert(page, nPage); if ( page ) @@ -407,7 +414,7 @@ bool wxBookCtrlBase::DeletePage(size_t nPage) wxWindow *wxBookCtrlBase::DoRemovePage(size_t nPage) { wxCHECK_MSG( nPage < m_pages.size(), NULL, - wxT("invalid page index in wxBookCtrlBase::DoRemovePage()") ); + _T("invalid page index in wxBookCtrlBase::DoRemovePage()") ); wxWindow *pageRemoved = m_pages[nPage]; m_pages.RemoveAt(nPage); @@ -439,19 +446,6 @@ int wxBookCtrlBase::GetNextPage(bool forward) const return nPage; } -bool wxBookCtrlBase::DoSetSelectionAfterInsertion(size_t n, bool bSelect) -{ - if ( bSelect ) - SetSelection(n); - else if ( m_selection == wxNOT_FOUND ) - ChangeSelection(0); - else // We're not going to select this page. - return false; - - // Return true to indicate that we selected this page. - return true; -} - int wxBookCtrlBase::DoSetSelection(size_t n, int flags) { wxCHECK_MSG( n < GetPageCount(), wxNOT_FOUND, @@ -461,7 +455,7 @@ int wxBookCtrlBase::DoSetSelection(size_t n, int flags) if ( n != (size_t)oldSel ) { - wxBookCtrlEvent *event = CreatePageChangingEvent(); + wxBookCtrlBaseEvent *event = CreatePageChangingEvent(); bool allowed = false; if ( flags & SetSelection_SendEvent ) @@ -499,6 +493,5 @@ int wxBookCtrlBase::DoSetSelection(size_t n, int flags) return oldSel; } -IMPLEMENT_DYNAMIC_CLASS(wxBookCtrlEvent, wxNotifyEvent) #endif // wxUSE_BOOKCTRL diff --git a/Source/3rd Party/wx/src/common/btncmn.cpp b/Source/3rd Party/wx/src/common/btncmn.cpp deleted file mode 100644 index 281d3e7c8..000000000 --- a/Source/3rd Party/wx/src/common/btncmn.cpp +++ /dev/null @@ -1,122 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/common/btncmn.cpp -// Purpose: implementation of wxButtonBase -// Author: Vadim Zeitlin -// Created: 2007-04-08 -// RCS-ID: $Id$ -// Copyright: (c) 2007 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// for compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_BUTTON - -#ifndef WX_PRECOMP - #include "wx/button.h" - #include "wx/toplevel.h" -#endif //WX_PRECOMP - -extern WXDLLEXPORT_DATA(const char) wxButtonNameStr[] = "button"; - -// ---------------------------------------------------------------------------- -// XTI -// ---------------------------------------------------------------------------- - -wxDEFINE_FLAGS( wxButtonStyle ) -wxBEGIN_FLAGS( wxButtonStyle ) -// new style border flags, we put them first to -// use them for streaming out -wxFLAGS_MEMBER(wxBORDER_SIMPLE) -wxFLAGS_MEMBER(wxBORDER_SUNKEN) -wxFLAGS_MEMBER(wxBORDER_DOUBLE) -wxFLAGS_MEMBER(wxBORDER_RAISED) -wxFLAGS_MEMBER(wxBORDER_STATIC) -wxFLAGS_MEMBER(wxBORDER_NONE) - -// old style border flags -wxFLAGS_MEMBER(wxSIMPLE_BORDER) -wxFLAGS_MEMBER(wxSUNKEN_BORDER) -wxFLAGS_MEMBER(wxDOUBLE_BORDER) -wxFLAGS_MEMBER(wxRAISED_BORDER) -wxFLAGS_MEMBER(wxSTATIC_BORDER) -wxFLAGS_MEMBER(wxBORDER) - -// standard window styles -wxFLAGS_MEMBER(wxTAB_TRAVERSAL) -wxFLAGS_MEMBER(wxCLIP_CHILDREN) -wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW) -wxFLAGS_MEMBER(wxWANTS_CHARS) -wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE) -wxFLAGS_MEMBER(wxALWAYS_SHOW_SB ) -wxFLAGS_MEMBER(wxVSCROLL) -wxFLAGS_MEMBER(wxHSCROLL) - -wxFLAGS_MEMBER(wxBU_LEFT) -wxFLAGS_MEMBER(wxBU_RIGHT) -wxFLAGS_MEMBER(wxBU_TOP) -wxFLAGS_MEMBER(wxBU_BOTTOM) -wxFLAGS_MEMBER(wxBU_EXACTFIT) -wxEND_FLAGS( wxButtonStyle ) - -wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxButton, wxControl, "wx/button.h") - -wxBEGIN_PROPERTIES_TABLE(wxButton) -wxEVENT_PROPERTY( Click, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEvent ) - -wxPROPERTY( Font, wxFont, SetFont, GetFont, wxEMPTY_PARAMETER_VALUE, \ - 0 /*flags*/, wxT("The font associated with the button label"), wxT("group")) -wxPROPERTY( Label, wxString, SetLabel, GetLabel, wxString(), \ - 0 /*flags*/, wxT("The button label"), wxT("group") ) - -wxPROPERTY_FLAGS( WindowStyle, wxButtonStyle, long, SetWindowStyleFlag, \ - GetWindowStyleFlag, wxEMPTY_PARAMETER_VALUE, 0 /*flags*/, \ - wxT("The button style"), wxT("group")) // style -wxEND_PROPERTIES_TABLE() - -wxEMPTY_HANDLERS_TABLE(wxButton) - -wxCONSTRUCTOR_6( wxButton, wxWindow*, Parent, wxWindowID, Id, wxString, \ - Label, wxPoint, Position, wxSize, Size, long, WindowStyle ) - - -// ============================================================================ -// implementation -// ============================================================================ - -wxWindow *wxButtonBase::SetDefault() -{ - wxTopLevelWindow * const - tlw = wxDynamicCast(wxGetTopLevelParent(this), wxTopLevelWindow); - - wxCHECK_MSG( tlw, NULL, wxT("button without top level window?") ); - - return tlw->SetDefaultItem(this); -} - -void wxAnyButtonBase::SetBitmapPosition(wxDirection dir) -{ - wxASSERT_MSG( !(dir & ~wxDIRECTION_MASK), "non-direction flag used" ); - wxASSERT_MSG( !!(dir & wxLEFT) + - !!(dir & wxRIGHT) + - !!(dir & wxTOP) + - !!(dir & wxBOTTOM) == 1, - "exactly one direction flag must be set" ); - - DoSetBitmapPosition(dir); - -} -#endif // wxUSE_BUTTON diff --git a/Source/3rd Party/wx/src/common/cairo.cpp b/Source/3rd Party/wx/src/common/cairo.cpp deleted file mode 100644 index 03eaa7d6c..000000000 --- a/Source/3rd Party/wx/src/common/cairo.cpp +++ /dev/null @@ -1,442 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/cairo.cpp -// Purpose: Cairo library -// Author: Anthony Betaudeau -// Created: 2007-08-25 -// RCS-ID: $Id$ -// Copyright: (c) Anthony Bretaudeau -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - - -// For compilers that support precompilation, includes "wx/wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -// keep cairo.h from defining dllimport as we're defining the symbols inside -// the wx dll in order to load them dynamically. -#define cairo_public - -#include "wx/cairo.h" -#include "wx/dynlib.h" - -#if wxUSE_CAIRO - -#ifdef __WXMSW__ -#include "wx/msw/wrapwin.h" -#endif - -#ifdef __WXMAC__ -#include "wx/osx/private.h" -#include -#endif - -#ifndef WX_PRECOMP - #include "wx/module.h" - #include "wx/log.h" -#endif - -#define wxCAIRO_METHOD_TYPE(name) \ - wxCairo##name##_t - -#define wxCAIRO_STATIC_METHOD_DEFINE(rettype, name, args, argnames, defret) \ - static wxCAIRO_METHOD_TYPE(name) name; - -#define wxCAIRO_STATIC_VOIDMETHOD_DEFINE(name, args, argnames) \ - wxCAIRO_STATIC_METHOD_DEFINE(void, name, args, argnames, NULL) - -#define wxFOR_ALL_CAIRO_VOIDMETHODS(m) \ - m( cairo_append_path, \ - (cairo_t *cr, const cairo_path_t *path), (cr, path) ) \ - m( cairo_arc, \ - (cairo_t *cr, double xc, double yc, double radius, double angle1, double angle2), (cr, xc, yc, radius, angle1, angle2) ) \ - m( cairo_arc_negative, \ - (cairo_t *cr, double xc, double yc, double radius, double angle1, double angle2), (cr, xc, yc, radius, angle1, angle2) ) \ - m( cairo_clip, \ - (cairo_t *cr), (cr) ) \ - m( cairo_close_path, \ - (cairo_t *cr), (cr) ) \ - m( cairo_curve_to, \ - (cairo_t *cr, double x1, double y1, double x2, double y2, double x3, double y3), (cr, x1, y1, x2, y2, x3, y3) ) \ - m( cairo_destroy, \ - (cairo_t *cr), (cr) ) \ - m( cairo_fill, \ - (cairo_t *cr), (cr) ) \ - m( cairo_fill_preserve, \ - (cairo_t *cr), (cr) ) \ - m( cairo_font_extents, \ - (cairo_t *cr, cairo_font_extents_t *extents), (cr, extents) ) \ - m( cairo_font_face_destroy, \ - (cairo_font_face_t *font_face), (font_face) ) \ - m( cairo_get_current_point, \ - (cairo_t *cr, double *x, double *y), (cr, x, y) ) \ - m( cairo_get_matrix, \ - (cairo_t *cr, cairo_matrix_t *matrix), (cr, matrix) ) \ - m( cairo_line_to, \ - (cairo_t *cr, double x, double y), (cr, x, y) ) \ - m( cairo_matrix_init, \ - (cairo_matrix_t *matrix, double xx, double yx, double xy, double yy, double x0, double y0), (matrix, xx, yx, xy, yy, x0, y0) ) \ - m( cairo_matrix_multiply, \ - (cairo_matrix_t *result, const cairo_matrix_t *a, const cairo_matrix_t *b), (result, a, b) ) \ - m( cairo_matrix_rotate, \ - (cairo_matrix_t *matrix, double radians), (matrix, radians) ) \ - m( cairo_matrix_scale, \ - (cairo_matrix_t *matrix, double sx, double sy), (matrix, sx, sy) ) \ - m( cairo_matrix_transform_distance, \ - (const cairo_matrix_t *matrix, double *dx, double *dy), (matrix, dx, dy) ) \ - m( cairo_matrix_transform_point, \ - (const cairo_matrix_t *matrix, double *x, double *y), (matrix, x, y) ) \ - m( cairo_matrix_translate, \ - (cairo_matrix_t *matrix, double tx, double ty), (matrix, tx, ty) ) \ - m( cairo_move_to, \ - (cairo_t *cr, double x, double y), (cr, x, y) ) \ - m( cairo_new_path, \ - (cairo_t *cr), (cr) ) \ - m( cairo_paint, \ - (cairo_t *cr), (cr) ) \ - m( cairo_paint_with_alpha, \ - (cairo_t *cr, double alpha), (cr, alpha) ) \ - m( cairo_path_destroy, \ - (cairo_path_t *path), (path) ) \ - m( cairo_pattern_add_color_stop_rgba, \ - (cairo_pattern_t *pattern, double offset, double red, double green, double blue, double alpha), (pattern, offset, red, green, blue, alpha) ) \ - m( cairo_pattern_destroy, \ - (cairo_pattern_t *pattern), (pattern) ) \ - m( cairo_pattern_set_extend, \ - (cairo_pattern_t *pattern, cairo_extend_t extend), (pattern, extend) ) \ - m( cairo_pattern_set_filter, \ - (cairo_pattern_t *pattern, cairo_filter_t filter), (pattern, filter) ) \ - m( cairo_pop_group_to_source, \ - (cairo_t *cr), (cr) ) \ - m( cairo_push_group, \ - (cairo_t *cr), (cr) ) \ - m( cairo_rectangle, \ - (cairo_t *cr, double x, double y, double width, double height), (cr, x, y, width, height) ) \ - m( cairo_reset_clip, \ - (cairo_t *cr), (cr) ) \ - m( cairo_restore, \ - (cairo_t *cr), (cr) ) \ - m( cairo_rotate, \ - (cairo_t *cr, double angle), (cr, angle) ) \ - m( cairo_save, \ - (cairo_t *cr), (cr) ) \ - m( cairo_scale, \ - (cairo_t *cr, double sx, double sy), (cr, sx, sy) ) \ - m( cairo_select_font_face, \ - (cairo_t *cr, const char *family, cairo_font_slant_t slant, cairo_font_weight_t weight), (cr, family, slant, weight) ) \ - m( cairo_set_antialias, \ - (cairo_t *cr, cairo_antialias_t antialias), (cr, antialias) ) \ - m( cairo_set_dash, \ - (cairo_t *cr, const double *dashes, int num_dashes, double offset), (cr, dashes, num_dashes, offset) ) \ - m( cairo_set_fill_rule, \ - (cairo_t *cr, cairo_fill_rule_t fill_rule), (cr, fill_rule) ) \ - m( cairo_set_font_face, \ - (cairo_t *cr, cairo_font_face_t *font_face), (cr, font_face) ) \ - m( cairo_set_font_size, \ - (cairo_t *cr, double size), (cr, size) ) \ - m( cairo_set_line_cap, \ - (cairo_t *cr, cairo_line_cap_t line_cap), (cr, line_cap) ) \ - m( cairo_set_line_join, \ - (cairo_t *cr, cairo_line_join_t line_join), (cr, line_join) ) \ - m( cairo_set_line_width, \ - (cairo_t *cr, double width), (cr, width) ) \ - m( cairo_set_matrix, \ - (cairo_t *cr, const cairo_matrix_t *matrix), (cr, matrix) ) \ - m( cairo_set_operator, \ - (cairo_t *cr, cairo_operator_t op), (cr, op) ) \ - m( cairo_set_source, \ - (cairo_t *cr, cairo_pattern_t *source), (cr, source) ) \ - m( cairo_set_source_rgba, \ - (cairo_t *cr, double red, double green, double blue, double alpha), (cr, red, green, blue, alpha) ) \ - m( cairo_show_text, \ - (cairo_t *cr, const char *utf8), (cr, utf8) ) \ - m( cairo_stroke, \ - (cairo_t *cr), (cr) ) \ - m( cairo_stroke_extents, \ - (cairo_t *cr, double *x1, double *y1, double *x2, double *y2), (cr, x1, y1, x2, y2) ) \ - m( cairo_stroke_preserve, \ - (cairo_t *cr), (cr) ) \ - m( cairo_surface_destroy, \ - (cairo_surface_t *surface), (surface) ) \ - m( cairo_text_extents, \ - (cairo_t *cr, const char *utf8, cairo_text_extents_t *extents), (cr, utf8, extents) ) \ - m( cairo_transform, \ - (cairo_t *cr, const cairo_matrix_t *matrix), (cr, matrix) ) \ - m( cairo_translate, \ - (cairo_t *cr, double tx, double ty), (cr, tx, ty) ) \ - -#ifdef __WXMAC__ -#define wxCAIRO_PLATFORM_METHODS(m) \ - m( cairo_font_face_t*, cairo_quartz_font_face_create_for_cgfont, \ - (CGFontRef font), (font), NULL ) \ - m( cairo_surface_t*, cairo_quartz_surface_create_for_cg_context, \ - (CGContextRef cgContext, unsigned int width, unsigned int height), (cgContext, width, height), NULL ) -#elif defined(__WXMSW__) -#define wxCAIRO_PLATFORM_METHODS(m) \ - m( cairo_surface_t*, cairo_win32_surface_create, \ - (HDC hdc), (hdc), NULL ) \ - m( cairo_surface_t*, cairo_win32_printing_surface_create, \ - (HDC hdc), (hdc), NULL ) -#else -#define wxCAIRO_PLATFORM_METHODS(m) -#endif - -#define wxFOR_ALL_CAIRO_METHODS(m) \ - m( cairo_path_t*, cairo_copy_path, \ - (cairo_t *cr), (cr), NULL ) \ - m( cairo_t*, cairo_create, \ - (cairo_surface_t *target), (target), NULL) \ - m( cairo_surface_t*, cairo_get_target, \ - (cairo_t *cr), (cr), NULL) \ - m( cairo_surface_t*, cairo_image_surface_create, \ - (cairo_format_t format, int width, int height), (format, width, height), NULL ) \ - m( cairo_surface_t*, cairo_image_surface_create_for_data, \ - (unsigned char *data, cairo_format_t format, int width, int height, int stride), (data, format, width, height, stride), NULL) \ - m( cairo_bool_t, cairo_in_fill, \ - (cairo_t *cr, double x, double y), (cr, x, y), false ) \ - m( cairo_status_t, cairo_matrix_invert, \ - (cairo_matrix_t *matrix), (matrix), NULL) \ - m( cairo_pattern_t*, cairo_pattern_create_for_surface, \ - (cairo_surface_t *surface), (surface), NULL) \ - m( cairo_pattern_t*, cairo_pattern_create_linear, \ - (double x0, double y0, double x1, double y1), (x0, y0, x1, y1), NULL) \ - m( cairo_pattern_t*, cairo_pattern_create_radial, \ - (double cx0, double cy0, double radius0, double cx1, double cy1, double radius1), (cx0, cy0, radius0, cx1, cy1, radius1), NULL) \ - m( cairo_status_t, cairo_pattern_status, \ - (cairo_pattern_t *pattern), (pattern), 4) \ - m( cairo_t*, cairo_reference, \ - (cairo_t *cr), (cr), NULL ) \ - m( cairo_surface_t*, cairo_surface_create_similar, \ - (cairo_surface_t *other, cairo_content_t content, int width, int height), (other, content, width, height), NULL) \ - m( int, cairo_format_stride_for_width, \ - (cairo_format_t format, int width), (format, width), 0) \ - m( int, cairo_version, \ - (), (), 0) \ - m( int, cairo_image_surface_get_stride, \ - (cairo_surface_t *surface), (surface), 0) \ - m( unsigned char *, cairo_image_surface_get_data, \ - (cairo_surface_t *surface), (surface), NULL) \ - m( cairo_format_t, cairo_image_surface_get_format, \ - (cairo_surface_t *surface), (surface), CAIRO_FORMAT_INVALID) \ - m( cairo_surface_type_t, cairo_surface_get_type, \ - (cairo_surface_t *surface), (surface), -1) \ - wxCAIRO_PLATFORM_METHODS(m) - - -#if wxUSE_PANGO -#define wxFOR_ALL_PANGO_CAIRO_VOIDMETHODS(m) \ - m( pango_cairo_update_layout, \ - (cairo_t *cr, PangoLayout *layout), (cr, layout) ) \ - m( pango_cairo_show_layout, \ - (cairo_t *cr, PangoLayout *layout), (cr, layout) ) -#endif - -#define wxCAIRO_DECLARE_TYPE(rettype, name, args, argnames, defret) \ - typedef rettype (*wxCAIRO_METHOD_TYPE(name)) args ; \ - wxCAIRO_METHOD_TYPE(name) wxDL_METHOD_NAME(name); - -#define wxCAIRO_DECLARE_VOIDTYPE(name, args, argnames) \ - wxCAIRO_DECLARE_TYPE(void, name, args, argnames, NULL) - -wxFOR_ALL_CAIRO_VOIDMETHODS(wxCAIRO_DECLARE_VOIDTYPE) -wxFOR_ALL_CAIRO_METHODS(wxCAIRO_DECLARE_TYPE) - - -class wxCairo -{ -public: - static bool Initialize(); - - // for internal use only - static void CleanUp(); - -private: - // the single wxCairo instance or NULL - static wxCairo *ms_lib; - - wxCairo(); - ~wxCairo(); - - bool IsOk(); - - wxDynamicLibrary m_libCairo; - wxDynamicLibrary m_libPangoCairo; - - // true if we successfully loaded the libraries and can use them - // - // note that this field must have this name as it's used by wxDL_XXX macros - bool m_ok; - -public: - - wxFOR_ALL_CAIRO_VOIDMETHODS(wxCAIRO_STATIC_VOIDMETHOD_DEFINE) - wxFOR_ALL_CAIRO_METHODS(wxCAIRO_STATIC_METHOD_DEFINE) -#if wxUSE_PANGO // untested, uncomment to test compilation. - //wxFOR_ALL_PANGO_METHODS(wxDL_STATIC_METHOD_DEFINE) -#endif - - wxDECLARE_NO_COPY_CLASS(wxCairo); -}; - -#define wxINIT_CAIRO_VOIDFUNC(name, params, args) \ - wxCAIRO_METHOD_TYPE(name) wxCairo::name = NULL; - -#define wxINIT_CAIRO_FUNC(rettype, name, params, args, defret) \ - wxCAIRO_METHOD_TYPE(name) wxCairo::name = NULL; - -wxFOR_ALL_CAIRO_VOIDMETHODS(wxINIT_CAIRO_VOIDFUNC) -wxFOR_ALL_CAIRO_METHODS(wxINIT_CAIRO_FUNC) - -#undef wxINIT_CAIRO_FUNC - -wxCairo *wxCairo::ms_lib = NULL; - -//---------------------------------------------------------------------------- -// wxCairoLibrary -//---------------------------------------------------------------------------- - -wxCairo::wxCairo() -{ - wxLogNull log; - -#ifdef __WXMSW__ - wxString cairoDllStr("libcairo-2.dll"); -#else - wxString cairoDllStr("libcairo.so.2"); -#endif - m_libCairo.Load(cairoDllStr); - m_ok = m_libCairo.IsLoaded(); - if ( !m_ok ) - return; - -#if wxUSE_PANGO - m_libPangoCairo.Load("libpangocairo-1.0.so.0"); - m_ok = m_libPangoCairo.IsLoaded(); - if ( !m_ok ) - { - m_libCairo.Unload(); - return; - } -#endif - - -#define wxDO_LOAD_FUNC(name, nameStr) \ - name = (wxCAIRO_METHOD_TYPE(name))m_libCairo.RawGetSymbol(nameStr); \ - if ( !name ) \ - return; - -#define wxLOAD_CAIRO_VOIDFUNC(name, params, args) \ - wxDO_LOAD_FUNC(name, wxSTRINGIZE_T(name)) - -#define wxLOAD_CAIRO_FUNC(rettype, name, params, args, defret) \ - wxDO_LOAD_FUNC(name, wxSTRINGIZE_T(name)) - -wxFOR_ALL_CAIRO_VOIDMETHODS(wxLOAD_CAIRO_VOIDFUNC) -wxFOR_ALL_CAIRO_METHODS(wxLOAD_CAIRO_FUNC) - -#undef wxLOAD_CAIRO_FUNC - - m_ok = true; -} - -wxCairo::~wxCairo() -{ -} - -/* static */ bool wxCairo::Initialize() -{ - if ( !ms_lib ) - { - ms_lib = new wxCairo(); - if ( !ms_lib->IsOk() ) - { - delete ms_lib; - ms_lib = NULL; - } - } - - return ms_lib != NULL; -} - -/* static */ void wxCairo::CleanUp() -{ - if (ms_lib) - { - delete ms_lib; - ms_lib = NULL; - } -} - -bool wxCairo::IsOk() -{ - return m_ok; -} - -// ============================================================================ -// implementation of the functions themselves -// ============================================================================ - -extern "C" -{ - -bool wxCairoInit() -{ - return wxCairo::Initialize(); -} - -void wxCairoCleanUp() -{ - wxCairo::CleanUp(); -} - -#define wxIMPL_CAIRO_FUNC(rettype, name, params, args, defret) \ - rettype name params \ - { \ - wxASSERT_MSG(wxCairo::Initialize(), "Cairo not initialized"); \ - return wxCairo::name args; \ - } - -#define wxIMPL_CAIRO_VOIDFUNC(name, params, args) \ - wxIMPL_CAIRO_FUNC(void, name, params, args, NULL) - -// we currently link directly to Cairo on GTK since it is usually available there, -// so don't use our cairo_xyz wrapper functions until the decision is made to -// always load Cairo dynamically there. -#ifndef __WXGTK__ -wxFOR_ALL_CAIRO_VOIDMETHODS(wxIMPL_CAIRO_VOIDFUNC) -wxFOR_ALL_CAIRO_METHODS(wxIMPL_CAIRO_FUNC) -#endif - -} // extern "C" - -//---------------------------------------------------------------------------- -// wxCairoModule -//---------------------------------------------------------------------------- - -class wxCairoModule : public wxModule -{ -public: - wxCairoModule() { } - virtual bool OnInit(); - virtual void OnExit(); - -private: - DECLARE_DYNAMIC_CLASS(wxCairoModule) -}; - -bool wxCairoModule::OnInit() -{ - return true; -} - -void wxCairoModule::OnExit() -{ - wxCairo::CleanUp(); -} - -IMPLEMENT_DYNAMIC_CLASS(wxCairoModule, wxModule) - -#endif // wxUSE_CAIRO diff --git a/Source/3rd Party/wx/src/common/checkboxcmn.cpp b/Source/3rd Party/wx/src/common/checkboxcmn.cpp deleted file mode 100644 index 80ca73997..000000000 --- a/Source/3rd Party/wx/src/common/checkboxcmn.cpp +++ /dev/null @@ -1,91 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/checkboxcmn.cpp -// Purpose: wxCheckBox common code -// Author: Julian Smart -// Modified by: -// Created: 04/01/98 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_CHECKBOX - -#include "wx/checkbox.h" - -extern WXDLLEXPORT_DATA(const char) wxCheckBoxNameStr[] = "check"; - -// ---------------------------------------------------------------------------- -// XTI -// ---------------------------------------------------------------------------- - -wxDEFINE_FLAGS( wxCheckBoxStyle ) -wxBEGIN_FLAGS( wxCheckBoxStyle ) - // new style border flags, we put them first to - // use them for streaming out - wxFLAGS_MEMBER(wxBORDER_SIMPLE) - wxFLAGS_MEMBER(wxBORDER_SUNKEN) - wxFLAGS_MEMBER(wxBORDER_DOUBLE) - wxFLAGS_MEMBER(wxBORDER_RAISED) - wxFLAGS_MEMBER(wxBORDER_STATIC) - wxFLAGS_MEMBER(wxBORDER_NONE) - - // old style border flags - wxFLAGS_MEMBER(wxSIMPLE_BORDER) - wxFLAGS_MEMBER(wxSUNKEN_BORDER) - wxFLAGS_MEMBER(wxDOUBLE_BORDER) - wxFLAGS_MEMBER(wxRAISED_BORDER) - wxFLAGS_MEMBER(wxSTATIC_BORDER) - wxFLAGS_MEMBER(wxNO_BORDER) - - // standard window styles - wxFLAGS_MEMBER(wxTAB_TRAVERSAL) - wxFLAGS_MEMBER(wxCLIP_CHILDREN) - wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW) - wxFLAGS_MEMBER(wxWANTS_CHARS) - wxFLAGS_MEMBER(wxNO_FULL_REPAINT_ON_RESIZE) - wxFLAGS_MEMBER(wxALWAYS_SHOW_SB ) - wxFLAGS_MEMBER(wxVSCROLL) - wxFLAGS_MEMBER(wxHSCROLL) - -wxEND_FLAGS( wxCheckBoxStyle ) - -wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxCheckBox, wxControl, "wx/checkbox.h") - -wxBEGIN_PROPERTIES_TABLE(wxCheckBox) - wxEVENT_PROPERTY( Click, wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEvent ) - - wxPROPERTY( Font, wxFont, SetFont, GetFont, wxEMPTY_PARAMETER_VALUE, \ - 0 /*flags*/, wxT("Helpstring"), wxT("group")) - wxPROPERTY( Label,wxString, SetLabel, GetLabel, wxString(), \ - 0 /*flags*/, wxT("Helpstring"), wxT("group")) - wxPROPERTY( Value,bool, SetValue, GetValue, wxEMPTY_PARAMETER_VALUE, \ - 0 /*flags*/, wxT("Helpstring"), wxT("group")) - - wxPROPERTY_FLAGS( WindowStyle, wxCheckBoxStyle, long, SetWindowStyleFlag, \ - GetWindowStyleFlag, wxEMPTY_PARAMETER_VALUE, 0 /*flags*/, \ - wxT("Helpstring"), wxT("group")) // style -wxEND_PROPERTIES_TABLE() - -wxEMPTY_HANDLERS_TABLE(wxCheckBox) - -wxCONSTRUCTOR_6( wxCheckBox, wxWindow*, Parent, wxWindowID, Id, \ - wxString, Label, wxPoint, Position, wxSize, Size, long, WindowStyle ) - - -#endif // wxUSE_CHECKBOX diff --git a/Source/3rd Party/wx/src/common/checklstcmn.cpp b/Source/3rd Party/wx/src/common/checklstcmn.cpp deleted file mode 100644 index d10a013ed..000000000 --- a/Source/3rd Party/wx/src/common/checklstcmn.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/common/checklstcmn.cpp -// Purpose: wxCheckListBox common code -// Author: Vadim Zeitlin -// Modified by: -// Created: 16.11.97 -// RCS-ID: $Id$ -// Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_CHECKLISTBOX - -#include "wx/checklst.h" - -#ifndef WX_PRECOMP - #include "wx/object.h" - #include "wx/colour.h" - #include "wx/font.h" - #include "wx/bitmap.h" - #include "wx/window.h" - #include "wx/listbox.h" - #include "wx/dcmemory.h" - #include "wx/settings.h" - #include "wx/log.h" -#endif - -// ---------------------------------------------------------------------------- -// XTI -// ---------------------------------------------------------------------------- - -wxDEFINE_FLAGS( wxCheckListBoxStyle ) -wxBEGIN_FLAGS( wxCheckListBoxStyle ) - // new style border flags, we put them first to - // use them for streaming out - wxFLAGS_MEMBER(wxBORDER_SIMPLE) - wxFLAGS_MEMBER(wxBORDER_SUNKEN) - wxFLAGS_MEMBER(wxBORDER_DOUBLE) - wxFLAGS_MEMBER(wxBORDER_RAISED) - wxFLAGS_MEMBER(wxBORDER_STATIC) - wxFLAGS_MEMBER(wxBORDER_NONE) - - // old style border flags - wxFLAGS_MEMBER(wxSIMPLE_BORDER) - wxFLAGS_MEMBER(wxSUNKEN_BORDER) - wxFLAGS_MEMBER(wxDOUBLE_BORDER) - wxFLAGS_MEMBER(wxRAISED_BORDER) - wxFLAGS_MEMBER(wxSTATIC_BORDER) - wxFLAGS_MEMBER(wxBORDER) - - // standard window styles - wxFLAGS_MEMBER(wxTAB_TRAVERSAL) - wxFLAGS_MEMBER(wxCLIP_CHILDREN) - wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW) - wxFLAGS_MEMBER(wxWANTS_CHARS) - wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE) - wxFLAGS_MEMBER(wxALWAYS_SHOW_SB ) - wxFLAGS_MEMBER(wxVSCROLL) - wxFLAGS_MEMBER(wxHSCROLL) - - wxFLAGS_MEMBER(wxLB_SINGLE) - wxFLAGS_MEMBER(wxLB_MULTIPLE) - wxFLAGS_MEMBER(wxLB_EXTENDED) - wxFLAGS_MEMBER(wxLB_HSCROLL) - wxFLAGS_MEMBER(wxLB_ALWAYS_SB) - wxFLAGS_MEMBER(wxLB_NEEDED_SB) - wxFLAGS_MEMBER(wxLB_SORT) - wxFLAGS_MEMBER(wxLB_OWNERDRAW) - -wxEND_FLAGS( wxCheckListBoxStyle ) - -wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxCheckListBox, wxListBox, "wx/checklst.h") - -wxBEGIN_PROPERTIES_TABLE(wxCheckListBox) - wxEVENT_PROPERTY( Toggle, wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, wxCommandEvent ) - wxPROPERTY_FLAGS( WindowStyle, wxCheckListBoxStyle, long, SetWindowStyleFlag, \ - GetWindowStyleFlag, wxEMPTY_PARAMETER_VALUE, wxLB_OWNERDRAW /*flags*/, \ - wxT("Helpstring"), wxT("group")) // style -wxEND_PROPERTIES_TABLE() - -wxEMPTY_HANDLERS_TABLE(wxCheckListBox) - -wxCONSTRUCTOR_4( wxCheckListBox, wxWindow*, Parent, wxWindowID, Id, \ - wxPoint, Position, wxSize, Size ) - - -#endif diff --git a/Source/3rd Party/wx/src/common/choiccmn.cpp b/Source/3rd Party/wx/src/common/choiccmn.cpp index c33bc857e..94481b914 100644 --- a/Source/3rd Party/wx/src/common/choiccmn.cpp +++ b/Source/3rd Party/wx/src/common/choiccmn.cpp @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 26.07.99 -// RCS-ID: $Id$ +// RCS-ID: $Id: choiccmn.cpp 39470 2006-05-30 07:34:30Z ABX $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -31,68 +31,7 @@ #ifndef WX_PRECOMP #endif -const char wxChoiceNameStr[] = "choice"; - - -wxDEFINE_FLAGS( wxChoiceStyle ) -wxBEGIN_FLAGS( wxChoiceStyle ) -// new style border flags, we put them first to -// use them for streaming out -wxFLAGS_MEMBER(wxBORDER_SIMPLE) -wxFLAGS_MEMBER(wxBORDER_SUNKEN) -wxFLAGS_MEMBER(wxBORDER_DOUBLE) -wxFLAGS_MEMBER(wxBORDER_RAISED) -wxFLAGS_MEMBER(wxBORDER_STATIC) -wxFLAGS_MEMBER(wxBORDER_NONE) - -// old style border flags -wxFLAGS_MEMBER(wxSIMPLE_BORDER) -wxFLAGS_MEMBER(wxSUNKEN_BORDER) -wxFLAGS_MEMBER(wxDOUBLE_BORDER) -wxFLAGS_MEMBER(wxRAISED_BORDER) -wxFLAGS_MEMBER(wxSTATIC_BORDER) -wxFLAGS_MEMBER(wxBORDER) - -// standard window styles -wxFLAGS_MEMBER(wxTAB_TRAVERSAL) -wxFLAGS_MEMBER(wxCLIP_CHILDREN) -wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW) -wxFLAGS_MEMBER(wxWANTS_CHARS) -wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE) -wxFLAGS_MEMBER(wxALWAYS_SHOW_SB ) -wxFLAGS_MEMBER(wxVSCROLL) -wxFLAGS_MEMBER(wxHSCROLL) - -wxEND_FLAGS( wxChoiceStyle ) - -wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxChoice, wxControl, "wx/choice.h") - -wxBEGIN_PROPERTIES_TABLE(wxChoice) -wxEVENT_PROPERTY( Select, wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEvent ) - -wxPROPERTY( Font, wxFont, SetFont, GetFont , wxEMPTY_PARAMETER_VALUE, \ - 0 /*flags*/, wxT("Helpstring"), wxT("group")) -wxPROPERTY_COLLECTION( Choices, wxArrayString, wxString, AppendString, \ - GetStrings, 0 /*flags*/, wxT("Helpstring"), wxT("group")) -wxPROPERTY( Selection,int, SetSelection, GetSelection, wxEMPTY_PARAMETER_VALUE, \ - 0 /*flags*/, wxT("Helpstring"), wxT("group")) - -/* - TODO PROPERTIES - selection (long) - content (list) - item - */ - -wxPROPERTY_FLAGS( WindowStyle, wxChoiceStyle, long, SetWindowStyleFlag, \ - GetWindowStyleFlag, wxEMPTY_PARAMETER_VALUE, 0 /*flags*/, \ - wxT("Helpstring"), wxT("group")) // style -wxEND_PROPERTIES_TABLE() - -wxEMPTY_HANDLERS_TABLE(wxChoice) - -wxCONSTRUCTOR_4( wxChoice, wxWindow*, Parent, wxWindowID, Id, \ - wxPoint, Position, wxSize, Size ) +const wxChar wxChoiceNameStr[] = wxT("choice"); // ============================================================================ // implementation @@ -110,7 +49,7 @@ wxChoiceBase::~wxChoiceBase() void wxChoiceBase::Command(wxCommandEvent& event) { SetSelection(event.GetInt()); - (void)GetEventHandler()->ProcessEvent(event); + (void)ProcessEvent(event); } #endif // wxUSE_CHOICE diff --git a/Source/3rd Party/wx/src/common/clipcmn.cpp b/Source/3rd Party/wx/src/common/clipcmn.cpp index b32f1b604..d4912cf8e 100644 --- a/Source/3rd Party/wx/src/common/clipcmn.cpp +++ b/Source/3rd Party/wx/src/common/clipcmn.cpp @@ -4,7 +4,7 @@ // Author: Robert Roebling // Modified by: // Created: 28.06.99 -// RCS-ID: $Id$ +// RCS-ID: $Id: clipcmn.cpp 40943 2006-08-31 19:31:43Z ABX $ // Copyright: (c) Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -29,45 +29,9 @@ #include "wx/clipbrd.h" #ifndef WX_PRECOMP - #include "wx/dataobj.h" #include "wx/module.h" #endif -// --------------------------------------------------------- -// wxClipboardEvent -// --------------------------------------------------------- - -IMPLEMENT_DYNAMIC_CLASS(wxClipboardEvent,wxEvent) - -wxDEFINE_EVENT( wxEVT_CLIPBOARD_CHANGED, wxClipboardEvent ); - -bool wxClipboardEvent::SupportsFormat( const wxDataFormat &format ) const -{ -#ifdef __WXGTK20__ - for (wxVector::size_type n = 0; n < m_formats.size(); n++) - { - if (m_formats[n] == format) - return true; - } - - return false; -#else - // All other ports just query the clipboard directly - // from here - wxClipboard* clipboard = (wxClipboard*) GetEventObject(); - return clipboard->IsSupported( format ); -#endif -} - -void wxClipboardEvent::AddFormat(const wxDataFormat& format) -{ - m_formats.push_back( format ); -} - -// --------------------------------------------------------- -// wxClipboardBase -// --------------------------------------------------------- - static wxClipboard *gs_clipboard = NULL; /*static*/ wxClipboard *wxClipboardBase::Get() @@ -79,19 +43,6 @@ static wxClipboard *gs_clipboard = NULL; return gs_clipboard; } -bool wxClipboardBase::IsSupportedAsync( wxEvtHandler *sink ) -{ - // We just imitate an asynchronous API on most platforms. - // This method is overridden uner GTK. - wxClipboardEvent *event = new wxClipboardEvent(wxEVT_CLIPBOARD_CHANGED); - event->SetEventObject( this ); - - sink->QueueEvent( event ); - - return true; -} - - // ---------------------------------------------------------------------------- // wxClipboardModule: module responsible for destroying the global clipboard // object diff --git a/Source/3rd Party/wx/src/common/clntdata.cpp b/Source/3rd Party/wx/src/common/clntdata.cpp index 3467d7fe6..f097259f8 100644 --- a/Source/3rd Party/wx/src/common/clntdata.cpp +++ b/Source/3rd Party/wx/src/common/clntdata.cpp @@ -1,10 +1,10 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: src/common/clntdata.cpp +// Name: common/clntdata.cpp // Purpose: A mixin class for holding a wxClientData or void pointer // Author: Robin Dunn // Modified by: // Created: 9-Oct-2001 -// RCS-ID: $Id$ +// RCS-ID: $Id: clntdata.cpp 35650 2005-09-23 12:56:45Z MR $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// diff --git a/Source/3rd Party/wx/src/common/clrpickercmn.cpp b/Source/3rd Party/wx/src/common/clrpickercmn.cpp index 1b63161c7..b62f6fc2b 100644 --- a/Source/3rd Party/wx/src/common/clrpickercmn.cpp +++ b/Source/3rd Party/wx/src/common/clrpickercmn.cpp @@ -4,7 +4,7 @@ // Author: Francesco Montorsi (readapted code written by Vadim Zeitlin) // Modified by: // Created: 15/04/2006 -// RCS-ID: $Id$ +// RCS-ID: $Id: clrpickercmn.cpp 42219 2006-10-21 19:53:05Z PC $ // Copyright: (c) Vadim Zeitlin, Francesco Montorsi // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -32,14 +32,14 @@ #include "wx/textctrl.h" #endif -const char wxColourPickerCtrlNameStr[] = "colourpicker"; -const char wxColourPickerWidgetNameStr[] = "colourpickerwidget"; +const wxChar wxColourPickerCtrlNameStr[] = wxT("colourpicker"); +const wxChar wxColourPickerWidgetNameStr[] = wxT("colourpickerwidget"); // ============================================================================ // implementation // ============================================================================ -wxDEFINE_EVENT(wxEVT_COMMAND_COLOURPICKER_CHANGED, wxColourPickerEvent); +DEFINE_EVENT_TYPE(wxEVT_COMMAND_COLOURPICKER_CHANGED) IMPLEMENT_DYNAMIC_CLASS(wxColourPickerCtrl, wxPickerBase) IMPLEMENT_DYNAMIC_CLASS(wxColourPickerEvent, wxEvent) @@ -84,7 +84,7 @@ void wxColourPickerCtrl::SetColour(const wxColour &col) bool wxColourPickerCtrl::SetColour(const wxString &text) { wxColour col(text); // smart wxString->wxColour conversion - if ( !col.IsOk() ) + if ( !col.Ok() ) return false; M_PICKER->SetColour(col); UpdateTextCtrlFromPicker(); @@ -105,7 +105,7 @@ void wxColourPickerCtrl::UpdatePickerFromTextCtrl() // wxString -> wxColour conversion wxColour col(m_text->GetValue()); - if ( !col.IsOk() ) + if ( !col.Ok() ) return; // invalid user input if (M_PICKER->GetColour() != col) diff --git a/Source/3rd Party/wx/src/common/cmdline.cpp b/Source/3rd Party/wx/src/common/cmdline.cpp index 4356126d6..f0022b0ac 100644 --- a/Source/3rd Party/wx/src/common/cmdline.cpp +++ b/Source/3rd Party/wx/src/common/cmdline.cpp @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 05.01.00 -// RCS-ID: $Id$ +// RCS-ID: $Id: cmdline.cpp 66920 2011-02-16 22:00:30Z JS $ // Copyright: (c) 2000 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -37,13 +37,10 @@ #if wxUSE_CMDLINE_PARSER #include -#include // for LC_ALL #include "wx/datetime.h" #include "wx/msgout.h" #include "wx/filename.h" -#include "wx/apptrait.h" -#include "wx/scopeguard.h" // ---------------------------------------------------------------------------- // private functions @@ -51,15 +48,11 @@ static wxString GetTypeName(wxCmdLineParamType type); -static wxString GetOptionName(wxString::const_iterator p, - wxString::const_iterator end, - const wxChar *allowedChars); +static wxString GetOptionName(const wxChar *p, const wxChar *allowedChars); -static wxString GetShortOptionName(wxString::const_iterator p, - wxString::const_iterator end); +static wxString GetShortOptionName(const wxChar *p); -static wxString GetLongOptionName(wxString::const_iterator p, - wxString::const_iterator end); +static wxString GetLongOptionName(const wxChar *p); // ---------------------------------------------------------------------------- // private structs @@ -75,27 +68,21 @@ struct wxCmdLineOption wxCmdLineParamType typ, int fl) { - // wxCMD_LINE_USAGE_TEXT uses only description, shortName and longName is empty - if ( k != wxCMD_LINE_USAGE_TEXT ) - { - wxASSERT_MSG - ( - !shrt.empty() || !lng.empty(), - wxT("option should have at least one name") - ); + wxASSERT_MSG( !shrt.empty() || !lng.empty(), + _T("option should have at least one name") ); - wxASSERT_MSG + wxASSERT_MSG ( - GetShortOptionName(shrt.begin(), shrt.end()).Len() == shrt.Len(), + GetShortOptionName(shrt).Len() == shrt.Len(), wxT("Short option contains invalid characters") ); - wxASSERT_MSG + wxASSERT_MSG ( - GetLongOptionName(lng.begin(), lng.end()).Len() == lng.Len(), + GetLongOptionName(lng).Len() == lng.Len(), wxT("Long option contains invalid characters") ); - } + kind = k; @@ -106,7 +93,7 @@ struct wxCmdLineOption type = typ; flags = fl; - Reset(); + m_hasVal = false; } // can't use union easily here, so just store all possible data fields, we @@ -116,11 +103,9 @@ struct wxCmdLineOption void Check(wxCmdLineParamType WXUNUSED_UNLESS_DEBUG(typ)) const { - wxASSERT_MSG( type == typ, wxT("type mismatch in wxCmdLineOption") ); + wxASSERT_MSG( type == typ, _T("type mismatch in wxCmdLineOption") ); } - double GetDoubleVal() const - { Check(wxCMD_LINE_VAL_DOUBLE); return m_doubleVal; } long GetLongVal() const { Check(wxCMD_LINE_VAL_NUMBER); return m_longVal; } const wxString& GetStrVal() const @@ -130,8 +115,6 @@ struct wxCmdLineOption { Check(wxCMD_LINE_VAL_DATE); return m_dateVal; } #endif // wxUSE_DATETIME - void SetDoubleVal(double val) - { Check(wxCMD_LINE_VAL_DOUBLE); m_doubleVal = val; m_hasVal = true; } void SetLongVal(long val) { Check(wxCMD_LINE_VAL_NUMBER); m_longVal = val; m_hasVal = true; } void SetStrVal(const wxString& val) @@ -141,19 +124,9 @@ struct wxCmdLineOption { Check(wxCMD_LINE_VAL_DATE); m_dateVal = val; m_hasVal = true; } #endif // wxUSE_DATETIME - void SetHasValue() { m_hasVal = true; } + void SetHasValue(bool hasValue = true) { m_hasVal = hasValue; } bool HasValue() const { return m_hasVal; } - void SetNegated() { m_isNegated = true; } - bool IsNegated() const { return m_isNegated; } - - // Reset to the initial state, called before parsing another command line. - void Reset() - { - m_hasVal = - m_isNegated = false; - } - public: wxCmdLineEntryType kind; wxString shortName, @@ -164,9 +137,7 @@ public: private: bool m_hasVal; - bool m_isNegated; - double m_doubleVal; long m_longVal; wxString m_strVal; #if wxUSE_DATETIME @@ -208,7 +179,7 @@ struct wxCmdLineParserData // cmd line data wxArrayString m_arguments; // == argv, argc == m_arguments.GetCount() - wxArrayOptions m_options; // all possible options and switches + wxArrayOptions m_options; // all possible options and switchrs wxArrayParams m_paramDesc; // description of all possible params wxArrayString m_parameters; // all params found @@ -217,7 +188,6 @@ struct wxCmdLineParserData void SetArguments(int argc, char **argv); #if wxUSE_UNICODE void SetArguments(int argc, wxChar **argv); - void SetArguments(int argc, const wxCmdLineArgsArray& argv); #endif // wxUSE_UNICODE void SetArguments(const wxString& cmdline); @@ -237,51 +207,19 @@ wxCmdLineParserData::wxCmdLineParserData() { m_enableLongOptions = true; #ifdef __UNIX_LIKE__ - m_switchChars = wxT("-"); + m_switchChars = _T("-"); #else // !Unix - m_switchChars = wxT("/-"); + m_switchChars = _T("/-"); #endif } -namespace -{ - -// Small helper function setting locale for all categories. -// -// We define it because wxSetlocale() can't be easily used with wxScopeGuard as -// it has several overloads -- while this one can. -inline char *SetAllLocaleFacets(const char *loc) -{ - return wxSetlocale(LC_ALL, loc); -} - -} // private namespace - void wxCmdLineParserData::SetArguments(int argc, char **argv) { m_arguments.clear(); - // Command-line arguments are supposed to be in the user locale encoding - // (what else?) but wxLocale probably wasn't initialized yet as we're - // called early during the program startup and so our locale might not have - // been set from the environment yet. To work around this problem we - // temporarily change the locale here. The only drawback is that changing - // the locale is thread-unsafe but precisely because we're called so early - // it's hopefully safe to assume that no other threads had been created yet. - char * const locOld = SetAllLocaleFacets(""); - wxON_BLOCK_EXIT1( SetAllLocaleFacets, locOld ); - for ( int n = 0; n < argc; n++ ) { - // try to interpret the string as being in the current locale - wxString arg(argv[n]); - - // but just in case we guessed wrongly and the conversion failed, do - // try to salvage at least something - if ( arg.empty() && argv[n][0] != '\0' ) - arg = wxString(argv[n], wxConvISO8859_1); - - m_arguments.push_back(arg); + m_arguments.push_back(wxString::FromAscii(argv[n])); } } @@ -297,12 +235,6 @@ void wxCmdLineParserData::SetArguments(int argc, wxChar **argv) } } -void wxCmdLineParserData::SetArguments(int WXUNUSED(argc), - const wxCmdLineArgsArray& argv) -{ - m_arguments = argv.GetArguments(); -} - #endif // wxUSE_UNICODE void wxCmdLineParserData::SetArguments(const wxString& cmdLine) @@ -373,11 +305,6 @@ void wxCmdLineParser::SetCmdLine(int argc, wxChar **argv) m_data->SetArguments(argc, argv); } -void wxCmdLineParser::SetCmdLine(int argc, const wxCmdLineArgsArray& argv) -{ - m_data->SetArguments(argc, argv); -} - #endif // wxUSE_UNICODE void wxCmdLineParser::SetCmdLine(const wxString& cmdline) @@ -404,7 +331,7 @@ void wxCmdLineParser::EnableLongOptions(bool enable) m_data->m_enableLongOptions = enable; } -bool wxCmdLineParser::AreLongOptionsEnabled() const +bool wxCmdLineParser::AreLongOptionsEnabled() { return m_data->m_enableLongOptions; } @@ -425,28 +352,21 @@ void wxCmdLineParser::SetDesc(const wxCmdLineEntryDesc *desc) switch ( desc->kind ) { case wxCMD_LINE_SWITCH: - AddSwitch(desc->shortName, desc->longName, - wxGetTranslation(desc->description), + AddSwitch(desc->shortName, desc->longName, desc->description, desc->flags); break; case wxCMD_LINE_OPTION: - AddOption(desc->shortName, desc->longName, - wxGetTranslation(desc->description), + AddOption(desc->shortName, desc->longName, desc->description, desc->type, desc->flags); break; case wxCMD_LINE_PARAM: - AddParam(wxGetTranslation(desc->description), - desc->type, desc->flags); - break; - - case wxCMD_LINE_USAGE_TEXT: - AddUsageText(wxGetTranslation(desc->description)); + AddParam(desc->description, desc->type, desc->flags); break; default: - wxFAIL_MSG( wxT("unknown command line entry type") ); + wxFAIL_MSG( _T("unknown command line entry type") ); // still fall through case wxCMD_LINE_NONE: @@ -461,7 +381,7 @@ void wxCmdLineParser::AddSwitch(const wxString& shortName, int flags) { wxASSERT_MSG( m_data->FindOption(shortName) == wxNOT_FOUND, - wxT("duplicate switch") ); + _T("duplicate switch") ); wxCmdLineOption *option = new wxCmdLineOption(wxCMD_LINE_SWITCH, shortName, longName, desc, @@ -477,7 +397,7 @@ void wxCmdLineParser::AddOption(const wxString& shortName, int flags) { wxASSERT_MSG( m_data->FindOption(shortName) == wxNOT_FOUND, - wxT("duplicate option") ); + _T("duplicate option") ); wxCmdLineOption *option = new wxCmdLineOption(wxCMD_LINE_OPTION, shortName, longName, desc, @@ -492,60 +412,44 @@ void wxCmdLineParser::AddParam(const wxString& desc, { // do some consistency checks: a required parameter can't follow an // optional one and nothing should follow a parameter with MULTIPLE flag -#if wxDEBUG_LEVEL +#ifdef __WXDEBUG__ if ( !m_data->m_paramDesc.IsEmpty() ) { wxCmdLineParam& param = m_data->m_paramDesc.Last(); wxASSERT_MSG( !(param.flags & wxCMD_LINE_PARAM_MULTIPLE), - wxT("all parameters after the one with wxCMD_LINE_PARAM_MULTIPLE style will be ignored") ); + _T("all parameters after the one with wxCMD_LINE_PARAM_MULTIPLE style will be ignored") ); if ( !(flags & wxCMD_LINE_PARAM_OPTIONAL) ) { wxASSERT_MSG( !(param.flags & wxCMD_LINE_PARAM_OPTIONAL), - wxT("a required parameter can't follow an optional one") ); + _T("a required parameter can't follow an optional one") ); } } -#endif // wxDEBUG_LEVEL +#endif // Debug wxCmdLineParam *param = new wxCmdLineParam(desc, type, flags); m_data->m_paramDesc.Add(param); } -void wxCmdLineParser::AddUsageText(const wxString& text) -{ - wxASSERT_MSG( !text.empty(), wxT("text can't be empty") ); - - wxCmdLineOption *option = new wxCmdLineOption(wxCMD_LINE_USAGE_TEXT, - wxEmptyString, wxEmptyString, - text, wxCMD_LINE_VAL_NONE, 0); - - m_data->m_options.Add(option); -} - // ---------------------------------------------------------------------------- // access to parse command line // ---------------------------------------------------------------------------- bool wxCmdLineParser::Found(const wxString& name) const -{ - return FoundSwitch(name) != wxCMD_SWITCH_NOT_FOUND; -} - -wxCmdLineSwitchState wxCmdLineParser::FoundSwitch(const wxString& name) const { int i = m_data->FindOption(name); if ( i == wxNOT_FOUND ) i = m_data->FindOptionByLongName(name); - wxCHECK_MSG( i != wxNOT_FOUND, wxCMD_SWITCH_NOT_FOUND, wxT("unknown switch") ); + wxCHECK_MSG( i != wxNOT_FOUND, false, _T("unknown switch") ); wxCmdLineOption& opt = m_data->m_options[(size_t)i]; if ( !opt.HasValue() ) - return wxCMD_SWITCH_NOT_FOUND; + return false; - return opt.IsNegated() ? wxCMD_SWITCH_OFF : wxCMD_SWITCH_ON; + return true; } bool wxCmdLineParser::Found(const wxString& name, wxString *value) const @@ -554,13 +458,13 @@ bool wxCmdLineParser::Found(const wxString& name, wxString *value) const if ( i == wxNOT_FOUND ) i = m_data->FindOptionByLongName(name); - wxCHECK_MSG( i != wxNOT_FOUND, false, wxT("unknown option") ); + wxCHECK_MSG( i != wxNOT_FOUND, false, _T("unknown option") ); wxCmdLineOption& opt = m_data->m_options[(size_t)i]; if ( !opt.HasValue() ) return false; - wxCHECK_MSG( value, false, wxT("NULL pointer in wxCmdLineOption::Found") ); + wxCHECK_MSG( value, false, _T("NULL pointer in wxCmdLineOption::Found") ); *value = opt.GetStrVal(); @@ -573,38 +477,19 @@ bool wxCmdLineParser::Found(const wxString& name, long *value) const if ( i == wxNOT_FOUND ) i = m_data->FindOptionByLongName(name); - wxCHECK_MSG( i != wxNOT_FOUND, false, wxT("unknown option") ); + wxCHECK_MSG( i != wxNOT_FOUND, false, _T("unknown option") ); wxCmdLineOption& opt = m_data->m_options[(size_t)i]; if ( !opt.HasValue() ) return false; - wxCHECK_MSG( value, false, wxT("NULL pointer in wxCmdLineOption::Found") ); + wxCHECK_MSG( value, false, _T("NULL pointer in wxCmdLineOption::Found") ); *value = opt.GetLongVal(); return true; } -bool wxCmdLineParser::Found(const wxString& name, double *value) const -{ - int i = m_data->FindOption(name); - if ( i == wxNOT_FOUND ) - i = m_data->FindOptionByLongName(name); - - wxCHECK_MSG( i != wxNOT_FOUND, false, wxT("unknown option") ); - - wxCmdLineOption& opt = m_data->m_options[(size_t)i]; - if ( !opt.HasValue() ) - return false; - - wxCHECK_MSG( value, false, wxT("NULL pointer in wxCmdLineOption::Found") ); - - *value = opt.GetDoubleVal(); - - return true; -} - #if wxUSE_DATETIME bool wxCmdLineParser::Found(const wxString& name, wxDateTime *value) const { @@ -612,13 +497,13 @@ bool wxCmdLineParser::Found(const wxString& name, wxDateTime *value) const if ( i == wxNOT_FOUND ) i = m_data->FindOptionByLongName(name); - wxCHECK_MSG( i != wxNOT_FOUND, false, wxT("unknown option") ); + wxCHECK_MSG( i != wxNOT_FOUND, false, _T("unknown option") ); wxCmdLineOption& opt = m_data->m_options[(size_t)i]; if ( !opt.HasValue() ) return false; - wxCHECK_MSG( value, false, wxT("NULL pointer in wxCmdLineOption::Found") ); + wxCHECK_MSG( value, false, _T("NULL pointer in wxCmdLineOption::Found") ); *value = opt.GetDateVal(); @@ -633,7 +518,7 @@ size_t wxCmdLineParser::GetParamCount() const wxString wxCmdLineParser::GetParam(size_t n) const { - wxCHECK_MSG( n < GetParamCount(), wxEmptyString, wxT("invalid param index") ); + wxCHECK_MSG( n < GetParamCount(), wxEmptyString, _T("invalid param index") ); return m_data->m_parameters[n]; } @@ -641,9 +526,10 @@ wxString wxCmdLineParser::GetParam(size_t n) const // Resets switches and options void wxCmdLineParser::Reset() { - for ( size_t i = 0; i < m_data->m_options.GetCount(); i++ ) + for ( size_t i = 0; i < m_data->m_options.Count(); i++ ) { - m_data->m_options[i].Reset(); + wxCmdLineOption& opt = m_data->m_options[i]; + opt.SetHasValue(false); } } @@ -676,7 +562,7 @@ int wxCmdLineParser::Parse(bool showUsage) // special case: "--" should be discarded and all following arguments // should be considered as parameters, even if they start with '-' and // not like options (this is POSIX-like) - if ( arg == wxT("--") ) + if ( arg == _T("--") ) { maybeOption = false; @@ -685,67 +571,32 @@ int wxCmdLineParser::Parse(bool showUsage) // empty argument or just '-' is not an option but a parameter if ( maybeOption && arg.length() > 1 && - // FIXME-UTF8: use wc_str() after removing ANSI build - wxStrchr(m_data->m_switchChars.c_str(), arg[0u]) ) + wxStrchr(m_data->m_switchChars, arg[0u]) ) { bool isLong; wxString name; int optInd = wxNOT_FOUND; // init to suppress warnings // an option or a switch: find whether it's a long or a short one - if ( arg.length() >= 3 && arg[0u] == wxT('-') && arg[1u] == wxT('-') ) + if ( arg[0u] == _T('-') && arg[1u] == _T('-') ) { // a long one isLong = true; // Skip leading "--" - wxString::const_iterator p = arg.begin() + 2; + const wxChar *p = arg.c_str() + 2; bool longOptionsEnabled = AreLongOptionsEnabled(); - name = GetLongOptionName(p, arg.end()); + name = GetLongOptionName(p); if (longOptionsEnabled) { - wxString errorOpt; - optInd = m_data->FindOptionByLongName(name); if ( optInd == wxNOT_FOUND ) { - // Check if this could be a negatable long option. - if ( name.Last() == '-' ) - { - name.RemoveLast(); - - optInd = m_data->FindOptionByLongName(name); - if ( optInd != wxNOT_FOUND ) - { - if ( !(m_data->m_options[optInd].flags & - wxCMD_LINE_SWITCH_NEGATABLE) ) - { - errorOpt.Printf - ( - _("Option '%s' can't be negated"), - name - ); - optInd = wxNOT_FOUND; - } - } - } - - if ( optInd == wxNOT_FOUND ) - { - if ( errorOpt.empty() ) - { - errorOpt.Printf - ( - _("Unknown long option '%s'"), - name - ); - } - - errorMsg << errorOpt << wxT('\n'); - } + errorMsg << wxString::Format(_("Unknown long option '%s'"), name.c_str()) + << _T('\n'); } } else @@ -755,7 +606,7 @@ int wxCmdLineParser::Parse(bool showUsage) // Print the argument including leading "--" name.Prepend( wxT("--") ); errorMsg << wxString::Format(_("Unknown option '%s'"), name.c_str()) - << wxT('\n'); + << _T('\n'); } } @@ -765,9 +616,9 @@ int wxCmdLineParser::Parse(bool showUsage) // a short one: as they can be cumulated, we try to find the // longest substring which is a valid option - wxString::const_iterator p = arg.begin() + 1; + const wxChar *p = arg.c_str() + 1; - name = GetShortOptionName(p, arg.end()); + name = GetShortOptionName(p); size_t len = name.length(); do @@ -777,7 +628,7 @@ int wxCmdLineParser::Parse(bool showUsage) // we couldn't find a valid option name in the // beginning of this string errorMsg << wxString::Format(_("Unknown option '%s'"), name.c_str()) - << wxT('\n'); + << _T('\n'); break; } @@ -804,14 +655,6 @@ int wxCmdLineParser::Parse(bool showUsage) if ( m_data->m_options[(size_t)optInd].kind == wxCMD_LINE_SWITCH ) { - // if the switch is negatable and it is just followed - // by '-' the '-' is considered to be part of this - // switch - if ( (m_data->m_options[(size_t)optInd].flags & - wxCMD_LINE_SWITCH_NEGATABLE) && - arg[len] == '-' ) - ++len; - // pretend that all the rest of the argument is the // next argument, in fact wxString arg2 = arg[0u]; @@ -820,10 +663,6 @@ int wxCmdLineParser::Parse(bool showUsage) m_data->m_arguments.insert (m_data->m_arguments.begin() + n + 1, arg2); count++; - - // only leave the part which wasn't extracted into the - // next argument in this one - arg = arg.Left(len + 1); } //else: it's our value, we'll deal with it below } @@ -839,31 +678,24 @@ int wxCmdLineParser::Parse(bool showUsage) // look at what follows: // +1 for leading '-' - wxString::const_iterator p = arg.begin() + 1 + name.length(); - wxString::const_iterator end = arg.end(); - + const wxChar *p = arg.c_str() + 1 + name.length(); if ( isLong ) - ++p; // for another leading '-' + p++; // for another leading '-' wxCmdLineOption& opt = m_data->m_options[(size_t)optInd]; if ( opt.kind == wxCMD_LINE_SWITCH ) { // we must check that there is no value following the switch - bool negated = (opt.flags & wxCMD_LINE_SWITCH_NEGATABLE) && - p != arg.end() && *p == '-'; - - if ( !negated && p != arg.end() ) + if ( *p != _T('\0') ) { errorMsg << wxString::Format(_("Unexpected characters following option '%s'."), name.c_str()) - << wxT('\n'); + << _T('\n'); ok = false; } else // no value, as expected { // nothing more to do opt.SetHasValue(); - if ( negated ) - opt.SetNegated(); if ( opt.flags & wxCMD_LINE_OPTION_HELP ) { @@ -876,53 +708,66 @@ int wxCmdLineParser::Parse(bool showUsage) } else // it's an option. not a switch { - switch ( p == end ? '\0' : (*p).GetValue() ) + // get the value + if ( isLong ) { - case '=': - case ':': - // the value follows - ++p; - break; + if ( *p++ != _T('=') ) + { + errorMsg << wxString::Format(_("Option '%s' requires a value, '=' expected."), name.c_str()) + << _T('\n'); - case '\0': - // the value is in the next argument - if ( ++n == count ) - { - // ... but there is none - errorMsg << wxString::Format(_("Option '%s' requires a value."), - name.c_str()) - << wxT('\n'); + ok = false; + } + } + else // short option + { + switch ( *p ) + { + case _T('='): + case _T(':'): + // the value follows + p++; + break; - ok = false; - } - else - { - // ... take it from there - p = m_data->m_arguments[n].begin(); - end = m_data->m_arguments[n].end(); - } - break; + case 0: + // the value is in the next argument + if ( ++n == count ) + { + // ... but there is none + errorMsg << wxString::Format(_("Option '%s' requires a value."), + name.c_str()) + << _T('\n'); - default: - // the value is right here: this may be legal or - // not depending on the option style - if ( opt.flags & wxCMD_LINE_NEEDS_SEPARATOR ) - { - errorMsg << wxString::Format(_("Separator expected after the option '%s'."), - name.c_str()) - << wxT('\n'); + ok = false; + } + else + { + // ... take it from there + p = m_data->m_arguments[n].c_str(); + } + break; - ok = false; - } + default: + // the value is right here: this may be legal or + // not depending on the option style + if ( opt.flags & wxCMD_LINE_NEEDS_SEPARATOR ) + { + errorMsg << wxString::Format(_("Separator expected after the option '%s'."), + name.c_str()) + << _T('\n'); + + ok = false; + } + } } if ( ok ) { - wxString value(p, end); + wxString value = p; switch ( opt.type ) { default: - wxFAIL_MSG( wxT("unknown option type") ); + wxFAIL_MSG( _T("unknown option type") ); // still fall through case wxCMD_LINE_VAL_STRING: @@ -940,25 +785,7 @@ int wxCmdLineParser::Parse(bool showUsage) { errorMsg << wxString::Format(_("'%s' is not a correct numeric value for option '%s'."), value.c_str(), name.c_str()) - << wxT('\n'); - - ok = false; - } - } - break; - - case wxCMD_LINE_VAL_DOUBLE: - { - double val; - if ( value.ToDouble(&val) ) - { - opt.SetDoubleVal(val); - } - else - { - errorMsg << wxString::Format(_("'%s' is not a correct numeric value for option '%s'."), - value.c_str(), name.c_str()) - << wxT('\n'); + << _T('\n'); ok = false; } @@ -969,12 +796,12 @@ int wxCmdLineParser::Parse(bool showUsage) case wxCMD_LINE_VAL_DATE: { wxDateTime dt; - wxString::const_iterator end; - if ( !dt.ParseDate(value, &end) || end != value.end() ) + const wxChar *res = dt.ParseDate(value); + if ( !res || *res ) { errorMsg << wxString::Format(_("Option '%s': '%s' cannot be converted to a date."), name.c_str(), value.c_str()) - << wxT('\n'); + << _T('\n'); ok = false; } @@ -1006,7 +833,7 @@ int wxCmdLineParser::Parse(bool showUsage) else { wxASSERT_MSG( currentParam == countParam - 1, - wxT("all parameters after the one with wxCMD_LINE_PARAM_MULTIPLE style are ignored") ); + _T("all parameters after the one with wxCMD_LINE_PARAM_MULTIPLE style are ignored") ); // remember that we did have this last repeatable parameter hadRepeatableParam = true; @@ -1015,7 +842,7 @@ int wxCmdLineParser::Parse(bool showUsage) else { errorMsg << wxString::Format(_("Unexpected parameter '%s'"), arg.c_str()) - << wxT('\n'); + << _T('\n'); ok = false; } @@ -1053,7 +880,7 @@ int wxCmdLineParser::Parse(bool showUsage) errorMsg << wxString::Format(_("The value for the option '%s' must be specified."), optName.c_str()) - << wxT('\n'); + << _T('\n'); ok = false; } @@ -1075,7 +902,7 @@ int wxCmdLineParser::Parse(bool showUsage) { errorMsg << wxString::Format(_("The required parameter '%s' was not specified."), param.description.c_str()) - << wxT('\n'); + << _T('\n'); ok = false; } @@ -1097,7 +924,7 @@ int wxCmdLineParser::Parse(bool showUsage) } else { - wxFAIL_MSG( wxT("no wxMessageOutput object?") ); + wxFAIL_MSG( _T("no wxMessageOutput object?") ); } } @@ -1108,7 +935,7 @@ int wxCmdLineParser::Parse(bool showUsage) // give the usage message // ---------------------------------------------------------------------------- -void wxCmdLineParser::Usage() const +void wxCmdLineParser::Usage() { wxMessageOutput* msgOut = wxMessageOutput::Get(); if ( msgOut ) @@ -1117,21 +944,20 @@ void wxCmdLineParser::Usage() const } else { - wxFAIL_MSG( wxT("no wxMessageOutput object?") ); + wxFAIL_MSG( _T("no wxMessageOutput object?") ); } } -wxString wxCmdLineParser::GetUsageString() const +wxString wxCmdLineParser::GetUsageString() { wxString appname; - if ( m_data->m_arguments.empty() ) + if ( wxTheApp ) { - if ( wxTheApp ) - appname = wxTheApp->GetAppName(); + appname = wxFileName(wxTheApp->argv[0]).GetFullName(); } - else // use argv[0] + else if (!m_data->m_arguments.empty() ) { - appname = wxFileName(m_data->m_arguments[0]).GetName(); + appname = wxFileName(m_data->m_arguments[0]).GetFullName(); } // we construct the brief cmd line desc on the fly, but not the detailed @@ -1142,14 +968,14 @@ wxString wxCmdLineParser::GetUsageString() const if ( !m_data->m_logo.empty() ) { - usage << m_data->m_logo << wxT('\n'); + usage << m_data->m_logo << _T('\n'); } usage << wxString::Format(_("Usage: %s"), appname.c_str()); // the switch char is usually '-' but this can be changed with // SetSwitchChars() and then the first one of possible chars is used - wxChar chSwitch = !m_data->m_switchChars ? wxT('-') + wxChar chSwitch = !m_data->m_switchChars ? _T('-') : m_data->m_switchChars[0u]; bool areLongOptionsEnabled = AreLongOptionsEnabled(); @@ -1157,63 +983,58 @@ wxString wxCmdLineParser::GetUsageString() const for ( n = 0; n < count; n++ ) { wxCmdLineOption& opt = m_data->m_options[n]; - wxString option, negator; - if ( opt.kind != wxCMD_LINE_USAGE_TEXT ) + usage << _T(' '); + if ( !(opt.flags & wxCMD_LINE_OPTION_MANDATORY) ) { - usage << wxT(' '); - if ( !(opt.flags & wxCMD_LINE_OPTION_MANDATORY) ) - { - usage << wxT('['); - } + usage << _T('['); + } - if ( opt.flags & wxCMD_LINE_SWITCH_NEGATABLE ) - negator = wxT("[-]"); - - if ( !opt.shortName.empty() ) + if ( !opt.shortName.empty() ) + { + usage << chSwitch << opt.shortName; + } + else if ( areLongOptionsEnabled && !opt.longName.empty() ) + { + usage << _T("--") << opt.longName; + } + else + { + if (!opt.longName.empty()) { - usage << chSwitch << opt.shortName << negator; - } - else if ( areLongOptionsEnabled && !opt.longName.empty() ) - { - usage << wxT("--") << opt.longName << negator; + wxFAIL_MSG( wxT("option with only a long name while long ") + wxT("options are disabled") ); } else { - if (!opt.longName.empty()) - { - wxFAIL_MSG( wxT("option with only a long name while long ") - wxT("options are disabled") ); - } - else - { - wxFAIL_MSG( wxT("option without neither short nor long name") ); - } + wxFAIL_MSG( _T("option without neither short nor long name") ); } + } - if ( !opt.shortName.empty() ) - { - option << wxT(" ") << chSwitch << opt.shortName; - } + wxString option; - if ( areLongOptionsEnabled && !opt.longName.empty() ) - { - option << (option.empty() ? wxT(" ") : wxT(", ")) - << wxT("--") << opt.longName; - } + if ( !opt.shortName.empty() ) + { + option << _T(" ") << chSwitch << opt.shortName; + } - if ( opt.kind != wxCMD_LINE_SWITCH ) - { - wxString val; - val << wxT('<') << GetTypeName(opt.type) << wxT('>'); - usage << wxT(' ') << val; - option << (!opt.longName ? wxT(':') : wxT('=')) << val; - } + if ( areLongOptionsEnabled && !opt.longName.empty() ) + { + option << (option.empty() ? _T(" ") : _T(", ")) + << _T("--") << opt.longName; + } - if ( !(opt.flags & wxCMD_LINE_OPTION_MANDATORY) ) - { - usage << wxT(']'); - } + if ( opt.kind != wxCMD_LINE_SWITCH ) + { + wxString val; + val << _T('<') << GetTypeName(opt.type) << _T('>'); + usage << _T(' ') << val; + option << (!opt.longName ? _T(':') : _T('=')) << val; + } + + if ( !(opt.flags & wxCMD_LINE_OPTION_MANDATORY) ) + { + usage << _T(']'); } namesOptions.push_back(option); @@ -1225,63 +1046,44 @@ wxString wxCmdLineParser::GetUsageString() const { wxCmdLineParam& param = m_data->m_paramDesc[n]; - usage << wxT(' '); + usage << _T(' '); if ( param.flags & wxCMD_LINE_PARAM_OPTIONAL ) { - usage << wxT('['); + usage << _T('['); } usage << param.description; if ( param.flags & wxCMD_LINE_PARAM_MULTIPLE ) { - usage << wxT("..."); + usage << _T("..."); } if ( param.flags & wxCMD_LINE_PARAM_OPTIONAL ) { - usage << wxT(']'); + usage << _T(']'); } } - usage << wxT('\n'); - - // set to number of our own options, not counting the standard ones - count = namesOptions.size(); - - // get option names & descriptions for standard options, if any: - wxAppTraits *traits = wxTheApp ? wxTheApp->GetTraits() : NULL; - wxString stdDesc; - if ( traits ) - stdDesc = traits->GetStandardCmdLineOptions(namesOptions, descOptions); + usage << _T('\n'); // now construct the detailed help message size_t len, lenMax = 0; - for ( n = 0; n < namesOptions.size(); n++ ) + count = namesOptions.size(); + for ( n = 0; n < count; n++ ) { len = namesOptions[n].length(); if ( len > lenMax ) lenMax = len; } - for ( n = 0; n < namesOptions.size(); n++ ) + for ( n = 0; n < count; n++ ) { - if ( n == count ) - usage << wxT('\n') << stdDesc; - len = namesOptions[n].length(); - // desc contains text if name is empty - if (len == 0) - { - usage << descOptions[n] << wxT('\n'); - } - else - { - usage << namesOptions[n] - << wxString(wxT(' '), lenMax - len) << wxT('\t') - << descOptions[n] - << wxT('\n'); - } + usage << namesOptions[n] + << wxString(_T(' '), lenMax - len) << _T('\t') + << descOptions[n] + << _T('\n'); } return usage; @@ -1297,7 +1099,7 @@ static wxString GetTypeName(wxCmdLineParamType type) switch ( type ) { default: - wxFAIL_MSG( wxT("unknown option type") ); + wxFAIL_MSG( _T("unknown option type") ); // still fall through case wxCMD_LINE_VAL_STRING: @@ -1308,10 +1110,6 @@ static wxString GetTypeName(wxCmdLineParamType type) s = _("num"); break; - case wxCMD_LINE_VAL_DOUBLE: - s = _("double"); - break; - case wxCMD_LINE_VAL_DATE: s = _("date"); break; @@ -1329,13 +1127,12 @@ the parameter allowedChars. For example, if p points to "abcde-@-_", and allowedChars is "-_", this function returns "abcde-". */ -static wxString GetOptionName(wxString::const_iterator p, - wxString::const_iterator end, - const wxChar *allowedChars) +static wxString GetOptionName(const wxChar *p, + const wxChar *allowedChars) { wxString argName; - while ( p != end && (wxIsalnum(*p) || wxStrchr(allowedChars, *p)) ) + while ( *p && (wxIsalnum(*p) || wxStrchr(allowedChars, *p)) ) { argName += *p++; } @@ -1353,16 +1150,14 @@ static wxString GetOptionName(wxString::const_iterator p, #define wxCMD_LINE_CHARS_ALLOWED_BY_LONG_OPTION \ wxCMD_LINE_CHARS_ALLOWED_BY_SHORT_OPTION wxT("-") -static wxString GetShortOptionName(wxString::const_iterator p, - wxString::const_iterator end) +static wxString GetShortOptionName(const wxChar *p) { - return GetOptionName(p, end, wxCMD_LINE_CHARS_ALLOWED_BY_SHORT_OPTION); + return GetOptionName(p, wxCMD_LINE_CHARS_ALLOWED_BY_SHORT_OPTION); } -static wxString GetLongOptionName(wxString::const_iterator p, - wxString::const_iterator end) +static wxString GetLongOptionName(const wxChar *p) { - return GetOptionName(p, end, wxCMD_LINE_CHARS_ALLOWED_BY_LONG_OPTION); + return GetOptionName(p, wxCMD_LINE_CHARS_ALLOWED_BY_LONG_OPTION); } #endif // wxUSE_CMDLINE_PARSER @@ -1380,40 +1175,32 @@ static wxString GetLongOptionName(wxString::const_iterator p, */ /* static */ -wxArrayString -wxCmdLineParser::ConvertStringToArgs(const wxString& cmdline, - wxCmdLineSplitType type) +wxArrayString wxCmdLineParser::ConvertStringToArgs(const wxChar *p) { wxArrayString args; wxString arg; arg.reserve(1024); - const wxString::const_iterator end = cmdline.end(); - wxString::const_iterator p = cmdline.begin(); - + bool isInsideQuotes = false; for ( ;; ) { // skip white space - while ( p != end && (*p == ' ' || *p == '\t') ) - ++p; + while ( *p == _T(' ') || *p == _T('\t') ) + p++; // anything left? - if ( p == end ) + if ( *p == _T('\0') ) break; // parse this parameter - bool lastBS = false, - isInsideQuotes = false; - wxChar chDelim = '\0'; - for ( arg.clear(); p != end; ++p ) + bool endParam = false; + bool lastBS = false; + for ( arg.clear(); !endParam; p++ ) { - const wxChar ch = *p; - - if ( type == wxCMD_LINE_SPLIT_DOS ) + switch ( *p ) { - if ( ch == '"' ) - { + case _T('"'): if ( !lastBS ) { isInsideQuotes = !isInsideQuotes; @@ -1424,57 +1211,32 @@ wxCmdLineParser::ConvertStringToArgs(const wxString& cmdline, //else: quote has no special meaning but the backslash // still remains -- makes no sense but this is what // Windows does - } - // note that backslash does *not* quote the space, only quotes do - else if ( !isInsideQuotes && (ch == ' ' || ch == '\t') ) - { - ++p; // skip this space anyhow break; - } - lastBS = !lastBS && ch == '\\'; - } - else // type == wxCMD_LINE_SPLIT_UNIX - { - if ( !lastBS ) - { + case _T(' '): + case _T('\t'): + // backslash does *not* quote the space, only quotes do if ( isInsideQuotes ) { - if ( ch == chDelim ) - { - isInsideQuotes = false; - - continue; // don't use the quote itself - } + // skip assignment below + break; } - else // not in quotes and not escaped - { - if ( ch == '\'' || ch == '"' ) - { - isInsideQuotes = true; - chDelim = ch; + // fall through - continue; // don't use the quote itself - } + case _T('\0'): + endParam = true; - if ( ch == ' ' || ch == '\t' ) - { - ++p; // skip this space anyhow - break; - } - } - - lastBS = ch == '\\'; - if ( lastBS ) - continue; - } - else // escaped by backslash, just use as is - { - lastBS = false; - } + break; } - arg += ch; + if ( endParam ) + { + break; + } + + lastBS = !lastBS && *p == _T('\\'); + + arg += *p; } args.push_back(arg); diff --git a/Source/3rd Party/wx/src/common/cmdproc.cpp b/Source/3rd Party/wx/src/common/cmdproc.cpp index 2c869da01..0ca291a61 100644 --- a/Source/3rd Party/wx/src/common/cmdproc.cpp +++ b/Source/3rd Party/wx/src/common/cmdproc.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart (extracted from docview.h by VZ) // Modified by: // Created: 05.11.00 -// RCS-ID: $Id$ +// RCS-ID: $Id: cmdproc.cpp 65725 2010-10-02 13:05:08Z TIK $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -28,7 +28,6 @@ #include "wx/intl.h" #include "wx/string.h" #include "wx/menu.h" - #include "wx/accel.h" #endif //WX_PRECOMP #include "wx/cmdproc.h" @@ -58,13 +57,10 @@ wxCommandProcessor::wxCommandProcessor(int maxCommands) { m_maxNoCommands = maxCommands; #if wxUSE_MENUS - m_commandEditMenu = NULL; + m_commandEditMenu = (wxMenu *) NULL; #endif // wxUSE_MENUS - -#if wxUSE_ACCEL - m_undoAccelerator = '\t' + wxAcceleratorEntry(wxACCEL_CTRL, 'Z').ToString(); - m_redoAccelerator = '\t' + wxAcceleratorEntry(wxACCEL_CTRL, 'Y').ToString(); -#endif // wxUSE_ACCEL + m_undoAccelerator = wxT("\tCtrl+Z"); + m_redoAccelerator = wxT("\tCtrl+Y"); m_lastSavedCommand = m_currentCommand = wxList::compatibility_iterator(); @@ -90,7 +86,7 @@ bool wxCommandProcessor::UndoCommand(wxCommand& cmd) // storeIt is false. bool wxCommandProcessor::Submit(wxCommand *command, bool storeIt) { - wxCHECK_MSG( command, false, wxT("no command in wxCommandProcessor::Submit") ); + wxCHECK_MSG( command, false, _T("no command in wxCommandProcessor::Submit") ); if ( !DoCommand(*command) ) { @@ -110,7 +106,7 @@ bool wxCommandProcessor::Submit(wxCommand *command, bool storeIt) void wxCommandProcessor::Store(wxCommand *command) { - wxCHECK_RET( command, wxT("no command in wxCommandProcessor::Store") ); + wxCHECK_RET( command, _T("no command in wxCommandProcessor::Store") ); // Correct a bug: we must chop off the current 'branch' // so that we're at the end of the command list. @@ -122,14 +118,13 @@ void wxCommandProcessor::Store(wxCommand *command) while (node) { wxList::compatibility_iterator next = node->GetNext(); - - // Make sure m_lastSavedCommand won't point to freed memory - if ( m_lastSavedCommand && m_lastSavedCommand == node ) - m_lastSavedCommand = wxList::compatibility_iterator(); - delete (wxCommand *)node->GetData(); m_commands.Erase(node); + // Make sure m_lastSavedCommand won't point to freed memory + if ( m_lastSavedCommand == node ) + m_lastSavedCommand = wxList::compatibility_iterator(); + node = next; } } @@ -137,14 +132,13 @@ void wxCommandProcessor::Store(wxCommand *command) if ( (int)m_commands.GetCount() == m_maxNoCommands ) { wxList::compatibility_iterator firstNode = m_commands.GetFirst(); - - // Make sure m_lastSavedCommand won't point to freed memory - if ( m_lastSavedCommand && m_lastSavedCommand == firstNode ) - m_lastSavedCommand = wxList::compatibility_iterator(); - wxCommand *firstCommand = (wxCommand *)firstNode->GetData(); delete firstCommand; m_commands.Erase(firstNode); + + // Make sure m_lastSavedCommand won't point to freed memory + if ( m_lastSavedCommand == firstNode ) + m_lastSavedCommand = wxList::compatibility_iterator(); } m_commands.Append(command); @@ -170,11 +164,11 @@ bool wxCommandProcessor::Undo() bool wxCommandProcessor::Redo() { - wxCommand *redoCommand = NULL; + wxCommand *redoCommand = (wxCommand *) NULL; wxList::compatibility_iterator redoNode -#if !wxUSE_STD_CONTAINERS +#if !wxUSE_STL = NULL // just to avoid warnings -#endif // !wxUSE_STD_CONTAINERS +#endif // !wxUSE_STL ; if ( m_currentCommand ) @@ -328,28 +322,4 @@ void wxCommandProcessor::ClearCommands() m_lastSavedCommand = wxList::compatibility_iterator(); } -bool wxCommandProcessor::IsDirty() const -{ - if ( m_commands.empty() ) - { - // If we have never been modified, we can't be dirty. - return false; - } - - if ( !m_lastSavedCommand ) - { - // If we have been modified but have never been saved, we're dirty. - return true; - } - - if ( !m_currentCommand ) - { - // This only happens if all commands were undone after saving the - // document: we're dirty then. - return true; - } - - // Finally if both iterators are valid, we may just compare them. - return m_currentCommand != m_lastSavedCommand; -} diff --git a/Source/3rd Party/wx/src/common/cmndata.cpp b/Source/3rd Party/wx/src/common/cmndata.cpp index edf89d275..9dccd841b 100644 --- a/Source/3rd Party/wx/src/common/cmndata.cpp +++ b/Source/3rd Party/wx/src/common/cmndata.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: cmndata.cpp 60700 2009-05-20 13:18:11Z JS $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -24,8 +24,6 @@ #pragma hdrstop #endif -#if wxUSE_PRINTING_ARCHITECTURE - #include "wx/cmndata.h" #ifndef WX_PRECOMP @@ -42,17 +40,109 @@ #include "wx/prntbase.h" #include "wx/printdlg.h" + +#if wxUSE_FONTDLG + #include "wx/fontdlg.h" +#endif // wxUSE_FONTDLG + +#if wxUSE_PRINTING_ARCHITECTURE + #include "wx/paper.h" +#if defined(__WXMAC__) + #include "wx/mac/private/print.h" +#endif IMPLEMENT_DYNAMIC_CLASS(wxPrintData, wxObject) IMPLEMENT_DYNAMIC_CLASS(wxPrintDialogData, wxObject) IMPLEMENT_DYNAMIC_CLASS(wxPageSetupDialogData, wxObject) +#endif // wxUSE_PRINTING_ARCHITECTURE + +IMPLEMENT_DYNAMIC_CLASS(wxFontData, wxObject) +IMPLEMENT_DYNAMIC_CLASS(wxColourData, wxObject) + // ============================================================================ // implementation // ============================================================================ +// ---------------------------------------------------------------------------- +// wxColourData +// ---------------------------------------------------------------------------- + +wxColourData::wxColourData() +{ + m_chooseFull = false; + m_dataColour.Set(0,0,0); + // m_custColours are wxNullColours initially +} + +wxColourData::wxColourData(const wxColourData& data) + : wxObject() +{ + (*this) = data; +} + +wxColourData::~wxColourData() +{ +} + +void wxColourData::SetCustomColour(int i, const wxColour& colour) +{ + wxCHECK_RET( (i >= 0 && i < 16), _T("custom colour index out of range") ); + + m_custColours[i] = colour; +} + +wxColour wxColourData::GetCustomColour(int i) +{ + wxCHECK_MSG( (i >= 0 && i < 16), wxColour(0,0,0), + _T("custom colour index out of range") ); + + return m_custColours[i]; +} + +void wxColourData::operator=(const wxColourData& data) +{ + int i; + for (i = 0; i < 16; i++) + m_custColours[i] = data.m_custColours[i]; + + m_dataColour = (wxColour&)data.m_dataColour; + m_chooseFull = data.m_chooseFull; +} + +// ---------------------------------------------------------------------------- +// Font data +// ---------------------------------------------------------------------------- + +wxFontData::wxFontData() +{ + // Intialize colour to black. + m_fontColour = wxNullColour; + + m_showHelp = false; + m_allowSymbols = true; + m_enableEffects = true; + m_minSize = 0; + m_maxSize = 0; + + m_encoding = wxFONTENCODING_SYSTEM; +} + +wxFontData::~wxFontData() +{ +} + +#if wxUSE_FONTDLG + +wxFontDialogBase::~wxFontDialogBase() +{ +} + +#endif // wxUSE_FONTDLG + +#if wxUSE_PRINTING_ARCHITECTURE // ---------------------------------------------------------------------------- // Print data // ---------------------------------------------------------------------------- @@ -94,7 +184,11 @@ wxPrintData::wxPrintData(const wxPrintData& printData) void wxPrintData::SetPrivData( char *privData, int len ) { - wxDELETEA(m_privData); + if (m_privData) + { + delete [] m_privData; + m_privData = NULL; + } m_privDataLen = len; if (m_privDataLen > 0) { @@ -123,11 +217,8 @@ void wxPrintData::ConvertFromNative() m_nativeData->TransferTo( *this ) ; } -wxPrintData& wxPrintData::operator=(const wxPrintData& data) +void wxPrintData::operator=(const wxPrintData& data) { - if ( &data == this ) - return *this; - m_printNoCopies = data.m_printNoCopies; m_printCollate = data.m_printCollate; m_printOrientation = data.m_printOrientation; @@ -154,15 +245,17 @@ wxPrintData& wxPrintData::operator=(const wxPrintData& data) m_nativeData = data.GetNativeData(); m_nativeData->m_ref++; - wxDELETEA(m_privData); + if (m_privData) + { + delete [] m_privData; + m_privData = NULL; + } m_privDataLen = data.GetPrivDataLen(); if (m_privDataLen > 0) { m_privData = new char[m_privDataLen]; memcpy( m_privData, data.GetPrivData(), m_privDataLen ); } - - return *this; } // Is this data OK for showing the print dialog? @@ -170,9 +263,174 @@ bool wxPrintData::IsOk() const { m_nativeData->TransferFrom( *this ); - return m_nativeData->IsOk(); + return m_nativeData->Ok(); } +// What should happen here? wxPostScriptPrintNativeData is not +// defined unless all this is true on MSW. +#if WXWIN_COMPATIBILITY_2_4 && wxUSE_PRINTING_ARCHITECTURE && (!defined(__WXMSW__) || wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW) + +#include "wx/generic/prntdlgg.h" + +#if wxUSE_POSTSCRIPT + #define WXUNUSED_WITHOUT_PS(name) name +#else + #define WXUNUSED_WITHOUT_PS(name) WXUNUSED(name) +#endif + +wxString wxPrintData::GetPrinterCommand() const +{ +#if wxUSE_POSTSCRIPT + if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData)) + return ((wxPostScriptPrintNativeData*)m_nativeData)->GetPrinterCommand(); +#endif + return wxEmptyString; +} + +wxString wxPrintData::GetPrinterOptions() const +{ +#if wxUSE_POSTSCRIPT + if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData)) + return ((wxPostScriptPrintNativeData*)m_nativeData)->GetPrinterOptions(); +#endif + return wxEmptyString; +} + +wxString wxPrintData::GetPreviewCommand() const +{ +#if wxUSE_POSTSCRIPT + if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData)) + return ((wxPostScriptPrintNativeData*)m_nativeData)->GetPreviewCommand(); +#endif + return wxEmptyString; +} + +wxString wxPrintData::GetFontMetricPath() const +{ +#if wxUSE_POSTSCRIPT + if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData)) + return ((wxPostScriptPrintNativeData*)m_nativeData)->GetFontMetricPath(); +#endif + return wxEmptyString; +} + +double wxPrintData::GetPrinterScaleX() const +{ +#if wxUSE_POSTSCRIPT + if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData)) + return ((wxPostScriptPrintNativeData*)m_nativeData)->GetPrinterScaleX(); +#endif + return 1.0; +} + +double wxPrintData::GetPrinterScaleY() const +{ +#if wxUSE_POSTSCRIPT + if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData)) + return ((wxPostScriptPrintNativeData*)m_nativeData)->GetPrinterScaleY(); +#endif + return 1.0; +} + +long wxPrintData::GetPrinterTranslateX() const +{ +#if wxUSE_POSTSCRIPT + if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData)) + return ((wxPostScriptPrintNativeData*)m_nativeData)->GetPrinterTranslateX(); +#endif + return 0; +} + +long wxPrintData::GetPrinterTranslateY() const +{ +#if wxUSE_POSTSCRIPT + if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData)) + return ((wxPostScriptPrintNativeData*)m_nativeData)->GetPrinterTranslateY(); +#endif + return 0; +} + +void wxPrintData::SetPrinterCommand(const wxString& WXUNUSED_WITHOUT_PS(command)) +{ +#if wxUSE_POSTSCRIPT + if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData)) + ((wxPostScriptPrintNativeData*)m_nativeData)->SetPrinterCommand( command ); +#endif +} + +void wxPrintData::SetPrinterOptions(const wxString& WXUNUSED_WITHOUT_PS(options)) +{ +#if wxUSE_POSTSCRIPT + if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData)) + ((wxPostScriptPrintNativeData*)m_nativeData)->SetPrinterOptions( options ); +#endif +} + +void wxPrintData::SetPreviewCommand(const wxString& WXUNUSED_WITHOUT_PS(command)) +{ +#if wxUSE_POSTSCRIPT + if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData)) + ((wxPostScriptPrintNativeData*)m_nativeData)->SetPreviewCommand( command ); +#endif +} + +void wxPrintData::SetFontMetricPath(const wxString& WXUNUSED_WITHOUT_PS(path)) +{ +#if wxUSE_POSTSCRIPT + if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData)) + ((wxPostScriptPrintNativeData*)m_nativeData)->SetFontMetricPath( path ); +#endif +} + +void wxPrintData::SetPrinterScaleX(double WXUNUSED_WITHOUT_PS(x)) +{ +#if wxUSE_POSTSCRIPT + if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData)) + ((wxPostScriptPrintNativeData*)m_nativeData)->SetPrinterScaleX( x ); +#endif +} + +void wxPrintData::SetPrinterScaleY(double WXUNUSED_WITHOUT_PS(y)) +{ +#if wxUSE_POSTSCRIPT + if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData)) + ((wxPostScriptPrintNativeData*)m_nativeData)->SetPrinterScaleY( y ); +#endif +} + +void wxPrintData::SetPrinterScaling(double WXUNUSED_WITHOUT_PS(x), double WXUNUSED_WITHOUT_PS(y)) +{ +#if wxUSE_POSTSCRIPT + if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData)) + ((wxPostScriptPrintNativeData*)m_nativeData)->SetPrinterScaling( x, y ); +#endif +} + +void wxPrintData::SetPrinterTranslateX(long WXUNUSED_WITHOUT_PS(x)) +{ +#if wxUSE_POSTSCRIPT + if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData)) + ((wxPostScriptPrintNativeData*)m_nativeData)->SetPrinterTranslateX( x ); +#endif +} + +void wxPrintData::SetPrinterTranslateY(long WXUNUSED_WITHOUT_PS(y)) +{ +#if wxUSE_POSTSCRIPT + if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData)) + ((wxPostScriptPrintNativeData*)m_nativeData)->SetPrinterTranslateY( y ); +#endif +} + +void wxPrintData::SetPrinterTranslation(long WXUNUSED_WITHOUT_PS(x), long WXUNUSED_WITHOUT_PS(y)) +{ +#if wxUSE_POSTSCRIPT + if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData)) + ((wxPostScriptPrintNativeData*)m_nativeData)->SetPrinterTranslation( x, y ); +#endif +} +#endif + // ---------------------------------------------------------------------------- // Print dialog data // ---------------------------------------------------------------------------- @@ -195,6 +453,9 @@ wxPrintDialogData::wxPrintDialogData() m_printEnablePrintToFile = ! factory->HasOwnPrintToFile(); m_printEnableHelp = false; +#if WXWIN_COMPATIBILITY_2_4 + m_printSetupDialog = false; +#endif } wxPrintDialogData::wxPrintDialogData(const wxPrintDialogData& dialogData) @@ -210,12 +471,7 @@ wxPrintDialogData::wxPrintDialogData(const wxPrintData& printData) m_printMinPage = 1; m_printMaxPage = 9999; m_printNoCopies = 1; - // On Mac the Print dialog always defaults to "All Pages" -#ifdef __WXMAC__ - m_printAllPages = true; -#else m_printAllPages = false; -#endif m_printCollate = false; m_printToFile = false; m_printSelection = false; @@ -223,6 +479,9 @@ wxPrintDialogData::wxPrintDialogData(const wxPrintData& printData) m_printEnablePageNumbers = true; m_printEnablePrintToFile = true; m_printEnableHelp = false; +#if WXWIN_COMPATIBILITY_2_4 + m_printSetupDialog = false; +#endif m_printData = printData; } @@ -245,6 +504,9 @@ void wxPrintDialogData::operator=(const wxPrintDialogData& data) m_printEnablePageNumbers = data.m_printEnablePageNumbers; m_printEnableHelp = data.m_printEnableHelp; m_printEnablePrintToFile = data.m_printEnablePrintToFile; +#if WXWIN_COMPATIBILITY_2_4 + m_printSetupDialog = data.m_printSetupDialog; +#endif m_printData = data.m_printData; } @@ -367,7 +629,7 @@ void wxPageSetupDialogData::SetPrintData(const wxPrintData& printData) // paper id void wxPageSetupDialogData::CalculateIdFromPaperSize() { - wxASSERT_MSG( (wxThePrintPaperDatabase != NULL), + wxASSERT_MSG( (wxThePrintPaperDatabase != (wxPrintPaperDatabase*) NULL), wxT("wxThePrintPaperDatabase should not be NULL. Do not create global print dialog data objects.") ); wxSize sz = GetPaperSize(); @@ -382,7 +644,7 @@ void wxPageSetupDialogData::CalculateIdFromPaperSize() // Use paper id in wxPrintData to set this object's paper size void wxPageSetupDialogData::CalculatePaperSizeFromId() { - wxASSERT_MSG( (wxThePrintPaperDatabase != NULL), + wxASSERT_MSG( (wxThePrintPaperDatabase != (wxPrintPaperDatabase*) NULL), wxT("wxThePrintPaperDatabase should not be NULL. Do not create global print dialog data objects.") ); wxSize sz = wxThePrintPaperDatabase->GetSize(m_printData.GetPaperId()); diff --git a/Source/3rd Party/wx/src/common/colourcmn.cpp b/Source/3rd Party/wx/src/common/colourcmn.cpp index 9a2905398..0bd34c8c9 100644 --- a/Source/3rd Party/wx/src/common/colourcmn.cpp +++ b/Source/3rd Party/wx/src/common/colourcmn.cpp @@ -4,7 +4,7 @@ // Author: Francesco Montorsi // Modified by: // Created: 20/4/2006 -// RCS-ID: $Id$ +// RCS-ID: $Id: colourcmn.cpp 41538 2006-09-30 20:45:15Z RR $ // Copyright: (c) Francesco Montorsi // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -23,147 +23,40 @@ #include "wx/log.h" #include "wx/utils.h" #include "wx/gdicmn.h" - #include "wx/wxcrtvararg.h" #endif #if wxUSE_VARIANT IMPLEMENT_VARIANT_OBJECT_EXPORTED(wxColour,WXDLLEXPORT) #endif - -// ---------------------------------------------------------------------------- -// XTI -// ---------------------------------------------------------------------------- - -#if wxUSE_EXTENDED_RTTI - -#include - -template<> void wxStringReadValue(const wxString &s, wxColour &data ) -{ - if ( !data.Set(s) ) - { - wxLogError(_("String To Colour : Incorrect colour specification : %s"), - s.c_str() ); - data = wxNullColour; - } -} - -template<> void wxStringWriteValue(wxString &s, const wxColour &data ) -{ - s = data.GetAsString(wxC2S_HTML_SYNTAX); -} - -wxTO_STRING_IMP( wxColour ) -wxFROM_STRING_IMP( wxColour ) - -wxIMPLEMENT_DYNAMIC_CLASS_WITH_COPY_AND_STREAMERS_XTI( wxColour, wxObject, \ - "wx/colour.h", &wxTO_STRING( wxColour ), &wxFROM_STRING( wxColour )) -//WX_IMPLEMENT_ANY_VALUE_TYPE(wxAnyValueTypeImpl) -wxBEGIN_PROPERTIES_TABLE(wxColour) -wxREADONLY_PROPERTY( Red, unsigned char, Red, wxEMPTY_PARAMETER_VALUE, \ - 0 /*flags*/, wxT("Helpstring"), wxT("group")) -wxREADONLY_PROPERTY( Green, unsigned char, Green, wxEMPTY_PARAMETER_VALUE, \ - 0 /*flags*/, wxT("Helpstring"), wxT("group")) -wxREADONLY_PROPERTY( Blue, unsigned char, Blue, wxEMPTY_PARAMETER_VALUE, \ - 0 /*flags*/, wxT("Helpstring"), wxT("group")) -wxEND_PROPERTIES_TABLE() - -wxDIRECT_CONSTRUCTOR_3( wxColour, unsigned char, Red, \ - unsigned char, Green, unsigned char, Blue ) - -wxEMPTY_HANDLERS_TABLE(wxColour) -#else - -#if wxCOLOUR_IS_GDIOBJECT -wxIMPLEMENT_DYNAMIC_CLASS(wxColour, wxGDIObject) -#else -wxIMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject) -#endif - -#endif - // ============================================================================ // wxString <-> wxColour conversions // ============================================================================ -bool wxColourBase::FromString(const wxString& str) +bool wxColourBase::FromString(const wxChar *str) { - if ( str.empty() ) + if ( str == NULL || str[0] == wxT('\0')) return false; // invalid or empty string - if ( wxStrnicmp(str, wxT("RGB"), 3) == 0 ) + if ( wxStrncmp(str, wxT("RGB"), 3) == 0 || + wxStrncmp(str, wxT("rgb"), 3) == 0 ) { // CSS-like RGB specification - // according to http://www.w3.org/TR/css3-color/#colorunits + // according to http://www.w3.org/TR/REC-CSS2/syndata.html#color-units // values outside 0-255 range are allowed but should be clipped - int red, green, blue, - alpha = wxALPHA_OPAQUE; - if ( str.length() > 3 && (str[3] == wxT('a') || str[3] == wxT('A')) ) - { - // We can't use sscanf() for the alpha value as sscanf() uses the - // current locale while the floating point numbers in CSS always - // use point as decimal separator, regardless of locale. So parse - // the tail of the string manually by putting it in a buffer and - // using wxString::ToCDouble() below. Notice that we can't use "%s" - // for this as it stops at white space and we need "%c" to avoid - // this and really get all the rest of the string into the buffer. + int red, green, blue; + if (wxSscanf(&str[3], wxT("(%d, %d, %d)"), &red, &green, &blue) != 3) + return false; - const unsigned len = str.length(); // always big enough - wxCharBuffer alphaBuf(len); - char * const alphaPtr = alphaBuf.data(); - - for ( unsigned n = 0; n < len; n++ ) - alphaPtr[n] = '\0'; - - // Construct the format string which ensures that the last argument - // receives all the rest of the string. - wxString formatStr; - formatStr << wxS("( %d , %d , %d , %") << len << 'c'; - - // Notice that we use sscanf() here because if the string is not - // ASCII it can't represent a valid RGB colour specification anyhow - // and like this we can be sure that %c corresponds to "char *" - // while with wxSscanf() it depends on the type of the string - // passed as first argument: if it is a wide string, then %c - // expects "wchar_t *" matching parameter under MSW for example. - if ( sscanf(str.c_str() + 4, - formatStr.mb_str(), - &red, &green, &blue, alphaPtr) != 4 ) - return false; - - // Notice that we must explicitly specify the length to get rid of - // trailing NULs. - wxString alphaStr(alphaPtr, wxStrlen(alphaPtr)); - if ( alphaStr.empty() || alphaStr.Last() != ')' ) - return false; - - alphaStr.RemoveLast(); - alphaStr.Trim(); - - double a; - if ( !alphaStr.ToCDouble(&a) ) - return false; - - alpha = wxRound(a * 255); - } - else // no 'a' following "rgb" - { - if ( wxSscanf(str.wx_str() + 3, wxT("( %d , %d , %d )"), - &red, &green, &blue) != 3 ) - return false; - } - - Set((unsigned char)wxClip(red, 0, 255), - (unsigned char)wxClip(green, 0, 255), - (unsigned char)wxClip(blue, 0, 255), - (unsigned char)wxClip(alpha, 0, 255)); + Set((unsigned char)wxClip(red,0,255), + (unsigned char)wxClip(green,0,255), + (unsigned char)wxClip(blue,0,255)); } else if ( str[0] == wxT('#') && wxStrlen(str) == 7 ) { // hexadecimal prefixed with # (HTML syntax) unsigned long tmp; - if (wxSscanf(str.wx_str() + 1, wxT("%lx"), &tmp) != 1) + if (wxSscanf(&str[1], wxT("%lx"), &tmp) != 1) return false; Set((unsigned char)(tmp >> 16), @@ -177,13 +70,13 @@ bool wxColourBase::FromString(const wxString& str) // because this place can be called from constructor // and 'this' could not be available yet wxColour clr = wxTheColourDatabase->Find(str); - if (clr.IsOk()) + if (clr.Ok()) Set((unsigned char)clr.Red(), (unsigned char)clr.Green(), (unsigned char)clr.Blue()); } - if (IsOk()) + if (Ok()) return true; wxLogDebug(wxT("wxColour::Set - couldn't set to colour string '%s'"), str); @@ -194,143 +87,29 @@ wxString wxColourBase::GetAsString(long flags) const { wxString colName; - const bool isOpaque = Alpha() == wxALPHA_OPAQUE; + if (flags & wxC2S_NAME) + colName = wxTheColourDatabase->FindName((const wxColour &)(*this)).MakeLower(); - // we can't use the name format if the colour is not opaque as the alpha - // information would be lost - if ( (flags & wxC2S_NAME) && isOpaque ) + if ( colName.empty() && (flags & wxC2S_CSS_SYNTAX) ) { - colName = wxTheColourDatabase->FindName( - static_cast(*this)).MakeLower(); + // no name for this colour; return it in CSS syntax + colName.Printf(wxT("rgb(%d, %d, %d)"), + Red(), Green(), Blue()); + } + else if ( colName.empty() && (flags & wxC2S_HTML_SYNTAX) ) + { + // no name for this colour; return it in HTML syntax + colName.Printf(wxT("#%02X%02X%02X"), + Red(), Green(), Blue()); } - if ( colName.empty() ) - { - const int red = Red(), - blue = Blue(), - green = Green(); - - if ( flags & wxC2S_CSS_SYNTAX ) - { - // no name for this colour; return it in CSS syntax - if ( isOpaque ) - { - colName.Printf(wxT("rgb(%d, %d, %d)"), red, green, blue); - } - else // use rgba() form - { - colName.Printf(wxT("rgba(%d, %d, %d, %s)"), - red, green, blue, - wxString::FromCDouble(Alpha() / 255., 3)); - } - } - else if ( flags & wxC2S_HTML_SYNTAX ) - { - wxASSERT_MSG( isOpaque, "alpha is lost in HTML syntax" ); - - // no name for this colour; return it in HTML syntax - colName.Printf(wxT("#%02X%02X%02X"), red, green, blue); - } - } - - // this function should alway returns a non-empty string + // this function always returns a non-empty string wxASSERT_MSG(!colName.empty(), wxT("Invalid wxColour -> wxString conversion flags")); return colName; } -// static -void wxColourBase::MakeMono(unsigned char* r, unsigned char* g, unsigned char* b, - bool on) -{ - *r = *g = *b = on ? 255 : 0; -} - -// static -void wxColourBase::MakeGrey(unsigned char* r, unsigned char* g, unsigned char* b - /*, unsigned char brightness */ - ) -{ - *r = *g = *b = (wxByte)(((*b)*117UL + (*g)*601UL + (*r)*306UL) >> 10); -} - -// static -void wxColourBase::MakeGrey(unsigned char* r, unsigned char* g, unsigned char* b, - double weight_r, double weight_g, double weight_b) -{ - double luma = (*r) * weight_r + (*g) * weight_g + (*b) * weight_b; - *r = *g = *b = (wxByte)wxRound(luma); -} - -// static -void wxColourBase::MakeDisabled(unsigned char* r, unsigned char* g, unsigned char* b, - unsigned char brightness) -{ - //MakeGrey(r, g, b, brightness); // grey no-blend version - *r = AlphaBlend(*r, brightness, 0.4); - *g = AlphaBlend(*g, brightness, 0.4); - *b = AlphaBlend(*b, brightness, 0.4); -} - -// AlphaBlend is used by ChangeLightness and MakeDisabled - -// static -unsigned char wxColourBase::AlphaBlend(unsigned char fg, unsigned char bg, - double alpha) -{ - double result = bg + (alpha * (fg - bg)); - result = wxMax(result, 0.0); - result = wxMin(result, 255.0); - return (unsigned char)result; -} - -// ChangeLightness() is a utility function that simply darkens -// or lightens a color, based on the specified percentage -// ialpha of 0 would be completely black, 100 completely white -// an ialpha of 100 returns the same colour - -// static -void wxColourBase::ChangeLightness(unsigned char* r, unsigned char* g, unsigned char* b, - int ialpha) -{ - if (ialpha == 100) return; - - // ialpha is 0..200 where 0 is completely black - // and 200 is completely white and 100 is the same - // convert that to normal alpha 0.0 - 1.0 - ialpha = wxMax(ialpha, 0); - ialpha = wxMin(ialpha, 200); - double alpha = ((double)(ialpha - 100.0))/100.0; - - unsigned char bg; - if (ialpha > 100) - { - // blend with white - bg = 255; - alpha = 1.0 - alpha; // 0 = transparent fg; 1 = opaque fg - } - else - { - // blend with black - bg = 0; - alpha = 1.0 + alpha; // 0 = transparent fg; 1 = opaque fg - } - - *r = AlphaBlend(*r, bg, alpha); - *g = AlphaBlend(*g, bg, alpha); - *b = AlphaBlend(*b, bg, alpha); -} - -wxColour wxColourBase::ChangeLightness(int ialpha) const -{ - wxByte r = Red(); - wxByte g = Green(); - wxByte b = Blue(); - ChangeLightness(&r, &g, &b, ialpha); - return wxColour(r,g,b); -} - #if WXWIN_COMPATIBILITY_2_6 // static @@ -345,25 +124,3 @@ void wxColourBase::InitFromName(const wxString& col) } #endif // WXWIN_COMPATIBILITY_2_6 - -// wxColour <-> wxString utilities, used by wxConfig -wxString wxToString(const wxColourBase& col) -{ - return col.IsOk() ? col.GetAsString(wxC2S_CSS_SYNTAX) - : wxString(); -} - -bool wxFromString(const wxString& str, wxColourBase *col) -{ - wxCHECK_MSG( col, false, wxT("NULL output parameter") ); - - if ( str.empty() ) - { - *col = wxNullColour; - return true; - } - - return col->Set(str); -} - - diff --git a/Source/3rd Party/wx/src/common/colourdata.cpp b/Source/3rd Party/wx/src/common/colourdata.cpp deleted file mode 100644 index bf7039d73..000000000 --- a/Source/3rd Party/wx/src/common/colourdata.cpp +++ /dev/null @@ -1,108 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/colourdata.cpp -// Author: Julian Smart -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_COLOURDLG || wxUSE_COLOURPICKERCTRL - -#include "wx/colourdata.h" -#include "wx/tokenzr.h" - -// ---------------------------------------------------------------------------- -// wxColourData -// ---------------------------------------------------------------------------- - -IMPLEMENT_DYNAMIC_CLASS(wxColourData, wxObject) - -wxColourData::wxColourData() -{ - m_chooseFull = false; - m_dataColour.Set(0,0,0); - // m_custColours are wxNullColours initially -} - -wxColourData::wxColourData(const wxColourData& data) - : wxObject() -{ - (*this) = data; -} - -wxColourData::~wxColourData() -{ -} - -void wxColourData::SetCustomColour(int i, const wxColour& colour) -{ - wxCHECK_RET( i >= 0 && i < NUM_CUSTOM, wxT("custom colour index out of range") ); - - m_custColours[i] = colour; -} - -wxColour wxColourData::GetCustomColour(int i) const -{ - wxCHECK_MSG( i >= 0 && i < NUM_CUSTOM, wxColour(0,0,0), - wxT("custom colour index out of range") ); - - return m_custColours[i]; -} - -wxColourData& wxColourData::operator=(const wxColourData& data) -{ - for ( int i = 0; i < NUM_CUSTOM; i++) - m_custColours[i] = data.m_custColours[i]; - - m_dataColour = data.m_dataColour; - m_chooseFull = data.m_chooseFull; - - return *this; -} - -// ---------------------------------------------------------------------------- -// [de]serialization -// ---------------------------------------------------------------------------- - -// separator used between different fields -static const char wxCOL_DATA_SEP = ','; - -wxString wxColourData::ToString() const -{ - wxString str(m_chooseFull ? '1' : '0'); - - for ( int i = 0; i < NUM_CUSTOM; i++ ) - { - str += wxCOL_DATA_SEP; - - const wxColour& clr = m_custColours[i]; - if ( clr.IsOk() ) - str += clr.GetAsString(wxC2S_HTML_SYNTAX); - } - - return str; -} - -bool wxColourData::FromString(const wxString& str) -{ - wxStringTokenizer tokenizer(str, wxCOL_DATA_SEP); - wxString token = tokenizer.GetNextToken(); - m_chooseFull = token == '1'; - bool success = m_chooseFull || token == '0'; - for (int i = 0; success && i < NUM_CUSTOM; i++) - { - token = tokenizer.GetNextToken(); - if (token.empty()) - m_custColours[i] = wxColour(); - else - success = m_custColours[i].Set(token); - } - return success; -} -#endif // wxUSE_COLOURDLG || wxUSE_COLOURPICKERCTRL diff --git a/Source/3rd Party/wx/src/common/combocmn.cpp b/Source/3rd Party/wx/src/common/combocmn.cpp index cc2931847..4e67f32ea 100644 --- a/Source/3rd Party/wx/src/common/combocmn.cpp +++ b/Source/3rd Party/wx/src/common/combocmn.cpp @@ -4,7 +4,7 @@ // Author: Jaakko Salli // Modified by: // Created: Apr-30-2006 -// RCS-ID: $Id$ +// RCS-ID: $Id: combocmn.cpp 67178 2011-03-13 09:32:19Z JMS $ // Copyright: (c) 2005 Jaakko Salli // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -23,20 +23,17 @@ #pragma hdrstop #endif -#if wxUSE_COMBOBOX -#include "wx/combobox.h" -extern WXDLLEXPORT_DATA(const char) wxComboBoxNameStr[] = "comboBox"; -#endif - #if wxUSE_COMBOCTRL +#include "wx/combobox.h" + #ifndef WX_PRECOMP #include "wx/app.h" #include "wx/log.h" #include "wx/dcclient.h" #include "wx/settings.h" + #include "wx/dialog.h" #include "wx/timer.h" - #include "wx/textctrl.h" #endif #include "wx/tooltip.h" @@ -44,71 +41,6 @@ extern WXDLLEXPORT_DATA(const char) wxComboBoxNameStr[] = "comboBox"; #include "wx/combo.h" -// ---------------------------------------------------------------------------- -// XTI -// ---------------------------------------------------------------------------- - -wxDEFINE_FLAGS( wxComboBoxStyle ) -wxBEGIN_FLAGS( wxComboBoxStyle ) -// new style border flags, we put them first to -// use them for streaming out -wxFLAGS_MEMBER(wxBORDER_SIMPLE) -wxFLAGS_MEMBER(wxBORDER_SUNKEN) -wxFLAGS_MEMBER(wxBORDER_DOUBLE) -wxFLAGS_MEMBER(wxBORDER_RAISED) -wxFLAGS_MEMBER(wxBORDER_STATIC) -wxFLAGS_MEMBER(wxBORDER_NONE) - -// old style border flags -wxFLAGS_MEMBER(wxSIMPLE_BORDER) -wxFLAGS_MEMBER(wxSUNKEN_BORDER) -wxFLAGS_MEMBER(wxDOUBLE_BORDER) -wxFLAGS_MEMBER(wxRAISED_BORDER) -wxFLAGS_MEMBER(wxSTATIC_BORDER) -wxFLAGS_MEMBER(wxBORDER) - -// standard window styles -wxFLAGS_MEMBER(wxTAB_TRAVERSAL) -wxFLAGS_MEMBER(wxCLIP_CHILDREN) -wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW) -wxFLAGS_MEMBER(wxWANTS_CHARS) -wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE) -wxFLAGS_MEMBER(wxALWAYS_SHOW_SB ) -wxFLAGS_MEMBER(wxVSCROLL) -wxFLAGS_MEMBER(wxHSCROLL) - -wxFLAGS_MEMBER(wxCB_SIMPLE) -wxFLAGS_MEMBER(wxCB_SORT) -wxFLAGS_MEMBER(wxCB_READONLY) -wxFLAGS_MEMBER(wxCB_DROPDOWN) - -wxEND_FLAGS( wxComboBoxStyle ) - -wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxComboBox, wxControl, "wx/combobox.h") - -wxBEGIN_PROPERTIES_TABLE(wxComboBox) -wxEVENT_PROPERTY( Select, wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEvent ) -wxEVENT_PROPERTY( TextEnter, wxEVT_COMMAND_TEXT_ENTER, wxCommandEvent ) - -// TODO DELEGATES -wxPROPERTY( Font, wxFont, SetFont, GetFont, wxEMPTY_PARAMETER_VALUE, \ - 0 /*flags*/, wxT("Helpstring"), wxT("group")) -wxPROPERTY_COLLECTION( Choices, wxArrayString, wxString, AppendString, \ - GetStrings, 0 /*flags*/, wxT("Helpstring"), wxT("group")) -wxPROPERTY( Value,wxString, SetValue, GetValue, wxEMPTY_PARAMETER_VALUE, \ - 0 /*flags*/, wxT("Helpstring"), wxT("group")) -wxPROPERTY( Selection,int, SetSelection, GetSelection, wxEMPTY_PARAMETER_VALUE, \ - 0 /*flags*/, wxT("Helpstring"), wxT("group")) - -wxPROPERTY_FLAGS( WindowStyle, wxComboBoxStyle, long, SetWindowStyleFlag, \ - GetWindowStyleFlag, wxEMPTY_PARAMETER_VALUE, 0 /*flags*/, \ - wxT("Helpstring"), wxT("group")) // style -wxEND_PROPERTIES_TABLE() - -wxEMPTY_HANDLERS_TABLE(wxComboBox) - -wxCONSTRUCTOR_5( wxComboBox, wxWindow*, Parent, wxWindowID, Id, \ - wxString, Value, wxPoint, Position, wxSize, Size ) // constants // ---------------------------------------------------------------------------- @@ -126,11 +58,6 @@ wxCONSTRUCTOR_5( wxComboBox, wxWindow*, Parent, wxWindowID, Id, \ #if defined(__WXMSW__) -// Let's use wxFrame as a fall-back solution until wxMSW gets wxNonOwnedWindow -#include "wx/frame.h" -#define wxCC_GENERIC_TLW_IS_FRAME -#define wxComboCtrlGenericTLW wxFrame - #define USE_TRANSIENT_POPUP 1 // Use wxPopupWindowTransient (preferred, if it works properly on platform) #define TRANSIENT_POPUPWIN_IS_PERFECT 0 // wxPopupTransientWindow works, its child can have focus, and common // native controls work on it like normal. @@ -149,22 +76,8 @@ wxCONSTRUCTOR_5( wxComboBox, wxWindow*, Parent, wxWindowID, Id, \ // reflected (or something like that - atleast commenting out ->Hide() // seemed to eliminate the position change). -#include "wx/dialog.h" -#define wxCC_GENERIC_TLW_IS_DIALOG -#define wxComboCtrlGenericTLW wxDialog - -#if defined(__WXGTK20__) -# include "wx/gtk/private.h" -#else -# include "wx/gtk1/private.h" -#endif - -// NB: Let's not be afraid to use wxGTK's wxPopupTransientWindow as a -// 'perfect' popup, as it can successfully host child controls even in -// popups that are shown in modal dialogs. - #define USE_TRANSIENT_POPUP 1 // Use wxPopupWindowTransient (preferred, if it works properly on platform) -#define TRANSIENT_POPUPWIN_IS_PERFECT 1 // wxPopupTransientWindow works, its child can have focus, and common +#define TRANSIENT_POPUPWIN_IS_PERFECT 0 // wxPopupTransientWindow works, its child can have focus, and common // native controls work on it like normal. #define POPUPWIN_IS_PERFECT 1 // Same, but for non-transient popup window. #define TEXTCTRL_TEXT_CENTERED 1 // 1 if text in textctrl is vertically centered @@ -172,14 +85,10 @@ wxCONSTRUCTOR_5( wxComboBox, wxWindow*, Parent, wxWindowID, Id, \ #elif defined(__WXMAC__) -#include "wx/nonownedwnd.h" -#define wxCC_GENERIC_TLW_IS_NONOWNEDWINDOW -#define wxComboCtrlGenericTLW wxNonOwnedWindow - -#define USE_TRANSIENT_POPUP 1 // Use wxPopupWindowTransient (preferred, if it works properly on platform) -#define TRANSIENT_POPUPWIN_IS_PERFECT 1 // wxPopupTransientWindow works, its child can have focus, and common +#define USE_TRANSIENT_POPUP 0 // Use wxPopupWindowTransient (preferred, if it works properly on platform) +#define TRANSIENT_POPUPWIN_IS_PERFECT 0 // wxPopupTransientWindow works, its child can have focus, and common // native controls work on it like normal. -#define POPUPWIN_IS_PERFECT 1 // Same, but for non-transient popup window. +#define POPUPWIN_IS_PERFECT 0 // Same, but for non-transient popup window. #define TEXTCTRL_TEXT_CENTERED 1 // 1 if text in textctrl is vertically centered #define FOCUS_RING 3 // Reserve room for the textctrl's focus ring to display @@ -190,10 +99,6 @@ wxCONSTRUCTOR_5( wxComboBox, wxWindow*, Parent, wxWindowID, Id, \ #else -#include "wx/dialog.h" -#define wxCC_GENERIC_TLW_IS_DIALOG -#define wxComboCtrlGenericTLW wxDialog - #define USE_TRANSIENT_POPUP 0 // Use wxPopupWindowTransient (preferred, if it works properly on platform) #define TRANSIENT_POPUPWIN_IS_PERFECT 0 // wxPopupTransientWindow works, its child can have focus, and common // native controls work on it like normal. @@ -207,7 +112,7 @@ wxCONSTRUCTOR_5( wxComboBox, wxWindow*, Parent, wxWindowID, Id, \ // Popupwin is really only supported on wxMSW (not WINCE) and wxGTK, regardless // what the wxUSE_POPUPWIN says. // FIXME: Why isn't wxUSE_POPUPWIN reliable any longer? (it was in wxW2.6.2) -#if (!defined(__WXMSW__) && !defined(__WXGTK__) && !defined(__WXMAC__)) || defined(__WXWINCE__) +#if (!defined(__WXMSW__) && !defined(__WXGTK__)) || defined(__WXWINCE__) #undef wxUSE_POPUPWIN #define wxUSE_POPUPWIN 0 #endif @@ -227,7 +132,7 @@ enum POPUPWIN_NONE = 0, POPUPWIN_WXPOPUPTRANSIENTWINDOW = 1, POPUPWIN_WXPOPUPWINDOW = 2, - POPUPWIN_GENERICTLW = 3 + POPUPWIN_WXDIALOG = 3 }; @@ -245,9 +150,9 @@ enum #define SECONDARY_POPUP_TYPE POPUPWIN_WXPOPUPWINDOW #define USES_WXPOPUPWINDOW 1 #else - #define wxComboPopupWindowBase2 wxComboCtrlGenericTLW - #define SECONDARY_POPUP_TYPE POPUPWIN_GENERICTLW - #define USES_GENERICTLW 1 + #define wxComboPopupWindowBase2 wxDialog + #define SECONDARY_POPUP_TYPE POPUPWIN_WXDIALOG + #define USES_WXDIALOG 1 #endif #elif wxUSE_POPUPWIN @@ -258,17 +163,17 @@ enum #define USES_WXPOPUPWINDOW 1 #if !POPUPWIN_IS_PERFECT - #define wxComboPopupWindowBase2 wxComboCtrlGenericTLW - #define SECONDARY_POPUP_TYPE POPUPWIN_GENERICTLW - #define USES_GENERICTLW 1 + #define wxComboPopupWindowBase2 wxDialog + #define SECONDARY_POPUP_TYPE POPUPWIN_WXDIALOG + #define USES_WXDIALOG 1 #endif #else // wxPopupWindow is not implemented - #define wxComboPopupWindowBase wxComboCtrlGenericTLW - #define PRIMARY_POPUP_TYPE POPUPWIN_GENERICTLW - #define USES_GENERICTLW 1 + #define wxComboPopupWindowBase wxDialog + #define PRIMARY_POPUP_TYPE POPUPWIN_WXDIALOG + #define USES_WXDIALOG 1 #endif @@ -281,8 +186,8 @@ enum #define USES_WXPOPUPWINDOW 0 #endif -#ifndef USES_GENERICTLW - #define USES_GENERICTLW 0 +#ifndef USES_WXDIALOG + #define USES_WXDIALOG 0 #endif @@ -293,26 +198,6 @@ enum #endif -// Returns true if given popup window type can be classified as perfect -// on this platform. -static inline bool IsPopupWinTypePerfect( wxByte popupWinType ) -{ -#if POPUPWIN_IS_PERFECT && TRANSIENT_POPUPWIN_IS_PERFECT - wxUnusedVar(popupWinType); - return true; -#else - return ( popupWinType == POPUPWIN_GENERICTLW - #if POPUPWIN_IS_PERFECT - || popupWinType == POPUPWIN_WXPOPUPWINDOW - #endif - #if TRANSIENT_POPUPWIN_IS_PERFECT - || popupWinType == POPUPWIN_WXPOPUPTRANSIENTWINDOW - #endif - ); -#endif -} - - // // ** TODO ** // * wxComboPopupWindow for external use (ie. replace old wxUniv wxPopupComboWindow) @@ -399,7 +284,7 @@ void wxComboFrameEventHandler::OnIdle( wxIdleEvent& event ) winFocused != m_combo->GetButton() // GTK (atleast) requires this ) { - m_combo->HidePopup(true); + m_combo->HidePopup(); } event.Skip(); @@ -407,37 +292,37 @@ void wxComboFrameEventHandler::OnIdle( wxIdleEvent& event ) void wxComboFrameEventHandler::OnMenuEvent( wxMenuEvent& event ) { - m_combo->HidePopup(true); + m_combo->HidePopup(); event.Skip(); } void wxComboFrameEventHandler::OnMouseEvent( wxMouseEvent& event ) { - m_combo->HidePopup(true); + m_combo->HidePopup(); event.Skip(); } void wxComboFrameEventHandler::OnClose( wxCloseEvent& event ) { - m_combo->HidePopup(true); + m_combo->HidePopup(); event.Skip(); } void wxComboFrameEventHandler::OnActivate( wxActivateEvent& event ) { - m_combo->HidePopup(true); + m_combo->HidePopup(); event.Skip(); } void wxComboFrameEventHandler::OnResize( wxSizeEvent& event ) { - m_combo->HidePopup(true); + m_combo->HidePopup(); event.Skip(); } void wxComboFrameEventHandler::OnMove( wxMoveEvent& event ) { - m_combo->HidePopup(true); + m_combo->HidePopup(); event.Skip(); } @@ -489,16 +374,15 @@ bool wxComboPopupWindow::Show( bool show ) m_inShow++; - wxPopupTransientWindow* const - ptw = static_cast(this); + wxASSERT( IsKindOf(CLASSINFO(wxPopupTransientWindow)) ); + + wxPopupTransientWindow* ptw = (wxPopupTransientWindow*) this; + wxComboCtrlBase* combo = (wxComboCtrlBase*) GetParent(); if ( show != ptw->IsShown() ) { if ( show ) - // We used to do wxPopupTransientWindow::Popup here, - // but this would hide normal Show, which we are - // also going to need. - ptw->Show(); + ptw->Popup(combo->GetPopupControl()->GetControl()); else ptw->Dismiss(); } @@ -517,10 +401,10 @@ bool wxComboPopupWindow::ProcessLeftDown(wxMouseEvent& event) void wxComboPopupWindow::OnDismiss() { wxComboCtrlBase* combo = (wxComboCtrlBase*) GetParent(); - wxASSERT_MSG( wxDynamicCast(combo, wxComboCtrlBase), + wxASSERT_MSG( combo->IsKindOf(CLASSINFO(wxComboCtrlBase)), wxT("parent might not be wxComboCtrl, but check IMPLEMENT_DYNAMIC_CLASS(2) macro for correctness") ); - combo->OnPopupDismiss(true); + combo->OnPopupDismiss(); } #endif // USES_WXPOPUPTRANSIENTWINDOW @@ -542,7 +426,7 @@ public: void OnSizeEvent( wxSizeEvent& event ); void OnKeyEvent(wxKeyEvent& event); -#if USES_GENERICTLW +#if USES_WXDIALOG void OnActivate( wxActivateEvent& event ); #endif @@ -556,8 +440,7 @@ private: BEGIN_EVENT_TABLE(wxComboPopupWindowEvtHandler, wxEvtHandler) EVT_KEY_DOWN(wxComboPopupWindowEvtHandler::OnKeyEvent) EVT_KEY_UP(wxComboPopupWindowEvtHandler::OnKeyEvent) - EVT_CHAR(wxComboPopupWindowEvtHandler::OnKeyEvent) -#if USES_GENERICTLW +#if USES_WXDIALOG EVT_ACTIVATE(wxComboPopupWindowEvtHandler::OnActivate) #endif EVT_SIZE(wxComboPopupWindowEvtHandler::OnSizeEvent) @@ -575,16 +458,16 @@ void wxComboPopupWindowEvtHandler::OnKeyEvent( wxKeyEvent& event ) wxWindowList children = m_combo->GetPopupWindow()->GetChildren(); wxWindowList::iterator node = children.begin(); wxWindow* child = (wxWindow*)*node; - child->GetEventHandler()->ProcessEvent(event); + child->AddPendingEvent(event); } -#if USES_GENERICTLW +#if USES_WXDIALOG void wxComboPopupWindowEvtHandler::OnActivate( wxActivateEvent& event ) { if ( !event.GetActive() ) { // Tell combo control that we are dismissed. - m_combo->HidePopup(true); + m_combo->HidePopup(); event.Skip(); } @@ -609,11 +492,6 @@ void wxComboPopup::OnDismiss() { } -wxComboCtrl* wxComboPopup::GetComboCtrl() const -{ - return wxStaticCast(m_combo, wxComboCtrl); -} - wxSize wxComboPopup::GetAdjustedSize( int minWidth, int prefHeight, int WXUNUSED(maxHeight) ) @@ -629,7 +507,7 @@ void wxComboPopup::DefaultPaintComboControl( wxComboCtrlBase* combo, combo->PrepareBackground(dc,rect,0); dc.DrawText( combo->GetValue(), - rect.x + combo->m_marginLeft, + rect.x + combo->GetTextIndent(), (rect.height-dc.GetCharHeight())/2 + rect.y ); } } @@ -644,11 +522,6 @@ void wxComboPopup::OnComboKeyEvent( wxKeyEvent& event ) event.Skip(); } -void wxComboPopup::OnComboCharEvent( wxKeyEvent& event ) -{ - event.Skip(); -} - void wxComboPopup::OnComboDoubleClick() { } @@ -657,12 +530,6 @@ void wxComboPopup::SetStringValue( const wxString& WXUNUSED(value) ) { } -bool wxComboPopup::FindItem(const wxString& WXUNUSED(item), - wxString* WXUNUSED(trueItem)) -{ - return true; -} - bool wxComboPopup::LazyCreate() { return false; @@ -670,35 +537,7 @@ bool wxComboPopup::LazyCreate() void wxComboPopup::Dismiss() { - m_combo->HidePopup(true); -} - -void wxComboPopup::DestroyPopup() -{ - // Here we make sure that the popup control's Destroy() gets called. - // This is necessary for the wxPersistentWindow to work properly. - wxWindow* popupCtrl = GetControl(); - if ( popupCtrl ) - { - // While all wxComboCtrl examples have m_popupInterface and - // popupCtrl as the same class (that will be deleted via the - // Destroy() call below), it is technically still possible to - // have implementations where they are in fact not same - // multiple-inherited class. Here we use C++ RTTI to check for - // this rare case. - #ifndef wxNO_RTTI - // It is probably better to delete m_popupInterface first, so - // that it retains access to its popup control window. - if ( dynamic_cast(this) != - dynamic_cast(popupCtrl) ) - delete this; - #endif - popupCtrl->Destroy(); - } - else - { - delete this; - } + m_combo->HidePopup(); } // ---------------------------------------------------------------------------- @@ -734,7 +573,6 @@ BEGIN_EVENT_TABLE(wxComboBoxExtraInputHandler, wxEvtHandler) EVT_KEY_UP(wxComboBoxExtraInputHandler::OnKey) EVT_CHAR(wxComboBoxExtraInputHandler::OnKey) EVT_SET_FOCUS(wxComboBoxExtraInputHandler::OnFocus) - EVT_KILL_FOCUS(wxComboBoxExtraInputHandler::OnFocus) END_EVENT_TABLE() @@ -759,8 +597,7 @@ void wxComboBoxExtraInputHandler::OnFocus(wxFocusEvent& event) { // FIXME: This code does run when control is clicked, // yet on Windows it doesn't select all the text. - if ( event.GetEventType() == wxEVT_SET_FOCUS && - !(m_combo->GetInternalFlags() & wxCC_NO_TEXT_AUTO_SELECT) ) + if ( !(m_combo->GetInternalFlags() & wxCC_NO_TEXT_AUTO_SELECT) ) { if ( m_combo->GetTextCtrl() ) m_combo->GetTextCtrl()->SelectAll(); @@ -774,8 +611,7 @@ void wxComboBoxExtraInputHandler::OnFocus(wxFocusEvent& event) // wxEVT_SET_FOCUSes (since m_text->SetFocus is called // from combo's focus event handler), they should be quite // harmless. - wxFocusEvent evt2(event); - evt2.SetId(m_combo->GetId()); + wxFocusEvent evt2(wxEVT_SET_FOCUS,m_combo->GetId()); evt2.SetEventObject(m_combo); m_combo->GetEventHandler()->ProcessEvent(evt2); @@ -787,21 +623,17 @@ void wxComboBoxExtraInputHandler::OnFocus(wxFocusEvent& event) // This is pushed to the event handler queue of the control in popup. // -class wxComboPopupEvtHandler : public wxEvtHandler +class wxComboPopupExtraEventHandler : public wxEvtHandler { public: - wxComboPopupEvtHandler( wxComboCtrlBase* combo ) + wxComboPopupExtraEventHandler( wxComboCtrlBase* combo ) : wxEvtHandler() { m_combo = combo; m_beenInside = false; - - // Let's make it so that the popup control will not receive mouse - // events until mouse left button has been up. - m_blockEventsToPopup = true; } - virtual ~wxComboPopupEvtHandler() { } + virtual ~wxComboPopupExtraEventHandler() { } void OnMouseEvent( wxMouseEvent& event ); @@ -809,163 +641,92 @@ public: void OnPopupDismiss() { m_beenInside = false; - m_blockEventsToPopup = true; } protected: wxComboCtrlBase* m_combo; - bool m_beenInside; - bool m_blockEventsToPopup; + bool m_beenInside; private: DECLARE_EVENT_TABLE() }; -BEGIN_EVENT_TABLE(wxComboPopupEvtHandler, wxEvtHandler) - EVT_MOUSE_EVENTS(wxComboPopupEvtHandler::OnMouseEvent) +BEGIN_EVENT_TABLE(wxComboPopupExtraEventHandler, wxEvtHandler) + EVT_MOUSE_EVENTS(wxComboPopupExtraEventHandler::OnMouseEvent) END_EVENT_TABLE() -void wxComboPopupEvtHandler::OnMouseEvent( wxMouseEvent& event ) +void wxComboPopupExtraEventHandler::OnMouseEvent( wxMouseEvent& event ) { wxPoint pt = event.GetPosition(); wxSize sz = m_combo->GetPopupControl()->GetControl()->GetClientSize(); int evtType = event.GetEventType(); bool isInside = pt.x >= 0 && pt.y >= 0 && pt.x < sz.x && pt.y < sz.y; - bool relayToButton = false; - event.Skip(); - - if ( !isInside || !m_combo->IsPopupShown() ) + if ( evtType == wxEVT_MOTION || + evtType == wxEVT_LEFT_DOWN || + evtType == wxEVT_RIGHT_DOWN ) { - // Mouse is outside the popup or popup is not actually shown (yet) - - if ( evtType == wxEVT_MOTION || - evtType == wxEVT_LEFT_DOWN || - evtType == wxEVT_LEFT_UP || - evtType == wxEVT_RIGHT_DOWN ) - { - // Block motion and click events outside the popup - event.Skip(false); - } - } - else - { - // Mouse is inside the popup, which is fully shown - - m_beenInside = true; - - // Do not let the popup control respond to mouse events until - // mouse press used to display the popup has been lifted. This - // is important for users with slower mouse fingers or mouse - // drivers. Note that we have some redundancy here, just in - // case the popup is some native control that does not emit all - // mouse event types. - if ( evtType == wxEVT_MOTION ) - { - if ( m_blockEventsToPopup ) - { - if ( event.LeftIsDown() ) - event.Skip(false); - else - m_blockEventsToPopup = false; - } - } - else if ( evtType == wxEVT_LEFT_DOWN ) - { - if ( m_blockEventsToPopup ) - m_blockEventsToPopup = false; - } - else if ( evtType == wxEVT_LEFT_UP ) - { - if ( m_blockEventsToPopup ) - { - // On first left up, stop blocking mouse events (but still - // block this one) - m_blockEventsToPopup = false; - event.Skip(false); - - // Also, this button press was (probably) used to display - // the popup, so relay it back to the drop-down button - // (which supposedly originated it). This is necessary to - // refresh it properly. - relayToButton = true; - } - } - else if ( m_blockEventsToPopup ) + // Block motion and click events outside the popup + if ( !isInside || !m_combo->IsPopupShown() ) { event.Skip(false); + return; } } - - // - // Some mouse events to popup that happen outside it, before cursor - // has been inside the popup, need to be ignored by it but relayed to - // the dropbutton. - // - if ( evtType == wxEVT_LEFT_UP ) + else if ( evtType == wxEVT_LEFT_UP ) { if ( !m_combo->IsPopupShown() ) { event.Skip(false); - relayToButton = true; + return; } - else if ( !isInside && !m_beenInside ) + + if ( !m_beenInside ) { - // Popup is shown but the cursor is not inside, nor it has been - relayToButton = true; + if ( isInside ) + { + m_beenInside = true; + } + else + { + // + // Some mouse events to popup that happen outside it, before cursor + // has been inside the popu, need to be ignored by it but relayed to + // the dropbutton. + // + wxWindow* btn = m_combo->GetButton(); + if ( btn ) + btn->GetEventHandler()->AddPendingEvent(event); + else + m_combo->GetEventHandler()->AddPendingEvent(event); + + return; + } + + event.Skip(); } } - if ( relayToButton ) - { - wxWindow* btn = m_combo->GetButton(); - if ( btn ) - btn->GetEventHandler()->ProcessEvent(event); - else - // Bypass the event handling mechanism. Using it would be - // confusing for the platform-specific wxComboCtrl - // implementations. - m_combo->HandleButtonMouseEvent(event, 0); - } + event.Skip(); } -// ---------------------------------------------------------------------------- -// wxComboCtrlTextCtrl -// ---------------------------------------------------------------------------- - -class wxComboCtrlTextCtrl : public wxTextCtrl -{ -public: - wxComboCtrlTextCtrl() : wxTextCtrl() { } - virtual ~wxComboCtrlTextCtrl() { } - - virtual wxWindow *GetMainWindowOfCompositeControl() - { - wxComboCtrl* combo = (wxComboCtrl*) GetParent(); - - // Returning this instead of just 'parent' lets FindFocus work - // correctly even when parent control is a child of a composite - // generic control (as is case with wxGenericDatePickerCtrl). - return combo->GetMainWindowOfCompositeControl(); - } -}; - // ---------------------------------------------------------------------------- // wxComboCtrlBase // ---------------------------------------------------------------------------- BEGIN_EVENT_TABLE(wxComboCtrlBase, wxControl) + EVT_TEXT(wxID_ANY,wxComboCtrlBase::OnTextCtrlEvent) EVT_SIZE(wxComboCtrlBase::OnSizeEvent) EVT_SET_FOCUS(wxComboCtrlBase::OnFocusEvent) EVT_KILL_FOCUS(wxComboCtrlBase::OnFocusEvent) EVT_IDLE(wxComboCtrlBase::OnIdleEvent) //EVT_BUTTON(wxID_ANY,wxComboCtrlBase::OnButtonClickEvent) EVT_KEY_DOWN(wxComboCtrlBase::OnKeyEvent) - EVT_CHAR(wxComboCtrlBase::OnCharEvent) + EVT_TEXT_ENTER(wxID_ANY,wxComboCtrlBase::OnTextCtrlEvent) EVT_SYS_COLOUR_CHANGED(wxComboCtrlBase::OnSysColourChanged) END_EVENT_TABLE() @@ -974,18 +735,18 @@ IMPLEMENT_ABSTRACT_CLASS(wxComboCtrlBase, wxControl) void wxComboCtrlBase::Init() { - m_winPopup = NULL; - m_popup = NULL; + m_winPopup = (wxWindow *)NULL; + m_popup = (wxWindow *)NULL; m_popupWinState = Hidden; - m_btn = NULL; - m_text = NULL; - m_popupInterface = NULL; + m_btn = (wxWindow*) NULL; + m_text = (wxTextCtrl*) NULL; + m_popupInterface = (wxComboPopup*) NULL; - m_popupEvtHandler = NULL; - m_textEvtHandler = NULL; + m_popupExtraHandler = (wxEvtHandler*) NULL; + m_textEvtHandler = (wxEvtHandler*) NULL; #if INSTALL_TOPLEV_HANDLER - m_toplevEvtHandler = NULL; + m_toplevEvtHandler = (wxEvtHandler*) NULL; #endif m_mainCtrlWnd = this; @@ -1007,13 +768,11 @@ void wxComboCtrlBase::Init() m_extLeft = 0; m_extRight = 0; - m_marginLeft = -1; + m_absIndent = -1; m_iFlags = 0; - m_textCtrlStyle = 0; m_timeCanAcceptClick = 0; m_resetFocus = false; - m_hasTcBgCol = false; } bool wxComboCtrlBase::Create(wxWindow *parent, @@ -1038,16 +797,15 @@ bool wxComboCtrlBase::Create(wxWindow *parent, // Get colours OnThemeChange(); - m_marginLeft = GetNativeTextIndent(); + m_absIndent = GetNativeTextIndent(); m_iFlags |= wxCC_IFLAG_CREATED; // If x and y indicate valid size, wxSizeEvent won't be - // emitted automatically, so we need to add artificial one. + // emitted automatically, so we need to add artifical one. if ( size.x > 0 && size.y > 0 ) { wxSizeEvent evt(size,GetId()); - evt.SetEventObject(this); GetEventHandler()->AddPendingEvent(evt); } @@ -1064,7 +822,7 @@ void wxComboCtrlBase::InstallInputHandlers() } void -wxComboCtrlBase::CreateTextCtrl(int style) +wxComboCtrlBase::CreateTextCtrl(int style, const wxValidator& validator) { if ( !(m_windowStyle & wxCB_READONLY) ) { @@ -1075,7 +833,7 @@ wxComboCtrlBase::CreateTextCtrl(int style) // not used by the wxPropertyGrid and therefore the tab is processed by // looking at ancestors to see if they have wxTAB_TRAVERSAL. The // navigation event is then sent to the wrong window. - style |= wxTE_PROCESS_TAB | m_textCtrlStyle; + style |= wxTE_PROCESS_TAB; if ( HasFlag(wxTE_PROCESS_ENTER) ) style |= wxTE_PROCESS_ENTER; @@ -1088,53 +846,31 @@ wxComboCtrlBase::CreateTextCtrl(int style) else m_ignoreEvtText = 0; - m_text = new wxComboCtrlTextCtrl(); - m_text->Create(this, wxID_ANY, m_valueString, - wxDefaultPosition, wxSize(10,-1), - style); - - // Connecting the events is currently the most reliable way - wxWindowID id = m_text->GetId(); - m_text->Connect(id, wxEVT_COMMAND_TEXT_UPDATED, - wxCommandEventHandler(wxComboCtrlBase::OnTextCtrlEvent), - NULL, this); - m_text->Connect(id, wxEVT_COMMAND_TEXT_ENTER, - wxCommandEventHandler(wxComboCtrlBase::OnTextCtrlEvent), - NULL, this); - - m_text->SetHint(m_hintText); + m_text = new wxTextCtrl(this, wxID_ANY, m_valueString, + wxDefaultPosition, wxSize(10,-1), + style, validator); } } void wxComboCtrlBase::OnThemeChange() { - // Because wxComboCtrl has transparent parts on most platforms, we - // don't want to touch the actual background colour. Instead, we just - // usually re-obtain m_tcBgCol here. - -#if defined(__WXMSW__) || defined(__WXGTK__) - wxVisualAttributes vattrs = wxComboBox::GetClassDefaultAttributes(); -#else - wxVisualAttributes vattrs; - vattrs.colFg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT); - vattrs.colBg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); -#endif - - if ( !m_hasTcBgCol ) - m_tcBgCol = vattrs.colBg; - + // Leave the default bg on the Mac so the area used by the focus ring will + // be the correct colour and themed brush. Instead we'll use + // wxSYS_COLOUR_WINDOW in the EVT_PAINT handler as needed. #ifndef __WXMAC__ - // Only change the colours if application has not specified - // custom ones. - if ( !m_hasFgCol ) + if ( !m_hasBgCol ) { - SetOwnForegroundColour(vattrs.colFg); +#ifdef __WXGTK__ + // Set background to gtk_rc_get_style(m_widget)->bg[GTK_STATE_NORMAL], + // which can be different than the background of text entry. + wxColour bgCol = GetDefaultAttributes().colBg; +#else + wxColour bgCol = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); +#endif + SetOwnBackgroundColour(bgCol); + m_hasBgCol = false; } - if ( !HasTransparentBackground() ) - { - SetOwnBackgroundColour(GetParent()->GetBackgroundColour()); - } -#endif // !__WXMAC__ +#endif } wxComboCtrlBase::~wxComboCtrlBase() @@ -1144,7 +880,7 @@ wxComboCtrlBase::~wxComboCtrlBase() #if INSTALL_TOPLEV_HANDLER delete ((wxComboFrameEventHandler*)m_toplevEvtHandler); - m_toplevEvtHandler = NULL; + m_toplevEvtHandler = (wxEvtHandler*) NULL; #endif DestroyPopup(); @@ -1171,19 +907,13 @@ void wxComboCtrlBase::CalculateAreas( int btnWidth ) // its platform default or bitmap+pushbutton background is used, but not if // there is vertical size adjustment or horizontal spacing. if ( ( (m_iFlags & wxCC_BUTTON_OUTSIDE_BORDER) || - (m_bmpNormal.IsOk() && m_blankButtonBg) ) && + (m_bmpNormal.Ok() && m_blankButtonBg) ) && m_btnSpacingX == 0 && m_btnHei <= 0 ) { m_iFlags |= wxCC_IFLAG_BUTTON_OUTSIDE; btnBorder = 0; } - else if ( (m_iFlags & wxCC_BUTTON_COVERS_BORDER) && - m_btnSpacingX == 0 && !m_bmpNormal.IsOk() ) - { - m_iFlags &= ~(wxCC_IFLAG_BUTTON_OUTSIDE); - btnBorder = 0; - } else { m_iFlags &= ~(wxCC_IFLAG_BUTTON_OUTSIDE); @@ -1191,8 +921,8 @@ void wxComboCtrlBase::CalculateAreas( int btnWidth ) } // Defaul indentation - if ( m_marginLeft < 0 ) - m_marginLeft = GetNativeTextIndent(); + if ( m_absIndent < 0 ) + m_absIndent = GetNativeTextIndent(); int butWidth = btnWidth; @@ -1236,7 +966,7 @@ void wxComboCtrlBase::CalculateAreas( int btnWidth ) // It is larger // OR // button width is set to default and blank button bg is not drawn - if ( m_bmpNormal.IsOk() ) + if ( m_bmpNormal.Ok() ) { int bmpReqWidth = m_bmpNormal.GetWidth(); int bmpReqHeight = m_bmpNormal.GetHeight(); @@ -1258,11 +988,6 @@ void wxComboCtrlBase::CalculateAreas( int btnWidth ) { int newY = butHeight+(customBorder*2); SetClientSize(wxDefaultCoord,newY); - if ( m_bmpNormal.IsOk() || m_btnArea.width != butWidth || m_btnArea.height != butHeight ) - m_iFlags |= wxCC_IFLAG_HAS_NONSTANDARD_BUTTON; - else - m_iFlags &= ~wxCC_IFLAG_HAS_NONSTANDARD_BUTTON; - sz.y = newY; } } @@ -1296,60 +1021,43 @@ void wxComboCtrlBase::PositionTextCtrl( int textCtrlXAdjust, int textCtrlYAdjust if ( !m_text ) return; +#if !TEXTCTRL_TEXT_CENTERED + wxSize sz = GetClientSize(); int customBorder = m_widthCustomBorder; if ( (m_text->GetWindowStyleFlag() & wxBORDER_MASK) == wxNO_BORDER ) { - int x; - - if ( !m_widthCustomPaint ) - { - // No special custom paint area - we can use 0 left margin - // with wxTextCtrl. - if ( m_text->SetMargins(0) ) - textCtrlXAdjust = 0; - x = m_tcArea.x + m_marginLeft + textCtrlXAdjust; - } - else - { - // There is special custom paint area - it is better to - // use some margin with the wxTextCtrl. - m_text->SetMargins(m_marginLeft); - x = m_tcArea.x + m_widthCustomPaint + - m_marginLeft + textCtrlXAdjust; - } - - // Centre textctrl vertically, if needed -#if !TEXTCTRL_TEXT_CENTERED + // Centre textctrl int tcSizeY = m_text->GetBestSize().y; - int diff0 = sz.y - tcSizeY; - int y = textCtrlYAdjust + (diff0/2); -#else - wxUnusedVar(textCtrlYAdjust); - int y = 0; -#endif + int diff = sz.y - tcSizeY; + int y = textCtrlYAdjust + (diff/2); if ( y < customBorder ) y = customBorder; - m_text->SetSize(x, - y, - m_tcArea.width - m_tcArea.x - x, - -1 ); + m_text->SetSize( m_tcArea.x + m_widthCustomPaint + m_absIndent + textCtrlXAdjust, + y, + m_tcArea.width - COMBO_MARGIN - + (textCtrlXAdjust + m_widthCustomPaint + m_absIndent), + -1 ); // Make sure textctrl doesn't exceed the bottom custom border wxSize tsz = m_text->GetSize(); - int diff1 = (y + tsz.y) - (sz.y - customBorder); - if ( diff1 >= 0 ) + diff = (y + tsz.y) - (sz.y - customBorder); + if ( diff >= 0 ) { - tsz.y = tsz.y - diff1 - 1; + tsz.y = tsz.y - diff - 1; m_text->SetSize(tsz); } } else +#else // TEXTCTRL_TEXT_CENTERED + wxUnusedVar(textCtrlXAdjust); + wxUnusedVar(textCtrlYAdjust); +#endif // !TEXTCTRL_TEXT_CENTERED/TEXTCTRL_TEXT_CENTERED { - // If it has border, have textctrl fill the entire text field. + // If it has border, have textctrl will the entire text field. m_text->SetSize( m_tcArea.x + m_widthCustomPaint, m_tcArea.y, m_tcArea.width - m_widthCustomPaint, @@ -1367,16 +1075,16 @@ wxSize wxComboCtrlBase::DoGetBestSize() const // TODO: Better method to calculate close-to-native control height. int fhei; - if ( m_font.IsOk() ) + if ( m_font.Ok() ) fhei = (m_font.GetPointSize()*2) + 5; - else if ( wxNORMAL_FONT->IsOk() ) + else if ( wxNORMAL_FONT->Ok() ) fhei = (wxNORMAL_FONT->GetPointSize()*2) + 5; else fhei = sizeText.y + 4; - // Need to force height to accommodate bitmap? + // Need to force height to accomodate bitmap? int btnSizeY = m_btnSize.y; - if ( m_bmpNormal.IsOk() && fhei < btnSizeY ) + if ( m_bmpNormal.Ok() && fhei < btnSizeY ) fhei = btnSizeY; // Control height doesn't depend on border @@ -1446,7 +1154,7 @@ bool wxComboCtrlBase::Enable(bool enable) m_btn->Enable(enable); if ( m_text ) m_text->Enable(enable); - + Refresh(); return true; @@ -1471,15 +1179,8 @@ bool wxComboCtrlBase::SetFont ( const wxFont& font ) if ( !wxControl::SetFont(font) ) return false; - if ( m_text ) - { - // Without hiding the wxTextCtrl there would be some - // visible 'flicker' (at least on Windows XP). - m_text->Hide(); + if (m_text) m_text->SetFont(font); - OnResize(); - m_text->Show(); - } return true; } @@ -1498,38 +1199,30 @@ void wxComboCtrlBase::DoSetToolTip(wxToolTip *tooltip) } else { - if ( m_text ) m_text->SetToolTip( NULL ); - if ( m_btn ) m_btn->SetToolTip( NULL ); + if ( m_text ) m_text->SetToolTip( (wxToolTip*) NULL ); + if ( m_btn ) m_btn->SetToolTip( (wxToolTip*) NULL ); } } #endif // wxUSE_TOOLTIPS -bool wxComboCtrlBase::SetForegroundColour(const wxColour& colour) +#if wxUSE_VALIDATORS +void wxComboCtrlBase::SetValidator(const wxValidator& validator) { - if ( wxControl::SetForegroundColour(colour) ) - { - if ( m_text ) - m_text->SetForegroundColour(colour); - return true; - } - return false; + wxTextCtrl* textCtrl = GetTextCtrl(); + + if ( textCtrl ) + textCtrl->SetValidator( validator ); + else + wxControl::SetValidator( validator ); } -bool wxComboCtrlBase::SetBackgroundColour(const wxColour& colour) +wxValidator* wxComboCtrlBase::GetValidator() { - if ( m_text ) - m_text->SetBackgroundColour(colour); - m_tcBgCol = colour; - m_hasTcBgCol = true; - return true; -} + wxTextCtrl* textCtrl = GetTextCtrl(); -wxColour wxComboCtrlBase::GetBackgroundColour() const -{ - if ( m_text ) - return m_text->GetBackgroundColour(); - return m_tcBgCol; + return textCtrl ? textCtrl->GetValidator() : wxControl::GetValidator(); } +#endif // wxUSE_VALIDATORS // ---------------------------------------------------------------------------- // painting @@ -1541,7 +1234,7 @@ void wxComboCtrlBase::PrepareBackground( wxDC& dc, const wxRect& rect, int flags { wxSize sz = GetClientSize(); bool isEnabled; - bool doDrawFocusRect; // also selected + bool isFocused; // also selected // For smaller size control (and for disabled background) use less spacing int focusSpacingX; @@ -1551,7 +1244,7 @@ void wxComboCtrlBase::PrepareBackground( wxDC& dc, const wxRect& rect, int flags { // Drawing control isEnabled = IsEnabled(); - doDrawFocusRect = ShouldDrawFocus() && !(m_iFlags & wxCC_FULL_BUTTON); + isFocused = ShouldDrawFocus(); // Windows-style: for smaller size control (and for disabled background) use less spacing focusSpacingX = isEnabled ? 2 : 1; @@ -1561,7 +1254,7 @@ void wxComboCtrlBase::PrepareBackground( wxDC& dc, const wxRect& rect, int flags { // Drawing a list item isEnabled = true; // they are never disabled - doDrawFocusRect = (flags & wxCONTROL_SELECTED) != 0; + isFocused = flags & wxCONTROL_SELECTED ? true : false; focusSpacingX = 0; focusSpacingY = 0; @@ -1580,71 +1273,51 @@ void wxComboCtrlBase::PrepareBackground( wxDC& dc, const wxRect& rect, int flags selRect.x += wcp + focusSpacingX; selRect.width -= wcp + (focusSpacingX*2); - wxColour bgCol; wxColour fgCol; + wxColour bgCol; - bool doDrawSelRect = true; - - // Determine foreground colour if ( isEnabled ) { - if ( doDrawFocusRect ) - { + if ( isFocused ) fgCol = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT); - } else if ( m_hasFgCol ) - { // Honour the custom foreground colour fgCol = GetForegroundColour(); - } else - { fgCol = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT); - } } else { fgCol = wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT); } - // Determine background colour if ( isEnabled ) { - if ( doDrawFocusRect ) - { + if ( isFocused ) bgCol = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT); - } - else if ( m_hasTcBgCol ) - { + else if ( m_hasBgCol ) // Honour the custom background colour - bgCol = m_tcBgCol; - } - else - { -#ifndef __WXMAC__ // see note in OnThemeChange - doDrawSelRect = false; bgCol = GetBackgroundColour(); -#else + else +#if defined(__WXMAC__) || defined(__WXGTK__) // see note in OnThemeChange bgCol = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); +#else + bgCol = GetBackgroundColour(); #endif - } } else { -#ifndef __WXMAC__ // see note in OnThemeChange - bgCol = GetBackgroundColour(); -#else +#if defined(__WXMAC__) || defined(__WXGTK__) // see note in OnThemeChange bgCol = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); +#else + bgCol = GetBackgroundColour(); #endif } dc.SetTextForeground( fgCol ); dc.SetBrush( bgCol ); - if ( doDrawSelRect ) - { - dc.SetPen( bgCol ); - dc.DrawRectangle( selRect ); - } + dc.SetPen( bgCol ); + dc.DrawRectangle( selRect ); // Don't clip exactly to the selection rectangle so we can draw // to the non-selected area in front of it. @@ -1663,9 +1336,10 @@ void wxComboCtrlBase::DrawButton( wxDC& dc, const wxRect& rect, int flags ) { int drawState = m_btnState; - if ( (m_iFlags & wxCC_BUTTON_STAYS_DOWN) && - GetPopupWindowState() >= Animating ) +#ifdef __WXGTK__ + if ( GetPopupWindowState() >= Animating ) drawState |= wxCONTROL_PRESSED; +#endif wxRect drawRect(rect.x+m_btnSpacingX, rect.y+((rect.height-m_btnSize.y)/2), @@ -1683,29 +1357,26 @@ void wxComboCtrlBase::DrawButton( wxDC& dc, const wxRect& rect, int flags ) if ( !enabled ) drawState |= wxCONTROL_DISABLED; - // Need to clear button background even if m_btn is present - // and also when using custom bitmap for the button - if ( (flags & Button_PaintBackground) && - (!HasTransparentBackground() || - !(m_iFlags & wxCC_IFLAG_BUTTON_OUTSIDE)) ) + if ( !m_bmpNormal.Ok() ) { - wxColour bgCol; - - if ( m_iFlags & wxCC_IFLAG_BUTTON_OUTSIDE ) - bgCol = GetParent()->GetBackgroundColour(); - else - bgCol = GetBackgroundColour(); - - dc.SetBrush(bgCol); - dc.SetPen(bgCol); - dc.DrawRectangle(rect); - } - - if ( !m_bmpNormal.IsOk() ) - { - if ( flags & Button_BitmapOnly ) + if ( flags & Draw_BitmapOnly ) return; + // Need to clear button background even if m_btn is present + if ( flags & Draw_PaintBg ) + { + wxColour bgCol; + + if ( m_iFlags & wxCC_IFLAG_BUTTON_OUTSIDE ) + bgCol = GetParent()->GetBackgroundColour(); + else + bgCol = GetBackgroundColour(); + + dc.SetBrush(bgCol); + dc.SetPen(bgCol); + dc.DrawRectangle(rect); + } + // Draw standard button wxRendererNative::Get().DrawComboBoxDropButton(this, dc, @@ -1729,13 +1400,30 @@ void wxComboCtrlBase::DrawButton( wxDC& dc, const wxRect& rect, int flags ) if ( m_blankButtonBg ) { - if ( !(flags & Button_BitmapOnly) ) + // If using blank button background, we need to clear its background + // with button face colour instead of colour for rest of the control. + if ( flags & Draw_PaintBg ) { - wxRendererNative::Get().DrawPushButton(this, - dc, - drawRect, - drawState); + wxColour bgCol = GetParent()->GetBackgroundColour(); //wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE); + //wxColour bgCol = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); + dc.SetPen(bgCol); + dc.SetBrush(bgCol); + dc.DrawRectangle(rect); } + + wxRendererNative::Get().DrawPushButton(this, + dc, + drawRect, + drawState); + + } + else + + { + // Need to clear button background even if m_btn is present + // (assume non-button background was cleared just before this call so brushes are good) + if ( flags & Draw_PaintBg ) + dc.DrawRectangle(rect); } // Draw bitmap centered in drawRect @@ -1751,7 +1439,6 @@ void wxComboCtrlBase::RecalcAndRefresh() if ( IsCreated() ) { wxSizeEvent evt(GetSize(),GetId()); - evt.SetEventObject(this); GetEventHandler()->ProcessEvent(evt); Refresh(); } @@ -1763,13 +1450,6 @@ void wxComboCtrlBase::RecalcAndRefresh() void wxComboCtrlBase::OnTextCtrlEvent(wxCommandEvent& event) { - // Avoid infinite recursion - if ( event.GetEventObject() == this ) - { - event.Skip(); - return; - } - if ( event.GetEventType() == wxEVT_COMMAND_TEXT_UPDATED ) { if ( m_ignoreEvtText > 0 ) @@ -1779,25 +1459,23 @@ void wxComboCtrlBase::OnTextCtrlEvent(wxCommandEvent& event) } } - // For safety, completely re-create a new wxCommandEvent - wxCommandEvent evt2(event); - evt2.SetId(GetId()); - evt2.SetEventObject(this); - HandleWindowEvent(evt2); - - event.StopPropagation(); + // Change event id, object and string before relaying it forward + event.SetId(GetId()); + wxString s = event.GetString(); + event.SetEventObject(this); + event.SetString(s); + event.Skip(); } // call if cursor is on button area or mouse is captured for the button bool wxComboCtrlBase::HandleButtonMouseEvent( wxMouseEvent& event, - int flags ) + int flags ) { int type = event.GetEventType(); if ( type == wxEVT_MOTION ) { - if ( (flags & wxCC_MF_ON_BUTTON) && - IsPopupWindowState(Hidden) ) + if ( flags & wxCC_MF_ON_BUTTON ) { if ( !(m_btnState & wxCONTROL_CURRENT) ) { @@ -1866,11 +1544,6 @@ bool wxComboCtrlBase::HandleButtonMouseEvent( wxMouseEvent& event, else return false; - // Never have 'hot' state when popup is being shown - // (this is mostly needed because of the animation). - if ( !IsPopupWindowState(Hidden) ) - m_btnState &= ~wxCONTROL_CURRENT; - return true; } @@ -1881,19 +1554,19 @@ bool wxComboCtrlBase::PreprocessMouseEvent( wxMouseEvent& event, wxLongLong t = ::wxGetLocalTimeMillis(); int evtType = event.GetEventType(); -#if USES_WXPOPUPWINDOW || USES_GENERICTLW +#if USES_WXPOPUPWINDOW || USES_WXDIALOG if ( m_popupWinType != POPUPWIN_WXPOPUPTRANSIENTWINDOW ) { if ( IsPopupWindowState(Visible) && ( evtType == wxEVT_LEFT_DOWN || evtType == wxEVT_RIGHT_DOWN ) ) { - HidePopup(true); + HidePopup(); return true; } } #endif - // Filter out clicks on button immediately after popup dismiss + // Filter out clicks on button immediately after popup dismiss (Windows like behaviour) if ( evtType == wxEVT_LEFT_DOWN && t < m_timeCanAcceptClick ) { event.SetEventType(0); @@ -1915,7 +1588,7 @@ void wxComboCtrlBase::HandleNormalMouseEvent( wxMouseEvent& event ) #if USES_WXPOPUPWINDOW // Click here always hides the popup. if ( m_popupWinType == POPUPWIN_WXPOPUPWINDOW ) - HidePopup(true); + HidePopup(); #endif } else @@ -1935,35 +1608,15 @@ void wxComboCtrlBase::HandleNormalMouseEvent( wxMouseEvent& event ) } } } - else if ( evtType == wxEVT_MOUSEWHEEL ) + else + if ( IsPopupShown() ) { - if ( IsPopupShown() ) - { - // relay (some) mouse events to the popup - m_popup->GetEventHandler()->ProcessEvent(event); - } - else if ( event.GetWheelAxis() == 0 && - event.GetWheelRotation() != 0 && - event.GetModifiers() == 0 ) - { - // Translate mousewheel actions into key up/down. This is - // the simplest way of getting native behaviour: scrolling the - // wheel moves selection up/down by one item. - wxKeyEvent kevent(wxEVT_KEY_DOWN); - kevent.m_keyCode = event.GetWheelRotation() > 0 - ? WXK_UP - : WXK_DOWN; - GetEventHandler()->ProcessEvent(kevent); - } - else - { - event.Skip(); - } + // relay (some) mouse events to the popup + if ( evtType == wxEVT_MOUSEWHEEL ) + m_popup->AddPendingEvent(event); } else if ( evtType ) - { event.Skip(); - } } void wxComboCtrlBase::OnKeyEvent(wxKeyEvent& event) @@ -1971,16 +1624,26 @@ void wxComboCtrlBase::OnKeyEvent(wxKeyEvent& event) if ( IsPopupShown() ) { // pass it to the popped up control - GetPopupControl()->GetControl()->GetEventHandler()->ProcessEvent(event); + GetPopupControl()->GetControl()->AddPendingEvent(event); } else // no popup { + int keycode = event.GetKeyCode(); + wxWindow* mainCtrl = GetMainWindowOfCompositeControl(); - if ( mainCtrl->GetParent()->HasFlag(wxTAB_TRAVERSAL) ) + if ( mainCtrl->GetParent()->HasFlag(wxTAB_TRAVERSAL) && + keycode == WXK_TAB ) { - if ( mainCtrl->HandleAsNavigationKey(event) ) - return; + wxNavigationKeyEvent evt; + + evt.SetFlags(wxNavigationKeyEvent::FromTab| + (!event.ShiftDown() ? wxNavigationKeyEvent::IsForward + : wxNavigationKeyEvent::IsBackward)); + evt.SetEventObject(mainCtrl); + evt.SetCurrentFocus(mainCtrl); + mainCtrl->GetParent()->GetEventHandler()->AddPendingEvent(evt); + return; } if ( IsKeyPopupToggle(event) ) @@ -1998,8 +1661,6 @@ void wxComboCtrlBase::OnKeyEvent(wxKeyEvent& event) return; } - int keycode = event.GetKeyCode(); - if ( (comboStyle & wxCB_READONLY) || (keycode != WXK_RIGHT && keycode != WXK_LEFT) ) { @@ -2010,42 +1671,20 @@ void wxComboCtrlBase::OnKeyEvent(wxKeyEvent& event) } } -void wxComboCtrlBase::OnCharEvent(wxKeyEvent& event) -{ - if ( IsPopupShown() ) - { - // pass it to the popped up control - GetPopupControl()->GetControl()->GetEventHandler()->ProcessEvent(event); - } - else // no popup - { - wxComboPopup* popupInterface = GetPopupControl(); - if ( popupInterface ) - { - popupInterface->OnComboCharEvent(event); - } - else - { - event.Skip(); - } - } -} - void wxComboCtrlBase::OnFocusEvent( wxFocusEvent& event ) { -// On Mac, this leads to infinite recursion and eventually a crash -#ifndef __WXMAC__ if ( event.GetEventType() == wxEVT_SET_FOCUS ) { wxWindow* tc = GetTextCtrl(); if ( tc && tc != DoFindFocus() ) - { +#ifdef __WXMAC__ + m_resetFocus = true; +#else tc->SetFocus(); - } +#endif } Refresh(); -#endif } void wxComboCtrlBase::OnIdleEvent( wxIdleEvent& WXUNUSED(event) ) @@ -2062,9 +1701,9 @@ void wxComboCtrlBase::OnIdleEvent( wxIdleEvent& WXUNUSED(event) ) void wxComboCtrlBase::OnSysColourChanged(wxSysColourChangedEvent& WXUNUSED(event)) { OnThemeChange(); - // left margin may also have changed - if ( !(m_iFlags & wxCC_IFLAG_LEFT_MARGIN_SET) ) - m_marginLeft = GetNativeTextIndent(); + // indentation may also have changed + if ( !(m_iFlags & wxCC_IFLAG_INDENT_SET) ) + m_absIndent = GetNativeTextIndent(); RecalcAndRefresh(); } @@ -2083,28 +1722,17 @@ void wxComboCtrlBase::CreatePopup() #ifdef wxComboPopupWindowBase2 if ( m_iFlags & wxCC_IFLAG_USE_ALT_POPUP ) { - #if !USES_GENERICTLW + #if !USES_WXDIALOG m_winPopup = new wxComboPopupWindowBase2( this, wxNO_BORDER ); #else - int tlwFlags = wxNO_BORDER; - #ifdef wxCC_GENERIC_TLW_IS_FRAME - tlwFlags |= wxFRAME_NO_TASKBAR; - #endif - - #ifdef wxCC_GENERIC_TLW_IS_NONOWNEDWINDOW - m_winPopup = new wxComboPopupWindowBase2( this, wxID_ANY, - wxPoint(-21,-21), wxSize(20, 20), - tlwFlags ); - #else m_winPopup = new wxComboPopupWindowBase2( this, wxID_ANY, wxEmptyString, wxPoint(-21,-21), wxSize(20, 20), - tlwFlags ); - #endif + wxNO_BORDER ); #endif m_popupWinType = SECONDARY_POPUP_TYPE; } else -#endif // wxComboPopupWindowBase2 +#endif { m_winPopup = new wxComboPopupWindow( this, wxNO_BORDER ); m_popupWinType = PRIMARY_POPUP_TYPE; @@ -2116,8 +1744,8 @@ void wxComboCtrlBase::CreatePopup() popupInterface->Create(m_winPopup); m_popup = popup = popupInterface->GetControl(); - m_popupEvtHandler = new wxComboPopupEvtHandler(this); - popup->PushEventHandler( m_popupEvtHandler ); + m_popupExtraHandler = new wxComboPopupExtraEventHandler(this); + popup->PushEventHandler( m_popupExtraHandler ); // This may be helpful on some platforms // (eg. it bypasses a wxGTK popupwindow bug where @@ -2130,29 +1758,27 @@ void wxComboCtrlBase::CreatePopup() // Destroy popup window and the child control void wxComboCtrlBase::DestroyPopup() { - HidePopup(true); + HidePopup(); if ( m_popup ) - m_popup->RemoveEventHandler(m_popupEvtHandler); + m_popup->RemoveEventHandler(m_popupExtraHandler); - wxDELETE(m_popupEvtHandler); + delete m_popupExtraHandler; - if ( m_popupInterface ) - { - // NB: DestroyPopup() performs 'delete this'. - m_popupInterface->DestroyPopup(); - m_popupInterface = NULL; - } + delete m_popupInterface; if ( m_winPopup ) { m_winPopup->RemoveEventHandler(m_popupWinEvtHandler); - wxDELETE(m_popupWinEvtHandler); + delete m_popupWinEvtHandler; + m_popupWinEvtHandler = NULL; m_winPopup->Destroy(); - m_winPopup = NULL; } - m_popup = NULL; + m_popupExtraHandler = (wxEvtHandler*) NULL; + m_popupInterface = (wxComboPopup*) NULL; + m_winPopup = (wxWindow*) NULL; + m_popup = (wxWindow*) NULL; } void wxComboCtrlBase::DoSetPopupControl(wxComboPopup* iface) @@ -2172,11 +1798,11 @@ void wxComboCtrlBase::DoSetPopupControl(wxComboPopup* iface) } else { - m_popup = NULL; + m_popup = (wxWindow*) NULL; } // This must be done after creation - if ( !m_valueString.empty() ) + if ( m_valueString.length() ) { iface->SetStringValue(m_valueString); //Refresh(); @@ -2194,30 +1820,10 @@ void wxComboCtrlBase::OnButtonClick() { // Derived classes can override this method for totally custom // popup action - switch ( GetPopupWindowState() ) - { - case Hidden: - { - Popup(); - break; - } - - case Animating: - case Visible: - { - HidePopup(true); - break; - } - } -} - -void wxComboCtrlBase::Popup() -{ - wxCommandEvent event(wxEVT_COMMAND_COMBOBOX_DROPDOWN, GetId()); - event.SetEventObject(this); - HandleWindowEvent(event); - - ShowPopup(); + if ( !IsPopupWindowState(Visible) ) + ShowPopup(); + else + HidePopup(); } void wxComboCtrlBase::ShowPopup() @@ -2264,8 +1870,7 @@ void wxComboCtrlBase::ShowPopup() // that if transient popup is open, then tab traversal is to be ignored. // However, I think this code would still be needed for cases where // transient popup doesn't work yet (wxWinCE?). - wxWindow* mainCtrl = GetMainWindowOfCompositeControl(); - wxWindow* parent = mainCtrl->GetParent(); + wxWindow* parent = GetParent(); int parentFlags = parent->GetWindowStyle(); if ( parentFlags & wxTAB_TRAVERSAL ) { @@ -2416,21 +2021,9 @@ void wxComboCtrlBase::DoShowPopup( const wxRect& rect, int WXUNUSED(flags) ) // (though the bug was probably fixed). winPopup->SetSize( rect ); -#if USES_WXPOPUPTRANSIENTWINDOW - if ( m_popupWinType == POPUPWIN_WXPOPUPTRANSIENTWINDOW ) - ((wxPopupTransientWindow*)winPopup)->Popup(m_popup); - else -#endif - winPopup->Show(); + winPopup->Show(); m_popupWinState = Visible; - - // If popup window was a generic top-level window, or the - // wxPopupWindow implemenation on this platform is classified as - // perfect, then we should be able to safely set focus to the popup - // control. - if ( IsPopupWinTypePerfect(m_popupWinType) ) - m_popup->SetFocus(); } else if ( IsPopupWindowState(Hidden) ) { @@ -2440,11 +2033,9 @@ void wxComboCtrlBase::DoShowPopup( const wxRect& rect, int WXUNUSED(flags) ) m_popupWinState = Hidden; } - - Refresh(); } -void wxComboCtrlBase::OnPopupDismiss(bool generateEvent) +void wxComboCtrlBase::OnPopupDismiss() { // Just in case, avoid double dismiss if ( IsPopupWindowState(Hidden) ) @@ -2460,8 +2051,8 @@ void wxComboCtrlBase::OnPopupDismiss(bool generateEvent) // Inform popup control itself m_popupInterface->OnDismiss(); - if ( m_popupEvtHandler ) - ((wxComboPopupEvtHandler*)m_popupEvtHandler)->OnPopupDismiss(); + if ( m_popupExtraHandler ) + ((wxComboPopupExtraEventHandler*)m_popupExtraHandler)->OnPopupDismiss(); #if INSTALL_TOPLEV_HANDLER // Remove top level window event handler @@ -2496,16 +2087,9 @@ void wxComboCtrlBase::OnPopupDismiss(bool generateEvent) Refresh(); SetFocus(); - - if ( generateEvent ) - { - wxCommandEvent event(wxEVT_COMMAND_COMBOBOX_CLOSEUP, GetId()); - event.SetEventObject(this); - HandleWindowEvent(event); - } } -void wxComboCtrlBase::HidePopup(bool generateEvent) +void wxComboCtrlBase::HidePopup() { // Should be able to call this without popup interface if ( IsPopupWindowState(Hidden) ) @@ -2513,11 +2097,11 @@ void wxComboCtrlBase::HidePopup(bool generateEvent) // transfer value and show it in textctrl, if any if ( !IsPopupWindowState(Animating) ) - SetValueByUser( m_popupInterface->GetStringValue() ); + SetValue( m_popupInterface->GetStringValue() ); m_winPopup->Hide(); - OnPopupDismiss(generateEvent); + OnPopupDismiss(); } // ---------------------------------------------------------------------------- @@ -2566,17 +2150,17 @@ void wxComboCtrlBase::SetButtonBitmaps( const wxBitmap& bmpNormal, m_bmpNormal = bmpNormal; m_blankButtonBg = blankButtonBg; - if ( bmpPressed.IsOk() ) + if ( bmpPressed.Ok() ) m_bmpPressed = bmpPressed; else m_bmpPressed = bmpNormal; - if ( bmpHover.IsOk() ) + if ( bmpHover.Ok() ) m_bmpHover = bmpHover; else m_bmpHover = bmpNormal; - if ( bmpDisabled.IsOk() ) + if ( bmpDisabled.Ok() ) m_bmpDisabled = bmpDisabled; else m_bmpDisabled = bmpNormal; @@ -2601,139 +2185,68 @@ void wxComboCtrlBase::SetCustomPaintWidth( int width ) RecalcAndRefresh(); } -bool wxComboCtrlBase::DoSetMargins(const wxPoint& margins) -{ - // For general sanity's sake, we ignore top margin. Instead - // we will always try to center the text vertically. - bool res = true; - - if ( margins.x != -1 ) - { - m_marginLeft = margins.x; - m_iFlags |= wxCC_IFLAG_LEFT_MARGIN_SET; - } - else - { - m_marginLeft = GetNativeTextIndent(); - m_iFlags &= ~(wxCC_IFLAG_LEFT_MARGIN_SET); - } - - if ( margins.y != -1 ) - { - res = false; - } - - RecalcAndRefresh(); - - return res; -} - -wxPoint wxComboCtrlBase::DoGetMargins() const -{ - return wxPoint(m_marginLeft, -1); -} - -#if WXWIN_COMPATIBILITY_2_8 void wxComboCtrlBase::SetTextIndent( int indent ) { if ( indent < 0 ) { - m_marginLeft = GetNativeTextIndent(); - m_iFlags &= ~(wxCC_IFLAG_LEFT_MARGIN_SET); + m_absIndent = GetNativeTextIndent(); + m_iFlags &= ~(wxCC_IFLAG_INDENT_SET); } else { - m_marginLeft = indent; - m_iFlags |= wxCC_IFLAG_LEFT_MARGIN_SET; + m_absIndent = indent; + m_iFlags |= wxCC_IFLAG_INDENT_SET; } RecalcAndRefresh(); } -wxCoord wxComboCtrlBase::GetTextIndent() const -{ - return m_marginLeft; -} -#endif - wxCoord wxComboCtrlBase::GetNativeTextIndent() const { return DEFAULT_TEXT_INDENT; } -void wxComboCtrlBase::SetTextCtrlStyle( int style ) -{ - m_textCtrlStyle = style; - - if ( m_text ) - m_text->SetWindowStyle(style); -} - // ---------------------------------------------------------------------------- -// wxTextEntry interface +// methods forwarded to wxTextCtrl // ---------------------------------------------------------------------------- -wxString wxComboCtrlBase::DoGetValue() const +wxString wxComboCtrlBase::GetValue() const { if ( m_text ) return m_text->GetValue(); return m_valueString; } -void wxComboCtrlBase::SetValueWithEvent(const wxString& value, - bool withEvent) +void wxComboCtrlBase::SetValueWithEvent(const wxString& value, bool withEvent) { - DoSetValue(value, withEvent ? SetValue_SendEvent : 0); -} + if ( m_text ) + { + if ( !withEvent ) + m_ignoreEvtText++; -void wxComboCtrlBase::OnSetValue(const wxString& value) -{ - // Note: before wxComboCtrl inherited from wxTextEntry, - // this code used to be in SetValueWithEvent(). + m_text->SetValue(value); + if ( !(m_iFlags & wxCC_NO_TEXT_AUTO_SELECT) ) + m_text->SelectAll(); + } // Since wxComboPopup may want to paint the combo as well, we need // to set the string value here (as well as sometimes in ShowPopup). if ( m_valueString != value ) { - bool found = true; - wxString trueValue = value; + m_valueString = value; - // Conform to wxComboBox behaviour: read-only control can only accept - // valid list items and empty string - if ( m_popupInterface && HasFlag(wxCB_READONLY) && value.length() ) - { - found = m_popupInterface->FindItem(value, - &trueValue); - } + EnsurePopupControl(); - if ( found ) - { - m_valueString = trueValue; - - EnsurePopupControl(); - - if ( m_popupInterface ) - m_popupInterface->SetStringValue(trueValue); - } + if (m_popupInterface) + m_popupInterface->SetStringValue(value); } Refresh(); } -void wxComboCtrlBase::SetValueByUser(const wxString& value) +void wxComboCtrlBase::SetValue(const wxString& value) { - // NB: Order of function calls is important here. Otherwise - // the SelectAll() may not work. - - if ( m_text ) - { - m_text->SetValue(value); - - if ( !(m_iFlags & wxCC_NO_TEXT_AUTO_SELECT) ) - m_text->SelectAll(); - } - - OnSetValue(value); + SetValueWithEvent(value, false); } // In this SetValue variant wxComboPopup::SetStringValue is not called @@ -2778,6 +2291,12 @@ void wxComboCtrlBase::SetInsertionPoint(long pos) m_text->SetInsertionPoint(pos); } +void wxComboCtrlBase::SetInsertionPointEnd() +{ + if ( m_text ) + m_text->SetInsertionPointEnd(); +} + long wxComboCtrlBase::GetInsertionPoint() const { if ( m_text ) @@ -2794,48 +2313,16 @@ long wxComboCtrlBase::GetLastPosition() const return 0; } -void wxComboCtrlBase::WriteText(const wxString& text) -{ - if ( m_text ) - { - m_text->WriteText(text); - OnSetValue(m_text->GetValue()); - } - else - { - OnSetValue(text); - } -} - -void wxComboCtrlBase::DoSetValue(const wxString& value, int flags) -{ - if ( m_text ) - { - if ( flags & SetValue_SendEvent ) - m_text->SetValue(value); - else - m_text->ChangeValue(value); - } - - OnSetValue(value); -} - void wxComboCtrlBase::Replace(long from, long to, const wxString& value) { if ( m_text ) - { m_text->Replace(from, to, value); - OnSetValue(m_text->GetValue()); - } } void wxComboCtrlBase::Remove(long from, long to) { if ( m_text ) - { m_text->Remove(from, to); - OnSetValue(m_text->GetValue()); - } } void wxComboCtrlBase::SetSelection(long from, long to) @@ -2844,73 +2331,10 @@ void wxComboCtrlBase::SetSelection(long from, long to) m_text->SetSelection(from, to); } -void wxComboCtrlBase::GetSelection(long *from, long *to) const -{ - if ( m_text ) - { - m_text->GetSelection(from, to); - } - else - { - *from = 0; - *to = 0; - } -} - -bool wxComboCtrlBase::IsEditable() const -{ - if ( m_text ) - return m_text->IsEditable(); - return false; -} - -void wxComboCtrlBase::SetEditable(bool editable) -{ - if ( m_text ) - m_text->SetEditable(editable); -} - void wxComboCtrlBase::Undo() { if ( m_text ) m_text->Undo(); } -void wxComboCtrlBase::Redo() -{ - if ( m_text ) - m_text->Redo(); -} - -bool wxComboCtrlBase::CanUndo() const -{ - if ( m_text ) - return m_text->CanUndo(); - - return false; -} - -bool wxComboCtrlBase::CanRedo() const -{ - if ( m_text ) - return m_text->CanRedo(); - - return false; -} - -bool wxComboCtrlBase::SetHint(const wxString& hint) -{ - m_hintText = hint; - bool res = true; - if ( m_text ) - res = m_text->SetHint(hint); - Refresh(); - return res; -} - -wxString wxComboCtrlBase::GetHint() const -{ - return m_hintText; -} - #endif // wxUSE_COMBOCTRL diff --git a/Source/3rd Party/wx/src/common/config.cpp b/Source/3rd Party/wx/src/common/config.cpp index 8a3513d2b..1079e46be 100644 --- a/Source/3rd Party/wx/src/common/config.cpp +++ b/Source/3rd Party/wx/src/common/config.cpp @@ -4,8 +4,8 @@ // Author: Vadim Zeitlin // Modified by: // Created: 07.04.98 -// RCS-ID: $Id$ -// Copyright: (c) 1997 Karsten Ballueder Ballueder@usa.net +// RCS-ID: $Id: config.cpp 50711 2007-12-15 02:57:58Z VZ $ +// Copyright: (c) 1997 Karsten Ballueder Ballueder@usa.net // Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -37,13 +37,11 @@ #if wxUSE_CONFIG && ((wxUSE_FILE && wxUSE_TEXTFILE) || wxUSE_CONFIG_NATIVE) -#include "wx/apptrait.h" #include "wx/file.h" #include #include #include // for INT_MAX -#include // for FLT_MAX // ---------------------------------------------------------------------------- // global and class static variables @@ -56,24 +54,9 @@ bool wxConfigBase::ms_bAutoCreate = true; // implementation // ============================================================================ -// ---------------------------------------------------------------------------- -// wxAppTraitsBase -// ---------------------------------------------------------------------------- - -wxConfigBase *wxAppTraitsBase::CreateConfig() -{ - return new - #if defined(__WINDOWS__) && wxUSE_CONFIG_NATIVE - wxRegConfig(wxTheApp->GetAppName(), wxTheApp->GetVendorName()); - #else // either we're under Unix or wish to use files even under Windows - wxFileConfig(wxTheApp->GetAppName()); - #endif -} - // ---------------------------------------------------------------------------- // wxConfigBase // ---------------------------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxConfigBase, wxObject) // Not all args will always be used by derived classes, but including them all // in each class ensures compatibility. @@ -103,10 +86,14 @@ wxConfigBase *wxConfigBase::Set(wxConfigBase *pConfig) wxConfigBase *wxConfigBase::Create() { if ( ms_bAutoCreate && ms_pConfig == NULL ) { - wxAppTraits * const traits = wxTheApp ? wxTheApp->GetTraits() : NULL; - wxCHECK_MSG( traits, NULL, wxT("create wxApp before calling this") ); - - ms_pConfig = traits->CreateConfig(); + ms_pConfig = + #if defined(__WXMSW__) && wxUSE_CONFIG_NATIVE + new wxRegConfig(wxTheApp->GetAppName(), wxTheApp->GetVendorName()); + #elif defined(__WXPALMOS__) && wxUSE_CONFIG_NATIVE + new wxPrefConfig(wxTheApp->GetAppName()); + #else // either we're under Unix or wish to use files even under Windows + new wxFileConfig(wxTheApp->GetAppName()); + #endif } return ms_pConfig; @@ -120,7 +107,7 @@ wxConfigBase *wxConfigBase::Create() #define IMPLEMENT_READ_FOR_TYPE(name, type, deftype, extra) \ bool wxConfigBase::Read(const wxString& key, type *val) const \ { \ - wxCHECK_MSG( val, false, wxT("wxConfig::Read(): NULL parameter") ); \ + wxCHECK_MSG( val, false, _T("wxConfig::Read(): NULL parameter") ); \ \ if ( !DoRead##name(key, val) ) \ return false; \ @@ -134,7 +121,7 @@ wxConfigBase *wxConfigBase::Create() type *val, \ deftype defVal) const \ { \ - wxCHECK_MSG( val, false, wxT("wxConfig::Read(): NULL parameter") ); \ + wxCHECK_MSG( val, false, _T("wxConfig::Read(): NULL parameter") ); \ \ bool read = DoRead##name(key, val); \ if ( !read ) \ @@ -155,79 +142,38 @@ wxConfigBase *wxConfigBase::Create() IMPLEMENT_READ_FOR_TYPE(String, wxString, const wxString&, ExpandEnvVars) IMPLEMENT_READ_FOR_TYPE(Long, long, long, long) +IMPLEMENT_READ_FOR_TYPE(Int, int, int, int) IMPLEMENT_READ_FOR_TYPE(Double, double, double, double) IMPLEMENT_READ_FOR_TYPE(Bool, bool, bool, bool) #undef IMPLEMENT_READ_FOR_TYPE -// int is stored as long -bool wxConfigBase::Read(const wxString& key, int *pi) const -{ - long l = *pi; - bool r = Read(key, &l); - wxASSERT_MSG( l < INT_MAX, wxT("int overflow in wxConfig::Read") ); - *pi = (int)l; - return r; -} - -bool wxConfigBase::Read(const wxString& key, int *pi, int defVal) const -{ - long l = *pi; - bool r = Read(key, &l, defVal); - wxASSERT_MSG( l < INT_MAX, wxT("int overflow in wxConfig::Read") ); - *pi = (int)l; - return r; -} - -// Read floats as doubles then just type cast it down. -bool wxConfigBase::Read(const wxString& key, float* val) const -{ - wxCHECK_MSG( val, false, wxT("wxConfig::Read(): NULL parameter") ); - - double temp; - if ( !Read(key, &temp) ) - return false; - - wxCHECK_MSG( fabs(temp) <= FLT_MAX, false, - wxT("float overflow in wxConfig::Read") ); - wxCHECK_MSG( (temp == 0.0) || (fabs(temp) >= FLT_MIN), false, - wxT("float underflow in wxConfig::Read") ); - - *val = static_cast(temp); - - return true; -} - -bool wxConfigBase::Read(const wxString& key, float* val, float defVal) const -{ - wxCHECK_MSG( val, false, wxT("wxConfig::Read(): NULL parameter") ); - - if ( Read(key, val) ) - return true; - - *val = defVal; - return false; -} - // the DoReadXXX() for the other types have implementation in the base class // but can be overridden in the derived ones -bool wxConfigBase::DoReadBool(const wxString& key, bool* val) const +bool wxConfigBase::DoReadInt(const wxString& key, int *pi) const { - wxCHECK_MSG( val, false, wxT("wxConfig::Read(): NULL parameter") ); + wxCHECK_MSG( pi, false, _T("wxConfig::Read(): NULL parameter") ); long l; if ( !DoReadLong(key, &l) ) return false; - if ( l != 0 && l != 1 ) - { - // Don't assert here as this could happen in the result of user editing - // the file directly and this not indicate a bug in the program but - // still complain that something is wrong. - wxLogWarning(_("Invalid value %ld for a boolean key \"%s\" in " - "config file."), - l, key); - } + wxASSERT_MSG( l < INT_MAX, _T("overflow in wxConfig::DoReadInt") ); + + *pi = (int)l; + + return true; +} + +bool wxConfigBase::DoReadBool(const wxString& key, bool* val) const +{ + wxCHECK_MSG( val, false, _T("wxConfig::Read(): NULL parameter") ); + + long l; + if ( !DoReadLong(key, &l) ) + return false; + + wxASSERT_MSG( l == 0 || l == 1, _T("bad bool value in wxConfig::DoReadInt") ); *val = l != 0; @@ -239,14 +185,7 @@ bool wxConfigBase::DoReadDouble(const wxString& key, double* val) const wxString str; if ( Read(key, &str) ) { - if ( str.ToCDouble(val) ) - return true; - - // Previous versions of wxFileConfig wrote the numbers out using the - // current locale and not the C one as now, so attempt to parse the - // string as a number in the current locale too, for compatibility. - if ( str.ToDouble(val) ) - return true; + return str.ToDouble(val); } return false; @@ -269,10 +208,12 @@ wxString wxConfigBase::ExpandEnvVars(const wxString& str) const bool wxConfigBase::DoWriteDouble(const wxString& key, double val) { - // Notice that we always write out the numbers in C locale and not the - // current one. This makes the config files portable between machines using - // different locales. - return DoWriteString(key, wxString::FromCDouble(val)); + return DoWriteString(key, wxString::Format(_T("%g"), val)); +} + +bool wxConfigBase::DoWriteInt(const wxString& key, int value) +{ + return DoWriteLong(key, (long)value); } bool wxConfigBase::DoWriteBool(const wxString& key, bool value) @@ -288,11 +229,10 @@ wxConfigPathChanger::wxConfigPathChanger(const wxConfigBase *pContainer, const wxString& strEntry) { m_bChanged = false; - m_pContainer = const_cast(pContainer); + m_pContainer = (wxConfigBase *)pContainer; - // the path is everything which precedes the last slash and the name is - // everything after it -- and this works correctly if there is no slash too - wxString strPath = strEntry.BeforeLast(wxCONFIG_PATH_SEPARATOR, &m_strName); + // the path is everything which precedes the last slash + wxString strPath = strEntry.BeforeLast(wxCONFIG_PATH_SEPARATOR); // except in the special case of "/keyname" when there is nothing before "/" if ( strPath.empty() && @@ -310,20 +250,27 @@ wxConfigPathChanger::wxConfigPathChanger(const wxConfigBase *pContainer, /* JACS: work around a memory bug that causes an assert when using wxRegConfig, related to reference-counting. - Can be reproduced by removing .wc_str() below and + Can be reproduced by removing (const wxChar*) below and adding the following code to the config sample OnInit under Windows: pConfig->SetPath(wxT("MySettings")); pConfig->SetPath(wxT("..")); int value; - pConfig->Read(wxT("MainWindowX"), & value); + pConfig->Read(_T("MainWindowX"), & value); */ - m_strOldPath = m_pContainer->GetPath().wc_str(); + m_strOldPath = (const wxChar*) m_pContainer->GetPath(); if ( *m_strOldPath.c_str() != wxCONFIG_PATH_SEPARATOR ) m_strOldPath += wxCONFIG_PATH_SEPARATOR; m_pContainer->SetPath(strPath); } + + // in any case, use the just the name, not full path + m_strName = strEntry.AfterLast(wxCONFIG_PATH_SEPARATOR); + } + else { + // it's a name only, without path - nothing to do + m_strName = strEntry; } } @@ -385,7 +332,7 @@ enum Bracket Bracket_None, Bracket_Normal = ')', Bracket_Curly = '}', -#ifdef __WINDOWS__ +#ifdef __WXMSW__ Bracket_Windows = '%', // yeah, Windows people are a bit strange ;-) #endif Bracket_Max @@ -398,23 +345,23 @@ wxString wxExpandEnvVars(const wxString& str) size_t m; for ( size_t n = 0; n < str.length(); n++ ) { - switch ( str[n].GetValue() ) { -#ifdef __WINDOWS__ + switch ( str[n] ) { +#ifdef __WXMSW__ case wxT('%'): -#endif // __WINDOWS__ +#endif //WINDOWS case wxT('$'): { Bracket bracket; - #ifdef __WINDOWS__ + #ifdef __WXMSW__ if ( str[n] == wxT('%') ) bracket = Bracket_Windows; else - #endif // __WINDOWS__ + #endif //WINDOWS if ( n == str.length() - 1 ) { bracket = Bracket_None; } else { - switch ( str[n + 1].GetValue() ) { + switch ( str[n + 1] ) { case wxT('('): bracket = Bracket_Normal; n++; // skip the bracket @@ -438,22 +385,21 @@ wxString wxExpandEnvVars(const wxString& str) wxString strVarName(str.c_str() + n + 1, m - n - 1); #ifdef __WXWINCE__ - const bool expanded = false; + const wxChar *pszValue = NULL; #else // NB: use wxGetEnv instead of wxGetenv as otherwise variables // set through wxSetEnv may not be read correctly! - bool expanded = false; + const wxChar *pszValue = NULL; wxString tmp; if (wxGetEnv(strVarName, &tmp)) - { - strResult += tmp; - expanded = true; - } - else + pszValue = tmp; #endif - { + if ( pszValue != NULL ) { + strResult += pszValue; + } + else { // variable doesn't exist => don't change anything - #ifdef __WINDOWS__ + #ifdef __WXMSW__ if ( bracket != Bracket_Windows ) #endif if ( bracket != Bracket_None ) @@ -470,14 +416,14 @@ wxString wxExpandEnvVars(const wxString& str) // // under Unix, OTOH, this warning could be useful for the user to // understand why isn't the variable expanded as intended - #ifndef __WINDOWS__ + #ifndef __WXMSW__ wxLogWarning(_("Environment variables expansion failed: missing '%c' at position %u in '%s'."), (char)bracket, (unsigned int) (m + 1), str.c_str()); - #endif // __WINDOWS__ + #endif // __WXMSW__ } else { // skip closing bracket unless the variables wasn't expanded - if ( !expanded ) + if ( pszValue == NULL ) strResult << (wxChar)bracket; m++; } @@ -487,7 +433,7 @@ wxString wxExpandEnvVars(const wxString& str) } break; - case wxT('\\'): + case '\\': // backslash can be used to suppress special meaning of % and $ if ( n != str.length() - 1 && (str[n + 1] == wxT('%') || str[n + 1] == wxT('$')) ) { @@ -506,27 +452,23 @@ wxString wxExpandEnvVars(const wxString& str) } // this function is used to properly interpret '..' in path -void wxSplitPath(wxArrayString& aParts, const wxString& path) +void wxSplitPath(wxArrayString& aParts, const wxChar *sz) { aParts.clear(); wxString strCurrent; - wxString::const_iterator pc = path.begin(); + const wxChar *pc = sz; for ( ;; ) { - if ( pc == path.end() || *pc == wxCONFIG_PATH_SEPARATOR ) { + if ( *pc == wxT('\0') || *pc == wxCONFIG_PATH_SEPARATOR ) { if ( strCurrent == wxT(".") ) { // ignore } else if ( strCurrent == wxT("..") ) { // go up one level if ( aParts.size() == 0 ) - { - wxLogWarning(_("'%s' has extra '..', ignored."), path); - } + wxLogWarning(_("'%s' has extra '..', ignored."), sz); else - { aParts.erase(aParts.end() - 1); - } strCurrent.Empty(); } @@ -537,12 +479,12 @@ void wxSplitPath(wxArrayString& aParts, const wxString& path) //else: // could log an error here, but we prefer to ignore extra '/' - if ( pc == path.end() ) + if ( *pc == wxT('\0') ) break; } else strCurrent += *pc; - ++pc; + pc++; } } diff --git a/Source/3rd Party/wx/src/common/containr.cpp b/Source/3rd Party/wx/src/common/containr.cpp index b80d0c7e5..275ffb574 100644 --- a/Source/3rd Party/wx/src/common/containr.cpp +++ b/Source/3rd Party/wx/src/common/containr.cpp @@ -4,9 +4,9 @@ // Author: Vadim Zeitlin // Modified by: // Created: 06.08.01 -// RCS-ID: $Id$ +// RCS-ID: $Id: containr.cpp 44273 2007-01-21 01:21:45Z VZ $ // Copyright: (c) 2001 Vadim Zeitlin -// Licence: wxWindows licence +// License: wxWindows licence /////////////////////////////////////////////////////////////////////////////// // ============================================================================ @@ -24,116 +24,72 @@ #pragma hdrstop #endif -#ifndef WX_PRECOMP - #include "wx/containr.h" -#endif - #ifndef WX_PRECOMP #include "wx/log.h" #include "wx/event.h" #include "wx/window.h" #include "wx/scrolbar.h" #include "wx/radiobut.h" + #include "wx/containr.h" #endif //WX_PRECOMP // trace mask for focus messages -#define TRACE_FOCUS wxT("focus") +#define TRACE_FOCUS _T("focus") // ============================================================================ // implementation // ============================================================================ -// ---------------------------------------------------------------------------- -// wxControlContainerBase -// ---------------------------------------------------------------------------- - -void wxControlContainerBase::SetCanFocus(bool acceptsFocus) +wxControlContainer::wxControlContainer(wxWindow *winParent) { - if ( acceptsFocus == m_acceptsFocus ) - return; - - m_acceptsFocus = acceptsFocus; - - m_winParent->SetCanFocus(m_acceptsFocus); + m_winParent = winParent; + m_winLastFocused = NULL; + m_inSetFocus = false; } -bool wxControlContainerBase::HasAnyFocusableChildren() const +bool wxControlContainer::AcceptsFocus() const { - const wxWindowList& children = m_winParent->GetChildren(); - for ( wxWindowList::const_iterator i = children.begin(), - end = children.end(); - i != end; - ++i ) + // if we're not shown or disabled, we can't accept focus + if ( m_winParent->IsShown() && m_winParent->IsEnabled() ) { - const wxWindow * const child = *i; - - if ( !m_winParent->IsClientAreaChild(child) ) - continue; - - if ( child->CanAcceptFocus() ) + // otherwise we can accept focus either if we have no children at all + // (in this case we're probably not used as a container) or only when + // at least one child will accept focus + wxWindowList::compatibility_iterator node = m_winParent->GetChildren().GetFirst(); + if ( !node ) return true; + +#ifdef __WXMAC__ + // wxMac has eventually the two scrollbars as children, they don't count + // as real children in the algorithm mentioned above + bool hasRealChildren = false ; +#endif + + while ( node ) + { + wxWindow *child = node->GetData(); + node = node->GetNext(); + +#ifdef __WXMAC__ + if ( m_winParent->MacIsWindowScrollbar( child ) ) + continue; + hasRealChildren = true ; +#endif + if ( child->AcceptsFocus() ) + { + return true; + } + } + +#ifdef __WXMAC__ + if ( !hasRealChildren ) + return true ; +#endif } return false; } -bool wxControlContainerBase::DoSetFocus() -{ - wxLogTrace(TRACE_FOCUS, wxT("SetFocus on wxPanel 0x%p."), - m_winParent->GetHandle()); - - if (m_inSetFocus) - return true; - - // when the panel gets the focus we move the focus to either the last - // window that had the focus or the first one that can get it unless the - // focus had been already set to some other child - - wxWindow *win = wxWindow::FindFocus(); - while ( win ) - { - if ( win == m_winParent ) - { - // our child already has focus, don't take it away from it - return true; - } - - if ( win->IsTopLevel() ) - { - // don't look beyond the first top level parent - useless and - // unnecessary - break; - } - - win = win->GetParent(); - } - - // protect against infinite recursion: - m_inSetFocus = true; - - bool ret = SetFocusToChild(); - - m_inSetFocus = false; - - return ret; -} - -bool wxControlContainerBase::SetFocusToChild() -{ - return wxSetFocusToChild(m_winParent, &m_winLastFocused); -} - -#ifndef wxHAS_NATIVE_TAB_TRAVERSAL - -// ---------------------------------------------------------------------------- -// generic wxControlContainer -// ---------------------------------------------------------------------------- - -wxControlContainer::wxControlContainer() -{ - m_winLastFocused = NULL; -} - void wxControlContainer::SetLastFocus(wxWindow *win) { // the panel itself should never get the focus at all but if it does happen @@ -157,7 +113,7 @@ void wxControlContainer::SetLastFocus(wxWindow *win) // (under wxGTK) wxASSERT_MSG( winParent, - wxT("Setting last focus for a window that is not our child?") ); + _T("Setting last focus for a window that is not our child?") ); } } @@ -165,15 +121,24 @@ void wxControlContainer::SetLastFocus(wxWindow *win) if ( win ) { - wxLogTrace(TRACE_FOCUS, wxT("Set last focus to %s(%s)"), + wxLogTrace(TRACE_FOCUS, _T("Set last focus to %s(%s)"), win->GetClassInfo()->GetClassName(), win->GetLabel().c_str()); } else { - wxLogTrace(TRACE_FOCUS, wxT("No more last focus")); + wxLogTrace(TRACE_FOCUS, _T("No more last focus")); } } + + // propagate the last focus upwards so that our parent can set focus back + // to us if it loses it now and regains later + wxWindow *parent = m_winParent->GetParent(); + if ( parent ) + { + wxChildFocusEvent eventFocus(m_winParent); + parent->GetEventHandler()->ProcessEvent(eventFocus); + } } // -------------------------------------------------------------------- @@ -181,7 +146,7 @@ void wxControlContainer::SetLastFocus(wxWindow *win) // within the same group. Used by wxSetFocusToChild on wxMSW // -------------------------------------------------------------------- -#if defined(__WXMSW__) && wxUSE_RADIOBTN +#ifdef __WXMSW__ wxRadioButton* wxGetPreviousButtonInGroup(wxRadioButton *btn) { @@ -190,7 +155,7 @@ wxRadioButton* wxGetPreviousButtonInGroup(wxRadioButton *btn) const wxWindowList& siblings = btn->GetParent()->GetChildren(); wxWindowList::compatibility_iterator nodeThis = siblings.Find(btn); - wxCHECK_MSG( nodeThis, NULL, wxT("radio button not a child of its parent?") ); + wxCHECK_MSG( nodeThis, NULL, _T("radio button not a child of its parent?") ); // Iterate over all previous siblings until we find the next radio button wxWindowList::compatibility_iterator nodeBefore = nodeThis->GetPrevious(); @@ -220,7 +185,7 @@ wxRadioButton* wxGetNextButtonInGroup(wxRadioButton *btn) const wxWindowList& siblings = btn->GetParent()->GetChildren(); wxWindowList::compatibility_iterator nodeThis = siblings.Find(btn); - wxCHECK_MSG( nodeThis, NULL, wxT("radio button not a child of its parent?") ); + wxCHECK_MSG( nodeThis, NULL, _T("radio button not a child of its parent?") ); // Iterate over all previous siblings until we find the next radio button wxWindowList::compatibility_iterator nodeNext = nodeThis->GetNext(); @@ -303,10 +268,7 @@ wxRadioButton* wxGetSelectedButtonInGroup(wxRadioButton *btn) void wxControlContainer::HandleOnNavigationKey( wxNavigationKeyEvent& event ) { - // for a TLW we shouldn't involve the parent window, it has nothing to do - // with keyboard navigation inside this TLW - wxWindow *parent = m_winParent->IsTopLevel() ? NULL - : m_winParent->GetParent(); + wxWindow *parent = m_winParent->GetParent(); // the event is propagated downwards if the event emitter was our parent bool goingDown = event.GetEventObject() == parent; @@ -385,7 +347,7 @@ void wxControlContainer::HandleOnNavigationKey( wxNavigationKeyEvent& event ) { // just to be sure it's not used (normally this is not necessary, but // doesn't hurt neither) - m_winLastFocused = NULL; + m_winLastFocused = (wxWindow *)NULL; // start from first or last depending on where we're going node = forward ? children.GetFirst() : children.GetLast(); @@ -407,12 +369,12 @@ void wxControlContainer::HandleOnNavigationKey( wxNavigationKeyEvent& event ) if ( winFocus ) { -#if defined(__WXMSW__) && wxUSE_RADIOBTN +#ifdef __WXMSW__ // If we are in a radio button group, start from the first item in the // group if ( event.IsFromTab() && wxIsKindOf(winFocus, wxRadioButton ) ) winFocus = wxGetFirstButtonInGroup((wxRadioButton*)winFocus); -#endif // __WXMSW__ +#endif // ok, we found the focus - now is it our child? start_node = children.Find( winFocus ); } @@ -459,21 +421,18 @@ void wxControlContainer::HandleOnNavigationKey( wxNavigationKeyEvent& event ) // looping inside this panel (normally, the focus will go to // the next/previous item after this panel in the parent // panel). - wxWindow *focusedParent = m_winParent; + wxWindow *focussed_child_of_parent = m_winParent; while ( parent ) { - // We don't want to tab into a different dialog or frame or - // even an MDI child frame, so test for this explicitly - // (and in particular don't just use IsTopLevel() which - // would return false in the latter case). - if ( focusedParent->IsTopNavigationDomain() ) + // we don't want to tab into a different dialog or frame + if ( focussed_child_of_parent->IsTopLevel() ) break; - event.SetCurrentFocus( focusedParent ); + event.SetCurrentFocus( focussed_child_of_parent ); if ( parent->GetEventHandler()->ProcessEvent( event ) ) return; - focusedParent = parent; + focussed_child_of_parent = parent; parent = parent->GetParent(); } @@ -489,15 +448,7 @@ void wxControlContainer::HandleOnNavigationKey( wxNavigationKeyEvent& event ) wxWindow *child = node->GetData(); - // don't TAB to another TLW - if ( child->IsTopLevel() ) - { - node = forward ? node->GetNext() : node->GetPrevious(); - - continue; - } - -#if defined(__WXMSW__) && wxUSE_RADIOBTN +#ifdef __WXMSW__ if ( event.IsFromTab() ) { if ( wxIsKindOf(child, wxRadioButton) ) @@ -522,27 +473,24 @@ void wxControlContainer::HandleOnNavigationKey( wxNavigationKeyEvent& event ) wxIsKindOf(m_winLastFocused, wxRadioButton) && !m_winLastFocused->HasFlag(wxRB_SINGLE) ) { - wxRadioButton * const - lastBtn = static_cast(m_winLastFocused); - // cursor keys don't navigate out of a radio button group so // find the correct radio button to focus if ( forward ) { - child = wxGetNextButtonInGroup(lastBtn); + child = wxGetNextButtonInGroup((wxRadioButton*)m_winLastFocused); if ( !child ) { // no next button in group, set it to the first button - child = wxGetFirstButtonInGroup(lastBtn); + child = wxGetFirstButtonInGroup((wxRadioButton*)m_winLastFocused); } } else { - child = wxGetPreviousButtonInGroup(lastBtn); + child = wxGetPreviousButtonInGroup((wxRadioButton*)m_winLastFocused); if ( !child ) { // no previous button in group, set it to the last button - child = wxGetLastButtonInGroup(lastBtn); + child = wxGetLastButtonInGroup((wxRadioButton*)m_winLastFocused); } } @@ -556,7 +504,7 @@ void wxControlContainer::HandleOnNavigationKey( wxNavigationKeyEvent& event ) } #endif // __WXMSW__ - if ( child->CanAcceptFocusFromKeyboard() ) + if ( child->AcceptsFocusFromKeyboard() ) { // if we're setting the focus to a child panel we should prevent it // from giving it to the child which had the focus the last time @@ -601,9 +549,50 @@ void wxControlContainer::HandleOnWindowDestroy(wxWindowBase *child) // focus handling // ---------------------------------------------------------------------------- +bool wxControlContainer::DoSetFocus() +{ + wxLogTrace(TRACE_FOCUS, _T("SetFocus on wxPanel 0x%p."), + m_winParent->GetHandle()); + + if (m_inSetFocus) + return true; + + // when the panel gets the focus we move the focus to either the last + // window that had the focus or the first one that can get it unless the + // focus had been already set to some other child + + wxWindow *win = wxWindow::FindFocus(); + while ( win ) + { + if ( win == m_winParent ) + { + // our child already has focus, don't take it away from it + return true; + } + + if ( win->IsTopLevel() ) + { + // don't look beyond the first top level parent - useless and + // unnecessary + break; + } + + win = win->GetParent(); + } + + // protect against infinite recursion: + m_inSetFocus = true; + + bool ret = SetFocusToChild(); + + m_inSetFocus = false; + + return ret; +} + void wxControlContainer::HandleOnFocus(wxFocusEvent& event) { - wxLogTrace(TRACE_FOCUS, wxT("OnFocus on wxPanel 0x%p, name: %s"), + wxLogTrace(TRACE_FOCUS, _T("OnFocus on wxPanel 0x%p, name: %s"), m_winParent->GetHandle(), m_winParent->GetName().c_str() ); @@ -612,18 +601,11 @@ void wxControlContainer::HandleOnFocus(wxFocusEvent& event) event.Skip(); } - -#else - // wxHAS_NATIVE_TAB_TRAVERSAL - bool wxControlContainer::SetFocusToChild() { - return wxSetFocusToChild(m_winParent, NULL); + return wxSetFocusToChild(m_winParent, &m_winLastFocused); } - -#endif // !wxHAS_NATIVE_TAB_TRAVERSAL - // ---------------------------------------------------------------------------- // SetFocusToChild(): this function is used by wxPanel but also by wxFrame in // wxMSW, this is why it is outside of wxControlContainer class @@ -631,50 +613,28 @@ bool wxControlContainer::SetFocusToChild() bool wxSetFocusToChild(wxWindow *win, wxWindow **childLastFocused) { - wxCHECK_MSG( win, false, wxT("wxSetFocusToChild(): invalid window") ); - // wxCHECK_MSG( childLastFocused, false, - // wxT("wxSetFocusToChild(): NULL child poonter") ); + wxCHECK_MSG( win, false, _T("wxSetFocusToChild(): invalid window") ); + wxCHECK_MSG( childLastFocused, false, + _T("wxSetFocusToChild(): NULL child poonter") ); - if ( childLastFocused && *childLastFocused ) + if ( *childLastFocused ) { // It might happen that the window got reparented if ( (*childLastFocused)->GetParent() == win ) { - // And it also could have become hidden in the meanwhile - // We want to focus on the deepest widget visible - wxWindow *deepestVisibleWindow = NULL; + wxLogTrace(TRACE_FOCUS, + _T("SetFocusToChild() => last child (0x%p)."), + (*childLastFocused)->GetHandle()); - while ( *childLastFocused ) - { - if ( (*childLastFocused)->IsShown() ) - { - if ( !deepestVisibleWindow ) - deepestVisibleWindow = *childLastFocused; - } - else - deepestVisibleWindow = NULL; - - *childLastFocused = (*childLastFocused)->GetParent(); - } - - if ( deepestVisibleWindow ) - { - *childLastFocused = deepestVisibleWindow; - - wxLogTrace(TRACE_FOCUS, - wxT("SetFocusToChild() => last child (0x%p)."), - (*childLastFocused)->GetHandle()); - - // not SetFocusFromKbd(): we're restoring focus back to the old - // window and not setting it as the result of a kbd action - (*childLastFocused)->SetFocus(); - return true; - } + // not SetFocusFromKbd(): we're restoring focus back to the old + // window and not setting it as the result of a kbd action + (*childLastFocused)->SetFocus(); + return true; } else { // it doesn't count as such any more - *childLastFocused = NULL; + *childLastFocused = (wxWindow *)NULL; } } @@ -685,13 +645,14 @@ bool wxSetFocusToChild(wxWindow *win, wxWindow **childLastFocused) wxWindow *child = node->GetData(); node = node->GetNext(); - // skip special windows: - if ( !win->IsClientAreaChild(child) ) +#ifdef __WXMAC__ + if ( child->GetParent()->MacIsWindowScrollbar( child ) ) continue; - - if ( child->CanAcceptFocusFromKeyboard() && !child->IsTopLevel() ) +#endif + + if ( child->AcceptsFocusFromKeyboard() && !child->IsTopLevel() ) { -#if defined(__WXMSW__) && wxUSE_RADIOBTN +#ifdef __WXMSW__ // If a radiobutton is the first focusable child, search for the // selected radiobutton in the same group wxRadioButton* btn = wxDynamicCast(child, wxRadioButton); @@ -701,14 +662,13 @@ bool wxSetFocusToChild(wxWindow *win, wxWindow **childLastFocused) if (selected) child = selected; } -#endif // __WXMSW__ +#endif wxLogTrace(TRACE_FOCUS, - wxT("SetFocusToChild() => first child (0x%p)."), + _T("SetFocusToChild() => first child (0x%p)."), child->GetHandle()); - if (childLastFocused) - *childLastFocused = child; + *childLastFocused = child; child->SetFocusFromKbd(); return true; } @@ -716,4 +676,3 @@ bool wxSetFocusToChild(wxWindow *win, wxWindow **childLastFocused) return false; } - diff --git a/Source/3rd Party/wx/src/common/convauto.cpp b/Source/3rd Party/wx/src/common/convauto.cpp index d043f0a0c..540f180ff 100644 --- a/Source/3rd Party/wx/src/common/convauto.cpp +++ b/Source/3rd Party/wx/src/common/convauto.cpp @@ -3,7 +3,7 @@ // Purpose: implementation of wxConvAuto // Author: Vadim Zeitlin // Created: 2006-04-04 -// RCS-ID: $Id$ +// RCS-ID: $Id: convauto.cpp 38570 2006-04-05 14:37:47Z VZ $ // Copyright: (c) 2006 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -23,199 +23,112 @@ #pragma hdrstop #endif +#if wxUSE_WCHAR_T + +#ifndef WX_PRECOMP +#endif //WX_PRECOMP + #include "wx/convauto.h" -// we use latin1 by default as it seems the least bad choice: the files we need -// to detect input of don't always come from the user system (they are often -// received from other machines) and so using wxFONTENCODING_SYSTEM doesn't -// seem to be a good idea and there is no other reasonable alternative -wxFontEncoding wxConvAuto::ms_defaultMBEncoding = wxFONTENCODING_ISO8859_1; - -namespace -{ - -const char BOM_UTF32BE[] = { '\x00', '\x00', '\xFE', '\xFF' }; -const char BOM_UTF32LE[] = { '\xFF', '\xFE', '\x00', '\x00' }; -const char BOM_UTF16BE[] = { '\xFE', '\xFF' }; -const char BOM_UTF16LE[] = { '\xFF', '\xFE' }; -const char BOM_UTF8[] = { '\xEF', '\xBB', '\xBF' }; - -} // anonymous namespace - // ============================================================================ // implementation // ============================================================================ /* static */ -void wxConvAuto::SetFallbackEncoding(wxFontEncoding enc) +wxConvAuto::BOMType wxConvAuto::DetectBOM(const char *src, size_t srcLen) { - wxASSERT_MSG( enc != wxFONTENCODING_DEFAULT, - wxT("wxFONTENCODING_DEFAULT doesn't make sense here") ); - - ms_defaultMBEncoding = enc; -} - -/* static */ -const char* wxConvAuto::GetBOMChars(wxBOM bom, size_t* count) -{ - wxCHECK_MSG( count , NULL, wxS("count pointer must be provided") ); - - switch ( bom ) + if ( srcLen < 2 ) { - case wxBOM_UTF32BE: *count = WXSIZEOF(BOM_UTF32BE); return BOM_UTF32BE; - case wxBOM_UTF32LE: *count = WXSIZEOF(BOM_UTF32LE); return BOM_UTF32LE; - case wxBOM_UTF16BE: *count = WXSIZEOF(BOM_UTF16BE); return BOM_UTF16BE; - case wxBOM_UTF16LE: *count = WXSIZEOF(BOM_UTF16LE); return BOM_UTF16LE; - case wxBOM_UTF8 : *count = WXSIZEOF(BOM_UTF8 ); return BOM_UTF8; - case wxBOM_Unknown: - case wxBOM_None: - wxFAIL_MSG( wxS("Invalid BOM type") ); - return NULL; + // minimal BOM is 2 bytes so bail out immediately and simplify the code + // below which wouldn't need to check for length for UTF-16 cases + return BOM_None; } - wxFAIL_MSG( wxS("Unknown BOM type") ); - return NULL; -} - -/* static */ -wxBOM wxConvAuto::DetectBOM(const char *src, size_t srcLen) -{ // examine the buffer for BOM presence // - // quoting from http://www.unicode.org/faq/utf_bom.html#BOM: - // - // Bytes Encoding Form - // - // 00 00 FE FF UTF-32, big-endian - // FF FE 00 00 UTF-32, little-endian - // FE FF UTF-16, big-endian - // FF FE UTF-16, little-endian - // EF BB BF UTF-8 - // - // as some BOMs are prefixes of other ones we may need to read more bytes - // to disambiguate them - - switch ( srcLen ) + // see http://www.unicode.org/faq/utf_bom.html#BOM + switch ( *src++ ) { - case 0: - return wxBOM_Unknown; - - case 1: - if ( src[0] == '\x00' || src[0] == '\xFF' || - src[0] == '\xFE' || src[0] == '\xEF') + case '\0': + // could only be big endian UTF-32 (00 00 FE FF) + if ( srcLen >= 4 && + src[0] == '\0' && + src[1] == '\xfe' && + src[2] == '\xff' ) { - // this could be a BOM but we don't know yet - return wxBOM_Unknown; + return BOM_UTF32BE; } break; - case 2: - case 3: - if ( src[0] == '\xEF' && src[1] == '\xBB' ) + case '\xfe': + // could only be big endian UTF-16 (FE FF) + if ( *src++ == '\xff' ) { - if ( srcLen == 3 ) - return src[2] == '\xBF' ? wxBOM_UTF8 : wxBOM_None; - - return wxBOM_Unknown; - } - - if ( src[0] == '\xFE' && src[1] == '\xFF' ) - return wxBOM_UTF16BE; - - if ( src[0] == '\xFF' && src[1] == '\xFE' ) - { - // if the next byte is 0, it could be an UTF-32LE BOM but if it - // isn't we can be sure it's UTF-16LE - if ( srcLen == 3 && src[2] != '\x00' ) - return wxBOM_UTF16LE; - - return wxBOM_Unknown; - } - - if ( src[0] == '\x00' && src[1] == '\x00' ) - { - // this could only be UTF-32BE, check that the data we have so - // far allows for it - if ( srcLen == 3 && src[2] != '\xFE' ) - return wxBOM_None; - - return wxBOM_Unknown; + return BOM_UTF16BE; } break; - default: - // we have at least 4 characters so we may finally decide whether - // we have a BOM or not - if ( src[0] == '\xEF' && src[1] == '\xBB' && src[2] == '\xBF' ) - return wxBOM_UTF8; + case '\xff': + // could be either little endian UTF-16 or UTF-32, both start + // with FF FE + if ( *src++ == '\xfe' ) + { + return srcLen >= 4 && src[0] == '\0' && src[1] == '\0' + ? BOM_UTF32LE + : BOM_UTF16LE; + } + break; - if ( src[0] == '\x00' && src[1] == '\x00' && - src[2] == '\xFE' && src[3] == '\xFF' ) - return wxBOM_UTF32BE; - - if ( src[0] == '\xFF' && src[1] == '\xFE' && - src[2] == '\x00' && src[3] == '\x00' ) - return wxBOM_UTF32LE; - - if ( src[0] == '\xFE' && src[1] == '\xFF' ) - return wxBOM_UTF16BE; - - if ( src[0] == '\xFF' && src[1] == '\xFE' ) - return wxBOM_UTF16LE; + case '\xef': + // is this UTF-8 BOM (EF BB BF)? + if ( srcLen >= 3 && src[0] == '\xbb' && src[1] == '\xbf' ) + { + return BOM_UTF8; + } + break; } - return wxBOM_None; + return BOM_None; } -void wxConvAuto::InitFromBOM(wxBOM bomType) +void wxConvAuto::InitFromBOM(BOMType bomType) { m_consumedBOM = false; switch ( bomType ) { - case wxBOM_Unknown: - wxFAIL_MSG( "shouldn't be called for this BOM type" ); - break; - - case wxBOM_None: - // use the default - break; - - case wxBOM_UTF32BE: + case BOM_UTF32BE: m_conv = new wxMBConvUTF32BE; m_ownsConv = true; break; - case wxBOM_UTF32LE: + case BOM_UTF32LE: m_conv = new wxMBConvUTF32LE; m_ownsConv = true; break; - case wxBOM_UTF16BE: + case BOM_UTF16BE: m_conv = new wxMBConvUTF16BE; m_ownsConv = true; break; - case wxBOM_UTF16LE: + case BOM_UTF16LE: m_conv = new wxMBConvUTF16LE; m_ownsConv = true; break; - case wxBOM_UTF8: - InitWithUTF8(); + case BOM_UTF8: + m_conv = &wxConvUTF8; + m_ownsConv = false; break; default: - wxFAIL_MSG( "unknown BOM type" ); - } + wxFAIL_MSG( _T("unexpected BOM type") ); + // fall through: still need to create something - if ( !m_conv ) - { - // we end up here if there is no BOM or we didn't recognize it somehow - // (this shouldn't happen but still don't crash if it does), so use the - // default encoding - InitWithUTF8(); - m_consumedBOM = true; // as there is nothing to consume + case BOM_None: + InitWithDefault(); + m_consumedBOM = true; // as there is nothing to consume } } @@ -224,31 +137,26 @@ void wxConvAuto::SkipBOM(const char **src, size_t *len) const int ofs; switch ( m_bomType ) { - case wxBOM_Unknown: - wxFAIL_MSG( "shouldn't be called for this BOM type" ); - return; - - case wxBOM_None: - ofs = 0; - break; - - case wxBOM_UTF32BE: - case wxBOM_UTF32LE: + case BOM_UTF32BE: + case BOM_UTF32LE: ofs = 4; break; - case wxBOM_UTF16BE: - case wxBOM_UTF16LE: + case BOM_UTF16BE: + case BOM_UTF16LE: ofs = 2; break; - case wxBOM_UTF8: + case BOM_UTF8: ofs = 3; break; default: - wxFAIL_MSG( "unknown BOM type" ); - return; + wxFAIL_MSG( _T("unexpected BOM type") ); + // fall through: still need to create something + + case BOM_None: + ofs = 0; } *src += ofs; @@ -256,15 +164,11 @@ void wxConvAuto::SkipBOM(const char **src, size_t *len) const *len -= ofs; } -bool wxConvAuto::InitFromInput(const char *src, size_t len) +void wxConvAuto::InitFromInput(const char **src, size_t *len) { - m_bomType = DetectBOM(src, len == wxNO_LEN ? strlen(src) : len); - if ( m_bomType == wxBOM_Unknown ) - return false; - + m_bomType = DetectBOM(*src, *len); InitFromBOM(m_bomType); - - return true; + SkipBOM(src, len); } size_t @@ -276,61 +180,21 @@ wxConvAuto::ToWChar(wchar_t *dst, size_t dstLen, // during this initial call but also during the first call with non-NULL // dst as typically we're first called with NULL dst to calculate the // needed buffer size - wxConvAuto *self = const_cast(this); - - + wxConvAuto *self = wx_const_cast(wxConvAuto *, this); if ( !m_conv ) { - if ( !self->InitFromInput(src, srcLen) ) - { - // there is not enough data to determine whether we have a BOM or - // not, so fail for now -- the caller is supposed to call us again - // with more data - return wxCONV_FAILED; - } + self->InitFromInput(&src, &srcLen); + if ( dst ) + self->m_consumedBOM = true; } - if ( !m_consumedBOM ) + if ( !m_consumedBOM && dst ) { - SkipBOM(&src, &srcLen); - if ( srcLen == 0 ) - { - // there is nothing left except the BOM so we'd return 0 below but - // this is unexpected: decoding a non-empty string must either fail - // or return something non-empty, in particular this would break - // the code in wxTextInputStream::NextChar() - // - // so still return an error as we need some more data to be able to - // decode it - return wxCONV_FAILED; - } - } - - // try to convert using the auto-detected encoding - size_t rc = m_conv->ToWChar(dst, dstLen, src, srcLen); - if ( rc == wxCONV_FAILED && m_bomType == wxBOM_None ) - { - // if the conversion failed but we didn't really detect anything and - // simply tried UTF-8 by default, retry it using the fall-back - if ( m_encDefault != wxFONTENCODING_MAX ) - { - if ( m_ownsConv ) - delete m_conv; - - self->m_conv = new wxCSConv(m_encDefault == wxFONTENCODING_DEFAULT - ? GetFallbackEncoding() - : m_encDefault); - self->m_ownsConv = true; - - rc = m_conv->ToWChar(dst, dstLen, src, srcLen); - } - } - - // don't skip the BOM again the next time if we really consumed it - if ( rc != wxCONV_FAILED && dst && !m_consumedBOM ) self->m_consumedBOM = true; + SkipBOM(&src, &srcLen); + } - return rc; + return m_conv->ToWChar(dst, dstLen, src, srcLen); } size_t @@ -340,8 +204,11 @@ wxConvAuto::FromWChar(char *dst, size_t dstLen, if ( !m_conv ) { // default to UTF-8 for the multibyte output - const_cast(this)->InitWithUTF8(); + wx_const_cast(wxConvAuto *, this)->InitWithDefault(); } return m_conv->FromWChar(dst, dstLen, src, srcLen); } + +#endif // wxUSE_WCHAR_T + diff --git a/Source/3rd Party/wx/src/common/cshelp.cpp b/Source/3rd Party/wx/src/common/cshelp.cpp index 7d7738459..181fd53b3 100644 --- a/Source/3rd Party/wx/src/common/cshelp.cpp +++ b/Source/3rd Party/wx/src/common/cshelp.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart, Vadim Zeitlin // Modified by: // Created: 08/09/2000 -// RCS-ID: $Id$ +// RCS-ID: $Id: cshelp.cpp 52329 2008-03-05 13:20:26Z VZ $ // Copyright: (c) 2000 Julian Smart, Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -58,7 +58,7 @@ public: //// Data wxContextHelp* m_contextHelp; - wxDECLARE_NO_COPY_CLASS(wxContextHelpEvtHandler); + DECLARE_NO_COPY_CLASS(wxContextHelpEvtHandler) }; // ============================================================================ @@ -232,7 +232,7 @@ bool wxContextHelpEvtHandler::ProcessEvent(wxEvent& event) // Dispatch the help event to the relevant window bool wxContextHelp::DispatchEvent(wxWindow* win, const wxPoint& pt) { - wxCHECK_MSG( win, false, wxT("win parameter can't be NULL") ); + wxCHECK_MSG( win, false, _T("win parameter can't be NULL") ); wxHelpEvent helpEvent(wxEVT_HELP, win->GetId(), pt, wxHelpEvent::Origin_HelpButton); @@ -284,7 +284,7 @@ wxContextHelpButton::wxContextHelpButton(wxWindow* parent, long style) #if defined(__WXPM__) : wxBitmapButton(parent, id, wxBitmap(wxCSQUERY_BITMAP - ,wxBITMAP_TYPE_BMP_RESOURCE + ,wxBITMAP_TYPE_RESOURCE ), pos, size, style) #else @@ -303,7 +303,7 @@ void wxContextHelpButton::OnContextHelp(wxCommandEvent& WXUNUSED(event)) // wxHelpProvider // ---------------------------------------------------------------------------- -wxHelpProvider *wxHelpProvider::ms_helpProvider = NULL; +wxHelpProvider *wxHelpProvider::ms_helpProvider = (wxHelpProvider *)NULL; // trivial implementation of some methods which we don't want to make pure // virtual for convenience @@ -332,7 +332,7 @@ wxString wxHelpProvider::GetHelpTextMaybeAtPoint(wxWindowBase *window) if ( m_helptextAtPoint != wxDefaultPosition || m_helptextOrigin != wxHelpEvent::Origin_Unknown ) { - wxCHECK_MSG( window, wxEmptyString, wxT("window must not be NULL") ); + wxCHECK_MSG( window, wxEmptyString, _T("window must not be NULL") ); wxPoint pt = m_helptextAtPoint; wxHelpEvent::Origin origin = m_helptextOrigin; @@ -472,7 +472,7 @@ bool wxHelpControllerHelpProvider::ShowHelp(wxWindowBase *window) // Convenience function for turning context id into wxString wxString wxContextId(int id) { - return wxString::Format(wxT("%d"), id); + return wxString::Format(_T("%d"), id); } // ---------------------------------------------------------------------------- diff --git a/Source/3rd Party/wx/src/common/ctrlcmn.cpp b/Source/3rd Party/wx/src/common/ctrlcmn.cpp index e9facb668..a10e48160 100644 --- a/Source/3rd Party/wx/src/common/ctrlcmn.cpp +++ b/Source/3rd Party/wx/src/common/ctrlcmn.cpp @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 26.07.99 -// RCS-ID: $Id$ +// RCS-ID: $Id: ctrlcmn.cpp 40329 2006-07-25 18:40:04Z VZ $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -29,18 +29,14 @@ #include "wx/control.h" #ifndef WX_PRECOMP - #include "wx/dc.h" #include "wx/log.h" #include "wx/radiobut.h" #include "wx/statbmp.h" #include "wx/bitmap.h" #include "wx/utils.h" // for wxStripMenuCodes() - #include "wx/settings.h" #endif -#include "wx/private/markupparser.h" - -const char wxControlNameStr[] = "control"; +const wxChar wxControlNameStr[] = wxT("control"); // ============================================================================ // implementation @@ -90,6 +86,13 @@ bool wxControlBase::CreateControl(wxWindowBase *parent, return true; } +/* static */ +wxString wxControlBase::GetLabelText(const wxString& label) +{ + // we don't want strip the TABs here, just the mnemonics + return wxStripMenuCodes(label, wxStrip_Mnemonics); +} + void wxControlBase::Command(wxCommandEvent& event) { (void)GetEventHandler()->ProcessEvent(event); @@ -97,7 +100,7 @@ void wxControlBase::Command(wxCommandEvent& event) void wxControlBase::InitCommandEvent(wxCommandEvent& event) const { - event.SetEventObject(const_cast(this)); + event.SetEventObject((wxControlBase *)this); // const_cast // event.SetId(GetId()); -- this is usuall done in the event ctor @@ -117,6 +120,13 @@ void wxControlBase::InitCommandEvent(wxCommandEvent& event) const } } + +void wxControlBase::SetLabel( const wxString &label ) +{ + InvalidateBestSize(); + wxWindow::SetLabel(label); +} + bool wxControlBase::SetFont(const wxFont& font) { InvalidateBestSize(); @@ -149,430 +159,6 @@ void wxControlBase::DoUpdateWindowUI(wxUpdateUIEvent& event) #endif // wxUSE_RADIOBTN } -/* static */ -wxString wxControlBase::GetLabelText(const wxString& label) -{ - // we don't want strip the TABs here, just the mnemonics - return wxStripMenuCodes(label, wxStrip_Mnemonics); -} - -/* static */ -wxString wxControlBase::RemoveMnemonics(const wxString& str) -{ - // we don't want strip the TABs here, just the mnemonics - return wxStripMenuCodes(str, wxStrip_Mnemonics); -} - -/* static */ -wxString wxControlBase::EscapeMnemonics(const wxString& text) -{ - wxString label(text); - label.Replace("&", "&&"); - return label; -} - -/* static */ -int wxControlBase::FindAccelIndex(const wxString& label, wxString *labelOnly) -{ - // the character following MNEMONIC_PREFIX is the accelerator for this - // control unless it is MNEMONIC_PREFIX too - this allows to insert - // literal MNEMONIC_PREFIX chars into the label - static const wxChar MNEMONIC_PREFIX = wxT('&'); - - if ( labelOnly ) - { - labelOnly->Empty(); - labelOnly->Alloc(label.length()); - } - - int indexAccel = -1; - for ( wxString::const_iterator pc = label.begin(); pc != label.end(); ++pc ) - { - if ( *pc == MNEMONIC_PREFIX ) - { - ++pc; // skip it - if ( pc == label.end() ) - break; - else if ( *pc != MNEMONIC_PREFIX ) - { - if ( indexAccel == -1 ) - { - // remember it (-1 is for MNEMONIC_PREFIX itself - indexAccel = pc - label.begin() - 1; - } - else - { - wxFAIL_MSG(wxT("duplicate accel char in control label")); - } - } - } - - if ( labelOnly ) - { - *labelOnly += *pc; - } - } - - return indexAccel; -} - -wxBorder wxControlBase::GetDefaultBorder() const -{ - return wxBORDER_THEME; -} - -/* static */ wxVisualAttributes -wxControlBase::GetCompositeControlsDefaultAttributes(wxWindowVariant WXUNUSED(variant)) -{ - wxVisualAttributes attrs; - attrs.font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); - attrs.colFg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT); - attrs.colBg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); - - return attrs; -} - -// ---------------------------------------------------------------------------- -// wxControl markup support -// ---------------------------------------------------------------------------- - -#if wxUSE_MARKUP - -/* static */ -wxString wxControlBase::RemoveMarkup(const wxString& markup) -{ - return wxMarkupParser::Strip(markup); -} - -bool wxControlBase::DoSetLabelMarkup(const wxString& markup) -{ - const wxString label = RemoveMarkup(markup); - if ( label.empty() && !markup.empty() ) - return false; - - SetLabel(label); - - return true; -} - -#endif // wxUSE_MARKUP - -// ---------------------------------------------------------------------------- -// wxControlBase - ellipsization code -// ---------------------------------------------------------------------------- - -#define wxELLIPSE_REPLACEMENT wxS("...") - -namespace -{ - -struct EllipsizeCalculator -{ - EllipsizeCalculator(const wxString& s, const wxDC& dc, - int maxFinalWidthPx, int replacementWidthPx) - : - m_initialCharToRemove(0), - m_nCharsToRemove(0), - m_outputNeedsUpdate(true), - m_str(s), - m_dc(dc), - m_maxFinalWidthPx(maxFinalWidthPx), - m_replacementWidthPx(replacementWidthPx) - { - m_isOk = dc.GetPartialTextExtents(s, m_charOffsetsPx); - wxASSERT( m_charOffsetsPx.GetCount() == s.length() ); - } - - bool IsOk() const { return m_isOk; } - - bool EllipsizationNotNeeded() const - { - // NOTE: charOffsetsPx[n] is the width in pixels of the first n characters (with the last one INCLUDED) - // thus charOffsetsPx[len-1] is the total width of the string - return m_charOffsetsPx.Last() <= m_maxFinalWidthPx; - } - - void Init(size_t initialCharToRemove, size_t nCharsToRemove) - { - m_initialCharToRemove = initialCharToRemove; - m_nCharsToRemove = nCharsToRemove; - } - - void RemoveFromEnd() - { - m_nCharsToRemove++; - } - - void RemoveFromStart() - { - m_initialCharToRemove--; - m_nCharsToRemove++; - } - - size_t GetFirstRemoved() const { return m_initialCharToRemove; } - size_t GetLastRemoved() const { return m_initialCharToRemove + m_nCharsToRemove - 1; } - - const wxString& GetEllipsizedText() - { - if ( m_outputNeedsUpdate ) - { - wxASSERT(m_initialCharToRemove <= m_str.length() - 1); // see valid range for initialCharToRemove above - wxASSERT(m_nCharsToRemove >= 1 && m_nCharsToRemove <= m_str.length() - m_initialCharToRemove); // see valid range for nCharsToRemove above - - // erase m_nCharsToRemove characters after m_initialCharToRemove (included); - // e.g. if we have the string "foobar" (len = 6) - // ^ - // \--- m_initialCharToRemove = 2 - // and m_nCharsToRemove = 2, then we get "foar" - m_output = m_str; - m_output.replace(m_initialCharToRemove, m_nCharsToRemove, wxELLIPSE_REPLACEMENT); - } - - return m_output; - } - - bool IsShortEnough() - { - if ( m_nCharsToRemove == m_str.length() ) - return true; // that's the best we could do - - // Width calculation using partial extents is just an inaccurate - // estimate: partial extents have sub-pixel precision and are rounded - // by GetPartialTextExtents(); replacing part of the string with "..." - // may change them too thanks to changes in ligatures, kerning etc. - // - // The correct algorithm would be to call GetTextExtent() in every step - // of ellipsization, but that would be too expensive, especially when - // the difference is just a few pixels. So we use partial extents to - // estimate string width and only verify it with GetTextExtent() when - // it looks good. - - int estimatedWidth = m_replacementWidthPx; // length of "..." - - // length of text before the removed part: - if ( m_initialCharToRemove > 0 ) - estimatedWidth += m_charOffsetsPx[m_initialCharToRemove - 1]; - - // length of text after the removed part: - - if ( GetLastRemoved() < m_str.length() ) - estimatedWidth += m_charOffsetsPx.Last() - m_charOffsetsPx[GetLastRemoved()]; - - if ( estimatedWidth > m_maxFinalWidthPx ) - return false; - - return m_dc.GetTextExtent(GetEllipsizedText()).GetWidth() <= m_maxFinalWidthPx; - } - - // calculation state: - - // REMEMBER: indexes inside the string have a valid range of [0;len-1] if not otherwise constrained - // lengths/counts of characters (e.g. nCharsToRemove) have a - // valid range of [0;len] if not otherwise constrained - // NOTE: since this point we know we have for sure a non-empty string from which we need - // to remove _at least_ one character (thus nCharsToRemove below is constrained to be >= 1) - - // index of first character to erase, valid range is [0;len-1]: - size_t m_initialCharToRemove; - // how many chars do we need to erase? valid range is [0;len-m_initialCharToRemove] - size_t m_nCharsToRemove; - - wxString m_output; - bool m_outputNeedsUpdate; - - // inputs: - wxString m_str; - const wxDC& m_dc; - int m_maxFinalWidthPx; - int m_replacementWidthPx; - wxArrayInt m_charOffsetsPx; - - bool m_isOk; -}; - -} // anonymous namespace - -/* static and protected */ -wxString wxControlBase::DoEllipsizeSingleLine(const wxString& curLine, const wxDC& dc, - wxEllipsizeMode mode, int maxFinalWidthPx, - int replacementWidthPx) -{ - wxASSERT_MSG(replacementWidthPx > 0, "Invalid parameters"); - wxASSERT_LEVEL_2_MSG(!curLine.Contains('\n'), - "Use Ellipsize() instead!"); - - wxASSERT_MSG( mode != wxELLIPSIZE_NONE, "shouldn't be called at all then" ); - - // NOTE: this function assumes that any mnemonic/tab character has already - // been handled if it was necessary to handle them (see Ellipsize()) - - if (maxFinalWidthPx <= 0) - return wxEmptyString; - - size_t len = curLine.length(); - if (len <= 1 ) - return curLine; - - EllipsizeCalculator calc(curLine, dc, maxFinalWidthPx, replacementWidthPx); - - if ( !calc.IsOk() ) - return curLine; - - if ( calc.EllipsizationNotNeeded() ) - return curLine; - - // let's compute the range of characters to remove depending on the ellipsization mode: - switch (mode) - { - case wxELLIPSIZE_START: - { - calc.Init(0, 1); - while ( !calc.IsShortEnough() ) - calc.RemoveFromEnd(); - - // always show at least one character of the string: - if ( calc.m_nCharsToRemove == len ) - return wxString(wxELLIPSE_REPLACEMENT) + curLine[len-1]; - - break; - } - - case wxELLIPSIZE_MIDDLE: - { - // NOTE: the following piece of code works also when len == 1 - - // start the removal process from the middle of the string - // i.e. separe the string in three parts: - // - the first one to preserve, valid range [0;initialCharToRemove-1] or the empty range if initialCharToRemove==0 - // - the second one to remove, valid range [initialCharToRemove;endCharToRemove] - // - the third one to preserve, valid range [endCharToRemove+1;len-1] or the empty range if endCharToRemove==len-1 - // NOTE: empty range != range [0;0] since the range [0;0] contains 1 character (the zero-th one)! - - calc.Init(len/2, 0); - - bool removeFromStart = true; - - while ( !calc.IsShortEnough() ) - { - const bool canRemoveFromStart = calc.GetFirstRemoved() > 0; - const bool canRemoveFromEnd = calc.GetLastRemoved() < len - 1; - - if ( !canRemoveFromStart && !canRemoveFromEnd ) - { - // we need to remove all the characters of the string! - break; - } - - // Remove from the beginning in even steps and from the end - // in odd steps, unless we exhausted one side already: - removeFromStart = !removeFromStart; - if ( removeFromStart && !canRemoveFromStart ) - removeFromStart = false; - else if ( !removeFromStart && !canRemoveFromEnd ) - removeFromStart = true; - - if ( removeFromStart ) - calc.RemoveFromStart(); - else - calc.RemoveFromEnd(); - } - - // Always show at least one character of the string. - // Additionally, if there's only one character left, prefer - // "a..." to "...a": - if ( calc.m_nCharsToRemove == len || - calc.m_nCharsToRemove == len - 1 ) - { - return curLine[0] + wxString(wxELLIPSE_REPLACEMENT); - } - } - break; - - case wxELLIPSIZE_END: - { - calc.Init(len - 1, 1); - while ( !calc.IsShortEnough() ) - calc.RemoveFromStart(); - - // always show at least one character of the string: - if ( calc.m_nCharsToRemove == len ) - return curLine[0] + wxString(wxELLIPSE_REPLACEMENT); - - break; - } - - case wxELLIPSIZE_NONE: - default: - wxFAIL_MSG("invalid ellipsize mode"); - return curLine; - } - - return calc.GetEllipsizedText(); -} - -/* static */ -wxString wxControlBase::Ellipsize(const wxString& label, const wxDC& dc, - wxEllipsizeMode mode, int maxFinalWidth, - int flags) -{ - wxString ret; - - // these cannot be cached between different Ellipsize() calls as they can - // change because of e.g. a font change; however we calculate them only once - // when ellipsizing multiline labels: - int replacementWidth = dc.GetTextExtent(wxELLIPSE_REPLACEMENT).GetWidth(); - - // NB: we must handle correctly labels with newlines: - wxString curLine; - for ( wxString::const_iterator pc = label.begin(); ; ++pc ) - { - if ( pc == label.end() || *pc == wxS('\n') ) - { - curLine = DoEllipsizeSingleLine(curLine, dc, mode, maxFinalWidth, - replacementWidth); - - // add this (ellipsized) row to the rest of the label - ret << curLine; - if ( pc == label.end() ) - { - // NOTE: this is the return which always exits the function - return ret; - } - else - { - ret << *pc; - curLine.clear(); - } - } - // we need to remove mnemonics from the label for correct calculations - else if ( *pc == wxS('&') && (flags & wxELLIPSIZE_FLAGS_PROCESS_MNEMONICS) ) - { - // pc+1 is safe: at worst we'll be at end() - wxString::const_iterator next = pc + 1; - if ( next != label.end() && *next == wxS('&') ) - curLine += wxS('&'); // && becomes & - //else: remove this ampersand - } - // we need also to expand tabs to properly calc their size - else if ( *pc == wxS('\t') && (flags & wxELLIPSIZE_FLAGS_EXPAND_TABS) ) - { - // Windows natively expands the TABs to 6 spaces. Do the same: - curLine += wxS(" "); - } - else - { - curLine += *pc; - } - } - - // this return would generate a - // warning C4702: unreachable code - // with MSVC since the function always exits from inside the loop - //return ret; -} - - - // ---------------------------------------------------------------------------- // wxStaticBitmap // ---------------------------------------------------------------------------- @@ -588,7 +174,7 @@ wxSize wxStaticBitmapBase::DoGetBestSize() const { wxSize best; wxBitmap bmp = GetBitmap(); - if ( bmp.IsOk() ) + if ( bmp.Ok() ) best = wxSize(bmp.GetWidth(), bmp.GetHeight()); else // this is completely arbitrary diff --git a/Source/3rd Party/wx/src/common/ctrlsub.cpp b/Source/3rd Party/wx/src/common/ctrlsub.cpp index 234787fdd..4a036d39b 100644 --- a/Source/3rd Party/wx/src/common/ctrlsub.cpp +++ b/Source/3rd Party/wx/src/common/ctrlsub.cpp @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 22.10.99 -// RCS-ID: $Id$ +// RCS-ID: $Id: ctrlsub.cpp 39077 2006-05-06 19:05:50Z VZ $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -90,196 +90,93 @@ wxItemContainer::~wxItemContainer() } // ---------------------------------------------------------------------------- -// deleting items +// appending items // ---------------------------------------------------------------------------- -void wxItemContainer::Clear() +void wxItemContainer::Append(const wxArrayString& strings) { - if ( HasClientObjectData() ) + const size_t count = strings.GetCount(); + for ( size_t n = 0; n < count; n++ ) { - const unsigned count = GetCount(); - for ( unsigned i = 0; i < count; ++i ) - ResetItemClientObject(i); - } - - SetClientDataType(wxClientData_None); - - DoClear(); -} - -void wxItemContainer::Delete(unsigned int pos) -{ - wxCHECK_RET( pos < GetCount(), wxT("invalid index") ); - - if ( HasClientObjectData() ) - ResetItemClientObject(pos); - - DoDeleteOneItem(pos); - - if ( IsEmpty() ) - { - SetClientDataType(wxClientData_None); + Append(strings[n]); } } -// ---------------------------------------------------------------------------- -// -// ---------------------------------------------------------------------------- - -int wxItemContainer::DoInsertItemsInLoop(const wxArrayStringsAdapter& items, - unsigned int pos, - void **clientData, - wxClientDataType type) +int wxItemContainer::Insert(const wxString& item, unsigned int pos, void *clientData) { - int n = wxNOT_FOUND; - - const unsigned int count = items.GetCount(); - for ( unsigned int i = 0; i < count; ++i ) - { - n = DoInsertOneItem(items[i], pos++); - if ( n == wxNOT_FOUND ) - break; - - AssignNewItemClientData(n, clientData, i, type); - } + int n = DoInsert(item, pos); + if ( n != wxNOT_FOUND ) + SetClientData(n, clientData); return n; } -int -wxItemContainer::DoInsertOneItem(const wxString& WXUNUSED(item), - unsigned int WXUNUSED(pos)) +int wxItemContainer::Insert(const wxString& item, unsigned int pos, wxClientData *clientData) { - wxFAIL_MSG( wxT("Must be overridden if DoInsertItemsInLoop() is used") ); + int n = DoInsert(item, pos); + if ( n != wxNOT_FOUND ) + SetClientObject(n, clientData); - return wxNOT_FOUND; + return n; } - // ---------------------------------------------------------------------------- // client data // ---------------------------------------------------------------------------- void wxItemContainer::SetClientObject(unsigned int n, wxClientData *data) { - wxASSERT_MSG( !HasClientUntypedData(), + wxASSERT_MSG( m_clientDataItemsType != wxClientData_Void, wxT("can't have both object and void client data") ); - wxCHECK_RET( IsValid(n), "Invalid index passed to SetClientObject()" ); - - if ( HasClientObjectData() ) + // when we call SetClientObject() for the first time, m_clientDataItemsType + // is still wxClientData_None and so calling DoGetItemClientObject() would + // fail (in addition to being useless) - don't do it + if ( m_clientDataItemsType == wxClientData_Object ) { - wxClientData * clientDataOld - = static_cast(DoGetItemClientData(n)); + wxClientData *clientDataOld = DoGetItemClientObject(n); if ( clientDataOld ) delete clientDataOld; } - else // didn't have any client data so far + else // m_clientDataItemsType == wxClientData_None { // now we have object client data - DoInitItemClientData(); - - SetClientDataType(wxClientData_Object); + m_clientDataItemsType = wxClientData_Object; } - DoSetItemClientData(n, data); + DoSetItemClientObject(n, data); } wxClientData *wxItemContainer::GetClientObject(unsigned int n) const { - wxCHECK_MSG( HasClientObjectData(), NULL, + wxASSERT_MSG( m_clientDataItemsType == wxClientData_Object, wxT("this window doesn't have object client data") ); - wxCHECK_MSG( IsValid(n), NULL, - "Invalid index passed to GetClientObject()" ); - - return static_cast(DoGetItemClientData(n)); -} - -wxClientData *wxItemContainer::DetachClientObject(unsigned int n) -{ - wxClientData * const data = GetClientObject(n); - if ( data ) - { - // reset the pointer as we don't own it any more - DoSetItemClientData(n, NULL); - } - - return data; + return DoGetItemClientObject(n); } void wxItemContainer::SetClientData(unsigned int n, void *data) { - if ( !HasClientData() ) - { - DoInitItemClientData(); - SetClientDataType(wxClientData_Void); - } - - wxASSERT_MSG( HasClientUntypedData(), + wxASSERT_MSG( m_clientDataItemsType != wxClientData_Object, wxT("can't have both object and void client data") ); - wxCHECK_RET( IsValid(n), "Invalid index passed to SetClientData()" ); - DoSetItemClientData(n, data); + m_clientDataItemsType = wxClientData_Void; } void *wxItemContainer::GetClientData(unsigned int n) const { - wxCHECK_MSG( HasClientUntypedData(), NULL, + wxASSERT_MSG( m_clientDataItemsType == wxClientData_Void, wxT("this window doesn't have void client data") ); - wxCHECK_MSG( IsValid(n), NULL, - "Invalid index passed to GetClientData()" ); - return DoGetItemClientData(n); } -void wxItemContainer::AssignNewItemClientData(unsigned int pos, - void **clientData, - unsigned int n, - wxClientDataType type) -{ - switch ( type ) - { - case wxClientData_Object: - SetClientObject - ( - pos, - (reinterpret_cast(clientData))[n] - ); - break; - - case wxClientData_Void: - SetClientData(pos, clientData[n]); - break; - - default: - wxFAIL_MSG( wxT("unknown client data type") ); - // fall through - - case wxClientData_None: - // nothing to do - break; - } -} - -void wxItemContainer::ResetItemClientObject(unsigned int n) -{ - wxClientData * const data = GetClientObject(n); - if ( data ) - { - delete data; - DoSetItemClientData(n, NULL); - } -} - // ============================================================================ // wxControlWithItems implementation // ============================================================================ -void -wxControlWithItemsBase::InitCommandEventWithItems(wxCommandEvent& event, int n) +void wxControlWithItems::InitCommandEventWithItems(wxCommandEvent& event, int n) { InitCommandEvent(event); @@ -292,4 +189,9 @@ wxControlWithItemsBase::InitCommandEventWithItems(wxCommandEvent& event, int n) } } +wxControlWithItems::~wxControlWithItems() +{ + // this destructor is required for Darwin +} + #endif // wxUSE_CONTROLS diff --git a/Source/3rd Party/wx/src/common/datetime.cpp b/Source/3rd Party/wx/src/common/datetime.cpp index 80acdcb03..1b2f9345b 100644 --- a/Source/3rd Party/wx/src/common/datetime.cpp +++ b/Source/3rd Party/wx/src/common/datetime.cpp @@ -1,11 +1,10 @@ /////////////////////////////////////////////////////////////////////////////// // Name: src/common/datetime.cpp // Purpose: implementation of time/date related classes -// (for formatting&parsing see datetimefmt.cpp) // Author: Vadim Zeitlin // Modified by: // Created: 11.05.99 -// RCS-ID: $Id$ +// RCS-ID: $Id: datetime.cpp 65730 2010-10-02 16:50:34Z TIK $ // Copyright: (c) 1999 Vadim Zeitlin // parts of code taken from sndcal library by Scott E. Lee: // @@ -63,7 +62,7 @@ #if !defined(wxUSE_DATETIME) || wxUSE_DATETIME #ifndef WX_PRECOMP - #ifdef __WINDOWS__ + #ifdef __WXMSW__ #include "wx/msw/wrapwin.h" #endif #include "wx/string.h" @@ -71,11 +70,9 @@ #include "wx/intl.h" #include "wx/stopwatch.h" // for wxGetLocalTimeMillis() #include "wx/module.h" - #include "wx/crt.h" #endif // WX_PRECOMP #include "wx/thread.h" -#include "wx/time.h" #include "wx/tokenzr.h" #include @@ -89,25 +86,162 @@ #include "wx/datetime.h" -// ---------------------------------------------------------------------------- -// wxXTI -// ---------------------------------------------------------------------------- +const long wxDateTime::TIME_T_FACTOR = 1000l; #if wxUSE_EXTENDED_RTTI template<> void wxStringReadValue(const wxString &s , wxDateTime &data ) { - data.ParseFormat(s,"%Y-%m-%d %H:%M:%S", NULL); + data.ParseFormat(s,wxT("%Y-%m-%d %H:%M:%S")) ; } template<> void wxStringWriteValue(wxString &s , const wxDateTime &data ) { - s = data.Format("%Y-%m-%d %H:%M:%S"); + s = data.Format(wxT("%Y-%m-%d %H:%M:%S")) ; } wxCUSTOM_TYPE_INFO(wxDateTime, wxToStringConverter , wxFromStringConverter) -#endif // wxUSE_EXTENDED_RTTI +#endif + +// +// ---------------------------------------------------------------------------- +// conditional compilation +// ---------------------------------------------------------------------------- + +#if defined(HAVE_STRPTIME) && defined(__GLIBC__) && \ + ((__GLIBC__ == 2) && (__GLIBC_MINOR__ == 0)) + // glibc 2.0.7 strptime() is broken - the following snippet causes it to + // crash (instead of just failing): + // + // strncpy(buf, "Tue Dec 21 20:25:40 1999", 128); + // strptime(buf, "%x", &tm); + // + // so don't use it + #undef HAVE_STRPTIME +#endif // broken strptime() + +#if defined(HAVE_STRPTIME) && defined(__DARWIN__) && defined(_MSL_USING_MW_C_HEADERS) && _MSL_USING_MW_C_HEADERS + // configure detects strptime as linkable because it's in the OS X + // System library but MSL headers don't declare it. + +// char *strptime(const char *, const char *, struct tm *); + // However, we DON'T want to just provide it here because we would + // crash and/or overwrite data when strptime from OS X tries + // to fill in MW's struct tm which is two fields shorter (no TZ stuff) + // So for now let's just say we don't have strptime + #undef HAVE_STRPTIME +#endif + +#if defined(__MWERKS__) && wxUSE_UNICODE + #include +#endif + +// define a special symbol for VC8 instead of writing tests for 1400 repeatedly +#ifdef __VISUALC__ + #if __VISUALC__ >= 1400 + #define __VISUALC8__ + #endif +#endif + +#if !defined(WX_TIMEZONE) && !defined(WX_GMTOFF_IN_TM) + #if defined(__WXPALMOS__) + #define WX_GMTOFF_IN_TM + #elif defined(__WXMSW__) + static long wxGetTimeZone() + { + TIME_ZONE_INFORMATION info; + GetTimeZoneInformation(&info); + long timeZone = info.Bias * 60; // convert minutes to seconds + return timeZone; + } + #define WX_TIMEZONE wxGetTimeZone() + #elif defined(__VISAGECPP__) + #define WX_TIMEZONE _timezone + #elif defined(__MWERKS__) + long wxmw_timezone = 28800; + #define WX_TIMEZONE wxmw_timezone + #elif defined(__DARWIN__) + #define WX_GMTOFF_IN_TM + #else // unknown platform - try timezone + #define WX_TIMEZONE timezone + #endif +#endif // !WX_TIMEZONE && !WX_GMTOFF_IN_TM + +// everyone has strftime except Win CE unless VC8 is used +#if !defined(__WXWINCE__) || defined(__VISUALC8__) + #define HAVE_STRFTIME +#endif + +// NB: VC8 safe time functions could/should be used for wxMSW as well probably +#if defined(__WXWINCE__) && defined(__VISUALC8__) + +struct tm *wxLocaltime_r(const time_t *t, struct tm* tm) +{ + __time64_t t64 = *t; + return _localtime64_s(tm, &t64) == 0 ? tm : NULL; +} + +struct tm *wxGmtime_r(const time_t* t, struct tm* tm) +{ + __time64_t t64 = *t; + return _gmtime64_s(tm, &t64) == 0 ? tm : NULL; +} + +#else // !wxWinCE with VC8 + +#if (!defined(HAVE_LOCALTIME_R) || !defined(HAVE_GMTIME_R)) && wxUSE_THREADS && !defined(__WINDOWS__) +static wxMutex timeLock; +#endif + +#ifndef HAVE_LOCALTIME_R +struct tm *wxLocaltime_r(const time_t* ticks, struct tm* temp) +{ +#if wxUSE_THREADS && !defined(__WINDOWS__) + // No need to waste time with a mutex on windows since it's using + // thread local storage for localtime anyway. + wxMutexLocker locker(timeLock); +#endif + + // Borland CRT crashes when passed 0 ticks for some reason, see SF bug 1704438 +#ifdef __BORLANDC__ + if ( !*ticks ) + return NULL; +#endif + + const tm * const t = localtime(ticks); + if ( !t ) + return NULL; + + memcpy(temp, t, sizeof(struct tm)); + return temp; +} +#endif // !HAVE_LOCALTIME_R + +#ifndef HAVE_GMTIME_R +struct tm *wxGmtime_r(const time_t* ticks, struct tm* temp) +{ +#if wxUSE_THREADS && !defined(__WINDOWS__) + // No need to waste time with a mutex on windows since it's + // using thread local storage for gmtime anyway. + wxMutexLocker locker(timeLock); +#endif + +#ifdef __BORLANDC__ + if ( !*ticks ) + return NULL; +#endif + + const tm * const t = gmtime(ticks); + if ( !t ) + return NULL; + + memcpy(temp, gmtime(ticks), sizeof(struct tm)); + return temp; +} +#endif // !HAVE_GMTIME_R + +#endif // wxWinCE with VC8/other platforms // ---------------------------------------------------------------------------- // macros @@ -154,6 +288,8 @@ static const int SEC_PER_MIN = 60; static const int MIN_PER_HOUR = 60; +static const int HOURS_PER_DAY = 24; + static const long SECONDS_PER_DAY = 86400l; static const int DAYS_PER_WEEK = 7; @@ -164,15 +300,14 @@ static const long MILLISECONDS_PER_DAY = 86400000l; // (i.e. JDN(Jan 1, 1970) = 2440587.5) static const long EPOCH_JDN = 2440587l; -// these values are only used in asserts so don't define them if asserts are -// disabled to avoid warnings about unused static variables -#if wxDEBUG_LEVEL +// used only in asserts +#ifdef __WXDEBUG__ // the date of JDN -0.5 (as we don't work with fractional parts, this is the // reference date for us) is Nov 24, 4714BC static const int JDN_0_YEAR = -4713; static const int JDN_0_MONTH = wxDateTime::Nov; static const int JDN_0_DAY = 24; -#endif // wxDEBUG_LEVEL +#endif // __WXDEBUG__ // the constants used for JDN calculations static const long JDN_OFFSET = 32046l; @@ -188,14 +323,12 @@ static const wxDateTime::wxDateTime_t gs_cumulatedDays[2][MONTHS_IN_YEAR] = { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335 } }; -const long wxDateTime::TIME_T_FACTOR = 1000l; - // ---------------------------------------------------------------------------- // global data // ---------------------------------------------------------------------------- -const char wxDefaultDateTimeFormat[] = "%c"; -const char wxDefaultTimeSpanFormat[] = "%H:%M:%S"; +const wxChar * wxDefaultDateTimeFormat = wxT("%c"); +const wxChar * wxDefaultTimeSpanFormat = wxT("%H:%M:%S"); // in the fine tradition of ANSI C we use our equivalent of (time_t)-1 to // indicate an invalid wxDateTime object @@ -207,19 +340,17 @@ wxDateTime::Country wxDateTime::ms_country = wxDateTime::Country_Unknown; // private functions // ---------------------------------------------------------------------------- -// debugger helper: this function can be called from a debugger to show what -// the date really is -extern const char *wxDumpDate(const wxDateTime* dt) +// debugger helper: shows what the date really is +#ifdef __WXDEBUG__ +extern const wxChar *wxDumpDate(const wxDateTime* dt) { - static char buf[128]; + static wxChar buf[128]; - wxString fmt(dt->Format("%Y-%m-%d (%a) %H:%M:%S")); - wxStrlcpy(buf, - (fmt + " (" + dt->GetValue().ToString() + " ticks)").ToAscii(), - WXSIZEOF(buf)); + wxStrcpy(buf, dt->Format(_T("%Y-%m-%d (%a) %H:%M:%S"))); return buf; } +#endif // Debug // get the number of days in the given month of the given year static inline @@ -227,7 +358,7 @@ wxDateTime::wxDateTime_t GetNumOfDaysInMonth(int year, wxDateTime::Month month) { // the number of days in month in Julian/Gregorian calendar: the first line // is for normal years, the second one is for the leap ones - static const wxDateTime::wxDateTime_t daysInMonth[2][MONTHS_IN_YEAR] = + static wxDateTime::wxDateTime_t daysInMonth[2][MONTHS_IN_YEAR] = { { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }, { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 } @@ -236,6 +367,37 @@ wxDateTime::wxDateTime_t GetNumOfDaysInMonth(int year, wxDateTime::Month month) return daysInMonth[wxDateTime::IsLeapYear(year)][month]; } +// returns the time zone in the C sense, i.e. the difference UTC - local +// (in seconds) +static int GetTimeZone() +{ +#ifdef WX_GMTOFF_IN_TM + // set to true when the timezone is set + static bool s_timezoneSet = false; + static long gmtoffset = LONG_MAX; // invalid timezone + + // ensure that the timezone variable is set by calling wxLocaltime_r + if ( !s_timezoneSet ) + { + // just call wxLocaltime_r() instead of figuring out whether this + // system supports tzset(), _tzset() or something else + time_t t = 0; + struct tm tm; + + wxLocaltime_r(&t, &tm); + s_timezoneSet = true; + + // note that GMT offset is the opposite of time zone and so to return + // consistent results in both WX_GMTOFF_IN_TM and !WX_GMTOFF_IN_TM + // cases we have to negate it + gmtoffset = -tm.tm_gmtoff; + } + return (int)gmtoffset; +#else // !WX_GMTOFF_IN_TM + return WX_TIMEZONE; +#endif // WX_GMTOFF_IN_TM/!WX_GMTOFF_IN_TM +} + // return the integral part of the JDN for the midnight of the given date (to // get the real JDN you need to add 0.5, this is, in fact, JDN of the // noon of the previous day) @@ -250,7 +412,7 @@ static long GetTruncatedJDN(wxDateTime::wxDateTime_t day, (year > JDN_0_YEAR) || ((year == JDN_0_YEAR) && (mon > JDN_0_MONTH)) || ((year == JDN_0_YEAR) && (mon == JDN_0_MONTH) && (day >= JDN_0_DAY)), - wxT("date out of range - can't convert to JDN") + _T("date out of range - can't convert to JDN") ); // make the year positive to avoid problems with negative numbers division @@ -276,11 +438,10 @@ static long GetTruncatedJDN(wxDateTime::wxDateTime_t day, - JDN_OFFSET; } -#ifdef wxHAS_STRFTIME +#ifdef HAVE_STRFTIME // this function is a wrapper around strftime(3) adding error checking -// NOTE: not static because used by datetimefmt.cpp -wxString CallStrftime(const wxString& format, const tm* tm) +static wxString CallStrftime(const wxChar *format, const tm* tm) { wxChar buf[4096]; // Create temp wxString here to work around mingw/cygwin bug 1046059 @@ -289,24 +450,50 @@ wxString CallStrftime(const wxString& format, const tm* tm) if ( !wxStrftime(buf, WXSIZEOF(buf), format, tm) ) { - // There is one special case in which strftime() can return 0 without - // indicating an error: "%p" may give empty string depending on the - // locale, so check for it explicitly. Apparently it's really the only - // exception. - if ( format != wxS("%p") ) - { - // if the format is valid, buffer must be too small? - wxFAIL_MSG(wxT("strftime() failed")); - } - - buf[0] = '\0'; + // buffer is too small? + wxFAIL_MSG(_T("strftime() failed")); } s = buf; return s; } -#endif // wxHAS_STRFTIME +#endif // HAVE_STRFTIME + +#ifdef HAVE_STRPTIME + +#if wxUSE_UNIX && !defined(HAVE_STRPTIME_DECL) + // configure detected that we had strptime() but not its declaration, + // provide it ourselves + extern "C" char *strptime(const char *, const char *, struct tm *); +#endif + +// Unicode-friendly strptime() wrapper +static const wxChar * +CallStrptime(const wxChar *input, const char *fmt, tm *tm) +{ + // the problem here is that strptime() returns pointer into the string we + // passed to it while we're really interested in the pointer into the + // original, Unicode, string so we try to transform the pointer back +#if wxUSE_UNICODE + wxCharBuffer inputMB(wxConvertWX2MB(input)); +#else // ASCII + const char * const inputMB = input; +#endif // Unicode/Ascii + + const char *result = strptime(inputMB, fmt, tm); + if ( !result ) + return NULL; + +#if wxUSE_UNICODE + // FIXME: this is wrong in presence of surrogates &c + return input + (result - inputMB.data()); +#else // ASCII + return result; +#endif // Unicode/Ascii +} + +#endif // HAVE_STRPTIME // if year and/or month have invalid values, replace them with the current ones static void ReplaceDefaultYearMonthWithCurrent(int *year, @@ -331,9 +518,8 @@ static void ReplaceDefaultYearMonthWithCurrent(int *year, } } -// fill the struct tm with default values -// NOTE: not static because used by datetimefmt.cpp -void InitTm(struct tm& tm) +// fll the struct tm with default values +static void InitTm(struct tm& tm) { // struct tm may have etxra fields (undocumented and with unportable // names) which, nevertheless, must be set to 0 @@ -344,6 +530,104 @@ void InitTm(struct tm& tm) tm.tm_isdst = -1; // auto determine } +// parsing helpers +// --------------- + +// return the month if the string is a month name or Inv_Month otherwise +static wxDateTime::Month GetMonthFromName(const wxString& name, int flags) +{ + wxDateTime::Month mon; + for ( mon = wxDateTime::Jan; mon < wxDateTime::Inv_Month; wxNextMonth(mon) ) + { + // case-insensitive comparison either one of or with both abbreviated + // and not versions + if ( flags & wxDateTime::Name_Full ) + { + if ( name.CmpNoCase(wxDateTime:: + GetMonthName(mon, wxDateTime::Name_Full)) == 0 ) + { + break; + } + } + + if ( flags & wxDateTime::Name_Abbr ) + { + if ( name.CmpNoCase(wxDateTime:: + GetMonthName(mon, wxDateTime::Name_Abbr)) == 0 ) + { + break; + } + } + } + + return mon; +} + +// return the weekday if the string is a weekday name or Inv_WeekDay otherwise +static wxDateTime::WeekDay GetWeekDayFromName(const wxString& name, int flags) +{ + wxDateTime::WeekDay wd; + for ( wd = wxDateTime::Sun; wd < wxDateTime::Inv_WeekDay; wxNextWDay(wd) ) + { + // case-insensitive comparison either one of or with both abbreviated + // and not versions + if ( flags & wxDateTime::Name_Full ) + { + if ( name.CmpNoCase(wxDateTime:: + GetWeekDayName(wd, wxDateTime::Name_Full)) == 0 ) + { + break; + } + } + + if ( flags & wxDateTime::Name_Abbr ) + { + if ( name.CmpNoCase(wxDateTime:: + GetWeekDayName(wd, wxDateTime::Name_Abbr)) == 0 ) + { + break; + } + } + } + + return wd; +} + +/* static */ +struct tm *wxDateTime::GetTmNow(struct tm *tmstruct) +{ + time_t t = GetTimeNow(); + return wxLocaltime_r(&t, tmstruct); +} + +// scans all digits (but no more than len) and returns the resulting number +static bool GetNumericToken(size_t len, const wxChar*& p, unsigned long *number) +{ + size_t n = 1; + wxString s; + while ( wxIsdigit(*p) ) + { + s += *p++; + + if ( len && ++n > len ) + break; + } + + return !s.empty() && s.ToULong(number); +} + +// scans all alphabetic characters and returns the resulting string +static wxString GetAlphaToken(const wxChar*& p) +{ + wxString s; + while ( wxIsalpha(*p) ) + { + s += *p++; + } + + return s; +} + // ============================================================================ // implementation of wxDateTime // ============================================================================ @@ -356,12 +640,8 @@ wxDateTime::Tm::Tm() { year = (wxDateTime_t)wxDateTime::Inv_Year; mon = wxDateTime::Inv_Month; - mday = - yday = 0; - hour = - min = - sec = - msec = 0; + mday = 0; + hour = min = sec = msec = 0; wday = wxDateTime::Inv_WeekDay; } @@ -381,17 +661,9 @@ wxDateTime::Tm::Tm(const struct tm& tm, const TimeZone& tz) bool wxDateTime::Tm::IsValid() const { - if ( mon == wxDateTime::Inv_Month ) - return false; - - // We need to check this here to avoid crashing in GetNumOfDaysInMonth() if - // somebody passed us "(wxDateTime::Month)1000". - wxCHECK_MSG( mon >= wxDateTime::Jan && mon < wxDateTime::Inv_Month, false, - wxS("Invalid month value") ); - // we allow for the leap seconds, although we don't use them (yet) return (year != wxDateTime::Inv_Year) && (mon != wxDateTime::Inv_Month) && - (mday > 0 && mday <= GetNumOfDaysInMonth(year, mon)) && + (mday <= GetNumOfDaysInMonth(year, mon)) && (hour < 24) && (min < 60) && (sec < 62) && (msec < 1000); } @@ -422,7 +694,7 @@ void wxDateTime::Tm::AddMonths(int monDiff) mon = (wxDateTime::Month)(mon + monDiff); - wxASSERT_MSG( mon >= 0 && mon < MONTHS_IN_YEAR, wxT("logic error") ); + wxASSERT_MSG( mon >= 0 && mon < MONTHS_IN_YEAR, _T("logic error") ); // NB: we don't check here that the resulting date is valid, this function // is private and the caller must check it if needed @@ -447,7 +719,7 @@ void wxDateTime::Tm::AddDays(int dayDiff) } wxASSERT_MSG( mday > 0 && mday <= GetNumOfDaysInMonth(year, mon), - wxT("logic error") ); + _T("logic error") ); } // ---------------------------------------------------------------------------- @@ -461,7 +733,7 @@ wxDateTime::TimeZone::TimeZone(wxDateTime::TZ tz) case wxDateTime::Local: // get the offset from C RTL: it returns the difference GMT-local // while we want to have the offset _from_ GMT, hence the '-' - m_offset = -wxGetTimeZone(); + m_offset = -GetTimeZone(); break; case wxDateTime::GMT_12: @@ -502,7 +774,7 @@ wxDateTime::TimeZone::TimeZone(wxDateTime::TZ tz) break; default: - wxFAIL_MSG( wxT("unknown time zone") ); + wxFAIL_MSG( _T("unknown time zone") ); } } @@ -510,13 +782,6 @@ wxDateTime::TimeZone::TimeZone(wxDateTime::TZ tz) // static functions // ---------------------------------------------------------------------------- -/* static */ -struct tm *wxDateTime::GetTmNow(struct tm *tmstruct) -{ - time_t t = GetTimeNow(); - return wxLocaltime_r(&t, tmstruct); -} - /* static */ bool wxDateTime::IsLeapYear(int year, wxDateTime::Calendar cal) { @@ -538,7 +803,7 @@ bool wxDateTime::IsLeapYear(int year, wxDateTime::Calendar cal) } else { - wxFAIL_MSG(wxT("unknown calendar")); + wxFAIL_MSG(_T("unknown calendar")); return false; } @@ -566,11 +831,11 @@ int wxDateTime::GetCurrentYear(wxDateTime::Calendar cal) return Now().GetYear(); case Julian: - wxFAIL_MSG(wxT("TODO")); + wxFAIL_MSG(_T("TODO")); break; default: - wxFAIL_MSG(wxT("unsupported calendar")); + wxFAIL_MSG(_T("unsupported calendar")); break; } @@ -586,11 +851,11 @@ wxDateTime::Month wxDateTime::GetCurrentMonth(wxDateTime::Calendar cal) return Now().GetMonth(); case Julian: - wxFAIL_MSG(wxT("TODO")); + wxFAIL_MSG(_T("TODO")); break; default: - wxFAIL_MSG(wxT("unsupported calendar")); + wxFAIL_MSG(_T("unsupported calendar")); break; } @@ -613,7 +878,7 @@ wxDateTime::wxDateTime_t wxDateTime::GetNumberOfDays(int year, Calendar cal) return IsLeapYear(year) ? 366 : 365; default: - wxFAIL_MSG(wxT("unsupported calendar")); + wxFAIL_MSG(_T("unsupported calendar")); break; } @@ -625,7 +890,7 @@ wxDateTime::wxDateTime_t wxDateTime::GetNumberOfDays(wxDateTime::Month month, int year, wxDateTime::Calendar cal) { - wxCHECK_MSG( month < MONTHS_IN_YEAR, 0, wxT("invalid month") ); + wxCHECK_MSG( month < MONTHS_IN_YEAR, 0, _T("invalid month") ); if ( cal == Gregorian || cal == Julian ) { @@ -639,105 +904,76 @@ wxDateTime::wxDateTime_t wxDateTime::GetNumberOfDays(wxDateTime::Month month, } else { - wxFAIL_MSG(wxT("unsupported calendar")); + wxFAIL_MSG(_T("unsupported calendar")); return 0; } } -namespace -{ - -// helper function used by GetEnglish/WeekDayName(): returns 0 if flags is -// Name_Full and 1 if it is Name_Abbr or -1 if the flags is incorrect (and -// asserts in this case) -// -// the return value of this function is used as an index into 2D array -// containing full names in its first row and abbreviated ones in the 2nd one -int NameArrayIndexFromFlag(wxDateTime::NameFlags flags) -{ - switch ( flags ) - { - case wxDateTime::Name_Full: - return 0; - - case wxDateTime::Name_Abbr: - return 1; - - default: - wxFAIL_MSG( "unknown wxDateTime::NameFlags value" ); - } - - return -1; -} - -} // anonymous namespace - -/* static */ -wxString wxDateTime::GetEnglishMonthName(Month month, NameFlags flags) -{ - wxCHECK_MSG( month != Inv_Month, wxEmptyString, "invalid month" ); - - static const char *const monthNames[2][MONTHS_IN_YEAR] = - { - { "January", "February", "March", "April", "May", "June", - "July", "August", "September", "October", "November", "December" }, - { "Jan", "Feb", "Mar", "Apr", "May", "Jun", - "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" } - }; - - const int idx = NameArrayIndexFromFlag(flags); - if ( idx == -1 ) - return wxString(); - - return monthNames[idx][month]; -} - /* static */ wxString wxDateTime::GetMonthName(wxDateTime::Month month, wxDateTime::NameFlags flags) { -#ifdef wxHAS_STRFTIME - wxCHECK_MSG( month != Inv_Month, wxEmptyString, wxT("invalid month") ); - + wxCHECK_MSG( month != Inv_Month, wxEmptyString, _T("invalid month") ); +#ifdef HAVE_STRFTIME // notice that we must set all the fields to avoid confusing libc (GNU one // gets confused to a crash if we don't do this) tm tm; InitTm(tm); tm.tm_mon = month; - return CallStrftime(flags == Name_Abbr ? wxT("%b") : wxT("%B"), &tm); -#else // !wxHAS_STRFTIME - return GetEnglishMonthName(month, flags); -#endif // wxHAS_STRFTIME/!wxHAS_STRFTIME -} - -/* static */ -wxString wxDateTime::GetEnglishWeekDayName(WeekDay wday, NameFlags flags) -{ - wxCHECK_MSG( wday != Inv_WeekDay, wxEmptyString, wxT("invalid weekday") ); - - static const char *const weekdayNames[2][DAYS_PER_WEEK] = + return CallStrftime(flags == Name_Abbr ? _T("%b") : _T("%B"), &tm); +#else // !HAVE_STRFTIME + wxString ret; + switch(month) { - { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", - "Saturday" }, - { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }, - }; - - const int idx = NameArrayIndexFromFlag(flags); - if ( idx == -1 ) - return wxString(); - - return weekdayNames[idx][wday]; + case Jan: + ret = (flags == Name_Abbr ? wxT("Jan"): wxT("January")); + break; + case Feb: + ret = (flags == Name_Abbr ? wxT("Feb"): wxT("Febuary")); + break; + case Mar: + ret = (flags == Name_Abbr ? wxT("Mar"): wxT("March")); + break; + case Apr: + ret = (flags == Name_Abbr ? wxT("Apr"): wxT("April")); + break; + case May: + ret = (flags == Name_Abbr ? wxT("May"): wxT("May")); + break; + case Jun: + ret = (flags == Name_Abbr ? wxT("Jun"): wxT("June")); + break; + case Jul: + ret = (flags == Name_Abbr ? wxT("Jul"): wxT("July")); + break; + case Aug: + ret = (flags == Name_Abbr ? wxT("Aug"): wxT("August")); + break; + case Sep: + ret = (flags == Name_Abbr ? wxT("Sep"): wxT("September")); + break; + case Oct: + ret = (flags == Name_Abbr ? wxT("Oct"): wxT("October")); + break; + case Nov: + ret = (flags == Name_Abbr ? wxT("Nov"): wxT("November")); + break; + case Dec: + ret = (flags == Name_Abbr ? wxT("Dec"): wxT("December")); + break; + } + return ret; +#endif // HAVE_STRFTIME/!HAVE_STRFTIME } /* static */ wxString wxDateTime::GetWeekDayName(wxDateTime::WeekDay wday, wxDateTime::NameFlags flags) { -#ifdef wxHAS_STRFTIME - wxCHECK_MSG( wday != Inv_WeekDay, wxEmptyString, wxT("invalid weekday") ); - + wxCHECK_MSG( wday != Inv_WeekDay, wxEmptyString, _T("invalid weekday") ); +#ifdef HAVE_STRFTIME // take some arbitrary Sunday (but notice that the day should be such that // after adding wday to it below we still have a valid date, e.g. don't // take 28 here!) @@ -754,10 +990,35 @@ wxString wxDateTime::GetWeekDayName(wxDateTime::WeekDay wday, (void)mktime(&tm); // ... and call strftime() - return CallStrftime(flags == Name_Abbr ? wxT("%a") : wxT("%A"), &tm); -#else // !wxHAS_STRFTIME - return GetEnglishWeekDayName(wday, flags); -#endif // wxHAS_STRFTIME/!wxHAS_STRFTIME + return CallStrftime(flags == Name_Abbr ? _T("%a") : _T("%A"), &tm); +#else // !HAVE_STRFTIME + wxString ret; + switch(wday) + { + case Sun: + ret = (flags == Name_Abbr ? wxT("Sun") : wxT("Sunday")); + break; + case Mon: + ret = (flags == Name_Abbr ? wxT("Mon") : wxT("Monday")); + break; + case Tue: + ret = (flags == Name_Abbr ? wxT("Tue") : wxT("Tuesday")); + break; + case Wed: + ret = (flags == Name_Abbr ? wxT("Wed") : wxT("Wednesday")); + break; + case Thu: + ret = (flags == Name_Abbr ? wxT("Thu") : wxT("Thursday")); + break; + case Fri: + ret = (flags == Name_Abbr ? wxT("Fri") : wxT("Friday")); + break; + case Sat: + ret = (flags == Name_Abbr ? wxT("Sat") : wxT("Saturday")); + break; + } + return ret; +#endif // HAVE_STRFTIME/!HAVE_STRFTIME } /* static */ @@ -776,7 +1037,7 @@ void wxDateTime::GetAmPmStrings(wxString *am, wxString *pm) // assert, even though it is a perfectly legal use. if ( am ) { - if (wxStrftime(buffer, WXSIZEOF(buffer), wxT("%p"), &tm) > 0) + if (wxStrftime(buffer, sizeof(buffer)/sizeof(wxChar), _T("%p"), &tm) > 0) *am = wxString(buffer); else *am = wxString(); @@ -784,14 +1045,13 @@ void wxDateTime::GetAmPmStrings(wxString *am, wxString *pm) if ( pm ) { tm.tm_hour = 13; - if (wxStrftime(buffer, WXSIZEOF(buffer), wxT("%p"), &tm) > 0) + if (wxStrftime(buffer, sizeof(buffer)/sizeof(wxChar), _T("%p"), &tm) > 0) *pm = wxString(buffer); else *pm = wxString(); } } - // ---------------------------------------------------------------------------- // Country stuff: date calculations depend on the country (DST, work days, // ...), so we need to know which rules to follow. @@ -809,24 +1069,24 @@ wxDateTime::Country wxDateTime::GetCountry() struct tm tmstruct; struct tm *tm = wxLocaltime_r(&t, &tmstruct); - wxString tz = CallStrftime(wxT("%Z"), tm); - if ( tz == wxT("WET") || tz == wxT("WEST") ) + wxString tz = CallStrftime(_T("%Z"), tm); + if ( tz == _T("WET") || tz == _T("WEST") ) { ms_country = UK; } - else if ( tz == wxT("CET") || tz == wxT("CEST") ) + else if ( tz == _T("CET") || tz == _T("CEST") ) { ms_country = Country_EEC; } - else if ( tz == wxT("MSK") || tz == wxT("MSD") ) + else if ( tz == _T("MSK") || tz == _T("MSD") ) { ms_country = Russia; } - else if ( tz == wxT("AST") || tz == wxT("ADT") || - tz == wxT("EST") || tz == wxT("EDT") || - tz == wxT("CST") || tz == wxT("CDT") || - tz == wxT("MST") || tz == wxT("MDT") || - tz == wxT("PST") || tz == wxT("PDT") ) + else if ( tz == _T("AST") || tz == _T("ADT") || + tz == _T("EST") || tz == _T("EDT") || + tz == _T("CST") || tz == _T("CDT") || + tz == _T("MST") || tz == _T("MDT") || + tz == _T("PST") || tz == _T("PDT") ) { ms_country = USA; } @@ -925,10 +1185,13 @@ wxDateTime wxDateTime::GetBeginDST(int year, Country country) if ( !dt.SetToLastWeekDay(Sun, Mar, year) ) { // weird... - wxFAIL_MSG( wxT("no last Sunday in March?") ); + wxFAIL_MSG( _T("no last Sunday in March?") ); } dt += wxTimeSpan::Hours(1); + + // disable DST tests because it could result in an infinite recursion! + dt.MakeGMT(true); } else switch ( country ) { @@ -968,7 +1231,7 @@ wxDateTime wxDateTime::GetBeginDST(int year, Country country) if ( !dt.SetToLastWeekDay(Sun, Apr, year) ) { // weird... - wxFAIL_MSG( wxT("no first Sunday in April?") ); + wxFAIL_MSG( _T("no first Sunday in April?") ); } } else if ( year > 2006 ) @@ -979,7 +1242,7 @@ wxDateTime wxDateTime::GetBeginDST(int year, Country country) if ( !dt.SetToWeekDay(Sun, 2, Mar, year) ) { // weird... - wxFAIL_MSG( wxT("no second Sunday in March?") ); + wxFAIL_MSG( _T("no second Sunday in March?") ); } } else @@ -987,7 +1250,7 @@ wxDateTime wxDateTime::GetBeginDST(int year, Country country) if ( !dt.SetToWeekDay(Sun, 1, Apr, year) ) { // weird... - wxFAIL_MSG( wxT("no first Sunday in April?") ); + wxFAIL_MSG( _T("no first Sunday in April?") ); } } @@ -1034,10 +1297,13 @@ wxDateTime wxDateTime::GetEndDST(int year, Country country) if ( !dt.SetToLastWeekDay(Sun, Oct, year) ) { // weirder and weirder... - wxFAIL_MSG( wxT("no last Sunday in October?") ); + wxFAIL_MSG( _T("no last Sunday in October?") ); } dt += wxTimeSpan::Hours(1); + + // disable DST tests because it could result in an infinite recursion! + dt.MakeGMT(true); } else switch ( country ) { @@ -1067,7 +1333,7 @@ wxDateTime wxDateTime::GetEndDST(int year, Country country) if ( !dt.SetToWeekDay(Sun, 1, Nov, year) ) { // weird... - wxFAIL_MSG( wxT("no first Sunday in November?") ); + wxFAIL_MSG( _T("no first Sunday in November?") ); } } else @@ -1077,7 +1343,7 @@ wxDateTime wxDateTime::GetEndDST(int year, Country country) if ( !dt.SetToLastWeekDay(Sun, Oct, year) ) { // weirder and weirder... - wxFAIL_MSG( wxT("no last Sunday in October?") ); + wxFAIL_MSG( _T("no last Sunday in October?") ); } } @@ -1102,7 +1368,7 @@ wxDateTime wxDateTime::GetEndDST(int year, Country country) // return the current time with ms precision /* static */ wxDateTime wxDateTime::UNow() { - return wxDateTime(wxGetUTCTimeMillis()); + return wxDateTime(wxGetLocalTimeMillis()); } // the values in the tm structure contain the local time @@ -1118,13 +1384,13 @@ wxDateTime& wxDateTime::Set(const struct tm& tm) if ( tm2.tm_year == 70 && tm2.tm_mon == 0 && tm2.tm_mday == 1 ) { return Set((time_t)( - wxGetTimeZone() + + GetTimeZone() + tm2.tm_hour * MIN_PER_HOUR * SEC_PER_MIN + tm2.tm_min * SEC_PER_MIN + tm2.tm_sec)); } - wxFAIL_MSG( wxT("mktime() failed") ); + wxFAIL_MSG( _T("mktime() failed") ); *this = wxInvalidDateTime; @@ -1147,13 +1413,13 @@ wxDateTime& wxDateTime::Set(wxDateTime_t hour, second < 62 && minute < 60 && millisec < 1000, - wxT("Invalid time in wxDateTime::Set()") ); + _T("Invalid time in wxDateTime::Set()") ); // get the current date from system struct tm tmstruct; struct tm *tm = GetTmNow(&tmstruct); - wxDATETIME_CHECK( tm, wxT("wxLocaltime_r() failed") ); + wxDATETIME_CHECK( tm, _T("wxLocaltime_r() failed") ); // make a copy so it isn't clobbered by the call to mktime() below struct tm tm1(*tm); @@ -1187,12 +1453,12 @@ wxDateTime& wxDateTime::Set(wxDateTime_t day, second < 62 && minute < 60 && millisec < 1000, - wxT("Invalid time in wxDateTime::Set()") ); + _T("Invalid time in wxDateTime::Set()") ); ReplaceDefaultYearMonthWithCurrent(&year, &month); wxDATETIME_CHECK( (0 < day) && (day <= GetNumberOfDays(month, year)), - wxT("Invalid date in wxDateTime::Set()") ); + _T("Invalid date in wxDateTime::Set()") ); // the range of time_t type (inclusive) static const int yearMinInRange = 1970; @@ -1232,7 +1498,7 @@ wxDateTime& wxDateTime::Set(wxDateTime_t day, m_time *= SECONDS_PER_DAY * TIME_T_FACTOR; // JDN corresponds to GMT, we take localtime - Add(wxTimeSpan(hour, minute, second + wxGetTimeZone(), millisec)); + Add(wxTimeSpan(hour, minute, second + GetTimeZone(), millisec)); } return *this; @@ -1331,7 +1597,7 @@ unsigned long wxDateTime::GetAsDOS() const time_t ticks = GetTicks(); struct tm tmstruct; struct tm *tm = wxLocaltime_r(&ticks, &tmstruct); - wxCHECK_MSG( tm, ULONG_MAX, wxT("time can't be represented in DOS format") ); + wxCHECK_MSG( tm, ULONG_MAX, _T("time can't be represented in DOS format") ); long year = tm->tm_year; year -= 80; @@ -1363,7 +1629,7 @@ unsigned long wxDateTime::GetAsDOS() const wxDateTime::Tm wxDateTime::GetTm(const TimeZone& tz) const { - wxASSERT_MSG( IsValid(), wxT("invalid wxDateTime") ); + wxASSERT_MSG( IsValid(), _T("invalid wxDateTime") ); time_t time = GetTicks(); if ( time != (time_t)-1 ) @@ -1371,13 +1637,13 @@ wxDateTime::Tm wxDateTime::GetTm(const TimeZone& tz) const // use C RTL functions struct tm tmstruct; tm *tm; - if ( tz.GetOffset() == -wxGetTimeZone() ) + if ( tz.GetOffset() == -GetTimeZone() ) { // we are working with local time tm = wxLocaltime_r(&time, &tmstruct); // should never happen - wxCHECK_MSG( tm, Tm(), wxT("wxLocaltime_r() failed") ); + wxCHECK_MSG( tm, Tm(), _T("wxLocaltime_r() failed") ); } else { @@ -1392,7 +1658,7 @@ wxDateTime::Tm wxDateTime::GetTm(const TimeZone& tz) const tm = wxGmtime_r(&time, &tmstruct); // should never happen - wxCHECK_MSG( tm, Tm(), wxT("wxGmtime_r() failed") ); + wxCHECK_MSG( tm, Tm(), _T("wxGmtime_r() failed") ); } else { @@ -1435,7 +1701,7 @@ wxDateTime::Tm wxDateTime::GetTm(const TimeZone& tz) const // CREDIT: code below is by Scott E. Lee (but bugs are mine) - wxASSERT_MSG( jdn > -2, wxT("JDN out of range") ); + wxASSERT_MSG( jdn > -2, _T("JDN out of range") ); // calculate the century long temp = (jdn + JDN_OFFSET) * 4 - 1; @@ -1466,13 +1732,12 @@ wxDateTime::Tm wxDateTime::GetTm(const TimeZone& tz) const year -= 4800; // check that the algorithm gave us something reasonable - wxASSERT_MSG( (0 < month) && (month <= 12), wxT("invalid month") ); - wxASSERT_MSG( (1 <= day) && (day < 32), wxT("invalid day") ); + wxASSERT_MSG( (0 < month) && (month <= 12), _T("invalid month") ); + wxASSERT_MSG( (1 <= day) && (day < 32), _T("invalid day") ); // construct Tm from these values Tm tm; tm.year = (int)year; - tm.yday = (wxDateTime_t)(dayOfYear - 1); // use C convention for day number tm.mon = (Month)(month - 1); // algorithm yields 1 for January, not 0 tm.mday = (wxDateTime_t)day; tm.msec = (wxDateTime_t)(timeOnly % 1000); @@ -1493,7 +1758,7 @@ wxDateTime::Tm wxDateTime::GetTm(const TimeZone& tz) const wxDateTime& wxDateTime::SetYear(int year) { - wxASSERT_MSG( IsValid(), wxT("invalid wxDateTime") ); + wxASSERT_MSG( IsValid(), _T("invalid wxDateTime") ); Tm tm(GetTm()); tm.year = year; @@ -1504,7 +1769,7 @@ wxDateTime& wxDateTime::SetYear(int year) wxDateTime& wxDateTime::SetMonth(Month month) { - wxASSERT_MSG( IsValid(), wxT("invalid wxDateTime") ); + wxASSERT_MSG( IsValid(), _T("invalid wxDateTime") ); Tm tm(GetTm()); tm.mon = month; @@ -1515,7 +1780,7 @@ wxDateTime& wxDateTime::SetMonth(Month month) wxDateTime& wxDateTime::SetDay(wxDateTime_t mday) { - wxASSERT_MSG( IsValid(), wxT("invalid wxDateTime") ); + wxASSERT_MSG( IsValid(), _T("invalid wxDateTime") ); Tm tm(GetTm()); tm.mday = mday; @@ -1526,7 +1791,7 @@ wxDateTime& wxDateTime::SetDay(wxDateTime_t mday) wxDateTime& wxDateTime::SetHour(wxDateTime_t hour) { - wxASSERT_MSG( IsValid(), wxT("invalid wxDateTime") ); + wxASSERT_MSG( IsValid(), _T("invalid wxDateTime") ); Tm tm(GetTm()); tm.hour = hour; @@ -1537,7 +1802,7 @@ wxDateTime& wxDateTime::SetHour(wxDateTime_t hour) wxDateTime& wxDateTime::SetMinute(wxDateTime_t min) { - wxASSERT_MSG( IsValid(), wxT("invalid wxDateTime") ); + wxASSERT_MSG( IsValid(), _T("invalid wxDateTime") ); Tm tm(GetTm()); tm.min = min; @@ -1548,7 +1813,7 @@ wxDateTime& wxDateTime::SetMinute(wxDateTime_t min) wxDateTime& wxDateTime::SetSecond(wxDateTime_t sec) { - wxASSERT_MSG( IsValid(), wxT("invalid wxDateTime") ); + wxASSERT_MSG( IsValid(), _T("invalid wxDateTime") ); Tm tm(GetTm()); tm.sec = sec; @@ -1559,7 +1824,7 @@ wxDateTime& wxDateTime::SetSecond(wxDateTime_t sec) wxDateTime& wxDateTime::SetMillisecond(wxDateTime_t millisecond) { - wxASSERT_MSG( IsValid(), wxT("invalid wxDateTime") ); + wxASSERT_MSG( IsValid(), _T("invalid wxDateTime") ); // we don't need to use GetTm() for this one m_time -= m_time % 1000l; @@ -1597,7 +1862,7 @@ wxDateTime& wxDateTime::Add(const wxDateSpan& diff) Set(tm); wxASSERT_MSG( IsSameTime(tm), - wxT("Add(wxDateSpan) shouldn't modify time") ); + _T("Add(wxDateSpan) shouldn't modify time") ); return *this; } @@ -1617,7 +1882,7 @@ wxDateTime wxDateTime::SetToWeekOfYear(int year, wxDateTime_t numWeek, WeekDay wd) { wxASSERT_MSG( numWeek > 0, - wxT("invalid week number: weeks are counted from 1") ); + _T("invalid week number: weeks are counted from 1") ); // Jan 4 always lies in the 1st week of the year wxDateTime dt(4, Jan, year); @@ -1681,7 +1946,7 @@ wxDateTime& wxDateTime::SetToLastMonthDay(Month month, wxDateTime& wxDateTime::SetToWeekDayInSameWeek(WeekDay weekday, WeekFlags flags) { - wxDATETIME_CHECK( weekday != Inv_WeekDay, wxT("invalid weekday") ); + wxDATETIME_CHECK( weekday != Inv_WeekDay, _T("invalid weekday") ); int wdayDst = weekday, wdayThis = GetWeekDay(); @@ -1721,7 +1986,7 @@ wxDateTime& wxDateTime::SetToWeekDayInSameWeek(WeekDay weekday, WeekFlags flags) wxDateTime& wxDateTime::SetToNextWeekDay(WeekDay weekday) { - wxDATETIME_CHECK( weekday != Inv_WeekDay, wxT("invalid weekday") ); + wxDATETIME_CHECK( weekday != Inv_WeekDay, _T("invalid weekday") ); int diff; WeekDay wdayThis = GetWeekDay(); @@ -1745,7 +2010,7 @@ wxDateTime& wxDateTime::SetToNextWeekDay(WeekDay weekday) wxDateTime& wxDateTime::SetToPrevWeekDay(WeekDay weekday) { - wxDATETIME_CHECK( weekday != Inv_WeekDay, wxT("invalid weekday") ); + wxDATETIME_CHECK( weekday != Inv_WeekDay, _T("invalid weekday") ); int diff; WeekDay wdayThis = GetWeekDay(); @@ -1772,7 +2037,7 @@ bool wxDateTime::SetToWeekDay(WeekDay weekday, Month month, int year) { - wxCHECK_MSG( weekday != Inv_WeekDay, false, wxT("invalid weekday") ); + wxCHECK_MSG( weekday != Inv_WeekDay, false, _T("invalid weekday") ); // we don't check explicitly that -5 <= n <= 5 because we will return false // anyhow in such case - but may be should still give an assert for it? @@ -1935,7 +2200,7 @@ wxDateTime& wxDateTime::SetToYearDay(wxDateTime::wxDateTime_t yday) { int year = GetYear(); wxDATETIME_CHECK( (0 < yday) && (yday <= GetNumberOfDays(year)), - wxT("invalid year day") ); + _T("invalid year day") ); bool isLeap = IsLeapYear(year); for ( Month mon = Jan; mon < Inv_Month; wxNextMonth(mon) ) @@ -1976,7 +2241,7 @@ double wxDateTime::GetRataDie() const int wxDateTime::IsDST(wxDateTime::Country country) const { wxCHECK_MSG( country == Country_Default, -1, - wxT("country support not implemented") ); + _T("country support not implemented") ); // use the C RTL for the dates in the standard range time_t timet = GetTicks(); @@ -1985,7 +2250,7 @@ int wxDateTime::IsDST(wxDateTime::Country country) const struct tm tmstruct; tm *tm = wxLocaltime_r(&timet, &tmstruct); - wxCHECK_MSG( tm, -1, wxT("wxLocaltime_r() failed") ); + wxCHECK_MSG( tm, -1, _T("wxLocaltime_r() failed") ); return tm->tm_isdst; } @@ -2005,7 +2270,7 @@ int wxDateTime::IsDST(wxDateTime::Country country) const wxDateTime& wxDateTime::MakeTimezone(const TimeZone& tz, bool noDST) { - long secDiff = wxGetTimeZone() + tz.GetOffset(); + long secDiff = GetTimeZone() + tz.GetOffset(); // we need to know whether DST is or not in effect for this date unless // the test disabled by the caller @@ -2020,7 +2285,7 @@ wxDateTime& wxDateTime::MakeTimezone(const TimeZone& tz, bool noDST) wxDateTime& wxDateTime::MakeFromTimezone(const TimeZone& tz, bool noDST) { - long secDiff = wxGetTimeZone() + tz.GetOffset(); + long secDiff = GetTimeZone() + tz.GetOffset(); // we need to know whether DST is or not in effect for this date unless // the test disabled by the caller @@ -2033,6 +2298,2155 @@ wxDateTime& wxDateTime::MakeFromTimezone(const TimeZone& tz, bool noDST) return Subtract(wxTimeSpan::Seconds(secDiff)); } +// ---------------------------------------------------------------------------- +// wxDateTime to/from text representations +// ---------------------------------------------------------------------------- + +wxString wxDateTime::Format(const wxChar *format, const TimeZone& tz) const +{ + wxCHECK_MSG( format, wxEmptyString, _T("NULL format in wxDateTime::Format") ); + + time_t time = GetTicks(); + + // we have to use our own implementation if the date is out of range of + // strftime() or if we use non standard specificators +#ifdef HAVE_STRFTIME + if ( (time != (time_t)-1) && !wxStrstr(format, _T("%l")) ) + { + // use strftime() + struct tm tmstruct; + struct tm *tm; + if ( tz.GetOffset() == -GetTimeZone() ) + { + // we are working with local time + tm = wxLocaltime_r(&time, &tmstruct); + + // should never happen + wxCHECK_MSG( tm, wxEmptyString, _T("wxLocaltime_r() failed") ); + } + else + { + time += (int)tz.GetOffset(); + +#if defined(__VMS__) || defined(__WATCOMC__) // time is unsigned so avoid warning + int time2 = (int) time; + if ( time2 >= 0 ) +#else + if ( time >= 0 ) +#endif + { + tm = wxGmtime_r(&time, &tmstruct); + + // should never happen + wxCHECK_MSG( tm, wxEmptyString, _T("wxGmtime_r() failed") ); + } + else + { + tm = (struct tm *)NULL; + } + } + + if ( tm ) + { + return CallStrftime(format, tm); + } + } + //else: use generic code below +#endif // HAVE_STRFTIME + + // we only parse ANSI C format specifications here, no POSIX 2 + // complications, no GNU extensions but we do add support for a "%l" format + // specifier allowing to get the number of milliseconds + Tm tm = GetTm(tz); + + // used for calls to strftime() when we only deal with time + struct tm tmTimeOnly; + memset(&tmTimeOnly, 0, sizeof(tmTimeOnly)); + tmTimeOnly.tm_hour = tm.hour; + tmTimeOnly.tm_min = tm.min; + tmTimeOnly.tm_sec = tm.sec; + tmTimeOnly.tm_wday = 0; + tmTimeOnly.tm_yday = 0; + tmTimeOnly.tm_mday = 1; // any date will do, use 1976-01-01 + tmTimeOnly.tm_mon = 0; + tmTimeOnly.tm_year = 76; + tmTimeOnly.tm_isdst = 0; // no DST, we adjust for tz ourselves + + wxString tmp, res, fmt; + for ( const wxChar *p = format; *p; p++ ) + { + if ( *p != _T('%') ) + { + // copy as is + res += *p; + + continue; + } + + // set the default format + switch ( *++p ) + { + case _T('Y'): // year has 4 digits + fmt = _T("%04d"); + break; + + case _T('j'): // day of year has 3 digits + case _T('l'): // milliseconds have 3 digits + fmt = _T("%03d"); + break; + + case _T('w'): // week day as number has only one + fmt = _T("%d"); + break; + + default: + // it's either another valid format specifier in which case + // the format is "%02d" (for all the rest) or we have the + // field width preceding the format in which case it will + // override the default format anyhow + fmt = _T("%02d"); + } + + bool restart = true; + while ( restart ) + { + restart = false; + + // start of the format specification + switch ( *p ) + { + case _T('a'): // a weekday name + case _T('A'): + // second parameter should be true for abbreviated names + res += GetWeekDayName(tm.GetWeekDay(), + *p == _T('a') ? Name_Abbr : Name_Full); + break; + + case _T('b'): // a month name + case _T('B'): + res += GetMonthName(tm.mon, + *p == _T('b') ? Name_Abbr : Name_Full); + break; + + case _T('c'): // locale default date and time representation + case _T('x'): // locale default date representation +#ifdef HAVE_STRFTIME + // + // the problem: there is no way to know what do these format + // specifications correspond to for the current locale. + // + // the solution: use a hack and still use strftime(): first + // find the YEAR which is a year in the strftime() range (1970 + // - 2038) whose Jan 1 falls on the same week day as the Jan 1 + // of the real year. Then make a copy of the format and + // replace all occurrences of YEAR in it with some unique + // string not appearing anywhere else in it, then use + // strftime() to format the date in year YEAR and then replace + // YEAR back by the real year and the unique replacement + // string back with YEAR. Notice that "all occurrences of YEAR" + // means all occurrences of 4 digit as well as 2 digit form! + // + // the bugs: we assume that neither of %c nor %x contains any + // fields which may change between the YEAR and real year. For + // example, the week number (%U, %W) and the day number (%j) + // will change if one of these years is leap and the other one + // is not! + { + // find the YEAR: normally, for any year X, Jan 1 or the + // year X + 28 is the same weekday as Jan 1 of X (because + // the weekday advances by 1 for each normal X and by 2 + // for each leap X, hence by 5 every 4 years or by 35 + // which is 0 mod 7 every 28 years) but this rule breaks + // down if there are years between X and Y which are + // divisible by 4 but not leap (i.e. divisible by 100 but + // not 400), hence the correction. + + int yearReal = GetYear(tz); + int mod28 = yearReal % 28; + + // be careful to not go too far - we risk to leave the + // supported range + int year; + if ( mod28 < 10 ) + { + year = 1988 + mod28; // 1988 == 0 (mod 28) + } + else + { + year = 1970 + mod28 - 10; // 1970 == 10 (mod 28) + } + + int nCentury = year / 100, + nCenturyReal = yearReal / 100; + + // need to adjust for the years divisble by 400 which are + // not leap but are counted like leap ones if we just take + // the number of centuries in between for nLostWeekDays + int nLostWeekDays = (nCentury - nCenturyReal) - + (nCentury / 4 - nCenturyReal / 4); + + // we have to gain back the "lost" weekdays: note that the + // effect of this loop is to not do anything to + // nLostWeekDays (which we won't use any more), but to + // (indirectly) set the year correctly + while ( (nLostWeekDays % 7) != 0 ) + { + nLostWeekDays += year++ % 4 ? 1 : 2; + } + + // Keep year below 2000 so the 2digit year number + // can never match the month or day of the month + if (year>=2000) year-=28; + // at any rate, we couldn't go further than 1988 + 9 + 28! + wxASSERT_MSG( year < 2030, + _T("logic error in wxDateTime::Format") ); + + wxString strYear, strYear2; + strYear.Printf(_T("%d"), year); + strYear2.Printf(_T("%d"), year % 100); + + // find four strings not occurring in format (this is surely + // not the optimal way of doing it... improvements welcome!) + wxString fmt2 = format; + wxString replacement,replacement2,replacement3,replacement4; + for (int rnr=1; rnr<5 ; rnr++) + { + wxString r = (wxChar)-rnr; + while ( fmt2.Find(r) != wxNOT_FOUND ) + { + r << (wxChar)-rnr; + } + + switch (rnr) + { + case 1: replacement=r; break; + case 2: replacement2=r; break; + case 3: replacement3=r; break; + case 4: replacement4=r; break; + } + } + // replace all occurrences of year with it + bool wasReplaced = fmt2.Replace(strYear, replacement) > 0; + // evaluation order ensures we always attempt the replacement. + wasReplaced = (fmt2.Replace(strYear2, replacement2) > 0) || wasReplaced; + + // use strftime() to format the same date but in supported + // year + // + // NB: we assume that strftime() doesn't check for the + // date validity and will happily format the date + // corresponding to Feb 29 of a non leap year (which + // may happen if yearReal was leap and year is not) + struct tm tmAdjusted; + InitTm(tmAdjusted); + tmAdjusted.tm_hour = tm.hour; + tmAdjusted.tm_min = tm.min; + tmAdjusted.tm_sec = tm.sec; + tmAdjusted.tm_wday = tm.GetWeekDay(); + tmAdjusted.tm_yday = GetDayOfYear(); + tmAdjusted.tm_mday = tm.mday; + tmAdjusted.tm_mon = tm.mon; + tmAdjusted.tm_year = year - 1900; + tmAdjusted.tm_isdst = 0; // no DST, already adjusted + wxString str = CallStrftime(*p == _T('c') ? _T("%c") + : _T("%x"), + &tmAdjusted); + + // now replace the occurrence of 1999 with the real year + // we do this in two stages to stop the 2 digit year + // matching any substring of the 4 digit year. + // Any day,month hours and minutes components should be safe due + // to ensuring the range of the years. + wxString strYearReal, strYearReal2; + strYearReal.Printf(_T("%04d"), yearReal); + strYearReal2.Printf(_T("%02d"), yearReal % 100); + str.Replace(strYear, replacement3); + str.Replace(strYear2,replacement4); + str.Replace(replacement3, strYearReal); + str.Replace(replacement4, strYearReal2); + + // and replace back all occurrences of replacement string + if ( wasReplaced ) + { + str.Replace(replacement2, strYear2); + str.Replace(replacement, strYear); + } + + res += str; + } +#else // !HAVE_STRFTIME + // Use "%m/%d/%y %H:%M:%S" format instead + res += wxString::Format(wxT("%02d/%02d/%04d %02d:%02d:%02d"), + tm.mon+1,tm.mday, tm.year, tm.hour, tm.min, tm.sec); +#endif // HAVE_STRFTIME/!HAVE_STRFTIME + break; + + case _T('d'): // day of a month (01-31) + res += wxString::Format(fmt, tm.mday); + break; + + case _T('H'): // hour in 24h format (00-23) + res += wxString::Format(fmt, tm.hour); + break; + + case _T('I'): // hour in 12h format (01-12) + { + // 24h -> 12h, 0h -> 12h too + int hour12 = tm.hour > 12 ? tm.hour - 12 + : tm.hour ? tm.hour : 12; + res += wxString::Format(fmt, hour12); + } + break; + + case _T('j'): // day of the year + res += wxString::Format(fmt, GetDayOfYear(tz)); + break; + + case _T('l'): // milliseconds (NOT STANDARD) + res += wxString::Format(fmt, GetMillisecond(tz)); + break; + + case _T('m'): // month as a number (01-12) + res += wxString::Format(fmt, tm.mon + 1); + break; + + case _T('M'): // minute as a decimal number (00-59) + res += wxString::Format(fmt, tm.min); + break; + + case _T('p'): // AM or PM string +#ifdef HAVE_STRFTIME + res += CallStrftime(_T("%p"), &tmTimeOnly); +#else // !HAVE_STRFTIME + res += (tmTimeOnly.tm_hour > 12) ? wxT("pm") : wxT("am"); +#endif // HAVE_STRFTIME/!HAVE_STRFTIME + break; + + case _T('S'): // second as a decimal number (00-61) + res += wxString::Format(fmt, tm.sec); + break; + + case _T('U'): // week number in the year (Sunday 1st week day) + res += wxString::Format(fmt, GetWeekOfYear(Sunday_First, tz)); + break; + + case _T('W'): // week number in the year (Monday 1st week day) + res += wxString::Format(fmt, GetWeekOfYear(Monday_First, tz)); + break; + + case _T('w'): // weekday as a number (0-6), Sunday = 0 + res += wxString::Format(fmt, tm.GetWeekDay()); + break; + + // case _T('x'): -- handled with "%c" + + case _T('X'): // locale default time representation + // just use strftime() to format the time for us +#ifdef HAVE_STRFTIME + res += CallStrftime(_T("%X"), &tmTimeOnly); +#else // !HAVE_STRFTIME + res += wxString::Format(wxT("%02d:%02d:%02d"),tm.hour, tm.min, tm.sec); +#endif // HAVE_STRFTIME/!HAVE_STRFTIME + break; + + case _T('y'): // year without century (00-99) + res += wxString::Format(fmt, tm.year % 100); + break; + + case _T('Y'): // year with century + res += wxString::Format(fmt, tm.year); + break; + + case _T('Z'): // timezone name +#ifdef HAVE_STRFTIME + res += CallStrftime(_T("%Z"), &tmTimeOnly); +#endif + break; + + default: + // is it the format width? + for( fmt.clear(); + *p == _T('-') || *p == _T('+') || + *p == _T(' ') || wxIsdigit(*p); + ++p ) + { + fmt += *p; + } + + if ( !fmt.empty() ) + { + // we've only got the flags and width so far in fmt + fmt.Prepend(_T('%')); + fmt.Append(_T('d')); + + restart = true; + + break; + } + + // no, it wasn't the width + wxFAIL_MSG(_T("unknown format specificator")); + + // fall through and just copy it nevertheless + + case _T('%'): // a percent sign + res += *p; + break; + + case 0: // the end of string + wxFAIL_MSG(_T("missing format at the end of string")); + + // just put the '%' which was the last char in format + res += _T('%'); + break; + } + } + } + + return res; +} + +// this function parses a string in (strict) RFC 822 format: see the section 5 +// of the RFC for the detailed description, but briefly it's something of the +// form "Sat, 18 Dec 1999 00:48:30 +0100" +// +// this function is "strict" by design - it must reject anything except true +// RFC822 time specs. +// +// TODO a great candidate for using reg exps +const wxChar *wxDateTime::ParseRfc822Date(const wxChar* date) +{ + wxCHECK_MSG( date, (wxChar *)NULL, _T("NULL pointer in wxDateTime::Parse") ); + + const wxChar *p = date; + const wxChar *comma = wxStrchr(p, _T(',')); + if ( comma ) + { + // the part before comma is the weekday + + // skip it for now - we don't use but might check that it really + // corresponds to the specfied date + p = comma + 1; + + if ( *p != _T(' ') ) + { + wxLogDebug(_T("no space after weekday in RFC822 time spec")); + + return (wxChar *)NULL; + } + + p++; // skip space + } + + // the following 1 or 2 digits are the day number + if ( !wxIsdigit(*p) ) + { + wxLogDebug(_T("day number expected in RFC822 time spec, none found")); + + return (wxChar *)NULL; + } + + wxDateTime_t day = (wxDateTime_t)(*p++ - _T('0')); + if ( wxIsdigit(*p) ) + { + day *= 10; + day = (wxDateTime_t)(day + (*p++ - _T('0'))); + } + + if ( *p++ != _T(' ') ) + { + return (wxChar *)NULL; + } + + // the following 3 letters specify the month + wxString monName(p, 3); + Month mon; + if ( monName == _T("Jan") ) + mon = Jan; + else if ( monName == _T("Feb") ) + mon = Feb; + else if ( monName == _T("Mar") ) + mon = Mar; + else if ( monName == _T("Apr") ) + mon = Apr; + else if ( monName == _T("May") ) + mon = May; + else if ( monName == _T("Jun") ) + mon = Jun; + else if ( monName == _T("Jul") ) + mon = Jul; + else if ( monName == _T("Aug") ) + mon = Aug; + else if ( monName == _T("Sep") ) + mon = Sep; + else if ( monName == _T("Oct") ) + mon = Oct; + else if ( monName == _T("Nov") ) + mon = Nov; + else if ( monName == _T("Dec") ) + mon = Dec; + else + { + wxLogDebug(_T("Invalid RFC 822 month name '%s'"), monName.c_str()); + + return (wxChar *)NULL; + } + + p += 3; + + if ( *p++ != _T(' ') ) + { + return (wxChar *)NULL; + } + + // next is the year + if ( !wxIsdigit(*p) ) + { + // no year? + return (wxChar *)NULL; + } + + int year = *p++ - _T('0'); + + if ( !wxIsdigit(*p) ) + { + // should have at least 2 digits in the year + return (wxChar *)NULL; + } + + year *= 10; + year += *p++ - _T('0'); + + // is it a 2 digit year (as per original RFC 822) or a 4 digit one? + if ( wxIsdigit(*p) ) + { + year *= 10; + year += *p++ - _T('0'); + + if ( !wxIsdigit(*p) ) + { + // no 3 digit years please + return (wxChar *)NULL; + } + + year *= 10; + year += *p++ - _T('0'); + } + + if ( *p++ != _T(' ') ) + { + return (wxChar *)NULL; + } + + // time is in the format hh:mm:ss and seconds are optional + if ( !wxIsdigit(*p) ) + { + return (wxChar *)NULL; + } + + wxDateTime_t hour = (wxDateTime_t)(*p++ - _T('0')); + + if ( !wxIsdigit(*p) ) + { + return (wxChar *)NULL; + } + + hour *= 10; + hour = (wxDateTime_t)(hour + (*p++ - _T('0'))); + + if ( *p++ != _T(':') ) + { + return (wxChar *)NULL; + } + + if ( !wxIsdigit(*p) ) + { + return (wxChar *)NULL; + } + + wxDateTime_t min = (wxDateTime_t)(*p++ - _T('0')); + + if ( !wxIsdigit(*p) ) + { + return (wxChar *)NULL; + } + + min *= 10; + min = (wxDateTime_t)(min + *p++ - _T('0')); + + wxDateTime_t sec = 0; + if ( *p == _T(':') ) + { + p++; + if ( !wxIsdigit(*p) ) + { + return (wxChar *)NULL; + } + + sec = (wxDateTime_t)(*p++ - _T('0')); + + if ( !wxIsdigit(*p) ) + { + return (wxChar *)NULL; + } + + sec *= 10; + sec = (wxDateTime_t)(sec + *p++ - _T('0')); + } + + if ( *p++ != _T(' ') ) + { + return (wxChar *)NULL; + } + + // and now the interesting part: the timezone + int offset wxDUMMY_INITIALIZE(0); + if ( *p == _T('-') || *p == _T('+') ) + { + // the explicit offset given: it has the form of hhmm + bool plus = *p++ == _T('+'); + + if ( !wxIsdigit(*p) || !wxIsdigit(*(p + 1)) ) + { + return (wxChar *)NULL; + } + + // hours + offset = MIN_PER_HOUR*(10*(*p - _T('0')) + (*(p + 1) - _T('0'))); + + p += 2; + + if ( !wxIsdigit(*p) || !wxIsdigit(*(p + 1)) ) + { + return (wxChar *)NULL; + } + + // minutes + offset += 10*(*p - _T('0')) + (*(p + 1) - _T('0')); + + if ( !plus ) + { + offset = -offset; + } + + p += 2; + } + else + { + // the symbolic timezone given: may be either military timezone or one + // of standard abbreviations + if ( !*(p + 1) ) + { + // military: Z = UTC, J unused, A = -1, ..., Y = +12 + static const int offsets[26] = + { + //A B C D E F G H I J K L M + -1, -2, -3, -4, -5, -6, -7, -8, -9, 0, -10, -11, -12, + //N O P R Q S T U V W Z Y Z + +1, +2, +3, +4, +5, +6, +7, +8, +9, +10, +11, +12, 0 + }; + + if ( *p < _T('A') || *p > _T('Z') || *p == _T('J') ) + { + wxLogDebug(_T("Invalid militaty timezone '%c'"), *p); + + return (wxChar *)NULL; + } + + offset = offsets[*p++ - _T('A')]; + } + else + { + // abbreviation + wxString tz = p; + if ( tz == _T("UT") || tz == _T("UTC") || tz == _T("GMT") ) + offset = 0; + else if ( tz == _T("AST") ) + offset = AST - GMT0; + else if ( tz == _T("ADT") ) + offset = ADT - GMT0; + else if ( tz == _T("EST") ) + offset = EST - GMT0; + else if ( tz == _T("EDT") ) + offset = EDT - GMT0; + else if ( tz == _T("CST") ) + offset = CST - GMT0; + else if ( tz == _T("CDT") ) + offset = CDT - GMT0; + else if ( tz == _T("MST") ) + offset = MST - GMT0; + else if ( tz == _T("MDT") ) + offset = MDT - GMT0; + else if ( tz == _T("PST") ) + offset = PST - GMT0; + else if ( tz == _T("PDT") ) + offset = PDT - GMT0; + else + { + wxLogDebug(_T("Unknown RFC 822 timezone '%s'"), p); + + return (wxChar *)NULL; + } + + p += tz.length(); + } + + // make it minutes + offset *= MIN_PER_HOUR; + } + + // the spec was correct, construct the date from the values we found + Set(day, mon, year, hour, min, sec); + MakeFromTimezone(TimeZone::Make(offset*SEC_PER_MIN)); + + return p; +} + +#ifdef __WINDOWS__ + +// returns the string containing strftime() format used for short dates in the +// current locale or an empty string +static wxString GetLocaleDateFormat() +{ + wxString fmtWX; + + // there is no setlocale() under Windows CE, so just always query the + // system there +#ifndef __WXWINCE__ + if ( strcmp(setlocale(LC_ALL, NULL), "C") != 0 ) +#endif + { + // The locale was programatically set to non-C. We assume that this was + // done using wxLocale, in which case thread's current locale is also + // set to correct LCID value and we can use GetLocaleInfo to determine + // the correct formatting string: +#ifdef __WXWINCE__ + LCID lcid = LOCALE_USER_DEFAULT; +#else + LCID lcid = GetThreadLocale(); +#endif + // according to MSDN 80 chars is max allowed for short date format + wxChar fmt[81]; + if ( ::GetLocaleInfo(lcid, LOCALE_SSHORTDATE, fmt, WXSIZEOF(fmt)) ) + { + wxChar chLast = _T('\0'); + size_t lastCount = 0; + for ( const wxChar *p = fmt; /* NUL handled inside */; p++ ) + { + if ( *p == chLast ) + { + lastCount++; + continue; + } + + switch ( *p ) + { + // these characters come in groups, start counting them + case _T('d'): + case _T('M'): + case _T('y'): + case _T('g'): + chLast = *p; + lastCount = 1; + break; + + default: + // first deal with any special characters we have had + if ( lastCount ) + { + switch ( chLast ) + { + case _T('d'): + switch ( lastCount ) + { + case 1: // d + case 2: // dd + // these two are the same as we + // don't distinguish between 1 and + // 2 digits for days + fmtWX += _T("%d"); + break; + + case 3: // ddd + fmtWX += _T("%a"); + break; + + case 4: // dddd + fmtWX += _T("%A"); + break; + + default: + wxFAIL_MSG( _T("too many 'd's") ); + } + break; + + case _T('M'): + switch ( lastCount ) + { + case 1: // M + case 2: // MM + // as for 'd' and 'dd' above + fmtWX += _T("%m"); + break; + + case 3: + fmtWX += _T("%b"); + break; + + case 4: + fmtWX += _T("%B"); + break; + + default: + wxFAIL_MSG( _T("too many 'M's") ); + } + break; + + case _T('y'): + switch ( lastCount ) + { + case 1: // y + case 2: // yy + fmtWX += _T("%y"); + break; + + case 4: // yyyy + fmtWX += _T("%Y"); + break; + + default: + wxFAIL_MSG( _T("wrong number of 'y's") ); + } + break; + + case _T('g'): + // strftime() doesn't have era string, + // ignore this format + wxASSERT_MSG( lastCount <= 2, + _T("too many 'g's") ); + break; + + default: + wxFAIL_MSG( _T("unreachable") ); + } + + chLast = _T('\0'); + lastCount = 0; + } + + // not a special character so must be just a separator, + // treat as is + if ( *p != _T('\0') ) + { + if ( *p == _T('%') ) + { + // this one needs to be escaped + fmtWX += _T('%'); + } + + fmtWX += *p; + } + } + + if ( *p == _T('\0') ) + break; + } + } + //else: GetLocaleInfo() failed, leave fmtDate value unchanged and + // try our luck with the default formats + } + //else: default C locale, default formats should work + + return fmtWX; +} + +#endif // __WINDOWS__ + +const wxChar *wxDateTime::ParseFormat(const wxChar *date, + const wxChar *format, + const wxDateTime& dateDef) +{ + wxCHECK_MSG( date && format, (wxChar *)NULL, + _T("NULL pointer in wxDateTime::ParseFormat()") ); + + wxString str; + unsigned long num; + + // what fields have we found? + bool haveWDay = false, + haveYDay = false, + haveDay = false, + haveMon = false, + haveYear = false, + haveHour = false, + haveMin = false, + haveSec = false; + + bool hourIsIn12hFormat = false, // or in 24h one? + isPM = false; // AM by default + + // and the value of the items we have (init them to get rid of warnings) + wxDateTime_t sec = 0, + min = 0, + hour = 0; + WeekDay wday = Inv_WeekDay; + wxDateTime_t yday = 0, + mday = 0; + wxDateTime::Month mon = Inv_Month; + int year = 0; + + const wxChar *input = date; + for ( const wxChar *fmt = format; *fmt; fmt++ ) + { + if ( *fmt != _T('%') ) + { + if ( wxIsspace(*fmt) ) + { + // a white space in the format string matches 0 or more white + // spaces in the input + while ( wxIsspace(*input) ) + { + input++; + } + } + else // !space + { + // any other character (not whitespace, not '%') must be + // matched by itself in the input + if ( *input++ != *fmt ) + { + // no match + return (wxChar *)NULL; + } + } + + // done with this format char + continue; + } + + // start of a format specification + + // parse the optional width + size_t width = 0; + while ( wxIsdigit(*++fmt) ) + { + width *= 10; + width += *fmt - _T('0'); + } + + // the default widths for the various fields + if ( !width ) + { + switch ( *fmt ) + { + case _T('Y'): // year has 4 digits + width = 4; + break; + + case _T('j'): // day of year has 3 digits + case _T('l'): // milliseconds have 3 digits + width = 3; + break; + + case _T('w'): // week day as number has only one + width = 1; + break; + + default: + // default for all other fields + width = 2; + } + } + + // then the format itself + switch ( *fmt ) + { + case _T('a'): // a weekday name + case _T('A'): + { + int flag = *fmt == _T('a') ? Name_Abbr : Name_Full; + wday = GetWeekDayFromName(GetAlphaToken(input), flag); + if ( wday == Inv_WeekDay ) + { + // no match + return (wxChar *)NULL; + } + } + haveWDay = true; + break; + + case _T('b'): // a month name + case _T('B'): + { + int flag = *fmt == _T('b') ? Name_Abbr : Name_Full; + mon = GetMonthFromName(GetAlphaToken(input), flag); + if ( mon == Inv_Month ) + { + // no match + return (wxChar *)NULL; + } + } + haveMon = true; + break; + + case _T('c'): // locale default date and time representation + { + wxDateTime dt; + + // this is the format which corresponds to ctime() output + // and strptime("%c") should parse it, so try it first + static const wxChar *fmtCtime = _T("%a %b %d %H:%M:%S %Y"); + + const wxChar *result = dt.ParseFormat(input, fmtCtime); + if ( !result ) + { + result = dt.ParseFormat(input, _T("%x %X")); + } + + if ( !result ) + { + result = dt.ParseFormat(input, _T("%X %x")); + } + + if ( !result ) + { + // we've tried everything and still no match + return (wxChar *)NULL; + } + + Tm tm = dt.GetTm(); + + haveDay = haveMon = haveYear = + haveHour = haveMin = haveSec = true; + + hour = tm.hour; + min = tm.min; + sec = tm.sec; + + year = tm.year; + mon = tm.mon; + mday = tm.mday; + + input = result; + } + break; + + case _T('d'): // day of a month (01-31) + if ( !GetNumericToken(width, input, &num) || + (num > 31) || (num < 1) ) + { + // no match + return (wxChar *)NULL; + } + + // we can't check whether the day range is correct yet, will + // do it later - assume ok for now + haveDay = true; + mday = (wxDateTime_t)num; + break; + + case _T('H'): // hour in 24h format (00-23) + if ( !GetNumericToken(width, input, &num) || (num > 23) ) + { + // no match + return (wxChar *)NULL; + } + + haveHour = true; + hour = (wxDateTime_t)num; + break; + + case _T('I'): // hour in 12h format (01-12) + if ( !GetNumericToken(width, input, &num) || !num || (num > 12) ) + { + // no match + return (wxChar *)NULL; + } + + haveHour = true; + hourIsIn12hFormat = true; + hour = (wxDateTime_t)(num % 12); // 12 should be 0 + break; + + case _T('j'): // day of the year + if ( !GetNumericToken(width, input, &num) || !num || (num > 366) ) + { + // no match + return (wxChar *)NULL; + } + + haveYDay = true; + yday = (wxDateTime_t)num; + break; + + case _T('m'): // month as a number (01-12) + if ( !GetNumericToken(width, input, &num) || !num || (num > 12) ) + { + // no match + return (wxChar *)NULL; + } + + haveMon = true; + mon = (Month)(num - 1); + break; + + case _T('M'): // minute as a decimal number (00-59) + if ( !GetNumericToken(width, input, &num) || (num > 59) ) + { + // no match + return (wxChar *)NULL; + } + + haveMin = true; + min = (wxDateTime_t)num; + break; + + case _T('p'): // AM or PM string + { + wxString am, pm, token = GetAlphaToken(input); + + GetAmPmStrings(&am, &pm); + if (am.empty() && pm.empty()) + return (wxChar *)NULL; // no am/pm strings defined + if ( token.CmpNoCase(pm) == 0 ) + { + isPM = true; + } + else if ( token.CmpNoCase(am) != 0 ) + { + // no match + return (wxChar *)NULL; + } + } + break; + + case _T('r'): // time as %I:%M:%S %p + { + wxDateTime dt; + input = dt.ParseFormat(input, _T("%I:%M:%S %p")); + if ( !input ) + { + // no match + return (wxChar *)NULL; + } + + haveHour = haveMin = haveSec = true; + + Tm tm = dt.GetTm(); + hour = tm.hour; + min = tm.min; + sec = tm.sec; + } + break; + + case _T('R'): // time as %H:%M + { + wxDateTime dt; + input = dt.ParseFormat(input, _T("%H:%M")); + if ( !input ) + { + // no match + return (wxChar *)NULL; + } + + haveHour = haveMin = true; + + Tm tm = dt.GetTm(); + hour = tm.hour; + min = tm.min; + } + break; + + case _T('S'): // second as a decimal number (00-61) + if ( !GetNumericToken(width, input, &num) || (num > 61) ) + { + // no match + return (wxChar *)NULL; + } + + haveSec = true; + sec = (wxDateTime_t)num; + break; + + case _T('T'): // time as %H:%M:%S + { + wxDateTime dt; + input = dt.ParseFormat(input, _T("%H:%M:%S")); + if ( !input ) + { + // no match + return (wxChar *)NULL; + } + + haveHour = haveMin = haveSec = true; + + Tm tm = dt.GetTm(); + hour = tm.hour; + min = tm.min; + sec = tm.sec; + } + break; + + case _T('w'): // weekday as a number (0-6), Sunday = 0 + if ( !GetNumericToken(width, input, &num) || (wday > 6) ) + { + // no match + return (wxChar *)NULL; + } + + haveWDay = true; + wday = (WeekDay)num; + break; + + case _T('x'): // locale default date representation +#ifdef HAVE_STRPTIME + // try using strptime() -- it may fail even if the input is + // correct but the date is out of range, so we will fall back + // to our generic code anyhow + { + struct tm tm; + + const wxChar *result = CallStrptime(input, "%x", &tm); + if ( result ) + { + input = result; + + haveDay = haveMon = haveYear = true; + + year = 1900 + tm.tm_year; + mon = (Month)tm.tm_mon; + mday = tm.tm_mday; + + break; + } + } +#endif // HAVE_STRPTIME + + { + wxDateTime dt; + wxString fmtDate, + fmtDateAlt; + +#ifdef __WINDOWS__ + // The above doesn't work for all locales, try to query + // Windows for the right way of formatting the date: + fmtDate = GetLocaleDateFormat(); + if ( fmtDate.empty() ) +#endif + { + if ( IsWestEuropeanCountry(GetCountry()) || + GetCountry() == Russia ) + { + fmtDate = _T("%d/%m/%y"); + fmtDateAlt = _T("%m/%d/%y"); + } + else // assume USA + { + fmtDate = _T("%m/%d/%y"); + fmtDateAlt = _T("%d/%m/%y"); + } + } + + const wxChar *result = dt.ParseFormat(input, fmtDate); + + if ( !result && !fmtDateAlt.empty() ) + { + // ok, be nice and try another one + result = dt.ParseFormat(input, fmtDateAlt); + } + + if ( !result ) + { + // bad luck + return (wxChar *)NULL; + } + + Tm tm = dt.GetTm(); + + haveDay = haveMon = haveYear = true; + + year = tm.year; + mon = tm.mon; + mday = tm.mday; + + input = result; + } + + break; + + case _T('X'): // locale default time representation +#ifdef HAVE_STRPTIME + { + // use strptime() to do it for us (FIXME !Unicode friendly) + struct tm tm; + input = CallStrptime(input, "%X", &tm); + if ( !input ) + { + return (wxChar *)NULL; + } + + haveHour = haveMin = haveSec = true; + + hour = tm.tm_hour; + min = tm.tm_min; + sec = tm.tm_sec; + } +#else // !HAVE_STRPTIME + // TODO under Win32 we can query the LOCALE_ITIME system + // setting which says whether the default time format is + // 24 or 12 hour + { + // try to parse what follows as "%H:%M:%S" and, if this + // fails, as "%I:%M:%S %p" - this should catch the most + // common cases + wxDateTime dt; + + const wxChar *result = dt.ParseFormat(input, _T("%T")); + if ( !result ) + { + result = dt.ParseFormat(input, _T("%r")); + } + + if ( !result ) + { + // no match + return (wxChar *)NULL; + } + + haveHour = haveMin = haveSec = true; + + Tm tm = dt.GetTm(); + hour = tm.hour; + min = tm.min; + sec = tm.sec; + + input = result; + } +#endif // HAVE_STRPTIME/!HAVE_STRPTIME + break; + + case _T('y'): // year without century (00-99) + if ( !GetNumericToken(width, input, &num) || (num > 99) ) + { + // no match + return (wxChar *)NULL; + } + + haveYear = true; + + // TODO should have an option for roll over date instead of + // hard coding it here + year = (num > 30 ? 1900 : 2000) + (wxDateTime_t)num; + break; + + case _T('Y'): // year with century + if ( !GetNumericToken(width, input, &num) ) + { + // no match + return (wxChar *)NULL; + } + + haveYear = true; + year = (wxDateTime_t)num; + break; + + case _T('Z'): // timezone name + wxFAIL_MSG(_T("TODO")); + break; + + case _T('%'): // a percent sign + if ( *input++ != _T('%') ) + { + // no match + return (wxChar *)NULL; + } + break; + + case 0: // the end of string + wxFAIL_MSG(_T("unexpected format end")); + + // fall through + + default: // not a known format spec + return (wxChar *)NULL; + } + } + + // format matched, try to construct a date from what we have now + Tm tmDef; + if ( dateDef.IsValid() ) + { + // take this date as default + tmDef = dateDef.GetTm(); + } + else if ( IsValid() ) + { + // if this date is valid, don't change it + tmDef = GetTm(); + } + else + { + // no default and this date is invalid - fall back to Today() + tmDef = Today().GetTm(); + } + + Tm tm = tmDef; + + // set the date + if ( haveYear ) + { + tm.year = year; + } + + // TODO we don't check here that the values are consistent, if both year + // day and month/day were found, we just ignore the year day and we + // also always ignore the week day + if ( haveMon && haveDay ) + { + if ( mday > GetNumOfDaysInMonth(tm.year, mon) ) + { + wxLogDebug(_T("bad month day in wxDateTime::ParseFormat")); + + return (wxChar *)NULL; + } + + tm.mon = mon; + tm.mday = mday; + } + else if ( haveYDay ) + { + if ( yday > GetNumberOfDays(tm.year) ) + { + wxLogDebug(_T("bad year day in wxDateTime::ParseFormat")); + + return (wxChar *)NULL; + } + + Tm tm2 = wxDateTime(1, Jan, tm.year).SetToYearDay(yday).GetTm(); + + tm.mon = tm2.mon; + tm.mday = tm2.mday; + } + + // deal with AM/PM + if ( haveHour && hourIsIn12hFormat && isPM ) + { + // translate to 24hour format + hour += 12; + } + //else: either already in 24h format or no translation needed + + // set the time + if ( haveHour ) + { + tm.hour = hour; + } + + if ( haveMin ) + { + tm.min = min; + } + + if ( haveSec ) + { + tm.sec = sec; + } + + Set(tm); + + // finally check that the week day is consistent -- if we had it + if ( haveWDay && GetWeekDay() != wday ) + { + wxLogDebug(_T("inconsistsnet week day in wxDateTime::ParseFormat()")); + + return NULL; + } + + return input; +} + +const wxChar *wxDateTime::ParseDateTime(const wxChar *date) +{ + wxCHECK_MSG( date, (wxChar *)NULL, _T("NULL pointer in wxDateTime::Parse") ); + + // Set to current day and hour, so strings like '14:00' becomes today at + // 14, not some other random date + wxDateTime dtDate = wxDateTime::Today(); + wxDateTime dtTime = wxDateTime::Today(); + + const wxChar* pchTime; + + // Try to parse the beginning of the string as a date + const wxChar* pchDate = dtDate.ParseDate(date); + + // We got a date in the beginning, see if there is a time specified after the date + if ( pchDate ) + { + // Skip spaces, as the ParseTime() function fails on spaces + while ( wxIsspace(*pchDate) ) + pchDate++; + + pchTime = dtTime.ParseTime(pchDate); + } + else // no date in the beginning + { + // check and see if we have a time followed by a date + pchTime = dtTime.ParseTime(date); + if ( pchTime ) + { + while ( wxIsspace(*pchTime) ) + pchTime++; + + pchDate = dtDate.ParseDate(pchTime); + } + } + + // If we have a date specified, set our own data to the same date + if ( !pchDate || !pchTime ) + return NULL; + + Set(dtDate.GetDay(), dtDate.GetMonth(), dtDate.GetYear(), + dtTime.GetHour(), dtTime.GetMinute(), dtTime.GetSecond(), + dtTime.GetMillisecond()); + + // Return endpoint of scan + return pchDate > pchTime ? pchDate : pchTime; +} + +const wxChar *wxDateTime::ParseDate(const wxChar *date) +{ + // this is a simplified version of ParseDateTime() which understands only + // "today" (for wxDate compatibility) and digits only otherwise (and not + // all esoteric constructions ParseDateTime() knows about) + + wxCHECK_MSG( date, (wxChar *)NULL, _T("NULL pointer in wxDateTime::Parse") ); + + const wxChar *p = date; + while ( wxIsspace(*p) ) + p++; + + // some special cases + static struct + { + const wxChar *str; + int dayDiffFromToday; + } literalDates[] = + { + { wxTRANSLATE("today"), 0 }, + { wxTRANSLATE("yesterday"), -1 }, + { wxTRANSLATE("tomorrow"), 1 }, + }; + + for ( size_t n = 0; n < WXSIZEOF(literalDates); n++ ) + { + const wxString dateStr = wxGetTranslation(literalDates[n].str); + size_t len = dateStr.length(); + if ( wxStrlen(p) >= len ) + { + wxString str(p, len); + if ( str.CmpNoCase(dateStr) == 0 ) + { + // nothing can follow this, so stop here + p += len; + + int dayDiffFromToday = literalDates[n].dayDiffFromToday; + *this = Today(); + if ( dayDiffFromToday ) + { + *this += wxDateSpan::Days(dayDiffFromToday); + } + + return p; + } + } + } + + // We try to guess what we have here: for each new (numeric) token, we + // determine if it can be a month, day or a year. Of course, there is an + // ambiguity as some numbers may be days as well as months, so we also + // have the ability to back track. + + // what do we have? + bool haveDay = false, // the months day? + haveWDay = false, // the day of week? + haveMon = false, // the month? + haveYear = false; // the year? + + // and the value of the items we have (init them to get rid of warnings) + WeekDay wday = Inv_WeekDay; + wxDateTime_t day = 0; + wxDateTime::Month mon = Inv_Month; + int year = 0; + + // tokenize the string + size_t nPosCur = 0; + static const wxChar *dateDelimiters = _T(".,/-\t\r\n "); + wxStringTokenizer tok(p, dateDelimiters); + while ( tok.HasMoreTokens() ) + { + wxString token = tok.GetNextToken(); + if ( !token ) + continue; + + // is it a number? + unsigned long val; + if ( token.ToULong(&val) ) + { + // guess what this number is + + bool isDay = false, + isMonth = false, + isYear = false; + + if ( !haveMon && val > 0 && val <= 12 ) + { + // assume it is month + isMonth = true; + } + else // not the month + { + if ( haveDay ) + { + // this can only be the year + isYear = true; + } + else // may be either day or year + { + // use a leap year if we don't have the year yet to allow + // dates like 2/29/1976 which would be rejected otherwise + wxDateTime_t max_days = (wxDateTime_t)( + haveMon + ? GetNumOfDaysInMonth(haveYear ? year : 1976, mon) + : 31 + ); + + // can it be day? + if ( (val == 0) || (val > (unsigned long)max_days) ) + { + // no + isYear = true; + } + else // yes, suppose it's the day + { + isDay = true; + } + } + } + + if ( isYear ) + { + if ( haveYear ) + break; + + haveYear = true; + + year = (wxDateTime_t)val; + } + else if ( isDay ) + { + if ( haveDay ) + break; + + haveDay = true; + + day = (wxDateTime_t)val; + } + else if ( isMonth ) + { + haveMon = true; + + mon = (Month)(val - 1); + } + } + else // not a number + { + // be careful not to overwrite the current mon value + Month mon2 = GetMonthFromName(token, Name_Full | Name_Abbr); + if ( mon2 != Inv_Month ) + { + // it's a month + if ( haveMon ) + { + // but we already have a month - maybe we guessed wrong? + if ( !haveDay ) + { + // no need to check in month range as always < 12, but + // the days are counted from 1 unlike the months + day = (wxDateTime_t)(mon + 1); + haveDay = true; + } + else + { + // could possible be the year (doesn't the year come + // before the month in the japanese format?) (FIXME) + break; + } + } + + mon = mon2; + + haveMon = true; + } + else // not a valid month name + { + WeekDay wday2 = GetWeekDayFromName(token, Name_Full | Name_Abbr); + if ( wday2 != Inv_WeekDay ) + { + // a week day + if ( haveWDay ) + { + break; + } + + wday = wday2; + + haveWDay = true; + } + else // not a valid weekday name + { + // try the ordinals + static const wxChar *ordinals[] = + { + wxTRANSLATE("first"), + wxTRANSLATE("second"), + wxTRANSLATE("third"), + wxTRANSLATE("fourth"), + wxTRANSLATE("fifth"), + wxTRANSLATE("sixth"), + wxTRANSLATE("seventh"), + wxTRANSLATE("eighth"), + wxTRANSLATE("ninth"), + wxTRANSLATE("tenth"), + wxTRANSLATE("eleventh"), + wxTRANSLATE("twelfth"), + wxTRANSLATE("thirteenth"), + wxTRANSLATE("fourteenth"), + wxTRANSLATE("fifteenth"), + wxTRANSLATE("sixteenth"), + wxTRANSLATE("seventeenth"), + wxTRANSLATE("eighteenth"), + wxTRANSLATE("nineteenth"), + wxTRANSLATE("twentieth"), + // that's enough - otherwise we'd have problems with + // composite (or not) ordinals + }; + + size_t n; + for ( n = 0; n < WXSIZEOF(ordinals); n++ ) + { + if ( token.CmpNoCase(ordinals[n]) == 0 ) + { + break; + } + } + + if ( n == WXSIZEOF(ordinals) ) + { + // stop here - something unknown + break; + } + + // it's a day + if ( haveDay ) + { + // don't try anything here (as in case of numeric day + // above) - the symbolic day spec should always + // precede the month/year + break; + } + + haveDay = true; + + day = (wxDateTime_t)(n + 1); + } + } + } + + nPosCur = tok.GetPosition(); + } + + // either no more tokens or the scan was stopped by something we couldn't + // parse - in any case, see if we can construct a date from what we have + if ( !haveDay && !haveWDay ) + { + wxLogDebug(_T("ParseDate: no day, no weekday hence no date.")); + + return NULL; + } + + if ( haveWDay && (haveMon || haveYear || haveDay) && + !(haveDay && haveMon && haveYear) ) + { + // without adjectives (which we don't support here) the week day only + // makes sense completely separately or with the full date + // specification (what would "Wed 1999" mean?) + return NULL; + } + + if ( !haveWDay && haveYear && !(haveDay && haveMon) ) + { + // may be we have month and day instead of day and year? + if ( haveDay && !haveMon ) + { + if ( day <= 12 ) + { + // exchange day and month + mon = (wxDateTime::Month)(day - 1); + + // we're in the current year then + if ( (year > 0) && (year <= (int)GetNumOfDaysInMonth(Inv_Year, mon)) ) + { + day = (wxDateTime_t)year; + + haveMon = true; + haveYear = false; + } + //else: no, can't exchange, leave haveMon == false + } + } + + if ( !haveMon ) + { + // if we give the year, month and day must be given too + wxLogDebug(_T("ParseDate: day and month should be specified if year is.")); + + return NULL; + } + } + + if ( !haveMon ) + { + mon = GetCurrentMonth(); + } + + if ( !haveYear ) + { + year = GetCurrentYear(); + } + + if ( haveDay ) + { + // normally we check the day above but the check is optimistic in case + // we find the day before its month/year so we have to redo it now + if ( day > GetNumOfDaysInMonth(year, mon) ) + return NULL; + + Set(day, mon, year); + + if ( haveWDay ) + { + // check that it is really the same + if ( GetWeekDay() != wday ) + { + // inconsistency detected + wxLogDebug(_T("ParseDate: inconsistent day/weekday.")); + + return (wxChar *)NULL; + } + } + } + else // haveWDay + { + *this = Today(); + + SetToWeekDayInSameWeek(wday); + } + + // return the pointer to the first unparsed char + p += nPosCur; + if ( nPosCur && wxStrchr(dateDelimiters, *(p - 1)) ) + { + // if we couldn't parse the token after the delimiter, put back the + // delimiter as well + p--; + } + + return p; +} + +const wxChar *wxDateTime::ParseTime(const wxChar *time) +{ + wxCHECK_MSG( time, (wxChar *)NULL, _T("NULL pointer in wxDateTime::Parse") ); + + // first try some extra things + static const struct + { + const wxChar *name; + wxDateTime_t hour; + } stdTimes[] = + { + { wxTRANSLATE("noon"), 12 }, + { wxTRANSLATE("midnight"), 00 }, + // anything else? + }; + + for ( size_t n = 0; n < WXSIZEOF(stdTimes); n++ ) + { + wxString timeString = wxGetTranslation(stdTimes[n].name); + size_t len = timeString.length(); + if ( timeString.CmpNoCase(wxString(time, len)) == 0 ) + { + // casts required by DigitalMars + Set(stdTimes[n].hour, wxDateTime_t(0), wxDateTime_t(0)); + + return time + len; + } + } + + // try all time formats we may think about in the order from longest to + // shortest + + // 12hour with AM/PM? + const wxChar *result = ParseFormat(time, _T("%I:%M:%S %p")); + + if ( !result ) + { + // normally, it's the same, but why not try it? + result = ParseFormat(time, _T("%H:%M:%S")); + } + + if ( !result ) + { + // 12hour with AM/PM but without seconds? + result = ParseFormat(time, _T("%I:%M %p")); + } + + if ( !result ) + { + // without seconds? + result = ParseFormat(time, _T("%H:%M")); + } + + if ( !result ) + { + // just the hour and AM/PM? + result = ParseFormat(time, _T("%I %p")); + } + + if ( !result ) + { + // just the hour? + result = ParseFormat(time, _T("%H")); + } + + if ( !result ) + { + // parse the standard format: normally it is one of the formats above + // but it may be set to something completely different by the user + result = ParseFormat(time, _T("%X")); + } + + // TODO: parse timezones + + return result; +} + +// ---------------------------------------------------------------------------- +// Workdays and holidays support +// ---------------------------------------------------------------------------- + +bool wxDateTime::IsWorkDay(Country WXUNUSED(country)) const +{ + return !wxDateTimeHolidayAuthority::IsHoliday(*this); +} + +// ============================================================================ +// wxDateSpan +// ============================================================================ + +wxDateSpan WXDLLIMPEXP_BASE operator*(int n, const wxDateSpan& ds) +{ + wxDateSpan ds1(ds); + return ds1.Multiply(n); +} + +// ============================================================================ +// wxTimeSpan +// ============================================================================ + +wxTimeSpan WXDLLIMPEXP_BASE operator*(int n, const wxTimeSpan& ts) +{ + return wxTimeSpan(ts).Multiply(n); +} + +// this enum is only used in wxTimeSpan::Format() below but we can't declare +// it locally to the method as it provokes an internal compiler error in egcs +// 2.91.60 when building with -O2 +enum TimeSpanPart +{ + Part_Week, + Part_Day, + Part_Hour, + Part_Min, + Part_Sec, + Part_MSec +}; + +// not all strftime(3) format specifiers make sense here because, for example, +// a time span doesn't have a year nor a timezone +// +// Here are the ones which are supported (all of them are supported by strftime +// as well): +// %H hour in 24 hour format +// %M minute (00 - 59) +// %S second (00 - 59) +// %% percent sign +// +// Also, for MFC CTimeSpan compatibility, we support +// %D number of days +// +// And, to be better than MFC :-), we also have +// %E number of wEeks +// %l milliseconds (000 - 999) +wxString wxTimeSpan::Format(const wxChar *format) const +{ + // we deal with only positive time spans here and just add the sign in + // front for the negative ones + if ( IsNegative() ) + { + wxString str(Negate().Format(format)); + return _T("-") + str; + } + + wxCHECK_MSG( format, wxEmptyString, + _T("NULL format in wxTimeSpan::Format") ); + + wxString str; + str.Alloc(wxStrlen(format)); + + // Suppose we have wxTimeSpan ts(1 /* hour */, 2 /* min */, 3 /* sec */) + // + // Then, of course, ts.Format("%H:%M:%S") must return "01:02:03", but the + // question is what should ts.Format("%S") do? The code here returns "3273" + // in this case (i.e. the total number of seconds, not just seconds % 60) + // because, for me, this call means "give me entire time interval in + // seconds" and not "give me the seconds part of the time interval" + // + // If we agree that it should behave like this, it is clear that the + // interpretation of each format specifier depends on the presence of the + // other format specs in the string: if there was "%H" before "%M", we + // should use GetMinutes() % 60, otherwise just GetMinutes() &c + + // we remember the most important unit found so far + TimeSpanPart partBiggest = Part_MSec; + + for ( const wxChar *pch = format; *pch; pch++ ) + { + wxChar ch = *pch; + + if ( ch == _T('%') ) + { + // the start of the format specification of the printf() below + wxString fmtPrefix(_T('%')); + + // the number + long n; + + // the number of digits for the format string, 0 if unused + unsigned digits = 0; + + ch = *++pch; // get the format spec char + switch ( ch ) + { + default: + wxFAIL_MSG( _T("invalid format character") ); + // fall through + + case _T('%'): + str += ch; + + // skip the part below switch + continue; + + case _T('D'): + n = GetDays(); + if ( partBiggest < Part_Day ) + { + n %= DAYS_PER_WEEK; + } + else + { + partBiggest = Part_Day; + } + break; + + case _T('E'): + partBiggest = Part_Week; + n = GetWeeks(); + break; + + case _T('H'): + n = GetHours(); + if ( partBiggest < Part_Hour ) + { + n %= HOURS_PER_DAY; + } + else + { + partBiggest = Part_Hour; + } + + digits = 2; + break; + + case _T('l'): + n = GetMilliseconds().ToLong(); + if ( partBiggest < Part_MSec ) + { + n %= 1000; + } + //else: no need to reset partBiggest to Part_MSec, it is + // the least significant one anyhow + + digits = 3; + break; + + case _T('M'): + n = GetMinutes(); + if ( partBiggest < Part_Min ) + { + n %= MIN_PER_HOUR; + } + else + { + partBiggest = Part_Min; + } + + digits = 2; + break; + + case _T('S'): + n = GetSeconds().ToLong(); + if ( partBiggest < Part_Sec ) + { + n %= SEC_PER_MIN; + } + else + { + partBiggest = Part_Sec; + } + + digits = 2; + break; + } + + if ( digits ) + { + fmtPrefix << _T("0") << digits; + } + + str += wxString::Format(fmtPrefix + _T("ld"), n); + } + else + { + // normal character, just copy + str += ch; + } + } + + return str; +} + // ============================================================================ // wxDateTimeHolidayAuthority and related classes // ============================================================================ @@ -2128,7 +4542,7 @@ size_t wxDateTimeWorkDays::DoGetHolidaysInRange(const wxDateTime& dtStart, { if ( dtStart > dtEnd ) { - wxFAIL_MSG( wxT("invalid date range in GetHolidaysInRange") ); + wxFAIL_MSG( _T("invalid date range in GetHolidaysInRange") ); return 0u; } @@ -2168,7 +4582,7 @@ size_t wxDateTimeWorkDays::DoGetHolidaysInRange(const wxDateTime& dtStart, WXDLLIMPEXP_BASE void wxNextMonth(wxDateTime::Month& m) { - wxASSERT_MSG( m < wxDateTime::Inv_Month, wxT("invalid month") ); + wxASSERT_MSG( m < wxDateTime::Inv_Month, _T("invalid month") ); // no wrapping or the for loop above would never end! m = (wxDateTime::Month)(m + 1); @@ -2176,7 +4590,7 @@ WXDLLIMPEXP_BASE void wxNextMonth(wxDateTime::Month& m) WXDLLIMPEXP_BASE void wxPrevMonth(wxDateTime::Month& m) { - wxASSERT_MSG( m < wxDateTime::Inv_Month, wxT("invalid month") ); + wxASSERT_MSG( m < wxDateTime::Inv_Month, _T("invalid month") ); m = m == wxDateTime::Jan ? wxDateTime::Inv_Month : (wxDateTime::Month)(m - 1); @@ -2184,7 +4598,7 @@ WXDLLIMPEXP_BASE void wxPrevMonth(wxDateTime::Month& m) WXDLLIMPEXP_BASE void wxNextWDay(wxDateTime::WeekDay& wd) { - wxASSERT_MSG( wd < wxDateTime::Inv_WeekDay, wxT("invalid week day") ); + wxASSERT_MSG( wd < wxDateTime::Inv_WeekDay, _T("invalid week day") ); // no wrapping or the for loop above would never end! wd = (wxDateTime::WeekDay)(wd + 1); @@ -2192,60 +4606,10 @@ WXDLLIMPEXP_BASE void wxNextWDay(wxDateTime::WeekDay& wd) WXDLLIMPEXP_BASE void wxPrevWDay(wxDateTime::WeekDay& wd) { - wxASSERT_MSG( wd < wxDateTime::Inv_WeekDay, wxT("invalid week day") ); + wxASSERT_MSG( wd < wxDateTime::Inv_WeekDay, _T("invalid week day") ); wd = wd == wxDateTime::Sun ? wxDateTime::Inv_WeekDay : (wxDateTime::WeekDay)(wd - 1); } -#ifdef __WINDOWS__ - -wxDateTime& wxDateTime::SetFromMSWSysTime(const SYSTEMTIME& st) -{ - return Set(st.wDay, - static_cast(wxDateTime::Jan + st.wMonth - 1), - st.wYear, - st.wHour, st.wMinute, st.wSecond, st.wMilliseconds); -} - -wxDateTime& wxDateTime::SetFromMSWSysDate(const SYSTEMTIME& st) -{ - return Set(st.wDay, - static_cast(wxDateTime::Jan + st.wMonth - 1), - st.wYear, - 0, 0, 0, 0); -} - -void wxDateTime::GetAsMSWSysTime(SYSTEMTIME* st) const -{ - const wxDateTime::Tm tm(GetTm()); - - st->wYear = (WXWORD)tm.year; - st->wMonth = (WXWORD)(tm.mon - wxDateTime::Jan + 1); - st->wDay = tm.mday; - - st->wDayOfWeek = 0; - st->wHour = tm.hour; - st->wMinute = tm.min; - st->wSecond = tm.sec; - st->wMilliseconds = tm.msec; -} - -void wxDateTime::GetAsMSWSysDate(SYSTEMTIME* st) const -{ - const wxDateTime::Tm tm(GetTm()); - - st->wYear = (WXWORD)tm.year; - st->wMonth = (WXWORD)(tm.mon - wxDateTime::Jan + 1); - st->wDay = tm.mday; - - st->wDayOfWeek = - st->wHour = - st->wMinute = - st->wSecond = - st->wMilliseconds = 0; -} - -#endif // __WINDOWS__ - #endif // wxUSE_DATETIME diff --git a/Source/3rd Party/wx/src/common/datetimefmt.cpp b/Source/3rd Party/wx/src/common/datetimefmt.cpp deleted file mode 100644 index 9b3f63cb7..000000000 --- a/Source/3rd Party/wx/src/common/datetimefmt.cpp +++ /dev/null @@ -1,2349 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/common/datetimefmt.cpp -// Purpose: wxDateTime formatting & parsing code -// Author: Vadim Zeitlin -// Modified by: -// Created: 11.05.99 -// RCS-ID: $Id$ -// Copyright: (c) 1999 Vadim Zeitlin -// parts of code taken from sndcal library by Scott E. Lee: -// -// Copyright 1993-1995, Scott E. Lee, all rights reserved. -// Permission granted to use, copy, modify, distribute and sell -// so long as the above copyright and this permission statement -// are retained in all copies. -// -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if !defined(wxUSE_DATETIME) || wxUSE_DATETIME - -#ifndef WX_PRECOMP - #ifdef __WINDOWS__ - #include "wx/msw/wrapwin.h" - #endif - #include "wx/string.h" - #include "wx/log.h" - #include "wx/intl.h" - #include "wx/stopwatch.h" // for wxGetLocalTimeMillis() - #include "wx/module.h" - #include "wx/crt.h" -#endif // WX_PRECOMP - -#include "wx/thread.h" - -#include - -#ifdef __WINDOWS__ - #include - #ifndef __WXWINCE__ - #include - #endif -#endif - -#include "wx/datetime.h" -#include "wx/time.h" - -// ============================================================================ -// implementation of wxDateTime -// ============================================================================ - -// ---------------------------------------------------------------------------- -// helpers shared between datetime.cpp and datetimefmt.cpp -// ---------------------------------------------------------------------------- - -extern void InitTm(struct tm& tm); - -extern wxString CallStrftime(const wxString& format, const tm* tm); - -// ---------------------------------------------------------------------------- -// constants (see also datetime.cpp) -// ---------------------------------------------------------------------------- - -static const int DAYS_PER_WEEK = 7; - -static const int HOURS_PER_DAY = 24; - -static const int SEC_PER_MIN = 60; - -static const int MIN_PER_HOUR = 60; - -// ---------------------------------------------------------------------------- -// parsing helpers -// ---------------------------------------------------------------------------- - -namespace -{ - -// all the functions below taking non-const wxString::const_iterator p advance -// it until the end of the match - -// scans all digits (but no more than len) and returns the resulting number -bool GetNumericToken(size_t len, - wxString::const_iterator& p, - const wxString::const_iterator& end, - unsigned long *number) -{ - size_t n = 1; - wxString s; - while ( p != end && wxIsdigit(*p) ) - { - s += *p++; - - if ( len && ++n > len ) - break; - } - - return !s.empty() && s.ToULong(number); -} - -// scans all alphabetic characters and returns the resulting string -wxString -GetAlphaToken(wxString::const_iterator& p, - const wxString::const_iterator& end) -{ - wxString s; - while ( p != end && wxIsalpha(*p) ) - { - s += *p++; - } - - return s; -} - -enum -{ - DateLang_English = 1, - DateLang_Local = 2 -}; - -// return the month if the string is a month name or Inv_Month otherwise -// -// flags can contain wxDateTime::Name_Abbr/Name_Full or both of them and lang -// can be either DateLang_Local (default) to interpret string as a localized -// month name or DateLang_English to parse it as a standard English name or -// their combination to interpret it in any way -wxDateTime::Month -GetMonthFromName(wxString::const_iterator& p, - const wxString::const_iterator& end, - int flags, - int lang) -{ - const wxString::const_iterator pOrig = p; - const wxString name = GetAlphaToken(p, end); - if ( name.empty() ) - return wxDateTime::Inv_Month; - - wxDateTime::Month mon; - for ( mon = wxDateTime::Jan; mon < wxDateTime::Inv_Month; wxNextMonth(mon) ) - { - // case-insensitive comparison either one of or with both abbreviated - // and not versions - if ( flags & wxDateTime::Name_Full ) - { - if ( lang & DateLang_English ) - { - if ( name.CmpNoCase(wxDateTime::GetEnglishMonthName(mon, - wxDateTime::Name_Full)) == 0 ) - break; - } - - if ( lang & DateLang_Local ) - { - if ( name.CmpNoCase(wxDateTime::GetMonthName(mon, - wxDateTime::Name_Full)) == 0 ) - break; - } - } - - if ( flags & wxDateTime::Name_Abbr ) - { - if ( lang & DateLang_English ) - { - if ( name.CmpNoCase(wxDateTime::GetEnglishMonthName(mon, - wxDateTime::Name_Abbr)) == 0 ) - break; - } - - if ( lang & DateLang_Local ) - { - // some locales (e.g. French one) use periods for the - // abbreviated month names but it's never part of name so - // compare it specially - wxString nameAbbr = wxDateTime::GetMonthName(mon, - wxDateTime::Name_Abbr); - const bool hasPeriod = *nameAbbr.rbegin() == '.'; - if ( hasPeriod ) - nameAbbr.erase(nameAbbr.end() - 1); - - if ( name.CmpNoCase(nameAbbr) == 0 ) - { - if ( hasPeriod ) - { - // skip trailing period if it was part of the match - if ( *p == '.' ) - ++p; - else // no match as no matching period - continue; - } - - break; - } - } - } - } - - if ( mon == wxDateTime::Inv_Month ) - p = pOrig; - - return mon; -} - -// return the weekday if the string is a weekday name or Inv_WeekDay otherwise -// -// flags and lang parameters have the same meaning as for GetMonthFromName() -// above -wxDateTime::WeekDay -GetWeekDayFromName(wxString::const_iterator& p, - const wxString::const_iterator& end, - int flags, int lang) -{ - const wxString::const_iterator pOrig = p; - const wxString name = GetAlphaToken(p, end); - if ( name.empty() ) - return wxDateTime::Inv_WeekDay; - - wxDateTime::WeekDay wd; - for ( wd = wxDateTime::Sun; wd < wxDateTime::Inv_WeekDay; wxNextWDay(wd) ) - { - if ( flags & wxDateTime::Name_Full ) - { - if ( lang & DateLang_English ) - { - if ( name.CmpNoCase(wxDateTime::GetEnglishWeekDayName(wd, - wxDateTime::Name_Full)) == 0 ) - break; - } - - if ( lang & DateLang_Local ) - { - if ( name.CmpNoCase(wxDateTime::GetWeekDayName(wd, - wxDateTime::Name_Full)) == 0 ) - break; - } - } - - if ( flags & wxDateTime::Name_Abbr ) - { - if ( lang & DateLang_English ) - { - if ( name.CmpNoCase(wxDateTime::GetEnglishWeekDayName(wd, - wxDateTime::Name_Abbr)) == 0 ) - break; - } - - if ( lang & DateLang_Local ) - { - if ( name.CmpNoCase(wxDateTime::GetWeekDayName(wd, - wxDateTime::Name_Abbr)) == 0 ) - break; - } - } - } - - if ( wd == wxDateTime::Inv_WeekDay ) - p = pOrig; - - return wd; -} - -// parses string starting at given iterator using the specified format and, -// optionally, a fall back format (and optionally another one... but it stops -// there, really) -// -// if unsuccessful, returns invalid wxDateTime without changing p; otherwise -// advance p to the end of the match and returns wxDateTime containing the -// results of the parsing -wxDateTime -ParseFormatAt(wxString::const_iterator& p, - const wxString::const_iterator& end, - const wxString& fmt, - // FIXME-VC6: using wxString() instead of wxEmptyString in the - // line below results in error C2062: type 'class - // wxString (__cdecl *)(void)' unexpected - const wxString& fmtAlt = wxEmptyString) -{ - const wxString str(p, end); - wxString::const_iterator endParse; - wxDateTime dt; - - // Use a default date outside of the DST period to avoid problems with - // parsing the time differently depending on the today's date (which is used - // as the fall back date if none is explicitly specified). - static const wxDateTime dtDef(1, wxDateTime::Jan, 2012); - - if ( dt.ParseFormat(str, fmt, dtDef, &endParse) || - (!fmtAlt.empty() && dt.ParseFormat(str, fmtAlt, dtDef, &endParse)) ) - { - p += endParse - str.begin(); - } - //else: all formats failed - - return dt; -} - -} // anonymous namespace - -// ---------------------------------------------------------------------------- -// wxDateTime to/from text representations -// ---------------------------------------------------------------------------- - -wxString wxDateTime::Format(const wxString& formatp, const TimeZone& tz) const -{ - wxCHECK_MSG( !formatp.empty(), wxEmptyString, - wxT("NULL format in wxDateTime::Format") ); - - wxString format = formatp; -#ifdef __WXOSX__ - format.Replace("%c",wxLocale::GetInfo(wxLOCALE_DATE_TIME_FMT)); - format.Replace("%x",wxLocale::GetInfo(wxLOCALE_SHORT_DATE_FMT)); - format.Replace("%X",wxLocale::GetInfo(wxLOCALE_TIME_FMT)); -#endif - // we have to use our own implementation if the date is out of range of - // strftime() or if we use non standard specifiers (notice that "%z" is - // special because it is de facto standard under Unix but is not supported - // under Windows) -#ifdef wxHAS_STRFTIME - time_t time = GetTicks(); - - if ( (time != (time_t)-1) && !wxStrstr(format, wxT("%l")) -#ifdef __WINDOWS__ - && !wxStrstr(format, wxT("%z")) -#endif - ) - { - // use strftime() - struct tm tmstruct; - struct tm *tm; - if ( tz.GetOffset() == -wxGetTimeZone() ) - { - // we are working with local time - tm = wxLocaltime_r(&time, &tmstruct); - - // should never happen - wxCHECK_MSG( tm, wxEmptyString, wxT("wxLocaltime_r() failed") ); - } - else - { - time += (int)tz.GetOffset(); - -#if defined(__VMS__) || defined(__WATCOMC__) // time is unsigned so avoid warning - int time2 = (int) time; - if ( time2 >= 0 ) -#else - if ( time >= 0 ) -#endif - { - tm = wxGmtime_r(&time, &tmstruct); - - // should never happen - wxCHECK_MSG( tm, wxEmptyString, wxT("wxGmtime_r() failed") ); - } - else - { - tm = (struct tm *)NULL; - } - } - - if ( tm ) - { - return CallStrftime(format, tm); - } - } - //else: use generic code below -#endif // wxHAS_STRFTIME - - // we only parse ANSI C format specifications here, no POSIX 2 - // complications, no GNU extensions but we do add support for a "%l" format - // specifier allowing to get the number of milliseconds - Tm tm = GetTm(tz); - - // used for calls to strftime() when we only deal with time - struct tm tmTimeOnly; - memset(&tmTimeOnly, 0, sizeof(tmTimeOnly)); - tmTimeOnly.tm_hour = tm.hour; - tmTimeOnly.tm_min = tm.min; - tmTimeOnly.tm_sec = tm.sec; - tmTimeOnly.tm_mday = 1; // any date will do, use 1976-01-01 - tmTimeOnly.tm_mon = 0; - tmTimeOnly.tm_year = 76; - tmTimeOnly.tm_isdst = 0; // no DST, we adjust for tz ourselves - - wxString tmp, res, fmt; - for ( wxString::const_iterator p = format.begin(); p != format.end(); ++p ) - { - if ( *p != wxT('%') ) - { - // copy as is - res += *p; - - continue; - } - - // set the default format - switch ( (*++p).GetValue() ) - { - case wxT('Y'): // year has 4 digits - case wxT('z'): // time zone as well - fmt = wxT("%04d"); - break; - - case wxT('j'): // day of year has 3 digits - case wxT('l'): // milliseconds have 3 digits - fmt = wxT("%03d"); - break; - - case wxT('w'): // week day as number has only one - fmt = wxT("%d"); - break; - - default: - // it's either another valid format specifier in which case - // the format is "%02d" (for all the rest) or we have the - // field width preceding the format in which case it will - // override the default format anyhow - fmt = wxT("%02d"); - } - - bool restart = true; - while ( restart ) - { - restart = false; - - // start of the format specification - switch ( (*p).GetValue() ) - { - case wxT('a'): // a weekday name - case wxT('A'): - // second parameter should be true for abbreviated names - res += GetWeekDayName(tm.GetWeekDay(), - *p == wxT('a') ? Name_Abbr : Name_Full); - break; - - case wxT('b'): // a month name - case wxT('B'): - res += GetMonthName(tm.mon, - *p == wxT('b') ? Name_Abbr : Name_Full); - break; - - case wxT('c'): // locale default date and time representation - case wxT('x'): // locale default date representation -#ifdef wxHAS_STRFTIME - // - // the problem: there is no way to know what do these format - // specifications correspond to for the current locale. - // - // the solution: use a hack and still use strftime(): first - // find the YEAR which is a year in the strftime() range (1970 - // - 2038) whose Jan 1 falls on the same week day as the Jan 1 - // of the real year. Then make a copy of the format and - // replace all occurrences of YEAR in it with some unique - // string not appearing anywhere else in it, then use - // strftime() to format the date in year YEAR and then replace - // YEAR back by the real year and the unique replacement - // string back with YEAR. Notice that "all occurrences of YEAR" - // means all occurrences of 4 digit as well as 2 digit form! - // - // the bugs: we assume that neither of %c nor %x contains any - // fields which may change between the YEAR and real year. For - // example, the week number (%U, %W) and the day number (%j) - // will change if one of these years is leap and the other one - // is not! - { - // find the YEAR: normally, for any year X, Jan 1 of the - // year X + 28 is the same weekday as Jan 1 of X (because - // the weekday advances by 1 for each normal X and by 2 - // for each leap X, hence by 5 every 4 years or by 35 - // which is 0 mod 7 every 28 years) but this rule breaks - // down if there are years between X and Y which are - // divisible by 4 but not leap (i.e. divisible by 100 but - // not 400), hence the correction. - - int yearReal = GetYear(tz); - int mod28 = yearReal % 28; - - // be careful to not go too far - we risk to leave the - // supported range - int year; - if ( mod28 < 10 ) - { - year = 1988 + mod28; // 1988 == 0 (mod 28) - } - else - { - year = 1970 + mod28 - 10; // 1970 == 10 (mod 28) - } - - int nCentury = year / 100, - nCenturyReal = yearReal / 100; - - // need to adjust for the years divisble by 400 which are - // not leap but are counted like leap ones if we just take - // the number of centuries in between for nLostWeekDays - int nLostWeekDays = (nCentury - nCenturyReal) - - (nCentury / 4 - nCenturyReal / 4); - - // we have to gain back the "lost" weekdays: note that the - // effect of this loop is to not do anything to - // nLostWeekDays (which we won't use any more), but to - // (indirectly) set the year correctly - while ( (nLostWeekDays % 7) != 0 ) - { - nLostWeekDays += year++ % 4 ? 1 : 2; - } - - // finally move the year below 2000 so that the 2-digit - // year number can never match the month or day of the - // month when we do the replacements below - if ( year >= 2000 ) - year -= 28; - - wxASSERT_MSG( year >= 1970 && year < 2000, - wxT("logic error in wxDateTime::Format") ); - - - // use strftime() to format the same date but in supported - // year - // - // NB: we assume that strftime() doesn't check for the - // date validity and will happily format the date - // corresponding to Feb 29 of a non leap year (which - // may happen if yearReal was leap and year is not) - struct tm tmAdjusted; - InitTm(tmAdjusted); - tmAdjusted.tm_hour = tm.hour; - tmAdjusted.tm_min = tm.min; - tmAdjusted.tm_sec = tm.sec; - tmAdjusted.tm_wday = tm.GetWeekDay(); - tmAdjusted.tm_yday = GetDayOfYear(); - tmAdjusted.tm_mday = tm.mday; - tmAdjusted.tm_mon = tm.mon; - tmAdjusted.tm_year = year - 1900; - tmAdjusted.tm_isdst = 0; // no DST, already adjusted - wxString str = CallStrftime(*p == wxT('c') ? wxT("%c") - : wxT("%x"), - &tmAdjusted); - - // now replace the replacement year with the real year: - // notice that we have to replace the 4 digit year with - // a unique string not appearing in strftime() output - // first to prevent the 2 digit year from matching any - // substring of the 4 digit year (but any day, month, - // hours or minutes components should be safe because - // they are never in 70-99 range) - wxString replacement("|"); - while ( str.find(replacement) != wxString::npos ) - replacement += '|'; - - str.Replace(wxString::Format("%d", year), - replacement); - str.Replace(wxString::Format("%d", year % 100), - wxString::Format("%d", yearReal % 100)); - str.Replace(replacement, - wxString::Format("%d", yearReal)); - - res += str; - } -#else // !wxHAS_STRFTIME - // Use "%m/%d/%y %H:%M:%S" format instead - res += wxString::Format(wxT("%02d/%02d/%04d %02d:%02d:%02d"), - tm.mon+1,tm.mday, tm.year, tm.hour, tm.min, tm.sec); -#endif // wxHAS_STRFTIME/!wxHAS_STRFTIME - break; - - case wxT('d'): // day of a month (01-31) - res += wxString::Format(fmt, tm.mday); - break; - - case wxT('H'): // hour in 24h format (00-23) - res += wxString::Format(fmt, tm.hour); - break; - - case wxT('I'): // hour in 12h format (01-12) - { - // 24h -> 12h, 0h -> 12h too - int hour12 = tm.hour > 12 ? tm.hour - 12 - : tm.hour ? tm.hour : 12; - res += wxString::Format(fmt, hour12); - } - break; - - case wxT('j'): // day of the year - res += wxString::Format(fmt, GetDayOfYear(tz)); - break; - - case wxT('l'): // milliseconds (NOT STANDARD) - res += wxString::Format(fmt, GetMillisecond(tz)); - break; - - case wxT('m'): // month as a number (01-12) - res += wxString::Format(fmt, tm.mon + 1); - break; - - case wxT('M'): // minute as a decimal number (00-59) - res += wxString::Format(fmt, tm.min); - break; - - case wxT('p'): // AM or PM string -#ifdef wxHAS_STRFTIME - res += CallStrftime(wxT("%p"), &tmTimeOnly); -#else // !wxHAS_STRFTIME - res += (tmTimeOnly.tm_hour > 12) ? wxT("pm") : wxT("am"); -#endif // wxHAS_STRFTIME/!wxHAS_STRFTIME - break; - - case wxT('S'): // second as a decimal number (00-61) - res += wxString::Format(fmt, tm.sec); - break; - - case wxT('U'): // week number in the year (Sunday 1st week day) - res += wxString::Format(fmt, GetWeekOfYear(Sunday_First, tz)); - break; - - case wxT('W'): // week number in the year (Monday 1st week day) - res += wxString::Format(fmt, GetWeekOfYear(Monday_First, tz)); - break; - - case wxT('w'): // weekday as a number (0-6), Sunday = 0 - res += wxString::Format(fmt, tm.GetWeekDay()); - break; - - // case wxT('x'): -- handled with "%c" - - case wxT('X'): // locale default time representation - // just use strftime() to format the time for us -#ifdef wxHAS_STRFTIME - res += CallStrftime(wxT("%X"), &tmTimeOnly); -#else // !wxHAS_STRFTIME - res += wxString::Format(wxT("%02d:%02d:%02d"),tm.hour, tm.min, tm.sec); -#endif // wxHAS_STRFTIME/!wxHAS_STRFTIME - break; - - case wxT('y'): // year without century (00-99) - res += wxString::Format(fmt, tm.year % 100); - break; - - case wxT('Y'): // year with century - res += wxString::Format(fmt, tm.year); - break; - - case wxT('z'): // time zone as [-+]HHMM - { - int ofs = tz.GetOffset(); - if ( ofs < 0 ) - { - res += '-'; - ofs = -ofs; - } - else - { - res += '+'; - } - - // Converts seconds to HHMM representation. - res += wxString::Format(fmt, - 100*(ofs/3600) + (ofs/60)%60); - } - break; - - case wxT('Z'): // timezone name -#ifdef wxHAS_STRFTIME - res += CallStrftime(wxT("%Z"), &tmTimeOnly); -#endif - break; - - default: - // is it the format width? - for ( fmt.clear(); - *p == wxT('-') || *p == wxT('+') || - *p == wxT(' ') || wxIsdigit(*p); - ++p ) - { - fmt += *p; - } - - if ( !fmt.empty() ) - { - // we've only got the flags and width so far in fmt - fmt.Prepend(wxT('%')); - fmt.Append(wxT('d')); - - restart = true; - - break; - } - - // no, it wasn't the width - wxFAIL_MSG(wxT("unknown format specifier")); - - // fall through and just copy it nevertheless - - case wxT('%'): // a percent sign - res += *p; - break; - - case 0: // the end of string - wxFAIL_MSG(wxT("missing format at the end of string")); - - // just put the '%' which was the last char in format - res += wxT('%'); - break; - } - } - } - - return res; -} - -// this function parses a string in (strict) RFC 822 format: see the section 5 -// of the RFC for the detailed description, but briefly it's something of the -// form "Sat, 18 Dec 1999 00:48:30 +0100" -// -// this function is "strict" by design - it must reject anything except true -// RFC822 time specs. -bool -wxDateTime::ParseRfc822Date(const wxString& date, wxString::const_iterator *end) -{ - const wxString::const_iterator pEnd = date.end(); - wxString::const_iterator p = date.begin(); - - // 1. week day - const wxDateTime::WeekDay - wd = GetWeekDayFromName(p, pEnd, Name_Abbr, DateLang_English); - if ( wd == Inv_WeekDay ) - return false; - //else: ignore week day for now, we could also check that it really - // corresponds to the specified date - - // 2. separating comma - if ( *p++ != ',' || *p++ != ' ' ) - return false; - - // 3. day number - if ( !wxIsdigit(*p) ) - return false; - - wxDateTime_t day = (wxDateTime_t)(*p++ - '0'); - if ( wxIsdigit(*p) ) - { - day *= 10; - day = (wxDateTime_t)(day + (*p++ - '0')); - } - - if ( *p++ != ' ' ) - return false; - - // 4. month name - const Month mon = GetMonthFromName(p, pEnd, Name_Abbr, DateLang_English); - if ( mon == Inv_Month ) - return false; - - if ( *p++ != ' ' ) - return false; - - // 5. year - if ( !wxIsdigit(*p) ) - return false; - - int year = *p++ - '0'; - if ( !wxIsdigit(*p) ) // should have at least 2 digits in the year - return false; - - year *= 10; - year += *p++ - '0'; - - // is it a 2 digit year (as per original RFC 822) or a 4 digit one? - if ( wxIsdigit(*p) ) - { - year *= 10; - year += *p++ - '0'; - - if ( !wxIsdigit(*p) ) - { - // no 3 digit years please - return false; - } - - year *= 10; - year += *p++ - '0'; - } - - if ( *p++ != ' ' ) - return false; - - // 6. time in hh:mm:ss format with seconds being optional - if ( !wxIsdigit(*p) ) - return false; - - wxDateTime_t hour = (wxDateTime_t)(*p++ - '0'); - - if ( !wxIsdigit(*p) ) - return false; - - hour *= 10; - hour = (wxDateTime_t)(hour + (*p++ - '0')); - - if ( *p++ != ':' ) - return false; - - if ( !wxIsdigit(*p) ) - return false; - - wxDateTime_t min = (wxDateTime_t)(*p++ - '0'); - - if ( !wxIsdigit(*p) ) - return false; - - min *= 10; - min += (wxDateTime_t)(*p++ - '0'); - - wxDateTime_t sec = 0; - if ( *p == ':' ) - { - p++; - if ( !wxIsdigit(*p) ) - return false; - - sec = (wxDateTime_t)(*p++ - '0'); - - if ( !wxIsdigit(*p) ) - return false; - - sec *= 10; - sec += (wxDateTime_t)(*p++ - '0'); - } - - if ( *p++ != ' ' ) - return false; - - // 7. now the interesting part: the timezone - int offset = 0; // just to suppress warnings - if ( *p == '-' || *p == '+' ) - { - // the explicit offset given: it has the form of hhmm - bool plus = *p++ == '+'; - - if ( !wxIsdigit(*p) || !wxIsdigit(*(p + 1)) ) - return false; - - - // hours - offset = MIN_PER_HOUR*(10*(*p - '0') + (*(p + 1) - '0')); - - p += 2; - - if ( !wxIsdigit(*p) || !wxIsdigit(*(p + 1)) ) - return false; - - // minutes - offset += 10*(*p - '0') + (*(p + 1) - '0'); - - if ( !plus ) - offset = -offset; - - p += 2; - } - else // not numeric - { - // the symbolic timezone given: may be either military timezone or one - // of standard abbreviations - if ( !*(p + 1) ) - { - // military: Z = UTC, J unused, A = -1, ..., Y = +12 - static const int offsets[26] = - { - //A B C D E F G H I J K L M - -1, -2, -3, -4, -5, -6, -7, -8, -9, 0, -10, -11, -12, - //N O P R Q S T U V W Z Y Z - +1, +2, +3, +4, +5, +6, +7, +8, +9, +10, +11, +12, 0 - }; - - if ( *p < wxT('A') || *p > wxT('Z') || *p == wxT('J') ) - return false; - - offset = offsets[*p++ - 'A']; - } - else - { - // abbreviation - const wxString tz(p, date.end()); - if ( tz == wxT("UT") || tz == wxT("UTC") || tz == wxT("GMT") ) - offset = 0; - else if ( tz == wxT("AST") ) - offset = AST - GMT0; - else if ( tz == wxT("ADT") ) - offset = ADT - GMT0; - else if ( tz == wxT("EST") ) - offset = EST - GMT0; - else if ( tz == wxT("EDT") ) - offset = EDT - GMT0; - else if ( tz == wxT("CST") ) - offset = CST - GMT0; - else if ( tz == wxT("CDT") ) - offset = CDT - GMT0; - else if ( tz == wxT("MST") ) - offset = MST - GMT0; - else if ( tz == wxT("MDT") ) - offset = MDT - GMT0; - else if ( tz == wxT("PST") ) - offset = PST - GMT0; - else if ( tz == wxT("PDT") ) - offset = PDT - GMT0; - else - return false; - - p += tz.length(); - } - - // make it minutes - offset *= MIN_PER_HOUR; - } - - - // the spec was correct, construct the date from the values we found - Set(day, mon, year, hour, min, sec); - MakeFromTimezone(TimeZone::Make(offset*SEC_PER_MIN)); - - if ( end ) - *end = p; - - return true; -} - -const char* wxDateTime::ParseRfc822Date(const char* date) -{ - wxString::const_iterator end; - wxString dateStr(date); - if ( !ParseRfc822Date(dateStr, &end) ) - return NULL; - - return date + dateStr.IterOffsetInMBStr(end); -} - -const wchar_t* wxDateTime::ParseRfc822Date(const wchar_t* date) -{ - wxString::const_iterator end; - wxString dateStr(date); - if ( !ParseRfc822Date(dateStr, &end) ) - return NULL; - - return date + (end - dateStr.begin()); -} - -bool -wxDateTime::ParseFormat(const wxString& date, - const wxString& format, - const wxDateTime& dateDef, - wxString::const_iterator *endParse) -{ - wxCHECK_MSG( !format.empty(), false, "format can't be empty" ); - wxCHECK_MSG( endParse, false, "end iterator pointer must be specified" ); - - wxString str; - unsigned long num; - - // what fields have we found? - bool haveWDay = false, - haveYDay = false, - haveDay = false, - haveMon = false, - haveYear = false, - haveHour = false, - haveMin = false, - haveSec = false, - haveMsec = false; - - bool hourIsIn12hFormat = false, // or in 24h one? - isPM = false; // AM by default - - bool haveTimeZone = false; - - // and the value of the items we have (init them to get rid of warnings) - wxDateTime_t msec = 0, - sec = 0, - min = 0, - hour = 0; - WeekDay wday = Inv_WeekDay; - wxDateTime_t yday = 0, - mday = 0; - wxDateTime::Month mon = Inv_Month; - int year = 0; - long timeZone = 0; // time zone in seconds as expected in Tm structure - - wxString::const_iterator input = date.begin(); - const wxString::const_iterator end = date.end(); - for ( wxString::const_iterator fmt = format.begin(); fmt != format.end(); ++fmt ) - { - if ( *fmt != wxT('%') ) - { - if ( wxIsspace(*fmt) ) - { - // a white space in the format string matches 0 or more white - // spaces in the input - while ( input != end && wxIsspace(*input) ) - { - input++; - } - } - else // !space - { - // any other character (not whitespace, not '%') must be - // matched by itself in the input - if ( input == end || *input++ != *fmt ) - { - // no match - return false; - } - } - - // done with this format char - continue; - } - - // start of a format specification - - // parse the optional width - size_t width = 0; - while ( wxIsdigit(*++fmt) ) - { - width *= 10; - width += *fmt - '0'; - } - - // the default widths for the various fields - if ( !width ) - { - switch ( (*fmt).GetValue() ) - { - case wxT('Y'): // year has 4 digits - width = 4; - break; - - case wxT('j'): // day of year has 3 digits - case wxT('l'): // milliseconds have 3 digits - width = 3; - break; - - case wxT('w'): // week day as number has only one - width = 1; - break; - - default: - // default for all other fields - width = 2; - } - } - - // then the format itself - switch ( (*fmt).GetValue() ) - { - case wxT('a'): // a weekday name - case wxT('A'): - { - wday = GetWeekDayFromName - ( - input, end, - *fmt == 'a' ? Name_Abbr : Name_Full, - DateLang_Local - ); - if ( wday == Inv_WeekDay ) - { - // no match - return false; - } - } - haveWDay = true; - break; - - case wxT('b'): // a month name - case wxT('B'): - { - mon = GetMonthFromName - ( - input, end, - *fmt == 'b' ? Name_Abbr : Name_Full, - DateLang_Local - ); - if ( mon == Inv_Month ) - { - // no match - return false; - } - } - haveMon = true; - break; - - case wxT('c'): // locale default date and time representation - { - wxDateTime dt; - -#if wxUSE_INTL - const wxString - fmtDateTime = wxLocale::GetInfo(wxLOCALE_DATE_TIME_FMT); - if ( !fmtDateTime.empty() ) - dt = ParseFormatAt(input, end, fmtDateTime); -#endif // wxUSE_INTL - if ( !dt.IsValid() ) - { - // also try the format which corresponds to ctime() - // output (i.e. the "C" locale default) - dt = ParseFormatAt(input, end, wxS("%a %b %d %H:%M:%S %Y")); - } - - if ( !dt.IsValid() ) - { - // and finally also the two generic date/time formats - dt = ParseFormatAt(input, end, wxS("%x %X"), wxS("%X %x")); - } - - if ( !dt.IsValid() ) - return false; - - const Tm tm = dt.GetTm(); - - hour = tm.hour; - min = tm.min; - sec = tm.sec; - - year = tm.year; - mon = tm.mon; - mday = tm.mday; - - haveDay = haveMon = haveYear = - haveHour = haveMin = haveSec = true; - } - break; - - case wxT('d'): // day of a month (01-31) - case 'e': // day of a month (1-31) (GNU extension) - if ( !GetNumericToken(width, input, end, &num) || - (num > 31) || (num < 1) ) - { - // no match - return false; - } - - // we can't check whether the day range is correct yet, will - // do it later - assume ok for now - haveDay = true; - mday = (wxDateTime_t)num; - break; - - case wxT('H'): // hour in 24h format (00-23) - if ( !GetNumericToken(width, input, end, &num) || (num > 23) ) - { - // no match - return false; - } - - haveHour = true; - hour = (wxDateTime_t)num; - break; - - case wxT('I'): // hour in 12h format (01-12) - if ( !GetNumericToken(width, input, end, &num) || - !num || (num > 12) ) - { - // no match - return false; - } - - haveHour = true; - hourIsIn12hFormat = true; - hour = (wxDateTime_t)(num % 12); // 12 should be 0 - break; - - case wxT('j'): // day of the year - if ( !GetNumericToken(width, input, end, &num) || - !num || (num > 366) ) - { - // no match - return false; - } - - haveYDay = true; - yday = (wxDateTime_t)num; - break; - - case wxT('l'): // milliseconds (0-999) - if ( !GetNumericToken(width, input, end, &num) ) - return false; - - haveMsec = true; - msec = (wxDateTime_t)num; - break; - - case wxT('m'): // month as a number (01-12) - if ( !GetNumericToken(width, input, end, &num) || - !num || (num > 12) ) - { - // no match - return false; - } - - haveMon = true; - mon = (Month)(num - 1); - break; - - case wxT('M'): // minute as a decimal number (00-59) - if ( !GetNumericToken(width, input, end, &num) || - (num > 59) ) - { - // no match - return false; - } - - haveMin = true; - min = (wxDateTime_t)num; - break; - - case wxT('p'): // AM or PM string - { - wxString am, pm; - GetAmPmStrings(&am, &pm); - - // we can never match %p in locales which don't use AM/PM - if ( am.empty() || pm.empty() ) - return false; - - const size_t pos = input - date.begin(); - if ( date.compare(pos, pm.length(), pm) == 0 ) - { - isPM = true; - input += pm.length(); - } - else if ( date.compare(pos, am.length(), am) == 0 ) - { - input += am.length(); - } - else // no match - { - return false; - } - } - break; - - case wxT('r'): // time as %I:%M:%S %p - { - wxDateTime dt; - if ( !dt.ParseFormat(wxString(input, end), - wxS("%I:%M:%S %p"), &input) ) - return false; - - haveHour = haveMin = haveSec = true; - - const Tm tm = dt.GetTm(); - hour = tm.hour; - min = tm.min; - sec = tm.sec; - } - break; - - case wxT('R'): // time as %H:%M - { - const wxDateTime - dt = ParseFormatAt(input, end, wxS("%H:%M")); - if ( !dt.IsValid() ) - return false; - - haveHour = - haveMin = true; - - const Tm tm = dt.GetTm(); - hour = tm.hour; - min = tm.min; - } - break; - - case wxT('S'): // second as a decimal number (00-61) - if ( !GetNumericToken(width, input, end, &num) || - (num > 61) ) - { - // no match - return false; - } - - haveSec = true; - sec = (wxDateTime_t)num; - break; - - case wxT('T'): // time as %H:%M:%S - { - const wxDateTime - dt = ParseFormatAt(input, end, wxS("%H:%M:%S")); - if ( !dt.IsValid() ) - return false; - - haveHour = - haveMin = - haveSec = true; - - const Tm tm = dt.GetTm(); - hour = tm.hour; - min = tm.min; - sec = tm.sec; - } - break; - - case wxT('w'): // weekday as a number (0-6), Sunday = 0 - if ( !GetNumericToken(width, input, end, &num) || - (wday > 6) ) - { - // no match - return false; - } - - haveWDay = true; - wday = (WeekDay)num; - break; - - case wxT('x'): // locale default date representation - { -#if wxUSE_INTL - wxString - fmtDate = wxLocale::GetInfo(wxLOCALE_SHORT_DATE_FMT), - fmtDateAlt = wxLocale::GetInfo(wxLOCALE_LONG_DATE_FMT); -#else // !wxUSE_INTL - wxString fmtDate, fmtDateAlt; -#endif // wxUSE_INTL/!wxUSE_INTL - if ( fmtDate.empty() ) - { - if ( IsWestEuropeanCountry(GetCountry()) || - GetCountry() == Russia ) - { - fmtDate = wxS("%d/%m/%Y"); - fmtDateAlt = wxS("%m/%d/%Y"); - } - else // assume USA - { - fmtDate = wxS("%m/%d/%Y"); - fmtDateAlt = wxS("%d/%m/%Y"); - } - } - - wxDateTime - dt = ParseFormatAt(input, end, fmtDate, fmtDateAlt); - - if ( !dt.IsValid() ) - { - // try with short years too - fmtDate.Replace("%Y","%y"); - fmtDateAlt.Replace("%Y","%y"); - dt = ParseFormatAt(input, end, fmtDate, fmtDateAlt); - - if ( !dt.IsValid() ) - return false; - } - - const Tm tm = dt.GetTm(); - - haveDay = - haveMon = - haveYear = true; - - year = tm.year; - mon = tm.mon; - mday = tm.mday; - } - - break; - - case wxT('X'): // locale default time representation - { -#if wxUSE_INTL - wxString fmtTime = wxLocale::GetInfo(wxLOCALE_TIME_FMT), - fmtTimeAlt; -#else // !wxUSE_INTL - wxString fmtTime, fmtTimeAlt; -#endif // wxUSE_INTL/!wxUSE_INTL - if ( fmtTime.empty() ) - { - // try to parse what follows as "%H:%M:%S" and, if this - // fails, as "%I:%M:%S %p" - this should catch the most - // common cases - fmtTime = "%T"; - fmtTimeAlt = "%r"; - } - - const wxDateTime - dt = ParseFormatAt(input, end, fmtTime, fmtTimeAlt); - if ( !dt.IsValid() ) - return false; - - haveHour = - haveMin = - haveSec = true; - - const Tm tm = dt.GetTm(); - hour = tm.hour; - min = tm.min; - sec = tm.sec; - } - break; - - case wxT('y'): // year without century (00-99) - if ( !GetNumericToken(width, input, end, &num) || - (num > 99) ) - { - // no match - return false; - } - - haveYear = true; - - // TODO should have an option for roll over date instead of - // hard coding it here - year = (num > 30 ? 1900 : 2000) + (wxDateTime_t)num; - break; - - case wxT('Y'): // year with century - if ( !GetNumericToken(width, input, end, &num) ) - { - // no match - return false; - } - - haveYear = true; - year = (wxDateTime_t)num; - break; - - case wxT('z'): - { - // check that we have something here at all - if ( input == end ) - return false; - - // and then check that it's either plus or minus sign - bool minusFound; - if ( *input == wxT('-') ) - minusFound = true; - else if ( *input == wxT('+') ) - minusFound = false; - else - return false; // no match - - // here should follow 4 digits HHMM - ++input; - unsigned long tzHourMin; - if ( !GetNumericToken(4, input, end, &tzHourMin) ) - return false; // no match - - const unsigned hours = tzHourMin / 100; - const unsigned minutes = tzHourMin % 100; - - if ( hours > 12 || minutes > 59 ) - return false; // bad format - - timeZone = 3600*hours + 60*minutes; - if ( minusFound ) - timeZone = -timeZone; - - haveTimeZone = true; - } - break; - - case wxT('Z'): // timezone name - // FIXME: currently we just ignore everything that looks like a - // time zone here - GetAlphaToken(input, end); - break; - - case wxT('%'): // a percent sign - if ( input == end || *input++ != wxT('%') ) - { - // no match - return false; - } - break; - - case 0: // the end of string - wxFAIL_MSG(wxT("unexpected format end")); - - // fall through - - default: // not a known format spec - return false; - } - } - - // format matched, try to construct a date from what we have now - Tm tmDef; - if ( dateDef.IsValid() ) - { - // take this date as default - tmDef = dateDef.GetTm(); - } - else if ( IsValid() ) - { - // if this date is valid, don't change it - tmDef = GetTm(); - } - else - { - // no default and this date is invalid - fall back to Today() - tmDef = Today().GetTm(); - } - - Tm tm = tmDef; - - // set the date - if ( haveMon ) - { - tm.mon = mon; - } - - if ( haveYear ) - { - tm.year = year; - } - - // TODO we don't check here that the values are consistent, if both year - // day and month/day were found, we just ignore the year day and we - // also always ignore the week day - if ( haveDay ) - { - if ( mday > GetNumberOfDays(tm.mon, tm.year) ) - return false; - - tm.mday = mday; - } - else if ( haveYDay ) - { - if ( yday > GetNumberOfDays(tm.year) ) - return false; - - Tm tm2 = wxDateTime(1, Jan, tm.year).SetToYearDay(yday).GetTm(); - - tm.mon = tm2.mon; - tm.mday = tm2.mday; - } - - // deal with AM/PM - if ( haveHour && hourIsIn12hFormat && isPM ) - { - // translate to 24hour format - hour += 12; - } - //else: either already in 24h format or no translation needed - - // set the time - if ( haveHour ) - { - tm.hour = hour; - } - - if ( haveMin ) - { - tm.min = min; - } - - if ( haveSec ) - { - tm.sec = sec; - } - - if ( haveMsec ) - tm.msec = msec; - - Set(tm); - - // If a time zone was specified and it is not the local time zone, we need - // to shift the time accordingly. - // - // Note that avoiding the call to MakeFromTimeZone is necessary to avoid - // DST problems. - if ( haveTimeZone && timeZone != -wxGetTimeZone() ) - MakeFromTimezone(timeZone); - - // finally check that the week day is consistent -- if we had it - if ( haveWDay && GetWeekDay() != wday ) - return false; - - *endParse = input; - - return true; -} - -const char* -wxDateTime::ParseFormat(const char* date, - const wxString& format, - const wxDateTime& dateDef) -{ - wxString::const_iterator end; - wxString dateStr(date); - if ( !ParseFormat(dateStr, format, dateDef, &end) ) - return NULL; - - return date + dateStr.IterOffsetInMBStr(end); -} - -const wchar_t* -wxDateTime::ParseFormat(const wchar_t* date, - const wxString& format, - const wxDateTime& dateDef) -{ - wxString::const_iterator end; - wxString dateStr(date); - if ( !ParseFormat(dateStr, format, dateDef, &end) ) - return NULL; - - return date + (end - dateStr.begin()); -} - -bool -wxDateTime::ParseDateTime(const wxString& date, wxString::const_iterator *end) -{ - wxCHECK_MSG( end, false, "end iterator pointer must be specified" ); - - wxDateTime - dtDate, - dtTime; - - wxString::const_iterator - endTime, - endDate, - endBoth; - - // If we got a date in the beginning, see if there is a time specified - // after the date - if ( dtDate.ParseDate(date, &endDate) ) - { - // Skip spaces, as the ParseTime() function fails on spaces - while ( endDate != date.end() && wxIsspace(*endDate) ) - ++endDate; - - const wxString timestr(endDate, date.end()); - if ( !dtTime.ParseTime(timestr, &endTime) ) - return false; - - endBoth = endDate + (endTime - timestr.begin()); - } - else // no date in the beginning - { - // check if we have a time followed by a date - if ( !dtTime.ParseTime(date, &endTime) ) - return false; - - while ( endTime != date.end() && wxIsspace(*endTime) ) - ++endTime; - - const wxString datestr(endTime, date.end()); - if ( !dtDate.ParseDate(datestr, &endDate) ) - return false; - - endBoth = endTime + (endDate - datestr.begin()); - } - - Set(dtDate.GetDay(), dtDate.GetMonth(), dtDate.GetYear(), - dtTime.GetHour(), dtTime.GetMinute(), dtTime.GetSecond(), - dtTime.GetMillisecond()); - - *end = endBoth; - - return true; -} - -const char* wxDateTime::ParseDateTime(const char* date) -{ - wxString::const_iterator end; - wxString dateStr(date); - if ( !ParseDateTime(dateStr, &end) ) - return NULL; - - return date + dateStr.IterOffsetInMBStr(end); -} - -const wchar_t* wxDateTime::ParseDateTime(const wchar_t* date) -{ - wxString::const_iterator end; - wxString dateStr(date); - if ( !ParseDateTime(dateStr, &end) ) - return NULL; - - return date + (end - dateStr.begin()); -} - -bool -wxDateTime::ParseDate(const wxString& date, wxString::const_iterator *end) -{ - wxCHECK_MSG( end, false, "end iterator pointer must be specified" ); - - // this is a simplified version of ParseDateTime() which understands only - // "today" (for wxDate compatibility) and digits only otherwise (and not - // all esoteric constructions ParseDateTime() knows about) - - const wxString::const_iterator pBegin = date.begin(); - const wxString::const_iterator pEnd = date.end(); - - wxString::const_iterator p = pBegin; - while ( p != pEnd && wxIsspace(*p) ) - p++; - - // some special cases - static struct - { - const char *str; - int dayDiffFromToday; - } literalDates[] = - { - { wxTRANSLATE("today"), 0 }, - { wxTRANSLATE("yesterday"), -1 }, - { wxTRANSLATE("tomorrow"), 1 }, - }; - - const size_t lenRest = pEnd - p; - for ( size_t n = 0; n < WXSIZEOF(literalDates); n++ ) - { - const wxString dateStr = wxGetTranslation(literalDates[n].str); - size_t len = dateStr.length(); - - if ( len > lenRest ) - continue; - - const wxString::const_iterator pEnd = p + len; - if ( wxString(p, pEnd).CmpNoCase(dateStr) == 0 ) - { - // nothing can follow this, so stop here - - p = pEnd; - - int dayDiffFromToday = literalDates[n].dayDiffFromToday; - *this = Today(); - if ( dayDiffFromToday ) - { - *this += wxDateSpan::Days(dayDiffFromToday); - } - - *end = pEnd; - - return true; - } - } - - // We try to guess what we have here: for each new (numeric) token, we - // determine if it can be a month, day or a year. Of course, there is an - // ambiguity as some numbers may be days as well as months, so we also - // have the ability to back track. - - // what do we have? - bool haveDay = false, // the months day? - haveWDay = false, // the day of week? - haveMon = false, // the month? - haveYear = false; // the year? - - bool monWasNumeric = false; // was month specified as a number? - - // and the value of the items we have (init them to get rid of warnings) - WeekDay wday = Inv_WeekDay; - wxDateTime_t day = 0; - wxDateTime::Month mon = Inv_Month; - int year = 0; - - // tokenize the string - while ( p != pEnd ) - { - // skip white space and date delimiters - if ( wxStrchr(".,/-\t\r\n ", *p) ) - { - ++p; - continue; - } - - // modify copy of the iterator as we're not sure if the next token is - // still part of the date at all - wxString::const_iterator pCopy = p; - - // we can have either alphabetic or numeric token, start by testing if - // it's the latter - unsigned long val; - if ( GetNumericToken(10 /* max length */, pCopy, pEnd, &val) ) - { - // guess what this number is - - bool isDay = false, - isMonth = false, - isYear = false; - - if ( !haveMon && val > 0 && val <= 12 ) - { - // assume it is month - isMonth = true; - } - else // not the month - { - if ( haveDay ) - { - // this can only be the year - isYear = true; - } - else // may be either day or year - { - // use a leap year if we don't have the year yet to allow - // dates like 2/29/1976 which would be rejected otherwise - wxDateTime_t max_days = (wxDateTime_t)( - haveMon - ? GetNumberOfDays(mon, haveYear ? year : 1976) - : 31 - ); - - // can it be day? - if ( (val == 0) || (val > (unsigned long)max_days) ) - { - // no - isYear = true; - } - else // yes, suppose it's the day - { - isDay = true; - } - } - } - - if ( isYear ) - { - if ( haveYear ) - break; - - haveYear = true; - - year = (wxDateTime_t)val; - } - else if ( isDay ) - { - if ( haveDay ) - break; - - haveDay = true; - - day = (wxDateTime_t)val; - } - else if ( isMonth ) - { - haveMon = true; - monWasNumeric = true; - - mon = (Month)(val - 1); - } - } - else // not a number - { - // be careful not to overwrite the current mon value - Month mon2 = GetMonthFromName - ( - pCopy, pEnd, - Name_Full | Name_Abbr, - DateLang_Local | DateLang_English - ); - if ( mon2 != Inv_Month ) - { - // it's a month - if ( haveMon ) - { - // but we already have a month - maybe we guessed wrong - // when we had interpreted that numeric value as a month - // and it was the day number instead? - if ( haveDay || !monWasNumeric ) - break; - - // assume we did and change our mind: reinterpret the month - // value as a day (notice that there is no need to check - // that it is valid as month values are always < 12, but - // the days are counted from 1 unlike the months) - day = (wxDateTime_t)(mon + 1); - haveDay = true; - } - - mon = mon2; - - haveMon = true; - } - else // not a valid month name - { - WeekDay wday2 = GetWeekDayFromName - ( - pCopy, pEnd, - Name_Full | Name_Abbr, - DateLang_Local | DateLang_English - ); - if ( wday2 != Inv_WeekDay ) - { - // a week day - if ( haveWDay ) - break; - - wday = wday2; - - haveWDay = true; - } - else // not a valid weekday name - { - // try the ordinals - static const char *const ordinals[] = - { - wxTRANSLATE("first"), - wxTRANSLATE("second"), - wxTRANSLATE("third"), - wxTRANSLATE("fourth"), - wxTRANSLATE("fifth"), - wxTRANSLATE("sixth"), - wxTRANSLATE("seventh"), - wxTRANSLATE("eighth"), - wxTRANSLATE("ninth"), - wxTRANSLATE("tenth"), - wxTRANSLATE("eleventh"), - wxTRANSLATE("twelfth"), - wxTRANSLATE("thirteenth"), - wxTRANSLATE("fourteenth"), - wxTRANSLATE("fifteenth"), - wxTRANSLATE("sixteenth"), - wxTRANSLATE("seventeenth"), - wxTRANSLATE("eighteenth"), - wxTRANSLATE("nineteenth"), - wxTRANSLATE("twentieth"), - // that's enough - otherwise we'd have problems with - // composite (or not) ordinals - }; - - size_t n; - for ( n = 0; n < WXSIZEOF(ordinals); n++ ) - { - const wxString ord = wxGetTranslation(ordinals[n]); - const size_t len = ord.length(); - if ( date.compare(p - pBegin, len, ord) == 0 ) - { - p += len; - break; - } - } - - if ( n == WXSIZEOF(ordinals) ) - { - // stop here - something unknown - break; - } - - // it's a day - if ( haveDay ) - { - // don't try anything here (as in case of numeric day - // above) - the symbolic day spec should always - // precede the month/year - break; - } - - haveDay = true; - - day = (wxDateTime_t)(n + 1); - } - } - } - - // advance iterator past a successfully parsed token - p = pCopy; - } - - // either no more tokens or the scan was stopped by something we couldn't - // parse - in any case, see if we can construct a date from what we have - if ( !haveDay && !haveWDay ) - return false; - - if ( haveWDay && (haveMon || haveYear || haveDay) && - !(haveDay && haveMon && haveYear) ) - { - // without adjectives (which we don't support here) the week day only - // makes sense completely separately or with the full date - // specification (what would "Wed 1999" mean?) - return false; - } - - if ( !haveWDay && haveYear && !(haveDay && haveMon) ) - { - // may be we have month and day instead of day and year? - if ( haveDay && !haveMon ) - { - if ( day <= 12 ) - { - // exchange day and month - mon = (wxDateTime::Month)(day - 1); - - // we're in the current year then - if ( (year > 0) && (year <= (int)GetNumberOfDays(mon, Inv_Year)) ) - { - day = (wxDateTime_t)year; - - haveMon = true; - haveYear = false; - } - //else: no, can't exchange, leave haveMon == false - } - } - - if ( !haveMon ) - return false; - } - - if ( !haveMon ) - { - mon = GetCurrentMonth(); - } - - if ( !haveYear ) - { - year = GetCurrentYear(); - } - - if ( haveDay ) - { - // normally we check the day above but the check is optimistic in case - // we find the day before its month/year so we have to redo it now - if ( day > GetNumberOfDays(mon, year) ) - return false; - - Set(day, mon, year); - - if ( haveWDay ) - { - // check that it is really the same - if ( GetWeekDay() != wday ) - return false; - } - } - else // haveWDay - { - *this = Today(); - - SetToWeekDayInSameWeek(wday); - } - - *end = p; - - return true; -} - -const char* wxDateTime::ParseDate(const char* date) -{ - wxString::const_iterator end; - wxString dateStr(date); - if ( !ParseDate(dateStr, &end) ) - return NULL; - - return date + dateStr.IterOffsetInMBStr(end); -} - -const wchar_t* wxDateTime::ParseDate(const wchar_t* date) -{ - wxString::const_iterator end; - wxString dateStr(date); - if ( !ParseDate(dateStr, &end) ) - return NULL; - - return date + (end - dateStr.begin()); -} - -bool -wxDateTime::ParseTime(const wxString& time, wxString::const_iterator *end) -{ - wxCHECK_MSG( end, false, "end iterator pointer must be specified" ); - - // first try some extra things - static const struct - { - const char *name; - wxDateTime_t hour; - } stdTimes[] = - { - { wxTRANSLATE("noon"), 12 }, - { wxTRANSLATE("midnight"), 00 }, - // anything else? - }; - - for ( size_t n = 0; n < WXSIZEOF(stdTimes); n++ ) - { - const wxString timeString = wxGetTranslation(stdTimes[n].name); - if ( timeString.CmpNoCase(wxString(time, timeString.length())) == 0 ) - { - // casts required by DigitalMars - Set(stdTimes[n].hour, wxDateTime_t(0), wxDateTime_t(0)); - - if ( end ) - *end = time.begin() + timeString.length(); - - return true; - } - } - - // try all time formats we may think about in the order from longest to - // shortest - static const char *const timeFormats[] = - { - "%I:%M:%S %p", // 12hour with AM/PM - "%H:%M:%S", // could be the same or 24 hour one so try it too - "%I:%M %p", // 12hour with AM/PM but without seconds - "%H:%M", // and a possibly 24 hour version without seconds - "%X", // possibly something from above or maybe something - // completely different -- try it last - - // TODO: parse timezones - }; - - for ( size_t nFmt = 0; nFmt < WXSIZEOF(timeFormats); nFmt++ ) - { - if ( ParseFormat(time, timeFormats[nFmt], end) ) - return true; - } - - return false; -} - -const char* wxDateTime::ParseTime(const char* date) -{ - wxString::const_iterator end; - wxString dateStr(date); - if ( !ParseTime(dateStr, &end) ) - return NULL; - - return date + dateStr.IterOffsetInMBStr(end); -} - -const wchar_t* wxDateTime::ParseTime(const wchar_t* date) -{ - wxString::const_iterator end; - wxString dateStr(date); - if ( !ParseTime(dateStr, &end) ) - return NULL; - - return date + (end - dateStr.begin()); -} - -// ---------------------------------------------------------------------------- -// Workdays and holidays support -// ---------------------------------------------------------------------------- - -bool wxDateTime::IsWorkDay(Country WXUNUSED(country)) const -{ - return !wxDateTimeHolidayAuthority::IsHoliday(*this); -} - -// ============================================================================ -// wxDateSpan -// ============================================================================ - -wxDateSpan WXDLLIMPEXP_BASE operator*(int n, const wxDateSpan& ds) -{ - wxDateSpan ds1(ds); - return ds1.Multiply(n); -} - -// ============================================================================ -// wxTimeSpan -// ============================================================================ - -wxTimeSpan WXDLLIMPEXP_BASE operator*(int n, const wxTimeSpan& ts) -{ - return wxTimeSpan(ts).Multiply(n); -} - -// this enum is only used in wxTimeSpan::Format() below but we can't declare -// it locally to the method as it provokes an internal compiler error in egcs -// 2.91.60 when building with -O2 -enum TimeSpanPart -{ - Part_Week, - Part_Day, - Part_Hour, - Part_Min, - Part_Sec, - Part_MSec -}; - -// not all strftime(3) format specifiers make sense here because, for example, -// a time span doesn't have a year nor a timezone -// -// Here are the ones which are supported (all of them are supported by strftime -// as well): -// %H hour in 24 hour format -// %M minute (00 - 59) -// %S second (00 - 59) -// %% percent sign -// -// Also, for MFC CTimeSpan compatibility, we support -// %D number of days -// -// And, to be better than MFC :-), we also have -// %E number of wEeks -// %l milliseconds (000 - 999) -wxString wxTimeSpan::Format(const wxString& format) const -{ - // we deal with only positive time spans here and just add the sign in - // front for the negative ones - if ( IsNegative() ) - { - wxString str(Negate().Format(format)); - return "-" + str; - } - - wxCHECK_MSG( !format.empty(), wxEmptyString, - wxT("NULL format in wxTimeSpan::Format") ); - - wxString str; - str.Alloc(format.length()); - - // Suppose we have wxTimeSpan ts(1 /* hour */, 2 /* min */, 3 /* sec */) - // - // Then, of course, ts.Format("%H:%M:%S") must return "01:02:03", but the - // question is what should ts.Format("%S") do? The code here returns "3273" - // in this case (i.e. the total number of seconds, not just seconds % 60) - // because, for me, this call means "give me entire time interval in - // seconds" and not "give me the seconds part of the time interval" - // - // If we agree that it should behave like this, it is clear that the - // interpretation of each format specifier depends on the presence of the - // other format specs in the string: if there was "%H" before "%M", we - // should use GetMinutes() % 60, otherwise just GetMinutes() &c - - // we remember the most important unit found so far - TimeSpanPart partBiggest = Part_MSec; - - for ( wxString::const_iterator pch = format.begin(); pch != format.end(); ++pch ) - { - wxChar ch = *pch; - - if ( ch == wxT('%') ) - { - // the start of the format specification of the printf() below - wxString fmtPrefix(wxT('%')); - - // the number - long n; - - // the number of digits for the format string, 0 if unused - unsigned digits = 0; - - ch = *++pch; // get the format spec char - switch ( ch ) - { - default: - wxFAIL_MSG( wxT("invalid format character") ); - // fall through - - case wxT('%'): - str += ch; - - // skip the part below switch - continue; - - case wxT('D'): - n = GetDays(); - if ( partBiggest < Part_Day ) - { - n %= DAYS_PER_WEEK; - } - else - { - partBiggest = Part_Day; - } - break; - - case wxT('E'): - partBiggest = Part_Week; - n = GetWeeks(); - break; - - case wxT('H'): - n = GetHours(); - if ( partBiggest < Part_Hour ) - { - n %= HOURS_PER_DAY; - } - else - { - partBiggest = Part_Hour; - } - - digits = 2; - break; - - case wxT('l'): - n = GetMilliseconds().ToLong(); - if ( partBiggest < Part_MSec ) - { - n %= 1000; - } - //else: no need to reset partBiggest to Part_MSec, it is - // the least significant one anyhow - - digits = 3; - break; - - case wxT('M'): - n = GetMinutes(); - if ( partBiggest < Part_Min ) - { - n %= MIN_PER_HOUR; - } - else - { - partBiggest = Part_Min; - } - - digits = 2; - break; - - case wxT('S'): - n = GetSeconds().ToLong(); - if ( partBiggest < Part_Sec ) - { - n %= SEC_PER_MIN; - } - else - { - partBiggest = Part_Sec; - } - - digits = 2; - break; - } - - if ( digits ) - { - fmtPrefix << wxT("0") << digits; - } - - str += wxString::Format(fmtPrefix + wxT("ld"), n); - } - else - { - // normal character, just copy - str += ch; - } - } - - return str; -} - -#endif // wxUSE_DATETIME diff --git a/Source/3rd Party/wx/src/common/datstrm.cpp b/Source/3rd Party/wx/src/common/datstrm.cpp index 806028f59..28f496562 100644 --- a/Source/3rd Party/wx/src/common/datstrm.cpp +++ b/Source/3rd Party/wx/src/common/datstrm.cpp @@ -4,7 +4,7 @@ // Author: Guilhem Lavaux // Modified by: Mickael Gilabert // Created: 28/06/98 -// RCS-ID: $Id$ +// RCS-ID: $Id: datstrm.cpp 53028 2008-04-05 17:28:32Z VZ $ // Copyright: (c) Guilhem Lavaux // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -45,14 +45,6 @@ wxDataInputStream::~wxDataInputStream() #endif // wxUSE_UNICODE } -#if wxUSE_UNICODE -void wxDataInputStream::SetConv( const wxMBConv &conv ) -{ - delete m_conv; - m_conv = conv.Clone(); -} -#endif - #if wxHAS_INT64 wxUint64 wxDataInputStream::Read64() { @@ -100,7 +92,7 @@ double wxDataInputStream::ReadDouble() char buf[10]; m_input->Read(buf, 10); - return wxConvertFromIeeeExtended((const wxInt8 *)buf); + return ConvertFromIeeeExtended((const wxInt8 *)buf); #else return 0.0; #endif @@ -481,14 +473,6 @@ wxDataOutputStream::~wxDataOutputStream() #endif // wxUSE_UNICODE } -#if wxUSE_UNICODE -void wxDataOutputStream::SetConv( const wxMBConv &conv ) -{ - delete m_conv; - m_conv = conv.Clone(); -} -#endif - #if wxHAS_INT64 void wxDataOutputStream::Write64(wxUint64 i) { @@ -547,15 +531,10 @@ void wxDataOutputStream::WriteDouble(double d) char buf[10]; #if wxUSE_APPLE_IEEE - wxConvertToIeeeExtended(d, (wxInt8 *)buf); + ConvertToIeeeExtended(d, (wxInt8 *)buf); #else - wxUnusedVar(d); #if !defined(__VMS__) && !defined(__GNUG__) -#ifdef _MSC_VER -# pragma message("wxDataOutputStream::WriteDouble() not using IeeeExtended - will not work!") -#else # pragma warning "wxDataOutputStream::WriteDouble() not using IeeeExtended - will not work!" -#endif #endif buf[0] = '\0'; #endif @@ -673,6 +652,13 @@ void wxDataOutputStream::WriteDouble(const double *buffer, size_t size) } } +wxDataOutputStream& wxDataOutputStream::operator<<(const wxChar *string) +{ + Write32(wxStrlen(string)); + m_output->Write((const char *)string, wxStrlen(string)*sizeof(wxChar)); + return *this; +} + wxDataOutputStream& wxDataOutputStream::operator<<(const wxString& string) { WriteString(string); diff --git a/Source/3rd Party/wx/src/common/dcbase.cpp b/Source/3rd Party/wx/src/common/dcbase.cpp index a7a1c3231..40e266592 100644 --- a/Source/3rd Party/wx/src/common/dcbase.cpp +++ b/Source/3rd Party/wx/src/common/dcbase.cpp @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 05/25/99 -// RCS-ID: $Id$ +// RCS-ID: $Id: dcbase.cpp 56135 2008-10-06 21:04:02Z VZ $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -25,618 +25,48 @@ #endif #include "wx/dc.h" -#include "wx/dcclient.h" -#include "wx/dcmemory.h" -#include "wx/dcscreen.h" -#include "wx/dcprint.h" -#include "wx/prntbase.h" -#include "wx/scopeguard.h" +#include "wx/dcbuffer.h" // for IMPLEMENT_DYNAMIC_CLASS #ifndef WX_PRECOMP #include "wx/math.h" - #include "wx/module.h" - #include "wx/window.h" #endif -#ifdef __WXMSW__ - #include "wx/msw/dcclient.h" - #include "wx/msw/dcmemory.h" - #include "wx/msw/dcscreen.h" -#endif +// bool wxDCBase::sm_cacheing = false; -#ifdef __WXGTK3__ - #include "wx/gtk/dc.h" -#elif defined __WXGTK20__ - #include "wx/gtk/dcclient.h" - #include "wx/gtk/dcmemory.h" - #include "wx/gtk/dcscreen.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/dcclient.h" - #include "wx/gtk1/dcmemory.h" - #include "wx/gtk1/dcscreen.h" -#endif +IMPLEMENT_ABSTRACT_CLASS(wxDCBase, wxObject) -#ifdef __WXMAC__ - #include "wx/osx/dcclient.h" - #include "wx/osx/dcmemory.h" - #include "wx/osx/dcscreen.h" -#endif +// ============================================================================ +// implementation +// ============================================================================ -#ifdef __WXPM__ - #include "wx/os2/dcclient.h" - #include "wx/os2/dcmemory.h" - #include "wx/os2/dcscreen.h" -#endif +IMPLEMENT_DYNAMIC_CLASS(wxBufferedDC, wxMemoryDC) +IMPLEMENT_ABSTRACT_CLASS(wxBufferedPaintDC, wxBufferedDC) -#ifdef __WXCOCOA__ - #include "wx/cocoa/dcclient.h" - #include "wx/cocoa/dcmemory.h" - #include "wx/cocoa/dcscreen.h" -#endif - -#ifdef __WXMOTIF__ - #include "wx/motif/dcclient.h" - #include "wx/motif/dcmemory.h" - #include "wx/motif/dcscreen.h" -#endif - -#ifdef __WXX11__ - #include "wx/x11/dcclient.h" - #include "wx/x11/dcmemory.h" - #include "wx/x11/dcscreen.h" -#endif - -#ifdef __WXDFB__ - #include "wx/dfb/dcclient.h" - #include "wx/dfb/dcmemory.h" - #include "wx/dfb/dcscreen.h" -#endif - -//---------------------------------------------------------------------------- -// wxDCFactory -//---------------------------------------------------------------------------- - -wxDCFactory *wxDCFactory::m_factory = NULL; - -void wxDCFactory::Set(wxDCFactory *factory) -{ - delete m_factory; - - m_factory = factory; -} - -wxDCFactory *wxDCFactory::Get() -{ - if ( !m_factory ) - m_factory = new wxNativeDCFactory; - - return m_factory; -} - -class wxDCFactoryCleanupModule : public wxModule -{ -public: - virtual bool OnInit() { return true; } - virtual void OnExit() { wxDCFactory::Set(NULL); } - -private: - DECLARE_DYNAMIC_CLASS(wxDCFactoryCleanupModule) -}; - -IMPLEMENT_DYNAMIC_CLASS(wxDCFactoryCleanupModule, wxModule) - -//----------------------------------------------------------------------------- -// wxNativeDCFactory -//----------------------------------------------------------------------------- - -wxDCImpl* wxNativeDCFactory::CreateWindowDC( wxWindowDC *owner, wxWindow *window ) -{ - wxDCImpl * const impl = new wxWindowDCImpl( owner, window ); - impl->InheritAttributes(window); - return impl; -} - -wxDCImpl* wxNativeDCFactory::CreateClientDC( wxClientDC *owner, wxWindow *window ) -{ - wxDCImpl * const impl = new wxClientDCImpl( owner, window ); - impl->InheritAttributes(window); - return impl; -} - -wxDCImpl* wxNativeDCFactory::CreatePaintDC( wxPaintDC *owner, wxWindow *window ) -{ - wxDCImpl * const impl = new wxPaintDCImpl( owner, window ); - impl->InheritAttributes(window); - return impl; -} - -wxDCImpl* wxNativeDCFactory::CreateMemoryDC( wxMemoryDC *owner ) -{ - return new wxMemoryDCImpl( owner ); -} - -wxDCImpl* wxNativeDCFactory::CreateMemoryDC(wxMemoryDC *owner, wxBitmap& bitmap) -{ - // the bitmap may be modified when it's selected into a memory DC so make - // sure changing this bitmap doesn't affect any other shallow copies of it - // (see wxMemoryDC::SelectObject()) - // - // notice that we don't provide any ctor equivalent to SelectObjectAsSource - // method because this should be rarely needed and easy to work around by - // using the default ctor and calling SelectObjectAsSource itself - if ( bitmap.IsOk() ) - bitmap.UnShare(); - - return new wxMemoryDCImpl(owner, bitmap); -} - -wxDCImpl* wxNativeDCFactory::CreateMemoryDC( wxMemoryDC *owner, wxDC *dc ) -{ - return new wxMemoryDCImpl( owner, dc ); -} - -wxDCImpl* wxNativeDCFactory::CreateScreenDC( wxScreenDC *owner ) -{ - return new wxScreenDCImpl( owner ); -} - -#if wxUSE_PRINTING_ARCHITECTURE -wxDCImpl *wxNativeDCFactory::CreatePrinterDC( wxPrinterDC *owner, const wxPrintData &data ) -{ - wxPrintFactory *factory = wxPrintFactory::GetFactory(); - return factory->CreatePrinterDCImpl( owner, data ); -} -#endif - -//----------------------------------------------------------------------------- -// wxWindowDC -//----------------------------------------------------------------------------- - -IMPLEMENT_ABSTRACT_CLASS(wxWindowDC, wxDC) - -wxWindowDC::wxWindowDC(wxWindow *win) - : wxDC(wxDCFactory::Get()->CreateWindowDC(this, win)) +#if WXWIN_COMPATIBILITY_2_6 +void wxDCBase::BeginDrawing() { } -//----------------------------------------------------------------------------- -// wxClientDC -//----------------------------------------------------------------------------- - -IMPLEMENT_ABSTRACT_CLASS(wxClientDC, wxWindowDC) - -wxClientDC::wxClientDC(wxWindow *win) - : wxWindowDC(wxDCFactory::Get()->CreateClientDC(this, win)) -{ -} - -//----------------------------------------------------------------------------- -// wxMemoryDC -//----------------------------------------------------------------------------- - -IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC, wxDC) - -wxMemoryDC::wxMemoryDC() - : wxDC(wxDCFactory::Get()->CreateMemoryDC(this)) -{ -} - -wxMemoryDC::wxMemoryDC(wxBitmap& bitmap) - : wxDC(wxDCFactory::Get()->CreateMemoryDC(this, bitmap)) -{ -} - -wxMemoryDC::wxMemoryDC(wxDC *dc) - : wxDC(wxDCFactory::Get()->CreateMemoryDC(this, dc)) -{ -} - -void wxMemoryDC::SelectObject(wxBitmap& bmp) -{ - if ( bmp.IsSameAs(GetSelectedBitmap()) ) - { - // Nothing to do, this bitmap is already selected. - return; - } - - // make sure that the given wxBitmap is not sharing its data with other - // wxBitmap instances as its contents will be modified by any drawing - // operation done on this DC - if (bmp.IsOk()) - bmp.UnShare(); - - GetImpl()->DoSelect(bmp); -} - -void wxMemoryDC::SelectObjectAsSource(const wxBitmap& bmp) -{ - GetImpl()->DoSelect(bmp); -} - -const wxBitmap& wxMemoryDC::GetSelectedBitmap() const -{ - return GetImpl()->GetSelectedBitmap(); -} - -wxBitmap& wxMemoryDC::GetSelectedBitmap() -{ - return GetImpl()->GetSelectedBitmap(); -} - - -//----------------------------------------------------------------------------- -// wxPaintDC -//----------------------------------------------------------------------------- - -IMPLEMENT_ABSTRACT_CLASS(wxPaintDC, wxClientDC) - -wxPaintDC::wxPaintDC(wxWindow *win) - : wxClientDC(wxDCFactory::Get()->CreatePaintDC(this, win)) -{ -} - -//----------------------------------------------------------------------------- -// wxScreenDC -//----------------------------------------------------------------------------- - -IMPLEMENT_DYNAMIC_CLASS(wxScreenDC, wxWindowDC) - -wxScreenDC::wxScreenDC() - : wxDC(wxDCFactory::Get()->CreateScreenDC(this)) -{ -} - -//----------------------------------------------------------------------------- -// wxPrinterDC -//----------------------------------------------------------------------------- - -#if wxUSE_PRINTING_ARCHITECTURE - -IMPLEMENT_DYNAMIC_CLASS(wxPrinterDC, wxDC) - -wxPrinterDC::wxPrinterDC() - : wxDC(wxDCFactory::Get()->CreatePrinterDC(this, wxPrintData())) -{ -} - -wxPrinterDC::wxPrinterDC(const wxPrintData& data) - : wxDC(wxDCFactory::Get()->CreatePrinterDC(this, data)) -{ -} - -wxRect wxPrinterDC::GetPaperRect() const -{ - return GetImpl()->GetPaperRect(); -} - -int wxPrinterDC::GetResolution() const -{ - return GetImpl()->GetResolution(); -} - -#endif // wxUSE_PRINTING_ARCHITECTURE - -//----------------------------------------------------------------------------- -// wxDCImpl -//----------------------------------------------------------------------------- - -IMPLEMENT_ABSTRACT_CLASS(wxDCImpl, wxObject) - -wxDCImpl::wxDCImpl( wxDC *owner ) - : m_window(NULL) - , m_colour(wxColourDisplay()) - , m_ok(true) - , m_clipping(false) - , m_isInteractive(0) - , m_isBBoxValid(false) - , m_logicalOriginX(0), m_logicalOriginY(0) - , m_deviceOriginX(0), m_deviceOriginY(0) - , m_deviceLocalOriginX(0), m_deviceLocalOriginY(0) - , m_logicalScaleX(1.0), m_logicalScaleY(1.0) - , m_userScaleX(1.0), m_userScaleY(1.0) - , m_scaleX(1.0), m_scaleY(1.0) - , m_signX(1), m_signY(1) - , m_minX(0), m_minY(0), m_maxX(0), m_maxY(0) - , m_clipX1(0), m_clipY1(0), m_clipX2(0), m_clipY2(0) - , m_logicalFunction(wxCOPY) - , m_backgroundMode(wxBRUSHSTYLE_TRANSPARENT) - , m_mappingMode(wxMM_TEXT) - , m_pen() - , m_brush() - , m_backgroundBrush() - , m_textForegroundColour(*wxBLACK) - , m_textBackgroundColour(*wxWHITE) - , m_font() -#if wxUSE_PALETTE - , m_palette() - , m_hasCustomPalette(false) -#endif // wxUSE_PALETTE -{ - m_owner = owner; - - m_mm_to_pix_x = (double)wxGetDisplaySize().GetWidth() / - (double)wxGetDisplaySizeMM().GetWidth(); - m_mm_to_pix_y = (double)wxGetDisplaySize().GetHeight() / - (double)wxGetDisplaySizeMM().GetHeight(); - - ResetBoundingBox(); - ResetClipping(); -} - -wxDCImpl::~wxDCImpl() +void wxDCBase::EndDrawing() { } +#endif // WXWIN_COMPATIBILITY_2_6 // ---------------------------------------------------------------------------- -// coordinate conversions and transforms +// special symbols // ---------------------------------------------------------------------------- -wxCoord wxDCImpl::DeviceToLogicalX(wxCoord x) const -{ - return wxRound( (double)((x - m_deviceOriginX - m_deviceLocalOriginX) * m_signX) / m_scaleX ) + m_logicalOriginX ; -} - -wxCoord wxDCImpl::DeviceToLogicalY(wxCoord y) const -{ - return wxRound( (double)((y - m_deviceOriginY - m_deviceLocalOriginY) * m_signY) / m_scaleY ) + m_logicalOriginY ; -} - -wxCoord wxDCImpl::DeviceToLogicalXRel(wxCoord x) const -{ - return wxRound((double)(x) / m_scaleX); -} - -wxCoord wxDCImpl::DeviceToLogicalYRel(wxCoord y) const -{ - return wxRound((double)(y) / m_scaleY); -} - -wxCoord wxDCImpl::LogicalToDeviceX(wxCoord x) const -{ - return wxRound( (double)((x - m_logicalOriginX) * m_signX) * m_scaleX) + m_deviceOriginX + m_deviceLocalOriginX; -} - -wxCoord wxDCImpl::LogicalToDeviceY(wxCoord y) const -{ - return wxRound( (double)((y - m_logicalOriginY) * m_signY) * m_scaleY) + m_deviceOriginY + m_deviceLocalOriginY; -} - -wxCoord wxDCImpl::LogicalToDeviceXRel(wxCoord x) const -{ - return wxRound((double)(x) * m_scaleX); -} - -wxCoord wxDCImpl::LogicalToDeviceYRel(wxCoord y) const -{ - return wxRound((double)(y) * m_scaleY); -} - -void wxDCImpl::ComputeScaleAndOrigin() -{ - m_scaleX = m_logicalScaleX * m_userScaleX; - m_scaleY = m_logicalScaleY * m_userScaleY; -} - -void wxDCImpl::SetMapMode( wxMappingMode mode ) -{ - switch (mode) - { - case wxMM_TWIPS: - SetLogicalScale( twips2mm*m_mm_to_pix_x, twips2mm*m_mm_to_pix_y ); - break; - case wxMM_POINTS: - SetLogicalScale( pt2mm*m_mm_to_pix_x, pt2mm*m_mm_to_pix_y ); - break; - case wxMM_METRIC: - SetLogicalScale( m_mm_to_pix_x, m_mm_to_pix_y ); - break; - case wxMM_LOMETRIC: - SetLogicalScale( m_mm_to_pix_x/10.0, m_mm_to_pix_y/10.0 ); - break; - default: - case wxMM_TEXT: - SetLogicalScale( 1.0, 1.0 ); - break; - } - m_mappingMode = mode; -} - -void wxDCImpl::SetUserScale( double x, double y ) -{ - // allow negative ? -> no - m_userScaleX = x; - m_userScaleY = y; - ComputeScaleAndOrigin(); -} - -void wxDCImpl::SetLogicalScale( double x, double y ) -{ - // allow negative ? - m_logicalScaleX = x; - m_logicalScaleY = y; - ComputeScaleAndOrigin(); -} - -void wxDCImpl::SetLogicalOrigin( wxCoord x, wxCoord y ) -{ - m_logicalOriginX = x * m_signX; - m_logicalOriginY = y * m_signY; - ComputeScaleAndOrigin(); -} - -void wxDCImpl::SetDeviceOrigin( wxCoord x, wxCoord y ) -{ - m_deviceOriginX = x; - m_deviceOriginY = y; - ComputeScaleAndOrigin(); -} - -void wxDCImpl::SetDeviceLocalOrigin( wxCoord x, wxCoord y ) -{ - m_deviceLocalOriginX = x; - m_deviceLocalOriginY = y; - ComputeScaleAndOrigin(); -} - -void wxDCImpl::SetAxisOrientation( bool xLeftRight, bool yBottomUp ) -{ - // only wxPostScripDC has m_signX = -1, we override SetAxisOrientation there - // wxWidgets 2.9: no longer override it - m_signX = (xLeftRight ? 1 : -1); - m_signY = (yBottomUp ? -1 : 1); - ComputeScaleAndOrigin(); -} - - -// Each element of the widths array will be the width of the string up to and -// including the corresponding character in text. This is the generic -// implementation, the port-specific classes should do this with native APIs -// if available and if faster. Note: pango_layout_index_to_pos is much slower -// than calling GetTextExtent!! - -#define FWC_SIZE 256 - -class FontWidthCache -{ -public: - FontWidthCache() : m_scaleX(1), m_widths(NULL) { } - ~FontWidthCache() { delete []m_widths; } - - void Reset() - { - if (!m_widths) - m_widths = new int[FWC_SIZE]; - - memset(m_widths, 0, sizeof(int)*FWC_SIZE); - } - - wxFont m_font; - double m_scaleX; - int *m_widths; -}; - -static FontWidthCache s_fontWidthCache; - -bool wxDCImpl::DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const -{ - int totalWidth = 0; - - const size_t len = text.length(); - widths.Empty(); - widths.Add(0, len); - - // reset the cache if font or horizontal scale have changed - if ( !s_fontWidthCache.m_widths || - !wxIsSameDouble(s_fontWidthCache.m_scaleX, m_scaleX) || - (s_fontWidthCache.m_font != GetFont()) ) - { - s_fontWidthCache.Reset(); - s_fontWidthCache.m_font = GetFont(); - s_fontWidthCache.m_scaleX = m_scaleX; - } - - // Calculate the position of each character based on the widths of - // the previous characters - int w, h; - for ( size_t i = 0; i < len; i++ ) - { - const wxChar c = text[i]; - unsigned int c_int = (unsigned int)c; - - if ((c_int < FWC_SIZE) && (s_fontWidthCache.m_widths[c_int] != 0)) - { - w = s_fontWidthCache.m_widths[c_int]; - } - else - { - DoGetTextExtent(c, &w, &h); - if (c_int < FWC_SIZE) - s_fontWidthCache.m_widths[c_int] = w; - } - - totalWidth += w; - widths[i] = totalWidth; - } - - return true; -} - -void wxDCImpl::GetMultiLineTextExtent(const wxString& text, - wxCoord *x, - wxCoord *y, - wxCoord *h, - const wxFont *font) const -{ - wxCoord widthTextMax = 0, widthLine, - heightTextTotal = 0, heightLineDefault = 0, heightLine = 0; - - wxString curLine; - for ( wxString::const_iterator pc = text.begin(); ; ++pc ) - { - if ( pc == text.end() || *pc == wxT('\n') ) - { - if ( curLine.empty() ) - { - // we can't use GetTextExtent - it will return 0 for both width - // and height and an empty line should count in height - // calculation - - // assume that this line has the same height as the previous - // one - if ( !heightLineDefault ) - heightLineDefault = heightLine; - - if ( !heightLineDefault ) - { - // but we don't know it yet - choose something reasonable - DoGetTextExtent(wxT("W"), NULL, &heightLineDefault, - NULL, NULL, font); - } - - heightTextTotal += heightLineDefault; - } - else - { - DoGetTextExtent(curLine, &widthLine, &heightLine, - NULL, NULL, font); - if ( widthLine > widthTextMax ) - widthTextMax = widthLine; - heightTextTotal += heightLine; - } - - if ( pc == text.end() ) - { - break; - } - else // '\n' - { - curLine.clear(); - } - } - else - { - curLine += *pc; - } - } - - if ( x ) - *x = widthTextMax; - if ( y ) - *y = heightTextTotal; - if ( h ) - *h = heightLine; -} - -void wxDCImpl::DoDrawCheckMark(wxCoord x1, wxCoord y1, +void wxDCBase::DoDrawCheckMark(wxCoord x1, wxCoord y1, wxCoord width, wxCoord height) { - wxCHECK_RET( IsOk(), wxT("invalid window dc") ); + wxCHECK_RET( Ok(), wxT("invalid window dc") ); wxCoord x2 = x1 + width, y2 = y1 + height; // the pen width is calibrated to give 3 for width == height == 10 - wxDCPenChanger pen( *m_owner, wxPen(GetTextForeground(), (width + height + 1)/7)); + wxDCPenChanger pen((wxDC&)*this, + wxPen(GetTextForeground(), (width + height + 1)/7)); // we're drawing a scaled version of wx/generic/tick.xpm here wxCoord x3 = x1 + (4*width) / 10, // x of the tick bottom @@ -648,47 +78,19 @@ void wxDCImpl::DoDrawCheckMark(wxCoord x1, wxCoord y1, CalcBoundingBox(x2, y2); } -bool -wxDCImpl::DoStretchBlit(wxCoord xdest, wxCoord ydest, - wxCoord dstWidth, wxCoord dstHeight, - wxDC *source, - wxCoord xsrc, wxCoord ysrc, - wxCoord srcWidth, wxCoord srcHeight, - wxRasterOperationMode rop, - bool useMask, - wxCoord xsrcMask, - wxCoord ysrcMask) -{ - wxCHECK_MSG( srcWidth && srcHeight && dstWidth && dstHeight, false, - wxT("invalid blit size") ); +// ---------------------------------------------------------------------------- +// line/polygons +// ---------------------------------------------------------------------------- - // emulate the stretching by modifying the DC scale - double xscale = (double)srcWidth/dstWidth, - yscale = (double)srcHeight/dstHeight; - - double xscaleOld, yscaleOld; - GetUserScale(&xscaleOld, &yscaleOld); - SetUserScale(xscaleOld/xscale, yscaleOld/yscale); - - bool rc = DoBlit(wxCoord(xdest*xscale), wxCoord(ydest*yscale), - wxCoord(dstWidth*xscale), wxCoord(dstHeight*yscale), - source, - xsrc, ysrc, rop, useMask, xsrcMask, ysrcMask); - - SetUserScale(xscaleOld, yscaleOld); - - return rc; -} - -void wxDCImpl::DrawLines(const wxPointList *list, wxCoord xoffset, wxCoord yoffset) +void wxDCBase::DrawLines(const wxList *list, wxCoord xoffset, wxCoord yoffset) { int n = list->GetCount(); wxPoint *points = new wxPoint[n]; int i = 0; - for ( wxPointList::compatibility_iterator node = list->GetFirst(); node; node = node->GetNext(), i++ ) + for ( wxList::compatibility_iterator node = list->GetFirst(); node; node = node->GetNext(), i++ ) { - wxPoint *point = node->GetData(); + wxPoint *point = (wxPoint *)node->GetData(); points[i].x = point->x; points[i].y = point->y; } @@ -698,17 +100,18 @@ void wxDCImpl::DrawLines(const wxPointList *list, wxCoord xoffset, wxCoord yoffs delete [] points; } -void wxDCImpl::DrawPolygon(const wxPointList *list, + +void wxDCBase::DrawPolygon(const wxList *list, wxCoord xoffset, wxCoord yoffset, - wxPolygonFillMode fillStyle) + int fillStyle) { int n = list->GetCount(); wxPoint *points = new wxPoint[n]; int i = 0; - for ( wxPointList::compatibility_iterator node = list->GetFirst(); node; node = node->GetNext(), i++ ) + for ( wxList::compatibility_iterator node = list->GetFirst(); node; node = node->GetNext(), i++ ) { - wxPoint *point = node->GetData(); + wxPoint *point = (wxPoint *)node->GetData(); points[i].x = point->x; points[i].y = point->y; } @@ -719,11 +122,11 @@ void wxDCImpl::DrawPolygon(const wxPointList *list, } void -wxDCImpl::DoDrawPolyPolygon(int n, +wxDCBase::DoDrawPolyPolygon(int n, int count[], wxPoint points[], wxCoord xoffset, wxCoord yoffset, - wxPolygonFillMode fillStyle) + int fillStyle) { if ( n == 1 ) { @@ -733,6 +136,7 @@ wxDCImpl::DoDrawPolyPolygon(int n, int i, j, lastOfs; wxPoint* pts; + wxPen pen; for (i = j = lastOfs = 0; i < n; i++) { @@ -748,11 +152,10 @@ wxDCImpl::DoDrawPolyPolygon(int n, pts[j++] = pts[lastOfs]; } - { - wxDCPenChanger setTransp(*m_owner, *wxTRANSPARENT_PEN); - DoDrawPolygon(j, pts, xoffset, yoffset, fillStyle); - } - + pen = GetPen(); + SetPen(wxPen(*wxBLACK, 0, wxTRANSPARENT)); + DoDrawPolygon(j, pts, xoffset, yoffset, fillStyle); + SetPen(pen); for (i = j = 0; i < n; i++) { DoDrawLines(count[i], pts+j, xoffset, yoffset); @@ -761,21 +164,45 @@ wxDCImpl::DoDrawPolyPolygon(int n, delete[] pts; } +// ---------------------------------------------------------------------------- +// splines +// ---------------------------------------------------------------------------- + #if wxUSE_SPLINES -void wxDCImpl::DrawSpline(wxCoord x1, wxCoord y1, - wxCoord x2, wxCoord y2, - wxCoord x3, wxCoord y3) +// TODO: this API needs fixing (wxPointList, why (!const) "wxList *"?) +void wxDCBase::DrawSpline(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord x3, wxCoord y3) { - wxPoint points[] = { wxPoint(x1, y1), wxPoint(x2, y2), wxPoint(x3, y3) }; - DrawSpline(WXSIZEOF(points), points); + wxList point_list; + + wxPoint *point1 = new wxPoint; + point1->x = x1; point1->y = y1; + point_list.Append((wxObject*)point1); + + wxPoint *point2 = new wxPoint; + point2->x = x2; point2->y = y2; + point_list.Append((wxObject*)point2); + + wxPoint *point3 = new wxPoint; + point3->x = x3; point3->y = y3; + point_list.Append((wxObject*)point3); + + DrawSpline(&point_list); + + for( wxList::compatibility_iterator node = point_list.GetFirst(); node; node = node->GetNext() ) + { + wxPoint *p = (wxPoint *)node->GetData(); + delete p; + } } -void wxDCImpl::DrawSpline(int n, wxPoint points[]) +void wxDCBase::DrawSpline(int n, wxPoint points[]) { - wxPointList list; - for ( int i = 0; i < n; i++ ) - list.Append(&points[i]); + wxList list; + for (int i =0; i < n; i++) + { + list.Append((wxObject*)&points[i]); + } DrawSpline(&list); } @@ -790,9 +217,9 @@ int wx_spline_pop(double *x1, double *y1, double *x2, double *y2, double *x3, void wx_spline_push(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4); static bool wx_spline_add_point(double x, double y); -static void wx_spline_draw_point_array(wxDC *dc); +static void wx_spline_draw_point_array(wxDCBase *dc); -static wxPointList wx_spline_point_list; +wxList wx_spline_point_list; #define half(z1, z2) ((z1+z2)/2.0) #define THRESHOLD 5 @@ -875,33 +302,35 @@ int wx_spline_pop(double *x1, double *y1, double *x2, double *y2, static bool wx_spline_add_point(double x, double y) { - wxPoint *point = new wxPoint( wxRound(x), wxRound(y) ); - wx_spline_point_list.Append(point ); - return true; + wxPoint *point = new wxPoint ; + point->x = (int) x; + point->y = (int) y; + wx_spline_point_list.Append((wxObject*)point); + return true; } -static void wx_spline_draw_point_array(wxDC *dc) +static void wx_spline_draw_point_array(wxDCBase *dc) { - dc->DrawLines(&wx_spline_point_list, 0, 0 ); - wxPointList::compatibility_iterator node = wx_spline_point_list.GetFirst(); - while (node) - { - wxPoint *point = node->GetData(); - delete point; - wx_spline_point_list.Erase(node); - node = wx_spline_point_list.GetFirst(); - } + dc->DrawLines(&wx_spline_point_list, 0, 0 ); + wxList::compatibility_iterator node = wx_spline_point_list.GetFirst(); + while (node) + { + wxPoint *point = (wxPoint *)node->GetData(); + delete point; + wx_spline_point_list.Erase(node); + node = wx_spline_point_list.GetFirst(); + } } -void wxDCImpl::DoDrawSpline( const wxPointList *points ) +void wxDCBase::DoDrawSpline( wxList *points ) { - wxCHECK_RET( IsOk(), wxT("invalid window dc") ); + wxCHECK_RET( Ok(), wxT("invalid window dc") ); wxPoint *p; double cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4; double x1, y1, x2, y2; - wxPointList::compatibility_iterator node = points->GetFirst(); + wxList::compatibility_iterator node = points->GetFirst(); if (!node) // empty list return; @@ -912,7 +341,7 @@ void wxDCImpl::DoDrawSpline( const wxPointList *points ) y1 = p->y; node = node->GetNext(); - p = node->GetData(); + p = (wxPoint *)node->GetData(); x2 = p->x; y2 = p->y; @@ -924,12 +353,12 @@ void wxDCImpl::DoDrawSpline( const wxPointList *points ) wx_spline_add_point(x1, y1); while ((node = node->GetNext()) -#if !wxUSE_STD_CONTAINERS +#if !wxUSE_STL != NULL -#endif // !wxUSE_STD_CONTAINERS +#endif // !wxUSE_STL ) { - p = node->GetData(); + p = (wxPoint *)node->GetData(); x1 = x2; y1 = y2; x2 = p->x; @@ -950,14 +379,319 @@ void wxDCImpl::DoDrawSpline( const wxPointList *points ) wx_spline_add_point( cx1, cy1 ); wx_spline_add_point( x2, y2 ); - wx_spline_draw_point_array( m_owner ); + wx_spline_draw_point_array( this ); } #endif // wxUSE_SPLINES +// ---------------------------------------------------------------------------- +// Partial Text Extents +// ---------------------------------------------------------------------------- -void wxDCImpl::DoGradientFillLinear(const wxRect& rect, +// Each element of the widths array will be the width of the string up to and +// including the corresponding character in text. This is the generic +// implementation, the port-specific classes should do this with native APIs +// if available and if faster. Note: pango_layout_index_to_pos is much slower +// than calling GetTextExtent!! + +#define FWC_SIZE 256 + +class FontWidthCache +{ +public: + FontWidthCache() : m_scaleX(1), m_widths(NULL) { } + ~FontWidthCache() { delete []m_widths; } + + void Reset() + { + if (!m_widths) + m_widths = new int[FWC_SIZE]; + + memset(m_widths, 0, sizeof(int)*FWC_SIZE); + } + + wxFont m_font; + double m_scaleX; + int *m_widths; +}; + +static FontWidthCache s_fontWidthCache; + +bool wxDCBase::DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const +{ + int totalWidth = 0; + + const size_t len = text.length(); + widths.Empty(); + widths.Add(0, len); + + // reset the cache if font or horizontal scale have changed + if ( !s_fontWidthCache.m_widths || + !wxIsSameDouble(s_fontWidthCache.m_scaleX, m_scaleX) || + (s_fontWidthCache.m_font != GetFont()) ) + { + s_fontWidthCache.Reset(); + s_fontWidthCache.m_font = GetFont(); + s_fontWidthCache.m_scaleX = m_scaleX; + } + + // Calculate the position of each character based on the widths of + // the previous characters + int w, h; + for ( size_t i = 0; i < len; i++ ) + { + const wxChar c = text[i]; + unsigned int c_int = (unsigned int)c; + + if ((c_int < FWC_SIZE) && (s_fontWidthCache.m_widths[c_int] != 0)) + { + w = s_fontWidthCache.m_widths[c_int]; + } + else + { + GetTextExtent(c, &w, &h); + if (c_int < FWC_SIZE) + s_fontWidthCache.m_widths[c_int] = w; + } + + totalWidth += w; + widths[i] = totalWidth; + } + + return true; +} + + +// ---------------------------------------------------------------------------- +// enhanced text drawing +// ---------------------------------------------------------------------------- + +void wxDCBase::GetMultiLineTextExtent(const wxString& text, + wxCoord *x, + wxCoord *y, + wxCoord *h, + wxFont *font) const +{ + wxCoord widthTextMax = 0, widthLine, + heightTextTotal = 0, heightLineDefault = 0, heightLine = 0; + + wxString curLine; + for ( const wxChar *pc = text; ; pc++ ) + { + if ( *pc == _T('\n') || *pc == _T('\0') ) + { + if ( curLine.empty() ) + { + // we can't use GetTextExtent - it will return 0 for both width + // and height and an empty line should count in height + // calculation + + // assume that this line has the same height as the previous + // one + if ( !heightLineDefault ) + heightLineDefault = heightLine; + + if ( !heightLineDefault ) + { + // but we don't know it yet - choose something reasonable + GetTextExtent(_T("W"), NULL, &heightLineDefault, + NULL, NULL, font); + } + + heightTextTotal += heightLineDefault; + } + else + { + GetTextExtent(curLine, &widthLine, &heightLine, + NULL, NULL, font); + if ( widthLine > widthTextMax ) + widthTextMax = widthLine; + heightTextTotal += heightLine; + } + + if ( *pc == _T('\n') ) + { + curLine.clear(); + } + else + { + // the end of string + break; + } + } + else + { + curLine += *pc; + } + } + + if ( x ) + *x = widthTextMax; + if ( y ) + *y = heightTextTotal; + if ( h ) + *h = heightLine; +} + +void wxDCBase::DrawLabel(const wxString& text, + const wxBitmap& bitmap, + const wxRect& rect, + int alignment, + int indexAccel, + wxRect *rectBounding) +{ + // find the text position + wxCoord widthText, heightText, heightLine; + GetMultiLineTextExtent(text, &widthText, &heightText, &heightLine); + + wxCoord width, height; + if ( bitmap.Ok() ) + { + width = widthText + bitmap.GetWidth(); + height = bitmap.GetHeight(); + } + else // no bitmap + { + width = widthText; + height = heightText; + } + + wxCoord x, y; + if ( alignment & wxALIGN_RIGHT ) + { + x = rect.GetRight() - width; + } + else if ( alignment & wxALIGN_CENTRE_HORIZONTAL ) + { + x = (rect.GetLeft() + rect.GetRight() + 1 - width) / 2; + } + else // alignment & wxALIGN_LEFT + { + x = rect.GetLeft(); + } + + if ( alignment & wxALIGN_BOTTOM ) + { + y = rect.GetBottom() - height; + } + else if ( alignment & wxALIGN_CENTRE_VERTICAL ) + { + y = (rect.GetTop() + rect.GetBottom() + 1 - height) / 2; + } + else // alignment & wxALIGN_TOP + { + y = rect.GetTop(); + } + + // draw the bitmap first + wxCoord x0 = x, + y0 = y, + width0 = width; + if ( bitmap.Ok() ) + { + DrawBitmap(bitmap, x, y, true /* use mask */); + + wxCoord offset = bitmap.GetWidth() + 4; + x += offset; + width -= offset; + + y += (height - heightText) / 2; + } + + // we will draw the underscore under the accel char later + wxCoord startUnderscore = 0, + endUnderscore = 0, + yUnderscore = 0; + + // split the string into lines and draw each of them separately + wxString curLine; + for ( const wxChar *pc = text; ; pc++ ) + { + if ( *pc == _T('\n') || *pc == _T('\0') ) + { + int xRealStart = x; // init it here to avoid compielr warnings + + if ( !curLine.empty() ) + { + // NB: can't test for !(alignment & wxALIGN_LEFT) because + // wxALIGN_LEFT is 0 + if ( alignment & (wxALIGN_RIGHT | wxALIGN_CENTRE_HORIZONTAL) ) + { + wxCoord widthLine; + GetTextExtent(curLine, &widthLine, NULL); + + if ( alignment & wxALIGN_RIGHT ) + { + xRealStart += width - widthLine; + } + else // if ( alignment & wxALIGN_CENTRE_HORIZONTAL ) + { + xRealStart += (width - widthLine) / 2; + } + } + //else: left aligned, nothing to do + + DrawText(curLine, xRealStart, y); + } + + y += heightLine; + + // do we have underscore in this line? we can check yUnderscore + // because it is set below to just y + heightLine if we do + if ( y == yUnderscore ) + { + // adjust the horz positions to account for the shift + startUnderscore += xRealStart; + endUnderscore += xRealStart; + } + + if ( *pc == _T('\0') ) + break; + + curLine.clear(); + } + else // not end of line + { + if ( pc - text.c_str() == indexAccel ) + { + // remeber to draw underscore here + GetTextExtent(curLine, &startUnderscore, NULL); + curLine += *pc; + GetTextExtent(curLine, &endUnderscore, NULL); + + yUnderscore = y + heightLine; + } + else + { + curLine += *pc; + } + } + } + + // draw the underscore if found + if ( startUnderscore != endUnderscore ) + { + // it should be of the same colour as text + SetPen(wxPen(GetTextForeground(), 0, wxSOLID)); + + yUnderscore--; + + DrawLine(startUnderscore, yUnderscore, endUnderscore, yUnderscore); + } + + // return bounding rect if requested + if ( rectBounding ) + { + *rectBounding = wxRect(x, y - heightText, widthText, heightText); + } + + CalcBoundingBox(x0, y0); + CalcBoundingBox(x0 + width0, y0 + height); +} + + +void wxDCBase::DoGradientFillLinear(const wxRect& rect, const wxColour& initialColour, const wxColour& destColour, wxDirection nDirection) @@ -1001,13 +735,13 @@ void wxDCImpl::DoGradientFillLinear(const wxRect& rect, nB = nB1 + (nB2-nB1)*(w-x)/w; wxColour colour(nR,nG,nB); - SetPen(wxPen(colour, 1, wxPENSTYLE_SOLID)); + SetPen(wxPen(colour, 1, wxSOLID)); SetBrush(wxBrush(colour)); if(nDirection == wxEAST) - DoDrawRectangle(rect.GetRight()-x-xDelta+1, rect.GetTop(), + DrawRectangle(rect.GetRight()-x-xDelta+1, rect.GetTop(), xDelta, rect.GetHeight()); else //nDirection == wxWEST - DoDrawRectangle(rect.GetLeft()+x, rect.GetTop(), + DrawRectangle(rect.GetLeft()+x, rect.GetTop(), xDelta, rect.GetHeight()); } } @@ -1038,13 +772,13 @@ void wxDCImpl::DoGradientFillLinear(const wxRect& rect, nB = nB1 + (nB2-nB1)*(w-y)/w; wxColour colour(nR,nG,nB); - SetPen(wxPen(colour, 1, wxPENSTYLE_SOLID)); + SetPen(wxPen(colour, 1, wxSOLID)); SetBrush(wxBrush(colour)); if(nDirection == wxNORTH) - DoDrawRectangle(rect.GetLeft(), rect.GetTop()+y, + DrawRectangle(rect.GetLeft(), rect.GetTop()+y, rect.GetWidth(), yDelta); else //nDirection == wxSOUTH - DoDrawRectangle(rect.GetLeft(), rect.GetBottom()-y-yDelta+1, + DrawRectangle(rect.GetLeft(), rect.GetBottom()-y-yDelta+1, rect.GetWidth(), yDelta); } } @@ -1053,14 +787,13 @@ void wxDCImpl::DoGradientFillLinear(const wxRect& rect, SetBrush(oldBrush); } -void wxDCImpl::DoGradientFillConcentric(const wxRect& rect, +void wxDCBase::DoGradientFillConcentric(const wxRect& rect, const wxColour& initialColour, const wxColour& destColour, const wxPoint& circleCenter) { - // save the old pen and ensure it is restored on exit - const wxPen penOrig = m_pen; - wxON_BLOCK_EXIT_SET(m_pen, penOrig); + //save the old pen color + wxColour oldPenColour = m_pen.GetColour(); wxUint8 nR1 = destColour.Red(); wxUint8 nG1 = destColour.Green(); @@ -1072,331 +805,47 @@ void wxDCImpl::DoGradientFillConcentric(const wxRect& rect, //Radius - double cx = rect.GetWidth() / 2; - double cy = rect.GetHeight() / 2; - double dRadius; + wxInt32 cx = rect.GetWidth() / 2; + wxInt32 cy = rect.GetHeight() / 2; + wxInt32 nRadius; if (cx < cy) - dRadius = cx; + nRadius = cx; else - dRadius = cy; + nRadius = cy; //Offset of circle - double ptX, ptY; - ptX = circleCenter.x; - ptY = circleCenter.y; - double nCircleOffX = ptX - cx; - double nCircleOffY = ptY - cy; - - double dGradient; - double dx, dy; + wxInt32 nCircleOffX = circleCenter.x - (rect.GetWidth() / 2); + wxInt32 nCircleOffY = circleCenter.y - (rect.GetHeight() / 2); for ( wxInt32 x = 0; x < rect.GetWidth(); x++ ) { for ( wxInt32 y = 0; y < rect.GetHeight(); y++ ) { //get color difference - dx = x; - dy = y; - - dGradient = ((dRadius - sqrt( (dx - cx - nCircleOffX) * (dx - cx - nCircleOffX) - +(dy - cy - nCircleOffY) * (dy - cy - nCircleOffY) - ) - ) * 100 - ) / dRadius; + wxInt32 nGradient = ((nRadius - + (wxInt32)sqrt( + pow((double)(x - cx - nCircleOffX), 2) + + pow((double)(y - cy - nCircleOffY), 2) + )) * 100) / nRadius; //normalize Gradient - if (dGradient < 0) - dGradient = 0.0; + if (nGradient < 0 ) + nGradient = 0; //get dest colors - nR = (wxUint8)(nR1 + ((nR2 - nR1) * dGradient / 100)); - nG = (wxUint8)(nG1 + ((nG2 - nG1) * dGradient / 100)); - nB = (wxUint8)(nB1 + ((nB2 - nB1) * dGradient / 100)); + nR = (wxUint8)(nR1 + ((nR2 - nR1) * nGradient / 100)); + nG = (wxUint8)(nG1 + ((nG2 - nG1) * nGradient / 100)); + nB = (wxUint8)(nB1 + ((nB2 - nB1) * nGradient / 100)); //set the pixel - SetPen(wxColour(nR,nG,nB)); - DoDrawPoint(x + rect.GetLeft(), y + rect.GetTop()); + m_pen.SetColour(wxColour(nR,nG,nB)); + DrawPoint(wxPoint(x + rect.GetLeft(), y + rect.GetTop())); } } + //return old pen color + m_pen.SetColour(oldPenColour); } -void wxDCImpl::InheritAttributes(wxWindow *win) -{ - wxCHECK_RET( win, "window can't be NULL" ); - - SetFont(win->GetFont()); - SetTextForeground(win->GetForegroundColour()); - SetTextBackground(win->GetBackgroundColour()); - SetBackground(win->GetBackgroundColour()); - SetLayoutDirection(win->GetLayoutDirection()); -} - -void wxDCImpl::DoGetFontMetrics(int *height, - int *ascent, - int *descent, - int *internalLeading, - int *externalLeading, - int *averageWidth) const -{ - // Average width is typically the same as width of 'x'. - wxCoord h, d; - DoGetTextExtent("x", averageWidth, &h, &d, externalLeading); - - if ( height ) - *height = h; - if ( ascent ) - *ascent = h - d; - if ( descent ) - *descent = d; - if ( internalLeading ) - *internalLeading = 0; -} - -//----------------------------------------------------------------------------- -// wxDC -//----------------------------------------------------------------------------- - -IMPLEMENT_ABSTRACT_CLASS(wxDC, wxObject) - -void wxDC::CopyAttributes(const wxDC& dc) -{ - SetFont(dc.GetFont()); - SetTextForeground(dc.GetTextForeground()); - SetTextBackground(dc.GetTextBackground()); - SetBackground(dc.GetBackground()); - SetLayoutDirection(dc.GetLayoutDirection()); -} - -void wxDC::DrawLabel(const wxString& text, - const wxBitmap& bitmap, - const wxRect& rect, - int alignment, - int indexAccel, - wxRect *rectBounding) -{ - // find the text position - wxCoord widthText, heightText, heightLine; - GetMultiLineTextExtent(text, &widthText, &heightText, &heightLine); - - wxCoord width, height; - if ( bitmap.IsOk() ) - { - width = widthText + bitmap.GetWidth(); - height = bitmap.GetHeight(); - } - else // no bitmap - { - width = widthText; - height = heightText; - } - - wxCoord x, y; - if ( alignment & wxALIGN_RIGHT ) - { - x = rect.GetRight() - width; - } - else if ( alignment & wxALIGN_CENTRE_HORIZONTAL ) - { - x = (rect.GetLeft() + rect.GetRight() + 1 - width) / 2; - } - else // alignment & wxALIGN_LEFT - { - x = rect.GetLeft(); - } - - if ( alignment & wxALIGN_BOTTOM ) - { - y = rect.GetBottom() - height; - } - else if ( alignment & wxALIGN_CENTRE_VERTICAL ) - { - y = (rect.GetTop() + rect.GetBottom() + 1 - height) / 2; - } - else // alignment & wxALIGN_TOP - { - y = rect.GetTop(); - } - - // draw the bitmap first - wxCoord x0 = x, - y0 = y, - width0 = width; - if ( bitmap.IsOk() ) - { - DrawBitmap(bitmap, x, y, true /* use mask */); - - wxCoord offset = bitmap.GetWidth() + 4; - x += offset; - width -= offset; - - y += (height - heightText) / 2; - } - - // we will draw the underscore under the accel char later - wxCoord startUnderscore = 0, - endUnderscore = 0, - yUnderscore = 0; - - // split the string into lines and draw each of them separately - // - // NB: while wxDC::DrawText() on some platforms supports drawing multi-line - // strings natively, this is not the case for all of them, notably not - // wxMSW which uses this function for multi-line texts, so we may only - // call DrawText() for single-line strings from here to avoid infinite - // recursion. - wxString curLine; - for ( wxString::const_iterator pc = text.begin(); ; ++pc ) - { - if ( pc == text.end() || *pc == '\n' ) - { - int xRealStart = x; // init it here to avoid compielr warnings - - if ( !curLine.empty() ) - { - // NB: can't test for !(alignment & wxALIGN_LEFT) because - // wxALIGN_LEFT is 0 - if ( alignment & (wxALIGN_RIGHT | wxALIGN_CENTRE_HORIZONTAL) ) - { - wxCoord widthLine; - GetTextExtent(curLine, &widthLine, NULL); - - if ( alignment & wxALIGN_RIGHT ) - { - xRealStart += width - widthLine; - } - else // if ( alignment & wxALIGN_CENTRE_HORIZONTAL ) - { - xRealStart += (width - widthLine) / 2; - } - } - //else: left aligned, nothing to do - - DrawText(curLine, xRealStart, y); - } - - y += heightLine; - - // do we have underscore in this line? we can check yUnderscore - // because it is set below to just y + heightLine if we do - if ( y == yUnderscore ) - { - // adjust the horz positions to account for the shift - startUnderscore += xRealStart; - endUnderscore += xRealStart; - } - - if ( pc == text.end() ) - break; - - curLine.clear(); - } - else // not end of line - { - if ( pc - text.begin() == indexAccel ) - { - // remember to draw underscore here - GetTextExtent(curLine, &startUnderscore, NULL); - curLine += *pc; - GetTextExtent(curLine, &endUnderscore, NULL); - - yUnderscore = y + heightLine; - } - else - { - curLine += *pc; - } - } - } - - // draw the underscore if found - if ( startUnderscore != endUnderscore ) - { - // it should be of the same colour as text - SetPen(wxPen(GetTextForeground(), 0, wxPENSTYLE_SOLID)); - - // This adjustment is relatively arbitrary: we need to draw the - // underline slightly higher to avoid overflowing the character cell - // but whether we should do it 1, 2 or 3 pixels higher is not clear. - // - // The currently used value seems to be compatible with native MSW - // behaviour, i.e. it results in the same appearance of the owner-drawn - // and normal labels. - yUnderscore -= 2; - - DrawLine(startUnderscore, yUnderscore, endUnderscore, yUnderscore); - } - - // return bounding rect if requested - if ( rectBounding ) - { - *rectBounding = wxRect(x, y - heightText, widthText, heightText); - } - - CalcBoundingBox(x0, y0); - CalcBoundingBox(x0 + width0, y0 + height); -} - -#if WXWIN_COMPATIBILITY_2_8 - // for compatibility with the old code when wxCoord was long everywhere -void wxDC::GetTextExtent(const wxString& string, - long *x, long *y, - long *descent, - long *externalLeading, - const wxFont *theFont) const - { - wxCoord x2, y2, descent2, externalLeading2; - m_pimpl->DoGetTextExtent(string, &x2, &y2, - &descent2, &externalLeading2, - theFont); - if ( x ) - *x = x2; - if ( y ) - *y = y2; - if ( descent ) - *descent = descent2; - if ( externalLeading ) - *externalLeading = externalLeading2; - } - -void wxDC::GetLogicalOrigin(long *x, long *y) const - { - wxCoord x2, y2; - m_pimpl->DoGetLogicalOrigin(&x2, &y2); - if ( x ) - *x = x2; - if ( y ) - *y = y2; - } - -void wxDC::GetDeviceOrigin(long *x, long *y) const - { - wxCoord x2, y2; - m_pimpl->DoGetDeviceOrigin(&x2, &y2); - if ( x ) - *x = x2; - if ( y ) - *y = y2; - } - -void wxDC::GetClippingBox(long *x, long *y, long *w, long *h) const - { - wxCoord xx,yy,ww,hh; - m_pimpl->DoGetClippingBox(&xx, &yy, &ww, &hh); - if (x) *x = xx; - if (y) *y = yy; - if (w) *w = ww; - if (h) *h = hh; - } - -void wxDC::DrawObject(wxDrawObject* drawobject) -{ - drawobject->Draw(*this); - CalcBoundingBox(drawobject->MinX(),drawobject->MinY()); - CalcBoundingBox(drawobject->MaxX(),drawobject->MaxY()); -} - -#endif // WXWIN_COMPATIBILITY_2_8 - /* Notes for wxWidgets DrawEllipticArcRot(...) @@ -1439,26 +888,26 @@ p.lenhard@t-online.de */ #ifdef __WXWINCE__ -void wxDCImpl::DoDrawEllipticArcRot( wxCoord x, wxCoord y, +void wxDCBase::DoDrawEllipticArcRot( wxCoord x, wxCoord y, wxCoord w, wxCoord h, double sa, double ea, double angle ) { - wxPointList list; + wxList list; CalculateEllipticPoints( &list, x, y, w, h, sa, ea ); Rotate( &list, angle, wxPoint( x+w/2, y+h/2 ) ); // Add center (for polygon/pie) - list.Append( new wxPoint( x+w/2, y+h/2 ) ); + list.Append( (wxObject*) new wxPoint( x+w/2, y+h/2 ) ); // copy list into array and delete list elements int n = list.GetCount(); wxPoint *points = new wxPoint[n]; int i = 0; - wxPointList::compatibility_iterator node; + wxNode* node = 0; for ( node = list.GetFirst(); node; node = node->GetNext(), i++ ) { - wxPoint *point = node->GetData(); + wxPoint *point = (wxPoint *)node->GetData(); points[i].x = point->x; points[i].y = point->y; delete point; @@ -1484,17 +933,16 @@ void wxDCImpl::DoDrawEllipticArcRot( wxCoord x, wxCoord y, } // DrawEllipticArcRot -void wxDCImpl::Rotate( wxPointList* points, double angle, wxPoint center ) +void wxDCBase::Rotate( wxList* points, double angle, wxPoint center ) { if( angle != 0.0 ) { double pi(M_PI); double dSinA = -sin(angle*2.0*pi/360.0); double dCosA = cos(angle*2.0*pi/360.0); - wxPointList::compatibility_iterator node; - for ( node = points->GetFirst(); node; node = node->GetNext() ) + for ( wxNode* node = points->GetFirst(); node; node = node->GetNext() ) { - wxPoint* point = node->GetData(); + wxPoint* point = (wxPoint*)node->GetData(); // transform coordinates, if necessary if( center.x ) point->x -= center.x; @@ -1512,7 +960,7 @@ void wxDCImpl::Rotate( wxPointList* points, double angle, wxPoint center ) } } -void wxDCImpl::CalculateEllipticPoints( wxPointList* points, +void wxDCBase::CalculateEllipticPoints( wxList* points, wxCoord xStart, wxCoord yStart, wxCoord w, wxCoord h, double sa, double ea ) @@ -1585,7 +1033,7 @@ void wxDCImpl::CalculateEllipticPoints( wxPointList* points, long y2_old = 0; long y_old = 0; // Lists for quadrant 1 to 4 - wxPointList pointsarray[4]; + wxList pointsarray[4]; // Calculate points for first quadrant and set in all quadrants for( x = 0; x <= a; ++x ) { @@ -1599,46 +1047,45 @@ void wxDCImpl::CalculateEllipticPoints( wxPointList* points, y2 = y2-y-y+1; --y; } - // old y now too big: set point with old y, old x + // old y now to big: set point with old y, old x if( bNewPoint && x>1) { int x1 = x - 1; // remove points on the same line - pointsarray[0].Insert( new wxPoint( xCenter + x1 - decrX, yCenter - y_old ) ); - pointsarray[1].Append( new wxPoint( xCenter - x1, yCenter - y_old ) ); - pointsarray[2].Insert( new wxPoint( xCenter - x1, yCenter + y_old - decrY ) ); - pointsarray[3].Append( new wxPoint( xCenter + x1 - decrX, yCenter + y_old - decrY ) ); + pointsarray[0].Insert( (wxObject*) new wxPoint( xCenter + x1 - decrX, yCenter - y_old ) ); + pointsarray[1].Append( (wxObject*) new wxPoint( xCenter - x1, yCenter - y_old ) ); + pointsarray[2].Insert( (wxObject*) new wxPoint( xCenter - x1, yCenter + y_old - decrY ) ); + pointsarray[3].Append( (wxObject*) new wxPoint( xCenter + x1 - decrX, yCenter + y_old - decrY ) ); } // set point } // calculate point // Starting and/or ending points for the quadrants, first quadrant gets both. - pointsarray[0].Insert( new wxPoint( xCenter + a - decrX, yCenter ) ); - pointsarray[0].Append( new wxPoint( xCenter, yCenter - b ) ); - pointsarray[1].Append( new wxPoint( xCenter - a, yCenter ) ); - pointsarray[2].Append( new wxPoint( xCenter, yCenter + b - decrY ) ); - pointsarray[3].Append( new wxPoint( xCenter + a - decrX, yCenter ) ); + pointsarray[0].Insert( (wxObject*) new wxPoint( xCenter + a - decrX, yCenter ) ); + pointsarray[0].Append( (wxObject*) new wxPoint( xCenter, yCenter - b ) ); + pointsarray[1].Append( (wxObject*) new wxPoint( xCenter - a, yCenter ) ); + pointsarray[2].Append( (wxObject*) new wxPoint( xCenter, yCenter + b - decrY ) ); + pointsarray[3].Append( (wxObject*) new wxPoint( xCenter + a - decrX, yCenter ) ); // copy quadrants in original list if( bUseAngles ) { // Copy the right part of the points in the lists // and delete the wxPoints, because they do not leave this method. - points->Append( new wxPoint( xsa, ysa ) ); + points->Append( (wxObject*) new wxPoint( xsa, ysa ) ); int q = sq; bool bStarted = false; bool bReady = false; bool bForceTurn = ( sq == eq && sa > ea ); while( !bReady ) { - wxPointList::compatibility_iterator node; - for( node = pointsarray[q].GetFirst(); node; node = node->GetNext() ) + for( wxNode *node = pointsarray[q].GetFirst(); node; node = node->GetNext() ) { // once: go to starting point in start quadrant if( !bStarted && ( - node->GetData()->x < xsa+1 && q <= 1 + ( (wxPoint*) node->GetData() )->x < xsa+1 && q <= 1 || - node->GetData()->x > xsa-1 && q >= 2 + ( (wxPoint*) node->GetData() )->x > xsa-1 && q >= 2 ) ) { @@ -1656,10 +1103,10 @@ void wxDCImpl::CalculateEllipticPoints( wxPointList* points, ) { // copy point - wxPoint* pPoint = new wxPoint( *(node->GetData()) ); - points->Append( pPoint ); + wxPoint* pPoint = new wxPoint( *((wxPoint*) node->GetData() ) ); + points->Append( (wxObject*) pPoint ); } - else if( q == eq && !bForceTurn || node->GetData()->x == xea) + else if( q == eq && !bForceTurn || ( (wxPoint*) node->GetData() )->x == xea) { bReady = true; } @@ -1670,49 +1117,49 @@ void wxDCImpl::CalculateEllipticPoints( wxPointList* points, bForceTurn = false; bStarted = true; } // while not bReady - points->Append( new wxPoint( xea, yea ) ); + points->Append( (wxObject*) new wxPoint( xea, yea ) ); // delete points for( q = 0; q < 4; ++q ) { - wxPointList::compatibility_iterator node; - for( node = pointsarray[q].GetFirst(); node; node = node->GetNext() ) + for( wxNode *node = pointsarray[q].GetFirst(); node; node = node->GetNext() ) { - wxPoint *p = node->GetData(); + wxPoint *p = (wxPoint *)node->GetData(); delete p; } } } else { - wxPointList::compatibility_iterator node; + wxNode* node; // copy whole ellipse, wxPoints will be deleted outside for( node = pointsarray[0].GetFirst(); node; node = node->GetNext() ) { - wxPoint *p = node->GetData(); + wxObject *p = node->GetData(); points->Append( p ); } for( node = pointsarray[1].GetFirst(); node; node = node->GetNext() ) { - wxPoint *p = node->GetData(); + wxObject *p = node->GetData(); points->Append( p ); } for( node = pointsarray[2].GetFirst(); node; node = node->GetNext() ) { - wxPoint *p = node->GetData(); + wxObject *p = node->GetData(); points->Append( p ); } for( node = pointsarray[3].GetFirst(); node; node = node->GetNext() ) { - wxPoint *p = node->GetData(); + wxObject *p = node->GetData(); points->Append( p ); } } // not iUseAngles } // CalculateEllipticPoints -#endif // __WXWINCE__ +#endif -float wxDCImpl::GetFontPointSizeAdjustment(float dpi) + +float wxDCBase::GetFontPointSizeAdjustment(float dpi) { // wxMSW has long-standing bug where wxFont point size is interpreted as // "pixel size corresponding to given point size *on screen*". In other @@ -1720,6 +1167,8 @@ float wxDCImpl::GetFontPointSizeAdjustment(float dpi) // are ~6 times smaller when printing. Unfortunately, this bug is so severe // that *all* printing code has to account for it and consequently, other // ports need to emulate this bug too: - const wxSize screenPPI = wxGetDisplayPPI(); - return float(screenPPI.y) / dpi; + const wxSize screenPixels = wxGetDisplaySize(); + const wxSize screenMM = wxGetDisplaySizeMM(); + const float screenPPI_y = (screenPixels.y * 25.4) / screenMM.y; + return screenPPI_y / dpi; } diff --git a/Source/3rd Party/wx/src/common/dcbufcmn.cpp b/Source/3rd Party/wx/src/common/dcbufcmn.cpp index a43f91f47..88751fe85 100644 --- a/Source/3rd Party/wx/src/common/dcbufcmn.cpp +++ b/Source/3rd Party/wx/src/common/dcbufcmn.cpp @@ -4,7 +4,7 @@ // Author: Ron Lee, Jaakko Salli // Modified by: // Created: Sep-20-2006 -// RCS-ID: $Id$ +// RCS-ID: $Id: dcbufcmn.cpp 52152 2008-02-27 18:03:12Z VZ $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -34,9 +34,6 @@ // implementation // ============================================================================ -IMPLEMENT_DYNAMIC_CLASS(wxBufferedDC,wxMemoryDC) -IMPLEMENT_ABSTRACT_CLASS(wxBufferedPaintDC,wxBufferedDC) - // ---------------------------------------------------------------------------- // wxSharedDCBufferManager: helper class maintaining backing store bitmap // ---------------------------------------------------------------------------- @@ -51,9 +48,6 @@ public: static wxBitmap* GetBuffer(int w, int h) { - if ( ms_usingSharedBuffer ) - return new wxBitmap(w, h); - if ( !ms_buffer || w > ms_buffer->GetWidth() || h > ms_buffer->GetHeight() ) @@ -69,33 +63,16 @@ public: ms_buffer = new wxBitmap(w, h); } - - ms_usingSharedBuffer = true; return ms_buffer; } - static void ReleaseBuffer(wxBitmap* buffer) - { - if ( buffer == ms_buffer ) - { - wxASSERT_MSG( ms_usingSharedBuffer, wxT("shared buffer already released") ); - ms_usingSharedBuffer = false; - } - else - { - delete buffer; - } - } - private: static wxBitmap *ms_buffer; - static bool ms_usingSharedBuffer; DECLARE_DYNAMIC_CLASS(wxSharedDCBufferManager) }; wxBitmap* wxSharedDCBufferManager::ms_buffer = NULL; -bool wxSharedDCBufferManager::ms_usingSharedBuffer = false; IMPLEMENT_DYNAMIC_CLASS(wxSharedDCBufferManager, wxModule) @@ -105,62 +82,14 @@ IMPLEMENT_DYNAMIC_CLASS(wxSharedDCBufferManager, wxModule) void wxBufferedDC::UseBuffer(wxCoord w, wxCoord h) { - wxCHECK_RET( w >= -1 && h >= -1, "Invalid buffer size" ); - if ( !m_buffer || !m_buffer->IsOk() ) { if ( w == -1 || h == -1 ) m_dc->GetSize(&w, &h); m_buffer = wxSharedDCBufferManager::GetBuffer(w, h); - m_style |= wxBUFFER_USES_SHARED_BUFFER; - m_area.Set(w,h); } - else - m_area = m_buffer->GetSize(); SelectObject(*m_buffer); - - // now that the DC is valid we can inherit the attributes (fonts, colours, - // layout direction, ...) from the original DC - if ( m_dc && m_dc->IsOk() ) - CopyAttributes(*m_dc); } -void wxBufferedDC::UnMask() -{ - wxCHECK_RET( m_dc, wxT("no underlying wxDC?") ); - wxASSERT_MSG( m_buffer && m_buffer->IsOk(), wxT("invalid backing store") ); - - wxCoord x = 0, - y = 0; - - // Ensure the scale matches the device - SetUserScale(1.0, 1.0); - - if ( m_style & wxBUFFER_CLIENT_AREA ) - GetDeviceOrigin(&x, &y); - - // It's possible that the buffer may be bigger than the area that needs to - // be drawn (the client size of the window is smaller than the bitmap, or - // a shared bitmap has been reused for a smaller area, etc.) so avoid - // blitting too much if possible, but only use the real DC size if the - // wxBUFFER_VIRTUAL_AREA style is not set. - int width = m_area.GetWidth(), - height = m_area.GetHeight(); - - if (! m_style & wxBUFFER_VIRTUAL_AREA) - { - int widthDC, - heightDC; - m_dc->GetSize(&widthDC, &heightDC); - width = wxMin(width, widthDC); - height = wxMin(height, heightDC); - } - - m_dc->Blit(0, 0, width, height, this, -x, -y); - m_dc = NULL; - - if ( m_style & wxBUFFER_USES_SHARED_BUFFER ) - wxSharedDCBufferManager::ReleaseBuffer(m_buffer); -} diff --git a/Source/3rd Party/wx/src/common/dcgraph.cpp b/Source/3rd Party/wx/src/common/dcgraph.cpp index f5547d93d..2dcc9aa61 100644 --- a/Source/3rd Party/wx/src/common/dcgraph.cpp +++ b/Source/3rd Party/wx/src/common/dcgraph.cpp @@ -1,10 +1,10 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: src/common/dcgraph.cpp +// Name: src/common/graphcmn.cpp // Purpose: graphics context methods common to all platforms // Author: Stefan Csomor // Modified by: // Created: -// RCS-ID: $Id$ +// RCS-ID: $Id: dcgraph.cpp 60190 2009-04-16 00:57:35Z KO $ // Copyright: (c) Stefan Csomor // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -19,7 +19,6 @@ #if wxUSE_GRAPHICS_CONTEXT #include "wx/graphics.h" -#include "wx/dcgraph.h" #ifndef WX_PRECOMP #include "wx/icon.h" @@ -28,18 +27,9 @@ #include "wx/region.h" #endif -#include "wx/dcclient.h" - -#ifdef __WXOSX_OR_COCOA__ -#ifdef __WXOSX_IPHONE__ - #include -#else - #include +#ifdef __WXMAC__ +#include "wx/mac/private.h" #endif -#endif - -#include // for INT_MAX - //----------------------------------------------------------------------------- // constants //----------------------------------------------------------------------------- @@ -55,112 +45,22 @@ static inline double DegToRad(double deg) return (deg * M_PI) / 180.0; } -static wxCompositionMode TranslateRasterOp(wxRasterOperationMode function) -{ - switch ( function ) - { - case wxCOPY: // src - // since we are supporting alpha, _OVER is closer to the intention than _SOURCE - // since the latter would overwrite even when alpha is not set to opaque - return wxCOMPOSITION_OVER; - - case wxOR: // src OR dst - return wxCOMPOSITION_ADD; - - case wxNO_OP: // dst - return wxCOMPOSITION_DEST; // ignore the source - - case wxCLEAR: // 0 - return wxCOMPOSITION_CLEAR;// clear dst - - case wxXOR: // src XOR dst - return wxCOMPOSITION_XOR; - - case wxAND: // src AND dst - case wxAND_INVERT: // (NOT src) AND dst - case wxAND_REVERSE:// src AND (NOT dst) - case wxEQUIV: // (NOT src) XOR dst - case wxINVERT: // NOT dst - case wxNAND: // (NOT src) OR (NOT dst) - case wxNOR: // (NOT src) AND (NOT dst) - case wxOR_INVERT: // (NOT src) OR dst - case wxOR_REVERSE: // src OR (NOT dst) - case wxSET: // 1 - case wxSRC_INVERT: // NOT src - break; - } - - return wxCOMPOSITION_INVALID; -} - //----------------------------------------------------------------------------- // wxDC bridge class //----------------------------------------------------------------------------- +#ifdef __WXMAC__ +IMPLEMENT_DYNAMIC_CLASS(wxGCDC, wxDCBase) +#else IMPLEMENT_DYNAMIC_CLASS(wxGCDC, wxDC) - -wxGCDC::wxGCDC(const wxWindowDC& dc) : - wxDC( new wxGCDCImpl( this, dc ) ) -{ -} - -wxGCDC::wxGCDC( const wxMemoryDC& dc) : - wxDC( new wxGCDCImpl( this, dc ) ) -{ -} - -#if wxUSE_PRINTING_ARCHITECTURE -wxGCDC::wxGCDC( const wxPrinterDC& dc) : - wxDC( new wxGCDCImpl( this, dc ) ) -{ -} #endif -#if defined(__WXMSW__) && wxUSE_ENH_METAFILE -wxGCDC::wxGCDC(const wxEnhMetaFileDC& dc) - : wxDC(new wxGCDCImpl(this, dc)) -{ -} -#endif - -wxGCDC::wxGCDC(wxGraphicsContext* context) : - wxDC( new wxGCDCImpl( this ) ) -{ - SetGraphicsContext(context); -} - -wxGCDC::wxGCDC() : - wxDC( new wxGCDCImpl( this ) ) -{ -} - -wxGCDC::~wxGCDC() -{ -} - -wxGraphicsContext* wxGCDC::GetGraphicsContext() const -{ - if (!m_pimpl) return NULL; - wxGCDCImpl *gc_impl = (wxGCDCImpl*) m_pimpl; - return gc_impl->GetGraphicsContext(); -} - -void wxGCDC::SetGraphicsContext( wxGraphicsContext* ctx ) -{ - if (!m_pimpl) return; - wxGCDCImpl *gc_impl = (wxGCDCImpl*) m_pimpl; - gc_impl->SetGraphicsContext( ctx ); -} - -IMPLEMENT_ABSTRACT_CLASS(wxGCDCImpl, wxDCImpl) - -wxGCDCImpl::wxGCDCImpl( wxDC *owner ) : - wxDCImpl( owner ) +wxGCDC::wxGCDC() { Init(); } -void wxGCDCImpl::SetGraphicsContext( wxGraphicsContext* ctx ) +void wxGCDC::SetGraphicsContext( wxGraphicsContext* ctx ) { delete m_graphicContext; m_graphicContext = ctx; @@ -176,42 +76,29 @@ void wxGCDCImpl::SetGraphicsContext( wxGraphicsContext* ctx ) } } -wxGCDCImpl::wxGCDCImpl( wxDC *owner, const wxWindowDC& dc ) : - wxDCImpl( owner ) -{ - Init(); - SetGraphicsContext( wxGraphicsContext::Create(dc) ); - m_window = dc.GetWindow(); -} - -wxGCDCImpl::wxGCDCImpl( wxDC *owner, const wxMemoryDC& dc ) : - wxDCImpl( owner ) +wxGCDC::wxGCDC(const wxWindowDC& dc) { Init(); wxGraphicsContext* context; +#if wxUSE_CAIRO + wxGraphicsRenderer* renderer = wxGraphicsRenderer::GetCairoRenderer(); + context = renderer->CreateContext(dc); +#else context = wxGraphicsContext::Create(dc); +#endif + SetGraphicsContext( context ); } -#if wxUSE_PRINTING_ARCHITECTURE -wxGCDCImpl::wxGCDCImpl( wxDC *owner, const wxPrinterDC& dc ) : - wxDCImpl( owner ) +#ifdef __WXMSW__ +wxGCDC::wxGCDC(const wxMemoryDC& dc) { Init(); SetGraphicsContext( wxGraphicsContext::Create(dc) ); } -#endif +#endif -#if defined(__WXMSW__) && wxUSE_ENH_METAFILE -wxGCDCImpl::wxGCDCImpl(wxDC *owner, const wxEnhMetaFileDC& dc) - : wxDCImpl(owner) -{ - Init(); - SetGraphicsContext(wxGraphicsContext::Create(dc)); -} -#endif - -void wxGCDCImpl::Init() +void wxGCDC::Init() { m_ok = false; m_colour = true; @@ -222,50 +109,39 @@ void wxGCDCImpl::Init() m_font = *wxNORMAL_FONT; m_brush = *wxWHITE_BRUSH; - m_graphicContext = wxGraphicsContext::Create(); + m_graphicContext = NULL; m_logicalFunctionSupported = true; } -wxGCDCImpl::~wxGCDCImpl() +wxGCDC::~wxGCDC() { delete m_graphicContext; } -void wxGCDCImpl::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, - bool useMask ) +void wxGCDC::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, bool WXUNUSED(useMask) ) { - wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawBitmap - invalid DC") ); - wxCHECK_RET( bmp.IsOk(), wxT("wxGCDC(cg)::DoDrawBitmap - invalid bitmap") ); + wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoDrawBitmap - invalid DC") ); + wxCHECK_RET( bmp.Ok(), wxT("wxGCDC(cg)::DoDrawBitmap - invalid bitmap") ); - int w = bmp.GetWidth(); - int h = bmp.GetHeight(); if ( bmp.GetDepth() == 1 ) { m_graphicContext->SetPen(*wxTRANSPARENT_PEN); m_graphicContext->SetBrush( wxBrush( m_textBackgroundColour , wxSOLID ) ); - m_graphicContext->DrawRectangle( x, y, w, h ); + m_graphicContext->DrawRectangle( x , y , bmp.GetWidth() , bmp.GetHeight() ); m_graphicContext->SetBrush( wxBrush( m_textForegroundColour , wxSOLID ) ); - m_graphicContext->DrawBitmap( bmp, x, y, w, h ); + m_graphicContext->DrawBitmap( bmp, x , y , bmp.GetWidth() , bmp.GetHeight() ); m_graphicContext->SetBrush( m_graphicContext->CreateBrush(m_brush)); m_graphicContext->SetPen( m_graphicContext->CreatePen(m_pen)); } - else // not a monochrome bitmap, handle it normally - { - // make a copy in case we need to remove its mask, if we don't modify - // it the copy is cheap as bitmaps are reference-counted - wxBitmap bmpCopy(bmp); - if ( !useMask && bmp.GetMask() ) - bmpCopy.SetMask(NULL); - - m_graphicContext->DrawBitmap( bmpCopy, x, y, w, h ); - } + else + m_graphicContext->DrawBitmap( bmp, x , y , bmp.GetWidth() , bmp.GetHeight() ); } -void wxGCDCImpl::DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y ) +void wxGCDC::DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y ) { - wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawIcon - invalid DC") ); - wxCHECK_RET( icon.IsOk(), wxT("wxGCDC(cg)::DoDrawIcon - invalid icon") ); + wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoDrawIcon - invalid DC") ); + wxCHECK_RET( icon.Ok(), wxT("wxGCDC(cg)::DoDrawIcon - invalid icon") ); wxCoord w = icon.GetWidth(); wxCoord h = icon.GetHeight(); @@ -273,31 +149,33 @@ void wxGCDCImpl::DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y ) m_graphicContext->DrawIcon( icon , x, y, w, h ); } -bool wxGCDCImpl::StartDoc( const wxString& WXUNUSED(message) ) +bool wxGCDC::StartDoc( const wxString& WXUNUSED(message) ) { return true; } -void wxGCDCImpl::EndDoc() +void wxGCDC::EndDoc() { } -void wxGCDCImpl::StartPage() +void wxGCDC::StartPage() { } -void wxGCDCImpl::EndPage() +void wxGCDC::EndPage() { } - -void wxGCDCImpl::Flush() + +void wxGCDC::Flush() { - m_graphicContext->Flush(); +#ifdef __WXMAC__ + CGContextFlush( (CGContextRef) m_graphicContext->GetNativeContext() ); +#endif } -void wxGCDCImpl::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord w, wxCoord h ) +void wxGCDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord w, wxCoord h ) { - wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoSetClippingRegion - invalid DC") ); + wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoSetClippingRegion - invalid DC") ); m_graphicContext->Clip( x, y, w, h ); if ( m_clipping ) @@ -318,10 +196,10 @@ void wxGCDCImpl::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord w, wxCoord h } } -void wxGCDCImpl::DoSetDeviceClippingRegion( const wxRegion ®ion ) +void wxGCDC::DoSetClippingRegionAsRegion( const wxRegion ®ion ) { // region is in device coordinates - wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoSetDeviceClippingRegion - invalid DC") ); + wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoSetClippingRegionAsRegion - invalid DC") ); if (region.Empty()) { @@ -354,106 +232,172 @@ void wxGCDCImpl::DoSetDeviceClippingRegion( const wxRegion ®ion ) } } -void wxGCDCImpl::DestroyClippingRegion() +void wxGCDC::DestroyClippingRegion() { m_graphicContext->ResetClip(); // currently the clip eg of a window extends to the area between the scrollbars - // so we must explicitly make sure it only covers the area we want it to draw + // so we must explicitely make sure it only covers the area we want it to draw int width, height ; - GetOwner()->GetSize( &width , &height ) ; + GetSize( &width , &height ) ; m_graphicContext->Clip( DeviceToLogicalX(0) , DeviceToLogicalY(0) , DeviceToLogicalXRel(width), DeviceToLogicalYRel(height) ); - + m_graphicContext->SetPen( m_pen ); m_graphicContext->SetBrush( m_brush ); m_clipping = false; } -void wxGCDCImpl::DoGetSizeMM( int* width, int* height ) const +void wxGCDC::DoGetSizeMM( int* width, int* height ) const { int w = 0, h = 0; - GetOwner()->GetSize( &w, &h ); + GetSize( &w, &h ); if (width) *width = long( double(w) / (m_scaleX * m_mm_to_pix_x) ); if (height) *height = long( double(h) / (m_scaleY * m_mm_to_pix_y) ); } -void wxGCDCImpl::SetTextForeground( const wxColour &col ) +void wxGCDC::SetTextForeground( const wxColour &col ) { - wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::SetTextForeground - invalid DC") ); + wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::SetTextForeground - invalid DC") ); - // don't set m_textForegroundColour to an invalid colour as we'd crash - // later then (we use m_textForegroundColour.GetColor() without checking - // in a few places) - if ( col.IsOk() ) + if ( col != m_textForegroundColour ) { m_textForegroundColour = col; m_graphicContext->SetFont( m_font, m_textForegroundColour ); } } -void wxGCDCImpl::SetTextBackground( const wxColour &col ) +void wxGCDC::SetTextBackground( const wxColour &col ) { - wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::SetTextBackground - invalid DC") ); + wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::SetTextBackground - invalid DC") ); m_textBackgroundColour = col; } -wxSize wxGCDCImpl::GetPPI() const +void wxGCDC::SetMapMode( int mode ) +{ + switch (mode) + { + case wxMM_TWIPS: + SetLogicalScale( twips2mm * m_mm_to_pix_x, twips2mm * m_mm_to_pix_y ); + break; + + case wxMM_POINTS: + SetLogicalScale( pt2mm * m_mm_to_pix_x, pt2mm * m_mm_to_pix_y ); + break; + + case wxMM_METRIC: + SetLogicalScale( m_mm_to_pix_x, m_mm_to_pix_y ); + break; + + case wxMM_LOMETRIC: + SetLogicalScale( m_mm_to_pix_x / 10.0, m_mm_to_pix_y / 10.0 ); + break; + + case wxMM_TEXT: + default: + SetLogicalScale( 1.0, 1.0 ); + break; + } + + ComputeScaleAndOrigin(); +} + +void wxGCDC::SetUserScale( double x, double y ) +{ + // allow negative ? -> no + + m_userScaleX = x; + m_userScaleY = y; + ComputeScaleAndOrigin(); +} + +void wxGCDC::SetLogicalScale( double x, double y ) +{ + // allow negative ? + m_logicalScaleX = x; + m_logicalScaleY = y; + ComputeScaleAndOrigin(); +} + +void wxGCDC::SetLogicalOrigin( wxCoord x, wxCoord y ) +{ + m_logicalOriginX = x * m_signX; // is this still correct ? + m_logicalOriginY = y * m_signY; + ComputeScaleAndOrigin(); +} + +void wxGCDC::SetDeviceOrigin( wxCoord x, wxCoord y ) +{ + m_deviceOriginX = x; + m_deviceOriginY = y; + ComputeScaleAndOrigin(); +} + +void wxGCDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp ) +{ + m_signX = (xLeftRight ? 1 : -1); + m_signY = (yBottomUp ? -1 : 1); + ComputeScaleAndOrigin(); +} + +wxSize wxGCDC::GetPPI() const { return wxSize(72, 72); } -int wxGCDCImpl::GetDepth() const +int wxGCDC::GetDepth() const { return 32; } -void wxGCDCImpl::ComputeScaleAndOrigin() +void wxGCDC::ComputeScaleAndOrigin() { - wxDCImpl::ComputeScaleAndOrigin(); + m_scaleX = m_logicalScaleX * m_userScaleX; + m_scaleY = m_logicalScaleY * m_userScaleY; if ( m_graphicContext ) { m_matrixCurrent = m_graphicContext->CreateMatrix(); - + m_matrixCurrent.Translate( m_deviceOriginX, m_deviceOriginY ); + m_matrixCurrent.Scale( m_scaleX, m_scaleY ); // the logical origin sets the origin to have new coordinates - m_matrixCurrent.Translate( m_deviceOriginX - m_logicalOriginX * m_signX * m_scaleX, - m_deviceOriginY-m_logicalOriginY * m_signY * m_scaleY); - - m_matrixCurrent.Scale( m_scaleX * m_signX, m_scaleY * m_signY ); + m_matrixCurrent.Translate( -m_logicalOriginX, -m_logicalOriginY ); m_graphicContext->SetTransform( m_matrixOriginal ); m_graphicContext->ConcatTransform( m_matrixCurrent ); } } -void wxGCDCImpl::SetPalette( const wxPalette& WXUNUSED(palette) ) +void wxGCDC::SetPalette( const wxPalette& WXUNUSED(palette) ) { } -void wxGCDCImpl::SetBackgroundMode( int mode ) +void wxGCDC::SetBackgroundMode( int mode ) { m_backgroundMode = mode; } -void wxGCDCImpl::SetFont( const wxFont &font ) +void wxGCDC::SetFont( const wxFont &font ) { m_font = font; if ( m_graphicContext ) { wxFont f = font; - if ( f.IsOk() ) + if ( f.Ok() ) f.SetPointSize( /*LogicalToDeviceYRel*/(font.GetPointSize())); m_graphicContext->SetFont( f, m_textForegroundColour ); } } -void wxGCDCImpl::SetPen( const wxPen &pen ) +void wxGCDC::SetPen( const wxPen &pen ) { + if ( m_pen == pen ) + return; + m_pen = pen; if ( m_graphicContext ) { @@ -461,53 +405,55 @@ void wxGCDCImpl::SetPen( const wxPen &pen ) } } -void wxGCDCImpl::SetBrush( const wxBrush &brush ) +void wxGCDC::SetBrush( const wxBrush &brush ) { + if (m_brush == brush) + return; + m_brush = brush; if ( m_graphicContext ) { m_graphicContext->SetBrush( m_brush ); } } - -void wxGCDCImpl::SetBackground( const wxBrush &brush ) + +void wxGCDC::SetBackground( const wxBrush &brush ) { + if (m_backgroundBrush == brush) + return; + m_backgroundBrush = brush; - if (!m_backgroundBrush.IsOk()) + if (!m_backgroundBrush.Ok()) return; } -void wxGCDCImpl::SetLogicalFunction( wxRasterOperationMode function ) +void wxGCDC::SetLogicalFunction( int function ) { + if (m_logicalFunction == function) + return; + m_logicalFunction = function; - - wxCompositionMode mode = TranslateRasterOp( function ); - m_logicalFunctionSupported = mode != wxCOMPOSITION_INVALID; - if (m_logicalFunctionSupported) - m_logicalFunctionSupported = m_graphicContext->SetCompositionMode(mode); - - if ( function == wxXOR ) - m_graphicContext->SetAntialiasMode(wxANTIALIAS_NONE); + if ( m_graphicContext->SetLogicalFunction( function ) ) + m_logicalFunctionSupported=true; else - m_graphicContext->SetAntialiasMode(wxANTIALIAS_DEFAULT); + m_logicalFunctionSupported=false; } -bool wxGCDCImpl::DoFloodFill(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), - const wxColour& WXUNUSED(col), - wxFloodFillStyle WXUNUSED(style)) +bool wxGCDC::DoFloodFill(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), + const wxColour& WXUNUSED(col), int WXUNUSED(style)) { return false; } -bool wxGCDCImpl::DoGetPixel( wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), wxColour *WXUNUSED(col) ) const +bool wxGCDC::DoGetPixel( wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), wxColour *WXUNUSED(col) ) const { // wxCHECK_MSG( 0 , false, wxT("wxGCDC(cg)::DoGetPixel - not implemented") ); return false; } -void wxGCDCImpl::DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 ) +void wxGCDC::DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 ) { - wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawLine - invalid DC") ); + wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoDrawLine - invalid DC") ); if ( !m_logicalFunctionSupported ) return; @@ -518,16 +464,16 @@ void wxGCDCImpl::DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 ) CalcBoundingBox(x2, y2); } -void wxGCDCImpl::DoCrossHair( wxCoord x, wxCoord y ) +void wxGCDC::DoCrossHair( wxCoord x, wxCoord y ) { - wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoCrossHair - invalid DC") ); + wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoCrossHair - invalid DC") ); if ( !m_logicalFunctionSupported ) return; int w = 0, h = 0; - GetOwner()->GetSize( &w, &h ); + GetSize( &w, &h ); m_graphicContext->StrokeLine(0,y,w,y); m_graphicContext->StrokeLine(x,0,x,h); @@ -536,11 +482,11 @@ void wxGCDCImpl::DoCrossHair( wxCoord x, wxCoord y ) CalcBoundingBox(0+w, 0+h); } -void wxGCDCImpl::DoDrawArc( wxCoord x1, wxCoord y1, +void wxGCDC::DoDrawArc( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord xc, wxCoord yc ) { - wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawArc - invalid DC") ); + wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoDrawArc - invalid DC") ); if ( !m_logicalFunctionSupported ) return; @@ -582,10 +528,10 @@ void wxGCDCImpl::DoDrawArc( wxCoord x1, wxCoord y1, m_graphicContext->DrawPath(path); } -void wxGCDCImpl::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord w, wxCoord h, +void wxGCDC::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord w, wxCoord h, double sa, double ea ) { - wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawEllipticArc - invalid DC") ); + wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoDrawEllipticArc - invalid DC") ); if ( !m_logicalFunctionSupported ) return; @@ -619,17 +565,17 @@ void wxGCDCImpl::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord w, wxCoord h, m_graphicContext->PopState(); } -void wxGCDCImpl::DoDrawPoint( wxCoord x, wxCoord y ) +void wxGCDC::DoDrawPoint( wxCoord x, wxCoord y ) { - wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawPoint - invalid DC") ); + wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoDrawPoint - invalid DC") ); DoDrawLine( x , y , x + 1 , y + 1 ); } -void wxGCDCImpl::DoDrawLines(int n, wxPoint points[], +void wxGCDC::DoDrawLines(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset) { - wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawLines - invalid DC") ); + wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoDrawLines - invalid DC") ); if ( !m_logicalFunctionSupported ) return; @@ -646,27 +592,27 @@ void wxGCDCImpl::DoDrawLines(int n, wxPoint points[], } #if wxUSE_SPLINES -void wxGCDCImpl::DoDrawSpline(const wxPointList *points) +void wxGCDC::DoDrawSpline(wxList *points) { - wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawSpline - invalid DC") ); + wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoDrawSpline - invalid DC") ); if ( !m_logicalFunctionSupported ) return; wxGraphicsPath path = m_graphicContext->CreatePath(); - wxPointList::compatibility_iterator node = points->GetFirst(); - if ( !node ) + wxList::compatibility_iterator node = points->GetFirst(); + if (node == wxList::compatibility_iterator()) // empty list return; - wxPoint *p = node->GetData(); + wxPoint *p = (wxPoint *)node->GetData(); wxCoord x1 = p->x; wxCoord y1 = p->y; node = node->GetNext(); - p = node->GetData(); + p = (wxPoint *)node->GetData(); wxCoord x2 = p->x; wxCoord y2 = p->y; @@ -675,16 +621,16 @@ void wxGCDCImpl::DoDrawSpline(const wxPointList *points) path.MoveToPoint( x1 , y1 ); path.AddLineToPoint( cx1 , cy1 ); -#if !wxUSE_STD_CONTAINERS +#if !wxUSE_STL while ((node = node->GetNext()) != NULL) #else while ((node = node->GetNext())) -#endif // !wxUSE_STD_CONTAINERS +#endif // !wxUSE_STL { - p = node->GetData(); + p = (wxPoint *)node->GetData(); x1 = x2; y1 = y2; x2 = p->x; @@ -704,11 +650,11 @@ void wxGCDCImpl::DoDrawSpline(const wxPointList *points) } #endif // wxUSE_SPLINES -void wxGCDCImpl::DoDrawPolygon( int n, wxPoint points[], - wxCoord xoffset, wxCoord yoffset, - wxPolygonFillMode fillStyle ) +void wxGCDC::DoDrawPolygon( int n, wxPoint points[], + wxCoord xoffset, wxCoord yoffset, + int fillStyle ) { - wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawPolygon - invalid DC") ); + wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoDrawPolygon - invalid DC") ); if ( n <= 0 || (m_brush.GetStyle() == wxTRANSPARENT && m_pen.GetStyle() == wxTRANSPARENT ) ) return; @@ -732,12 +678,12 @@ void wxGCDCImpl::DoDrawPolygon( int n, wxPoint points[], delete[] pointsD; } -void wxGCDCImpl::DoDrawPolyPolygon(int n, +void wxGCDC::DoDrawPolyPolygon(int n, int count[], wxPoint points[], wxCoord xoffset, wxCoord yoffset, - wxPolygonFillMode fillStyle) + int fillStyle) { wxASSERT(n > 1); wxGraphicsPath path = m_graphicContext->CreatePath(); @@ -761,9 +707,9 @@ void wxGCDCImpl::DoDrawPolyPolygon(int n, m_graphicContext->DrawPath( path , fillStyle); } -void wxGCDCImpl::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord w, wxCoord h) +void wxGCDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord w, wxCoord h) { - wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawRectangle - invalid DC") ); + wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoDrawRectangle - invalid DC") ); if ( !m_logicalFunctionSupported ) return; @@ -782,11 +728,11 @@ void wxGCDCImpl::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord w, wxCoord h) m_graphicContext->DrawRectangle(x,y,w,h); } -void wxGCDCImpl::DoDrawRoundedRectangle(wxCoord x, wxCoord y, +void wxGCDC::DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord w, wxCoord h, double radius) { - wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawRoundedRectangle - invalid DC") ); + wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoDrawRoundedRectangle - invalid DC") ); if ( !m_logicalFunctionSupported ) return; @@ -808,9 +754,9 @@ void wxGCDCImpl::DoDrawRoundedRectangle(wxCoord x, wxCoord y, m_graphicContext->DrawRoundedRectangle( x,y,w,h,radius); } -void wxGCDCImpl::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord w, wxCoord h) +void wxGCDC::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord w, wxCoord h) { - wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawEllipse - invalid DC") ); + wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoDrawEllipse - invalid DC") ); if ( !m_logicalFunctionSupported ) return; @@ -825,114 +771,75 @@ void wxGCDCImpl::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord w, wxCoord h) m_graphicContext->DrawEllipse(x,y,w,h); } -bool wxGCDCImpl::CanDrawBitmap() const +bool wxGCDC::CanDrawBitmap() const { return true; } -bool wxGCDCImpl::DoBlit( +bool wxGCDC::DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, - wxDC *source, wxCoord xsrc, wxCoord ysrc, - wxRasterOperationMode logical_func , bool useMask, + wxDC *source, wxCoord xsrc, wxCoord ysrc, int logical_func , bool WXUNUSED(useMask), wxCoord xsrcMask, wxCoord ysrcMask ) { - return DoStretchBlit( xdest, ydest, width, height, - source, xsrc, ysrc, width, height, logical_func, useMask, - xsrcMask,ysrcMask ); -} - -bool wxGCDCImpl::DoStretchBlit( - wxCoord xdest, wxCoord ydest, wxCoord dstWidth, wxCoord dstHeight, - wxDC *source, wxCoord xsrc, wxCoord ysrc, wxCoord srcWidth, wxCoord srcHeight, - wxRasterOperationMode logical_func , bool useMask, - wxCoord xsrcMask, wxCoord ysrcMask ) -{ - wxCHECK_MSG( IsOk(), false, wxT("wxGCDC(cg)::DoStretchBlit - invalid DC") ); - wxCHECK_MSG( source->IsOk(), false, wxT("wxGCDC(cg)::DoStretchBlit - invalid source DC") ); + wxCHECK_MSG( Ok(), false, wxT("wxGCDC(cg)::DoBlit - invalid DC") ); + wxCHECK_MSG( source->Ok(), false, wxT("wxGCDC(cg)::DoBlit - invalid source DC") ); if ( logical_func == wxNO_OP ) return true; - - wxCompositionMode mode = TranslateRasterOp(logical_func); - if ( mode == wxCOMPOSITION_INVALID ) + else if ( !m_graphicContext->SetLogicalFunction( logical_func ) ) + { - wxFAIL_MSG( wxT("Blitting is not supported with this logical operation.") ); + wxFAIL_MSG( wxT("Logical function is not supported by the graphics context.") ); return false; } + if (xsrcMask == -1 && ysrcMask == -1) + { + xsrcMask = xsrc; + ysrcMask = ysrc; + } + wxRect subrect(source->LogicalToDeviceX(xsrc), source->LogicalToDeviceY(ysrc), - source->LogicalToDeviceXRel(srcWidth), - source->LogicalToDeviceYRel(srcHeight)); - const wxRect subrectOrig = subrect; - // clip the subrect down to the size of the source DC - wxRect clip; - source->GetSize(&clip.width, &clip.height); - subrect.Intersect(clip); - if (subrect.width == 0) - return true; + source->LogicalToDeviceXRel(width), + source->LogicalToDeviceYRel(height)); - bool retval = true; + // if needed clip the subrect down to the size of the source DC + wxCoord sw, sh; + source->GetSize(&sw, &sh); + sw = source->LogicalToDeviceXRel(sw); + sh = source->LogicalToDeviceYRel(sh); + if (subrect.x + subrect.width > sw) + subrect.width = sw - subrect.x; + if (subrect.y + subrect.height > sh) + subrect.height = sh - subrect.y; - wxCompositionMode formerMode = m_graphicContext->GetCompositionMode(); - if (m_graphicContext->SetCompositionMode(mode)) + wxBitmap blit = source->GetAsBitmap( &subrect ); + + if ( blit.Ok() ) { - wxAntialiasMode formerAa = m_graphicContext->GetAntialiasMode(); - if (mode == wxCOMPOSITION_XOR) - { - m_graphicContext->SetAntialiasMode(wxANTIALIAS_NONE); - } - - if (xsrcMask == -1 && ysrcMask == -1) - { - xsrcMask = xsrc; - ysrcMask = ysrc; - } - - wxBitmap blit = source->GetAsBitmap( &subrect ); - - if ( blit.IsOk() ) - { - if ( !useMask && blit.GetMask() ) - blit.SetMask(NULL); - - double x = xdest; - double y = ydest; - double w = dstWidth; - double h = dstHeight; - // adjust dest rect if source rect is clipped - if (subrect.width != subrectOrig.width || subrect.height != subrectOrig.height) - { - x += (subrect.x - subrectOrig.x) / double(subrectOrig.width) * dstWidth; - y += (subrect.y - subrectOrig.y) / double(subrectOrig.height) * dstHeight; - w *= double(subrect.width) / subrectOrig.width; - h *= double(subrect.height) / subrectOrig.height; - } - m_graphicContext->DrawBitmap(blit, x, y, w, h); - } - else - { - wxFAIL_MSG( wxT("Cannot Blit. Unable to get contents of DC as bitmap.") ); - retval = false; - } - - if (mode == wxCOMPOSITION_XOR) - { - m_graphicContext->SetAntialiasMode(formerAa); - } + m_graphicContext->DrawBitmap( blit, xdest, ydest, + wxMin(width, blit.GetWidth()), + wxMin(height, blit.GetHeight())); + } + else + { + wxFAIL_MSG( wxT("Cannot Blit. Unable to get contents of DC as bitmap.") ); + return false; } - // reset composition - m_graphicContext->SetCompositionMode(formerMode); - return retval; + // reset logical function + m_graphicContext->SetLogicalFunction( m_logicalFunction ); + + return true; } -void wxGCDCImpl::DoDrawRotatedText(const wxString& str, wxCoord x, wxCoord y, +void wxGCDC::DoDrawRotatedText(const wxString& str, wxCoord x, wxCoord y, double angle) { - wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawRotatedText - invalid DC") ); + wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoDrawRotatedText - invalid DC") ); - if ( str.empty() ) + if ( str.length() == 0 ) return; if ( !m_logicalFunctionSupported ) return; @@ -943,23 +850,11 @@ void wxGCDCImpl::DoDrawRotatedText(const wxString& str, wxCoord x, wxCoord y, m_graphicContext->DrawText( str, x ,y , DegToRad(angle ), m_graphicContext->CreateBrush( wxBrush(m_textBackgroundColour,wxSOLID) ) ); } -void wxGCDCImpl::DoDrawText(const wxString& str, wxCoord x, wxCoord y) +void wxGCDC::DoDrawText(const wxString& str, wxCoord x, wxCoord y) { - // For compatibility with other ports (notably wxGTK) and because it's - // genuinely useful, we allow passing multiline strings to DrawText(). - // However there is no native OSX function to draw them directly so we - // instead reuse the generic DrawLabel() method to render them. Of course, - // DrawLabel() itself will call back to us but with single line strings - // only so there won't be any infinite recursion here. - if ( str.find('\n') != wxString::npos ) - { - GetOwner()->DrawLabel(str, wxRect(x, y, 0, 0)); - return; - } + wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoDrawRotatedText - invalid DC") ); - wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawText - invalid DC") ); - - if ( str.empty() ) + if ( str.length() == 0 ) return; if ( !m_logicalFunctionSupported ) @@ -971,18 +866,18 @@ void wxGCDCImpl::DoDrawText(const wxString& str, wxCoord x, wxCoord y) m_graphicContext->DrawText( str, x ,y , m_graphicContext->CreateBrush( wxBrush(m_textBackgroundColour,wxSOLID) ) ); } -bool wxGCDCImpl::CanGetTextExtent() const +bool wxGCDC::CanGetTextExtent() const { - wxCHECK_MSG( IsOk(), false, wxT("wxGCDC(cg)::CanGetTextExtent - invalid DC") ); + wxCHECK_MSG( Ok(), false, wxT("wxGCDC(cg)::CanGetTextExtent - invalid DC") ); return true; } -void wxGCDCImpl::DoGetTextExtent( const wxString &str, wxCoord *width, wxCoord *height, +void wxGCDC::DoGetTextExtent( const wxString &str, wxCoord *width, wxCoord *height, wxCoord *descent, wxCoord *externalLeading , - const wxFont *theFont ) const + wxFont *theFont ) const { - wxCHECK_RET( m_graphicContext, wxT("wxGCDC(cg)::DoGetTextExtent - invalid DC") ); + wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoGetTextExtent - invalid DC") ); if ( theFont ) { @@ -1008,9 +903,9 @@ void wxGCDCImpl::DoGetTextExtent( const wxString &str, wxCoord *width, wxCoord * } } -bool wxGCDCImpl::DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const +bool wxGCDC::DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const { - wxCHECK_MSG( m_graphicContext, false, wxT("wxGCDC(cg)::DoGetPartialTextExtents - invalid DC") ); + wxCHECK_MSG( Ok(), false, wxT("wxGCDC(cg)::DoGetPartialTextExtents - invalid DC") ); widths.Clear(); widths.Add(0,text.Length()); if ( text.IsEmpty() ) @@ -1025,7 +920,7 @@ bool wxGCDCImpl::DoGetPartialTextExtents(const wxString& text, wxArrayInt& width return true; } -wxCoord wxGCDCImpl::GetCharWidth(void) const +wxCoord wxGCDC::GetCharWidth(void) const { wxCoord width; DoGetTextExtent( wxT("g") , &width , NULL , NULL , NULL , NULL ); @@ -1033,7 +928,7 @@ wxCoord wxGCDCImpl::GetCharWidth(void) const return width; } -wxCoord wxGCDCImpl::GetCharHeight(void) const +wxCoord wxGCDC::GetCharHeight(void) const { wxCoord height; DoGetTextExtent( wxT("g") , NULL , &height , NULL , NULL , NULL ); @@ -1041,33 +936,25 @@ wxCoord wxGCDCImpl::GetCharHeight(void) const return height; } -void wxGCDCImpl::Clear(void) +void wxGCDC::Clear(void) { - wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::Clear - invalid DC") ); + wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::Clear - invalid DC") ); // TODO better implementation / incorporate size info into wxGCDC or context m_graphicContext->SetBrush( m_backgroundBrush ); wxPen p = *wxTRANSPARENT_PEN; m_graphicContext->SetPen( p ); - wxCompositionMode formerMode = m_graphicContext->GetCompositionMode(); - m_graphicContext->SetCompositionMode(wxCOMPOSITION_SOURCE); - DoDrawRectangle( 0, 0, INT_MAX , INT_MAX ); - m_graphicContext->SetCompositionMode(formerMode); + DoDrawRectangle( 0, 0, 32000 , 32000 ); m_graphicContext->SetPen( m_pen ); m_graphicContext->SetBrush( m_brush ); } -void wxGCDCImpl::DoGetSize(int *width, int *height) const +void wxGCDC::DoGetSize(int *width, int *height) const { - wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoGetSize - invalid DC") ); - wxDouble w,h; - m_graphicContext->GetSize( &w, &h ); - if ( height ) - *height = (int) (h+0.5); - if ( width ) - *width = (int) (w+0.5); + *width = 10000; + *height = 10000; } -void wxGCDCImpl::DoGradientFillLinear(const wxRect& rect, +void wxGCDC::DoGradientFillLinear(const wxRect& rect, const wxColour& initialColour, const wxColour& destColour, wxDirection nDirection ) @@ -1108,10 +995,9 @@ void wxGCDCImpl::DoGradientFillLinear(const wxRect& rect, m_graphicContext->SetPen(*wxTRANSPARENT_PEN); m_graphicContext->DrawRectangle(rect.x,rect.y,rect.width,rect.height); m_graphicContext->SetPen(m_pen); - m_graphicContext->SetBrush(m_brush); } -void wxGCDCImpl::DoGradientFillConcentric(const wxRect& rect, +void wxGCDC::DoGradientFillConcentric(const wxRect& rect, const wxColour& initialColour, const wxColour& destColour, const wxPoint& circleCenter) @@ -1137,30 +1023,12 @@ void wxGCDCImpl::DoGradientFillConcentric(const wxRect& rect, m_graphicContext->DrawRectangle(rect.x,rect.y,rect.width,rect.height); m_graphicContext->SetPen(m_pen); - m_graphicContext->SetBrush(m_brush); } -void wxGCDCImpl::DoDrawCheckMark(wxCoord x, wxCoord y, +void wxGCDC::DoDrawCheckMark(wxCoord x, wxCoord y, wxCoord width, wxCoord height) { - wxDCImpl::DoDrawCheckMark(x,y,width,height); + wxDCBase::DoDrawCheckMark(x,y,width,height); } -#ifdef __WXMSW__ -wxRect wxGCDCImpl::MSWApplyGDIPlusTransform(const wxRect& r) const -{ - wxGraphicsContext* const gc = GetGraphicsContext(); - wxCHECK_MSG( gc, r, wxT("Invalid wxGCDC") ); - - double x = 0, - y = 0; - gc->GetTransform().TransformPoint(&x, &y); - - wxRect rect(r); - rect.Offset(x, y); - - return rect; -} -#endif // __WXMSW__ - #endif // wxUSE_GRAPHICS_CONTEXT diff --git a/Source/3rd Party/wx/src/common/dcsvg.cpp b/Source/3rd Party/wx/src/common/dcsvg.cpp deleted file mode 100644 index 5419f85e8..000000000 --- a/Source/3rd Party/wx/src/common/dcsvg.cpp +++ /dev/null @@ -1,671 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/svg.cpp -// Purpose: SVG sample -// Author: Chris Elliott -// Modified by: -// RCS-ID: $Id$ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - - -// For compilers that support precompilation, includes "wx/wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#if wxUSE_SVG - -#ifndef WX_PRECOMP - #include "wx/dcmemory.h" - #include "wx/dcscreen.h" - #include "wx/icon.h" - #include "wx/image.h" -#endif - -#include "wx/dcsvg.h" -#include "wx/wfstream.h" -#include "wx/filename.h" - -// ---------------------------------------------------------- -// Global utilities -// ---------------------------------------------------------- - -namespace -{ - -inline double DegToRad(double deg) { return (deg * M_PI) / 180.0; } - -// This function returns a string representation of a floating point number in -// C locale (i.e. always using "." for the decimal separator) and with the -// fixed precision (which is 2 for some unknown reason but this is what it was -// in this code originally). -inline wxString NumStr(double f) -{ - return wxString::FromCDouble(f, 2); -} - -// Return the colour representation as HTML-like "#rrggbb" string and also -// returns its alpha as opacity number in 0..1 range. -wxString Col2SVG(wxColour c, float *opacity) -{ - if ( c.Alpha() != wxALPHA_OPAQUE ) - { - *opacity = c.Alpha()/255.; - - // Remove the alpha before using GetAsString(wxC2S_HTML_SYNTAX) as it - // doesn't support colours with alpha channel. - c = wxColour(c.GetRGB()); - } - else // No alpha. - { - *opacity = 1.; - } - - return c.GetAsString(wxC2S_HTML_SYNTAX); -} - -wxString wxPenString(wxColour c, int style = wxPENSTYLE_SOLID) -{ - float opacity; - wxString s = wxT("stroke:") + Col2SVG(c, &opacity) + wxT("; "); - - switch ( style ) - { - case wxPENSTYLE_SOLID: - s += wxString::Format(wxT("stroke-opacity:%s; "), NumStr(opacity)); - break; - case wxPENSTYLE_TRANSPARENT: - s += wxT("stroke-opacity:0.0; "); - break; - default : - wxASSERT_MSG(false, wxT("wxSVGFileDC::Requested Pen Style not available")); - } - - return s; -} - -wxString wxBrushString(wxColour c, int style = wxBRUSHSTYLE_SOLID) -{ - float opacity; - wxString s = wxT("fill:") + Col2SVG(c, &opacity) + wxT("; "); - - switch ( style ) - { - case wxBRUSHSTYLE_SOLID: - s += wxString::Format(wxT("fill-opacity:%s; "), NumStr(opacity)); - break; - case wxBRUSHSTYLE_TRANSPARENT: - s += wxT("fill-opacity:0.0; "); - break; - default : - wxASSERT_MSG(false, wxT("wxSVGFileDC::Requested Brush Style not available")); - } - - return s; -} - -} // anonymous namespace - -// ---------------------------------------------------------- -// wxSVGFileDCImpl -// ---------------------------------------------------------- - -IMPLEMENT_ABSTRACT_CLASS(wxSVGFileDCImpl, wxDC) - -wxSVGFileDCImpl::wxSVGFileDCImpl( wxSVGFileDC *owner, const wxString &filename, - int width, int height, double dpi ) : - wxDCImpl( owner ) - { - Init( filename, width, height, dpi ); - } - -void wxSVGFileDCImpl::Init (const wxString &filename, int Width, int Height, double dpi) -{ - m_width = Width; - m_height = Height; - - m_dpi = dpi; - - m_OK = true; - - m_mm_to_pix_x = dpi/25.4; - m_mm_to_pix_y = dpi/25.4; - - m_backgroundBrush = *wxTRANSPARENT_BRUSH; - m_textForegroundColour = *wxBLACK; - m_textBackgroundColour = *wxWHITE; - m_colour = wxColourDisplay(); - - m_pen = *wxBLACK_PEN; - m_font = *wxNORMAL_FONT; - m_brush = *wxWHITE_BRUSH; - - m_graphics_changed = true; - - ////////////////////code here - - m_outfile = new wxFileOutputStream(filename); - m_OK = m_outfile->IsOk(); - if (m_OK) - { - m_filename = filename; - m_sub_images = 0; - wxString s; - s = wxT("") + wxString(wxT("\n")); - write(s); - s = wxT(" ") + wxString(wxT("\n")); - write(s); - s = wxT(" \n"), NumStr(float(Width)/dpi*2.54), NumStr(float(Height)/dpi*2.54), Width, Height ); - write(s); - s = wxT("SVG Picture created as ") + wxFileName(filename).GetFullName() + wxT(" ") + wxT("\n"); - write(s); - s = wxString (wxT("Picture generated by wxSVG ")) + wxSVGVersion + wxT(" ")+ wxT("\n"); - write(s); - s = wxT("") + wxString(wxT("\n")); - write(s); - } -} - -wxSVGFileDCImpl::~wxSVGFileDCImpl() -{ - wxString s = wxT(" \n \n"); - write(s); - delete m_outfile; -} - -void wxSVGFileDCImpl::DoGetSizeMM( int *width, int *height ) const -{ - if (width) - *width = wxRound( (double)m_width / m_mm_to_pix_x ); - - if (height) - *height = wxRound( (double)m_height / m_mm_to_pix_y ); -} - -wxSize wxSVGFileDCImpl::GetPPI() const -{ - return wxSize( wxRound(m_dpi), wxRound(m_dpi) ); -} - -void wxSVGFileDCImpl::DoDrawLine (wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) -{ - if (m_graphics_changed) NewGraphics(); - wxString s; - s.Printf ( wxT(" \n"), x1,y1,x2,y2 ); - if (m_OK) - { - write(s); - } - CalcBoundingBox(x1, y1); - CalcBoundingBox(x2, y2); -} - -void wxSVGFileDCImpl::DoDrawLines(int n, wxPoint points[], wxCoord xoffset , wxCoord yoffset ) -{ - for ( int i = 1; i < n; i++ ) - { - DoDrawLine ( points [i-1].x + xoffset, points [i-1].y + yoffset, - points [ i ].x + xoffset, points [ i ].y + yoffset ); - } -} - -void wxSVGFileDCImpl::DoDrawPoint (wxCoord x1, wxCoord y1) -{ - wxString s; - if (m_graphics_changed) NewGraphics(); - s = wxT(" ") + wxString(wxT("\n")); - write(s); - DoDrawLine ( x1,y1,x1,y1 ); - s = wxT(""); - write(s); -} - -void wxSVGFileDCImpl::DoDrawCheckMark(wxCoord x1, wxCoord y1, wxCoord width, wxCoord height) -{ - wxDCImpl::DoDrawCheckMark (x1,y1,width,height); -} - -void wxSVGFileDCImpl::DoDrawText(const wxString& text, wxCoord x1, wxCoord y1) -{ - DoDrawRotatedText(text, x1,y1,0.0); -} - -void wxSVGFileDCImpl::DoDrawRotatedText(const wxString& sText, wxCoord x, wxCoord y, double angle) -{ - //known bug; if the font is drawn in a scaled DC, it will not behave exactly as wxMSW - if (m_graphics_changed) NewGraphics(); - wxString s, sTmp; - - // calculate bounding box - wxCoord w, h, desc; - DoGetTextExtent(sText, &w, &h, &desc); - - double rad = DegToRad(angle); - - // wxT("upper left") and wxT("upper right") - CalcBoundingBox(x, y); - CalcBoundingBox((wxCoord)(x + w*cos(rad)), (wxCoord)(y - h*sin(rad))); - - // wxT("bottom left") and wxT("bottom right") - x += (wxCoord)(h*sin(rad)); - y += (wxCoord)(h*cos(rad)); - CalcBoundingBox(x, y); - CalcBoundingBox((wxCoord)(x + h*sin(rad)), (wxCoord)(y + h*cos(rad))); - - if (m_backgroundMode == wxBRUSHSTYLE_SOLID) - { - // draw background first - // just like DoDrawRectangle except we pass the text color to it and set the border to a 1 pixel wide text background - - sTmp.Printf ( wxT(" "), NumStr(-angle), x,y ); - s += sTmp + wxT("\n"); - write(s); - } - //now do the text itself - s.Printf (wxT(" 0) s += wxT("style=\"font-family:") + sTmp + wxT("; "); - else s += wxT("style=\" "); - - wxString fontweights [3] = { wxT("normal"), wxT("lighter"), wxT("bold") }; - s += wxT("font-weight:") + fontweights[m_font.GetWeight() - wxNORMAL] + wxT("; "); - - wxString fontstyles [5] = { wxT("normal"), wxT("style error"), wxT("style error"), wxT("italic"), wxT("oblique") }; - s += wxT("font-style:") + fontstyles[m_font.GetStyle() - wxNORMAL] + wxT("; "); - - sTmp.Printf (wxT("font-size:%dpt; "), m_font.GetPointSize() ); - s += sTmp; - //text will be solid, unless alpha value isn't opaque in the foreground colour - s += wxBrushString(m_textForegroundColour) + wxPenString(m_textForegroundColour); - sTmp.Printf ( wxT("stroke-width:0;\" transform=\"rotate( %s %d %d ) \" >"), NumStr(-angle), x,y ); - s += sTmp + sText + wxT(" ") + wxT("\n"); - if (m_OK) - { - write(s); - } -} - -void wxSVGFileDCImpl::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) -{ - DoDrawRoundedRectangle(x, y, width, height, 0); -} - -void wxSVGFileDCImpl::DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius ) - -{ - if (m_graphics_changed) NewGraphics(); - wxString s; - - s.Printf ( wxT(" \n"); - write(s); - - CalcBoundingBox(x, y); - CalcBoundingBox(x + width, y + height); -} - -void wxSVGFileDCImpl::DoDrawPolygon(int n, wxPoint points[], - wxCoord xoffset, wxCoord yoffset, - wxPolygonFillMode fillStyle) -{ - if (m_graphics_changed) NewGraphics(); - wxString s, sTmp; - s = wxT(" \n"); - write(s); -} - -void wxSVGFileDCImpl::DoDrawEllipse (wxCoord x, wxCoord y, wxCoord width, wxCoord height) - -{ - if (m_graphics_changed) NewGraphics(); - - int rh = height /2; - int rw = width /2; - - wxString s; - s.Printf ( wxT(" \n"); - - write(s); - - CalcBoundingBox(x, y); - CalcBoundingBox(x + width, y + height); -} - -void wxSVGFileDCImpl::DoDrawArc(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord xc, wxCoord yc) -{ - /* Draws an arc of a circle, centred on (xc, yc), with starting point - (x1, y1) and ending at (x2, y2). The current pen is used for the outline - and the current brush for filling the shape. - - The arc is drawn in an anticlockwise direction from the start point to - the end point. - - Might be better described as Pie drawing */ - - if (m_graphics_changed) NewGraphics(); - wxString s; - - // we need the radius of the circle which has two estimates - double r1 = sqrt ( double( (x1-xc)*(x1-xc) ) + double( (y1-yc)*(y1-yc) ) ); - double r2 = sqrt ( double( (x2-xc)*(x2-xc) ) + double( (y2-yc)*(y2-yc) ) ); - - wxASSERT_MSG( (fabs ( r2-r1 ) <= 3), wxT("wxSVGFileDC::DoDrawArc Error in getting radii of circle")); - if ( fabs ( r2-r1 ) > 3 ) //pixels - { - s = wxT(" \n"); - write(s); - } - - double theta1 = atan2((double)(yc-y1),(double)(x1-xc)); - if ( theta1 < 0 ) theta1 = theta1 + M_PI * 2; - double theta2 = atan2((double)(yc-y2), (double)(x2-xc)); - if ( theta2 < 0 ) theta2 = theta2 + M_PI * 2; - if ( theta2 < theta1 ) theta2 = theta2 + M_PI *2; - - int fArc; // flag for large or small arc 0 means less than 180 degrees - if ( fabs(theta2 - theta1) > M_PI ) fArc = 1; else fArc = 0; - - int fSweep = 0; // flag for sweep always 0 - - s.Printf ( wxT(" \n"); - - - if (m_OK) - { - write(s); - } -} - -void wxSVGFileDCImpl::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea) -{ - /* - Draws an arc of an ellipse. The current pen is used for drawing the arc - and the current brush is used for drawing the pie. This function is - currently only available for X window and PostScript device contexts. - - x and y specify the x and y coordinates of the upper-left corner of the - rectangle that contains the ellipse. - - width and height specify the width and height of the rectangle that - contains the ellipse. - - start and end specify the start and end of the arc relative to the - three-o'clock position from the center of the rectangle. Angles are - specified in degrees (360 is a complete circle). Positive values mean - counter-clockwise motion. If start is equal to end, a complete ellipse - will be drawn. */ - - //known bug: SVG draws with the current pen along the radii, but this does not happen in wxMSW - - if (m_graphics_changed) NewGraphics(); - - wxString s; - //radius - double rx = w / 2; - double ry = h / 2; - // center - double xc = x + rx; - double yc = y + ry; - - double xs, ys, xe, ye; - xs = xc + rx * cos (DegToRad(sa)); - xe = xc + rx * cos (DegToRad(ea)); - ys = yc - ry * sin (DegToRad(sa)); - ye = yc - ry * sin (DegToRad(ea)); - - ///now same as circle arc... - - double theta1 = atan2(ys-yc, xs-xc); - double theta2 = atan2(ye-yc, xe-xc); - - int fArc; // flag for large or small arc 0 means less than 180 degrees - if ( (theta2 - theta1) > 0 ) fArc = 1; else fArc = 0; - - int fSweep; - if ( fabs(theta2 - theta1) > M_PI) fSweep = 1; else fSweep = 0; - - s.Printf ( wxT(" \n"); - - if (m_OK) - { - write(s); - } -} - -void wxSVGFileDCImpl::DoGetTextExtent(const wxString& string, wxCoord *w, wxCoord *h, wxCoord *descent , wxCoord *externalLeading , const wxFont *font) const - -{ - wxScreenDC sDC; - - sDC.SetFont (m_font); - if ( font != NULL ) sDC.SetFont ( *font ); - sDC.GetTextExtent(string, w, h, descent, externalLeading ); -} - -wxCoord wxSVGFileDCImpl::GetCharHeight() const -{ - wxScreenDC sDC; - sDC.SetFont (m_font); - - return sDC.GetCharHeight(); - -} - -wxCoord wxSVGFileDCImpl::GetCharWidth() const -{ - wxScreenDC sDC; - sDC.SetFont (m_font); - - return sDC.GetCharWidth(); -} - - -// ---------------------------------------------------------- -// wxSVGFileDCImpl - set functions -// ---------------------------------------------------------- - -void wxSVGFileDCImpl::SetBackground( const wxBrush &brush ) -{ - m_backgroundBrush = brush; -} - - -void wxSVGFileDCImpl::SetBackgroundMode( int mode ) -{ - m_backgroundMode = mode; -} - - -void wxSVGFileDCImpl::SetBrush(const wxBrush& brush) - -{ - m_brush = brush; - - m_graphics_changed = true; -} - - -void wxSVGFileDCImpl::SetPen(const wxPen& pen) -{ - // width, color, ends, joins : currently implemented - // dashes, stipple : not implemented - m_pen = pen; - - m_graphics_changed = true; -} - -void wxSVGFileDCImpl::NewGraphics() -{ - wxString s, sBrush, sPenCap, sPenJoin, sPenStyle, sLast, sWarn; - - sBrush = wxT("\n"), - m_pen.GetWidth(), NumStr(m_logicalOriginX), NumStr(m_logicalOriginY), NumStr(m_scaleX), NumStr(m_scaleY) ); - - s = sBrush + sPenCap + sPenJoin + sPenStyle + sLast + wxT("\n") + sWarn; - write(s); - m_graphics_changed = false; -} - - -void wxSVGFileDCImpl::SetFont(const wxFont& font) - -{ - m_font = font; -} - -// export a bitmap as a raster image in png -bool wxSVGFileDCImpl::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, - wxDC* source, wxCoord xsrc, wxCoord ysrc, - wxRasterOperationMode logicalFunc /*= wxCOPY*/, bool useMask /*= false*/, - wxCoord /*xsrcMask = -1*/, wxCoord /*ysrcMask = -1*/) -{ - if (logicalFunc != wxCOPY) - { - wxASSERT_MSG(false, wxT("wxSVGFileDC::DoBlit Call requested nonCopy mode; this is not possible")); - return false; - } - if (useMask != false) - { - wxASSERT_MSG(false, wxT("wxSVGFileDC::DoBlit Call requested false mask; this is not possible")); - return false; - } - wxBitmap myBitmap (width, height); - wxMemoryDC memDC; - memDC.SelectObject( myBitmap ); - memDC.Blit(0, 0, width, height, source, xsrc, ysrc); - memDC.SelectObject( wxNullBitmap ); - DoDrawBitmap(myBitmap, xdest, ydest); - return false; -} - -void wxSVGFileDCImpl::DoDrawIcon(const class wxIcon & myIcon, wxCoord x, wxCoord y) -{ - wxBitmap myBitmap (myIcon.GetWidth(), myIcon.GetHeight() ); - wxMemoryDC memDC; - memDC.SelectObject( myBitmap ); - memDC.DrawIcon(myIcon,0,0); - memDC.SelectObject( wxNullBitmap ); - DoDrawBitmap(myBitmap, x, y); -} - -void wxSVGFileDCImpl::DoDrawBitmap(const class wxBitmap & bmp, wxCoord x, wxCoord y , bool WXUNUSED(bTransparent) /*=0*/ ) -{ - if (m_graphics_changed) NewGraphics(); - - wxString sTmp, s, sPNG; - if ( wxImage::FindHandler(wxBITMAP_TYPE_PNG) == NULL ) - wxImage::AddHandler(new wxPNGHandler); - -// create suitable file name - sTmp.Printf ( wxT("_image%d.png"), m_sub_images); - sPNG = m_filename.BeforeLast(wxT('.')) + sTmp; - while (wxFile::Exists(sPNG) ) - { - m_sub_images ++; - sTmp.Printf ( wxT("_image%d.png"), m_sub_images); - sPNG = m_filename.BeforeLast(wxT('.')) + sTmp; - } - -//create copy of bitmap (wxGTK doesn't like saving a constant bitmap) - wxBitmap myBitmap = bmp; -//save it - bool bPNG_OK = myBitmap.SaveFile(sPNG,wxBITMAP_TYPE_PNG); - -// reference the bitmap from the SVG doc -// only use filename & ext - sPNG = sPNG.AfterLast(wxFileName::GetPathSeparator()); - -// reference the bitmap from the SVG doc - int w = myBitmap.GetWidth(); - int h = myBitmap.GetHeight(); - sTmp.Printf ( wxT(" \n"), sPNG.c_str() ); - s += sTmp + wxT("Image from wxSVG ") + wxT("\n"); - - if (m_OK && bPNG_OK) - { - write(s); - } - m_OK = m_outfile->IsOk() && bPNG_OK; -} - -void wxSVGFileDCImpl::write(const wxString &s) -{ - const wxCharBuffer buf = s.utf8_str(); - m_outfile->Write(buf, strlen((const char *)buf)); - m_OK = m_outfile->IsOk(); -} - - -#ifdef __BORLANDC__ -#pragma warn .rch -#pragma warn .ccc -#endif - -#endif // wxUSE_SVG - diff --git a/Source/3rd Party/wx/src/common/dircmn.cpp b/Source/3rd Party/wx/src/common/dircmn.cpp index 50815f09c..2e2b24a34 100644 --- a/Source/3rd Party/wx/src/common/dircmn.cpp +++ b/Source/3rd Party/wx/src/common/dircmn.cpp @@ -4,9 +4,9 @@ // Author: Vadim Zeitlin // Modified by: // Created: 19.05.01 -// RCS-ID: $Id$ +// RCS-ID: $Id: dircmn.cpp 40665 2006-08-19 08:45:31Z JS $ // Copyright: (c) 2001 Vadim Zeitlin -// Licence: wxWindows licence +// License: wxWindows licence /////////////////////////////////////////////////////////////////////////////// // ============================================================================ @@ -55,16 +55,16 @@ wxDirTraverser::OnOpenError(const wxString& WXUNUSED(dirname)) // dumb generic implementation -bool wxDir::HasFiles(const wxString& spec) const +bool wxDir::HasFiles(const wxString& spec) { wxString s; return GetFirst(&s, spec, wxDIR_FILES | wxDIR_HIDDEN); } // we have a (much) faster version for Unix -#if (defined(__CYGWIN__) && defined(__WINDOWS__)) || !defined(__UNIX_LIKE__) || defined(__EMX__) || defined(__WINE__) +#if (defined(__CYGWIN__) && defined(__WINDOWS__)) || !defined(__UNIX_LIKE__) || defined(__WXMAC__) || defined(__EMX__) || defined(__WINE__) -bool wxDir::HasSubDirs(const wxString& spec) const +bool wxDir::HasSubDirs(const wxString& spec) { wxString s; return GetFirst(&s, spec, wxDIR_DIRS | wxDIR_HIDDEN); @@ -72,28 +72,6 @@ bool wxDir::HasSubDirs(const wxString& spec) const #endif // !Unix -// ---------------------------------------------------------------------------- -// wxDir::GetNameWithSep() -// ---------------------------------------------------------------------------- - -wxString wxDir::GetNameWithSep() const -{ - // Note that for historical reasons (i.e. because GetName() was there - // first) we implement this one in terms of GetName() even though it might - // actually make more sense to reverse this logic. - - wxString name = GetName(); - if ( !name.empty() ) - { - // Notice that even though GetName() isn't supposed to return the - // separator, it can still be present for the root directory name. - if ( name.Last() != wxFILE_SEP_PATH ) - name += wxFILE_SEP_PATH; - } - - return name; -} - // ---------------------------------------------------------------------------- // wxDir::Traverse() // ---------------------------------------------------------------------------- @@ -103,13 +81,14 @@ size_t wxDir::Traverse(wxDirTraverser& sink, int flags) const { wxCHECK_MSG( IsOpened(), (size_t)-1, - wxT("dir must be opened before traversing it") ); + _T("dir must be opened before traversing it") ); // the total number of files found size_t nFiles = 0; // the name of this dir with path delimiter at the end - const wxString prefix = GetNameWithSep(); + wxString prefix = GetName(); + prefix += wxFILE_SEP_PATH; // first, recurse into subdirs if ( flags & wxDIR_DIRS ) @@ -124,7 +103,7 @@ size_t wxDir::Traverse(wxDirTraverser& sink, switch ( sink.OnDir(fulldirname) ) { default: - wxFAIL_MSG(wxT("unexpected OnDir() return value") ); + wxFAIL_MSG(_T("unexpected OnDir() return value") ); // fall through case wxDIR_STOP: @@ -152,7 +131,7 @@ size_t wxDir::Traverse(wxDirTraverser& sink, switch ( sink.OnOpenError(fulldirname) ) { default: - wxFAIL_MSG(wxT("unexpected OnOpenError() return value") ); + wxFAIL_MSG(_T("unexpected OnOpenError() return value") ); // fall through case wxDIR_STOP: @@ -201,7 +180,7 @@ size_t wxDir::Traverse(wxDirTraverser& sink, break; wxASSERT_MSG( res == wxDIR_CONTINUE, - wxT("unexpected OnFile() return value") ); + _T("unexpected OnFile() return value") ); nFiles++; @@ -235,7 +214,7 @@ public: private: wxArrayString& m_files; - wxDECLARE_NO_COPY_CLASS(wxDirTraverserSimple); + DECLARE_NO_COPY_CLASS(wxDirTraverserSimple) }; /* static */ @@ -244,7 +223,7 @@ size_t wxDir::GetAllFiles(const wxString& dirname, const wxString& filespec, int flags) { - wxCHECK_MSG( files, (size_t)-1, wxT("NULL pointer in wxDir::GetAllFiles") ); + wxCHECK_MSG( files, (size_t)-1, _T("NULL pointer in wxDir::GetAllFiles") ); size_t nFiles = 0; @@ -287,7 +266,7 @@ public: private: wxString m_file; - wxDECLARE_NO_COPY_CLASS(wxDirTraverserFindFirst); + DECLARE_NO_COPY_CLASS(wxDirTraverserFindFirst) }; /* static */ @@ -312,8 +291,6 @@ wxString wxDir::FindFirst(const wxString& dirname, // wxDir::GetTotalSize() // ---------------------------------------------------------------------------- -#if wxUSE_LONGLONG - class wxDirTraverserSumSize : public wxDirTraverser { public: @@ -321,11 +298,11 @@ public: virtual wxDirTraverseResult OnFile(const wxString& filename) { + wxULongLong sz = wxFileName::GetSize(filename); + // wxFileName::GetSize won't use this class again as // we're passing it a file and not a directory; // thus we are sure to avoid an endless loop - wxULongLong sz = wxFileName::GetSize(filename); - if (sz == wxInvalidSize) { // if the GetSize() failed (this can happen because e.g. a @@ -348,7 +325,7 @@ public: wxULongLong GetTotalSize() const { return m_sz; } - const wxArrayString& GetSkippedFiles() const + wxArrayString &FilesSkipped() { return m_skippedFiles; } protected: @@ -368,36 +345,13 @@ wxULongLong wxDir::GetTotalSize(const wxString &dirname, wxArrayString *filesSki return wxInvalidSize; wxDirTraverserSumSize traverser; - if (dir.Traverse(traverser) == (size_t)-1 ) + if (dir.Traverse(traverser) == (size_t)-1 || + traverser.GetTotalSize() == 0) return wxInvalidSize; if (filesSkipped) - *filesSkipped = traverser.GetSkippedFiles(); + *filesSkipped = traverser.FilesSkipped(); return traverser.GetTotalSize(); } -#endif // wxUSE_LONGLONG - -// ---------------------------------------------------------------------------- -// wxDir helpers -// ---------------------------------------------------------------------------- - -/* static */ -bool wxDir::Exists(const wxString& dir) -{ - return wxFileName::DirExists(dir); -} - -/* static */ -bool wxDir::Make(const wxString &dir, int perm, int flags) -{ - return wxFileName::Mkdir(dir, perm, flags); -} - -/* static */ -bool wxDir::Remove(const wxString &dir, int flags) -{ - return wxFileName::Rmdir(dir, flags); -} - diff --git a/Source/3rd Party/wx/src/common/dirctrlcmn.cpp b/Source/3rd Party/wx/src/common/dirctrlcmn.cpp deleted file mode 100644 index 326044c66..000000000 --- a/Source/3rd Party/wx/src/common/dirctrlcmn.cpp +++ /dev/null @@ -1,89 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/dirctrlcmn.cpp -// Purpose: wxGenericDirCtrl common code -// Author: Harm van der Heijden, Robert Roebling, Julian Smart -// Modified by: -// Created: 12/12/98 -// RCS-ID: $Id$ -// Copyright: (c) Harm van der Heijden, Robert Roebling and Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_DIRDLG || wxUSE_FILEDLG - -#include "wx/generic/dirctrlg.h" - -extern WXDLLEXPORT_DATA(const char) wxDirDialogNameStr[] = "wxDirCtrl"; -extern WXDLLEXPORT_DATA(const char) wxDirDialogDefaultFolderStr[] = "/"; -extern WXDLLEXPORT_DATA(const char) wxDirSelectorPromptStr[] = "Select a directory"; - -//----------------------------------------------------------------------------- -// XTI -//----------------------------------------------------------------------------- - -wxDEFINE_FLAGS( wxGenericDirCtrlStyle ) -wxBEGIN_FLAGS( wxGenericDirCtrlStyle ) - // new style border flags, we put them first to - // use them for streaming out - wxFLAGS_MEMBER(wxBORDER_SIMPLE) - wxFLAGS_MEMBER(wxBORDER_SUNKEN) - wxFLAGS_MEMBER(wxBORDER_DOUBLE) - wxFLAGS_MEMBER(wxBORDER_RAISED) - wxFLAGS_MEMBER(wxBORDER_STATIC) - wxFLAGS_MEMBER(wxBORDER_NONE) - - // old style border flags - wxFLAGS_MEMBER(wxSIMPLE_BORDER) - wxFLAGS_MEMBER(wxSUNKEN_BORDER) - wxFLAGS_MEMBER(wxDOUBLE_BORDER) - wxFLAGS_MEMBER(wxRAISED_BORDER) - wxFLAGS_MEMBER(wxSTATIC_BORDER) - wxFLAGS_MEMBER(wxBORDER) - - // standard window styles - wxFLAGS_MEMBER(wxTAB_TRAVERSAL) - wxFLAGS_MEMBER(wxCLIP_CHILDREN) - wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW) - wxFLAGS_MEMBER(wxWANTS_CHARS) - wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE) - wxFLAGS_MEMBER(wxALWAYS_SHOW_SB ) - wxFLAGS_MEMBER(wxVSCROLL) - wxFLAGS_MEMBER(wxHSCROLL) - - wxFLAGS_MEMBER(wxDIRCTRL_DIR_ONLY) - wxFLAGS_MEMBER(wxDIRCTRL_3D_INTERNAL) - wxFLAGS_MEMBER(wxDIRCTRL_SELECT_FIRST) - wxFLAGS_MEMBER(wxDIRCTRL_SHOW_FILTERS) -wxEND_FLAGS( wxGenericDirCtrlStyle ) - -wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxGenericDirCtrl, wxControl, "wx/dirctrl.h") - -wxBEGIN_PROPERTIES_TABLE(wxGenericDirCtrl) - wxHIDE_PROPERTY( Children ) - - wxPROPERTY( DefaultPath, wxString, SetDefaultPath, GetDefaultPath, \ - wxEMPTY_PARAMETER_VALUE, 0 /*flags*/, wxT("Helpstring"), wxT("group")) - wxPROPERTY( Filter, wxString, SetFilter, GetFilter, wxEMPTY_PARAMETER_VALUE, \ - 0 /*flags*/, wxT("Helpstring"), wxT("group") ) - wxPROPERTY( DefaultFilter, int, SetFilterIndex, GetFilterIndex, \ - wxEMPTY_PARAMETER_VALUE, 0 /*flags*/, wxT("Helpstring"), wxT("group") ) - - wxPROPERTY_FLAGS( WindowStyle, wxGenericDirCtrlStyle, long, SetWindowStyleFlag, \ - GetWindowStyleFlag, wxEMPTY_PARAMETER_VALUE, 0, wxT("Helpstring"), \ - wxT("group") ) -wxEND_PROPERTIES_TABLE() - -wxEMPTY_HANDLERS_TABLE(wxGenericDirCtrl) - -wxCONSTRUCTOR_8( wxGenericDirCtrl, wxWindow*, Parent, wxWindowID, Id, \ - wxString, DefaultPath, wxPoint, Position, wxSize, Size, \ - long, WindowStyle, wxString, Filter, int, DefaultFilter ) - -#endif // wxUSE_DIRDLG || wxUSE_FILEDLG diff --git a/Source/3rd Party/wx/src/common/dlgcmn.cpp b/Source/3rd Party/wx/src/common/dlgcmn.cpp index a5d4a74bc..f119b8601 100644 --- a/Source/3rd Party/wx/src/common/dlgcmn.cpp +++ b/Source/3rd Party/wx/src/common/dlgcmn.cpp @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 28.06.99 -// RCS-ID: $Id$ +// RCS-ID: $Id: dlgcmn.cpp 49747 2007-11-09 15:06:52Z JS $ // Copyright: (c) Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -27,7 +27,6 @@ #include "wx/dialog.h" #ifndef WX_PRECOMP - #include "wx/app.h" #include "wx/button.h" #include "wx/dcclient.h" #include "wx/intl.h" @@ -39,76 +38,61 @@ #include "wx/statline.h" #include "wx/sysopt.h" -#include "wx/module.h" -#include "wx/bookctrl.h" -#include "wx/scrolwin.h" -#include "wx/textwrapper.h" -#if wxUSE_DISPLAY -#include "wx/display.h" -#endif - -extern WXDLLEXPORT_DATA(const char) wxDialogNameStr[] = "dialog"; +#if wxUSE_STATTEXT // ---------------------------------------------------------------------------- -// XTI +// wxTextWrapper // ---------------------------------------------------------------------------- -wxDEFINE_FLAGS( wxDialogStyle ) -wxBEGIN_FLAGS( wxDialogStyle ) -// new style border flags, we put them first to -// use them for streaming out -wxFLAGS_MEMBER(wxBORDER_SIMPLE) -wxFLAGS_MEMBER(wxBORDER_SUNKEN) -wxFLAGS_MEMBER(wxBORDER_DOUBLE) -wxFLAGS_MEMBER(wxBORDER_RAISED) -wxFLAGS_MEMBER(wxBORDER_STATIC) -wxFLAGS_MEMBER(wxBORDER_NONE) +// this class is used to wrap the text on word boundary: wrapping is done by +// calling OnStartLine() and OnOutputLine() functions +class wxTextWrapper +{ +public: + wxTextWrapper() { m_eol = false; } -// old style border flags -wxFLAGS_MEMBER(wxSIMPLE_BORDER) -wxFLAGS_MEMBER(wxSUNKEN_BORDER) -wxFLAGS_MEMBER(wxDOUBLE_BORDER) -wxFLAGS_MEMBER(wxRAISED_BORDER) -wxFLAGS_MEMBER(wxSTATIC_BORDER) -wxFLAGS_MEMBER(wxNO_BORDER) + // win is used for getting the font, text is the text to wrap, width is the + // max line width or -1 to disable wrapping + void Wrap(wxWindow *win, const wxString& text, int widthMax); -// standard window styles -wxFLAGS_MEMBER(wxTAB_TRAVERSAL) -wxFLAGS_MEMBER(wxCLIP_CHILDREN) + // we don't need it, but just to avoid compiler warnings + virtual ~wxTextWrapper() { } -// dialog styles -wxFLAGS_MEMBER(wxWS_EX_VALIDATE_RECURSIVELY) -wxFLAGS_MEMBER(wxSTAY_ON_TOP) -wxFLAGS_MEMBER(wxCAPTION) -#if WXWIN_COMPATIBILITY_2_6 -wxFLAGS_MEMBER(wxTHICK_FRAME) -#endif // WXWIN_COMPATIBILITY_2_6 -wxFLAGS_MEMBER(wxSYSTEM_MENU) -wxFLAGS_MEMBER(wxRESIZE_BORDER) -#if WXWIN_COMPATIBILITY_2_6 -wxFLAGS_MEMBER(wxRESIZE_BOX) -#endif // WXWIN_COMPATIBILITY_2_6 -wxFLAGS_MEMBER(wxCLOSE_BOX) -wxFLAGS_MEMBER(wxMAXIMIZE_BOX) -wxFLAGS_MEMBER(wxMINIMIZE_BOX) -wxEND_FLAGS( wxDialogStyle ) +protected: + // line may be empty + virtual void OnOutputLine(const wxString& line) = 0; -wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxDialog, wxTopLevelWindow, "wx/dialog.h") + // called at the start of every new line (except the very first one) + virtual void OnNewLine() { } -wxBEGIN_PROPERTIES_TABLE(wxDialog) -wxPROPERTY( Title, wxString, SetTitle, GetTitle, wxString(), \ - 0 /*flags*/, wxT("Helpstring"), wxT("group")) +private: + // call OnOutputLine() and set m_eol to true + void DoOutputLine(const wxString& line) + { + OnOutputLine(line); -wxPROPERTY_FLAGS( WindowStyle, wxDialogStyle, long, SetWindowStyleFlag, \ - GetWindowStyleFlag, wxEMPTY_PARAMETER_VALUE, 0 /*flags*/, \ - wxT("Helpstring"), wxT("group")) // style -wxEND_PROPERTIES_TABLE() + m_eol = true; + } -wxEMPTY_HANDLERS_TABLE(wxDialog) + // this function is a destructive inspector: when it returns true it also + // resets the flag to false so calling it again woulnd't return true any + // more + bool IsStartOfNewLine() + { + if ( !m_eol ) + return false; -wxCONSTRUCTOR_6( wxDialog, wxWindow*, Parent, wxWindowID, Id, \ - wxString, Title, wxPoint, Position, wxSize, Size, long, WindowStyle) + m_eol = false; + + return true; + } + + + bool m_eol; +}; + +#endif // wxUSE_STATTEXT // ---------------------------------------------------------------------------- // wxDialogBase @@ -120,100 +104,119 @@ BEGIN_EVENT_TABLE(wxDialogBase, wxTopLevelWindow) EVT_CLOSE(wxDialogBase::OnCloseWindow) EVT_CHAR_HOOK(wxDialogBase::OnCharHook) + + WX_EVENT_TABLE_CONTROL_CONTAINER(wxDialogBase) END_EVENT_TABLE() -wxDialogLayoutAdapter* wxDialogBase::sm_layoutAdapter = NULL; -bool wxDialogBase::sm_layoutAdaptation = false; +WX_DELEGATE_TO_CONTROL_CONTAINER(wxDialogBase, wxTopLevelWindow) void wxDialogBase::Init() { m_returnCode = 0; m_affirmativeId = wxID_OK; m_escapeId = wxID_ANY; - m_layoutAdaptationLevel = 3; - m_layoutAdaptationDone = FALSE; - m_layoutAdaptationMode = wxDIALOG_ADAPTATION_MODE_DEFAULT; // the dialogs have this flag on by default to prevent the events from the // dialog controls from reaching the parent frame which is usually // undesirable and can lead to unexpected and hard to find bugs SetExtraStyle(GetExtraStyle() | wxWS_EX_BLOCK_EVENTS); -} -wxWindow *wxDialogBase::CheckIfCanBeUsedAsParent(wxWindow *parent) const -{ - if ( !parent ) - return NULL; - - extern WXDLLIMPEXP_DATA_BASE(wxList) wxPendingDelete; - if ( wxPendingDelete.Member(parent) || parent->IsBeingDeleted() ) - { - // this window is being deleted and we shouldn't create any children - // under it - return NULL; - } - - if ( parent->HasExtraStyle(wxWS_EX_TRANSIENT) ) - { - // this window is not being deleted yet but it's going to disappear - // soon so still don't parent this window under it - return NULL; - } - - if ( !parent->IsShownOnScreen() ) - { - // using hidden parent won't work correctly neither - return NULL; - } - - // FIXME-VC6: this compiler requires an explicit const cast or it fails - // with error C2446 - if ( const_cast(parent) == this ) - { - // not sure if this can really happen but it doesn't hurt to guard - // against this clearly invalid situation - return NULL; - } - - return parent; -} - -wxWindow * -wxDialogBase::GetParentForModalDialog(wxWindow *parent, long style) const -{ - // creating a parent-less modal dialog will result (under e.g. wxGTK2) - // in an unfocused dialog, so try to find a valid parent for it unless we - // were explicitly asked not to - if ( style & wxDIALOG_NO_PARENT ) - return NULL; - - // first try the given parent - if ( parent ) - parent = CheckIfCanBeUsedAsParent(wxGetTopLevelParent(parent)); - - // then the currently active window - if ( !parent ) - parent = CheckIfCanBeUsedAsParent( - wxGetTopLevelParent(wxGetActiveWindow())); - - // and finally the application main window - if ( !parent ) - parent = CheckIfCanBeUsedAsParent(wxTheApp->GetTopWindow()); - - return parent; + m_container.SetContainerWindow(this); } #if wxUSE_STATTEXT -wxSizer *wxDialogBase::CreateTextSizer(const wxString& message) +void wxTextWrapper::Wrap(wxWindow *win, const wxString& text, int widthMax) { - wxTextSizerWrapper wrapper(this); + const wxChar *lastSpace = NULL; + wxString line; - return CreateTextSizer(message, wrapper); + const wxChar *lineStart = text.c_str(); + for ( const wxChar *p = lineStart; ; p++ ) + { + if ( IsStartOfNewLine() ) + { + OnNewLine(); + + lastSpace = NULL; + line.clear(); + lineStart = p; + } + + if ( *p == _T('\n') || *p == _T('\0') ) + { + DoOutputLine(line); + + if ( *p == _T('\0') ) + break; + } + else // not EOL + { + if ( *p == _T(' ') ) + lastSpace = p; + + line += *p; + + if ( widthMax >= 0 && lastSpace ) + { + int width; + win->GetTextExtent(line, &width, NULL); + + if ( width > widthMax ) + { + // remove the last word from this line + line.erase(lastSpace - lineStart, p + 1 - lineStart); + DoOutputLine(line); + + // go back to the last word of this line which we didn't + // output yet + p = lastSpace; + } + } + //else: no wrapping at all or impossible to wrap + } + } } -wxSizer *wxDialogBase::CreateTextSizer(const wxString& message, - wxTextSizerWrapper& wrapper) +class wxTextSizerWrapper : public wxTextWrapper +{ +public: + wxTextSizerWrapper(wxWindow *win) + { + m_win = win; + m_hLine = 0; + } + + wxSizer *CreateSizer(const wxString& text, int widthMax) + { + m_sizer = new wxBoxSizer(wxVERTICAL); + Wrap(m_win, text, widthMax); + return m_sizer; + } + +protected: + virtual void OnOutputLine(const wxString& line) + { + if ( !line.empty() ) + { + m_sizer->Add(new wxStaticText(m_win, wxID_ANY, line)); + } + else // empty line, no need to create a control for it + { + if ( !m_hLine ) + m_hLine = m_win->GetCharHeight(); + + m_sizer->Add(5, m_hLine); + } + } + +private: + wxWindow *m_win; + wxSizer *m_sizer; + int m_hLine; +}; + +wxSizer *wxDialogBase::CreateTextSizer(const wxString& message) { // I admit that this is complete bogus, but it makes // message boxes work for pda screens temporarily.. @@ -224,13 +227,62 @@ wxSizer *wxDialogBase::CreateTextSizer(const wxString& message, widthMax = wxSystemSettings::GetMetric( wxSYS_SCREEN_X ) - 25; } - return wrapper.CreateSizer(message, widthMax); + // '&' is used as accel mnemonic prefix in the wxWidgets controls but in + // the static messages created by CreateTextSizer() (used by wxMessageBox, + // for example), we don't want this special meaning, so we need to quote it + wxString text(message); + text.Replace(_T("&"), _T("&&")); + + wxTextSizerWrapper wrapper(this); + + return wrapper.CreateSizer(text, widthMax); +} + +class wxLabelWrapper : public wxTextWrapper +{ +public: + void WrapLabel(wxWindow *text, int widthMax) + { + m_text.clear(); + Wrap(text, text->GetLabel(), widthMax); + text->SetLabel(m_text); + } + +protected: + virtual void OnOutputLine(const wxString& line) + { + m_text += line; + } + + virtual void OnNewLine() + { + m_text += _T('\n'); + } + +private: + wxString m_text; +}; + +// NB: don't "factor out" the scope operator, SGI MIPSpro 7.3 (but not 7.4) +// gets confused if it doesn't immediately follow the class name +void +#if defined(__WXGTK__) && !defined(__WXUNIVERSAL__) +wxStaticText:: +#else +wxStaticTextBase:: +#endif +Wrap(int width) +{ + wxLabelWrapper wrapper; + wrapper.WrapLabel(this, width); } #endif // wxUSE_STATTEXT wxSizer *wxDialogBase::CreateButtonSizer(long flags) { + wxSizer *sizer = NULL; + #ifdef __SMARTPHONE__ wxDialog* dialog = (wxDialog*) this; if ( flags & wxOK ) @@ -244,8 +296,6 @@ wxSizer *wxDialogBase::CreateButtonSizer(long flags) if ( flags & wxNO ) dialog->SetRightMenu(wxID_NO); - - return NULL; #else // !__SMARTPHONE__ #if wxUSE_BUTTON @@ -259,23 +309,21 @@ wxSizer *wxDialogBase::CreateButtonSizer(long flags) wxSystemOptions::GetOptionInt(wxT("wince.dialog.real-ok-cancel")) ) #endif // __POCKETPC__ { - return CreateStdDialogButtonSizer(flags); + sizer = CreateStdDialogButtonSizer(flags); } -#ifdef __POCKETPC__ - return NULL; -#endif // __POCKETPC__ - -#else // !wxUSE_BUTTON - wxUnusedVar(flags); - - return NULL; -#endif // wxUSE_BUTTON/!wxUSE_BUTTON +#endif // wxUSE_BUTTON #endif // __SMARTPHONE__/!__SMARTPHONE__ + + return sizer; } -wxSizer *wxDialogBase::CreateSeparatedSizer(wxSizer *sizer) +wxSizer *wxDialogBase::CreateSeparatedButtonSizer(long flags) { + wxSizer *sizer = CreateButtonSizer(flags); + if ( !sizer ) + return NULL; + // Mac Human Interface Guidelines recommend not to use static lines as // grouping elements #if wxUSE_STATLINE && !defined(__WXMAC__) @@ -289,15 +337,6 @@ wxSizer *wxDialogBase::CreateSeparatedSizer(wxSizer *sizer) return sizer; } -wxSizer *wxDialogBase::CreateSeparatedButtonSizer(long flags) -{ - wxSizer *sizer = CreateButtonSizer(flags); - if ( !sizer ) - return NULL; - - return CreateSeparatedSizer(sizer); -} - #if wxUSE_BUTTON wxStdDialogButtonSizer *wxDialogBase::CreateStdDialogButtonSizer( long flags ) @@ -332,18 +371,6 @@ wxStdDialogButtonSizer *wxDialogBase::CreateStdDialogButtonSizer( long flags ) sizer->AddButton(no); } - if (flags & wxAPPLY) - { - wxButton *apply = new wxButton(this, wxID_APPLY); - sizer->AddButton(apply); - } - - if (flags & wxCLOSE) - { - wxButton *close = new wxButton(this, wxID_CLOSE); - sizer->AddButton(close); - } - if (flags & wxHELP) { wxButton *help = new wxButton(this, wxID_HELP); @@ -433,32 +460,6 @@ bool wxDialogBase::EmulateButtonClickIfPresent(int id) #endif // wxUSE_BUTTON/!wxUSE_BUTTON } -bool wxDialogBase::SendCloseButtonClickEvent() -{ - int idCancel = GetEscapeId(); - switch ( idCancel ) - { - case wxID_NONE: - // The user doesn't want this dialog to close "implicitly". - break; - - case wxID_ANY: - // this value is special: it means translate Esc to wxID_CANCEL - // but if there is no such button, then fall back to wxID_OK - if ( EmulateButtonClickIfPresent(wxID_CANCEL) ) - return true; - idCancel = GetAffirmativeId(); - // fall through - - default: - // translate Esc to button press for the button with given id - if ( EmulateButtonClickIfPresent(idCancel) ) - return true; - } - - return false; -} - bool wxDialogBase::IsEscapeKey(const wxKeyEvent& event) { // for most platforms, Esc key is used to close the dialogs @@ -470,10 +471,25 @@ void wxDialogBase::OnCharHook(wxKeyEvent& event) { if ( event.GetKeyCode() == WXK_ESCAPE ) { - if ( SendCloseButtonClickEvent() ) + int idCancel = GetEscapeId(); + switch ( idCancel ) { - // Skip the call to event.Skip() below, we did handle this key. - return; + case wxID_NONE: + // don't handle Esc specially at all + break; + + case wxID_ANY: + // this value is special: it means translate Esc to wxID_CANCEL + // but if there is no such button, then fall back to wxID_OK + if ( EmulateButtonClickIfPresent(wxID_CANCEL) ) + return; + idCancel = GetAffirmativeId(); + // fall through + + default: + // translate Esc to button press for the button with given id + if ( EmulateButtonClickIfPresent(idCancel) ) + return; } } @@ -505,41 +521,6 @@ void wxDialogBase::OnButton(wxCommandEvent& event) } } -// ---------------------------------------------------------------------------- -// compatibility methods for supporting the modality API -// ---------------------------------------------------------------------------- - -wxDEFINE_EVENT( wxEVT_WINDOW_MODAL_DIALOG_CLOSED , wxWindowModalDialogEvent ); - -IMPLEMENT_DYNAMIC_CLASS(wxWindowModalDialogEvent, wxCommandEvent) - -void wxDialogBase::ShowWindowModal () -{ - ShowModal(); - SendWindowModalDialogEvent ( wxEVT_WINDOW_MODAL_DIALOG_CLOSED ); -} - -void wxDialogBase::SendWindowModalDialogEvent ( wxEventType type ) -{ - wxWindowModalDialogEvent event ( type, GetId()); - event.SetEventObject(this); - - if ( !GetEventHandler()->ProcessEvent(event) ) - { - // the event is not propagated upwards to the parent automatically - // because the dialog is a top level window, so do it manually as - // in 9 cases of 10 the message must be processed by the dialog - // owner and not the dialog itself - (void)GetParent()->GetEventHandler()->ProcessEvent(event); - } -} - - -wxDialogModality wxDialogBase::GetModality() const -{ - return IsModal() ? wxDIALOG_MODALITY_APP_MODAL : wxDIALOG_MODALITY_NONE; -} - // ---------------------------------------------------------------------------- // other event handlers // ---------------------------------------------------------------------------- @@ -547,9 +528,17 @@ wxDialogModality wxDialogBase::GetModality() const void wxDialogBase::OnCloseWindow(wxCloseEvent& WXUNUSED(event)) { // We'll send a Cancel message by default, which may close the dialog. - // Check for looping if the Cancel event handler calls Close(). - // + + // Note that if a cancel button and handler aren't present in the dialog, + // nothing will happen when you close the dialog via the window manager, or + // via Close(). We wouldn't want to destroy the dialog by default, since + // the dialog may have been created on the stack. However, this does mean + // that calling dialog->Close() won't delete the dialog unless the handler + // for wxID_CANCEL does so. So use Destroy() if you want to be sure to + // destroy the dialog. The default OnCancel (above) simply ends a modal + // dialog, and hides a modeless dialog. + // VZ: this is horrible and MT-unsafe. Can't we reuse some of these global // lists here? don't dare to change it now, but should be done later! static wxList closing; @@ -559,17 +548,9 @@ void wxDialogBase::OnCloseWindow(wxCloseEvent& WXUNUSED(event)) closing.Append(this); - if ( !SendCloseButtonClickEvent() ) - { - // If the handler didn't close the dialog (e.g. because there is no - // button with matching id) we still want to close it when the user - // clicks the "x" button in the title bar, otherwise we shouldn't even - // have put it there. - // - // Notice that using wxID_CLOSE might have been a better choice but we - // use wxID_CANCEL for compatibility reasons. - EndDialog(wxID_CANCEL); - } + wxCommandEvent cancelEvent(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL); + cancelEvent.SetEventObject( this ); + GetEventHandler()->ProcessEvent(cancelEvent); // This may close the dialog closing.DeleteObject(this); } @@ -580,427 +561,5 @@ void wxDialogBase::OnSysColourChanged(wxSysColourChangedEvent& event) SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)); Refresh(); #endif - event.Skip(); } - -/// Do the adaptation -bool wxDialogBase::DoLayoutAdaptation() -{ - if (GetLayoutAdapter()) - { - wxWindow* focusWindow = wxFindFocusDescendant(this); // from event.h - if (GetLayoutAdapter()->DoLayoutAdaptation((wxDialog*) this)) - { - if (focusWindow) - focusWindow->SetFocus(); - return true; - } - else - return false; - } - else - return false; -} - -/// Can we do the adaptation? -bool wxDialogBase::CanDoLayoutAdaptation() -{ - // Check if local setting overrides the global setting - bool layoutEnabled = (GetLayoutAdaptationMode() == wxDIALOG_ADAPTATION_MODE_ENABLED) || (IsLayoutAdaptationEnabled() && (GetLayoutAdaptationMode() != wxDIALOG_ADAPTATION_MODE_DISABLED)); - - return (layoutEnabled && !m_layoutAdaptationDone && GetLayoutAdaptationLevel() != 0 && GetLayoutAdapter() != NULL && GetLayoutAdapter()->CanDoLayoutAdaptation((wxDialog*) this)); -} - -/// Set scrolling adapter class, returning old adapter -wxDialogLayoutAdapter* wxDialogBase::SetLayoutAdapter(wxDialogLayoutAdapter* adapter) -{ - wxDialogLayoutAdapter* oldLayoutAdapter = sm_layoutAdapter; - sm_layoutAdapter = adapter; - return oldLayoutAdapter; -} - -/*! - * Standard adapter - */ - -IMPLEMENT_CLASS(wxDialogLayoutAdapter, wxObject) - -IMPLEMENT_CLASS(wxStandardDialogLayoutAdapter, wxDialogLayoutAdapter) - -// Allow for caption size on wxWidgets < 2.9 -#if defined(__WXGTK__) && !wxCHECK_VERSION(2,9,0) -#define wxEXTRA_DIALOG_HEIGHT 30 -#else -#define wxEXTRA_DIALOG_HEIGHT 0 -#endif - -/// Indicate that adaptation should be done -bool wxStandardDialogLayoutAdapter::CanDoLayoutAdaptation(wxDialog* dialog) -{ - if (dialog->GetSizer()) - { - wxSize windowSize, displaySize; - return MustScroll(dialog, windowSize, displaySize) != 0; - } - else - return false; -} - -bool wxStandardDialogLayoutAdapter::DoLayoutAdaptation(wxDialog* dialog) -{ - if (dialog->GetSizer()) - { -#if wxUSE_BOOKCTRL - wxBookCtrlBase* bookContentWindow = wxDynamicCast(dialog->GetContentWindow(), wxBookCtrlBase); - - if (bookContentWindow) - { - // If we have a book control, make all the pages (that use sizers) scrollable - wxWindowList windows; - for (size_t i = 0; i < bookContentWindow->GetPageCount(); i++) - { - wxWindow* page = bookContentWindow->GetPage(i); - - wxScrolledWindow* scrolledWindow = wxDynamicCast(page, wxScrolledWindow); - if (scrolledWindow) - windows.Append(scrolledWindow); - else if (!scrolledWindow && page->GetSizer()) - { - // Create a scrolled window and reparent - scrolledWindow = CreateScrolledWindow(page); - wxSizer* oldSizer = page->GetSizer(); - - wxSizer* newSizer = new wxBoxSizer(wxVERTICAL); - newSizer->Add(scrolledWindow,1, wxEXPAND, 0); - - page->SetSizer(newSizer, false /* don't delete the old sizer */); - - scrolledWindow->SetSizer(oldSizer); - - ReparentControls(page, scrolledWindow); - - windows.Append(scrolledWindow); - } - } - - FitWithScrolling(dialog, windows); - } - else -#endif // wxUSE_BOOKCTRL - { -#if wxUSE_BUTTON - // If we have an arbitrary dialog, create a scrolling area for the main content, and a button sizer - // for the main buttons. - wxScrolledWindow* scrolledWindow = CreateScrolledWindow(dialog); - - int buttonSizerBorder = 0; - - // First try to find a wxStdDialogButtonSizer - wxSizer* buttonSizer = FindButtonSizer(true /* find std button sizer */, dialog, dialog->GetSizer(), buttonSizerBorder); - - // Next try to find a wxBoxSizer containing the controls - if (!buttonSizer && dialog->GetLayoutAdaptationLevel() > wxDIALOG_ADAPTATION_STANDARD_SIZER) - buttonSizer = FindButtonSizer(false /* find ordinary sizer */, dialog, dialog->GetSizer(), buttonSizerBorder); - - // If we still don't have a button sizer, collect any 'loose' buttons in the layout - if (!buttonSizer && dialog->GetLayoutAdaptationLevel() > wxDIALOG_ADAPTATION_ANY_SIZER) - { - int count = 0; - wxStdDialogButtonSizer* stdButtonSizer = new wxStdDialogButtonSizer; - buttonSizer = stdButtonSizer; - - FindLooseButtons(dialog, stdButtonSizer, dialog->GetSizer(), count); - if (count > 0) - stdButtonSizer->Realize(); - else - { - wxDELETE(buttonSizer); - } - } - - if (buttonSizerBorder == 0) - buttonSizerBorder = 5; - - ReparentControls(dialog, scrolledWindow, buttonSizer); - - wxBoxSizer* newTopSizer = new wxBoxSizer(wxVERTICAL); - wxSizer* oldSizer = dialog->GetSizer(); - - dialog->SetSizer(newTopSizer, false /* don't delete old sizer */); - - newTopSizer->Add(scrolledWindow, 1, wxEXPAND|wxALL, 0); - if (buttonSizer) - newTopSizer->Add(buttonSizer, 0, wxEXPAND|wxALL, buttonSizerBorder); - - scrolledWindow->SetSizer(oldSizer); - - FitWithScrolling(dialog, scrolledWindow); -#endif // wxUSE_BUTTON - } - } - - dialog->SetLayoutAdaptationDone(true); - return true; -} - -// Create the scrolled window -wxScrolledWindow* wxStandardDialogLayoutAdapter::CreateScrolledWindow(wxWindow* parent) -{ - wxScrolledWindow* scrolledWindow = new wxScrolledWindow(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL|wxVSCROLL|wxHSCROLL|wxBORDER_NONE); - return scrolledWindow; -} - -#if wxUSE_BUTTON - -/// Find and remove the button sizer, if any -wxSizer* wxStandardDialogLayoutAdapter::FindButtonSizer(bool stdButtonSizer, wxDialog* dialog, wxSizer* sizer, int& retBorder, int accumlatedBorder) -{ - for ( wxSizerItemList::compatibility_iterator node = sizer->GetChildren().GetFirst(); - node; node = node->GetNext() ) - { - wxSizerItem *item = node->GetData(); - wxSizer *childSizer = item->GetSizer(); - - if ( childSizer ) - { - int newBorder = accumlatedBorder; - if (item->GetFlag() & wxALL) - newBorder += item->GetBorder(); - - if (stdButtonSizer) // find wxStdDialogButtonSizer - { - wxStdDialogButtonSizer* buttonSizer = wxDynamicCast(childSizer, wxStdDialogButtonSizer); - if (buttonSizer) - { - sizer->Detach(childSizer); - retBorder = newBorder; - return buttonSizer; - } - } - else // find a horizontal box sizer containing standard buttons - { - wxBoxSizer* buttonSizer = wxDynamicCast(childSizer, wxBoxSizer); - if (buttonSizer && IsOrdinaryButtonSizer(dialog, buttonSizer)) - { - sizer->Detach(childSizer); - retBorder = newBorder; - return buttonSizer; - } - } - - wxSizer* s = FindButtonSizer(stdButtonSizer, dialog, childSizer, retBorder, newBorder); - if (s) - return s; - } - } - return NULL; -} - -/// Check if this sizer contains standard buttons, and so can be repositioned in the dialog -bool wxStandardDialogLayoutAdapter::IsOrdinaryButtonSizer(wxDialog* dialog, wxBoxSizer* sizer) -{ - if (sizer->GetOrientation() != wxHORIZONTAL) - return false; - - for ( wxSizerItemList::compatibility_iterator node = sizer->GetChildren().GetFirst(); - node; node = node->GetNext() ) - { - wxSizerItem *item = node->GetData(); - wxButton *childButton = wxDynamicCast(item->GetWindow(), wxButton); - - if (childButton && IsStandardButton(dialog, childButton)) - return true; - } - return false; -} - -/// Check if this is a standard button -bool wxStandardDialogLayoutAdapter::IsStandardButton(wxDialog* dialog, wxButton* button) -{ - wxWindowID id = button->GetId(); - - return (id == wxID_OK || id == wxID_CANCEL || id == wxID_YES || id == wxID_NO || id == wxID_SAVE || - id == wxID_APPLY || id == wxID_HELP || id == wxID_CONTEXT_HELP || dialog->IsMainButtonId(id)); -} - -/// Find 'loose' main buttons in the existing layout and add them to the standard dialog sizer -bool wxStandardDialogLayoutAdapter::FindLooseButtons(wxDialog* dialog, wxStdDialogButtonSizer* buttonSizer, wxSizer* sizer, int& count) -{ - wxSizerItemList::compatibility_iterator node = sizer->GetChildren().GetFirst(); - while (node) - { - wxSizerItemList::compatibility_iterator next = node->GetNext(); - wxSizerItem *item = node->GetData(); - wxSizer *childSizer = item->GetSizer(); - wxButton *childButton = wxDynamicCast(item->GetWindow(), wxButton); - - if (childButton && IsStandardButton(dialog, childButton)) - { - sizer->Detach(childButton); - buttonSizer->AddButton(childButton); - count ++; - } - - if (childSizer) - FindLooseButtons(dialog, buttonSizer, childSizer, count); - - node = next; - } - return true; -} - -#endif // wxUSE_BUTTON - -/// Reparent the controls to the scrolled window -void wxStandardDialogLayoutAdapter::ReparentControls(wxWindow* parent, wxWindow* reparentTo, wxSizer* buttonSizer) -{ - DoReparentControls(parent, reparentTo, buttonSizer); -} - -void wxStandardDialogLayoutAdapter::DoReparentControls(wxWindow* parent, wxWindow* reparentTo, wxSizer* buttonSizer) -{ - wxWindowList::compatibility_iterator node = parent->GetChildren().GetFirst(); - while (node) - { - wxWindowList::compatibility_iterator next = node->GetNext(); - - wxWindow *win = node->GetData(); - - // Don't reparent the scrolled window or buttons in the button sizer - if (win != reparentTo && (!buttonSizer || !buttonSizer->GetItem(win))) - { - win->Reparent(reparentTo); -#ifdef __WXMSW__ - // Restore correct tab order - ::SetWindowPos((HWND) win->GetHWND(), HWND_BOTTOM, -1, -1, -1, -1, SWP_NOMOVE|SWP_NOSIZE); -#endif - } - - node = next; - } -} - -/// Find whether scrolling will be necessary for the dialog, returning wxVERTICAL, wxHORIZONTAL or both -int wxStandardDialogLayoutAdapter::MustScroll(wxDialog* dialog, wxSize& windowSize, wxSize& displaySize) -{ - return DoMustScroll(dialog, windowSize, displaySize); -} - -/// Find whether scrolling will be necessary for the dialog, returning wxVERTICAL, wxHORIZONTAL or both -int wxStandardDialogLayoutAdapter::DoMustScroll(wxDialog* dialog, wxSize& windowSize, wxSize& displaySize) -{ - wxSize minWindowSize = dialog->GetSizer()->GetMinSize(); - windowSize = dialog->GetSize(); - windowSize = wxSize(wxMax(windowSize.x, minWindowSize.x), wxMax(windowSize.y, minWindowSize.y)); -#if wxUSE_DISPLAY - displaySize = wxDisplay(wxDisplay::GetFromWindow(dialog)).GetClientArea().GetSize(); -#else - displaySize = wxGetClientDisplayRect().GetSize(); -#endif - - int flags = 0; - - if (windowSize.y >= (displaySize.y - wxEXTRA_DIALOG_HEIGHT)) - flags |= wxVERTICAL; - if (windowSize.x >= displaySize.x) - flags |= wxHORIZONTAL; - - return flags; -} - -// A function to fit the dialog around its contents, and then adjust for screen size. -// If scrolled windows are passed, scrolling is enabled in the required orientation(s). -bool wxStandardDialogLayoutAdapter::FitWithScrolling(wxDialog* dialog, wxWindowList& windows) -{ - return DoFitWithScrolling(dialog, windows); -} - -// A function to fit the dialog around its contents, and then adjust for screen size. -// If a scrolled window is passed, scrolling is enabled in the required orientation(s). -bool wxStandardDialogLayoutAdapter::FitWithScrolling(wxDialog* dialog, wxScrolledWindow* scrolledWindow) -{ - return DoFitWithScrolling(dialog, scrolledWindow); -} - -// A function to fit the dialog around its contents, and then adjust for screen size. -// If a scrolled window is passed, scrolling is enabled in the required orientation(s). -bool wxStandardDialogLayoutAdapter::DoFitWithScrolling(wxDialog* dialog, wxScrolledWindow* scrolledWindow) -{ - wxWindowList windows; - windows.Append(scrolledWindow); - return DoFitWithScrolling(dialog, windows); -} - -bool wxStandardDialogLayoutAdapter::DoFitWithScrolling(wxDialog* dialog, wxWindowList& windows) -{ - wxSizer* sizer = dialog->GetSizer(); - if (!sizer) - return false; - - sizer->SetSizeHints(dialog); - - wxSize windowSize, displaySize; - int scrollFlags = DoMustScroll(dialog, windowSize, displaySize); - int scrollBarSize = 20; - - if (scrollFlags) - { - int scrollBarExtraX = 0, scrollBarExtraY = 0; - bool resizeHorizontally = (scrollFlags & wxHORIZONTAL) != 0; - bool resizeVertically = (scrollFlags & wxVERTICAL) != 0; - - if (windows.GetCount() != 0) - { - // Allow extra for a scrollbar, assuming we resizing in one direction only. - if ((resizeVertically && !resizeHorizontally) && (windowSize.x < (displaySize.x - scrollBarSize))) - scrollBarExtraX = scrollBarSize; - if ((resizeHorizontally && !resizeVertically) && (windowSize.y < (displaySize.y - scrollBarSize))) - scrollBarExtraY = scrollBarSize; - } - - wxWindowList::compatibility_iterator node = windows.GetFirst(); - while (node) - { - wxWindow *win = node->GetData(); - wxScrolledWindow* scrolledWindow = wxDynamicCast(win, wxScrolledWindow); - if (scrolledWindow) - { - scrolledWindow->SetScrollRate(resizeHorizontally ? 10 : 0, resizeVertically ? 10 : 0); - - if (scrolledWindow->GetSizer()) - scrolledWindow->GetSizer()->Fit(scrolledWindow); - } - - node = node->GetNext(); - } - - wxSize limitTo = windowSize + wxSize(scrollBarExtraX, scrollBarExtraY); - if (resizeVertically) - limitTo.y = displaySize.y - wxEXTRA_DIALOG_HEIGHT; - if (resizeHorizontally) - limitTo.x = displaySize.x; - - dialog->SetMinSize(limitTo); - dialog->SetSize(limitTo); - - dialog->SetSizeHints( limitTo.x, limitTo.y, dialog->GetMaxWidth(), dialog->GetMaxHeight() ); - } - - return true; -} - -/*! - * Module to initialise standard adapter - */ - -class wxDialogLayoutAdapterModule: public wxModule -{ - DECLARE_DYNAMIC_CLASS(wxDialogLayoutAdapterModule) -public: - wxDialogLayoutAdapterModule() {} - virtual void OnExit() { delete wxDialogBase::SetLayoutAdapter(NULL); } - virtual bool OnInit() { wxDialogBase::SetLayoutAdapter(new wxStandardDialogLayoutAdapter); return true; } -}; - -IMPLEMENT_DYNAMIC_CLASS(wxDialogLayoutAdapterModule, wxModule) diff --git a/Source/3rd Party/wx/src/common/dndcmn.cpp b/Source/3rd Party/wx/src/common/dndcmn.cpp index 6ae6f73a7..75b8a8d31 100644 --- a/Source/3rd Party/wx/src/common/dndcmn.cpp +++ b/Source/3rd Party/wx/src/common/dndcmn.cpp @@ -1,9 +1,9 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: src/common/dndcmn.cpp +// Name: common/dndcmn.cpp // Author: Robert Roebling // Modified by: // Created: 19.10.99 -// RCS-ID: $Id$ +// RCS-ID: $Id: dndcmn.cpp 43664 2006-11-26 21:50:51Z JS $ // Copyright: (c) wxWidgets Team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// diff --git a/Source/3rd Party/wx/src/common/dobjcmn.cpp b/Source/3rd Party/wx/src/common/dobjcmn.cpp index dca1e80dc..f9404928e 100644 --- a/Source/3rd Party/wx/src/common/dobjcmn.cpp +++ b/Source/3rd Party/wx/src/common/dobjcmn.cpp @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin, Robert Roebling // Modified by: // Created: 19.10.99 -// RCS-ID: $Id$ +// RCS-ID: $Id: dobjcmn.cpp 49036 2007-10-04 10:10:06Z SC $ // Copyright: (c) wxWidgets Team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -94,19 +94,22 @@ wxDataObjectComposite::~wxDataObjectComposite() } wxDataObjectSimple * -wxDataObjectComposite::GetObject(const wxDataFormat& format, wxDataObjectBase::Direction dir) const +wxDataObjectComposite::GetObject(const wxDataFormat& format) const { wxSimpleDataObjectList::compatibility_iterator node = m_dataObjects.GetFirst(); - while ( node ) { wxDataObjectSimple *dataObj = node->GetData(); - if (dataObj->IsSupported(format,dir)) - return dataObj; + if ( dataObj->GetFormat() == format ) + { + return dataObj; + } + node = node->GetNext(); } - return NULL; + + return (wxDataObjectSimple *)NULL; } void wxDataObjectComposite::Add(wxDataObjectSimple *dataObject, bool preferred) @@ -173,33 +176,21 @@ void* wxDataObjectComposite::SetSizeInBuffer( void* buffer, size_t size, #endif -size_t wxDataObjectComposite::GetFormatCount(Direction dir) const +size_t wxDataObjectComposite::GetFormatCount(Direction WXUNUSED(dir)) const { - size_t n = 0; - - // NOTE: some wxDataObjectSimple objects may return a number greater than 1 - // from GetFormatCount(): this is the case of e.g. wxTextDataObject - // under wxMac and wxGTK - wxSimpleDataObjectList::compatibility_iterator node; - for ( node = m_dataObjects.GetFirst(); node; node = node->GetNext() ) - n += node->GetData()->GetFormatCount(dir); - - return n; + // TODO what about the Get/Set only formats? + return m_dataObjects.GetCount(); } void wxDataObjectComposite::GetAllFormats(wxDataFormat *formats, - Direction dir) const + Direction WXUNUSED(dir)) const { - size_t index(0); + size_t n = 0; wxSimpleDataObjectList::compatibility_iterator node; - for ( node = m_dataObjects.GetFirst(); node; node = node->GetNext() ) { - // NOTE: some wxDataObjectSimple objects may return more than 1 format - // from GetAllFormats(): this is the case of e.g. wxTextDataObject - // under wxMac and wxGTK - node->GetData()->GetAllFormats(formats+index, dir); - index += node->GetData()->GetFormatCount(dir); + // TODO if ( !outputOnlyToo ) && this one counts ... + formats[n++] = node->GetData()->GetFormat(); } } @@ -234,25 +225,14 @@ bool wxDataObjectComposite::SetData(const wxDataFormat& format, wxT("unsupported format in wxDataObjectComposite")); m_receivedFormat = format; - - // Notice that we must pass "format" here as wxTextDataObject, that we can - // have as one of our "simple" sub-objects actually is not that simple and - // can support multiple formats (ASCII/UTF-8/UTF-16/...) and so needs to - // know which one it is given. - return dataObj->SetData( format, len, buf ); + return dataObj->SetData( len, buf ); } // ---------------------------------------------------------------------------- // wxTextDataObject // ---------------------------------------------------------------------------- -#ifdef wxNEEDS_UTF8_FOR_TEXT_DATAOBJ - -// FIXME-UTF8: we should be able to merge wchar_t and UTF-8 versions once we -// have a way to get UTF-8 string (and its length) in both builds -// without loss of efficiency (i.e. extra buffer copy/strlen call) - -#if wxUSE_UNICODE_WCHAR +#if defined(__WXGTK20__) && wxUSE_UNICODE static inline wxMBConv& GetConv(const wxDataFormat& format) { @@ -295,87 +275,26 @@ bool wxTextDataObject::SetData(const wxDataFormat& format, return true; } -#else // wxUSE_UNICODE_UTF8 +#elif wxUSE_UNICODE && defined(__WXMAC__) + +static wxMBConvUTF16 sUTF16Converter; + +static inline wxMBConv& GetConv(const wxDataFormat& format) +{ + return + format == wxDF_UNICODETEXT + ? (wxMBConv&) sUTF16Converter + : (wxMBConv&) wxConvLocal; +} size_t wxTextDataObject::GetDataSize(const wxDataFormat& format) const { - if ( format == wxDF_UNICODETEXT || wxLocaleIsUtf8 ) - { - return m_text.utf8_length(); - } - else // wxDF_TEXT - { - const wxCharBuffer buf(wxConvLocal.cWC2MB(m_text.wc_str())); - return buf ? strlen(buf) : 0; - } -} + wxCharBuffer buffer = GetConv(format).cWX2MB( GetText().c_str() ); + if ( !buffer ) + return 0; -bool wxTextDataObject::GetDataHere(const wxDataFormat& format, void *buf) const -{ - if ( !buf ) - return false; - - if ( format == wxDF_UNICODETEXT || wxLocaleIsUtf8 ) - { - memcpy(buf, m_text.utf8_str(), m_text.utf8_length()); - } - else // wxDF_TEXT - { - const wxCharBuffer bufLocal(wxConvLocal.cWC2MB(m_text.wc_str())); - if ( !bufLocal ) - return false; - - memcpy(buf, bufLocal, strlen(bufLocal)); - } - - return true; -} - -bool wxTextDataObject::SetData(const wxDataFormat& format, - size_t len, const void *buf_) -{ - const char * const buf = static_cast(buf_); - - if ( buf == NULL ) - return false; - - if ( format == wxDF_UNICODETEXT || wxLocaleIsUtf8 ) - { - // normally the data is in UTF-8 so we could use FromUTF8Unchecked() - // but it's not absolutely clear what GTK+ does if the clipboard data - // is not in UTF-8 so do an extra check for tranquility, it shouldn't - // matter much if we lose a bit of performance when pasting from - // clipboard - m_text = wxString::FromUTF8(buf, len); - } - else // wxDF_TEXT, convert from current (non-UTF8) locale - { - m_text = wxConvLocal.cMB2WC(buf, len, NULL); - } - - return true; -} - -#endif // wxUSE_UNICODE_WCHAR/wxUSE_UNICODE_UTF8 - -#elif defined(wxNEEDS_UTF16_FOR_TEXT_DATAOBJ) - -namespace -{ - -inline wxMBConv& GetConv(const wxDataFormat& format) -{ - static wxMBConvUTF16 s_UTF16Converter; - - return format == wxDF_UNICODETEXT ? static_cast(s_UTF16Converter) - : static_cast(wxConvLocal); -} - -} // anonymous namespace - -size_t wxTextDataObject::GetDataSize(const wxDataFormat& format) const -{ - return GetConv(format).WC2MB(NULL, GetText().wc_str(), 0); + size_t len = GetConv(format).WC2MB( NULL, GetText().c_str(), 0 ); + return len; } bool wxTextDataObject::GetDataHere(const wxDataFormat& format, void *buf) const @@ -383,26 +302,30 @@ bool wxTextDataObject::GetDataHere(const wxDataFormat& format, void *buf) const if ( buf == NULL ) return false; - wxCharBuffer buffer(GetConv(format).cWX2MB(GetText().c_str())); + wxCharBuffer buffer = GetConv(format).cWX2MB( GetText().c_str() ); + if ( !buffer ) + return false; - memcpy(buf, buffer.data(), buffer.length()); + size_t len = GetConv(format).WC2MB( NULL, GetText().c_str(), 0 ); + memcpy( (char*)buf, (const char*)buffer, len ); return true; } bool wxTextDataObject::SetData(const wxDataFormat& format, - size_t WXUNUSED(len), - const void *buf) + size_t WXUNUSED(len), const void *buf) { if ( buf == NULL ) return false; - SetText(GetConv(format).cMB2WX(static_cast(buf))); + wxWCharBuffer buffer = GetConv(format).cMB2WX( (const char*)buf ); + + SetText( buffer ); return true; } -#else // !wxNEEDS_UTF{8,16}_FOR_TEXT_DATAOBJ +#else size_t wxTextDataObject::GetDataSize() const { @@ -411,126 +334,66 @@ size_t wxTextDataObject::GetDataSize() const bool wxTextDataObject::GetDataHere(void *buf) const { - // NOTE: use wxTmemcpy() instead of wxStrncpy() to allow - // retrieval of strings with embedded NULLs - wxTmemcpy( (wxChar*)buf, GetText().c_str(), GetTextLength() ); + wxStrcpy( (wxChar*)buf, GetText().c_str() ); return true; } -bool wxTextDataObject::SetData(size_t len, const void *buf) +bool wxTextDataObject::SetData(size_t WXUNUSED(len), const void *buf) { - SetText( wxString((const wxChar*)buf, len/sizeof(wxChar)) ); + SetText( wxString((const wxChar*)buf) ); return true; } -#endif // different wxTextDataObject implementations - -size_t wxHTMLDataObject::GetDataSize() const -{ - const wxScopedCharBuffer buffer(GetHTML().utf8_str()); - - size_t size = buffer.length(); - -#ifdef __WXMSW__ - // On Windows we need to add some stuff to the string to satisfy - // its clipboard format requirements. - size += 400; #endif - return size; -} +// ---------------------------------------------------------------------------- +// wxFileDataObjectBase +// ---------------------------------------------------------------------------- -bool wxHTMLDataObject::GetDataHere(void *buf) const +// VZ: I don't need this in MSW finally, so if it is needed in wxGTK, it should +// be moved to gtk/dataobj.cpp +#if 0 + +wxString wxFileDataObjectBase::GetFilenames() const { - if ( !buf ) - return false; - - // Windows and Mac always use UTF-8, and docs suggest GTK does as well. - const wxScopedCharBuffer html(GetHTML().utf8_str()); - if ( !html ) - return false; - - char* const buffer = static_cast(buf); - -#ifdef __WXMSW__ - // add the extra info that the MSW clipboard format requires. - - // Create a template string for the HTML header... - strcpy(buffer, - "Version:0.9\r\n" - "StartHTML:00000000\r\n" - "EndHTML:00000000\r\n" - "StartFragment:00000000\r\n" - "EndFragment:00000000\r\n" - "\r\n" - "\r\n"); - - // Append the HTML... - strcat(buffer, html); - strcat(buffer, "\r\n"); - // Finish up the HTML format... - strcat(buffer, - "\r\n" - "\r\n" - ""); - - // Now go back, calculate all the lengths, and write out the - // necessary header information. Note, wsprintf() truncates the - // string when you overwrite it so you follow up with code to replace - // the 0 appended at the end with a '\r'... - char *ptr = strstr(buffer, "StartHTML"); - sprintf(ptr+10, "%08u", (unsigned)(strstr(buffer, "") - buffer)); - *(ptr+10+8) = '\r'; - - ptr = strstr(buffer, "EndHTML"); - sprintf(ptr+8, "%08u", (unsigned)strlen(buffer)); - *(ptr+8+8) = '\r'; - - ptr = strstr(buffer, "StartFragment"); - sprintf(ptr+14, "%08u", (unsigned)(strstr(buffer, "", fragmentStart) + 3; - int endCommentStart = html.rfind(" number conversion functions -// ---------------------------------------------------------------------------- - -/* - WARNING: the implementation of the wxStrtoX_l() functions below is unsafe - in a multi-threaded environment as we temporary change the locale - and if in the meanwhile an other thread performs some locale-dependent - operation, it may get unexpected results... - However this is the best we can do without reinventing the wheel in the - case !wxHAS_XLOCALE_SUPPORT... -*/ - -namespace -{ - -// Helper class that changes LC_NUMERIC facet of the global locale in its ctor -// to "C" locale and restores it in its dtor later. -class CNumericLocaleSetter -{ -public: - CNumericLocaleSetter() - : m_oldLocale(wxStrdupA(setlocale(LC_NUMERIC, NULL))) - { - if ( !wxSetlocale(LC_NUMERIC, "C") ) - { - // Setting locale to "C" should really always work. - wxFAIL_MSG( wxS("Couldn't set LC_NUMERIC to \"C\"") ); - } - } - - ~CNumericLocaleSetter() - { - wxSetlocale(LC_NUMERIC, m_oldLocale); - free(m_oldLocale); - } - -private: - char * const m_oldLocale; - - wxDECLARE_NO_COPY_CLASS(CNumericLocaleSetter); -}; - -} // anonymous namespace - -double wxStrtod_l(const wchar_t* str, wchar_t **endptr, const wxXLocale& loc) -{ - wxCHECK( loc.IsOk(), 0. ); - - CNumericLocaleSetter locSetter; - - return wxStrtod(str, endptr); -} - -double wxStrtod_l(const char* str, char **endptr, const wxXLocale& loc) -{ - wxCHECK( loc.IsOk(), 0. ); - - CNumericLocaleSetter locSetter; - - return wxStrtod(str, endptr); -} - -long wxStrtol_l(const wchar_t* str, wchar_t **endptr, int base, const wxXLocale& loc) -{ - wxCHECK( loc.IsOk(), 0 ); - - CNumericLocaleSetter locSetter; - - return wxStrtol(str, endptr, base); -} - -long wxStrtol_l(const char* str, char **endptr, int base, const wxXLocale& loc) -{ - wxCHECK( loc.IsOk(), 0 ); - - CNumericLocaleSetter locSetter; - - return wxStrtol(str, endptr, base); -} - -unsigned long wxStrtoul_l(const wchar_t* str, wchar_t **endptr, int base, const wxXLocale& loc) -{ - wxCHECK( loc.IsOk(), 0 ); - - CNumericLocaleSetter locSetter; - - return wxStrtoul(str, endptr, base); -} - -unsigned long wxStrtoul_l(const char* str, char **endptr, int base, const wxXLocale& loc) -{ - wxCHECK( loc.IsOk(), 0 ); - - CNumericLocaleSetter locSetter; - - return wxStrtoul(str, endptr, base); -} - -#endif // !defined(wxHAS_XLOCALE_SUPPORT) - -#endif // wxUSE_XLOCALE diff --git a/Source/3rd Party/wx/src/common/xpmdecod.cpp b/Source/3rd Party/wx/src/common/xpmdecod.cpp index 163ae05df..2a5a8ef1a 100644 --- a/Source/3rd Party/wx/src/common/xpmdecod.cpp +++ b/Source/3rd Party/wx/src/common/xpmdecod.cpp @@ -2,7 +2,7 @@ // Name: src/common/xpmdecod.cpp // Purpose: wxXPMDecoder // Author: John Cristy, Vaclav Slavik -// RCS-ID: $Id$ +// RCS-ID: $Id: xpmdecod.cpp 54948 2008-08-03 10:54:33Z VZ $ // Copyright: (c) John Cristy, Vaclav Slavik // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -122,6 +122,8 @@ bool wxXPMDecoder::CanRead(wxInputStream& stream) if ( !stream.Read(buf, WXSIZEOF(buf)) ) return false; + stream.SeekI(-(wxFileOffset)WXSIZEOF(buf), wxFromCurrent); + return memcmp(buf, "/* XPM */", WXSIZEOF(buf)) == 0; } @@ -264,7 +266,7 @@ typedef struct #define myRGB(r,g,b) ((wxUint32)r<<16|(wxUint32)g<<8|(wxUint32)b) -static const rgbRecord theRGBRecords[] = +static rgbRecord theRGBRecords[] = { {"aliceblue", myRGB(240, 248, 255)}, {"antiquewhite", myRGB(250, 235, 215)}, @@ -503,7 +505,7 @@ static const rgbRecord theRGBRecords[] = {"yellowgreen", myRGB(50, 216, 56)}, {NULL, myRGB(0, 0, 0)} }; -static const int numTheRGBRecords = 235; +static int numTheRGBRecords = 235; static unsigned char ParseHexadecimal(char digit1, char digit2) { @@ -618,7 +620,7 @@ static bool GetRGBFromName(const char *inname, bool *isNone, static const char *ParseColor(const char *data) { - static const char *const targets[] = + static const char *targets[] = {"c ", "g ", "g4 ", "m ", "b ", "s ", NULL}; const char *p, *r; @@ -663,12 +665,12 @@ wxImage wxXPMDecoder::ReadData(const char* const* xpm_data) int count; unsigned width, height, colors_cnt, chars_per_pixel; size_t i, j, i_key; - char key[64]; + wxChar key[64]; const char *clr_def; + bool hasMask; wxXPMColourMap clr_tbl; wxXPMColourMap::iterator it; wxString maskKey; - wxString keyString; /* * Read hints and initialize structures: @@ -687,10 +689,12 @@ wxImage wxXPMDecoder::ReadData(const char* const* xpm_data) // 8bit RGB... wxCHECK_MSG(chars_per_pixel < 64, wxNullImage, wxT("XPM colormaps this large not supported.")); - if (!img.Create(width, height, false)) + if ( !img.Create(width, height) ) return wxNullImage; - key[chars_per_pixel] = '\0'; + img.SetMask(false); + key[chars_per_pixel] = wxT('\0'); + hasMask = false; /* * Create colour map: @@ -709,7 +713,7 @@ wxImage wxXPMDecoder::ReadData(const char* const* xpm_data) } for (i_key = 0; i_key < chars_per_pixel; i_key++) - key[i_key] = xmpColLine[i_key]; + key[i_key] = (wxChar)xmpColLine[i_key]; clr_def = ParseColor(xmpColLine + chars_per_pixel); if ( clr_def == NULL ) @@ -728,41 +732,36 @@ wxImage wxXPMDecoder::ReadData(const char* const* xpm_data) return wxNullImage; } - keyString = key; if ( isNone ) - maskKey = keyString; + { + img.SetMask(true); + img.SetMaskColour(255, 0, 255); + clr_data.R = + clr_data.B = 255; + clr_data.G = 0; + hasMask = true; + maskKey = key; + } - clr_tbl[keyString] = clr_data; + clr_tbl[key] = clr_data; } - // deal with the mask: we must replace pseudo-colour "None" with the mask - // colour (which can be any colour not otherwise used in the image) - if (!maskKey.empty()) + /* + * Modify colour entries with RGB = (255,0,255) to (255,0,254) if + * mask colour is present (so that existing pixels with (255,0,255) + * magenta colour are not incorrectly made transparent): + */ + if (hasMask) { - wxLongToLongHashMap rgb_table; - long rgb; - const size_t n = clr_tbl.size(); - wxXPMColourMap::const_iterator iter = clr_tbl.begin(); - for (i = 0; i < n; ++i, ++iter) + for (it = clr_tbl.begin(); it != clr_tbl.end(); ++it) { - const wxXPMColourMapData& data = iter->second; - rgb = (data.R << 16) + (data.G << 8) + data.B; - rgb_table[rgb]; + if (it->second.R == 255 && it->second.G == 0 && + it->second.B == 255 && + it->first != maskKey) + { + it->second.B = 254; + } } - for (rgb = 0; rgb <= 0xffffff && rgb_table.count(rgb); ++rgb) - ; - if (rgb > 0xffffff) - { - wxLogError(_("XPM: no colors left to use for mask!")); - return wxNullImage; - } - - wxXPMColourMapData& maskData = clr_tbl[maskKey]; - maskData.R = wxByte(rgb >> 16); - maskData.G = wxByte(rgb >> 8); - maskData.B = wxByte(rgb); - - img.SetMaskColour(maskData.R, maskData.G, maskData.B); } /* @@ -787,11 +786,10 @@ wxImage wxXPMDecoder::ReadData(const char* const* xpm_data) for (i_key = 0; i_key < chars_per_pixel; i_key++) { - key[i_key] = xpmImgLine[chars_per_pixel * i + i_key]; + key[i_key] = (wxChar)xpmImgLine[chars_per_pixel * i + i_key]; } - keyString = key; - entry = clr_tbl.find(keyString); + entry = clr_tbl.find(key); if ( entry == end ) { wxLogError(_("XPM: Malformed pixel data!")); @@ -802,12 +800,15 @@ wxImage wxXPMDecoder::ReadData(const char* const* xpm_data) // each remaining pixel if we don't bail out return wxNullImage; } - - img_data[0] = entry->second.R; - img_data[1] = entry->second.G; - img_data[2] = entry->second.B; + else + { + img_data[0] = entry->second.R; + img_data[1] = entry->second.G; + img_data[2] = entry->second.B; + } } } + #if wxUSE_PALETTE unsigned char* r = new unsigned char[colors_cnt]; unsigned char* g = new unsigned char[colors_cnt]; @@ -825,6 +826,7 @@ wxImage wxXPMDecoder::ReadData(const char* const* xpm_data) delete[] g; delete[] b; #endif // wxUSE_PALETTE + return img; } diff --git a/Source/3rd Party/wx/src/common/xti.cpp b/Source/3rd Party/wx/src/common/xti.cpp index f19ee16af..adbbd07bf 100644 --- a/Source/3rd Party/wx/src/common/xti.cpp +++ b/Source/3rd Party/wx/src/common/xti.cpp @@ -1,10 +1,10 @@ ///////////////////////////////////////////////////////////////////////////// // Name: src/common/xti.cpp -// Purpose: runtime metadata information (extended class info) +// Purpose: runtime metadata information (extended class info // Author: Stefan Csomor // Modified by: // Created: 27/07/03 -// RCS-ID: $Id$ +// RCS-ID: $Id: xti.cpp 38857 2006-04-20 07:31:44Z ABX $ // Copyright: (c) 1997 Julian Smart // (c) 2003 Stefan Csomor // Licence: wxWindows licence @@ -28,8 +28,6 @@ #include "wx/xti.h" #include "wx/xml/xml.h" #include "wx/tokenzr.h" -#include "wx/range.h" - #include #include "wx/beforestd.h" @@ -38,73 +36,72 @@ #include #include "wx/afterstd.h" -using namespace std; +using namespace std ; // ---------------------------------------------------------------------------- -// wxEnumData +// Enum Support // ---------------------------------------------------------------------------- wxEnumData::wxEnumData( wxEnumMemberData* data ) { - m_members = data; - for ( m_count = 0; m_members[m_count].m_name; m_count++) - {}; + m_members = data ; + for ( m_count = 0; m_members[m_count].m_name ; m_count++) + {} ; } bool wxEnumData::HasEnumMemberValue(const wxChar *name, int *value) const { int i; - for (i = 0; m_members[i].m_name; i++ ) + for (i = 0; m_members[i].m_name ; i++ ) { if (!wxStrcmp(name, m_members[i].m_name)) { if ( value ) *value = m_members[i].m_value; - return true; + return true ; } } - return false; + return false ; } int wxEnumData::GetEnumMemberValue(const wxChar *name) const { int i; - for (i = 0; m_members[i].m_name; i++ ) + for (i = 0; m_members[i].m_name ; i++ ) { if (!wxStrcmp(name, m_members[i].m_name)) { return m_members[i].m_value; } } - return 0; + return 0 ; } const wxChar *wxEnumData::GetEnumMemberName(int value) const { int i; - for (i = 0; m_members[i].m_name; i++) + for (i = 0; m_members[i].m_name ; i++) if (value == m_members[i].m_value) return m_members[i].m_name; - return wxEmptyString; + return wxEmptyString ; } int wxEnumData::GetEnumMemberValueByIndex( int idx ) const { // we should cache the count in order to avoid out-of-bounds errors - return m_members[idx].m_value; + return m_members[idx].m_value ; } const wxChar * wxEnumData::GetEnumMemberNameByIndex( int idx ) const { // we should cache the count in order to avoid out-of-bounds errors - return m_members[idx].m_name; + return m_members[idx].m_name ; } // ---------------------------------------------------------------------------- // Type Information // ---------------------------------------------------------------------------- - // ---------------------------------------------------------------------------- // value streaming // ---------------------------------------------------------------------------- @@ -114,190 +111,159 @@ const wxChar * wxEnumData::GetEnumMemberNameByIndex( int idx ) const // bool -template<> void wxStringReadValue(const wxString &s, bool &data ) +template<> void wxStringReadValue(const wxString &s , bool &data ) { - int intdata; - wxSscanf(s, wxT("%d"), &intdata ); - data = (bool)(intdata != 0); + int intdata ; + wxSscanf(s, _T("%d"), &intdata ) ; + data = (bool)intdata ; } -template<> void wxStringWriteValue(wxString &s, const bool &data ) +template<> void wxStringWriteValue(wxString &s , const bool &data ) { - s = wxString::Format(wxT("%d"), data ); + s = wxString::Format(_T("%d"), data ) ; } // char -template<> void wxStringReadValue(const wxString &s, char &data ) +template<> void wxStringReadValue(const wxString &s , char &data ) { - int intdata; - wxSscanf(s, wxT("%d"), &intdata ); - data = char(intdata); + int intdata ; + wxSscanf(s, _T("%d"), &intdata ) ; + data = char(intdata) ; } -template<> void wxStringWriteValue(wxString &s, const char &data ) +template<> void wxStringWriteValue(wxString &s , const char &data ) { - s = wxString::Format(wxT("%d"), data ); + s = wxString::Format(_T("%d"), data ) ; } // unsigned char -template<> void wxStringReadValue(const wxString &s, unsigned char &data ) +template<> void wxStringReadValue(const wxString &s , unsigned char &data ) { - int intdata; - wxSscanf(s, wxT("%d"), &intdata ); - data = (unsigned char)(intdata); + int intdata ; + wxSscanf(s, _T("%d"), &intdata ) ; + data = (unsigned char)(intdata) ; } -template<> void wxStringWriteValue(wxString &s, const unsigned char &data ) +template<> void wxStringWriteValue(wxString &s , const unsigned char &data ) { - s = wxString::Format(wxT("%d"), data ); + s = wxString::Format(_T("%d"), data ) ; } // int -template<> void wxStringReadValue(const wxString &s, int &data ) +template<> void wxStringReadValue(const wxString &s , int &data ) { - wxSscanf(s, wxT("%d"), &data ); + wxSscanf(s, _T("%d"), &data ) ; } -template<> void wxStringWriteValue(wxString &s, const int &data ) +template<> void wxStringWriteValue(wxString &s , const int &data ) { - s = wxString::Format(wxT("%d"), data ); + s = wxString::Format(_T("%d"), data ) ; } // unsigned int -template<> void wxStringReadValue(const wxString &s, unsigned int &data ) +template<> void wxStringReadValue(const wxString &s , unsigned int &data ) { - wxSscanf(s, wxT("%d"), &data ); + wxSscanf(s, _T("%d"), &data ) ; } -template<> void wxStringWriteValue(wxString &s, const unsigned int &data ) +template<> void wxStringWriteValue(wxString &s , const unsigned int &data ) { - s = wxString::Format(wxT("%d"), data ); + s = wxString::Format(_T("%d"), data ) ; } // long -template<> void wxStringReadValue(const wxString &s, long &data ) +template<> void wxStringReadValue(const wxString &s , long &data ) { - wxSscanf(s, wxT("%ld"), &data ); + wxSscanf(s, _T("%ld"), &data ) ; } -template<> void wxStringWriteValue(wxString &s, const long &data ) +template<> void wxStringWriteValue(wxString &s , const long &data ) { - s = wxString::Format(wxT("%ld"), data ); + s = wxString::Format(_T("%ld"), data ) ; } // unsigned long -template<> void wxStringReadValue(const wxString &s, unsigned long &data ) +template<> void wxStringReadValue(const wxString &s , unsigned long &data ) { - wxSscanf(s, wxT("%ld"), &data ); + wxSscanf(s, _T("%ld"), &data ) ; } -template<> void wxStringWriteValue(wxString &s, const unsigned long &data ) +template<> void wxStringWriteValue(wxString &s , const unsigned long &data ) { - s = wxString::Format(wxT("%ld"), data ); + s = wxString::Format(_T("%ld"), data ) ; } -#ifdef wxLongLong_t -template<> void wxStringReadValue(const wxString &s, wxLongLong_t &data ) -{ - wxSscanf(s, wxT("%lld"), &data ); -} - -template<> void wxStringWriteValue(wxString &s, const wxLongLong_t &data ) -{ - s = wxString::Format(wxT("%lld"), data ); -} - -template<> void wxStringReadValue(const wxString &s, wxULongLong_t &data ) -{ - wxSscanf(s, wxT("%lld"), &data ); -} - -template<> void wxStringWriteValue(wxString &s, const wxULongLong_t &data ) -{ - s = wxString::Format(wxT("%lld"), data ); -} -#endif // float -template<> void wxStringReadValue(const wxString &s, float &data ) +template<> void wxStringReadValue(const wxString &s , float &data ) { - wxSscanf(s, wxT("%f"), &data ); + wxSscanf(s, _T("%f"), &data ) ; } -template<> void wxStringWriteValue(wxString &s, const float &data ) +template<> void wxStringWriteValue(wxString &s , const float &data ) { - s = wxString::Format(wxT("%f"), data ); + s = wxString::Format(_T("%f"), data ) ; } // double -template<> void wxStringReadValue(const wxString &s, double &data ) +template<> void wxStringReadValue(const wxString &s , double &data ) { - wxSscanf(s, wxT("%lf"), &data ); + wxSscanf(s, _T("%lf"), &data ) ; } -template<> void wxStringWriteValue(wxString &s, const double &data ) +template<> void wxStringWriteValue(wxString &s , const double &data ) { - s = wxString::Format(wxT("%lf"), data ); + s = wxString::Format(_T("%lf"), data ) ; } // wxString -template<> void wxStringReadValue(const wxString &s, wxString &data ) +template<> void wxStringReadValue(const wxString &s , wxString &data ) { - data = s; + data = s ; } -template<> void wxStringWriteValue(wxString &s, const wxString &data ) +template<> void wxStringWriteValue(wxString &s , const wxString &data ) { - s = data; + s = data ; } - // built-ins // #if wxUSE_FUNC_TEMPLATE_POINTER - #define wxBUILTIN_TYPE_INFO( element, type ) \ - wxBuiltInTypeInfo \ - s_typeInfo##type(element, &wxToStringConverter, \ - &wxFromStringConverter, typeid(type).name()); +#define wxBUILTIN_TYPE_INFO( element , type ) \ + wxBuiltInTypeInfo s_typeInfo##type(element , &wxToStringConverter , &wxFromStringConverter , typeid(type).name()) ; #else - #define wxBUILTIN_TYPE_INFO( element, type ) \ - void _toString##element( const wxAny& data, wxString &result ) \ - { wxToStringConverter(data, result); } \ + void _fromString##element( const wxString& data , wxxVariant &result ) { wxFromStringConverter(data, result); } \ + wxBuiltInTypeInfo s_typeInfo##type(element , &_toString##element , &_fromString##element , typeid(type).name()) ; #endif typedef unsigned char unsigned_char; typedef unsigned int unsigned_int; typedef unsigned long unsigned_long; -wxBuiltInTypeInfo s_typeInfovoid( wxT_VOID, NULL, NULL, typeid(void).name()); -wxBUILTIN_TYPE_INFO( wxT_BOOL, bool); -wxBUILTIN_TYPE_INFO( wxT_CHAR, char); -wxBUILTIN_TYPE_INFO( wxT_UCHAR, unsigned_char); -wxBUILTIN_TYPE_INFO( wxT_INT, int); -wxBUILTIN_TYPE_INFO( wxT_UINT, unsigned_int); -wxBUILTIN_TYPE_INFO( wxT_LONG, long); -wxBUILTIN_TYPE_INFO( wxT_ULONG, unsigned_long); -wxBUILTIN_TYPE_INFO( wxT_FLOAT, float); -wxBUILTIN_TYPE_INFO( wxT_DOUBLE, double); -wxBUILTIN_TYPE_INFO( wxT_STRING, wxString); +wxBuiltInTypeInfo s_typeInfovoid( wxT_VOID , NULL , NULL , typeid(void).name()); +wxBUILTIN_TYPE_INFO( wxT_BOOL , bool); +wxBUILTIN_TYPE_INFO( wxT_CHAR , char); +wxBUILTIN_TYPE_INFO( wxT_UCHAR , unsigned_char); +wxBUILTIN_TYPE_INFO( wxT_INT , int); +wxBUILTIN_TYPE_INFO( wxT_UINT , unsigned_int); +wxBUILTIN_TYPE_INFO( wxT_LONG , long); +wxBUILTIN_TYPE_INFO( wxT_ULONG , unsigned_long); +wxBUILTIN_TYPE_INFO( wxT_FLOAT , float); +wxBUILTIN_TYPE_INFO( wxT_DOUBLE , double); +wxBUILTIN_TYPE_INFO( wxT_STRING , wxString); -#ifdef wxLongLong_t -wxBUILTIN_TYPE_INFO(wxT_LONGLONG, wxLongLong_t) -wxBUILTIN_TYPE_INFO(wxT_ULONGLONG, wxULongLong_t) -#endif // this are compiler induced specialization which are never used anywhere @@ -309,82 +275,47 @@ wxILLEGAL_TYPE_SPECIALIZATION( bool * ) wxILLEGAL_TYPE_SPECIALIZATION( long * ) wxILLEGAL_TYPE_SPECIALIZATION( wxString * ) -// wxRange +wxCOLLECTION_TYPE_INFO( wxString , wxArrayString ) ; -template<> void wxStringReadValue(const wxString &s , wxRange &data) +template<> void wxCollectionToVariantArray( wxArrayString const &theArray, wxxVariantArray &value) { - int minValue, maxValue; - wxSscanf(s, wxT("%d,%d"), &minValue , &maxValue); - data = wxRange(minValue, maxValue); + wxArrayCollectionToVariantArray( theArray , value ) ; } -template<> void wxStringWriteValue(wxString &s , const wxRange &data) +wxTypeInfoMap *wxTypeInfo::ms_typeTable = NULL ; + +wxTypeInfo *wxTypeInfo::FindType(const wxChar *typeName) { - s = wxString::Format(wxT("%d,%d"), data.GetMin() , data.GetMax()); -} - -wxCUSTOM_TYPE_INFO(wxRange, wxToStringConverter , wxFromStringConverter) - -// other types - -wxCOLLECTION_TYPE_INFO( wxString, wxArrayString ); - -template<> void wxCollectionToVariantArray( wxArrayString const &theArray, - wxAnyList &value) -{ - wxArrayCollectionToVariantArray( theArray, value ); -} - -wxTypeInfoMap *wxTypeInfo::ms_typeTable = NULL; - -wxTypeInfo *wxTypeInfo::FindType(const wxString& typeName) -{ - wxTypeInfoMap::iterator iter = ms_typeTable->find(typeName); - - if (iter == ms_typeTable->end()) - return NULL; - + wxTypeInfoMap::iterator iter = ms_typeTable->find(typeName) ; + wxASSERT_MSG( iter != ms_typeTable->end() , wxT("lookup for a non-existent type-info") ) ; return (wxTypeInfo *)iter->second; } -wxClassTypeInfo::wxClassTypeInfo( wxTypeKind kind, wxClassInfo* classInfo, - wxVariant2StringFnc to, - wxString2VariantFnc from, - const wxString &name) : - wxTypeInfo( kind, to, from, name) -{ - wxASSERT_MSG( kind == wxT_OBJECT_PTR || kind == wxT_OBJECT, - wxT("Illegal Kind for Enum Type")); m_classInfo = classInfo; -} +#if wxUSE_UNICODE +wxClassTypeInfo::wxClassTypeInfo( wxTypeKind kind , wxClassInfo* classInfo , converterToString_t to , converterFromString_t from , const char *name) : +wxTypeInfo( kind , to , from , name) +{ wxASSERT_MSG( kind == wxT_OBJECT_PTR || kind == wxT_OBJECT , wxT("Illegal Kind for Enum Type")) ; m_classInfo = classInfo ;} +#endif -wxEventSourceTypeInfo::wxEventSourceTypeInfo( int eventType, wxClassInfo* eventClass, - wxVariant2StringFnc to, - wxString2VariantFnc from ) : - wxTypeInfo ( wxT_DELEGATE, to, from, wxEmptyString ) -{ - m_eventClass = eventClass; - m_eventType = eventType; - m_lastEventType = -1; -} +wxClassTypeInfo::wxClassTypeInfo( wxTypeKind kind , wxClassInfo* classInfo , converterToString_t to , converterFromString_t from , const wxString &name) : +wxTypeInfo( kind , to , from , name) +{ wxASSERT_MSG( kind == wxT_OBJECT_PTR || kind == wxT_OBJECT , wxT("Illegal Kind for Enum Type")) ; m_classInfo = classInfo ;} -wxEventSourceTypeInfo::wxEventSourceTypeInfo( int eventType, int lastEventType, - wxClassInfo* eventClass, - wxVariant2StringFnc to, - wxString2VariantFnc from ) : - wxTypeInfo ( wxT_DELEGATE, to, from, wxEmptyString ) -{ - m_eventClass = eventClass; - m_eventType = eventType; - m_lastEventType = lastEventType; -} +wxDelegateTypeInfo::wxDelegateTypeInfo( int eventType , wxClassInfo* eventClass , converterToString_t to , converterFromString_t from ) : +wxTypeInfo ( wxT_DELEGATE , to , from , wxEmptyString ) +{ m_eventClass = eventClass ; m_eventType = eventType ; m_lastEventType = -1 ;} + +wxDelegateTypeInfo::wxDelegateTypeInfo( int eventType , int lastEventType , wxClassInfo* eventClass , converterToString_t to , converterFromString_t from ) : +wxTypeInfo ( wxT_DELEGATE , to , from , wxEmptyString ) +{ m_eventClass = eventClass ; m_eventType = eventType ; m_lastEventType = lastEventType; } void wxTypeInfo::Register() { if ( ms_typeTable == NULL ) - ms_typeTable = new wxTypeInfoMap(); + ms_typeTable = new wxTypeInfoMap() ; if( !m_name.empty() ) - (*ms_typeTable)[m_name] = this; + (*ms_typeTable)[m_name] = this ; } void wxTypeInfo::Unregister() @@ -393,39 +324,24 @@ void wxTypeInfo::Unregister() ms_typeTable->erase(m_name); } -// removing header dependency on string tokenizer +// removing header dependancy on string tokenizer -void wxSetStringToArray( const wxString &s, wxArrayString &array ) +void wxSetStringToArray( const wxString &s , wxArrayString &array ) { wxStringTokenizer tokenizer(s, wxT("| \t\n"), wxTOKEN_STRTOK); wxString flag; - array.Clear(); + array.Clear() ; while (tokenizer.HasMoreTokens()) { - array.Add(tokenizer.GetNextToken()); + array.Add(tokenizer.GetNextToken()) ; } } // ---------------------------------------------------------------------------- -// wxPropertyInfo +// wxClassInfo // ---------------------------------------------------------------------------- -void wxPropertyInfo::Insert(wxPropertyInfo* &iter) -{ - m_next = NULL; - if ( iter == NULL ) - iter = this; - else - { - wxPropertyInfo* i = iter; - while( i->m_next ) - i = i->m_next; - - i->m_next = this; - } -} - -void wxPropertyInfo::Remove() +wxPropertyInfo::~wxPropertyInfo() { if ( this == m_itsClass->m_firstProperty ) { @@ -445,29 +361,9 @@ void wxPropertyInfo::Remove() info = info->m_next; } } - } -// ---------------------------------------------------------------------------- -// wxHandlerInfo -// ---------------------------------------------------------------------------- - -void wxHandlerInfo::Insert(wxHandlerInfo* &iter) -{ - m_next = NULL; - if ( iter == NULL ) - iter = this; - else - { - wxHandlerInfo* i = iter; - while( i->m_next ) - i = i->m_next; - - i->m_next = this; - } -} - -void wxHandlerInfo::Remove() +wxHandlerInfo::~wxHandlerInfo() { if ( this == m_itsClass->m_firstHandler ) { @@ -489,73 +385,25 @@ void wxHandlerInfo::Remove() } } - -// ---------------------------------------------------------------------------- -// wxClassInfo -// ---------------------------------------------------------------------------- - -bool wxClassInfo::Create(wxObject *object, int ParamCount, wxAny *Params) const -{ - if ( ParamCount != m_constructorPropertiesCount ) - { - // FIXME: shouldn't we just return false and let the caller handle it? - wxLogError( _("Illegal Parameter Count for Create Method") ); - return false; - } - - return m_constructor->Create( object, Params ); -} - -wxObject *wxClassInfo::ConstructObject(int ParamCount, wxAny *Params) const -{ - if ( ParamCount != m_constructorPropertiesCount ) - { - // FIXME: shouldn't we just return NULL and let the caller handle this case? - wxLogError( _("Illegal Parameter Count for ConstructObject Method") ); - return NULL; - } - - wxObject *object = NULL; - if (!m_constructor->Create( object, Params )) - return NULL; - return object; -} - -bool wxClassInfo::IsKindOf(const wxClassInfo *info) const -{ - if ( info != 0 ) - { - if ( info == this ) - return true; - - for ( int i = 0; m_parents[i]; ++ i ) - { - if ( m_parents[i]->IsKindOf( info ) ) - return true; - } - } - return false; -} - const wxPropertyAccessor *wxClassInfo::FindAccessor(const wxChar *PropertyName) const { - const wxPropertyInfo* info = FindPropertyInfo( PropertyName ); + const wxPropertyInfo* info = FindPropertyInfo( PropertyName ) ; if ( info ) - return info->GetAccessor(); + return info->GetAccessor() ; - return NULL; + return NULL ; } wxPropertyInfo *wxClassInfo::FindPropertyInfoInThisClass (const wxChar *PropertyName) const { - wxPropertyInfo* info = GetFirstProperty(); + wxPropertyInfo* info = m_firstProperty ; while( info ) { - if ( wxStrcmp( info->GetName(), PropertyName ) == 0 ) - return info; - info = info->GetNext(); + if ( wxStrcmp( info->GetName() , PropertyName ) == 0 ) + return info ; + info = info->GetNext() ; } return 0; @@ -563,15 +411,15 @@ wxPropertyInfo *wxClassInfo::FindPropertyInfoInThisClass (const wxChar *Property const wxPropertyInfo *wxClassInfo::FindPropertyInfo (const wxChar *PropertyName) const { - const wxPropertyInfo* info = FindPropertyInfoInThisClass( PropertyName ); + const wxPropertyInfo* info = FindPropertyInfoInThisClass( PropertyName ) ; if ( info ) - return info; + return info ; - const wxClassInfo** parents = GetParents(); - for ( int i = 0; parents[i]; ++ i ) + const wxClassInfo** parents = GetParents() ; + for ( int i = 0 ; parents[i] ; ++ i ) { if ( ( info = parents[i]->FindPropertyInfo( PropertyName ) ) != NULL ) - return info; + return info ; } return 0; @@ -579,13 +427,13 @@ const wxPropertyInfo *wxClassInfo::FindPropertyInfo (const wxChar *PropertyName) wxHandlerInfo *wxClassInfo::FindHandlerInfoInThisClass (const wxChar *PropertyName) const { - wxHandlerInfo* info = GetFirstHandler(); + wxHandlerInfo* info = m_firstHandler ; while( info ) { - if ( wxStrcmp( info->GetName(), PropertyName ) == 0 ) - return info; - info = info->GetNext(); + if ( wxStrcmp( info->GetName() , PropertyName ) == 0 ) + return info ; + info = info->GetNext() ; } return 0; @@ -593,16 +441,16 @@ wxHandlerInfo *wxClassInfo::FindHandlerInfoInThisClass (const wxChar *PropertyNa const wxHandlerInfo *wxClassInfo::FindHandlerInfo (const wxChar *PropertyName) const { - const wxHandlerInfo* info = FindHandlerInfoInThisClass( PropertyName ); + const wxHandlerInfo* info = FindHandlerInfoInThisClass( PropertyName ) ; if ( info ) - return info; + return info ; - const wxClassInfo** parents = GetParents(); - for ( int i = 0; parents[i]; ++ i ) + const wxClassInfo** parents = GetParents() ; + for ( int i = 0 ; parents[i] ; ++ i ) { if ( ( info = parents[i]->FindHandlerInfo( PropertyName ) ) != NULL ) - return info; + return info ; } return 0; @@ -611,68 +459,64 @@ const wxHandlerInfo *wxClassInfo::FindHandlerInfo (const wxChar *PropertyName) c wxObjectStreamingCallback wxClassInfo::GetStreamingCallback() const { if ( m_streamingCallback ) - return m_streamingCallback; + return m_streamingCallback ; - wxObjectStreamingCallback retval = NULL; - const wxClassInfo** parents = GetParents(); - for ( int i = 0; parents[i] && retval == NULL; ++ i ) + wxObjectStreamingCallback retval = NULL ; + const wxClassInfo** parents = GetParents() ; + for ( int i = 0 ; parents[i] && retval == NULL ; ++ i ) { - retval = parents[i]->GetStreamingCallback(); + retval = parents[i]->GetStreamingCallback() ; } - return retval; + return retval ; } -bool wxClassInfo::BeforeWriteObject( const wxObject *obj, wxObjectWriter *streamer, - wxObjectWriterCallback *writercallback, const wxStringToAnyHashMap &metadata) const +bool wxClassInfo::BeforeWriteObject( const wxObject *obj, wxWriter *streamer , wxPersister *persister , wxxVariantArray &metadata) const { - wxObjectStreamingCallback sb = GetStreamingCallback(); + wxObjectStreamingCallback sb = GetStreamingCallback() ; if ( sb ) - return (*sb)(obj, streamer, writercallback, metadata ); + return (*sb)(obj , streamer , persister , metadata ) ; - return true; + return true ; } -void wxClassInfo::SetProperty(wxObject *object, const wxChar *propertyName, - const wxAny &value) const +void wxClassInfo::SetProperty(wxObject *object, const wxChar *propertyName, const wxxVariant &value) const { const wxPropertyAccessor *accessor; accessor = FindAccessor(propertyName); wxASSERT(accessor->HasSetter()); - accessor->SetProperty( object, value ); + accessor->SetProperty( object , value ) ; } -wxAny wxClassInfo::GetProperty(wxObject *object, const wxChar *propertyName) const +wxxVariant wxClassInfo::GetProperty(wxObject *object, const wxChar *propertyName) const { const wxPropertyAccessor *accessor; accessor = FindAccessor(propertyName); wxASSERT(accessor->HasGetter()); - wxAny result; + wxxVariant result ; accessor->GetProperty(object,result); - return result; + return result ; } -wxAnyList wxClassInfo::GetPropertyCollection(wxObject *object, - const wxChar *propertyName) const +wxxVariantArray wxClassInfo::GetPropertyCollection(wxObject *object, const wxChar *propertyName) const { const wxPropertyAccessor *accessor; accessor = FindAccessor(propertyName); wxASSERT(accessor->HasGetter()); - wxAnyList result; + wxxVariantArray result ; accessor->GetPropertyCollection(object,result); - return result; + return result ; } -void wxClassInfo::AddToPropertyCollection(wxObject *object, const wxChar *propertyName, - const wxAny& value) const +void wxClassInfo::AddToPropertyCollection(wxObject *object, const wxChar *propertyName , const wxxVariant& value) const { const wxPropertyAccessor *accessor; accessor = FindAccessor(propertyName); wxASSERT(accessor->HasAdder()); - accessor->AddToPropertyCollection( object, value ); + accessor->AddToPropertyCollection( object , value ) ; } // void wxClassInfo::GetProperties( wxPropertyInfoMap &map ) const @@ -680,49 +524,39 @@ void wxClassInfo::AddToPropertyCollection(wxObject *object, const wxChar *proper // to MSVC and so we use a other name. void wxClassInfo::GetProperties( wxPropertyInfoMap &infomap ) const { - const wxPropertyInfo *pi = GetFirstProperty(); + const wxPropertyInfo *pi = GetFirstProperty() ; while( pi ) { if ( infomap.find( pi->GetName() ) == infomap.end() ) - infomap[pi->GetName()] = (wxPropertyInfo*) pi; + infomap[pi->GetName()] = (wxPropertyInfo*) pi ; - pi = pi->GetNext(); + pi = pi->GetNext() ; } - const wxClassInfo** parents = GetParents(); - for ( int i = 0; parents[i]; ++ i ) + const wxClassInfo** parents = GetParents() ; + for ( int i = 0 ; parents[i] ; ++ i ) { - parents[i]->GetProperties( infomap ); + parents[i]->GetProperties( infomap ) ; } } -wxObject* wxClassInfo::AnyToObjectPtr( const wxAny &data) const -{ - return m_variantOfPtrToObjectConverter(data); -} +/* +VARIANT TO OBJECT +*/ -void wxClassInfo::CallOnAny( const wxAny &data, wxObjectFunctor* functor ) const +wxObject* wxxVariant::GetAsObject() { - if ( data.GetTypeInfo()->GetKind() == wxT_OBJECT ) - return m_variantToObjectConverter(data, functor); + const wxClassTypeInfo *ti = dynamic_cast( m_data->GetTypeInfo() ) ; + if ( ti ) + return ti->GetClassInfo()->VariantToInstance(*this) ; else - return (*functor)(m_variantOfPtrToObjectConverter(data)); -} - -wxAny wxClassInfo::ObjectPtrToAny( wxObject* obj) const -{ - return m_objectToVariantConverter(obj); -} - -bool wxClassInfo::NeedsDirectConstruction() const -{ - return wx_dynamic_cast(wxObjectAllocator*, m_constructor) != NULL; + return NULL ; } // ---------------------------------------------------------------------------- // wxDynamicObject support // ---------------------------------------------------------------------------- - +// // Dynamic Objects are objects that have a real superclass instance and carry their // own attributes in a hash map. Like this it is possible to create the objects and // stream them, as if their class information was already available from compiled data @@ -731,177 +565,167 @@ struct wxDynamicObject::wxDynamicObjectInternal { wxDynamicObjectInternal() {} - wxStringToAnyHashMap m_properties; -}; +#if wxUSE_UNICODE + map m_properties ; +#else + map m_properties ; +#endif +} ; -typedef list< wxDynamicObject* > wxDynamicObjectList; +typedef list< wxDynamicObject* > wxDynamicObjectList ; struct wxDynamicClassInfo::wxDynamicClassInfoInternal { - wxDynamicObjectList m_dynamicObjects; -}; + wxDynamicObjectList m_dynamicObjects ; +} ; // instantiates this object with an instance of its superclass wxDynamicObject::wxDynamicObject(wxObject* superClassInstance, const wxDynamicClassInfo *info) { - m_superClassInstance = superClassInstance; - m_classInfo = info; - m_data = new wxDynamicObjectInternal; + m_superClassInstance = superClassInstance ; + m_classInfo = info ; + m_data = new wxDynamicObjectInternal ; } wxDynamicObject::~wxDynamicObject() { - wx_dynamic_cast(const wxDynamicClassInfo*, m_classInfo)-> - m_data->m_dynamicObjects.remove( this ); - delete m_data; - delete m_superClassInstance; + dynamic_cast(m_classInfo)->m_data->m_dynamicObjects.remove( this ) ; + delete m_data ; + delete m_superClassInstance ; } -void wxDynamicObject::SetProperty (const wxChar *propertyName, const wxAny &value) +void wxDynamicObject::SetProperty (const wxChar *propertyName, const wxxVariant &value) { - wxASSERT_MSG(m_classInfo->FindPropertyInfoInThisClass(propertyName), - wxT("Accessing Unknown Property in a Dynamic Object") ); - m_data->m_properties[propertyName] = value; + wxASSERT_MSG(m_classInfo->FindPropertyInfoInThisClass(propertyName),wxT("Accessing Unknown Property in a Dynamic Object") ) ; + m_data->m_properties[propertyName] = value ; } -wxAny wxDynamicObject::GetProperty (const wxChar *propertyName) const +wxxVariant wxDynamicObject::GetProperty (const wxChar *propertyName) const { - wxASSERT_MSG(m_classInfo->FindPropertyInfoInThisClass(propertyName), - wxT("Accessing Unknown Property in a Dynamic Object") ); - return m_data->m_properties[propertyName]; + wxASSERT_MSG(m_classInfo->FindPropertyInfoInThisClass(propertyName),wxT("Accessing Unknown Property in a Dynamic Object") ) ; + return m_data->m_properties[propertyName] ; } void wxDynamicObject::RemoveProperty( const wxChar *propertyName ) { - wxASSERT_MSG(m_classInfo->FindPropertyInfoInThisClass(propertyName), - wxT("Removing Unknown Property in a Dynamic Object") ); - m_data->m_properties.erase( propertyName ); + wxASSERT_MSG(m_classInfo->FindPropertyInfoInThisClass(propertyName),wxT("Removing Unknown Property in a Dynamic Object") ) ; + m_data->m_properties.erase( propertyName ) ; } -void wxDynamicObject::RenameProperty( const wxChar *oldPropertyName, - const wxChar *newPropertyName ) +void wxDynamicObject::RenameProperty( const wxChar *oldPropertyName , const wxChar *newPropertyName ) { - wxASSERT_MSG(m_classInfo->FindPropertyInfoInThisClass(oldPropertyName), - wxT("Renaming Unknown Property in a Dynamic Object") ); - - wxAny value = m_data->m_properties[oldPropertyName]; - m_data->m_properties.erase( oldPropertyName ); - m_data->m_properties[newPropertyName] = value; + wxASSERT_MSG(m_classInfo->FindPropertyInfoInThisClass(oldPropertyName),wxT("Renaming Unknown Property in a Dynamic Object") ) ; + wxxVariant value = m_data->m_properties[oldPropertyName] ; + m_data->m_properties.erase( oldPropertyName ) ; + m_data->m_properties[newPropertyName] = value ; } // ---------------------------------------------------------------------------- -// wxDynamicClassInfo +// wxDynamiClassInfo // ---------------------------------------------------------------------------- -wxDynamicClassInfo::wxDynamicClassInfo( const wxChar *unitName, - const wxChar *className, - const wxClassInfo* superClass ) : - wxClassInfo( unitName, className, new const wxClassInfo*[2]) +wxDynamicClassInfo::wxDynamicClassInfo( const wxChar *unitName, const wxChar *className , const wxClassInfo* superClass ) : +wxClassInfo( unitName, className , new const wxClassInfo*[2]) { - GetParents()[0] = superClass; - GetParents()[1] = NULL; - m_data = new wxDynamicClassInfoInternal; + GetParents()[0] = superClass ; + GetParents()[1] = NULL ; + m_data = new wxDynamicClassInfoInternal ; } wxDynamicClassInfo::~wxDynamicClassInfo() { - delete[] GetParents(); - delete m_data; + delete[] GetParents() ; + delete m_data ; } wxObject *wxDynamicClassInfo::AllocateObject() const { - wxObject* parent = GetParents()[0]->AllocateObject(); - wxDynamicObject *obj = new wxDynamicObject( parent, this ); - m_data->m_dynamicObjects.push_back( obj ); - return obj; + wxObject* parent = GetParents()[0]->AllocateObject() ; + wxDynamicObject *obj = new wxDynamicObject( parent , this ) ; + m_data->m_dynamicObjects.push_back( obj ) ; + return obj ; } -bool wxDynamicClassInfo::Create (wxObject *object, int paramCount, wxAny *params) const +void wxDynamicClassInfo::Create (wxObject *object, int paramCount, wxxVariant *params) const { - wxDynamicObject *dynobj = wx_dynamic_cast( wxDynamicObject *, object ); - wxASSERT_MSG( dynobj, - wxT("cannot call wxDynamicClassInfo::Create on ") - wxT("an object other than wxDynamicObject") ); - - return GetParents()[0]->Create( dynobj->GetSuperClassInstance(), paramCount, params ); + wxDynamicObject *dynobj = dynamic_cast< wxDynamicObject *>( object ) ; + wxASSERT_MSG( dynobj , wxT("cannot call wxDynamicClassInfo::Create on an object other than wxDynamicObject") ) ; + GetParents()[0]->Create( dynobj->GetSuperClassInstance() , paramCount , params ) ; } // get number of parameters for constructor int wxDynamicClassInfo::GetCreateParamCount() const { - return GetParents()[0]->GetCreateParamCount(); + return GetParents()[0]->GetCreateParamCount() ; } // get i-th constructor parameter const wxChar* wxDynamicClassInfo::GetCreateParamName(int i) const { - return GetParents()[0]->GetCreateParamName( i ); + return GetParents()[0]->GetCreateParamName( i ) ; } -void wxDynamicClassInfo::SetProperty(wxObject *object, const wxChar *propertyName, const wxAny &value) const +void wxDynamicClassInfo::SetProperty(wxObject *object, const wxChar *propertyName, const wxxVariant &value) const { - wxDynamicObject* dynobj = wx_dynamic_cast(wxDynamicObject*, object); - wxASSERT_MSG( dynobj, wxT("cannot call wxDynamicClassInfo::SetProperty on an object other than wxDynamicObject") ); + wxDynamicObject* dynobj = dynamic_cast< wxDynamicObject * >( object ) ; + wxASSERT_MSG( dynobj , wxT("cannot call wxDynamicClassInfo::SetProperty on an object other than wxDynamicObject") ) ; if ( FindPropertyInfoInThisClass(propertyName) ) - dynobj->SetProperty( propertyName, value ); + dynobj->SetProperty( propertyName , value ) ; else - GetParents()[0]->SetProperty( dynobj->GetSuperClassInstance(), propertyName, value ); + GetParents()[0]->SetProperty( dynobj->GetSuperClassInstance() , propertyName , value ) ; } -wxAny wxDynamicClassInfo::GetProperty(wxObject *object, const wxChar *propertyName) const +wxxVariant wxDynamicClassInfo::GetProperty(wxObject *object, const wxChar *propertyName) const { - wxDynamicObject* dynobj = wx_dynamic_cast(wxDynamicObject*, object); - wxASSERT_MSG( dynobj, wxT("cannot call wxDynamicClassInfo::SetProperty on an object other than wxDynamicObject") ); + wxDynamicObject* dynobj = dynamic_cast< wxDynamicObject * >( object ) ; + wxASSERT_MSG( dynobj , wxT("cannot call wxDynamicClassInfo::SetProperty on an object other than wxDynamicObject") ) ; if ( FindPropertyInfoInThisClass(propertyName) ) - return dynobj->GetProperty( propertyName ); + return dynobj->GetProperty( propertyName ) ; else - return GetParents()[0]->GetProperty( dynobj->GetSuperClassInstance(), propertyName ); + return GetParents()[0]->GetProperty( dynobj->GetSuperClassInstance() , propertyName ) ; } -void wxDynamicClassInfo::AddProperty( const wxChar *propertyName, const wxTypeInfo* typeInfo ) +void wxDynamicClassInfo::AddProperty( const wxChar *propertyName , const wxTypeInfo* typeInfo ) { - EnsureInfosInited(); - new wxPropertyInfo( m_firstProperty, this, propertyName, typeInfo->GetTypeName(), new wxGenericPropertyAccessor( propertyName ), wxAny() ); + new wxPropertyInfo( m_firstProperty , this , propertyName , typeInfo->GetTypeName() , new wxGenericPropertyAccessor( propertyName ) , wxxVariant() ) ; } -void wxDynamicClassInfo::AddHandler( const wxChar *handlerName, wxObjectEventFunction address, const wxClassInfo* eventClassInfo ) +void wxDynamicClassInfo::AddHandler( const wxChar *handlerName , wxObjectEventFunction address , const wxClassInfo* eventClassInfo ) { - EnsureInfosInited(); - new wxHandlerInfo( m_firstHandler, this, handlerName, address, eventClassInfo ); + new wxHandlerInfo( m_firstHandler , this , handlerName , address , eventClassInfo ) ; } // removes an existing runtime-property void wxDynamicClassInfo::RemoveProperty( const wxChar *propertyName ) { - for ( wxDynamicObjectList::iterator iter = m_data->m_dynamicObjects.begin(); iter != m_data->m_dynamicObjects.end(); ++iter ) - (*iter)->RemoveProperty( propertyName ); - delete FindPropertyInfoInThisClass(propertyName); + for ( wxDynamicObjectList::iterator iter = m_data->m_dynamicObjects.begin() ; iter != m_data->m_dynamicObjects.end() ; ++iter ) + (*iter)->RemoveProperty( propertyName ) ; + delete FindPropertyInfoInThisClass(propertyName) ; } // removes an existing runtime-handler void wxDynamicClassInfo::RemoveHandler( const wxChar *handlerName ) { - delete FindHandlerInfoInThisClass(handlerName); + delete FindHandlerInfoInThisClass(handlerName) ; } // renames an existing runtime-property -void wxDynamicClassInfo::RenameProperty( const wxChar *oldPropertyName, const wxChar *newPropertyName ) +void wxDynamicClassInfo::RenameProperty( const wxChar *oldPropertyName , const wxChar *newPropertyName ) { - wxPropertyInfo* pi = FindPropertyInfoInThisClass(oldPropertyName); - wxASSERT_MSG( pi,wxT("not existing property") ); - pi->m_name = newPropertyName; - wx_dynamic_cast(wxGenericPropertyAccessor*, pi->GetAccessor())->RenameProperty( oldPropertyName, newPropertyName ); - for ( wxDynamicObjectList::iterator iter = m_data->m_dynamicObjects.begin(); iter != m_data->m_dynamicObjects.end(); ++iter ) - (*iter)->RenameProperty( oldPropertyName, newPropertyName ); + wxPropertyInfo* pi = FindPropertyInfoInThisClass(oldPropertyName) ; + wxASSERT_MSG( pi ,wxT("not existing property") ) ; + pi->m_name = newPropertyName ; + dynamic_cast(pi->GetAccessor())->RenameProperty( oldPropertyName , newPropertyName ) ; + for ( wxDynamicObjectList::iterator iter = m_data->m_dynamicObjects.begin() ; iter != m_data->m_dynamicObjects.end() ; ++iter ) + (*iter)->RenameProperty( oldPropertyName , newPropertyName ) ; } // renames an existing runtime-handler -void wxDynamicClassInfo::RenameHandler( const wxChar *oldHandlerName, const wxChar *newHandlerName ) +void wxDynamicClassInfo::RenameHandler( const wxChar *oldHandlerName , const wxChar *newHandlerName ) { - wxASSERT_MSG(FindHandlerInfoInThisClass(oldHandlerName),wxT("not existing handler") ); - FindHandlerInfoInThisClass(oldHandlerName)->m_name = newHandlerName; + wxASSERT_MSG(FindHandlerInfoInThisClass(oldHandlerName),wxT("not existing handler") ) ; + FindHandlerInfoInThisClass(oldHandlerName)->m_name = newHandlerName ; } // ---------------------------------------------------------------------------- @@ -910,63 +734,34 @@ void wxDynamicClassInfo::RenameHandler( const wxChar *oldHandlerName, const wxCh struct wxGenericPropertyAccessor::wxGenericPropertyAccessorInternal { - char filler; -}; + char filler ; +} ; wxGenericPropertyAccessor::wxGenericPropertyAccessor( const wxString& propertyName ) -: wxPropertyAccessor( NULL, NULL, NULL, NULL ) +: wxPropertyAccessor( NULL , NULL , NULL , NULL ) { - m_data = new wxGenericPropertyAccessorInternal; - m_propertyName = propertyName; - m_getterName = wxT("Get")+propertyName; - m_setterName = wxT("Set")+propertyName; + m_data = new wxGenericPropertyAccessorInternal ; + m_propertyName = propertyName ; + m_getterName = wxT("Get")+propertyName ; + m_setterName = wxT("Set")+propertyName ; } wxGenericPropertyAccessor::~wxGenericPropertyAccessor() { - delete m_data; + delete m_data ; } - -void wxGenericPropertyAccessor::SetProperty(wxObject *object, const wxAny &value) const +void wxGenericPropertyAccessor::SetProperty(wxObject *object, const wxxVariant &value) const { - wxDynamicObject* dynobj = wx_dynamic_cast(wxDynamicObject*, object); - wxASSERT_MSG( dynobj, wxT("cannot call wxDynamicClassInfo::SetProperty on an object other than wxDynamicObject") ); - dynobj->SetProperty(m_propertyName.c_str(), value ); + wxDynamicObject* dynobj = dynamic_cast< wxDynamicObject * >( object ) ; + wxASSERT_MSG( dynobj , wxT("cannot call wxDynamicClassInfo::SetProperty on an object other than wxDynamicObject") ) ; + dynobj->SetProperty(m_propertyName , value ) ; } -void wxGenericPropertyAccessor::GetProperty(const wxObject *object, wxAny& value) const +void wxGenericPropertyAccessor::GetProperty(const wxObject *object, wxxVariant& value) const { - const wxDynamicObject* dynobj = wx_dynamic_cast( const wxDynamicObject * , object ); - wxASSERT_MSG( dynobj, wxT("cannot call wxDynamicClassInfo::SetProperty on an object other than wxDynamicObject") ); - value = dynobj->GetProperty( m_propertyName.c_str() ); + const wxDynamicObject* dynobj = dynamic_cast< const wxDynamicObject * >( object ) ; + wxASSERT_MSG( dynobj , wxT("cannot call wxDynamicClassInfo::SetProperty on an object other than wxDynamicObject") ) ; + value = dynobj->GetProperty( m_propertyName ) ; } -// ---------------------------------------------------------------------------- -// wxGenericPropertyAccessor -// ---------------------------------------------------------------------------- - -wxString wxAnyGetAsString( const wxAny& data) -{ - if ( data.IsNull() || data.GetTypeInfo()==NULL ) - return wxEmptyString; - - wxString s; - data.GetTypeInfo()->ConvertToString(data,s); - return s; -} - -const wxObject* wxAnyGetAsObjectPtr( const wxAny& data) -{ - if ( !data.IsNull() ) - { - const wxClassTypeInfo* ti = wx_dynamic_cast(const wxClassTypeInfo*, data.GetTypeInfo()); - if( ti ) - return ti->GetClassInfo()->AnyToObjectPtr(data); - } - return NULL; -} - -wxObjectFunctor::~wxObjectFunctor() -{}; - #endif // wxUSE_EXTENDED_RTTI diff --git a/Source/3rd Party/wx/src/common/xtistrm.cpp b/Source/3rd Party/wx/src/common/xtistrm.cpp index 4c09363bd..b1e7f53cb 100644 --- a/Source/3rd Party/wx/src/common/xtistrm.cpp +++ b/Source/3rd Party/wx/src/common/xtistrm.cpp @@ -4,7 +4,7 @@ // Author: Stefan Csomor // Modified by: // Created: 27/07/03 -// RCS-ID: $Id$ +// RCS-ID: $Id: xtistrm.cpp 38939 2006-04-27 12:47:14Z ABX $ // Copyright: (c) 2003 Stefan Csomor // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -29,418 +29,369 @@ #include "wx/tokenzr.h" #include "wx/txtstrm.h" -// STL headers: - #include "wx/beforestd.h" #include #include #include #include "wx/afterstd.h" -using namespace std; +using namespace std ; -// ---------------------------------------------------------------------------- -// wxObjectWriter -// ---------------------------------------------------------------------------- - -struct wxObjectWriter::wxObjectWriterInternal +struct wxWriter::wxWriterInternal { - map< const wxObject*, int > m_writtenObjects; - int m_nextId; -}; + map< const wxObject* , int > m_writtenObjects ; + int m_nextId ; +} ; -wxObjectWriter::wxObjectWriter() +wxWriter::wxWriter() { - m_data = new wxObjectWriterInternal; - m_data->m_nextId = 0; + m_data = new wxWriterInternal ; + m_data->m_nextId = 0 ; } -wxObjectWriter::~wxObjectWriter() +wxWriter::~wxWriter() { - delete m_data; + delete m_data ; } -struct wxObjectWriter::wxObjectWriterInternalPropertiesData +struct wxWriter::wxWriterInternalPropertiesData { - char nothing; -}; + char nothing ; +} ; -void wxObjectWriter::ClearObjectContext() +void wxWriter::ClearObjectContext() { - delete m_data; - m_data = new wxObjectWriterInternal(); - m_data->m_nextId = 0; + delete m_data ; + m_data = new wxWriterInternal() ; + m_data->m_nextId = 0 ; } -void wxObjectWriter::WriteObject(const wxObject *object, const wxClassInfo *classInfo, - wxObjectWriterCallback *writercallback, const wxString &name, - const wxStringToAnyHashMap &metadata ) +void wxWriter::WriteObject(const wxObject *object, const wxClassInfo *classInfo , wxPersister *persister , const wxString &name , wxxVariantArray &metadata ) { - DoBeginWriteTopLevelEntry( name ); - WriteObject( object, classInfo, writercallback, false, metadata); - DoEndWriteTopLevelEntry( name ); + DoBeginWriteTopLevelEntry( name ) ; + WriteObject( object , classInfo , persister , false , metadata) ; + DoEndWriteTopLevelEntry( name ) ; } -void wxObjectWriter::WriteObject(const wxObject *object, const wxClassInfo *classInfo, - wxObjectWriterCallback *writercallback, bool isEmbedded, - const wxStringToAnyHashMap &metadata ) +void wxWriter::WriteObject(const wxObject *object, const wxClassInfo *classInfo , wxPersister *persister , bool isEmbedded, wxxVariantArray &metadata ) { - if ( !classInfo->BeforeWriteObject( object, this, writercallback, metadata) ) - return; + if ( !classInfo->BeforeWriteObject( object , this , persister , metadata) ) + return ; - if ( writercallback->BeforeWriteObject( this, object, classInfo, metadata) ) + if ( persister->BeforeWriteObject( this , object , classInfo , metadata) ) { if ( object == NULL ) - DoWriteNullObject(); + DoWriteNullObject() ; else if ( IsObjectKnown( object ) ) - DoWriteRepeatedObject( GetObjectID(object) ); + DoWriteRepeatedObject( GetObjectID(object) ) ; else { - int oid = m_data->m_nextId++; + int oid = m_data->m_nextId++ ; if ( !isEmbedded ) - m_data->m_writtenObjects[object] = oid; + m_data->m_writtenObjects[object] = oid ; // in case this object is a wxDynamicObject we also have to insert is superclass // instance with the same id, so that object relations are streamed out correctly - const wxDynamicObject* dynobj = wx_dynamic_cast(const wxDynamicObject*, object); + const wxDynamicObject* dynobj = dynamic_cast( object ) ; if ( !isEmbedded && dynobj ) - m_data->m_writtenObjects[dynobj->GetSuperClassInstance()] = oid; + m_data->m_writtenObjects[dynobj->GetSuperClassInstance()] = oid ; - DoBeginWriteObject( object, classInfo, oid, metadata ); - wxObjectWriterInternalPropertiesData data; - WriteAllProperties( object, classInfo, writercallback, &data ); - DoEndWriteObject( object, classInfo, oid ); + DoBeginWriteObject( object , classInfo , oid , metadata ) ; + wxWriterInternalPropertiesData data ; + WriteAllProperties( object , classInfo , persister , &data ) ; + DoEndWriteObject( object , classInfo , oid ) ; } - writercallback->AfterWriteObject( this,object, classInfo ); + persister->AfterWriteObject( this ,object , classInfo ) ; } } -void wxObjectWriter::FindConnectEntry(const wxEvtHandler * evSource, - const wxEventSourceTypeInfo* dti, - const wxObject* &sink, - const wxHandlerInfo *&handler) +void wxWriter::FindConnectEntry(const wxEvtHandler * evSource,const wxDelegateTypeInfo* dti, const wxObject* &sink , const wxHandlerInfo *&handler) { - wxList *dynamicEvents = evSource->GetDynamicEventTable(); + wxList *dynamicEvents = evSource->GetDynamicEventTable() ; if ( dynamicEvents ) { - for ( wxList::const_iterator node = dynamicEvents->begin(); node != dynamicEvents->end(); ++node ) + wxList::compatibility_iterator node = dynamicEvents->GetFirst(); + while (node) { - wxDynamicEventTableEntry *entry = (wxDynamicEventTableEntry*)(*node); + wxDynamicEventTableEntry *entry = (wxDynamicEventTableEntry*)node->GetData(); // find the match if ( entry->m_fn && (dti->GetEventType() == entry->m_eventType) && (entry->m_id == -1 ) && - (entry->m_fn->GetEvtHandler() != NULL ) ) + (entry->m_eventSink != NULL ) ) { - sink = entry->m_fn->GetEvtHandler(); - const wxClassInfo* sinkClassInfo = sink->GetClassInfo(); - const wxHandlerInfo* sinkHandler = sinkClassInfo->GetFirstHandler(); + sink = entry->m_eventSink ; + const wxClassInfo* sinkClassInfo = sink->GetClassInfo() ; + const wxHandlerInfo* sinkHandler = sinkClassInfo->GetFirstHandler() ; while ( sinkHandler ) { - if ( sinkHandler->GetEventFunction() == entry->m_fn->GetEvtMethod() ) + if ( sinkHandler->GetEventFunction() == entry->m_fn ) { - handler = sinkHandler; - break; + handler = sinkHandler ; + break ; } - sinkHandler = sinkHandler->GetNext(); + sinkHandler = sinkHandler->GetNext() ; } - break; + break ; } + node = node->GetNext(); } } } -void wxObjectWriter::WriteAllProperties( const wxObject * obj, const wxClassInfo* ci, - wxObjectWriterCallback *writercallback, - wxObjectWriterInternalPropertiesData * data ) +void wxWriter::WriteAllProperties( const wxObject * obj , const wxClassInfo* ci , wxPersister *persister, wxWriterInternalPropertiesData * data ) { - wxPropertyInfoMap map; - ci->GetProperties( map ); - for ( int i = 0; i < ci->GetCreateParamCount(); ++i ) + wxPropertyInfoMap map ; + ci->GetProperties( map ) ; + for ( int i = 0 ; i < ci->GetCreateParamCount() ; ++i ) { - wxString name = ci->GetCreateParamName(i); - wxPropertyInfoMap::const_iterator iter = map.find(name); - const wxPropertyInfo* prop = iter == map.end() ? NULL : iter->second; + wxString name = ci->GetCreateParamName(i) ; + const wxPropertyInfo* prop = map.find(name)->second ; if ( prop ) { - WriteOneProperty( obj, prop->GetDeclaringClass(), prop, writercallback, data ); + WriteOneProperty( obj , prop->GetDeclaringClass() , prop , persister , data ) ; } else { - wxLogError( _("Create Parameter %s not found in declared RTTI Parameters"), name.c_str() ); + wxLogError( _("Create Parameter not found in declared RTTI Parameters") ) ; } - map.erase( name ); + map.erase( name ) ; } { // Extra block for broken compilers - for( wxPropertyInfoMap::iterator iter = map.begin(); iter != map.end(); ++iter ) + for( wxPropertyInfoMap::iterator iter = map.begin() ; iter != map.end() ; ++iter ) { - const wxPropertyInfo* prop = iter->second; + const wxPropertyInfo* prop = iter->second ; if ( prop->GetFlags() & wxPROP_OBJECT_GRAPH ) { - WriteOneProperty( obj, prop->GetDeclaringClass(), prop, writercallback, data ); + WriteOneProperty( obj , prop->GetDeclaringClass() , prop , persister , data ) ; } } } { // Extra block for broken compilers - for( wxPropertyInfoMap::iterator iter = map.begin(); iter != map.end(); ++iter ) + for( wxPropertyInfoMap::iterator iter = map.begin() ; iter != map.end() ; ++iter ) { - const wxPropertyInfo* prop = iter->second; + const wxPropertyInfo* prop = iter->second ; if ( !(prop->GetFlags() & wxPROP_OBJECT_GRAPH) ) { - WriteOneProperty( obj, prop->GetDeclaringClass(), prop, writercallback, data ); + WriteOneProperty( obj , prop->GetDeclaringClass() , prop , persister , data ) ; } } } } -class WXDLLIMPEXP_BASE wxObjectPropertyWriter: public wxObjectWriterFunctor -{ -public: - wxObjectPropertyWriter(const wxClassTypeInfo* cti, - wxObjectWriterCallback *writercallback, - wxObjectWriter* writer, - wxStringToAnyHashMap &props) : - m_cti(cti),m_persister(writercallback),m_writer(writer),m_props(props) - {} - - virtual void operator()(const wxObject *vobj) - { - m_writer->WriteObject( vobj, (vobj ? vobj->GetClassInfo() : m_cti->GetClassInfo() ), - m_persister, m_cti->GetKind()== wxT_OBJECT, m_props ); - } -private: - const wxClassTypeInfo* m_cti; - wxObjectWriterCallback *m_persister; - wxObjectWriter* m_writer; - wxStringToAnyHashMap& m_props; -}; - -void wxObjectWriter::WriteOneProperty( const wxObject *obj, const wxClassInfo* ci, - const wxPropertyInfo* pi, wxObjectWriterCallback *writercallback, - wxObjectWriterInternalPropertiesData *WXUNUSED(data) ) +void wxWriter::WriteOneProperty( const wxObject *obj , const wxClassInfo* ci , const wxPropertyInfo* pi , wxPersister *persister , wxWriterInternalPropertiesData *WXUNUSED(data) ) { if ( pi->GetFlags() & wxPROP_DONT_STREAM ) - return; + return ; // make sure that we are picking the correct object for accessing the property - const wxDynamicObject* dynobj = wx_dynamic_cast(const wxDynamicObject*, obj ); - if ( dynobj && (wx_dynamic_cast(const wxDynamicClassInfo*, ci) == NULL) ) - obj = dynobj->GetSuperClassInstance(); + const wxDynamicObject* dynobj = dynamic_cast< const wxDynamicObject* > (obj ) ; + if ( dynobj && (dynamic_cast(ci) == NULL) ) + obj = dynobj->GetSuperClassInstance() ; if ( pi->GetTypeInfo()->GetKind() == wxT_COLLECTION ) { - wxAnyList data; - pi->GetAccessor()->GetPropertyCollection(obj, data); - const wxTypeInfo * elementType = - wx_dynamic_cast( const wxCollectionTypeInfo*, pi->GetTypeInfo() )->GetElementType(); - if ( !data.empty() ) + wxxVariantArray data ; + pi->GetAccessor()->GetPropertyCollection(obj, data) ; + const wxTypeInfo * elementType = dynamic_cast< const wxCollectionTypeInfo* >( pi->GetTypeInfo() )->GetElementType() ; + for ( size_t i = 0 ; i < data.GetCount() ; ++i ) { - DoBeginWriteProperty( pi ); - for ( wxAnyList::const_iterator iter = data.begin(); iter != data.end(); ++iter ) - { - DoBeginWriteElement(); - const wxAny* valptr = *iter; - if ( writercallback->BeforeWriteProperty( this, obj, pi, *valptr ) ) - { - const wxClassTypeInfo* cti = - wx_dynamic_cast( const wxClassTypeInfo*, elementType ); - if ( cti ) - { - wxStringToAnyHashMap md; - wxObjectPropertyWriter pw(cti,writercallback,this, md); + if ( i == 0 ) + DoBeginWriteProperty( pi ) ; - const wxClassInfo* pci = cti->GetClassInfo(); - pci->CallOnAny( *valptr, &pw); - } - else - { - DoWriteSimpleType( *valptr ); - } + DoBeginWriteElement() ; + wxxVariant value = data[i] ; + if ( persister->BeforeWriteProperty( this , obj, pi , value ) ) + { + const wxClassTypeInfo* cti = dynamic_cast< const wxClassTypeInfo* > ( elementType ) ; + if ( cti ) + { + const wxClassInfo* pci = cti->GetClassInfo() ; + wxObject *vobj = pci->VariantToInstance( value ) ; + wxxVariantArray md ; + WriteObject( vobj , (vobj ? vobj->GetClassInfo() : pci ) , persister , cti->GetKind()== wxT_OBJECT , md ) ; + } + else + { + DoWriteSimpleType( value ) ; } - DoEndWriteElement(); } - DoEndWriteProperty( pi ); - } - } + DoEndWriteElement() ; + if ( i == data.GetCount() - 1 ) + DoEndWriteProperty( pi ) ; + } + } else { - const wxEventSourceTypeInfo* dti = - wx_dynamic_cast( const wxEventSourceTypeInfo* , pi->GetTypeInfo() ); + const wxDelegateTypeInfo* dti = dynamic_cast< const wxDelegateTypeInfo* > ( pi->GetTypeInfo() ) ; if ( dti ) { - const wxObject* sink = NULL; - const wxHandlerInfo *handler = NULL; + const wxObject* sink = NULL ; + const wxHandlerInfo *handler = NULL ; - const wxEvtHandler * evSource = wx_dynamic_cast(const wxEvtHandler *, obj); + const wxEvtHandler * evSource = dynamic_cast(obj) ; if ( evSource ) { - FindConnectEntry( evSource, dti, sink, handler ); - if ( writercallback->BeforeWriteDelegate( this, obj, ci, pi, sink, handler ) ) + FindConnectEntry( evSource , dti , sink , handler ) ; + if ( persister->BeforeWriteDelegate( this , obj , ci , pi , sink , handler ) ) { if ( sink != NULL && handler != NULL ) { - DoBeginWriteProperty( pi ); + DoBeginWriteProperty( pi ) ; if ( IsObjectKnown( sink ) ) { - DoWriteDelegate( obj, ci, pi, sink, GetObjectID( sink ), - sink->GetClassInfo(), handler ); - DoEndWriteProperty( pi ); + DoWriteDelegate( obj , ci , pi , sink , GetObjectID( sink ) , sink->GetClassInfo() , handler ) ; + DoEndWriteProperty( pi ) ; } else { - wxLogError( wxT("Streaming delegates for not already ") - wxT("streamed objects not yet supported") ); + wxLogError( _("Streaming delegates for not already streamed objects not yet supported") ) ; } } } } else { - wxLogError(_("Illegal Object Class (Non-wxEvtHandler) as Event Source") ); + wxLogError(_("Illegal Object Class (Non-wxEvtHandler) as Event Source") ) ; } } else { - wxAny value; - pi->GetAccessor()->GetProperty(obj, value); + wxxVariant value ; + pi->GetAccessor()->GetProperty(obj, value) ; // avoid streaming out void objects - // TODO Verify - if( value.IsNull() ) - return; + if( value.IsEmpty() ) + return ; if ( pi->GetFlags() & wxPROP_ENUM_STORE_LONG ) { - const wxEnumTypeInfo *eti = - wx_dynamic_cast(const wxEnumTypeInfo*, pi->GetTypeInfo() ); + const wxEnumTypeInfo *eti = dynamic_cast( pi->GetTypeInfo() ) ; if ( eti ) { - eti->ConvertFromLong( wxANY_AS(value, long ), value ); + eti->ConvertFromLong( value.wxTEMPLATED_MEMBER_CALL(Get , long) , value ) ; } else { - wxLogError( _("Type must have enum - long conversion") ); + wxLogError( _("Type must have enum - long conversion") ) ; } } // avoid streaming out default values - if ( pi->GetTypeInfo()->HasStringConverters() && - !pi->GetDefaultValue().IsNull() ) // TODO Verify + if ( pi->GetTypeInfo()->HasStringConverters() && !pi->GetDefaultValue().IsEmpty() ) { - if ( wxAnyGetAsString(value) == wxAnyGetAsString(pi->GetDefaultValue()) ) - return; + if ( value.GetAsString() == pi->GetDefaultValue().GetAsString() ) + return ; } // avoid streaming out null objects - const wxClassTypeInfo* cti = - wx_dynamic_cast( const wxClassTypeInfo* , pi->GetTypeInfo() ); + const wxClassTypeInfo* cti = dynamic_cast< const wxClassTypeInfo* > ( pi->GetTypeInfo() ) ; - if ( cti && cti->GetKind() == wxT_OBJECT_PTR && wxAnyGetAsObjectPtr(value) == NULL ) - return; + if ( cti && value.GetAsObject() == NULL ) + return ; - if ( writercallback->BeforeWriteProperty( this, obj, pi, value ) ) + if ( persister->BeforeWriteProperty( this , obj, pi , value ) ) { - DoBeginWriteProperty( pi ); + DoBeginWriteProperty( pi ) ; if ( cti ) { - if ( cti->HasStringConverters() ) + const wxClassInfo* pci = cti->GetClassInfo() ; + wxObject *vobj = pci->VariantToInstance( value ) ; + if ( vobj && pi->GetTypeInfo()->HasStringConverters() ) { - wxString stringValue; - cti->ConvertToString( value, stringValue ); - wxAny convertedValue(stringValue); - DoWriteSimpleType( convertedValue ); + wxString stringValue ; + cti->ConvertToString( value , stringValue ) ; + wxxVariant convertedValue(stringValue) ; + DoWriteSimpleType( convertedValue ) ; } else { - wxStringToAnyHashMap md; - wxObjectPropertyWriter pw(cti,writercallback,this, md); - - const wxClassInfo* pci = cti->GetClassInfo(); - pci->CallOnAny(value, &pw); + wxxVariantArray md ; + WriteObject( vobj , (vobj ? vobj->GetClassInfo() : pci ) , persister , cti->GetKind()== wxT_OBJECT , md) ; } } else { - DoWriteSimpleType( value ); + DoWriteSimpleType( value ) ; } - DoEndWriteProperty( pi ); + DoEndWriteProperty( pi ) ; } } } } -int wxObjectWriter::GetObjectID(const wxObject *obj) +int wxWriter::GetObjectID(const wxObject *obj) { if ( !IsObjectKnown( obj ) ) - return wxInvalidObjectID; + return wxInvalidObjectID ; - return m_data->m_writtenObjects[obj]; + return m_data->m_writtenObjects[obj] ; } -bool wxObjectWriter::IsObjectKnown( const wxObject *obj ) +bool wxWriter::IsObjectKnown( const wxObject *obj ) { - return m_data->m_writtenObjects.find( obj ) != m_data->m_writtenObjects.end(); + return m_data->m_writtenObjects.find( obj ) != m_data->m_writtenObjects.end() ; } // ---------------------------------------------------------------------------- -// wxObjectReader +// reading objects in // ---------------------------------------------------------------------------- -struct wxObjectReader::wxObjectReaderInternal +struct wxReader::wxReaderInternal { map m_classInfos; }; -wxObjectReader::wxObjectReader() +wxReader::wxReader() { - m_data = new wxObjectReaderInternal; + m_data = new wxReaderInternal; } -wxObjectReader::~wxObjectReader() +wxReader::~wxReader() { delete m_data; } -wxClassInfo* wxObjectReader::GetObjectClassInfo(int objectID) +wxClassInfo* wxReader::GetObjectClassInfo(int objectID) { if ( objectID == wxNullObjectID || objectID == wxInvalidObjectID ) { - wxLogError( _("Invalid or Null Object ID passed to GetObjectClassInfo" ) ); - return NULL; + wxLogError( _("Invalid or Null Object ID passed to GetObjectClassInfo" ) ) ; + return NULL ; } if ( m_data->m_classInfos.find(objectID) == m_data->m_classInfos.end() ) { - wxLogError( _("Unknown Object passed to GetObjectClassInfo" ) ); - return NULL; + wxLogError( _("Unknown Object passed to GetObjectClassInfo" ) ) ; + return NULL ; } - return m_data->m_classInfos[objectID]; + return m_data->m_classInfos[objectID] ; } -void wxObjectReader::SetObjectClassInfo(int objectID, wxClassInfo *classInfo ) +void wxReader::SetObjectClassInfo(int objectID, wxClassInfo *classInfo ) { if ( objectID == wxNullObjectID || objectID == wxInvalidObjectID ) { - wxLogError( _("Invalid or Null Object ID passed to GetObjectClassInfo" ) ); - return; + wxLogError( _("Invalid or Null Object ID passed to GetObjectClassInfo" ) ) ; + return ; } if ( m_data->m_classInfos.find(objectID) != m_data->m_classInfos.end() ) { - wxLogError( _("Already Registered Object passed to SetObjectClassInfo" ) ); - return; + wxLogError( _("Already Registered Object passed to SetObjectClassInfo" ) ) ; + return ; } - m_data->m_classInfos[objectID] = classInfo; + m_data->m_classInfos[objectID] = classInfo ; } -bool wxObjectReader::HasObjectClassInfo( int objectID ) +bool wxReader::HasObjectClassInfo( int objectID ) { if ( objectID == wxNullObjectID || objectID == wxInvalidObjectID ) { - wxLogError( _("Invalid or Null Object ID passed to HasObjectClassInfo" ) ); - return false; + wxLogError( _("Invalid or Null Object ID passed to HasObjectClassInfo" ) ) ; + return NULL ; } - return m_data->m_classInfos.find(objectID) != m_data->m_classInfos.end(); + return m_data->m_classInfos.find(objectID) != m_data->m_classInfos.end() ; } @@ -456,10 +407,10 @@ and create params are always toplevel class only // ---------------------------------------------------------------------------- -// wxObjectRuntimeReaderCallback - depersisting to memory +// depersisting to memory // ---------------------------------------------------------------------------- -struct wxObjectRuntimeReaderCallback::wxObjectRuntimeReaderCallbackInternal +struct wxRuntimeDepersister::wxRuntimeDepersisterInternal { map m_objects; @@ -467,54 +418,54 @@ struct wxObjectRuntimeReaderCallback::wxObjectRuntimeReaderCallbackInternal { if ( m_objects.find(objectID) != m_objects.end() ) { - wxLogError( _("Passing a already registered object to SetObject") ); - return ; + wxLogError( _("Passing a already registered object to SetObject") ) ; + return ; } - m_objects[objectID] = obj; + m_objects[objectID] = obj ; } wxObject* GetObject( int objectID ) { if ( objectID == wxNullObjectID ) - return NULL; + return NULL ; if ( m_objects.find(objectID) == m_objects.end() ) { - wxLogError( _("Passing an unknown object to GetObject") ); - return NULL; + wxLogError( _("Passing an unkown object to GetObject") ) ; + return NULL ; } - return m_objects[objectID]; + return m_objects[objectID] ; } -}; +} ; -wxObjectRuntimeReaderCallback::wxObjectRuntimeReaderCallback() +wxRuntimeDepersister::wxRuntimeDepersister() { - m_data = new wxObjectRuntimeReaderCallbackInternal(); + m_data = new wxRuntimeDepersisterInternal() ; } -wxObjectRuntimeReaderCallback::~wxObjectRuntimeReaderCallback() +wxRuntimeDepersister::~wxRuntimeDepersister() { - delete m_data; + delete m_data ; } -void wxObjectRuntimeReaderCallback::AllocateObject(int objectID, wxClassInfo *classInfo, - wxStringToAnyHashMap &WXUNUSED(metadata)) +void wxRuntimeDepersister::AllocateObject(int objectID, wxClassInfo *classInfo , + wxxVariantArray &WXUNUSED(metadata)) { wxObject *O; O = classInfo->CreateObject(); m_data->SetObject(objectID, O); } -void wxObjectRuntimeReaderCallback::CreateObject(int objectID, +void wxRuntimeDepersister::CreateObject(int objectID, const wxClassInfo *classInfo, int paramCount, - wxAny *params, + wxxVariant *params, int *objectIdValues, - const wxClassInfo **objectClassInfos, - wxStringToAnyHashMap &WXUNUSED(metadata)) + const wxClassInfo **objectClassInfos , + wxxVariantArray &WXUNUSED(metadata)) { wxObject *o; o = m_data->GetObject(objectID); - for ( int i = 0; i < paramCount; ++i ) + for ( int i = 0 ; i < paramCount ; ++i ) { if ( objectIdValues[i] != wxInvalidObjectID ) { @@ -522,27 +473,27 @@ void wxObjectRuntimeReaderCallback::CreateObject(int objectID, o = m_data->GetObject(objectIdValues[i]); // if this is a dynamic object and we are asked for another class // than wxDynamicObject we cast it down manually. - wxDynamicObject *dyno = wx_dynamic_cast( wxDynamicObject *, o); + wxDynamicObject *dyno = dynamic_cast< wxDynamicObject * > (o) ; if ( dyno!=NULL && (objectClassInfos[i] != dyno->GetClassInfo()) ) { - o = dyno->GetSuperClassInstance(); + o = dyno->GetSuperClassInstance() ; } - params[i] = objectClassInfos[i]->ObjectPtrToAny(o); + params[i] = objectClassInfos[i]->InstanceToVariant(o) ; } } classInfo->Create(o, paramCount, params); } -void wxObjectRuntimeReaderCallback::ConstructObject(int objectID, +void wxRuntimeDepersister::ConstructObject(int objectID, const wxClassInfo *classInfo, int paramCount, - wxAny *params, + wxxVariant *params, int *objectIdValues, - const wxClassInfo **objectClassInfos, - wxStringToAnyHashMap &WXUNUSED(metadata)) + const wxClassInfo **objectClassInfos , + wxxVariantArray &WXUNUSED(metadata)) { wxObject *o; - for ( int i = 0; i < paramCount; ++i ) + for ( int i = 0 ; i < paramCount ; ++i ) { if ( objectIdValues[i] != wxInvalidObjectID ) { @@ -550,12 +501,12 @@ void wxObjectRuntimeReaderCallback::ConstructObject(int objectID, o = m_data->GetObject(objectIdValues[i]); // if this is a dynamic object and we are asked for another class // than wxDynamicObject we cast it down manually. - wxDynamicObject *dyno = wx_dynamic_cast( wxDynamicObject *, o); + wxDynamicObject *dyno = dynamic_cast< wxDynamicObject * > (o) ; if ( dyno!=NULL && (objectClassInfos[i] != dyno->GetClassInfo()) ) { - o = dyno->GetSuperClassInstance(); + o = dyno->GetSuperClassInstance() ; } - params[i] = objectClassInfos[i]->ObjectPtrToAny(o); + params[i] = objectClassInfos[i]->InstanceToVariant(o) ; } } o = classInfo->ConstructObject(paramCount, params); @@ -563,24 +514,24 @@ void wxObjectRuntimeReaderCallback::ConstructObject(int objectID, } -void wxObjectRuntimeReaderCallback::DestroyObject(int objectID, wxClassInfo *WXUNUSED(classInfo)) +void wxRuntimeDepersister::DestroyObject(int objectID, wxClassInfo *WXUNUSED(classInfo)) { wxObject *o; o = m_data->GetObject(objectID); - delete o; + delete o ; } -void wxObjectRuntimeReaderCallback::SetProperty(int objectID, +void wxRuntimeDepersister::SetProperty(int objectID, const wxClassInfo *classInfo, const wxPropertyInfo* propertyInfo, - const wxAny &value) + const wxxVariant &value) { wxObject *o; o = m_data->GetObject(objectID); - classInfo->SetProperty( o, propertyInfo->GetName().c_str(), value ); + classInfo->SetProperty( o , propertyInfo->GetName() , value ) ; } -void wxObjectRuntimeReaderCallback::SetPropertyAsObject(int objectID, +void wxRuntimeDepersister::SetPropertyAsObject(int objectID, const wxClassInfo *classInfo, const wxPropertyInfo* propertyInfo, int valueObjectId) @@ -588,94 +539,309 @@ void wxObjectRuntimeReaderCallback::SetPropertyAsObject(int objectID, wxObject *o, *valo; o = m_data->GetObject(objectID); valo = m_data->GetObject(valueObjectId); - const wxClassInfo* valClassInfo = - (wx_dynamic_cast(const wxClassTypeInfo*,propertyInfo->GetTypeInfo()))->GetClassInfo(); - + const wxClassInfo* valClassInfo = (dynamic_cast(propertyInfo->GetTypeInfo()))->GetClassInfo() ; // if this is a dynamic object and we are asked for another class // than wxDynamicObject we cast it down manually. - wxDynamicObject *dynvalo = wx_dynamic_cast( wxDynamicObject *, valo); + wxDynamicObject *dynvalo = dynamic_cast< wxDynamicObject * > (valo) ; if ( dynvalo!=NULL && (valClassInfo != dynvalo->GetClassInfo()) ) { - valo = dynvalo->GetSuperClassInstance(); + valo = dynvalo->GetSuperClassInstance() ; } - classInfo->SetProperty( o, propertyInfo->GetName().c_str(), - valClassInfo->ObjectPtrToAny(valo) ); + classInfo->SetProperty( o , propertyInfo->GetName() , valClassInfo->InstanceToVariant(valo) ) ; } -void wxObjectRuntimeReaderCallback::SetConnect(int eventSourceObjectID, +void wxRuntimeDepersister::SetConnect(int eventSourceObjectID, const wxClassInfo *WXUNUSED(eventSourceClassInfo), - const wxPropertyInfo *delegateInfo, - const wxClassInfo *WXUNUSED(eventSinkClassInfo), - const wxHandlerInfo* handlerInfo, + const wxPropertyInfo *delegateInfo , + const wxClassInfo *WXUNUSED(eventSinkClassInfo) , + const wxHandlerInfo* handlerInfo , int eventSinkObjectID ) { - wxEvtHandler *ehsource = - wx_dynamic_cast( wxEvtHandler* , m_data->GetObject( eventSourceObjectID ) ); - wxEvtHandler *ehsink = - wx_dynamic_cast( wxEvtHandler *,m_data->GetObject(eventSinkObjectID) ); + wxEvtHandler *ehsource = dynamic_cast< wxEvtHandler* >( m_data->GetObject( eventSourceObjectID ) ) ; + wxEvtHandler *ehsink = dynamic_cast< wxEvtHandler *>(m_data->GetObject(eventSinkObjectID) ) ; if ( ehsource && ehsink ) { - const wxEventSourceTypeInfo *delegateTypeInfo = - wx_dynamic_cast(const wxEventSourceTypeInfo*,delegateInfo->GetTypeInfo()); + const wxDelegateTypeInfo *delegateTypeInfo = dynamic_cast(delegateInfo->GetTypeInfo()); if( delegateTypeInfo && delegateTypeInfo->GetLastEventType() == -1 ) { - ehsource->Connect( -1, delegateTypeInfo->GetEventType(), - handlerInfo->GetEventFunction(), NULL /*user data*/, - ehsink ); + ehsource->Connect( -1 , delegateTypeInfo->GetEventType() , + handlerInfo->GetEventFunction() , NULL /*user data*/ , + ehsink ) ; } else { - for ( wxEventType iter = delegateTypeInfo->GetEventType(); - iter <= delegateTypeInfo->GetLastEventType(); ++iter ) + for ( wxEventType iter = delegateTypeInfo->GetEventType() ; iter <= delegateTypeInfo->GetLastEventType() ; ++iter ) { - ehsource->Connect( -1, iter, - handlerInfo->GetEventFunction(), NULL /*user data*/, - ehsink ); + ehsource->Connect( -1 , iter , + handlerInfo->GetEventFunction() , NULL /*user data*/ , + ehsink ) ; } } } } -wxObject *wxObjectRuntimeReaderCallback::GetObject(int objectID) +wxObject *wxRuntimeDepersister::GetObject(int objectID) { - return m_data->GetObject( objectID ); + return m_data->GetObject( objectID ) ; } -void wxObjectRuntimeReaderCallback::AddToPropertyCollection( int objectID, +// adds an element to a property collection +void wxRuntimeDepersister::AddToPropertyCollection( int objectID , const wxClassInfo *classInfo, - const wxPropertyInfo* propertyInfo, - const wxAny &value) + const wxPropertyInfo* propertyInfo , + const wxxVariant &value) { wxObject *o; o = m_data->GetObject(objectID); - classInfo->AddToPropertyCollection( o, propertyInfo->GetName().c_str(), value ); + classInfo->AddToPropertyCollection( o , propertyInfo->GetName() , value ) ; } -void wxObjectRuntimeReaderCallback::AddToPropertyCollectionAsObject(int objectID, +// sets the corresponding property (value is an object) +void wxRuntimeDepersister::AddToPropertyCollectionAsObject(int objectID, const wxClassInfo *classInfo, - const wxPropertyInfo* propertyInfo, + const wxPropertyInfo* propertyInfo , int valueObjectId) { wxObject *o, *valo; o = m_data->GetObject(objectID); valo = m_data->GetObject(valueObjectId); - const wxCollectionTypeInfo * collectionTypeInfo = - wx_dynamic_cast( const wxCollectionTypeInfo *, propertyInfo->GetTypeInfo() ); - const wxClassInfo* valClassInfo = - (wx_dynamic_cast(const wxClassTypeInfo*,collectionTypeInfo->GetElementType()))->GetClassInfo(); - + const wxCollectionTypeInfo * collectionTypeInfo = dynamic_cast< const wxCollectionTypeInfo * >(propertyInfo->GetTypeInfo() ) ; + const wxClassInfo* valClassInfo = (dynamic_cast(collectionTypeInfo->GetElementType()))->GetClassInfo() ; // if this is a dynamic object and we are asked for another class // than wxDynamicObject we cast it down manually. - wxDynamicObject *dynvalo = wx_dynamic_cast( wxDynamicObject *, valo); + wxDynamicObject *dynvalo = dynamic_cast< wxDynamicObject * > (valo) ; if ( dynvalo!=NULL && (valClassInfo != dynvalo->GetClassInfo()) ) { - valo = dynvalo->GetSuperClassInstance(); + valo = dynvalo->GetSuperClassInstance() ; } - classInfo->AddToPropertyCollection( o, propertyInfo->GetName().c_str(), - valClassInfo->ObjectPtrToAny(valo) ); + classInfo->AddToPropertyCollection( o , propertyInfo->GetName() , valClassInfo->InstanceToVariant(valo) ) ; } +// ---------------------------------------------------------------------------- +// depersisting to code +// ---------------------------------------------------------------------------- + +struct wxCodeDepersister::wxCodeDepersisterInternal +{ +#if wxUSE_UNICODE + map m_objectNames ; +#else + map m_objectNames ; +#endif + + void SetObjectName(int objectID, const wxString &name ) + { + if ( m_objectNames.find(objectID) != m_objectNames.end() ) + { + wxLogError( _("Passing a already registered object to SetObjectName") ) ; + return ; + } + m_objectNames[objectID] = (const wxChar *)name; + } + + wxString GetObjectName( int objectID ) + { + if ( objectID == wxNullObjectID ) + return wxT("NULL") ; + + if ( m_objectNames.find(objectID) == m_objectNames.end() ) + { + wxLogError( _("Passing an unkown object to GetObject") ) ; + return wxEmptyString ; + } + return wxString( m_objectNames[objectID].c_str() ) ; + } +} ; + +wxCodeDepersister::wxCodeDepersister(wxTextOutputStream *out) +: m_fp(out) +{ + m_data = new wxCodeDepersisterInternal ; +} + +wxCodeDepersister::~wxCodeDepersister() +{ + delete m_data ; +} + +void wxCodeDepersister::AllocateObject(int objectID, wxClassInfo *classInfo , + wxxVariantArray &WXUNUSED(metadata)) +{ + wxString objectName = wxString::Format( wxT("LocalObject_%d") , objectID ) ; + m_fp->WriteString( wxString::Format( wxT("\t%s *%s = new %s;\n"), + classInfo->GetClassName(), + objectName.c_str(), + classInfo->GetClassName()) ); + m_data->SetObjectName( objectID , objectName ) ; +} + +void wxCodeDepersister::DestroyObject(int objectID, wxClassInfo *WXUNUSED(classInfo)) +{ + m_fp->WriteString( wxString::Format( wxT("\tdelete %s;\n"), + m_data->GetObjectName( objectID).c_str() ) ); +} + +wxString wxCodeDepersister::ValueAsCode( const wxxVariant ¶m ) +{ + wxString value ; + const wxTypeInfo* type = param.GetTypeInfo() ; + if ( type->GetKind() == wxT_CUSTOM ) + { + const wxCustomTypeInfo* cti = dynamic_cast(type) ; + if ( cti ) + { + value.Printf( wxT("%s(%s)"), cti->GetTypeName().c_str(),param.GetAsString().c_str() ); + } + else + { + wxLogError ( _("Internal error, illegal wxCustomTypeInfo") ) ; + } + } + else if ( type->GetKind() == wxT_STRING ) + { + value.Printf( wxT("\"%s\""),param.GetAsString().c_str() ); + } + else + { + value.Printf( wxT("%s"), param.GetAsString().c_str() ); + } + return value ; +} + +void wxCodeDepersister::CreateObject(int objectID, + const wxClassInfo *WXUNUSED(classInfo), + int paramCount, + wxxVariant *params, + int *objectIDValues, + const wxClassInfo **WXUNUSED(objectClassInfos) , + wxxVariantArray &WXUNUSED(metadata) + ) +{ + int i; + m_fp->WriteString( wxString::Format( wxT("\t%s->Create("), m_data->GetObjectName(objectID).c_str() ) ); + for (i = 0; i < paramCount; i++) + { + if ( objectIDValues[i] != wxInvalidObjectID ) + m_fp->WriteString( wxString::Format( wxT("%s"), m_data->GetObjectName( objectIDValues[i] ).c_str() ) ); + else + { + m_fp->WriteString( wxString::Format( wxT("%s"), ValueAsCode(params[i]).c_str() ) ); + } + if (i < paramCount - 1) + m_fp->WriteString( wxT(", ")); + } + m_fp->WriteString( wxT(");\n") ); +} + +void wxCodeDepersister::ConstructObject(int objectID, + const wxClassInfo *classInfo, + int paramCount, + wxxVariant *params, + int *objectIDValues, + const wxClassInfo **WXUNUSED(objectClassInfos) , + wxxVariantArray &WXUNUSED(metadata) + ) +{ + wxString objectName = wxString::Format( wxT("LocalObject_%d") , objectID ) ; + m_fp->WriteString( wxString::Format( wxT("\t%s *%s = new %s("), + classInfo->GetClassName(), + objectName.c_str(), + classInfo->GetClassName()) ); + m_data->SetObjectName( objectID , objectName ) ; + + int i; + for (i = 0; i < paramCount; i++) + { + if ( objectIDValues[i] != wxInvalidObjectID ) + m_fp->WriteString( wxString::Format( wxT("%s"), m_data->GetObjectName( objectIDValues[i] ).c_str() ) ); + else + { + m_fp->WriteString( wxString::Format( wxT("%s"), ValueAsCode(params[i]).c_str() ) ); + } + if (i < paramCount - 1) + m_fp->WriteString( wxT(", ") ); + } + m_fp->WriteString( wxT(");\n") ); +} + +void wxCodeDepersister::SetProperty(int objectID, + const wxClassInfo *WXUNUSED(classInfo), + const wxPropertyInfo* propertyInfo, + const wxxVariant &value) +{ + m_fp->WriteString( wxString::Format( wxT("\t%s->%s(%s);\n"), + m_data->GetObjectName(objectID).c_str(), + propertyInfo->GetAccessor()->GetSetterName().c_str(), + ValueAsCode(value).c_str()) ); +} + +void wxCodeDepersister::SetPropertyAsObject(int objectID, + const wxClassInfo *WXUNUSED(classInfo), + const wxPropertyInfo* propertyInfo, + int valueObjectId) +{ + if ( propertyInfo->GetTypeInfo()->GetKind() == wxT_OBJECT ) + m_fp->WriteString( wxString::Format( wxT("\t%s->%s(*%s);\n"), + m_data->GetObjectName(objectID).c_str(), + propertyInfo->GetAccessor()->GetSetterName().c_str(), + m_data->GetObjectName( valueObjectId).c_str() ) ); + else + m_fp->WriteString( wxString::Format( wxT("\t%s->%s(%s);\n"), + m_data->GetObjectName(objectID).c_str(), + propertyInfo->GetAccessor()->GetSetterName().c_str(), + m_data->GetObjectName( valueObjectId).c_str() ) ); +} + +void wxCodeDepersister::AddToPropertyCollection( int objectID , + const wxClassInfo *WXUNUSED(classInfo), + const wxPropertyInfo* propertyInfo , + const wxxVariant &value) +{ + m_fp->WriteString( wxString::Format( wxT("\t%s->%s(%s);\n"), + m_data->GetObjectName(objectID).c_str(), + propertyInfo->GetAccessor()->GetAdderName().c_str(), + ValueAsCode(value).c_str()) ); +} + +// sets the corresponding property (value is an object) +void wxCodeDepersister::AddToPropertyCollectionAsObject(int WXUNUSED(objectID), + const wxClassInfo *WXUNUSED(classInfo), + const wxPropertyInfo* WXUNUSED(propertyInfo) , + int WXUNUSED(valueObjectId)) +{ + // TODO +} + +void wxCodeDepersister::SetConnect(int eventSourceObjectID, + const wxClassInfo *WXUNUSED(eventSourceClassInfo), + const wxPropertyInfo *delegateInfo , + const wxClassInfo *eventSinkClassInfo , + const wxHandlerInfo* handlerInfo , + int eventSinkObjectID ) +{ + wxString ehsource = m_data->GetObjectName( eventSourceObjectID ) ; + wxString ehsink = m_data->GetObjectName(eventSinkObjectID) ; + wxString ehsinkClass = eventSinkClassInfo->GetClassName() ; + const wxDelegateTypeInfo *delegateTypeInfo = dynamic_cast(delegateInfo->GetTypeInfo()); + if ( delegateTypeInfo ) + { + int eventType = delegateTypeInfo->GetEventType() ; + wxString handlerName = handlerInfo->GetName() ; + + m_fp->WriteString( wxString::Format( wxT("\t%s->Connect( %s->GetId() , %d , (wxObjectEventFunction)(wxEventFunction) & %s::%s , NULL , %s ) ;") , + ehsource.c_str() , ehsource.c_str() , eventType , ehsinkClass.c_str() , handlerName.c_str() , ehsink.c_str() ) ); + } + else + { + wxLogError(_("delegate has no type info")); + } +} + +#include "wx/arrimpl.cpp" + +WX_DEFINE_OBJARRAY(wxxVariantArray); + #endif // wxUSE_EXTENDED_RTTI diff --git a/Source/3rd Party/wx/src/common/zipstrm.cpp b/Source/3rd Party/wx/src/common/zipstrm.cpp index 35eacef35..1cda3adce 100644 --- a/Source/3rd Party/wx/src/common/zipstrm.cpp +++ b/Source/3rd Party/wx/src/common/zipstrm.cpp @@ -2,7 +2,7 @@ // Name: src/common/zipstrm.cpp // Purpose: Streams for Zip files // Author: Mike Wetherell -// RCS-ID: $Id$ +// RCS-ID: $Id: zipstrm.cpp 51009 2008-01-03 17:11:45Z MW $ // Copyright: (c) Mike Wetherell // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -28,7 +28,7 @@ #include "wx/datstrm.h" #include "wx/zstream.h" #include "wx/mstream.h" -#include "wx/scopedptr.h" +#include "wx/ptr_scpd.h" #include "wx/wfstream.h" #include "zlib.h" @@ -125,7 +125,7 @@ static inline wxUint16 CrackUint16(const char *m) // static wxFileOffset QuietSeek(wxInputStream& stream, wxFileOffset pos) { -#if wxUSE_LOG +#if defined(__WXDEBUG__) && wxUSE_LOG wxLogLevel level = wxLog::GetLogLevel(); wxLog::SetLogLevel(wxLOG_Debug - 1); wxFileOffset result = stream.SeekI(pos); @@ -140,7 +140,7 @@ static wxFileOffset QuietSeek(wxInputStream& stream, wxFileOffset pos) ///////////////////////////////////////////////////////////////////////////// // Class factory -static wxZipClassFactory g_wxZipClassFactory; +wxZipClassFactory g_wxZipClassFactory; wxZipClassFactory::wxZipClassFactory() { @@ -151,9 +151,9 @@ wxZipClassFactory::wxZipClassFactory() const wxChar * const * wxZipClassFactory::GetProtocols(wxStreamProtocolType type) const { - static const wxChar *protocols[] = { wxT("zip"), NULL }; - static const wxChar *mimetypes[] = { wxT("application/zip"), NULL }; - static const wxChar *fileexts[] = { wxT(".zip"), wxT(".htb"), NULL }; + static const wxChar *protocols[] = { _T("zip"), NULL }; + static const wxChar *mimetypes[] = { _T("application/zip"), NULL }; + static const wxChar *fileexts[] = { _T(".zip"), _T(".htb"), NULL }; static const wxChar *empty[] = { NULL }; switch (type) { @@ -200,7 +200,7 @@ wxZipHeader::wxZipHeader(wxInputStream& stream, size_t size) m_pos(0), m_ok(false) { - wxCHECK_RET(size <= sizeof(m_data), wxT("buffer too small")); + wxCHECK_RET(size <= sizeof(m_data), _T("buffer too small")); m_size = stream.Read(m_data, size).LastRead(); m_ok = m_size == size; } @@ -251,7 +251,7 @@ private: wxFileOffset m_pos; wxFileOffset m_len; - wxDECLARE_NO_COPY_CLASS(wxStoredInputStream); + DECLARE_NO_COPY_CLASS(wxStoredInputStream) }; wxStoredInputStream::wxStoredInputStream(wxInputStream& stream) @@ -297,7 +297,7 @@ protected: private: wxFileOffset m_pos; - wxDECLARE_NO_COPY_CLASS(wxStoredOutputStream); + DECLARE_NO_COPY_CLASS(wxStoredOutputStream) }; size_t wxStoredOutputStream::OnSysWrite(const void *buffer, size_t size) @@ -359,7 +359,7 @@ private: size_t m_start; size_t m_end; - wxDECLARE_NO_COPY_CLASS(wxTeeInputStream); + DECLARE_NO_COPY_CLASS(wxTeeInputStream) }; wxTeeInputStream::wxTeeInputStream(wxInputStream& stream) @@ -455,7 +455,7 @@ private: enum { BUFSIZE = 8192 }; wxCharBuffer m_dummy; - wxDECLARE_NO_COPY_CLASS(wxRawInputStream); + DECLARE_NO_COPY_CLASS(wxRawInputStream) }; wxRawInputStream::wxRawInputStream(wxInputStream& stream) @@ -786,15 +786,15 @@ wxString wxZipEntry::GetName(wxPathFormat format /*=wxPATH_NATIVE*/) const switch (wxFileName::GetFormat(format)) { case wxPATH_DOS: { - wxString name(isDir ? m_Name + wxT("\\") : m_Name); + wxString name(isDir ? m_Name + _T("\\") : m_Name); for (size_t i = 0; i < name.length(); i++) - if (name[i] == wxT('/')) - name[i] = wxT('\\'); + if (name[i] == _T('/')) + name[i] = _T('\\'); return name; } case wxPATH_UNIX: - return isDir ? m_Name + wxT("/") : m_Name; + return isDir ? m_Name + _T("/") : m_Name; default: ; @@ -834,9 +834,9 @@ wxString wxZipEntry::GetInternalName(const wxString& name, while (!internal.empty() && *internal.begin() == '/') internal.erase(0, 1); - while (!internal.empty() && internal.compare(0, 2, wxT("./")) == 0) + while (!internal.empty() && internal.compare(0, 2, _T("./")) == 0) internal.erase(0, 2); - if (internal == wxT(".") || internal == wxT("..")) + if (internal == _T(".") || internal == _T("..")) internal = wxEmptyString; return internal; @@ -1004,7 +1004,7 @@ size_t wxZipEntry::ReadLocal(wxInputStream& stream, wxMBConv& conv) size_t wxZipEntry::WriteLocal(wxOutputStream& stream, wxMBConv& conv) const { wxString unixName = GetName(wxPATH_UNIX); - const wxWX2MBbuf name_buf = unixName.mb_str(conv); + const wxWX2MBbuf name_buf = conv.cWX2MB(unixName); const char *name = name_buf; if (!name) name = ""; wxUint16 nameLen = wx_truncate_cast(wxUint16, strlen(name)); @@ -1080,12 +1080,12 @@ size_t wxZipEntry::ReadCentral(wxInputStream& stream, wxMBConv& conv) size_t wxZipEntry::WriteCentral(wxOutputStream& stream, wxMBConv& conv) const { wxString unixName = GetName(wxPATH_UNIX); - const wxWX2MBbuf name_buf = unixName.mb_str(conv); + const wxWX2MBbuf name_buf = conv.cWX2MB(unixName); const char *name = name_buf; if (!name) name = ""; wxUint16 nameLen = wx_truncate_cast(wxUint16, strlen(name)); - const wxWX2MBbuf comment_buf = m_Comment.mb_str(conv); + const wxWX2MBbuf comment_buf = conv.cWX2MB(m_Comment); const char *comment = comment_buf; if (!comment) comment = ""; wxUint16 commentLen = wx_truncate_cast(wxUint16, strlen(comment)); @@ -1235,7 +1235,7 @@ wxZipEndRec::wxZipEndRec() bool wxZipEndRec::Write(wxOutputStream& stream, wxMBConv& conv) const { - const wxWX2MBbuf comment_buf = m_Comment.mb_str(conv); + const wxWX2MBbuf comment_buf = conv.cWX2MB(m_Comment); const char *comment = comment_buf; if (!comment) comment = ""; wxUint16 commentLen = (wxUint16)strlen(comment); @@ -1269,9 +1269,7 @@ bool wxZipEndRec::Read(wxInputStream& stream, wxMBConv& conv) if (m_DiskNumber != 0 || m_StartDisk != 0 || m_EntriesHere != m_TotalEntries) - { wxLogWarning(_("assuming this is a multi-part zip concatenated")); - } return true; } @@ -1338,10 +1336,10 @@ void wxZipInputStream::Init(const wxString& file) Init(); m_allowSeeking = true; wxFFileInputStream *ffile; - ffile = static_cast(m_parent_i_stream); + ffile = wx_static_cast(wxFFileInputStream*, m_parent_i_stream); wxZipEntryPtr_ entry; - if (ffile->IsOk()) { + if (ffile->Ok()) { do { entry.reset(GetNextEntry()); } @@ -1465,13 +1463,11 @@ bool wxZipInputStream::LoadEndRecord() m_TotalEntries = endrec.GetTotalEntries(); m_Comment = endrec.GetComment(); - wxUint32 magic = m_TotalEntries ? CENTRAL_MAGIC : END_MAGIC; - // Now find the central-directory. we have the file offset of // the CD, so look there first. if (m_parent_i_stream->SeekI(endrec.GetOffset()) != wxInvalidOffset && - ReadSignature() == magic) { - m_signature = magic; + ReadSignature() == CENTRAL_MAGIC) { + m_signature = CENTRAL_MAGIC; m_position = endrec.GetOffset(); m_offsetAdjustment = 0; return true; @@ -1481,8 +1477,8 @@ bool wxZipInputStream::LoadEndRecord() // to a self extractor, so take the CD size (also in endrec), subtract // it from the file offset of the end-central-directory and look there. if (m_parent_i_stream->SeekI(endPos - endrec.GetSize()) - != wxInvalidOffset && ReadSignature() == magic) { - m_signature = magic; + != wxInvalidOffset && ReadSignature() == CENTRAL_MAGIC) { + m_signature = CENTRAL_MAGIC; m_position = endPos - endrec.GetSize(); m_offsetAdjustment = m_position - endrec.GetOffset(); return true; @@ -1773,7 +1769,7 @@ bool wxZipInputStream::OpenDecompressor(bool raw /*=false*/) return IsOk(); } -// Can be overridden to add support for additional decompression methods +// Can be overriden to add support for additional decompression methods // wxInputStream *wxZipInputStream::OpenDecompressor(wxInputStream& stream) { @@ -1874,19 +1870,13 @@ size_t wxZipInputStream::OnSysRead(void *buffer, size_t size) m_lasterror = wxSTREAM_READ_ERROR; if (m_entry.GetSize() != TellI()) - { wxLogError(_("reading zip stream (entry %s): bad length"), m_entry.GetName().c_str()); - } else if (m_crcAccumulator != m_entry.GetCrc()) - { wxLogError(_("reading zip stream (entry %s): bad crc"), m_entry.GetName().c_str()); - } else - { m_lasterror = wxSTREAM_EOF; - } } } @@ -1998,7 +1988,6 @@ void wxZipOutputStream::Init(int level) m_comp = NULL; m_level = level; m_offsetAdjustment = wxInvalidOffset; - m_endrecWritten = false; } wxZipOutputStream::~wxZipOutputStream() @@ -2059,7 +2048,7 @@ bool wxZipOutputStream::CopyEntry(wxArchiveEntry *entry, return false; } - return CopyEntry(zipEntry, static_cast(stream)); + return CopyEntry(zipEntry, wx_static_cast(wxZipInputStream&, stream)); } bool wxZipOutputStream::CopyArchiveMetaData(wxZipInputStream& inputStream) @@ -2073,7 +2062,7 @@ bool wxZipOutputStream::CopyArchiveMetaData(wxZipInputStream& inputStream) bool wxZipOutputStream::CopyArchiveMetaData(wxArchiveInputStream& stream) { - return CopyArchiveMetaData(static_cast(stream)); + return CopyArchiveMetaData(wx_static_cast(wxZipInputStream&, stream)); } void wxZipOutputStream::SetLevel(int level) @@ -2128,7 +2117,7 @@ bool wxZipOutputStream::DoCreate(wxZipEntry *entry, bool raw /*=false*/) return true; } -// Can be overridden to add support for additional compression methods +// Can be overriden to add support for additional compression methods // wxOutputStream *wxZipOutputStream::OpenCompressor( wxOutputStream& stream, @@ -2298,9 +2287,7 @@ bool wxZipOutputStream::Close() { CloseEntry(); - if (m_lasterror == wxSTREAM_WRITE_ERROR - || (m_entries.size() == 0 && m_endrecWritten)) - { + if (m_lasterror == wxSTREAM_WRITE_ERROR || m_entries.size() == 0) { wxFilterOutputStream::Close(); return false; } @@ -2325,8 +2312,7 @@ bool wxZipOutputStream::Close() endrec.Write(*m_parent_o_stream, GetConv()); m_lasterror = m_parent_o_stream->GetLastError(); - m_endrecWritten = true; - + if (!wxFilterOutputStream::Close() || !IsOk()) return false; m_lasterror = wxSTREAM_EOF; diff --git a/Source/3rd Party/wx/src/common/zstream.cpp b/Source/3rd Party/wx/src/common/zstream.cpp index 5d012de86..a3a427007 100644 --- a/Source/3rd Party/wx/src/common/zstream.cpp +++ b/Source/3rd Party/wx/src/common/zstream.cpp @@ -4,7 +4,7 @@ // Author: Guilhem Lavaux // Modified by: Mike Wetherell // Created: 11/07/98 -// RCS-ID: $Id$ +// RCS-ID: $Id: zstream.cpp 42621 2006-10-29 16:47:20Z MW $ // Copyright: (c) Guilhem Lavaux // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -19,7 +19,6 @@ #if wxUSE_ZLIB && wxUSE_STREAMS #include "wx/zstream.h" -#include "wx/versioninfo.h" #ifndef WX_PRECOMP #include "wx/intl.h" @@ -32,7 +31,7 @@ // apparently not the case for all MSW makefiles and so, unless we use // configure (which defines __WX_SETUP_H__) or it is explicitly overridden by // the user (who can define wxUSE_ZLIB_H_IN_PATH), we hardcode the path here -#if defined(__WINDOWS__) && !defined(__WX_SETUP_H__) && !defined(wxUSE_ZLIB_H_IN_PATH) +#if defined(__WXMSW__) && !defined(__WX_SETUP_H__) && !defined(wxUSE_ZLIB_H_IN_PATH) #include "../zlib/zlib.h" #else #include "zlib.h" @@ -45,22 +44,6 @@ enum { }; -wxVersionInfo wxGetZlibVersionInfo() -{ - int major, - minor, - build; - - if ( sscanf(zlibVersion(), "%d.%d.%d", &major, &minor, &build) != 3 ) - { - major = - minor = - build = 0; - } - - return wxVersionInfo("zlib", major, minor, build); -} - ///////////////////////////////////////////////////////////////////////////// // Zlib Class factory @@ -77,8 +60,8 @@ wxZlibClassFactory::wxZlibClassFactory() const wxChar * const * wxZlibClassFactory::GetProtocols(wxStreamProtocolType type) const { - static const wxChar *mimes[] = { wxT("application/x-deflate"), NULL }; - static const wxChar *encs[] = { wxT("deflate"), NULL }; + static const wxChar *mimes[] = { _T("application/x-deflate"), NULL }; + static const wxChar *encs[] = { _T("deflate"), NULL }; static const wxChar *empty[] = { NULL }; switch (type) { @@ -105,14 +88,14 @@ wxGzipClassFactory::wxGzipClassFactory() const wxChar * const * wxGzipClassFactory::GetProtocols(wxStreamProtocolType type) const { - static const wxChar *protos[] = - { wxT("gzip"), NULL }; - static const wxChar *mimes[] = - { wxT("application/gzip"), wxT("application/x-gzip"), NULL }; - static const wxChar *encs[] = - { wxT("gzip"), NULL }; - static const wxChar *exts[] = - { wxT(".gz"), wxT(".gzip"), NULL }; + static const wxChar *protos[] = + { _T("gzip"), NULL }; + static const wxChar *mimes[] = + { _T("application/gzip"), _T("application/x-gzip"), NULL }; + static const wxChar *encs[] = + { _T("gzip"), NULL }; + static const wxChar *exts[] = + { _T(".gz"), _T(".gzip"), NULL }; static const wxChar *empty[] = { NULL }; @@ -149,6 +132,13 @@ void wxZlibInputStream::Init(int flags) m_z_size = ZSTREAM_BUFFER_SIZE; m_pos = 0; +#if WXWIN_COMPATIBILITY_2_4 + // treat compatibility mode as auto + m_24compatibilty = flags == wxZLIB_24COMPATIBLE; + if (m_24compatibilty) + flags = wxZLIB_AUTO; +#endif + // if gzip is asked for but not supported... if ((flags == wxZLIB_GZIP || flags == wxZLIB_AUTO) && !CanHandleGZip()) { if (flags == wxZLIB_AUTO) { @@ -241,9 +231,12 @@ size_t wxZlibInputStream::OnSysRead(void *buffer, size_t size) // by the parent strean, m_lasterror = wxSTREAM_READ_ERROR; if (m_parent_i_stream->Eof()) - { +#if WXWIN_COMPATIBILITY_2_4 + if (m_24compatibilty) + m_lasterror = wxSTREAM_EOF; + else +#endif wxLogError(_("Can't read inflate stream: unexpected EOF in underlying stream.")); - } break; default: @@ -267,16 +260,6 @@ size_t wxZlibInputStream::OnSysRead(void *buffer, size_t size) return major > 1 || (major == 1 && minor >= 2); } -bool wxZlibInputStream::SetDictionary(const char *data, const size_t datalen) -{ - return (inflateSetDictionary(m_inflate, (Bytef*)data, datalen) == Z_OK); -} - -bool wxZlibInputStream::SetDictionary(const wxMemoryBuffer &buf) -{ - return SetDictionary((char*)buf.GetData(), buf.GetDataLen()); -} - ////////////////////// // wxZlibOutputStream @@ -352,8 +335,11 @@ bool wxZlibOutputStream::Close() { DoFlush(true); deflateEnd(m_deflate); - wxDELETE(m_deflate); - wxDELETEA(m_z_buffer); + delete m_deflate; + + m_deflate = NULL; + delete[] m_z_buffer; + m_z_buffer = NULL; return wxFilterOutputStream::Close() && IsOk(); } @@ -438,15 +424,5 @@ size_t wxZlibOutputStream::OnSysWrite(const void *buffer, size_t size) return wxZlibInputStream::CanHandleGZip(); } -bool wxZlibOutputStream::SetDictionary(const char *data, const size_t datalen) -{ - return (deflateSetDictionary(m_deflate, (Bytef*)data, datalen) == Z_OK); -} - -bool wxZlibOutputStream::SetDictionary(const wxMemoryBuffer &buf) -{ - return SetDictionary((char*)buf.GetData(), buf.GetDataLen()); -} - #endif // wxUSE_ZLIB && wxUSE_STREAMS diff --git a/Source/3rd Party/wx/src/generic/busyinfo.cpp b/Source/3rd Party/wx/src/generic/busyinfo.cpp index 39cd49586..257c23366 100644 --- a/Source/3rd Party/wx/src/generic/busyinfo.cpp +++ b/Source/3rd Party/wx/src/generic/busyinfo.cpp @@ -3,7 +3,7 @@ // Purpose: Information window when app is busy // Author: Vaclav Slavik // Copyright: (c) 1999 Vaclav Slavik -// RCS-ID: $Id$ +// RCS-ID: $Id: busyinfo.cpp 44898 2007-03-18 20:39:13Z VZ $ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -24,7 +24,6 @@ #endif #include "wx/busyinfo.h" -#include "wx/generic/stattextg.h" class WXDLLEXPORT wxInfoFrame : public wxFrame { @@ -32,7 +31,7 @@ public: wxInfoFrame(wxWindow *parent, const wxString& message); private: - wxDECLARE_NO_COPY_CLASS(wxInfoFrame); + DECLARE_NO_COPY_CLASS(wxInfoFrame) }; @@ -44,14 +43,10 @@ wxInfoFrame::wxInfoFrame(wxWindow *parent, const wxString& message) #else wxSIMPLE_BORDER #endif - | wxFRAME_TOOL_WINDOW | wxSTAY_ON_TOP) + | wxFRAME_TOOL_WINDOW) { wxPanel *panel = new wxPanel( this ); -#ifdef __WXGTK__ - wxGenericStaticText *text = new wxGenericStaticText(panel, wxID_ANY, message); -#else wxStaticText *text = new wxStaticText(panel, wxID_ANY, message); -#endif panel->SetCursor(*wxHOURGLASS_CURSOR); text->SetCursor(*wxHOURGLASS_CURSOR); @@ -119,7 +114,13 @@ wxInfoFrame::wxInfoFrame(wxWindow *parent, const wxString& message) wxBusyInfo::wxBusyInfo(const wxString& message, wxWindow *parent) { - m_InfoFrame = new wxInfoFrame(parent, message); + m_InfoFrame = new wxInfoFrame( parent, message); + if ( parent && parent->HasFlag(wxSTAY_ON_TOP) ) + { + // we must have this flag to be in front of our parent if it has it + m_InfoFrame->SetWindowStyleFlag(wxSTAY_ON_TOP); + } + m_InfoFrame->Show(true); m_InfoFrame->Refresh(); m_InfoFrame->Update(); diff --git a/Source/3rd Party/wx/src/generic/buttonbar.cpp b/Source/3rd Party/wx/src/generic/buttonbar.cpp index a3c247373..b229d7275 100644 --- a/Source/3rd Party/wx/src/generic/buttonbar.cpp +++ b/Source/3rd Party/wx/src/generic/buttonbar.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart, after Robert Roebling, Vadim Zeitlin, SciTech // Modified by: // Created: 2006-04-13 -// Id: $Id$ +// Id: $Id: buttonbar.cpp 42816 2006-10-31 08:50:17Z RD $ // Copyright: (c) Julian Smart, Robert Roebling, Vadim Zeitlin, // SciTech Software, Inc. // Licence: wxWindows licence @@ -66,10 +66,8 @@ public: m_button = NULL; } - wxButtonToolBarTool(wxButtonToolBar *tbar, - wxControl *control, - const wxString& label) - : wxToolBarToolBase(tbar, control, label) + wxButtonToolBarTool(wxButtonToolBar *tbar, wxControl *control) + : wxToolBarToolBase(tbar, control) { m_x = m_y = wxDefaultCoord; m_width = @@ -140,10 +138,7 @@ bool wxButtonToolBar::Create(wxWindow *parent, // wxColour lightBackground(244, 244, 244); - wxFont font(wxSMALL_FONT->GetPointSize(), - wxNORMAL_FONT->GetFamily(), - wxNORMAL_FONT->GetStyle(), - wxFONTWEIGHT_NORMAL); + wxFont font(wxSMALL_FONT->GetPointSize(), wxNORMAL_FONT->GetFamily(), wxNORMAL_FONT->GetStyle(), wxNORMAL); SetFont(font); // Calculate the label height if necessary @@ -210,7 +205,7 @@ void wxButtonToolBar::GetRectLimits(const wxRect& rect, wxCoord *start, wxCoord *end) const { - wxCHECK_RET( start && end, wxT("NULL pointer in GetRectLimits") ); + wxCHECK_RET( start && end, _T("NULL pointer in GetRectLimits") ); if ( IsVertical() ) { @@ -229,7 +224,7 @@ void wxButtonToolBar::SetToolShortHelp(int id, const wxString& help) { wxToolBarToolBase *tool = FindById(id); - wxCHECK_RET( tool, wxT("SetToolShortHelp: no such tool") ); + wxCHECK_RET( tool, _T("SetToolShortHelp: no such tool") ); // TODO: set tooltip/short help tool->SetShortHelp(help); @@ -276,10 +271,9 @@ wxToolBarToolBase *wxButtonToolBar::CreateTool(int id, clientData, shortHelp, longHelp); } -wxToolBarToolBase *wxButtonToolBar::CreateTool(wxControl *control, - const wxString& label) +wxToolBarToolBase *wxButtonToolBar::CreateTool(wxControl *control) { - return new wxButtonToolBarTool(this, control, label); + return new wxButtonToolBarTool(this, control); } // ---------------------------------------------------------------------------- @@ -292,7 +286,7 @@ wxRect wxButtonToolBar::GetToolRect(wxToolBarToolBase *toolBase) const wxRect rect; - wxCHECK_MSG( tool, rect, wxT("GetToolRect: NULL tool") ); + wxCHECK_MSG( tool, rect, _T("GetToolRect: NULL tool") ); // ensure that we always have the valid tool position if ( m_needsLayout ) @@ -496,7 +490,7 @@ void wxButtonToolBar::OnCommand(wxCommandEvent& event) } // paints a border -void wxButtonToolBar::OnPaint(wxPaintEvent& WXUNUSED(event)) +void wxButtonToolBar::OnPaint(wxPaintEvent& event) { wxPaintDC dc(this); @@ -552,7 +546,7 @@ void wxButtonToolBar::OnLeftUp(wxMouseEvent& event) { wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, tool->GetId()); event.SetEventObject(tool->GetButton()); - if (!GetEventHandler()->ProcessEvent(event)) + if (!ProcessEvent(event)) event.Skip(); } } diff --git a/Source/3rd Party/wx/src/generic/choicbkg.cpp b/Source/3rd Party/wx/src/generic/choicbkg.cpp index d9a2b3239..a5df5f1e4 100644 --- a/Source/3rd Party/wx/src/generic/choicbkg.cpp +++ b/Source/3rd Party/wx/src/generic/choicbkg.cpp @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: Wlodzimierz ABX Skiba from generic/listbkg.cpp // Created: 15.09.04 -// RCS-ID: $Id$ +// RCS-ID: $Id: choicbkg.cpp 58355 2009-01-24 14:12:59Z VZ $ // Copyright: (c) Vadim Zeitlin, Wlodzimierz Skiba // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -48,9 +48,12 @@ // ---------------------------------------------------------------------------- IMPLEMENT_DYNAMIC_CLASS(wxChoicebook, wxBookCtrlBase) +IMPLEMENT_DYNAMIC_CLASS(wxChoicebookEvent, wxNotifyEvent) -wxDEFINE_EVENT( wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING, wxBookCtrlEvent ); -wxDEFINE_EVENT( wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED, wxBookCtrlEvent ); +#if !WXWIN_COMPATIBILITY_EVENT_TYPES +const wxEventType wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING = wxNewEventType(); +const wxEventType wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED = wxNewEventType(); +#endif BEGIN_EVENT_TABLE(wxChoicebook, wxBookCtrlBase) EVT_CHOICE(wxID_ANY, wxChoicebook::OnChoiceSelected) @@ -64,6 +67,11 @@ END_EVENT_TABLE() // wxChoicebook creation // ---------------------------------------------------------------------------- +void wxChoicebook::Init() +{ + m_selection = wxNOT_FOUND; +} + bool wxChoicebook::Create(wxWindow *parent, wxWindowID id, @@ -106,6 +114,53 @@ wxChoicebook::Create(wxWindow *parent, return true; } +// ---------------------------------------------------------------------------- +// wxChoicebook geometry management +// ---------------------------------------------------------------------------- + +wxSize wxChoicebook::GetControllerSize() const +{ + const wxSize sizeClient = GetClientSize(), + sizeChoice = m_controlSizer->CalcMin(); + + wxSize size; + if ( IsVertical() ) + { + size.x = sizeClient.x; + size.y = sizeChoice.y; + } + else // left/right aligned + { + size.x = sizeChoice.x; + size.y = sizeClient.y; + } + + return size; +} + +wxSize wxChoicebook::CalcSizeFromPage(const wxSize& sizePage) const +{ + // we need to add the size of the choice control and the border between + const wxSize sizeChoice = GetControllerSize(); + + wxSize size = sizePage; + if ( IsVertical() ) + { + if ( sizeChoice.x > sizePage.x ) + size.x = sizeChoice.x; + size.y += sizeChoice.y + GetInternalBorder(); + } + else // left/right aligned + { + size.x += sizeChoice.x + GetInternalBorder(); + if ( sizeChoice.y > sizePage.y ) + size.y = sizeChoice.y; + } + + return size; +} + + // ---------------------------------------------------------------------------- // accessing the pages // ---------------------------------------------------------------------------- @@ -124,31 +179,22 @@ wxString wxChoicebook::GetPageText(size_t n) const int wxChoicebook::GetPageImage(size_t WXUNUSED(n)) const { + wxFAIL_MSG( _T("wxChoicebook::GetPageImage() not implemented") ); + return wxNOT_FOUND; } bool wxChoicebook::SetPageImage(size_t WXUNUSED(n), int WXUNUSED(imageId)) { - // fail silently, the code may be written to use one of several book - // classes and call SetPageImage() unconditionally, it's better to just - // ignore it (which is the best we can do short of rewriting this class to - // use wxBitmapComboBox anyhow) than complain loudly about a rather - // harmless problem + wxFAIL_MSG( _T("wxChoicebook::SetPageImage() not implemented") ); return false; } // ---------------------------------------------------------------------------- -// miscellaneous other stuff +// image list stuff // ---------------------------------------------------------------------------- -void wxChoicebook::DoSetWindowVariant(wxWindowVariant variant) -{ - wxBookCtrlBase::DoSetWindowVariant(variant); - if (m_bookctrl) - m_bookctrl->SetWindowVariant(variant); -} - void wxChoicebook::SetImageList(wxImageList *imageList) { // TODO: can be implemented in form of static bitmap near choice control @@ -160,12 +206,17 @@ void wxChoicebook::SetImageList(wxImageList *imageList) // selection // ---------------------------------------------------------------------------- -wxBookCtrlEvent* wxChoicebook::CreatePageChangingEvent() const +int wxChoicebook::GetSelection() const { - return new wxBookCtrlEvent(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING, m_windowId); + return m_selection; } -void wxChoicebook::MakeChangedEvent(wxBookCtrlEvent &event) +wxBookCtrlBaseEvent* wxChoicebook::CreatePageChangingEvent() const +{ + return new wxChoicebookEvent(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING, m_windowId); +} + +void wxChoicebook::MakeChangedEvent(wxBookCtrlBaseEvent &event) { event.SetEventType(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED); } @@ -195,36 +246,47 @@ wxChoicebook::InsertPage(size_t n, GetChoiceCtrl()->Select(m_selection); } - if ( !DoSetSelectionAfterInsertion(n, bSelect) ) + // some page should be selected: either this one or the first one if there + // is still no selection + int selNew = wxNOT_FOUND; + if ( bSelect ) + selNew = n; + else if ( m_selection == wxNOT_FOUND ) + selNew = 0; + + if ( selNew != m_selection ) page->Hide(); + if ( selNew != wxNOT_FOUND ) + SetSelection(selNew); + return true; } wxWindow *wxChoicebook::DoRemovePage(size_t page) { + const size_t page_count = GetPageCount(); wxWindow *win = wxBookCtrlBase::DoRemovePage(page); if ( win ) { GetChoiceCtrl()->Delete(page); - if ( m_selection >= (int)page ) + if (m_selection >= (int)page) { - // ensure that the selection is valid - int sel; - if ( GetPageCount() == 0 ) + // force new sel valid if possible + int sel = m_selection - 1; + if (page_count == 1) sel = wxNOT_FOUND; - else - sel = m_selection ? m_selection - 1 : 0; + else if ((page_count == 2) || (sel == -1)) + sel = 0; - // if deleting current page we shouldn't try to hide it - m_selection = m_selection == (int)page ? wxNOT_FOUND - : m_selection - 1; + // force sel invalid if deleting current page - don't try to hide it + m_selection = (m_selection == (int)page) ? wxNOT_FOUND : m_selection - 1; - if ( sel != wxNOT_FOUND && sel != m_selection ) + if ((sel != wxNOT_FOUND) && (sel != m_selection)) SetSelection(sel); - } + } } return win; @@ -233,6 +295,7 @@ wxWindow *wxChoicebook::DoRemovePage(size_t page) bool wxChoicebook::DeleteAllPages() { + m_selection = wxNOT_FOUND; GetChoiceCtrl()->Clear(); return wxBookCtrlBase::DeleteAllPages(); } diff --git a/Source/3rd Party/wx/src/generic/choicdgg.cpp b/Source/3rd Party/wx/src/generic/choicdgg.cpp index 4cf6348e4..1caf90aa3 100644 --- a/Source/3rd Party/wx/src/generic/choicdgg.cpp +++ b/Source/3rd Party/wx/src/generic/choicdgg.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: 03.11.00: VZ to add wxArrayString and multiple sel functions // Created: 04/01/98 -// RCS-ID: $Id$ +// RCS-ID: $Id: choicdgg.cpp 44620 2007-03-06 09:56:43Z JS $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -87,13 +87,9 @@ wxString wxGetSingleChoice( const wxString& message, wxWindow *parent, int WXUNUSED(x), int WXUNUSED(y), bool WXUNUSED(centre), - int WXUNUSED(width), int WXUNUSED(height), - int initialSelection) + int WXUNUSED(width), int WXUNUSED(height) ) { wxSingleChoiceDialog dialog(parent, message, caption, n, choices); - - dialog.SetSelection(initialSelection); - wxString choice; if ( dialog.ShowModal() == wxID_OK ) choice = dialog.GetStringSelection(); @@ -107,56 +103,26 @@ wxString wxGetSingleChoice( const wxString& message, wxWindow *parent, int x, int y, bool centre, - int width, int height, - int initialSelection) + int width, int height) { wxString *choices; int n = ConvertWXArrayToC(aChoices, &choices); wxString res = wxGetSingleChoice(message, caption, n, choices, parent, - x, y, centre, width, height, - initialSelection); + x, y, centre, width, height); delete [] choices; return res; } -wxString wxGetSingleChoice( const wxString& message, - const wxString& caption, - const wxArrayString& choices, - int initialSelection, - wxWindow *parent) -{ - return wxGetSingleChoice(message, caption, choices, parent, - wxDefaultCoord, wxDefaultCoord, - true, wxCHOICE_WIDTH, wxCHOICE_HEIGHT, - initialSelection); -} - -wxString wxGetSingleChoice( const wxString& message, - const wxString& caption, - int n, const wxString *choices, - int initialSelection, - wxWindow *parent) -{ - return wxGetSingleChoice(message, caption, n, choices, parent, - wxDefaultCoord, wxDefaultCoord, - true, wxCHOICE_WIDTH, wxCHOICE_HEIGHT, - initialSelection); -} - int wxGetSingleChoiceIndex( const wxString& message, const wxString& caption, int n, const wxString *choices, wxWindow *parent, int WXUNUSED(x), int WXUNUSED(y), bool WXUNUSED(centre), - int WXUNUSED(width), int WXUNUSED(height), - int initialSelection) + int WXUNUSED(width), int WXUNUSED(height) ) { wxSingleChoiceDialog dialog(parent, message, caption, n, choices); - - dialog.SetSelection(initialSelection); - int choice; if ( dialog.ShowModal() == wxID_OK ) choice = dialog.GetSelection(); @@ -172,45 +138,17 @@ int wxGetSingleChoiceIndex( const wxString& message, wxWindow *parent, int x, int y, bool centre, - int width, int height, - int initialSelection) + int width, int height) { wxString *choices; int n = ConvertWXArrayToC(aChoices, &choices); int res = wxGetSingleChoiceIndex(message, caption, n, choices, parent, - x, y, centre, width, height, - initialSelection); + x, y, centre, width, height); delete [] choices; return res; } -int wxGetSingleChoiceIndex( const wxString& message, - const wxString& caption, - const wxArrayString& choices, - int initialSelection, - wxWindow *parent) -{ - return wxGetSingleChoiceIndex(message, caption, choices, parent, - wxDefaultCoord, wxDefaultCoord, - true, wxCHOICE_WIDTH, wxCHOICE_HEIGHT, - initialSelection); -} - - -int wxGetSingleChoiceIndex( const wxString& message, - const wxString& caption, - int n, const wxString *choices, - int initialSelection, - wxWindow *parent) -{ - return wxGetSingleChoiceIndex(message, caption, n, choices, parent, - wxDefaultCoord, wxDefaultCoord, - true, wxCHOICE_WIDTH, wxCHOICE_HEIGHT, - initialSelection); -} - - void *wxGetSingleChoiceData( const wxString& message, const wxString& caption, int n, const wxString *choices, @@ -218,17 +156,13 @@ void *wxGetSingleChoiceData( const wxString& message, wxWindow *parent, int WXUNUSED(x), int WXUNUSED(y), bool WXUNUSED(centre), - int WXUNUSED(width), int WXUNUSED(height), - int initialSelection) + int WXUNUSED(width), int WXUNUSED(height) ) { wxSingleChoiceDialog dialog(parent, message, caption, n, choices, - client_data); - - dialog.SetSelection(initialSelection); - + (char **)client_data); void *data; if ( dialog.ShowModal() == wxID_OK ) - data = dialog.GetSelectionData(); + data = dialog.GetSelectionClientData(); else data = NULL; @@ -242,50 +176,19 @@ void *wxGetSingleChoiceData( const wxString& message, wxWindow *parent, int x, int y, bool centre, - int width, int height, - int initialSelection) + int width, int height) { wxString *choices; int n = ConvertWXArrayToC(aChoices, &choices); void *res = wxGetSingleChoiceData(message, caption, n, choices, client_data, parent, - x, y, centre, width, height, - initialSelection); + x, y, centre, width, height); delete [] choices; return res; } -void* wxGetSingleChoiceData( const wxString& message, - const wxString& caption, - const wxArrayString& choices, - void **client_data, - int initialSelection, - wxWindow *parent) -{ - return wxGetSingleChoiceData(message, caption, choices, - client_data, parent, - wxDefaultCoord, wxDefaultCoord, - true, wxCHOICE_WIDTH, wxCHOICE_HEIGHT, - initialSelection); -} - -void* wxGetSingleChoiceData( const wxString& message, - const wxString& caption, - int n, const wxString *choices, - void **client_data, - int initialSelection, - wxWindow *parent) -{ - return wxGetSingleChoiceData(message, caption, n, choices, - client_data, parent, - wxDefaultCoord, wxDefaultCoord, - true, wxCHOICE_WIDTH, wxCHOICE_HEIGHT, - initialSelection); -} - - -int wxGetSelectedChoices(wxArrayInt& selections, +size_t wxGetMultipleChoices(wxArrayInt& selections, const wxString& message, const wxString& caption, int n, const wxString *choices, @@ -300,19 +203,15 @@ int wxGetSelectedChoices(wxArrayInt& selections, // deselects the first item which is selected by default dialog.SetSelections(selections); - if ( dialog.ShowModal() != wxID_OK ) - { - // NB: intentionally do not clear the selections array here, the caller - // might want to preserve its original contents if the dialog was - // cancelled - return -1; - } + if ( dialog.ShowModal() == wxID_OK ) + selections = dialog.GetSelections(); + else + selections.Empty(); - selections = dialog.GetSelections(); return selections.GetCount(); } -int wxGetSelectedChoices(wxArrayInt& selections, +size_t wxGetMultipleChoices(wxArrayInt& selections, const wxString& message, const wxString& caption, const wxArrayString& aChoices, @@ -323,7 +222,7 @@ int wxGetSelectedChoices(wxArrayInt& selections, { wxString *choices; int n = ConvertWXArrayToC(aChoices, &choices); - int res = wxGetSelectedChoices(selections, message, caption, + size_t res = wxGetMultipleChoices(selections, message, caption, n, choices, parent, x, y, centre, width, height); delete [] choices; @@ -331,50 +230,6 @@ int wxGetSelectedChoices(wxArrayInt& selections, return res; } -#if WXWIN_COMPATIBILITY_2_8 -size_t wxGetMultipleChoices(wxArrayInt& selections, - const wxString& message, - const wxString& caption, - int n, const wxString *choices, - wxWindow *parent, - int x, int y, - bool centre, - int width, int height) -{ - int rc = wxGetSelectedChoices(selections, message, caption, - n, choices, - parent, x, y, centre, width, height); - if ( rc == -1 ) - { - selections.clear(); - return 0; - } - - return rc; -} - -size_t wxGetMultipleChoices(wxArrayInt& selections, - const wxString& message, - const wxString& caption, - const wxArrayString& aChoices, - wxWindow *parent, - int x, int y, - bool centre, - int width, int height) -{ - int rc = wxGetSelectedChoices(selections, message, caption, - aChoices, - parent, x, y, centre, width, height); - if ( rc == -1 ) - { - selections.clear(); - return 0; - } - - return rc; -} -#endif // WXWIN_COMPATIBILITY_2_8 - // ---------------------------------------------------------------------------- // wxAnyChoiceDialog // ---------------------------------------------------------------------------- @@ -387,12 +242,14 @@ bool wxAnyChoiceDialog::Create(wxWindow *parent, const wxPoint& pos, long styleLbox) { - // extract the buttons styles from the dialog one and remove them from it - const long styleBtns = styleDlg & (wxOK | wxCANCEL); - styleDlg &= ~styleBtns; - +#ifdef __WXMAC__ + // FIXME: why?? + if ( !wxDialog::Create(parent, wxID_ANY, caption, pos, wxDefaultSize, styleDlg & (~wxCANCEL) ) ) + return false; +#else if ( !wxDialog::Create(parent, wxID_ANY, caption, pos, wxDefaultSize, styleDlg) ) return false; +#endif wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL ); @@ -411,7 +268,7 @@ bool wxAnyChoiceDialog::Create(wxWindow *parent, // 3) buttons if any wxSizer * - buttonSizer = CreateSeparatedButtonSizer(styleBtns); + buttonSizer = CreateSeparatedButtonSizer(styleDlg & ButtonSizerFlags); if ( buttonSizer ) { topsizer->Add(buttonSizer, wxSizerFlags().Expand().DoubleBorder()); @@ -445,8 +302,11 @@ bool wxAnyChoiceDialog::Create(wxWindow *parent, wxListBoxBase *wxAnyChoiceDialog::CreateList(int n, const wxString *choices, long styleLbox) { + wxSize size = wxDefaultSize; + if (wxSystemSettings::GetScreenType() > wxSYS_SCREEN_PDA) + size = wxSize(300, 200); return new wxListBox( this, wxID_LISTBOX, - wxDefaultPosition, wxDefaultSize, + wxDefaultPosition, size, n, choices, styleLbox ); } @@ -467,12 +327,35 @@ END_EVENT_TABLE() IMPLEMENT_DYNAMIC_CLASS(wxSingleChoiceDialog, wxDialog) +wxSingleChoiceDialog::wxSingleChoiceDialog(wxWindow *parent, + const wxString& message, + const wxString& caption, + int n, + const wxString *choices, + char **clientData, + long style, + const wxPoint& WXUNUSED(pos)) +{ + Create(parent, message, caption, n, choices, clientData, style); +} + +wxSingleChoiceDialog::wxSingleChoiceDialog(wxWindow *parent, + const wxString& message, + const wxString& caption, + const wxArrayString& choices, + char **clientData, + long style, + const wxPoint& WXUNUSED(pos)) +{ + Create(parent, message, caption, choices, clientData, style); +} + bool wxSingleChoiceDialog::Create( wxWindow *parent, const wxString& message, const wxString& caption, int n, const wxString *choices, - void **clientData, + char **clientData, long style, const wxPoint& pos ) { @@ -496,7 +379,7 @@ bool wxSingleChoiceDialog::Create( wxWindow *parent, const wxString& message, const wxString& caption, const wxArrayString& choices, - void **clientData, + char **clientData, long style, const wxPoint& pos ) { @@ -508,9 +391,6 @@ bool wxSingleChoiceDialog::Create( wxWindow *parent, // Set the selection void wxSingleChoiceDialog::SetSelection(int sel) { - wxCHECK_RET( sel >= 0 && (unsigned)sel < m_listbox->GetCount(), - "Invalid initial selection" ); - m_listbox->SetSelection(sel); m_selection = sel; } @@ -661,8 +541,12 @@ bool wxMultiChoiceDialog::TransferDataFromWindow() wxListBoxBase *wxMultiChoiceDialog::CreateList(int n, const wxString *choices, long styleLbox) { + wxSize size = wxDefaultSize; + if (wxSystemSettings::GetScreenType() > wxSYS_SCREEN_PDA) + size = wxSize(300, 200); + return new wxCheckListBox( this, wxID_LISTBOX, - wxDefaultPosition, wxDefaultSize, + wxDefaultPosition, size, n, choices, styleLbox ); } diff --git a/Source/3rd Party/wx/src/generic/clrpickerg.cpp b/Source/3rd Party/wx/src/generic/clrpickerg.cpp index 5c76f5afd..a02d2accd 100644 --- a/Source/3rd Party/wx/src/generic/clrpickerg.cpp +++ b/Source/3rd Party/wx/src/generic/clrpickerg.cpp @@ -4,7 +4,7 @@ // Author: Francesco Montorsi (readapted code written by Vadim Zeitlin) // Modified by: // Created: 15/04/2006 -// RCS-ID: $Id$ +// RCS-ID: $Id: clrpickerg.cpp 58967 2009-02-17 13:31:28Z SC $ // Copyright: (c) Vadim Zeitlin, Francesco Montorsi // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -27,8 +27,8 @@ #if wxUSE_COLOURPICKERCTRL #include "wx/clrpicker.h" + #include "wx/colordlg.h" -#include "wx/dcmemory.h" // ============================================================================ @@ -36,7 +36,7 @@ // ============================================================================ wxColourData wxGenericColourButton::ms_data; -IMPLEMENT_DYNAMIC_CLASS(wxGenericColourButton, wxBitmapButton) +IMPLEMENT_DYNAMIC_CLASS(wxGenericColourButton, wxCLRBTN_BASE_CLASS) // ---------------------------------------------------------------------------- // wxGenericColourButton @@ -47,11 +47,15 @@ bool wxGenericColourButton::Create( wxWindow *parent, wxWindowID id, const wxSize &size, long style, const wxValidator& validator, const wxString &name) { - m_bitmap = wxBitmap( 60, 13 ); - // create this button - if (!wxBitmapButton::Create( parent, id, m_bitmap, pos, - size, style | wxBU_AUTODRAW, validator, name )) +#if wxCLRBTN_USES_BMP_BUTTON + wxBitmap empty(1,1); + if (!wxBitmapButton::Create( parent, id, empty, pos, + size, style, validator, name )) +#else + if (!wxButton::Create( parent, id, wxEmptyString, pos, + size, style, validator, name )) +#endif { wxFAIL_MSG( wxT("wxGenericColourButton creation failed") ); return false; @@ -83,7 +87,7 @@ void wxGenericColourButton::InitColourData() void wxGenericColourButton::OnButtonClick(wxCommandEvent& WXUNUSED(ev)) { - // update the wxColouData to be shown in the dialog + // update the wxColouData to be shown in the the dialog ms_data.SetColour(m_colour); // create the colour dialog and display it @@ -101,38 +105,83 @@ void wxGenericColourButton::OnButtonClick(wxCommandEvent& WXUNUSED(ev)) void wxGenericColourButton::UpdateColour() { - wxMemoryDC dc(m_bitmap); - dc.SetPen( *wxTRANSPARENT_PEN ); - dc.SetBrush( wxBrush(m_colour) ); - dc.DrawRectangle( 0,0,m_bitmap.GetWidth(),m_bitmap.GetHeight() ); - - if ( HasFlag(wxCLRP_SHOW_LABEL) ) + if ( !m_colour.Ok() ) { - wxColour col( ~m_colour.Red(), ~m_colour.Green(), ~m_colour.Blue() ); - dc.SetTextForeground( col ); - dc.SetFont( GetFont() ); - dc.DrawText( m_colour.GetAsString(wxC2S_HTML_SYNTAX), 0, 0 ); +#if wxCLRBTN_USES_BMP_BUTTON + wxBitmap empty(1,1); + SetBitmapLabel(empty); +#else + if ( HasFlag(wxCLRP_SHOW_LABEL) ) + SetLabel(wxEmptyString); +#endif + return; } - dc.SelectObject( wxNullBitmap ); - SetBitmapLabel( m_bitmap ); + // some combinations of the fg/bg colours may be unreadable, so we invert + // the colour to make sure fg colour is different enough from m_colour + wxColour colFg(~m_colour.Red(), ~m_colour.Green(), ~m_colour.Blue()); + +#if wxCLRBTN_USES_BMP_BUTTON + wxSize sz = GetSize(); + sz.x -= 2*GetMarginX(); + sz.y -= 2*GetMarginY(); + + wxPoint topleft; + + if ( sz.x < 1 ) + sz.x = 1; + else + if ( sz.y < 1 ) + sz.y = 1; + + wxBitmap bmp(sz.x, sz.y); + { + wxMemoryDC memdc(bmp); + memdc.SetPen(colFg); + memdc.SetBrush(m_colour); + memdc.DrawRectangle(topleft,sz); + if ( HasFlag(wxCLRP_SHOW_LABEL) ) + { + int x, y, leading, desc; + wxString label = m_colour.GetAsString(wxC2S_HTML_SYNTAX); + memdc.GetTextExtent(label,&x,&y,&desc,&leading); + if ( x <= sz.x && y <= sz.y ) + { + topleft.x += (sz.x-x)/2; + topleft.y += (sz.y-y)/2; + memdc.SetTextForeground(colFg); + memdc.DrawText(label,topleft); + } + } + } + SetBitmapLabel(bmp); +#else + SetForegroundColour(colFg); + SetBackgroundColour(m_colour); + + if ( HasFlag(wxCLRP_SHOW_LABEL) ) + SetLabel(m_colour.GetAsString(wxC2S_HTML_SYNTAX)); +#endif } wxSize wxGenericColourButton::DoGetBestSize() const { - wxSize sz(wxBitmapButton::DoGetBestSize()); -#ifdef __WXMAC__ - sz.y += 6; -#else - sz.y += 2; -#endif - sz.x += 30; + wxSize sz(wxButton::DoGetBestSize()); if ( HasFlag(wxCLRP_SHOW_LABEL) ) + { +#if wxCLRBTN_USES_BMP_BUTTON + int x, y, leading, desc; + wxString label = m_colour.GetAsString(wxC2S_HTML_SYNTAX); + wxClientDC dc(const_cast(this)); + dc.GetTextExtent(label,&x,&y,&desc,&leading); + sz.x = sz.y+x; +#endif return sz; + } // if we have no label, then make this button a square - // (like e.g. native GTK version of this control) ??? - // sz.SetWidth(sz.GetHeight()); + // (like e.g. native GTK version of this control) + sz.SetWidth(sz.GetHeight()); return sz; } diff --git a/Source/3rd Party/wx/src/generic/collpaneg.cpp b/Source/3rd Party/wx/src/generic/collpaneg.cpp index c43168ed7..7f8848f4b 100644 --- a/Source/3rd Party/wx/src/generic/collpaneg.cpp +++ b/Source/3rd Party/wx/src/generic/collpaneg.cpp @@ -4,7 +4,7 @@ // Author: Francesco Montorsi // Modified By: // Created: 8/10/2006 -// Id: $Id$ +// Id: $Id: collpaneg.cpp 43371 2006-11-12 21:38:49Z VZ $ // Copyright: (c) Francesco Montorsi // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -16,11 +16,6 @@ // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - #include "wx/defs.h" #if wxUSE_COLLPANE && wxUSE_BUTTON && wxUSE_STATLINE @@ -44,13 +39,13 @@ // implementation // ============================================================================ -const char wxCollapsiblePaneNameStr[] = "collapsiblePane"; +const wxChar wxCollapsiblePaneNameStr[] = wxT("collapsiblePane"); //----------------------------------------------------------------------------- // wxGenericCollapsiblePane //----------------------------------------------------------------------------- -wxDEFINE_EVENT( wxEVT_COMMAND_COLLPANE_CHANGED, wxCollapsiblePaneEvent ); +DEFINE_EVENT_TYPE(wxEVT_COMMAND_COLLPANE_CHANGED) IMPLEMENT_DYNAMIC_CLASS(wxGenericCollapsiblePane, wxControl) IMPLEMENT_DYNAMIC_CLASS(wxCollapsiblePaneEvent, wxCommandEvent) @@ -59,13 +54,6 @@ BEGIN_EVENT_TABLE(wxGenericCollapsiblePane, wxControl) EVT_SIZE(wxGenericCollapsiblePane::OnSize) END_EVENT_TABLE() -void wxGenericCollapsiblePane::Init() -{ - m_pButton = NULL; - m_pPane = NULL; - m_pStaticLine = NULL; - m_sz = NULL; -} bool wxGenericCollapsiblePane::Create(wxWindow *parent, wxWindowID id, @@ -81,35 +69,32 @@ bool wxGenericCollapsiblePane::Create(wxWindow *parent, m_strLabel = label; - // sizer containing the expand button and possibly a static line - m_sz = new wxBoxSizer(wxHORIZONTAL); - -#if defined( __WXMAC__ ) && !defined(__WXUNIVERSAL__) - // on Mac we use the special disclosure triangle button - m_pStaticLine = NULL; - m_pButton = new wxDisclosureTriangle(this, wxID_ANY, GetBtnLabel()); - m_sz->Add(m_pButton); -#else // create children and lay them out using a wxBoxSizer // (so that we automatically get RTL features) m_pButton = new wxButton(this, wxID_ANY, GetBtnLabel(), wxPoint(0, 0), wxDefaultSize, wxBU_EXACTFIT); m_pStaticLine = new wxStaticLine(this, wxID_ANY); - +#ifdef __WXMAC__ + // on Mac we put the static libe above the button + m_sz = new wxBoxSizer(wxVERTICAL); + m_sz->Add(m_pStaticLine, 0, wxALL|wxGROW, GetBorder()); + m_sz->Add(m_pButton, 0, wxLEFT|wxRIGHT|wxBOTTOM, GetBorder()); +#else // on other platforms we put the static line and the button horizontally + m_sz = new wxBoxSizer(wxHORIZONTAL); m_sz->Add(m_pButton, 0, wxLEFT|wxTOP|wxBOTTOM, GetBorder()); m_sz->Add(m_pStaticLine, 1, wxALIGN_CENTER|wxLEFT|wxRIGHT, GetBorder()); #endif // FIXME: at least under wxCE and wxGTK1 the background is black if we don't do // this, no idea why... -#if defined(__WXWINCE__) || defined(__WXGTK__) +#if defined(__WXWINCE__) || (defined(__WXGTK__) && !defined(__WXGTK20__)) SetBackgroundColour(parent->GetBackgroundColour()); #endif // do not set sz as our sizers since we handle the pane window without using sizers m_pPane = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, - wxTAB_TRAVERSAL|wxNO_BORDER, wxT("wxCollapsiblePanePane") ); + wxTAB_TRAVERSAL|wxNO_BORDER); // start as collapsed: m_pPane->Hide(); @@ -119,14 +104,14 @@ bool wxGenericCollapsiblePane::Create(wxWindow *parent, wxGenericCollapsiblePane::~wxGenericCollapsiblePane() { - if (m_pButton) + if (m_pButton && m_pStaticLine && m_sz) + { m_pButton->SetContainingSizer(NULL); - - if (m_pStaticLine) m_pStaticLine->SetContainingSizer(NULL); - // our sizer is not deleted automatically since we didn't use SetSizer()! - wxDELETE(m_sz); + // our sizer is not deleted automatically since we didn't use SetSizer()! + wxDELETE(m_sz); + } } wxSize wxGenericCollapsiblePane::DoGetBestSize() const @@ -146,42 +131,78 @@ wxSize wxGenericCollapsiblePane::DoGetBestSize() const wxString wxGenericCollapsiblePane::GetBtnLabel() const { - // on mac the triangle indicates the state, no string change -#ifdef __WXMAC__ - return m_strLabel; -#else return m_strLabel + (IsCollapsed() ? wxT(" >>") : wxT(" <<")); -#endif } void wxGenericCollapsiblePane::OnStateChange(const wxSize& sz) { // minimal size has priority over the best size so set here our min size -// SetMinSize(sz); + SetMinSize(sz); SetSize(sz); if (this->HasFlag(wxCP_NO_TLW_RESIZE)) { - // the user asked to explicitly handle the resizing itself... + // the user asked to explicitely handle the resizing itself... return; } - wxTopLevelWindow *top = - wxDynamicCast(wxGetTopLevelParent(this), wxTopLevelWindow); - if ( !top ) - return; + // + // NB: the following block of code has been accurately designed to + // as much flicker-free as possible; be careful when modifying it! + // - wxSizer *sizer = top->GetSizer(); - if ( !sizer ) - return; + wxTopLevelWindow * + top = wxDynamicCast(wxGetTopLevelParent(this), wxTopLevelWindow); + if ( top ) + { + // NB: don't Layout() the 'top' window as its size has not been correctly + // updated yet and we don't want to do an initial Layout() with the old + // size immediately followed by a SetClientSize/Fit call for the new + // size; that would provoke flickering! - const wxSize newBestSize = sizer->ComputeFittingClientSize(top); - top->SetMinClientSize(newBestSize); + if (top->GetSizer()) +#ifdef __WXGTK__ + // FIXME: the SetSizeHints() call would be required also for GTK+ for + // the expanded->collapsed transition. Unfortunately if we + // enable this line, then the GTK+ top window won't always be + // resized by the SetClientSize() call below! As a side effect + // of this dirty fix, the minimal size for the pane window is + // not set in GTK+ and the user can hide it shrinking the "top" + // window... + if (IsCollapsed()) +#endif + top->GetSizer()->SetSizeHints(top); - // we shouldn't attempt to resize a maximized window, whatever happens - if ( !top->IsMaximized() ) - top->SetClientSize(newBestSize); + + // we shouldn't attempt to resize a maximized window, whatever happens + if ( !top->IsMaximized() ) + { + if ( IsCollapsed() ) + { + // expanded -> collapsed transition + if (top->GetSizer()) + { + // we have just set the size hints... + wxSize sz = top->GetSizer()->CalcMin(); + + // use SetClientSize() and not SetSize() otherwise the size for + // e.g. a wxFrame with a menubar wouldn't be correctly set + top->SetClientSize(sz); + } + else + top->Layout(); + } + else + { + // collapsed -> expanded transition + + // force our parent to "fit", i.e. expand so that it can honour + // our minimal size + top->Fit(); + } + } + } } void wxGenericCollapsiblePane::Collapse(bool collapse) @@ -194,13 +215,8 @@ void wxGenericCollapsiblePane::Collapse(bool collapse) m_pPane->Show(!collapse); // update button label -#if defined( __WXMAC__ ) && !defined(__WXUNIVERSAL__) - m_pButton->SetOpen( !collapse ); -#else // NB: this must be done after updating our "state" m_pButton->SetLabel(GetBtnLabel()); -#endif - OnStateChange(GetBestSize()); } @@ -208,25 +224,16 @@ void wxGenericCollapsiblePane::Collapse(bool collapse) void wxGenericCollapsiblePane::SetLabel(const wxString &label) { m_strLabel = label; -#ifdef __WXMAC__ - m_pButton->SetLabel(GetBtnLabel()); -#else m_pButton->SetLabel(GetBtnLabel()); m_pButton->SetInitialSize(); -#endif Layout(); } bool wxGenericCollapsiblePane::Layout() { -#ifdef __WXMAC__ - if (!m_pButton || !m_pPane || !m_sz) - return false; // we need to complete the creation first! -#else if (!m_pButton || !m_pStaticLine || !m_pPane || !m_sz) return false; // we need to complete the creation first! -#endif wxSize oursz(GetSize()); @@ -252,6 +259,8 @@ int wxGenericCollapsiblePane::GetBorder() const { #if defined( __WXMAC__ ) return 6; +#elif defined(__WXGTK20__) + return 3; #elif defined(__WXMSW__) wxASSERT(m_pButton); return m_pButton->ConvertDialogToPixels(wxSize(2, 0)).x; diff --git a/Source/3rd Party/wx/src/generic/combog.cpp b/Source/3rd Party/wx/src/generic/combog.cpp index 579b5104e..798170e91 100644 --- a/Source/3rd Party/wx/src/generic/combog.cpp +++ b/Source/3rd Party/wx/src/generic/combog.cpp @@ -4,7 +4,7 @@ // Author: Jaakko Salli // Modified by: // Created: Apr-30-2006 -// RCS-ID: $Id$ +// RCS-ID: $Id: combog.cpp 67178 2011-03-13 09:32:19Z JMS $ // Copyright: (c) 2005 Jaakko Salli // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -32,7 +32,6 @@ #include "wx/combobox.h" #include "wx/dcclient.h" #include "wx/settings.h" - #include "wx/textctrl.h" #endif #include "wx/dcbuffer.h" @@ -42,46 +41,36 @@ #if defined(__WXUNIVERSAL__) -// position adjustment for wxTextCtrl, to achieve zero left margin -// meaningless if LEFT_MARGIN_CAN_BE_SET set to 1 in combocmn.cpp -#define TEXTCTRLXADJUST 0 - +#define TEXTCTRLXADJUST 0 // position adjustment for wxTextCtrl, with zero indent +#define TEXTCTRLYADJUST 0 #define TEXTXADJUST 0 // how much is read-only text's x adjusted #define DEFAULT_DROPBUTTON_WIDTH 19 #elif defined(__WXMSW__) -// position adjustment for wxTextCtrl, to achieve zero left margin -// meaningless if LEFT_MARGIN_CAN_BE_SET set to 1 in combocmn.cpp -#define TEXTCTRLXADJUST 2 - +#define TEXTCTRLXADJUST 2 // position adjustment for wxTextCtrl, with zero indent +#define TEXTCTRLYADJUST 3 #define TEXTXADJUST 0 // how much is read-only text's x adjusted #define DEFAULT_DROPBUTTON_WIDTH 17 #elif defined(__WXGTK__) -// position adjustment for wxTextCtrl, to achieve zero left margin -// meaningless if LEFT_MARGIN_CAN_BE_SET set to 1 in combocmn.cpp -#define TEXTCTRLXADJUST -1 - +#define TEXTCTRLXADJUST -1 // position adjustment for wxTextCtrl, with zero indent +#define TEXTCTRLYADJUST 0 #define TEXTXADJUST 1 // how much is read-only text's x adjusted #define DEFAULT_DROPBUTTON_WIDTH 23 #elif defined(__WXMAC__) -// position adjustment for wxTextCtrl, to achieve zero left margin -// meaningless if LEFT_MARGIN_CAN_BE_SET set to 1 in combocmn.cpp -#define TEXTCTRLXADJUST 0 - +#define TEXTCTRLXADJUST 0 // position adjustment for wxTextCtrl, with zero indent +#define TEXTCTRLYADJUST 0 #define TEXTXADJUST 0 // how much is read-only text's x adjusted #define DEFAULT_DROPBUTTON_WIDTH 22 #else -// position adjustment for wxTextCtrl, to achieve zero left margin -// meaningless if LEFT_MARGIN_CAN_BE_SET set to 1 in combocmn.cpp -#define TEXTCTRLXADJUST 0 - +#define TEXTCTRLXADJUST 0 // position adjustment for wxTextCtrl, with zero indent +#define TEXTCTRLYADJUST 0 #define TEXTXADJUST 0 // how much is read-only text's x adjusted #define DEFAULT_DROPBUTTON_WIDTH 19 @@ -170,8 +159,7 @@ bool wxGenericComboCtrl::Create(wxWindow *parent, border = wxBORDER_NONE; Customize( wxCC_BUTTON_OUTSIDE_BORDER | - wxCC_NO_TEXT_AUTO_SELECT | - wxCC_BUTTON_STAYS_DOWN ); + wxCC_NO_TEXT_AUTO_SELECT ); #endif @@ -186,20 +174,18 @@ bool wxGenericComboCtrl::Create(wxWindow *parent, pos, size, style | wxFULL_REPAINT_ON_RESIZE, - validator, + wxDefaultValidator, name) ) return false; // Create textctrl, if necessary - CreateTextCtrl( tcBorder ); + CreateTextCtrl( tcBorder, validator ); // Add keyboard input handlers for main control and textctrl InstallInputHandlers(); - // Set background style for double-buffering, when needed - // (cannot use when system draws background automatically) - if ( !HasTransparentBackground() ) - SetBackgroundStyle( wxBG_STYLE_PAINT ); + // Set background + SetBackgroundStyle( wxBG_STYLE_CUSTOM ); // for double-buffering // SetInitialSize should be called last SetInitialSize(size); @@ -230,24 +216,16 @@ void wxGenericComboCtrl::OnResize() #endif // Move textctrl, if any, accordingly - PositionTextCtrl( TEXTCTRLXADJUST ); + PositionTextCtrl( TEXTCTRLXADJUST, TEXTCTRLYADJUST ); } void wxGenericComboCtrl::OnPaintEvent( wxPaintEvent& WXUNUSED(event) ) { - // Determine wxDC to use based on need to double-buffer or - // use system-generated transparent background portions - wxDC* dcPtr; - if ( HasTransparentBackground() ) - dcPtr = new wxPaintDC(this); - else - dcPtr = new wxAutoBufferedPaintDC(this); - wxDC& dc = *dcPtr; - wxSize sz = GetClientSize(); - const wxRect& butRect = m_btnArea; - wxRect tcRect = m_tcArea; - wxRect fullRect(0, 0, sz.x, sz.y); + wxAutoBufferedPaintDC dc(this); + + const wxRect& rectb = m_btnArea; + wxRect rect = m_tcArea; // artificial simple border if ( m_widthCustomBorder ) @@ -255,22 +233,16 @@ void wxGenericComboCtrl::OnPaintEvent( wxPaintEvent& WXUNUSED(event) ) int customBorder = m_widthCustomBorder; // Set border colour -#ifdef __WXMAC__ - wxPen pen1( wxColour(133,133,133), - customBorder, - wxSOLID ); -#else wxPen pen1( wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT), customBorder, - wxPENSTYLE_SOLID); -#endif + wxSOLID ); dc.SetPen( pen1 ); // area around both controls - wxRect rect2(fullRect); + wxRect rect2(0,0,sz.x,sz.y); if ( m_iFlags & wxCC_IFLAG_BUTTON_OUTSIDE ) { - rect2 = tcRect; + rect2 = m_tcArea; if ( customBorder == 1 ) { rect2.Inflate(1); @@ -293,49 +265,50 @@ void wxGenericComboCtrl::OnPaintEvent( wxPaintEvent& WXUNUSED(event) ) dc.DrawRectangle(rect2); } - // Clear the main background if the system doesn't do it by itself - if ( !HasTransparentBackground() && - (tcRect.x > 0 || tcRect.y > 0) ) - { - wxColour winCol = GetParent()->GetBackgroundColour(); - dc.SetBrush(winCol); - dc.SetPen(winCol); +#if defined(__WXMAC__) || defined(__WXGTK__) // see note in OnThemeChange + wxColour winCol = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); +#else + wxColour winCol = GetBackgroundColour(); +#endif + dc.SetBrush(winCol); + dc.SetPen(winCol); - dc.DrawRectangle(fullRect); - } + //wxLogDebug(wxT("hei: %i tcy: %i tchei: %i"),GetClientSize().y,m_tcArea.y,m_tcArea.height); + //wxLogDebug(wxT("btnx: %i tcx: %i tcwid: %i"),m_btnArea.x,m_tcArea.x,m_tcArea.width); + // clear main background + dc.DrawRectangle(rect); + if ( !m_btn ) { + #ifdef __WXGTK__ + // Under GTK+ this avoids drawing the button background with wrong + // colour + DrawButton(dc,rectb,0); + #else // Standard button rendering - DrawButton(dc, butRect); + DrawButton(dc,rectb); + #endif } // paint required portion on the control - if ( !m_text || m_widthCustomPaint ) + if ( (!m_text || m_widthCustomPaint) ) { wxASSERT( m_widthCustomPaint >= 0 ); - // Clear the text-control area background - wxColour tcCol = GetBackgroundColour(); - dc.SetBrush(tcCol); - dc.SetPen(tcCol); - dc.DrawRectangle(tcRect); - // this is intentionally here to allow drawed rectangle's // right edge to be hidden if ( m_text ) - tcRect.width = m_widthCustomPaint; + rect.width = m_widthCustomPaint; dc.SetFont( GetFont() ); - dc.SetClippingRegion(tcRect); + dc.SetClippingRegion(rect); if ( m_popupInterface ) - m_popupInterface->PaintComboControl(dc, tcRect); + m_popupInterface->PaintComboControl(dc,rect); else - wxComboPopup::DefaultPaintComboControl(this, dc, tcRect); + wxComboPopup::DefaultPaintComboControl(this,dc,rect); } - - delete dcPtr; } void wxGenericComboCtrl::OnMouseEvent( wxMouseEvent& event ) @@ -424,7 +397,19 @@ void wxGenericComboCtrl::SetCustomPaintWidth( int width ) tc->RemoveEventHandler(m_textEvtHandler); delete m_textEvtHandler; - CreateTextCtrl( tcCreateStyle ); +#if wxUSE_VALIDATORS + wxValidator* pValidator = tc->GetValidator(); + if ( pValidator ) + { + pValidator = (wxValidator*) pValidator->Clone(); + CreateTextCtrl( tcCreateStyle, *pValidator ); + delete pValidator; + } + else +#endif + { + CreateTextCtrl( tcCreateStyle, wxDefaultValidator ); + } InstallInputHandlers(); } @@ -449,8 +434,7 @@ bool wxGenericComboCtrl::IsKeyPopupToggle(const wxKeyEvent& event) const } else { - if ( (keycode == WXK_DOWN && event.AltDown()) || - (keycode == WXK_F4) ) + if ( keycode == WXK_DOWN && event.AltDown() ) return true; } diff --git a/Source/3rd Party/wx/src/generic/dcpsg.cpp b/Source/3rd Party/wx/src/generic/dcpsg.cpp index b0f10e6b3..f19e75d66 100644 --- a/Source/3rd Party/wx/src/generic/dcpsg.cpp +++ b/Source/3rd Party/wx/src/generic/dcpsg.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart, Robert Roebling, Markus Holzhem // Modified by: // Created: 04/01/98 -// RCS-ID: $Id$ +// RCS-ID: $Id: dcpsg.cpp 55927 2008-09-28 09:12:16Z VS $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -32,9 +32,11 @@ #include "wx/prntbase.h" #include "wx/generic/prntdlgg.h" #include "wx/paper.h" -#include "wx/filename.h" +#include "wx/filefn.h" #include "wx/stdpaths.h" +WXDLLIMPEXP_DATA_CORE(int) wxPageNumber; + #ifdef __WXMSW__ #ifdef DrawText @@ -190,7 +192,7 @@ static const char *wxPostScriptHeaderColourImage = "\ } ifelse % end of 'false' case\n\ "; -static const char wxPostScriptHeaderReencodeISO1[] = +static char wxPostScriptHeaderReencodeISO1[] = "\n/reencodeISO {\n" "dup dup findfont dup length dict begin\n" "{ 1 index /FID ne { def }{ pop pop } ifelse } forall\n" @@ -214,7 +216,7 @@ static const char wxPostScriptHeaderReencodeISO1[] = "/.notdef/dotlessi/grave/acute/circumflex/tilde/macron/breve\n" "/dotaccent/dieresis/.notdef/ring/cedilla/.notdef/hungarumlaut\n"; -static const char wxPostScriptHeaderReencodeISO2[] = +static char wxPostScriptHeaderReencodeISO2[] = "/ogonek/caron/space/exclamdown/cent/sterling/currency/yen/brokenbar\n" "/section/dieresis/copyright/ordfeminine/guillemotleft/logicalnot\n" "/hyphen/registered/macron/degree/plusminus/twosuperior/threesuperior\n" @@ -235,85 +237,25 @@ static const char wxPostScriptHeaderReencodeISO2[] = // wxPostScriptDC //------------------------------------------------------------------------------- - IMPLEMENT_DYNAMIC_CLASS(wxPostScriptDC, wxDC) -wxPostScriptDC::wxPostScriptDC() - : wxDC(new wxPostScriptDCImpl(this)) +float wxPostScriptDC::ms_PSScaleFactor = 1.0; + +void wxPostScriptDC::SetResolution(int ppi) { + ms_PSScaleFactor = (float)ppi / 72.0; } -wxPostScriptDC::wxPostScriptDC(const wxPrintData& printData) - : wxDC(new wxPostScriptDCImpl(this, printData)) +int wxPostScriptDC::GetResolution() { + return (int)(ms_PSScaleFactor * 72.0); } -// conversion -static const double RAD2DEG = 180.0 / M_PI; - -// we don't want to use only 72 dpi from PS print -static const int DPI = 600; -static const double PS2DEV = 600.0 / 72.0; -static const double DEV2PS = 72.0 / 600.0; - -#define XLOG2DEV(x) ((double)(LogicalToDeviceX(x)) * DEV2PS) -#define XLOG2DEVREL(x) ((double)(LogicalToDeviceXRel(x)) * DEV2PS) -#define YLOG2DEV(x) ((m_pageHeight - (double)LogicalToDeviceY(x)) * DEV2PS) -#define YLOG2DEVREL(x) ((double)(LogicalToDeviceYRel(x)) * DEV2PS) - - -IMPLEMENT_ABSTRACT_CLASS(wxPostScriptDCImpl, wxDCImpl) - //------------------------------------------------------------------------------- -wxPostScriptDCImpl::wxPostScriptDCImpl( wxPostScriptDC *owner ) : - wxDCImpl( owner ) +wxPostScriptDC::wxPostScriptDC () { - Init(); - - m_pageHeight = 842 * PS2DEV; - - m_ok = true; -} - -wxPostScriptDCImpl::wxPostScriptDCImpl( wxPostScriptDC *owner, const wxPrintData& data ) : - wxDCImpl( owner ) -{ - Init(); - - // this calculates m_pageHeight required for - // taking the inverted Y axis into account - SetPrintData( data ); - - m_ok = true; -} - - -wxPostScriptDCImpl::wxPostScriptDCImpl( wxPrinterDC *owner ) : - wxDCImpl( owner ) -{ - Init(); - - m_pageHeight = 842 * PS2DEV; - - m_ok = true; -} - -wxPostScriptDCImpl::wxPostScriptDCImpl( wxPrinterDC *owner, const wxPrintData& data ) : - wxDCImpl( owner ) -{ - Init(); - - // this calculates m_pageHeight required for - // taking the inverted Y axis into account - SetPrintData( data ); - - m_ok = true; -} - -void wxPostScriptDCImpl::Init() -{ - m_pstream = NULL; + m_pstream = (FILE*) NULL; m_currentRed = 0; m_currentGreen = 0; @@ -326,67 +268,71 @@ void wxPostScriptDCImpl::Init() m_underlinePosition = 0.0; m_underlineThickness = 0.0; + m_signX = 1; // default x-axis left to right + m_signY = -1; // default y-axis bottom up -> top down } -wxPostScriptDCImpl::~wxPostScriptDCImpl () +wxPostScriptDC::wxPostScriptDC (const wxPrintData& printData) +{ + m_pstream = (FILE*) NULL; + + m_currentRed = 0; + m_currentGreen = 0; + m_currentBlue = 0; + + m_pageNumber = 0; + + m_clipping = false; + + m_underlinePosition = 0.0; + m_underlineThickness = 0.0; + + m_signX = 1; // default x-axis left to right + m_signY = -1; // default y-axis bottom up -> top down + + m_printData = printData; + + m_ok = true; +} + +wxPostScriptDC::~wxPostScriptDC () { if (m_pstream) { fclose( m_pstream ); - m_pstream = NULL; + m_pstream = (FILE*) NULL; } } -bool wxPostScriptDCImpl::IsOk() const +bool wxPostScriptDC::IsOk() const { return m_ok; } -wxRect wxPostScriptDCImpl::GetPaperRect() const -{ - int w = 0; - int h = 0; - DoGetSize( &w, &h ); - return wxRect(0,0,w,h); -} - -int wxPostScriptDCImpl::GetResolution() const -{ - return DPI; -} - -void wxPostScriptDCImpl::DoSetClippingRegion (wxCoord x, wxCoord y, wxCoord w, wxCoord h) +void wxPostScriptDC::DoSetClippingRegion (wxCoord x, wxCoord y, wxCoord w, wxCoord h) { wxCHECK_RET( m_ok , wxT("invalid postscript dc") ); - if (m_clipping) - DestroyClippingRegion(); + if (m_clipping) DestroyClippingRegion(); - m_clipX1 = x; - m_clipY1 = y; - m_clipX2 = x + w; - m_clipY2 = y + h; + wxDC::DoSetClippingRegion(x, y, w, h); m_clipping = true; - wxString buffer; - buffer.Printf( "gsave\n" - "newpath\n" - "%f %f moveto\n" - "%f %f lineto\n" - "%f %f lineto\n" - "%f %f lineto\n" - "closepath clip newpath\n", - XLOG2DEV(x), YLOG2DEV(y), - XLOG2DEV(x+w), YLOG2DEV(y), - XLOG2DEV(x+w), YLOG2DEV(y+h), - XLOG2DEV(x), YLOG2DEV(y+h) ); - buffer.Replace( ",", "." ); - PsPrint( buffer ); + PsPrintf( wxT("gsave\n newpath\n") + wxT("%d %d moveto\n") + wxT("%d %d lineto\n") + wxT("%d %d lineto\n") + wxT("%d %d lineto\n") + wxT("closepath clip newpath\n"), + LogicalToDeviceX(x), LogicalToDeviceY(y), + LogicalToDeviceX(x+w), LogicalToDeviceY(y), + LogicalToDeviceX(x+w), LogicalToDeviceY(y+h), + LogicalToDeviceX(x), LogicalToDeviceY(y+h) ); } -void wxPostScriptDCImpl::DestroyClippingRegion() +void wxPostScriptDC::DestroyClippingRegion() { wxCHECK_RET( m_ok , wxT("invalid postscript dc") ); @@ -396,63 +342,61 @@ void wxPostScriptDCImpl::DestroyClippingRegion() PsPrint( "grestore\n" ); } - wxDCImpl::DestroyClippingRegion(); + wxDC::DestroyClippingRegion(); } -void wxPostScriptDCImpl::Clear() +void wxPostScriptDC::Clear() { // This should fail silently to avoid unnecessary // asserts - // wxFAIL_MSG( wxT("wxPostScriptDCImpl::Clear not implemented.") ); + // wxFAIL_MSG( wxT("wxPostScriptDC::Clear not implemented.") ); } -bool wxPostScriptDCImpl::DoFloodFill (wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), const wxColour &WXUNUSED(col), wxFloodFillStyle WXUNUSED(style)) +bool wxPostScriptDC::DoFloodFill (wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), const wxColour &WXUNUSED(col), int WXUNUSED(style)) { - wxFAIL_MSG( wxT("wxPostScriptDCImpl::FloodFill not implemented.") ); + wxFAIL_MSG( wxT("wxPostScriptDC::FloodFill not implemented.") ); return false; } -bool wxPostScriptDCImpl::DoGetPixel (wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), wxColour * WXUNUSED(col)) const +bool wxPostScriptDC::DoGetPixel (wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), wxColour * WXUNUSED(col)) const { - wxFAIL_MSG( wxT("wxPostScriptDCImpl::GetPixel not implemented.") ); + wxFAIL_MSG( wxT("wxPostScriptDC::GetPixel not implemented.") ); return false; } -void wxPostScriptDCImpl::DoCrossHair (wxCoord WXUNUSED(x), wxCoord WXUNUSED(y)) +void wxPostScriptDC::DoCrossHair (wxCoord WXUNUSED(x), wxCoord WXUNUSED(y)) { - wxFAIL_MSG( wxT("wxPostScriptDCImpl::CrossHair not implemented.") ); + wxFAIL_MSG( wxT("wxPostScriptDC::CrossHair not implemented.") ); } -void wxPostScriptDCImpl::DoDrawLine (wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) +void wxPostScriptDC::DoDrawLine (wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) { wxCHECK_RET( m_ok, wxT("invalid postscript dc") ); - if ( m_pen.IsTransparent() ) - return; + if (m_pen.GetStyle() == wxTRANSPARENT) return; SetPen( m_pen ); - wxString buffer; - buffer.Printf( "newpath\n" - "%f %f moveto\n" - "%f %f lineto\n" - "stroke\n", - XLOG2DEV(x1), YLOG2DEV(y1), - XLOG2DEV(x2), YLOG2DEV(y2) ); - buffer.Replace( ",", "." ); - PsPrint( buffer ); + PsPrintf( wxT("newpath\n") + wxT("%d %d moveto\n") + wxT("%d %d lineto\n") + wxT("stroke\n"), + LogicalToDeviceX(x1), LogicalToDeviceY(y1), + LogicalToDeviceX(x2), LogicalToDeviceY (y2) ); CalcBoundingBox( x1, y1 ); CalcBoundingBox( x2, y2 ); } -void wxPostScriptDCImpl::DoDrawArc (wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord xc, wxCoord yc) +#define RAD2DEG 57.29577951308 + +void wxPostScriptDC::DoDrawArc (wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord xc, wxCoord yc) { wxCHECK_RET( m_ok, wxT("invalid postscript dc") ); wxCoord dx = x1 - xc; wxCoord dy = y1 - yc; - double radius = sqrt( (double)(dx*dx+dy*dy) ); + wxCoord radius = (wxCoord) sqrt( (double)(dx*dx+dy*dy) ); double alpha1, alpha2; if (x1 == x2 && y1 == y2) @@ -479,49 +423,40 @@ void wxPostScriptDCImpl::DoDrawArc (wxCoord x1, wxCoord y1, wxCoord x2, wxCoord while (alpha1 > 360) alpha1 -= 360; // 0 and 360 degree while (alpha2 > 360) alpha2 -= 360; - int i_radius = wxRound( radius ); - - if ( m_brush.IsNonTransparent() ) + if (m_brush.GetStyle() != wxTRANSPARENT) { SetBrush( m_brush ); - wxString buffer; - buffer.Printf( "newpath\n" - "%f %f %f %f %f %f ellipse\n" - "%f %f lineto\n" - "closepath\n" - "fill\n", - XLOG2DEV(xc), YLOG2DEV(yc), - XLOG2DEVREL(i_radius), YLOG2DEVREL(i_radius), - alpha1, alpha2, - XLOG2DEV(xc), YLOG2DEV(yc) ); - buffer.Replace( ",", "." ); - PsPrint( buffer ); + PsPrintf( wxT("newpath\n") + wxT("%d %d %d %d %d %d ellipse\n") + wxT("%d %d lineto\n") + wxT("closepath\n") + wxT("fill\n"), + LogicalToDeviceX(xc), LogicalToDeviceY(yc), LogicalToDeviceXRel(radius), LogicalToDeviceYRel(radius), (wxCoord)alpha1, (wxCoord) alpha2, + LogicalToDeviceX(xc), LogicalToDeviceY(yc) ); - CalcBoundingBox( xc-i_radius, yc-i_radius ); - CalcBoundingBox( xc+i_radius, yc+i_radius ); + CalcBoundingBox( xc-radius, yc-radius ); + CalcBoundingBox( xc+radius, yc+radius ); } - if ( m_pen.IsNonTransparent() ) + if (m_pen.GetStyle() != wxTRANSPARENT) { SetPen( m_pen ); - wxString buffer; - buffer.Printf( "newpath\n" - "%f %f %f %f %f %f ellipse\n" - "stroke\n", - XLOG2DEV(xc), YLOG2DEV(yc), - XLOG2DEVREL(i_radius), YLOG2DEVREL(i_radius), - alpha1, alpha2 ); - buffer.Replace( ",", "." ); - PsPrint( buffer ); + PsPrintf( wxT("newpath\n") + wxT("%d %d %d %d %d %d ellipse\n") + wxT("%d %d lineto\n") + wxT("closepath\n") + wxT("stroke\n"), + LogicalToDeviceX(xc), LogicalToDeviceY(yc), LogicalToDeviceXRel(radius), LogicalToDeviceYRel(radius), (wxCoord)alpha1, (wxCoord) alpha2, + LogicalToDeviceX(xc), LogicalToDeviceY(yc) ); - CalcBoundingBox( xc-i_radius, yc-i_radius ); - CalcBoundingBox( xc+i_radius, yc+i_radius ); + CalcBoundingBox( xc-radius, yc-radius ); + CalcBoundingBox( xc+radius, yc+radius ); } } -void wxPostScriptDCImpl::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea) +void wxPostScriptDC::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea) { wxCHECK_RET( m_ok, wxT("invalid postscript dc") ); @@ -536,97 +471,82 @@ void wxPostScriptDCImpl::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord if ( wxIsSameDouble(sa, ea) ) { - DoDrawEllipse(x,y,w,h); + DrawEllipse(x,y,w,h); return; } - if ( m_brush.IsNonTransparent() ) + if (m_brush.GetStyle () != wxTRANSPARENT) { SetBrush( m_brush ); - wxString buffer; - buffer.Printf( "newpath\n" - "%f %f %f %f %f %f true ellipticarc\n", - XLOG2DEV(x+w/2), YLOG2DEV(y+h/2), - XLOG2DEVREL(w/2), YLOG2DEVREL(h/2), - sa, ea ); - buffer.Replace( ",", "." ); - PsPrint( buffer ); + PsPrintf( wxT("newpath\n") + wxT("%d %d %d %d %d %d true ellipticarc\n"), + LogicalToDeviceX(x+w/2), LogicalToDeviceY(y+h/2), + LogicalToDeviceXRel(w/2), LogicalToDeviceYRel(h/2), + (wxCoord)sa, (wxCoord)ea ); CalcBoundingBox( x ,y ); CalcBoundingBox( x+w, y+h ); } - if ( m_pen.IsNonTransparent() ) + if (m_pen.GetStyle () != wxTRANSPARENT) { SetPen( m_pen ); - wxString buffer; - buffer.Printf( "newpath\n" - "%f %f %f %f %f %f false ellipticarc\n", - XLOG2DEV(x+w/2), YLOG2DEV(y+h/2), - XLOG2DEVREL(w/2), YLOG2DEVREL(h/2), - sa, ea ); - buffer.Replace( ",", "." ); - PsPrint( buffer ); + PsPrintf( wxT("newpath\n") + wxT("%d %d %d %d %d %d false ellipticarc\n"), + LogicalToDeviceX(x+w/2), LogicalToDeviceY(y+h/2), + LogicalToDeviceXRel(w/2), LogicalToDeviceYRel(h/2), + (wxCoord)sa, (wxCoord)ea ); CalcBoundingBox( x ,y ); CalcBoundingBox( x+w, y+h ); } } -void wxPostScriptDCImpl::DoDrawPoint (wxCoord x, wxCoord y) +void wxPostScriptDC::DoDrawPoint (wxCoord x, wxCoord y) { wxCHECK_RET( m_ok, wxT("invalid postscript dc") ); - if ( m_pen.IsTransparent() ) - return; + if (m_pen.GetStyle() == wxTRANSPARENT) return; SetPen (m_pen); - wxString buffer; - buffer.Printf( "newpath\n" - "%f %f moveto\n" - "%f %f lineto\n" - "stroke\n", - XLOG2DEV(x), YLOG2DEV(y), - XLOG2DEV(x+1), YLOG2DEV(y) ); - buffer.Replace( ",", "." ); - PsPrint( buffer ); + PsPrintf( wxT("newpath\n") + wxT("%d %d moveto\n") + wxT("%d %d lineto\n") + wxT("stroke\n"), + LogicalToDeviceX(x), LogicalToDeviceY(y), + LogicalToDeviceX(x+1), LogicalToDeviceY(y) ); CalcBoundingBox( x, y ); } -void wxPostScriptDCImpl::DoDrawPolygon (int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset, wxPolygonFillMode fillStyle) +void wxPostScriptDC::DoDrawPolygon (int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset, int fillStyle) { wxCHECK_RET( m_ok, wxT("invalid postscript dc") ); if (n <= 0) return; - if ( m_brush.IsNonTransparent() ) + if (m_brush.GetStyle () != wxTRANSPARENT) { SetBrush( m_brush ); PsPrint( "newpath\n" ); - double xx = XLOG2DEV(points[0].x + xoffset); - double yy = YLOG2DEV(points[0].y + yoffset); + wxCoord xx = LogicalToDeviceX(points[0].x + xoffset); + wxCoord yy = LogicalToDeviceY(points[0].y + yoffset); - wxString buffer; - buffer.Printf( "%f %f moveto\n", xx, yy ); - buffer.Replace( ",", "." ); - PsPrint( buffer ); + PsPrintf( wxT("%d %d moveto\n"), xx, yy ); CalcBoundingBox( points[0].x + xoffset, points[0].y + yoffset ); for (int i = 1; i < n; i++) { - xx = XLOG2DEV(points[i].x + xoffset); - yy = YLOG2DEV(points[i].y + yoffset); + xx = LogicalToDeviceX(points[i].x + xoffset); + yy = LogicalToDeviceY(points[i].y + yoffset); - buffer.Printf( "%f %f lineto\n", xx, yy ); - buffer.Replace( ",", "." ); - PsPrint( buffer ); + PsPrintf( wxT("%d %d lineto\n"), xx, yy ); CalcBoundingBox( points[i].x + xoffset, points[i].y + yoffset); } @@ -634,30 +554,25 @@ void wxPostScriptDCImpl::DoDrawPolygon (int n, wxPoint points[], wxCoord xoffset PsPrint( (fillStyle == wxODDEVEN_RULE ? "eofill\n" : "fill\n") ); } - if ( m_pen.IsNonTransparent() ) + if (m_pen.GetStyle () != wxTRANSPARENT) { SetPen( m_pen ); PsPrint( "newpath\n" ); - double xx = XLOG2DEV(points[0].x + xoffset); - double yy = YLOG2DEV(points[0].y + yoffset); + wxCoord xx = LogicalToDeviceX(points[0].x + xoffset); + wxCoord yy = LogicalToDeviceY(points[0].y + yoffset); - wxString buffer; - buffer.Printf( "%f %f moveto\n", xx, yy ); - buffer.Replace( ",", "." ); - PsPrint( buffer ); + PsPrintf( wxT("%d %d moveto\n"), xx, yy ); CalcBoundingBox( points[0].x + xoffset, points[0].y + yoffset ); for (int i = 1; i < n; i++) { - xx = XLOG2DEV(points[i].x + xoffset); - yy = YLOG2DEV(points[i].y + yoffset); + xx = LogicalToDeviceX(points[i].x + xoffset); + yy = LogicalToDeviceY(points[i].y + yoffset); - buffer.Printf( "%f %f lineto\n", xx, yy ); - buffer.Replace( ",", "." ); - PsPrint( buffer ); + PsPrintf( wxT("%d %d lineto\n"), xx, yy ); CalcBoundingBox( points[i].x + xoffset, points[i].y + yoffset); } @@ -667,13 +582,13 @@ void wxPostScriptDCImpl::DoDrawPolygon (int n, wxPoint points[], wxCoord xoffset } } -void wxPostScriptDCImpl::DoDrawPolyPolygon (int n, int count[], wxPoint points[], wxCoord xoffset, wxCoord yoffset, wxPolygonFillMode fillStyle) +void wxPostScriptDC::DoDrawPolyPolygon (int n, int count[], wxPoint points[], wxCoord xoffset, wxCoord yoffset, int fillStyle) { wxCHECK_RET( m_ok, wxT("invalid postscript dc") ); if (n <= 0) return; - if ( m_brush.IsNonTransparent() ) + if (m_brush.GetStyle () != wxTRANSPARENT) { SetBrush( m_brush ); @@ -682,24 +597,19 @@ void wxPostScriptDCImpl::DoDrawPolyPolygon (int n, int count[], wxPoint points[] int ofs = 0; for (int i = 0; i < n; ofs += count[i++]) { - double xx = XLOG2DEV(points[ofs].x + xoffset); - double yy = YLOG2DEV(points[ofs].y + yoffset); + wxCoord xx = LogicalToDeviceX(points[ofs].x + xoffset); + wxCoord yy = LogicalToDeviceY(points[ofs].y + yoffset); - wxString buffer; - buffer.Printf( "%f %f moveto\n", xx, yy ); - buffer.Replace( ",", "." ); - PsPrint( buffer ); + PsPrintf( wxT("%d %d moveto\n"), xx, yy ); CalcBoundingBox( points[ofs].x + xoffset, points[ofs].y + yoffset ); for (int j = 1; j < count[i]; j++) { - xx = XLOG2DEV(points[ofs+j].x + xoffset); - yy = YLOG2DEV(points[ofs+j].y + yoffset); + xx = LogicalToDeviceX(points[ofs+j].x + xoffset); + yy = LogicalToDeviceY(points[ofs+j].y + yoffset); - buffer.Printf( "%f %f lineto\n", xx, yy ); - buffer.Replace( ",", "." ); - PsPrint( buffer ); + PsPrintf( wxT("%d %d lineto\n"), xx, yy ); CalcBoundingBox( points[ofs+j].x + xoffset, points[ofs+j].y + yoffset); } @@ -707,7 +617,7 @@ void wxPostScriptDCImpl::DoDrawPolyPolygon (int n, int count[], wxPoint points[] PsPrint( (fillStyle == wxODDEVEN_RULE ? "eofill\n" : "fill\n") ); } - if ( m_pen.IsNonTransparent() ) + if (m_pen.GetStyle () != wxTRANSPARENT) { SetPen( m_pen ); @@ -716,24 +626,19 @@ void wxPostScriptDCImpl::DoDrawPolyPolygon (int n, int count[], wxPoint points[] int ofs = 0; for (int i = 0; i < n; ofs += count[i++]) { - double xx = XLOG2DEV(points[ofs].x + xoffset); - double yy = YLOG2DEV(points[ofs].y + yoffset); + wxCoord xx = LogicalToDeviceX(points[ofs].x + xoffset); + wxCoord yy = LogicalToDeviceY(points[ofs].y + yoffset); - wxString buffer; - buffer.Printf( "%f %f moveto\n", xx, yy ); - buffer.Replace( ",", "." ); - PsPrint( buffer ); + PsPrintf( wxT("%d %d moveto\n"), xx, yy ); CalcBoundingBox( points[ofs].x + xoffset, points[ofs].y + yoffset ); for (int j = 1; j < count[i]; j++) { - xx = XLOG2DEV(points[ofs+j].x + xoffset); - yy = YLOG2DEV(points[ofs+j].y + yoffset); + xx = LogicalToDeviceX(points[ofs+j].x + xoffset); + yy = LogicalToDeviceY(points[ofs+j].y + yoffset); - buffer.Printf( "%f %f lineto\n", xx, yy ); - buffer.Replace( ",", "." ); - PsPrint( buffer ); + PsPrintf( wxT("%d %d lineto\n"), xx, yy ); CalcBoundingBox( points[ofs+j].x + xoffset, points[ofs+j].y + yoffset); } @@ -743,12 +648,11 @@ void wxPostScriptDCImpl::DoDrawPolyPolygon (int n, int count[], wxPoint points[] } } -void wxPostScriptDCImpl::DoDrawLines (int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset) +void wxPostScriptDC::DoDrawLines (int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset) { wxCHECK_RET( m_ok, wxT("invalid postscript dc") ); - if ( m_pen.IsTransparent() ) - return; + if (m_pen.GetStyle() == wxTRANSPARENT) return; if (n <= 0) return; @@ -756,89 +660,74 @@ void wxPostScriptDCImpl::DoDrawLines (int n, wxPoint points[], wxCoord xoffset, int i; for ( i =0; iGetTextExtent(text, &text_w, &text_h, &text_descent); + GetTextExtent(text, &text_w, &text_h, &text_descent); + + // VZ: this seems to be unnecessary, so taking it out for now, if it + // doesn't create any problems, remove this comment entirely + //SetFont( m_font ); + int size = m_font.GetPointSize(); @@ -1336,30 +1213,29 @@ void wxPostScriptDCImpl::DoDrawText( const wxString& text, wxCoord x, wxCoord y // - note that there is still rounding error in text_descent! wxCoord by = y + size - text_descent; // baseline - wxString buffer; - buffer.Printf( "%f %f moveto\n", XLOG2DEV(x), YLOG2DEV(by) ); - buffer.Replace( ",", "." ); - PsPrint( buffer ); + PsPrintf( wxT("%d %d moveto\n"), LogicalToDeviceX(x), LogicalToDeviceY(by) ); PsPrint( "(" ); - for ( const char *p = textbuf; *p != '\0'; p++ ) + const wxWX2MBbuf textbuf = text.mb_str(); + size_t len = strlen(textbuf); + size_t i; + for (i = 0; i < len; i++) { - int c = (unsigned char)*p; + int c = (unsigned char) textbuf[i]; if (c == ')' || c == '(' || c == '\\') { /* Cope with special characters */ PsPrint( "\\" ); - PsPrint( (char) c ); + PsPrint(c); } else if ( c >= 128 ) { /* Cope with character codes > 127 */ - buffer.Printf( "\\%o", c ); - PsPrint( buffer ); + PsPrintf( wxT("\\%o"), c); } else { - PsPrint( (char) c ); + PsPrint(c); } } @@ -1368,17 +1244,20 @@ void wxPostScriptDCImpl::DoDrawText( const wxString& text, wxCoord x, wxCoord y if (m_font.GetUnderlined()) { wxCoord uy = (wxCoord)(y + size - m_underlinePosition); + char buffer[100]; - buffer.Printf( "gsave\n" - "%f %f moveto\n" - "%f setlinewidth\n" - "%f %f lineto\n" - "stroke\n" - "grestore\n", - XLOG2DEV(x), YLOG2DEV(uy), + sprintf( buffer, + "gsave\n" + "%d %d moveto\n" + "%f setlinewidth\n" + "%d %d lineto\n" + "stroke\n" + "grestore\n", + LogicalToDeviceX(x), LogicalToDeviceY(uy), m_underlineThickness, - XLOG2DEV(x + text_w), YLOG2DEV(uy) ); - buffer.Replace( ",", "." ); + LogicalToDeviceX(x + text_w), LogicalToDeviceY(uy) ); + for (i = 0; i < 100; i++) + if (buffer[i] == ',') buffer[i] = '.'; PsPrint( buffer ); } @@ -1386,7 +1265,7 @@ void wxPostScriptDCImpl::DoDrawText( const wxString& text, wxCoord x, wxCoord y CalcBoundingBox( x + size * text.length() * 2/3 , y ); } -void wxPostScriptDCImpl::DoDrawRotatedText( const wxString& text, wxCoord x, wxCoord y, double angle ) +void wxPostScriptDC::DoDrawRotatedText( const wxString& text, wxCoord x, wxCoord y, double angle ) { if ( wxIsNullDouble(angle) ) { @@ -1398,7 +1277,7 @@ void wxPostScriptDCImpl::DoDrawRotatedText( const wxString& text, wxCoord x, wxC SetFont( m_font ); - if (m_textForegroundColour.IsOk()) + if (m_textForegroundColour.Ok()) { unsigned char red = m_textForegroundColour.Red(); unsigned char blue = m_textForegroundColour.Blue(); @@ -1424,9 +1303,12 @@ void wxPostScriptDCImpl::DoDrawRotatedText( const wxString& text, wxCoord x, wxC double bluePS = (double)(blue) / 255.0; double greenPS = (double)(green) / 255.0; - wxString buffer; - buffer.Printf( "%f %f %f setrgbcolor\n", redPS, greenPS, bluePS ); - buffer.Replace( ",", "." ); + char buffer[100]; + sprintf( buffer, + "%.8f %.8f %.8f setrgbcolor\n", + redPS, greenPS, bluePS ); + for (int i = 0; i < 100; i++) + if (buffer[i] == ',') buffer[i] = '.'; PsPrint( buffer ); m_currentRed = red; @@ -1437,64 +1319,70 @@ void wxPostScriptDCImpl::DoDrawRotatedText( const wxString& text, wxCoord x, wxC int size = m_font.GetPointSize(); - wxString buffer; - buffer.Printf( "%f %f moveto\n", XLOG2DEV(x), YLOG2DEV(y)); - buffer.Replace( ",", "." ); - PsPrint( buffer ); + PsPrintf( wxT("%d %d moveto\n"), + LogicalToDeviceX(x), LogicalToDeviceY(y)); - buffer.Printf( "%f rotate\n", angle ); - buffer.Replace( ",", "." ); - PsPrint( buffer ); + char buffer[100]; + sprintf(buffer, "%.8f rotate\n", angle); + size_t i; + for (i = 0; i < 100; i++) + { + if (buffer[i] == ',') buffer[i] = '.'; + } + PsPrint( buffer); PsPrint( "(" ); const wxWX2MBbuf textbuf = text.mb_str(); - if ( textbuf ) + size_t len = strlen(textbuf); + for (i = 0; i < len; i++) { - for ( const char *p = textbuf; *p != '\0'; p++ ) + int c = (unsigned char) textbuf[i]; + if (c == ')' || c == '(' || c == '\\') { - int c = (unsigned char)*p; - if (c == ')' || c == '(' || c == '\\') - { - /* Cope with special characters */ - PsPrint( "\\" ); - PsPrint( (char) c ); - } - else if ( c >= 128 ) - { - /* Cope with character codes > 127 */ - buffer.Printf( "\\%o", c); - PsPrint( buffer ); - } - else - { - PsPrint( (char) c ); - } + /* Cope with special characters */ + PsPrint( "\\" ); + PsPrint(c); + } + else if ( c >= 128 ) + { + /* Cope with character codes > 127 */ + PsPrintf( wxT("\\%o"), c); + } + else + { + PsPrint(c); } } PsPrint( ") show\n" ); - buffer.Printf( "%f rotate\n", -angle ); - buffer.Replace( ",", "." ); + sprintf( buffer, "%.8f rotate\n", -angle ); + for (i = 0; i < 100; i++) + { + if (buffer[i] == ',') buffer[i] = '.'; + } PsPrint( buffer ); if (m_font.GetUnderlined()) { wxCoord uy = (wxCoord)(y + size - m_underlinePosition); wxCoord w, h; - GetOwner()->GetTextExtent(text, &w, &h); + GetTextExtent(text, &w, &h); - buffer.Printf( + sprintf( buffer, "gsave\n" - "%f %f moveto\n" + "%d %d moveto\n" "%f setlinewidth\n" - "%f %f lineto\n" + "%d %d lineto\n" "stroke\n" "grestore\n", - XLOG2DEV(x), YLOG2DEV(uy), + LogicalToDeviceX(x), LogicalToDeviceY(uy), m_underlineThickness, - XLOG2DEV(x + w), YLOG2DEV(uy) ); - buffer.Replace( ",", "." ); + LogicalToDeviceX(x + w), LogicalToDeviceY(uy) ); + for (i = 0; i < 100; i++) + { + if (buffer[i] == ',') buffer[i] = '.'; + } PsPrint( buffer ); } @@ -1502,18 +1390,18 @@ void wxPostScriptDCImpl::DoDrawRotatedText( const wxString& text, wxCoord x, wxC CalcBoundingBox( x + size * text.length() * 2/3 , y ); } -void wxPostScriptDCImpl::SetBackground (const wxBrush& brush) +void wxPostScriptDC::SetBackground (const wxBrush& brush) { m_backgroundBrush = brush; } -void wxPostScriptDCImpl::SetLogicalFunction(wxRasterOperationMode WXUNUSED(function)) +void wxPostScriptDC::SetLogicalFunction (int WXUNUSED(function)) { - wxFAIL_MSG( wxT("wxPostScriptDCImpl::SetLogicalFunction not implemented.") ); + wxFAIL_MSG( wxT("wxPostScriptDC::SetLogicalFunction not implemented.") ); } #if wxUSE_SPLINES -void wxPostScriptDCImpl::DoDrawSpline( const wxPointList *points ) +void wxPostScriptDC::DoDrawSpline( wxList *points ) { wxCHECK_RET( m_ok, wxT("invalid postscript dc") ); @@ -1524,13 +1412,13 @@ void wxPostScriptDCImpl::DoDrawSpline( const wxPointList *points ) double c, d, x1, y1, x2, y2, x3, y3; wxPoint *p, *q; - wxPointList::compatibility_iterator node = points->GetFirst(); - p = node->GetData(); + wxList::compatibility_iterator node = points->GetFirst(); + p = (wxPoint *)node->GetData(); x1 = p->x; y1 = p->y; node = node->GetNext(); - p = node->GetData(); + p = (wxPoint *)node->GetData(); c = p->x; d = p->y; x3 = @@ -1544,14 +1432,11 @@ void wxPostScriptDCImpl::DoDrawSpline( const wxPointList *points ) #endif (double)(y1 + d) / 2; - wxString buffer; - buffer.Printf( "newpath\n" - "%f %f moveto\n" - "%f %f lineto\n", - XLOG2DEV(wxRound(x1)), YLOG2DEV(wxRound(y1)), - XLOG2DEV(wxRound(x3)), YLOG2DEV(wxRound(y3)) ); - buffer.Replace( ",", "." ); - PsPrint( buffer ); + PsPrintf( wxT("newpath\n") + wxT("%d %d moveto\n") + wxT("%d %d lineto\n"), + LogicalToDeviceX((wxCoord)x1), LogicalToDeviceY((wxCoord)y1), + LogicalToDeviceX((wxCoord)x3), LogicalToDeviceY((wxCoord)y3) ); CalcBoundingBox( (wxCoord)x1, (wxCoord)y1 ); CalcBoundingBox( (wxCoord)x3, (wxCoord)y3 ); @@ -1559,7 +1444,7 @@ void wxPostScriptDCImpl::DoDrawSpline( const wxPointList *points ) node = node->GetNext(); while (node) { - q = node->GetData(); + q = (wxPoint *)node->GetData(); x1 = x3; y1 = y3; @@ -1570,12 +1455,10 @@ void wxPostScriptDCImpl::DoDrawSpline( const wxPointList *points ) x3 = (double)(x2 + c) / 2; y3 = (double)(y2 + d) / 2; - buffer.Printf( "%f %f %f %f %f %f DrawSplineSection\n", - XLOG2DEV(wxRound(x1)), YLOG2DEV(wxRound(y1)), - XLOG2DEV(wxRound(x2)), YLOG2DEV(wxRound(y2)), - XLOG2DEV(wxRound(x3)), YLOG2DEV(wxRound(y3)) ); - buffer.Replace( ",", "." ); - PsPrint( buffer ); + PsPrintf( wxT("%d %d %d %d %d %d DrawSplineSection\n"), + LogicalToDeviceX((wxCoord)x1), LogicalToDeviceY((wxCoord)y1), + LogicalToDeviceX((wxCoord)x2), LogicalToDeviceY((wxCoord)y2), + LogicalToDeviceX((wxCoord)x3), LogicalToDeviceY((wxCoord)y3) ); CalcBoundingBox( (wxCoord)x1, (wxCoord)y1 ); CalcBoundingBox( (wxCoord)x3, (wxCoord)y3 ); @@ -1588,55 +1471,41 @@ void wxPostScriptDCImpl::DoDrawSpline( const wxPointList *points ) next-to-last and last point respectively, in the point list */ - buffer.Printf( "%f %f lineto\nstroke\n", XLOG2DEV(wxRound(c)), YLOG2DEV(wxRound(d)) ); - buffer.Replace( ",", "." ); - PsPrint( buffer ); + PsPrintf( wxT("%d %d lineto\n") + wxT("stroke\n"), + LogicalToDeviceX((wxCoord)c), LogicalToDeviceY((wxCoord)d) ); } #endif // wxUSE_SPLINES -wxCoord wxPostScriptDCImpl::GetCharWidth() const +wxCoord wxPostScriptDC::GetCharWidth() const { // Chris Breeze: reasonable approximation using wxMODERN/Courier return (wxCoord) (GetCharHeight() * 72.0 / 120.0); } -void wxPostScriptDCImpl::SetPrintData(const wxPrintData& data) + +void wxPostScriptDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp ) { - m_printData = data; + wxCHECK_RET( m_ok, wxT("invalid postscript dc") ); - wxPaperSize id = m_printData.GetPaperId(); - wxPrintPaperType *paper = wxThePrintPaperDatabase->FindPaperType(id); - if (!paper) paper = wxThePrintPaperDatabase->FindPaperType(wxPAPER_A4); - int w = 595; - int h = 842; - if (paper) - { - w = paper->GetSizeDeviceUnits().x; - h = paper->GetSizeDeviceUnits().y; - } + m_signX = (xLeftRight ? 1 : -1); + m_signY = (yBottomUp ? 1 : -1); - if (m_printData.GetOrientation() == wxLANDSCAPE) - m_pageHeight = w * PS2DEV; - else - m_pageHeight = h * PS2DEV; + ComputeScaleAndOrigin(); } -void wxPostScriptDCImpl::ComputeScaleAndOrigin() +void wxPostScriptDC::SetDeviceOrigin( wxCoord x, wxCoord y ) { - const wxRealPoint origScale(m_scaleX, m_scaleY); + wxCHECK_RET( m_ok, wxT("invalid postscript dc") ); - wxDCImpl::ComputeScaleAndOrigin(); + int h = 0; + int w = 0; + GetSize( &w, &h ); - // If scale has changed call SetPen to recalulate the line width - // and SetFont to recalculate font size - if ( wxRealPoint(m_scaleX, m_scaleY) != origScale && m_pen.IsOk() ) - { - SetPen( m_pen ); - SetFont( m_font ); - } + wxDC::SetDeviceOrigin( x, h-y ); } -void wxPostScriptDCImpl::DoGetSize(int* width, int* height) const +void wxPostScriptDC::DoGetSize(int* width, int* height) const { wxPaperSize id = m_printData.GetPaperId(); @@ -1659,14 +1528,11 @@ void wxPostScriptDCImpl::DoGetSize(int* width, int* height) const h = tmp; } - if (width) - *width = wxRound( w * PS2DEV ); - - if (height) - *height = wxRound( h * PS2DEV ); + if (width) *width = (int)(w * ms_PSScaleFactor); + if (height) *height = (int)(h * ms_PSScaleFactor); } -void wxPostScriptDCImpl::DoGetSizeMM(int *width, int *height) const +void wxPostScriptDC::DoGetSizeMM(int *width, int *height) const { wxPaperSize id = m_printData.GetPaperId(); @@ -1694,13 +1560,14 @@ void wxPostScriptDCImpl::DoGetSizeMM(int *width, int *height) const } // Resolution in pixels per logical inch -wxSize wxPostScriptDCImpl::GetPPI(void) const +wxSize wxPostScriptDC::GetPPI(void) const { - return wxSize( DPI, DPI ); + return wxSize((int)(72 * ms_PSScaleFactor), + (int)(72 * ms_PSScaleFactor)); } -bool wxPostScriptDCImpl::StartDoc( const wxString& WXUNUSED(message) ) +bool wxPostScriptDC::StartDoc( const wxString& message ) { wxCHECK_MSG( m_ok, false, wxT("invalid postscript dc") ); @@ -1708,7 +1575,7 @@ bool wxPostScriptDCImpl::StartDoc( const wxString& WXUNUSED(message) ) { if (m_printData.GetFilename() == wxEmptyString) { - wxString filename = wxFileName::CreateTempFileName( wxT("ps") ); + wxString filename = wxGetTempFileName( wxT("ps") ); m_printData.SetFilename(filename); } @@ -1723,21 +1590,18 @@ bool wxPostScriptDCImpl::StartDoc( const wxString& WXUNUSED(message) ) } m_ok = true; - - wxString buffer; + m_title = message; PsPrint( "%!PS-Adobe-2.0\n" ); - PsPrint( "%%Creator: wxWidgets PostScript renderer\n" ); - - buffer.Printf( "%%%%CreationDate: %s\n", wxNow() ); - PsPrint( buffer ); - + PsPrintf( wxT("%%%%CreationDate: %s\n"), wxNow().c_str() ); if (m_printData.GetOrientation() == wxLANDSCAPE) PsPrint( "%%Orientation: Landscape\n" ); else PsPrint( "%%Orientation: Portrait\n" ); + // PsPrintf( wxT("%%%%Pages: %d\n"), (wxPageNumber - 1) ); + const wxChar *paper; switch (m_printData.GetPaperId()) { @@ -1757,10 +1621,7 @@ bool wxPostScriptDCImpl::StartDoc( const wxString& WXUNUSED(message) ) case wxPAPER_10X14: paper = wxT("10x14"); break; // 10-by-14-inch sheet default: paper = wxT("A4"); } - - buffer.Printf( "%%%%DocumentPaperSizes: %s\n", paper ); - PsPrint( buffer ); - + PsPrintf( wxT("%%%%DocumentPaperSizes: %s\n"), paper ); PsPrint( "%%EndComments\n\n" ); PsPrint( "%%BeginProlog\n" ); @@ -1782,11 +1643,12 @@ bool wxPostScriptDCImpl::StartDoc( const wxString& WXUNUSED(message) ) // set origin according to paper size SetDeviceOrigin( 0,0 ); + wxPageNumber = 1; m_pageNumber = 1; return true; } -void wxPostScriptDCImpl::EndDoc () +void wxPostScriptDC::EndDoc () { wxCHECK_RET( m_ok, wxT("invalid postscript dc") ); @@ -1798,7 +1660,7 @@ void wxPostScriptDCImpl::EndDoc () if ( m_pstream ) { fclose( m_pstream ); - m_pstream = NULL; + m_pstream = (FILE *) NULL; } #if 0 @@ -1814,10 +1676,10 @@ void wxPostScriptDCImpl::EndDoc () // Compute the bounding box. Note that it is in the default user // coordinate system, thus we have to convert the values. - wxCoord minX = (wxCoord) XLOG2DEV(m_minX); - wxCoord minY = (wxCoord) YLOG2DEV(m_minY); - wxCoord maxX = (wxCoord) XLOG2DEV(m_maxX); - wxCoord maxY = (wxCoord) YLOG2DEV(m_maxY); + wxCoord minX = (wxCoord) LogicalToDeviceX(m_minX); + wxCoord minY = (wxCoord) LogicalToDeviceY(m_minY); + wxCoord maxX = (wxCoord) LogicalToDeviceX(m_maxX); + wxCoord maxY = (wxCoord) LogicalToDeviceY(m_maxY); // LOG2DEV may have changed the minimum to maximum vice versa if ( minX > maxX ) { wxCoord tmp = minX; minX = maxX; maxX = tmp; } @@ -1886,118 +1748,100 @@ void wxPostScriptDCImpl::EndDoc () #endif } -void wxPostScriptDCImpl::StartPage() +void wxPostScriptDC::StartPage() { wxCHECK_RET( m_ok, wxT("invalid postscript dc") ); - wxString buffer; - buffer.Printf( wxT("%%%%Page: %d\n"), m_pageNumber++ ); - PsPrint( buffer ); + PsPrintf( wxT("%%%%Page: %d\n"), wxPageNumber++ ); + + // What is this one supposed to do? RR. +// *m_pstream << "matrix currentmatrix\n"; + + // Added by Chris Breeze + + // Each page starts with an "initgraphics" which resets the + // transformation and so we need to reset the origin + // (and rotate the page for landscape printing) + + // Output scaling + wxCoord translate_x, translate_y; + double scale_x, scale_y; -#if 0 wxPostScriptPrintNativeData *data = (wxPostScriptPrintNativeData *) m_printData.GetNativeData(); - wxCoord translate_x = (wxCoord)data->GetPrinterTranslateX(); - wxCoord translate_y = (wxCoord)data->GetPrinterTranslateY(); + translate_x = (wxCoord)data->GetPrinterTranslateX(); + translate_y = (wxCoord)data->GetPrinterTranslateY(); - buffer.Printf( "%d %d translate\n", translate_x, translate_y ); - PsPrint( buffer ); - - double scale_x = data->GetPrinterScaleX(); - double scale_y = data->GetPrinterScaleY(); - - buffer.Printf( "%f %f scale\n", scale_x, scale_y ); - buffer.Replace( ",", "." ); - PsPrint( buffer ); - -#endif - - // Each page starts with an "initgraphics" which resets the - // transformation and so we need to rotate the page for - // landscape printing) - - // I copied this one from a PostScript tutorial, but to no avail. RR. - // PsPrint( "90 rotate llx neg ury nef translate\n" ); + scale_x = data->GetPrinterScaleX(); + scale_y = data->GetPrinterScaleY(); if (m_printData.GetOrientation() == wxLANDSCAPE) + { + int h; + GetSize( (int*) NULL, &h ); + translate_y -= h; PsPrint( "90 rotate\n" ); + // I copied this one from a PostScript tutorial, but to no avail. RR. + // PsPrint( "90 rotate llx neg ury nef translate\n" ); + } + + char buffer[100]; + sprintf( buffer, "%.8f %.8f scale\n", scale_x / ms_PSScaleFactor, + scale_y / ms_PSScaleFactor); + for (int i = 0; i < 100; i++) + if (buffer[i] == ',') buffer[i] = '.'; + PsPrint( buffer ); + + PsPrintf( wxT("%d %d translate\n"), translate_x, translate_y ); } -void wxPostScriptDCImpl::EndPage () +void wxPostScriptDC::EndPage () { wxCHECK_RET( m_ok , wxT("invalid postscript dc") ); PsPrint( "showpage\n" ); } -bool wxPostScriptDCImpl::DoBlit( wxCoord xdest, wxCoord ydest, +bool wxPostScriptDC::DoBlit( wxCoord xdest, wxCoord ydest, wxCoord fwidth, wxCoord fheight, wxDC *source, wxCoord xsrc, wxCoord ysrc, - wxRasterOperationMode rop, - bool WXUNUSED(useMask), wxCoord WXUNUSED(xsrcMask), wxCoord WXUNUSED(ysrcMask) ) + int rop, bool WXUNUSED(useMask), wxCoord WXUNUSED(xsrcMask), wxCoord WXUNUSED(ysrcMask) ) { wxCHECK_MSG( m_ok, false, wxT("invalid postscript dc") ); wxCHECK_MSG( source, false, wxT("invalid source dc") ); - // blit into a bitmap + /* blit into a bitmap */ wxBitmap bitmap( (int)fwidth, (int)fheight ); wxMemoryDC memDC; memDC.SelectObject(bitmap); memDC.Blit(0, 0, fwidth, fheight, source, xsrc, ysrc, rop); /* TODO: Blit transparently? */ memDC.SelectObject(wxNullBitmap); - //draw bitmap. scaling and positioning is done there - GetOwner()->DrawBitmap( bitmap, xdest, ydest ); + /* draw bitmap. scaling and positioning is done there */ + DrawBitmap( bitmap, xdest, ydest ); return true; } -wxCoord wxPostScriptDCImpl::GetCharHeight() const +wxCoord wxPostScriptDC::GetCharHeight() const { - if (m_font.IsOk()) + if (m_font.Ok()) return m_font.GetPointSize(); else return 12; } -void wxPostScriptDCImpl::PsPrint( const wxString& str ) -{ - const wxCharBuffer psdata(str.utf8_str()); - - wxPostScriptPrintNativeData *data = - (wxPostScriptPrintNativeData *) m_printData.GetNativeData(); - - switch (m_printData.GetPrintMode()) - { -#if wxUSE_STREAMS - // append to output stream - case wxPRINT_MODE_STREAM: - { - wxOutputStream* outputstream = data->GetOutputStream(); - wxCHECK_RET( outputstream, wxT("invalid outputstream") ); - outputstream->Write( psdata, strlen( psdata ) ); - } - break; -#endif // wxUSE_STREAMS - - // save data into file - default: - wxCHECK_RET( m_pstream, wxT("invalid postscript dc") ); - fwrite( psdata, 1, strlen( psdata ), m_pstream ); - } -} - -void wxPostScriptDCImpl::DoGetTextExtent(const wxString& string, +void wxPostScriptDC::DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y, wxCoord *descent, wxCoord *externalLeading, - const wxFont *theFont ) const + wxFont *theFont ) const { - const wxFont *fontToUse = theFont; + wxFont *fontToUse = theFont; - if (!fontToUse) fontToUse = &m_font; + if (!fontToUse) fontToUse = (wxFont*) &m_font; const float fontSize = fontToUse->GetPointSize() * GetFontPointSizeAdjustment(72.0); @@ -2015,10 +1859,6 @@ void wxPostScriptDCImpl::DoGetTextExtent(const wxString& string, const wxWX2MBbuf strbuf = string.mb_str(); - // conversion failed (non e.g. ISO characters) - if ( !strbuf ) - return; - #if !wxUSE_AFM_FOR_POSTSCRIPT /* Provide a VERY rough estimate (avoid using it). * Produces accurate results for mono-spaced font @@ -2049,13 +1889,13 @@ void wxPostScriptDCImpl::DoGetTextExtent(const wxString& string, / in 'points' (1/72 of an inch). this should later on be / changed to depend on the mapping mode. / CAVE: the path to the AFM files must be set before calling this - / fun3B3Bction. this is usually done by a call like the following: + / function. this is usually done by a call like the following: / wxSetAFMPath("d:\\wxw161\\afm\\"); / / example: / / wxPostScriptDC dc(NULL, true); - / if (dc.IsOk()){ + / if (dc.Ok()){ / wxSetAFMPath("d:\\wxw161\\afm\\"); / dc.StartDoc("Test"); / dc.StartPage(); @@ -2294,9 +2134,9 @@ void wxPostScriptDCImpl::DoGetTextExtent(const wxString& string, // VS: dirty, but is there any better solution? double *pt; pt = (double*) &m_underlinePosition; - *pt = YLOG2DEVREL((wxCoord)(UnderlinePosition * fontSize)) / 1000.0f; + *pt = LogicalToDeviceYRel((wxCoord)(UnderlinePosition * fontSize)) / 1000.0f; pt = (double*) &m_underlineThickness; - *pt = YLOG2DEVREL((wxCoord)(UnderlineThickness * fontSize)) / 1000.0f; + *pt = LogicalToDeviceYRel((wxCoord)(UnderlineThickness * fontSize)) / 1000.0f; } @@ -2358,6 +2198,64 @@ void wxPostScriptDCImpl::DoGetTextExtent(const wxString& string, // Use AFM } +// print postscript datas via required method (file, stream) +void wxPostScriptDC::PsPrintf( const wxChar* fmt, ... ) +{ + va_list argptr; + va_start(argptr, fmt); + + PsPrint( wxString::FormatV( fmt, argptr ).c_str() ); +} + +void wxPostScriptDC::PsPrint( const char* psdata ) +{ + wxPostScriptPrintNativeData *data = + (wxPostScriptPrintNativeData *) m_printData.GetNativeData(); + + switch (m_printData.GetPrintMode()) + { +#if wxUSE_STREAMS + // append to output stream + case wxPRINT_MODE_STREAM: + { + wxOutputStream* outputstream = data->GetOutputStream(); + wxCHECK_RET( outputstream, wxT("invalid outputstream") ); + outputstream->Write( psdata, strlen( psdata ) ); + } + break; +#endif // wxUSE_STREAMS + + // save data into file + default: + wxCHECK_RET( m_pstream, wxT("invalid postscript dc") ); + fwrite( psdata, 1, strlen( psdata ), m_pstream ); + } +} + +void wxPostScriptDC::PsPrint( int ch ) +{ + wxPostScriptPrintNativeData *data = + (wxPostScriptPrintNativeData *) m_printData.GetNativeData(); + + switch (m_printData.GetPrintMode()) + { +#if wxUSE_STREAMS + // append to output stream + case wxPRINT_MODE_STREAM: + { + wxOutputStream* outputstream = data->GetOutputStream(); + wxCHECK_RET( outputstream, wxT("invalid outputstream") ); + outputstream->PutC( (char)ch ); + } + break; +#endif // wxUSE_STREAMS + + // save data into file + default: + wxCHECK_RET( m_pstream, wxT("invalid postscript dc") ); + fputc( ch, m_pstream ); + } +} #endif // wxUSE_PRINTING_ARCHITECTURE && wxUSE_POSTSCRIPT diff --git a/Source/3rd Party/wx/src/generic/dirctrlg.cpp b/Source/3rd Party/wx/src/generic/dirctrlg.cpp index 60ee92ae3..9edf105f6 100644 --- a/Source/3rd Party/wx/src/generic/dirctrlg.cpp +++ b/Source/3rd Party/wx/src/generic/dirctrlg.cpp @@ -4,7 +4,7 @@ // Author: Harm van der Heijden, Robert Roebling, Julian Smart // Modified by: // Created: 12/12/98 -// RCS-ID: $Id$ +// RCS-ID: $Id: dirctrlg.cpp 62093 2009-09-24 17:04:10Z JS $ // Copyright: (c) Harm van der Heijden, Robert Roebling and Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -29,6 +29,7 @@ #include "wx/icon.h" #include "wx/settings.h" #include "wx/msgdlg.h" + #include "wx/cmndata.h" #include "wx/choice.h" #include "wx/textctrl.h" #include "wx/layout.h" @@ -39,7 +40,6 @@ #include "wx/module.h" #endif -#include "wx/filename.h" #include "wx/filefn.h" #include "wx/imaglist.h" #include "wx/tokenzr.h" @@ -52,13 +52,12 @@ #endif #if defined(__WXMAC__) - #include "wx/osx/private.h" // includes mac headers + #include "wx/mac/private.h" // includes mac headers #endif -#ifdef __WINDOWS__ +#ifdef __WXMSW__ #include #include "wx/msw/winundef.h" -#include "wx/volume.h" // FIXME - Mingw32 1.0 has both _getdrive() and _chdrive(). For now, let's assume // older releases don't, but it should be verified and the checks modified @@ -71,7 +70,7 @@ #include #endif -#endif // __WINDOWS__ +#endif #if defined(__OS2__) || defined(__DOS__) #ifdef __OS2__ @@ -83,74 +82,77 @@ #include #include #endif + extern bool wxIsDriveAvailable(const wxString& dirName); #endif // __OS2__ #if defined(__WXMAC__) -// #include "MoreFilesX.h" + #include "MoreFilesX.h" #endif #ifdef __BORLANDC__ #include "dos.h" #endif -extern WXDLLEXPORT_DATA(const char) wxFileSelectorDefaultWildcardStr[]; - // If compiled under Windows, this macro can cause problems #ifdef GetFirstChild #undef GetFirstChild #endif -bool wxIsDriveAvailable(const wxString& dirName); - // ---------------------------------------------------------------------------- // wxGetAvailableDrives, for WINDOWS, DOS, OS2, MAC, UNIX (returns "/") // ---------------------------------------------------------------------------- size_t wxGetAvailableDrives(wxArrayString &paths, wxArrayString &names, wxArrayInt &icon_ids) { -#ifdef wxHAS_FILESYSTEM_VOLUMES +#if defined(__WINDOWS__) || defined(__DOS__) || defined(__OS2__) #ifdef __WXWINCE__ // No logical drives; return "\" paths.Add(wxT("\\")); names.Add(wxT("\\")); icon_ids.Add(wxFileIconsTable::computer); -#elif defined(__WIN32__) && wxUSE_FSVOLUME - // TODO: this code (using wxFSVolumeBase) should be used for all platforms - // but unfortunately wxFSVolumeBase is not implemented everywhere - const wxArrayString as = wxFSVolumeBase::GetVolumes(); - - for (size_t i = 0; i < as.GetCount(); i++) +#elif defined(__WIN32__) + wxChar driveBuffer[256]; + size_t n = (size_t) GetLogicalDriveStrings(255, driveBuffer); + size_t i = 0; + while (i < n) { - wxString path = as[i]; - wxFSVolume vol(path); + wxString path, name; + path.Printf(wxT("%c:\\"), driveBuffer[i]); + name.Printf(wxT("%c:"), driveBuffer[i]); + + // Do not use GetVolumeInformation to further decorate the + // name, since it can cause severe delays on network drives. + int imageId; - switch (vol.GetKind()) + int driveType = ::GetDriveType(path); + switch (driveType) { - case wxFS_VOL_FLOPPY: - if ( (path == wxT("a:\\")) || (path == wxT("b:\\")) ) + case DRIVE_REMOVABLE: + if (path == wxT("a:\\") || path == wxT("b:\\")) imageId = wxFileIconsTable::floppy; else imageId = wxFileIconsTable::removeable; break; - case wxFS_VOL_DVDROM: - case wxFS_VOL_CDROM: + case DRIVE_CDROM: imageId = wxFileIconsTable::cdrom; break; - case wxFS_VOL_NETWORK: - if (path[0] == wxT('\\')) - continue; // skip "\\computer\folder" - imageId = wxFileIconsTable::drive; - break; - case wxFS_VOL_DISK: - case wxFS_VOL_OTHER: + case DRIVE_REMOTE: + case DRIVE_FIXED: default: imageId = wxFileIconsTable::drive; break; } + paths.Add(path); - names.Add(vol.GetDisplayName()); + names.Add(name); icon_ids.Add(imageId); + + while (driveBuffer[i] != wxT('\0')) + i ++; + i ++; + if (driveBuffer[i] == wxT('\0')) + break; } #elif defined(__OS2__) APIRET rc; @@ -164,10 +166,9 @@ size_t wxGetAvailableDrives(wxArrayString &paths, wxArrayString &names, wxArrayI { if (ulDriveMap & ( 1 << i )) { - const wxString path = wxFileName::GetVolumeString( - 'A' + i, wxPATH_GET_SEPARATOR); - const wxString name = wxFileName::GetVolumeString( - 'A' + i, wxPATH_NO_SEPARATOR); + wxString path, name; + path.Printf(wxT("%c:\\"), 'A' + i); + name.Printf(wxT("%c:"), 'A' + i); // Note: If _filesys is unsupported by some compilers, // we can always replace it by DosQueryFSAttach @@ -202,23 +203,25 @@ size_t wxGetAvailableDrives(wxArrayString &paths, wxArrayString &names, wxArrayI } } #else // !__WIN32__, !__OS2__ + int drive; + /* If we can switch to the drive, it exists. */ - for ( char drive = 'A'; drive <= 'Z'; drive++ ) + for( drive = 1; drive <= 26; drive++ ) { - const wxString - path = wxFileName::GetVolumeString(drive, wxPATH_GET_SEPARATOR); + wxString path, name; + path.Printf(wxT("%c:\\"), (char) (drive + 'a' - 1)); + name.Printf(wxT("%c:"), (char) (drive + 'A' - 1)); if (wxIsDriveAvailable(path)) { paths.Add(path); - names.Add(wxFileName::GetVolumeString(drive, wxPATH_NO_SEPARATOR)); - icon_ids.Add(drive <= 2 ? wxFileIconsTable::floppy - : wxFileIconsTable::drive); + names.Add(name); + icon_ids.Add((drive <= 2) ? wxFileIconsTable::floppy : wxFileIconsTable::drive); } } #endif // __WIN32__/!__WIN32__ -#elif defined(__WXMAC__) && wxOSX_USE_COCOA_OR_CARBON +#elif defined(__WXMAC__) ItemCount volumeIndex = 1; OSErr err = noErr ; @@ -270,7 +273,7 @@ size_t wxGetAvailableDrives(wxArrayString &paths, wxArrayString &names, wxArrayI bool wxIsDriveAvailable(const wxString& dirName) { - // FIXME: this method leads to hang up under Watcom for some reason + // FIXME_MGL - this method leads to hang up under Watcom for some reason #ifdef __WATCOMC__ wxUnusedVar(dirName); #else @@ -310,7 +313,7 @@ int setdrive(int WXUNUSED_IN_WINCE(drive)) #else newdrive[2] = wxT('\0'); #endif -#if defined(__WINDOWS__) +#if defined(__WXMSW__) if (::SetCurrentDirectory(newdrive)) #else // VA doesn't know what LPSTR is and has its own set @@ -436,6 +439,64 @@ bool wxDirItemData::HasFiles(const wxString& WXUNUSED(spec)) const // wxGenericDirCtrl //----------------------------------------------------------------------------- + +#if wxUSE_EXTENDED_RTTI +WX_DEFINE_FLAGS( wxGenericDirCtrlStyle ) + +wxBEGIN_FLAGS( wxGenericDirCtrlStyle ) + // new style border flags, we put them first to + // use them for streaming out + wxFLAGS_MEMBER(wxBORDER_SIMPLE) + wxFLAGS_MEMBER(wxBORDER_SUNKEN) + wxFLAGS_MEMBER(wxBORDER_DOUBLE) + wxFLAGS_MEMBER(wxBORDER_RAISED) + wxFLAGS_MEMBER(wxBORDER_STATIC) + wxFLAGS_MEMBER(wxBORDER_NONE) + + // old style border flags + wxFLAGS_MEMBER(wxSIMPLE_BORDER) + wxFLAGS_MEMBER(wxSUNKEN_BORDER) + wxFLAGS_MEMBER(wxDOUBLE_BORDER) + wxFLAGS_MEMBER(wxRAISED_BORDER) + wxFLAGS_MEMBER(wxSTATIC_BORDER) + wxFLAGS_MEMBER(wxBORDER) + + // standard window styles + wxFLAGS_MEMBER(wxTAB_TRAVERSAL) + wxFLAGS_MEMBER(wxCLIP_CHILDREN) + wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW) + wxFLAGS_MEMBER(wxWANTS_CHARS) + wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE) + wxFLAGS_MEMBER(wxALWAYS_SHOW_SB ) + wxFLAGS_MEMBER(wxVSCROLL) + wxFLAGS_MEMBER(wxHSCROLL) + + wxFLAGS_MEMBER(wxDIRCTRL_DIR_ONLY) + wxFLAGS_MEMBER(wxDIRCTRL_3D_INTERNAL) + wxFLAGS_MEMBER(wxDIRCTRL_SELECT_FIRST) + wxFLAGS_MEMBER(wxDIRCTRL_SHOW_FILTERS) + +wxEND_FLAGS( wxGenericDirCtrlStyle ) + +IMPLEMENT_DYNAMIC_CLASS_XTI(wxGenericDirCtrl, wxControl,"wx/dirctrl.h") + +wxBEGIN_PROPERTIES_TABLE(wxGenericDirCtrl) + wxHIDE_PROPERTY( Children ) + wxPROPERTY( DefaultPath , wxString , SetDefaultPath , GetDefaultPath , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY( Filter , wxString , SetFilter , GetFilter , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group") ) + wxPROPERTY( DefaultFilter , int , SetFilterIndex, GetFilterIndex, EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group") ) + wxPROPERTY_FLAGS( WindowStyle, wxGenericDirCtrlStyle, long, SetWindowStyleFlag, GetWindowStyleFlag, EMPTY_MACROVALUE , 0, wxT("Helpstring"), wxT("group") ) +wxEND_PROPERTIES_TABLE() + +wxBEGIN_HANDLERS_TABLE(wxGenericDirCtrl) +wxEND_HANDLERS_TABLE() + +wxCONSTRUCTOR_8( wxGenericDirCtrl , wxWindow* , Parent , wxWindowID , Id , wxString , DefaultPath , + wxPoint , Position , wxSize , Size , long , WindowStyle , wxString , Filter , int , DefaultFilter ) +#else +IMPLEMENT_DYNAMIC_CLASS(wxGenericDirCtrl, wxControl) +#endif + BEGIN_EVENT_TABLE(wxGenericDirCtrl, wxControl) EVT_TREE_ITEM_EXPANDING (wxID_TREECTRL, wxGenericDirCtrl::OnExpandItem) EVT_TREE_ITEM_COLLAPSED (wxID_TREECTRL, wxGenericDirCtrl::OnCollapseItem) @@ -470,7 +531,7 @@ void wxGenericDirCtrl::ExpandRoot() } bool wxGenericDirCtrl::Create(wxWindow *parent, - const wxWindowID treeid, + const wxWindowID id, const wxString& dir, const wxPoint& pos, const wxSize& size, @@ -479,7 +540,7 @@ bool wxGenericDirCtrl::Create(wxWindow *parent, int defaultFilter, const wxString& name) { - if (!wxControl::Create(parent, treeid, pos, size, style, wxDefaultValidator, name)) + if (!wxControl::Create(parent, id, pos, size, style, wxDefaultValidator, name)) return false; SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)); @@ -502,23 +563,32 @@ bool wxGenericDirCtrl::Create(wxWindow *parent, if (style & wxDIRCTRL_EDIT_LABELS) treeStyle |= wxTR_EDIT_LABELS; - if (style & wxDIRCTRL_MULTIPLE) - treeStyle |= wxTR_MULTIPLE; - if ((style & wxDIRCTRL_3D_INTERNAL) == 0) treeStyle |= wxNO_BORDER; + else + treeStyle |= wxBORDER_SUNKEN; + + long filterStyle = 0; + if ((style & wxDIRCTRL_3D_INTERNAL) == 0) + filterStyle |= wxNO_BORDER; + else + filterStyle |= wxBORDER_SUNKEN; m_treeCtrl = CreateTreeCtrl(this, wxID_TREECTRL, wxPoint(0,0), GetClientSize(), treeStyle); - if (!filter.empty()) - m_filterListCtrl = new wxDirFilterListCtrl(this, wxID_FILTERLISTCTRL); + if (!filter.empty() && (style & wxDIRCTRL_SHOW_FILTERS)) + m_filterListCtrl = new wxDirFilterListCtrl(this, wxID_FILTERLISTCTRL, wxDefaultPosition, wxDefaultSize, filterStyle); m_defaultPath = dir; m_filter = filter; if (m_filter.empty()) - m_filter = wxFileSelectorDefaultWildcardStr; +#ifdef __UNIX__ + m_filter = wxT("*"); +#else + m_filter = wxT("*.*"); +#endif SetFilterIndex(defaultFilter); @@ -562,34 +632,18 @@ void wxGenericDirCtrl::Init() m_filterListCtrl = NULL; } -wxTreeCtrl* wxGenericDirCtrl::CreateTreeCtrl(wxWindow *parent, wxWindowID treeid, const wxPoint& pos, const wxSize& size, long treeStyle) +wxTreeCtrl* wxGenericDirCtrl::CreateTreeCtrl(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long treeStyle) { - return new wxTreeCtrl(parent, treeid, pos, size, treeStyle); + return new wxTreeCtrl(parent, id, pos, size, treeStyle); } void wxGenericDirCtrl::ShowHidden( bool show ) { - if ( m_showHidden == show ) - return; - m_showHidden = show; - if ( HasFlag(wxDIRCTRL_MULTIPLE) ) - { - wxArrayString paths; - GetPaths(paths); - ReCreateTree(); - for ( unsigned n = 0; n < paths.size(); n++ ) - { - ExpandPath(paths[n]); - } - } - else - { - wxString path = GetPath(); - ReCreateTree(); - SetPath(path); - } + wxString path = GetPath(); + ReCreateTree(); + SetPath(path); } const wxTreeItemId @@ -597,11 +651,11 @@ wxGenericDirCtrl::AddSection(const wxString& path, const wxString& name, int ima { wxDirItemData *dir_item = new wxDirItemData(path,name,true); - wxTreeItemId treeid = AppendItem( m_rootId, name, imageId, -1, dir_item); + wxTreeItemId id = AppendItem( m_rootId, name, imageId, -1, dir_item); - m_treeCtrl->SetItemHasChildren(treeid); + m_treeCtrl->SetItemHasChildren(id); - return treeid; + return id; } void wxGenericDirCtrl::SetupSections() @@ -622,14 +676,6 @@ void wxGenericDirCtrl::SetupSections() AddSection(paths[n], names[n], icons[n]); } -void wxGenericDirCtrl::SetFocus() -{ - // we don't need focus ourselves, give it to the tree so that the user - // could navigate it - if (m_treeCtrl) - m_treeCtrl->SetFocus(); -} - void wxGenericDirCtrl::OnBeginEditItem(wxTreeEvent &event) { // don't rename the main entry "Sections" @@ -665,8 +711,8 @@ void wxGenericDirCtrl::OnEndEditItem(wxTreeEvent &event) return; } - wxTreeItemId treeid = event.GetItem(); - wxDirItemData *data = (wxDirItemData*)m_treeCtrl->GetItemData( treeid ); + wxTreeItemId id = event.GetItem(); + wxDirItemData *data = (wxDirItemData*)m_treeCtrl->GetItemData( id ); wxASSERT( data ); wxString new_name( wxPathOnly( data->m_path ) ); @@ -702,6 +748,7 @@ void wxGenericDirCtrl::OnExpandItem(wxTreeEvent &event) // ctor when wxTR_HIDE_ROOT was specified if (!m_rootId.IsOk()) + m_rootId = m_treeCtrl->GetRootItem(); ExpandDir(parentId); @@ -729,7 +776,7 @@ void wxGenericDirCtrl::CollapseDir(wxTreeItemId parentId) m_treeCtrl->Thaw(); } -void wxGenericDirCtrl::PopulateNode(wxTreeItemId parentId) +void wxGenericDirCtrl::ExpandDir(wxTreeItemId parentId) { wxDirItemData *data = (wxDirItemData *) m_treeCtrl->GetItemData(parentId); @@ -797,7 +844,7 @@ void wxGenericDirCtrl::PopulateNode(wxTreeItemId parentId) dirs.Sort(wxDirCtrlStringCompareFunction); // Now do the filenames -- but only if we're allowed to - if (!HasFlag(wxDIRCTRL_DIR_ONLY)) + if ((GetWindowStyle() & wxDIRCTRL_DIR_ONLY) == 0) { d.Open(dirName); @@ -828,13 +875,9 @@ void wxGenericDirCtrl::PopulateNode(wxTreeItemId parentId) filenames.Sort(wxDirCtrlStringCompareFunction); } - // Now we really know whether we have any children so tell the tree control - // about it. - m_treeCtrl->SetItemHasChildren(parentId, !dirs.empty() || !filenames.empty()); - // Add the sorted dirs size_t i; - for (i = 0; i < dirs.GetCount(); i++) + for (i = 0; i < dirs.Count(); i++) { eachFilename = dirs[i]; path = dirName; @@ -843,23 +886,27 @@ void wxGenericDirCtrl::PopulateNode(wxTreeItemId parentId) path += eachFilename; wxDirItemData *dir_item = new wxDirItemData(path,eachFilename,true); - wxTreeItemId treeid = AppendItem( parentId, eachFilename, + wxTreeItemId id = AppendItem( parentId, eachFilename, wxFileIconsTable::folder, -1, dir_item); - m_treeCtrl->SetItemImage( treeid, wxFileIconsTable::folder_open, + m_treeCtrl->SetItemImage( id, wxFileIconsTable::folder_open, wxTreeItemIcon_Expanded ); - // assume that it does have children by default as it can take a long - // time to really check for this (think remote drives...) - // - // and if we're wrong, we'll correct the icon later if - // the user really tries to open this item - m_treeCtrl->SetItemHasChildren(treeid); + // Has this got any children? If so, make it expandable. + // (There are two situations when a dir has children: either it + // has subdirectories or it contains files that weren't filtered + // out. The latter only applies to dirctrl with files.) + if ( dir_item->HasSubDirs() || + (((GetWindowStyle() & wxDIRCTRL_DIR_ONLY) == 0) && + dir_item->HasFiles(m_currentFilterStr)) ) + { + m_treeCtrl->SetItemHasChildren(id); + } } // Add the sorted filenames - if (!HasFlag(wxDIRCTRL_DIR_ONLY)) + if ((GetWindowStyle() & wxDIRCTRL_DIR_ONLY) == 0) { - for (i = 0; i < filenames.GetCount(); i++) + for (i = 0; i < filenames.Count(); i++) { eachFilename = filenames[i]; path = dirName; @@ -876,12 +923,6 @@ void wxGenericDirCtrl::PopulateNode(wxTreeItemId parentId) } } -void wxGenericDirCtrl::ExpandDir(wxTreeItemId parentId) -{ - // ExpandDir() will not actually expand the tree node, just populate it - PopulateNode(parentId); -} - void wxGenericDirCtrl::ReCreateTree() { CollapseDir(m_treeCtrl->GetRootItem()); @@ -960,15 +1001,15 @@ wxTreeItemId wxGenericDirCtrl::FindChild(wxTreeItemId parentId, const wxString& bool wxGenericDirCtrl::ExpandPath(const wxString& path) { bool done = false; - wxTreeItemId treeid = FindChild(m_rootId, path, done); - wxTreeItemId lastId = treeid; // The last non-zero treeid - while (treeid.IsOk() && !done) + wxTreeItemId id = FindChild(m_rootId, path, done); + wxTreeItemId lastId = id; // The last non-zero id + while (id.IsOk() && !done) { - ExpandDir(treeid); + ExpandDir(id); - treeid = FindChild(treeid, path, done); - if (treeid.IsOk()) - lastId = treeid; + id = FindChild(id, path, done); + if (id.IsOk()) + lastId = id; } if (!lastId.IsOk()) return false; @@ -978,7 +1019,7 @@ bool wxGenericDirCtrl::ExpandPath(const wxString& path) { m_treeCtrl->Expand(lastId); } - if (HasFlag(wxDIRCTRL_SELECT_FIRST) && data->m_isDir) + if ((GetWindowStyle() & wxDIRCTRL_SELECT_FIRST) && data->m_isDir) { // Find the first file in this directory wxTreeItemIdValue cookie; @@ -1016,17 +1057,17 @@ bool wxGenericDirCtrl::ExpandPath(const wxString& path) bool wxGenericDirCtrl::CollapsePath(const wxString& path) { bool done = false; - wxTreeItemId treeid = FindChild(m_rootId, path, done); - wxTreeItemId lastId = treeid; // The last non-zero treeid + wxTreeItemId id = FindChild(m_rootId, path, done); + wxTreeItemId lastId = id; // The last non-zero id - while ( treeid.IsOk() && !done ) + while ( id.IsOk() && !done ) { - CollapseDir(treeid); + CollapseDir(id); - treeid = FindChild(treeid, path, done); + id = FindChild(id, path, done); - if ( treeid.IsOk() ) - lastId = treeid; + if ( id.IsOk() ) + lastId = id; } if ( !lastId.IsOk() ) @@ -1041,52 +1082,22 @@ bool wxGenericDirCtrl::CollapsePath(const wxString& path) wxString wxGenericDirCtrl::GetPath() const { - // Allow calling GetPath() in multiple selection from OnSelFilter - if (m_treeCtrl->HasFlag(wxTR_MULTIPLE)) + wxTreeItemId id = m_treeCtrl->GetSelection(); + if (id) { - wxArrayTreeItemIds items; - m_treeCtrl->GetSelections(items); - if (items.size() > 0) - { - // return first string only - wxTreeItemId treeid = items[0]; - wxDirItemData* data = (wxDirItemData*) m_treeCtrl->GetItemData(treeid); - return data->m_path; - } - - return wxEmptyString; - } - - wxTreeItemId treeid = m_treeCtrl->GetSelection(); - if (treeid) - { - wxDirItemData* data = (wxDirItemData*) m_treeCtrl->GetItemData(treeid); + wxDirItemData* data = (wxDirItemData*) m_treeCtrl->GetItemData(id); return data->m_path; } else return wxEmptyString; } -void wxGenericDirCtrl::GetPaths(wxArrayString& paths) const -{ - paths.clear(); - - wxArrayTreeItemIds items; - m_treeCtrl->GetSelections(items); - for ( unsigned n = 0; n < items.size(); n++ ) - { - wxTreeItemId treeid = items[n]; - wxDirItemData* data = (wxDirItemData*) m_treeCtrl->GetItemData(treeid); - paths.Add(data->m_path); - } -} - wxString wxGenericDirCtrl::GetFilePath() const { - wxTreeItemId treeid = m_treeCtrl->GetSelection(); - if (treeid) + wxTreeItemId id = m_treeCtrl->GetSelection(); + if (id) { - wxDirItemData* data = (wxDirItemData*) m_treeCtrl->GetItemData(treeid); + wxDirItemData* data = (wxDirItemData*) m_treeCtrl->GetItemData(id); if (data->m_isDir) return wxEmptyString; else @@ -1096,21 +1107,6 @@ wxString wxGenericDirCtrl::GetFilePath() const return wxEmptyString; } -void wxGenericDirCtrl::GetFilePaths(wxArrayString& paths) const -{ - paths.clear(); - - wxArrayTreeItemIds items; - m_treeCtrl->GetSelections(items); - for ( unsigned n = 0; n < items.size(); n++ ) - { - wxTreeItemId treeid = items[n]; - wxDirItemData* data = (wxDirItemData*) m_treeCtrl->GetItemData(treeid); - if ( !data->m_isDir ) - paths.Add(data->m_path); - } -} - void wxGenericDirCtrl::SetPath(const wxString& path) { m_defaultPath = path; @@ -1118,48 +1114,11 @@ void wxGenericDirCtrl::SetPath(const wxString& path) ExpandPath(path); } -void wxGenericDirCtrl::SelectPath(const wxString& path, bool select) -{ - bool done = false; - wxTreeItemId treeid = FindChild(m_rootId, path, done); - wxTreeItemId lastId = treeid; // The last non-zero treeid - while ( treeid.IsOk() && !done ) - { - treeid = FindChild(treeid, path, done); - if ( treeid.IsOk() ) - lastId = treeid; - } - if ( !lastId.IsOk() ) - return; - - if ( done ) - { - m_treeCtrl->SelectItem(treeid, select); - } -} - -void wxGenericDirCtrl::SelectPaths(const wxArrayString& paths) -{ - if ( HasFlag(wxDIRCTRL_MULTIPLE) ) - { - UnselectAll(); - for ( unsigned n = 0; n < paths.size(); n++ ) - { - SelectPath(paths[n]); - } - } -} - -void wxGenericDirCtrl::UnselectAll() -{ - m_treeCtrl->UnselectAll(); -} - // Not used #if 0 -void wxGenericDirCtrl::FindChildFiles(wxTreeItemId treeid, int dirFlags, wxArrayString& filenames) +void wxGenericDirCtrl::FindChildFiles(wxTreeItemId id, int dirFlags, wxArrayString& filenames) { - wxDirItemData *data = (wxDirItemData *) m_treeCtrl->GetItemData(treeid); + wxDirItemData *data = (wxDirItemData *) m_treeCtrl->GetItemData(id); // This may take a longish time. Go to busy cursor wxBusyCursor busy; @@ -1170,7 +1129,7 @@ void wxGenericDirCtrl::FindChildFiles(wxTreeItemId treeid, int dirFlags, wxArray wxString dirName(data->m_path); -#if defined(__WINDOWS__) || defined(__OS2__) +#if defined(__WXMSW__) || defined(__OS2__) if (dirName.Last() == ':') dirName += wxString(wxFILE_SEP_PATH); #endif @@ -1217,14 +1176,6 @@ void wxGenericDirCtrl::SetFilter(const wxString& filter) { m_filter = filter; - if (!filter.empty() && !m_filterListCtrl) - m_filterListCtrl = new wxDirFilterListCtrl(this, wxID_FILTERLISTCTRL); - else if (filter.empty() && m_filterListCtrl) - { - m_filterListCtrl->Destroy(); - m_filterListCtrl = NULL; - } - wxString f, d; if (ExtractWildcard(m_filter, m_currentFilter, f, d)) m_currentFilterStr = f; @@ -1234,6 +1185,7 @@ void wxGenericDirCtrl::SetFilter(const wxString& filter) #else m_currentFilterStr = wxT("*.*"); #endif + // current filter index is meaningless after filter change, set it to zero SetFilterIndex(0); if (m_filterListCtrl) @@ -1255,6 +1207,15 @@ bool wxGenericDirCtrl::ExtractWildcard(const wxString& filterStr, int n, wxStrin return false; } +#if WXWIN_COMPATIBILITY_2_4 +// Parses the global filter, returning the number of filters. +// Returns 0 if none or if there's a problem. +// filterStr is in the form: "All files (*.*)|*.*|JPEG Files (*.jpeg)|*.jpg" +int wxGenericDirCtrl::ParseFilter(const wxString& filterStr, wxArrayString& filters, wxArrayString& descriptions) +{ + return wxParseCommonDialogsFilter(filterStr, descriptions, filters ); +} +#endif // WXWIN_COMPATIBILITY_2_4 void wxGenericDirCtrl::DoResize() { @@ -1314,22 +1275,13 @@ BEGIN_EVENT_TABLE(wxDirFilterListCtrl, wxChoice) EVT_CHOICE(wxID_ANY, wxDirFilterListCtrl::OnSelFilter) END_EVENT_TABLE() -bool wxDirFilterListCtrl::Create(wxGenericDirCtrl* parent, - const wxWindowID treeid, - const wxPoint& pos, - const wxSize& size, - long style) +bool wxDirFilterListCtrl::Create(wxGenericDirCtrl* parent, const wxWindowID id, + const wxPoint& pos, + const wxSize& size, + long style) { m_dirCtrl = parent; - - // by default our border style is determined by the style of our parent - if ( !(style & wxBORDER_MASK) ) - { - style |= parent->HasFlag(wxDIRCTRL_3D_INTERNAL) ? wxBORDER_SUNKEN - : wxBORDER_NONE; - } - - return wxChoice::Create(parent, treeid, pos, size, 0, NULL, style); + return wxChoice::Create(parent, id, pos, size, 0, NULL, style); } void wxDirFilterListCtrl::Init() @@ -1341,33 +1293,16 @@ void wxDirFilterListCtrl::OnSelFilter(wxCommandEvent& WXUNUSED(event)) { int sel = GetSelection(); - if (m_dirCtrl->HasFlag(wxDIRCTRL_MULTIPLE)) - { - wxArrayString paths; - m_dirCtrl->GetPaths(paths); + wxString currentPath = m_dirCtrl->GetPath(); - m_dirCtrl->SetFilterIndex(sel); + m_dirCtrl->SetFilterIndex(sel); - // If the filter has changed, the view is out of date, so - // collapse the tree. - m_dirCtrl->ReCreateTree(); + // If the filter has changed, the view is out of date, so + // collapse the tree. + m_dirCtrl->ReCreateTree(); - // Expand and select the previously selected paths - for (unsigned int i = 0; i < paths.GetCount(); i++) - { - m_dirCtrl->ExpandPath(paths.Item(i)); - } - } - else - { - wxString currentPath = m_dirCtrl->GetPath(); - - m_dirCtrl->SetFilterIndex(sel); - m_dirCtrl->ReCreateTree(); - - // Try to restore the selection, or at least the directory - m_dirCtrl->ExpandPath(currentPath); - } + // Try to restore the selection, or at least the directory + m_dirCtrl->ExpandPath(currentPath); } void wxDirFilterListCtrl::FillFilterList(const wxString& filter, int defaultFilter) @@ -1391,9 +1326,9 @@ void wxDirFilterListCtrl::FillFilterList(const wxString& filter, int defaultFilt // wxFileIconsTable icons // ---------------------------------------------------------------------------- -#ifndef __WXGTK20__ +#ifndef __WXGTK24__ /* Computer (c) Julian Smart */ -static const char* const file_icons_tbl_computer_xpm[] = { +static const char * file_icons_tbl_computer_xpm[] = { /* columns rows colors chars-per-pixel */ "16 16 42 1", "r c #4E7FD0", @@ -1456,14 +1391,14 @@ static const char* const file_icons_tbl_computer_xpm[] = { " dfffffffffffffd", " " }; -#endif // !GTK+ 2 +#endif // GTK+ < 2.4 // ---------------------------------------------------------------------------- // wxFileIconsTable & friends // ---------------------------------------------------------------------------- // global instance of a wxFileIconsTable -wxFileIconsTable* wxTheFileIconsTable = NULL; +wxFileIconsTable* wxTheFileIconsTable = (wxFileIconsTable *)NULL; // A module to allow icons table cleanup @@ -1475,7 +1410,11 @@ public: bool OnInit() { wxTheFileIconsTable = new wxFileIconsTable; return true; } void OnExit() { - wxDELETE(wxTheFileIconsTable); + if (wxTheFileIconsTable) + { + delete wxTheFileIconsTable; + wxTheFileIconsTable = NULL; + } } }; @@ -1484,9 +1423,9 @@ IMPLEMENT_DYNAMIC_CLASS(wxFileIconsTableModule, wxModule) class wxFileIconEntry : public wxObject { public: - wxFileIconEntry(int i) { iconid = i; } + wxFileIconEntry(int i) { id = i; } - int iconid; + int id; }; wxFileIconsTable::wxFileIconsTable() @@ -1521,7 +1460,7 @@ void wxFileIconsTable::Create() wxART_CMN_DIALOG, wxSize(16, 16))); // computer -#ifdef __WXGTK20__ +#ifdef __WXGTK24__ // GTK24 uses this icon in the file open dialog m_smallImageList->Add(wxArtProvider::GetBitmap(wxART_HARDDISK, wxART_CMN_DIALOG, @@ -1550,14 +1489,14 @@ void wxFileIconsTable::Create() wxART_CMN_DIALOG, wxSize(16, 16))); // executable - if (GetIconID(wxEmptyString, wxT("application/x-executable")) == file) + if (GetIconID(wxEmptyString, _T("application/x-executable")) == file) { m_smallImageList->Add(wxArtProvider::GetBitmap(wxART_EXECUTABLE_FILE, wxART_CMN_DIALOG, wxSize(16, 16))); - delete m_HashTable->Get(wxT("exe")); - m_HashTable->Delete(wxT("exe")); - m_HashTable->Put(wxT("exe"), new wxFileIconEntry(executable)); + delete m_HashTable->Get(_T("exe")); + m_HashTable->Delete(_T("exe")); + m_HashTable->Put(_T("exe"), new wxFileIconEntry(executable)); } /* else put into list by GetIconID (KDE defines application/x-executable for *.exe and has nice icon) @@ -1572,7 +1511,7 @@ wxImageList *wxFileIconsTable::GetSmallImageList() return m_smallImageList; } -#if wxUSE_MIMETYPE && wxUSE_IMAGE && (!defined(__WINDOWS__) || wxUSE_WXDIB) +#if wxUSE_MIMETYPE && wxUSE_IMAGE && (!defined(__WXMSW__) || wxUSE_WXDIB) // VS: we don't need this function w/o wxMimeTypesManager because we'll only have // one icon and we won't resize it @@ -1688,7 +1627,7 @@ int wxFileIconsTable::GetIconID(const wxString& extension, const wxString& mime) if (!extension.empty()) { wxFileIconEntry *entry = (wxFileIconEntry*) m_HashTable->Get(extension); - if (entry) return (entry -> iconid); + if (entry) return (entry -> id); } wxFileType *ft = (mime.empty()) ? @@ -1708,7 +1647,7 @@ int wxFileIconsTable::GetIconID(const wxString& extension, const wxString& mime) delete ft; - if ( !ic.IsOk() ) + if ( !ic.Ok() ) { int newid = file; m_HashTable->Put(extension, new wxFileIconEntry(newid)); @@ -1718,7 +1657,7 @@ int wxFileIconsTable::GetIconID(const wxString& extension, const wxString& mime) wxBitmap bmp; bmp.CopyFromIcon(ic); - if ( !bmp.IsOk() ) + if ( !bmp.Ok() ) { int newid = file; m_HashTable->Put(extension, new wxFileIconEntry(newid)); @@ -1727,12 +1666,12 @@ int wxFileIconsTable::GetIconID(const wxString& extension, const wxString& mime) const unsigned int size = 16; - int treeid = m_smallImageList->GetImageCount(); + int id = m_smallImageList->GetImageCount(); if ((bmp.GetWidth() == (int) size) && (bmp.GetHeight() == (int) size)) { m_smallImageList->Add(bmp); } -#if wxUSE_IMAGE && (!defined(__WINDOWS__) || wxUSE_WXDIB) +#if wxUSE_IMAGE && (!defined(__WXMSW__) || wxUSE_WXDIB) else { wxImage img = bmp.ConvertToImage(); @@ -1745,8 +1684,8 @@ int wxFileIconsTable::GetIconID(const wxString& extension, const wxString& mime) } #endif // wxUSE_IMAGE - m_HashTable->Put(extension, new wxFileIconEntry(treeid)); - return treeid; + m_HashTable->Put(extension, new wxFileIconEntry(id)); + return id; #else // !wxUSE_MIMETYPE diff --git a/Source/3rd Party/wx/src/generic/dragimgg.cpp b/Source/3rd Party/wx/src/generic/dragimgg.cpp index 83a55343c..d3c8ac474 100644 --- a/Source/3rd Party/wx/src/generic/dragimgg.cpp +++ b/Source/3rd Party/wx/src/generic/dragimgg.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 29/2/2000 -// RCS-ID: $Id$ +// RCS-ID: $Id: dragimgg.cpp 42397 2006-10-25 12:12:56Z VS $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -69,13 +69,13 @@ void wxGenericDragImage::Init() { m_isDirty = false; m_isShown = false; - m_windowDC = NULL; - m_window = NULL; + m_windowDC = (wxDC*) NULL; + m_window = (wxWindow*) NULL; m_fullScreen = false; #ifdef wxHAS_NATIVE_OVERLAY m_dcOverlay = NULL; #else - m_pBackingBitmap = NULL; + m_pBackingBitmap = (wxBitmap*) NULL; #endif } @@ -172,7 +172,7 @@ bool wxGenericDragImage::Create(const wxString& str, const wxCursor& cursor) { wxFont font(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)); - wxCoord w = 0, h = 0; + long w = 0, h = 0; wxScreenDC dc; dc.SetFont(font); dc.GetTextExtent(str, & w, & h); @@ -187,7 +187,7 @@ bool wxGenericDragImage::Create(const wxString& str, const wxCursor& cursor) dc2.SetFont(font); dc2.SetBackground(* wxWHITE_BRUSH); dc2.Clear(); - dc2.SetBackgroundMode(wxBRUSHSTYLE_TRANSPARENT); + dc2.SetBackgroundMode(wxTRANSPARENT); dc2.SetTextForeground(* wxLIGHT_GREY); dc2.DrawText(str, 0, 0); dc2.DrawText(str, 1, 0); @@ -236,7 +236,7 @@ bool wxGenericDragImage::BeginDrag(const wxPoint& hotspot, bool fullScreen, wxRect* rect) { - wxCHECK_MSG( window, false, wxT("Window must not be null in BeginDrag.")); + wxASSERT_MSG( (window != 0), wxT("Window must not be null in BeginDrag.")); // The image should be offset by this amount m_offset = hotspot; @@ -247,15 +247,18 @@ bool wxGenericDragImage::BeginDrag(const wxPoint& hotspot, m_boundingRect = * rect; m_isDirty = false; - m_isShown = false; + m_isDirty = false; - if (m_cursor.IsOk()) + if (window) { - m_oldCursor = window->GetCursor(); - window->SetCursor(m_cursor); - } + window->CaptureMouse(); - window->CaptureMouse(); + if (m_cursor.Ok()) + { + m_oldCursor = window->GetCursor(); + window->SetCursor(m_cursor); + } + } // Make a copy of the window so we can repair damage done as the image is // dragged. @@ -288,7 +291,7 @@ bool wxGenericDragImage::BeginDrag(const wxPoint& hotspot, #ifndef wxHAS_NATIVE_OVERLAY wxBitmap* backing = (m_pBackingBitmap ? m_pBackingBitmap : (wxBitmap*) & m_backingBitmap); - if (!backing->IsOk() || (backing->GetWidth() < clientSize.x || backing->GetHeight() < clientSize.y)) + if (!backing->Ok() || (backing->GetWidth() < clientSize.x || backing->GetHeight() < clientSize.y)) (*backing) = wxBitmap(clientSize.x, clientSize.y); #endif // !wxHAS_NATIVE_OVERLAY @@ -324,7 +327,7 @@ bool wxGenericDragImage::BeginDrag(const wxPoint& hotspot, wxWindow* window, wxW wxSize sz = fullScreenRect->GetSize(); - if (fullScreenRect->GetParent() && !wxDynamicCast(fullScreenRect, wxFrame)) + if (fullScreenRect->GetParent() && !fullScreenRect->IsKindOf(CLASSINFO(wxFrame))) fullScreenRect->GetParent()->ClientToScreen(& x, & y); rect.x = x; rect.y = y; @@ -345,7 +348,7 @@ bool wxGenericDragImage::EndDrag() #endif m_window->ReleaseMouse(); - if (m_cursor.IsOk() && m_oldCursor.IsOk()) + if (m_cursor.Ok() && m_oldCursor.Ok()) { m_window->SetCursor(m_oldCursor); } @@ -358,7 +361,8 @@ bool wxGenericDragImage::EndDrag() #else m_windowDC->DestroyClippingRegion(); #endif - wxDELETE(m_windowDC); + delete m_windowDC; + m_windowDC = (wxDC*) NULL; } #ifndef wxHAS_NATIVE_OVERLAY @@ -372,7 +376,7 @@ bool wxGenericDragImage::EndDrag() // is non-NULL, or in screen coordinates if NULL. bool wxGenericDragImage::Move(const wxPoint& pt) { - wxASSERT_MSG( (m_windowDC != NULL), wxT("No window DC in wxGenericDragImage::Move()") ); + wxASSERT_MSG( (m_windowDC != (wxDC*) NULL), wxT("No window DC in wxGenericDragImage::Move()") ); wxPoint pt2(pt); if (m_fullScreen) @@ -396,7 +400,7 @@ bool wxGenericDragImage::Move(const wxPoint& pt) bool wxGenericDragImage::Show() { - wxASSERT_MSG( (m_windowDC != NULL), wxT("No window DC in wxGenericDragImage::Show()") ); + wxASSERT_MSG( (m_windowDC != (wxDC*) NULL), wxT("No window DC in wxGenericDragImage::Show()") ); // Show at the current position @@ -434,7 +438,7 @@ bool wxGenericDragImage::UpdateBackingFromWindow(wxDC& windowDC, wxMemoryDC& des bool wxGenericDragImage::Hide() { - wxASSERT_MSG( (m_windowDC != NULL), wxT("No window DC in wxGenericDragImage::Hide()") ); + wxASSERT_MSG( (m_windowDC != (wxDC*) NULL), wxT("No window DC in wxGenericDragImage::Hide()") ); // Repair the old position @@ -450,16 +454,13 @@ bool wxGenericDragImage::Hide() } // More efficient: erase and redraw simultaneously if possible -bool wxGenericDragImage::RedrawImage(const wxPoint& oldPos, - const wxPoint& newPos, +bool wxGenericDragImage::RedrawImage(const wxPoint& oldPos, const wxPoint& newPos, bool eraseOld, bool drawNew) { if (!m_windowDC) return false; #ifdef wxHAS_NATIVE_OVERLAY - wxUnusedVar(oldPos); - wxDCOverlay dcoverlay( m_overlay, (wxWindowDC*) m_windowDC ) ; if ( eraseOld ) dcoverlay.Clear() ; @@ -467,7 +468,7 @@ bool wxGenericDragImage::RedrawImage(const wxPoint& oldPos, DoDrawImage(*m_windowDC, newPos); #else // !wxHAS_NATIVE_OVERLAY wxBitmap* backing = (m_pBackingBitmap ? m_pBackingBitmap : (wxBitmap*) & m_backingBitmap); - if (!backing->IsOk()) + if (!backing->Ok()) return false; wxRect oldRect(GetImageRect(oldPos)); @@ -499,7 +500,7 @@ bool wxGenericDragImage::RedrawImage(const wxPoint& oldPos, // keep reallocating all the time. int excess = 50; - if (!m_repairBitmap.IsOk() || (m_repairBitmap.GetWidth() < fullRect.GetWidth() || m_repairBitmap.GetHeight() < fullRect.GetHeight())) + if (!m_repairBitmap.Ok() || (m_repairBitmap.GetWidth() < fullRect.GetWidth() || m_repairBitmap.GetHeight() < fullRect.GetHeight())) { m_repairBitmap = wxBitmap(fullRect.GetWidth() + excess, fullRect.GetHeight() + excess); } @@ -539,12 +540,12 @@ bool wxGenericDragImage::RedrawImage(const wxPoint& oldPos, // Override this if you are using a virtual image (drawing your own image) bool wxGenericDragImage::DoDrawImage(wxDC& dc, const wxPoint& pos) const { - if (m_bitmap.IsOk()) + if (m_bitmap.Ok()) { dc.DrawBitmap(m_bitmap, pos.x, pos.y, (m_bitmap.GetMask() != 0)); return true; } - else if (m_icon.IsOk()) + else if (m_icon.Ok()) { dc.DrawIcon(m_icon, pos.x, pos.y); return true; @@ -556,11 +557,11 @@ bool wxGenericDragImage::DoDrawImage(wxDC& dc, const wxPoint& pos) const // Override this if you are using a virtual image (drawing your own image) wxRect wxGenericDragImage::GetImageRect(const wxPoint& pos) const { - if (m_bitmap.IsOk()) + if (m_bitmap.Ok()) { return wxRect(pos.x, pos.y, m_bitmap.GetWidth(), m_bitmap.GetHeight()); } - else if (m_icon.IsOk()) + else if (m_icon.Ok()) { return wxRect(pos.x, pos.y, m_icon.GetWidth(), m_icon.GetHeight()); } diff --git a/Source/3rd Party/wx/src/generic/filectrlg.cpp b/Source/3rd Party/wx/src/generic/filectrlg.cpp deleted file mode 100644 index fbbab5bf1..000000000 --- a/Source/3rd Party/wx/src/generic/filectrlg.cpp +++ /dev/null @@ -1,1473 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/generic/filectrlg.cpp -// Purpose: wxGenericFileCtrl Implementation -// Author: Diaa M. Sami -// Created: 2007-07-07 -// RCS-ID: $Id$ -// Copyright: (c) Diaa M. Sami -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#if wxUSE_FILECTRL - -#include "wx/generic/filectrlg.h" - -#ifndef WX_PRECOMP - #include "wx/settings.h" - #include "wx/sizer.h" - #include "wx/stattext.h" - #include "wx/checkbox.h" - #include "wx/msgdlg.h" - #include "wx/log.h" - #include "wx/filedlg.h" -#endif - -#include "wx/clntdata.h" -#include "wx/file.h" // for wxS_IXXX constants only -#include "wx/generic/dirctrlg.h" // for wxFileIconsTable -#include "wx/dir.h" -#include "wx/tokenzr.h" -#include "wx/imaglist.h" - -#ifdef __WINDOWS__ - #include "wx/msw/wrapwin.h" -#endif - -#if defined(__WXWINCE__) -#define IsTopMostDir(dir) (dir == wxT("\\") || dir == wxT("/")) -#elif (defined(__DOS__) || defined(__WINDOWS__) || defined (__OS2__)) -#define IsTopMostDir(dir) (dir.empty()) -#else -#define IsTopMostDir(dir) (dir == wxT("/")) -#endif - - -// ---------------------------------------------------------------------------- -// private functions -// ---------------------------------------------------------------------------- - -static -int wxCALLBACK wxFileDataNameCompare( wxIntPtr data1, wxIntPtr data2, wxIntPtr sortOrder) -{ - wxFileData *fd1 = (wxFileData *)wxUIntToPtr(data1); - wxFileData *fd2 = (wxFileData *)wxUIntToPtr(data2); - - if (fd1->GetFileName() == wxT("..")) - return -sortOrder; - if (fd2->GetFileName() == wxT("..")) - return sortOrder; - if (fd1->IsDir() && !fd2->IsDir()) - return -sortOrder; - if (fd2->IsDir() && !fd1->IsDir()) - return sortOrder; - - return sortOrder*wxStrcmp( fd1->GetFileName(), fd2->GetFileName() ); -} - -static -int wxCALLBACK wxFileDataSizeCompare(wxIntPtr data1, wxIntPtr data2, wxIntPtr sortOrder) -{ - wxFileData *fd1 = (wxFileData *)wxUIntToPtr(data1); - wxFileData *fd2 = (wxFileData *)wxUIntToPtr(data2); - - if (fd1->GetFileName() == wxT("..")) - return -sortOrder; - if (fd2->GetFileName() == wxT("..")) - return sortOrder; - if (fd1->IsDir() && !fd2->IsDir()) - return -sortOrder; - if (fd2->IsDir() && !fd1->IsDir()) - return sortOrder; - if (fd1->IsLink() && !fd2->IsLink()) - return -sortOrder; - if (fd2->IsLink() && !fd1->IsLink()) - return sortOrder; - - return fd1->GetSize() > fd2->GetSize() ? sortOrder : -sortOrder; -} - -static -int wxCALLBACK wxFileDataTypeCompare(wxIntPtr data1, wxIntPtr data2, wxIntPtr sortOrder) -{ - wxFileData *fd1 = (wxFileData *)wxUIntToPtr(data1); - wxFileData *fd2 = (wxFileData *)wxUIntToPtr(data2); - - if (fd1->GetFileName() == wxT("..")) - return -sortOrder; - if (fd2->GetFileName() == wxT("..")) - return sortOrder; - if (fd1->IsDir() && !fd2->IsDir()) - return -sortOrder; - if (fd2->IsDir() && !fd1->IsDir()) - return sortOrder; - if (fd1->IsLink() && !fd2->IsLink()) - return -sortOrder; - if (fd2->IsLink() && !fd1->IsLink()) - return sortOrder; - - return sortOrder*wxStrcmp( fd1->GetFileType(), fd2->GetFileType() ); -} - -static -int wxCALLBACK wxFileDataTimeCompare(wxIntPtr data1, wxIntPtr data2, wxIntPtr sortOrder) -{ - wxFileData *fd1 = (wxFileData *)wxUIntToPtr(data1); - wxFileData *fd2 = (wxFileData *)wxUIntToPtr(data2); - - if (fd1->GetFileName() == wxT("..")) - return -sortOrder; - if (fd2->GetFileName() == wxT("..")) - return sortOrder; - if (fd1->IsDir() && !fd2->IsDir()) - return -sortOrder; - if (fd2->IsDir() && !fd1->IsDir()) - return sortOrder; - - return fd1->GetDateTime().IsLaterThan(fd2->GetDateTime()) ? sortOrder : -sortOrder; -} - -// defined in src/generic/dirctrlg.cpp -extern size_t wxGetAvailableDrives(wxArrayString &paths, wxArrayString &names, wxArrayInt &icon_ids); - -//----------------------------------------------------------------------------- -// wxFileData -//----------------------------------------------------------------------------- - -wxFileData::wxFileData( const wxString &filePath, const wxString &fileName, fileType type, int image_id ) -{ - Init(); - m_fileName = fileName; - m_filePath = filePath; - m_type = type; - m_image = image_id; - - ReadData(); -} - -void wxFileData::Init() -{ - m_size = 0; - m_type = wxFileData::is_file; - m_image = wxFileIconsTable::file; -} - -void wxFileData::Copy( const wxFileData& fileData ) -{ - m_fileName = fileData.GetFileName(); - m_filePath = fileData.GetFilePath(); - m_size = fileData.GetSize(); - m_dateTime = fileData.GetDateTime(); - m_permissions = fileData.GetPermissions(); - m_type = fileData.GetType(); - m_image = fileData.GetImageId(); -} - -void wxFileData::ReadData() -{ - if (IsDrive()) - { - m_size = 0; - return; - } - -#if defined(__DOS__) || (defined(__WINDOWS__) && !defined(__WXWINCE__)) || defined(__OS2__) - // c:\.. is a drive don't stat it - if ((m_fileName == wxT("..")) && (m_filePath.length() <= 5)) - { - m_type = is_drive; - m_size = 0; - return; - } -#endif // __DOS__ || __WINDOWS__ - -#ifdef __WXWINCE__ - - // WinCE - - DWORD fileAttribs = GetFileAttributes(m_filePath.fn_str()); - m_type |= (fileAttribs & FILE_ATTRIBUTE_DIRECTORY) != 0 ? is_dir : 0; - - wxString p, f, ext; - wxFileName::SplitPath(m_filePath, & p, & f, & ext); - if (wxStricmp(ext, wxT("exe")) == 0) - m_type |= is_exe; - - // Find out size - m_size = 0; - HANDLE fileHandle = CreateFile(m_filePath.fn_str(), - GENERIC_READ, - FILE_SHARE_READ, - NULL, - OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, - NULL); - - if (fileHandle != INVALID_HANDLE_VALUE) - { - m_size = GetFileSize(fileHandle, 0); - CloseHandle(fileHandle); - } - - m_dateTime = wxFileModificationTime(m_filePath); - -#else - - // OTHER PLATFORMS - - wxStructStat buff; - -#if defined(__UNIX__) && (!defined( __OS2__ ) && !defined(__VMS)) - lstat( m_filePath.fn_str(), &buff ); - m_type |= S_ISLNK(buff.st_mode) ? is_link : 0; -#else // no lstat() - wxStat( m_filePath, &buff ); -#endif - - m_type |= (buff.st_mode & S_IFDIR) != 0 ? is_dir : 0; - m_type |= (buff.st_mode & wxS_IXUSR) != 0 ? is_exe : 0; - - m_size = buff.st_size; - - m_dateTime = buff.st_mtime; -#endif - // __WXWINCE__ - -#if defined(__UNIX__) - m_permissions.Printf(wxT("%c%c%c%c%c%c%c%c%c"), - buff.st_mode & wxS_IRUSR ? wxT('r') : wxT('-'), - buff.st_mode & wxS_IWUSR ? wxT('w') : wxT('-'), - buff.st_mode & wxS_IXUSR ? wxT('x') : wxT('-'), - buff.st_mode & wxS_IRGRP ? wxT('r') : wxT('-'), - buff.st_mode & wxS_IWGRP ? wxT('w') : wxT('-'), - buff.st_mode & wxS_IXGRP ? wxT('x') : wxT('-'), - buff.st_mode & wxS_IROTH ? wxT('r') : wxT('-'), - buff.st_mode & wxS_IWOTH ? wxT('w') : wxT('-'), - buff.st_mode & wxS_IXOTH ? wxT('x') : wxT('-')); -#elif defined(__WIN32__) - DWORD attribs = ::GetFileAttributes(m_filePath.c_str()); - if (attribs != (DWORD)-1) - { - m_permissions.Printf(wxT("%c%c%c%c"), - attribs & FILE_ATTRIBUTE_ARCHIVE ? wxT('A') : wxT(' '), - attribs & FILE_ATTRIBUTE_READONLY ? wxT('R') : wxT(' '), - attribs & FILE_ATTRIBUTE_HIDDEN ? wxT('H') : wxT(' '), - attribs & FILE_ATTRIBUTE_SYSTEM ? wxT('S') : wxT(' ')); - } -#endif - - // try to get a better icon - if (m_image == wxFileIconsTable::file) - { - if (m_fileName.Find(wxT('.'), true) != wxNOT_FOUND) - { - m_image = wxTheFileIconsTable->GetIconID( m_fileName.AfterLast(wxT('.'))); - } else if (IsExe()) - { - m_image = wxFileIconsTable::executable; - } - } -} - -wxString wxFileData::GetFileType() const -{ - if (IsDir()) - return _(""); - else if (IsLink()) - return _(""); - else if (IsDrive()) - return _(""); - else if (m_fileName.Find(wxT('.'), true) != wxNOT_FOUND) - return m_fileName.AfterLast(wxT('.')); - - return wxEmptyString; -} - -wxString wxFileData::GetModificationTime() const -{ - // want time as 01:02 so they line up nicely, no %r in WIN32 - return m_dateTime.FormatDate() + wxT(" ") + m_dateTime.Format(wxT("%I:%M:%S %p")); -} - -wxString wxFileData::GetHint() const -{ - wxString s = m_filePath; - s += wxT(" "); - - if (IsDir()) - s += _(""); - else if (IsLink()) - s += _(""); - else if (IsDrive()) - s += _(""); - else // plain file - s += wxString::Format(wxPLURAL("%ld byte", "%ld bytes", m_size), - wxLongLong(m_size).ToString().c_str()); - - s += wxT(' '); - - if ( !IsDrive() ) - { - s << GetModificationTime() - << wxT(" ") - << m_permissions; - } - - return s; -} - -wxString wxFileData::GetEntry( fileListFieldType num ) const -{ - wxString s; - switch ( num ) - { - case FileList_Name: - s = m_fileName; - break; - - case FileList_Size: - if (!IsDir() && !IsLink() && !IsDrive()) - s = wxLongLong(m_size).ToString(); - break; - - case FileList_Type: - s = GetFileType(); - break; - - case FileList_Time: - if (!IsDrive()) - s = GetModificationTime(); - break; - -#if defined(__UNIX__) || defined(__WIN32__) - case FileList_Perm: - s = m_permissions; - break; -#endif // defined(__UNIX__) || defined(__WIN32__) - - default: - wxFAIL_MSG( wxT("unexpected field in wxFileData::GetEntry()") ); - } - - return s; -} - -void wxFileData::SetNewName( const wxString &filePath, const wxString &fileName ) -{ - m_fileName = fileName; - m_filePath = filePath; -} - -void wxFileData::MakeItem( wxListItem &item ) -{ - item.m_text = m_fileName; - item.ClearAttributes(); - if (IsExe()) - item.SetTextColour(*wxRED); - if (IsDir()) - item.SetTextColour(*wxBLUE); - - item.m_image = m_image; - - if (IsLink()) - { - wxColour dg = wxTheColourDatabase->Find( wxT("MEDIUM GREY") ); - if ( dg.IsOk() ) - item.SetTextColour(dg); - } - item.m_data = wxPtrToUInt(this); -} - -//----------------------------------------------------------------------------- -// wxFileListCtrl -//----------------------------------------------------------------------------- - -IMPLEMENT_DYNAMIC_CLASS(wxFileListCtrl,wxListCtrl) - -BEGIN_EVENT_TABLE(wxFileListCtrl,wxListCtrl) - EVT_LIST_DELETE_ITEM(wxID_ANY, wxFileListCtrl::OnListDeleteItem) - EVT_LIST_DELETE_ALL_ITEMS(wxID_ANY, wxFileListCtrl::OnListDeleteAllItems) - EVT_LIST_END_LABEL_EDIT(wxID_ANY, wxFileListCtrl::OnListEndLabelEdit) - EVT_LIST_COL_CLICK(wxID_ANY, wxFileListCtrl::OnListColClick) -END_EVENT_TABLE() - - -wxFileListCtrl::wxFileListCtrl() -{ - m_showHidden = false; - m_sort_forward = true; - m_sort_field = wxFileData::FileList_Name; -} - -wxFileListCtrl::wxFileListCtrl(wxWindow *win, - wxWindowID id, - const wxString& wild, - bool showHidden, - const wxPoint& pos, - const wxSize& size, - long style, - const wxValidator &validator, - const wxString &name) - : wxListCtrl(win, id, pos, size, style, validator, name), - m_wild(wild) -{ - wxImageList *imageList = wxTheFileIconsTable->GetSmallImageList(); - - SetImageList( imageList, wxIMAGE_LIST_SMALL ); - - m_showHidden = showHidden; - - m_sort_forward = true; - m_sort_field = wxFileData::FileList_Name; - - m_dirName = wxT("*"); - - if (style & wxLC_REPORT) - ChangeToReportMode(); -} - -void wxFileListCtrl::ChangeToListMode() -{ - ClearAll(); - SetSingleStyle( wxLC_LIST ); - UpdateFiles(); -} - -void wxFileListCtrl::ChangeToReportMode() -{ - ClearAll(); - SetSingleStyle( wxLC_REPORT ); - - // do this since WIN32 does mm/dd/yy UNIX does mm/dd/yyyy - // don't hardcode since mm/dd is dd/mm elsewhere - int w, h; - wxDateTime dt(22, wxDateTime::Dec, 2002, 22, 22, 22); - wxString txt = dt.FormatDate() + wxT("22") + dt.Format(wxT("%I:%M:%S %p")); - GetTextExtent(txt, &w, &h); - - InsertColumn( 0, _("Name"), wxLIST_FORMAT_LEFT, w ); - InsertColumn( 1, _("Size"), wxLIST_FORMAT_LEFT, w/2 ); - InsertColumn( 2, _("Type"), wxLIST_FORMAT_LEFT, w/2 ); - InsertColumn( 3, _("Modified"), wxLIST_FORMAT_LEFT, w ); -#if defined(__UNIX__) - GetTextExtent(wxT("Permissions 2"), &w, &h); - InsertColumn( 4, _("Permissions"), wxLIST_FORMAT_LEFT, w ); -#elif defined(__WIN32__) - GetTextExtent(wxT("Attributes 2"), &w, &h); - InsertColumn( 4, _("Attributes"), wxLIST_FORMAT_LEFT, w ); -#endif - - UpdateFiles(); -} - -void wxFileListCtrl::ChangeToSmallIconMode() -{ - ClearAll(); - SetSingleStyle( wxLC_SMALL_ICON ); - UpdateFiles(); -} - -void wxFileListCtrl::ShowHidden( bool show ) -{ - m_showHidden = show; - UpdateFiles(); -} - -long wxFileListCtrl::Add( wxFileData *fd, wxListItem &item ) -{ - long ret = -1; - item.m_mask = wxLIST_MASK_TEXT + wxLIST_MASK_DATA + wxLIST_MASK_IMAGE; - fd->MakeItem( item ); - long my_style = GetWindowStyleFlag(); - if (my_style & wxLC_REPORT) - { - ret = InsertItem( item ); - for (int i = 1; i < wxFileData::FileList_Max; i++) - SetItem( item.m_itemId, i, fd->GetEntry((wxFileData::fileListFieldType)i) ); - } - else if ((my_style & wxLC_LIST) || (my_style & wxLC_SMALL_ICON)) - { - ret = InsertItem( item ); - } - return ret; -} - -void wxFileListCtrl::UpdateItem(const wxListItem &item) -{ - wxFileData *fd = (wxFileData*)GetItemData(item); - wxCHECK_RET(fd, wxT("invalid filedata")); - - fd->ReadData(); - - SetItemText(item, fd->GetFileName()); - SetItemImage(item, fd->GetImageId()); - - if (GetWindowStyleFlag() & wxLC_REPORT) - { - for (int i = 1; i < wxFileData::FileList_Max; i++) - SetItem( item.m_itemId, i, fd->GetEntry((wxFileData::fileListFieldType)i) ); - } -} - -void wxFileListCtrl::UpdateFiles() -{ - // don't do anything before ShowModal() call which sets m_dirName - if ( m_dirName == wxT("*") ) - return; - - wxBusyCursor bcur; // this may take a while... - - DeleteAllItems(); - - wxListItem item; - item.m_itemId = 0; - item.m_col = 0; - -#if (defined(__WINDOWS__) || defined(__DOS__) || defined(__WXMAC__) || defined(__OS2__)) && !defined(__WXWINCE__) - if ( IsTopMostDir(m_dirName) ) - { - wxArrayString names, paths; - wxArrayInt icons; - const size_t count = wxGetAvailableDrives(paths, names, icons); - - for ( size_t n = 0; n < count; n++ ) - { - // use paths[n] as the drive name too as our HandleAction() can't - // deal with the drive names (of the form "System (C:)") currently - // as it mistakenly treats them as file names - // - // it would be preferable to show names, and not paths, in the - // dialog just as the native dialog does but for this we must: - // a) store the item type as item data and modify HandleAction() - // to use it instead of wxDirExists() to check whether the item - // is a directory - // b) store the drives by their drive letters and not their - // descriptions as otherwise it's pretty confusing to the user - wxFileData *fd = new wxFileData(paths[n], paths[n], - wxFileData::is_drive, icons[n]); - if (Add(fd, item) != -1) - item.m_itemId++; - else - delete fd; - } - } - else -#endif // defined(__DOS__) || defined(__WINDOWS__) - { - // Real directory... - if ( !IsTopMostDir(m_dirName) && !m_dirName.empty() ) - { - wxString p(wxPathOnly(m_dirName)); -#if (defined(__UNIX__) || defined(__WXWINCE__)) && !defined(__OS2__) - if (p.empty()) p = wxT("/"); -#endif // __UNIX__ - wxFileData *fd = new wxFileData(p, wxT(".."), wxFileData::is_dir, wxFileIconsTable::folder); - if (Add(fd, item) != -1) - item.m_itemId++; - else - delete fd; - } - - wxString dirname(m_dirName); -#if defined(__DOS__) || defined(__WINDOWS__) || defined(__OS2__) - if (dirname.length() == 2 && dirname[1u] == wxT(':')) - dirname << wxT('\\'); -#endif // defined(__DOS__) || defined(__WINDOWS__) || defined(__OS2__) - - if (dirname.empty()) - dirname = wxFILE_SEP_PATH; - - wxLogNull logNull; - wxDir dir(dirname); - - if ( dir.IsOpened() ) - { - wxString dirPrefix(dirname); - if (dirPrefix.Last() != wxFILE_SEP_PATH) - dirPrefix += wxFILE_SEP_PATH; - - int hiddenFlag = m_showHidden ? wxDIR_HIDDEN : 0; - - bool cont; - wxString f; - - // Get the directories first (not matched against wildcards): - cont = dir.GetFirst(&f, wxEmptyString, wxDIR_DIRS | hiddenFlag); - while (cont) - { - wxFileData *fd = new wxFileData(dirPrefix + f, f, wxFileData::is_dir, wxFileIconsTable::folder); - if (Add(fd, item) != -1) - item.m_itemId++; - else - delete fd; - - cont = dir.GetNext(&f); - } - - // Tokenize the wildcard string, so we can handle more than 1 - // search pattern in a wildcard. - wxStringTokenizer tokenWild(m_wild, wxT(";")); - while ( tokenWild.HasMoreTokens() ) - { - cont = dir.GetFirst(&f, tokenWild.GetNextToken(), - wxDIR_FILES | hiddenFlag); - while (cont) - { - wxFileData *fd = new wxFileData(dirPrefix + f, f, wxFileData::is_file, wxFileIconsTable::file); - if (Add(fd, item) != -1) - item.m_itemId++; - else - delete fd; - - cont = dir.GetNext(&f); - } - } - } - } - - SortItems(m_sort_field, m_sort_forward); -} - -void wxFileListCtrl::SetWild( const wxString &wild ) -{ - if (wild.Find(wxT('|')) != wxNOT_FOUND) - return; - - m_wild = wild; - UpdateFiles(); -} - -void wxFileListCtrl::MakeDir() -{ - wxString new_name( _("NewName") ); - wxString path( m_dirName ); - path += wxFILE_SEP_PATH; - path += new_name; - if (wxFileExists(path)) - { - // try NewName0, NewName1 etc. - int i = 0; - do { - new_name = _("NewName"); - wxString num; - num.Printf( wxT("%d"), i ); - new_name += num; - - path = m_dirName; - path += wxFILE_SEP_PATH; - path += new_name; - i++; - } while (wxFileExists(path)); - } - - wxLogNull log; - if (!wxMkdir(path)) - { - wxMessageDialog dialog(this, _("Operation not permitted."), _("Error"), wxOK | wxICON_ERROR ); - dialog.ShowModal(); - return; - } - - wxFileData *fd = new wxFileData( path, new_name, wxFileData::is_dir, wxFileIconsTable::folder ); - wxListItem item; - item.m_itemId = 0; - item.m_col = 0; - long itemid = Add( fd, item ); - - if (itemid != -1) - { - SortItems(m_sort_field, m_sort_forward); - itemid = FindItem( 0, wxPtrToUInt(fd) ); - EnsureVisible( itemid ); - EditLabel( itemid ); - } - else - delete fd; -} - -void wxFileListCtrl::GoToParentDir() -{ - if (!IsTopMostDir(m_dirName)) - { - size_t len = m_dirName.length(); - if (wxEndsWithPathSeparator(m_dirName)) - m_dirName.Remove( len-1, 1 ); - wxString fname( wxFileNameFromPath(m_dirName) ); - m_dirName = wxPathOnly( m_dirName ); -#if defined(__DOS__) || defined(__WINDOWS__) || defined(__OS2__) - if (!m_dirName.empty()) - { - if (m_dirName.Last() == wxT('.')) - m_dirName = wxEmptyString; - } -#elif defined(__UNIX__) - if (m_dirName.empty()) - m_dirName = wxT("/"); -#endif - UpdateFiles(); - long id = FindItem( 0, fname ); - if (id != wxNOT_FOUND) - { - SetItemState( id, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED ); - EnsureVisible( id ); - } - } -} - -void wxFileListCtrl::GoToHomeDir() -{ - wxString s = wxGetUserHome( wxString() ); - GoToDir(s); -} - -void wxFileListCtrl::GoToDir( const wxString &dir ) -{ - if (!wxDirExists(dir)) return; - - m_dirName = dir; - UpdateFiles(); - - SetItemState( 0, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED ); - - EnsureVisible( 0 ); -} - -void wxFileListCtrl::FreeItemData(wxListItem& item) -{ - if ( item.m_data ) - { - wxFileData *fd = (wxFileData*)item.m_data; - delete fd; - - item.m_data = 0; - } -} - -void wxFileListCtrl::OnListDeleteItem( wxListEvent &event ) -{ - FreeItemData(event.m_item); -} - -void wxFileListCtrl::OnListDeleteAllItems( wxListEvent & WXUNUSED(event) ) -{ - FreeAllItemsData(); -} - -void wxFileListCtrl::FreeAllItemsData() -{ - wxListItem item; - item.m_mask = wxLIST_MASK_DATA; - - item.m_itemId = GetNextItem( -1, wxLIST_NEXT_ALL ); - while ( item.m_itemId != -1 ) - { - GetItem( item ); - FreeItemData(item); - item.m_itemId = GetNextItem( item.m_itemId, wxLIST_NEXT_ALL ); - } -} - -void wxFileListCtrl::OnListEndLabelEdit( wxListEvent &event ) -{ - wxFileData *fd = (wxFileData*)event.m_item.m_data; - wxASSERT( fd ); - - if ((event.GetLabel().empty()) || - (event.GetLabel() == wxT(".")) || - (event.GetLabel() == wxT("..")) || - (event.GetLabel().First( wxFILE_SEP_PATH ) != wxNOT_FOUND)) - { - wxMessageDialog dialog(this, _("Illegal directory name."), _("Error"), wxOK | wxICON_ERROR ); - dialog.ShowModal(); - event.Veto(); - return; - } - - wxString new_name( wxPathOnly( fd->GetFilePath() ) ); - new_name += wxFILE_SEP_PATH; - new_name += event.GetLabel(); - - wxLogNull log; - - if (wxFileExists(new_name)) - { - wxMessageDialog dialog(this, _("File name exists already."), _("Error"), wxOK | wxICON_ERROR ); - dialog.ShowModal(); - event.Veto(); - } - - if (wxRenameFile(fd->GetFilePath(),new_name)) - { - fd->SetNewName( new_name, event.GetLabel() ); - - SetItemState( event.GetItem(), wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED ); - - UpdateItem( event.GetItem() ); - EnsureVisible( event.GetItem() ); - } - else - { - wxMessageDialog dialog(this, _("Operation not permitted."), _("Error"), wxOK | wxICON_ERROR ); - dialog.ShowModal(); - event.Veto(); - } -} - -void wxFileListCtrl::OnListColClick( wxListEvent &event ) -{ - int col = event.GetColumn(); - - switch (col) - { - case wxFileData::FileList_Name : - case wxFileData::FileList_Size : - case wxFileData::FileList_Type : - case wxFileData::FileList_Time : break; - default : return; - } - - if ((wxFileData::fileListFieldType)col == m_sort_field) - m_sort_forward = !m_sort_forward; - else - m_sort_field = (wxFileData::fileListFieldType)col; - - SortItems(m_sort_field, m_sort_forward); -} - -void wxFileListCtrl::SortItems(wxFileData::fileListFieldType field, bool forward) -{ - m_sort_field = field; - m_sort_forward = forward; - const long sort_dir = forward ? 1 : -1; - - switch (m_sort_field) - { - case wxFileData::FileList_Size : - wxListCtrl::SortItems(wxFileDataSizeCompare, sort_dir); - break; - - case wxFileData::FileList_Type : - wxListCtrl::SortItems(wxFileDataTypeCompare, sort_dir); - break; - - case wxFileData::FileList_Time : - wxListCtrl::SortItems(wxFileDataTimeCompare, sort_dir); - break; - - case wxFileData::FileList_Name : - default : - wxListCtrl::SortItems(wxFileDataNameCompare, sort_dir); - break; - } -} - -wxFileListCtrl::~wxFileListCtrl() -{ - // Normally the data are freed via an EVT_LIST_DELETE_ALL_ITEMS event and - // wxFileListCtrl::OnListDeleteAllItems. But if the event is generated after - // the destruction of the wxFileListCtrl we need to free any data here: - FreeAllItemsData(); -} - -#define ID_CHOICE (wxID_FILECTRL + 1) -#define ID_TEXT (wxID_FILECTRL + 2) -#define ID_FILELIST_CTRL (wxID_FILECTRL + 3) -#define ID_CHECK (wxID_FILECTRL + 4) - -/////////////////////////////////////////////////////////////////////////////// -// wxGenericFileCtrl implementation -/////////////////////////////////////////////////////////////////////////////// - -IMPLEMENT_DYNAMIC_CLASS( wxGenericFileCtrl, wxNavigationEnabled ) - -BEGIN_EVENT_TABLE( wxGenericFileCtrl, wxNavigationEnabled ) - EVT_LIST_ITEM_SELECTED( ID_FILELIST_CTRL, wxGenericFileCtrl::OnSelected ) - EVT_LIST_ITEM_ACTIVATED( ID_FILELIST_CTRL, wxGenericFileCtrl::OnActivated ) - EVT_CHOICE( ID_CHOICE, wxGenericFileCtrl::OnChoiceFilter ) - EVT_TEXT_ENTER( ID_TEXT, wxGenericFileCtrl::OnTextEnter ) - EVT_TEXT( ID_TEXT, wxGenericFileCtrl::OnTextChange ) - EVT_CHECKBOX( ID_CHECK, wxGenericFileCtrl::OnCheck ) -END_EVENT_TABLE() - -bool wxGenericFileCtrl::Create( wxWindow *parent, - wxWindowID id, - const wxString& defaultDirectory, - const wxString& defaultFileName, - const wxString& wildCard, - long style, - const wxPoint& pos, - const wxSize& size, - const wxString& name ) -{ - this->m_style = style; - m_inSelected = false; - m_noSelChgEvent = false; - m_check = NULL; - - // check that the styles are not contradictory - wxASSERT_MSG( !( ( m_style & wxFC_SAVE ) && ( m_style & wxFC_OPEN ) ), - wxT( "can't specify both wxFC_SAVE and wxFC_OPEN at once" ) ); - - wxASSERT_MSG( !( ( m_style & wxFC_SAVE ) && ( m_style & wxFC_MULTIPLE ) ), - wxT( "wxFC_MULTIPLE can't be used with wxFC_SAVE" ) ); - - wxNavigationEnabled::Create( parent, id, - pos, size, - wxTAB_TRAVERSAL, - wxDefaultValidator, - name ); - - m_dir = defaultDirectory; - - m_ignoreChanges = true; - - if ( ( m_dir.empty() ) || ( m_dir == wxT( "." ) ) ) - { - m_dir = wxGetCwd(); - if ( m_dir.empty() ) - m_dir = wxFILE_SEP_PATH; - } - - const size_t len = m_dir.length(); - if ( ( len > 1 ) && ( wxEndsWithPathSeparator( m_dir ) ) ) - m_dir.Remove( len - 1, 1 ); - - m_filterExtension = wxEmptyString; - - // layout - - const bool is_pda = ( wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA ); - - wxBoxSizer *mainsizer = new wxBoxSizer( wxVERTICAL ); - - wxBoxSizer *staticsizer = new wxBoxSizer( wxHORIZONTAL ); - if ( is_pda ) - staticsizer->Add( new wxStaticText( this, wxID_ANY, _( "Current directory:" ) ), - wxSizerFlags().DoubleBorder(wxRIGHT) ); - m_static = new wxStaticText( this, wxID_ANY, m_dir ); - staticsizer->Add( m_static, 1 ); - mainsizer->Add( staticsizer, wxSizerFlags().Expand().Border()); - - long style2 = wxLC_LIST; - if ( !( m_style & wxFC_MULTIPLE ) ) - style2 |= wxLC_SINGLE_SEL; - -#ifdef __WXWINCE__ - style2 |= wxSIMPLE_BORDER; -#else - style2 |= wxSUNKEN_BORDER; -#endif - - m_list = new wxFileListCtrl( this, ID_FILELIST_CTRL, - wxEmptyString, false, - wxDefaultPosition, wxSize( 400, 140 ), - style2 ); - - m_text = new wxTextCtrl( this, ID_TEXT, wxEmptyString, - wxDefaultPosition, wxDefaultSize, - wxTE_PROCESS_ENTER ); - m_choice = new wxChoice( this, ID_CHOICE ); - - if ( is_pda ) - { - // PDAs have a different screen layout - mainsizer->Add( m_list, wxSizerFlags( 1 ).Expand().HorzBorder() ); - - wxBoxSizer *textsizer = new wxBoxSizer( wxHORIZONTAL ); - textsizer->Add( m_text, wxSizerFlags( 1 ).Centre().Border() ); - textsizer->Add( m_choice, wxSizerFlags( 1 ).Centre().Border() ); - mainsizer->Add( textsizer, wxSizerFlags().Expand() ); - - } - else // !is_pda - { - mainsizer->Add( m_list, wxSizerFlags( 1 ).Expand().Border() ); - mainsizer->Add( m_text, wxSizerFlags().Expand().Border() ); - - wxBoxSizer *choicesizer = new wxBoxSizer( wxHORIZONTAL ); - choicesizer->Add( m_choice, wxSizerFlags( 1 ).Centre() ); - - if ( !( m_style & wxFC_NOSHOWHIDDEN ) ) - { - m_check = new wxCheckBox( this, ID_CHECK, _( "Show &hidden files" ) ); - choicesizer->Add( m_check, wxSizerFlags().Centre().DoubleBorder(wxLEFT) ); - } - - mainsizer->Add( choicesizer, wxSizerFlags().Expand().Border() ); - } - - SetWildcard( wildCard ); - - SetAutoLayout( true ); - SetSizer( mainsizer ); - - if ( !is_pda ) - { - mainsizer->Fit( this ); - } - - m_list->GoToDir( m_dir ); - UpdateControls(); - m_text->SetValue( m_fileName ); - - m_ignoreChanges = false; - - // must be after m_ignoreChanges = false - SetFilename( defaultFileName ); - - return true; -} - -// NB: there is an unfortunate mismatch between wxFileName and wxFileDialog -// method names but our GetDirectory() does correspond to wxFileName:: -// GetPath() while our GetPath() is wxFileName::GetFullPath() -wxString wxGenericFileCtrl::GetPath() const -{ - wxASSERT_MSG ( !(m_style & wxFC_MULTIPLE), "use GetPaths() instead" ); - - return DoGetFileName().GetFullPath(); -} - -wxString wxGenericFileCtrl::GetFilename() const -{ - wxASSERT_MSG ( !(m_style & wxFC_MULTIPLE), "use GetFilenames() instead" ); - - return DoGetFileName().GetFullName(); -} - -wxString wxGenericFileCtrl::GetDirectory() const -{ - // don't check for wxFC_MULTIPLE here, this one is probably safe to call in - // any case as it can be always taken to mean "current directory" - return DoGetFileName().GetPath(); -} - -wxFileName wxGenericFileCtrl::DoGetFileName() const -{ - wxFileName fn; - - wxString value = m_text->GetValue(); - if ( value.empty() ) - { - // nothing in the text control, get the selected file from the list - wxListItem item; - item.m_itemId = m_list->GetNextItem(-1, wxLIST_NEXT_ALL, - wxLIST_STATE_SELECTED); - m_list->GetItem(item); - - fn.Assign(m_list->GetDir(), item.m_text); - } - else // user entered the value - { - // the path can be either absolute or relative - fn.Assign(value); - if ( fn.IsRelative() ) - fn.MakeAbsolute(m_list->GetDir()); - } - - return fn; -} - -// helper used in DoGetFilenames() and needed because Borland can't compile -// operator?: inline -static inline wxString GetFileNameOrPath(const wxFileName& fn, bool fullPath) -{ - return fullPath ? fn.GetFullPath() : fn.GetFullName(); -} - -void -wxGenericFileCtrl::DoGetFilenames(wxArrayString& filenames, bool fullPath) const -{ - filenames.clear(); - - const wxString dir = m_list->GetDir(); - - const wxString value = m_text->GetValue(); - if ( !value.empty() ) - { - wxFileName fn(value); - if ( fn.IsRelative() ) - fn.MakeAbsolute(dir); - - filenames.push_back(GetFileNameOrPath(fn, fullPath)); - return; - } - - const int numSel = m_list->GetSelectedItemCount(); - if ( !numSel ) - return; - - filenames.reserve(numSel); - - wxListItem item; - item.m_mask = wxLIST_MASK_TEXT; - item.m_itemId = -1; - for ( ;; ) - { - item.m_itemId = m_list->GetNextItem(item.m_itemId, wxLIST_NEXT_ALL, - wxLIST_STATE_SELECTED); - - if ( item.m_itemId == -1 ) - break; - - m_list->GetItem(item); - - const wxFileName fn(dir, item.m_text); - filenames.push_back(GetFileNameOrPath(fn, fullPath)); - } -} - -bool wxGenericFileCtrl::SetDirectory( const wxString& dir ) -{ - m_ignoreChanges = true; - m_list->GoToDir( dir ); - UpdateControls(); - m_ignoreChanges = false; - - return wxFileName( dir ).SameAs( m_list->GetDir() ); -} - -bool wxGenericFileCtrl::SetFilename( const wxString& name ) -{ - const long item = m_list->FindItem( -1, name ); - - if ( item == -1 ) // file not found either because it doesn't exist or the - // current filter doesn't show it. - return false; - - m_noSelChgEvent = true; - - // Deselect selected items - { - const int numSelectedItems = m_list->GetSelectedItemCount(); - - if ( numSelectedItems > 0 ) - { - long itemIndex = -1; - - for ( ;; ) - { - itemIndex = m_list->GetNextItem( itemIndex, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED ); - if ( itemIndex == -1 ) - break; - - m_list->SetItemState( itemIndex, 0, wxLIST_STATE_SELECTED ); - } - } - } - - m_list->SetItemState( item, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED ); - m_list->EnsureVisible( item ); - - m_noSelChgEvent = false; - - return true; -} - -void wxGenericFileCtrl::DoSetFilterIndex( int filterindex ) -{ - wxClientData *pcd = m_choice->GetClientObject( filterindex ); - if ( !pcd ) - return; - - const wxString& str = ((static_cast(pcd))->GetData()); - m_list->SetWild( str ); - m_filterIndex = filterindex; - if ( str.Left( 2 ) == wxT( "*." ) ) - { - m_filterExtension = str.Mid( 1 ); - if ( m_filterExtension == wxT( ".*" ) ) - m_filterExtension.clear(); - } - else - { - m_filterExtension.clear(); - } - - GenerateFilterChangedEvent( this, this ); -} - -void wxGenericFileCtrl::SetWildcard( const wxString& wildCard ) -{ - if ( wildCard.empty() || wildCard == wxFileSelectorDefaultWildcardStr ) - { - m_wildCard = wxString::Format( _( "All files (%s)|%s" ), - wxFileSelectorDefaultWildcardStr, - wxFileSelectorDefaultWildcardStr ); - } - else - m_wildCard = wildCard; - - wxArrayString wildDescriptions, wildFilters; - const size_t count = wxParseCommonDialogsFilter( m_wildCard, - wildDescriptions, - wildFilters ); - wxCHECK_RET( count, wxT( "wxFileDialog: bad wildcard string" ) ); - - m_choice->Clear(); - - for ( size_t n = 0; n < count; n++ ) - { - m_choice->Append(wildDescriptions[n], new wxStringClientData(wildFilters[n])); - } - - SetFilterIndex( 0 ); -} - -void wxGenericFileCtrl::SetFilterIndex( int filterindex ) -{ - m_choice->SetSelection( filterindex ); - - DoSetFilterIndex( filterindex ); -} - -void wxGenericFileCtrl::OnChoiceFilter( wxCommandEvent &event ) -{ - DoSetFilterIndex( ( int )event.GetInt() ); -} - -void wxGenericFileCtrl::OnCheck( wxCommandEvent &event ) -{ - m_list->ShowHidden( event.GetInt() != 0 ); -} - -void wxGenericFileCtrl::OnActivated( wxListEvent &event ) -{ - HandleAction( event.m_item.m_text ); -} - -void wxGenericFileCtrl::OnTextEnter( wxCommandEvent &WXUNUSED( event ) ) -{ - HandleAction( m_text->GetValue() ); -} - -void wxGenericFileCtrl::OnTextChange( wxCommandEvent &WXUNUSED( event ) ) -{ - if ( !m_ignoreChanges ) - { - // Clear selections. Otherwise when the user types in a value they may - // not get the file whose name they typed. - if ( m_list->GetSelectedItemCount() > 0 ) - { - long item = m_list->GetNextItem( -1, wxLIST_NEXT_ALL, - wxLIST_STATE_SELECTED ); - while ( item != -1 ) - { - m_list->SetItemState( item, 0, wxLIST_STATE_SELECTED ); - item = m_list->GetNextItem( item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED ); - } - } - } -} - -void wxGenericFileCtrl::OnSelected( wxListEvent &event ) -{ - if ( m_ignoreChanges ) - return; - - if ( m_inSelected ) - return; - - m_inSelected = true; - const wxString filename( event.m_item.m_text ); - -#ifdef __WXWINCE__ - // No double-click on most WinCE devices, so do action immediately. - HandleAction( filename ); -#else - if ( filename == wxT( ".." ) ) - { - m_inSelected = false; - return; - } - - wxString dir = m_list->GetDir(); - if ( !IsTopMostDir( dir ) ) - dir += wxFILE_SEP_PATH; - dir += filename; - if ( wxDirExists( dir ) ) - { - m_inSelected = false; - - return; - } - - - m_ignoreChanges = true; - m_text->SetValue( filename ); - - if ( m_list->GetSelectedItemCount() > 1 ) - { - m_text->Clear(); - } - - if ( !m_noSelChgEvent ) - GenerateSelectionChangedEvent( this, this ); - - m_ignoreChanges = false; -#endif - m_inSelected = false; -} - -void wxGenericFileCtrl::HandleAction( const wxString &fn ) -{ - if ( m_ignoreChanges ) - return; - - wxString filename( fn ); - if ( filename.empty() ) - { - return; - } - if ( filename == wxT( "." ) ) return; - - wxString dir = m_list->GetDir(); - - // "some/place/" means they want to chdir not try to load "place" - const bool want_dir = filename.Last() == wxFILE_SEP_PATH; - if ( want_dir ) - filename = filename.RemoveLast(); - - if ( filename == wxT( ".." ) ) - { - m_ignoreChanges = true; - m_list->GoToParentDir(); - - GenerateFolderChangedEvent( this, this ); - - UpdateControls(); - m_ignoreChanges = false; - return; - } - -#ifdef __UNIX__ - if ( filename == wxT( "~" ) ) - { - m_ignoreChanges = true; - m_list->GoToHomeDir(); - - GenerateFolderChangedEvent( this, this ); - - UpdateControls(); - m_ignoreChanges = false; - return; - } - - if ( filename.BeforeFirst( wxT( '/' ) ) == wxT( "~" ) ) - { - filename = wxString( wxGetUserHome() ) + filename.Remove( 0, 1 ); - } -#endif // __UNIX__ - - if ( !( m_style & wxFC_SAVE ) ) - { - if ( ( filename.Find( wxT( '*' ) ) != wxNOT_FOUND ) || - ( filename.Find( wxT( '?' ) ) != wxNOT_FOUND ) ) - { - if ( filename.Find( wxFILE_SEP_PATH ) != wxNOT_FOUND ) - { - wxMessageBox( _( "Illegal file specification." ), - _( "Error" ), wxOK | wxICON_ERROR, this ); - return; - } - m_list->SetWild( filename ); - return; - } - } - - if ( !IsTopMostDir( dir ) ) - dir += wxFILE_SEP_PATH; - if ( !wxIsAbsolutePath( filename ) ) - { - dir += filename; - filename = dir; - } - - if ( wxDirExists( filename ) ) - { - m_ignoreChanges = true; - m_list->GoToDir( filename ); - UpdateControls(); - - GenerateFolderChangedEvent( this, this ); - - m_ignoreChanges = false; - return; - } - - // they really wanted a dir, but it doesn't exist - if ( want_dir ) - { - wxMessageBox( _( "Directory doesn't exist." ), _( "Error" ), - wxOK | wxICON_ERROR, this ); - return; - } - - // append the default extension to the filename if it doesn't have any - // - // VZ: the logic of testing for !wxFileExists() only for the open file - // dialog is not entirely clear to me, why don't we allow saving to a - // file without extension as well? - if ( !( m_style & wxFC_OPEN ) || !wxFileExists( filename ) ) - { - filename = wxFileDialogBase::AppendExtension( filename, m_filterExtension ); - GenerateFileActivatedEvent( this, this, wxFileName( filename ).GetFullName() ); - return; - } - - GenerateFileActivatedEvent( this, this ); -} - -bool wxGenericFileCtrl::SetPath( const wxString& path ) -{ - if ( !wxFileName::FileExists( ( path ) ) ) - return false; - - wxString ext; - wxFileName::SplitPath( path, &m_dir, &m_fileName, &ext ); - if ( !ext.empty() ) - { - m_fileName += wxT( "." ); - m_fileName += ext; - } - - SetDirectory( m_dir ); - SetFilename( m_fileName ); - - return true; -} - -void wxGenericFileCtrl::GetPaths( wxArrayString& paths ) const -{ - DoGetFilenames( paths, true ); -} - -void wxGenericFileCtrl::GetFilenames( wxArrayString& files ) const -{ - DoGetFilenames( files, false ); -} - -void wxGenericFileCtrl::UpdateControls() -{ - const wxString dir = m_list->GetDir(); - m_static->SetLabel( dir ); -} - -void wxGenericFileCtrl::GoToParentDir() -{ - m_list->GoToParentDir(); - UpdateControls(); -} - -void wxGenericFileCtrl::GoToHomeDir() -{ - m_list->GoToHomeDir(); - UpdateControls(); -} - -#endif // wxUSE_FILECTRL diff --git a/Source/3rd Party/wx/src/generic/filepickerg.cpp b/Source/3rd Party/wx/src/generic/filepickerg.cpp index 3779dc4ff..96eb79916 100644 --- a/Source/3rd Party/wx/src/generic/filepickerg.cpp +++ b/Source/3rd Party/wx/src/generic/filepickerg.cpp @@ -4,7 +4,7 @@ // Author: Francesco Montorsi // Modified by: // Created: 15/04/2006 -// RCS-ID: $Id$ +// RCS-ID: $Id: filepickerg.cpp 52835 2008-03-26 15:49:08Z JS $ // Copyright: (c) Francesco Montorsi // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -26,11 +26,8 @@ #if wxUSE_FILEPICKERCTRL || wxUSE_DIRPICKERCTRL -#include "wx/filename.h" #include "wx/filepicker.h" -#include "wx/scopedptr.h" - // ============================================================================ // implementation @@ -43,38 +40,15 @@ IMPLEMENT_DYNAMIC_CLASS(wxGenericDirButton, wxButton) // wxGenericFileButton // ---------------------------------------------------------------------------- -bool wxGenericFileDirButton::Create(wxWindow *parent, - wxWindowID id, - const wxString& label, - const wxString& path, - const wxString& message, - const wxString& wildcard, - const wxPoint& pos, - const wxSize& size, - long style, - const wxValidator& validator, - const wxString& name) +bool wxGenericFileDirButton::Create( wxWindow *parent, wxWindowID id, + const wxString &label, const wxString &path, + const wxString &message, const wxString &wildcard, + const wxPoint &pos, const wxSize &size, long style, + const wxValidator& validator, const wxString &name) { - m_pickerStyle = style; - - // If the special wxPB_SMALL flag is used, ignore the provided label and - // use the shortest possible label and the smallest possible button fitting - // it. - long styleButton = 0; - wxString labelButton; - if ( m_pickerStyle & wxPB_SMALL ) - { - labelButton = _("..."); - styleButton = wxBU_EXACTFIT; - } - else - { - labelButton = label; - } - // create this button - if ( !wxButton::Create(parent, id, labelButton, - pos, size, styleButton, validator, name) ) + if (!wxButton::Create(parent, id, label, pos, size, style, + validator, name)) { wxFAIL_MSG( wxT("wxGenericFileButton creation failed") ); return false; @@ -95,80 +69,18 @@ bool wxGenericFileDirButton::Create(wxWindow *parent, void wxGenericFileDirButton::OnButtonClick(wxCommandEvent& WXUNUSED(ev)) { - wxScopedPtr p(CreateDialog()); + wxDialog *p = CreateDialog(); if (p->ShowModal() == wxID_OK) { // save updated path in m_path - UpdatePathFromDialog(p.get()); + UpdatePathFromDialog(p); // fire an event wxFileDirPickerEvent event(GetEventType(), this, GetId(), m_path); GetEventHandler()->ProcessEvent(event); } -} -void wxGenericFileDirButton::SetInitialDirectory(const wxString& dir) -{ - m_initialDir = dir; -} - -// ---------------------------------------------------------------------------- -// wxGenericFileutton -// ---------------------------------------------------------------------------- - -void -wxGenericFileButton::DoSetInitialDirectory(wxFileDialog* dialog, - const wxString& dir) -{ - if ( m_path.find_first_of(wxFileName::GetPathSeparators()) == - wxString::npos ) - { - dialog->SetDirectory(dir); - } -} - -wxDialog *wxGenericFileButton::CreateDialog() -{ - wxFileDialog* const dialog = new wxFileDialog - ( - GetDialogParent(), - m_message, - wxEmptyString, - wxEmptyString, - m_wildcard, - GetDialogStyle() - ); - - // If there is no default file or if it doesn't have any path, use the - // explicitly set initial directory. - // - // Notice that it is important to call this before SetPath() below as if we - // do have m_initialDir and no directory in m_path, we need to interpret - // the path as being relative with respect to m_initialDir. - if ( !m_initialDir.empty() ) - DoSetInitialDirectory(dialog, m_initialDir); - - // This sets both the default file name and the default directory of the - // dialog if m_path contains directory part. - dialog->SetPath(m_path); - - return dialog; -} - -// ---------------------------------------------------------------------------- -// wxGenericDirButton -// ---------------------------------------------------------------------------- - -wxDialog *wxGenericDirButton::CreateDialog() -{ - wxDirDialog* const dialog = new wxDirDialog - ( - GetDialogParent(), - m_message, - m_path.empty() ? m_initialDir : m_path, - GetDialogStyle() - ); - return dialog; + wxDELETE(p); } #endif // wxUSE_FILEPICKERCTRL || wxUSE_DIRPICKERCTRL diff --git a/Source/3rd Party/wx/src/generic/fontpickerg.cpp b/Source/3rd Party/wx/src/generic/fontpickerg.cpp index d26865af1..e01bcd544 100644 --- a/Source/3rd Party/wx/src/generic/fontpickerg.cpp +++ b/Source/3rd Party/wx/src/generic/fontpickerg.cpp @@ -4,7 +4,7 @@ // Author: Francesco Montorsi // Modified by: // Created: 15/04/2006 -// RCS-ID: $Id$ +// RCS-ID: $Id: fontpickerg.cpp 52835 2008-03-26 15:49:08Z JS $ // Copyright: (c) Francesco Montorsi // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -35,6 +35,7 @@ // implementation // ============================================================================ +wxFontData wxGenericFontButton::ms_data; IMPLEMENT_DYNAMIC_CLASS(wxGenericFontButton, wxButton) // ---------------------------------------------------------------------------- @@ -47,8 +48,8 @@ bool wxGenericFontButton::Create( wxWindow *parent, wxWindowID id, const wxValidator& validator, const wxString &name) { wxString label = (style & wxFNTP_FONTDESC_AS_LABEL) ? - wxString() : // label will be updated by UpdateFont - _("Choose font"); + wxEmptyString : // label will be updated by UpdateFont + wxT("Choose font"); // create this button if (!wxButton::Create( parent, id, label, pos, @@ -72,22 +73,22 @@ bool wxGenericFontButton::Create( wxWindow *parent, wxWindowID id, void wxGenericFontButton::InitFontData() { - m_data.SetAllowSymbols(true); - m_data.SetColour(*wxBLACK); - m_data.EnableEffects(true); + ms_data.SetAllowSymbols(true); + ms_data.SetColour(*wxBLACK); + ms_data.EnableEffects(true); } void wxGenericFontButton::OnButtonClick(wxCommandEvent& WXUNUSED(ev)) { - // update the wxFontData to be shown in the dialog - m_data.SetInitialFont(m_selectedFont); + // update the wxFontData to be shown in the the dialog + ms_data.SetInitialFont(m_selectedFont); // create the font dialog and display it - wxFontDialog dlg(this, m_data); + wxFontDialog dlg(this, ms_data); if (dlg.ShowModal() == wxID_OK) { - m_data = dlg.GetFontData(); - SetSelectedFont(m_data.GetChosenFont()); + ms_data = dlg.GetFontData(); + SetSelectedFont(ms_data.GetChosenFont()); // fire an event wxFontPickerEvent event(this, GetId(), m_selectedFont); @@ -97,10 +98,10 @@ void wxGenericFontButton::OnButtonClick(wxCommandEvent& WXUNUSED(ev)) void wxGenericFontButton::UpdateFont() { - if ( !m_selectedFont.IsOk() ) + if ( !m_selectedFont.Ok() ) return; - SetForegroundColour(m_data.GetColour()); + SetForegroundColour(ms_data.GetColour()); if (HasFlag(wxFNTP_USEFONT_FOR_LABEL)) { diff --git a/Source/3rd Party/wx/src/generic/fswatcherg.cpp b/Source/3rd Party/wx/src/generic/fswatcherg.cpp deleted file mode 100644 index 91c4fe9fe..000000000 --- a/Source/3rd Party/wx/src/generic/fswatcherg.cpp +++ /dev/null @@ -1,22 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/generic/fswatcherg.cpp -// Purpose: wxPollingFileSystemWatcher -// Author: Bartosz Bekier -// Created: 2009-05-26 -// RCS-ID: $Id$ -// Copyright: (c) 2009 Bartosz Bekier -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_FSWATCHER - -#include "wx/fswatcher.h" - -#endif // wxUSE_FSWATCHER diff --git a/Source/3rd Party/wx/src/generic/graphicc.cpp b/Source/3rd Party/wx/src/generic/graphicc.cpp index 71c31814b..75744b086 100644 --- a/Source/3rd Party/wx/src/generic/graphicc.cpp +++ b/Source/3rd Party/wx/src/generic/graphicc.cpp @@ -4,7 +4,7 @@ // Author: Stefan Csomor // Modified by: // Created: 2006-10-03 -// RCS-ID: $Id$ +// RCS-ID: $Id: graphicc.cpp 66928 2011-02-16 23:31:13Z JS $ // Copyright: (c) 2006 Stefan Csomor // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -12,35 +12,62 @@ #include "wx/wxprec.h" #ifdef __BORLANDC__ - #pragma hdrstop +#pragma hdrstop #endif #if wxUSE_GRAPHICS_CONTEXT +#ifndef WX_PRECOMP +#include "wx/image.h" +#include "wx/window.h" +#include "wx/dc.h" +#include "wx/utils.h" +#include "wx/dialog.h" +#include "wx/app.h" +#include "wx/bitmap.h" +#include "wx/dcmemory.h" +#include "wx/log.h" +#include "wx/icon.h" +#include "wx/dcprint.h" +#include "wx/module.h" +#endif + +#ifdef __WXGTK__ +#include "wx/gtk/win_gtk.h" +#endif + #include "wx/graphics.h" +#include "wx/rawbmp.h" #if wxUSE_CAIRO -// keep cairo.h from defining dllimport as we're defining the symbols inside -// the wx dll in order to load them dynamically. -#define cairo_public +//----------------------------------------------------------------------------- +// constants +//----------------------------------------------------------------------------- -#include "wx/cairo.h" +const double RAD2DEG = 180.0 / M_PI; -#ifndef WX_PRECOMP - #include "wx/bitmap.h" - #include "wx/icon.h" - #include "wx/dcclient.h" - #include "wx/dcmemory.h" - #include "wx/dcprint.h" - #include "wx/window.h" -#endif +//----------------------------------------------------------------------------- +// Local functions +//----------------------------------------------------------------------------- -#include "wx/private/graphics.h" -#include "wx/rawbmp.h" -#include "wx/vector.h" +static inline double dmin(double a, double b) +{ + return a < b ? a : b; +} +static inline double dmax(double a, double b) +{ + return a > b ? a : b; +} -using namespace std; +static inline double DegToRad(double deg) +{ + return (deg * M_PI) / 180.0; +} +static inline double RadToDeg(double deg) +{ + return (deg * 180.0) / M_PI; +} //----------------------------------------------------------------------------- // device context implementation @@ -71,24 +98,10 @@ using namespace std; #include #ifdef __WXMSW__ #include -// Notice that the order is important: cairo-win32.h includes windows.h which -// pollutes the global name space with macros so include our own header which -// #undefines them after it. -#include "wx/msw/private.h" #endif #ifdef __WXGTK__ #include -#include "wx/fontutil.h" -#ifndef __WXGTK3__ -#include "wx/gtk/dc.h" -#endif -#endif - -#ifdef __WXMAC__ -#include "wx/osx/private.h" -#include -#include #endif class WXDLLIMPEXP_CORE wxCairoPathData : public wxGraphicsPathData @@ -132,7 +145,7 @@ public : /* - // appends a rectangle as a new closed subpath + // appends a rectangle as a new closed subpath virtual void AddRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h ) ; // appends an ellipsis as a new closed subpath fitting the passed rectangle virtual void AddEllipsis( wxDouble x, wxDouble y, wxDouble w , wxDouble h ) ; @@ -153,7 +166,7 @@ public : // gets the bounding box enclosing all points (possibly including control points) virtual void GetBox(wxDouble *x, wxDouble *y, wxDouble *w, wxDouble *h) const; - virtual bool Contains( wxDouble x, wxDouble y, wxPolygonFillMode fillStyle = wxWINDING_RULE) const; + virtual bool Contains( wxDouble x, wxDouble y, int fillStyle = wxWINDING_RULE) const; private : cairo_t* m_pathContext; @@ -171,13 +184,13 @@ public : virtual void Concat( const wxGraphicsMatrixData *t ); // sets the matrix to the respective values - virtual void Set(wxDouble a=1.0, wxDouble b=0.0, wxDouble c=0.0, wxDouble d=1.0, + virtual void Set(wxDouble a=1.0, wxDouble b=0.0, wxDouble c=0.0, wxDouble d=1.0, wxDouble tx=0.0, wxDouble ty=0.0); // gets the component valuess of the matrix virtual void Get(wxDouble* a=NULL, wxDouble* b=NULL, wxDouble* c=NULL, wxDouble* d=NULL, wxDouble* tx=NULL, wxDouble* ty=NULL) const; - + // makes this the inverse matrix virtual void Invert(); @@ -216,44 +229,7 @@ private: cairo_matrix_t m_matrix ; } ; -// Common base class for pens and brushes. -class wxCairoPenBrushBaseData : public wxGraphicsObjectRefData -{ -public: - wxCairoPenBrushBaseData(wxGraphicsRenderer* renderer, - const wxColour& col, - bool isTransparent); - virtual ~wxCairoPenBrushBaseData(); - - virtual void Apply( wxGraphicsContext* context ); - -protected: - // Call this to use the given bitmap as stipple. Bitmap must be non-null - // and valid. - void InitStipple(wxBitmap* bmp); - - // Call this to use the given hatch style. Hatch style must be valid. - void InitHatch(wxHatchStyle hatchStyle); - - - double m_red; - double m_green; - double m_blue; - double m_alpha; - - cairo_pattern_t* m_pattern; - class wxCairoBitmapData* m_bmpdata; - -private: - // Called once to allocate m_pattern if needed. - void InitHatchPattern(cairo_t* ctext); - - wxHatchStyle m_hatchStyle; - - wxDECLARE_NO_COPY_CLASS(wxCairoPenBrushBaseData); -}; - -class WXDLLIMPEXP_CORE wxCairoPenData : public wxCairoPenBrushBaseData +class WXDLLIMPEXP_CORE wxCairoPenData : public wxGraphicsObjectRefData { public: wxCairoPenData( wxGraphicsRenderer* renderer, const wxPen &pen ); @@ -266,7 +242,12 @@ public: private : double m_width; - + + double m_red; + double m_green; + double m_blue; + double m_alpha; + cairo_line_cap_t m_cap; cairo_line_join_t m_join; @@ -274,106 +255,62 @@ private : const double *m_lengths; double *m_userLengths; - wxDECLARE_NO_COPY_CLASS(wxCairoPenData); + wxPen m_pen; }; -class WXDLLIMPEXP_CORE wxCairoBrushData : public wxCairoPenBrushBaseData +class WXDLLIMPEXP_CORE wxCairoBrushData : public wxGraphicsObjectRefData { public: wxCairoBrushData( wxGraphicsRenderer* renderer ); wxCairoBrushData( wxGraphicsRenderer* renderer, const wxBrush &brush ); + ~wxCairoBrushData (); - void CreateLinearGradientBrush(wxDouble x1, wxDouble y1, - wxDouble x2, wxDouble y2, - const wxGraphicsGradientStops& stops); - void CreateRadialGradientBrush(wxDouble xo, wxDouble yo, - wxDouble xc, wxDouble yc, wxDouble radius, - const wxGraphicsGradientStops& stops); + virtual void Apply( wxGraphicsContext* context ); + void CreateLinearGradientBrush( wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2, + const wxColour&c1, const wxColour&c2 ); + void CreateRadialGradientBrush( wxDouble xo, wxDouble yo, wxDouble xc, wxDouble yc, wxDouble radius, + const wxColour &oColor, const wxColour &cColor ); protected: virtual void Init(); - // common part of Create{Linear,Radial}GradientBrush() - void AddGradientStops(const wxGraphicsGradientStops& stops); +private : + double m_red; + double m_green; + double m_blue; + double m_alpha; + + cairo_pattern_t* m_brushPattern; }; class wxCairoFontData : public wxGraphicsObjectRefData { public: wxCairoFontData( wxGraphicsRenderer* renderer, const wxFont &font, const wxColour& col ); - wxCairoFontData(wxGraphicsRenderer* renderer, - double sizeInPixels, - const wxString& facename, - int flags, - const wxColour& col); ~wxCairoFontData(); - virtual bool Apply( wxGraphicsContext* context ); -#ifdef __WXGTK__ - const wxFont& GetFont() const { return m_wxfont; } -#endif + virtual void Apply( wxGraphicsContext* context ); private : - void InitColour(const wxColour& col); - void InitFontComponents(const wxString& facename, - cairo_font_slant_t slant, - cairo_font_weight_t weight); - + wxCharBuffer m_fontName; double m_size; + cairo_font_slant_t m_slant; + cairo_font_weight_t m_weight; double m_red; double m_green; double m_blue; double m_alpha; -#ifdef __WXMAC__ - cairo_font_face_t *m_font; -#elif defined(__WXGTK__) - wxFont m_wxfont; -#endif - - // These members are used when the font is created from its face name and - // flags (and not from wxFont) and also even when creating it from wxFont - // on the platforms not covered above. - // - // Notice that we can't use cairo_font_face_t instead of storing those, - // even though it would be simpler and need less #ifdefs, because - // cairo_toy_font_face_create() that we'd need to create it is only - // available in Cairo 1.8 and we require just 1.2 currently. If we do drop - // support for < 1.8 versions in the future it would be definitely better - // to use cairo_toy_font_face_create() instead. - wxCharBuffer m_fontName; - cairo_font_slant_t m_slant; - cairo_font_weight_t m_weight; }; -class wxCairoBitmapData : public wxGraphicsBitmapData +class wxCairoBitmapData : public wxGraphicsObjectRefData { public: wxCairoBitmapData( wxGraphicsRenderer* renderer, const wxBitmap& bmp ); -#if wxUSE_IMAGE - wxCairoBitmapData(wxGraphicsRenderer* renderer, const wxImage& image); -#endif // wxUSE_IMAGE - wxCairoBitmapData( wxGraphicsRenderer* renderer, cairo_surface_t* bitmap ); ~wxCairoBitmapData(); virtual cairo_surface_t* GetCairoSurface() { return m_surface; } virtual cairo_pattern_t* GetCairoPattern() { return m_pattern; } - virtual void* GetNativeBitmap() const { return m_surface; } virtual wxSize GetSize() { return wxSize(m_width, m_height); } - -#if wxUSE_IMAGE - wxImage ConvertToImage() const; -#endif // wxUSE_IMAGE - private : - // Allocate m_buffer for the bitmap of the given size in the given format. - // - // Returns the stride used for the buffer. - int InitBuffer(int width, int height, cairo_format_t format); - - // Really create the surface using the buffer (which was supposed to be - // filled since InitBuffer() call). - void InitSurface(cairo_format_t format, int stride); - - cairo_surface_t* m_surface; cairo_pattern_t* m_pattern; int m_width; @@ -383,44 +320,22 @@ private : class WXDLLIMPEXP_CORE wxCairoContext : public wxGraphicsContext { + DECLARE_NO_COPY_CLASS(wxCairoContext) + public: wxCairoContext( wxGraphicsRenderer* renderer, const wxWindowDC& dc ); - wxCairoContext( wxGraphicsRenderer* renderer, const wxMemoryDC& dc ); - wxCairoContext( wxGraphicsRenderer* renderer, const wxPrinterDC& dc ); -#ifdef __WXGTK__ - wxCairoContext( wxGraphicsRenderer* renderer, GdkWindow *window ); -#endif #ifdef __WXMSW__ wxCairoContext( wxGraphicsRenderer* renderer, HDC context ); +#endif +#ifdef __WXGTK__ + wxCairoContext( wxGraphicsRenderer* renderer, GdkDrawable *drawable ); #endif wxCairoContext( wxGraphicsRenderer* renderer, cairo_t *context ); wxCairoContext( wxGraphicsRenderer* renderer, wxWindow *window); - - // If this ctor is used, Init() must be called by the derived class later. - wxCairoContext( wxGraphicsRenderer* renderer ); - + wxCairoContext(); virtual ~wxCairoContext(); - virtual bool ShouldOffset() const - { - if ( !m_enableOffset ) - return false; - - int penwidth = 0 ; - if ( !m_pen.IsNull() ) - { - penwidth = (int)((wxCairoPenData*)m_pen.GetRefData())->GetWidth(); - if ( penwidth == 0 ) - penwidth = 1; - } - return ( penwidth % 2 ) == 1; - } - virtual void Clip( const wxRegion ®ion ); -#ifdef __WXMSW__ - cairo_surface_t* m_mswSurface; - WindowHDC m_mswWindowHDC; -#endif // clips drawings to the rect virtual void Clip( wxDouble x, wxDouble y, wxDouble w, wxDouble h ); @@ -430,18 +345,8 @@ public: virtual void * GetNativeContext(); - virtual bool SetAntialiasMode(wxAntialiasMode antialias); - - virtual bool SetInterpolationQuality(wxInterpolationQuality interpolation); - - virtual bool SetCompositionMode(wxCompositionMode op); - - virtual void BeginLayer(wxDouble opacity); - - virtual void EndLayer(); - virtual void StrokePath( const wxGraphicsPath& p ); - virtual void FillPath( const wxGraphicsPath& p , wxPolygonFillMode fillStyle = wxWINDING_RULE ); + virtual void FillPath( const wxGraphicsPath& p , int fillStyle = wxWINDING_RULE ); virtual void Translate( wxDouble dx , wxDouble dy ); virtual void Scale( wxDouble xScale , wxDouble yScale ); @@ -456,191 +361,24 @@ public: // gets the matrix of this context virtual wxGraphicsMatrix GetTransform() const; - virtual void DrawBitmap( const wxGraphicsBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h ); + void DrawGraphicsBitmapInternal( const wxGraphicsBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h ); virtual void DrawBitmap( const wxBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h ); virtual void DrawIcon( const wxIcon &icon, wxDouble x, wxDouble y, wxDouble w, wxDouble h ); virtual void PushState(); virtual void PopState(); + virtual void DrawText( const wxString &str, wxDouble x, wxDouble y); virtual void GetTextExtent( const wxString &str, wxDouble *width, wxDouble *height, wxDouble *descent, wxDouble *externalLeading ) const; virtual void GetPartialTextExtents(const wxString& text, wxArrayDouble& widths) const; -protected: - virtual void DoDrawText( const wxString &str, wxDouble x, wxDouble y ); - - void Init(cairo_t *context); - private: cairo_t* m_context; - - wxVector m_layerOpacities; - - wxDECLARE_NO_COPY_CLASS(wxCairoContext); +#ifdef __WXMSW__ + cairo_surface_t* m_mswSurface; +#endif }; -#if wxUSE_IMAGE -// ---------------------------------------------------------------------------- -// wxCairoImageContext: context associated with a wxImage. -// ---------------------------------------------------------------------------- - -class wxCairoImageContext : public wxCairoContext -{ -public: - wxCairoImageContext(wxGraphicsRenderer* renderer, wxImage& image) : - wxCairoContext(renderer), - m_image(image), - m_data(renderer, image) - { - Init(cairo_create(m_data.GetCairoSurface())); - } - - virtual ~wxCairoImageContext() - { - m_image = m_data.ConvertToImage(); - } - -private: - wxImage& m_image; - wxCairoBitmapData m_data; - - wxDECLARE_NO_COPY_CLASS(wxCairoImageContext); -}; -#endif // wxUSE_IMAGE - -// ---------------------------------------------------------------------------- -// wxCairoPenBrushBaseData implementation -//----------------------------------------------------------------------------- - -wxCairoPenBrushBaseData::wxCairoPenBrushBaseData(wxGraphicsRenderer* renderer, - const wxColour& col, - bool isTransparent) - : wxGraphicsObjectRefData(renderer) -{ - m_hatchStyle = wxHATCHSTYLE_INVALID; - m_pattern = NULL; - m_bmpdata = NULL; - - if ( isTransparent ) - { - m_red = - m_green = - m_blue = - m_alpha = 0; - } - else // non-transparent - { - m_red = col.Red()/255.0; - m_green = col.Green()/255.0; - m_blue = col.Blue()/255.0; - m_alpha = col.Alpha()/255.0; - } -} - -wxCairoPenBrushBaseData::~wxCairoPenBrushBaseData() -{ - if (m_bmpdata) - { - // Deleting the bitmap data also deletes the pattern referenced by - // m_pattern, so set it to NULL to avoid deleting it twice. - delete m_bmpdata; - m_pattern = NULL; - } - if (m_pattern) - cairo_pattern_destroy(m_pattern); -} - -void wxCairoPenBrushBaseData::InitHatchPattern(cairo_t* ctext) -{ - cairo_surface_t* const - surface = cairo_surface_create_similar( - cairo_get_target(ctext), CAIRO_CONTENT_COLOR_ALPHA, 10, 10 - ); - - cairo_t* const cr = cairo_create(surface); - cairo_set_line_cap(cr, CAIRO_LINE_CAP_SQUARE); - cairo_set_line_width(cr, 1); - cairo_set_line_join(cr,CAIRO_LINE_JOIN_MITER); - - switch ( m_hatchStyle ) - { - case wxHATCHSTYLE_CROSS: - cairo_move_to(cr, 5, 0); - cairo_line_to(cr, 5, 10); - cairo_move_to(cr, 0, 5); - cairo_line_to(cr, 10, 5); - break; - - case wxHATCHSTYLE_BDIAGONAL: - cairo_move_to(cr, 0, 10); - cairo_line_to(cr, 10, 0); - break; - - case wxHATCHSTYLE_FDIAGONAL: - cairo_move_to(cr, 0, 0); - cairo_line_to(cr, 10, 10); - break; - - case wxHATCHSTYLE_CROSSDIAG: - cairo_move_to(cr, 0, 0); - cairo_line_to(cr, 10, 10); - cairo_move_to(cr, 10, 0); - cairo_line_to(cr, 0, 10); - break; - - case wxHATCHSTYLE_HORIZONTAL: - cairo_move_to(cr, 0, 5); - cairo_line_to(cr, 10, 5); - break; - - case wxHATCHSTYLE_VERTICAL: - cairo_move_to(cr, 5, 0); - cairo_line_to(cr, 5, 10); - break; - - default: - wxFAIL_MSG(wxS("Invalid hatch pattern style.")); - } - - cairo_set_source_rgba(cr, m_red, m_green, m_blue, m_alpha); - cairo_stroke(cr); - - cairo_destroy(cr); - - m_pattern = cairo_pattern_create_for_surface(surface); - cairo_surface_destroy(surface); - cairo_pattern_set_extend(m_pattern, CAIRO_EXTEND_REPEAT); -} - -void wxCairoPenBrushBaseData::InitStipple(wxBitmap* bmp) -{ - wxCHECK_RET( bmp && bmp->IsOk(), wxS("Invalid stippled bitmap") ); - - m_bmpdata = new wxCairoBitmapData(GetRenderer(), *bmp); - m_pattern = m_bmpdata->GetCairoPattern(); - cairo_pattern_set_extend(m_pattern, CAIRO_EXTEND_REPEAT); -} - -void wxCairoPenBrushBaseData::InitHatch(wxHatchStyle hatchStyle) -{ - // We can't create m_pattern right now as we don't have the Cairo context - // needed for it, so just remember that we need to do it. - m_hatchStyle = hatchStyle; -} - -void wxCairoPenBrushBaseData::Apply( wxGraphicsContext* context ) -{ - cairo_t* const ctext = (cairo_t*) context->GetNativeContext(); - - if ( m_hatchStyle != wxHATCHSTYLE_INVALID && !m_pattern ) - InitHatchPattern(ctext); - - if ( m_pattern ) - cairo_set_source(ctext, m_pattern); - else - cairo_set_source_rgba(ctext, m_red, m_green, m_blue, m_alpha); -} - //----------------------------------------------------------------------------- // wxCairoPenData implementation //----------------------------------------------------------------------------- @@ -659,14 +397,20 @@ void wxCairoPenData::Init() } wxCairoPenData::wxCairoPenData( wxGraphicsRenderer* renderer, const wxPen &pen ) - : wxCairoPenBrushBaseData(renderer, pen.GetColour(), pen.IsTransparent()) -{ +: wxGraphicsObjectRefData(renderer) +{ Init(); - m_width = pen.GetWidth(); + m_pen = pen; + m_width = m_pen.GetWidth(); if (m_width <= 0.0) m_width = 0.1; - switch ( pen.GetCap() ) + m_red = m_pen.GetColour().Red()/255.0; + m_green = m_pen.GetColour().Green()/255.0; + m_blue = m_pen.GetColour().Blue()/255.0; + m_alpha = m_pen.GetColour().Alpha()/255.0; + + switch ( m_pen.GetCap() ) { case wxCAP_ROUND : m_cap = CAIRO_LINE_CAP_ROUND; @@ -685,7 +429,7 @@ wxCairoPenData::wxCairoPenData( wxGraphicsRenderer* renderer, const wxPen &pen ) break; } - switch ( pen.GetJoin() ) + switch ( m_pen.GetJoin() ) { case wxJOIN_BEVEL : m_join = CAIRO_LINE_JOIN_BEVEL; @@ -722,37 +466,37 @@ wxCairoPenData::wxCairoPenData( wxGraphicsRenderer* renderer, const wxPen &pen ) 9.0 , 6.0 , 3.0 , 3.0 }; - switch ( pen.GetStyle() ) + switch ( m_pen.GetStyle() ) { - case wxPENSTYLE_SOLID : + case wxSOLID : break; - case wxPENSTYLE_DOT : + case wxDOT : m_count = WXSIZEOF(dotted); m_userLengths = new double[ m_count ] ; memcpy( m_userLengths, dotted, sizeof(dotted) ); m_lengths = m_userLengths; break; - case wxPENSTYLE_LONG_DASH : - m_lengths = dashed ; + case wxLONG_DASH : + m_lengths = dotted ; m_count = WXSIZEOF(dashed); break; - case wxPENSTYLE_SHORT_DASH : - m_lengths = short_dashed ; + case wxSHORT_DASH : + m_lengths = dotted ; m_count = WXSIZEOF(short_dashed); break; - case wxPENSTYLE_DOT_DASH : - m_lengths = dotted_dashed ; + case wxDOT_DASH : + m_lengths = dotted ; m_count = WXSIZEOF(dotted_dashed); break; - case wxPENSTYLE_USER_DASH : + case wxUSER_DASH : { wxDash *wxdashes ; - m_count = pen.GetDashes( &wxdashes ) ; + m_count = m_pen.GetDashes( &wxdashes ) ; if ((wxdashes != NULL) && (m_count > 0)) { m_userLengths = new double[m_count] ; @@ -769,18 +513,53 @@ wxCairoPenData::wxCairoPenData( wxGraphicsRenderer* renderer, const wxPen &pen ) m_lengths = m_userLengths ; } break; - - case wxPENSTYLE_STIPPLE : - case wxPENSTYLE_STIPPLE_MASK : - case wxPENSTYLE_STIPPLE_MASK_OPAQUE : - InitStipple(pen.GetStipple()); - break; - - default : - if ( pen.GetStyle() >= wxPENSTYLE_FIRST_HATCH - && pen.GetStyle() <= wxPENSTYLE_LAST_HATCH ) + case wxSTIPPLE : { - InitHatch(static_cast(pen.GetStyle())); + /* + wxBitmap* bmp = pen.GetStipple(); + if ( bmp && bmp->Ok() ) + { + wxDELETE( m_penImage ); + wxDELETE( m_penBrush ); + m_penImage = Bitmap::FromHBITMAP((HBITMAP)bmp->GetHBITMAP(),(HPALETTE)bmp->GetPalette()->GetHPALETTE()); + m_penBrush = new TextureBrush(m_penImage); + m_pen->SetBrush( m_penBrush ); + } + */ + } + break; + default : + if ( m_pen.GetStyle() >= wxFIRST_HATCH && m_pen.GetStyle() <= wxLAST_HATCH ) + { + /* + wxDELETE( m_penBrush ); + HatchStyle style = HatchStyleHorizontal; + switch( pen.GetStyle() ) + { + case wxBDIAGONAL_HATCH : + style = HatchStyleBackwardDiagonal; + break ; + case wxCROSSDIAG_HATCH : + style = HatchStyleDiagonalCross; + break ; + case wxFDIAGONAL_HATCH : + style = HatchStyleForwardDiagonal; + break ; + case wxCROSS_HATCH : + style = HatchStyleCross; + break ; + case wxHORIZONTAL_HATCH : + style = HatchStyleHorizontal; + break ; + case wxVERTICAL_HATCH : + style = HatchStyleVertical; + break ; + + } + m_penBrush = new HatchBrush(style,Color( pen.GetColour().Alpha() , pen.GetColour().Red() , + pen.GetColour().Green() , pen.GetColour().Blue() ), Color.Transparent ); + m_pen->SetBrush( m_penBrush ) + */ } break; } @@ -788,10 +567,9 @@ wxCairoPenData::wxCairoPenData( wxGraphicsRenderer* renderer, const wxPen &pen ) void wxCairoPenData::Apply( wxGraphicsContext* context ) { - wxCairoPenBrushBaseData::Apply(context); - cairo_t * ctext = (cairo_t*) context->GetNativeContext(); cairo_set_line_width(ctext,m_width); + cairo_set_source_rgba(ctext,m_red,m_green, m_blue,m_alpha); cairo_set_line_cap(ctext,m_cap); cairo_set_line_join(ctext,m_join); cairo_set_dash(ctext,(double*)m_lengths,m_count,0.0); @@ -802,199 +580,143 @@ void wxCairoPenData::Apply( wxGraphicsContext* context ) //----------------------------------------------------------------------------- wxCairoBrushData::wxCairoBrushData( wxGraphicsRenderer* renderer ) - : wxCairoPenBrushBaseData(renderer, wxColour(), true /* transparent */) + : wxGraphicsObjectRefData( renderer ) { Init(); } -wxCairoBrushData::wxCairoBrushData( wxGraphicsRenderer* renderer, - const wxBrush &brush ) - : wxCairoPenBrushBaseData(renderer, brush.GetColour(), brush.IsTransparent()) +wxCairoBrushData::wxCairoBrushData( wxGraphicsRenderer* renderer, const wxBrush &brush ) + : wxGraphicsObjectRefData(renderer) { Init(); - - switch ( brush.GetStyle() ) + + m_red = brush.GetColour().Red()/255.0; + m_green = brush.GetColour().Green()/255.0; + m_blue = brush.GetColour().Blue()/255.0; + m_alpha = brush.GetColour().Alpha()/255.0; + /* + if ( brush.GetStyle() == wxSOLID) { - case wxBRUSHSTYLE_STIPPLE: - case wxBRUSHSTYLE_STIPPLE_MASK: - case wxBRUSHSTYLE_STIPPLE_MASK_OPAQUE: - InitStipple(brush.GetStipple()); - break; + m_brush = new SolidBrush( Color( brush.GetColour().Alpha() , brush.GetColour().Red() , + brush.GetColour().Green() , brush.GetColour().Blue() ) ); + } + else if ( brush.IsHatch() ) + { + HatchStyle style = HatchStyleHorizontal; + switch( brush.GetStyle() ) + { + case wxBDIAGONAL_HATCH : + style = HatchStyleBackwardDiagonal; + break ; + case wxCROSSDIAG_HATCH : + style = HatchStyleDiagonalCross; + break ; + case wxFDIAGONAL_HATCH : + style = HatchStyleForwardDiagonal; + break ; + case wxCROSS_HATCH : + style = HatchStyleCross; + break ; + case wxHORIZONTAL_HATCH : + style = HatchStyleHorizontal; + break ; + case wxVERTICAL_HATCH : + style = HatchStyleVertical; + break ; - default: - if ( brush.IsHatch() ) - InitHatch(static_cast(brush.GetStyle())); - break; + } + m_brush = new HatchBrush(style,Color( brush.GetColour().Alpha() , brush.GetColour().Red() , + brush.GetColour().Green() , brush.GetColour().Blue() ), Color.Transparent ); + } + else + { + wxBitmap* bmp = brush.GetStipple(); + if ( bmp && bmp->Ok() ) + { + wxDELETE( m_brushImage ); + m_brushImage = Bitmap::FromHBITMAP((HBITMAP)bmp->GetHBITMAP(),(HPALETTE)bmp->GetPalette()->GetHPALETTE()); + m_brush = new TextureBrush(m_brushImage); + } + } + */ +} + +wxCairoBrushData::~wxCairoBrushData () +{ + if (m_brushPattern) + cairo_pattern_destroy(m_brushPattern); +} + +void wxCairoBrushData::Apply( wxGraphicsContext* context ) +{ + cairo_t * ctext = (cairo_t*) context->GetNativeContext(); + if ( m_brushPattern ) + { + cairo_set_source(ctext,m_brushPattern); + } + else + { + cairo_set_source_rgba(ctext,m_red,m_green, m_blue,m_alpha); } } -void wxCairoBrushData::AddGradientStops(const wxGraphicsGradientStops& stops) +void wxCairoBrushData::CreateLinearGradientBrush( wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2, + const wxColour&c1, const wxColour&c2 ) { - // loop over all the stops, they include the beginning and ending ones - const unsigned numStops = stops.GetCount(); - for ( unsigned n = 0; n < numStops; n++ ) - { - const wxGraphicsGradientStop stop = stops.Item(n); - - const wxColour col = stop.GetColour(); - - cairo_pattern_add_color_stop_rgba - ( - m_pattern, - stop.GetPosition(), - col.Red()/255.0, - col.Green()/255.0, - col.Blue()/255.0, - col.Alpha()/255.0 - ); - } - - wxASSERT_MSG(cairo_pattern_status(m_pattern) == CAIRO_STATUS_SUCCESS, - wxT("Couldn't create cairo pattern")); + m_brushPattern = cairo_pattern_create_linear(x1,y1,x2,y2); + cairo_pattern_add_color_stop_rgba(m_brushPattern,0.0,c1.Red()/255.0, + c1.Green()/255.0, c1.Blue()/255.0,c1.Alpha()/255.0); + cairo_pattern_add_color_stop_rgba(m_brushPattern,1.0,c2.Red()/255.0, + c2.Green()/255.0, c2.Blue()/255.0,c2.Alpha()/255.0); + wxASSERT_MSG(cairo_pattern_status(m_brushPattern) == CAIRO_STATUS_SUCCESS, wxT("Couldn't create cairo pattern")); } -void -wxCairoBrushData::CreateLinearGradientBrush(wxDouble x1, wxDouble y1, - wxDouble x2, wxDouble y2, - const wxGraphicsGradientStops& stops) +void wxCairoBrushData::CreateRadialGradientBrush( wxDouble xo, wxDouble yo, wxDouble xc, wxDouble yc, wxDouble radius, + const wxColour &oColor, const wxColour &cColor ) { - m_pattern = cairo_pattern_create_linear(x1,y1,x2,y2); - - AddGradientStops(stops); -} - -void -wxCairoBrushData::CreateRadialGradientBrush(wxDouble xo, wxDouble yo, - wxDouble xc, wxDouble yc, - wxDouble radius, - const wxGraphicsGradientStops& stops) -{ - m_pattern = cairo_pattern_create_radial(xo,yo,0.0,xc,yc,radius); - - AddGradientStops(stops); + m_brushPattern = cairo_pattern_create_radial(xo,yo,0.0,xc,yc,radius); + cairo_pattern_add_color_stop_rgba(m_brushPattern,0.0,oColor.Red()/255.0, + oColor.Green()/255.0, oColor.Blue()/255.0,oColor.Alpha()/255.0); + cairo_pattern_add_color_stop_rgba(m_brushPattern,1.0,cColor.Red()/255.0, + cColor.Green()/255.0, cColor.Blue()/255.0,cColor.Alpha()/255.0); + wxASSERT_MSG(cairo_pattern_status(m_brushPattern) == CAIRO_STATUS_SUCCESS, wxT("Couldn't create cairo pattern")); } void wxCairoBrushData::Init() { - m_pattern = NULL; - m_bmpdata = NULL; + m_brushPattern = NULL; } //----------------------------------------------------------------------------- // wxCairoFontData implementation //----------------------------------------------------------------------------- -void wxCairoFontData::InitColour(const wxColour& col) +wxCairoFontData::wxCairoFontData( wxGraphicsRenderer* renderer, const wxFont &font, + const wxColour& col ) : wxGraphicsObjectRefData(renderer) { m_red = col.Red()/255.0; - m_green = col.Green()/255.0; + m_green = col.Green()/255.0; m_blue = col.Blue()/255.0; m_alpha = col.Alpha()/255.0; -} - -void -wxCairoFontData::InitFontComponents(const wxString& facename, - cairo_font_slant_t slant, - cairo_font_weight_t weight) -{ - m_fontName = facename.mb_str(wxConvUTF8); - m_slant = slant; - m_weight = weight; -} - -wxCairoFontData::wxCairoFontData( wxGraphicsRenderer* renderer, const wxFont &font, - const wxColour& col ) - : wxGraphicsObjectRefData(renderer) -#ifdef __WXGTK__ - , m_wxfont(font) -#endif -{ - InitColour(col); m_size = font.GetPointSize(); - -#ifdef __WXMAC__ - m_font = cairo_quartz_font_face_create_for_cgfont( font.OSXGetCGFont() ); -#elif defined(__WXGTK__) -#else - InitFontComponents - ( - font.GetFaceName(), - font.GetStyle() == wxFONTSTYLE_ITALIC ? CAIRO_FONT_SLANT_ITALIC - : CAIRO_FONT_SLANT_NORMAL, - font.GetWeight() == wxFONTWEIGHT_BOLD ? CAIRO_FONT_WEIGHT_BOLD - : CAIRO_FONT_WEIGHT_NORMAL - ); -#endif -} - -wxCairoFontData::wxCairoFontData(wxGraphicsRenderer* renderer, - double sizeInPixels, - const wxString& facename, - int flags, - const wxColour& col) : - wxGraphicsObjectRefData(renderer) -{ - InitColour(col); - - // Resolution for Cairo image surfaces is 72 DPI meaning that the sizes in - // points and pixels are identical, so we can just pass the size in pixels - // directly to cairo_set_font_size(). - m_size = sizeInPixels; - -#if defined(__WXMAC__) - m_font = NULL; -#endif - - // There is no need to set m_underlined under wxGTK in this case, it can - // only be used if m_font != NULL. - - InitFontComponents - ( - facename, - flags & wxFONTFLAG_ITALIC ? CAIRO_FONT_SLANT_ITALIC - : CAIRO_FONT_SLANT_NORMAL, - flags & wxFONTFLAG_BOLD ? CAIRO_FONT_WEIGHT_BOLD - : CAIRO_FONT_WEIGHT_NORMAL - ); + m_fontName = font.GetFaceName().mb_str(wxConvUTF8); + m_slant = font.GetStyle() == wxFONTSTYLE_ITALIC ? CAIRO_FONT_SLANT_ITALIC:CAIRO_FONT_SLANT_NORMAL; + m_weight = font.GetWeight() == wxFONTWEIGHT_BOLD ? CAIRO_FONT_WEIGHT_BOLD:CAIRO_FONT_WEIGHT_NORMAL; } wxCairoFontData::~wxCairoFontData() { -#ifdef __WXMAC__ - if ( m_font ) - cairo_font_face_destroy( m_font ); -#endif } -bool wxCairoFontData::Apply( wxGraphicsContext* context ) +void wxCairoFontData::Apply( wxGraphicsContext* context ) { cairo_t * ctext = (cairo_t*) context->GetNativeContext(); cairo_set_source_rgba(ctext,m_red,m_green, m_blue,m_alpha); -#ifdef __WXGTK__ - if (m_wxfont.IsOk()) - { - // Nothing to do, the caller uses Pango layout functions to do - // everything. - return true; - } -#elif defined(__WXMAC__) - if ( m_font ) - { - cairo_set_font_face(ctext, m_font); - cairo_set_font_size(ctext, m_size ); - return true; - } -#endif - - // If we get here, we must be on a platform without native font support or - // we're using toy Cairo API even under wxGTK/wxMac. - cairo_select_font_face(ctext, m_fontName, m_slant, m_weight ); - cairo_set_font_size(ctext, m_size ); - - // Indicate that we don't use native fonts for the platforms which care - // about this (currently only wxGTK). - return false; + cairo_select_font_face(ctext,m_fontName,m_slant,m_weight); + cairo_set_font_size(ctext,m_size); + // TODO UNDERLINE + // TODO FIX SIZE } //----------------------------------------------------------------------------- @@ -1088,7 +810,7 @@ void wxCairoPathData::GetCurrentPoint( wxDouble* x, wxDouble* y) const void wxCairoPathData::AddArc( wxDouble x, wxDouble y, wxDouble r, double startAngle, double endAngle, bool clockwise ) { - // as clockwise means positive in our system (y pointing downwards) + // as clockwise means positive in our system (y pointing downwards) // TODO make this interpretation dependent of the // real device trans if ( clockwise||(endAngle-startAngle)>=2*M_PI) @@ -1098,14 +820,14 @@ void wxCairoPathData::AddArc( wxDouble x, wxDouble y, wxDouble r, double startAn } // transforms each point of this path by the matrix -void wxCairoPathData::Transform( const wxGraphicsMatrixData* matrix ) +void wxCairoPathData::Transform( const wxGraphicsMatrixData* matrix ) { // as we don't have a true path object, we have to apply the inverse // matrix to the context cairo_matrix_t m = *((cairo_matrix_t*) matrix->GetNativeMatrix()); cairo_matrix_invert( &m ); cairo_transform(m_pathContext,&m); -} +} // gets the bounding box enclosing all points (possibly including control points) void wxCairoPathData::GetBox(wxDouble *x, wxDouble *y, wxDouble *w, wxDouble *h) const @@ -1123,7 +845,7 @@ void wxCairoPathData::GetBox(wxDouble *x, wxDouble *y, wxDouble *w, wxDouble *h) *x = x1; *w = x2-x1; } - + if( y2 < y1 ) { *y = y2; @@ -1136,10 +858,9 @@ void wxCairoPathData::GetBox(wxDouble *x, wxDouble *y, wxDouble *w, wxDouble *h) } } -bool wxCairoPathData::Contains( wxDouble x, wxDouble y, wxPolygonFillMode fillStyle ) const +bool wxCairoPathData::Contains( wxDouble x, wxDouble y, int fillStyle ) const { - cairo_set_fill_rule(m_pathContext,fillStyle==wxODDEVEN_RULE ? CAIRO_FILL_RULE_EVEN_ODD : CAIRO_FILL_RULE_WINDING); - return cairo_in_fill( m_pathContext, x, y) != 0; + return cairo_in_stroke( m_pathContext, x, y) != 0; } //----------------------------------------------------------------------------- @@ -1153,25 +874,25 @@ wxCairoMatrixData::wxCairoMatrixData(wxGraphicsRenderer* renderer, const cairo_m m_matrix = *matrix; } -wxCairoMatrixData::~wxCairoMatrixData() +wxCairoMatrixData::~wxCairoMatrixData() { // nothing to do } -wxGraphicsObjectRefData *wxCairoMatrixData::Clone() const +wxGraphicsObjectRefData *wxCairoMatrixData::Clone() const { return new wxCairoMatrixData(GetRenderer(),&m_matrix); } // concatenates the matrix -void wxCairoMatrixData::Concat( const wxGraphicsMatrixData *t ) +void wxCairoMatrixData::Concat( const wxGraphicsMatrixData *t ) { - cairo_matrix_multiply( &m_matrix, &m_matrix, (cairo_matrix_t*) t->GetNativeMatrix()); + cairo_matrix_multiply( &m_matrix, &m_matrix, (cairo_matrix_t*) t->GetNativeMatrix()); } // sets the matrix to the respective values -void wxCairoMatrixData::Set(wxDouble a, wxDouble b, wxDouble c, wxDouble d, - wxDouble tx, wxDouble ty) +void wxCairoMatrixData::Set(wxDouble a, wxDouble b, wxDouble c, wxDouble d, + wxDouble tx, wxDouble ty) { cairo_matrix_init( &m_matrix, a, b, c, d, tx, ty); } @@ -1189,21 +910,21 @@ void wxCairoMatrixData::Get(wxDouble* a, wxDouble* b, wxDouble* c, } // makes this the inverse matrix -void wxCairoMatrixData::Invert() +void wxCairoMatrixData::Invert() { cairo_matrix_invert( &m_matrix ); } // returns true if the elements of the transformation matrix are equal ? -bool wxCairoMatrixData::IsEqual( const wxGraphicsMatrixData* t) const +bool wxCairoMatrixData::IsEqual( const wxGraphicsMatrixData* t) const { const cairo_matrix_t* tm = (cairo_matrix_t*) t->GetNativeMatrix(); - return ( - m_matrix.xx == tm->xx && - m_matrix.yx == tm->yx && - m_matrix.xy == tm->xy && - m_matrix.yy == tm->yy && - m_matrix.x0 == tm->x0 && + return ( + m_matrix.xx == tm->xx && + m_matrix.yx == tm->yx && + m_matrix.xy == tm->xy && + m_matrix.yy == tm->yy && + m_matrix.x0 == tm->x0 && m_matrix.y0 == tm->y0 ) ; } @@ -1231,7 +952,7 @@ void wxCairoMatrixData::Scale( wxDouble xScale , wxDouble yScale ) } // add the rotation to this matrix (radians) -void wxCairoMatrixData::Rotate( wxDouble angle ) +void wxCairoMatrixData::Rotate( wxDouble angle ) { cairo_matrix_rotate( &m_matrix, angle) ; } @@ -1264,90 +985,35 @@ void * wxCairoMatrixData::GetNativeMatrix() const return (void*) &m_matrix; } -// ---------------------------------------------------------------------------- +//----------------------------------------------------------------------------- // wxCairoBitmap implementation -// ---------------------------------------------------------------------------- +//----------------------------------------------------------------------------- -int wxCairoBitmapData::InitBuffer(int width, int height, cairo_format_t format) -{ - wxUnusedVar(format); // Only really unused with Cairo < 1.6. - - // Determine the stride: use cairo_format_stride_for_width() if available - // but fall back to 4*width for the earlier versions as this is what that - // function always returns, even in latest Cairo, anyhow. - int stride; -#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 6, 0) - if ( cairo_version() >= CAIRO_VERSION_ENCODE(1, 6, 0) ) - { - stride = cairo_format_stride_for_width(format, width); - - // All our code would totally break if stride were not a multiple of 4 - // so ensure this is the case. - if ( stride % 4 ) - { - wxFAIL_MSG("Unexpected Cairo image surface stride."); - - stride += 4 - stride % 4; - } - } - else -#endif - stride = 4*width; - - m_width = width; - m_height = height; - m_buffer = new unsigned char[height*stride]; - - return stride; -} - -void wxCairoBitmapData::InitSurface(cairo_format_t format, int stride) -{ - m_surface = cairo_image_surface_create_for_data( - m_buffer, format, m_width, m_height, stride); - m_pattern = cairo_pattern_create_for_surface(m_surface); -} - -wxCairoBitmapData::wxCairoBitmapData( wxGraphicsRenderer* renderer, cairo_surface_t* bitmap ) : - wxGraphicsBitmapData( renderer ) -{ - m_surface = bitmap; - m_pattern = cairo_pattern_create_for_surface(m_surface); -} - -wxCairoBitmapData::wxCairoBitmapData( wxGraphicsRenderer* renderer, const wxBitmap& bmp ) : wxGraphicsBitmapData( renderer ) +wxCairoBitmapData::wxCairoBitmapData( wxGraphicsRenderer* renderer, const wxBitmap& bmp ) : wxGraphicsObjectRefData( renderer ) { wxCHECK_RET( bmp.IsOk(), wxT("Invalid bitmap in wxCairoContext::DrawBitmap")); -#ifdef wxHAS_RAW_BITMAP + int bw = m_width = bmp.GetWidth(); + int bh = m_height = bmp.GetHeight(); + wxBitmap bmpSource = bmp; // we need a non-const instance + m_buffer = new unsigned char[bw*bh*4]; + wxUint32* data = (wxUint32*)m_buffer; + // Create a surface object and copy the bitmap pixel data to it. if the // image has alpha (or a mask represented as alpha) then we'll use a // different format and iterator than if it doesn't... - cairo_format_t bufferFormat = bmp.GetDepth() == 32 -#if defined(__WXGTK__) && !defined(__WXGTK3__) - || bmp.GetMask() -#endif - ? CAIRO_FORMAT_ARGB32 - : CAIRO_FORMAT_RGB24; - - int stride = InitBuffer(bmp.GetWidth(), bmp.GetHeight(), bufferFormat); - - wxBitmap bmpSource = bmp; // we need a non-const instance - wxUint32* data = (wxUint32*)m_buffer; - - if ( bufferFormat == CAIRO_FORMAT_ARGB32 ) + if (bmpSource.HasAlpha() || bmpSource.GetMask()) { - // use the bitmap's alpha - wxAlphaPixelData - pixData(bmpSource, wxPoint(0, 0), wxSize(m_width, m_height)); + m_surface = cairo_image_surface_create_for_data( + m_buffer, CAIRO_FORMAT_ARGB32, bw, bh, bw*4); + wxAlphaPixelData pixData(bmpSource, wxPoint(0,0), wxSize(bw, bh)); wxCHECK_RET( pixData, wxT("Failed to gain raw access to bitmap data.")); - + wxAlphaPixelData::Iterator p(pixData); - for (int y=0; y(m_buffer); - const unsigned char* src = image.GetData(); - - if ( bufferFormat == CAIRO_FORMAT_ARGB32 ) - { - const unsigned char* alpha = image.GetAlpha(); - - for ( int y = 0; y < m_height; y++ ) - { - wxUint32* const rowStartDst = dst; - - for ( int x = 0; x < m_width; x++ ) - { - const unsigned char a = *alpha++; - - *dst++ = a << 24 | - Premultiply(a, src[0]) << 16 | - Premultiply(a, src[1]) << 8 | - Premultiply(a, src[2]); - src += 3; - } - - dst = rowStartDst + stride / 4; - } - } - else // RGB - { - for ( int y = 0; y < m_height; y++ ) - { - wxUint32* const rowStartDst = dst; - - for ( int x = 0; x < m_width; x++ ) - { - *dst++ = src[0] << 16 | - src[1] << 8 | - src[2]; - src += 3; - } - - dst = rowStartDst + stride / 4; - } - } - - InitSurface(bufferFormat, stride); -} - -wxImage wxCairoBitmapData::ConvertToImage() const -{ - wxImage image(m_width, m_height, false /* don't clear */); - - // Get the surface type and format. - wxCHECK_MSG( cairo_surface_get_type(m_surface) == CAIRO_SURFACE_TYPE_IMAGE, - wxNullImage, - wxS("Can't convert non-image surface to image.") ); - - switch ( cairo_image_surface_get_format(m_surface) ) - { - case CAIRO_FORMAT_ARGB32: - image.SetAlpha(); - break; - - case CAIRO_FORMAT_RGB24: - // Nothing to do, we don't use alpha by default. - break; - - case CAIRO_FORMAT_A8: - case CAIRO_FORMAT_A1: - wxFAIL_MSG(wxS("Unsupported Cairo image surface type.")); - return wxNullImage; - - default: - wxFAIL_MSG(wxS("Unknown Cairo image surface type.")); - return wxNullImage; - } - - // Prepare for copying data. - const wxUint32* src = (wxUint32*)cairo_image_surface_get_data(m_surface); - wxCHECK_MSG( src, wxNullImage, wxS("Failed to get Cairo surface data.") ); - - int stride = cairo_image_surface_get_stride(m_surface); - wxCHECK_MSG( stride > 0, wxNullImage, - wxS("Failed to get Cairo surface stride.") ); - - // As we work with wxUint32 pointers and not char ones, we need to adjust - // the stride accordingly. This should be lossless as the stride must be a - // multiple of pixel size. - wxASSERT_MSG( !(stride % sizeof(wxUint32)), wxS("Unexpected stride.") ); - stride /= sizeof(wxUint32); - - unsigned char* dst = image.GetData(); - unsigned char *alpha = image.GetAlpha(); - if ( alpha ) - { - // We need to also copy alpha and undo the pre-multiplication as Cairo - // stores pre-multiplied values in this format while wxImage does not. - for ( int y = 0; y < m_height; y++ ) - { - const wxUint32* const rowStart = src; - for ( int x = 0; x < m_width; x++ ) - { - const wxUint32 argb = *src++; - - *alpha++ = (argb & 0xff000000) >> 24; - - // Copy the RGB data undoing the pre-multiplication. - *dst++ = Unpremultiply(*alpha, (argb & 0x00ff0000) >> 16); - *dst++ = Unpremultiply(*alpha, (argb & 0x0000ff00) >> 8); - *dst++ = Unpremultiply(*alpha, (argb & 0x000000ff)); - } - - src = rowStart + stride; - } - } - else // RGB - { - // Things are pretty simple in this case, just copy RGB bytes. - for ( int y = 0; y < m_height; y++ ) - { - const wxUint32* const rowStart = src; - for ( int x = 0; x < m_width; x++ ) - { - const wxUint32 argb = *src++; - - *dst++ = (argb & 0x00ff0000) >> 16; - *dst++ = (argb & 0x0000ff00) >> 8; - *dst++ = (argb & 0x000000ff); - } - - src = rowStart + stride; - } - } - - return image; -} - -#endif // wxUSE_IMAGE - wxCairoBitmapData::~wxCairoBitmapData() { - if (m_pattern) - cairo_pattern_destroy(m_pattern); - - if (m_surface) - cairo_surface_destroy(m_surface); - + cairo_pattern_destroy(m_pattern); + cairo_surface_destroy(m_surface); delete [] m_buffer; } @@ -1618,207 +1073,23 @@ wxCairoBitmapData::~wxCairoBitmapData() // wxCairoContext implementation //----------------------------------------------------------------------------- -class wxCairoOffsetHelper -{ -public : - wxCairoOffsetHelper( cairo_t* ctx , bool offset ) - { - m_ctx = ctx; - m_offset = offset; - if ( m_offset ) - cairo_translate( m_ctx, 0.5, 0.5 ); - } - ~wxCairoOffsetHelper( ) - { - if ( m_offset ) - cairo_translate( m_ctx, -0.5, -0.5 ); - } -public : - cairo_t* m_ctx; - bool m_offset; -} ; - -wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, const wxPrinterDC& dc ) -: wxGraphicsContext(renderer) -{ -#ifdef __WXMSW__ - // wxMSW contexts always use MM_ANISOTROPIC, which messes up - // text rendering when printing using Cairo. Switch it to MM_TEXT - // map mode to avoid this problem. - HDC hdc = (HDC)dc.GetHDC(); - ::SetMapMode(hdc, MM_TEXT); - m_mswSurface = cairo_win32_printing_surface_create(hdc); - Init( cairo_create(m_mswSurface) ); -#endif - -#ifdef __WXGTK20__ - const wxDCImpl *impl = dc.GetImpl(); - Init( (cairo_t*) impl->GetCairoContext() ); -#endif - wxSize sz = dc.GetSize(); - m_width = sz.x; - m_height = sz.y; - - wxPoint org = dc.GetDeviceOrigin(); - cairo_translate( m_context, org.x, org.y ); - - double sx,sy; - dc.GetUserScale( &sx, &sy ); - -// TODO: Determine if these fixes are needed on other platforms too. -// On MSW, without this the printer context will not respect wxDC SetMapMode calls. -// For example, using dc.SetMapMode(wxMM_POINTS) can let us share printer and screen -// drawing code -#ifdef __WXMSW__ - double lsx,lsy; - dc.GetLogicalScale( &lsx, &lsy ); - sx *= lsx; - sy *= lsy; -#endif - cairo_scale( m_context, sx, sy ); - - org = dc.GetLogicalOrigin(); - cairo_translate( m_context, -org.x, -org.y ); -} - wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, const wxWindowDC& dc ) : wxGraphicsContext(renderer) { - int width, height; - dc.GetSize( &width, &height ); - m_width = width; - m_height = height; - - m_enableOffset = true; - -#ifdef __WXMSW__ - m_mswSurface = cairo_win32_surface_create((HDC)dc.GetHDC()); - Init( cairo_create(m_mswSurface) ); -#endif - -#ifdef __WXGTK3__ - cairo_t* cr = static_cast(dc.GetImpl()->GetCairoContext()); - if (cr) - Init(cr); -#elif defined __WXGTK20__ - wxGTKDCImpl *impldc = (wxGTKDCImpl*) dc.GetImpl(); - Init( gdk_cairo_create( impldc->GetGDKWindow() ) ); - -#if 0 - wxGraphicsMatrix matrix = CreateMatrix(); - - wxPoint org = dc.GetDeviceOrigin(); - matrix.Translate( org.x, org.y ); - - org = dc.GetLogicalOrigin(); - matrix.Translate( -org.x, -org.y ); - - double sx,sy; - dc.GetUserScale( &sx, &sy ); - matrix.Scale( sx, sy ); - - ConcatTransform( matrix ); -#endif -#endif - -#ifdef __WXMAC__ - CGContextRef cgcontext = (CGContextRef)dc.GetWindow()->MacGetCGContextRef(); - cairo_surface_t* surface = cairo_quartz_surface_create_for_cg_context(cgcontext, width, height); - Init( cairo_create( surface ) ); - cairo_surface_destroy( surface ); +#ifdef __WXGTK__ + m_context = gdk_cairo_create( dc.m_window ) ; #endif + PushState(); + PushState(); } -wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, const wxMemoryDC& dc ) +#ifdef __WXGTK__ +wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, GdkDrawable *drawable ) : wxGraphicsContext(renderer) { - int width, height; - dc.GetSize( &width, &height ); - m_width = width; - m_height = height; - - m_enableOffset = true; - -#ifdef __WXMSW__ - - HDC hdc = (HDC)dc.GetHDC(); - - HBITMAP bitmap = (HBITMAP)GetCurrentObject(hdc, OBJ_BITMAP); - - BITMAP info; - bool hasBitmap = false; - - // cairo_win32_surface_create creates a 24-bit bitmap, - // so if we have alpha, we need to create a 32-bit surface instead. - if (!GetObject(bitmap, sizeof(info), &info) || info.bmBitsPixel < 32) - m_mswSurface = cairo_win32_surface_create(hdc); - else { - hasBitmap = true; - m_mswSurface = cairo_image_surface_create_for_data((unsigned char*)info.bmBits, - CAIRO_FORMAT_ARGB32, - info.bmWidth, - info.bmHeight, - info.bmWidthBytes); - } - - Init( cairo_create(m_mswSurface) ); - // If we've created a image surface, we need to flip the Y axis so that - // all drawing will appear right side up. - if (hasBitmap) { - cairo_matrix_t matrix; - cairo_matrix_init(&matrix, 1.0, 0.0, 0.0, -1.0, 0.0, height); - cairo_set_matrix(m_context, &matrix); - } -#endif - -#ifdef __WXGTK3__ - cairo_t* cr = static_cast(dc.GetImpl()->GetCairoContext()); - if (cr) - Init(cr); -#elif defined __WXGTK20__ - wxGTKDCImpl *impldc = (wxGTKDCImpl*) dc.GetImpl(); - Init( gdk_cairo_create( impldc->GetGDKWindow() ) ); - -#if 0 - wxGraphicsMatrix matrix = CreateMatrix(); - - wxPoint org = dc.GetDeviceOrigin(); - matrix.Translate( org.x, org.y ); - - org = dc.GetLogicalOrigin(); - matrix.Translate( -org.x, -org.y ); - - double sx,sy; - dc.GetUserScale( &sx, &sy ); - matrix.Scale( sx, sy ); - - ConcatTransform( matrix ); -#endif -#endif - -#ifdef __WXMAC__ - CGContextRef cgcontext = (CGContextRef)dc.GetWindow()->MacGetCGContextRef(); - cairo_surface_t* surface = cairo_quartz_surface_create_for_cg_context(cgcontext, width, height); - Init( cairo_create( surface ) ); - cairo_surface_destroy( surface ); -#endif -} - -#ifdef __WXGTK20__ -wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, GdkWindow *window ) -: wxGraphicsContext(renderer) -{ - Init( gdk_cairo_create( window ) ); - -#ifdef __WXGTK3__ - m_width = gdk_window_get_width(window); - m_height = gdk_window_get_height(window); -#else - int width, height; - gdk_drawable_get_size(window, &width, &height); - m_width = width; - m_height = height; -#endif + m_context = gdk_cairo_create( drawable ) ; + PushState(); + PushState(); } #endif @@ -1827,9 +1098,9 @@ wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, HDC handle ) : wxGraphicsContext(renderer) { m_mswSurface = cairo_win32_surface_create(handle); - Init( cairo_create(m_mswSurface) ); - m_width = - m_height = 0; + m_context = cairo_create(m_mswSurface); + PushState(); + PushState(); } #endif @@ -1837,49 +1108,40 @@ wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, HDC handle ) wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, cairo_t *context ) : wxGraphicsContext(renderer) { - Init( context ); - m_width = - m_height = 0; + m_context = context ; + PushState(); + PushState(); } wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, wxWindow *window) - : wxGraphicsContext(renderer) -#ifdef __WXMSW__ - , m_mswWindowHDC(GetHwndOf(window)) -#endif +: wxGraphicsContext(renderer) { - m_enableOffset = true; #ifdef __WXGTK__ // something along these lines (copied from dcclient) + GtkWidget *widget = window->m_wxwindow; + // Some controls don't have m_wxwindow - like wxStaticBox, but the user // code should still be able to create wxClientDCs for them, so we will // use the parent window here then. - if (window->m_wxwindow == NULL) + if ( !widget ) { window = window->GetParent(); + widget = window->m_wxwindow; } - wxASSERT_MSG( window->m_wxwindow, wxT("wxCairoContext needs a widget") ); + wxASSERT_MSG( widget, wxT("wxCairoContext needs a widget") ); - Init(gdk_cairo_create(window->GTKGetDrawingWindow())); - - wxSize sz = window->GetSize(); - m_width = sz.x; - m_height = sz.y; + GtkPizza *pizza = GTK_PIZZA( widget ); + GdkDrawable* drawable = pizza->bin_window; + m_context = gdk_cairo_create( drawable ) ; #endif - #ifdef __WXMSW__ - m_mswSurface = cairo_win32_surface_create((HDC)m_mswWindowHDC); - Init(cairo_create(m_mswSurface)); + m_mswSurface = cairo_win32_surface_create((HDC)window->GetHandle()); + m_context = cairo_create(m_mswSurface); #endif - -} - -wxCairoContext::wxCairoContext(wxGraphicsRenderer* renderer) : - wxGraphicsContext(renderer) -{ - m_context = NULL; + PushState(); + PushState(); } wxCairoContext::~wxCairoContext() @@ -1896,13 +1158,6 @@ wxCairoContext::~wxCairoContext() #endif } -void wxCairoContext::Init(cairo_t *context) -{ - m_context = context ; - PushState(); - PushState(); -} - void wxCairoContext::Clip( const wxRegion& region ) { @@ -1912,16 +1167,16 @@ void wxCairoContext::Clip( const wxRegion& region ) while (ri) { path.AddRectangle(ri.GetX(), ri.GetY(), ri.GetW(), ri.GetH()); - ++ri; + ri++; } - + // Put it in the context cairo_path_t* cp = (cairo_path_t*) path.GetNativePath() ; cairo_append_path(m_context, cp); // clip to that path cairo_clip(m_context); - path.UnGetNativePath(cp); + path.UnGetNativePath(cp); } void wxCairoContext::Clip( wxDouble x, wxDouble y, wxDouble w, wxDouble h ) @@ -1936,7 +1191,7 @@ void wxCairoContext::Clip( wxDouble x, wxDouble y, wxDouble w, wxDouble h ) // clip to that path cairo_clip(m_context); - path.UnGetNativePath(cp); + path.UnGetNativePath(cp); } void wxCairoContext::ResetClip() @@ -1948,8 +1203,7 @@ void wxCairoContext::ResetClip() void wxCairoContext::StrokePath( const wxGraphicsPath& path ) { if ( !m_pen.IsNull() ) - { - wxCairoOffsetHelper helper( m_context, ShouldOffset() ) ; + { cairo_path_t* cp = (cairo_path_t*) path.GetNativePath() ; cairo_append_path(m_context,cp); ((wxCairoPenData*)m_pen.GetRefData())->Apply(this); @@ -1958,11 +1212,10 @@ void wxCairoContext::StrokePath( const wxGraphicsPath& path ) } } -void wxCairoContext::FillPath( const wxGraphicsPath& path , wxPolygonFillMode fillStyle ) +void wxCairoContext::FillPath( const wxGraphicsPath& path , int fillStyle ) { if ( !m_brush.IsNull() ) { - wxCairoOffsetHelper helper( m_context, ShouldOffset() ) ; cairo_path_t* cp = (cairo_path_t*) path.GetNativePath() ; cairo_append_path(m_context,cp); ((wxCairoBrushData*)m_brush.GetRefData())->Apply(this); @@ -2019,29 +1272,31 @@ void wxCairoContext::PopState() cairo_restore(m_context); } +void wxGraphicsContext::DrawGraphicsBitmap(const wxGraphicsBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h) +{ + static_cast(this)->DrawGraphicsBitmapInternal(bmp, x, y, w, h); +} + void wxCairoContext::DrawBitmap( const wxBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) { wxGraphicsBitmap bitmap = GetRenderer()->CreateBitmap(bmp); - DrawBitmap(bitmap, x, y, w, h); - + DrawGraphicsBitmapInternal(bitmap, x, y, w, h); } -void wxCairoContext::DrawBitmap(const wxGraphicsBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) +void wxCairoContext::DrawGraphicsBitmapInternal(const wxGraphicsBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) { - PushState(); - - // In case we're scaling the image by using a width and height different - // than the bitmap's size create a pattern transformation on the surface and - // draw the transformed pattern. wxCairoBitmapData* data = static_cast(bmp.GetRefData()); cairo_pattern_t* pattern = data->GetCairoPattern(); wxSize size = data->GetSize(); - - wxDouble scaleX = w / size.GetWidth(); - wxDouble scaleY = h / size.GetHeight(); - + PushState(); + // prepare to draw the image cairo_translate(m_context, x, y); + // In case we're scaling the image by using a width and height different + // than the bitmap's size create a pattern transformation on the surface and + // draw the transformed pattern. + wxDouble scaleX = w / size.GetWidth(); + wxDouble scaleY = h / size.GetHeight(); cairo_scale(m_context, scaleX, scaleY); cairo_set_source(m_context, pattern); // use the original size here since the context is scaled already... @@ -2049,6 +1304,7 @@ void wxCairoContext::DrawBitmap(const wxGraphicsBitmap &bmp, wxDouble x, wxDoubl // fill the rectangle using the pattern cairo_fill(m_context); + // clean up PopState(); } @@ -2061,44 +1317,23 @@ void wxCairoContext::DrawIcon( const wxIcon &icon, wxDouble x, wxDouble y, wxDou } -void wxCairoContext::DoDrawText(const wxString& str, wxDouble x, wxDouble y) +void wxCairoContext::DrawText( const wxString &str, wxDouble x, wxDouble y ) { - wxCHECK_RET( !m_font.IsNull(), - wxT("wxCairoContext::DrawText - no valid font set") ); + wxCHECK_RET( !m_font.IsNull(), wxT("wxCairoContext::DrawText - no valid font set") ); if ( str.empty()) return; - - const wxCharBuffer data = str.utf8_str(); - if ( !data ) - return; - - if ( ((wxCairoFontData*)m_font.GetRefData())->Apply(this) ) - { -#ifdef __WXGTK__ - PangoLayout *layout = pango_cairo_create_layout (m_context); - const wxFont& font = static_cast(m_font.GetRefData())->GetFont(); - pango_layout_set_font_description(layout, font.GetNativeFontInfo()->description); - pango_layout_set_text(layout, data, data.length()); - font.GTKSetPangoAttrs(layout); - - cairo_move_to(m_context, x, y); - pango_cairo_show_layout (m_context, layout); - - g_object_unref (layout); - - // Don't use Cairo text API, we already did everything. - return; -#endif - } + + ((wxCairoFontData*)m_font.GetRefData())->Apply(this); // Cairo's x,y for drawing text is at the baseline, so we need to adjust // the position we move to by the ascent. cairo_font_extents_t fe; cairo_font_extents(m_context, &fe); cairo_move_to(m_context, x, y+fe.ascent); - - cairo_show_text(m_context, data); + + const wxWX2MBbuf buf(str.mb_str(wxConvUTF8)); + cairo_show_text(m_context,buf); } void wxCairoContext::GetTextExtent( const wxString &str, wxDouble *width, wxDouble *height, @@ -2106,48 +1341,10 @@ void wxCairoContext::GetTextExtent( const wxString &str, wxDouble *width, wxDoub { wxCHECK_RET( !m_font.IsNull(), wxT("wxCairoContext::GetTextExtent - no valid font set") ); - if ( width ) - *width = 0; - if ( height ) - *height = 0; - if ( descent ) - *descent = 0; - if ( externalLeading ) - *externalLeading = 0; - if ( str.empty()) return; - if ( ((wxCairoFontData*)m_font.GetRefData())->Apply((wxCairoContext*)this) ) - { -#ifdef __WXGTK__ - int w, h; - - PangoLayout *layout = pango_cairo_create_layout (m_context); - const wxFont& font = static_cast(m_font.GetRefData())->GetFont(); - pango_layout_set_font_description(layout, font.GetNativeFontInfo()->description); - const wxCharBuffer data = str.utf8_str(); - if ( !data ) - { - return; - } - pango_layout_set_text(layout, data, data.length()); - pango_layout_get_pixel_size (layout, &w, &h); - if ( width ) - *width = w; - if ( height ) - *height = h; - if (descent) - { - PangoLayoutIter *iter = pango_layout_get_iter(layout); - int baseline = pango_layout_iter_get_baseline(iter); - pango_layout_iter_free(iter); - *descent = h - PANGO_PIXELS(baseline); - } - g_object_unref (layout); - return; -#endif - } + ((wxCairoFontData*)m_font.GetRefData())->Apply((wxCairoContext*)this); if (width) { @@ -2161,18 +1358,7 @@ void wxCairoContext::GetTextExtent( const wxString &str, wxDouble *width, wxDoub { cairo_font_extents_t fe; cairo_font_extents(m_context, &fe); - - // some backends have negative descents - - if ( fe.descent < 0 ) - fe.descent = -fe.descent; - - if ( fe.height < (fe.ascent + fe.descent ) ) - { - // some backends are broken re height ... (eg currently ATSUI) - fe.height = fe.ascent + fe.descent; - } - + if (height) *height = fe.height; if ( descent ) @@ -2185,138 +1371,21 @@ void wxCairoContext::GetTextExtent( const wxString &str, wxDouble *width, wxDoub void wxCairoContext::GetPartialTextExtents(const wxString& text, wxArrayDouble& widths) const { widths.Empty(); + widths.Add(0, text.length()); + wxCHECK_RET( !m_font.IsNull(), wxT("wxCairoContext::GetPartialTextExtents - no valid font set") ); -#if __WXGTK__ - const wxCharBuffer data = text.utf8_str(); - int w = 0; - if (data.length()) - { - PangoLayout* layout = pango_cairo_create_layout(m_context); - const wxFont& font = static_cast(m_font.GetRefData())->GetFont(); - pango_layout_set_font_description(layout, font.GetNativeFontInfo()->description); - pango_layout_set_text(layout, data, data.length()); - PangoLayoutIter* iter = pango_layout_get_iter(layout); - PangoRectangle rect; - do { - pango_layout_iter_get_cluster_extents(iter, NULL, &rect); - w += rect.width; - widths.Add(PANGO_PIXELS(w)); - } while (pango_layout_iter_next_cluster(iter)); - pango_layout_iter_free(iter); - g_object_unref(layout); - } - size_t i = widths.GetCount(); - const size_t len = text.length(); - while (i++ < len) - widths.Add(PANGO_PIXELS(w)); -#else + + if (text.empty()) + return; + // TODO -#endif } -void * wxCairoContext::GetNativeContext() +void * wxCairoContext::GetNativeContext() { return m_context; } -bool wxCairoContext::SetAntialiasMode(wxAntialiasMode antialias) -{ - if (m_antialias == antialias) - return true; - - m_antialias = antialias; - - cairo_antialias_t antialiasMode; - switch (antialias) - { - case wxANTIALIAS_DEFAULT: - antialiasMode = CAIRO_ANTIALIAS_DEFAULT; - break; - case wxANTIALIAS_NONE: - antialiasMode = CAIRO_ANTIALIAS_NONE; - break; - default: - return false; - } - cairo_set_antialias(m_context, antialiasMode); - return true; -} - -bool wxCairoContext::SetInterpolationQuality(wxInterpolationQuality WXUNUSED(interpolation)) -{ - // placeholder - return false; -} - -bool wxCairoContext::SetCompositionMode(wxCompositionMode op) -{ - if ( m_composition == op ) - return true; - - m_composition = op; - cairo_operator_t cop; - switch (op) - { - case wxCOMPOSITION_CLEAR: - cop = CAIRO_OPERATOR_CLEAR; - break; - case wxCOMPOSITION_SOURCE: - cop = CAIRO_OPERATOR_SOURCE; - break; - case wxCOMPOSITION_OVER: - cop = CAIRO_OPERATOR_OVER; - break; - case wxCOMPOSITION_IN: - cop = CAIRO_OPERATOR_IN; - break; - case wxCOMPOSITION_OUT: - cop = CAIRO_OPERATOR_OUT; - break; - case wxCOMPOSITION_ATOP: - cop = CAIRO_OPERATOR_ATOP; - break; - case wxCOMPOSITION_DEST: - cop = CAIRO_OPERATOR_DEST; - break; - case wxCOMPOSITION_DEST_OVER: - cop = CAIRO_OPERATOR_DEST_OVER; - break; - case wxCOMPOSITION_DEST_IN: - cop = CAIRO_OPERATOR_DEST_IN; - break; - case wxCOMPOSITION_DEST_OUT: - cop = CAIRO_OPERATOR_DEST_OUT; - break; - case wxCOMPOSITION_DEST_ATOP: - cop = CAIRO_OPERATOR_DEST_ATOP; - break; - case wxCOMPOSITION_XOR: - cop = CAIRO_OPERATOR_XOR; - break; - case wxCOMPOSITION_ADD: - cop = CAIRO_OPERATOR_ADD; - break; - default: - return false; - } - cairo_set_operator(m_context, cop); - return true; -} - -void wxCairoContext::BeginLayer(wxDouble opacity) -{ - m_layerOpacities.push_back(opacity); - cairo_push_group(m_context); -} - -void wxCairoContext::EndLayer() -{ - float opacity = m_layerOpacities.back(); - m_layerOpacities.pop_back(); - cairo_pop_group_to_source(m_context); - cairo_paint_with_alpha(m_context,opacity); -} - //----------------------------------------------------------------------------- // wxCairoRenderer declaration //----------------------------------------------------------------------------- @@ -2331,31 +1400,26 @@ public : // Context virtual wxGraphicsContext * CreateContext( const wxWindowDC& dc); + +#ifdef __WXMSW__ virtual wxGraphicsContext * CreateContext( const wxMemoryDC& dc); - virtual wxGraphicsContext * CreateContext( const wxPrinterDC& dc); +#endif virtual wxGraphicsContext * CreateContextFromNativeContext( void * context ); virtual wxGraphicsContext * CreateContextFromNativeWindow( void * window ); -#if wxUSE_IMAGE - virtual wxGraphicsContext * CreateContextFromImage(wxImage& image); -#endif // wxUSE_IMAGE virtual wxGraphicsContext * CreateContext( wxWindow* window ); virtual wxGraphicsContext * CreateMeasuringContext(); -#ifdef __WXMSW__ -#if wxUSE_ENH_METAFILE - virtual wxGraphicsContext * CreateContext( const wxEnhMetaFileDC& dc); -#endif -#endif + // Path virtual wxGraphicsPath CreatePath(); // Matrix - virtual wxGraphicsMatrix CreateMatrix( wxDouble a=1.0, wxDouble b=0.0, wxDouble c=0.0, wxDouble d=1.0, + virtual wxGraphicsMatrix CreateMatrix( wxDouble a=1.0, wxDouble b=0.0, wxDouble c=0.0, wxDouble d=1.0, wxDouble tx=0.0, wxDouble ty=0.0); @@ -2363,44 +1427,21 @@ public : virtual wxGraphicsBrush CreateBrush(const wxBrush& brush ) ; - virtual wxGraphicsBrush - CreateLinearGradientBrush(wxDouble x1, wxDouble y1, - wxDouble x2, wxDouble y2, - const wxGraphicsGradientStops& stops); + // sets the brush to a linear gradient, starting at (x1,y1) with color c1 to (x2,y2) with color c2 + virtual wxGraphicsBrush CreateLinearGradientBrush( wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2, + const wxColour&c1, const wxColour&c2) ; - virtual wxGraphicsBrush - CreateRadialGradientBrush(wxDouble xo, wxDouble yo, - wxDouble xc, wxDouble yc, - wxDouble radius, - const wxGraphicsGradientStops& stops); + // sets the brush to a radial gradient originating at (xo,yc) with color oColor and ends on a circle around (xc,yc) + // with radius r and color cColor + virtual wxGraphicsBrush CreateRadialGradientBrush( wxDouble xo, wxDouble yo, wxDouble xc, wxDouble yc, wxDouble radius, + const wxColour &oColor, const wxColour &cColor) ; // sets the font virtual wxGraphicsFont CreateFont( const wxFont &font , const wxColour &col = *wxBLACK ) ; - virtual wxGraphicsFont CreateFont(double sizeInPixels, - const wxString& facename, - int flags = wxFONTFLAG_DEFAULT, - const wxColour& col = *wxBLACK); + + wxGraphicsBitmap CreateBitmap( const wxBitmap &bitmap ) ; - // create a native bitmap representation - virtual wxGraphicsBitmap CreateBitmap( const wxBitmap &bitmap ); -#if wxUSE_IMAGE - virtual wxGraphicsBitmap CreateBitmapFromImage(const wxImage& image); - virtual wxImage CreateImageFromBitmap(const wxGraphicsBitmap& bmp); -#endif // wxUSE_IMAGE - - // create a graphics bitmap from a native bitmap - virtual wxGraphicsBitmap CreateBitmapFromNativeBitmap( void* bitmap ); - - // create a subimage from a native image representation - virtual wxGraphicsBitmap CreateSubBitmap( const wxGraphicsBitmap &bitmap, wxDouble x, wxDouble y, wxDouble w, wxDouble h ); - -protected : - bool EnsureIsLoaded(); - void Load(); - void Unload(); - friend class wxCairoModule; private : - int m_loaded; DECLARE_DYNAMIC_CLASS_NO_COPY(wxCairoRenderer) } ; @@ -2411,69 +1452,32 @@ private : IMPLEMENT_DYNAMIC_CLASS(wxCairoRenderer,wxGraphicsRenderer) static wxCairoRenderer gs_cairoGraphicsRenderer; -// temporary hack to allow creating a cairo context on any platform -extern wxGraphicsRenderer* gCairoRenderer; -wxGraphicsRenderer* gCairoRenderer = &gs_cairoGraphicsRenderer; -bool wxCairoRenderer::EnsureIsLoaded() +#ifdef __WXGTK__ +wxGraphicsRenderer* wxGraphicsRenderer::GetDefaultRenderer() { -#ifndef __WXGTK__ - Load(); - return wxCairoInit(); -#else - return true; + return &gs_cairoGraphicsRenderer; +} #endif -} - -void wxCairoRenderer::Load() -{ - wxCairoInit(); -} - -void wxCairoRenderer::Unload() -{ - wxCairoCleanUp(); -} - -// call EnsureIsLoaded() and return returnOnFail value if it fails -#define ENSURE_LOADED_OR_RETURN(returnOnFail) \ - if ( !EnsureIsLoaded() ) \ - return (returnOnFail) wxGraphicsContext * wxCairoRenderer::CreateContext( const wxWindowDC& dc) { - ENSURE_LOADED_OR_RETURN(NULL); return new wxCairoContext(this,dc); } -wxGraphicsContext * wxCairoRenderer::CreateContext( const wxMemoryDC& dc) -{ - ENSURE_LOADED_OR_RETURN(NULL); - return new wxCairoContext(this,dc); -} - -wxGraphicsContext * wxCairoRenderer::CreateContext( const wxPrinterDC& dc) -{ - ENSURE_LOADED_OR_RETURN(NULL); - return new wxCairoContext(this, dc); -} - #ifdef __WXMSW__ -#if wxUSE_ENH_METAFILE -wxGraphicsContext * wxCairoRenderer::CreateContext( const wxEnhMetaFileDC& WXUNUSED(dc) ) +wxGraphicsContext * wxCairoRenderer::CreateContext( const wxMemoryDC& dc) { - ENSURE_LOADED_OR_RETURN(NULL); return NULL; } #endif -#endif wxGraphicsContext * wxCairoRenderer::CreateContextFromNativeContext( void * context ) { - ENSURE_LOADED_OR_RETURN(NULL); -#ifdef __WXMSW__ +#if __WXMSW__ return new wxCairoContext(this,(HDC)context); -#else +#endif +#if __WXGTK__ return new wxCairoContext(this,(cairo_t*)context); #endif } @@ -2481,36 +1485,24 @@ wxGraphicsContext * wxCairoRenderer::CreateContextFromNativeContext( void * cont wxGraphicsContext * wxCairoRenderer::CreateContextFromNativeWindow( void * window ) { - ENSURE_LOADED_OR_RETURN(NULL); #ifdef __WXGTK__ - return new wxCairoContext(this, static_cast(window)); + return new wxCairoContext(this,(GdkDrawable*)window); #else - wxUnusedVar(window); return NULL; #endif } -#if wxUSE_IMAGE -wxGraphicsContext * wxCairoRenderer::CreateContextFromImage(wxImage& image) -{ - return new wxCairoImageContext(this, image); -} -#endif // wxUSE_IMAGE - wxGraphicsContext * wxCairoRenderer::CreateMeasuringContext() { - ENSURE_LOADED_OR_RETURN(NULL); #ifdef __WXGTK__ return CreateContextFromNativeWindow(gdk_get_default_root_window()); -#else +#endif return NULL; // TODO -#endif } wxGraphicsContext * wxCairoRenderer::CreateContext( wxWindow* window ) { - ENSURE_LOADED_OR_RETURN(NULL); return new wxCairoContext(this, window ); } @@ -2518,7 +1510,6 @@ wxGraphicsContext * wxCairoRenderer::CreateContext( wxWindow* window ) wxGraphicsPath wxCairoRenderer::CreatePath() { - ENSURE_LOADED_OR_RETURN(wxNullGraphicsPath); wxGraphicsPath path; path.SetRefData( new wxCairoPathData(this) ); return path; @@ -2527,11 +1518,10 @@ wxGraphicsPath wxCairoRenderer::CreatePath() // Matrix -wxGraphicsMatrix wxCairoRenderer::CreateMatrix( wxDouble a, wxDouble b, wxDouble c, wxDouble d, +wxGraphicsMatrix wxCairoRenderer::CreateMatrix( wxDouble a, wxDouble b, wxDouble c, wxDouble d, wxDouble tx, wxDouble ty) { - ENSURE_LOADED_OR_RETURN(wxNullGraphicsMatrix); wxGraphicsMatrix m; wxCairoMatrixData* data = new wxCairoMatrixData( this ); data->Set( a,b,c,d,tx,ty ) ; @@ -2539,10 +1529,9 @@ wxGraphicsMatrix wxCairoRenderer::CreateMatrix( wxDouble a, wxDouble b, wxDouble return m; } -wxGraphicsPen wxCairoRenderer::CreatePen(const wxPen& pen) +wxGraphicsPen wxCairoRenderer::CreatePen(const wxPen& pen) { - ENSURE_LOADED_OR_RETURN(wxNullGraphicsPen); - if ( !pen.IsOk() || pen.GetStyle() == wxPENSTYLE_TRANSPARENT ) + if ( !pen.Ok() || pen.GetStyle() == wxTRANSPARENT ) return wxNullGraphicsPen; else { @@ -2552,10 +1541,9 @@ wxGraphicsPen wxCairoRenderer::CreatePen(const wxPen& pen) } } -wxGraphicsBrush wxCairoRenderer::CreateBrush(const wxBrush& brush ) +wxGraphicsBrush wxCairoRenderer::CreateBrush(const wxBrush& brush ) { - ENSURE_LOADED_OR_RETURN(wxNullGraphicsBrush); - if ( !brush.IsOk() || brush.GetStyle() == wxBRUSHSTYLE_TRANSPARENT ) + if ( !brush.Ok() || brush.GetStyle() == wxTRANSPARENT ) return wxNullGraphicsBrush; else { @@ -2565,37 +1553,34 @@ wxGraphicsBrush wxCairoRenderer::CreateBrush(const wxBrush& brush ) } } -wxGraphicsBrush -wxCairoRenderer::CreateLinearGradientBrush(wxDouble x1, wxDouble y1, - wxDouble x2, wxDouble y2, - const wxGraphicsGradientStops& stops) +// sets the brush to a linear gradient, starting at (x1,y1) with color c1 to (x2,y2) with color c2 +wxGraphicsBrush wxCairoRenderer::CreateLinearGradientBrush( wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2, + const wxColour&c1, const wxColour&c2) { - ENSURE_LOADED_OR_RETURN(wxNullGraphicsBrush); wxGraphicsBrush p; wxCairoBrushData* d = new wxCairoBrushData( this ); - d->CreateLinearGradientBrush(x1, y1, x2, y2, stops); + d->CreateLinearGradientBrush(x1, y1, x2, y2, c1, c2); p.SetRefData(d); return p; } -wxGraphicsBrush -wxCairoRenderer::CreateRadialGradientBrush(wxDouble xo, wxDouble yo, - wxDouble xc, wxDouble yc, wxDouble r, - const wxGraphicsGradientStops& stops) +// sets the brush to a radial gradient originating at (xo,yc) with color oColor and ends on a circle around (xc,yc) +// with radius r and color cColor +wxGraphicsBrush wxCairoRenderer::CreateRadialGradientBrush( wxDouble xo, wxDouble yo, wxDouble xc, wxDouble yc, wxDouble radius, + const wxColour &oColor, const wxColour &cColor) { - ENSURE_LOADED_OR_RETURN(wxNullGraphicsBrush); wxGraphicsBrush p; wxCairoBrushData* d = new wxCairoBrushData( this ); - d->CreateRadialGradientBrush(xo, yo, xc, yc, r, stops); + d->CreateRadialGradientBrush(xo,yo,xc,yc,radius,oColor,cColor); p.SetRefData(d); return p; } -wxGraphicsFont wxCairoRenderer::CreateFont( const wxFont &font , const wxColour &col ) +// sets the font +wxGraphicsFont wxCairoRenderer::CreateFont( const wxFont &font , const wxColour &col ) { - ENSURE_LOADED_OR_RETURN(wxNullGraphicsFont); - if ( font.IsOk() ) - { + if ( font.Ok() ) + { wxGraphicsFont p; p.SetRefData(new wxCairoFontData( this , font, col )); return p; @@ -2604,23 +1589,9 @@ wxGraphicsFont wxCairoRenderer::CreateFont( const wxFont &font , const wxColour return wxNullGraphicsFont; } -wxGraphicsFont -wxCairoRenderer::CreateFont(double sizeInPixels, - const wxString& facename, - int flags, - const wxColour& col) +wxGraphicsBitmap wxGraphicsRenderer::CreateBitmap( const wxBitmap& bmp ) { - ENSURE_LOADED_OR_RETURN(wxNullGraphicsFont); - - wxGraphicsFont font; - font.SetRefData(new wxCairoFontData(this, sizeInPixels, facename, flags, col)); - return font; -} - -wxGraphicsBitmap wxCairoRenderer::CreateBitmap( const wxBitmap& bmp ) -{ - ENSURE_LOADED_OR_RETURN(wxNullGraphicsBitmap); - if ( bmp.IsOk() ) + if ( bmp.Ok() ) { wxGraphicsBitmap p; p.SetRefData(new wxCairoBitmapData( this , bmp )); @@ -2630,81 +1601,15 @@ wxGraphicsBitmap wxCairoRenderer::CreateBitmap( const wxBitmap& bmp ) return wxNullGraphicsBitmap; } -#if wxUSE_IMAGE - -wxGraphicsBitmap wxCairoRenderer::CreateBitmapFromImage(const wxImage& image) -{ - wxGraphicsBitmap bmp; - - ENSURE_LOADED_OR_RETURN(bmp); - - if ( image.IsOk() ) - { - bmp.SetRefData(new wxCairoBitmapData(this, image)); - } - - return bmp; -} - -wxImage wxCairoRenderer::CreateImageFromBitmap(const wxGraphicsBitmap& bmp) -{ - ENSURE_LOADED_OR_RETURN(wxNullImage); - - const wxCairoBitmapData* const - data = static_cast(bmp.GetGraphicsData()); - - return data ? data->ConvertToImage() : wxNullImage; -} - -#endif // wxUSE_IMAGE - - -wxGraphicsBitmap wxCairoRenderer::CreateBitmapFromNativeBitmap( void* bitmap ) -{ - ENSURE_LOADED_OR_RETURN(wxNullGraphicsBitmap); - if ( bitmap != NULL ) - { - wxGraphicsBitmap p; - p.SetRefData(new wxCairoBitmapData( this , (cairo_surface_t*) bitmap )); - return p; - } - else - return wxNullGraphicsBitmap; -} - -wxGraphicsBitmap -wxCairoRenderer::CreateSubBitmap(const wxGraphicsBitmap& WXUNUSED(bitmap), - wxDouble WXUNUSED(x), - wxDouble WXUNUSED(y), - wxDouble WXUNUSED(w), - wxDouble WXUNUSED(h)) -{ - ENSURE_LOADED_OR_RETURN(wxNullGraphicsBitmap); - wxFAIL_MSG("wxCairoRenderer::CreateSubBitmap is not implemented."); - return wxNullGraphicsBitmap; -} +#endif // wxUSE_CAIRO wxGraphicsRenderer* wxGraphicsRenderer::GetCairoRenderer() { +#if wxUSE_CAIRO return &gs_cairoGraphicsRenderer; -} - -#else // !wxUSE_CAIRO - -wxGraphicsRenderer* wxGraphicsRenderer::GetCairoRenderer() -{ +#else return NULL; +#endif } -#endif // wxUSE_CAIRO/!wxUSE_CAIRO - -// MSW and OS X have their own native default renderers, but the other ports -// use Cairo by default -#if !(defined(__WXMSW__) || defined(__WXOSX__)) -wxGraphicsRenderer* wxGraphicsRenderer::GetDefaultRenderer() -{ - return GetCairoRenderer(); -} -#endif // !(__WXMSW__ || __WXOSX__) - #endif // wxUSE_GRAPHICS_CONTEXT diff --git a/Source/3rd Party/wx/src/generic/headerctrlg.cpp b/Source/3rd Party/wx/src/generic/headerctrlg.cpp deleted file mode 100644 index 0529a6ace..000000000 --- a/Source/3rd Party/wx/src/generic/headerctrlg.cpp +++ /dev/null @@ -1,721 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/generic/headerctrlg.cpp -// Purpose: generic wxHeaderCtrl implementation -// Author: Vadim Zeitlin -// Created: 2008-12-03 -// RCS-ID: $Id$ -// Copyright: (c) 2008 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// for compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_HEADERCTRL - -#include "wx/headerctrl.h" - -#ifdef wxHAS_GENERIC_HEADERCTRL - -#include "wx/dcbuffer.h" -#include "wx/renderer.h" - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -namespace -{ - -const unsigned COL_NONE = (unsigned)-1; - -} // anonymous namespace - -// ============================================================================ -// wxHeaderCtrl implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxHeaderCtrl creation -// ---------------------------------------------------------------------------- - -void wxHeaderCtrl::Init() -{ - m_numColumns = 0; - m_hover = - m_colBeingResized = - m_colBeingReordered = COL_NONE; - m_dragOffset = 0; - m_scrollOffset = 0; -} - -bool wxHeaderCtrl::Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos, - const wxSize& size, - long style, - const wxString& name) -{ - if ( !wxHeaderCtrlBase::Create(parent, id, pos, size, - style, wxDefaultValidator, name) ) - return false; - - // tell the system to not paint the background at all to avoid flicker as - // we paint the entire window area in our OnPaint() - SetBackgroundStyle(wxBG_STYLE_CUSTOM); - - return true; -} - -wxHeaderCtrl::~wxHeaderCtrl() -{ -} - -// ---------------------------------------------------------------------------- -// wxHeaderCtrl columns manipulation -// ---------------------------------------------------------------------------- - -void wxHeaderCtrl::DoSetCount(unsigned int count) -{ - // update the column indices order array before changing m_numColumns - DoResizeColumnIndices(m_colIndices, count); - - m_numColumns = count; - - InvalidateBestSize(); - Refresh(); -} - -unsigned int wxHeaderCtrl::DoGetCount() const -{ - return m_numColumns; -} - -void wxHeaderCtrl::DoUpdate(unsigned int idx) -{ - InvalidateBestSize(); - - // we need to refresh not only this column but also the ones after it in - // case it was shown or hidden or its width changed -- it would be nice to - // avoid doing this unnecessary by storing the old column width (TODO) - RefreshColsAfter(idx); -} - -// ---------------------------------------------------------------------------- -// wxHeaderCtrl scrolling -// ---------------------------------------------------------------------------- - -void wxHeaderCtrl::DoScrollHorz(int dx) -{ - m_scrollOffset += dx; - - // don't call our own version which calls this function! - wxControl::ScrollWindow(dx, 0); -} - -// ---------------------------------------------------------------------------- -// wxHeaderCtrl geometry -// ---------------------------------------------------------------------------- - -wxSize wxHeaderCtrl::DoGetBestSize() const -{ - wxWindow *win = GetParent(); - int height = wxRendererNative::Get().GetHeaderButtonHeight( win ); - - // the vertical size is rather arbitrary but it looks better if we leave - // some space around the text - const wxSize size(IsEmpty() ? wxHeaderCtrlBase::DoGetBestSize().x - : GetColEnd(GetColumnCount() - 1), - height ); // (7*GetCharHeight())/4); - CacheBestSize(size); - return size; -} - -int wxHeaderCtrl::GetColStart(unsigned int idx) const -{ - int pos = m_scrollOffset; - for ( unsigned n = 0; ; n++ ) - { - const unsigned i = m_colIndices[n]; - if ( i == idx ) - break; - - const wxHeaderColumn& col = GetColumn(i); - if ( col.IsShown() ) - pos += col.GetWidth(); - } - - return pos; -} - -int wxHeaderCtrl::GetColEnd(unsigned int idx) const -{ - int x = GetColStart(idx); - - return x + GetColumn(idx).GetWidth(); -} - -unsigned int wxHeaderCtrl::FindColumnAtPoint(int x, bool *onSeparator) const -{ - int pos = 0; - const unsigned count = GetColumnCount(); - for ( unsigned n = 0; n < count; n++ ) - { - const unsigned idx = m_colIndices[n]; - const wxHeaderColumn& col = GetColumn(idx); - if ( col.IsHidden() ) - continue; - - pos += col.GetWidth(); - - // if the column is resizable, check if we're approximatively over the - // line separating it from the next column - // - // TODO: don't hardcode sensitivity - if ( col.IsResizeable() && abs(x - pos) < 8 ) - { - if ( onSeparator ) - *onSeparator = true; - return idx; - } - - // inside this column? - if ( x < pos ) - { - if ( onSeparator ) - *onSeparator = false; - return idx; - } - } - - if ( onSeparator ) - *onSeparator = false; - return COL_NONE; -} - -// ---------------------------------------------------------------------------- -// wxHeaderCtrl repainting -// ---------------------------------------------------------------------------- - -void wxHeaderCtrl::RefreshCol(unsigned int idx) -{ - wxRect rect = GetClientRect(); - rect.x += GetColStart(idx); - rect.width = GetColumn(idx).GetWidth(); - - RefreshRect(rect); -} - -void wxHeaderCtrl::RefreshColIfNotNone(unsigned int idx) -{ - if ( idx != COL_NONE ) - RefreshCol(idx); -} - -void wxHeaderCtrl::RefreshColsAfter(unsigned int idx) -{ - wxRect rect = GetClientRect(); - const int ofs = GetColStart(idx); - rect.x += ofs; - rect.width -= ofs; - - RefreshRect(rect); -} - -// ---------------------------------------------------------------------------- -// wxHeaderCtrl dragging/resizing/reordering -// ---------------------------------------------------------------------------- - -bool wxHeaderCtrl::IsResizing() const -{ - return m_colBeingResized != COL_NONE; -} - -bool wxHeaderCtrl::IsReordering() const -{ - return m_colBeingReordered != COL_NONE; -} - -void wxHeaderCtrl::ClearMarkers() -{ - wxClientDC dc(this); - - wxDCOverlay dcover(m_overlay, &dc); - dcover.Clear(); -} - -void wxHeaderCtrl::EndDragging() -{ - // We currently only use markers for reordering, not for resizing - if (IsReordering()) - { - ClearMarkers(); - m_overlay.Reset(); - } - - // don't use the special dragging cursor any more - SetCursor(wxNullCursor); -} - -void wxHeaderCtrl::CancelDragging() -{ - wxASSERT_MSG( IsDragging(), - "shouldn't be called if we're not dragging anything" ); - - EndDragging(); - - unsigned int& col = IsResizing() ? m_colBeingResized : m_colBeingReordered; - - wxHeaderCtrlEvent event(wxEVT_COMMAND_HEADER_DRAGGING_CANCELLED, GetId()); - event.SetEventObject(this); - event.SetColumn(col); - - GetEventHandler()->ProcessEvent(event); - - col = COL_NONE; -} - -int wxHeaderCtrl::ConstrainByMinWidth(unsigned int col, int& xPhysical) -{ - const int xStart = GetColStart(col); - - // notice that GetMinWidth() returns 0 if there is no minimal width so it - // still makes sense to use it even in this case - const int xMinEnd = xStart + GetColumn(col).GetMinWidth(); - - if ( xPhysical < xMinEnd ) - xPhysical = xMinEnd; - - return xPhysical - xStart; -} - -void wxHeaderCtrl::StartOrContinueResizing(unsigned int col, int xPhysical) -{ - wxHeaderCtrlEvent event(IsResizing() ? wxEVT_COMMAND_HEADER_RESIZING - : wxEVT_COMMAND_HEADER_BEGIN_RESIZE, - GetId()); - event.SetEventObject(this); - event.SetColumn(col); - - event.SetWidth(ConstrainByMinWidth(col, xPhysical)); - - if ( GetEventHandler()->ProcessEvent(event) && !event.IsAllowed() ) - { - if ( IsResizing() ) - { - ReleaseMouse(); - CancelDragging(); - } - //else: nothing to do -- we just don't start to resize - } - else // go ahead with resizing - { - if ( !IsResizing() ) - { - m_colBeingResized = col; - SetCursor(wxCursor(wxCURSOR_SIZEWE)); - CaptureMouse(); - } - //else: we had already done the above when we started - - } -} - -void wxHeaderCtrl::EndResizing(int xPhysical) -{ - wxASSERT_MSG( IsResizing(), "shouldn't be called if we're not resizing" ); - - EndDragging(); - - ReleaseMouse(); - - wxHeaderCtrlEvent event(wxEVT_COMMAND_HEADER_END_RESIZE, GetId()); - event.SetEventObject(this); - event.SetColumn(m_colBeingResized); - event.SetWidth(ConstrainByMinWidth(m_colBeingResized, xPhysical)); - - GetEventHandler()->ProcessEvent(event); - - m_colBeingResized = COL_NONE; -} - -void wxHeaderCtrl::UpdateReorderingMarker(int xPhysical) -{ - wxClientDC dc(this); - - wxDCOverlay dcover(m_overlay, &dc); - dcover.Clear(); - - dc.SetPen(*wxBLUE); - dc.SetBrush(*wxTRANSPARENT_BRUSH); - - // draw the phantom position of the column being dragged - int x = xPhysical - m_dragOffset; - int y = GetClientSize().y; - dc.DrawRectangle(x, 0, - GetColumn(m_colBeingReordered).GetWidth(), y); - - // and also a hint indicating where it is going to be inserted if it's - // dropped now - unsigned int col = FindColumnAtPoint(xPhysical); - if ( col != COL_NONE ) - { - static const int DROP_MARKER_WIDTH = 4; - - dc.SetBrush(*wxBLUE); - dc.DrawRectangle(GetColEnd(col) - DROP_MARKER_WIDTH/2, 0, - DROP_MARKER_WIDTH, y); - } -} - -void wxHeaderCtrl::StartReordering(unsigned int col, int xPhysical) -{ - wxHeaderCtrlEvent event(wxEVT_COMMAND_HEADER_BEGIN_REORDER, GetId()); - event.SetEventObject(this); - event.SetColumn(col); - - if ( GetEventHandler()->ProcessEvent(event) && !event.IsAllowed() ) - { - // don't start dragging it, nothing to do otherwise - return; - } - - m_dragOffset = xPhysical - GetColStart(col); - - m_colBeingReordered = col; - SetCursor(wxCursor(wxCURSOR_HAND)); - CaptureMouse(); - - // do not call UpdateReorderingMarker() here: we don't want to give - // feedback for reordering until the user starts to really move the mouse - // as he might want to just click on the column and not move it at all -} - -bool wxHeaderCtrl::EndReordering(int xPhysical) -{ - wxASSERT_MSG( IsReordering(), "shouldn't be called if we're not reordering" ); - - EndDragging(); - - ReleaseMouse(); - - const int colOld = m_colBeingReordered, - colNew = FindColumnAtPoint(xPhysical); - - m_colBeingReordered = COL_NONE; - - if ( xPhysical - GetColStart(colOld) == m_dragOffset ) - return false; - - if ( colNew != colOld ) - { - wxHeaderCtrlEvent event(wxEVT_COMMAND_HEADER_END_REORDER, GetId()); - event.SetEventObject(this); - event.SetColumn(colOld); - - const unsigned pos = GetColumnPos(FindColumnAtPoint(xPhysical)); - event.SetNewOrder(pos); - - if ( !GetEventHandler()->ProcessEvent(event) || event.IsAllowed() ) - { - // do reorder the columns - DoMoveCol(colOld, pos); - } - } - - // whether we moved the column or not, the user did move the mouse and so - // did try to do it so return true - return true; -} - -// ---------------------------------------------------------------------------- -// wxHeaderCtrl column reordering -// ---------------------------------------------------------------------------- - -void wxHeaderCtrl::DoSetColumnsOrder(const wxArrayInt& order) -{ - m_colIndices = order; - Refresh(); -} - -wxArrayInt wxHeaderCtrl::DoGetColumnsOrder() const -{ - return m_colIndices; -} - -void wxHeaderCtrl::DoMoveCol(unsigned int idx, unsigned int pos) -{ - MoveColumnInOrderArray(m_colIndices, idx, pos); - - Refresh(); -} - -// ---------------------------------------------------------------------------- -// wxHeaderCtrl event handlers -// ---------------------------------------------------------------------------- - -BEGIN_EVENT_TABLE(wxHeaderCtrl, wxHeaderCtrlBase) - EVT_PAINT(wxHeaderCtrl::OnPaint) - - EVT_MOUSE_EVENTS(wxHeaderCtrl::OnMouse) - - EVT_MOUSE_CAPTURE_LOST(wxHeaderCtrl::OnCaptureLost) - - EVT_KEY_DOWN(wxHeaderCtrl::OnKeyDown) -END_EVENT_TABLE() - -void wxHeaderCtrl::OnPaint(wxPaintEvent& WXUNUSED(event)) -{ - int w, h; - GetClientSize(&w, &h); - -#ifdef __WXGTK__ -// int vw; -// GetVirtualSize(&vw, NULL); -#endif - - wxAutoBufferedPaintDC dc(this); - - dc.SetBackground(GetBackgroundColour()); - dc.Clear(); - - // account for the horizontal scrollbar offset in the parent window - dc.SetDeviceOrigin(m_scrollOffset, 0); - - const unsigned int count = m_numColumns; - int xpos = 0; - for ( unsigned int i = 0; i < count; i++ ) - { - const unsigned idx = m_colIndices[i]; - const wxHeaderColumn& col = GetColumn(idx); - if ( col.IsHidden() ) - continue; - - int colWidth = col.GetWidth(); - - wxHeaderSortIconType sortArrow; - if ( col.IsSortKey() ) - { - sortArrow = col.IsSortOrderAscending() ? wxHDR_SORT_ICON_UP - : wxHDR_SORT_ICON_DOWN; - } - else // not sorting by this column - { - sortArrow = wxHDR_SORT_ICON_NONE; - } - - int state = 0; - if ( IsEnabled() ) - { - if ( idx == m_hover ) - state = wxCONTROL_CURRENT; - } - else // disabled - { - state = wxCONTROL_DISABLED; - } - - if (i == 0) - state |= wxCONTROL_SPECIAL; - - wxHeaderButtonParams params; - params.m_labelText = col.GetTitle(); - params.m_labelBitmap = col.GetBitmap(); - params.m_labelAlignment = col.GetAlignment(); - -#ifdef __WXGTK__ - if (i == count-1) - { -// colWidth = wxMax( colWidth, vw - xpos ); - state |= wxCONTROL_DIRTY; - } -#endif - - wxRendererNative::Get().DrawHeaderButton - ( - this, - dc, - wxRect(xpos, 0, colWidth, h), - state, - sortArrow, - ¶ms - ); - - xpos += colWidth; - } -} - -void wxHeaderCtrl::OnCaptureLost(wxMouseCaptureLostEvent& WXUNUSED(event)) -{ - if ( IsDragging() ) - CancelDragging(); -} - -void wxHeaderCtrl::OnKeyDown(wxKeyEvent& event) -{ - if ( event.GetKeyCode() == WXK_ESCAPE ) - { - if ( IsDragging() ) - { - ReleaseMouse(); - CancelDragging(); - - return; - } - } - - event.Skip(); -} - -void wxHeaderCtrl::OnMouse(wxMouseEvent& mevent) -{ - // do this in advance to allow simply returning if we're not interested, - // we'll undo it if we do handle the event below - mevent.Skip(); - - - // account for the control displacement - const int xPhysical = mevent.GetX(); - const int xLogical = xPhysical - m_scrollOffset; - - // first deal with the [continuation of any] dragging operations in - // progress - if ( IsResizing() ) - { - if ( mevent.LeftUp() ) - EndResizing(xPhysical); - else // update the live separator position - StartOrContinueResizing(m_colBeingResized, xPhysical); - - return; - } - - if ( IsReordering() ) - { - if ( !mevent.LeftUp() ) - { - // update the column position - UpdateReorderingMarker(xPhysical); - - return; - } - - // finish reordering and continue to generate a click event below if we - // didn't really reorder anything - if ( EndReordering(xPhysical) ) - return; - } - - - // find if the event is over a column at all - bool onSeparator; - const unsigned col = mevent.Leaving() - ? (onSeparator = false, COL_NONE) - : FindColumnAtPoint(xLogical, &onSeparator); - - - // update the highlighted column if it changed - if ( col != m_hover ) - { - const unsigned hoverOld = m_hover; - m_hover = col; - - RefreshColIfNotNone(hoverOld); - RefreshColIfNotNone(m_hover); - } - - // update mouse cursor as it moves around - if ( mevent.Moving() ) - { - SetCursor(onSeparator ? wxCursor(wxCURSOR_SIZEWE) : wxNullCursor); - return; - } - - // all the other events only make sense when they happen over a column - if ( col == COL_NONE ) - return; - - - // enter various dragging modes on left mouse press - if ( mevent.LeftDown() ) - { - if ( onSeparator ) - { - // start resizing the column - wxASSERT_MSG( !IsResizing(), "reentering column resize mode?" ); - StartOrContinueResizing(col, xPhysical); - } - else // on column itself - { - // start dragging the column - wxASSERT_MSG( !IsReordering(), "reentering column move mode?" ); - - StartReordering(col, xPhysical); - } - - return; - } - - // determine the type of header event corresponding to click events - wxEventType evtType = wxEVT_NULL; - const bool click = mevent.ButtonUp(), - dblclk = mevent.ButtonDClick(); - if ( click || dblclk ) - { - switch ( mevent.GetButton() ) - { - case wxMOUSE_BTN_LEFT: - // treat left double clicks on separator specially - if ( onSeparator && dblclk ) - { - evtType = wxEVT_COMMAND_HEADER_SEPARATOR_DCLICK; - } - else // not double click on separator - { - evtType = click ? wxEVT_COMMAND_HEADER_CLICK - : wxEVT_COMMAND_HEADER_DCLICK; - } - break; - - case wxMOUSE_BTN_RIGHT: - evtType = click ? wxEVT_COMMAND_HEADER_RIGHT_CLICK - : wxEVT_COMMAND_HEADER_RIGHT_DCLICK; - break; - - case wxMOUSE_BTN_MIDDLE: - evtType = click ? wxEVT_COMMAND_HEADER_MIDDLE_CLICK - : wxEVT_COMMAND_HEADER_MIDDLE_DCLICK; - break; - - default: - // ignore clicks from other mouse buttons - ; - } - } - - if ( evtType == wxEVT_NULL ) - return; - - wxHeaderCtrlEvent event(evtType, GetId()); - event.SetEventObject(this); - event.SetColumn(col); - - if ( GetEventHandler()->ProcessEvent(event) ) - mevent.Skip(false); -} - -#endif // wxHAS_GENERIC_HEADERCTRL - -#endif // wxUSE_HEADERCTRL diff --git a/Source/3rd Party/wx/src/generic/infobar.cpp b/Source/3rd Party/wx/src/generic/infobar.cpp deleted file mode 100644 index 40d194dbe..000000000 --- a/Source/3rd Party/wx/src/generic/infobar.cpp +++ /dev/null @@ -1,374 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/generic/infobar.cpp -// Purpose: generic wxInfoBar implementation -// Author: Vadim Zeitlin -// Created: 2009-07-28 -// RCS-ID: $Id$ -// Copyright: (c) 2009 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// for compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_INFOBAR - -#include "wx/infobar.h" - -#ifndef WX_PRECOMP - #include "wx/bmpbuttn.h" - #include "wx/button.h" - #include "wx/dcmemory.h" - #include "wx/settings.h" - #include "wx/statbmp.h" - #include "wx/stattext.h" - #include "wx/sizer.h" -#endif // WX_PRECOMP - -#include "wx/artprov.h" -#include "wx/renderer.h" -#include "wx/scopeguard.h" - -BEGIN_EVENT_TABLE(wxInfoBarGeneric, wxInfoBarBase) - EVT_BUTTON(wxID_ANY, wxInfoBarGeneric::OnButton) -END_EVENT_TABLE() - -// ---------------------------------------------------------------------------- -// local helpers -// ---------------------------------------------------------------------------- - -namespace -{ - -#ifdef wxHAS_DRAW_TITLE_BAR_BITMAP - -wxBitmap -GetCloseButtonBitmap(wxWindow *win, - const wxSize& size, - const wxColour& colBg, - int flags = 0) -{ - wxBitmap bmp(size); - wxMemoryDC dc(bmp); - dc.SetBackground(colBg); - dc.Clear(); - wxRendererNative::Get(). - DrawTitleBarBitmap(win, dc, size, wxTITLEBAR_BUTTON_CLOSE, flags); - return bmp; -} - -#endif // wxHAS_DRAW_TITLE_BAR_BITMAP - -} // anonymous namespace - -// ============================================================================ -// implementation -// ============================================================================ - -void wxInfoBarGeneric::Init() -{ - m_icon = NULL; - m_text = NULL; - m_button = NULL; - - m_showEffect = - m_hideEffect = wxSHOW_EFFECT_MAX; - - // use default effect duration - m_effectDuration = 0; -} - -bool wxInfoBarGeneric::Create(wxWindow *parent, wxWindowID winid) -{ - // calling Hide() before Create() ensures that we're created initially - // hidden - Hide(); - if ( !wxWindow::Create(parent, winid) ) - return false; - - // use special, easy to notice, colours - const wxColour colBg = wxSystemSettings::GetColour(wxSYS_COLOUR_INFOBK); - SetBackgroundColour(colBg); - SetOwnForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_INFOTEXT)); - - // create the controls: icon, text and the button to dismiss the - // message. - - // the icon is not shown unless it's assigned a valid bitmap - m_icon = new wxStaticBitmap(this, wxID_ANY, wxNullBitmap); - - m_text = new wxStaticText(this, wxID_ANY, ""); - -#ifdef wxHAS_DRAW_TITLE_BAR_BITMAP - const wxSize sizeBmp = wxArtProvider::GetSizeHint(wxART_BUTTON); - wxBitmap bmp = GetCloseButtonBitmap(this, sizeBmp, colBg); -#else // !wxHAS_DRAW_TITLE_BAR_BITMAP - wxBitmap bmp = wxArtProvider::GetBitmap(wxART_CLOSE, wxART_BUTTON); -#endif // wxHAS_DRAW_TITLE_BAR_BITMAP - m_button = new wxBitmapButton - ( - this, - wxID_ANY, - bmp, - wxDefaultPosition, - wxDefaultSize, - wxBORDER_NONE - ); - -#ifdef wxHAS_DRAW_TITLE_BAR_BITMAP - m_button->SetBitmapPressed( - GetCloseButtonBitmap(this, sizeBmp, colBg, wxCONTROL_PRESSED)); - - m_button->SetBitmapCurrent( - GetCloseButtonBitmap(this, sizeBmp, colBg, wxCONTROL_CURRENT)); -#endif // wxHAS_DRAW_TITLE_BAR_BITMAP - - m_button->SetBackgroundColour(colBg); - m_button->SetToolTip(_("Hide this notification message.")); - - // center the text inside the sizer with an icon to the left of it and a - // button at the very right - // - // NB: AddButton() relies on the button being the last control in the sizer - // and being preceded by a spacer - wxSizer * const sizer = new wxBoxSizer(wxHORIZONTAL); - sizer->Add(m_icon, wxSizerFlags().Centre().Border()); - sizer->Add(m_text, wxSizerFlags().Centre()); - sizer->AddStretchSpacer(); - sizer->Add(m_button, wxSizerFlags().Centre().Border()); - SetSizer(sizer); - - return true; -} - -bool wxInfoBarGeneric::SetFont(const wxFont& font) -{ - if ( !wxInfoBarBase::SetFont(font) ) - return false; - - // check that we're not called before Create() - if ( m_text ) - m_text->SetFont(font); - - return true; -} - -wxInfoBarGeneric::BarPlacement wxInfoBarGeneric::GetBarPlacement() const -{ - wxSizer * const sizer = GetContainingSizer(); - if ( !sizer ) - return BarPlacement_Unknown; - - // FIXME-VC6: can't compare "const wxInfoBarGeneric *" and "wxWindow *", - // so need this workaround - wxWindow * const self = const_cast(this); - const wxSizerItemList& siblings = sizer->GetChildren(); - if ( siblings.GetFirst()->GetData()->GetWindow() == self ) - return BarPlacement_Top; - else if ( siblings.GetLast()->GetData()->GetWindow() == self ) - return BarPlacement_Bottom; - else - return BarPlacement_Unknown; -} - -wxShowEffect wxInfoBarGeneric::GetShowEffect() const -{ - if ( m_showEffect != wxSHOW_EFFECT_MAX ) - return m_showEffect; - - switch ( GetBarPlacement() ) - { - case BarPlacement_Top: - return wxSHOW_EFFECT_SLIDE_TO_BOTTOM; - - case BarPlacement_Bottom: - return wxSHOW_EFFECT_SLIDE_TO_TOP; - - default: - wxFAIL_MSG( "unknown info bar placement" ); - // fall through - - case BarPlacement_Unknown: - return wxSHOW_EFFECT_NONE; - } -} - -wxShowEffect wxInfoBarGeneric::GetHideEffect() const -{ - if ( m_hideEffect != wxSHOW_EFFECT_MAX ) - return m_hideEffect; - - switch ( GetBarPlacement() ) - { - case BarPlacement_Top: - return wxSHOW_EFFECT_SLIDE_TO_TOP; - - case BarPlacement_Bottom: - return wxSHOW_EFFECT_SLIDE_TO_BOTTOM; - - default: - wxFAIL_MSG( "unknown info bar placement" ); - // fall through - - case BarPlacement_Unknown: - return wxSHOW_EFFECT_NONE; - } -} - -void wxInfoBarGeneric::UpdateParent() -{ - wxWindow * const parent = GetParent(); - parent->Layout(); -} - -void wxInfoBarGeneric::DoHide() -{ - HideWithEffect(GetHideEffect(), GetEffectDuration()); - - UpdateParent(); -} - -void wxInfoBarGeneric::DoShow() -{ - // re-layout the parent first so that the window expands into an already - // unoccupied by the other controls area: for this we need to change our - // internal visibility flag to force Layout() to take us into account (an - // alternative solution to this hack would be to temporarily set - // wxRESERVE_SPACE_EVEN_IF_HIDDEN flag but it's not really batter) - - // just change the internal flag indicating that the window is visible, - // without really showing it - wxWindowBase::Show(); - - // adjust the parent layout to account for us - UpdateParent(); - - // reset the flag back before really showing the window or it wouldn't be - // shown at all because it would believe itself already visible - wxWindowBase::Show(false); - - - // finally do really show the window. - ShowWithEffect(GetShowEffect(), GetEffectDuration()); -} - -void wxInfoBarGeneric::ShowMessage(const wxString& msg, int flags) -{ - // first update the controls - const int icon = flags & wxICON_MASK; - if ( !icon || (icon == wxICON_NONE) ) - { - m_icon->Hide(); - } - else // do show an icon - { - m_icon->SetBitmap(wxArtProvider::GetBitmap( - wxArtProvider::GetMessageBoxIconId(flags), - wxART_BUTTON)); - m_icon->Show(); - } - - // notice the use of EscapeMnemonics() to ensure that "&" come through - // correctly - m_text->SetLabel(wxControl::EscapeMnemonics(msg)); - - - // then show this entire window if not done yet - if ( !IsShown() ) - { - DoShow(); - } - else // we're already shown - { - // just update the layout to correspond to the new message - Layout(); - } -} - -void wxInfoBarGeneric::Dismiss() -{ - DoHide(); -} - -void wxInfoBarGeneric::AddButton(wxWindowID btnid, const wxString& label) -{ - wxSizer * const sizer = GetSizer(); - wxCHECK_RET( sizer, "must be created first" ); - - // user-added buttons replace the standard close button so remove it if we - // hadn't done it yet - if ( sizer->Detach(m_button) ) - { - m_button->Hide(); - } - - wxButton * const button = new wxButton(this, btnid, label); - -#ifdef __WXMAC__ - // smaller buttons look better in the (narrow) info bar under OS X - button->SetWindowVariant(wxWINDOW_VARIANT_SMALL); -#endif // __WXMAC__ - - sizer->Add(button, wxSizerFlags().Centre().DoubleBorder()); -} - -void wxInfoBarGeneric::RemoveButton(wxWindowID btnid) -{ - wxSizer * const sizer = GetSizer(); - wxCHECK_RET( sizer, "must be created first" ); - - // iterate over the sizer items in reverse order to find the last added - // button with this id (ids of all buttons should be unique anyhow but if - // they are repeated removing the last added one probably makes more sense) - const wxSizerItemList& items = sizer->GetChildren(); - for ( wxSizerItemList::compatibility_iterator node = items.GetLast(); - node != items.GetFirst(); - node = node->GetPrevious() ) - { - const wxSizerItem * const item = node->GetData(); - - // if we reached the spacer separating the buttons from the text - // preceding them without finding our button, it must mean it's not - // there at all - if ( item->IsSpacer() ) - { - wxFAIL_MSG( wxString::Format("button with id %d not found", btnid) ); - return; - } - - // check if we found our button - if ( item->GetWindow()->GetId() == btnid ) - { - delete item->GetWindow(); - break; - } - } - - // check if there are any custom buttons left - if ( sizer->GetChildren().GetLast()->GetData()->IsSpacer() ) - { - // if the last item is the spacer, none are left so restore the - // standard close button - sizer->Add(m_button, wxSizerFlags().Centre().DoubleBorder()); - m_button->Show(); - } -} - -void wxInfoBarGeneric::OnButton(wxCommandEvent& WXUNUSED(event)) -{ - DoHide(); -} - -#endif // wxUSE_INFOBAR diff --git a/Source/3rd Party/wx/src/generic/listbkg.cpp b/Source/3rd Party/wx/src/generic/listbkg.cpp index 0fc2ff6be..50a6ea40e 100644 --- a/Source/3rd Party/wx/src/generic/listbkg.cpp +++ b/Source/3rd Party/wx/src/generic/listbkg.cpp @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 19.08.03 -// RCS-ID: $Id$ +// RCS-ID: $Id: listbkg.cpp 48783 2007-09-19 11:24:38Z RR $ // Copyright: (c) 2003 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -36,8 +36,6 @@ #include "wx/statline.h" #include "wx/imaglist.h" -#include "wx/sysopt.h" - // ---------------------------------------------------------------------------- // various wxWidgets macros // ---------------------------------------------------------------------------- @@ -50,9 +48,12 @@ // ---------------------------------------------------------------------------- IMPLEMENT_DYNAMIC_CLASS(wxListbook, wxBookCtrlBase) +IMPLEMENT_DYNAMIC_CLASS(wxListbookEvent, wxNotifyEvent) -wxDEFINE_EVENT( wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING, wxBookCtrlEvent ); -wxDEFINE_EVENT( wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED, wxBookCtrlEvent ); +#if !WXWIN_COMPATIBILITY_EVENT_TYPES +const wxEventType wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING = wxNewEventType(); +const wxEventType wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED = wxNewEventType(); +#endif BEGIN_EVENT_TABLE(wxListbook, wxBookCtrlBase) EVT_SIZE(wxListbook::OnSize) @@ -67,6 +68,11 @@ END_EVENT_TABLE() // wxListbook creation // ---------------------------------------------------------------------------- +void wxListbook::Init() +{ + m_selection = wxNOT_FOUND; +} + bool wxListbook::Create(wxWindow *parent, wxWindowID id, @@ -99,9 +105,8 @@ wxListbook::Create(wxWindow *parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, - wxLC_SINGLE_SEL | - (IsVertical() ? wxLC_ALIGN_LEFT : wxLC_ALIGN_TOP) | - wxLC_LIST + wxLC_ICON | wxLC_SINGLE_SEL | + (IsVertical() ? wxLC_ALIGN_LEFT : wxLC_ALIGN_TOP) ); #ifdef __WXMSW__ @@ -121,6 +126,28 @@ wxListbook::Create(wxWindow *parent, // wxListbook geometry management // ---------------------------------------------------------------------------- +wxSize wxListbook::GetControllerSize() const +{ + const wxSize sizeClient = GetClientSize(), + sizeBorder = m_bookctrl->GetSize() - m_bookctrl->GetClientSize(), + sizeList = GetListView()->GetViewRect().GetSize() + sizeBorder; + + wxSize size; + + if ( IsVertical() ) + { + size.x = sizeClient.x; + size.y = sizeList.y; + } + else // left/right aligned + { + size.x = sizeList.x; + size.y = sizeClient.y; + } + + return size; +} + void wxListbook::OnSize(wxSizeEvent& event) { // arrange the icons before calling SetClientSize(), otherwise it wouldn't @@ -128,11 +155,9 @@ void wxListbook::OnSize(wxSizeEvent& event) // under MSW, we'd finish with an ugly looking list control with both // vertical and horizontal scrollbar (with one of them being added because // the other one is not accounted for in client size computations) - wxListView * const list = GetListView(); - if ( list ) - list->Arrange(); - - event.Skip(); + wxListView *list = GetListView(); + if (list) list->Arrange(); + wxBookCtrlBase::OnSize(event); } int wxListbook::HitTest(const wxPoint& pt, long *flags) const @@ -174,14 +199,25 @@ int wxListbook::HitTest(const wxPoint& pt, long *flags) const return pagePos; } -void wxListbook::UpdateSize() +wxSize wxListbook::CalcSizeFromPage(const wxSize& sizePage) const { - // we should find a more elegant way to force a layout than generating this - // dummy event - wxSizeEvent sz(GetSize(), GetId()); - GetEventHandler()->ProcessEvent(sz); + // we need to add the size of the list control and the border between + const wxSize sizeList = GetControllerSize(); + + wxSize size = sizePage; + if ( IsVertical() ) + { + size.y += sizeList.y + GetInternalBorder(); + } + else // left/right aligned + { + size.x += sizeList.x + GetInternalBorder(); + } + + return size; } + // ---------------------------------------------------------------------------- // accessing the pages // ---------------------------------------------------------------------------- @@ -198,19 +234,11 @@ wxString wxListbook::GetPageText(size_t n) const return GetListView()->GetItemText(n); } -int wxListbook::GetPageImage(size_t n) const +int wxListbook::GetPageImage(size_t WXUNUSED(n)) const { - wxListItem item; - item.SetId(n); + wxFAIL_MSG( _T("wxListbook::GetPageImage() not implemented") ); - if (GetListView()->GetItem(item)) - { - return item.GetImage(); - } - else - { - return wxNOT_FOUND; - } + return wxNOT_FOUND; } bool wxListbook::SetPageImage(size_t n, int imageId) @@ -224,33 +252,7 @@ bool wxListbook::SetPageImage(size_t n, int imageId) void wxListbook::SetImageList(wxImageList *imageList) { - wxListView * const list = GetListView(); - - // If imageList presence has changed, we update the list control style - if ( (imageList != NULL) != (GetImageList() != NULL) ) - { - // Preserve the selection which is lost when changing the mode - const int oldSel = GetSelection(); - - // Update the style to use icon view for images, list view otherwise - long style = list->GetWindowStyle() & ~wxLC_MASK_TYPE; - if ( imageList ) - { - style |= wxLC_ICON; - } - else // no image list - { - style |= wxLC_LIST; - } - - list->SetWindowStyleFlag(style); - - // Restore selection - if ( oldSel != wxNOT_FOUND ) - SetSelection(oldSel); - } - - list->SetImageList(imageList, wxIMAGE_LIST_NORMAL); + GetListView()->SetImageList(imageList, wxIMAGE_LIST_NORMAL); wxBookCtrlBase::SetImageList(imageList); } @@ -266,12 +268,17 @@ void wxListbook::UpdateSelectedPage(size_t newsel) GetListView()->Focus(newsel); } -wxBookCtrlEvent* wxListbook::CreatePageChangingEvent() const +int wxListbook::GetSelection() const { - return new wxBookCtrlEvent(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING, m_windowId); + return m_selection; } -void wxListbook::MakeChangedEvent(wxBookCtrlEvent &event) +wxBookCtrlBaseEvent* wxListbook::CreatePageChangingEvent() const +{ + return new wxListbookEvent(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING, m_windowId); +} + +void wxListbook::MakeChangedEvent(wxBookCtrlBaseEvent &event) { event.SetEventType(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED); } @@ -303,10 +310,22 @@ wxListbook::InsertPage(size_t n, GetListView()->Focus(m_selection); } - if ( !DoSetSelectionAfterInsertion(n, bSelect) ) + // some page should be selected: either this one or the first one if there + // is still no selection + int selNew = -1; + if ( bSelect ) + selNew = n; + else if ( m_selection == -1 ) + selNew = 0; + + if ( selNew != m_selection ) page->Hide(); - UpdateSize(); + if ( selNew != -1 ) + SetSelection(selNew); + + wxSizeEvent sz(GetSize(), GetId()); + GetEventHandler()->ProcessEvent(sz); return true; } @@ -326,7 +345,7 @@ wxWindow *wxListbook::DoRemovePage(size_t page) int sel = m_selection - 1; if (page_count == 1) sel = wxNOT_FOUND; - else if ((page_count == 2) || (sel == wxNOT_FOUND)) + else if ((page_count == 2) || (sel == -1)) sel = 0; // force sel invalid if deleting current page - don't try to hide it @@ -337,7 +356,11 @@ wxWindow *wxListbook::DoRemovePage(size_t page) } GetListView()->Arrange(); - UpdateSize(); + if (GetPageCount() == 0) + { + wxSizeEvent sz(GetSize(), GetId()); + ProcessEvent(sz); + } } return win; @@ -350,7 +373,10 @@ bool wxListbook::DeleteAllPages() if (!wxBookCtrlBase::DeleteAllPages()) return false; - UpdateSize(); + m_selection = -1; + + wxSizeEvent sz(GetSize(), GetId()); + ProcessEvent(sz); return true; } diff --git a/Source/3rd Party/wx/src/generic/logg.cpp b/Source/3rd Party/wx/src/generic/logg.cpp index 572cc04bc..e370dc4ea 100644 --- a/Source/3rd Party/wx/src/generic/logg.cpp +++ b/Source/3rd Party/wx/src/generic/logg.cpp @@ -5,7 +5,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 20.09.99 (extracted from src/common/log.cpp) -// RCS-ID: $Id$ +// RCS-ID: $Id: logg.cpp 43078 2006-11-04 23:46:02Z VZ $ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -38,27 +38,20 @@ #include "wx/sizer.h" #include "wx/statbmp.h" #include "wx/settings.h" - #include "wx/wxcrtvararg.h" #endif // WX_PRECOMP #if wxUSE_LOGGUI || wxUSE_LOGWINDOW #include "wx/file.h" -#include "wx/clipbrd.h" -#include "wx/dataobj.h" #include "wx/textfile.h" #include "wx/statline.h" #include "wx/artprov.h" -#include "wx/collpane.h" -#include "wx/arrstr.h" -#include "wx/msgout.h" #ifdef __WXMSW__ // for OutputDebugString() #include "wx/msw/private.h" #endif // Windows - #ifdef __WXPM__ #include #endif @@ -69,12 +62,14 @@ #include "wx/image.h" #endif // wxUSE_LOG_DIALOG/!wxUSE_LOG_DIALOG -#include "wx/time.h" +#if defined(__MWERKS__) && wxUSE_UNICODE + #include +#endif + +#include "wx/datetime.h" // the suffix we add to the button to show that the dialog can be expanded -#define EXPAND_SUFFIX wxT(" >>") - -#define CAN_SAVE_FILES (wxUSE_FILE && wxUSE_FILEDLG) +#define EXPAND_SUFFIX _T(" >>") // ---------------------------------------------------------------------------- // private classes @@ -84,16 +79,20 @@ // this function is a wrapper around strftime(3) // allows to exclude the usage of wxDateTime -static wxString TimeStamp(const wxString& format, time_t t) +static wxString TimeStamp(const wxChar *format, time_t t) { +#if wxUSE_DATETIME wxChar buf[4096]; struct tm tm; if ( !wxStrftime(buf, WXSIZEOF(buf), format, wxLocaltime_r(&t, &tm)) ) { // buffer is too small? - wxFAIL_MSG(wxT("strftime() failed")); + wxFAIL_MSG(_T("strftime() failed")); } return wxString(buf); +#else // !wxUSE_DATETIME + return wxEmptyString; +#endif // wxUSE_DATETIME/!wxUSE_DATETIME } @@ -110,67 +109,53 @@ public: // event handlers void OnOk(wxCommandEvent& event); -#if wxUSE_CLIPBOARD - void OnCopy(wxCommandEvent& event); -#endif // wxUSE_CLIPBOARD -#if CAN_SAVE_FILES + void OnDetails(wxCommandEvent& event); +#if wxUSE_FILE void OnSave(wxCommandEvent& event); -#endif // CAN_SAVE_FILES - void OnListItemActivated(wxListEvent& event); +#endif // wxUSE_FILE + void OnListSelect(wxListEvent& event); private: // create controls needed for the details display - void CreateDetailsControls(wxWindow *); - - // if necessary truncates the given string and adds an ellipsis - wxString EllipsizeString(const wxString &text) - { - if (ms_maxLength > 0 && - text.length() > ms_maxLength) - { - wxString ret(text); - ret.Truncate(ms_maxLength); - ret << "..."; - return ret; - } - - return text; - } - -#if CAN_SAVE_FILES || wxUSE_CLIPBOARD - // return the contents of the dialog as a multiline string - wxString GetLogMessages() const; -#endif // CAN_SAVE_FILES || wxUSE_CLIPBOARD - + void CreateDetailsControls(); // the data for the listctrl wxArrayString m_messages; wxArrayInt m_severity; wxArrayLong m_times; + // the "toggle" button and its state +#ifndef __SMARTPHONE__ + wxButton *m_btnDetails; +#endif + bool m_showingDetails; + // the controls which are not shown initially (but only when details // button is pressed) wxListCtrl *m_listctrl; +#ifndef __SMARTPHONE__ +#if wxUSE_STATLINE + wxStaticLine *m_statline; +#endif // wxUSE_STATLINE +#if wxUSE_FILE + wxButton *m_btnSave; +#endif // wxUSE_FILE +#endif // __SMARTPHONE__ // the translated "Details" string static wxString ms_details; - // the maximum length of the log message - static size_t ms_maxLength; - DECLARE_EVENT_TABLE() - wxDECLARE_NO_COPY_CLASS(wxLogDialog); + DECLARE_NO_COPY_CLASS(wxLogDialog) }; BEGIN_EVENT_TABLE(wxLogDialog, wxDialog) EVT_BUTTON(wxID_OK, wxLogDialog::OnOk) -#if wxUSE_CLIPBOARD - EVT_BUTTON(wxID_COPY, wxLogDialog::OnCopy) -#endif // wxUSE_CLIPBOARD -#if CAN_SAVE_FILES + EVT_BUTTON(wxID_MORE, wxLogDialog::OnDetails) +#if wxUSE_FILE EVT_BUTTON(wxID_SAVE, wxLogDialog::OnSave) -#endif // CAN_SAVE_FILES - EVT_LIST_ITEM_ACTIVATED(wxID_ANY, wxLogDialog::OnListItemActivated) +#endif // wxUSE_FILE + EVT_LIST_ITEM_SELECTED(wxID_ANY, wxLogDialog::OnListSelect) END_EVENT_TABLE() #endif // wxUSE_LOG_DIALOG @@ -179,7 +164,7 @@ END_EVENT_TABLE() // private functions // ---------------------------------------------------------------------------- -#if CAN_SAVE_FILES +#if wxUSE_FILE && wxUSE_FILEDLG // pass an uninitialized file object, the function will ask the user for the // filename and try to open it, returns true on success (file was opened), @@ -187,12 +172,53 @@ END_EVENT_TABLE() // dialog was cancelled static int OpenLogFile(wxFile& file, wxString *filename = NULL, wxWindow *parent = NULL); -#endif // CAN_SAVE_FILES +#endif // wxUSE_FILE + +// ---------------------------------------------------------------------------- +// global variables +// ---------------------------------------------------------------------------- + +// we use a global variable to store the frame pointer for wxLogStatus - bad, +// but it's the easiest way +static wxFrame *gs_pFrame = NULL; // FIXME MT-unsafe // ============================================================================ // implementation // ============================================================================ +// ---------------------------------------------------------------------------- +// global functions +// ---------------------------------------------------------------------------- + +// accepts an additional argument which tells to which frame the output should +// be directed +void wxVLogStatus(wxFrame *pFrame, const wxChar *szFormat, va_list argptr) +{ + wxString msg; + + wxLog *pLog = wxLog::GetActiveTarget(); + if ( pLog != NULL ) { + msg.PrintfV(szFormat, argptr); + + wxASSERT( gs_pFrame == NULL ); // should be reset! + gs_pFrame = pFrame; +#ifdef __WXWINCE__ + wxLog::OnLog(wxLOG_Status, msg, 0); +#else + wxLog::OnLog(wxLOG_Status, msg, time(NULL)); +#endif + gs_pFrame = (wxFrame *) NULL; + } +} + +void wxLogStatus(wxFrame *pFrame, const wxChar *szFormat, ...) +{ + va_list argptr; + va_start(argptr, szFormat); + wxVLogStatus(pFrame, szFormat, argptr); + va_end(argptr); +} + // ---------------------------------------------------------------------------- // wxLogGui implementation (FIXME MT-unsafe) // ---------------------------------------------------------------------------- @@ -215,124 +241,95 @@ void wxLogGui::Clear() m_aTimes.Empty(); } -int wxLogGui::GetSeverityIcon() const -{ - return m_bErrors ? wxICON_STOP - : m_bWarnings ? wxICON_EXCLAMATION - : wxICON_INFORMATION; -} - -wxString wxLogGui::GetTitle() const -{ - wxString titleFormat; - switch ( GetSeverityIcon() ) - { - case wxICON_STOP: - titleFormat = _("%s Error"); - break; - - case wxICON_EXCLAMATION: - titleFormat = _("%s Warning"); - break; - - default: - wxFAIL_MSG( "unexpected icon severity" ); - // fall through - - case wxICON_INFORMATION: - titleFormat = _("%s Information"); - } - - return wxString::Format(titleFormat, wxTheApp->GetAppDisplayName()); -} - -void -wxLogGui::DoShowSingleLogMessage(const wxString& message, - const wxString& title, - int style) -{ - wxMessageBox(message, title, wxOK | style); -} - -void -wxLogGui::DoShowMultipleLogMessages(const wxArrayString& messages, - const wxArrayInt& severities, - const wxArrayLong& times, - const wxString& title, - int style) -{ -#if wxUSE_LOG_DIALOG - wxLogDialog dlg(NULL, - messages, severities, times, - title, style); - - // clear the message list before showing the dialog because while it's - // shown some new messages may appear - Clear(); - - (void)dlg.ShowModal(); -#else // !wxUSE_LOG_DIALOG - // start from the most recent message - wxString message; - const size_t nMsgCount = messages.size(); - message.reserve(nMsgCount*100); - for ( size_t n = nMsgCount; n > 0; n-- ) { - message << m_aMessages[n - 1] << wxT("\n"); - } - - DoShowSingleLogMessage(message, title, style); -#endif // wxUSE_LOG_DIALOG/!wxUSE_LOG_DIALOG -} - void wxLogGui::Flush() { - wxLog::Flush(); - if ( !m_bHasMessages ) return; // do it right now to block any new calls to Flush() while we're here m_bHasMessages = false; - // note that this must be done before examining m_aMessages as it may log - // yet another message - const unsigned repeatCount = LogLastRepeatIfNeeded(); - - const size_t nMsgCount = m_aMessages.size(); - - if ( repeatCount > 0 ) + unsigned repeatCount = 0; + if ( wxLog::GetRepetitionCounting() ) { - m_aMessages[nMsgCount - 1] << " (" << m_aMessages[nMsgCount - 2] << ")"; + repeatCount = wxLog::DoLogNumberOfRepeats(); } - const wxString title = GetTitle(); - const int style = GetSeverityIcon(); + wxString appName = wxTheApp->GetAppName(); + if ( !appName.empty() ) + appName[0u] = (wxChar)wxToupper(appName[0u]); + + long style; + wxString titleFormat; + if ( m_bErrors ) { + titleFormat = _("%s Error"); + style = wxICON_STOP; + } + else if ( m_bWarnings ) { + titleFormat = _("%s Warning"); + style = wxICON_EXCLAMATION; + } + else { + titleFormat = _("%s Information"); + style = wxICON_INFORMATION; + } + + wxString title; + title.Printf(titleFormat, appName.c_str()); + + size_t nMsgCount = m_aMessages.Count(); // avoid showing other log dialogs until we're done with the dialog we're // showing right now: nested modal dialogs make for really bad UI! Suspend(); + wxString str; if ( nMsgCount == 1 ) { - // make a copy before calling Clear() - const wxString message(m_aMessages[0]); - Clear(); - - DoShowSingleLogMessage(message, title, style); + str = m_aMessages[0]; } else // more than one message { - wxArrayString messages; - wxArrayInt severities; - wxArrayLong times; +#if wxUSE_LOG_DIALOG - messages.swap(m_aMessages); - severities.swap(m_aSeverity); - times.swap(m_aTimes); + if ( repeatCount > 0 ) + m_aMessages[nMsgCount-1] += wxString::Format(wxT(" (%s)"), m_aMessages[nMsgCount-2].c_str()); + wxLogDialog dlg(NULL, + m_aMessages, m_aSeverity, m_aTimes, + title, style); + // clear the message list before showing the dialog because while it's + // shown some new messages may appear Clear(); - DoShowMultipleLogMessages(messages, severities, times, title, style); + (void)dlg.ShowModal(); +#else // !wxUSE_LOG_DIALOG + // concatenate all strings (but not too many to not overfill the msg box) + size_t nLines = 0; + + // start from the most recent message + for ( size_t n = nMsgCount; n > 0; n-- ) { + // for Windows strings longer than this value are wrapped (NT 4.0) + const size_t nMsgLineWidth = 156; + + nLines += (m_aMessages[n - 1].Len() + nMsgLineWidth - 1) / nMsgLineWidth; + + if ( nLines > 25 ) // don't put too many lines in message box + break; + + str << m_aMessages[n - 1] << wxT("\n"); + } +#endif // wxUSE_LOG_DIALOG/!wxUSE_LOG_DIALOG + } + + // this catches both cases of 1 message with wxUSE_LOG_DIALOG and any + // situation without it + if ( !str.empty() ) + { + wxMessageBox(str, title, wxOK | style); + + // no undisplayed messages whatsoever + Clear(); } // allow flushing the logs again @@ -340,19 +337,16 @@ void wxLogGui::Flush() } // log all kinds of messages -void wxLogGui::DoLogRecord(wxLogLevel level, - const wxString& msg, - const wxLogRecordInfo& info) +void wxLogGui::DoLog(wxLogLevel level, const wxChar *szString, time_t t) { - switch ( level ) - { + switch ( level ) { case wxLOG_Info: if ( GetVerbose() ) case wxLOG_Message: { - m_aMessages.Add(msg); + m_aMessages.Add(szString); m_aSeverity.Add(wxLOG_Message); - m_aTimes.Add((long)info.timestamp); + m_aTimes.Add((long)t); m_bHasMessages = true; } break; @@ -360,29 +354,53 @@ void wxLogGui::DoLogRecord(wxLogLevel level, case wxLOG_Status: #if wxUSE_STATUSBAR { - wxFrame *pFrame = NULL; - - // check if the frame was passed to us explicitly - wxUIntPtr ptr = 0; - if ( info.GetNumValue(wxLOG_KEY_FRAME, &ptr) ) - { - pFrame = static_cast(wxUIntToPtr(ptr)); - } - // find the top window and set it's status text if it has any + wxFrame *pFrame = gs_pFrame; if ( pFrame == NULL ) { wxWindow *pWin = wxTheApp->GetTopWindow(); - if ( wxDynamicCast(pWin, wxFrame) ) { + if ( pWin != NULL && pWin->IsKindOf(CLASSINFO(wxFrame)) ) { pFrame = (wxFrame *)pWin; } } if ( pFrame && pFrame->GetStatusBar() ) - pFrame->SetStatusText(msg); + pFrame->SetStatusText(szString); } #endif // wxUSE_STATUSBAR break; + case wxLOG_Trace: + case wxLOG_Debug: + #ifdef __WXDEBUG__ + { + wxString str; + TimeStamp(&str); + str += szString; + + #if defined(__WXMSW__) && !defined(__WXMICROWIN__) + // don't prepend debug/trace here: it goes to the + // debug window anyhow + str += wxT("\r\n"); + OutputDebugString(str); + #else + // send them to stderr + wxFprintf(stderr, wxT("[%s] %s\n"), + level == wxLOG_Trace ? wxT("Trace") + : wxT("Debug"), + str.c_str()); + fflush(stderr); + #endif + } + #endif // __WXDEBUG__ + + break; + + case wxLOG_FatalError: + // show this one immediately + wxMessageBox(szString, _("Fatal error"), wxICON_HAND); + wxExit(); + break; + case wxLOG_Error: if ( !m_bErrors ) { #if !wxUSE_LOG_DIALOG @@ -403,31 +421,11 @@ void wxLogGui::DoLogRecord(wxLogLevel level, m_bWarnings = true; } - m_aMessages.Add(msg); + m_aMessages.Add(szString); m_aSeverity.Add((int)level); - m_aTimes.Add((long)info.timestamp); + m_aTimes.Add((long)t); m_bHasMessages = true; break; - - case wxLOG_Debug: - case wxLOG_Trace: - // let the base class deal with debug/trace messages - wxLog::DoLogRecord(level, msg, info); - break; - - case wxLOG_FatalError: - case wxLOG_Max: - // fatal errors are shown immediately and terminate the program so - // we should never see them here - wxFAIL_MSG("unexpected log level"); - break; - - case wxLOG_Progress: - case wxLOG_User: - // just ignore those: passing them to the base class would result - // in asserts from DoLogText() because DoLogTextAtLevel() would - // call it as it doesn't know how to handle these levels otherwise - break; } } @@ -445,22 +443,19 @@ class wxLogFrame : public wxFrame { public: // ctor & dtor - wxLogFrame(wxWindow *pParent, wxLogWindow *log, const wxString& szTitle); + wxLogFrame(wxWindow *pParent, wxLogWindow *log, const wxChar *szTitle); virtual ~wxLogFrame(); // menu callbacks void OnClose(wxCommandEvent& event); void OnCloseWindow(wxCloseEvent& event); -#if CAN_SAVE_FILES - void OnSave(wxCommandEvent& event); -#endif // CAN_SAVE_FILES +#if wxUSE_FILE + void OnSave (wxCommandEvent& event); +#endif // wxUSE_FILE void OnClear(wxCommandEvent& event); - // do show the message in the text control - void ShowLogMessage(const wxString& message) - { - m_pTextCtrl->AppendText(message + wxS('\n')); - } + // accessors + wxTextCtrl *TextCtrl() const { return m_pTextCtrl; } private: // use standard ids for our commands! @@ -478,21 +473,21 @@ private: wxLogWindow *m_log; DECLARE_EVENT_TABLE() - wxDECLARE_NO_COPY_CLASS(wxLogFrame); + DECLARE_NO_COPY_CLASS(wxLogFrame) }; BEGIN_EVENT_TABLE(wxLogFrame, wxFrame) // wxLogWindow menu events EVT_MENU(Menu_Close, wxLogFrame::OnClose) -#if CAN_SAVE_FILES +#if wxUSE_FILE EVT_MENU(Menu_Save, wxLogFrame::OnSave) -#endif // CAN_SAVE_FILES +#endif // wxUSE_FILE EVT_MENU(Menu_Clear, wxLogFrame::OnClear) EVT_CLOSE(wxLogFrame::OnCloseWindow) END_EVENT_TABLE() -wxLogFrame::wxLogFrame(wxWindow *pParent, wxLogWindow *log, const wxString& szTitle) +wxLogFrame::wxLogFrame(wxWindow *pParent, wxLogWindow *log, const wxChar *szTitle) : wxFrame(pParent, wxID_ANY, szTitle) { m_log = log; @@ -512,9 +507,9 @@ wxLogFrame::wxLogFrame(wxWindow *pParent, wxLogWindow *log, const wxString& szTi // create menu wxMenuBar *pMenuBar = new wxMenuBar; wxMenu *pMenu = new wxMenu; -#if CAN_SAVE_FILES - pMenu->Append(Menu_Save, _("Save &As..."), _("Save log contents to file")); -#endif // CAN_SAVE_FILES +#if wxUSE_FILE + pMenu->Append(Menu_Save, _("&Save..."), _("Save log contents to file")); +#endif // wxUSE_FILE pMenu->Append(Menu_Clear, _("C&lear"), _("Clear the log contents")); pMenu->AppendSeparator(); pMenu->Append(Menu_Close, _("&Close"), _("Close this window")); @@ -550,9 +545,10 @@ void wxLogFrame::OnCloseWindow(wxCloseEvent& WXUNUSED(event)) DoClose(); } -#if CAN_SAVE_FILES +#if wxUSE_FILE void wxLogFrame::OnSave(wxCommandEvent& WXUNUSED(event)) { +#if wxUSE_FILEDLG wxString filename; wxFile file; int rc = OpenLogFile(file, &filename, this); @@ -579,10 +575,11 @@ void wxLogFrame::OnSave(wxCommandEvent& WXUNUSED(event)) wxLogError(_("Can't save log contents to file.")); } else { - wxLogStatus((wxFrame*)this, _("Log saved to the file '%s'."), filename.c_str()); + wxLogStatus(this, _("Log saved to the file '%s'."), filename.c_str()); } +#endif } -#endif // CAN_SAVE_FILES +#endif // wxUSE_FILE void wxLogFrame::OnClear(wxCommandEvent& WXUNUSED(event)) { @@ -598,15 +595,10 @@ wxLogFrame::~wxLogFrame() // ----------- wxLogWindow::wxLogWindow(wxWindow *pParent, - const wxString& szTitle, + const wxChar *szTitle, bool bShow, bool bDoPass) { - // Initialize it to NULL to ensure that we don't crash if any log messages - // are generated before the frame is fully created (while this doesn't - // happen normally, it might, in principle). - m_pLogFrame = NULL; - PassMessages(bDoPass); m_pLogFrame = new wxLogFrame(pParent, this, szTitle); @@ -620,20 +612,56 @@ void wxLogWindow::Show(bool bShow) m_pLogFrame->Show(bShow); } -void wxLogWindow::DoLogTextAtLevel(wxLogLevel level, const wxString& msg) +void wxLogWindow::DoLog(wxLogLevel level, const wxChar *szString, time_t t) { - if ( !m_pLogFrame ) - return; + // first let the previous logger show it + wxLogPassThrough::DoLog(level, szString, t); - // don't put trace messages in the text window for 2 reasons: - // 1) there are too many of them - // 2) they may provoke other trace messages (e.g. wxMSW code uses - // wxLogTrace to log Windows messages and adding text to the control - // sends more of them) thus sending a program into an infinite loop - if ( level == wxLOG_Trace ) - return; + if ( m_pLogFrame ) { + switch ( level ) { + case wxLOG_Status: + // by default, these messages are ignored by wxLog, so process + // them ourselves + if ( !wxIsEmpty(szString) ) + { + wxString str; + str << _("Status: ") << szString; + DoLogString(str, t); + } + break; - m_pLogFrame->ShowLogMessage(msg); + // don't put trace messages in the text window for 2 reasons: + // 1) there are too many of them + // 2) they may provoke other trace messages thus sending a program + // into an infinite loop + case wxLOG_Trace: + break; + + default: + // and this will format it nicely and call our DoLogString() + wxLog::DoLog(level, szString, t); + } + } +} + +void wxLogWindow::DoLogString(const wxChar *szString, time_t WXUNUSED(t)) +{ + // put the text into our window + wxTextCtrl *pText = m_pLogFrame->TextCtrl(); + + // remove selection (WriteText is in fact ReplaceSelection) +#ifdef __WXMSW__ + wxTextPos nLen = pText->GetLastPosition(); + pText->SetSelection(nLen, nLen); +#endif // Windows + + wxString msg; + TimeStamp(&msg); + msg << szString << wxT('\n'); + + pText->AppendText(msg); + + // TODO ensure that the line can be seen } wxFrame *wxLogWindow::GetFrame() const @@ -653,7 +681,7 @@ bool wxLogWindow::OnFrameClose(wxFrame * WXUNUSED(frame)) void wxLogWindow::OnFrameDelete(wxFrame * WXUNUSED(frame)) { - m_pLogFrame = NULL; + m_pLogFrame = (wxLogFrame *)NULL; } wxLogWindow::~wxLogWindow() @@ -670,8 +698,13 @@ wxLogWindow::~wxLogWindow() #if wxUSE_LOG_DIALOG +#ifndef __SMARTPHONE__ +static const size_t MARGIN = 10; +#else +static const size_t MARGIN = 0; +#endif + wxString wxLogDialog::ms_details; -size_t wxLogDialog::ms_maxLength = 0; wxLogDialog::wxLogDialog(wxWindow *parent, const wxArrayString& messages, @@ -683,8 +716,6 @@ wxLogDialog::wxLogDialog(wxWindow *parent, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) { - // init the static variables: - if ( ms_details.empty() ) { // ensure that we won't loop here if wxGetTranslation() @@ -696,11 +727,6 @@ wxLogDialog::wxLogDialog(wxWindow *parent, #endif } - if ( ms_maxLength == 0 ) - { - ms_maxLength = (2 * wxGetDisplaySize().x/3) / GetCharWidth(); - } - size_t count = messages.GetCount(); m_messages.Alloc(count); m_severity.Alloc(count); @@ -708,89 +734,109 @@ wxLogDialog::wxLogDialog(wxWindow *parent, for ( size_t n = 0; n < count; n++ ) { - m_messages.Add(messages[n]); + wxString msg = messages[n]; + msg.Replace(wxT("\n"), wxT(" ")); + m_messages.Add(msg); m_severity.Add(severity[n]); m_times.Add(times[n]); } - m_listctrl = NULL; + m_showingDetails = false; // not initially + m_listctrl = (wxListCtrl *)NULL; + +#ifndef __SMARTPHONE__ + +#if wxUSE_STATLINE + m_statline = (wxStaticLine *)NULL; +#endif // wxUSE_STATLINE + +#if wxUSE_FILE + m_btnSave = (wxButton *)NULL; +#endif // wxUSE_FILE + +#endif // __SMARTPHONE__ bool isPda = (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA); // create the controls which are always shown and layout them: we use - // sizers even though our window is not resizable to calculate the size of + // sizers even though our window is not resizeable to calculate the size of // the dialog properly wxBoxSizer *sizerTop = new wxBoxSizer(wxVERTICAL); +#ifndef __SMARTPHONE__ + wxBoxSizer *sizerButtons = new wxBoxSizer(isPda ? wxHORIZONTAL : wxVERTICAL); +#endif wxBoxSizer *sizerAll = new wxBoxSizer(isPda ? wxVERTICAL : wxHORIZONTAL); - if (!isPda) - { - wxStaticBitmap *icon = new wxStaticBitmap - ( - this, - wxID_ANY, - wxArtProvider::GetMessageBoxIcon(style) - ); - sizerAll->Add(icon, wxSizerFlags().Centre()); - } - - // create the text sizer with a minimal size so that we are sure it won't be too small - wxString message = EllipsizeString(messages.Last()); - wxSizer *szText = CreateTextSizer(message); - szText->SetMinSize(wxMin(300, wxGetDisplaySize().x / 3), -1); - - sizerAll->Add(szText, wxSizerFlags(1).Centre().Border(wxLEFT | wxRIGHT)); - - wxButton *btnOk = new wxButton(this, wxID_OK); - sizerAll->Add(btnOk, wxSizerFlags().Centre()); - - sizerTop->Add(sizerAll, wxSizerFlags().Expand().Border()); - - - // add the details pane -#ifndef __SMARTPHONE__ - -#if wxUSE_COLLPANE - wxCollapsiblePane * const - collpane = new wxCollapsiblePane(this, wxID_ANY, ms_details); - sizerTop->Add(collpane, wxSizerFlags(1).Expand().Border()); - - wxWindow *win = collpane->GetPane(); -#else - wxPanel* win = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, - wxBORDER_NONE); -#endif - wxSizer * const paneSz = new wxBoxSizer(wxVERTICAL); - - CreateDetailsControls(win); - - paneSz->Add(m_listctrl, wxSizerFlags(1).Expand().Border(wxTOP)); - -#if wxUSE_CLIPBOARD || CAN_SAVE_FILES - wxBoxSizer * const btnSizer = new wxBoxSizer(wxHORIZONTAL); - - wxSizerFlags flagsBtn; - flagsBtn.Border(wxLEFT); - -#if wxUSE_CLIPBOARD - btnSizer->Add(new wxButton(win, wxID_COPY), flagsBtn); -#endif // wxUSE_CLIPBOARD - -#if CAN_SAVE_FILES - btnSizer->Add(new wxButton(win, wxID_SAVE), flagsBtn); -#endif // CAN_SAVE_FILES - - paneSz->Add(btnSizer, wxSizerFlags().Right().Border(wxTOP|wxBOTTOM)); -#endif // wxUSE_CLIPBOARD || CAN_SAVE_FILES - - win->SetSizer(paneSz); - paneSz->SetSizeHints(win); -#else // __SMARTPHONE__ +#ifdef __SMARTPHONE__ SetLeftMenu(wxID_OK); SetRightMenu(wxID_MORE, ms_details + EXPAND_SUFFIX); -#endif // __SMARTPHONE__/!__SMARTPHONE__ +#else + wxButton *btnOk = new wxButton(this, wxID_OK); + sizerButtons->Add(btnOk, 0, isPda ? wxCENTRE : wxCENTRE|wxBOTTOM, MARGIN/2); + m_btnDetails = new wxButton(this, wxID_MORE, ms_details + EXPAND_SUFFIX); + sizerButtons->Add(m_btnDetails, 0, isPda ? wxCENTRE|wxLEFT : wxCENTRE | wxTOP, MARGIN/2 - 1); +#endif - SetSizerAndFit(sizerTop); + wxBitmap bitmap; + switch ( style & wxICON_MASK ) + { + case wxICON_ERROR: + bitmap = wxArtProvider::GetBitmap(wxART_ERROR, wxART_MESSAGE_BOX); +#ifdef __WXPM__ + bitmap.SetId(wxICON_SMALL_ERROR); +#endif + break; + + case wxICON_INFORMATION: + bitmap = wxArtProvider::GetBitmap(wxART_INFORMATION, wxART_MESSAGE_BOX); +#ifdef __WXPM__ + bitmap.SetId(wxICON_SMALL_INFO); +#endif + break; + + case wxICON_WARNING: + bitmap = wxArtProvider::GetBitmap(wxART_WARNING, wxART_MESSAGE_BOX); +#ifdef __WXPM__ + bitmap.SetId(wxICON_SMALL_WARNING); +#endif + break; + + default: + wxFAIL_MSG(_T("incorrect log style")); + } + + if (!isPda) + sizerAll->Add(new wxStaticBitmap(this, wxID_ANY, bitmap), 0, + wxALIGN_CENTRE_VERTICAL); + + const wxString& message = messages.Last(); + sizerAll->Add(CreateTextSizer(message), 1, + wxALIGN_CENTRE_VERTICAL | wxLEFT | wxRIGHT, MARGIN); +#ifndef __SMARTPHONE__ + sizerAll->Add(sizerButtons, 0, isPda ? wxCENTRE|wxTOP|wxBOTTOM : (wxALIGN_RIGHT | wxLEFT), MARGIN); +#endif + + sizerTop->Add(sizerAll, 0, wxALL | wxEXPAND, MARGIN); + + SetSizer(sizerTop); + + // see comments in OnDetails() + // + // Note: Doing this, this way, triggered a nasty bug in + // wxTopLevelWindowGTK::GtkOnSize which took -1 literally once + // either of maxWidth or maxHeight was set. This symptom has been + // fixed there, but it is a problem that remains as long as we allow + // unchecked access to the internal size members. We really need to + // encapuslate window sizes more cleanly and make it clear when -1 will + // be substituted and when it will not. + + wxSize size = sizerTop->Fit(this); + m_maxHeight = size.y; + SetSizeHints(size.x, size.y, m_maxWidth, m_maxHeight); + +#ifndef __SMARTPHONE__ + btnOk->SetFocus(); +#endif Centre(); @@ -802,37 +848,44 @@ wxLogDialog::wxLogDialog(wxWindow *parent, } } -void wxLogDialog::CreateDetailsControls(wxWindow *parent) +void wxLogDialog::CreateDetailsControls() { - wxString fmt = wxLog::GetTimestamp(); - bool hasTimeStamp = !fmt.IsEmpty(); +#ifndef __SMARTPHONE__ + // create the save button and separator line if possible +#if wxUSE_FILE + m_btnSave = new wxButton(this, wxID_SAVE); +#endif // wxUSE_FILE + +#if wxUSE_STATLINE + m_statline = new wxStaticLine(this, wxID_ANY); +#endif // wxUSE_STATLINE + +#endif // __SMARTPHONE__ // create the list ctrl now - m_listctrl = new wxListCtrl(parent, wxID_ANY, + m_listctrl = new wxListCtrl(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, - wxBORDER_SIMPLE | + wxSUNKEN_BORDER | wxLC_REPORT | wxLC_NO_HEADER | wxLC_SINGLE_SEL); #ifdef __WXWINCE__ - // This makes a big aesthetic difference on WinCE but I + // This maks a big aesthetic difference on WinCE but I // don't want to risk problems on other platforms m_listctrl->Hide(); #endif // no need to translate these strings as they're not shown to the // user anyhow (we use wxLC_NO_HEADER style) - m_listctrl->InsertColumn(0, wxT("Message")); - - if (hasTimeStamp) - m_listctrl->InsertColumn(1, wxT("Time")); + m_listctrl->InsertColumn(0, _T("Message")); + m_listctrl->InsertColumn(1, _T("Time")); // prepare the imagelist static const int ICON_SIZE = 16; wxImageList *imageList = new wxImageList(ICON_SIZE, ICON_SIZE); // order should be the same as in the switch below! - static const char* const icons[] = + static const wxChar* icons[] = { wxART_ERROR, wxART_WARNING, @@ -848,7 +901,7 @@ void wxLogDialog::CreateDetailsControls(wxWindow *parent) // This may very well fail if there are insufficient colours available. // Degrade gracefully. - if ( !bmp.IsOk() ) + if ( !bmp.Ok() ) { loadedIcons = false; @@ -860,7 +913,14 @@ void wxLogDialog::CreateDetailsControls(wxWindow *parent) m_listctrl->SetImageList(imageList, wxIMAGE_LIST_SMALL); - // fill the listctrl + // and fill it + wxString fmt = wxLog::GetTimestamp(); + if ( !fmt ) + { + // default format + fmt = _T("%c"); + } + size_t count = m_messages.GetCount(); for ( size_t n = 0; n < count; n++ ) { @@ -887,20 +947,13 @@ void wxLogDialog::CreateDetailsControls(wxWindow *parent) image = -1; } - wxString msg = m_messages[n]; - msg.Replace(wxT("\n"), wxT(" ")); - msg = EllipsizeString(msg); - - m_listctrl->InsertItem(n, msg, image); - - if (hasTimeStamp) - m_listctrl->SetItem(n, 1, TimeStamp(fmt, (time_t)m_times[n])); + m_listctrl->InsertItem(n, m_messages[n], image); + m_listctrl->SetItem(n, 1, TimeStamp(fmt, (time_t)m_times[n])); } // let the columns size themselves m_listctrl->SetColumnWidth(0, wxLIST_AUTOSIZE); - if (hasTimeStamp) - m_listctrl->SetColumnWidth(1, wxLIST_AUTOSIZE); + m_listctrl->SetColumnWidth(1, wxLIST_AUTOSIZE); // calculate an approximately nice height for the listctrl int height = GetCharHeight()*(count + 4); @@ -919,21 +972,12 @@ void wxLogDialog::CreateDetailsControls(wxWindow *parent) m_listctrl->SetSize(wxDefaultCoord, wxMin(height, heightMax)); } -void wxLogDialog::OnListItemActivated(wxListEvent& event) +void wxLogDialog::OnListSelect(wxListEvent& event) { - // show the activated item in a message box - // This allow the user to correctly display the logs which are longer - // than the listctrl and thus gets truncated or those which contains - // newlines. - - // NB: don't do: - // wxString str = m_listctrl->GetItemText(event.GetIndex()); - // as there's a 260 chars limit on the items inside a wxListCtrl in wxMSW. - wxString str = m_messages[event.GetIndex()]; - - // wxMessageBox will nicely handle the '\n' in the string (if any) - // and supports long strings - wxMessageBox(str, wxT("Log message"), wxOK, this); + // we can't just disable the control because this looks ugly under Windows + // (wrong bg colour, no scrolling...), but we still want to disable + // selecting items - it makes no sense here + m_listctrl->SetItemState(event.GetIndex(), 0, wxLIST_STATE_SELECTED); } void wxLogDialog::OnOk(wxCommandEvent& WXUNUSED(event)) @@ -941,52 +985,11 @@ void wxLogDialog::OnOk(wxCommandEvent& WXUNUSED(event)) EndModal(wxID_OK); } -#if CAN_SAVE_FILES || wxUSE_CLIPBOARD - -wxString wxLogDialog::GetLogMessages() const -{ - wxString fmt = wxLog::GetTimestamp(); - if ( fmt.empty() ) - { - // use the default format - fmt = "%c"; - } - - const size_t count = m_messages.GetCount(); - - wxString text; - text.reserve(count*m_messages[0].length()); - for ( size_t n = 0; n < count; n++ ) - { - text << TimeStamp(fmt, (time_t)m_times[n]) - << ": " - << m_messages[n] - << wxTextFile::GetEOL(); - } - - return text; -} - -#endif // CAN_SAVE_FILES || wxUSE_CLIPBOARD - -#if wxUSE_CLIPBOARD - -void wxLogDialog::OnCopy(wxCommandEvent& WXUNUSED(event)) -{ - wxClipboardLocker clip; - if ( !clip || - !wxTheClipboard->AddData(new wxTextDataObject(GetLogMessages())) ) - { - wxLogError(_("Failed to copy dialog contents to the clipboard.")); - } -} - -#endif // wxUSE_CLIPBOARD - -#if CAN_SAVE_FILES +#if wxUSE_FILE void wxLogDialog::OnSave(wxCommandEvent& WXUNUSED(event)) { +#if wxUSE_FILEDLG wxFile file; int rc = OpenLogFile(file, NULL, this); if ( rc == -1 ) @@ -995,13 +998,141 @@ void wxLogDialog::OnSave(wxCommandEvent& WXUNUSED(event)) return; } - if ( !rc || !file.Write(GetLogMessages()) || !file.Close() ) + bool ok = rc != 0; + + wxString fmt = wxLog::GetTimestamp(); + if ( !fmt ) { - wxLogError(_("Can't save log contents to file.")); + // default format + fmt = _T("%c"); } + + size_t count = m_messages.GetCount(); + for ( size_t n = 0; ok && (n < count); n++ ) + { + wxString line; + line << TimeStamp(fmt, (time_t)m_times[n]) + << _T(": ") + << m_messages[n] + << wxTextFile::GetEOL(); + + ok = file.Write(line); + } + + if ( ok ) + ok = file.Close(); + + if ( !ok ) + wxLogError(_("Can't save log contents to file.")); +#endif // wxUSE_FILEDLG } -#endif // CAN_SAVE_FILES +#endif // wxUSE_FILE + +void wxLogDialog::OnDetails(wxCommandEvent& WXUNUSED(event)) +{ + wxSizer *sizer = GetSizer(); + + if ( m_showingDetails ) + { +#ifdef __SMARTPHONE__ + SetRightMenu(wxID_MORE, ms_details + EXPAND_SUFFIX); +#else + m_btnDetails->SetLabel(ms_details + EXPAND_SUFFIX); +#endif + + sizer->Detach( m_listctrl ); + +#ifndef __SMARTPHONE__ + +#if wxUSE_STATLINE + sizer->Detach( m_statline ); +#endif // wxUSE_STATLINE + +#if wxUSE_FILE + sizer->Detach( m_btnSave ); +#endif // wxUSE_FILE + +#endif // __SMARTPHONE__ + } + else // show details now + { +#ifdef __SMARTPHONE__ + SetRightMenu(wxID_MORE, wxString(_T("<< ")) + ms_details); +#else + m_btnDetails->SetLabel(wxString(_T("<< ")) + ms_details); +#endif + + if ( !m_listctrl ) + { + CreateDetailsControls(); + } + +#if wxUSE_STATLINE && !defined(__SMARTPHONE__) + bool isPda = (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA); + if (!isPda) + sizer->Add(m_statline, 0, wxEXPAND | (wxALL & ~wxTOP), MARGIN); +#endif // wxUSE_STATLINE + + sizer->Add(m_listctrl, 1, wxEXPAND | (wxALL & ~wxTOP), MARGIN); + + // VZ: this doesn't work as this becomes the initial (and not only + // minimal) listctrl height as well - why? +#if 0 + // allow the user to make the dialog shorter than its initial height - + // without this it wouldn't work as the list ctrl would have been + // incompressible + sizer->SetItemMinSize(m_listctrl, 100, 3*GetCharHeight()); +#endif // 0 + +#if wxUSE_FILE && !defined(__SMARTPHONE__) + sizer->Add(m_btnSave, 0, wxALIGN_RIGHT | (wxALL & ~wxTOP), MARGIN); +#endif // wxUSE_FILE + } + + m_showingDetails = !m_showingDetails; + + // in any case, our size changed - relayout everything and set new hints + // --------------------------------------------------------------------- + + // we have to reset min size constraints or Fit() would never reduce the + // dialog size when collapsing it and we have to reset max constraint + // because it wouldn't expand it otherwise + + m_minHeight = + m_maxHeight = -1; + + // wxSizer::FitSize() is private, otherwise we might use it directly... + wxSize sizeTotal = GetSize(), + sizeClient = GetClientSize(); + + wxSize size = sizer->GetMinSize(); + size.x += sizeTotal.x - sizeClient.x; + size.y += sizeTotal.y - sizeClient.y; + + // we don't want to allow expanding the dialog in vertical direction as + // this would show the "hidden" details but we can resize the dialog + // vertically while the details are shown + if ( !m_showingDetails ) + m_maxHeight = size.y; + + SetSizeHints(size.x, size.y, m_maxWidth, m_maxHeight); + +#ifdef __WXWINCE__ + if (m_showingDetails) + m_listctrl->Show(); +#endif + + // don't change the width when expanding/collapsing + SetSize(wxDefaultCoord, size.y); + +#ifdef __WXGTK__ + // VS: this is necessary in order to force frame redraw under + // WindowMaker or fvwm2 (and probably other broken WMs). + // Otherwise, detailed list wouldn't be displayed. + Show(); +#endif // wxGTK +} wxLogDialog::~wxLogDialog() { @@ -1013,7 +1144,7 @@ wxLogDialog::~wxLogDialog() #endif // wxUSE_LOG_DIALOG -#if CAN_SAVE_FILES +#if wxUSE_FILE && wxUSE_FILEDLG // pass an uninitialized file object, the function will ask the user for the // filename and try to open it, returns true on success (file was opened), @@ -1031,7 +1162,7 @@ static int OpenLogFile(wxFile& file, wxString *pFilename, wxWindow *parent) // open file // --------- - bool bOk = true; // suppress warning about it being possible uninitialized + bool bOk wxDUMMY_INITIALIZE(false); if ( wxFile::Exists(filename) ) { bool bAppend = false; wxString strMsg; @@ -1071,7 +1202,7 @@ static int OpenLogFile(wxFile& file, wxString *pFilename, wxWindow *parent) return bOk; } -#endif // CAN_SAVE_FILES +#endif // wxUSE_FILE #endif // !(wxUSE_LOGGUI || wxUSE_LOGWINDOW) @@ -1086,9 +1217,13 @@ wxLogTextCtrl::wxLogTextCtrl(wxTextCtrl *pTextCtrl) m_pTextCtrl = pTextCtrl; } -void wxLogTextCtrl::DoLogText(const wxString& msg) +void wxLogTextCtrl::DoLogString(const wxChar *szString, time_t WXUNUSED(t)) { - m_pTextCtrl->AppendText(msg + wxS('\n')); + wxString msg; + TimeStamp(&msg); + + msg << szString << wxT('\n'); + m_pTextCtrl->AppendText(msg); } #endif // wxUSE_LOG && wxUSE_TEXTCTRL diff --git a/Source/3rd Party/wx/src/generic/markuptext.cpp b/Source/3rd Party/wx/src/generic/markuptext.cpp deleted file mode 100644 index ae3d14d73..000000000 --- a/Source/3rd Party/wx/src/generic/markuptext.cpp +++ /dev/null @@ -1,254 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/generic/markuptext.cpp -// Purpose: wxMarkupText implementation -// Author: Vadim Zeitlin -// Created: 2011-02-21 -// RCS-ID: $Id: wxhead.cpp,v 1.11 2010-04-22 12:44:51 zeitlin Exp $ -// Copyright: (c) 2011 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// for compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_MARKUP - -#ifndef WX_PRECOMP - #include "wx/gdicmn.h" - #include "wx/control.h" - #include "wx/dc.h" -#endif // WX_PRECOMP - -#include "wx/generic/private/markuptext.h" - -#include "wx/private/markupparserattr.h" - -namespace -{ - -// ---------------------------------------------------------------------------- -// wxMarkupParserMeasureOutput: measure the extends of a markup string. -// ---------------------------------------------------------------------------- - -class wxMarkupParserMeasureOutput : public wxMarkupParserAttrOutput -{ -public: - // Initialize the base class with the font to use. As we don't care about - // colours (which don't affect the text measurements), don't bother to - // specify them at all. - wxMarkupParserMeasureOutput(wxDC& dc, int *visibleHeight) - : wxMarkupParserAttrOutput(dc.GetFont(), wxColour(), wxColour()), - m_dc(dc), - m_visibleHeight(visibleHeight) - { - if ( visibleHeight ) - *visibleHeight = 0; - } - - const wxSize& GetSize() const { return m_size; } - - - virtual void OnText(const wxString& text_) - { - const wxString text(wxControl::RemoveMnemonics(text_)); - - // TODO-MULTILINE-MARKUP: Must use GetMultiLineTextExtent(). - const wxSize size = m_dc.GetTextExtent(text); - - m_size.x += size.x; - if ( size.y > m_size.y ) - m_size.y = size.y; - - if ( m_visibleHeight ) - { - wxFontMetrics tm = m_dc.GetFontMetrics(); - int visibleHeight = tm.ascent - tm.internalLeading; - if ( *m_visibleHeight < visibleHeight ) - *m_visibleHeight = visibleHeight; - } - } - - virtual void OnAttrStart(const Attr& attr) - { - m_dc.SetFont(attr.font); - } - - virtual void OnAttrEnd(const Attr& WXUNUSED(attr)) - { - m_dc.SetFont(GetFont()); - } - -private: - wxDC& m_dc; - - // The values that we compute. - wxSize m_size; - int * const m_visibleHeight; // may be NULL - - wxDECLARE_NO_COPY_CLASS(wxMarkupParserMeasureOutput); -}; - -// ---------------------------------------------------------------------------- -// wxMarkupParserRenderOutput: render a markup string. -// ---------------------------------------------------------------------------- - -class wxMarkupParserRenderOutput : public wxMarkupParserAttrOutput -{ -public: - // Notice that the bottom of rectangle passed to our ctor is used as the - // baseline for the text we draw, i.e. it needs to be adjusted to exclude - // descent by the caller. - wxMarkupParserRenderOutput(wxDC& dc, - const wxRect& rect, - int flags) - : wxMarkupParserAttrOutput(dc.GetFont(), - dc.GetTextForeground(), - wxColour()), - m_dc(dc), - m_rect(rect), - m_flags(flags) - { - m_pos = m_rect.x; - - // We don't initialize the base class initial text background colour to - // the valid value because we want to be able to detect when we revert - // to the "absence of background colour" and set the background mode to - // be transparent in OnAttrStart() below. But do remember it to be able - // to restore it there later -- this doesn't affect us as the text - // background isn't used anyhow when the background mode is transparent - // but it might affect the caller if it sets the background mode to - // opaque and draws some text after using us. - m_origTextBackground = dc.GetTextBackground(); - } - - virtual void OnText(const wxString& text_) - { - wxString text; - int indexAccel = wxControl::FindAccelIndex(text_, &text); - if ( !(m_flags & wxMarkupText::Render_ShowAccels) ) - indexAccel = wxNOT_FOUND; - - // Adjust the position (unfortunately we need to do this manually as - // there is no notion of current text position in wx API) rectangle to - // ensure that all text segments use the same baseline (as there is - // nothing equivalent to Windows SetTextAlign(TA_BASELINE) neither). - wxRect rect(m_rect); - rect.x = m_pos; - - int descent; - m_dc.GetTextExtent(text, &rect.width, &rect.height, &descent); - rect.height -= descent; - rect.y += m_rect.height - rect.height; - - wxRect bounds; - m_dc.DrawLabel(text, wxBitmap(), - rect, wxALIGN_LEFT | wxALIGN_TOP, - indexAccel, - &bounds); - - // TODO-MULTILINE-MARKUP: Must update vertical position too. - m_pos += bounds.width; - } - - virtual void OnAttrStart(const Attr& attr) - { - m_dc.SetFont(attr.font); - if ( attr.foreground.IsOk() ) - m_dc.SetTextForeground(attr.foreground); - - if ( attr.background.IsOk() ) - { - // Setting the background colour is not enough, we must also change - // the mode to ensure that it is actually used. - m_dc.SetBackgroundMode(wxSOLID); - m_dc.SetTextBackground(attr.background); - } - } - - virtual void OnAttrEnd(const Attr& attr) - { - // We always restore the font because we always change it... - m_dc.SetFont(GetFont()); - - // ...but we only need to restore the colours if we had changed them. - if ( attr.foreground.IsOk() ) - m_dc.SetTextForeground(GetAttr().foreground); - - if ( attr.background.IsOk() ) - { - wxColour background = GetAttr().background; - if ( !background.IsOk() ) - { - // Invalid background colour indicates that the background - // should actually be made transparent and in this case the - // actual value of background colour doesn't matter but we also - // restore it just in case, see comment in the ctor. - m_dc.SetBackgroundMode(wxTRANSPARENT); - background = m_origTextBackground; - } - - m_dc.SetTextBackground(background); - } - } - -private: - wxDC& m_dc; - const wxRect m_rect; - const int m_flags; - - wxColour m_origTextBackground; - - // Current horizontal text output position. - // - // TODO-MULTILINE-MARKUP: Must keep vertical position too. - int m_pos; - - wxDECLARE_NO_COPY_CLASS(wxMarkupParserRenderOutput); -}; - -} // anonymous namespace - -// ============================================================================ -// wxMarkupText implementation -// ============================================================================ - -wxSize wxMarkupText::Measure(wxDC& dc, int *visibleHeight) const -{ - wxMarkupParserMeasureOutput out(dc, visibleHeight); - wxMarkupParser parser(out); - if ( !parser.Parse(m_markup) ) - { - wxFAIL_MSG( "Invalid markup" ); - return wxDefaultSize; - } - - return out.GetSize(); -} - -void wxMarkupText::Render(wxDC& dc, const wxRect& rect, int flags) -{ - // We want to center the above-baseline parts of the letter vertically, so - // we use the visible height and not the total height (which includes - // descent and internal leading) here. - int visibleHeight; - wxRect rectText(rect.GetPosition(), Measure(dc, &visibleHeight)); - rectText.height = visibleHeight; - - wxMarkupParserRenderOutput out(dc, rectText.CentreIn(rect), flags); - wxMarkupParser parser(out); - parser.Parse(m_markup); -} - -#endif // wxUSE_MARKUP diff --git a/Source/3rd Party/wx/src/generic/msgdlgg.cpp b/Source/3rd Party/wx/src/generic/msgdlgg.cpp index 8f712b9f3..8887f131b 100644 --- a/Source/3rd Party/wx/src/generic/msgdlgg.cpp +++ b/Source/3rd Party/wx/src/generic/msgdlgg.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart, Robert Roebling // Modified by: // Created: 04/01/98 -// RCS-ID: $Id$ +// RCS-ID: $Id: msgdlgg.cpp 41838 2006-10-09 21:08:45Z VZ $ // Copyright: (c) Julian Smart and Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -16,7 +16,7 @@ #pragma hdrstop #endif -#if wxUSE_MSGDLG +#if wxUSE_MSGDLG && (!defined(__WXGTK20__) || defined(__WXUNIVERSAL__) || defined(__WXGPE__)) #ifndef WX_PRECOMP #include "wx/utils.h" @@ -38,35 +38,11 @@ #define __WX_COMPILING_MSGDLGG_CPP__ 1 #include "wx/msgdlg.h" #include "wx/artprov.h" -#include "wx/textwrapper.h" #if wxUSE_STATLINE #include "wx/statline.h" #endif -// ---------------------------------------------------------------------------- -// wxTitleTextWrapper: simple class to create wrapped text in "title font" -// ---------------------------------------------------------------------------- - -class wxTitleTextWrapper : public wxTextSizerWrapper -{ -public: - wxTitleTextWrapper(wxWindow *win) - : wxTextSizerWrapper(win) - { - } - -protected: - virtual wxWindow *OnCreateLine(const wxString& s) - { - wxWindow * const win = wxTextSizerWrapper::OnCreateLine(s); - - win->SetFont(win->GetFont().Larger().MakeBold()); - - return win; - } -}; - // ---------------------------------------------------------------------------- // icons // ---------------------------------------------------------------------------- @@ -74,7 +50,6 @@ protected: BEGIN_EVENT_TABLE(wxGenericMessageDialog, wxDialog) EVT_BUTTON(wxID_YES, wxGenericMessageDialog::OnYes) EVT_BUTTON(wxID_NO, wxGenericMessageDialog::OnNo) - EVT_BUTTON(wxID_HELP, wxGenericMessageDialog::OnHelp) EVT_BUTTON(wxID_CANCEL, wxGenericMessageDialog::OnCancel) END_EVENT_TABLE() @@ -85,85 +60,9 @@ wxGenericMessageDialog::wxGenericMessageDialog( wxWindow *parent, const wxString& caption, long style, const wxPoint& pos) - : wxMessageDialogBase(GetParentForModalDialog(parent, style), - message, - caption, - style), - m_pos(pos) + : wxDialog( parent, wxID_ANY, caption, pos, wxDefaultSize, wxDEFAULT_DIALOG_STYLE ) { - m_created = false; -} - -wxSizer *wxGenericMessageDialog::CreateMsgDlgButtonSizer() -{ -#ifndef __SMARTPHONE__ - if ( HasCustomLabels() ) - { - wxStdDialogButtonSizer * const sizerStd = new wxStdDialogButtonSizer; - - wxButton *btnDef = NULL; - - if ( m_dialogStyle & wxOK ) - { - btnDef = new wxButton(this, wxID_OK, GetCustomOKLabel()); - sizerStd->AddButton(btnDef); - } - - if ( m_dialogStyle & wxCANCEL ) - { - wxButton * const - cancel = new wxButton(this, wxID_CANCEL, GetCustomCancelLabel()); - sizerStd->AddButton(cancel); - - if ( m_dialogStyle & wxCANCEL_DEFAULT ) - btnDef = cancel; - } - - if ( m_dialogStyle & wxYES_NO ) - { - wxButton * const - yes = new wxButton(this, wxID_YES, GetCustomYesLabel()); - sizerStd->AddButton(yes); - - wxButton * const - no = new wxButton(this, wxID_NO, GetCustomNoLabel()); - sizerStd->AddButton(no); - if ( m_dialogStyle & wxNO_DEFAULT ) - btnDef = no; - else if ( !btnDef ) - btnDef = yes; - } - - if ( m_dialogStyle & wxHELP ) - { - wxButton * const - help = new wxButton(this, wxID_HELP, GetCustomHelpLabel()); - sizerStd->AddButton(help); - } - - if ( btnDef ) - { - btnDef->SetDefault(); - btnDef->SetFocus(); - } - - sizerStd->Realize(); - - return CreateSeparatedSizer(sizerStd); - } -#endif // !__SMARTPHONE__ - - // Use standard labels for all buttons - return CreateSeparatedButtonSizer - ( - m_dialogStyle & (wxOK | wxCANCEL | wxHELP | wxYES_NO | - wxNO_DEFAULT | wxCANCEL_DEFAULT) - ); -} - -void wxGenericMessageDialog::DoCreateMsgdialog() -{ - wxDialog::Create(m_parent, wxID_ANY, m_caption, m_pos, wxDefaultSize, wxDEFAULT_DIALOG_STYLE); + SetMessageDialogStyle(style); bool is_pda = (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA); @@ -173,57 +72,53 @@ void wxGenericMessageDialog::DoCreateMsgdialog() #if wxUSE_STATBMP // 1) icon - if (m_dialogStyle & wxICON_MASK) + if (style & wxICON_MASK) { - wxStaticBitmap *icon = new wxStaticBitmap - ( - this, - wxID_ANY, - wxArtProvider::GetMessageBoxIcon(m_dialogStyle) - ); + wxBitmap bitmap; + switch ( style & wxICON_MASK ) + { + default: + wxFAIL_MSG(_T("incorrect log style")); + // fall through + + case wxICON_ERROR: + bitmap = wxArtProvider::GetIcon(wxART_ERROR, wxART_MESSAGE_BOX); + break; + + case wxICON_INFORMATION: + bitmap = wxArtProvider::GetIcon(wxART_INFORMATION, wxART_MESSAGE_BOX); + break; + + case wxICON_WARNING: + bitmap = wxArtProvider::GetIcon(wxART_WARNING, wxART_MESSAGE_BOX); + break; + + case wxICON_QUESTION: + bitmap = wxArtProvider::GetIcon(wxART_QUESTION, wxART_MESSAGE_BOX); + break; + } + wxStaticBitmap *icon = new wxStaticBitmap(this, wxID_ANY, bitmap); if (is_pda) topsizer->Add( icon, 0, wxTOP|wxLEFT|wxRIGHT | wxALIGN_LEFT, 10 ); else - icon_text->Add(icon, wxSizerFlags().Top().Border(wxRIGHT, 20)); + icon_text->Add( icon, 0, wxCENTER ); } #endif // wxUSE_STATBMP #if wxUSE_STATTEXT // 2) text + icon_text->Add( CreateTextSizer( message ), 0, wxALIGN_CENTER | wxLEFT, 10 ); - wxBoxSizer * const textsizer = new wxBoxSizer(wxVERTICAL); - - // We want to show the main message in a different font to make it stand - // out if the extended message is used as well. This looks better and is - // more consistent with the native dialogs under MSW and GTK. - wxString lowerMessage; - if ( !m_extendedMessage.empty() ) - { - wxTitleTextWrapper titleWrapper(this); - textsizer->Add(CreateTextSizer(GetMessage(), titleWrapper), - wxSizerFlags().Border(wxBOTTOM, 20)); - - lowerMessage = GetExtendedMessage(); - } - else // no extended message - { - lowerMessage = GetMessage(); - } - - textsizer->Add(CreateTextSizer(lowerMessage)); - - icon_text->Add(textsizer, 0, wxALIGN_CENTER, 10); - topsizer->Add( icon_text, 1, wxLEFT|wxRIGHT|wxTOP, 10 ); + topsizer->Add( icon_text, 1, wxCENTER | wxLEFT|wxRIGHT|wxTOP, 10 ); #endif // wxUSE_STATTEXT - // 3) optional checkbox and detailed text - AddMessageDialogCheckBox( topsizer ); - AddMessageDialogDetails( topsizer ); - - // 4) buttons - wxSizer *sizerBtn = CreateMsgDlgButtonSizer(); + // 3) buttons + int center_flag = wxEXPAND; + if (style & wxYES_NO) + center_flag = wxALIGN_CENTRE; + wxSizer *sizerBtn = CreateSeparatedButtonSizer(style & ButtonSizerFlags); if ( sizerBtn ) - topsizer->Add(sizerBtn, 0, wxEXPAND | wxALL, 10 ); + topsizer->Add(sizerBtn, 0, center_flag | wxALL, 10 ); SetAutoLayout( true ); SetSizer( topsizer ); @@ -250,11 +145,6 @@ void wxGenericMessageDialog::OnNo(wxCommandEvent& WXUNUSED(event)) EndModal( wxID_NO ); } -void wxGenericMessageDialog::OnHelp(wxCommandEvent& WXUNUSED(event)) -{ - EndModal( wxID_HELP ); -} - void wxGenericMessageDialog::OnCancel(wxCommandEvent& WXUNUSED(event)) { // Allow cancellation via ESC/Close button except if @@ -266,15 +156,4 @@ void wxGenericMessageDialog::OnCancel(wxCommandEvent& WXUNUSED(event)) } } -int wxGenericMessageDialog::ShowModal() -{ - if ( !m_created ) - { - m_created = true; - DoCreateMsgdialog(); - } - - return wxMessageDialogBase::ShowModal(); -} - -#endif // wxUSE_MSGDLG +#endif // wxUSE_MSGDLG && !defined(__WXGTK20__) diff --git a/Source/3rd Party/wx/src/generic/numdlgg.cpp b/Source/3rd Party/wx/src/generic/numdlgg.cpp index 664e32413..38c1376d8 100644 --- a/Source/3rd Party/wx/src/generic/numdlgg.cpp +++ b/Source/3rd Party/wx/src/generic/numdlgg.cpp @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 23.07.99 -// RCS-ID: $Id$ +// RCS-ID: $Id: numdlgg.cpp 54861 2008-07-30 21:53:26Z VZ $ // Copyright: (c) Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -77,8 +77,7 @@ wxNumberEntryDialog::wxNumberEntryDialog(wxWindow *parent, long min, long max, const wxPoint& pos) - : wxDialog(GetParentForModalDialog(parent, 0), - wxID_ANY, caption, + : wxDialog(parent, wxID_ANY, caption, pos, wxDefaultSize) { m_value = value; @@ -135,7 +134,7 @@ void wxNumberEntryDialog::OnOK(wxCommandEvent& WXUNUSED(event)) { #if !wxUSE_SPINCTRL wxString tmp = m_spinctrl->GetValue(); - if ( wxSscanf(tmp, wxT("%ld"), &m_value) != 1 ) + if ( wxSscanf(tmp, _T("%ld"), &m_value) != 1 ) EndModal(wxID_CANCEL); else #else diff --git a/Source/3rd Party/wx/src/generic/printps.cpp b/Source/3rd Party/wx/src/generic/printps.cpp index 71df86e3e..fafc3d8f1 100644 --- a/Source/3rd Party/wx/src/generic/printps.cpp +++ b/Source/3rd Party/wx/src/generic/printps.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 04/01/98 -// RCS-ID: $Id$ +// RCS-ID: $Id: printps.cpp 42522 2006-10-27 13:07:40Z JS $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -40,7 +40,7 @@ #include "wx/generic/printps.h" #include "wx/printdlg.h" #include "wx/generic/prntdlgg.h" -#include "wx/progdlg.h" +#include "wx/generic/progdlgg.h" #include "wx/paper.h" #include @@ -72,7 +72,7 @@ wxPostScriptPrinter::~wxPostScriptPrinter() bool wxPostScriptPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt) { sm_abortIt = false; - sm_abortWindow = NULL; + sm_abortWindow = (wxWindow *) NULL; if (!printout) { @@ -80,6 +80,8 @@ bool wxPostScriptPrinter::Print(wxWindow *parent, wxPrintout *printout, bool pro return false; } + printout->SetIsPreview(false); + if (m_printDialogData.GetMinPage() < 1) m_printDialogData.SetMinPage(1); if (m_printDialogData.GetMaxPage() < 1) @@ -99,7 +101,7 @@ bool wxPostScriptPrinter::Print(wxWindow *parent, wxPrintout *printout, bool pro } // May have pressed cancel. - if (!dc || !dc->IsOk()) + if (!dc || !dc->Ok()) { if (dc) delete dc; sm_lastError = wxPRINTER_ERROR; @@ -111,8 +113,8 @@ bool wxPostScriptPrinter::Print(wxWindow *parent, wxPrintout *printout, bool pro printout->SetPPIScreen( (int) ((ScreenPixels.GetWidth() * 25.4) / ScreenMM.GetWidth()), (int) ((ScreenPixels.GetHeight() * 25.4) / ScreenMM.GetHeight()) ); - printout->SetPPIPrinter( dc->GetResolution(), - dc->GetResolution() ); + printout->SetPPIPrinter( wxPostScriptDC::GetResolution(), + wxPostScriptDC::GetResolution() ); // Set printout parameters printout->SetDC(dc); @@ -230,7 +232,7 @@ bool wxPostScriptPrinter::Print(wxWindow *parent, wxPrintout *printout, bool pro wxDC* wxPostScriptPrinter::PrintDialog(wxWindow *parent) { - wxDC* dc = NULL; + wxDC* dc = (wxDC*) NULL; wxGenericPrintDialog dialog( parent, &m_printDialogData ); if (dialog.ShowModal() == wxID_OK) @@ -330,20 +332,16 @@ void wxPostScriptPrintPreview::DetermineScaling() if (paper) { - int resolution = 600; // TODO, this is correct, but get this from wxPSDC somehow + wxSize ScreenPixels = wxGetDisplaySize(); + wxSize ScreenMM = wxGetDisplaySizeMM(); - const wxSize screenPPI = wxGetDisplayPPI(); - int logPPIScreenX = screenPPI.GetWidth(); - int logPPIScreenY = screenPPI.GetHeight(); - int logPPIPrinterX = resolution; - int logPPIPrinterY = resolution; - - m_previewPrintout->SetPPIScreen( logPPIScreenX, logPPIScreenY ); - m_previewPrintout->SetPPIPrinter( logPPIPrinterX, logPPIPrinterY ); + m_previewPrintout->SetPPIScreen( (int) ((ScreenPixels.GetWidth() * 25.4) / ScreenMM.GetWidth()), + (int) ((ScreenPixels.GetHeight() * 25.4) / ScreenMM.GetHeight()) ); + m_previewPrintout->SetPPIPrinter(wxPostScriptDC::GetResolution(), wxPostScriptDC::GetResolution()); wxSize sizeDevUnits(paper->GetSizeDeviceUnits()); - sizeDevUnits.x = (wxCoord)((float)sizeDevUnits.x * resolution / 72.0); - sizeDevUnits.y = (wxCoord)((float)sizeDevUnits.y * resolution / 72.0); + sizeDevUnits.x = (wxCoord)((float)sizeDevUnits.x * wxPostScriptDC::GetResolution() / 72.0); + sizeDevUnits.y = (wxCoord)((float)sizeDevUnits.y * wxPostScriptDC::GetResolution() / 72.0); wxSize sizeTenthsMM(paper->GetSize()); wxSize sizeMM(sizeTenthsMM.x / 10, sizeTenthsMM.y / 10); @@ -364,8 +362,8 @@ void wxPostScriptPrintPreview::DetermineScaling() m_previewPrintout->SetPaperRectPixels(wxRect(0, 0, m_pageWidth, m_pageHeight)); // At 100%, the page should look about page-size on the screen. - m_previewScaleX = float(logPPIScreenX) / logPPIPrinterX; - m_previewScaleY = float(logPPIScreenY) / logPPIPrinterY; + m_previewScaleX = (float)0.8 * 72.0 / (float)wxPostScriptDC::GetResolution(); + m_previewScaleY = m_previewScaleX; } } diff --git a/Source/3rd Party/wx/src/generic/prntdlgg.cpp b/Source/3rd Party/wx/src/generic/prntdlgg.cpp index 2909498f4..42658569c 100644 --- a/Source/3rd Party/wx/src/generic/prntdlgg.cpp +++ b/Source/3rd Party/wx/src/generic/prntdlgg.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 04/01/98 -// RCS-ID: $Id$ +// RCS-ID: $Id: prntdlgg.cpp 55256 2008-08-25 14:39:11Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -69,12 +69,7 @@ wxFORCE_LINK_MODULE(gnome_print) #endif -#if wxUSE_GTKPRINT - #include "wx/link.h" - wxFORCE_LINK_MODULE(gtk_print) -#endif - -#endif // !wxUniv +#endif // !__WXUNIVERSAL__ // ---------------------------------------------------------------------------- // global vars @@ -145,8 +140,7 @@ END_EVENT_TABLE() wxGenericPrintDialog::wxGenericPrintDialog(wxWindow *parent, wxPrintDialogData* data) - : wxPrintDialogBase(GetParentForModalDialog(parent, 0), - wxID_ANY, _("Print"), + : wxPrintDialogBase(parent, wxID_ANY, _("Print"), wxPoint(0,0), wxSize(600, 600), wxDEFAULT_DIALOG_STYLE | wxTAB_TRAVERSAL) @@ -159,8 +153,7 @@ wxGenericPrintDialog::wxGenericPrintDialog(wxWindow *parent, wxGenericPrintDialog::wxGenericPrintDialog(wxWindow *parent, wxPrintData* data) - : wxPrintDialogBase(GetParentForModalDialog(parent, 0), - wxID_ANY, _("Print"), + : wxPrintDialogBase(parent, wxID_ANY, _("Print"), wxPoint(0,0), wxSize(600, 600), wxDEFAULT_DIALOG_STYLE | wxTAB_TRAVERSAL) @@ -221,15 +214,16 @@ void wxGenericPrintDialog::Init(wxWindow * WXUNUSED(parent)) choices[0] = _("All"); choices[1] = _("Pages"); - m_fromText = NULL; - m_toText = NULL; - m_rangeRadioBox = NULL; + m_fromText = (wxTextCtrl*)NULL; + m_toText = (wxTextCtrl*)NULL; + m_rangeRadioBox = (wxRadioBox *)NULL; if (m_printDialogData.GetFromPage() != 0) { m_rangeRadioBox = new wxRadioBox(this, wxPRINTID_RANGE, _("Print Range"), wxDefaultPosition, wxDefaultSize, - 2, choices); + 2, choices, + 1, wxRA_VERTICAL); m_rangeRadioBox->SetSelection(1); mainsizer->Add( m_rangeRadioBox, 0, wxLEFT|wxTOP|wxRIGHT, 10 ); @@ -356,9 +350,9 @@ bool wxGenericPrintDialog::TransferDataToWindow() m_fromText->Enable(true); m_toText->Enable(true); if (m_printDialogData.GetFromPage() > 0) - m_fromText->SetValue(wxString::Format(wxT("%d"), m_printDialogData.GetFromPage())); + m_fromText->SetValue(wxString::Format(_T("%d"), m_printDialogData.GetFromPage())); if (m_printDialogData.GetToPage() > 0) - m_toText->SetValue(wxString::Format(wxT("%d"), m_printDialogData.GetToPage())); + m_toText->SetValue(wxString::Format(_T("%d"), m_printDialogData.GetToPage())); if(m_rangeRadioBox) { if (m_printDialogData.GetAllPages() || m_printDialogData.GetFromPage() == 0) @@ -380,7 +374,7 @@ bool wxGenericPrintDialog::TransferDataToWindow() } } m_noCopiesText->SetValue( - wxString::Format(wxT("%d"), m_printDialogData.GetNoCopies())); + wxString::Format(_T("%d"), m_printDialogData.GetNoCopies())); m_printToFileCheckBox->SetValue(m_printDialogData.GetPrintToFile()); m_printToFileCheckBox->Enable(m_printDialogData.GetEnablePrintToFile()); @@ -458,13 +452,13 @@ wxDialog(parent, wxID_ANY, _("Print Setup"), wxPoint(0,0), wxSize(600, 600), wxD } /* XPM */ -static const char* const check_xpm[] = { +static const char * check_xpm[] = { /* width height ncolors chars_per_pixel */ "16 16 3 1", /* colors */ -" s None c None", -"X c #000000", -". c #808080", +" s None c None", +"X c #000000", +". c #808080", /* pixels */ " ", " ", @@ -708,7 +702,7 @@ void wxGenericPrintSetupDialog::OnPrinter(wxListEvent& event) li.SetMask( wxLIST_MASK_TEXT ); li.SetId( event.GetIndex() ); m_printerListCtrl->GetItem( li ); - m_printerCommandText->SetValue( wxT("lpr -P") + li.GetText() ); + m_printerCommandText->SetValue( _T("lpr -P") + li.GetText() ); } } @@ -717,9 +711,9 @@ bool wxGenericPrintSetupDialog::TransferDataToWindow() wxPostScriptPrintNativeData *data = (wxPostScriptPrintNativeData *) m_printData.GetNativeData(); - if (m_printerCommandText && !data->GetPrinterCommand().empty()) + if (m_printerCommandText && data->GetPrinterCommand()) m_printerCommandText->SetValue(data->GetPrinterCommand()); - if (m_printerOptionsText && !data->GetPrinterOptions().empty()) + if (m_printerOptionsText && data->GetPrinterOptions()) m_printerOptionsText->SetValue(data->GetPrinterOptions()); if (m_colourCheckBox) m_colourCheckBox->SetValue(m_printData.GetColour()); @@ -804,7 +798,7 @@ wxComboBox *wxGenericPrintSetupDialog::CreatePaperTypeChoice() wxComboBox *choice = new wxComboBox( this, wxPRINTID_PAPERSIZE, - _("Paper size"), + _("Paper Size"), wxDefaultPosition, wxSize(width, wxDefaultCoord), n, choices ); @@ -831,7 +825,7 @@ wxGenericPageSetupDialog::wxGenericPageSetupDialog( wxWindow *parent, wxPageSetupDialogData* data) : wxPageSetupDialogBase( parent, wxID_ANY, - _("Page setup"), + _("Page Setup"), wxPoint(0,0), wxSize(600, 600), wxDEFAULT_DIALOG_STYLE|wxTAB_TRAVERSAL ) @@ -858,7 +852,7 @@ wxGenericPageSetupDialog::wxGenericPageSetupDialog( wxWindow *parent, m_paperTypeChoice = new wxComboBox( this, wxPRINTID_PAPERSIZE, - _("Paper size"), + _("Paper Size"), wxDefaultPosition, wxSize(300, wxDefaultCoord), n, choices ); @@ -1060,7 +1054,7 @@ wxComboBox *wxGenericPageSetupDialog::CreatePaperTypeChoice(int *x, int *y) wxComboBox *choice = new wxComboBox( this, wxPRINTID_PAPERSIZE, - _("Paper size"), + _("Paper Size"), wxPoint(*x, *y), wxSize(300, wxDefaultCoord), n, choices ); diff --git a/Source/3rd Party/wx/src/generic/progdlgg.cpp b/Source/3rd Party/wx/src/generic/progdlgg.cpp index 821e1c213..3b63456cf 100644 --- a/Source/3rd Party/wx/src/generic/progdlgg.cpp +++ b/Source/3rd Party/wx/src/generic/progdlgg.cpp @@ -1,10 +1,10 @@ ///////////////////////////////////////////////////////////////////////////// // Name: src/generic/progdlgg.cpp -// Purpose: wxGenericProgressDialog class +// Purpose: wxProgressDialog class // Author: Karsten Ballueder // Modified by: // Created: 09.05.1999 -// RCS-ID: $Id$ +// RCS-ID: $Id: progdlgg.cpp 50711 2007-12-15 02:57:58Z VZ $ // Copyright: (c) Karsten Ballueder // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -38,11 +38,9 @@ #include "wx/dcclient.h" #include "wx/timer.h" #include "wx/settings.h" - #include "wx/app.h" #endif #include "wx/progdlg.h" -#include "wx/evtloop.h" // --------------------------------------------------------------------------- // macros @@ -66,127 +64,60 @@ static const int wxID_SKIP = 32000; // whatever +// ---------------------------------------------------------------------------- +// private functions +// ---------------------------------------------------------------------------- + +// update the label to show the given time (in seconds) +static void SetTimeLabel(unsigned long val, wxStaticText *label); + // ---------------------------------------------------------------------------- // event tables // ---------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(wxGenericProgressDialog, wxDialog) - EVT_BUTTON(wxID_CANCEL, wxGenericProgressDialog::OnCancel) - EVT_BUTTON(wxID_SKIP, wxGenericProgressDialog::OnSkip) +BEGIN_EVENT_TABLE(wxProgressDialog, wxDialog) + EVT_BUTTON(wxID_CANCEL, wxProgressDialog::OnCancel) + EVT_BUTTON(wxID_SKIP, wxProgressDialog::OnSkip) - EVT_CLOSE(wxGenericProgressDialog::OnClose) + EVT_CLOSE(wxProgressDialog::OnClose) END_EVENT_TABLE() +IMPLEMENT_CLASS(wxProgressDialog, wxDialog) + // ============================================================================ -// wxGenericProgressDialog implementation +// wxProgressDialog implementation // ============================================================================ -wxIMPLEMENT_CLASS(wxProgressDialog, wxDialog) - // ---------------------------------------------------------------------------- -// wxGenericProgressDialog creation +// wxProgressDialog creation // ---------------------------------------------------------------------------- -void wxGenericProgressDialog::Init() +wxProgressDialog::wxProgressDialog(wxString const &title, + wxString const &message, + int maximum, + wxWindow *parent, + int style) + : wxDialog(parent, wxID_ANY, title), + m_skip(false), + m_delay(3), + m_hasAbortButton(false), + m_hasSkipButton(false) { // we may disappear at any moment, let the others know about it SetExtraStyle(GetExtraStyle() | wxWS_EX_TRANSIENT); + m_windowStyle |= style; - // Initialize all our members that we always use (even when we don't - // create a valid window in this class). + m_hasAbortButton = (style & wxPD_CAN_ABORT) != 0; + m_hasSkipButton = (style & wxPD_CAN_SKIP) != 0; - m_pdStyle = 0; - m_parentTop = NULL; - - m_gauge = NULL; - m_msg = NULL; - m_elapsed = - m_estimated = - m_remaining = NULL; - - m_state = Uncancelable; - m_maximum = 0; - - m_timeStart = wxGetCurrentTime(); - m_timeStop = (unsigned long)-1; - m_break = 0; - - m_skip = false; - -#if !defined(__SMARTPHONE__) - m_btnAbort = - m_btnSkip = NULL; -#endif - - m_display_estimated = - m_last_timeupdate = - m_ctdelay = 0; - - m_delay = 3; - - m_winDisabler = NULL; - m_tempEventLoop = NULL; -} - -wxGenericProgressDialog::wxGenericProgressDialog() - : wxDialog() -{ - Init(); -} - -wxGenericProgressDialog::wxGenericProgressDialog(const wxString& title, - const wxString& message, - int maximum, - wxWindow *parent, - int style) - : wxDialog() -{ - Init(); - - Create( title, message, maximum, parent, style ); -} - -void wxGenericProgressDialog::SetTopParent(wxWindow* parent) -{ - m_parentTop = GetParentForModalDialog(parent, GetWindowStyle()); -} - -bool wxGenericProgressDialog::Create( const wxString& title, - const wxString& message, - int maximum, - wxWindow *parent, - int style ) -{ - SetTopParent(parent); - - m_parentTop = wxGetTopLevelParent(parent); - m_pdStyle = style; - - wxWindow* const - realParent = GetParentForModalDialog(parent, GetWindowStyle()); - - if (!wxDialog::Create(realParent, wxID_ANY, title)) - return false; - - SetMaximum(maximum); - - // We need a running event loop in order to update the dialog and be able - // to process clicks on its buttons, so ensure that there is one running - // even if this means we have to start it ourselves (this happens most - // commonly during the program initialization, e.g. for the progress - // dialogs shown from overridden wxApp::OnInit()). - if ( !wxEventLoopBase::GetActive() ) - { - m_tempEventLoop = new wxEventLoop; - wxEventLoop::SetActive(m_tempEventLoop); - } + bool isPda = (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA); #if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) // we have to remove the "Close" button from the title bar then as it is // confusing to have it - it doesn't work anyhow // // FIXME: should probably have a (extended?) window style for this - if ( !HasPDFlag(wxPD_CAN_ABORT) ) + if ( !m_hasAbortButton ) { EnableCloseButton(false); } @@ -196,113 +127,156 @@ bool wxGenericProgressDialog::Create( const wxString& title, SetLeftMenu(); #endif - m_state = HasPDFlag(wxPD_CAN_ABORT) ? Continue : Uncancelable; + m_state = m_hasAbortButton ? Continue : Uncancelable; + m_maximum = maximum; - // top-level sizerTop - wxSizer * const sizerTop = new wxBoxSizer(wxVERTICAL); +#if defined(__WXMSW__) || defined(__WXPM__) + // we can't have values > 65,536 in the progress control under Windows, so + // scale everything down + m_factor = m_maximum / 65536 + 1; + m_maximum /= m_factor; +#endif // __WXMSW__ + + m_parentTop = wxGetTopLevelParent(parent); + + wxClientDC dc(this); + dc.SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)); + long widthText = 0; + dc.GetTextExtent(message, &widthText, NULL, NULL, NULL, NULL); + + wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); m_msg = new wxStaticText(this, wxID_ANY, message); - sizerTop->Add(m_msg, 0, wxLEFT | wxTOP, 2*LAYOUT_MARGIN); + sizer->Add(m_msg, 0, wxLEFT | wxTOP, 2*LAYOUT_MARGIN); - int gauge_style = wxGA_HORIZONTAL; - if ( style & wxPD_SMOOTH ) - gauge_style |= wxGA_SMOOTH; + wxSize sizeDlg, + sizeLabel = m_msg->GetSize(); + sizeDlg.y = 2*LAYOUT_MARGIN + sizeLabel.y; -#ifdef __WXMSW__ - maximum /= m_factor; -#endif + if ( maximum > 0 ) + { + int gauge_style = wxGA_HORIZONTAL; + if ( ( style & wxPD_SMOOTH ) == wxPD_SMOOTH ) + gauge_style |= wxGA_SMOOTH; + m_gauge = new wxGauge(this, wxID_ANY, m_maximum, + wxDefaultPosition, wxDefaultSize, + gauge_style ); - m_gauge = new wxGauge - ( - this, - wxID_ANY, - maximum, - wxDefaultPosition, - // make the progress bar sufficiently long - wxSize(wxMin(wxGetClientDisplayRect().width/3, 300), -1), - gauge_style - ); + sizer->Add(m_gauge, 0, wxLEFT | wxRIGHT | wxTOP | wxEXPAND, 2*LAYOUT_MARGIN); + m_gauge->SetValue(0); - sizerTop->Add(m_gauge, 0, wxLEFT | wxRIGHT | wxTOP | wxEXPAND, 2*LAYOUT_MARGIN); - m_gauge->SetValue(0); + wxSize sizeGauge = m_gauge->GetSize(); + sizeDlg.y += 2*LAYOUT_MARGIN + sizeGauge.y; + } + else + m_gauge = (wxGauge *)NULL; // create the estimated/remaining/total time zones if requested - m_elapsed = - m_estimated = - m_remaining = NULL; + m_elapsed = m_estimated = m_remaining = (wxStaticText*)NULL; + m_display_estimated = m_last_timeupdate = m_break = 0; + m_ctdelay = 0; + + // if we are going to have at least one label, remember it in this var + wxStaticText *label = NULL; // also count how many labels we really have size_t nTimeLabels = 0; - wxSizer * const sizerLabels = new wxFlexGridSizer(2); - if ( style & wxPD_ELAPSED_TIME ) { nTimeLabels++; - m_elapsed = CreateLabel(GetElapsedLabel(), sizerLabels); + label = + m_elapsed = CreateLabel(_("Elapsed time : "), sizer); } if ( style & wxPD_ESTIMATED_TIME ) { nTimeLabels++; - m_estimated = CreateLabel(GetEstimatedLabel(), sizerLabels); + label = + m_estimated = CreateLabel(_("Estimated time : "), sizer); } if ( style & wxPD_REMAINING_TIME ) { nTimeLabels++; - m_remaining = CreateLabel(GetRemainingLabel(), sizerLabels); + label = + m_remaining = CreateLabel(_("Remaining time : "), sizer); + } + + if ( nTimeLabels > 0 ) + { + // set it to the current time + m_timeStart = wxGetCurrentTime(); + sizeDlg.y += nTimeLabels * (label->GetSize().y + LAYOUT_MARGIN); } - sizerTop->Add(sizerLabels, 0, wxALIGN_CENTER_HORIZONTAL | wxTOP, LAYOUT_MARGIN); #if defined(__SMARTPHONE__) - if ( HasPDFlag(wxPD_CAN_SKIP) ) + if ( m_hasSkipButton ) SetRightMenu(wxID_SKIP, _("Skip")); - if ( HasPDFlag(wxPD_CAN_ABORT) ) + if ( m_hasAbortButton ) SetLeftMenu(wxID_CANCEL); #else - m_btnAbort = - m_btnSkip = NULL; - + m_btnAbort = m_btnSkip = (wxButton *)NULL; + bool sizeDlgModified = false; wxBoxSizer *buttonSizer = new wxBoxSizer(wxHORIZONTAL); - // Windows dialogs usually have buttons in the lower right corner const int sizerFlags = -#if defined(__WXMSW__) || defined(__WXPM__) || defined(__WXOSX__) +#if defined(__WXMSW__) || defined(__WXPM__) wxALIGN_RIGHT | wxALL #else // !MSW wxALIGN_CENTER_HORIZONTAL | wxBOTTOM | wxTOP #endif // MSW/!MSW ; - if ( HasPDFlag(wxPD_CAN_SKIP) ) + if ( m_hasSkipButton ) { - m_btnSkip = new wxButton(this, wxID_SKIP, _("&Skip")); + m_btnSkip = new wxButton(this, wxID_SKIP, _("Skip")); + // Windows dialogs usually have buttons in the lower right corner buttonSizer->Add(m_btnSkip, 0, sizerFlags, LAYOUT_MARGIN); + sizeDlg.y += 2*LAYOUT_MARGIN + wxButton::GetDefaultSize().y; + sizeDlgModified = true; } - if ( HasPDFlag(wxPD_CAN_ABORT) ) + if ( m_hasAbortButton ) { m_btnAbort = new wxButton(this, wxID_CANCEL); + // Windows dialogs usually have buttons in the lower right corner buttonSizer->Add(m_btnAbort, 0, sizerFlags, LAYOUT_MARGIN); + if(!sizeDlgModified) + sizeDlg.y += 2*LAYOUT_MARGIN + wxButton::GetDefaultSize().y; } - if ( !HasPDFlag(wxPD_CAN_SKIP | wxPD_CAN_ABORT) ) - buttonSizer->AddSpacer(LAYOUT_MARGIN); - - sizerTop->Add(buttonSizer, 0, sizerFlags, LAYOUT_MARGIN ); + sizer->Add(buttonSizer, 0, sizerFlags, LAYOUT_MARGIN ); #endif // __SMARTPHONE__/!__SMARTPHONE__ - SetSizerAndFit(sizerTop); + SetSizerAndFit(sizer); + + if (!isPda) + { + sizeDlg.y += 2*LAYOUT_MARGIN; + + // try to make the dialog not square but rectangular of reasonable width + sizeDlg.x = (wxCoord)wxMax(3*widthText/2, 4*sizeDlg.y/3); + SetClientSize(sizeDlg); + } Centre(wxCENTER_FRAME | wxBOTH); - DisableOtherWindows(); + if ( style & wxPD_APP_MODAL ) + { + m_winDisabler = new wxWindowDisabler(this); + } + else + { + if ( m_parentTop ) + m_parentTop->Disable(); + m_winDisabler = NULL; + } Show(); Enable(); @@ -316,118 +290,45 @@ bool wxGenericProgressDialog::Create( const wxString& title, } Update(); - return true; } -void wxGenericProgressDialog::UpdateTimeEstimates(int value, - unsigned long &elapsedTime, - unsigned long &estimatedTime, - unsigned long &remainingTime) +wxStaticText *wxProgressDialog::CreateLabel(const wxString& text, + wxSizer *sizer) { - unsigned long elapsed = wxGetCurrentTime() - m_timeStart; - if ( value != 0 && (m_last_timeupdate < elapsed || value == m_maximum) ) - { - m_last_timeupdate = elapsed; - unsigned long estimated = m_break + - (unsigned long)(( (double) (elapsed-m_break) * m_maximum ) / ((double)value)) ; - if ( estimated > m_display_estimated - && m_ctdelay >= 0 - ) - { - ++m_ctdelay; - } - else if ( estimated < m_display_estimated - && m_ctdelay <= 0 - ) - { - --m_ctdelay; - } - else - { - m_ctdelay = 0; - } - if ( m_ctdelay >= m_delay // enough confirmations for a higher value - || m_ctdelay <= (m_delay*-1) // enough confirmations for a lower value - || value == m_maximum // to stay consistent - || elapsed > m_display_estimated // to stay consistent - || ( elapsed > 0 && elapsed < 4 ) // additional updates in the beginning - ) - { - m_display_estimated = estimated; - m_ctdelay = 0; - } - } + wxBoxSizer *locsizer = new wxBoxSizer(wxLARGESMALL(wxHORIZONTAL,wxVERTICAL)); - if ( value != 0 ) - { - long display_remaining = m_display_estimated - elapsed; - if ( display_remaining < 0 ) - { - display_remaining = 0; - } - - estimatedTime = m_display_estimated; - remainingTime = display_remaining; - } - - elapsedTime = elapsed; -} - -// static -wxString wxGenericProgressDialog::GetFormattedTime(unsigned long timeInSec) -{ - wxString timeAsHMS; - - if ( timeInSec == (unsigned long)-1 ) - { - timeAsHMS = _("Unknown"); - } - else - { - unsigned hours = timeInSec / 3600; - unsigned minutes = (timeInSec % 3600) / 60; - unsigned seconds = timeInSec % 60; - timeAsHMS.Printf("%u:%02u:%02u", hours, minutes, seconds); - } - - return timeAsHMS; -} - -wxStaticText * -wxGenericProgressDialog::CreateLabel(const wxString& text, wxSizer *sizer) -{ - wxStaticText *label = new wxStaticText(this, wxID_ANY, text); - wxStaticText *value = new wxStaticText(this, wxID_ANY, _("unknown")); + wxStaticText *dummy = new wxStaticText(this, wxID_ANY, text); + wxStaticText *label = new wxStaticText(this, wxID_ANY, _("unknown")); // select placement most native or nice on target GUI #if defined(__SMARTPHONE__) - // value and time to the left in two rows - sizer->Add(label, 1, wxALIGN_LEFT); - sizer->Add(value, 1, wxALIGN_LEFT); + // label and time to the left in two rows + locsizer->Add(dummy, 1, wxALIGN_LEFT); + locsizer->Add(label, 1, wxALIGN_LEFT); + sizer->Add(locsizer, 0, wxALIGN_LEFT | wxTOP | wxLEFT, LAYOUT_MARGIN); #elif defined(__WXMSW__) || defined(__WXPM__) || defined(__WXMAC__) || defined(__WXGTK20__) - // value and time centered in one row - sizer->Add(label, 1, wxLARGESMALL(wxALIGN_RIGHT,wxALIGN_LEFT) | wxTOP | wxRIGHT, LAYOUT_MARGIN); - sizer->Add(value, 1, wxALIGN_LEFT | wxTOP, LAYOUT_MARGIN); + // label and time centered in one row + locsizer->Add(dummy, 1, wxLARGESMALL(wxALIGN_RIGHT,wxALIGN_LEFT)); + locsizer->Add(label, 1, wxALIGN_LEFT | wxLEFT, LAYOUT_MARGIN); + sizer->Add(locsizer, 0, wxALIGN_CENTER_HORIZONTAL | wxTOP, LAYOUT_MARGIN); #else - // value and time to the right in one row - sizer->Add(label); - sizer->Add(value, 0, wxLEFT, LAYOUT_MARGIN); + // label and time to the right in one row + sizer->Add(locsizer, 0, wxALIGN_RIGHT | wxRIGHT | wxTOP, LAYOUT_MARGIN); + locsizer->Add(dummy); + locsizer->Add(label, 0, wxLEFT, LAYOUT_MARGIN); #endif - return value; + return label; } // ---------------------------------------------------------------------------- -// wxGenericProgressDialog operations +// wxProgressDialog operations // ---------------------------------------------------------------------------- bool -wxGenericProgressDialog::Update(int value, const wxString& newmsg, bool *skip) +wxProgressDialog::Update(int value, const wxString& newmsg, bool *skip) { - if ( !DoBeforeUpdate(skip) ) - return false; - - wxCHECK_MSG( m_gauge, false, "dialog should be fully created" ); + wxASSERT_MSG( value == -1 || m_gauge, wxT("cannot update non existent dialog") ); #ifdef __WXMSW__ value /= m_factor; @@ -435,19 +336,54 @@ wxGenericProgressDialog::Update(int value, const wxString& newmsg, bool *skip) wxASSERT_MSG( value <= m_maximum, wxT("invalid progress value") ); - m_gauge->SetValue(value); + if ( m_gauge ) + m_gauge->SetValue(value); UpdateMessage(newmsg); if ( (m_elapsed || m_remaining || m_estimated) && (value != 0) ) { - unsigned long elapsed; - unsigned long display_remaining; + unsigned long elapsed = wxGetCurrentTime() - m_timeStart; + if ( m_last_timeupdate < elapsed + || value == m_maximum + ) + { + m_last_timeupdate = elapsed; + unsigned long estimated = m_break + + (unsigned long)(( (double) (elapsed-m_break) * m_maximum ) / ((double)value)) ; + if ( estimated > m_display_estimated + && m_ctdelay >= 0 + ) + { + ++m_ctdelay; + } + else if ( estimated < m_display_estimated + && m_ctdelay <= 0 + ) + { + --m_ctdelay; + } + else + { + m_ctdelay = 0; + } + if ( m_ctdelay >= m_delay // enough confirmations for a higher value + || m_ctdelay <= (m_delay*-1) // enough confirmations for a lower value + || value == m_maximum // to stay consistent + || elapsed > m_display_estimated // to stay consistent + || ( elapsed > 0 && elapsed < 4 ) // additional updates in the beginning + ) + { + m_display_estimated = estimated; + m_ctdelay = 0; + } + } - UpdateTimeEstimates( value, - elapsed, - m_display_estimated, - display_remaining ); + long display_remaining = m_display_estimated - elapsed; + if ( display_remaining < 0 ) + { + display_remaining = 0; + } SetTimeLabel(elapsed, m_elapsed); SetTimeLabel(m_display_estimated, m_estimated); @@ -468,7 +404,7 @@ wxGenericProgressDialog::Update(int value, const wxString& newmsg, bool *skip) // so that we return true below and that out [Cancel] handler knew what // to do m_state = Finished; - if( !HasPDFlag(wxPD_AUTO_HIDE) ) + if( !(GetWindowStyle() & wxPD_AUTO_HIDE) ) { EnableClose(); DisableSkip(); @@ -482,14 +418,8 @@ wxGenericProgressDialog::Update(int value, const wxString& newmsg, bool *skip) m_msg->SetLabel(_("Done.")); } - // allow the window to repaint: - // NOTE: since we yield only for UI events with this call, there - // should be no side-effects - wxEventLoopBase::GetActive()->YieldFor(wxEVT_CATEGORY_UI); + wxYieldIfNeeded() ; - // NOTE: this call results in a new event loop being created - // and to a call to ProcessPendingEvents() (which may generate - // unwanted re-entrancies). (void)ShowModal(); } else // auto hide @@ -504,7 +434,7 @@ wxGenericProgressDialog::Update(int value, const wxString& newmsg, bool *skip) } else // not at maximum yet { - DoAfterUpdate(); + return DoAfterUpdate(skip); } // update the display in case yielding above didn't do it @@ -513,12 +443,9 @@ wxGenericProgressDialog::Update(int value, const wxString& newmsg, bool *skip) return m_state != Canceled; } -bool wxGenericProgressDialog::Pulse(const wxString& newmsg, bool *skip) +bool wxProgressDialog::Pulse(const wxString& newmsg, bool *skip) { - if ( !DoBeforeUpdate(skip) ) - return false; - - wxCHECK_MSG( m_gauge, false, "dialog should be fully created" ); + wxASSERT_MSG( m_gauge, wxT("cannot update non existent dialog") ); // show a bit of progress m_gauge->Pulse(); @@ -534,18 +461,14 @@ bool wxGenericProgressDialog::Pulse(const wxString& newmsg, bool *skip) SetTimeLabel((unsigned long)-1, m_remaining); } - DoAfterUpdate(); - - return m_state != Canceled; + return DoAfterUpdate(skip); } -bool wxGenericProgressDialog::DoBeforeUpdate(bool *skip) +bool wxProgressDialog::DoAfterUpdate(bool *skip) { // we have to yield because not only we want to update the display but // also to process the clicks on the cancel and skip buttons - // NOTE: using YieldFor() this call shouldn't give re-entrancy problems - // for event handlers not interested to UI/user-input events. - wxEventLoopBase::GetActive()->YieldFor(wxEVT_CATEGORY_UI|wxEVT_CATEGORY_USER_INPUT); + wxYieldIfNeeded(); Update(); @@ -559,15 +482,7 @@ bool wxGenericProgressDialog::DoBeforeUpdate(bool *skip) return m_state != Canceled; } -void wxGenericProgressDialog::DoAfterUpdate() -{ - // allow the window to repaint: - // NOTE: since we yield only for UI events with this call, there - // should be no side-effects - wxEventLoopBase::GetActive()->YieldFor(wxEVT_CATEGORY_UI); -} - -void wxGenericProgressDialog::Resume() +void wxProgressDialog::Resume() { m_state = Continue; m_ctdelay = m_delay; // force an update of the elapsed/estimated/remaining time @@ -578,7 +493,7 @@ void wxGenericProgressDialog::Resume() m_skip = false; } -bool wxGenericProgressDialog::Show( bool show ) +bool wxProgressDialog::Show( bool show ) { // reenable other windows before hiding this one because otherwise // Windows wouldn't give the focus back to the window which had @@ -589,83 +504,11 @@ bool wxGenericProgressDialog::Show( bool show ) return wxDialog::Show(show); } -int wxGenericProgressDialog::GetValue() const -{ - wxCHECK_MSG( m_gauge, -1, "dialog should be fully created" ); - - return m_gauge->GetValue(); -} - -int wxGenericProgressDialog::GetRange() const -{ - return m_maximum; -} - -wxString wxGenericProgressDialog::GetMessage() const -{ - return m_msg->GetLabel(); -} - -void wxGenericProgressDialog::SetRange(int maximum) -{ - wxCHECK_RET( m_gauge, "dialog should be fully created" ); - - wxCHECK_RET( maximum > 0, "Invalid range" ); - - m_gauge->SetRange(maximum); - - SetMaximum(maximum); -} - -void wxGenericProgressDialog::SetMaximum(int maximum) -{ - m_maximum = maximum; - -#if defined(__WXMSW__) || defined(__WXPM__) - // we can't have values > 65,536 in the progress control under Windows, so - // scale everything down - m_factor = m_maximum / 65536 + 1; -#endif // __WXMSW__ -} - - -bool wxGenericProgressDialog::WasCancelled() const -{ - return HasPDFlag(wxPD_CAN_ABORT) && m_state == Canceled; -} - -bool wxGenericProgressDialog::WasSkipped() const -{ - return HasPDFlag(wxPD_CAN_SKIP) && m_skip; -} - -// static -void wxGenericProgressDialog::SetTimeLabel(unsigned long val, - wxStaticText *label) -{ - if ( label ) - { - wxString s; - - if (val != (unsigned long)-1) - { - s = GetFormattedTime(val); - } - else - { - s = _("Unknown"); - } - - if ( s != label->GetLabel() ) - label->SetLabel(s); - } -} - // ---------------------------------------------------------------------------- // event handlers // ---------------------------------------------------------------------------- -void wxGenericProgressDialog::OnCancel(wxCommandEvent& event) +void wxProgressDialog::OnCancel(wxCommandEvent& event) { if ( m_state == Finished ) { @@ -689,13 +532,13 @@ void wxGenericProgressDialog::OnCancel(wxCommandEvent& event) } } -void wxGenericProgressDialog::OnSkip(wxCommandEvent& WXUNUSED(event)) +void wxProgressDialog::OnSkip(wxCommandEvent& WXUNUSED(event)) { DisableSkip(); m_skip = true; } -void wxGenericProgressDialog::OnClose(wxCloseEvent& event) +void wxProgressDialog::OnClose(wxCloseEvent& event) { if ( m_state == Uncancelable ) { @@ -722,37 +565,18 @@ void wxGenericProgressDialog::OnClose(wxCloseEvent& event) // destruction // ---------------------------------------------------------------------------- -wxGenericProgressDialog::~wxGenericProgressDialog() +wxProgressDialog::~wxProgressDialog() { // normally this should have been already done, but just in case ReenableOtherWindows(); - - if ( m_tempEventLoop ) - { - wxEventLoopBase::SetActive(NULL); - delete m_tempEventLoop; - } } -void wxGenericProgressDialog::DisableOtherWindows() +void wxProgressDialog::ReenableOtherWindows() { - if ( HasPDFlag(wxPD_APP_MODAL) ) + if ( GetWindowStyle() & wxPD_APP_MODAL ) { - m_winDisabler = new wxWindowDisabler(this); - } - else - { - if ( m_parentTop ) - m_parentTop->Disable(); - m_winDisabler = NULL; - } -} - -void wxGenericProgressDialog::ReenableOtherWindows() -{ - if ( HasPDFlag(wxPD_APP_MODAL) ) - { - wxDELETE(m_winDisabler); + delete m_winDisabler; + m_winDisabler = (wxWindowDisabler *)NULL; } else { @@ -765,9 +589,32 @@ void wxGenericProgressDialog::ReenableOtherWindows() // private functions // ---------------------------------------------------------------------------- -void wxGenericProgressDialog::EnableSkip(bool enable) +static void SetTimeLabel(unsigned long val, wxStaticText *label) { - if ( HasPDFlag(wxPD_CAN_SKIP) ) + if ( label ) + { + wxString s; + + if (val != (unsigned long)-1) + { + unsigned long hours = val / 3600; + unsigned long minutes = (val % 3600) / 60; + unsigned long seconds = val % 60; + s.Printf(wxT("%lu:%02lu:%02lu"), hours, minutes, seconds); + } + else + { + s = _("Unknown"); + } + + if ( s != label->GetLabel() ) + label->SetLabel(s); + } +} + +void wxProgressDialog::EnableSkip(bool enable) +{ + if(m_hasSkipButton) { #ifdef __SMARTPHONE__ if(enable) @@ -781,9 +628,9 @@ void wxGenericProgressDialog::EnableSkip(bool enable) } } -void wxGenericProgressDialog::EnableAbort(bool enable) +void wxProgressDialog::EnableAbort(bool enable) { - if( HasPDFlag(wxPD_CAN_ABORT) ) + if(m_hasAbortButton) { #ifdef __SMARTPHONE__ if(enable) @@ -797,9 +644,9 @@ void wxGenericProgressDialog::EnableAbort(bool enable) } } -void wxGenericProgressDialog::EnableClose() +void wxProgressDialog::EnableClose() { - if(HasPDFlag(wxPD_CAN_ABORT)) + if(m_hasAbortButton) { #ifdef __SMARTPHONE__ SetLeftMenu(wxID_CANCEL, _("Close")); @@ -813,16 +660,13 @@ void wxGenericProgressDialog::EnableClose() } } -void wxGenericProgressDialog::UpdateMessage(const wxString &newmsg) +void wxProgressDialog::UpdateMessage(const wxString &newmsg) { if ( !newmsg.empty() && newmsg != m_msg->GetLabel() ) { m_msg->SetLabel(newmsg); - // allow the window to repaint: - // NOTE: since we yield only for UI events with this call, there - // should be no side-effects - wxEventLoopBase::GetActive()->YieldFor(wxEVT_CATEGORY_UI); + wxYieldIfNeeded() ; } } diff --git a/Source/3rd Party/wx/src/generic/renderg.cpp b/Source/3rd Party/wx/src/generic/renderg.cpp index a16cb07fa..8c36e31d1 100644 --- a/Source/3rd Party/wx/src/generic/renderg.cpp +++ b/Source/3rd Party/wx/src/generic/renderg.cpp @@ -4,9 +4,9 @@ // Author: Vadim Zeitlin // Modified by: // Created: 20.07.2003 -// RCS-ID: $Id$ +// RCS-ID: $Id: renderg.cpp 45498 2007-04-16 13:03:05Z VZ $ // Copyright: (c) 2003 Vadim Zeitlin -// Licence: wxWindows licence +// License: wxWindows license /////////////////////////////////////////////////////////////////////////////// // ============================================================================ @@ -32,16 +32,11 @@ #include "wx/settings.h" #include "wx/gdicmn.h" #include "wx/module.h" - #include "wx/control.h" #endif //WX_PRECOMP #include "wx/splitter.h" #include "wx/dcmirror.h" -#ifdef __WXMAC__ - #include "wx/osx/private.h" -#endif - // ---------------------------------------------------------------------------- // wxRendererGeneric: our wxRendererNative implementation // ---------------------------------------------------------------------------- @@ -67,8 +62,6 @@ public: virtual int GetHeaderButtonHeight(wxWindow *win); - virtual int GetHeaderButtonMargin(wxWindow *win); - virtual void DrawTreeItemButton(wxWindow *win, wxDC& dc, const wxRect& rect, @@ -101,8 +94,6 @@ public: const wxRect& rect, int flags = 0); - virtual wxSize GetCheckBoxSize(wxWindow *win); - virtual void DrawPushButton(wxWindow *win, wxDC& dc, const wxRect& rect, @@ -113,24 +104,6 @@ public: const wxRect& rect, int flags = 0); - virtual void DrawFocusRect(wxWindow* win, wxDC& dc, const wxRect& rect, int flags = 0); - - virtual void DrawChoice(wxWindow* win, wxDC& dc, const wxRect& rect, int flags=0); - - virtual void DrawComboBox(wxWindow* win, wxDC& dc, const wxRect& rect, int flags=0); - - virtual void DrawTextCtrl(wxWindow* win, wxDC& dc, const wxRect& rect, int flags=0); - - virtual void DrawRadioBitmap(wxWindow* win, wxDC& dc, const wxRect& rect, int flags=0); - -#ifdef wxHAS_DRAW_TITLE_BAR_BITMAP - virtual void DrawTitleBarBitmap(wxWindow *win, - wxDC& dc, - const wxRect& rect, - wxTitleBarButton button, - int flags = 0); -#endif // wxHAS_DRAW_TITLE_BAR_BITMAP - virtual wxSplitterRenderParams GetSplitterParams(const wxWindow *win); virtual wxRendererVersion GetVersion() const @@ -185,7 +158,10 @@ wxRendererNative& wxRendererNative::GetGeneric() void wxRendererGeneric::Cleanup() { - wxDELETE(sm_rendererGeneric); + if (sm_rendererGeneric) + delete sm_rendererGeneric; + + sm_rendererGeneric = NULL; } wxRendererGeneric* wxRendererGeneric::sm_rendererGeneric = NULL; @@ -236,6 +212,8 @@ wxRendererGeneric::DrawHeaderButton(wxWindow* win, wxHeaderSortIconType sortArrow, wxHeaderButtonParams* params) { + const int CORNER = 1; + const wxCoord x = rect.x, y = rect.y, w = rect.width, @@ -244,20 +222,22 @@ wxRendererGeneric::DrawHeaderButton(wxWindow* win, dc.SetBrush(wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE))); dc.SetPen(*wxTRANSPARENT_PEN); dc.DrawRectangle(rect); - + dc.SetBrush(*wxTRANSPARENT_BRUSH); dc.SetPen(m_penBlack); - dc.DrawLine( x+w-1, y, x+w-1, y+h ); // right (outer) - dc.DrawLine( x, y+h-1, x+w, y+h-1 ); // bottom (outer) + dc.DrawLine( x+w-CORNER+1, y, x+w, y+h ); // right (outer) + dc.DrawRectangle( x, y+h, w+1, 1 ); // bottom (outer) dc.SetPen(m_penDarkGrey); - dc.DrawLine( x+w-2, y+1, x+w-2, y+h-1 ); // right (inner) - dc.DrawLine( x+1, y+h-2, x+w-1, y+h-2 ); // bottom (inner) + dc.DrawLine( x+w-CORNER, y, x+w-1, y+h ); // right (inner) + dc.DrawRectangle( x+1, y+h-1, w-2, 1 ); // bottom (inner) dc.SetPen(m_penHighlight); - dc.DrawLine( x, y, x, y+h-1 ); // left (outer) - dc.DrawLine( x, y, x+w-1, y ); // top (outer) + dc.DrawRectangle( x, y, w-CORNER+1, 1 ); // top (outer) + dc.DrawRectangle( x, y, 1, h ); // left (outer) + dc.DrawLine( x, y+h-1, x+1, y+h-1 ); + dc.DrawLine( x+w-1, y, x+w-1, y+1 ); return DrawHeaderButtonContents(win, dc, rect, flags, sortArrow, params); } @@ -272,7 +252,7 @@ wxRendererGeneric::DrawHeaderButtonContents(wxWindow *win, wxHeaderButtonParams* params) { int labelWidth = 0; - + // Mark this item as selected. For the generic version we'll just draw an // underline if ( flags & wxCONTROL_SELECTED ) @@ -281,7 +261,7 @@ wxRendererGeneric::DrawHeaderButtonContents(wxWindow *win, // native hot-tracking line (on XP) const int penwidth = 3; int y = rect.y + rect.height + 1 - penwidth; - wxColour c = (params && params->m_selectionColour.IsOk()) ? + wxColour c = (params && params->m_selectionColour.Ok()) ? params->m_selectionColour : wxColour(0x66, 0x66, 0x66); wxPen pen(c, penwidth); pen.SetCap(wxCAP_BUTT); @@ -301,7 +281,7 @@ wxRendererGeneric::DrawHeaderButtonContents(wxWindow *win, ar.y += (rect.height - ar.height)/2; ar.x = ar.x + rect.width - 3*ar.width/2; arrowSpace = 3*ar.width/2; // space to preserve when drawing the label - + wxPoint triPt[3]; if ( sortArrow & wxHDR_SORT_ICON_UP ) { @@ -322,116 +302,107 @@ wxRendererGeneric::DrawHeaderButtonContents(wxWindow *win, triPt[2].y = ar.height; } - wxColour c = (params && params->m_arrowColour.IsOk()) ? + wxColour c = (params && params->m_arrowColour.Ok()) ? params->m_arrowColour : wxSystemSettings::GetColour(wxSYS_COLOUR_3DSHADOW); - - wxDCPenChanger setPen(dc, c); - wxDCBrushChanger setBrush(dc, c); - - wxDCClipper clip(dc, rect); - dc.DrawPolygon( 3, triPt, ar.x, ar.y); + dc.SetPen(wxPen(c)); + dc.SetBrush(wxBrush(c)); + dc.DrawPolygon( 3, triPt, ar.x, ar.y); } labelWidth += arrowSpace; - + + const int margin = 5; // number of pixels to reserve on either side of the label int bmpWidth = 0; + int txtEnd = 0; + + if ( params && params->m_labelBitmap.Ok() ) + bmpWidth = params->m_labelBitmap.GetWidth() + 2; - // draw the bitmap if there is one - if ( params && params->m_labelBitmap.IsOk() ) - { - int w = params->m_labelBitmap.GetWidth(); - int h = params->m_labelBitmap.GetHeight(); - - const int margin = 1; // an extra pixel on either side of the bitmap - - bmpWidth = w + 2*margin; - labelWidth += bmpWidth; - - int x = rect.x + margin; - const int y = rect.y + wxMax(1, (rect.height - h) / 2); - - const int extraSpace = rect.width - labelWidth; - if ( params->m_labelText.empty() && extraSpace > 0 ) - { - // use the alignment flags - switch (params->m_labelAlignment) - { - default: - case wxALIGN_LEFT: - break; - - case wxALIGN_CENTER: - x += extraSpace/2; - break; - - case wxALIGN_RIGHT: - x += extraSpace; - break; - } - } - - wxDCClipper clip(dc, rect); - dc.DrawBitmap(params->m_labelBitmap, x, y, true); - } - + labelWidth += bmpWidth + 2*margin; + // Draw a label if one is given if ( params && !params->m_labelText.empty() ) { - const int margin = 5; // number of pixels to reserve on either side of the label - labelWidth += 2*margin; - - wxFont font = params->m_labelFont.IsOk() ? + wxFont font = params->m_labelFont.Ok() ? params->m_labelFont : win->GetFont(); - wxColour clr = params->m_labelColour.IsOk() ? + wxColour clr = params->m_labelColour.Ok() ? params->m_labelColour : win->GetForegroundColour(); wxString label( params->m_labelText ); - + dc.SetFont(font); dc.SetTextForeground(clr); - dc.SetBackgroundMode(wxBRUSHSTYLE_TRANSPARENT); + dc.SetBackgroundMode(wxTRANSPARENT); - int tw, th, td; + int tw, th, td, x, y; dc.GetTextExtent( label, &tw, &th, &td); - - int x = rect.x + bmpWidth + margin; - const int y = rect.y + wxMax(0, (rect.height - (th+td)) / 2); - + labelWidth += tw; + y = rect.y + wxMax(0, (rect.height - (th+td)) / 2); + // truncate and add an ellipsis (...) if the text is too wide. - const int availWidth = rect.width - labelWidth; -#if wxUSE_CONTROLS - if ( tw > availWidth ) + int targetWidth = rect.width - arrowSpace - bmpWidth - 2*margin; + if ( tw > targetWidth ) { - label = wxControl::Ellipsize(label, - dc, - wxELLIPSIZE_END, - availWidth, - wxELLIPSIZE_FLAGS_NONE); - tw = dc.GetTextExtent(label).x; + int ellipsisWidth; + dc.GetTextExtent( wxT("..."), &ellipsisWidth, NULL); + do { + label.Truncate( label.length() - 1 ); + dc.GetTextExtent( label, &tw, &th); + } while (tw + ellipsisWidth > targetWidth && label.length() ); + label.append( wxT("...") ); + tw += ellipsisWidth; } - else // enough space, we can respect alignment -#endif // wxUSE_CONTROLS + + switch (params->m_labelAlignment) + { + default: + case wxALIGN_LEFT: + x = rect.x + margin; + break; + case wxALIGN_CENTER: + x = rect.x + wxMax(0, (rect.width - arrowSpace - tw - bmpWidth)/2); + break; + case wxALIGN_RIGHT: + x = rect.x + wxMax(0, rect.width - arrowSpace - margin - tw - bmpWidth); + break; + } + + dc.DrawText(label, x, y); + txtEnd = x + tw + 2; + } + + // draw the bitmap if there is one + if ( params && params->m_labelBitmap.Ok() ) + { + int w, h, x, y; + w = params->m_labelBitmap.GetWidth(); + h = params->m_labelBitmap.GetHeight(); + + y = rect.y + wxMax(1, (rect.height - h) / 2); + + // if there is a text label, then put the bitmap at the end of the label + if ( txtEnd != 0 ) + { + x = txtEnd; + } + // otherwise use the alignment flags + else { switch (params->m_labelAlignment) { default: case wxALIGN_LEFT: + x = rect.x + margin; break; - case wxALIGN_CENTER: - x += (availWidth - tw)/2; + x = rect.x + wxMax(1, (rect.width - arrowSpace - w)/2); break; - case wxALIGN_RIGHT: - x += availWidth - tw; + x = rect.x + wxMax(1, rect.width - arrowSpace - margin - w); break; } } - - dc.DrawText(label, x, y); - - labelWidth += tw; + dc.DrawBitmap(params->m_labelBitmap, x, y, true); } - return labelWidth; } @@ -449,11 +420,6 @@ int wxRendererGeneric::GetHeaderButtonHeight(wxWindow *win) return h + d + 2 * HEADER_OFFSET_Y + EXTRA_HEIGHT; } -int wxRendererGeneric::GetHeaderButtonMargin(wxWindow *WXUNUSED(win)) -{ - return 5; -} - // draw the plus or minus sign void @@ -650,11 +616,6 @@ wxRendererGeneric::DrawCheckBox(wxWindow *WXUNUSED(win), } } -wxSize wxRendererGeneric::GetCheckBoxSize(wxWindow *WXUNUSED(win)) -{ - return wxSize(16, 16); -} - void wxRendererGeneric::DrawPushButton(wxWindow *win, wxDC& dc, @@ -672,7 +633,7 @@ wxRendererGeneric::DrawPushButton(wxWindow *win, } void -wxRendererGeneric::DrawItemSelectionRect(wxWindow * win, +wxRendererGeneric::DrawItemSelectionRect(wxWindow * WXUNUSED(win), wxDC& dc, const wxRect& rect, int flags) @@ -695,104 +656,11 @@ wxRendererGeneric::DrawItemSelectionRect(wxWindow * win, } dc.SetBrush(brush); - if ((flags & wxCONTROL_CURRENT) && (flags & wxCONTROL_FOCUSED) -#if defined( __WXMAC__ ) && !defined(__WXUNIVERSAL__) && wxOSX_USE_CARBON - && IsControlActive( (ControlRef)win->GetHandle() ) -#endif - ) - dc.SetPen( *wxBLACK_PEN ); - else - dc.SetPen( *wxTRANSPARENT_PEN ); + dc.SetPen(flags & wxCONTROL_CURRENT ? *wxBLACK_PEN : *wxTRANSPARENT_PEN); dc.DrawRectangle( rect ); - - // it's unused everywhere except in wxOSX/Carbon - wxUnusedVar(win); } -void -wxRendererGeneric::DrawFocusRect(wxWindow* WXUNUSED(win), wxDC& dc, const wxRect& rect, int WXUNUSED(flags)) -{ - // draw the pixels manually because the "dots" in wxPen with wxDOT style - // may be short traits and not really dots - // - // note that to behave in the same manner as DrawRect(), we must exclude - // the bottom and right borders from the rectangle - wxCoord x1 = rect.GetLeft(), - y1 = rect.GetTop(), - x2 = rect.GetRight(), - y2 = rect.GetBottom(); - - dc.SetPen(m_penBlack); - -#ifdef __WXMAC__ - dc.SetLogicalFunction(wxCOPY); -#else - // this seems to be closer than what Windows does than wxINVERT although - // I'm still not sure if it's correct - dc.SetLogicalFunction(wxAND_REVERSE); -#endif - - wxCoord z; - for ( z = x1 + 1; z < x2; z += 2 ) - dc.DrawPoint(z, rect.GetTop()); - - wxCoord shift = z == x2 ? 0 : 1; - for ( z = y1 + shift; z < y2; z += 2 ) - dc.DrawPoint(x2, z); - - shift = z == y2 ? 0 : 1; - for ( z = x2 - shift; z > x1; z -= 2 ) - dc.DrawPoint(z, y2); - - shift = z == x1 ? 0 : 1; - for ( z = y2 - shift; z > y1; z -= 2 ) - dc.DrawPoint(x1, z); - - dc.SetLogicalFunction(wxCOPY); -} - -void wxRendererGeneric::DrawChoice(wxWindow* WXUNUSED(win), wxDC& WXUNUSED(dc), - const wxRect& WXUNUSED(rect), int WXUNUSED(flags)) -{ - wxFAIL_MSG("UNIMPLEMENTED: wxRendererGeneric::DrawChoice"); -} - -void wxRendererGeneric::DrawComboBox(wxWindow* WXUNUSED(win), wxDC& WXUNUSED(dc), - const wxRect& WXUNUSED(rect), int WXUNUSED(flags)) -{ - wxFAIL_MSG("UNIMPLEMENTED: wxRendererGeneric::DrawComboBox"); -} - -void wxRendererGeneric::DrawRadioBitmap(wxWindow* WXUNUSED(win), wxDC& WXUNUSED(dc), - const wxRect& WXUNUSED(rect), int WXUNUSED(flags)) -{ - wxFAIL_MSG("UNIMPLEMENTED: wxRendererGeneric::DrawRadioBitmap"); -} - -void wxRendererGeneric::DrawTextCtrl(wxWindow* WXUNUSED(win), wxDC& WXUNUSED(dc), - const wxRect& WXUNUSED(rect), int WXUNUSED(flags)) -{ - wxFAIL_MSG("UNIMPLEMENTED: wxRendererGeneric::DrawTextCtrl"); -} - -#ifdef wxHAS_DRAW_TITLE_BAR_BITMAP - -void wxRendererGeneric::DrawTitleBarBitmap(wxWindow * WXUNUSED(win), - wxDC& WXUNUSED(dc), - const wxRect& WXUNUSED(rect), - wxTitleBarButton WXUNUSED(button), - int WXUNUSED(flags)) -{ - // no need to fail here, if wxHAS_DRAW_TITLE_BAR_BITMAP is defined this - // will be implemented in the native renderer and this version is never - // going to be used -- but we still need to define it to allow - // instantiation of this class (which would have been pure virtual - // otherwise) -} - -#endif // wxHAS_DRAW_TITLE_BAR_BITMAP - // ---------------------------------------------------------------------------- // A module to allow cleanup of generic renderer. diff --git a/Source/3rd Party/wx/src/generic/richmsgdlgg.cpp b/Source/3rd Party/wx/src/generic/richmsgdlgg.cpp deleted file mode 100644 index e51df69cd..000000000 --- a/Source/3rd Party/wx/src/generic/richmsgdlgg.cpp +++ /dev/null @@ -1,90 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/generic/richmsgdlgg.cpp -// Purpose: wxGenericRichMessageDialog -// Author: Rickard Westerlund -// Created: 2010-07-04 -// RCS-ID: $Id$ -// Copyright: (c) 2010 wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#if wxUSE_RICHMSGDLG - -#ifndef WX_PRECOMP - #include "wx/checkbox.h" - #include "wx/stattext.h" - #include "wx/sizer.h" -#endif - -#include "wx/collpane.h" -#include "wx/richmsgdlg.h" - -wxIMPLEMENT_CLASS(wxRichMessageDialog, wxDialog) - -// ---------------------------------------------------------------------------- -// Events and handlers -// ---------------------------------------------------------------------------- - -BEGIN_EVENT_TABLE(wxGenericRichMessageDialog, wxRichMessageDialogBase) - EVT_COLLAPSIBLEPANE_CHANGED(wxID_ANY, - wxGenericRichMessageDialog::OnPaneChanged) -END_EVENT_TABLE() - -void wxGenericRichMessageDialog::OnPaneChanged(wxCollapsiblePaneEvent& event) -{ - if ( event.GetCollapsed() ) - m_detailsPane->SetLabel( m_detailsExpanderCollapsedLabel ); - else - m_detailsPane->SetLabel( m_detailsExpanderExpandedLabel ); -} - -// ---------------------------------------------------------------------------- -// wxGenericRichMessageDialog -// ---------------------------------------------------------------------------- - -void wxGenericRichMessageDialog::AddMessageDialogCheckBox(wxSizer *sizer) -{ - if ( !m_checkBoxText.empty() ) - { - m_checkBox = new wxCheckBox(this, wxID_ANY, m_checkBoxText); - m_checkBox->SetValue(m_checkBoxValue); - - sizer->Add(m_checkBox, wxSizerFlags().Left().Border(wxLEFT|wxTOP, 10)); - } -} - -void wxGenericRichMessageDialog::AddMessageDialogDetails(wxSizer *sizer) -{ - if ( !m_detailedText.empty() ) - { - wxSizer *sizerDetails = new wxBoxSizer( wxHORIZONTAL ); - - m_detailsPane = - new wxCollapsiblePane( this, -1, m_detailsExpanderCollapsedLabel ); - - // add the detailed text - wxWindow *windowPane = m_detailsPane->GetPane(); - wxSizer *sizerPane = new wxBoxSizer( wxHORIZONTAL ); - sizerPane->Add( new wxStaticText( windowPane, -1, m_detailedText ) ); - windowPane->SetSizer( sizerPane ); - - sizerDetails->Add( m_detailsPane, wxSizerFlags().Right().Expand() ); - sizer->Add( sizerDetails, 0, wxTOP|wxLEFT|wxRIGHT | wxALIGN_LEFT, 10 ); - } -} - -bool wxGenericRichMessageDialog::IsCheckBoxChecked() const -{ - // This function can be called before the dialog is shown and hence before - // the check box is created. - return m_checkBox ? m_checkBox->IsChecked() : m_checkBoxValue; -} - -#endif // wxUSE_RICHMSGDLG diff --git a/Source/3rd Party/wx/src/generic/scrlwing.cpp b/Source/3rd Party/wx/src/generic/scrlwing.cpp index 46d7ba944..4ee236b03 100644 --- a/Source/3rd Party/wx/src/generic/scrlwing.cpp +++ b/Source/3rd Party/wx/src/generic/scrlwing.cpp @@ -5,7 +5,7 @@ // Modified by: Vadim Zeitlin on 31.08.00: wxScrollHelper allows to implement. // Ron Lee on 10.4.02: virtual size / auto scrollbars et al. // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: scrlwing.cpp 60600 2009-05-12 10:33:49Z VZ $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -31,7 +31,9 @@ #include "wx/utils.h" #include "wx/panel.h" #include "wx/dcclient.h" - #include "wx/timer.h" + #if wxUSE_TIMER + #include "wx/timer.h" + #endif #include "wx/sizer.h" #include "wx/settings.h" #endif @@ -72,7 +74,7 @@ class WXDLLEXPORT wxScrollHelperEvtHandler : public wxEvtHandler { public: - wxScrollHelperEvtHandler(wxScrollHelperBase *scrollHelper) + wxScrollHelperEvtHandler(wxScrollHelper *scrollHelper) { m_scrollHelper = scrollHelper; } @@ -82,11 +84,11 @@ public: void ResetDrawnFlag() { m_hasDrawnWindow = false; } private: - wxScrollHelperBase *m_scrollHelper; + wxScrollHelper *m_scrollHelper; bool m_hasDrawnWindow; - wxDECLARE_NO_COPY_CLASS(wxScrollHelperEvtHandler); + DECLARE_NO_COPY_CLASS(wxScrollHelperEvtHandler) }; #if wxUSE_TIMER @@ -98,8 +100,7 @@ private: class wxAutoScrollTimer : public wxTimer { public: - wxAutoScrollTimer(wxWindow *winToScroll, - wxScrollHelperBase *scroll, + wxAutoScrollTimer(wxWindow *winToScroll, wxScrollHelper *scroll, wxEventType eventTypeToSend, int pos, int orient); @@ -107,12 +108,12 @@ public: private: wxWindow *m_win; - wxScrollHelperBase *m_scrollHelper; + wxScrollHelper *m_scrollHelper; wxEventType m_eventType; int m_pos, m_orient; - wxDECLARE_NO_COPY_CLASS(wxAutoScrollTimer); + DECLARE_NO_COPY_CLASS(wxAutoScrollTimer) }; // ============================================================================ @@ -124,7 +125,7 @@ private: // ---------------------------------------------------------------------------- wxAutoScrollTimer::wxAutoScrollTimer(wxWindow *winToScroll, - wxScrollHelperBase *scroll, + wxScrollHelper *scroll, wxEventType eventTypeToSend, int pos, int orient) { @@ -152,7 +153,7 @@ void wxAutoScrollTimer::Notify() { // and then send a pseudo mouse-move event to refresh the selection wxMouseEvent event2(wxEVT_MOTION); - event2.SetPosition(wxGetMousePosition()); + wxGetMousePosition(&event2.m_x, &event2.m_y); // the mouse event coordinates should be client, not screen as // returned by wxGetMousePosition @@ -203,13 +204,8 @@ bool wxScrollHelperEvtHandler::ProcessEvent(wxEvent& event) // user code defined OnPaint() in the derived class) m_hasDrawnWindow = true; - // Pass it on to the real handler: notice that we must not call - // ProcessEvent() on this object itself as it wouldn't pass it to the next - // handler (i.e. the real window) if we're called from a previous handler - // (as indicated by "process here only" flag being set) and we do want to - // execute the handler defined in the window we're associated with right - // now, without waiting until TryAfter() is called from wxEvtHandler. - bool processed = m_nextHandler->ProcessEvent(event); + // pass it on to the real handler + bool processed = wxEvtHandler::ProcessEvent(event); // always process the size events ourselves, even if the user code handles // them as well, as we need to AdjustScrollbars() @@ -236,6 +232,10 @@ bool wxScrollHelperEvtHandler::ProcessEvent(wxEvent& event) } } + // reset the skipped flag to false as it might have been set to true in + // ProcessEvent() above + event.Skip(false); + if ( evType == wxEVT_PAINT ) { m_scrollHelper->HandleOnPaint((wxPaintEvent &)event); @@ -248,12 +248,6 @@ bool wxScrollHelperEvtHandler::ProcessEvent(wxEvent& event) return true; } - // reset the skipped flag (which might have been set to true in - // ProcessEvent() above) to be able to test it below - bool wasSkipped = event.GetSkipped(); - if ( wasSkipped ) - event.Skip(false); - if ( evType == wxEVT_SCROLLWIN_TOP || evType == wxEVT_SCROLLWIN_BOTTOM || evType == wxEVT_SCROLLWIN_LINEUP || @@ -263,16 +257,8 @@ bool wxScrollHelperEvtHandler::ProcessEvent(wxEvent& event) evType == wxEVT_SCROLLWIN_THUMBTRACK || evType == wxEVT_SCROLLWIN_THUMBRELEASE ) { - m_scrollHelper->HandleOnScroll((wxScrollWinEvent &)event); - if ( !event.GetSkipped() ) - { - // it makes sense to indicate that we processed the message as we - // did scroll the window (and also notice that wxAutoScrollTimer - // relies on our return value to stop scrolling when we are at top - // or bottom already) - processed = true; - wasSkipped = false; - } + m_scrollHelper->HandleOnScroll((wxScrollWinEvent &)event); + return !event.GetSkipped(); } if ( evType == wxEVT_ENTER_WINDOW ) @@ -284,52 +270,28 @@ bool wxScrollHelperEvtHandler::ProcessEvent(wxEvent& event) m_scrollHelper->HandleOnMouseLeave((wxMouseEvent &)event); } #if wxUSE_MOUSEWHEEL - // Use GTK's own scroll wheel handling in GtkScrolledWindow -#ifndef __WXGTK20__ else if ( evType == wxEVT_MOUSEWHEEL ) { m_scrollHelper->HandleOnMouseWheel((wxMouseEvent &)event); return true; } -#endif #endif // wxUSE_MOUSEWHEEL else if ( evType == wxEVT_CHAR ) { m_scrollHelper->HandleOnChar((wxKeyEvent &)event); - if ( !event.GetSkipped() ) - { - processed = true; - wasSkipped = false; - } + return !event.GetSkipped(); } - event.Skip(wasSkipped); - - // We called ProcessEvent() on the next handler, meaning that we explicitly - // worked around the request to process the event in this handler only. As - // explained above, this is unfortunately really necessary but the trouble - // is that the event will continue to be post-processed by the previous - // handler resulting in duplicate calls to event handlers. Call the special - // function below to prevent this from happening, base class DoTryChain() - // will check for it and behave accordingly. - // - // And if we're not called from DoTryChain(), this won't do anything anyhow. - event.DidntHonourProcessOnlyIn(); - - return processed; + return false; } -// ============================================================================ -// wxScrollHelperBase implementation -// ============================================================================ - // ---------------------------------------------------------------------------- -// wxScrollHelperBase construction +// wxScrollHelper construction // ---------------------------------------------------------------------------- -wxScrollHelperBase::wxScrollHelperBase(wxWindow *win) +wxScrollHelper::wxScrollHelper(wxWindow *win) { - wxASSERT_MSG( win, wxT("associated window can't be NULL in wxScrollHelper") ); + wxASSERT_MSG( win, _T("associated window can't be NULL in wxScrollHelper") ); m_xScrollPixelsPerLine = m_yScrollPixelsPerLine = @@ -343,8 +305,6 @@ wxScrollHelperBase::wxScrollHelperBase(wxWindow *win) m_xScrollingEnabled = m_yScrollingEnabled = true; - m_kbdScrollingEnabled = true; - m_scaleX = m_scaleY = 1.0; #if wxUSE_MOUSEWHEEL @@ -352,21 +312,21 @@ wxScrollHelperBase::wxScrollHelperBase(wxWindow *win) #endif m_win = - m_targetWindow = NULL; + m_targetWindow = (wxWindow *)NULL; - m_timerAutoScroll = NULL; + m_timerAutoScroll = (wxTimer *)NULL; m_handler = NULL; m_win = win; - - m_win->SetScrollHelper(static_cast(this)); + + m_win->SetScrollHelper( this ); // by default, the associated window is also the target window DoSetTargetWindow(win); } -wxScrollHelperBase::~wxScrollHelperBase() +wxScrollHelper::~wxScrollHelper() { StopAutoScrolling(); @@ -377,25 +337,24 @@ wxScrollHelperBase::~wxScrollHelperBase() // setting scrolling parameters // ---------------------------------------------------------------------------- -void wxScrollHelperBase::SetScrollbars(int pixelsPerUnitX, - int pixelsPerUnitY, - int noUnitsX, - int noUnitsY, - int xPos, - int yPos, - bool noRefresh) +void wxScrollHelper::SetScrollbars(int pixelsPerUnitX, + int pixelsPerUnitY, + int noUnitsX, + int noUnitsY, + int xPos, + int yPos, + bool noRefresh) { - // Convert positions expressed in scroll units to positions in pixels. - int xPosInPixels = (xPos + m_xScrollPosition)*m_xScrollPixelsPerLine, - yPosInPixels = (yPos + m_yScrollPosition)*m_yScrollPixelsPerLine; + int xpos, ypos; + CalcUnscrolledPosition(xPos, yPos, &xpos, &ypos); bool do_refresh = ( (noUnitsX != 0 && m_xScrollLines == 0) || - (noUnitsX < m_xScrollLines && xPosInPixels > pixelsPerUnitX * noUnitsX) || + (noUnitsX < m_xScrollLines && xpos > pixelsPerUnitX * noUnitsX) || (noUnitsY != 0 && m_yScrollLines == 0) || - (noUnitsY < m_yScrollLines && yPosInPixels > pixelsPerUnitY * noUnitsY) || + (noUnitsY < m_yScrollLines && ypos > pixelsPerUnitY * noUnitsY) || (xPos != m_xScrollPosition) || (yPos != m_yScrollPosition) ); @@ -445,7 +404,7 @@ void wxScrollHelperBase::SetScrollbars(int pixelsPerUnitX, // [target] window handling // ---------------------------------------------------------------------------- -void wxScrollHelperBase::DeleteEvtHandler() +void wxScrollHelper::DeleteEvtHandler() { // search for m_handler in the handler list if ( m_win && m_handler ) @@ -461,13 +420,7 @@ void wxScrollHelperBase::DeleteEvtHandler() } } -void wxScrollHelperBase::ResetDrawnFlag() -{ - wxCHECK_RET( m_handler, "invalid use of ResetDrawnFlag - no handler?" ); - m_handler->ResetDrawnFlag(); -} - -void wxScrollHelperBase::DoSetTargetWindow(wxWindow *target) +void wxScrollHelper::DoSetTargetWindow(wxWindow *target) { m_targetWindow = target; #ifdef __WXMAC__ @@ -487,7 +440,7 @@ void wxScrollHelperBase::DoSetTargetWindow(wxWindow *target) } } -void wxScrollHelperBase::SetTargetWindow(wxWindow *target) +void wxScrollHelper::SetTargetWindow(wxWindow *target) { wxCHECK_RET( target, wxT("target window must not be NULL") ); @@ -497,7 +450,7 @@ void wxScrollHelperBase::SetTargetWindow(wxWindow *target) DoSetTargetWindow(target); } -wxWindow *wxScrollHelperBase::GetTargetWindow() const +wxWindow *wxScrollHelper::GetTargetWindow() const { return m_targetWindow; } @@ -506,7 +459,7 @@ wxWindow *wxScrollHelperBase::GetTargetWindow() const // scrolling implementation itself // ---------------------------------------------------------------------------- -void wxScrollHelperBase::HandleOnScroll(wxScrollWinEvent& event) +void wxScrollHelper::HandleOnScroll(wxScrollWinEvent& event) { int nScrollInc = CalcScrollInc(event); if ( nScrollInc == 0 ) @@ -518,6 +471,7 @@ void wxScrollHelperBase::HandleOnScroll(wxScrollWinEvent& event) } bool needsRefresh = false; + int dx = 0, dy = 0; int orient = event.GetOrientation(); @@ -578,7 +532,7 @@ void wxScrollHelperBase::HandleOnScroll(wxScrollWinEvent& event) } } -int wxScrollHelperBase::CalcScrollInc(wxScrollWinEvent& event) +int wxScrollHelper::CalcScrollInc(wxScrollWinEvent& event) { int pos = event.GetPosition(); int orient = event.GetOrientation(); @@ -631,48 +585,261 @@ int wxScrollHelperBase::CalcScrollInc(wxScrollWinEvent& event) if (orient == wxHORIZONTAL) { - if ( m_xScrollPosition + nScrollInc < 0 ) + if (m_xScrollPixelsPerLine > 0) { - // As -ve as we can go - nScrollInc = -m_xScrollPosition; - } - else // check for the other bound - { - const int posMax = m_xScrollLines - m_xScrollLinesPerPage; - if ( m_xScrollPosition + nScrollInc > posMax ) + if ( m_xScrollPosition + nScrollInc < 0 ) { - // As +ve as we can go - nScrollInc = posMax - m_xScrollPosition; + // As -ve as we can go + nScrollInc = -m_xScrollPosition; + } + else // check for the other bound + { + const int posMax = m_xScrollLines - m_xScrollLinesPerPage; + if ( m_xScrollPosition + nScrollInc > posMax ) + { + // As +ve as we can go + nScrollInc = posMax - m_xScrollPosition; + } } } + else + m_targetWindow->Refresh(true, GetScrollRect()); } - else // wxVERTICAL + else { - if ( m_yScrollPosition + nScrollInc < 0 ) + if ( m_yScrollPixelsPerLine > 0 ) { - // As -ve as we can go - nScrollInc = -m_yScrollPosition; - } - else // check for the other bound - { - const int posMax = m_yScrollLines - m_yScrollLinesPerPage; - if ( m_yScrollPosition + nScrollInc > posMax ) + if ( m_yScrollPosition + nScrollInc < 0 ) { - // As +ve as we can go - nScrollInc = posMax - m_yScrollPosition; + // As -ve as we can go + nScrollInc = -m_yScrollPosition; } + else // check for the other bound + { + const int posMax = m_yScrollLines - m_yScrollLinesPerPage; + if ( m_yScrollPosition + nScrollInc > posMax ) + { + // As +ve as we can go + nScrollInc = posMax - m_yScrollPosition; + } + } + } + else + { + // VZ: why do we do this? (FIXME) + m_targetWindow->Refresh(true, GetScrollRect()); } } return nScrollInc; } -void wxScrollHelperBase::DoPrepareDC(wxDC& dc) +// Adjust the scrollbars - new version. +void wxScrollHelper::AdjustScrollbars() +{ + static wxRecursionGuardFlag s_flagReentrancy; + wxRecursionGuard guard(s_flagReentrancy); + if ( guard.IsInside() ) + { + // don't reenter AdjustScrollbars() while another call to + // AdjustScrollbars() is in progress because this may lead to calling + // ScrollWindow() twice and this can really happen under MSW if + // SetScrollbar() call below adds or removes the scrollbar which + // changes the window size and hence results in another + // AdjustScrollbars() call + return; + } + + int w = 0, h = 0; + int oldw, oldh; + + int oldXScroll = m_xScrollPosition; + int oldYScroll = m_yScrollPosition; + + // VZ: at least under Windows this loop is useless because when scrollbars + // [dis]appear we get a WM_SIZE resulting in another call to + // AdjustScrollbars() anyhow. As it doesn't seem to do any harm I leave + // it here for now but it would be better to ensure that all ports + // generate EVT_SIZE when scrollbars [dis]appear, emulating it if + // necessary, and remove it later + // JACS: Stop potential infinite loop by limiting number of iterations + int iterationCount = 0; + const int iterationMax = 5; + do + { + iterationCount ++; + + GetTargetSize(&w, 0); + + // scroll lines per page: if 0, no scrolling is needed + int linesPerPage; + + if ( m_xScrollPixelsPerLine == 0 ) + { + // scrolling is disabled + m_xScrollLines = 0; + m_xScrollPosition = 0; + linesPerPage = 0; + } + else // might need scrolling + { + // Round up integer division to catch any "leftover" client space. + const int wVirt = m_targetWindow->GetVirtualSize().GetWidth(); + m_xScrollLines = (wVirt + m_xScrollPixelsPerLine - 1) / m_xScrollPixelsPerLine; + + // Calculate page size i.e. number of scroll units you get on the + // current client window. + linesPerPage = w / m_xScrollPixelsPerLine; + + // Special case. When client and virtual size are very close but + // the client is big enough, kill scrollbar. + if ((linesPerPage < m_xScrollLines) && (w >= wVirt)) ++linesPerPage; + + if (linesPerPage >= m_xScrollLines) + { + // we're big enough to not need scrolling + linesPerPage = + m_xScrollLines = + m_xScrollPosition = 0; + } + else // we do need a scrollbar + { + if ( linesPerPage < 1 ) + linesPerPage = 1; + + // Correct position if greater than extent of canvas minus + // the visible portion of it or if below zero + const int posMax = m_xScrollLines - linesPerPage; + if ( m_xScrollPosition > posMax ) + m_xScrollPosition = posMax; + else if ( m_xScrollPosition < 0 ) + m_xScrollPosition = 0; + } + } + + m_win->SetScrollbar(wxHORIZONTAL, m_xScrollPosition, + linesPerPage, m_xScrollLines); + + // The amount by which we scroll when paging + SetScrollPageSize(wxHORIZONTAL, linesPerPage); + + GetTargetSize(0, &h); + + if ( m_yScrollPixelsPerLine == 0 ) + { + // scrolling is disabled + m_yScrollLines = 0; + m_yScrollPosition = 0; + linesPerPage = 0; + } + else // might need scrolling + { + // Round up integer division to catch any "leftover" client space. + const int hVirt = m_targetWindow->GetVirtualSize().GetHeight(); + m_yScrollLines = ( hVirt + m_yScrollPixelsPerLine - 1 ) / m_yScrollPixelsPerLine; + + // Calculate page size i.e. number of scroll units you get on the + // current client window. + linesPerPage = h / m_yScrollPixelsPerLine; + + // Special case. When client and virtual size are very close but + // the client is big enough, kill scrollbar. + if ((linesPerPage < m_yScrollLines) && (h >= hVirt)) ++linesPerPage; + + if (linesPerPage >= m_yScrollLines) + { + // we're big enough to not need scrolling + linesPerPage = + m_yScrollLines = + m_yScrollPosition = 0; + } + else // we do need a scrollbar + { + if ( linesPerPage < 1 ) + linesPerPage = 1; + + // Correct position if greater than extent of canvas minus + // the visible portion of it or if below zero + const int posMax = m_yScrollLines - linesPerPage; + if ( m_yScrollPosition > posMax ) + m_yScrollPosition = posMax; + else if ( m_yScrollPosition < 0 ) + m_yScrollPosition = 0; + } + } + + m_win->SetScrollbar(wxVERTICAL, m_yScrollPosition, + linesPerPage, m_yScrollLines); + + // The amount by which we scroll when paging + SetScrollPageSize(wxVERTICAL, linesPerPage); + + + // If a scrollbar (dis)appeared as a result of this, adjust them again. + oldw = w; + oldh = h; + + GetTargetSize( &w, &h ); + } while ( (w != oldw || h != oldh) && (iterationCount < iterationMax) ); + +#ifdef __WXMOTIF__ + // Sorry, some Motif-specific code to implement a backing pixmap + // for the wxRETAINED style. Implementing a backing store can't + // be entirely generic because it relies on the wxWindowDC implementation + // to duplicate X drawing calls for the backing pixmap. + + if ( m_targetWindow->GetWindowStyle() & wxRETAINED ) + { + Display* dpy = XtDisplay((Widget)m_targetWindow->GetMainWidget()); + + int totalPixelWidth = m_xScrollLines * m_xScrollPixelsPerLine; + int totalPixelHeight = m_yScrollLines * m_yScrollPixelsPerLine; + if (m_targetWindow->GetBackingPixmap() && + !((m_targetWindow->GetPixmapWidth() == totalPixelWidth) && + (m_targetWindow->GetPixmapHeight() == totalPixelHeight))) + { + XFreePixmap (dpy, (Pixmap) m_targetWindow->GetBackingPixmap()); + m_targetWindow->SetBackingPixmap((WXPixmap) 0); + } + + if (!m_targetWindow->GetBackingPixmap() && + (m_xScrollLines != 0) && (m_yScrollLines != 0)) + { + int depth = wxDisplayDepth(); + m_targetWindow->SetPixmapWidth(totalPixelWidth); + m_targetWindow->SetPixmapHeight(totalPixelHeight); + m_targetWindow->SetBackingPixmap((WXPixmap) XCreatePixmap (dpy, RootWindow (dpy, DefaultScreen (dpy)), + m_targetWindow->GetPixmapWidth(), m_targetWindow->GetPixmapHeight(), depth)); + } + + } +#endif // Motif + + if (oldXScroll != m_xScrollPosition) + { + if (m_xScrollingEnabled) + m_targetWindow->ScrollWindow( m_xScrollPixelsPerLine * (oldXScroll - m_xScrollPosition), 0, + GetScrollRect() ); + else + m_targetWindow->Refresh(true, GetScrollRect()); + } + + if (oldYScroll != m_yScrollPosition) + { + if (m_yScrollingEnabled) + m_targetWindow->ScrollWindow( 0, m_yScrollPixelsPerLine * (oldYScroll-m_yScrollPosition), + GetScrollRect() ); + else + m_targetWindow->Refresh(true, GetScrollRect()); + } +} + +void wxScrollHelper::DoPrepareDC(wxDC& dc) { wxPoint pt = dc.GetDeviceOrigin(); #ifdef __WXGTK__ // It may actually be correct to always query - // the m_sign from the DC here, but I leave the + // the m_sign from the DC here, but I leve the // #ifdef GTK for now. if (m_win->GetLayoutDirection() == wxLayout_RightToLeft) dc.SetDeviceOrigin( pt.x + m_xScrollPosition * m_xScrollPixelsPerLine, @@ -684,7 +851,7 @@ void wxScrollHelperBase::DoPrepareDC(wxDC& dc) dc.SetUserScale( m_scaleX, m_scaleY ); } -void wxScrollHelperBase::SetScrollRate( int xstep, int ystep ) +void wxScrollHelper::SetScrollRate( int xstep, int ystep ) { int old_x = m_xScrollPixelsPerLine * m_xScrollPosition; int old_y = m_yScrollPixelsPerLine * m_yScrollPosition; @@ -702,7 +869,7 @@ void wxScrollHelperBase::SetScrollRate( int xstep, int ystep ) AdjustScrollbars(); } -void wxScrollHelperBase::GetScrollPixelsPerUnit (int *x_unit, int *y_unit) const +void wxScrollHelper::GetScrollPixelsPerUnit (int *x_unit, int *y_unit) const { if ( x_unit ) *x_unit = m_xScrollPixelsPerLine; @@ -711,7 +878,7 @@ void wxScrollHelperBase::GetScrollPixelsPerUnit (int *x_unit, int *y_unit) const } -int wxScrollHelperBase::GetScrollLines( int orient ) const +int wxScrollHelper::GetScrollLines( int orient ) const { if ( orient == wxHORIZONTAL ) return m_xScrollLines; @@ -719,7 +886,7 @@ int wxScrollHelperBase::GetScrollLines( int orient ) const return m_yScrollLines; } -int wxScrollHelperBase::GetScrollPageSize(int orient) const +int wxScrollHelper::GetScrollPageSize(int orient) const { if ( orient == wxHORIZONTAL ) return m_xScrollLinesPerPage; @@ -727,7 +894,7 @@ int wxScrollHelperBase::GetScrollPageSize(int orient) const return m_yScrollLinesPerPage; } -void wxScrollHelperBase::SetScrollPageSize(int orient, int pageSize) +void wxScrollHelper::SetScrollPageSize(int orient, int pageSize) { if ( orient == wxHORIZONTAL ) m_xScrollLinesPerPage = pageSize; @@ -735,14 +902,89 @@ void wxScrollHelperBase::SetScrollPageSize(int orient, int pageSize) m_yScrollLinesPerPage = pageSize; } -void wxScrollHelperBase::EnableScrolling (bool x_scroll, bool y_scroll) +/* + * Scroll to given position (scroll position, not pixel position) + */ +void wxScrollHelper::Scroll( int x_pos, int y_pos ) +{ + if (!m_targetWindow) + return; + + if (((x_pos == -1) || (x_pos == m_xScrollPosition)) && + ((y_pos == -1) || (y_pos == m_yScrollPosition))) return; + + int w = 0, h = 0; + GetTargetSize(&w, &h); + + // compute new position: + int new_x = m_xScrollPosition; + int new_y = m_yScrollPosition; + + if ((x_pos != -1) && (m_xScrollPixelsPerLine)) + { + new_x = x_pos; + + // Calculate page size i.e. number of scroll units you get on the + // current client window + int noPagePositions = w/m_xScrollPixelsPerLine; + if (noPagePositions < 1) noPagePositions = 1; + + // Correct position if greater than extent of canvas minus + // the visible portion of it or if below zero + new_x = wxMin( m_xScrollLines-noPagePositions, new_x ); + new_x = wxMax( 0, new_x ); + } + if ((y_pos != -1) && (m_yScrollPixelsPerLine)) + { + new_y = y_pos; + + // Calculate page size i.e. number of scroll units you get on the + // current client window + int noPagePositions = h/m_yScrollPixelsPerLine; + if (noPagePositions < 1) noPagePositions = 1; + + // Correct position if greater than extent of canvas minus + // the visible portion of it or if below zero + new_y = wxMin( m_yScrollLines-noPagePositions, new_y ); + new_y = wxMax( 0, new_y ); + } + + if ( new_x == m_xScrollPosition && new_y == m_yScrollPosition ) + return; // nothing to do, the position didn't change + + // flush all pending repaints before we change m_{x,y}ScrollPosition, as + // otherwise invalidated area could be updated incorrectly later when + // ScrollWindow() makes sure they're repainted before scrolling them + m_targetWindow->Update(); + + // update the position and scroll the window now: + if (m_xScrollPosition != new_x) + { + int old_x = m_xScrollPosition; + m_xScrollPosition = new_x; + m_win->SetScrollPos( wxHORIZONTAL, new_x ); + m_targetWindow->ScrollWindow( (old_x-new_x)*m_xScrollPixelsPerLine, 0, + GetScrollRect() ); + } + + if (m_yScrollPosition != new_y) + { + int old_y = m_yScrollPosition; + m_yScrollPosition = new_y; + m_win->SetScrollPos( wxVERTICAL, new_y ); + m_targetWindow->ScrollWindow( 0, (old_y-new_y)*m_yScrollPixelsPerLine, + GetScrollRect() ); + } +} + +void wxScrollHelper::EnableScrolling (bool x_scroll, bool y_scroll) { m_xScrollingEnabled = x_scroll; m_yScrollingEnabled = y_scroll; } // Where the current view starts from -void wxScrollHelperBase::DoGetViewStart (int *x, int *y) const +void wxScrollHelper::GetViewStart (int *x, int *y) const { if ( x ) *x = m_xScrollPosition; @@ -750,8 +992,7 @@ void wxScrollHelperBase::DoGetViewStart (int *x, int *y) const *y = m_yScrollPosition; } -void wxScrollHelperBase::DoCalcScrolledPosition(int x, int y, - int *xx, int *yy) const +void wxScrollHelper::DoCalcScrolledPosition(int x, int y, int *xx, int *yy) const { if ( xx ) *xx = x - m_xScrollPosition * m_xScrollPixelsPerLine; @@ -759,8 +1000,7 @@ void wxScrollHelperBase::DoCalcScrolledPosition(int x, int y, *yy = y - m_yScrollPosition * m_yScrollPixelsPerLine; } -void wxScrollHelperBase::DoCalcUnscrolledPosition(int x, int y, - int *xx, int *yy) const +void wxScrollHelper::DoCalcUnscrolledPosition(int x, int y, int *xx, int *yy) const { if ( xx ) *xx = x + m_xScrollPosition * m_xScrollPixelsPerLine; @@ -772,7 +1012,7 @@ void wxScrollHelperBase::DoCalcUnscrolledPosition(int x, int y, // geometry // ---------------------------------------------------------------------------- -bool wxScrollHelperBase::ScrollLayout() +bool wxScrollHelper::ScrollLayout() { if ( m_win->GetSizer() && m_targetWindow == m_win ) { @@ -790,7 +1030,7 @@ bool wxScrollHelperBase::ScrollLayout() return m_win->wxWindow::Layout(); } -void wxScrollHelperBase::ScrollDoSetVirtualSize(int x, int y) +void wxScrollHelper::ScrollDoSetVirtualSize(int x, int y) { m_win->wxWindow::DoSetVirtualSize( x, y ); AdjustScrollbars(); @@ -801,7 +1041,7 @@ void wxScrollHelperBase::ScrollDoSetVirtualSize(int x, int y) // wxWindow's GetBestVirtualSize returns the actual window size, // whereas we want to return the virtual size -wxSize wxScrollHelperBase::ScrollGetBestVirtualSize() const +wxSize wxScrollHelper::ScrollGetBestVirtualSize() const { wxSize clientSize(m_win->GetClientSize()); if ( m_win->GetSizer() ) @@ -810,12 +1050,33 @@ wxSize wxScrollHelperBase::ScrollGetBestVirtualSize() const return clientSize; } +// return the window best size from the given best virtual size +wxSize +wxScrollHelper::ScrollGetWindowSizeForVirtualSize(const wxSize& size) const +{ + // Only use the content to set the window size in the direction + // where there's no scrolling; otherwise we're going to get a huge + // window in the direction in which scrolling is enabled + int ppuX, ppuY; + GetScrollPixelsPerUnit(&ppuX, &ppuY); + + wxSize minSize = m_win->GetMinSize(); + + wxSize best(size); + if (ppuX > 0) + best.x = minSize.x + wxSystemSettings::GetMetric(wxSYS_VSCROLL_X); + if (ppuY > 0) + best.y = minSize.y + wxSystemSettings::GetMetric(wxSYS_HSCROLL_Y); + + return best; +} + // ---------------------------------------------------------------------------- // event handlers // ---------------------------------------------------------------------------- // Default OnSize resets scrollbars, if any -void wxScrollHelperBase::HandleOnSize(wxSizeEvent& WXUNUSED(event)) +void wxScrollHelper::HandleOnSize(wxSizeEvent& WXUNUSED(event)) { if ( m_targetWindow->GetAutoLayout() ) { @@ -832,7 +1093,7 @@ void wxScrollHelperBase::HandleOnSize(wxSizeEvent& WXUNUSED(event)) // This calls OnDraw, having adjusted the origin according to the current // scroll position -void wxScrollHelperBase::HandleOnPaint(wxPaintEvent& WXUNUSED(event)) +void wxScrollHelper::HandleOnPaint(wxPaintEvent& WXUNUSED(event)) { // don't use m_targetWindow here, this is always called for ourselves wxPaintDC dc(m_win); @@ -845,78 +1106,95 @@ void wxScrollHelperBase::HandleOnPaint(wxPaintEvent& WXUNUSED(event)) // compatibility here - if we used OnKeyDown(), the programs which process // arrows themselves in their OnChar() would never get the message and like // this they always have the priority -void wxScrollHelperBase::HandleOnChar(wxKeyEvent& event) +void wxScrollHelper::HandleOnChar(wxKeyEvent& event) { - if ( !m_kbdScrollingEnabled ) + int stx = 0, sty = 0, // view origin + szx = 0, szy = 0, // view size (total) + clix = 0, cliy = 0; // view size (on screen) + + GetViewStart(&stx, &sty); + GetTargetSize(&clix, &cliy); + m_targetWindow->GetVirtualSize(&szx, &szy); + + if( m_xScrollPixelsPerLine ) { - event.Skip(); - return; + clix /= m_xScrollPixelsPerLine; + szx /= m_xScrollPixelsPerLine; + } + else + { + clix = 0; + szx = -1; + } + if( m_yScrollPixelsPerLine ) + { + cliy /= m_yScrollPixelsPerLine; + szy /= m_yScrollPixelsPerLine; + } + else + { + cliy = 0; + szy = -1; } - // prepare the event this key press maps to - wxScrollWinEvent newEvent; - - newEvent.SetPosition(0); - newEvent.SetEventObject(m_win); - - // this is the default, it's changed to wxHORIZONTAL below if needed - newEvent.SetOrientation(wxVERTICAL); - - // some key events result in scrolling in both horizontal and vertical - // direction, e.g. Ctrl-{Home,End}, if this flag is true we should generate - // a second event in horizontal direction in addition to the primary one - bool sendHorizontalToo = false; + int xScrollOld = m_xScrollPosition, + yScrollOld = m_yScrollPosition; + int dsty; switch ( event.GetKeyCode() ) { case WXK_PAGEUP: - newEvent.SetEventType(wxEVT_SCROLLWIN_PAGEUP); + dsty = sty - (5 * cliy / 6); + Scroll(-1, (dsty == -1) ? 0 : dsty); break; case WXK_PAGEDOWN: - newEvent.SetEventType(wxEVT_SCROLLWIN_PAGEDOWN); + Scroll(-1, sty + (5 * cliy / 6)); break; case WXK_HOME: - newEvent.SetEventType(wxEVT_SCROLLWIN_TOP); - - sendHorizontalToo = event.ControlDown(); + Scroll(0, event.ControlDown() ? 0 : -1); break; case WXK_END: - newEvent.SetEventType(wxEVT_SCROLLWIN_BOTTOM); + Scroll(szx - clix, event.ControlDown() ? szy - cliy : -1); + break; - sendHorizontalToo = event.ControlDown(); + case WXK_UP: + Scroll(-1, sty - 1); + break; + + case WXK_DOWN: + Scroll(-1, sty + 1); break; case WXK_LEFT: - newEvent.SetOrientation(wxHORIZONTAL); - // fall through - - case WXK_UP: - newEvent.SetEventType(wxEVT_SCROLLWIN_LINEUP); + Scroll(stx - 1, -1); break; case WXK_RIGHT: - newEvent.SetOrientation(wxHORIZONTAL); - // fall through - - case WXK_DOWN: - newEvent.SetEventType(wxEVT_SCROLLWIN_LINEDOWN); + Scroll(stx + 1, -1); break; default: - // not a scrolling key + // not for us event.Skip(); - return; } - m_win->ProcessWindowEvent(newEvent); - - if ( sendHorizontalToo ) + if ( m_xScrollPosition != xScrollOld ) { - newEvent.SetOrientation(wxHORIZONTAL); - m_win->ProcessWindowEvent(newEvent); + wxScrollWinEvent event(wxEVT_SCROLLWIN_THUMBTRACK, m_xScrollPosition, + wxHORIZONTAL); + event.SetEventObject(m_win); + m_win->GetEventHandler()->ProcessEvent(event); + } + + if ( m_yScrollPosition != yScrollOld ) + { + wxScrollWinEvent event(wxEVT_SCROLLWIN_THUMBTRACK, m_yScrollPosition, + wxVERTICAL); + event.SetEventObject(m_win); + m_win->GetEventHandler()->ProcessEvent(event); } } @@ -925,28 +1203,32 @@ void wxScrollHelperBase::HandleOnChar(wxKeyEvent& event) // a captured mouse is being held outside the window // ---------------------------------------------------------------------------- -bool wxScrollHelperBase::SendAutoScrollEvents(wxScrollWinEvent& event) const +bool wxScrollHelper::SendAutoScrollEvents(wxScrollWinEvent& event) const { // only send the event if the window is scrollable in this direction wxWindow *win = (wxWindow *)event.GetEventObject(); return win->HasScrollbar(event.GetOrientation()); } -void wxScrollHelperBase::StopAutoScrolling() +void wxScrollHelper::StopAutoScrolling() { #if wxUSE_TIMER - wxDELETE(m_timerAutoScroll); + if ( m_timerAutoScroll ) + { + delete m_timerAutoScroll; + m_timerAutoScroll = (wxTimer *)NULL; + } #endif } -void wxScrollHelperBase::HandleOnMouseEnter(wxMouseEvent& event) +void wxScrollHelper::HandleOnMouseEnter(wxMouseEvent& event) { StopAutoScrolling(); event.Skip(); } -void wxScrollHelperBase::HandleOnMouseLeave(wxMouseEvent& event) +void wxScrollHelper::HandleOnMouseLeave(wxMouseEvent& event) { // don't prevent the usual processing of the event from taking place event.Skip(); @@ -987,7 +1269,7 @@ void wxScrollHelperBase::HandleOnMouseLeave(wxMouseEvent& event) // but seems to happen sometimes under wxMSW - maybe it's a bug // there but for now just ignore it - //wxFAIL_MSG( wxT("can't understand where has mouse gone") ); + //wxFAIL_MSG( _T("can't understand where has mouse gone") ); return; } @@ -1017,7 +1299,7 @@ void wxScrollHelperBase::HandleOnMouseLeave(wxMouseEvent& event) #if wxUSE_MOUSEWHEEL -void wxScrollHelperBase::HandleOnMouseWheel(wxMouseEvent& event) +void wxScrollHelper::HandleOnMouseWheel(wxMouseEvent& event) { m_wheelRotation += event.GetWheelRotation(); int lines = m_wheelRotation / event.GetWheelDelta(); @@ -1029,7 +1311,7 @@ void wxScrollHelperBase::HandleOnMouseWheel(wxMouseEvent& event) wxScrollWinEvent newEvent; newEvent.SetPosition(0); - newEvent.SetOrientation( event.GetWheelAxis() == 0 ? wxVERTICAL : wxHORIZONTAL); + newEvent.SetOrientation(wxVERTICAL); newEvent.SetEventObject(m_win); if (event.IsPageScroll()) @@ -1058,7 +1340,7 @@ void wxScrollHelperBase::HandleOnMouseWheel(wxMouseEvent& event) #endif // wxUSE_MOUSEWHEEL -void wxScrollHelperBase::HandleOnChildFocus(wxChildFocusEvent& event) +void wxScrollHelper::HandleOnChildFocus(wxChildFocusEvent& event) { // this event should be processed by all windows in parenthood chain, // e.g. so that nested wxScrolledWindows work correctly @@ -1070,7 +1352,7 @@ void wxScrollHelperBase::HandleOnChildFocus(wxChildFocusEvent& event) if ( win == m_targetWindow ) return; // nothing to do -#if defined( __WXOSX__ ) && wxUSE_SCROLLBAR +#ifdef __WXMAC__ if (wxDynamicCast(win, wxScrollBar)) return; #endif @@ -1102,7 +1384,7 @@ void wxScrollHelperBase::HandleOnChildFocus(wxChildFocusEvent& event) win->GetParent() == m_targetWindow) // if win is a wxPanel and receives the focus, it should not be // scrolled into view - return; + return; const wxRect viewRect(m_targetWindow->GetClientRect()); @@ -1112,7 +1394,7 @@ void wxScrollHelperBase::HandleOnChildFocus(wxChildFocusEvent& event) // part of a wxComboCtrl visible and the button would still be outside the // scrolled area. But do so only if the parent fits *entirely* inside the // scrolled window. In other situations, such as nested wxPanel or - // wxScrolledWindows, the parent might be way too big to fit inside the + // wxScrolledWindows, the parent might be way to big to fit inside the // scrolled window. If that is the case, then make only the focused window // visible if ( win->GetParent() != m_targetWindow) @@ -1122,7 +1404,7 @@ void wxScrollHelperBase::HandleOnChildFocus(wxChildFocusEvent& event) if (parent_size.GetWidth() <= viewRect.GetWidth() && parent_size.GetHeight() <= viewRect.GetHeight()) // make the immediate parent visible instead of the focused control - win=parent; + win=parent; } // make win position relative to the m_targetWindow viewing area instead of @@ -1199,359 +1481,53 @@ void wxScrollHelperBase::HandleOnChildFocus(wxChildFocusEvent& event) Scroll(startx, starty); } - -#ifdef wxHAS_GENERIC_SCROLLWIN - // ---------------------------------------------------------------------------- -// wxScrollHelper implementation +// wxScrolledWindow implementation // ---------------------------------------------------------------------------- -wxScrollHelper::wxScrollHelper(wxWindow *winToScroll) - : wxScrollHelperBase(winToScroll) +IMPLEMENT_DYNAMIC_CLASS(wxScrolledWindow, wxPanel) + +BEGIN_EVENT_TABLE(wxScrolledWindow, wxPanel) + EVT_PAINT(wxScrolledWindow::OnPaint) +END_EVENT_TABLE() + +bool wxScrolledWindow::Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name) { - m_xVisibility = - m_yVisibility = wxSHOW_SB_DEFAULT; + m_targetWindow = this; +#ifdef __WXMAC__ + MacSetClipChildren( true ) ; +#endif + + bool ok = wxPanel::Create(parent, id, pos, size, style|wxHSCROLL|wxVSCROLL, name); + + return ok; } -void wxScrollHelper::DoShowScrollbars(wxScrollbarVisibility horz, - wxScrollbarVisibility vert) +wxScrolledWindow::~wxScrolledWindow() { - if ( horz != m_xVisibility || vert != m_yVisibility ) - { - m_xVisibility = horz; - m_yVisibility = vert; - - AdjustScrollbars(); - } } -void -wxScrollHelper::DoAdjustScrollbar(int orient, - int clientSize, - int virtSize, - int pixelsPerUnit, - int& scrollUnits, - int& scrollPosition, - int& scrollLinesPerPage, - wxScrollbarVisibility visibility) +void wxScrolledWindow::OnPaint(wxPaintEvent& event) { - // scroll lines per page: if 0, no scrolling is needed - // check if we need scrollbar in this direction at all - if ( pixelsPerUnit == 0 || clientSize >= virtSize ) - { - // scrolling is disabled or unnecessary - scrollUnits = - scrollPosition = 0; - scrollLinesPerPage = 0; - } - else // might need scrolling - { - // Round up integer division to catch any "leftover" client space. - scrollUnits = (virtSize + pixelsPerUnit - 1) / pixelsPerUnit; + // the user code didn't really draw the window if we got here, so set this + // flag to try to call OnDraw() later + m_handler->ResetDrawnFlag(); - // Calculate the number of fully scroll units - scrollLinesPerPage = clientSize / pixelsPerUnit; - - if ( scrollLinesPerPage >= scrollUnits ) - { - // we're big enough to not need scrolling - scrollUnits = - scrollPosition = 0; - scrollLinesPerPage = 0; - } - else // we do need a scrollbar - { - if ( scrollLinesPerPage < 1 ) - scrollLinesPerPage = 1; - - // Correct position if greater than extent of canvas minus - // the visible portion of it or if below zero - const int posMax = scrollUnits - scrollLinesPerPage; - if ( scrollPosition > posMax ) - scrollPosition = posMax; - else if ( scrollPosition < 0 ) - scrollPosition = 0; - } - } - - // in wxSHOW_SB_NEVER case don't show the scrollbar even if it's needed, in - // wxSHOW_SB_ALWAYS case show the scrollbar even if it's not needed by - // passing a special range value to SetScrollbar() - int range; - switch ( visibility ) - { - case wxSHOW_SB_NEVER: - range = 0; - break; - - case wxSHOW_SB_ALWAYS: - range = scrollUnits ? scrollUnits : -1; - break; - - default: - wxFAIL_MSG( wxS("unknown scrollbar visibility") ); - // fall through - - case wxSHOW_SB_DEFAULT: - range = scrollUnits; - break; - - } - - m_win->SetScrollbar(orient, scrollPosition, scrollLinesPerPage, range); -} - -void wxScrollHelper::AdjustScrollbars() -{ - static wxRecursionGuardFlag s_flagReentrancy; - wxRecursionGuard guard(s_flagReentrancy); - if ( guard.IsInside() ) - { - // don't reenter AdjustScrollbars() while another call to - // AdjustScrollbars() is in progress because this may lead to calling - // ScrollWindow() twice and this can really happen under MSW if - // SetScrollbar() call below adds or removes the scrollbar which - // changes the window size and hence results in another - // AdjustScrollbars() call - return; - } - - int oldXScroll = m_xScrollPosition; - int oldYScroll = m_yScrollPosition; - - // we may need to readjust the scrollbars several times as enabling one of - // them reduces the area available for the window contents and so can make - // the other scrollbar necessary now although it wasn't necessary before - // - // VZ: normally this loop should be over in at most 2 iterations, I don't - // know why do we need 5 of them - for ( int iterationCount = 0; iterationCount < 5; iterationCount++ ) - { - wxSize clientSize = GetTargetSize(); - const wxSize virtSize = m_targetWindow->GetVirtualSize(); - - // this block of code tries to work around the following problem: the - // window could have been just resized to have enough space to show its - // full contents without the scrollbars, but its client size could be - // not big enough because it does have the scrollbars right now and so - // the scrollbars would remain even though we don't need them any more - // - // to prevent this from happening, check if we have enough space for - // everything without the scrollbars and explicitly disable them then - const wxSize availSize = GetSizeAvailableForScrollTarget( - m_win->GetSize() - m_win->GetWindowBorderSize()); - if ( availSize != clientSize ) - { - if ( availSize.x >= virtSize.x && availSize.y >= virtSize.y ) - { - // this will be enough to make the scrollbars disappear below - // and then the client size will indeed become equal to the - // full available size - clientSize = availSize; - } - } - - - DoAdjustScrollbar(wxHORIZONTAL, - clientSize.x, - virtSize.x, - m_xScrollPixelsPerLine, - m_xScrollLines, - m_xScrollPosition, - m_xScrollLinesPerPage, - m_xVisibility); - - DoAdjustScrollbar(wxVERTICAL, - clientSize.y, - virtSize.y, - m_yScrollPixelsPerLine, - m_yScrollLines, - m_yScrollPosition, - m_yScrollLinesPerPage, - m_yVisibility); - - - // If a scrollbar (dis)appeared as a result of this, we need to adjust - // them again but if the client size didn't change, then we're done - if ( GetTargetSize() == clientSize ) - break; - } - -#ifdef __WXMOTIF__ - // Sorry, some Motif-specific code to implement a backing pixmap - // for the wxRETAINED style. Implementing a backing store can't - // be entirely generic because it relies on the wxWindowDC implementation - // to duplicate X drawing calls for the backing pixmap. - - if ( m_targetWindow->GetWindowStyle() & wxRETAINED ) - { - Display* dpy = XtDisplay((Widget)m_targetWindow->GetMainWidget()); - - int totalPixelWidth = m_xScrollLines * m_xScrollPixelsPerLine; - int totalPixelHeight = m_yScrollLines * m_yScrollPixelsPerLine; - if (m_targetWindow->GetBackingPixmap() && - !((m_targetWindow->GetPixmapWidth() == totalPixelWidth) && - (m_targetWindow->GetPixmapHeight() == totalPixelHeight))) - { - XFreePixmap (dpy, (Pixmap) m_targetWindow->GetBackingPixmap()); - m_targetWindow->SetBackingPixmap((WXPixmap) 0); - } - - if (!m_targetWindow->GetBackingPixmap() && - (m_xScrollLines != 0) && (m_yScrollLines != 0)) - { - int depth = wxDisplayDepth(); - m_targetWindow->SetPixmapWidth(totalPixelWidth); - m_targetWindow->SetPixmapHeight(totalPixelHeight); - m_targetWindow->SetBackingPixmap((WXPixmap) XCreatePixmap (dpy, RootWindow (dpy, DefaultScreen (dpy)), - m_targetWindow->GetPixmapWidth(), m_targetWindow->GetPixmapHeight(), depth)); - } - - } -#endif // Motif - - if (oldXScroll != m_xScrollPosition) - { - if (m_xScrollingEnabled) - m_targetWindow->ScrollWindow( m_xScrollPixelsPerLine * (oldXScroll - m_xScrollPosition), 0, - GetScrollRect() ); - else - m_targetWindow->Refresh(true, GetScrollRect()); - } - - if (oldYScroll != m_yScrollPosition) - { - if (m_yScrollingEnabled) - m_targetWindow->ScrollWindow( 0, m_yScrollPixelsPerLine * (oldYScroll-m_yScrollPosition), - GetScrollRect() ); - else - m_targetWindow->Refresh(true, GetScrollRect()); - } -} - -void wxScrollHelper::DoScroll( int x_pos, int y_pos ) -{ - if (!m_targetWindow) - return; - - if (((x_pos == -1) || (x_pos == m_xScrollPosition)) && - ((y_pos == -1) || (y_pos == m_yScrollPosition))) return; - - int w = 0, h = 0; - GetTargetSize(&w, &h); - - // compute new position: - int new_x = m_xScrollPosition; - int new_y = m_yScrollPosition; - - if ((x_pos != -1) && (m_xScrollPixelsPerLine)) - { - new_x = x_pos; - - // Calculate page size i.e. number of scroll units you get on the - // current client window - int noPagePositions = w/m_xScrollPixelsPerLine; - if (noPagePositions < 1) noPagePositions = 1; - - // Correct position if greater than extent of canvas minus - // the visible portion of it or if below zero - new_x = wxMin( m_xScrollLines-noPagePositions, new_x ); - new_x = wxMax( 0, new_x ); - } - if ((y_pos != -1) && (m_yScrollPixelsPerLine)) - { - new_y = y_pos; - - // Calculate page size i.e. number of scroll units you get on the - // current client window - int noPagePositions = h/m_yScrollPixelsPerLine; - if (noPagePositions < 1) noPagePositions = 1; - - // Correct position if greater than extent of canvas minus - // the visible portion of it or if below zero - new_y = wxMin( m_yScrollLines-noPagePositions, new_y ); - new_y = wxMax( 0, new_y ); - } - - if ( new_x == m_xScrollPosition && new_y == m_yScrollPosition ) - return; // nothing to do, the position didn't change - - // flush all pending repaints before we change m_{x,y}ScrollPosition, as - // otherwise invalidated area could be updated incorrectly later when - // ScrollWindow() makes sure they're repainted before scrolling them - m_targetWindow->Update(); - - // update the position and scroll the window now: - if (m_xScrollPosition != new_x) - { - int old_x = m_xScrollPosition; - m_xScrollPosition = new_x; - m_win->SetScrollPos( wxHORIZONTAL, new_x ); - m_targetWindow->ScrollWindow( (old_x-new_x)*m_xScrollPixelsPerLine, 0, - GetScrollRect() ); - } - - if (m_yScrollPosition != new_y) - { - int old_y = m_yScrollPosition; - m_yScrollPosition = new_y; - m_win->SetScrollPos( wxVERTICAL, new_y ); - m_targetWindow->ScrollWindow( 0, (old_y-new_y)*m_yScrollPixelsPerLine, - GetScrollRect() ); - } -} - -#endif // wxHAS_GENERIC_SCROLLWIN - -// ---------------------------------------------------------------------------- -// wxScrolled and wxScrolledWindow implementation -// ---------------------------------------------------------------------------- - -wxSize wxScrolledT_Helper::FilterBestSize(const wxWindow *win, - const wxScrollHelper *helper, - const wxSize& origBest) -{ - // NB: We don't do this in WX_FORWARD_TO_SCROLL_HELPER, because not - // all scrollable windows should behave like this, only those that - // contain children controls within scrollable area - // (i.e., wxScrolledWindow) and other some scrollable windows may - // have different DoGetBestSize() implementation (e.g. wxTreeCtrl). - - wxSize best = origBest; - - if ( win->GetAutoLayout() ) - { - // Only use the content to set the window size in the direction - // where there's no scrolling; otherwise we're going to get a huge - // window in the direction in which scrolling is enabled - int ppuX, ppuY; - helper->GetScrollPixelsPerUnit(&ppuX, &ppuY); - - // NB: This code used to use *current* size if min size wasn't - // specified, presumably to get some reasonable (i.e., larger than - // minimal) size. But that's a wrong thing to do in GetBestSize(), - // so we use minimal size as specified. If the app needs some - // minimal size for its scrolled window, it should set it and put - // the window into sizer as expandable so that it can use all space - // available to it. - // - // See also http://svn.wxwidgets.org/viewvc/wx?view=rev&revision=45864 - - wxSize minSize = win->GetMinSize(); - - if ( ppuX > 0 ) - best.x = minSize.x + wxSystemSettings::GetMetric(wxSYS_VSCROLL_X); - - if ( ppuY > 0 ) - best.y = minSize.y + wxSystemSettings::GetMetric(wxSYS_HSCROLL_Y); - } - - return best; + event.Skip(); } #ifdef __WXMSW__ -WXLRESULT wxScrolledT_Helper::FilterMSWWindowProc(WXUINT nMsg, WXLRESULT rc) +WXLRESULT wxScrolledWindow::MSWWindowProc(WXUINT nMsg, + WXWPARAM wParam, + WXLPARAM lParam) { + WXLRESULT rc = wxPanel::MSWWindowProc(nMsg, wParam, lParam); + #ifndef __WXWINCE__ // we need to process arrows ourselves for scrolling if ( nMsg == WM_GETDLGCODE ) @@ -1559,10 +1535,8 @@ WXLRESULT wxScrolledT_Helper::FilterMSWWindowProc(WXUINT nMsg, WXLRESULT rc) rc |= DLGC_WANTARROWS; } #endif + return rc; } -#endif // __WXMSW__ -// NB: skipping wxScrolled in wxRTTI information because being a templte, -// it doesn't and can't implement wxRTTI support -IMPLEMENT_DYNAMIC_CLASS(wxScrolledWindow, wxPanel) +#endif // __WXMSW__ diff --git a/Source/3rd Party/wx/src/generic/selstore.cpp b/Source/3rd Party/wx/src/generic/selstore.cpp index 6610de56a..653de1511 100644 --- a/Source/3rd Party/wx/src/generic/selstore.cpp +++ b/Source/3rd Party/wx/src/generic/selstore.cpp @@ -1,10 +1,10 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: src/generic/selstore.cpp +// Name: generic/selstore.cpp // Purpose: wxSelectionStore implementation // Author: Vadim Zeitlin // Modified by: // Created: 08.06.03 (extracted from src/generic/listctrl.cpp) -// RCS-ID: $Id$ +// RCS-ID: $Id: selstore.cpp 27853 2004-06-17 16:22:36Z ABX $ // Copyright: (c) 2000-2003 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -33,7 +33,7 @@ // tests // ---------------------------------------------------------------------------- -bool wxSelectionStore::IsSelected(unsigned item) const +bool wxSelectionStore::IsSelected(size_t item) const { bool isSel = m_itemsSel.Index(item) != wxNOT_FOUND; @@ -46,7 +46,7 @@ bool wxSelectionStore::IsSelected(unsigned item) const // Select*() // ---------------------------------------------------------------------------- -bool wxSelectionStore::SelectItem(unsigned item, bool select) +bool wxSelectionStore::SelectItem(size_t item, bool select) { // search for the item ourselves as like this we get the index where to // insert it later if needed, so we do only one search in the array instead @@ -75,16 +75,16 @@ bool wxSelectionStore::SelectItem(unsigned item, bool select) return false; } -bool wxSelectionStore::SelectRange(unsigned itemFrom, unsigned itemTo, +bool wxSelectionStore::SelectRange(size_t itemFrom, size_t itemTo, bool select, wxArrayInt *itemsChanged) { // 100 is hardcoded but it shouldn't matter much: the important thing is // that we don't refresh everything when really few (e.g. 1 or 2) items // change state - static const unsigned MANY_ITEMS = 100; + static const size_t MANY_ITEMS = 100; - wxASSERT_MSG( itemFrom <= itemTo, wxT("should be in order") ); + wxASSERT_MSG( itemFrom <= itemTo, _T("should be in order") ); // are we going to have more [un]selected items than the other ones? if ( itemTo - itemFrom > m_count/2 ) @@ -102,7 +102,7 @@ bool wxSelectionStore::SelectRange(unsigned itemFrom, unsigned itemTo, // TODO: it should be possible to optimize the searches a bit // knowing the possible range - unsigned item; + size_t item; for ( item = 0; item < itemFrom; item++ ) { if ( selOld.Index(item) == wxNOT_FOUND ) @@ -166,7 +166,7 @@ bool wxSelectionStore::SelectRange(unsigned itemFrom, unsigned itemTo, } // just add the items to the selection - for ( unsigned item = itemFrom; item <= itemTo; item++ ) + for ( size_t item = itemFrom; item <= itemTo; item++ ) { if ( SelectItem(item, select) && itemsChanged ) { @@ -191,7 +191,7 @@ bool wxSelectionStore::SelectRange(unsigned itemFrom, unsigned itemTo, // callbacks // ---------------------------------------------------------------------------- -void wxSelectionStore::OnItemDelete(unsigned item) +void wxSelectionStore::OnItemDelete(size_t item) { size_t count = m_itemsSel.GetCount(), i = m_itemsSel.IndexForInsert(item); @@ -208,25 +208,9 @@ void wxSelectionStore::OnItemDelete(unsigned item) while ( i < count ) { // all following elements must be greater than the one we deleted - wxASSERT_MSG( m_itemsSel[i] > item, wxT("logic error") ); + wxASSERT_MSG( m_itemsSel[i] > item, _T("logic error") ); m_itemsSel[i++]--; } } -void wxSelectionStore::SetItemCount(unsigned count) -{ - // forget about all items whose indices are now invalid if the size - // decreased - if ( count < m_count ) - { - for ( size_t i = m_itemsSel.GetCount(); i > 0; i-- ) - { - if ( m_itemsSel[i - 1] >= count ) - m_itemsSel.RemoveAt(i - 1); - } - } - - // remember the new number of items - m_count = count; -} diff --git a/Source/3rd Party/wx/src/generic/spinctlg.cpp b/Source/3rd Party/wx/src/generic/spinctlg.cpp index 83d7d5df5..92f3eeea4 100644 --- a/Source/3rd Party/wx/src/generic/spinctlg.cpp +++ b/Source/3rd Party/wx/src/generic/spinctlg.cpp @@ -4,9 +4,9 @@ // Author: Vadim Zeitlin // Modified by: // Created: 29.01.01 -// RCS-ID: $Id$ +// RCS-ID: $Id: spinctlg.cpp 52582 2008-03-17 13:46:31Z VZ $ // Copyright: (c) 2001 Vadim Zeitlin -// Licence: wxWindows licence +// License: wxWindows licence /////////////////////////////////////////////////////////////////////////////// // ============================================================================ @@ -24,196 +24,165 @@ #pragma hdrstop #endif +// There are port-specific versions for MSW, GTK, OS/2 and Mac, so exclude the +// contents of this file in those cases +#if !(defined(__WXMSW__) || defined(__WXGTK__) || defined(__WXPM__) || \ + defined(__WXMAC__)) || defined(__WXUNIVERSAL__) + #ifndef WX_PRECOMP #include "wx/textctrl.h" #endif //WX_PRECOMP -#include "wx/spinctrl.h" -#include "wx/tooltip.h" - #if wxUSE_SPINCTRL -IMPLEMENT_DYNAMIC_CLASS(wxSpinDoubleEvent, wxNotifyEvent) - -// There are port-specific versions for the wxSpinCtrl, so exclude the -// contents of this file in those cases -#if !defined(wxHAS_NATIVE_SPINCTRL) || !defined(wxHAS_NATIVE_SPINCTRLDOUBLE) - #include "wx/spinbutt.h" - -#if wxUSE_SPINBTN +#include "wx/spinctrl.h" // ---------------------------------------------------------------------------- // constants // ---------------------------------------------------------------------------- -// The margin between the text control and the spin: the value here is the same -// as the margin between the spin button and its "buddy" text control in wxMSW -// so the generic control looks similarly to the native one there, we might -// need to use different value for the other platforms (and maybe even -// determine it dynamically?). -static const wxCoord MARGIN = 1; - -#define SPINCTRLBUT_MAX 32000 // large to avoid wrap around trouble +// the margin between the text control and the spin +static const wxCoord MARGIN = 2; // ---------------------------------------------------------------------------- -// wxSpinCtrlTextGeneric: text control used by spin control +// wxSpinCtrlText: text control used by spin control // ---------------------------------------------------------------------------- -class wxSpinCtrlTextGeneric : public wxTextCtrl +class wxSpinCtrlText : public wxTextCtrl { public: - wxSpinCtrlTextGeneric(wxSpinCtrlGenericBase *spin, const wxString& value, long style=0) - : wxTextCtrl(spin->GetParent(), wxID_ANY, value, wxDefaultPosition, wxDefaultSize, - style & wxALIGN_MASK) + wxSpinCtrlText(wxSpinCtrl *spin, const wxString& value) + : wxTextCtrl(spin->GetParent(), wxID_ANY, value) { m_spin = spin; // remove the default minsize, the spinctrl will have one instead - SetSizeHints(wxDefaultCoord, wxDefaultCoord); + SetSizeHints(wxDefaultCoord,wxDefaultCoord); } - virtual ~wxSpinCtrlTextGeneric() +protected: + void OnTextChange(wxCommandEvent& event) { - // MSW sends extra kill focus event on destroy - if (m_spin) - m_spin->m_textCtrl = NULL; - - m_spin = NULL; - } - - void OnChar( wxKeyEvent &event ) - { - if (m_spin) - m_spin->ProcessWindowEvent(event); - } - - void OnKillFocus(wxFocusEvent& event) - { - if (m_spin) - m_spin->ProcessWindowEvent(event); + int val; + if ( m_spin->GetTextValue(&val) ) + { + m_spin->GetSpinButton()->SetValue(val); + } event.Skip(); } - wxSpinCtrlGenericBase *m_spin; + bool ProcessEvent(wxEvent &event) + { + // Hand button down events to wxSpinCtrl. Doesn't work. + if (event.GetEventType() == wxEVT_LEFT_DOWN && m_spin->ProcessEvent( event )) + return true; + + return wxTextCtrl::ProcessEvent( event ); + } private: + wxSpinCtrl *m_spin; + DECLARE_EVENT_TABLE() }; -BEGIN_EVENT_TABLE(wxSpinCtrlTextGeneric, wxTextCtrl) - EVT_CHAR(wxSpinCtrlTextGeneric::OnChar) - - EVT_KILL_FOCUS(wxSpinCtrlTextGeneric::OnKillFocus) +BEGIN_EVENT_TABLE(wxSpinCtrlText, wxTextCtrl) + EVT_TEXT(wxID_ANY, wxSpinCtrlText::OnTextChange) END_EVENT_TABLE() // ---------------------------------------------------------------------------- -// wxSpinCtrlButtonGeneric: spin button used by spin control +// wxSpinCtrlButton: spin button used by spin control // ---------------------------------------------------------------------------- -class wxSpinCtrlButtonGeneric : public wxSpinButton +class wxSpinCtrlButton : public wxSpinButton { public: - wxSpinCtrlButtonGeneric(wxSpinCtrlGenericBase *spin, int style) - : wxSpinButton(spin->GetParent(), wxID_ANY, wxDefaultPosition, - wxDefaultSize, style | wxSP_VERTICAL) + wxSpinCtrlButton(wxSpinCtrl *spin, int style) + : wxSpinButton(spin->GetParent()) { m_spin = spin; - SetRange(-SPINCTRLBUT_MAX, SPINCTRLBUT_MAX); + SetWindowStyle(style | wxSP_VERTICAL); // remove the default minsize, the spinctrl will have one instead - SetSizeHints(wxDefaultCoord, wxDefaultCoord); + SetSizeHints(wxDefaultCoord,wxDefaultCoord); } - void OnSpinButton(wxSpinEvent& event) +protected: + void OnSpinButton(wxSpinEvent& eventSpin) { - if (m_spin) - m_spin->OnSpinButton(event); - } + m_spin->SetTextValue(eventSpin.GetPosition()); - wxSpinCtrlGenericBase *m_spin; + wxCommandEvent event(wxEVT_COMMAND_SPINCTRL_UPDATED, m_spin->GetId()); + event.SetEventObject(m_spin); + event.SetInt(eventSpin.GetPosition()); + + m_spin->GetEventHandler()->ProcessEvent(event); + + eventSpin.Skip(); + } private: + wxSpinCtrl *m_spin; + DECLARE_EVENT_TABLE() }; -BEGIN_EVENT_TABLE(wxSpinCtrlButtonGeneric, wxSpinButton) - EVT_SPIN_UP( wxID_ANY, wxSpinCtrlButtonGeneric::OnSpinButton) - EVT_SPIN_DOWN(wxID_ANY, wxSpinCtrlButtonGeneric::OnSpinButton) +BEGIN_EVENT_TABLE(wxSpinCtrlButton, wxSpinButton) + EVT_SPIN(wxID_ANY, wxSpinCtrlButton::OnSpinButton) END_EVENT_TABLE() +IMPLEMENT_DYNAMIC_CLASS(wxSpinCtrl, wxControl) + // ============================================================================ -// wxSpinCtrlGenericBase +// implementation // ============================================================================ // ---------------------------------------------------------------------------- -// wxSpinCtrlGenericBase creation +// wxSpinCtrl creation // ---------------------------------------------------------------------------- -void wxSpinCtrlGenericBase::Init() +void wxSpinCtrl::Init() { - m_value = 0; - m_min = 0; - m_max = 100; - m_increment = 1; - m_snap_to_ticks = false; - m_format = wxS("%g"); - - m_spin_value = 0; - - m_textCtrl = NULL; - m_spinButton = NULL; + m_text = NULL; + m_btn = NULL; } -bool wxSpinCtrlGenericBase::Create(wxWindow *parent, - wxWindowID id, - const wxString& value, - const wxPoint& pos, const wxSize& size, - long style, - double min, double max, double initial, - double increment, - const wxString& name) +bool wxSpinCtrl::Create(wxWindow *parent, + wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + long style, + int min, + int max, + int initial, + const wxString& name) { - // don't use borders for this control itself, it wouldn't look good with - // the text control borders (but we might want to use style border bits to - // select the text control style) - if ( !wxControl::Create(parent, id, wxDefaultPosition, wxDefaultSize, - (style & ~wxBORDER_MASK) | wxBORDER_NONE, + if ( !wxControl::Create(parent, id, wxDefaultPosition, wxDefaultSize, style, wxDefaultValidator, name) ) { return false; } - m_value = initial; - m_min = min; - m_max = max; - m_increment = increment; - - m_textCtrl = new wxSpinCtrlTextGeneric(this, value, style); - m_spinButton = new wxSpinCtrlButtonGeneric(this, style); -#if wxUSE_TOOLTIPS - m_textCtrl->SetToolTip(GetToolTipText()); - m_spinButton->SetToolTip(GetToolTipText()); -#endif // wxUSE_TOOLTIPS - - m_spin_value = m_spinButton->GetValue(); - // the string value overrides the numeric one (for backwards compatibility // reasons and also because it is simpler to satisfy the string value which // comes much sooner in the list of arguments and leave the initial // parameter unspecified) if ( !value.empty() ) { - double d; - if ( value.ToDouble(&d) ) - { - m_value = d; - m_textCtrl->SetValue(wxString::Format(m_format, m_value)); - } + long l; + if ( value.ToLong(&l) ) + initial = l; } + m_text = new wxSpinCtrlText(this, value); + m_btn = new wxSpinCtrlButton(this, style); + + m_btn->SetRange(min, max); + m_btn->SetValue(initial); SetInitialSize(size); Move(pos); @@ -230,381 +199,193 @@ bool wxSpinCtrlGenericBase::Create(wxWindow *parent, return true; } -wxSpinCtrlGenericBase::~wxSpinCtrlGenericBase() +wxSpinCtrl::~wxSpinCtrl() { // delete the controls now, don't leave them alive even though they would // still be eventually deleted by our parent - but it will be too late, the // user code expects them to be gone now - - if (m_textCtrl) - { - // null this since MSW sends KILL_FOCUS on deletion, see ~wxSpinCtrlTextGeneric - wxDynamicCast(m_textCtrl, wxSpinCtrlTextGeneric)->m_spin = NULL; - - wxSpinCtrlTextGeneric *text = (wxSpinCtrlTextGeneric*)m_textCtrl; - m_textCtrl = NULL; - delete text; - } - - wxDELETE(m_spinButton); + delete m_text; + m_text = NULL ; + delete m_btn; + m_btn = NULL ; } // ---------------------------------------------------------------------------- // geometry // ---------------------------------------------------------------------------- -wxSize wxSpinCtrlGenericBase::DoGetBestSize() const +wxSize wxSpinCtrl::DoGetBestSize() const { - wxSize sizeBtn = m_spinButton->GetBestSize(), - sizeText = m_textCtrl->GetBestSize(); + wxSize sizeBtn = m_btn->GetBestSize(), + sizeText = m_text->GetBestSize(); return wxSize(sizeBtn.x + sizeText.x + MARGIN, sizeText.y); } -void wxSpinCtrlGenericBase::DoMoveWindow(int x, int y, int width, int height) +void wxSpinCtrl::DoMoveWindow(int x, int y, int width, int height) { wxControl::DoMoveWindow(x, y, width, height); // position the subcontrols inside the client area - wxSize sizeBtn = m_spinButton->GetSize(); + wxSize sizeBtn = m_btn->GetSize(); - wxCoord wText = width - sizeBtn.x - MARGIN; - m_textCtrl->SetSize(x, y, wText, height); - m_spinButton->SetSize(x + wText + MARGIN, y, wxDefaultCoord, height); + wxCoord wText = width - sizeBtn.x; + m_text->SetSize(x, y, wText, height); + m_btn->SetSize(x + wText + MARGIN, y, wxDefaultCoord, height); } // ---------------------------------------------------------------------------- // operations forwarded to the subcontrols // ---------------------------------------------------------------------------- -void wxSpinCtrlGenericBase::SetFocus() +bool wxSpinCtrl::Enable(bool enable) { - if ( m_textCtrl ) - m_textCtrl->SetFocus(); -} - -#ifdef __WXMSW__ - -void wxSpinCtrlGenericBase::DoEnable(bool enable) -{ - // We never enable this control itself, it must stay disabled to avoid - // interfering with the siblings event handling (see e.g. #12045 for the - // kind of problems which arise otherwise). - if ( !enable ) - wxSpinCtrlBase::DoEnable(enable); -} - -#endif // __WXMSW__ - -bool wxSpinCtrlGenericBase::Enable(bool enable) -{ - if ( !wxSpinCtrlBase::Enable(enable) ) + if ( !wxControl::Enable(enable) ) return false; - m_spinButton->Enable(enable); - m_textCtrl->Enable(enable); + m_btn->Enable(enable); + m_text->Enable(enable); return true; } -bool wxSpinCtrlGenericBase::Show(bool show) +bool wxSpinCtrl::Show(bool show) { if ( !wxControl::Show(show) ) return false; // under GTK Show() is called the first time before we are fully // constructed - if ( m_spinButton ) + if ( m_btn ) { - m_spinButton->Show(show); - m_textCtrl->Show(show); + m_btn->Show(show); + m_text->Show(show); } return true; } -#if wxUSE_TOOLTIPS -void wxSpinCtrlGenericBase::DoSetToolTip(wxToolTip *tip) +bool wxSpinCtrl::Reparent(wxWindow *newParent) { - // Notice that we must check for the subcontrols not being NULL (as they - // could be if we were created with the default ctor and this is called - // before Create() for some reason) and that we can't call SetToolTip(tip) - // because this would take ownership of the wxToolTip object (twice). - if ( m_textCtrl ) + if ( m_btn ) { - if ( tip ) - m_textCtrl->SetToolTip(tip->GetTip()); - else - m_textCtrl->SetToolTip(NULL); + m_btn->Reparent(newParent); + m_text->Reparent(newParent); } - if ( m_spinButton ) - { - if( tip ) - m_spinButton->SetToolTip(tip->GetTip()); - else - m_spinButton->SetToolTip(NULL); - } - - wxWindowBase::DoSetToolTip(tip); -} -#endif // wxUSE_TOOLTIPS - -// ---------------------------------------------------------------------------- -// Handle sub controls events -// ---------------------------------------------------------------------------- - -BEGIN_EVENT_TABLE(wxSpinCtrlGenericBase, wxSpinCtrlBase) - EVT_CHAR(wxSpinCtrlGenericBase::OnTextChar) - EVT_KILL_FOCUS(wxSpinCtrlGenericBase::OnTextLostFocus) -END_EVENT_TABLE() - -void wxSpinCtrlGenericBase::OnSpinButton(wxSpinEvent& event) -{ - event.Skip(); - - // Sync the textctrl since the user expects that the button will modify - // what they see in the textctrl. - SyncSpinToText(); - - int spin_value = event.GetPosition(); - double step = (event.GetEventType() == wxEVT_SCROLL_LINEUP) ? 1 : -1; - - // Use the spinbutton's acceleration, if any, but not if wrapping around - if (((spin_value >= 0) && (m_spin_value >= 0)) || ((spin_value <= 0) && (m_spin_value <= 0))) - step *= abs(spin_value - m_spin_value); - - double value = AdjustToFitInRange(m_value + step*m_increment); - - // Ignore the edges when it wraps since the up/down event may be opposite - // They are in GTK and Mac - if (abs(spin_value - m_spin_value) > SPINCTRLBUT_MAX) - { - m_spin_value = spin_value; - return; - } - - m_spin_value = spin_value; - - if ( DoSetValue(value) ) - DoSendEvent(); -} - -void wxSpinCtrlGenericBase::OnTextLostFocus(wxFocusEvent& event) -{ - SyncSpinToText(); - DoSendEvent(); - - event.Skip(); -} - -void wxSpinCtrlGenericBase::OnTextChar(wxKeyEvent& event) -{ - if ( !HasFlag(wxSP_ARROW_KEYS) ) - { - event.Skip(); - return; - } - - double value = m_value; - switch ( event.GetKeyCode() ) - { - case WXK_UP : - value += m_increment; - break; - - case WXK_DOWN : - value -= m_increment; - break; - - case WXK_PAGEUP : - value += m_increment * 10.0; - break; - - case WXK_PAGEDOWN : - value -= m_increment * 10.0; - break; - - default: - event.Skip(); - return; - } - - value = AdjustToFitInRange(value); - - SyncSpinToText(); - - if ( DoSetValue(value) ) - DoSendEvent(); + return true; } // ---------------------------------------------------------------------------- -// Textctrl functions +// value and range access // ---------------------------------------------------------------------------- -bool wxSpinCtrlGenericBase::SyncSpinToText() +bool wxSpinCtrl::GetTextValue(int *val) const { - if ( !m_textCtrl || !m_textCtrl->IsModified() ) + long l; + if ( !m_text->GetValue().ToLong(&l) ) + { + // not a number at all return false; - - double textValue; - if ( m_textCtrl->GetValue().ToDouble(&textValue) ) - { - if (textValue > m_max) - textValue = m_max; - else if (textValue < m_min) - textValue = m_min; - } - else // text contents is not a valid number at all - { - // replace its contents with the last valid value - textValue = m_value; } - // we must always set the value here, even if it's equal to m_value, as - // otherwise we could be left with an out of range value when leaving the - // text control and the current value is already m_max for example - return DoSetValue(textValue); + if ( l < GetMin() || l > GetMax() ) + { + // out of range + return false; + } + + *val = l; + + return true; +} + +int wxSpinCtrl::GetValue() const +{ + return m_btn ? m_btn->GetValue() : 0; +} + +int wxSpinCtrl::GetMin() const +{ + return m_btn ? m_btn->GetMin() : 0; +} + +int wxSpinCtrl::GetMax() const +{ + return m_btn ? m_btn->GetMax() : 0; } // ---------------------------------------------------------------------------- // changing value and range // ---------------------------------------------------------------------------- -void wxSpinCtrlGenericBase::SetValue(const wxString& text) +void wxSpinCtrl::SetTextValue(int val) { - wxCHECK_RET( m_textCtrl, wxT("invalid call to wxSpinCtrl::SetValue") ); + wxCHECK_RET( m_text, _T("invalid call to wxSpinCtrl::SetTextValue") ); - double val; - if ( text.ToDouble(&val) && InRange(val) ) + m_text->SetValue(wxString::Format(_T("%d"), val)); + + // select all text + m_text->SetSelection(0, -1); + + // and give focus to the control! + // m_text->SetFocus(); Why???? TODO. + +#ifdef __WXCOCOA__ + /* It's sort of a hack to do this from here but the idea is that if the + user has clicked on us, which is the main reason this method is called, + then focus probably ought to go to the text control since clicking on + a text control usually gives it focus. + + However, if the focus is already on us (i.e. the user has turned on + the ability to tab to controls) then we don't want to drop focus. + So we only set focus if we would steal it away from a different + control, not if we would steal it away from ourself. + */ + wxWindow *currentFocusedWindow = wxWindow::FindFocus(); + if(currentFocusedWindow != this && currentFocusedWindow != m_text) + m_text->SetFocus(); +#endif +} + +void wxSpinCtrl::SetValue(int val) +{ + wxCHECK_RET( m_btn, _T("invalid call to wxSpinCtrl::SetValue") ); + + SetTextValue(val); + + m_btn->SetValue(val); +} + +void wxSpinCtrl::SetValue(const wxString& text) +{ + wxCHECK_RET( m_text, _T("invalid call to wxSpinCtrl::SetValue") ); + + long val; + if ( text.ToLong(&val) && ((val > INT_MIN) && (val < INT_MAX)) ) { - DoSetValue(val); + SetValue((int)val); } else // not a number at all or out of range { - m_textCtrl->SetValue(text); - m_textCtrl->SetSelection(0, -1); - m_textCtrl->SetInsertionPointEnd(); + m_text->SetValue(text); + m_text->SetSelection(0, -1); } } -bool wxSpinCtrlGenericBase::DoSetValue(double val) +void wxSpinCtrl::SetRange(int min, int max) { - wxCHECK_MSG( m_textCtrl, false, wxT("invalid call to wxSpinCtrl::SetValue") ); + wxCHECK_RET( m_btn, _T("invalid call to wxSpinCtrl::SetRange") ); - if (!InRange(val)) - return false; - - if ( m_snap_to_ticks && (m_increment != 0) ) - { - double snap_value = val / m_increment; - - if (wxFinite(snap_value)) // FIXME what to do about a failure? - { - if ((snap_value - floor(snap_value)) < (ceil(snap_value) - snap_value)) - val = floor(snap_value) * m_increment; - else - val = ceil(snap_value) * m_increment; - } - } - - wxString str(wxString::Format(m_format.c_str(), val)); - - if ((val != m_value) || (str != m_textCtrl->GetValue())) - { - m_value = val; - str.ToDouble( &m_value ); // wysiwyg for textctrl - m_textCtrl->SetValue( str ); - m_textCtrl->SetInsertionPointEnd(); - m_textCtrl->DiscardEdits(); - return true; - } - - return false; + m_btn->SetRange(min, max); } -double wxSpinCtrlGenericBase::AdjustToFitInRange(double value) const +void wxSpinCtrl::SetSelection(long from, long to) { - if (value < m_min) - value = HasFlag(wxSP_WRAP) ? m_max : m_min; - if (value > m_max) - value = HasFlag(wxSP_WRAP) ? m_min : m_max; + wxCHECK_RET( m_text, _T("invalid call to wxSpinCtrl::SetSelection") ); - return value; + m_text->SetSelection(from, to); } -void wxSpinCtrlGenericBase::DoSetRange(double min, double max) -{ - m_min = min; - m_max = max; -} - -void wxSpinCtrlGenericBase::DoSetIncrement(double inc) -{ - m_increment = inc; -} - -void wxSpinCtrlGenericBase::SetSnapToTicks(bool snap_to_ticks) -{ - m_snap_to_ticks = snap_to_ticks; - DoSetValue(m_value); -} - -void wxSpinCtrlGenericBase::SetSelection(long from, long to) -{ - wxCHECK_RET( m_textCtrl, wxT("invalid call to wxSpinCtrl::SetSelection") ); - - m_textCtrl->SetSelection(from, to); -} - -#ifndef wxHAS_NATIVE_SPINCTRL - -//----------------------------------------------------------------------------- -// wxSpinCtrl -//----------------------------------------------------------------------------- - -void wxSpinCtrl::DoSendEvent() -{ - wxSpinEvent event( wxEVT_COMMAND_SPINCTRL_UPDATED, GetId()); - event.SetEventObject( this ); - event.SetPosition((int)(m_value + 0.5)); // FIXME should be SetValue - event.SetString(m_textCtrl->GetValue()); - GetEventHandler()->ProcessEvent( event ); -} - -#endif // !wxHAS_NATIVE_SPINCTRL - -//----------------------------------------------------------------------------- -// wxSpinCtrlDouble -//----------------------------------------------------------------------------- - -IMPLEMENT_DYNAMIC_CLASS(wxSpinCtrlDouble, wxSpinCtrlGenericBase) - -void wxSpinCtrlDouble::DoSendEvent() -{ - wxSpinDoubleEvent event( wxEVT_COMMAND_SPINCTRLDOUBLE_UPDATED, GetId()); - event.SetEventObject( this ); - event.SetValue(m_value); - event.SetString(m_textCtrl->GetValue()); - GetEventHandler()->ProcessEvent( event ); -} - -void wxSpinCtrlDouble::SetDigits(unsigned digits) -{ - wxCHECK_RET( digits <= 20, "too many digits for wxSpinCtrlDouble" ); - - if ( digits == m_digits ) - return; - - m_digits = digits; - - m_format.Printf(wxT("%%0.%ulf"), digits); - - DoSetValue(m_value); -} - -#endif // wxUSE_SPINBTN - -#endif // !wxPort-with-native-spinctrl - #endif // wxUSE_SPINCTRL +#endif // !wxPort-with-native-spinctrl diff --git a/Source/3rd Party/wx/src/generic/splitter.cpp b/Source/3rd Party/wx/src/generic/splitter.cpp index b51fceb3a..ccad80b62 100644 --- a/Source/3rd Party/wx/src/generic/splitter.cpp +++ b/Source/3rd Party/wx/src/generic/splitter.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: splitter.cpp 60837 2009-05-31 13:13:07Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -39,10 +39,10 @@ #include -wxDEFINE_EVENT( wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED, wxSplitterEvent ); -wxDEFINE_EVENT( wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING, wxSplitterEvent ); -wxDEFINE_EVENT( wxEVT_COMMAND_SPLITTER_DOUBLECLICKED, wxSplitterEvent ); -wxDEFINE_EVENT( wxEVT_COMMAND_SPLITTER_UNSPLIT, wxSplitterEvent ); +DEFINE_EVENT_TYPE(wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED) +DEFINE_EVENT_TYPE(wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING) +DEFINE_EVENT_TYPE(wxEVT_COMMAND_SPLITTER_DOUBLECLICKED) +DEFINE_EVENT_TYPE(wxEVT_COMMAND_SPLITTER_UNSPLIT) IMPLEMENT_DYNAMIC_CLASS(wxSplitterWindow, wxWindow) @@ -61,25 +61,15 @@ BEGIN_EVENT_TABLE(wxSplitterWindow, wxWindow) EVT_PAINT(wxSplitterWindow::OnPaint) EVT_SIZE(wxSplitterWindow::OnSize) EVT_MOUSE_EVENTS(wxSplitterWindow::OnMouseEvent) - EVT_MOUSE_CAPTURE_LOST(wxSplitterWindow::OnMouseCaptureLost) #if defined( __WXMSW__ ) || defined( __WXMAC__) EVT_SET_CURSOR(wxSplitterWindow::OnSetCursor) #endif // wxMSW + + WX_EVENT_TABLE_CONTROL_CONTAINER(wxSplitterWindow) END_EVENT_TABLE() -static bool IsLive(wxSplitterWindow* wnd) -{ - // with wxSP_LIVE_UPDATE style the splitter windows are always resized - // following the mouse movement while it drags the sash, without it we only - // draw the sash at the new position but only resize the windows when the - // dragging is finished -#if defined( __WXMAC__ ) && defined(TARGET_API_MAC_OSX) && TARGET_API_MAC_OSX == 1 - return true; // Mac can't paint outside paint event - always need live mode -#else - return wnd->HasFlag(wxSP_LIVE_UPDATE); -#endif -} +WX_DELEGATE_TO_CONTROL_CONTAINER(wxSplitterWindow, wxWindow) bool wxSplitterWindow::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, @@ -90,10 +80,22 @@ bool wxSplitterWindow::Create(wxWindow *parent, wxWindowID id, // allow TABbing from one window to the other style |= wxTAB_TRAVERSAL; + // we draw our border ourselves to blend the sash with it + style &= ~wxBORDER_MASK; + style |= wxBORDER_NONE; + +#if defined(__WXMAC__) && wxMAC_USE_CORE_GRAPHICS + // CoreGraphics can't paint sash feedback + style |= wxSP_LIVE_UPDATE; +#endif + if ( !wxWindow::Create(parent, id, pos, size, style, name) ) return false; - m_lastSize = GetClientSize(); + if (size.x >= 0) + m_lastSize.x = size.x; + if (size.y >= 0) + m_lastSize.y = size.y; m_permitUnsplitAlways = (style & wxSP_PERMIT_UNSPLIT) != 0; @@ -110,22 +112,26 @@ bool wxSplitterWindow::Create(wxWindow *parent, wxWindowID id, void wxSplitterWindow::Init() { + m_container.SetContainerWindow(this); + m_splitMode = wxSPLIT_VERTICAL; m_permitUnsplitAlways = true; - m_windowOne = NULL; - m_windowTwo = NULL; + m_windowOne = (wxWindow *) NULL; + m_windowTwo = (wxWindow *) NULL; m_dragMode = wxSPLIT_DRAG_NONE; m_oldX = 0; m_oldY = 0; - m_sashStart = 0; - m_sashPosition = 0; - m_requestedSashPosition = INT_MAX; + m_firstX = 0; + m_firstY = 0; + m_sashPosition = m_requestedSashPosition = 0; m_sashGravity = 0.0; + m_sashSize = -1; // -1 means use the native sash size m_lastSize = wxSize(0,0); + m_checkRequestedSashPosition = false; m_minimumPaneSize = 0; m_sashCursorWE = wxCursor(wxCURSOR_SIZEWE); m_sashCursorNS = wxCursor(wxCURSOR_SIZENS); - m_sashTrackerPen = new wxPen(*wxBLACK, 2, wxPENSTYLE_SOLID); + m_sashTrackerPen = new wxPen(*wxBLACK, 2, wxSOLID); m_needUpdating = false; m_isHot = false; @@ -179,12 +185,6 @@ void wxSplitterWindow::SetResizeCursor() void wxSplitterWindow::OnPaint(wxPaintEvent& WXUNUSED(event)) { wxPaintDC dc(this); -#ifdef __WXOSX__ - // as subpanels might have a transparent background we must erase the background - // at least on OSX, otherwise traces of the sash will remain - // test with: splitter sample->replace right window - dc.Clear(); -#endif DrawSash(dc); } @@ -193,21 +193,17 @@ void wxSplitterWindow::OnInternalIdle() { wxWindow::OnInternalIdle(); - // We may need to update the children sizes in two cases: either because - // we're in the middle of a live update as indicated by m_needUpdating or - // because we have a requested but not yet set sash position as indicated - // by m_requestedSashPosition having a valid value. - if ( m_needUpdating ) + // if this is the first idle time after a sash position has potentially + // been set, allow SizeWindows to check for a requested size. + if (!m_checkRequestedSashPosition) { - m_needUpdating = false; - } - else if ( m_requestedSashPosition == INT_MAX ) - { - // We don't need to resize the children. - return; + m_checkRequestedSashPosition = true; + SizeWindows(); + return; // it won't needUpdating in this case } - SizeWindows(); + if (m_needUpdating) + SizeWindows(); } void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event) @@ -221,8 +217,15 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event) return; } - bool isLive = IsLive(this); - + // with wxSP_LIVE_UPDATE style the splitter windows are always resized + // following the mouse movement while it drags the sash, without it we only + // draw the sash at the new position but only resize the windows when the + // dragging is finished +#if defined( __WXMAC__ ) && defined(TARGET_API_MAC_OSX) && TARGET_API_MAC_OSX == 1 + bool isLive = true ; // FIXME: why? +#else + bool isLive = HasFlag(wxSP_LIVE_UPDATE); +#endif if (event.LeftDown()) { if ( SashHitTest(x, y) ) @@ -240,13 +243,13 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event) // shadow sash m_sashPositionCurrent = m_sashPosition; - m_oldX = (m_splitMode == wxSPLIT_VERTICAL ? m_sashPositionCurrent : x); - m_oldY = (m_splitMode != wxSPLIT_VERTICAL ? m_sashPositionCurrent : y); - DrawSashTracker(m_oldX, m_oldY); + DrawSashTracker(x, y); } - m_ptStart = wxPoint(x,y); - m_sashStart = m_sashPosition; + m_oldX = x; + m_oldY = y; + + SetResizeCursor(); return; } } @@ -274,9 +277,10 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event) // the position of the click doesn't exactly correspond to // m_sashPosition, rather it changes it by the distance by which the // mouse has moved - int diff = m_splitMode == wxSPLIT_VERTICAL ? x - m_ptStart.x : y - m_ptStart.y; + int diff = m_splitMode == wxSPLIT_VERTICAL ? x - m_oldX : y - m_oldY; - int posSashNew = OnSashPositionChanging(m_sashStart + diff); + int posSashOld = isLive ? m_sashPosition : m_sashPositionCurrent; + int posSashNew = OnSashPositionChanging(posSashOld + diff); if ( posSashNew == -1 ) { // change not allowed @@ -291,7 +295,7 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event) // We remove the first window from the view wxWindow *removedWindow = m_windowOne; m_windowOne = m_windowTwo; - m_windowTwo = NULL; + m_windowTwo = (wxWindow *) NULL; OnUnsplit(removedWindow); wxSplitterEvent eventUnsplit(wxEVT_COMMAND_SPLITTER_UNSPLIT, this); eventUnsplit.m_data.win = removedWindow; @@ -302,7 +306,7 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event) { // We remove the second window from the view wxWindow *removedWindow = m_windowTwo; - m_windowTwo = NULL; + m_windowTwo = (wxWindow *) NULL; OnUnsplit(removedWindow); wxSplitterEvent eventUnsplit(wxEVT_COMMAND_SPLITTER_UNSPLIT, this); eventUnsplit.m_data.win = removedWindow; @@ -330,53 +334,62 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event) } else if (event.Dragging() && (m_dragMode == wxSPLIT_DRAG_DRAGGING)) { - int diff = m_splitMode == wxSPLIT_VERTICAL ? x - m_ptStart.x : y - m_ptStart.y; + int diff = m_splitMode == wxSPLIT_VERTICAL ? x - m_oldX : y - m_oldY; + if ( !diff ) + { + // nothing to do, mouse didn't really move far enough + return; + } - int posSashNew = OnSashPositionChanging(m_sashStart + diff); + int posSashOld = isLive ? m_sashPosition : m_sashPositionCurrent; + int posSashNew = OnSashPositionChanging(posSashOld + diff); if ( posSashNew == -1 ) { // change not allowed return; } + if ( posSashNew == m_sashPosition ) + return; + + // Erase old tracker if ( !isLive ) { - if ( posSashNew == m_sashPositionCurrent ) - return; - - m_sashPositionCurrent = posSashNew; - - // Erase old tracker DrawSashTracker(m_oldX, m_oldY); + } - m_oldX = (m_splitMode == wxSPLIT_VERTICAL ? m_sashPositionCurrent : x); - m_oldY = (m_splitMode != wxSPLIT_VERTICAL ? m_sashPositionCurrent : y); + if (m_splitMode == wxSPLIT_VERTICAL) + x = posSashNew; + else + y = posSashNew; + + // Remember old positions + m_oldX = x; + m_oldY = y; #ifdef __WXMSW__ - // As we captured the mouse, we may get the mouse events from outside - // our window - for example, negative values in x, y. This has a weird - // consequence under MSW where we use unsigned values sometimes and - // signed ones other times: the coordinates turn as big positive - // numbers and so the sash is drawn on the *right* side of the window - // instead of the left (or bottom instead of top). Correct this. - if ( (short)m_oldX < 0 ) - m_oldX = 0; - if ( (short)m_oldY < 0 ) - m_oldY = 0; + // As we captured the mouse, we may get the mouse events from outside + // our window - for example, negative values in x, y. This has a weird + // consequence under MSW where we use unsigned values sometimes and + // signed ones other times: the coordinates turn as big positive + // numbers and so the sash is drawn on the *right* side of the window + // instead of the left (or bottom instead of top). Correct this. + if ( (short)m_oldX < 0 ) + m_oldX = 0; + if ( (short)m_oldY < 0 ) + m_oldY = 0; #endif // __WXMSW__ - // Draw new one + // Draw new one + if ( !isLive ) + { + m_sashPositionCurrent = posSashNew; + DrawSashTracker(m_oldX, m_oldY); } else { - if ( posSashNew == m_sashPosition ) - return; - DoSetSashPosition(posSashNew); - - // in live mode, the new position is the actual sash position, clear requested position! - m_requestedSashPosition = INT_MAX; m_needUpdating = true; } } @@ -390,22 +403,6 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event) } } -void wxSplitterWindow::OnMouseCaptureLost(wxMouseCaptureLostEvent& WXUNUSED(event)) -{ - if (m_dragMode != wxSPLIT_DRAG_DRAGGING) - return; - - m_dragMode = wxSPLIT_DRAG_NONE; - - SetCursor(* wxSTANDARD_CURSOR); - - // Erase old tracker - if ( !IsLive(this) ) - { - DrawSashTracker(m_oldX, m_oldY); - } -} - void wxSplitterWindow::OnSize(wxSizeEvent& event) { // only process this message if we're not iconized - otherwise iconizing @@ -435,43 +432,30 @@ void wxSplitterWindow::OnSize(wxSizeEvent& event) return; } - const wxSize curSize = event.GetSize(); - - // Update the sash position if needed. - // - // Notice that we shouldn't do this if the sash position requested by user - // couldn't be set yet as it would never be taken into account at all if we - // modified it before this happens. - if ( m_windowTwo && m_requestedSashPosition == INT_MAX ) + if ( m_windowTwo ) { - int size = m_splitMode == wxSPLIT_VERTICAL ? curSize.x : curSize.y; + int w, h; + GetClientSize(&w, &h); + + int size = m_splitMode == wxSPLIT_VERTICAL ? w : h; int old_size = m_splitMode == wxSPLIT_VERTICAL ? m_lastSize.x : m_lastSize.y; - - // Don't do anything if the size didn't really change. - if ( size != old_size ) + if ( old_size != 0 ) { - int newPosition = -1; - - // Apply gravity if we use it. int delta = (int) ( (size - old_size)*m_sashGravity ); if ( delta != 0 ) { - newPosition = m_sashPosition + delta; + int newPosition = m_sashPosition + delta; if( newPosition < m_minimumPaneSize ) newPosition = m_minimumPaneSize; - } - - // Also check if the second window became too small. - newPosition = AdjustSashPosition(newPosition == -1 - ? m_sashPosition - : newPosition); - if ( newPosition != m_sashPosition ) SetSashPositionAndNotify(newPosition); + } } - } - m_lastSize = curSize; + if ( m_sashPosition >= size - 5 ) + SetSashPositionAndNotify(wxMax(10, size - 40)); + m_lastSize = wxSize(w,h); + } SizeWindows(); } @@ -479,7 +463,7 @@ void wxSplitterWindow::OnSize(wxSizeEvent& event) void wxSplitterWindow::SetSashGravity(double gravity) { wxCHECK_RET( gravity >= 0. && gravity <= 1., - wxT("invalid gravity value") ); + _T("invalid gravity value") ); m_sashGravity = gravity; } @@ -496,20 +480,9 @@ bool wxSplitterWindow::SashHitTest(int x, int y, int tolerance) return z >= hitMin && z <= hitMax; } -void wxSplitterWindow::SetSashInvisible(bool invisible) -{ - if ( IsSashInvisible() != invisible ) - ToggleWindowStyle(wxSP_NOSASH); -} - int wxSplitterWindow::GetSashSize() const { - return IsSashInvisible() ? 0 : GetDefaultSashSize(); -} - -int wxSplitterWindow::GetDefaultSashSize() const -{ - return wxRendererNative::Get().GetSplitterParams(this).widthSash; + return m_sashSize > -1 ? m_sashSize : wxRendererNative::Get().GetSplitterParams(this).widthSash; } int wxSplitterWindow::GetBorderSize() const @@ -533,7 +506,7 @@ void wxSplitterWindow::DrawSash(wxDC& dc) return; // nor if we're configured to not show it - if ( IsSashInvisible() ) + if ( HasFlag(wxSP_NOSASH) ) return; wxRendererNative::Get().DrawSplitterSash @@ -560,15 +533,33 @@ void wxSplitterWindow::DrawSashTracker(int x, int y) if ( m_splitMode == wxSPLIT_VERTICAL ) { - x1 = x2 = wxClip(x, 0, w) + m_sashTrackerPen->GetWidth()/2; - y1 = 2; - y2 = h-2; + x1 = x; y1 = 2; + x2 = x; y2 = h-2; + + if ( x1 > w ) + { + x1 = w; x2 = w; + } + else if ( x1 < 0 ) + { + x1 = 0; x2 = 0; + } } else { - y1 = y2 = wxClip(y, 0, h) + m_sashTrackerPen->GetWidth()/2; - x1 = 2; - x2 = w-2; + x1 = 2; y1 = y; + x2 = w-2; y2 = y; + + if ( y1 > h ) + { + y1 = h; + y2 = h; + } + else if ( y1 < 0 ) + { + y1 = 0; + y2 = 0; + } } ClientToScreen(&x1, &y1); @@ -665,7 +656,7 @@ void wxSplitterWindow::SetSashPositionAndNotify(int sashPos) void wxSplitterWindow::SizeWindows() { // check if we have delayed setting the real sash position - if ( m_requestedSashPosition != INT_MAX ) + if ( m_checkRequestedSashPosition && m_requestedSashPosition != INT_MAX ) { int newSashPosition = ConvertSashPosition(m_requestedSashPosition); if ( newSashPosition != m_sashPosition ) @@ -731,19 +722,21 @@ void wxSplitterWindow::SizeWindows() wxClientDC dc(this); DrawSash(dc); + + SetNeedUpdating(false); } // Set pane for unsplit window void wxSplitterWindow::Initialize(wxWindow *window) { - wxASSERT_MSG( (!window || window->GetParent() == this), - wxT("windows in the splitter should have it as parent!") ); + wxASSERT_MSG( (!window || (window && window->GetParent() == this)), + _T("windows in the splitter should have it as parent!") ); if (window && !window->IsShown()) window->Show(); m_windowOne = window; - m_windowTwo = NULL; + m_windowTwo = (wxWindow *) NULL; DoSetSashPosition(0); } @@ -758,10 +751,10 @@ bool wxSplitterWindow::DoSplit(wxSplitMode mode, return false; wxCHECK_MSG( window1 && window2, false, - wxT("cannot split with NULL window(s)") ); + _T("can not split with NULL window(s)") ); wxCHECK_MSG( window1->GetParent() == this && window2->GetParent() == this, false, - wxT("windows in the splitter should have it as parent!") ); + _T("windows in the splitter should have it as parent!") ); if (! window1->IsShown()) window1->Show(); @@ -772,8 +765,15 @@ bool wxSplitterWindow::DoSplit(wxSplitMode mode, m_windowOne = window1; m_windowTwo = window2; + // remember the sash position we want to set for later if we can't set it + // right now (e.g. because the window is too small) + m_requestedSashPosition = sashPosition; + m_checkRequestedSashPosition = false; + + DoSetSashPosition(ConvertSashPosition(sashPosition)); + + SizeWindows(); - SetSashPosition(sashPosition, true); return true; } @@ -806,13 +806,13 @@ bool wxSplitterWindow::Unsplit(wxWindow *toRemove) if ( toRemove == NULL || toRemove == m_windowTwo) { win = m_windowTwo ; - m_windowTwo = NULL; + m_windowTwo = (wxWindow *) NULL; } else if ( toRemove == m_windowOne ) { win = m_windowOne ; m_windowOne = m_windowTwo; - m_windowTwo = NULL; + m_windowTwo = (wxWindow *) NULL; } else { @@ -866,6 +866,7 @@ void wxSplitterWindow::SetSashPosition(int position, bool redraw) // remember the sash position we want to set for later if we can't set it // right now (e.g. because the window is too small) m_requestedSashPosition = position; + m_checkRequestedSashPosition = false; DoSetSashPosition(ConvertSashPosition(position)); @@ -880,7 +881,9 @@ void wxSplitterWindow::SetSashPosition(int position, bool redraw) // window is shown, if you know the overall size is correct. void wxSplitterWindow::UpdateSize() { + m_checkRequestedSashPosition = true; SizeWindows(); + m_checkRequestedSashPosition = false; } bool wxSplitterWindow::DoSendEvent(wxSplitterEvent& event) @@ -978,13 +981,13 @@ int wxSplitterWindow::OnSashPositionChanging(int newSashPosition) { // If resultant pane would be too small, enlarge it newSashPosition = AdjustSashPosition(newSashPosition); - - // If the result is out of bounds it means minimum size is too big, - // so split window in half as best compromise. - if ( newSashPosition < 0 || newSashPosition > window_size ) - newSashPosition = window_size / 2; } + // If the result is out of bounds it means minimum size is too big, + // so split window in half as best compromise. + if ( newSashPosition < 0 || newSashPosition > window_size ) + newSashPosition = window_size / 2; + // now let the event handler have it // // FIXME: shouldn't we do it before the adjustments above so as to ensure diff --git a/Source/3rd Party/wx/src/generic/srchctlg.cpp b/Source/3rd Party/wx/src/generic/srchctlg.cpp index d1f1c079d..8b7edad0d 100644 --- a/Source/3rd Party/wx/src/generic/srchctlg.cpp +++ b/Source/3rd Party/wx/src/generic/srchctlg.cpp @@ -3,9 +3,9 @@ // Purpose: implements wxSearchCtrl as a composite control // Author: Vince Harron // Created: 2006-02-19 -// RCS-ID: $Id$ +// RCS-ID: $Id: srchctlg.cpp 47962 2007-08-08 12:38:13Z JS $ // Copyright: Vince Harron -// Licence: wxWindows licence +// License: wxWindows licence /////////////////////////////////////////////////////////////////////////////// // For compilers that support precompilation, includes "wx.h". @@ -50,6 +50,55 @@ static const wxCoord ICON_MARGIN = 0; static const wxCoord ICON_OFFSET = 0; #endif +// ---------------------------------------------------------------------------- +// TODO: These functions or something like them should probably be made +// public. There are similar functions in src/aui/dockart.cpp... + +static double wxBlendColour(double fg, double bg, double alpha) +{ + double result = bg + (alpha * (fg - bg)); + if (result < 0.0) + result = 0.0; + if (result > 255) + result = 255; + return result; +} + +static wxColor wxStepColour(const wxColor& c, int ialpha) +{ + if (ialpha == 100) + return c; + + double r = c.Red(), g = c.Green(), b = c.Blue(); + double bg; + + // ialpha is 0..200 where 0 is completely black + // and 200 is completely white and 100 is the same + // convert that to normal alpha 0.0 - 1.0 + ialpha = wxMin(ialpha, 200); + ialpha = wxMax(ialpha, 0); + double alpha = ((double)(ialpha - 100.0))/100.0; + + if (ialpha > 100) + { + // blend with white + bg = 255.0; + alpha = 1.0 - alpha; // 0 = transparent fg; 1 = opaque fg + } + else + { + // blend with black + bg = 0.0; + alpha = 1.0 + alpha; // 0 = transparent fg; 1 = opaque fg + } + + r = wxBlendColour(r, bg, alpha); + g = wxBlendColour(g, bg, alpha); + b = wxBlendColour(b, bg, alpha); + + return wxColour((unsigned char)r, (unsigned char)g, (unsigned char)b); +} + #define LIGHT_STEP 160 // ---------------------------------------------------------------------------- @@ -61,32 +110,28 @@ class wxSearchTextCtrl : public wxTextCtrl public: wxSearchTextCtrl(wxSearchCtrl *search, const wxString& value, int style) : wxTextCtrl(search, wxID_ANY, value, wxDefaultPosition, wxDefaultSize, - (style & ~wxBORDER_MASK) | wxNO_BORDER) + style | wxNO_BORDER) { m_search = search; - - SetHint(_("Search")); + m_defaultFG = GetForegroundColour(); // remove the default minsize, the searchctrl will have one instead SetSizeHints(wxDefaultCoord,wxDefaultCoord); } - - // provide access to the base class protected methods to wxSearchCtrl which - // needs to forward to them - void DoSetValue(const wxString& value, int flags) + void SetDescriptiveText(const wxString& text) { - wxTextCtrl::DoSetValue(value, flags); + if ( GetValue() == m_descriptiveText ) + { + ChangeValue(wxEmptyString); + } + + m_descriptiveText = text; } - bool DoLoadFile(const wxString& file, int fileType) + wxString GetDescriptiveText() const { - return wxTextCtrl::DoLoadFile(file, fileType); - } - - bool DoSaveFile(const wxString& file, int fileType) - { - return wxTextCtrl::DoSaveFile(file, fileType); + return m_descriptiveText; } protected: @@ -114,34 +159,30 @@ protected: m_search->GetEventHandler()->ProcessEvent(event); } -#ifdef __WXMSW__ - // We increase the text control height to be the same as for the controls - // with border as this is what we actually need here because even though - // this control itself is borderless, it's inside wxSearchCtrl which does - // have the border and so should have the same height as the normal text - // entries with border. - // - // This is a bit ugly and it would arguably be better to use whatever size - // the base class version returns and just centre the text vertically in - // the search control but I failed to modify the code in LayoutControls() - // to do this easily and as there is much in that code I don't understand - // (notably what is the logic for buttons sizing?) I prefer to not touch it - // at all. - virtual wxSize DoGetBestSize() const + void OnIdle(wxIdleEvent& WXUNUSED(event)) { - const long flags = GetWindowStyleFlag(); - wxSearchTextCtrl* const self = const_cast(this); - - self->SetWindowStyleFlag((flags & ~wxBORDER_MASK) | wxBORDER_DEFAULT); - const wxSize size = wxTextCtrl::DoGetBestSize(); - self->SetWindowStyleFlag(flags); - - return size; + if ( IsEmpty() && !(wxWindow::FindFocus() == this) ) + { + ChangeValue(m_descriptiveText); + SetInsertionPoint(0); + SetForegroundColour(wxStepColour(m_defaultFG, LIGHT_STEP)); + } + } + + void OnFocus(wxFocusEvent& event) + { + event.Skip(); + if ( GetValue() == m_descriptiveText ) + { + ChangeValue(wxEmptyString); + SetForegroundColour(m_defaultFG); + } } -#endif // __WXMSW__ private: wxSearchCtrl* m_search; + wxString m_descriptiveText; + wxColour m_defaultFG; DECLARE_EVENT_TABLE() }; @@ -151,6 +192,8 @@ BEGIN_EVENT_TABLE(wxSearchTextCtrl, wxTextCtrl) EVT_TEXT_ENTER(wxID_ANY, wxSearchTextCtrl::OnText) EVT_TEXT_URL(wxID_ANY, wxSearchTextCtrl::OnTextUrl) EVT_TEXT_MAXLEN(wxID_ANY, wxSearchTextCtrl::OnText) + EVT_IDLE(wxSearchTextCtrl::OnIdle) + EVT_SET_FOCUS(wxSearchTextCtrl::OnFocus) END_EVENT_TABLE() // ---------------------------------------------------------------------------- @@ -169,13 +212,6 @@ public: void SetBitmapLabel(const wxBitmap& label) { m_bmp = label; } - // The buttons in wxSearchCtrl shouldn't accept focus from keyboard because - // this would interfere with the usual TAB processing: the user expects - // that pressing TAB in the search control should switch focus to the next - // control and not give it to the button inside the same control. Besides, - // the search button can be already activated by pressing "Enter" so there - // is really no reason for it to be able to get focus from keyboard. - virtual bool AcceptsFocusFromKeyboard() const { return false; } protected: wxSize DoGetBestSize() const @@ -188,14 +224,6 @@ protected: wxCommandEvent event(m_eventType, m_search->GetId()); event.SetEventObject(m_search); - if ( m_eventType == wxEVT_COMMAND_SEARCHCTRL_SEARCH_BTN ) - { - // it's convenient to have the string to search for directly in the - // event instead of having to retrieve it from the control in the - // event handler code later, so provide it here - event.SetString(m_search->GetValue()); - } - GetEventHandler()->ProcessEvent(event); m_search->SetFocus(); @@ -293,36 +321,36 @@ bool wxSearchCtrl::Create(wxWindow *parent, wxWindowID id, const wxValidator& validator, const wxString& name) { - // force border style for more native appearance - style &= ~wxBORDER_MASK; -#ifdef __WXGTK__ - style |= wxBORDER_SUNKEN; -#elif defined(__WXMSW__) - // Don't set the style explicitly, let GetDefaultBorder() work it out, unless - // we will get a sunken border (e.g. on Windows 200) in which case we must - // override with a simple border. - if (GetDefaultBorder() == wxBORDER_SUNKEN) - style |= wxBORDER_SIMPLE; -#else - style |= wxBORDER_SIMPLE; + int borderStyle = wxBORDER_SIMPLE; + +#if defined(__WXMSW__) + borderStyle = GetThemedBorderStyle(); + if (borderStyle == wxBORDER_SUNKEN) + borderStyle = wxBORDER_SIMPLE; +#elif defined(__WXGTK__) + borderStyle = wxBORDER_SUNKEN; #endif - if ( !wxSearchCtrlBaseBaseClass::Create(parent, id, pos, size, - style, validator, name) ) + + if ( !wxTextCtrlBase::Create(parent, id, pos, size, borderStyle | (style & ~wxBORDER_MASK), validator, name) ) { return false; } - m_text = new wxSearchTextCtrl(this, value, style); + m_text = new wxSearchTextCtrl(this, value, style & ~wxBORDER_MASK); + m_text->SetDescriptiveText(_("Search")); - m_searchButton = new wxSearchButton(this, - wxEVT_COMMAND_SEARCHCTRL_SEARCH_BTN, - m_searchBitmap); - m_cancelButton = new wxSearchButton(this, - wxEVT_COMMAND_SEARCHCTRL_CANCEL_BTN, - m_cancelBitmap); + wxSize sizeText = m_text->GetBestSize(); + + m_searchButton = new wxSearchButton(this,wxEVT_COMMAND_SEARCHCTRL_SEARCH_BTN,m_searchBitmap); + m_cancelButton = new wxSearchButton(this,wxEVT_COMMAND_SEARCHCTRL_CANCEL_BTN,m_cancelBitmap); SetForegroundColour( m_text->GetForegroundColour() ); + m_searchButton->SetForegroundColour( m_text->GetForegroundColour() ); + m_cancelButton->SetForegroundColour( m_text->GetForegroundColour() ); + SetBackgroundColour( m_text->GetBackgroundColour() ); + m_searchButton->SetBackgroundColour( m_text->GetBackgroundColour() ); + m_cancelButton->SetBackgroundColour( m_text->GetBackgroundColour() ); RecalcBitmaps(); @@ -423,12 +451,12 @@ bool wxSearchCtrl::IsCancelButtonVisible() const void wxSearchCtrl::SetDescriptiveText(const wxString& text) { - m_text->SetHint(text); + m_text->SetDescriptiveText(text); } wxString wxSearchCtrl::GetDescriptiveText() const { - return m_text->GetHint(); + return m_text->GetDescriptiveText(); } // ---------------------------------------------------------------------------- @@ -480,8 +508,6 @@ void wxSearchCtrl::LayoutControls(int x, int y, int width, int height) y += BORDER; width -= horizontalBorder*2; height -= BORDER*2; - if (width < 0) width = 0; - if (height < 0) height = 0; wxSize sizeSearch(0,0); wxSize sizeCancel(0,0); @@ -508,7 +534,6 @@ void wxSearchCtrl::LayoutControls(int x, int y, int width, int height) cancelMargin = 0; } wxCoord textWidth = width - sizeSearch.x - sizeCancel.x - searchMargin - cancelMargin - 1; - if (textWidth < 0) textWidth = 0; // position the subcontrols inside the client area @@ -521,22 +546,23 @@ void wxSearchCtrl::LayoutControls(int x, int y, int width, int height) y + ICON_OFFSET - 1, sizeCancel.x, height); } -wxWindowList wxSearchCtrl::GetCompositeWindowParts() const -{ - wxWindowList parts; - parts.push_back(m_text); - parts.push_back(m_searchButton); - parts.push_back(m_cancelButton); - return parts; -} // accessors // --------- -wxString wxSearchCtrl::DoGetValue() const +wxString wxSearchCtrl::GetValue() const { - return m_text->GetValue(); + wxString value = m_text->GetValue(); + if (value == m_text->GetDescriptiveText()) + return wxEmptyString; + else + return value; } +void wxSearchCtrl::SetValue(const wxString& value) +{ + m_text->SetValue(value); +} + wxString wxSearchCtrl::GetRange(long from, long to) const { return m_text->GetRange(from, to); @@ -758,7 +784,7 @@ long wxSearchCtrl::GetInsertionPoint() const { return m_text->GetInsertionPoint(); } -long wxSearchCtrl::GetLastPosition() const +wxTextPos wxSearchCtrl::GetLastPosition() const { return m_text->GetLastPosition(); } @@ -779,32 +805,20 @@ void wxSearchCtrl::SetEditable(bool editable) bool wxSearchCtrl::SetFont(const wxFont& font) { - if ( !wxSearchCtrlBase::SetFont(font) ) - return false; - - // Recreate the bitmaps as their size may have changed. + bool result = wxSearchCtrlBase::SetFont(font); + if ( result && m_text ) + { + result = m_text->SetFont(font); + } RecalcBitmaps(); - - return true; -} - -bool wxSearchCtrl::SetBackgroundColour(const wxColour& colour) -{ - if ( !wxSearchCtrlBase::SetBackgroundColour(colour) ) - return false; - - // When the background changes, re-render the bitmaps so that the correct - // colour shows in their "transparent" area. - RecalcBitmaps(); - - return true; + return result; } // search control generic only void wxSearchCtrl::SetSearchBitmap( const wxBitmap& bitmap ) { m_searchBitmap = bitmap; - m_searchBitmapUser = bitmap.IsOk(); + m_searchBitmapUser = bitmap.Ok(); if ( m_searchBitmapUser ) { if ( m_searchButton && !HasMenu() ) @@ -824,7 +838,7 @@ void wxSearchCtrl::SetSearchBitmap( const wxBitmap& bitmap ) void wxSearchCtrl::SetSearchMenuBitmap( const wxBitmap& bitmap ) { m_searchMenuBitmap = bitmap; - m_searchMenuBitmapUser = bitmap.IsOk(); + m_searchMenuBitmapUser = bitmap.Ok(); if ( m_searchMenuBitmapUser ) { if ( m_searchButton && m_menu ) @@ -844,7 +858,7 @@ void wxSearchCtrl::SetSearchMenuBitmap( const wxBitmap& bitmap ) void wxSearchCtrl::SetCancelBitmap( const wxBitmap& bitmap ) { m_cancelBitmap = bitmap; - m_cancelBitmapUser = bitmap.IsOk(); + m_cancelBitmapUser = bitmap.Ok(); if ( m_cancelBitmapUser ) { if ( m_cancelButton ) @@ -878,17 +892,9 @@ wxTextCtrl& operator<<(const wxChar c); void wxSearchCtrl::DoSetValue(const wxString& value, int flags) { - m_text->DoSetValue(value, flags); -} - -bool wxSearchCtrl::DoLoadFile(const wxString& file, int fileType) -{ - return m_text->DoLoadFile(file, fileType); -} - -bool wxSearchCtrl::DoSaveFile(const wxString& file, int fileType) -{ - return m_text->DoSaveFile(file, fileType); + m_text->ChangeValue( value ); + if ( flags & SetValue_SendEvent ) + SendTextUpdatedEvent(); } // do the window-specific processing after processing the update event @@ -923,7 +929,7 @@ static int GetMultiplier() wxBitmap wxSearchCtrl::RenderSearchBitmap( int x, int y, bool renderDrop ) { wxColour bg = GetBackgroundColour(); - wxColour fg = GetForegroundColour().ChangeLightness(LIGHT_STEP-20); + wxColour fg = wxStepColour(GetForegroundColour(), LIGHT_STEP-20); //=============================================================================== // begin drawing code @@ -1028,7 +1034,7 @@ wxBitmap wxSearchCtrl::RenderSearchBitmap( int x, int y, bool renderDrop ) wxBitmap wxSearchCtrl::RenderCancelBitmap( int x, int y ) { wxColour bg = GetBackgroundColour(); - wxColour fg = GetForegroundColour().ChangeLightness(LIGHT_STEP); + wxColour fg = wxStepColour(GetForegroundColour(), LIGHT_STEP); //=============================================================================== // begin drawing code @@ -1124,7 +1130,7 @@ void wxSearchCtrl::RecalcBitmaps() if ( !m_searchBitmapUser ) { if ( - !m_searchBitmap.IsOk() || + !m_searchBitmap.Ok() || m_searchBitmap.GetHeight() != bitmapHeight || m_searchBitmap.GetWidth() != bitmapWidth ) @@ -1142,7 +1148,7 @@ void wxSearchCtrl::RecalcBitmaps() if ( !m_searchMenuBitmapUser ) { if ( - !m_searchMenuBitmap.IsOk() || + !m_searchMenuBitmap.Ok() || m_searchMenuBitmap.GetHeight() != bitmapHeight || m_searchMenuBitmap.GetWidth() != bitmapWidth ) @@ -1160,7 +1166,7 @@ void wxSearchCtrl::RecalcBitmaps() if ( !m_cancelBitmapUser ) { if ( - !m_cancelBitmap.IsOk() || + !m_cancelBitmap.Ok() || m_cancelBitmap.GetHeight() != bitmapHeight || m_cancelBitmap.GetWidth() != bitmapHeight ) diff --git a/Source/3rd Party/wx/src/generic/statbmpg.cpp b/Source/3rd Party/wx/src/generic/statbmpg.cpp deleted file mode 100644 index ca7a827d3..000000000 --- a/Source/3rd Party/wx/src/generic/statbmpg.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/generic/statbmpg.cpp -// Purpose: wxGenericStaticBitmap -// Author: Marcin Wojdyr, Stefan Csomor -// Created: 2008-06-16 -// RCS-ID: $Id$ -// Copyright: wxWidgets developers -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - -#if wxUSE_STATBMP - -#ifndef WX_PRECOMP - #include "wx/dcclient.h" -#endif - -#include "wx/generic/statbmpg.h" - -bool wxGenericStaticBitmap::Create(wxWindow *parent, wxWindowID id, - const wxBitmap& bitmap, - const wxPoint& pos, const wxSize& size, - long style, const wxString& name) -{ - if (! wxControl::Create(parent, id, pos, size, style, - wxDefaultValidator, name)) - return false; - SetBitmap(bitmap); - Connect(wxEVT_PAINT, wxPaintEventHandler(wxGenericStaticBitmap::OnPaint)); - return true; -} - -void wxGenericStaticBitmap::OnPaint(wxPaintEvent& WXUNUSED(event)) -{ - wxPaintDC dc(this); - if (m_bitmap.IsOk()) - dc.DrawBitmap(m_bitmap, 0, 0, true); -} - -// under OSX_cocoa is a define, avoid duplicate info -#ifndef wxGenericStaticBitmap - -IMPLEMENT_DYNAMIC_CLASS(wxGenericStaticBitmap, wxStaticBitmapBase) - -#endif - -#endif // wxUSE_STATBMP - diff --git a/Source/3rd Party/wx/src/generic/stattextg.cpp b/Source/3rd Party/wx/src/generic/stattextg.cpp deleted file mode 100644 index 7641c4261..000000000 --- a/Source/3rd Party/wx/src/generic/stattextg.cpp +++ /dev/null @@ -1,169 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/generic/stattextg.cpp -// Purpose: wxGenericStaticText -// Author: Marcin Wojdyr -// Created: 2008-06-26 -// RCS-ID: $Id$ -// Copyright: Marcin Wojdyr -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_STATTEXT - -#ifndef WX_PRECOMP - #include "wx/dcclient.h" - #include "wx/settings.h" - #include "wx/validate.h" -#endif - -#include "wx/generic/stattextg.h" - -#if wxUSE_MARKUP - #include "wx/generic/private/markuptext.h" -#endif // wxUSE_MARKUP - -IMPLEMENT_DYNAMIC_CLASS(wxGenericStaticText, wxStaticTextBase) - - -bool wxGenericStaticText::Create(wxWindow *parent, - wxWindowID id, - const wxString &label, - const wxPoint &pos, - const wxSize &size, - long style, - const wxString &name) -{ - if ( !wxControl::Create(parent, id, pos, size, style, - wxDefaultValidator, name) ) - return false; - - SetLabel(label); - SetInitialSize(size); - Connect(wxEVT_PAINT, wxPaintEventHandler(wxGenericStaticText::OnPaint)); - return true; -} - -wxGenericStaticText::~wxGenericStaticText() -{ -#if wxUSE_MARKUP - delete m_markupText; -#endif // wxUSE_MARKUP -} - -void wxGenericStaticText::DoDrawLabel(wxDC& dc, const wxRect& rect) -{ -#if wxUSE_MARKUP - if ( m_markupText ) - m_markupText->Render(dc, rect, wxMarkupText::Render_ShowAccels); - else -#endif // wxUSE_MARKUP - dc.DrawLabel(m_label, rect, GetAlignment(), m_mnemonic); -} - -void wxGenericStaticText::OnPaint(wxPaintEvent& WXUNUSED(event)) -{ - wxPaintDC dc(this); - - wxRect rect = GetClientRect(); - if ( IsEnabled() ) - { - dc.SetTextForeground( - wxSystemSettings::GetColour(wxSYS_COLOUR_BTNTEXT)); - } - else // paint disabled text - { - // draw shadow of the text - dc.SetTextForeground( - wxSystemSettings::GetColour(wxSYS_COLOUR_BTNHIGHLIGHT)); - wxRect rectShadow = rect; - rectShadow.Offset(1, 1); - DoDrawLabel(dc, rectShadow); - dc.SetTextForeground( - wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW)); - } - DoDrawLabel(dc, rect); -} - - -wxSize wxGenericStaticText::DoGetBestClientSize() const -{ - wxClientDC dc(wxConstCast(this, wxGenericStaticText)); - -#if wxUSE_MARKUP - if ( m_markupText ) - return m_markupText->Measure(dc); -#endif // wxUSE_MARKUP - - return dc.GetMultiLineTextExtent(GetLabel()); -} - -void wxGenericStaticText::SetLabel(const wxString& label) -{ - wxControl::SetLabel(label); - DoSetLabel(GetEllipsizedLabel()); - if ( !HasFlag(wxST_NO_AUTORESIZE) && !IsEllipsized() ) - InvalidateBestSize(); - -#if wxUSE_MARKUP - if ( m_markupText ) - { - delete m_markupText; - m_markupText = NULL; - } -#endif // wxUSE_MARKUP - - Refresh(); -} - -void wxGenericStaticText::DoSetLabel(const wxString& label) -{ - m_mnemonic = FindAccelIndex(label, &m_label); -} - -#if wxUSE_MARKUP - -bool wxGenericStaticText::DoSetLabelMarkup(const wxString& markup) -{ - if ( !wxStaticTextBase::DoSetLabelMarkup(markup) ) - return false; - - if ( !m_markupText ) - m_markupText = new wxMarkupText(markup); - else - m_markupText->SetMarkup(markup); - - if ( !HasFlag(wxST_NO_AUTORESIZE) ) - InvalidateBestSize(); - - Refresh(); - - return true; -} - -#endif // wxUSE_MARKUP - -bool wxGenericStaticText::SetFont(const wxFont &font) -{ - if ( !wxControl::SetFont(font) ) - return false; - if ( !HasFlag(wxST_NO_AUTORESIZE) ) - InvalidateBestSize(); - Refresh(); - return true; -} - -void wxGenericStaticText::DoSetSize(int x, int y, int width, int height, - int sizeFlags) -{ - wxStaticTextBase::DoSetSize(x, y, width, height, sizeFlags); - UpdateLabel(); -} - - -#endif // wxUSE_STATTEXT diff --git a/Source/3rd Party/wx/src/generic/statusbr.cpp b/Source/3rd Party/wx/src/generic/statusbr.cpp index 7e5b512a7..c392cefcd 100644 --- a/Source/3rd Party/wx/src/generic/statusbr.cpp +++ b/Source/3rd Party/wx/src/generic/statusbr.cpp @@ -2,9 +2,9 @@ // Name: src/generic/statusbr.cpp // Purpose: wxStatusBarGeneric class implementation // Author: Julian Smart -// Modified by: Francesco Montorsi +// Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ +// RCS-ID: $Id: statusbr.cpp 57542 2008-12-25 13:03:24Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -23,14 +23,11 @@ #ifndef WX_PRECOMP #include "wx/settings.h" #include "wx/dcclient.h" - #include "wx/toplevel.h" - #include "wx/control.h" #endif #ifdef __WXGTK20__ #include - #include "wx/gtk/private.h" - #include "wx/gtk/private/gtk2-compat.h" + #include "wx/gtk/win_gtk.h" #endif // we only have to do it here when we use wxStatusBarGeneric in addition to the @@ -44,60 +41,16 @@ IMPLEMENT_DYNAMIC_CLASS(wxStatusBarGeneric, wxWindow) #endif // wxUSE_NATIVE_STATUSBAR -// Default status border dimensions -#define wxTHICK_LINE_BORDER 2 - -// Margin between the field text and the field rect -#define wxFIELD_TEXT_MARGIN 2 - -// ---------------------------------------------------------------------------- -// GTK+ signal handler -// ---------------------------------------------------------------------------- - -#if defined( __WXGTK20__ ) -#if GTK_CHECK_VERSION(2,12,0) -extern "C" { -static -gboolean statusbar_query_tooltip(GtkWidget* WXUNUSED(widget), - gint x, - gint y, - gboolean WXUNUSED(keyboard_mode), - GtkTooltip *tooltip, - wxStatusBar* statbar) -{ - int n = statbar->GetFieldFromPoint(wxPoint(x,y)); - if (n == wxNOT_FOUND) - return FALSE; - - // should we show the tooltip for the n-th pane of the statusbar? - if (!statbar->GetField(n).IsEllipsized()) - return FALSE; // no, it's not useful - - const wxString& str = statbar->GetStatusText(n); - if (str.empty()) - return FALSE; - - gtk_tooltip_set_text(tooltip, wxGTK_CONV_SYS(str)); - return TRUE; -} -} -#endif -#endif - -// ---------------------------------------------------------------------------- -// wxStatusBarGeneric -// ---------------------------------------------------------------------------- - BEGIN_EVENT_TABLE(wxStatusBarGeneric, wxWindow) EVT_PAINT(wxStatusBarGeneric::OnPaint) - EVT_SIZE(wxStatusBarGeneric::OnSize) -#ifdef __WXGTK20__ EVT_LEFT_DOWN(wxStatusBarGeneric::OnLeftDown) EVT_RIGHT_DOWN(wxStatusBarGeneric::OnRightDown) -#endif EVT_SYS_COLOUR_CHANGED(wxStatusBarGeneric::OnSysColourChanged) END_EVENT_TABLE() +// Default status border dimensions +#define wxTHICK_LINE_BORDER 2 + void wxStatusBarGeneric::Init() { m_borderX = wxTHICK_LINE_BORDER; @@ -128,179 +81,218 @@ bool wxStatusBarGeneric::Create(wxWindow *parent, SetFont(*wxSMALL_FONT); #endif - int height = (int)((11*GetCharHeight())/10 + 2*GetBorderY()); + wxCoord y; + { + // Set the height according to the font and the border size + wxClientDC dc(this); + dc.SetFont(GetFont()); + + dc.GetTextExtent(_T("X"), NULL, &y ); + } + int height = (int)( (11*y)/10 + 2*GetBorderY()); + SetSize(wxDefaultCoord, wxDefaultCoord, wxDefaultCoord, height); SetFieldsCount(1); -#if defined( __WXGTK20__ ) -#if GTK_CHECK_VERSION(2,12,0) - if (HasFlag(wxSTB_SHOW_TIPS) -#ifndef __WXGTK3__ - && gtk_check_version(2,12,0) == NULL -#endif - ) - { - g_object_set(m_widget, "has-tooltip", TRUE, NULL); - g_signal_connect(m_widget, "query-tooltip", - G_CALLBACK(statusbar_query_tooltip), this); - } -#endif -#endif - return true; } + wxSize wxStatusBarGeneric::DoGetBestSize() const { int width, height; // best width is the width of the parent - if (GetParent()) - GetParent()->GetClientSize(&width, NULL); - else - width = 80; // a dummy value + GetParent()->GetClientSize(&width, NULL); - // best height is as calculated above in Create() - height = (int)((11*GetCharHeight())/10 + 2*GetBorderY()); + // best height is as calculated above in Create + wxClientDC dc((wxWindow*)this); + dc.SetFont(GetFont()); + wxCoord y; + dc.GetTextExtent(_T("X"), NULL, &y ); + height = (int)( (11*y)/10 + 2*GetBorderY()); return wxSize(width, height); } -void wxStatusBarGeneric::DoUpdateStatusText(int number) +void wxStatusBarGeneric::SetFieldsCount(int number, const int *widths) { - wxRect rect; - GetFieldRect(number, rect); + wxASSERT_MSG( number >= 0, _T("negative number of fields in wxStatusBar?") ); - Refresh(true, &rect); + int i; + for(i = m_nFields; i < number; ++i) + m_statusStrings.Add( wxEmptyString ); - // it's common to show some text in the status bar before starting a - // relatively lengthy operation, ensure that the text is shown to the - // user immediately and not after the lengthy operation end - Update(); + for (i = m_nFields - 1; i >= number; --i) + m_statusStrings.RemoveAt(i); + + // forget the old cached pixel widths + m_widthsAbs.Empty(); + + wxStatusBarBase::SetFieldsCount(number, widths); + + wxASSERT_MSG( m_nFields == (int)m_statusStrings.GetCount(), + _T("This really should never happen, can we do away with m_nFields here?") ); +} + +void wxStatusBarGeneric::SetStatusText(const wxString& text, int number) +{ + wxCHECK_RET( (number >= 0) && (number < m_nFields), + _T("invalid status bar field index") ); + + wxString oldText = m_statusStrings[number]; + if (oldText != text) + { + m_statusStrings[number] = text; + + wxRect rect; + GetFieldRect(number, rect); + + Refresh(true, &rect); + + // it's common to show some text in the status bar before starting a + // relatively lengthy operation, ensure that the text is shown to the + // user immediately and not after the lengthy operation end + Update(); + } +} + +wxString wxStatusBarGeneric::GetStatusText(int n) const +{ + wxCHECK_MSG( (n >= 0) && (n < m_nFields), wxEmptyString, + _T("invalid status bar field index") ); + + return m_statusStrings[n]; } void wxStatusBarGeneric::SetStatusWidths(int n, const int widths_field[]) { - // only set status widths when n == number of statuswindows - wxCHECK_RET( (size_t)n == m_panes.GetCount(), wxT("status bar field count mismatch") ); + // only set status widths, when n == number of statuswindows + wxCHECK_RET( n == m_nFields, _T("status bar field count mismatch") ); + + // delete the old widths in any case - this function may be used to reset + // the widths to the default (all equal) + // MBN: this is incompatible with at least wxMSW and wxMAC and not + // documented, but let's keep it for now + ReinitWidths(); + + // forget the old cached pixel widths + m_widthsAbs.Empty(); + + if ( !widths_field ) + { + // not an error, see the comment above + Refresh(); + return; + } wxStatusBarBase::SetStatusWidths(n, widths_field); - - // update cache - DoUpdateFieldWidths(); } -void wxStatusBarGeneric::DoUpdateFieldWidths() +void wxStatusBarGeneric::OnPaint(wxPaintEvent& WXUNUSED(event) ) { - m_lastClientSize = GetClientSize(); + wxPaintDC dc(this); - // recompute the cache of the field widths if the status bar width has changed - m_widthsAbs = CalculateAbsWidths(m_lastClientSize.x); -} - -bool wxStatusBarGeneric::ShowsSizeGrip() const -{ - if ( !HasFlag(wxSTB_SIZEGRIP) ) - return false; - - wxTopLevelWindow * const - tlw = wxDynamicCast(wxGetTopLevelParent(GetParent()), wxTopLevelWindow); - return tlw && !tlw->IsMaximized() && tlw->HasFlag(wxRESIZE_BORDER); -} - -void wxStatusBarGeneric::DrawFieldText(wxDC& dc, const wxRect& rect, int i, int textHeight) -{ - wxString text(GetStatusText(i)); - if (text.empty()) - return; // optimization - - int xpos = rect.x + wxFIELD_TEXT_MARGIN, - maxWidth = rect.width - 2*wxFIELD_TEXT_MARGIN, - ypos = (int) (((rect.height - textHeight) / 2) + rect.y + 0.5); - - if (ShowsSizeGrip()) + dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT)); +#ifdef __WXGTK20__ + // Draw grip first + if (HasFlag( wxST_SIZEGRIP )) { - // don't write text over the size grip: - // NOTE: overloading DoGetClientSize() and GetClientAreaOrigin() wouldn't - // work because the adjustment needs to be done only when drawing - // the field text and not also when drawing the background, the - // size grip itself, etc - if ((GetLayoutDirection() == wxLayout_RightToLeft && i == 0) || - (GetLayoutDirection() != wxLayout_RightToLeft && - i == (int)m_panes.GetCount()-1)) + int width, height; + GetClientSize(&width, &height); + + if (GetLayoutDirection() == wxLayout_RightToLeft) { - const wxRect& gripRc = GetSizeGripRect(); - - // NOTE: we don't need any special treatment wrt to the layout direction - // since DrawText() will automatically adjust the origin of the - // text accordingly to the layout in use - - maxWidth -= gripRc.width; + gtk_paint_resize_grip( m_widget->style, + GTK_PIZZA(m_wxwindow)->bin_window, + (GtkStateType) GTK_WIDGET_STATE (m_widget), + NULL, + m_widget, + "statusbar", + GDK_WINDOW_EDGE_SOUTH_WEST, + 2, 2, height-2, height-4 ); + } + else + { + gtk_paint_resize_grip( m_widget->style, + GTK_PIZZA(m_wxwindow)->bin_window, + (GtkStateType) GTK_WIDGET_STATE (m_widget), + NULL, + m_widget, + "statusbar", + GDK_WINDOW_EDGE_SOUTH_EAST, + width-height-2, 2, height-2, height-4 ); } } +#endif - // eventually ellipsize the text so that it fits the field width + if (GetFont().Ok()) + dc.SetFont(GetFont()); - wxEllipsizeMode ellmode = (wxEllipsizeMode)-1; - if (HasFlag(wxSTB_ELLIPSIZE_START)) ellmode = wxELLIPSIZE_START; - else if (HasFlag(wxSTB_ELLIPSIZE_MIDDLE)) ellmode = wxELLIPSIZE_MIDDLE; - else if (HasFlag(wxSTB_ELLIPSIZE_END)) ellmode = wxELLIPSIZE_END; + dc.SetBackgroundMode(wxTRANSPARENT); - if (ellmode == (wxEllipsizeMode)-1) - { - // if we have the wxSTB_SHOW_TIPS we must set the ellipsized flag even if - // we don't ellipsize the text but just truncate it - if (HasFlag(wxSTB_SHOW_TIPS)) - SetEllipsizedFlag(i, dc.GetTextExtent(text).GetWidth() > maxWidth); +#ifdef __WXPM__ + wxColour vColor; - dc.SetClippingRegion(rect); - } - else - { - text = wxControl::Ellipsize(text, dc, - ellmode, - maxWidth, - wxELLIPSIZE_FLAGS_EXPAND_TABS); - // Ellipsize() will do something only if necessary + vColor = wxSystemSettings::GetColour(wxSYS_COLOUR_MENUBAR); + ::WinFillRect(dc.m_hPS, &dc.m_vRclPaint, vColor.GetPixel()); +#endif - // update the ellipsization status for this pane; this is used later to - // decide whether a tooltip should be shown or not for this pane - // (if we have wxSTB_SHOW_TIPS) - SetEllipsizedFlag(i, text != GetStatusText(i)); - } + for (int i = 0; i < m_nFields; i ++) + DrawField(dc, i); +} + +void wxStatusBarGeneric::DrawFieldText(wxDC& dc, int i) +{ + int leftMargin = 2; + + wxRect rect; + GetFieldRect(i, rect); + + wxString text(GetStatusText(i)); + + long x = 0, y = 0; + + dc.GetTextExtent(text, &x, &y); + + int xpos = rect.x + leftMargin; + int ypos = (int) (((rect.height - y) / 2 ) + rect.y + 0.5) ; #if defined( __WXGTK__ ) || defined(__WXMAC__) xpos++; ypos++; #endif - // draw the text + dc.SetClippingRegion(rect.x, rect.y, rect.width, rect.height); + dc.DrawText(text, xpos, ypos); - if (ellmode == (wxEllipsizeMode)-1) - dc.DestroyClippingRegion(); + dc.DestroyClippingRegion(); } -void wxStatusBarGeneric::DrawField(wxDC& dc, int i, int textHeight) +void wxStatusBarGeneric::DrawField(wxDC& dc, int i) { wxRect rect; GetFieldRect(i, rect); - if (rect.GetWidth() <= 0) - return; // happens when the status bar is shrunk in a very small area! + int style = wxSB_NORMAL; + if (m_statusStyles) + style = m_statusStyles[i]; - int style = m_panes[i].GetStyle(); if (style != wxSB_FLAT) { // Draw border - // For wxSB_NORMAL: paint a grey background, plus 3-d border (one black rectangle) - // Inside this, left and top sides (dark grey). Bottom and right (white). + // For wxSB_NORMAL: + // Have grey background, plus 3-d border - + // One black rectangle. + // Inside this, left and top sides - dark grey. Bottom and right - + // white. // Reverse it for wxSB_RAISED dc.SetPen((style == wxSB_RAISED) ? m_mediumShadowPen : m_hilightPen); -#ifndef __WXPM__ + #ifndef __WXPM__ // Right and bottom lines dc.DrawLine(rect.x + rect.width, rect.y, @@ -315,7 +307,7 @@ void wxStatusBarGeneric::DrawField(wxDC& dc, int i, int textHeight) rect.x, rect.y); dc.DrawLine(rect.x, rect.y, rect.x + rect.width, rect.y); -#else + #else dc.DrawLine(rect.x + rect.width, rect.height + 2, rect.x, rect.height + 2); @@ -326,70 +318,59 @@ void wxStatusBarGeneric::DrawField(wxDC& dc, int i, int textHeight) dc.DrawLine(rect.x, rect.y, rect.x + rect.width, rect.y); dc.DrawLine(rect.x, rect.y + rect.height, - rect.x, rect.y); + rect.x, rect.y); + #endif } - DrawFieldText(dc, rect, i, textHeight); + DrawFieldText(dc, i); } + // Get the position and size of the field's internal bounding rectangle bool wxStatusBarGeneric::GetFieldRect(int n, wxRect& rect) const { - wxCHECK_MSG( (n >= 0) && ((size_t)n < m_panes.GetCount()), false, - wxT("invalid status bar field index") ); + wxCHECK_MSG( (n >= 0) && (n < m_nFields), false, + _T("invalid status bar field index") ); - // We can be called from the user-defined EVT_SIZE handler in which case - // the widths haven't been updated yet and we need to do it now. This is - // not very efficient as we keep testing the size but there is no other way - // to make the code needing the up-to-date fields sizes in its EVT_SIZE to - // work. - if ( GetClientSize().x != m_lastClientSize.x ) + // FIXME: workarounds for OS/2 bugs have nothing to do here (VZ) + int width, height; +#ifdef __WXPM__ + GetSize(&width, &height); +#else + GetClientSize(&width, &height); +#endif + + // we cache m_widthsAbs between calls and recompute it if client + // width has changed (or when it is initially empty) + if ( m_widthsAbs.IsEmpty() || (m_lastClientWidth != width) ) { - const_cast(this)->DoUpdateFieldWidths(); + wxConstCast(this, wxStatusBarGeneric)-> + m_widthsAbs = CalculateAbsWidths(width); + // remember last width for which we have recomputed the widths in pixels + wxConstCast(this, wxStatusBarGeneric)-> + m_lastClientWidth = width; } - if (m_widthsAbs.IsEmpty()) - return false; - rect.x = 0; for ( int i = 0; i < n; i++ ) + { rect.x += m_widthsAbs[i]; - rect.x += m_borderX; + } + rect.x += m_borderX; rect.y = m_borderY; + rect.width = m_widthsAbs[n] - 2*m_borderX; - rect.height = m_lastClientSize.y - 2*m_borderY; + rect.height = height - 2*m_borderY; return true; } -int wxStatusBarGeneric::GetFieldFromPoint(const wxPoint& pt) const -{ - if (m_widthsAbs.IsEmpty()) - return wxNOT_FOUND; - - // NOTE: we explicitly don't take in count the borders since they are only - // useful when rendering the status text, not for hit-test computations - - if (pt.y <= 0 || pt.y >= m_lastClientSize.y) - return wxNOT_FOUND; - - int x = 0; - for ( size_t i = 0; i < m_panes.GetCount(); i++ ) - { - if (pt.x > x && pt.x < x+m_widthsAbs[i]) - return i; - - x += m_widthsAbs[i]; - } - - return wxNOT_FOUND; -} - +// Initialize colours void wxStatusBarGeneric::InitColours() { #if defined(__WXPM__) - m_mediumShadowPen = wxPen(wxColour(127, 127, 127)); + m_mediumShadowPen = wxPen(wxColour(127, 127, 127), 1, wxSOLID); m_hilightPen = *wxWHITE_PEN; SetBackgroundColour(*wxLIGHT_GREY); @@ -400,83 +381,7 @@ void wxStatusBarGeneric::InitColours() #endif // __WXPM__/!__WXPM__ } -void wxStatusBarGeneric::SetMinHeight(int height) -{ - // check that this min height is not less than minimal height for the - // current font (min height is as calculated above in Create() except for border) - int minHeight = (int)((11*GetCharHeight())/10); - - if ( height > minHeight ) - SetSize(wxDefaultCoord, wxDefaultCoord, wxDefaultCoord, height + 2*m_borderY); -} - -wxRect wxStatusBarGeneric::GetSizeGripRect() const -{ - int width, height; - wxWindow::DoGetClientSize(&width, &height); - - if (GetLayoutDirection() == wxLayout_RightToLeft) - return wxRect(2, 2, height-2, height-4); - else - return wxRect(width-height-2, 2, height-2, height-4); -} - -// ---------------------------------------------------------------------------- -// wxStatusBarGeneric - event handlers -// ---------------------------------------------------------------------------- - -void wxStatusBarGeneric::OnPaint(wxPaintEvent& WXUNUSED(event) ) -{ - wxPaintDC dc(this); - -#ifdef __WXGTK20__ - // Draw grip first - if ( ShowsSizeGrip() ) - { - const wxRect& rc = GetSizeGripRect(); -#ifdef __WXGTK3__ - GtkWidget* toplevel = gtk_widget_get_toplevel(m_widget); - if (toplevel && !gtk_window_get_has_resize_grip(GTK_WINDOW(toplevel))) - { - GtkStyleContext* sc = gtk_widget_get_style_context(toplevel); - gtk_style_context_save(sc); - gtk_style_context_add_class(sc, GTK_STYLE_CLASS_GRIP); - GtkJunctionSides sides = GTK_JUNCTION_CORNER_BOTTOMRIGHT; - if (GetLayoutDirection() == wxLayout_RightToLeft) - sides = GTK_JUNCTION_CORNER_BOTTOMLEFT; - gtk_style_context_set_junction_sides(sc, sides); - gtk_render_handle(sc, - static_cast(dc.GetImpl()->GetCairoContext()), - rc.x, rc.y, rc.width, rc.height); - gtk_style_context_restore(sc); - } -#else - GdkWindowEdge edge = - GetLayoutDirection() == wxLayout_RightToLeft ? GDK_WINDOW_EDGE_SOUTH_WEST : - GDK_WINDOW_EDGE_SOUTH_EAST; - gtk_paint_resize_grip(gtk_widget_get_style(m_widget), - GTKGetDrawingWindow(), - gtk_widget_get_state(m_widget), - NULL, - m_widget, - "statusbar", - edge, - rc.x, rc.y, rc.width, rc.height ); -#endif - } -#endif // __WXGTK20__ - - if (GetFont().IsOk()) - dc.SetFont(GetFont()); - - // compute char height only once for all panes: - int textHeight = dc.GetCharHeight(); - - dc.SetBackgroundMode(wxBRUSHSTYLE_TRANSPARENT); - for (size_t i = 0; i < m_panes.GetCount(); i ++) - DrawField(dc, i, textHeight); -} - +// Responds to colour changes, and passes event on to children. void wxStatusBarGeneric::OnSysColourChanged(wxSysColourChangedEvent& event) { InitColours(); @@ -485,21 +390,34 @@ void wxStatusBarGeneric::OnSysColourChanged(wxSysColourChangedEvent& event) wxWindow::OnSysColourChanged(event); } -#ifdef __WXGTK20__ +void wxStatusBarGeneric::SetMinHeight(int height) +{ + // check that this min height is not less than minimal height for the + // current font + wxClientDC dc(this); + wxCoord y; + dc.GetTextExtent( wxT("X"), NULL, &y ); + + if ( height > (11*y)/10 ) + { + SetSize(wxDefaultCoord, wxDefaultCoord, wxDefaultCoord, height + 2*m_borderY); + } +} + void wxStatusBarGeneric::OnLeftDown(wxMouseEvent& event) { +#ifdef __WXGTK20__ int width, height; GetClientSize(&width, &height); - GtkWidget* ancestor = gtk_widget_get_toplevel(m_widget); -#ifdef __WXGTK3__ - if (ancestor && gtk_window_get_has_resize_grip(GTK_WINDOW(ancestor))) - ancestor = NULL; -#endif - - if (ancestor && ShowsSizeGrip() && event.GetX() > width - height) + if (HasFlag( wxST_SIZEGRIP ) && (event.GetX() > width-height)) { - GdkWindow *source = GTKGetDrawingWindow(); + GtkWidget *ancestor = gtk_widget_get_toplevel( m_widget ); + + if (!GTK_IS_WINDOW (ancestor)) + return; + + GdkWindow *source = GTK_PIZZA(m_wxwindow)->bin_window; int org_x = 0; int org_y = 0; @@ -528,22 +446,25 @@ void wxStatusBarGeneric::OnLeftDown(wxMouseEvent& event) { event.Skip( true ); } +#else + event.Skip( true ); +#endif } void wxStatusBarGeneric::OnRightDown(wxMouseEvent& event) { +#ifdef __WXGTK20__ int width, height; GetClientSize(&width, &height); - GtkWidget* ancestor = gtk_widget_get_toplevel(m_widget); -#ifdef __WXGTK3__ - if (ancestor && gtk_window_get_has_resize_grip(GTK_WINDOW(ancestor))) - ancestor = NULL; -#endif - - if (ancestor && ShowsSizeGrip() && event.GetX() > width - height) + if (HasFlag( wxST_SIZEGRIP ) && (event.GetX() > width-height)) { - GdkWindow *source = GTKGetDrawingWindow(); + GtkWidget *ancestor = gtk_widget_get_toplevel( m_widget ); + + if (!GTK_IS_WINDOW (ancestor)) + return; + + GdkWindow *source = GTK_PIZZA(m_wxwindow)->bin_window; int org_x = 0; int org_y = 0; @@ -559,14 +480,9 @@ void wxStatusBarGeneric::OnRightDown(wxMouseEvent& event) { event.Skip( true ); } -} -#endif // __WXGTK20__ - -void wxStatusBarGeneric::OnSize(wxSizeEvent& event) -{ - DoUpdateFieldWidths(); - - event.Skip(); +#else + event.Skip( true ); +#endif } #endif // wxUSE_STATUSBAR diff --git a/Source/3rd Party/wx/src/generic/textdlgg.cpp b/Source/3rd Party/wx/src/generic/textdlgg.cpp index ce3e1173d..f1c8aa64b 100644 --- a/Source/3rd Party/wx/src/generic/textdlgg.cpp +++ b/Source/3rd Party/wx/src/generic/textdlgg.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 04/01/98 -// RCS-ID: $Id$ +// RCS-ID: $Id: textdlgg.cpp 41838 2006-10-09 21:08:45Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -42,8 +42,8 @@ #include "wx/statline.h" #endif -const char wxGetTextFromUserPromptStr[] = "Input Text"; -const char wxGetPasswordFromUserPromptStr[] = "Enter Password"; +const wxChar wxGetTextFromUserPromptStr[] = wxT("Input Text"); +const wxChar wxGetPasswordFromUserPromptStr[] = wxT("Enter Password"); // ---------------------------------------------------------------------------- // constants @@ -71,8 +71,7 @@ wxTextEntryDialog::wxTextEntryDialog(wxWindow *parent, const wxString& value, long style, const wxPoint& pos) - : wxDialog(GetParentForModalDialog(parent, style), - wxID_ANY, caption, pos, wxDefaultSize, + : wxDialog(parent, wxID_ANY, caption, pos, wxDefaultSize, wxDEFAULT_DIALOG_STYLE), m_value(value) { @@ -107,7 +106,7 @@ wxTextEntryDialog::wxTextEntryDialog(wxWindow *parent, #endif // wxUSE_VALIDATORS // 3) buttons if any - wxSizer *buttonSizer = CreateSeparatedButtonSizer(style & (wxOK | wxCANCEL)); + wxSizer *buttonSizer = CreateSeparatedButtonSizer(style & ButtonSizerFlags); if ( buttonSizer ) { topsizer->Add(buttonSizer, wxSizerFlags(flagsBorder2).Expand()); @@ -151,15 +150,7 @@ void wxTextEntryDialog::SetValue(const wxString& val) } #if wxUSE_VALIDATORS - -#if WXWIN_COMPATIBILITY_2_8 void wxTextEntryDialog::SetTextValidator( long style ) -{ - SetTextValidator((wxTextValidatorStyle)style); -} -#endif - -void wxTextEntryDialog::SetTextValidator( wxTextValidatorStyle style ) { wxTextValidator validator( style, &m_value ); m_textctrl->SetValidator( validator ); diff --git a/Source/3rd Party/wx/src/generic/timer.cpp b/Source/3rd Party/wx/src/generic/timer.cpp index 364419f9e..1fad2018b 100644 --- a/Source/3rd Party/wx/src/generic/timer.cpp +++ b/Source/3rd Party/wx/src/generic/timer.cpp @@ -2,7 +2,7 @@ // Name: src/generic/timer.cpp // Purpose: wxTimer implementation // Author: Vaclav Slavik -// Id: $Id$ +// Id: $Id: timer.cpp 40943 2006-08-31 19:31:43Z ABX $ // Copyright: (c) Vaclav Slavik // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -22,34 +22,69 @@ #if wxUSE_TIMER +#include "wx/timer.h" + #ifndef WX_PRECOMP #include "wx/log.h" #include "wx/module.h" #endif -#include "wx/apptrait.h" -#include "wx/generic/private/timer.h" - // ---------------------------------------------------------------------------- // Time input function // ---------------------------------------------------------------------------- -#define GetMillisecondsTime wxGetLocalTimeMillis +#ifdef __WXMGL__ + // We take advantage of wxMGL's _EVT_getTicks because it is faster + // (especially under MS-DOS!) and more precise than wxGetLocalTimeMillis + // if we are unlucky and the latter combines information from two sources. + #include "wx/mgl/private.h" + extern "C" ulong _EVT_getTicks(); + #define GetMillisecondsTime _EVT_getTicks -typedef wxLongLong wxTimerTick_t; + typedef ulong wxTimerTick_t; -#if wxUSE_LONGLONG_WX - #define wxTimerTickFmtSpec wxLongLongFmtSpec "d" - #define wxTimerTickPrintfArg(tt) (tt.GetValue()) -#else // using native wxLongLong - #define wxTimerTickFmtSpec wxT("s") - #define wxTimerTickPrintfArg(tt) (tt.ToString().c_str()) -#endif // wx/native long long + #define wxTimerTickFmtSpec _T("lu") + #define wxTimerTickPrintfArg(tt) (tt) -inline bool wxTickGreaterEqual(wxTimerTick_t x, wxTimerTick_t y) -{ - return x >= y; -} + #ifdef __DOS__ + // Under DOS the MGL timer has a 24hr period, so consider the 12 hours + // before y to be 'less' and the the 12 hours after 'greater' modulo + // 24 hours. + inline bool wxTickGreaterEqual(wxTimerTick_t x, wxTimerTick_t y) + { + // _EVT_getTicks wraps at 1573040 * 55 + const wxTimerTick_t modulus = 1573040 * 55; + return (2 * modulus + x - y) % modulus < modulus / 2; + } + #else + // If wxTimerTick_t is 32-bits then it'll wrap in around 50 days. So + // let the 25 days before y be 'less' and 25 days after be 'greater'. + inline bool wxTickGreaterEqual(wxTimerTick_t x, wxTimerTick_t y) + { + // This code assumes wxTimerTick_t is an unsigned type. + // Set half_modulus with top bit set and the rest zeros. + const wxTimerTick_t half_modulus = ~((~(wxTimerTick_t)0) >> 1); + return x - y < half_modulus; + } + #endif +#else // !__WXMGL__ + #define GetMillisecondsTime wxGetLocalTimeMillis + + typedef wxLongLong wxTimerTick_t; + + #if wxUSE_LONGLONG_WX + #define wxTimerTickFmtSpec wxLongLongFmtSpec _T("d") + #define wxTimerTickPrintfArg(tt) (tt.GetValue()) + #else // using native wxLongLong + #define wxTimerTickFmtSpec _T("s") + #define wxTimerTickPrintfArg(tt) (tt.ToString().c_str()) + #endif // wx/native long long + + inline bool wxTickGreaterEqual(wxTimerTick_t x, wxTimerTick_t y) + { + return x >= y; + } +#endif // __WXMGL__/!__WXMGL__ // ---------------------------------------------------------------------------- // helper structures and wxTimerScheduler @@ -58,15 +93,15 @@ inline bool wxTickGreaterEqual(wxTimerTick_t x, wxTimerTick_t y) class wxTimerDesc { public: - wxTimerDesc(wxGenericTimerImpl *t) : + wxTimerDesc(wxTimer *t) : timer(t), running(false), next(NULL), prev(NULL), shotTime(0), deleteFlag(NULL) {} - wxGenericTimerImpl *timer; - bool running; - wxTimerDesc *next, *prev; - wxTimerTick_t shotTime; - volatile bool *deleteFlag; // see comment in ~wxTimer + wxTimer *timer; + bool running; + wxTimerDesc *next, *prev; + wxTimerTick_t shotTime; + volatile bool *deleteFlag; // see comment in ~wxTimer }; class wxTimerScheduler @@ -172,16 +207,18 @@ void wxTimerScheduler::NotifyTimers() // wxTimer // ---------------------------------------------------------------------------- +IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxEvtHandler) + wxTimerScheduler *gs_scheduler = NULL; -void wxGenericTimerImpl::Init() +void wxTimer::Init() { if ( !gs_scheduler ) gs_scheduler = new wxTimerScheduler; m_desc = new wxTimerDesc(this); } -wxGenericTimerImpl::~wxGenericTimerImpl() +wxTimer::~wxTimer() { wxLogTrace( wxT("timer"), wxT("destroying timer %p..."), this); if ( IsRunning() ) @@ -198,31 +235,31 @@ wxGenericTimerImpl::~wxGenericTimerImpl() wxLogTrace( wxT("timer"), wxT(" ...done destroying timer %p..."), this); } -bool wxGenericTimerImpl::IsRunning() const +bool wxTimer::IsRunning() const { return m_desc->running; } -bool wxGenericTimerImpl::Start(int millisecs, bool oneShot) +bool wxTimer::Start(int millisecs, bool oneShot) { wxLogTrace( wxT("timer"), wxT("started timer %p: %i ms, oneshot=%i"), this, millisecs, oneShot); - if ( !wxTimerImpl::Start(millisecs, oneShot) ) - return false; + if ( !wxTimerBase::Start(millisecs, oneShot) ) + return false; gs_scheduler->QueueTimer(m_desc); return true; } -void wxGenericTimerImpl::Stop() +void wxTimer::Stop() { if ( !m_desc->running ) return; gs_scheduler->RemoveTimer(m_desc); } -/*static*/ void wxGenericTimerImpl::NotifyTimers() +/*static*/ void wxTimer::NotifyTimers() { if ( gs_scheduler ) gs_scheduler->NotifyTimers(); @@ -237,19 +274,10 @@ DECLARE_DYNAMIC_CLASS(wxTimerModule) public: wxTimerModule() {} bool OnInit() { return true; } - void OnExit() { wxDELETE(gs_scheduler); } + void OnExit() { delete gs_scheduler; gs_scheduler = NULL; } }; IMPLEMENT_DYNAMIC_CLASS(wxTimerModule, wxModule) -// ---------------------------------------------------------------------------- -// wxGUIAppTraits -// ---------------------------------------------------------------------------- - -wxTimerImpl *wxGUIAppTraits::CreateTimerImpl(wxTimer *timer) -{ - return new wxGenericTimerImpl(timer); -} - #endif //wxUSE_TIMER diff --git a/Source/3rd Party/wx/src/generic/tipwin.cpp b/Source/3rd Party/wx/src/generic/tipwin.cpp index c93aa5ad8..0f2f2bb18 100644 --- a/Source/3rd Party/wx/src/generic/tipwin.cpp +++ b/Source/3rd Party/wx/src/generic/tipwin.cpp @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 10.09.00 -// RCS-ID: $Id$ +// RCS-ID: $Id: tipwin.cpp 43033 2006-11-04 13:31:10Z VZ $ // Copyright: (c) 2000 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -71,7 +71,7 @@ private: #endif // !wxUSE_POPUPWIN DECLARE_EVENT_TABLE() - wxDECLARE_NO_COPY_CLASS(wxTipWindowView); + DECLARE_NO_COPY_CLASS(wxTipWindowView) }; // ============================================================================ @@ -167,7 +167,7 @@ wxTipWindow::~wxTipWindow() { *m_windowPtr = NULL; } - #if wxUSE_POPUPWIN + #ifdef wxUSE_POPUPWIN #ifdef __WXGTK__ if ( m_view->HasCapture() ) m_view->ReleaseMouse(); @@ -267,7 +267,7 @@ void wxTipWindowView::Adjust(const wxString& text, wxCoord maxLength) bool breakLine = false; for ( const wxChar *p = text.c_str(); ; p++ ) { - if ( *p == wxT('\n') || *p == wxT('\0') ) + if ( *p == _T('\n') || *p == _T('\0') ) { dc.GetTextExtent(current, &width, &height); if ( width > widthMax ) @@ -287,7 +287,7 @@ void wxTipWindowView::Adjust(const wxString& text, wxCoord maxLength) current.clear(); breakLine = false; } - else if ( breakLine && (*p == wxT(' ') || *p == wxT('\t')) ) + else if ( breakLine && (*p == _T(' ') || *p == _T('\t')) ) { // word boundary - break the line here m_parent->m_textLines.Add(current); @@ -326,8 +326,8 @@ void wxTipWindowView::OnPaint(wxPaintEvent& WXUNUSED(event)) rect.height = size.y; // first filll the background - dc.SetBrush(wxBrush(GetBackgroundColour(), wxBRUSHSTYLE_SOLID)); - dc.SetPen(wxPen(GetForegroundColour(), 1, wxPENSTYLE_SOLID)); + dc.SetBrush(wxBrush(GetBackgroundColour(), wxSOLID)); + dc.SetPen( wxPen(GetForegroundColour(), 1, wxSOLID) ); dc.DrawRectangle(rect); // and then draw the text line by line diff --git a/Source/3rd Party/wx/src/generic/toolbkg.cpp b/Source/3rd Party/wx/src/generic/toolbkg.cpp index 4a425a4b4..fa3bbdf97 100644 --- a/Source/3rd Party/wx/src/generic/toolbkg.cpp +++ b/Source/3rd Party/wx/src/generic/toolbkg.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 2006-01-29 -// RCS-ID: $Id$ +// RCS-ID: $Id: toolbkg.cpp 44271 2007-01-21 00:52:05Z VZ $ // Copyright: (c) 2006 Julian Smart // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -44,9 +44,12 @@ // ---------------------------------------------------------------------------- IMPLEMENT_DYNAMIC_CLASS(wxToolbook, wxBookCtrlBase) +IMPLEMENT_DYNAMIC_CLASS(wxToolbookEvent, wxNotifyEvent) -wxDEFINE_EVENT( wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGING, wxBookCtrlEvent ); -wxDEFINE_EVENT( wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGED, wxBookCtrlEvent ); +#if !WXWIN_COMPATIBILITY_EVENT_TYPES +const wxEventType wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGING = wxNewEventType(); +const wxEventType wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGED = wxNewEventType(); +#endif BEGIN_EVENT_TABLE(wxToolbook, wxBookCtrlBase) EVT_SIZE(wxToolbook::OnSize) @@ -64,6 +67,7 @@ END_EVENT_TABLE() void wxToolbook::Init() { + m_selection = wxNOT_FOUND; m_needsRealizing = false; } @@ -85,19 +89,14 @@ bool wxToolbook::Create(wxWindow *parent, wxDefaultValidator, name) ) return false; - int tbFlags = wxTB_TEXT | wxTB_FLAT | wxBORDER_NONE; - if ( (style & (wxBK_LEFT | wxBK_RIGHT)) != 0 ) - tbFlags |= wxTB_VERTICAL; - else - tbFlags |= wxTB_HORIZONTAL; - - if ( style & wxTBK_HORZ_LAYOUT ) - tbFlags |= wxTB_HORZ_LAYOUT; + int orient = wxTB_HORIZONTAL; + if ( (style & (wxBK_LEFT | wxBK_RIGHT)) != 0) + orient = wxTB_VERTICAL; // TODO: make more configurable #if defined(__WXMAC__) && wxUSE_TOOLBAR && wxUSE_BMPBUTTON - if (style & wxTBK_BUTTONBAR) + if (style & wxBK_BUTTONBAR) { m_bookctrl = new wxButtonToolBar ( @@ -105,7 +104,7 @@ bool wxToolbook::Create(wxWindow *parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, - tbFlags + orient|wxTB_TEXT|wxTB_FLAT|wxNO_BORDER ); } else @@ -117,7 +116,7 @@ bool wxToolbook::Create(wxWindow *parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, - tbFlags | wxTB_NODIVIDER + orient|wxTB_TEXT|wxTB_FLAT|wxTB_NODIVIDER|wxNO_BORDER ); } @@ -128,6 +127,28 @@ bool wxToolbook::Create(wxWindow *parent, // wxToolbook geometry management // ---------------------------------------------------------------------------- +wxSize wxToolbook::GetControllerSize() const +{ + const wxSize sizeClient = GetClientSize(), + sizeBorder = m_bookctrl->GetSize() - m_bookctrl->GetClientSize(), + sizeToolBar = GetToolBar()->GetSize() + sizeBorder; + + wxSize size; + + if ( IsVertical() ) + { + size.x = sizeClient.x; + size.y = sizeToolBar.y; + } + else // left/right aligned + { + size.x = sizeToolBar.x; + size.y = sizeClient.y; + } + + return size; +} + void wxToolbook::OnSize(wxSizeEvent& event) { if (m_needsRealizing) @@ -136,6 +157,24 @@ void wxToolbook::OnSize(wxSizeEvent& event) wxBookCtrlBase::OnSize(event); } +wxSize wxToolbook::CalcSizeFromPage(const wxSize& sizePage) const +{ + // we need to add the size of the list control and the border between + const wxSize sizeToolBar = GetControllerSize(); + + wxSize size = sizePage; + if ( IsVertical() ) + { + size.y += sizeToolBar.y + GetInternalBorder(); + } + else // left/right aligned + { + size.x += sizeToolBar.x + GetInternalBorder(); + } + + return size; +} + // ---------------------------------------------------------------------------- // accessing the pages // ---------------------------------------------------------------------------- @@ -164,7 +203,7 @@ wxString wxToolbook::GetPageText(size_t n) const int wxToolbook::GetPageImage(size_t WXUNUSED(n)) const { - wxFAIL_MSG( wxT("wxToolbook::GetPageImage() not implemented") ); + wxFAIL_MSG( _T("wxToolbook::GetPageImage() not implemented") ); return wxNOT_FOUND; } @@ -200,12 +239,17 @@ void wxToolbook::SetImageList(wxImageList *imageList) // selection // ---------------------------------------------------------------------------- -wxBookCtrlEvent* wxToolbook::CreatePageChangingEvent() const +int wxToolbook::GetSelection() const { - return new wxBookCtrlEvent(wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGING, m_windowId); + return m_selection; } -void wxToolbook::MakeChangedEvent(wxBookCtrlEvent &event) +wxBookCtrlBaseEvent* wxToolbook::CreatePageChangingEvent() const +{ + return new wxToolbookEvent(wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGING, m_windowId); +} + +void wxToolbook::MakeChangedEvent(wxBookCtrlBaseEvent &event) { event.SetEventType(wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGED); } @@ -222,20 +266,23 @@ void wxToolbook::Realize() { if (m_needsRealizing) { - m_needsRealizing = false; - GetToolBar()->SetToolBitmapSize(m_maxBitmapSize); + int remap = wxSystemOptions::GetOptionInt(wxT("msw.remap")); + wxSystemOptions::SetOption(wxT("msw.remap"), 0); GetToolBar()->Realize(); + wxSystemOptions::SetOption(wxT("msw.remap"), remap); } - if (m_selection == wxNOT_FOUND) + m_needsRealizing = false; + + if (m_selection == -1) m_selection = 0; if (GetPageCount() > 0) { int sel = m_selection; - m_selection = wxNOT_FOUND; + m_selection = -1; SetSelection(sel); } @@ -346,7 +393,7 @@ wxWindow *wxToolbook::DoRemovePage(size_t page) int sel = m_selection - 1; if (page_count == 1) sel = wxNOT_FOUND; - else if ((page_count == 2) || (sel == wxNOT_FOUND)) + else if ((page_count == 2) || (sel == -1)) sel = 0; // force sel invalid if deleting current page - don't try to hide it diff --git a/Source/3rd Party/wx/src/generic/treebkg.cpp b/Source/3rd Party/wx/src/generic/treebkg.cpp index 99885de0c..23f09eccb 100644 --- a/Source/3rd Party/wx/src/generic/treebkg.cpp +++ b/Source/3rd Party/wx/src/generic/treebkg.cpp @@ -4,7 +4,7 @@ // Author: Evgeniy Tarassov, Vadim Zeitlin // Modified by: // Created: 2005-09-15 -// RCS-ID: $Id$ +// RCS-ID: $Id: treebkg.cpp 54645 2008-07-15 21:29:10Z JS $ // Copyright: (c) 2005 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -46,28 +46,37 @@ // ---------------------------------------------------------------------------- IMPLEMENT_DYNAMIC_CLASS(wxTreebook, wxBookCtrlBase) +IMPLEMENT_DYNAMIC_CLASS(wxTreebookEvent, wxNotifyEvent) -wxDEFINE_EVENT( wxEVT_COMMAND_TREEBOOK_PAGE_CHANGING, wxBookCtrlEvent ); -wxDEFINE_EVENT( wxEVT_COMMAND_TREEBOOK_PAGE_CHANGED, wxBookCtrlEvent ); -wxDEFINE_EVENT( wxEVT_COMMAND_TREEBOOK_NODE_COLLAPSED, wxBookCtrlEvent ); -wxDEFINE_EVENT( wxEVT_COMMAND_TREEBOOK_NODE_EXPANDED, wxBookCtrlEvent ); +#if !WXWIN_COMPATIBILITY_EVENT_TYPES +const wxEventType wxEVT_COMMAND_TREEBOOK_PAGE_CHANGING = wxNewEventType(); +const wxEventType wxEVT_COMMAND_TREEBOOK_PAGE_CHANGED = wxNewEventType(); +const wxEventType wxEVT_COMMAND_TREEBOOK_NODE_COLLAPSED = wxNewEventType(); +const wxEventType wxEVT_COMMAND_TREEBOOK_NODE_EXPANDED = wxNewEventType(); +#endif BEGIN_EVENT_TABLE(wxTreebook, wxBookCtrlBase) EVT_TREE_SEL_CHANGED (wxID_ANY, wxTreebook::OnTreeSelectionChange) EVT_TREE_ITEM_EXPANDED (wxID_ANY, wxTreebook::OnTreeNodeExpandedCollapsed) EVT_TREE_ITEM_COLLAPSED(wxID_ANY, wxTreebook::OnTreeNodeExpandedCollapsed) + + WX_EVENT_TABLE_CONTROL_CONTAINER(wxTreebook) END_EVENT_TABLE() // ============================================================================ // wxTreebook implementation // ============================================================================ +WX_DELEGATE_TO_CONTROL_CONTAINER(wxTreebook, wxControl) + // ---------------------------------------------------------------------------- // wxTreebook creation // ---------------------------------------------------------------------------- void wxTreebook::Init() { + m_container.SetContainerWindow(this); + m_selection = m_actualSelection = wxNOT_FOUND; } @@ -95,13 +104,18 @@ wxTreebook::Create(wxWindow *parent, style, wxDefaultValidator, name) ) return false; +#ifdef __WXMSW__ + long treeStyle = GetThemedBorderStyle(); +#else + long treeStyle = wxBORDER_SUNKEN; +#endif m_bookctrl = new wxTreeCtrl ( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, - wxBORDER_THEME | + treeStyle| wxTR_DEFAULT_STYLE | wxTR_HIDE_ROOT | wxTR_SINGLE @@ -217,7 +231,7 @@ bool wxTreebook::DoAddSubPage(wxWindow *page, const wxString& text, bool bSelect wxTreeItemId lastNodeId = tree->GetLastChild(rootId); wxCHECK_MSG( lastNodeId.IsOk(), false, - wxT("Can't insert sub page when there are no pages") ); + _T("Can't insert sub page when there are no pages") ); // now calculate its position (should we save/update it too?) size_t newPos = tree->GetCount() - @@ -556,6 +570,21 @@ bool wxTreebook::SetPageImage(size_t n, int imageId) return true; } +wxSize wxTreebook::CalcSizeFromPage(const wxSize& sizePage) const +{ + const wxSize sizeTree = GetControllerSize(); + + wxSize size = sizePage; + size.x += sizeTree.x; + + return size; +} + +int wxTreebook::GetSelection() const +{ + return m_selection; +} + int wxTreebook::DoSetSelection(size_t pagePos, int flags) { wxCHECK_MSG( IS_VALID_PAGE(pagePos), wxNOT_FOUND, @@ -563,7 +592,7 @@ int wxTreebook::DoSetSelection(size_t pagePos, int flags) wxASSERT_MSG( GetPageCount() == DoInternalGetPageCount(), wxT("wxTreebook logic error: m_treeIds and m_pages not in sync!")); - wxBookCtrlEvent event(wxEVT_COMMAND_TREEBOOK_PAGE_CHANGING, m_windowId); + wxTreebookEvent event(wxEVT_COMMAND_TREEBOOK_PAGE_CHANGING, m_windowId); const int oldSel = m_selection; wxTreeCtrl *tree = GetTreeCtrl(); bool allowed = false; @@ -701,7 +730,7 @@ void wxTreebook::OnTreeNodeExpandedCollapsed(wxTreeEvent & event) int pagePos = DoInternalFindPageById(nodeId); wxCHECK_RET( pagePos != wxNOT_FOUND, wxT("Internal problem in wxTreebook!..") ); - wxBookCtrlEvent ev(GetTreeCtrl()->IsExpanded(nodeId) + wxTreebookEvent ev(GetTreeCtrl()->IsExpanded(nodeId) ? wxEVT_COMMAND_TREEBOOK_NODE_EXPANDED : wxEVT_COMMAND_TREEBOOK_NODE_COLLAPSED, m_windowId); diff --git a/Source/3rd Party/wx/src/generic/treectlg.cpp b/Source/3rd Party/wx/src/generic/treectlg.cpp index ef7f551a0..e00ee5b1e 100644 --- a/Source/3rd Party/wx/src/generic/treectlg.cpp +++ b/Source/3rd Party/wx/src/generic/treectlg.cpp @@ -4,7 +4,7 @@ // Author: Robert Roebling // Created: 01/02/97 // Modified: 22/10/98 - almost total rewrite, simpler interface (VZ) -// Id: $Id$ +// Id: $Id: treectlg.cpp 67017 2011-02-25 09:37:28Z JS $ // Copyright: (c) 1998 Robert Roebling and Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -42,7 +42,7 @@ #include "wx/renderer.h" #ifdef __WXMAC__ - #include "wx/osx/private.h" + #include "wx/mac/private.h" #endif // ----------------------------------------------------------------------------- @@ -51,7 +51,7 @@ class WXDLLIMPEXP_FWD_CORE wxGenericTreeItem; -WX_DEFINE_ARRAY_PTR(wxGenericTreeItem *, wxArrayGenericTreeItems); +WX_DEFINE_EXPORTED_ARRAY_PTR(wxGenericTreeItem *, wxArrayGenericTreeItems); // ---------------------------------------------------------------------------- // constants @@ -61,9 +61,6 @@ static const int NO_IMAGE = -1; static const int PIXELS_PER_UNIT = 10; -// the margin between the item state image and the item normal image -static const int MARGIN_BETWEEN_STATE_AND_IMAGE = 2; - // the margin between the item image and the item text static const int MARGIN_BETWEEN_IMAGE_AND_TEXT = 4; @@ -77,7 +74,7 @@ class WXDLLEXPORT wxTreeRenameTimer: public wxTimer public: // start editing the current item after half a second (if the mouse hasn't // been clicked/moved) - enum { DELAY = 500 }; + enum { DELAY = 250 }; wxTreeRenameTimer( wxGenericTreeCtrl *owner ); @@ -86,7 +83,7 @@ public: private: wxGenericTreeCtrl *m_owner; - wxDECLARE_NO_COPY_CLASS(wxTreeRenameTimer); + DECLARE_NO_COPY_CLASS(wxTreeRenameTimer) }; // control used for in-place edit @@ -95,7 +92,7 @@ class WXDLLEXPORT wxTreeTextCtrl: public wxTextCtrl public: wxTreeTextCtrl(wxGenericTreeCtrl *owner, wxGenericTreeItem *item); - void EndEdit( bool discardChanges ); + void EndEdit(bool discardChanges); const wxGenericTreeItem* item() const { return m_itemEdited; } @@ -105,7 +102,7 @@ protected: void OnKillFocus( wxFocusEvent &event ); bool AcceptChanges(); - void Finish( bool setfocus ); + void Finish( bool setfocus = true ); private: wxGenericTreeCtrl *m_owner; @@ -114,7 +111,7 @@ private: bool m_aboutToFinish; DECLARE_EVENT_TABLE() - wxDECLARE_NO_COPY_CLASS(wxTreeTextCtrl); + DECLARE_NO_COPY_CLASS(wxTreeTextCtrl) }; // timer used to clear wxGenericTreeCtrl::m_findPrefix if no key was pressed @@ -132,7 +129,7 @@ public: private: wxGenericTreeCtrl *m_owner; - wxDECLARE_NO_COPY_CLASS(wxTreeFindTimer); + DECLARE_NO_COPY_CLASS(wxTreeFindTimer) }; // a tree item @@ -140,8 +137,7 @@ class WXDLLEXPORT wxGenericTreeItem { public: // ctors & dtor - wxGenericTreeItem() - { + wxGenericTreeItem() { m_data = NULL; m_widthText = m_heightText = -1; @@ -162,7 +158,6 @@ public: int GetImage(wxTreeItemIcon which = wxTreeItemIcon_Normal) const { return m_images[which]; } wxTreeItemData *GetData() const { return m_data; } - int GetState() const { return m_state; } // returns the current image for the item (depending on its // selected/expanded/whatever state) @@ -182,7 +177,6 @@ public: } void SetData(wxTreeItemData *data) { m_data = data; } - void SetState(int state) { m_state = state; m_width = 0; } void SetHasPlus(bool has = true) { m_hasPlus = has; } @@ -200,18 +194,18 @@ public: void SetY(int y) { m_y = y; } int GetHeight() const { return m_height; } - int GetWidth() const { return m_width; } + int GetWidth() const { return m_width; } int GetTextHeight() const { - wxASSERT_MSG( m_heightText != -1, "must call CalculateSize() first" ); + wxASSERT_MSG( m_heightText != -1, _T("must call CalculateSize() first") ); return m_heightText; } int GetTextWidth() const { - wxASSERT_MSG( m_widthText != -1, "must call CalculateSize() first" ); + wxASSERT_MSG( m_widthText != -1, _T("must call CalculateSize() first") ); return m_widthText; } @@ -261,9 +255,9 @@ public: void RecursiveResetSize(); void RecursiveResetTextSize(); - // return the item at given position (or NULL if no item), onButton is - // true if the point belongs to the item's button, otherwise it lies - // on the item's label + // return the item at given position (or NULL if no item), onButton is + // true if the point belongs to the item's button, otherwise it lies + // on the item's label wxGenericTreeItem *HitTest( const wxPoint& point, const wxGenericTreeCtrl *, int &flags, @@ -331,8 +325,6 @@ private: wxTreeItemData *m_data; // user-provided data - int m_state; // item state - wxArrayGenericTreeItems m_children; // list of children wxGenericTreeItem *m_parent; // parent of this item @@ -355,7 +347,7 @@ private: unsigned int m_isBold :1; // render the label in bold font unsigned int m_ownsAttr :1; // delete attribute when done - wxDECLARE_NO_COPY_CLASS(wxGenericTreeItem); + DECLARE_NO_COPY_CLASS(wxGenericTreeItem) }; // ============================================================================= @@ -381,8 +373,7 @@ static void EventFlagsToSelType(long style, } // check if the given item is under another one -static bool -IsDescendantOf(const wxGenericTreeItem *parent, const wxGenericTreeItem *item) +static bool IsDescendantOf(const wxGenericTreeItem *parent, const wxGenericTreeItem *item) { while ( item ) { @@ -429,32 +420,45 @@ wxTreeTextCtrl::wxTreeTextCtrl(wxGenericTreeCtrl *owner, m_owner = owner; m_aboutToFinish = false; - wxRect rect; - m_owner->GetBoundingRect(m_itemEdited, rect, true); + int w = m_itemEdited->GetWidth(), + h = m_itemEdited->GetHeight(); - // corrects position and size for better appearance -#ifdef __WXMSW__ - rect.x -= 5; - rect.width += 10; -#elif defined(__WXGTK__) - rect.x -= 5; - rect.y -= 2; - rect.width += 8; - rect.height += 4; -#elif defined(wxOSX_USE_CARBON) && wxOSX_USE_CARBON - int bestHeight = GetBestSize().y - 8; - if ( rect.height > bestHeight ) + int x, y; + m_owner->CalcScrolledPosition(item->GetX(), item->GetY(), &x, &y); + + int image_h = 0, + image_w = 0; + + int image = item->GetCurrentImage(); + if ( image != NO_IMAGE ) { - int diff = rect.height - bestHeight; - rect.height -= diff; - rect.y += diff / 2; + if ( m_owner->m_imageListNormal ) + { + m_owner->m_imageListNormal->GetSize( image, image_w, image_h ); + image_w += MARGIN_BETWEEN_IMAGE_AND_TEXT; + } + else + { + wxFAIL_MSG(_T("you must create an image list to use images!")); + } } -#endif // platforms + + // FIXME: what are all these hardcoded 4, 8 and 11s really? + x += image_w; + w -= image_w + 4; +#ifdef __WXMAC__ + wxSize bs = DoGetBestSize() ; + // edit control height + if ( h > bs.y - 8 ) + { + int diff = h - ( bs.y - 8 ) ; + h -= diff ; + y += diff / 2 ; + } +#endif (void)Create(m_owner, wxID_ANY, m_startValue, - rect.GetPosition(), rect.GetSize()); - - SetSelection(-1, -1); + wxPoint(x - 4, y - 4), wxSize(w + 11, h + 8)); } void wxTreeTextCtrl::EndEdit(bool discardChanges) @@ -465,7 +469,7 @@ void wxTreeTextCtrl::EndEdit(bool discardChanges) { m_owner->OnRenameCancelled(m_itemEdited); - Finish( true ); + Finish(); } else { @@ -473,7 +477,7 @@ void wxTreeTextCtrl::EndEdit(bool discardChanges) AcceptChanges(); // Even if vetoed, close the control (consistent with MSW) - Finish( true ); + Finish(); } } @@ -541,7 +545,7 @@ void wxTreeTextCtrl::OnKeyUp( wxKeyEvent &event ) wxPoint myPos = GetPosition(); wxSize mySize = GetSize(); int sx, sy; - GetTextExtent(GetValue() + wxT("M"), &sx, &sy); + GetTextExtent(GetValue() + _T("M"), &sx, &sy); if (myPos.x + sx > parentSize.x) sx = parentSize.x - myPos.x; if (mySize.x > sx) @@ -582,7 +586,6 @@ wxGenericTreeItem::wxGenericTreeItem(wxGenericTreeItem *parent, m_images[wxTreeItemIcon_SelectedExpanded] = NO_IMAGE; m_data = data; - m_state = wxTREE_ITEMSTATE_NONE; m_x = m_y = 0; m_isCollapsed = true; @@ -592,7 +595,7 @@ wxGenericTreeItem::wxGenericTreeItem(wxGenericTreeItem *parent, m_parent = parent; - m_attr = NULL; + m_attr = (wxTreeItemAttr *)NULL; m_ownsAttr = false; // We don't know the height here yet. @@ -610,12 +613,12 @@ wxGenericTreeItem::~wxGenericTreeItem() if (m_ownsAttr) delete m_attr; wxASSERT_MSG( m_children.IsEmpty(), - "must call DeleteChildren() before deleting the item" ); + wxT("please call DeleteChildren() before deleting the item") ); } void wxGenericTreeItem::DeleteChildren(wxGenericTreeCtrl *tree) { - size_t count = m_children.GetCount(); + size_t count = m_children.Count(); for ( size_t n = 0; n < count; n++ ) { wxGenericTreeItem *child = m_children[n]; @@ -632,7 +635,7 @@ void wxGenericTreeItem::DeleteChildren(wxGenericTreeCtrl *tree) size_t wxGenericTreeItem::GetChildrenCount(bool recursively) const { - size_t count = m_children.GetCount(); + size_t count = m_children.Count(); if ( !recursively ) return count; @@ -655,7 +658,7 @@ void wxGenericTreeItem::GetSize( int &x, int &y, if (IsExpanded()) { - size_t count = m_children.GetCount(); + size_t count = m_children.Count(); for ( size_t n = 0; n < count; ++n ) { m_children[n]->GetSize( x, y, theButton ); @@ -706,29 +709,10 @@ wxGenericTreeItem *wxGenericTreeItem::HitTest(const wxPoint& point, // assuming every image (normal and selected) has the same size! if ( (GetImage() != NO_IMAGE) && theCtrl->m_imageListNormal ) - { theCtrl->m_imageListNormal->GetSize(GetImage(), image_w, image_h); - } - int state_w = -1; - int state_h; - - if ( (GetState() != wxTREE_ITEMSTATE_NONE) && - theCtrl->m_imageListState ) - { - theCtrl->m_imageListState->GetSize(GetState(), - state_w, state_h); - } - - if ((state_w != -1) && (point.x <= m_x + state_w + 1)) - flags |= wxTREE_HITTEST_ONITEMSTATEICON; - else if ((image_w != -1) && - (point.x <= m_x + - (state_w != -1 ? state_w + - MARGIN_BETWEEN_STATE_AND_IMAGE - : 0) - + image_w + 1)) + if ((image_w != -1) && (point.x <= m_x + image_w + 1)) flags |= wxTREE_HITTEST_ONITEMICON; else flags |= wxTREE_HITTEST_ONITEMLABEL; @@ -745,11 +729,11 @@ wxGenericTreeItem *wxGenericTreeItem::HitTest(const wxPoint& point, } // if children are expanded, fall through to evaluate them - if (m_isCollapsed) return NULL; + if (m_isCollapsed) return (wxGenericTreeItem*) NULL; } // evaluate children - size_t count = m_children.GetCount(); + size_t count = m_children.Count(); for ( size_t n = 0; n < count; n++ ) { wxGenericTreeItem *res = m_children[n]->HitTest( point, @@ -760,7 +744,7 @@ wxGenericTreeItem *wxGenericTreeItem::HitTest(const wxPoint& point, return res; } - return NULL; + return (wxGenericTreeItem*) NULL; } int wxGenericTreeItem::GetCurrentImage() const @@ -840,27 +824,19 @@ wxGenericTreeItem::DoCalculateSize(wxGenericTreeCtrl* control, int text_h = m_heightText + 2; - int image_h = 0, image_w = 0; + int image_h = 0; + int image_w = 0; int image = GetCurrentImage(); - if ( image != NO_IMAGE && control->m_imageListNormal ) + if ( image != NO_IMAGE ) { - control->m_imageListNormal->GetSize(image, image_w, image_h); - image_w += MARGIN_BETWEEN_IMAGE_AND_TEXT; + if ( control->m_imageListNormal ) + { + control->m_imageListNormal->GetSize( image, image_w, image_h ); + image_w += MARGIN_BETWEEN_IMAGE_AND_TEXT; + } } - int state_h = 0, state_w = 0; - int state = GetState(); - if ( state != wxTREE_ITEMSTATE_NONE && control->m_imageListState ) - { - control->m_imageListState->GetSize(state, state_w, state_h); - if ( image_w != 0 ) - state_w += MARGIN_BETWEEN_STATE_AND_IMAGE; - else - state_w += MARGIN_BETWEEN_IMAGE_AND_TEXT; - } - - int img_h = wxMax(state_h, image_h); - m_height = wxMax(img_h, text_h); + m_height = (image_h > text_h) ? image_h : text_h; if (m_height < 30) m_height += 2; // at least 2 pixels @@ -870,7 +846,7 @@ wxGenericTreeItem::DoCalculateSize(wxGenericTreeCtrl* control, if (m_height > control->m_lineHeight) control->m_lineHeight = m_height; - m_width = state_w + image_w + m_widthText + 2; + m_width = image_w + m_widthText + 2; } void wxGenericTreeItem::RecursiveResetSize() @@ -902,13 +878,21 @@ BEGIN_EVENT_TABLE(wxGenericTreeCtrl, wxTreeCtrlBase) EVT_PAINT (wxGenericTreeCtrl::OnPaint) EVT_SIZE (wxGenericTreeCtrl::OnSize) EVT_MOUSE_EVENTS (wxGenericTreeCtrl::OnMouse) - EVT_KEY_DOWN (wxGenericTreeCtrl::OnKeyDown) EVT_CHAR (wxGenericTreeCtrl::OnChar) EVT_SET_FOCUS (wxGenericTreeCtrl::OnSetFocus) EVT_KILL_FOCUS (wxGenericTreeCtrl::OnKillFocus) EVT_TREE_ITEM_GETTOOLTIP(wxID_ANY, wxGenericTreeCtrl::OnGetToolTip) END_EVENT_TABLE() +#if !defined(__WXMSW__) || defined(__WXUNIVERSAL__) +/* + * wxTreeCtrl has to be a real class or we have problems with + * the run-time information. + */ + +IMPLEMENT_DYNAMIC_CLASS(wxTreeCtrl, wxGenericTreeCtrl) +#endif + // ----------------------------------------------------------------------------- // construction/destruction // ----------------------------------------------------------------------------- @@ -918,7 +902,7 @@ void wxGenericTreeCtrl::Init() m_current = m_key_current = m_anchor = - m_select_me = NULL; + m_select_me = (wxGenericTreeItem *) NULL; m_hasFocus = false; m_dirty = false; @@ -932,7 +916,7 @@ void wxGenericTreeCtrl::Init() ( wxSYS_COLOUR_HIGHLIGHT ), - wxBRUSHSTYLE_SOLID + wxSOLID ); m_hilightUnfocusedBrush = new wxBrush @@ -941,7 +925,7 @@ void wxGenericTreeCtrl::Init() ( wxSYS_COLOUR_BTNSHADOW ), - wxBRUSHSTYLE_SOLID + wxSOLID ); m_imageListButtons = NULL; @@ -954,22 +938,26 @@ void wxGenericTreeCtrl::Init() m_textCtrl = NULL; m_renameTimer = NULL; + m_freezeCount = 0; m_findTimer = NULL; m_dropEffectAboveItem = false; - m_dndEffect = NoEffect; - m_dndEffectItem = NULL; - m_lastOnSame = false; -#if defined( __WXMAC__ ) - m_normalFont = wxFont(wxOSX_SYSTEM_FONT_VIEWS); +#ifdef __WXMAC_CARBON__ + m_normalFont.MacCreateThemeFont( kThemeViewsFont ) ; #else m_normalFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ); #endif - m_boldFont = m_normalFont.Bold(); + m_boldFont = wxFont(m_normalFont.GetPointSize(), + m_normalFont.GetFamily(), + m_normalFont.GetStyle(), + wxBOLD, + m_normalFont.GetUnderlined(), + m_normalFont.GetFaceName(), + m_normalFont.GetEncoding()); } bool wxGenericTreeCtrl::Create(wxWindow *parent, @@ -981,23 +969,24 @@ bool wxGenericTreeCtrl::Create(wxWindow *parent, const wxString& name ) { #ifdef __WXMAC__ - int major, minor; - wxGetOsVersion(&major, &minor); + int major,minor; + wxGetOsVersion( &major, &minor ); + style &= ~wxTR_LINES_AT_ROOT; + style |= wxTR_NO_LINES; if (major < 10) style |= wxTR_ROW_LINES; - if (style & wxTR_HAS_BUTTONS) - style |= wxTR_NO_LINES; -#endif // __WXMAC__ + if (style == 0 || style & wxTR_DEFAULT_STYLE) + style |= wxTR_FULL_ROW_HIGHLIGHT; +#endif // __WXMAC__ #ifdef __WXGTK20__ - if (style & wxTR_HAS_BUTTONS) - style |= wxTR_NO_LINES; + style |= wxTR_NO_LINES; #endif if ( !wxControl::Create( parent, id, pos, size, - style|wxHSCROLL|wxVSCROLL|wxWANTS_CHARS, + style|wxHSCROLL|wxVSCROLL, validator, name ) ) return false; @@ -1017,14 +1006,7 @@ bool wxGenericTreeCtrl::Create(wxWindow *parent, if (!m_hasFont) SetOwnFont(attr.font); - // this is a misnomer: it's called "dotted pen" but uses (default) wxSOLID - // style because we apparently get performance problems when using dotted - // pen for drawing in some ports -- but under MSW it seems to work fine -#ifdef __WXMSW__ - m_dottedPen = wxPen(*wxLIGHT_GREY, 0, wxPENSTYLE_DOT); -#else - m_dottedPen = *wxGREY_PEN; -#endif + m_dottedPen = wxPen( wxT("grey"), 0, 0 ); SetInitialSize(size); @@ -1126,14 +1108,6 @@ wxTreeItemData *wxGenericTreeCtrl::GetItemData(const wxTreeItemId& item) const return ((wxGenericTreeItem*) item.m_pItem)->GetData(); } -int wxGenericTreeCtrl::DoGetItemState(const wxTreeItemId& item) const -{ - wxCHECK_MSG( item.IsOk(), wxTREE_ITEMSTATE_NONE, wxT("invalid tree item") ); - - wxGenericTreeItem *pItem = (wxGenericTreeItem*) item.m_pItem; - return pItem->GetState(); -} - wxColour wxGenericTreeCtrl::GetItemTextColour(const wxTreeItemId& item) const { wxCHECK_MSG( item.IsOk(), wxNullColour, wxT("invalid tree item") ); @@ -1142,8 +1116,7 @@ wxColour wxGenericTreeCtrl::GetItemTextColour(const wxTreeItemId& item) const return pItem->Attr().GetTextColour(); } -wxColour -wxGenericTreeCtrl::GetItemBackgroundColour(const wxTreeItemId& item) const +wxColour wxGenericTreeCtrl::GetItemBackgroundColour(const wxTreeItemId& item) const { wxCHECK_MSG( item.IsOk(), wxNullColour, wxT("invalid tree item") ); @@ -1159,8 +1132,7 @@ wxFont wxGenericTreeCtrl::GetItemFont(const wxTreeItemId& item) const return pItem->Attr().GetFont(); } -void -wxGenericTreeCtrl::SetItemText(const wxTreeItemId& item, const wxString& text) +void wxGenericTreeCtrl::SetItemText(const wxTreeItemId& item, const wxString& text) { wxCHECK_RET( item.IsOk(), wxT("invalid tree item") ); @@ -1182,8 +1154,7 @@ void wxGenericTreeCtrl::SetItemImage(const wxTreeItemId& item, RefreshLine(pItem); } -void -wxGenericTreeCtrl::SetItemData(const wxTreeItemId& item, wxTreeItemData *data) +void wxGenericTreeCtrl::SetItemData(const wxTreeItemId& item, wxTreeItemData *data) { wxCHECK_RET( item.IsOk(), wxT("invalid tree item") ); @@ -1193,16 +1164,6 @@ wxGenericTreeCtrl::SetItemData(const wxTreeItemId& item, wxTreeItemData *data) ((wxGenericTreeItem*) item.m_pItem)->SetData(data); } -void wxGenericTreeCtrl::DoSetItemState(const wxTreeItemId& item, int state) -{ - wxCHECK_RET( item.IsOk(), wxT("invalid tree item") ); - - wxGenericTreeItem *pItem = (wxGenericTreeItem*) item.m_pItem; - pItem->SetState(state); - pItem->CalculateSize(this); - RefreshLine(pItem); -} - void wxGenericTreeCtrl::SetItemHasChildren(const wxTreeItemId& item, bool has) { wxCHECK_RET( item.IsOk(), wxT("invalid tree item") ); @@ -1225,7 +1186,6 @@ void wxGenericTreeCtrl::SetItemBold(const wxTreeItemId& item, bool bold) // recalculate the item size as bold and non bold fonts have different // widths pItem->CalculateSize(this); - RefreshLine(pItem); } } @@ -1268,8 +1228,7 @@ void wxGenericTreeCtrl::SetItemBackgroundColour(const wxTreeItemId& item, RefreshLine(pItem); } -void -wxGenericTreeCtrl::SetItemFont(const wxTreeItemId& item, const wxFont& font) +void wxGenericTreeCtrl::SetItemFont(const wxTreeItemId& item, const wxFont& font) { wxCHECK_RET( item.IsOk(), wxT("invalid tree item") ); @@ -1284,8 +1243,14 @@ bool wxGenericTreeCtrl::SetFont( const wxFont &font ) { wxTreeCtrlBase::SetFont(font); - m_normalFont = font; - m_boldFont = m_normalFont.Bold(); + m_normalFont = font ; + m_boldFont = wxFont(m_normalFont.GetPointSize(), + m_normalFont.GetFamily(), + m_normalFont.GetStyle(), + wxBOLD, + m_normalFont.GetUnderlined(), + m_normalFont.GetFaceName(), + m_normalFont.GetEncoding()); if (m_anchor) m_anchor->RecursiveResetTextSize(); @@ -1388,13 +1353,12 @@ wxTreeItemId wxGenericTreeCtrl::GetNextChild(const wxTreeItemId& item, { wxCHECK_MSG( item.IsOk(), wxTreeItemId(), wxT("invalid tree item") ); - wxArrayGenericTreeItems& - children = ((wxGenericTreeItem*) item.m_pItem)->GetChildren(); + wxArrayGenericTreeItems& children = ((wxGenericTreeItem*) item.m_pItem)->GetChildren(); // it's ok to cast cookie to size_t, we never have indices big enough to // overflow "void *" size_t *pIndex = (size_t *)&cookie; - if ( *pIndex < children.GetCount() ) + if ( *pIndex < children.Count() ) { return children.Item((*pIndex)++); } @@ -1405,13 +1369,42 @@ wxTreeItemId wxGenericTreeCtrl::GetNextChild(const wxTreeItemId& item, } } +#if WXWIN_COMPATIBILITY_2_4 + +wxTreeItemId wxGenericTreeCtrl::GetFirstChild(const wxTreeItemId& item, + long& cookie) const +{ + wxCHECK_MSG( item.IsOk(), wxTreeItemId(), wxT("invalid tree item") ); + + cookie = 0; + return GetNextChild(item, cookie); +} + +wxTreeItemId wxGenericTreeCtrl::GetNextChild(const wxTreeItemId& item, + long& cookie) const +{ + wxCHECK_MSG( item.IsOk(), wxTreeItemId(), wxT("invalid tree item") ); + + wxArrayGenericTreeItems& children = ((wxGenericTreeItem*) item.m_pItem)->GetChildren(); + if ( (size_t)cookie < children.Count() ) + { + return children.Item((size_t)cookie++); + } + else + { + // there are no more of them + return wxTreeItemId(); + } +} + +#endif // WXWIN_COMPATIBILITY_2_4 + wxTreeItemId wxGenericTreeCtrl::GetLastChild(const wxTreeItemId& item) const { wxCHECK_MSG( item.IsOk(), wxTreeItemId(), wxT("invalid tree item") ); - wxArrayGenericTreeItems& - children = ((wxGenericTreeItem*) item.m_pItem)->GetChildren(); - return children.IsEmpty() ? wxTreeItemId() : wxTreeItemId(children.Last()); + wxArrayGenericTreeItems& children = ((wxGenericTreeItem*) item.m_pItem)->GetChildren(); + return (children.IsEmpty() ? wxTreeItemId() : wxTreeItemId(children.Last())); } wxTreeItemId wxGenericTreeCtrl::GetNextSibling(const wxTreeItemId& item) const @@ -1431,8 +1424,7 @@ wxTreeItemId wxGenericTreeCtrl::GetNextSibling(const wxTreeItemId& item) const wxASSERT( index != wxNOT_FOUND ); // I'm not a child of my parent? size_t n = (size_t)(index + 1); - return n == siblings.GetCount() ? wxTreeItemId() - : wxTreeItemId(siblings[n]); + return n == siblings.Count() ? wxTreeItemId() : wxTreeItemId(siblings[n]); } wxTreeItemId wxGenericTreeCtrl::GetPrevSibling(const wxTreeItemId& item) const @@ -1484,16 +1476,16 @@ wxTreeItemId wxGenericTreeCtrl::GetNext(const wxTreeItemId& item) const wxTreeItemId wxGenericTreeCtrl::GetFirstVisibleItem() const { - wxTreeItemId itemid = GetRootItem(); - if (!itemid.IsOk()) - return itemid; + wxTreeItemId id = GetRootItem(); + if (!id.IsOk()) + return id; do { - if (IsVisible(itemid)) - return itemid; - itemid = GetNext(itemid); - } while (itemid.IsOk()); + if (IsVisible(id)) + return id; + id = GetNext(id); + } while (id.IsOk()); return wxTreeItemId(); } @@ -1501,7 +1493,6 @@ wxTreeItemId wxGenericTreeCtrl::GetFirstVisibleItem() const wxTreeItemId wxGenericTreeCtrl::GetNextVisible(const wxTreeItemId& item) const { wxCHECK_MSG( item.IsOk(), wxTreeItemId(), wxT("invalid tree item") ); - wxASSERT_MSG( IsVisible(item), wxT("this item itself should be visible") ); wxTreeItemId id = item; if (id.IsOk()) @@ -1518,37 +1509,10 @@ wxTreeItemId wxGenericTreeCtrl::GetNextVisible(const wxTreeItemId& item) const wxTreeItemId wxGenericTreeCtrl::GetPrevVisible(const wxTreeItemId& item) const { wxCHECK_MSG( item.IsOk(), wxTreeItemId(), wxT("invalid tree item") ); - wxASSERT_MSG( IsVisible(item), wxT("this item itself should be visible") ); - // find out the starting point - wxTreeItemId prevItem = GetPrevSibling(item); - if ( !prevItem.IsOk() ) - { - prevItem = GetItemParent(item); - } + wxFAIL_MSG(wxT("not implemented")); - // find the first visible item after it - while ( prevItem.IsOk() && !IsVisible(prevItem) ) - { - prevItem = GetNext(prevItem); - if ( !prevItem.IsOk() || prevItem == item ) - { - // there are no visible items before item - return wxTreeItemId(); - } - } - - // from there we must be able to navigate until this item - while ( prevItem.IsOk() ) - { - const wxTreeItemId nextItem = GetNextVisible(prevItem); - if ( !nextItem.IsOk() || nextItem == item ) - break; - - prevItem = nextItem; - } - - return prevItem; + return wxTreeItemId(); } // called by wxTextTreeCtrl when it marks itself for deletion @@ -1570,40 +1534,39 @@ wxTreeItemId wxGenericTreeCtrl::FindItem(const wxTreeItemId& idParent, // allows to switch between two items starting with the same letter just by // pressing it) but we shouldn't jump to the next one if the user is // continuing to type as otherwise he might easily skip the item he wanted - wxTreeItemId itemid = idParent; + wxTreeItemId id = idParent; if ( prefix.length() == 1 ) { - itemid = GetNext(itemid); + id = GetNext(id); } // look for the item starting with the given prefix after it - while ( itemid.IsOk() && !GetItemText(itemid).Lower().StartsWith(prefix) ) + while ( id.IsOk() && !GetItemText(id).Lower().StartsWith(prefix) ) { - itemid = GetNext(itemid); + id = GetNext(id); } // if we haven't found anything... - if ( !itemid.IsOk() ) + if ( !id.IsOk() ) { // ... wrap to the beginning - itemid = GetRootItem(); + id = GetRootItem(); if ( HasFlag(wxTR_HIDE_ROOT) ) { // can't select virtual root - itemid = GetNext(itemid); + id = GetNext(id); } // and try all the items (stop when we get to the one we started from) - while ( itemid.IsOk() && itemid != idParent && - !GetItemText(itemid).Lower().StartsWith(prefix) ) + while (id.IsOk() && id != idParent && !GetItemText(id).Lower().StartsWith(prefix) ) { - itemid = GetNext(itemid); + id = GetNext(id); } // If we haven't found the item, id.IsOk() will be false, as per // documentation } - return itemid; + return id; } // ----------------------------------------------------------------------------- @@ -1646,11 +1609,11 @@ wxTreeItemId wxGenericTreeCtrl::AddRoot(const wxString& text, int selImage, wxTreeItemData *data) { - wxCHECK_MSG( !m_anchor, wxTreeItemId(), "tree can have only one root" ); + wxCHECK_MSG( !m_anchor, wxTreeItemId(), wxT("tree can have only one root") ); m_dirty = true; // do this first so stuff below doesn't cause flicker - m_anchor = new wxGenericTreeItem(NULL, text, + m_anchor = new wxGenericTreeItem((wxGenericTreeItem *)NULL, text, image, selImage, data); if ( data != NULL ) { @@ -1663,8 +1626,8 @@ wxTreeItemId wxGenericTreeCtrl::AddRoot(const wxString& text, // into children m_anchor->SetHasPlus(); m_anchor->Expand(); - CalculatePositions(); } + CalculatePositions(); if (!HasFlag(wxTR_MULTIPLE)) { @@ -1692,11 +1655,9 @@ wxTreeItemId wxGenericTreeCtrl::DoInsertAfter(const wxTreeItemId& parentId, int index = -1; if (idPrevious.IsOk()) { - index = parent->GetChildren().Index( - (wxGenericTreeItem*) idPrevious.m_pItem); + index = parent->GetChildren().Index((wxGenericTreeItem*) idPrevious.m_pItem); wxASSERT_MSG( index != wxNOT_FOUND, - "previous item in wxGenericTreeCtrl::InsertItem() " - "is not a sibling" ); + wxT("previous item in wxGenericTreeCtrl::InsertItem() is not a sibling") ); } return DoInsertItem(parentId, (size_t)++index, text, image, selImage, data); @@ -1706,30 +1667,22 @@ wxTreeItemId wxGenericTreeCtrl::DoInsertAfter(const wxTreeItemId& parentId, void wxGenericTreeCtrl::SendDeleteEvent(wxGenericTreeItem *item) { wxTreeEvent event(wxEVT_COMMAND_TREE_DELETE_ITEM, this, item); - GetEventHandler()->ProcessEvent( event ); + ProcessEvent( event ); } // Don't leave edit or selection on a child which is about to disappear void wxGenericTreeCtrl::ChildrenClosing(wxGenericTreeItem* item) { - if ( m_textCtrl && item != m_textCtrl->item() && - IsDescendantOf(item, m_textCtrl->item()) ) - { + if (m_textCtrl != NULL && item != m_textCtrl->item() && IsDescendantOf(item, m_textCtrl->item())) { m_textCtrl->EndEdit( true ); } - - if ( item != m_key_current && IsDescendantOf(item, m_key_current) ) - { + if (item != m_key_current && IsDescendantOf(item, m_key_current)) { m_key_current = NULL; } - - if ( IsDescendantOf(item, m_select_me) ) - { + if (IsDescendantOf(item, m_select_me)) { m_select_me = item; } - - if ( item != m_current && IsDescendantOf(item, m_current) ) - { + if (item != m_current && IsDescendantOf(item, m_current)) { m_current->SetHilight( false ); m_current = NULL; m_select_me = item; @@ -1760,16 +1713,6 @@ void wxGenericTreeCtrl::Delete(const wxTreeItemId& itemId) wxGenericTreeItem *parent = item->GetParent(); - // if the selected item will be deleted, select the parent ... - wxGenericTreeItem *to_be_selected = parent; - if (parent) - { - // .. unless there is a next sibling like wxMSW does it - int pos = parent->GetChildren().Index( item ); - if ((int)(parent->GetChildren().GetCount()) > pos+1) - to_be_selected = parent->GetChildren().Item( pos+1 ); - } - // don't keep stale pointers around! if ( IsDescendantOf(item, m_key_current) ) { @@ -1785,7 +1728,7 @@ void wxGenericTreeCtrl::Delete(const wxTreeItemId& itemId) // a different item, in idle time. if ( m_select_me && IsDescendantOf(item, m_select_me) ) { - m_select_me = to_be_selected; + m_select_me = parent; } if ( IsDescendantOf(item, m_current) ) @@ -1796,7 +1739,7 @@ void wxGenericTreeCtrl::Delete(const wxTreeItemId& itemId) // m_current = parent; m_current = NULL; - m_select_me = to_be_selected; + m_select_me = parent; } // remove the item from the tree @@ -1834,9 +1777,9 @@ void wxGenericTreeCtrl::Expand(const wxTreeItemId& itemId) { wxGenericTreeItem *item = (wxGenericTreeItem*) itemId.m_pItem; - wxCHECK_RET( item, wxT("invalid item in wxGenericTreeCtrl::Expand") ); + wxCHECK_RET( item, _T("invalid item in wxGenericTreeCtrl::Expand") ); wxCHECK_RET( !HasFlag(wxTR_HIDE_ROOT) || itemId != GetRootItem(), - wxT("can't expand hidden root") ); + _T("can't expand hidden root") ); if ( !item->HasPlus() ) return; @@ -1846,32 +1789,25 @@ void wxGenericTreeCtrl::Expand(const wxTreeItemId& itemId) wxTreeEvent event(wxEVT_COMMAND_TREE_ITEM_EXPANDING, this, item); - if ( GetEventHandler()->ProcessEvent( event ) && !event.IsAllowed() ) + if ( ProcessEvent( event ) && !event.IsAllowed() ) { // cancelled by program return; } item->Expand(); - if ( !IsFrozen() ) - { - CalculatePositions(); + CalculatePositions(); - RefreshSubtree(item); - } - else // frozen - { - m_dirty = true; - } + RefreshSubtree(item); event.SetEventType(wxEVT_COMMAND_TREE_ITEM_EXPANDED); - GetEventHandler()->ProcessEvent( event ); + ProcessEvent( event ); } void wxGenericTreeCtrl::Collapse(const wxTreeItemId& itemId) { wxCHECK_RET( !HasFlag(wxTR_HIDE_ROOT) || itemId != GetRootItem(), - wxT("can't collapse hidden root") ); + _T("can't collapse hidden root") ); wxGenericTreeItem *item = (wxGenericTreeItem*) itemId.m_pItem; @@ -1879,7 +1815,7 @@ void wxGenericTreeCtrl::Collapse(const wxTreeItemId& itemId) return; wxTreeEvent event(wxEVT_COMMAND_TREE_ITEM_COLLAPSING, this, item); - if ( GetEventHandler()->ProcessEvent( event ) && !event.IsAllowed() ) + if ( ProcessEvent( event ) && !event.IsAllowed() ) { // cancelled by program return; @@ -1890,7 +1826,7 @@ void wxGenericTreeCtrl::Collapse(const wxTreeItemId& itemId) #if 0 // TODO why should items be collapsed recursively? wxArrayGenericTreeItems& children = item->GetChildren(); - size_t count = children.GetCount(); + size_t count = children.Count(); for ( size_t n = 0; n < count; n++ ) { Collapse(children[n]); @@ -1902,7 +1838,7 @@ void wxGenericTreeCtrl::Collapse(const wxTreeItemId& itemId) RefreshSubtree(item); event.SetEventType(wxEVT_COMMAND_TREE_ITEM_COLLAPSED); - GetEventHandler()->ProcessEvent( event ); + ProcessEvent( event ); } void wxGenericTreeCtrl::CollapseAndReset(const wxTreeItemId& item) @@ -1933,20 +1869,6 @@ void wxGenericTreeCtrl::Unselect() } } -void wxGenericTreeCtrl::ClearFocusedItem() -{ - wxTreeItemId item = GetFocusedItem(); - if ( item.IsOk() ) - SelectItem(item, false); -} - -void wxGenericTreeCtrl::SetFocusedItem(const wxTreeItemId& item) -{ - wxCHECK_RET( item.IsOk(), wxT("invalid tree item") ); - - SelectItem(item, true); -} - void wxGenericTreeCtrl::UnselectAllChildren(wxGenericTreeItem *item) { if (item->IsSelected()) @@ -1958,7 +1880,7 @@ void wxGenericTreeCtrl::UnselectAllChildren(wxGenericTreeItem *item) if (item->HasChildren()) { wxArrayGenericTreeItems& children = item->GetChildren(); - size_t count = children.GetCount(); + size_t count = children.Count(); for ( size_t n = 0; n < count; ++n ) { UnselectAllChildren(children[n]); @@ -1977,52 +1899,13 @@ void wxGenericTreeCtrl::UnselectAll() } } -void wxGenericTreeCtrl::SelectChildren(const wxTreeItemId& parent) -{ - wxCHECK_RET( HasFlag(wxTR_MULTIPLE), - "this only works with multiple selection controls" ); - - UnselectAll(); - - if ( !HasChildren(parent) ) - return; - - - wxArrayGenericTreeItems& - children = ((wxGenericTreeItem*) parent.m_pItem)->GetChildren(); - size_t count = children.GetCount(); - - wxGenericTreeItem * - item = (wxGenericTreeItem*) ((wxTreeItemId)children[0]).m_pItem; - wxTreeEvent event(wxEVT_COMMAND_TREE_SEL_CHANGING, this, item); - event.m_itemOld = m_current; - - if ( GetEventHandler()->ProcessEvent( event ) && !event.IsAllowed() ) - return; - - for ( size_t n = 0; n < count; ++n ) - { - m_current = m_key_current = children[n]; - m_current->SetHilight(true); - RefreshSelected(); - } - - - event.SetEventType(wxEVT_COMMAND_TREE_SEL_CHANGED); - GetEventHandler()->ProcessEvent( event ); -} - - // Recursive function ! // To stop we must have crt_itemGetParent(); @@ -2033,20 +1916,16 @@ wxGenericTreeCtrl::TagNextChildren(wxGenericTreeItem *crt_item, int index = children.Index(crt_item); wxASSERT( index != wxNOT_FOUND ); // I'm not a child of my parent? - size_t count = children.GetCount(); + size_t count = children.Count(); for (size_t n=(size_t)(index+1); nSetHilight(select); RefreshLine(crt_item); @@ -2054,11 +1933,10 @@ wxGenericTreeCtrl::TagAllChildrenUntilLast(wxGenericTreeItem *crt_item, if (crt_item==last_item) return true; - // We should leave the not shown children of collapsed items alone. - if (crt_item->HasChildren() && crt_item->IsExpanded()) + if (crt_item->HasChildren()) { wxArrayGenericTreeItems& children = crt_item->GetChildren(); - size_t count = children.GetCount(); + size_t count = children.Count(); for ( size_t n = 0; n < count; ++n ) { if (TagAllChildrenUntilLast(children[n], last_item, select)) @@ -2069,9 +1947,7 @@ wxGenericTreeCtrl::TagAllChildrenUntilLast(wxGenericTreeItem *crt_item, return false; } -void -wxGenericTreeCtrl::SelectItemRange(wxGenericTreeItem *item1, - wxGenericTreeItem *item2) +void wxGenericTreeCtrl::SelectItemRange(wxGenericTreeItem *item1, wxGenericTreeItem *item2) { m_select_me = NULL; @@ -2146,8 +2022,7 @@ void wxGenericTreeCtrl::DoSelectItem(const wxTreeItemId& itemId, { if ( !m_current ) { - m_current = - m_key_current = (wxGenericTreeItem*) GetRootItem().m_pItem; + m_current = m_key_current = (wxGenericTreeItem*) GetRootItem().m_pItem; } // don't change the mark (m_current) @@ -2182,7 +2057,7 @@ void wxGenericTreeCtrl::SelectItem(const wxTreeItemId& itemId, bool select) if ( select ) { - if ( !item->IsSelected() ) + if (!item->IsSelected()) DoSelectItem(itemId, !HasFlag(wxTR_MULTIPLE)); } else // deselect @@ -2224,7 +2099,7 @@ size_t wxGenericTreeCtrl::GetSelections(wxArrayTreeItemIds &array) const } //else: the tree is empty, so no selections - return array.GetCount(); + return array.Count(); } void wxGenericTreeCtrl::EnsureVisible(const wxTreeItemId& item) @@ -2262,42 +2137,56 @@ void wxGenericTreeCtrl::EnsureVisible(const wxTreeItemId& item) void wxGenericTreeCtrl::ScrollTo(const wxTreeItemId &item) { - if (!item.IsOk()) - return; + if (!item.IsOk()) return; - // update the control before scrolling it + // We have to call this here because the label in + // question might just have been added and no screen + // update taken place. if (m_dirty) #if defined( __WXMSW__ ) || defined(__WXMAC__) Update(); #else DoDirtyProcessing(); #endif - wxGenericTreeItem *gitem = (wxGenericTreeItem*) item.m_pItem; - int itemY = gitem->GetY(); + // now scroll to the item + int item_y = gitem->GetY(); int start_x = 0; int start_y = 0; GetViewStart( &start_x, &start_y ); + start_y *= PIXELS_PER_UNIT; - const int clientHeight = GetClientSize().y; + int client_h = 0; + int client_w = 0; + GetClientSize( &client_w, &client_h ); - const int itemHeight = GetLineHeight(gitem) + 2; - - if ( itemY + itemHeight > start_y*PIXELS_PER_UNIT + clientHeight ) + if (item_y < start_y+3) { - // need to scroll up by enough to show this item fully - itemY += itemHeight - clientHeight; + // going down + int x = 0; + int y = 0; + m_anchor->GetSize( x, y, this ); + y += PIXELS_PER_UNIT+2; // one more scrollbar unit + 2 pixels + x += PIXELS_PER_UNIT+2; // one more scrollbar unit + 2 pixels + int x_pos = GetScrollPos( wxHORIZONTAL ); + // Item should appear at top + SetScrollbars( PIXELS_PER_UNIT, PIXELS_PER_UNIT, x/PIXELS_PER_UNIT, y/PIXELS_PER_UNIT, x_pos, item_y/PIXELS_PER_UNIT ); } - else if ( itemY > start_y*PIXELS_PER_UNIT ) + else if (item_y+GetLineHeight(gitem) > start_y+client_h) { - // item is already fully visible, don't do anything - return; + // going up + int x = 0; + int y = 0; + m_anchor->GetSize( x, y, this ); + y += PIXELS_PER_UNIT+2; // one more scrollbar unit + 2 pixels + x += PIXELS_PER_UNIT+2; // one more scrollbar unit + 2 pixels + item_y += PIXELS_PER_UNIT+2; + int x_pos = GetScrollPos( wxHORIZONTAL ); + // Item should appear at bottom + SetScrollbars( PIXELS_PER_UNIT, PIXELS_PER_UNIT, x/PIXELS_PER_UNIT, y/PIXELS_PER_UNIT, x_pos, (item_y+GetLineHeight(gitem)-client_h)/PIXELS_PER_UNIT ); } - //else: scroll down to make this item the top one displayed - - Scroll(-1, itemY/PIXELS_PER_UNIT); } // FIXME: tree sorting functions are not reentrant and not MT-safe! @@ -2306,8 +2195,7 @@ static wxGenericTreeCtrl *s_treeBeingSorted = NULL; static int LINKAGEMODE tree_ctrl_compare_func(wxGenericTreeItem **item1, wxGenericTreeItem **item2) { - wxCHECK_MSG( s_treeBeingSorted, 0, - "bug in wxGenericTreeCtrl::SortChildren()" ); + wxCHECK_MSG( s_treeBeingSorted, 0, wxT("bug in wxGenericTreeCtrl::SortChildren()") ); return s_treeBeingSorted->OnCompareItems(*item1, *item2); } @@ -2322,7 +2210,7 @@ void wxGenericTreeCtrl::SortChildren(const wxTreeItemId& itemId) wxT("wxGenericTreeCtrl::SortChildren is not reentrant") ); wxArrayGenericTreeItems& children = item->GetChildren(); - if ( children.GetCount() > 1 ) + if ( children.Count() > 1 ) { m_dirty = true; @@ -2352,20 +2240,6 @@ void wxGenericTreeCtrl::CalculateLineHeight() } } - if ( m_imageListState ) - { - // Calculate a m_lineHeight value from the state Image sizes. - // May be toggle off. Then wxGenericTreeCtrl will spread when - // necessary (which might look ugly). - int n = m_imageListState->GetImageCount(); - for (int i = 0; i < n ; i++) - { - int width = 0, height = 0; - m_imageListState->GetSize(i, width, height); - if (height > m_lineHeight) m_lineHeight = height; - } - } - if (m_imageListButtons) { // Calculate a m_lineHeight value from the Button image sizes. @@ -2407,15 +2281,6 @@ void wxGenericTreeCtrl::SetStateImageList(wxImageList *imageList) if (m_ownsImageListState) delete m_imageListState; m_imageListState = imageList; m_ownsImageListState = false; - m_dirty = true; - - if (m_anchor) - m_anchor->RecursiveResetSize(); - - // Don't do any drawing if we're setting the list to NULL, - // since we may be in the process of deleting the tree control. - if (imageList) - CalculateLineHeight(); } void wxGenericTreeCtrl::SetButtonsImageList(wxImageList *imageList) @@ -2451,9 +2316,7 @@ void wxGenericTreeCtrl::AdjustMyScrollbars() x += PIXELS_PER_UNIT+2; // one more scrollbar unit + 2 pixels int x_pos = GetScrollPos( wxHORIZONTAL ); int y_pos = GetScrollPos( wxVERTICAL ); - SetScrollbars( PIXELS_PER_UNIT, PIXELS_PER_UNIT, - x/PIXELS_PER_UNIT, y/PIXELS_PER_UNIT, - x_pos, y_pos ); + SetScrollbars( PIXELS_PER_UNIT, PIXELS_PER_UNIT, x/PIXELS_PER_UNIT, y/PIXELS_PER_UNIT, x_pos, y_pos ); } else { @@ -2472,7 +2335,6 @@ int wxGenericTreeCtrl::GetLineHeight(wxGenericTreeItem *item) const void wxGenericTreeCtrl::PaintItem(wxGenericTreeItem *item, wxDC& dc) { item->SetFont(this, dc); - item->CalculateSize(this, dc); wxCoord text_h = item->GetTextHeight(); @@ -2482,7 +2344,7 @@ void wxGenericTreeCtrl::PaintItem(wxGenericTreeItem *item, wxDC& dc) { if ( m_imageListNormal ) { - m_imageListNormal->GetSize(image, image_w, image_h); + m_imageListNormal->GetSize( image, image_w, image_h ); image_w += MARGIN_BETWEEN_IMAGE_AND_TEXT; } else @@ -2491,24 +2353,6 @@ void wxGenericTreeCtrl::PaintItem(wxGenericTreeItem *item, wxDC& dc) } } - int state_h = 0, state_w = 0; - int state = item->GetState(); - if ( state != wxTREE_ITEMSTATE_NONE ) - { - if ( m_imageListState ) - { - m_imageListState->GetSize(state, state_w, state_h); - if ( image_w != 0 ) - state_w += MARGIN_BETWEEN_STATE_AND_IMAGE; - else - state_w += MARGIN_BETWEEN_IMAGE_AND_TEXT; - } - else - { - state = wxTREE_ITEMSTATE_NONE; - } - } - int total_h = GetLineHeight(item); bool drawItemBackground = false, hasBgColour = false; @@ -2532,17 +2376,19 @@ void wxGenericTreeCtrl::PaintItem(wxGenericTreeItem *item, wxDC& dc) { colBg = GetBackgroundColour(); } - dc.SetBrush(wxBrush(colBg, wxBRUSHSTYLE_SOLID)); + dc.SetBrush(wxBrush(colBg, wxSOLID)); } int offset = HasFlag(wxTR_ROW_LINES) ? 1 : 0; if ( HasFlag(wxTR_FULL_ROW_HIGHLIGHT) ) { - int x, w, h; - x=0; + int x = 0, w = 0, h = 0; GetVirtualSize(&w, &h); wxRect rect( x, item->GetY()+offset, w, total_h-offset); +#if !defined(__WXGTK20__) && !defined(__WXMAC__) + dc.DrawRectangle(rect); +#else if (!item->IsSelected()) { dc.DrawRectangle(rect); @@ -2551,30 +2397,26 @@ void wxGenericTreeCtrl::PaintItem(wxGenericTreeItem *item, wxDC& dc) { int flags = wxCONTROL_SELECTED; if (m_hasFocus -#if defined( __WXMAC__ ) && !defined(__WXUNIVERSAL__) && wxOSX_USE_CARBON // TODO CS +#ifdef __WXMAC__ && IsControlActive( (ControlRef)GetHandle() ) #endif ) flags |= wxCONTROL_FOCUSED; if ((item == m_current) && (m_hasFocus)) flags |= wxCONTROL_CURRENT; - - wxRendererNative::Get(). - DrawItemSelectionRect(this, dc, rect, flags); + wxRendererNative::Get().DrawItemSelectionRect( this, dc, rect, flags ); } +#endif } - else // no full row highlight + else { - if ( item->IsSelected() && - (state != wxTREE_ITEMSTATE_NONE || image != NO_IMAGE) ) + if ( item->IsSelected() && image != NO_IMAGE ) { - // If it's selected, and there's an state image or normal image, - // then we should take care to leave the area under the image - // painted in the background colour. - wxRect rect( item->GetX() + state_w + image_w - 2, - item->GetY() + offset, - item->GetWidth() - state_w - image_w + 2, - total_h - offset ); + // If it's selected, and there's an image, then we should + // take care to leave the area under the image painted in the + // background colour. + wxRect rect( item->GetX() + image_w - 2, item->GetY()+offset, + item->GetWidth() - image_w + 2, total_h-offset ); #if !defined(__WXGTK20__) && !defined(__WXMAC__) dc.DrawRectangle( rect ); #else @@ -2586,8 +2428,7 @@ void wxGenericTreeCtrl::PaintItem(wxGenericTreeItem *item, wxDC& dc) flags |= wxCONTROL_FOCUSED; if ((item == m_current) && (m_hasFocus)) flags |= wxCONTROL_CURRENT; - wxRendererNative::Get(). - DrawItemSelectionRect(this, dc, rect, flags); + wxRendererNative::Get().DrawItemSelectionRect( this, dc, rect, flags ); #endif } // On GTK+ 2, drawing a 'normal' background is wrong for themes that @@ -2595,15 +2436,16 @@ void wxGenericTreeCtrl::PaintItem(wxGenericTreeItem *item, wxDC& dc) // except for custom item backgrounds, works for both kinds of theme. else if (drawItemBackground) { - wxRect rect( item->GetX() + state_w + image_w - 2, - item->GetY() + offset, - item->GetWidth() - state_w - image_w + 2, - total_h - offset ); + wxRect rect( item->GetX()-2, item->GetY()+offset, + item->GetWidth()+2, total_h-offset ); +#if !defined(__WXGTK20__) && !defined(__WXMAC__) + dc.DrawRectangle( rect ); +#else if ( hasBgColour ) { dc.DrawRectangle( rect ); } - else // no specific background colour + else { rect.x -= 1; rect.width += 2; @@ -2613,86 +2455,34 @@ void wxGenericTreeCtrl::PaintItem(wxGenericTreeItem *item, wxDC& dc) flags |= wxCONTROL_FOCUSED; if ((item == m_current) && (m_hasFocus)) flags |= wxCONTROL_CURRENT; - wxRendererNative::Get(). - DrawItemSelectionRect(this, dc, rect, flags); + wxRendererNative::Get().DrawItemSelectionRect( this, dc, rect, flags ); } +#endif } } - if ( state != wxTREE_ITEMSTATE_NONE ) - { - dc.SetClippingRegion( item->GetX(), item->GetY(), state_w, total_h ); - m_imageListState->Draw( state, dc, - item->GetX(), - item->GetY() + - (total_h > state_h ? (total_h-state_h)/2 - : 0), - wxIMAGELIST_DRAW_TRANSPARENT ); - dc.DestroyClippingRegion(); - } - if ( image != NO_IMAGE ) { - dc.SetClippingRegion(item->GetX() + state_w, item->GetY(), - image_w, total_h); + dc.SetClippingRegion( item->GetX(), item->GetY(), image_w-2, total_h ); m_imageListNormal->Draw( image, dc, - item->GetX() + state_w, - item->GetY() + - (total_h > image_h ? (total_h-image_h)/2 - : 0), + item->GetX(), + item->GetY() +((total_h > image_h)?((total_h-image_h)/2):0), wxIMAGELIST_DRAW_TRANSPARENT ); dc.DestroyClippingRegion(); } - dc.SetBackgroundMode(wxBRUSHSTYLE_TRANSPARENT); + dc.SetBackgroundMode(wxTRANSPARENT); int extraH = (total_h > text_h) ? (total_h - text_h)/2 : 0; dc.DrawText( item->GetText(), - (wxCoord)(state_w + image_w + item->GetX()), + (wxCoord)(image_w + item->GetX()), (wxCoord)(item->GetY() + extraH)); // restore normal font dc.SetFont( m_normalFont ); - - if (item == m_dndEffectItem) - { - dc.SetPen( *wxBLACK_PEN ); - // DnD visual effects - switch (m_dndEffect) - { - case BorderEffect: - { - dc.SetBrush(*wxTRANSPARENT_BRUSH); - int w = item->GetWidth() + 2; - int h = total_h + 2; - dc.DrawRectangle( item->GetX() - 1, item->GetY() - 1, w, h); - break; - } - case AboveEffect: - { - int x = item->GetX(), - y = item->GetY(); - dc.DrawLine( x, y, x + item->GetWidth(), y); - break; - } - case BelowEffect: - { - int x = item->GetX(), - y = item->GetY(); - y += total_h - 1; - dc.DrawLine( x, y, x + item->GetWidth(), y); - break; - } - case NoEffect: - break; - } - } } -void -wxGenericTreeCtrl::PaintLevel(wxGenericTreeItem *item, - wxDC &dc, - int level, - int &y) +// Now y stands for the top of the item, whereas it used to stand for middle ! +void wxGenericTreeCtrl::PaintLevel( wxGenericTreeItem *item, wxDC &dc, int level, int &y ) { int x = level*m_indent; if (!HasFlag(wxTR_HIDE_ROOT)) @@ -2704,7 +2494,7 @@ wxGenericTreeCtrl::PaintLevel(wxGenericTreeItem *item, // always expand hidden root int origY = y; wxArrayGenericTreeItems& children = item->GetChildren(); - int count = children.GetCount(); + int count = children.Count(); if (count > 0) { int n = 0, oldY; @@ -2713,8 +2503,7 @@ wxGenericTreeCtrl::PaintLevel(wxGenericTreeItem *item, PaintLevel(children[n], dc, 1, y); } while (++n < count); - if ( !HasFlag(wxTR_NO_LINES) && HasFlag(wxTR_LINES_AT_ROOT) - && count > 0 ) + if (!HasFlag(wxTR_NO_LINES) && HasFlag(wxTR_LINES_AT_ROOT) && count > 0) { // draw line down to last child origY += GetLineHeight(children[0])>>1; @@ -2748,7 +2537,7 @@ wxGenericTreeCtrl::PaintLevel(wxGenericTreeItem *item, wxColour colText; if ( item->IsSelected() -#if defined( __WXMAC__ ) && !defined(__WXUNIVERSAL__) && wxOSX_USE_CARBON // TODO CS +#ifdef __WXMAC__ // On wxMac, if the tree doesn't have the focus we draw an empty // rectangle, so we want to make sure that the text is visible // against the normal background, not the highlightbackground, so @@ -2760,10 +2549,10 @@ wxGenericTreeCtrl::PaintLevel(wxGenericTreeItem *item, #ifdef __WXMAC__ colText = *wxWHITE; #else - if (m_hasFocus) - colText = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT); - else - colText = wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT); + if (m_hasFocus) + colText = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT); + else + colText = wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT); #endif } else @@ -2856,7 +2645,7 @@ wxGenericTreeCtrl::PaintLevel(wxGenericTreeItem *item, if (item->IsExpanded()) { wxArrayGenericTreeItems& children = item->GetChildren(); - int count = children.GetCount(); + int count = children.Count(); if (count > 0) { int n = 0, oldY; @@ -2872,21 +2661,20 @@ wxGenericTreeCtrl::PaintLevel(wxGenericTreeItem *item, oldY += GetLineHeight(children[n-1])>>1; if (HasButtons()) y_mid += 5; - // Only draw the portion of the line that is visible, in case - // it is huge + // Only draw the portion of the line that is visible, in case it is huge wxCoord xOrigin=0, yOrigin=0, width, height; dc.GetDeviceOrigin(&xOrigin, &yOrigin); yOrigin = abs(yOrigin); GetClientSize(&width, &height); - // Move end points to the beginning/end of the view? + // Move end points to the begining/end of the view? if (y_mid < yOrigin) y_mid = yOrigin; if (oldY > yOrigin + height) oldY = yOrigin + height; - // after the adjustments if y_mid is larger than oldY then the - // line isn't visible at all so don't draw anything + // after the adjustments if y_mid is larger than oldY then the line + // isn't visible at all so don't draw anything if (y_mid < oldY) dc.DrawLine(x, y_mid, x, oldY); } @@ -2910,7 +2698,7 @@ void wxGenericTreeCtrl::DrawDropEffect(wxGenericTreeItem *item) DrawLine(item, !m_dropEffectAboveItem ); } - SetCursor(*wxSTANDARD_CURSOR); + SetCursor(wxCURSOR_BULLSEYE); } else { @@ -2921,49 +2709,39 @@ void wxGenericTreeCtrl::DrawDropEffect(wxGenericTreeItem *item) void wxGenericTreeCtrl::DrawBorder(const wxTreeItemId &item) { - wxCHECK_RET( item.IsOk(), "invalid item in wxGenericTreeCtrl::DrawLine" ); + wxCHECK_RET( item.IsOk(), _T("invalid item in wxGenericTreeCtrl::DrawLine") ); wxGenericTreeItem *i = (wxGenericTreeItem*) item.m_pItem; - if (m_dndEffect == NoEffect) - { - m_dndEffect = BorderEffect; - m_dndEffectItem = i; - } - else - { - m_dndEffect = NoEffect; - m_dndEffectItem = NULL; - } + wxClientDC dc(this); + PrepareDC( dc ); + dc.SetLogicalFunction(wxINVERT); + dc.SetBrush(*wxTRANSPARENT_BRUSH); - wxRect rect( i->GetX()-1, i->GetY()-1, i->GetWidth()+2, GetLineHeight(i)+2 ); - CalcScrolledPosition( rect.x, rect.y, &rect.x, &rect.y ); - RefreshRect( rect ); + int w = i->GetWidth() + 2; + int h = GetLineHeight(i) + 2; + + dc.DrawRectangle( i->GetX() - 1, i->GetY() - 1, w, h); } void wxGenericTreeCtrl::DrawLine(const wxTreeItemId &item, bool below) { - wxCHECK_RET( item.IsOk(), "invalid item in wxGenericTreeCtrl::DrawLine" ); + wxCHECK_RET( item.IsOk(), _T("invalid item in wxGenericTreeCtrl::DrawLine") ); wxGenericTreeItem *i = (wxGenericTreeItem*) item.m_pItem; - if (m_dndEffect == NoEffect) + wxClientDC dc(this); + PrepareDC( dc ); + dc.SetLogicalFunction(wxINVERT); + + int x = i->GetX(), + y = i->GetY(); + if ( below ) { - if (below) - m_dndEffect = BelowEffect; - else - m_dndEffect = AboveEffect; - m_dndEffectItem = i; - } - else - { - m_dndEffect = NoEffect; - m_dndEffectItem = NULL; + y += GetLineHeight(i) - 1; } - wxRect rect( i->GetX()-1, i->GetY()-1, i->GetWidth()+2, GetLineHeight(i)+2 ); - CalcScrolledPosition( rect.x, rect.y, &rect.x, &rect.y ); - RefreshRect( rect ); + dc.DrawLine( x, y, x + i->GetWidth(), y); } // ----------------------------------------------------------------------------- @@ -3017,19 +2795,16 @@ void wxGenericTreeCtrl::OnKillFocus( wxFocusEvent &event ) event.Skip(); } -void wxGenericTreeCtrl::OnKeyDown( wxKeyEvent &event ) +void wxGenericTreeCtrl::OnChar( wxKeyEvent &event ) { - // send a tree event wxTreeEvent te( wxEVT_COMMAND_TREE_KEY_DOWN, this); te.m_evtKey = event; if ( GetEventHandler()->ProcessEvent( te ) ) + { + // intercepted by the user code return; + } - event.Skip(); -} - -void wxGenericTreeCtrl::OnChar( wxKeyEvent &event ) -{ if ( (m_current == 0) || (m_key_current == 0) ) { event.Skip(); @@ -3063,21 +2838,6 @@ void wxGenericTreeCtrl::OnChar( wxKeyEvent &event ) // end : go to last item without opening parents // alnum : start or continue searching for the item with this prefix int keyCode = event.GetKeyCode(); - -#ifdef __WXOSX__ - // Make the keys work as they do in the native control: - // right => expand - // left => collapse if current item is expanded - if (keyCode == WXK_RIGHT) - { - keyCode = '+'; - } - else if (keyCode == WXK_LEFT && IsExpanded(m_current)) - { - keyCode = '-'; - } -#endif // __WXOSX__ - switch ( keyCode ) { case '+': @@ -3108,17 +2868,14 @@ void wxGenericTreeCtrl::OnChar( wxKeyEvent &event ) case WXK_MENU: { - // Use the item's bounding rectangle to determine position for - // the event + // Use the item's bounding rectangle to determine position for the event wxRect ItemRect; GetBoundingRect(m_current, ItemRect, true); - wxTreeEvent - eventMenu(wxEVT_COMMAND_TREE_ITEM_MENU, this, m_current); + wxTreeEvent eventMenu(wxEVT_COMMAND_TREE_ITEM_MENU, this, m_current); // Use the left edge, vertical middle eventMenu.m_pointDrag = wxPoint(ItemRect.GetX(), - ItemRect.GetY() + - ItemRect.GetHeight() / 2); + ItemRect.GetY() + ItemRect.GetHeight() / 2); GetEventHandler()->ProcessEvent( eventMenu ); } break; @@ -3127,8 +2884,7 @@ void wxGenericTreeCtrl::OnChar( wxKeyEvent &event ) case WXK_RETURN: if ( !event.HasModifiers() ) { - wxTreeEvent - eventAct(wxEVT_COMMAND_TREE_ITEM_ACTIVATED, this, m_current); + wxTreeEvent eventAct(wxEVT_COMMAND_TREE_ITEM_ACTIVATED, this, m_current); GetEventHandler()->ProcessEvent( eventAct ); } @@ -3156,15 +2912,12 @@ void wxGenericTreeCtrl::OnChar( wxKeyEvent &event ) { wxTreeItemIdValue cookie; wxTreeItemId current = m_key_current; - // TODO: Huh? If we get here, we'd better be the first - // child of our parent. How else could it be? + // TODO: Huh? If we get here, we'd better be the first child of our parent. How else could it be? if (current == GetFirstChild( prev, cookie )) { // otherwise we return to where we came from - DoSelectItem(prev, - unselect_others, - extended_select); - m_key_current = (wxGenericTreeItem*) prev.m_pItem; + DoSelectItem( prev, unselect_others, extended_select ); + m_key_current= (wxGenericTreeItem*) prev.m_pItem; break; } } @@ -3360,35 +3113,25 @@ bool wxGenericTreeCtrl::GetBoundingRect(const wxTreeItemId& item, wxRect& rect, bool textOnly) const { - wxCHECK_MSG( item.IsOk(), false, - "invalid item in wxGenericTreeCtrl::GetBoundingRect" ); + wxCHECK_MSG( item.IsOk(), false, _T("invalid item in wxGenericTreeCtrl::GetBoundingRect") ); wxGenericTreeItem *i = (wxGenericTreeItem*) item.m_pItem; if ( textOnly ) { - int image_h = 0, image_w = 0; - int image = ((wxGenericTreeItem*) item.m_pItem)->GetCurrentImage(); - if ( image != NO_IMAGE && m_imageListNormal ) + rect.x = i->GetX(); + rect.width = i->GetWidth(); + + if ( m_imageListNormal ) { - m_imageListNormal->GetSize( image, image_w, image_h ); - image_w += MARGIN_BETWEEN_IMAGE_AND_TEXT; + int image = ((wxGenericTreeItem*) item.m_pItem)->GetCurrentImage(); + if ( image != NO_IMAGE ) + { + int image_w, image_h; + m_imageListNormal->GetSize( image, image_w, image_h ); + rect.width += image_w + MARGIN_BETWEEN_IMAGE_AND_TEXT; + } } - - int state_h = 0, state_w = 0; - int state = ((wxGenericTreeItem*) item.m_pItem)->GetState(); - if ( state != wxTREE_ITEMSTATE_NONE && m_imageListState ) - { - m_imageListState->GetSize( state, state_w, state_h ); - if ( image_w != 0 ) - state_w += MARGIN_BETWEEN_STATE_AND_IMAGE; - else - state_w += MARGIN_BETWEEN_IMAGE_AND_TEXT; - } - - rect.x = i->GetX() + state_w + image_w; - rect.width = i->GetWidth() - state_w - image_w; - } else // the entire line { @@ -3408,7 +3151,7 @@ bool wxGenericTreeCtrl::GetBoundingRect(const wxTreeItemId& item, wxTextCtrl *wxGenericTreeCtrl::EditLabel(const wxTreeItemId& item, wxClassInfo * WXUNUSED(textCtrlClass)) { - wxCHECK_MSG( item.IsOk(), NULL, wxT("can't edit an invalid item") ); + wxCHECK_MSG( item.IsOk(), NULL, _T("can't edit an invalid item") ); wxGenericTreeItem *itemEdit = (wxGenericTreeItem *)item.m_pItem; @@ -3448,7 +3191,7 @@ wxTextCtrl* wxGenericTreeCtrl::GetEditControl() const void wxGenericTreeCtrl::EndEditLabel(const wxTreeItemId& WXUNUSED(item), bool discardChanges) { - wxCHECK_RET( m_textCtrl, wxT("not editing label") ); + wxCHECK_RET( m_textCtrl, _T("not editing label") ); m_textCtrl->EndEdit(discardChanges); } @@ -3523,16 +3266,11 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event ) // Determines what item we are hovering over and need a tooltip for wxTreeItemId hoverItem = thisItem; - // We do not want a tooltip if we are dragging, or if the rename timer is - // running - if ( underMouseChanged && - hoverItem.IsOk() && - !m_isDragging && - (!m_renameTimer || !m_renameTimer->IsRunning()) ) + // We do not want a tooltip if we are dragging, or if the rename timer is running + if (underMouseChanged && hoverItem.IsOk() && !m_isDragging && (!m_renameTimer || !m_renameTimer->IsRunning())) { // Ask the tree control what tooltip (if any) should be shown - wxTreeEvent - hevent(wxEVT_COMMAND_TREE_ITEM_GETTOOLTIP, this, hoverItem); + wxTreeEvent hevent(wxEVT_COMMAND_TREE_ITEM_GETTOOLTIP, this, hoverItem); if ( GetEventHandler()->ProcessEvent(hevent) && hevent.IsAllowed() ) { @@ -3624,8 +3362,6 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event ) #if defined(__WXMSW__) || defined(__WXMAC__) || defined(__WXGTK20__) Update(); #else - // TODO: remove this call or use wxEventLoopBase::GetActive()->YieldFor(wxEVT_CATEGORY_UI) - // instead (needs to be tested!) wxYieldIfNeeded(); #endif } @@ -3641,7 +3377,7 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event ) { m_oldSelection->SetHilight(true); RefreshLine(m_oldSelection); - m_oldSelection = NULL; + m_oldSelection = (wxGenericTreeItem *)NULL; } // generate the drag end event @@ -3652,27 +3388,23 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event ) (void)GetEventHandler()->ProcessEvent(eventEndDrag); m_isDragging = false; - m_dropTarget = NULL; + m_dropTarget = (wxGenericTreeItem *)NULL; SetCursor(m_oldCursor); -#if defined( __WXMSW__ ) || defined(__WXMAC__) || defined(__WXGTK20__) +#if defined( __WXMSW__ ) || defined(__WXMAC__) Update(); #else - // TODO: remove this call or use wxEventLoopBase::GetActive()->YieldFor(wxEVT_CATEGORY_UI) - // instead (needs to be tested!) wxYieldIfNeeded(); #endif } else { // If we got to this point, we are not dragging or moving the mouse. - // Because the code in carbon/toplevel.cpp will only set focus to the - // tree if we skip for EVT_LEFT_DOWN, we MUST skip this event here for - // focus to work. + // Because the code in carbon/toplevel.cpp will only set focus to the tree + // if we skip for EVT_LEFT_DOWN, we MUST skip this event here for focus to work. // We skip even if we didn't hit an item because we still should - // restore focus to the tree control even if we didn't exactly hit an - // item. + // restore focus to the tree control even if we didn't exactly hit an item. if ( event.LeftDown() ) { event.Skip(); @@ -3687,40 +3419,30 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event ) if ( event.RightDown() ) { // If the item is already selected, do not update the selection. - // Multi-selections should not be cleared if a selected item is - // clicked. + // Multi-selections should not be cleared if a selected item is clicked. if (!IsSelected(item)) { DoSelectItem(item, true, false); } - wxTreeEvent - nevent(wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK, this, item); + wxTreeEvent nevent(wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK, this, item); nevent.m_pointDrag = CalcScrolledPosition(pt); event.Skip(!GetEventHandler()->ProcessEvent(nevent)); // Consistent with MSW (for now), send the ITEM_MENU *after* - // the RIGHT_CLICK event. TODO: This behaviour may change. + // the RIGHT_CLICK event. TODO: This behavior may change. wxTreeEvent nevent2(wxEVT_COMMAND_TREE_ITEM_MENU, this, item); nevent2.m_pointDrag = CalcScrolledPosition(pt); GetEventHandler()->ProcessEvent(nevent2); } else if ( event.MiddleDown() ) { - wxTreeEvent - nevent(wxEVT_COMMAND_TREE_ITEM_MIDDLE_CLICK, this, item); + wxTreeEvent nevent(wxEVT_COMMAND_TREE_ITEM_MIDDLE_CLICK, this, item); nevent.m_pointDrag = CalcScrolledPosition(pt); event.Skip(!GetEventHandler()->ProcessEvent(nevent)); } else if ( event.LeftUp() ) { - if (flags & wxTREE_HITTEST_ONITEMSTATEICON) - { - wxTreeEvent - nevent(wxEVT_COMMAND_TREE_STATE_IMAGE_CLICK, this, item); - GetEventHandler()->ProcessEvent(nevent); - } - // this facilitates multiple-item drag-and-drop if ( /* item && */ HasFlag(wxTR_MULTIPLE)) @@ -3758,9 +3480,8 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event ) m_lastOnSame = false; } } - else // !RightDown() && !MiddleDown() && !LeftUp() + else // !RightDown() && !MiddleDown() && !LeftUp() ==> LeftDown() || LeftDClick() { - // ==> LeftDown() || LeftDClick() if ( event.LeftDown() ) { m_lastOnSame = item == m_current; @@ -3792,9 +3513,7 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event ) EventFlagsToSelType(GetWindowStyleFlag(), event.ShiftDown(), event.CmdDown(), - is_multiple, - extended_select, - unselect_others); + is_multiple, extended_select, unselect_others); DoSelectItem(item, unselect_others, extended_select); } @@ -3811,8 +3530,7 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event ) m_lastOnSame = false; // send activate event first - wxTreeEvent - nevent(wxEVT_COMMAND_TREE_ITEM_ACTIVATED, this, item); + wxTreeEvent nevent(wxEVT_COMMAND_TREE_ITEM_ACTIVATED, this, item); nevent.m_pointDrag = CalcScrolledPosition(pt); if ( !GetEventHandler()->ProcessEvent( nevent ) ) { @@ -3851,11 +3569,15 @@ void wxGenericTreeCtrl::OnInternalIdle() DoDirtyProcessing(); } -void -wxGenericTreeCtrl::CalculateLevel(wxGenericTreeItem *item, - wxDC &dc, - int level, - int &y ) +void wxGenericTreeCtrl::CalculateSize( wxGenericTreeItem *WXUNUSED(item), wxDC &WXUNUSED(dc) ) +{ + // Should not be called anymore, keeping for ABI compatibility. +} + +// ----------------------------------------------------------------------------- +// for developper : y is now the top of the level +// not the middle of it ! +void wxGenericTreeCtrl::CalculateLevel( wxGenericTreeItem *item, wxDC &dc, int level, int &y ) { int x = level*m_indent; if (!HasFlag(wxTR_HIDE_ROOT)) @@ -3884,7 +3606,7 @@ wxGenericTreeCtrl::CalculateLevel(wxGenericTreeItem *item, Recurse: wxArrayGenericTreeItems& children = item->GetChildren(); - size_t n, count = children.GetCount(); + size_t n, count = children.Count(); ++level; for (n = 0; n < count; ++n ) CalculateLevel( children[n], dc, level, y ); // recurse @@ -3900,8 +3622,8 @@ void wxGenericTreeCtrl::CalculatePositions() dc.SetFont( m_normalFont ); dc.SetPen( m_dottedPen ); - //if(GetImageList() == NULL) - // m_lineHeight = (int)(dc.GetCharHeight() + 4); + + m_anchor->CalculateSize(this, dc); int y = 2; CalculateLevel( m_anchor, dc, 0, y ); // start recursion @@ -3909,13 +3631,13 @@ void wxGenericTreeCtrl::CalculatePositions() void wxGenericTreeCtrl::Refresh(bool eraseBackground, const wxRect *rect) { - if ( !IsFrozen() ) + if ( !m_freezeCount ) wxTreeCtrlBase::Refresh(eraseBackground, rect); } void wxGenericTreeCtrl::RefreshSubtree(wxGenericTreeItem *item) { - if (m_dirty || IsFrozen() ) + if (m_dirty || m_freezeCount) return; wxSize client = GetClientSize(); @@ -3932,7 +3654,7 @@ void wxGenericTreeCtrl::RefreshSubtree(wxGenericTreeItem *item) void wxGenericTreeCtrl::RefreshLine( wxGenericTreeItem *item ) { - if (m_dirty || IsFrozen() ) + if (m_dirty || m_freezeCount) return; wxRect rect; @@ -3945,7 +3667,7 @@ void wxGenericTreeCtrl::RefreshLine( wxGenericTreeItem *item ) void wxGenericTreeCtrl::RefreshSelected() { - if (IsFrozen()) + if (m_freezeCount) return; // TODO: this is awfully inefficient, we should keep the list of all @@ -3956,7 +3678,7 @@ void wxGenericTreeCtrl::RefreshSelected() void wxGenericTreeCtrl::RefreshSelectedUnder(wxGenericTreeItem *item) { - if (IsFrozen()) + if (m_freezeCount) return; if ( item->IsSelected() ) @@ -3970,14 +3692,19 @@ void wxGenericTreeCtrl::RefreshSelectedUnder(wxGenericTreeItem *item) } } -void wxGenericTreeCtrl::DoThaw() +void wxGenericTreeCtrl::Freeze() { - wxTreeCtrlBase::DoThaw(); + m_freezeCount++; +} - if ( m_dirty ) - DoDirtyProcessing(); - else +void wxGenericTreeCtrl::Thaw() +{ + wxCHECK_RET( m_freezeCount > 0, _T("thawing unfrozen tree control?") ); + + if ( --m_freezeCount == 0 ) + { Refresh(); + } } // ---------------------------------------------------------------------------- @@ -4036,9 +3763,23 @@ wxGenericTreeCtrl::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant)) #endif } +#if WXWIN_COMPATIBILITY_2_4 + +int wxGenericTreeCtrl::GetItemSelectedImage(const wxTreeItemId& item) const +{ + return GetItemImage(item, wxTreeItemIcon_Selected); +} + +void wxGenericTreeCtrl::SetItemSelectedImage(const wxTreeItemId& item, int image) +{ + SetItemImage(item, image, wxTreeItemIcon_Selected); +} + +#endif // WXWIN_COMPATIBILITY_2_4 + void wxGenericTreeCtrl::DoDirtyProcessing() { - if (IsFrozen()) + if (m_freezeCount) return; m_dirty = false; diff --git a/Source/3rd Party/wx/src/generic/vlbox.cpp b/Source/3rd Party/wx/src/generic/vlbox.cpp index 89f2b1691..70a5bc109 100644 --- a/Source/3rd Party/wx/src/generic/vlbox.cpp +++ b/Source/3rd Party/wx/src/generic/vlbox.cpp @@ -4,9 +4,9 @@ // Author: Vadim Zeitlin // Modified by: // Created: 31.05.03 -// RCS-ID: $Id$ +// RCS-ID: $Id: vlbox.cpp 53998 2008-06-06 22:55:23Z VZ $ // Copyright: (c) 2003 Vadim Zeitlin -// Licence: wxWindows licence +// License: wxWindows license /////////////////////////////////////////////////////////////////////////////// // ============================================================================ @@ -36,7 +36,6 @@ #include "wx/dcbuffer.h" #include "wx/selstore.h" -#include "wx/renderer.h" // ---------------------------------------------------------------------------- // event tables @@ -48,11 +47,6 @@ BEGIN_EVENT_TABLE(wxVListBox, wxVScrolledWindow) EVT_KEY_DOWN(wxVListBox::OnKeyDown) EVT_LEFT_DOWN(wxVListBox::OnLeftDown) EVT_LEFT_DCLICK(wxVListBox::OnLeftDClick) - - EVT_SET_FOCUS(wxVListBox::OnSetOrKillFocus) - EVT_KILL_FOCUS(wxVListBox::OnSetOrKillFocus) - - EVT_SIZE(wxVListBox::OnSize) END_EVENT_TABLE() // ============================================================================ @@ -60,7 +54,6 @@ END_EVENT_TABLE() // ============================================================================ IMPLEMENT_ABSTRACT_CLASS(wxVListBox, wxVScrolledWindow) -const char wxVListBoxNameStr[] = "wxVListBox"; // ---------------------------------------------------------------------------- // wxVListBox creation @@ -80,11 +73,6 @@ bool wxVListBox::Create(wxWindow *parent, long style, const wxString& name) { -#ifdef __WXMSW__ - if ( (style & wxBORDER_MASK) == wxDEFAULT ) - style |= wxBORDER_THEME; -#endif - style |= wxWANTS_CHARS | wxFULL_REPAINT_ON_RESIZE; if ( !wxVScrolledWindow::Create(parent, id, pos, size, style, name) ) return false; @@ -95,10 +83,7 @@ bool wxVListBox::Create(wxWindow *parent, // make sure the native widget has the right colour since we do // transparent drawing by default SetBackgroundColour(GetBackgroundColour()); - - // leave m_colBgSel in an invalid state: it means for OnDrawBackground() - // to use wxRendererNative instead of painting selection bg ourselves - m_colBgSel = wxNullColour; + m_colBgSel = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT); // flicker-free drawing requires this SetBackgroundStyle(wxBG_STYLE_CUSTOM); @@ -123,7 +108,7 @@ void wxVListBox::SetItemCount(size_t count) m_selStore->SetItemCount(count); } - SetRowCount(count); + SetLineCount(count); } // ---------------------------------------------------------------------------- @@ -138,16 +123,16 @@ bool wxVListBox::IsSelected(size_t line) const bool wxVListBox::Select(size_t item, bool select) { wxCHECK_MSG( m_selStore, false, - wxT("Select() may only be used with multiselection listbox") ); + _T("Select() may only be used with multiselection listbox") ); wxCHECK_MSG( item < GetItemCount(), false, - wxT("Select(): invalid item index") ); + _T("Select(): invalid item index") ); bool changed = m_selStore->SelectItem(item, select); if ( changed ) { // selection really changed - RefreshRow(item); + RefreshLine(item); } DoSetCurrent(item); @@ -158,7 +143,7 @@ bool wxVListBox::Select(size_t item, bool select) bool wxVListBox::SelectRange(size_t from, size_t to) { wxCHECK_MSG( m_selStore, false, - wxT("SelectRange() may only be used with multiselection listbox") ); + _T("SelectRange() may only be used with multiselection listbox") ); // make sure items are in correct order if ( from > to ) @@ -169,14 +154,14 @@ bool wxVListBox::SelectRange(size_t from, size_t to) } wxCHECK_MSG( to < GetItemCount(), false, - wxT("SelectRange(): invalid item index") ); + _T("SelectRange(): invalid item index") ); wxArrayInt changed; if ( !m_selStore->SelectRange(from, to, true, &changed) ) { // too many items have changed, we didn't record them in changed array // so we have no choice but to refresh everything between from and to - RefreshRows(from, to); + RefreshLines(from, to); } else // we've got the indices of the changed items { @@ -190,7 +175,7 @@ bool wxVListBox::SelectRange(size_t from, size_t to) // refresh just the lines which have really changed for ( size_t n = 0; n < count; n++ ) { - RefreshRow(changed[n]); + RefreshLine(changed[n]); } } @@ -201,7 +186,7 @@ bool wxVListBox::SelectRange(size_t from, size_t to) bool wxVListBox::DoSelectAll(bool select) { wxCHECK_MSG( m_selStore, false, - wxT("SelectAll may only be used with multiselection listbox") ); + _T("SelectAll may only be used with multiselection listbox") ); size_t count = GetItemCount(); if ( count ) @@ -224,7 +209,7 @@ bool wxVListBox::DoSetCurrent(int current) { wxASSERT_MSG( current == wxNOT_FOUND || (current >= 0 && (size_t)current < GetItemCount()), - wxT("wxVListBox::DoSetCurrent(): invalid item index") ); + _T("wxVListBox::DoSetCurrent(): invalid item index") ); if ( current == m_current ) { @@ -233,7 +218,7 @@ bool wxVListBox::DoSetCurrent(int current) } if ( m_current != wxNOT_FOUND ) - RefreshRow(m_current); + RefreshLine(m_current); m_current = current; @@ -243,40 +228,33 @@ bool wxVListBox::DoSetCurrent(int current) // don't need to refresh it -- it will be redrawn anyhow if ( !IsVisible(m_current) ) { - ScrollToRow(m_current); + ScrollToLine(m_current); } else // line is at least partly visible { // it is, indeed, only partly visible, so scroll it into view to // make it entirely visible - // BUT scrolling down when m_current is first visible makes it - // completely hidden, so that is even worse - while ( (size_t)m_current + 1 == GetVisibleRowsEnd() && - (size_t)m_current != GetVisibleRowsBegin() && - ScrollToRow(GetVisibleBegin() + 1) ) ; + while ( (size_t)m_current == GetLastVisibleLine() && + ScrollToLine(GetVisibleBegin()+1) ) ; // but in any case refresh it as even if it was only partly visible // before we need to redraw it entirely as its background changed - RefreshRow(m_current); + RefreshLine(m_current); } } return true; } -void wxVListBox::InitEvent(wxCommandEvent& event, int n) -{ - event.SetEventObject(this); - event.SetInt(n); -} - void wxVListBox::SendSelectedEvent() { wxASSERT_MSG( m_current != wxNOT_FOUND, - wxT("SendSelectedEvent() shouldn't be called") ); + _T("SendSelectedEvent() shouldn't be called") ); wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, GetId()); - InitEvent(event, m_current); + event.SetEventObject(this); + event.SetInt(m_current); + (void)GetEventHandler()->ProcessEvent(event); } @@ -284,7 +262,7 @@ void wxVListBox::SetSelection(int selection) { wxCHECK_RET( selection == wxNOT_FOUND || (selection >= 0 && (size_t)selection < GetItemCount()), - wxT("wxVListBox::SetSelection(): invalid item index") ); + _T("wxVListBox::SetSelection(): invalid item index") ); if ( HasMultipleSelection() ) { @@ -314,7 +292,7 @@ int wxVListBox::GetFirstSelected(unsigned long& cookie) const int wxVListBox::GetNextSelected(unsigned long& cookie) const { wxCHECK_MSG( m_selStore, wxNOT_FOUND, - wxT("GetFirst/NextSelected() may only be used with multiselection listboxes") ); + _T("GetFirst/NextSelected() may only be used with multiselection listboxes") ); while ( cookie < GetItemCount() ) { @@ -325,41 +303,6 @@ int wxVListBox::GetNextSelected(unsigned long& cookie) const return wxNOT_FOUND; } -void wxVListBox::RefreshSelected() -{ - // only refresh those items which are currently visible and selected: - for ( size_t n = GetVisibleBegin(), end = GetVisibleEnd(); n < end; n++ ) - { - if ( IsSelected(n) ) - RefreshRow(n); - } -} - -wxRect wxVListBox::GetItemRect(size_t n) const -{ - wxRect itemrect; - - // check that this item is visible - const size_t lineMax = GetVisibleEnd(); - if ( n >= lineMax ) - return itemrect; - size_t line = GetVisibleBegin(); - if ( n < line ) - return itemrect; - - while ( line <= n ) - { - itemrect.y += itemrect.height; - itemrect.height = OnGetRowHeight(line); - - line++; - } - - itemrect.width = GetClientSize().x; - - return itemrect; -} - // ---------------------------------------------------------------------------- // wxVListBox appearance parameters // ---------------------------------------------------------------------------- @@ -383,7 +326,7 @@ void wxVListBox::SetSelectionBackground(const wxColour& col) // wxVListBox painting // ---------------------------------------------------------------------------- -wxCoord wxVListBox::OnGetRowHeight(size_t line) const +wxCoord wxVListBox::OnGetLineHeight(size_t line) const { return OnMeasureItem(line) + 2*m_ptMargins.y; } @@ -394,15 +337,8 @@ void wxVListBox::OnDrawSeparator(wxDC& WXUNUSED(dc), { } -bool -wxVListBox::DoDrawSolidBackground(const wxColour& col, - wxDC& dc, - const wxRect& rect, - size_t n) const +void wxVListBox::OnDrawBackground(wxDC& dc, const wxRect& rect, size_t n) const { - if ( !col.IsOk() ) - return false; - // we need to render selected and current items differently const bool isSelected = IsSelected(n), isCurrent = IsCurrent(n); @@ -410,36 +346,18 @@ wxVListBox::DoDrawSolidBackground(const wxColour& col, { if ( isSelected ) { - dc.SetBrush(wxBrush(col, wxBRUSHSTYLE_SOLID)); + dc.SetBrush(wxBrush(m_colBgSel, wxSOLID)); } else // !selected { dc.SetBrush(*wxTRANSPARENT_BRUSH); } + dc.SetPen(*(isCurrent ? wxBLACK_PEN : wxTRANSPARENT_PEN)); + dc.DrawRectangle(rect); } //else: do nothing for the normal items - - return true; -} - -void wxVListBox::OnDrawBackground(wxDC& dc, const wxRect& rect, size_t n) const -{ - // use wxRendererNative for more native look unless we use custom bg colour - if ( !DoDrawSolidBackground(m_colBgSel, dc, rect, n) ) - { - int flags = 0; - if ( IsSelected(n) ) - flags |= wxCONTROL_SELECTED; - if ( IsCurrent(n) ) - flags |= wxCONTROL_CURRENT; - if ( wxWindow::FindFocus() == const_cast(this) ) - flags |= wxCONTROL_FOCUSED; - - wxRendererNative::Get().DrawItemSelectionRect( - const_cast(this), dc, rect, flags); - } } void wxVListBox::OnPaint(wxPaintEvent& WXUNUSED(event)) @@ -456,24 +374,24 @@ void wxVListBox::OnPaint(wxPaintEvent& WXUNUSED(event)) dc.Clear(); // the bounding rectangle of the current line - wxRect rectRow; - rectRow.width = clientSize.x; + wxRect rectLine; + rectLine.width = clientSize.x; // iterate over all visible lines const size_t lineMax = GetVisibleEnd(); - for ( size_t line = GetVisibleBegin(); line < lineMax; line++ ) + for ( size_t line = GetFirstVisibleLine(); line < lineMax; line++ ) { - const wxCoord hRow = OnGetRowHeight(line); + const wxCoord hLine = OnGetLineHeight(line); - rectRow.height = hRow; + rectLine.height = hLine; // and draw the ones which intersect the update rect - if ( rectRow.Intersects(rectUpdate) ) + if ( rectLine.Intersects(rectUpdate) ) { // don't allow drawing outside of the lines rectangle - wxDCClipper clip(dc, rectRow); + wxDCClipper clip(dc, rectLine); - wxRect rect = rectRow; + wxRect rect = rectLine; OnDrawBackground(dc, rect, line); OnDrawSeparator(dc, rect, line); @@ -483,7 +401,7 @@ void wxVListBox::OnPaint(wxPaintEvent& WXUNUSED(event)) } else // no intersection { - if ( rectRow.GetTop() > rectUpdate.GetBottom() ) + if ( rectLine.GetTop() > rectUpdate.GetBottom() ) { // we are already below the update rect, no need to continue // further @@ -492,24 +410,10 @@ void wxVListBox::OnPaint(wxPaintEvent& WXUNUSED(event)) //else: the next line may intersect the update rect } - rectRow.y += hRow; + rectLine.y += hLine; } } -void wxVListBox::OnSetOrKillFocus(wxFocusEvent& WXUNUSED(event)) -{ - // we need to repaint the selection when we get the focus since - // wxRendererNative in general draws the focused selection differently - // from the unfocused selection (see OnDrawItem): - RefreshSelected(); -} - -void wxVListBox::OnSize(wxSizeEvent& event) -{ - UpdateScrollbar(); - event.Skip(); -} - // ============================================================================ // wxVListBox keyboard/mouse handling // ============================================================================ @@ -608,27 +512,23 @@ void wxVListBox::OnKeyDown(wxKeyEvent& event) switch ( event.GetKeyCode() ) { case WXK_HOME: - case WXK_NUMPAD_HOME: current = 0; break; case WXK_END: - case WXK_NUMPAD_END: - current = GetRowCount() - 1; + current = GetLineCount() - 1; break; case WXK_DOWN: - case WXK_NUMPAD_DOWN: - if ( m_current == (int)GetRowCount() - 1 ) + if ( m_current == (int)GetLineCount() - 1 ) return; current = m_current + 1; break; case WXK_UP: - case WXK_NUMPAD_UP: if ( m_current == wxNOT_FOUND ) - current = GetRowCount() - 1; + current = GetLineCount() - 1; else if ( m_current != 0 ) current = m_current - 1; else // m_current == 0 @@ -636,19 +536,17 @@ void wxVListBox::OnKeyDown(wxKeyEvent& event) break; case WXK_PAGEDOWN: - case WXK_NUMPAD_PAGEDOWN: PageDown(); - current = GetVisibleBegin(); + current = GetFirstVisibleLine(); break; case WXK_PAGEUP: - case WXK_NUMPAD_PAGEUP: - if ( m_current == (int)GetVisibleBegin() ) + if ( m_current == (int)GetFirstVisibleLine() ) { PageUp(); } - current = GetVisibleBegin(); + current = GetFirstVisibleLine(); break; case WXK_SPACE: @@ -663,7 +561,13 @@ void wxVListBox::OnKeyDown(wxKeyEvent& event) case WXK_TAB: // Since we are using wxWANTS_CHARS we need to send navigation // events for the tabs on MSW - HandleAsNavigationKey(event); + { + wxNavigationKeyEvent ne; + ne.SetDirection(!event.ShiftDown()); + ne.SetCurrentFocus(this); + ne.SetEventObject(this); + GetParent()->GetEventHandler()->ProcessEvent(ne); + } // fall through to default #endif default: @@ -689,7 +593,7 @@ void wxVListBox::OnLeftDown(wxMouseEvent& event) { SetFocus(); - int item = VirtualHitTest(event.GetPosition().y); + int item = HitTest(event.GetPosition()); if ( item != wxNOT_FOUND ) { @@ -712,7 +616,7 @@ void wxVListBox::OnLeftDown(wxMouseEvent& event) void wxVListBox::OnLeftDClick(wxMouseEvent& eventMouse) { - int item = VirtualHitTest(eventMouse.GetPosition().y); + int item = HitTest(eventMouse.GetPosition()); if ( item != wxNOT_FOUND ) { @@ -721,7 +625,9 @@ void wxVListBox::OnLeftDClick(wxMouseEvent& eventMouse) if ( item == m_current ) { wxCommandEvent event(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, GetId()); - InitEvent(event, item); + event.SetEventObject(this); + event.SetInt(item); + (void)GetEventHandler()->ProcessEvent(event); } else diff --git a/Source/3rd Party/wx/src/generic/vscroll.cpp b/Source/3rd Party/wx/src/generic/vscroll.cpp index ce455b362..af47dca25 100644 --- a/Source/3rd Party/wx/src/generic/vscroll.cpp +++ b/Source/3rd Party/wx/src/generic/vscroll.cpp @@ -2,9 +2,9 @@ // Name: src/generic/vscroll.cpp // Purpose: wxVScrolledWindow implementation // Author: Vadim Zeitlin -// Modified by: Brad Anderson, David Warkentin +// Modified by: // Created: 30.05.03 -// RCS-ID: $Id$ +// RCS-ID: $Id: vscroll.cpp 57359 2008-12-15 19:09:31Z BP $ // Copyright: (c) 2003 Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -25,644 +25,405 @@ #endif #ifndef WX_PRECOMP - #include "wx/dc.h" #include "wx/sizer.h" #endif #include "wx/vscroll.h" -#include "wx/utils.h" // For wxMin/wxMax(). - -// ============================================================================ -// wxVarScrollHelperEvtHandler declaration -// ============================================================================ - // ---------------------------------------------------------------------------- -// wxScrollHelperEvtHandler: intercept the events from the window and forward -// them to wxVarScrollHelperBase +// event tables // ---------------------------------------------------------------------------- -class WXDLLEXPORT wxVarScrollHelperEvtHandler : public wxEvtHandler -{ -public: - wxVarScrollHelperEvtHandler(wxVarScrollHelperBase *scrollHelper) - { - m_scrollHelper = scrollHelper; - } - - virtual bool ProcessEvent(wxEvent& event); - -private: - wxVarScrollHelperBase *m_scrollHelper; - - wxDECLARE_NO_COPY_CLASS(wxVarScrollHelperEvtHandler); -}; - -// ============================================================================ -// wxVarScrollHelperEvtHandler implementation -// ============================================================================ - -bool wxVarScrollHelperEvtHandler::ProcessEvent(wxEvent& event) -{ - wxEventType evType = event.GetEventType(); - - // pass it on to the real handler - bool processed = wxEvtHandler::ProcessEvent(event); - - // always process the size events ourselves, even if the user code handles - // them as well, as we need to AdjustScrollbars() - // - // NB: it is important to do it after processing the event in the normal - // way as HandleOnSize() may generate a wxEVT_SIZE itself if the - // scrollbar[s] (dis)appear and it should be seen by the user code - // after this one - if ( evType == wxEVT_SIZE ) - { - m_scrollHelper->HandleOnSize((wxSizeEvent &)event); - - return !event.GetSkipped(); - } - - if ( processed ) - { - // normally, nothing more to do here - except if we have a command - // event - if ( event.IsCommandEvent() ) - { - return true; - } - } - - // reset the skipped flag (which might have been set to true in - // ProcessEvent() above) to be able to test it below - bool wasSkipped = event.GetSkipped(); - if ( wasSkipped ) - event.Skip(false); - - if ( evType == wxEVT_SCROLLWIN_TOP || - evType == wxEVT_SCROLLWIN_BOTTOM || - evType == wxEVT_SCROLLWIN_LINEUP || - evType == wxEVT_SCROLLWIN_LINEDOWN || - evType == wxEVT_SCROLLWIN_PAGEUP || - evType == wxEVT_SCROLLWIN_PAGEDOWN || - evType == wxEVT_SCROLLWIN_THUMBTRACK || - evType == wxEVT_SCROLLWIN_THUMBRELEASE ) - { - m_scrollHelper->HandleOnScroll((wxScrollWinEvent &)event); - if ( !event.GetSkipped() ) - { - // it makes sense to indicate that we processed the message as we - // did scroll the window (and also notice that wxAutoScrollTimer - // relies on our return value for continuous scrolling) - processed = true; - wasSkipped = false; - } - } +BEGIN_EVENT_TABLE(wxVScrolledWindow, wxPanel) + EVT_SIZE(wxVScrolledWindow::OnSize) + EVT_SCROLLWIN(wxVScrolledWindow::OnScroll) #if wxUSE_MOUSEWHEEL - else if ( evType == wxEVT_MOUSEWHEEL ) - { - m_scrollHelper->HandleOnMouseWheel((wxMouseEvent &)event); - } -#endif // wxUSE_MOUSEWHEEL - - event.Skip(wasSkipped); - - return processed; -} + EVT_MOUSEWHEEL(wxVScrolledWindow::OnMouseWheel) +#endif +END_EVENT_TABLE() // ============================================================================ -// wxVarScrollHelperBase implementation +// implementation // ============================================================================ +IMPLEMENT_ABSTRACT_CLASS(wxVScrolledWindow, wxPanel) + // ---------------------------------------------------------------------------- -// wxVarScrollHelperBase initialization +// initialization // ---------------------------------------------------------------------------- -wxVarScrollHelperBase::wxVarScrollHelperBase(wxWindow *win) +void wxVScrolledWindow::Init() { - wxASSERT_MSG( win, wxT("associated window can't be NULL in wxVarScrollHelperBase") ); + // we're initially empty + m_lineMax = + m_lineFirst = 0; + + // this one should always be strictly positive + m_nVisible = 1; + + m_heightTotal = 0; #if wxUSE_MOUSEWHEEL m_sumWheelRotation = 0; #endif - - m_unitMax = 0; - m_sizeTotal = 0; - m_unitFirst = 0; - - m_win = - m_targetWindow = NULL; - - m_physicalScrolling = true; - m_handler = NULL; - - m_win = win; - - // by default, the associated window is also the target window - DoSetTargetWindow(win); - -} - -wxVarScrollHelperBase::~wxVarScrollHelperBase() -{ - DeleteEvtHandler(); } // ---------------------------------------------------------------------------- -// wxVarScrollHelperBase various helpers +// various helpers // ---------------------------------------------------------------------------- -void -wxVarScrollHelperBase::AssignOrient(wxCoord& x, - wxCoord& y, - wxCoord first, - wxCoord second) -{ - if ( GetOrientation() == wxVERTICAL ) - { - x = first; - y = second; - } - else // horizontal - { - x = second; - y = first; - } -} - -void -wxVarScrollHelperBase::IncOrient(wxCoord& x, wxCoord& y, wxCoord inc) -{ - if ( GetOrientation() == wxVERTICAL ) - y += inc; - else - x += inc; -} - -wxCoord wxVarScrollHelperBase::DoEstimateTotalSize() const +wxCoord wxVScrolledWindow::EstimateTotalHeight() const { // estimate the total height: it is impossible to call - // OnGetUnitSize() for every unit because there may be too many of - // them, so we just make a guess using some units in the beginning, + // OnGetLineHeight() for every line because there may be too many of + // them, so we just make a guess using some lines in the beginning, // some in the end and some in the middle - static const size_t NUM_UNITS_TO_SAMPLE = 10; + static const size_t NUM_LINES_TO_SAMPLE = 10; - wxCoord sizeTotal; - if ( m_unitMax < 3*NUM_UNITS_TO_SAMPLE ) + wxCoord heightTotal; + if ( m_lineMax < 3*NUM_LINES_TO_SAMPLE ) { - // in this case, full calculations are faster and more correct than + // in this case calculating exactly is faster and more correct than // guessing - sizeTotal = GetUnitsSize(0, m_unitMax); + heightTotal = GetLinesHeight(0, m_lineMax); } - else // too many units to calculate exactly + else // too many lines to calculate exactly { - // look at some units in the beginning/middle/end - sizeTotal = - GetUnitsSize(0, NUM_UNITS_TO_SAMPLE) + - GetUnitsSize(m_unitMax - NUM_UNITS_TO_SAMPLE, - m_unitMax) + - GetUnitsSize(m_unitMax/2 - NUM_UNITS_TO_SAMPLE/2, - m_unitMax/2 + NUM_UNITS_TO_SAMPLE/2); + // look at some lines in the beginning/middle/end + heightTotal = + GetLinesHeight(0, NUM_LINES_TO_SAMPLE) + + GetLinesHeight(m_lineMax - NUM_LINES_TO_SAMPLE, m_lineMax) + + GetLinesHeight(m_lineMax/2 - NUM_LINES_TO_SAMPLE/2, + m_lineMax/2 + NUM_LINES_TO_SAMPLE/2); - // use the height of the units we looked as the average - sizeTotal = (wxCoord) - (((float)sizeTotal / (3*NUM_UNITS_TO_SAMPLE)) * m_unitMax); + // use the height of the lines we looked as the average + heightTotal = (wxCoord) + (((float)heightTotal / (3*NUM_LINES_TO_SAMPLE)) * m_lineMax); } - return sizeTotal; + return heightTotal; } -wxCoord wxVarScrollHelperBase::GetUnitsSize(size_t unitMin, size_t unitMax) const +wxCoord wxVScrolledWindow::GetLinesHeight(size_t lineMin, size_t lineMax) const { - if ( unitMin == unitMax ) + if ( lineMin == lineMax ) return 0; - else if ( unitMin > unitMax ) - return -GetUnitsSize(unitMax, unitMin); - //else: unitMin < unitMax + else if ( lineMin > lineMax ) + return -GetLinesHeight(lineMax, lineMin); + //else: lineMin < lineMax - // let the user code know that we're going to need all these units - OnGetUnitsSizeHint(unitMin, unitMax); + // let the user code know that we're going to need all these lines + OnGetLinesHint(lineMin, lineMax); - // sum up their sizes - wxCoord size = 0; - for ( size_t unit = unitMin; unit < unitMax; ++unit ) + // do sum up their heights + wxCoord height = 0; + for ( size_t line = lineMin; line < lineMax; line++ ) { - size += OnGetUnitSize(unit); + height += OnGetLineHeight(line); } - return size; + return height; } -size_t wxVarScrollHelperBase::FindFirstVisibleFromLast(size_t unitLast, bool full) const +size_t wxVScrolledWindow::FindFirstFromBottom(size_t lineLast, bool full) { - const wxCoord sWindow = GetOrientationTargetSize(); + const wxCoord hWindow = GetClientSize().y; - // go upwards until we arrive at a unit such that unitLast is not visible + // go upwards until we arrive at a line such that lineLast is not visible // any more when it is shown - size_t unitFirst = unitLast; - wxCoord s = 0; + size_t lineFirst = lineLast; + wxCoord h = 0; for ( ;; ) { - s += OnGetUnitSize(unitFirst); + h += OnGetLineHeight(lineFirst); - if ( s > sWindow ) + if ( h > hWindow ) { - // for this unit to be fully visible we need to go one unit + // for this line to be fully visible we need to go one line // down, but if it is enough for it to be only partly visible then - // this unit will do as well + // this line will do as well if ( full ) { - ++unitFirst; + lineFirst++; } break; } - if ( !unitFirst ) + if ( !lineFirst ) break; - --unitFirst; + lineFirst--; } - return unitFirst; + return lineFirst; } -size_t wxVarScrollHelperBase::GetNewScrollPosition(wxScrollWinEvent& event) const +void wxVScrolledWindow::RemoveScrollbar() { - wxEventType evtType = event.GetEventType(); - - if ( evtType == wxEVT_SCROLLWIN_TOP ) - { - return 0; - } - else if ( evtType == wxEVT_SCROLLWIN_BOTTOM ) - { - return m_unitMax; - } - else if ( evtType == wxEVT_SCROLLWIN_LINEUP ) - { - return m_unitFirst ? m_unitFirst - 1 : 0; - } - else if ( evtType == wxEVT_SCROLLWIN_LINEDOWN ) - { - return m_unitFirst + 1; - } - else if ( evtType == wxEVT_SCROLLWIN_PAGEUP ) - { - // Page up should do at least as much as line up. - return wxMin(FindFirstVisibleFromLast(m_unitFirst), - m_unitFirst ? m_unitFirst - 1 : 0); - } - else if ( evtType == wxEVT_SCROLLWIN_PAGEDOWN ) - { - // And page down should do at least as much as line down. - if ( GetVisibleEnd() ) - return wxMax(GetVisibleEnd() - 1, m_unitFirst + 1); - else - return wxMax(GetVisibleEnd(), m_unitFirst + 1); - } - else if ( evtType == wxEVT_SCROLLWIN_THUMBRELEASE ) - { - return event.GetPosition(); - } - else if ( evtType == wxEVT_SCROLLWIN_THUMBTRACK ) - { - return event.GetPosition(); - } - - // unknown scroll event? - wxFAIL_MSG( wxT("unknown scroll event type?") ); - return 0; + m_lineFirst = 0; + m_nVisible = m_lineMax; + SetScrollbar(wxVERTICAL, 0, 0, 0); } -void wxVarScrollHelperBase::UpdateScrollbar() +void wxVScrolledWindow::UpdateScrollbar() { - // if there is nothing to scroll, remove the scrollbar - if ( !m_unitMax ) - { - RemoveScrollbar(); - return; - } + // see how many lines can we fit on screen + const wxCoord hWindow = GetClientSize().y; - // see how many units can we fit on screen - const wxCoord sWindow = GetOrientationTargetSize(); - - // do vertical calculations - wxCoord s = 0; - size_t unit; - for ( unit = m_unitFirst; unit < m_unitMax; ++unit ) + wxCoord h = 0; + size_t line; + for ( line = m_lineFirst; line < m_lineMax; line++ ) { - if ( s > sWindow ) + if ( h > hWindow ) break; - s += OnGetUnitSize(unit); + h += OnGetLineHeight(line); } - m_nUnitsVisible = unit - m_unitFirst; - - int unitsPageSize = m_nUnitsVisible; - if ( s > sWindow ) + // if we still have remaining space below, maybe we can fit everything? + if ( h < hWindow ) { - // last unit is only partially visible, we still need the scrollbar and - // so we have to "fix" pageSize because if it is equal to m_unitMax - // the scrollbar is not shown at all under MSW - --unitsPageSize; + wxCoord hAll = h; + for ( size_t lineFirst = m_lineFirst; lineFirst > 0; lineFirst-- ) + { + hAll += OnGetLineHeight(m_lineFirst - 1); + if ( hAll > hWindow ) + break; + } + + if ( hAll < hWindow ) + { + // we don't need scrollbar at all + RemoveScrollbar(); + return; + } + } + + m_nVisible = line - m_lineFirst; + + int pageSize = m_nVisible; + if ( h > hWindow ) + { + // last line is only partially visible, we still need the scrollbar and + // so we have to "fix" pageSize because if it is equal to m_lineMax the + // scrollbar is not shown at all under MSW + pageSize--; } // set the scrollbar parameters to reflect this - m_win->SetScrollbar(GetOrientation(), m_unitFirst, unitsPageSize, m_unitMax); -} - -void wxVarScrollHelperBase::RemoveScrollbar() -{ - m_unitFirst = 0; - m_nUnitsVisible = m_unitMax; - m_win->SetScrollbar(GetOrientation(), 0, 0, 0); -} - -void wxVarScrollHelperBase::DeleteEvtHandler() -{ - // search for m_handler in the handler list - if ( m_win && m_handler ) - { - if ( m_win->RemoveEventHandler(m_handler) ) - { - delete m_handler; - } - //else: something is very wrong, so better [maybe] leak memory than - // risk a crash because of double deletion - - m_handler = NULL; - } -} - -void wxVarScrollHelperBase::DoSetTargetWindow(wxWindow *target) -{ - m_targetWindow = target; -#ifdef __WXMAC__ - target->MacSetClipChildren( true ) ; -#endif - - // install the event handler which will intercept the events we're - // interested in (but only do it for our real window, not the target window - // which we scroll - we don't need to hijack its events) - if ( m_targetWindow == m_win ) - { - // if we already have a handler, delete it first - DeleteEvtHandler(); - - m_handler = new wxVarScrollHelperEvtHandler(this); - m_targetWindow->PushEventHandler(m_handler); - } + SetScrollbar(wxVERTICAL, m_lineFirst, pageSize, m_lineMax); } // ---------------------------------------------------------------------------- -// wxVarScrollHelperBase operations +// operations // ---------------------------------------------------------------------------- -void wxVarScrollHelperBase::SetTargetWindow(wxWindow *target) +void wxVScrolledWindow::SetLineCount(size_t count) { - wxCHECK_RET( target, wxT("target window must not be NULL") ); - - if ( target == m_targetWindow ) - return; - - DoSetTargetWindow(target); -} - -void wxVarScrollHelperBase::SetUnitCount(size_t count) -{ - // save the number of units - m_unitMax = count; + // save the number of lines + m_lineMax = count; // and our estimate for their total height - m_sizeTotal = EstimateTotalSize(); + m_heightTotal = EstimateTotalHeight(); - // ScrollToUnit() will update the scrollbar itself if it changes the unit - // we pass to it because it's out of [new] range - size_t oldScrollPos = m_unitFirst; - DoScrollToUnit(m_unitFirst); - if ( oldScrollPos == m_unitFirst ) + // recalculate the scrollbars parameters + if ( count ) { - // but if it didn't do it, we still need to update the scrollbar to - // reflect the changed number of units ourselves - UpdateScrollbar(); + m_lineFirst = 1; // make sure it is != 0 + ScrollToLine(0); + } + else // no items + { + RemoveScrollbar(); } } -void wxVarScrollHelperBase::RefreshUnit(size_t unit) +void wxVScrolledWindow::RefreshLine(size_t line) { - // is this unit visible? - if ( !IsVisible(unit) ) + // is this line visible? + if ( !IsVisible(line) ) { // no, it is useless to do anything return; } - // calculate the rect occupied by this unit on screen + // calculate the rect occupied by this line on screen wxRect rect; - AssignOrient(rect.width, rect.height, - GetNonOrientationTargetSize(), OnGetUnitSize(unit)); - - for ( size_t n = GetVisibleBegin(); n < unit; ++n ) + rect.width = GetClientSize().x; + rect.height = OnGetLineHeight(line); + for ( size_t n = GetVisibleBegin(); n < line; n++ ) { - IncOrient(rect.x, rect.y, OnGetUnitSize(n)); + rect.y += OnGetLineHeight(n); } // do refresh it - m_targetWindow->RefreshRect(rect); + RefreshRect(rect); } -void wxVarScrollHelperBase::RefreshUnits(size_t from, size_t to) +void wxVScrolledWindow::RefreshLines(size_t from, size_t to) { - wxASSERT_MSG( from <= to, wxT("RefreshUnits(): empty range") ); + wxASSERT_MSG( from <= to, _T("RefreshLines(): empty range") ); - // clump the range to just the visible units -- it is useless to refresh + // clump the range to just the visible lines -- it is useless to refresh // the other ones if ( from < GetVisibleBegin() ) from = GetVisibleBegin(); - if ( to > GetVisibleEnd() ) + if ( to >= GetVisibleEnd() ) to = GetVisibleEnd(); + else + to++; - // calculate the rect occupied by these units on screen - int orient_size, nonorient_size, orient_pos; - orient_size = nonorient_size = orient_pos = 0; - - nonorient_size = GetNonOrientationTargetSize(); - - for ( size_t nBefore = GetVisibleBegin(); - nBefore < from; - nBefore++ ) - { - orient_pos += OnGetUnitSize(nBefore); - } - - for ( size_t nBetween = from; nBetween <= to; nBetween++ ) - { - orient_size += OnGetUnitSize(nBetween); - } - + // calculate the rect occupied by these lines on screen wxRect rect; - AssignOrient(rect.x, rect.y, 0, orient_pos); - AssignOrient(rect.width, rect.height, nonorient_size, orient_size); + rect.width = GetClientSize().x; + for ( size_t nBefore = GetVisibleBegin(); nBefore < from; nBefore++ ) + { + rect.y += OnGetLineHeight(nBefore); + } + + for ( size_t nBetween = from; nBetween < to; nBetween++ ) + { + rect.height += OnGetLineHeight(nBetween); + } // do refresh it - m_targetWindow->RefreshRect(rect); + RefreshRect(rect); } -void wxVarScrollHelperBase::RefreshAll() +void wxVScrolledWindow::RefreshAll() { UpdateScrollbar(); - m_targetWindow->Refresh(); + Refresh(); } -bool wxVarScrollHelperBase::ScrollLayout() +bool wxVScrolledWindow::Layout() { - if ( m_targetWindow->GetSizer() && m_physicalScrolling ) + if ( GetSizer() ) { // adjust the sizer dimensions/position taking into account the // virtual size and scrolled position of the window. - int x, y; - AssignOrient(x, y, 0, -GetScrollOffset()); + int w = 0, h = 0; + GetVirtualSize(&w, &h); - int w, h; - m_targetWindow->GetVirtualSize(&w, &h); + // x is always 0 so no variable needed + int y = -GetLinesHeight(0, GetFirstVisibleLine()); - m_targetWindow->GetSizer()->SetDimension(x, y, w, h); + GetSizer()->SetDimension(0, y, w, h); return true; } // fall back to default for LayoutConstraints - return m_targetWindow->wxWindow::Layout(); + return wxPanel::Layout(); } -int wxVarScrollHelperBase::VirtualHitTest(wxCoord coord) const +int wxVScrolledWindow::HitTest(wxCoord WXUNUSED(x), wxCoord y) const { - const size_t unitMax = GetVisibleEnd(); - for ( size_t unit = GetVisibleBegin(); unit < unitMax; ++unit ) + const size_t lineMax = GetVisibleEnd(); + for ( size_t line = GetVisibleBegin(); line < lineMax; line++ ) { - coord -= OnGetUnitSize(unit); - if ( coord < 0 ) - return unit; + y -= OnGetLineHeight(line); + if ( y < 0 ) + return line; } return wxNOT_FOUND; } // ---------------------------------------------------------------------------- -// wxVarScrollHelperBase scrolling +// scrolling // ---------------------------------------------------------------------------- -bool wxVarScrollHelperBase::DoScrollToUnit(size_t unit) +bool wxVScrolledWindow::ScrollToLine(size_t line) { - if ( !m_unitMax ) + if ( !m_lineMax ) { // we're empty, code below doesn't make sense in this case return false; } - // determine the real first unit to scroll to: we shouldn't scroll beyond + // determine the real first line to scroll to: we shouldn't scroll beyond // the end - size_t unitFirstLast = FindFirstVisibleFromLast(m_unitMax - 1, true); - if ( unit > unitFirstLast ) - unit = unitFirstLast; + size_t lineFirstLast = FindFirstFromBottom(m_lineMax - 1, true); + if ( line > lineFirstLast ) + line = lineFirstLast; // anything to do? - if ( unit == m_unitFirst ) + if ( line == m_lineFirst ) { // no return false; } - // remember the currently shown units for the refresh code below - size_t unitFirstOld = GetVisibleBegin(), - unitLastOld = GetVisibleEnd(); + // remember the currently shown lines for the refresh code below + size_t lineFirstOld = GetVisibleBegin(), + lineLastOld = GetVisibleEnd(); - m_unitFirst = unit; + m_lineFirst = line; // the size of scrollbar thumb could have changed UpdateScrollbar(); - // finally refresh the display -- but only redraw as few units as possible - // to avoid flicker. We can't do this if we have children because they - // won't be scrolled - if ( m_targetWindow->GetChildren().empty() && - (GetVisibleBegin() >= unitLastOld || GetVisibleEnd() <= unitFirstOld) ) + + // finally refresh the display -- but only redraw as few lines as possible + // to avoid flicker + if ( GetChildren().empty() && + (GetVisibleBegin() >= lineLastOld || GetVisibleEnd() <= lineFirstOld ) ) { - // the simplest case: we don't have any old units left, just redraw + // the simplest case: we don't have any old lines left, just redraw // everything - m_targetWindow->Refresh(); + Refresh(); } - else // scroll the window + else // overlap between the lines we showed before and should show now { // Avoid scrolling visible parts of the screen on Mac #ifdef __WXMAC__ - if (m_physicalScrolling && m_targetWindow->IsShownOnScreen()) -#else - if ( m_physicalScrolling ) + if (!IsShownOnScreen()) + Refresh(); + else #endif - { - wxCoord dx = 0, - dy = GetUnitsSize(GetVisibleBegin(), unitFirstOld); - - if ( GetOrientation() == wxHORIZONTAL ) - { - wxCoord tmp = dx; - dx = dy; - dy = tmp; - } - - m_targetWindow->ScrollWindow(dx, dy); - } - else // !m_physicalScrolling - { - // we still need to invalidate but we can't use ScrollWindow - // because physical scrolling is disabled (the user either didn't - // want children scrolled and/or doesn't want pixels to be - // physically scrolled). - m_targetWindow->Refresh(); - } + ScrollWindow(0, GetLinesHeight(GetVisibleBegin(), lineFirstOld)); } return true; } -bool wxVarScrollHelperBase::DoScrollUnits(int units) +bool wxVScrolledWindow::ScrollLines(int lines) { - units += m_unitFirst; - if ( units < 0 ) - units = 0; + lines += m_lineFirst; + if ( lines < 0 ) + lines = 0; - return DoScrollToUnit(units); + return ScrollToLine(lines); } -bool wxVarScrollHelperBase::DoScrollPages(int pages) +bool wxVScrolledWindow::ScrollPages(int pages) { bool didSomething = false; while ( pages ) { - int unit; + int line; if ( pages > 0 ) { - unit = GetVisibleEnd(); - if ( unit ) - --unit; - --pages; + line = GetVisibleEnd(); + if ( line ) + line--; + pages--; } else // pages < 0 { - unit = FindFirstVisibleFromLast(GetVisibleEnd()); - ++pages; + line = FindFirstFromBottom(GetVisibleBegin()); + pages++; } - didSomething = DoScrollToUnit(unit); + didSomething = ScrollToLine(line); } return didSomething; @@ -672,94 +433,71 @@ bool wxVarScrollHelperBase::DoScrollPages(int pages) // event handling // ---------------------------------------------------------------------------- -void wxVarScrollHelperBase::HandleOnSize(wxSizeEvent& event) +void wxVScrolledWindow::OnSize(wxSizeEvent& event) { - if ( m_unitMax ) - { - // sometimes change in varscrollable window's size can result in - // unused empty space after the last item. Fix it by decrementing - // first visible item position according to the available space. - - // determine free space - const wxCoord sWindow = GetOrientationTargetSize(); - wxCoord s = 0; - size_t unit; - for ( unit = m_unitFirst; unit < m_unitMax; ++unit ) - { - if ( s > sWindow ) - break; - - s += OnGetUnitSize(unit); - } - wxCoord freeSpace = sWindow - s; - - // decrement first visible item index as long as there is free space - size_t idealUnitFirst; - for ( idealUnitFirst = m_unitFirst; - idealUnitFirst > 0; - idealUnitFirst-- ) - { - wxCoord us = OnGetUnitSize(idealUnitFirst-1); - if ( freeSpace < us ) - break; - freeSpace -= us; - } - m_unitFirst = idealUnitFirst; - } - UpdateScrollbar(); event.Skip(); } -void wxVarScrollHelperBase::HandleOnScroll(wxScrollWinEvent& event) +void wxVScrolledWindow::OnScroll(wxScrollWinEvent& event) { - if (GetOrientation() != event.GetOrientation()) + size_t lineFirstNew; + + const wxEventType evtType = event.GetEventType(); + + if ( evtType == wxEVT_SCROLLWIN_TOP ) { - event.Skip(); + lineFirstNew = 0; + } + else if ( evtType == wxEVT_SCROLLWIN_BOTTOM ) + { + lineFirstNew = m_lineMax; + } + else if ( evtType == wxEVT_SCROLLWIN_LINEUP ) + { + lineFirstNew = m_lineFirst ? m_lineFirst - 1 : 0; + } + else if ( evtType == wxEVT_SCROLLWIN_LINEDOWN ) + { + lineFirstNew = m_lineFirst + 1; + } + else if ( evtType == wxEVT_SCROLLWIN_PAGEUP ) + { + lineFirstNew = FindFirstFromBottom(m_lineFirst); + } + else if ( evtType == wxEVT_SCROLLWIN_PAGEDOWN ) + { + lineFirstNew = GetVisibleEnd(); + if ( lineFirstNew ) + lineFirstNew--; + } + else if ( evtType == wxEVT_SCROLLWIN_THUMBRELEASE ) + { + lineFirstNew = event.GetPosition(); + } + else if ( evtType == wxEVT_SCROLLWIN_THUMBTRACK ) + { + lineFirstNew = event.GetPosition(); + } + + else // unknown scroll event? + { + wxFAIL_MSG( _T("unknown scroll event type?") ); return; } - DoScrollToUnit(GetNewScrollPosition(event)); + ScrollToLine(lineFirstNew); #ifdef __WXMAC__ - UpdateMacScrollWindow(); + Update(); #endif // __WXMAC__ } -void wxVarScrollHelperBase::DoPrepareDC(wxDC& dc) -{ - if ( m_physicalScrolling ) - { - wxPoint pt = dc.GetDeviceOrigin(); - - IncOrient(pt.x, pt.y, -GetScrollOffset()); - - dc.SetDeviceOrigin(pt.x, pt.y); - } -} - -int wxVarScrollHelperBase::DoCalcScrolledPosition(int coord) const -{ - return coord - GetScrollOffset(); -} - -int wxVarScrollHelperBase::DoCalcUnscrolledPosition(int coord) const -{ - return coord + GetScrollOffset(); -} - #if wxUSE_MOUSEWHEEL -void wxVarScrollHelperBase::HandleOnMouseWheel(wxMouseEvent& event) +void wxVScrolledWindow::OnMouseWheel(wxMouseEvent& event) { - // we only want to process wheel events for vertical implementations. - // There is no way to determine wheel orientation (and on MSW horizontal - // wheel rotation just fakes scroll events, rather than sending a MOUSEWHEEL - // event). - if ( GetOrientation() != wxVERTICAL ) - return; - m_sumWheelRotation += event.GetWheelRotation(); int delta = event.GetWheelDelta(); @@ -771,251 +509,11 @@ void wxVarScrollHelperBase::HandleOnMouseWheel(wxMouseEvent& event) m_sumWheelRotation += units_to_scroll*delta; if ( !event.IsPageScroll() ) - DoScrollUnits( units_to_scroll*event.GetLinesPerAction() ); - else // scroll pages instead of units - DoScrollPages( units_to_scroll ); + ScrollLines( units_to_scroll*event.GetLinesPerAction() ); + else + // scroll pages instead of lines + ScrollPages( units_to_scroll ); } #endif // wxUSE_MOUSEWHEEL - -// ============================================================================ -// wxVarHVScrollHelper implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxVarHVScrollHelper operations -// ---------------------------------------------------------------------------- - -void wxVarHVScrollHelper::SetRowColumnCount(size_t rowCount, size_t columnCount) -{ - SetRowCount(rowCount); - SetColumnCount(columnCount); -} - -bool wxVarHVScrollHelper::ScrollToRowColumn(size_t row, size_t column) -{ - bool result = false; - result |= ScrollToRow(row); - result |= ScrollToColumn(column); - return result; -} - -void wxVarHVScrollHelper::RefreshRowColumn(size_t row, size_t column) -{ - // is this unit visible? - if ( !IsRowVisible(row) || !IsColumnVisible(column) ) - { - // no, it is useless to do anything - return; - } - - // calculate the rect occupied by this cell on screen - wxRect v_rect, h_rect; - v_rect.height = OnGetRowHeight(row); - h_rect.width = OnGetColumnWidth(column); - - size_t n; - - for ( n = GetVisibleRowsBegin(); n < row; n++ ) - { - v_rect.y += OnGetRowHeight(n); - } - - for ( n = GetVisibleColumnsBegin(); n < column; n++ ) - { - h_rect.x += OnGetColumnWidth(n); - } - - // refresh but specialize the behaviour if we have a single target window - if ( wxVarVScrollHelper::GetTargetWindow() == wxVarHScrollHelper::GetTargetWindow() ) - { - v_rect.x = h_rect.x; - v_rect.width = h_rect.width; - wxVarVScrollHelper::GetTargetWindow()->RefreshRect(v_rect); - } - else - { - v_rect.x = 0; - v_rect.width = wxVarVScrollHelper::GetNonOrientationTargetSize(); - h_rect.y = 0; - h_rect.width = wxVarHScrollHelper::GetNonOrientationTargetSize(); - - wxVarVScrollHelper::GetTargetWindow()->RefreshRect(v_rect); - wxVarHScrollHelper::GetTargetWindow()->RefreshRect(h_rect); - } -} - -void wxVarHVScrollHelper::RefreshRowsColumns(size_t fromRow, size_t toRow, - size_t fromColumn, size_t toColumn) -{ - wxASSERT_MSG( fromRow <= toRow || fromColumn <= toColumn, - wxT("RefreshRowsColumns(): empty range") ); - - // clump the range to just the visible units -- it is useless to refresh - // the other ones - if ( fromRow < GetVisibleRowsBegin() ) - fromRow = GetVisibleRowsBegin(); - - if ( toRow > GetVisibleRowsEnd() ) - toRow = GetVisibleRowsEnd(); - - if ( fromColumn < GetVisibleColumnsBegin() ) - fromColumn = GetVisibleColumnsBegin(); - - if ( toColumn > GetVisibleColumnsEnd() ) - toColumn = GetVisibleColumnsEnd(); - - // calculate the rect occupied by these units on screen - wxRect v_rect, h_rect; - size_t nBefore, nBetween; - - for ( nBefore = GetVisibleRowsBegin(); - nBefore < fromRow; - nBefore++ ) - { - v_rect.y += OnGetRowHeight(nBefore); - } - - for ( nBetween = fromRow; nBetween <= toRow; nBetween++ ) - { - v_rect.height += OnGetRowHeight(nBetween); - } - - for ( nBefore = GetVisibleColumnsBegin(); - nBefore < fromColumn; - nBefore++ ) - { - h_rect.x += OnGetColumnWidth(nBefore); - } - - for ( nBetween = fromColumn; nBetween <= toColumn; nBetween++ ) - { - h_rect.width += OnGetColumnWidth(nBetween); - } - - // refresh but specialize the behaviour if we have a single target window - if ( wxVarVScrollHelper::GetTargetWindow() == wxVarHScrollHelper::GetTargetWindow() ) - { - v_rect.x = h_rect.x; - v_rect.width = h_rect.width; - wxVarVScrollHelper::GetTargetWindow()->RefreshRect(v_rect); - } - else - { - v_rect.x = 0; - v_rect.width = wxVarVScrollHelper::GetNonOrientationTargetSize(); - h_rect.y = 0; - h_rect.width = wxVarHScrollHelper::GetNonOrientationTargetSize(); - - wxVarVScrollHelper::GetTargetWindow()->RefreshRect(v_rect); - wxVarHScrollHelper::GetTargetWindow()->RefreshRect(h_rect); - } -} - -wxPosition wxVarHVScrollHelper::VirtualHitTest(wxCoord x, wxCoord y) const -{ - return wxPosition(wxVarVScrollHelper::VirtualHitTest(y), - wxVarHScrollHelper::VirtualHitTest(x)); -} - -void wxVarHVScrollHelper::DoPrepareDC(wxDC& dc) -{ - wxVarVScrollHelper::DoPrepareDC(dc); - wxVarHScrollHelper::DoPrepareDC(dc); -} - -bool wxVarHVScrollHelper::ScrollLayout() -{ - bool layout_result = false; - layout_result |= wxVarVScrollHelper::ScrollLayout(); - layout_result |= wxVarHScrollHelper::ScrollLayout(); - return layout_result; -} - -wxSize wxVarHVScrollHelper::GetRowColumnCount() const -{ - return wxSize(GetColumnCount(), GetRowCount()); -} - -wxPosition wxVarHVScrollHelper::GetVisibleBegin() const -{ - return wxPosition(GetVisibleRowsBegin(), GetVisibleColumnsBegin()); -} - -wxPosition wxVarHVScrollHelper::GetVisibleEnd() const -{ - return wxPosition(GetVisibleRowsEnd(), GetVisibleColumnsEnd()); -} - -bool wxVarHVScrollHelper::IsVisible(size_t row, size_t column) const -{ - return IsRowVisible(row) && IsColumnVisible(column); -} - - -// ============================================================================ -// wx[V/H/HV]ScrolledWindow implementations -// ============================================================================ - -IMPLEMENT_ABSTRACT_CLASS(wxVScrolledWindow, wxPanel) -IMPLEMENT_ABSTRACT_CLASS(wxHScrolledWindow, wxPanel) -IMPLEMENT_ABSTRACT_CLASS(wxHVScrolledWindow, wxPanel) - - -#if WXWIN_COMPATIBILITY_2_8 - -// =========================================================================== -// wxVarVScrollLegacyAdaptor -// =========================================================================== - -size_t wxVarVScrollLegacyAdaptor::GetFirstVisibleLine() const -{ return GetVisibleRowsBegin(); } - -size_t wxVarVScrollLegacyAdaptor::GetLastVisibleLine() const -{ return GetVisibleRowsEnd() - 1; } - -size_t wxVarVScrollLegacyAdaptor::GetLineCount() const -{ return GetRowCount(); } - -void wxVarVScrollLegacyAdaptor::SetLineCount(size_t count) -{ SetRowCount(count); } - -void wxVarVScrollLegacyAdaptor::RefreshLine(size_t line) -{ RefreshRow(line); } - -void wxVarVScrollLegacyAdaptor::RefreshLines(size_t from, size_t to) -{ RefreshRows(from, to); } - -bool wxVarVScrollLegacyAdaptor::ScrollToLine(size_t line) -{ return ScrollToRow(line); } - -bool wxVarVScrollLegacyAdaptor::ScrollLines(int lines) -{ return ScrollRows(lines); } - -bool wxVarVScrollLegacyAdaptor::ScrollPages(int pages) -{ return ScrollRowPages(pages); } - -wxCoord wxVarVScrollLegacyAdaptor::OnGetLineHeight(size_t WXUNUSED(n)) const -{ - wxFAIL_MSG( wxT("OnGetLineHeight() must be overridden if OnGetRowHeight() isn't!") ); - return -1; -} - -void wxVarVScrollLegacyAdaptor::OnGetLinesHint(size_t WXUNUSED(lineMin), - size_t WXUNUSED(lineMax)) const -{ -} - -wxCoord wxVarVScrollLegacyAdaptor::OnGetRowHeight(size_t n) const -{ - return OnGetLineHeight(n); -} - -void wxVarVScrollLegacyAdaptor::OnGetRowsHeightHint(size_t rowMin, - size_t rowMax) const -{ - OnGetLinesHint(rowMin, rowMax); -} - -#endif // WXWIN_COMPATIBILITY_2_8 diff --git a/Source/3rd Party/wx/src/msw/accel.cpp b/Source/3rd Party/wx/src/msw/accel.cpp index 5acfc4b44..465ee8c30 100644 --- a/Source/3rd Party/wx/src/msw/accel.cpp +++ b/Source/3rd Party/wx/src/msw/accel.cpp @@ -1,10 +1,10 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: src/msw/accel.cpp +// Name: msw/accel.cpp // Purpose: wxAcceleratorTable // Author: Julian Smart // Modified by: // Created: 04/01/98 -// RCS-ID: $Id$ +// RCS-ID: $Id: accel.cpp 56049 2008-10-03 12:13:21Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -33,7 +33,8 @@ #include "wx/accel.h" #include "wx/msw/private.h" -#include "wx/msw/private/keyboard.h" + +extern WXWORD wxCharCodeWXToMSW(int id, bool *isVirtual); IMPLEMENT_DYNAMIC_CLASS(wxAcceleratorTable, wxObject) @@ -53,7 +54,7 @@ protected: HACCEL m_hAccel; bool m_ok; - wxDECLARE_NO_COPY_CLASS(wxAcceleratorRefData); + DECLARE_NO_COPY_CLASS(wxAcceleratorRefData) }; // ============================================================================ @@ -89,7 +90,7 @@ wxAcceleratorTable::wxAcceleratorTable(const wxString& resource) { m_refData = new wxAcceleratorRefData; - HACCEL hAccel = ::LoadAccelerators(wxGetInstance(), resource.t_str()); + HACCEL hAccel = ::LoadAccelerators(wxGetInstance(), resource); M_ACCELDATA->m_hAccel = hAccel; M_ACCELDATA->m_ok = hAccel != 0; } @@ -104,15 +105,19 @@ wxAcceleratorTable::wxAcceleratorTable(int n, const wxAcceleratorEntry entries[] { int flags = entries[i].GetFlags(); - BYTE fVirt = FVIRTKEY; + BYTE fVirt = 0; if ( flags & wxACCEL_ALT ) - fVirt |= FALT; + fVirt |= FALT | FVIRTKEY; if ( flags & wxACCEL_SHIFT ) - fVirt |= FSHIFT; + fVirt |= FSHIFT | FVIRTKEY; if ( flags & wxACCEL_CTRL ) - fVirt |= FCONTROL; + fVirt |= FCONTROL | FVIRTKEY; - WORD key = wxMSWKeyboard::WXToVK(entries[i].GetKeyCode()); + bool isVirtual; + + WORD key = wxCharCodeWXToMSW(entries[i].GetKeyCode(), &isVirtual); + if (isVirtual) + fVirt |= FVIRTKEY; arr[i].fVirt = fVirt; arr[i].key = key; @@ -148,7 +153,7 @@ WXHACCEL wxAcceleratorTable::GetHACCEL() const bool wxAcceleratorTable::Translate(wxWindow *window, WXMSG *wxmsg) const { MSG *msg = (MSG *)wxmsg; - return IsOk() && ::TranslateAccelerator(GetHwndOf(window), GetHaccel(), msg); + return Ok() && ::TranslateAccelerator(GetHwndOf(window), GetHaccel(), msg); } #endif // wxUSE_ACCEL diff --git a/Source/3rd Party/wx/src/msw/anybutton.cpp b/Source/3rd Party/wx/src/msw/anybutton.cpp deleted file mode 100644 index d851d4cd8..000000000 --- a/Source/3rd Party/wx/src/msw/anybutton.cpp +++ /dev/null @@ -1,1244 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/msw/anybutton.cpp -// Purpose: wxAnyButton -// Author: Julian Smart -// Created: 1998-01-04 (extracted from button.cpp) -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#ifdef wxHAS_ANY_BUTTON - -#include "wx/anybutton.h" - -#ifndef WX_PRECOMP - #include "wx/app.h" - #include "wx/brush.h" - #include "wx/panel.h" - #include "wx/bmpbuttn.h" - #include "wx/settings.h" - #include "wx/dcscreen.h" - #include "wx/dcclient.h" - #include "wx/toplevel.h" - #include "wx/msw/wrapcctl.h" - #include "wx/msw/private.h" - #include "wx/msw/missing.h" -#endif - -#include "wx/imaglist.h" -#include "wx/stockitem.h" -#include "wx/msw/private/button.h" -#include "wx/msw/private/dc.h" -#include "wx/private/window.h" - -#if wxUSE_MARKUP - #include "wx/generic/private/markuptext.h" -#endif // wxUSE_MARKUP - -using namespace wxMSWImpl; - -#if wxUSE_UXTHEME - #include "wx/msw/uxtheme.h" - - // no need to include tmschema.h - #ifndef BP_PUSHBUTTON - #define BP_PUSHBUTTON 1 - - #define PBS_NORMAL 1 - #define PBS_HOT 2 - #define PBS_PRESSED 3 - #define PBS_DISABLED 4 - #define PBS_DEFAULTED 5 - - #define TMT_CONTENTMARGINS 3602 - #endif - - // provide the necessary declarations ourselves if they're missing from - // headers - #ifndef BCM_SETIMAGELIST - #define BCM_SETIMAGELIST 0x1602 - #define BCM_SETTEXTMARGIN 0x1604 - - enum - { - BUTTON_IMAGELIST_ALIGN_LEFT, - BUTTON_IMAGELIST_ALIGN_RIGHT, - BUTTON_IMAGELIST_ALIGN_TOP, - BUTTON_IMAGELIST_ALIGN_BOTTOM - }; - - struct BUTTON_IMAGELIST - { - HIMAGELIST himl; - RECT margin; - UINT uAlign; - }; - #endif -#endif // wxUSE_UXTHEME - -#ifndef WM_THEMECHANGED - #define WM_THEMECHANGED 0x031A -#endif - -#ifndef ODS_NOACCEL - #define ODS_NOACCEL 0x0100 -#endif - -#ifndef ODS_NOFOCUSRECT - #define ODS_NOFOCUSRECT 0x0200 -#endif - -#ifndef DT_HIDEPREFIX - #define DT_HIDEPREFIX 0x00100000 -#endif - -#if wxUSE_UXTHEME -extern wxWindowMSW *wxWindowBeingErased; // From src/msw/window.cpp -#endif // wxUSE_UXTHEME - -// ---------------------------------------------------------------------------- -// button image data -// ---------------------------------------------------------------------------- - -// we use different data classes for owner drawn buttons and for themed XP ones - -class wxButtonImageData -{ -public: - wxButtonImageData() { } - virtual ~wxButtonImageData() { } - - virtual wxBitmap GetBitmap(wxAnyButton::State which) const = 0; - virtual void SetBitmap(const wxBitmap& bitmap, wxAnyButton::State which) = 0; - - virtual wxSize GetBitmapMargins() const = 0; - virtual void SetBitmapMargins(wxCoord x, wxCoord y) = 0; - - virtual wxDirection GetBitmapPosition() const = 0; - virtual void SetBitmapPosition(wxDirection dir) = 0; - -private: - wxDECLARE_NO_COPY_CLASS(wxButtonImageData); -}; - -namespace -{ - -// the gap between button edge and the interior area used by Windows for the -// standard buttons -const int OD_BUTTON_MARGIN = 4; - -class wxODButtonImageData : public wxButtonImageData -{ -public: - wxODButtonImageData(wxAnyButton *btn, const wxBitmap& bitmap) - { - SetBitmap(bitmap, wxAnyButton::State_Normal); - SetBitmap(bitmap.ConvertToDisabled(), wxAnyButton::State_Disabled); - - m_dir = wxLEFT; - - // we use margins when we have both bitmap and text, but when we have - // only the bitmap it should take up the entire button area - if ( btn->ShowsLabel() ) - { - m_margin.x = btn->GetCharWidth(); - m_margin.y = btn->GetCharHeight() / 2; - } - } - - virtual wxBitmap GetBitmap(wxAnyButton::State which) const - { - return m_bitmaps[which]; - } - - virtual void SetBitmap(const wxBitmap& bitmap, wxAnyButton::State which) - { - m_bitmaps[which] = bitmap; - } - - virtual wxSize GetBitmapMargins() const - { - return m_margin; - } - - virtual void SetBitmapMargins(wxCoord x, wxCoord y) - { - m_margin = wxSize(x, y); - } - - virtual wxDirection GetBitmapPosition() const - { - return m_dir; - } - - virtual void SetBitmapPosition(wxDirection dir) - { - m_dir = dir; - } - -private: - // just store the values passed to us to be able to retrieve them later - // from the drawing code - wxBitmap m_bitmaps[wxAnyButton::State_Max]; - wxSize m_margin; - wxDirection m_dir; - - wxDECLARE_NO_COPY_CLASS(wxODButtonImageData); -}; - -#if wxUSE_UXTHEME - -// somehow the margin is one pixel greater than the value returned by -// GetThemeMargins() call -const int XP_BUTTON_EXTRA_MARGIN = 1; - -class wxXPButtonImageData : public wxButtonImageData -{ -public: - // we must be constructed with the size of our images as we need to create - // the image list - wxXPButtonImageData(wxAnyButton *btn, const wxBitmap& bitmap) - : m_iml(bitmap.GetWidth(), bitmap.GetHeight(), true /* use mask */, - wxAnyButton::State_Max), - m_hwndBtn(GetHwndOf(btn)) - { - // initialize all bitmaps except for the disabled one to normal state - for ( int n = 0; n < wxAnyButton::State_Max; n++ ) - { - m_iml.Add(n == wxAnyButton::State_Disabled ? bitmap.ConvertToDisabled() - : bitmap); - } - - m_data.himl = GetHimagelistOf(&m_iml); - - // no margins by default - m_data.margin.left = - m_data.margin.right = - m_data.margin.top = - m_data.margin.bottom = 0; - - // use default alignment - m_data.uAlign = BUTTON_IMAGELIST_ALIGN_LEFT; - - UpdateImageInfo(); - } - - virtual wxBitmap GetBitmap(wxAnyButton::State which) const - { - return m_iml.GetBitmap(which); - } - - virtual void SetBitmap(const wxBitmap& bitmap, wxAnyButton::State which) - { - m_iml.Replace(which, bitmap); - - UpdateImageInfo(); - } - - virtual wxSize GetBitmapMargins() const - { - return wxSize(m_data.margin.left, m_data.margin.top); - } - - virtual void SetBitmapMargins(wxCoord x, wxCoord y) - { - RECT& margin = m_data.margin; - margin.left = - margin.right = x; - margin.top = - margin.bottom = y; - - if ( !::SendMessage(m_hwndBtn, BCM_SETTEXTMARGIN, 0, (LPARAM)&margin) ) - { - wxLogDebug("SendMessage(BCM_SETTEXTMARGIN) failed"); - } - } - - virtual wxDirection GetBitmapPosition() const - { - switch ( m_data.uAlign ) - { - default: - wxFAIL_MSG( "invalid image alignment" ); - // fall through - - case BUTTON_IMAGELIST_ALIGN_LEFT: - return wxLEFT; - - case BUTTON_IMAGELIST_ALIGN_RIGHT: - return wxRIGHT; - - case BUTTON_IMAGELIST_ALIGN_TOP: - return wxTOP; - - case BUTTON_IMAGELIST_ALIGN_BOTTOM: - return wxBOTTOM; - } - } - - virtual void SetBitmapPosition(wxDirection dir) - { - UINT alignNew; - switch ( dir ) - { - default: - wxFAIL_MSG( "invalid direction" ); - // fall through - - case wxLEFT: - alignNew = BUTTON_IMAGELIST_ALIGN_LEFT; - break; - - case wxRIGHT: - alignNew = BUTTON_IMAGELIST_ALIGN_RIGHT; - break; - - case wxTOP: - alignNew = BUTTON_IMAGELIST_ALIGN_TOP; - break; - - case wxBOTTOM: - alignNew = BUTTON_IMAGELIST_ALIGN_BOTTOM; - break; - } - - if ( alignNew != m_data.uAlign ) - { - m_data.uAlign = alignNew; - UpdateImageInfo(); - } - } - -private: - void UpdateImageInfo() - { - if ( !::SendMessage(m_hwndBtn, BCM_SETIMAGELIST, 0, (LPARAM)&m_data) ) - { - wxLogDebug("SendMessage(BCM_SETIMAGELIST) failed"); - } - } - - // we store image list separately to be able to use convenient wxImageList - // methods instead of working with raw HIMAGELIST - wxImageList m_iml; - - // store the rest of the data in BCM_SETIMAGELIST-friendly form - BUTTON_IMAGELIST m_data; - - // the button we're associated with - const HWND m_hwndBtn; - - - wxDECLARE_NO_COPY_CLASS(wxXPButtonImageData); -}; - -#endif // wxUSE_UXTHEME - -} // anonymous namespace - -// ---------------------------------------------------------------------------- -// macros -// ---------------------------------------------------------------------------- - -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// helper functions from wx/msw/private/button.h -// ---------------------------------------------------------------------------- - -void wxMSWButton::UpdateMultilineStyle(HWND hwnd, const wxString& label) -{ - // update BS_MULTILINE style depending on the new label (resetting it - // doesn't seem to do anything very useful but it shouldn't hurt and we do - // have to set it whenever the label becomes multi line as otherwise it - // wouldn't be shown correctly as we don't use BS_MULTILINE when creating - // the control unless it already has new lines in its label) - long styleOld = ::GetWindowLong(hwnd, GWL_STYLE), - styleNew; - if ( label.find(wxT('\n')) != wxString::npos ) - styleNew = styleOld | BS_MULTILINE; - else - styleNew = styleOld & ~BS_MULTILINE; - - if ( styleNew != styleOld ) - ::SetWindowLong(hwnd, GWL_STYLE, styleNew); -} - -wxSize wxMSWButton::GetFittingSize(wxWindow *win, - const wxSize& sizeLabel, - int flags) -{ - wxSize sizeBtn = sizeLabel; - - // FIXME: The numbers here are pure guesswork, no idea how should the - // button margins be really calculated. - if ( flags & Size_ExactFit ) - { - // We still need some margin or the text would be overwritten, just - // make it as small as possible. - sizeBtn.x += (3*win->GetCharWidth()); - } - else - { - sizeBtn.x += 3*win->GetCharWidth(); - sizeBtn.y += win->GetCharHeight()/2; - } - - // account for the shield UAC icon if we have it - if ( flags & Size_AuthNeeded ) - sizeBtn.x += wxSystemSettings::GetMetric(wxSYS_SMALLICON_X); - - return sizeBtn; -} - -wxSize wxMSWButton::ComputeBestFittingSize(wxControl *btn, int flags) -{ - wxClientDC dc(btn); - - wxSize sizeBtn; - dc.GetMultiLineTextExtent(btn->GetLabelText(), &sizeBtn.x, &sizeBtn.y); - - return GetFittingSize(btn, sizeBtn, flags); -} - -wxSize wxMSWButton::IncreaseToStdSizeAndCache(wxControl *btn, const wxSize& size) -{ - wxSize sizeBtn(size); - - // All buttons have at least the standard height and, unless the user - // explicitly wants them to be as small as possible and used wxBU_EXACTFIT - // style to indicate this, of at least the standard width too. - // - // Notice that we really want to make all buttons equally high, otherwise - // they look ugly and the existing code using wxBU_EXACTFIT only uses it to - // control width and not height. - - // The 50x14 button size is documented in the "Recommended sizing and - // spacing" section of MSDN layout article. - // - // Note that we intentionally don't use GetDefaultSize() here, because - // it's inexact -- dialog units depend on this dialog's font. - const wxSize sizeDef = btn->ConvertDialogToPixels(wxSize(50, 14)); - if ( !btn->HasFlag(wxBU_EXACTFIT) ) - { - if ( sizeBtn.x < sizeDef.x ) - sizeBtn.x = sizeDef.x; - } - if ( sizeBtn.y < sizeDef.y ) - sizeBtn.y = sizeDef.y; - - btn->CacheBestSize(sizeBtn); - - return sizeBtn; -} - -// ---------------------------------------------------------------------------- -// creation/destruction -// ---------------------------------------------------------------------------- - -wxAnyButton::~wxAnyButton() -{ - delete m_imageData; -#if wxUSE_MARKUP - delete m_markupText; -#endif // wxUSE_MARKUP -} - -void wxAnyButton::SetLabel(const wxString& label) -{ - wxMSWButton::UpdateMultilineStyle(GetHwnd(), label); - - wxAnyButtonBase::SetLabel(label); - -#if wxUSE_MARKUP - // If we have a plain text label, we shouldn't be using markup any longer. - if ( m_markupText ) - { - delete m_markupText; - m_markupText = NULL; - - // Unfortunately we don't really know whether we can reset the button - // to be non-owner-drawn or not: if we had made it owner-drawn just - // because of a call to SetLabelMarkup(), we could, but not if there - // were [also] calls to Set{Fore,Back}groundColour(). If it's really a - // problem to have button remain owner-drawn forever just because it - // had markup label once, we should record the reason for our current - // owner-drawnness and check it here. - } -#endif // wxUSE_MARKUP -} - -// ---------------------------------------------------------------------------- -// size management including autosizing -// ---------------------------------------------------------------------------- - -void wxAnyButton::AdjustForBitmapSize(wxSize &size) const -{ - wxCHECK_RET( m_imageData, wxT("shouldn't be called if no image") ); - - // account for the bitmap size - const wxSize sizeBmp = m_imageData->GetBitmap(State_Normal).GetSize(); - const wxDirection dirBmp = m_imageData->GetBitmapPosition(); - if ( dirBmp == wxLEFT || dirBmp == wxRIGHT ) - { - size.x += sizeBmp.x; - if ( sizeBmp.y > size.y ) - size.y = sizeBmp.y; - } - else // bitmap on top/below the text - { - size.y += sizeBmp.y; - if ( sizeBmp.x > size.x ) - size.x = sizeBmp.x; - } - - // account for the user-specified margins - size += 2*m_imageData->GetBitmapMargins(); - - // and also for the margins we always add internally (unless we have no - // border at all in which case the button has exactly the same size as - // bitmap and so no margins should be used) - if ( !HasFlag(wxBORDER_NONE) ) - { - int marginH = 0, - marginV = 0; -#if wxUSE_UXTHEME - if ( wxUxThemeEngine::GetIfActive() ) - { - wxUxThemeHandle theme(const_cast(this), L"BUTTON"); - - MARGINS margins; - wxUxThemeEngine::Get()->GetThemeMargins(theme, NULL, - BP_PUSHBUTTON, - PBS_NORMAL, - TMT_CONTENTMARGINS, - NULL, - &margins); - - // XP doesn't draw themed buttons correctly when the client - // area is smaller than 8x8 - enforce this minimum size for - // small bitmaps - size.IncTo(wxSize(8, 8)); - - marginH = margins.cxLeftWidth + margins.cxRightWidth - + 2*XP_BUTTON_EXTRA_MARGIN; - marginV = margins.cyTopHeight + margins.cyBottomHeight - + 2*XP_BUTTON_EXTRA_MARGIN; - } - else -#endif // wxUSE_UXTHEME - { - marginH = - marginV = OD_BUTTON_MARGIN; - } - - size.IncBy(marginH, marginV); - } -} - -wxSize wxAnyButton::DoGetBestSize() const -{ - wxAnyButton * const self = const_cast(this); - - wxSize size; - - // Account for the text part if we have it. - if ( ShowsLabel() ) - { - int flags = 0; - if ( HasFlag(wxBU_EXACTFIT) ) - flags |= wxMSWButton::Size_ExactFit; - if ( DoGetAuthNeeded() ) - flags |= wxMSWButton::Size_AuthNeeded; - -#if wxUSE_MARKUP - if ( m_markupText ) - { - wxClientDC dc(self); - size = wxMSWButton::GetFittingSize(self, - m_markupText->Measure(dc), - flags); - } - else // Normal plain text (but possibly multiline) label. -#endif // wxUSE_MARKUP - { - size = wxMSWButton::ComputeBestFittingSize(self, flags); - } - } - - if ( m_imageData ) - AdjustForBitmapSize(size); - - return wxMSWButton::IncreaseToStdSizeAndCache(self, size); -} - -// ---------------------------------------------------------------------------- -// event/message handlers -// ---------------------------------------------------------------------------- - -WXLRESULT wxAnyButton::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) -{ - if ( nMsg == WM_LBUTTONDBLCLK ) - { - // emulate a click event to force an owner-drawn button to change its - // appearance - without this, it won't do it - (void)wxControl::MSWWindowProc(WM_LBUTTONDOWN, wParam, lParam); - - // and continue with processing the message normally as well - } -#if wxUSE_UXTHEME - else if ( nMsg == WM_THEMECHANGED ) - { - // need to recalculate the best size here - // as the theme size might have changed - InvalidateBestSize(); - } -#endif // wxUSE_UXTHEME - // must use m_mouseInWindow here instead of IsMouseInWindow() - // since we need to know the first time the mouse enters the window - // and IsMouseInWindow() would return true in this case - else if ( (nMsg == WM_MOUSEMOVE && !m_mouseInWindow) || - nMsg == WM_MOUSELEAVE ) - { - if ( - IsEnabled() && - ( -#if wxUSE_UXTHEME - wxUxThemeEngine::GetIfActive() || -#endif // wxUSE_UXTHEME - (m_imageData && m_imageData->GetBitmap(State_Current).IsOk()) - ) - ) - { - Refresh(); - } - } - - // let the base class do all real processing - return wxControl::MSWWindowProc(nMsg, wParam, lParam); -} - -// ---------------------------------------------------------------------------- -// button images -// ---------------------------------------------------------------------------- - -wxBitmap wxAnyButton::DoGetBitmap(State which) const -{ - return m_imageData ? m_imageData->GetBitmap(which) : wxBitmap(); -} - -void wxAnyButton::DoSetBitmap(const wxBitmap& bitmap, State which) -{ -#if wxUSE_UXTHEME - wxXPButtonImageData *oldData = NULL; -#endif // wxUSE_UXTHEME - - // Check if we already had bitmaps of different size. - if ( m_imageData && - bitmap.GetSize() != m_imageData->GetBitmap(State_Normal).GetSize() ) - { - wxASSERT_MSG( (which == State_Normal) || bitmap.IsNull(), - "Must set normal bitmap with the new size first" ); - -#if wxUSE_UXTHEME - if ( ShowsLabel() && wxUxThemeEngine::GetIfActive() ) - { - // We can't change the size of the images stored in wxImageList - // in wxXPButtonImageData::m_iml so force recreating it below but - // keep the current data to copy its values into the new one. - oldData = static_cast(m_imageData); - m_imageData = NULL; - } -#endif // wxUSE_UXTHEME - //else: wxODButtonImageData doesn't require anything special - } - - // allocate the image data when the first bitmap is set - if ( !m_imageData ) - { -#if wxUSE_UXTHEME - // using image list doesn't work correctly if we don't have any label - // (even if we use BUTTON_IMAGELIST_ALIGN_CENTER alignment and - // BS_BITMAP style), at least under Windows 2003 so use owner drawn - // strategy for bitmap-only buttons - if ( ShowsLabel() && wxUxThemeEngine::GetIfActive() ) - { - m_imageData = new wxXPButtonImageData(this, bitmap); - - if ( oldData ) - { - // Preserve the old values in case the user changed them. - m_imageData->SetBitmapPosition(oldData->GetBitmapPosition()); - - const wxSize oldMargins = oldData->GetBitmapMargins(); - m_imageData->SetBitmapMargins(oldMargins.x, oldMargins.y); - - // No need to preserve the bitmaps though as they were of wrong - // size anyhow. - - delete oldData; - } - } - else -#endif // wxUSE_UXTHEME - { - m_imageData = new wxODButtonImageData(this, bitmap); - MakeOwnerDrawn(); - } - } - else - { - m_imageData->SetBitmap(bitmap, which); - } - - // it should be enough to only invalidate the best size when the normal - // bitmap changes as all bitmaps assigned to the button should be of the - // same size anyhow - if ( which == State_Normal ) - InvalidateBestSize(); - - Refresh(); -} - -wxSize wxAnyButton::DoGetBitmapMargins() const -{ - return m_imageData ? m_imageData->GetBitmapMargins() : wxSize(0, 0); -} - -void wxAnyButton::DoSetBitmapMargins(wxCoord x, wxCoord y) -{ - wxCHECK_RET( m_imageData, "SetBitmap() must be called first" ); - - m_imageData->SetBitmapMargins(x, y); - InvalidateBestSize(); -} - -void wxAnyButton::DoSetBitmapPosition(wxDirection dir) -{ - wxCHECK_RET( m_imageData, "SetBitmap() must be called first" ); - - m_imageData->SetBitmapPosition(dir); - InvalidateBestSize(); -} - -// ---------------------------------------------------------------------------- -// markup support -// ---------------------------------------------------------------------------- - -#if wxUSE_MARKUP - -bool wxAnyButton::DoSetLabelMarkup(const wxString& markup) -{ - if ( !wxAnyButtonBase::DoSetLabelMarkup(markup) ) - return false; - - if ( !m_markupText ) - { - m_markupText = new wxMarkupText(markup); - MakeOwnerDrawn(); - } - else - { - // We are already owner-drawn so just update the text. - m_markupText->SetMarkup(markup); - } - - Refresh(); - - return true; -} - -#endif // wxUSE_MARKUP - -// ---------------------------------------------------------------------------- -// owner-drawn buttons support -// ---------------------------------------------------------------------------- - -// drawing helpers -namespace -{ - -// return the button state using both the ODS_XXX flags specified in state -// parameter and the current button state -wxAnyButton::State GetButtonState(wxAnyButton *btn, UINT state) -{ - if ( state & ODS_DISABLED ) - return wxAnyButton::State_Disabled; - - if ( state & ODS_SELECTED ) - return wxAnyButton::State_Pressed; - - if ( btn->HasCapture() || btn->IsMouseInWindow() ) - return wxAnyButton::State_Current; - - if ( state & ODS_FOCUS ) - return wxAnyButton::State_Focused; - - return btn->GetNormalState(); -} - -void DrawButtonText(HDC hdc, - RECT *pRect, - wxAnyButton *btn, - int flags) -{ - const wxString text = btn->GetLabel(); - - if ( text.find(wxT('\n')) != wxString::npos ) - { - // draw multiline label - - // center text horizontally in any case - flags |= DT_CENTER; - - // first we need to compute its bounding rect - RECT rc; - ::CopyRect(&rc, pRect); - ::DrawText(hdc, text.t_str(), text.length(), &rc, - DT_CENTER | DT_CALCRECT); - - // now center this rect inside the entire button area - const LONG w = rc.right - rc.left; - const LONG h = rc.bottom - rc.top; - rc.left = pRect->left + (pRect->right - pRect->left)/2 - w/2; - rc.right = rc.left+w; - rc.top = pRect->top + (pRect->bottom - pRect->top)/2 - h/2; - rc.bottom = rc.top+h; - - ::DrawText(hdc, text.t_str(), text.length(), &rc, flags); - } - else // single line label - { - // translate wx button flags to alignment flags for DrawText() - if ( btn->HasFlag(wxBU_RIGHT) ) - { - flags |= DT_RIGHT; - } - else if ( !btn->HasFlag(wxBU_LEFT) ) - { - flags |= DT_CENTER; - } - //else: DT_LEFT is the default anyhow (and its value is 0 too) - - if ( btn->HasFlag(wxBU_BOTTOM) ) - { - flags |= DT_BOTTOM; - } - else if ( !btn->HasFlag(wxBU_TOP) ) - { - flags |= DT_VCENTER; - } - //else: as above, DT_TOP is the default - - // notice that we must have DT_SINGLELINE for vertical alignment flags - // to work - ::DrawText(hdc, text.t_str(), text.length(), pRect, - flags | DT_SINGLELINE ); - } -} - -void DrawRect(HDC hdc, const RECT& r) -{ - wxDrawLine(hdc, r.left, r.top, r.right, r.top); - wxDrawLine(hdc, r.right, r.top, r.right, r.bottom); - wxDrawLine(hdc, r.right, r.bottom, r.left, r.bottom); - wxDrawLine(hdc, r.left, r.bottom, r.left, r.top); -} - -/* - The button frame looks like this normally: - - WWWWWWWWWWWWWWWWWWB - WHHHHHHHHHHHHHHHHGB W = white (HILIGHT) - WH GB H = light grey (LIGHT) - WH GB G = dark grey (SHADOW) - WH GB B = black (DKSHADOW) - WH GB - WGGGGGGGGGGGGGGGGGB - BBBBBBBBBBBBBBBBBBB - - When the button is selected, the button becomes like this (the total button - size doesn't change): - - BBBBBBBBBBBBBBBBBBB - BWWWWWWWWWWWWWWWWBB - BWHHHHHHHHHHHHHHGBB - BWH GBB - BWH GBB - BWGGGGGGGGGGGGGGGBB - BBBBBBBBBBBBBBBBBBB - BBBBBBBBBBBBBBBBBBB - - When the button is pushed (while selected) it is like: - - BBBBBBBBBBBBBBBBBBB - BGGGGGGGGGGGGGGGGGB - BG GB - BG GB - BG GB - BG GB - BGGGGGGGGGGGGGGGGGB - BBBBBBBBBBBBBBBBBBB -*/ -void DrawButtonFrame(HDC hdc, RECT& rectBtn, - bool selected, bool pushed) -{ - RECT r; - CopyRect(&r, &rectBtn); - - AutoHPEN hpenBlack(GetSysColor(COLOR_3DDKSHADOW)), - hpenGrey(GetSysColor(COLOR_3DSHADOW)), - hpenLightGr(GetSysColor(COLOR_3DLIGHT)), - hpenWhite(GetSysColor(COLOR_3DHILIGHT)); - - SelectInHDC selectPen(hdc, hpenBlack); - - r.right--; - r.bottom--; - - if ( pushed ) - { - DrawRect(hdc, r); - - (void)SelectObject(hdc, hpenGrey); - ::InflateRect(&r, -1, -1); - - DrawRect(hdc, r); - } - else // !pushed - { - if ( selected ) - { - DrawRect(hdc, r); - - ::InflateRect(&r, -1, -1); - } - - wxDrawLine(hdc, r.left, r.bottom, r.right, r.bottom); - wxDrawLine(hdc, r.right, r.bottom, r.right, r.top - 1); - - (void)SelectObject(hdc, hpenWhite); - wxDrawLine(hdc, r.left, r.bottom - 1, r.left, r.top); - wxDrawLine(hdc, r.left, r.top, r.right, r.top); - - (void)SelectObject(hdc, hpenLightGr); - wxDrawLine(hdc, r.left + 1, r.bottom - 2, r.left + 1, r.top + 1); - wxDrawLine(hdc, r.left + 1, r.top + 1, r.right - 1, r.top + 1); - - (void)SelectObject(hdc, hpenGrey); - wxDrawLine(hdc, r.left + 1, r.bottom - 1, r.right - 1, r.bottom - 1); - wxDrawLine(hdc, r.right - 1, r.bottom - 1, r.right - 1, r.top); - } - - InflateRect(&rectBtn, -OD_BUTTON_MARGIN, -OD_BUTTON_MARGIN); -} - -#if wxUSE_UXTHEME -void DrawXPBackground(wxAnyButton *button, HDC hdc, RECT& rectBtn, UINT state) -{ - wxUxThemeHandle theme(button, L"BUTTON"); - - // this array is indexed by wxAnyButton::State values and so must be kept in - // sync with it - static const int uxStates[] = - { - PBS_NORMAL, PBS_HOT, PBS_PRESSED, PBS_DISABLED, PBS_DEFAULTED - }; - - int iState = uxStates[GetButtonState(button, state)]; - - wxUxThemeEngine * const engine = wxUxThemeEngine::Get(); - - // draw parent background if needed - if ( engine->IsThemeBackgroundPartiallyTransparent - ( - theme, - BP_PUSHBUTTON, - iState - ) ) - { - // Set this button as the one whose background is being erased: this - // allows our WM_ERASEBKGND handler used by DrawThemeParentBackground() - // to correctly align the background brush with this window instead of - // the parent window to which WM_ERASEBKGND is sent. Notice that this - // doesn't work with custom user-defined EVT_ERASE_BACKGROUND handlers - // as they won't be aligned but unfortunately all the attempts to fix - // it by shifting DC origin before calling DrawThemeParentBackground() - // failed to work so we at least do this, even though this is far from - // being the perfect solution. - wxWindowBeingErased = button; - - engine->DrawThemeParentBackground(GetHwndOf(button), hdc, &rectBtn); - - wxWindowBeingErased = NULL; - } - - // draw background - engine->DrawThemeBackground(theme, hdc, BP_PUSHBUTTON, iState, - &rectBtn, NULL); - - // calculate content area margins - MARGINS margins; - engine->GetThemeMargins(theme, hdc, BP_PUSHBUTTON, iState, - TMT_CONTENTMARGINS, &rectBtn, &margins); - ::InflateRect(&rectBtn, -margins.cxLeftWidth, -margins.cyTopHeight); - ::InflateRect(&rectBtn, -XP_BUTTON_EXTRA_MARGIN, -XP_BUTTON_EXTRA_MARGIN); - - if ( button->UseBgCol() ) - { - COLORREF colBg = wxColourToRGB(button->GetBackgroundColour()); - AutoHBRUSH hbrushBackground(colBg); - - // don't overwrite the focus rect - RECT rectClient; - ::CopyRect(&rectClient, &rectBtn); - ::InflateRect(&rectClient, -1, -1); - FillRect(hdc, &rectClient, hbrushBackground); - } -} -#endif // wxUSE_UXTHEME - -} // anonymous namespace - -// ---------------------------------------------------------------------------- -// owner drawn buttons support -// ---------------------------------------------------------------------------- - -void wxAnyButton::MakeOwnerDrawn() -{ - if ( !IsOwnerDrawn() ) - { - // make it so - // note that BS_OWNERDRAW is not independent from other style bits - long style = GetWindowLong(GetHwnd(), GWL_STYLE); - style &= ~(BS_3STATE | BS_AUTO3STATE | BS_AUTOCHECKBOX | BS_AUTORADIOBUTTON | BS_CHECKBOX | BS_DEFPUSHBUTTON | BS_GROUPBOX | BS_PUSHBUTTON | BS_RADIOBUTTON | BS_PUSHLIKE); - style |= BS_OWNERDRAW; - SetWindowLong(GetHwnd(), GWL_STYLE, style); - } -} - -bool wxAnyButton::IsOwnerDrawn() const -{ - long style = GetWindowLong(GetHwnd(), GWL_STYLE); - return ( (style & BS_OWNERDRAW) == BS_OWNERDRAW ); -} - -bool wxAnyButton::SetBackgroundColour(const wxColour &colour) -{ - if ( !wxControl::SetBackgroundColour(colour) ) - { - // nothing to do - return false; - } - - MakeOwnerDrawn(); - - Refresh(); - - return true; -} - -bool wxAnyButton::SetForegroundColour(const wxColour &colour) -{ - if ( !wxControl::SetForegroundColour(colour) ) - { - // nothing to do - return false; - } - - MakeOwnerDrawn(); - - Refresh(); - - return true; -} - -bool wxAnyButton::MSWOnDraw(WXDRAWITEMSTRUCT *wxdis) -{ - LPDRAWITEMSTRUCT lpDIS = (LPDRAWITEMSTRUCT)wxdis; - HDC hdc = lpDIS->hDC; - - UINT state = lpDIS->itemState; - switch ( GetButtonState(this, state) ) - { - case State_Disabled: - state |= ODS_DISABLED; - break; - case State_Pressed: - state |= ODS_SELECTED; - break; - case State_Focused: - state |= ODS_FOCUS; - break; - default: - break; - } - - bool pushed = (SendMessage(GetHwnd(), BM_GETSTATE, 0, 0) & BST_PUSHED) != 0; - - RECT rectBtn; - CopyRect(&rectBtn, &lpDIS->rcItem); - - // draw the button background - if ( !HasFlag(wxBORDER_NONE) ) - { -#if wxUSE_UXTHEME - if ( wxUxThemeEngine::GetIfActive() ) - { - DrawXPBackground(this, hdc, rectBtn, state); - } - else -#endif // wxUSE_UXTHEME - { - COLORREF colBg = wxColourToRGB(GetBackgroundColour()); - - // first, draw the background - AutoHBRUSH hbrushBackground(colBg); - FillRect(hdc, &rectBtn, hbrushBackground); - - // draw the border for the current state - bool selected = (state & ODS_SELECTED) != 0; - if ( !selected ) - { - wxTopLevelWindow * - tlw = wxDynamicCast(wxGetTopLevelParent(this), wxTopLevelWindow); - if ( tlw ) - { - selected = tlw->GetDefaultItem() == this; - } - } - - DrawButtonFrame(hdc, rectBtn, selected, pushed); - } - - // draw the focus rectangle if we need it - if ( (state & ODS_FOCUS) && !(state & ODS_NOFOCUSRECT) ) - { - DrawFocusRect(hdc, &rectBtn); - -#if wxUSE_UXTHEME - if ( !wxUxThemeEngine::GetIfActive() ) -#endif // wxUSE_UXTHEME - { - if ( pushed ) - { - // the label is shifted by 1 pixel to create "pushed" effect - OffsetRect(&rectBtn, 1, 1); - } - } - } - } - - - // draw the image, if any - if ( m_imageData ) - { - wxBitmap bmp = m_imageData->GetBitmap(GetButtonState(this, state)); - if ( !bmp.IsOk() ) - bmp = m_imageData->GetBitmap(State_Normal); - - const wxSize sizeBmp = bmp.GetSize(); - const wxSize margin = m_imageData->GetBitmapMargins(); - const wxSize sizeBmpWithMargins(sizeBmp + 2*margin); - wxRect rectButton(wxRectFromRECT(rectBtn)); - - // for simplicity, we start with centred rectangle and then move it to - // the appropriate edge - wxRect rectBitmap = wxRect(sizeBmp).CentreIn(rectButton); - - // move bitmap only if we have a label, otherwise keep it centered - if ( ShowsLabel() ) - { - switch ( m_imageData->GetBitmapPosition() ) - { - default: - wxFAIL_MSG( "invalid direction" ); - // fall through - - case wxLEFT: - rectBitmap.x = rectButton.x + margin.x; - rectButton.x += sizeBmpWithMargins.x; - rectButton.width -= sizeBmpWithMargins.x; - break; - - case wxRIGHT: - rectBitmap.x = rectButton.GetRight() - sizeBmp.x - margin.x; - rectButton.width -= sizeBmpWithMargins.x; - break; - - case wxTOP: - rectBitmap.y = rectButton.y + margin.y; - rectButton.y += sizeBmpWithMargins.y; - rectButton.height -= sizeBmpWithMargins.y; - break; - - case wxBOTTOM: - rectBitmap.y = rectButton.GetBottom() - sizeBmp.y - margin.y; - rectButton.height -= sizeBmpWithMargins.y; - break; - } - } - - wxDCTemp dst((WXHDC)hdc); - dst.DrawBitmap(bmp, rectBitmap.GetPosition(), true); - - wxCopyRectToRECT(rectButton, rectBtn); - } - - - // finally draw the label - if ( ShowsLabel() ) - { - COLORREF colFg = state & ODS_DISABLED - ? ::GetSysColor(COLOR_GRAYTEXT) - : wxColourToRGB(GetForegroundColour()); - - wxTextColoursChanger changeFg(hdc, colFg, CLR_INVALID); - wxBkModeChanger changeBkMode(hdc, wxBRUSHSTYLE_TRANSPARENT); - -#if wxUSE_MARKUP - if ( m_markupText ) - { - wxDCTemp dc((WXHDC)hdc); - dc.SetTextForeground(wxColour(colFg)); - dc.SetFont(GetFont()); - - m_markupText->Render(dc, wxRectFromRECT(rectBtn), - state & ODS_NOACCEL - ? wxMarkupText::Render_Default - : wxMarkupText::Render_ShowAccels); - } - else // Plain text label -#endif // wxUSE_MARKUP - { - // notice that DT_HIDEPREFIX doesn't work on old (pre-Windows 2000) - // systems but by happy coincidence ODS_NOACCEL is not used under - // them neither so DT_HIDEPREFIX should never be used there - DrawButtonText(hdc, &rectBtn, this, - state & ODS_NOACCEL ? DT_HIDEPREFIX : 0); - } - } - - return true; -} - -#endif // wxHAS_ANY_BUTTON diff --git a/Source/3rd Party/wx/src/msw/app.cpp b/Source/3rd Party/wx/src/msw/app.cpp index f5c0d08ec..266ddc45c 100644 --- a/Source/3rd Party/wx/src/msw/app.cpp +++ b/Source/3rd Party/wx/src/msw/app.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 04/01/98 -// RCS-ID: $Id$ +// RCS-ID: $Id: app.cpp 62085 2009-09-24 15:42:13Z JS $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -40,7 +40,7 @@ #include "wx/dialog.h" #include "wx/msgdlg.h" #include "wx/intl.h" - #include "wx/crt.h" + #include "wx/wxchar.h" #include "wx/log.h" #include "wx/module.h" #endif @@ -49,14 +49,9 @@ #include "wx/filename.h" #include "wx/dynlib.h" #include "wx/evtloop.h" -#include "wx/thread.h" -#include "wx/scopeguard.h" -#include "wx/vector.h" #include "wx/msw/private.h" -#include "wx/msw/dc.h" #include "wx/msw/ole/oleutils.h" -#include "wx/msw/private/timer.h" #if wxUSE_TOOLTIPS #include "wx/tooltip.h" @@ -64,7 +59,7 @@ // OLE is used for drag-and-drop, clipboard, OLE Automation..., but some // compilers don't support it (missing headers, libs, ...) -#if defined(__GNUWIN32_OLD__) || defined(__SYMANTEC__) +#if defined(__GNUWIN32_OLD__) || defined(__SYMANTEC__) || defined(__SALFORDC__) #undef wxUSE_OLE #define wxUSE_OLE 0 @@ -82,7 +77,10 @@ #include #include -#include "wx/msw/missing.h" +// For MB_TASKMODAL +#ifdef __WXWINCE__ +#include "wx/msw/wince/missing.h" +#endif // instead of including which is not part of the core SDK and not // shipped at all with other compilers, we always define the parts of it we @@ -105,9 +103,6 @@ typedef HRESULT (CALLBACK* DLLGETVERSIONPROC)(DLLVERSIONINFO *); #endif // defined(DLLVERSIONINFO) -#ifndef ATTACH_PARENT_PROCESS - #define ATTACH_PARENT_PROCESS ((DWORD)-1) -#endif // --------------------------------------------------------------------------- // global variables @@ -117,27 +112,19 @@ extern void wxSetKeyboardHook(bool doIt); #endif -// because of mingw32 4.3 bug this struct can't be inside the namespace below: -// see http://article.gmane.org/gmane.comp.lib.wxwidgets.devel/110282 -struct ClassRegInfo -{ - ClassRegInfo(const wxChar *name) - : regname(name), - regnameNR(regname + wxApp::GetNoRedrawClassSuffix()) - { - } - - // the name of the registered class with and without CS_[HV]REDRAW styles - wxString regname; - wxString regnameNR; -}; - -namespace -{ - -wxVector gs_regClassesInfo; - -} // anonymous namespace +// NB: all "NoRedraw" classes must have the same names as the "normal" classes +// with NR suffix - wxWindow::MSWCreate() supposes this +#ifdef __WXWINCE__ +WXDLLIMPEXP_CORE wxChar *wxCanvasClassName; +WXDLLIMPEXP_CORE wxChar *wxCanvasClassNameNR; +#else +WXDLLIMPEXP_CORE const wxChar *wxCanvasClassName = wxT("wxWindowClass"); +WXDLLIMPEXP_CORE const wxChar *wxCanvasClassNameNR = wxT("wxWindowClassNR"); +#endif +WXDLLIMPEXP_CORE const wxChar *wxMDIFrameClassName = wxT("wxMDIFrameClass"); +WXDLLIMPEXP_CORE const wxChar *wxMDIFrameClassNameNoRedraw = wxT("wxMDIFrameClassNR"); +WXDLLIMPEXP_CORE const wxChar *wxMDIChildFrameClassName = wxT("wxMDIChildFrameClass"); +WXDLLIMPEXP_CORE const wxChar *wxMDIChildFrameClassNameNoRedraw = wxT("wxMDIChildFrameClassNR"); // ---------------------------------------------------------------------------- // private functions @@ -202,6 +189,11 @@ void *wxGUIAppTraits::BeforeChildWaitLoop() return new ChildWaitLoopData(wd, winActive); } +void wxGUIAppTraits::AlwaysYield() +{ + wxYield(); +} + void wxGUIAppTraits::AfterChildWaitLoop(void *dataOrig) { wxEndBusyCursor(); @@ -219,12 +211,11 @@ void wxGUIAppTraits::AfterChildWaitLoop(void *dataOrig) delete data; } -#if wxUSE_THREADS bool wxGUIAppTraits::DoMessageFromThreadWait() { // we should return false only if the app should exit, i.e. only if // Dispatch() determines that the main event loop should terminate - wxEventLoopBase * const evtLoop = wxEventLoop::GetActive(); + wxEventLoop *evtLoop = wxEventLoop::GetActive(); if ( !evtLoop || !evtLoop->Pending() ) { // no events means no quit event @@ -234,33 +225,6 @@ bool wxGUIAppTraits::DoMessageFromThreadWait() return evtLoop->Dispatch(); } -DWORD wxGUIAppTraits::WaitForThread(WXHANDLE hThread, int flags) -{ - // We only ever dispatch messages from the main thread and, additionally, - // even from the main thread we shouldn't wait for the message if we don't - // have a running event loop as we would never remove them from the message - // queue then and so we would enter an infinite loop as - // MsgWaitForMultipleObjects() keeps returning WAIT_OBJECT_0 + 1. - if ( flags == wxTHREAD_WAIT_BLOCK || - !wxIsMainThread() || - !wxEventLoop::GetActive() ) - { - // Simple blocking wait. - return DoSimpleWaitForThread(hThread); - } - - return ::MsgWaitForMultipleObjects - ( - 1, // number of objects to wait for - (HANDLE *)&hThread, // the objects - false, // wait for any objects, not all - INFINITE, // no timeout - QS_ALLINPUT | // return as soon as there are any events - QS_ALLPOSTMESSAGE - ); -} -#endif // wxUSE_THREADS - wxPortId wxGUIAppTraits::GetToolkitVersion(int *majVer, int *minVer) const { OSVERSIONINFO info; @@ -284,320 +248,6 @@ wxPortId wxGUIAppTraits::GetToolkitVersion(int *majVer, int *minVer) const #endif } -#if wxUSE_TIMER - -wxTimerImpl *wxGUIAppTraits::CreateTimerImpl(wxTimer *timer) -{ - return new wxMSWTimerImpl(timer); -} - -#endif // wxUSE_TIMER - -wxEventLoopBase* wxGUIAppTraits::CreateEventLoop() -{ - return new wxEventLoop; -} - -// --------------------------------------------------------------------------- -// Stuff for using console from the GUI applications -// --------------------------------------------------------------------------- - -#ifndef __WXWINCE__ - -#if wxUSE_DYNLIB_CLASS - -#include - -namespace -{ - -/* - Helper class to manipulate console from a GUI app. - - Notice that console output is available in the GUI app only if: - - AttachConsole() returns TRUE (which means it never works under pre-XP) - - we have a valid STD_ERROR_HANDLE - - command history hasn't been changed since our startup - - To check if all these conditions are verified, you need to simple call - IsOkToUse(). It will check the first two conditions above the first time it - is called (and if this fails, the subsequent calls will return immediately) - and also recheck the last one every time it is called. - */ -class wxConsoleStderr -{ -public: - // default ctor does nothing, call Init() before using this class - wxConsoleStderr() - { - m_hStderr = INVALID_HANDLE_VALUE; - m_historyLen = - m_dataLen = - m_dataLine = 0; - - m_ok = -1; - } - - ~wxConsoleStderr() - { - if ( m_hStderr != INVALID_HANDLE_VALUE ) - { - if ( !::FreeConsole() ) - { - wxLogLastError(wxT("FreeConsole")); - } - } - } - - // return true if we were successfully initialized and there had been no - // console activity which would interfere with our output since then - bool IsOkToUse() const - { - if ( m_ok == -1 ) - { - wxConsoleStderr * const self = const_cast(this); - self->m_ok = self->DoInit(); - - // no need to call IsHistoryUnchanged() as we just initialized - // m_history anyhow - return m_ok == 1; - } - - return m_ok && IsHistoryUnchanged(); - } - - - // output the provided text on the console, return true if ok - bool Write(const wxString& text); - -private: - // called by Init() once only to do the real initialization - bool DoInit(); - - // retrieve the command line history into the provided buffer and return - // its length - int GetCommandHistory(wxWxCharBuffer& buf) const; - - // check if the console history has changed - bool IsHistoryUnchanged() const; - - int m_ok; // initially -1, set to true or false by Init() - - wxDynamicLibrary m_dllKernel32; - - HANDLE m_hStderr; // console handle, if it's valid we must call - // FreeConsole() (even if m_ok != 1) - - wxWxCharBuffer m_history; // command history on startup - int m_historyLen; // length command history buffer - - wxCharBuffer m_data; // data between empty line and cursor position - int m_dataLen; // length data buffer - int m_dataLine; // line offset - - typedef DWORD (WINAPI *GetConsoleCommandHistory_t)(LPTSTR sCommands, - DWORD nBufferLength, - LPCTSTR sExeName); - typedef DWORD (WINAPI *GetConsoleCommandHistoryLength_t)(LPCTSTR sExeName); - - GetConsoleCommandHistory_t m_pfnGetConsoleCommandHistory; - GetConsoleCommandHistoryLength_t m_pfnGetConsoleCommandHistoryLength; - - wxDECLARE_NO_COPY_CLASS(wxConsoleStderr); -}; - -bool wxConsoleStderr::DoInit() -{ - HANDLE hStderr = ::GetStdHandle(STD_ERROR_HANDLE); - - if ( hStderr == INVALID_HANDLE_VALUE || !hStderr ) - return false; - - if ( !m_dllKernel32.Load(wxT("kernel32.dll")) ) - return false; - - typedef BOOL (WINAPI *AttachConsole_t)(DWORD dwProcessId); - AttachConsole_t wxDL_INIT_FUNC(pfn, AttachConsole, m_dllKernel32); - - if ( !pfnAttachConsole || !pfnAttachConsole(ATTACH_PARENT_PROCESS) ) - return false; - - // console attached, set m_hStderr now to ensure that we free it in the - // dtor - m_hStderr = hStderr; - - wxDL_INIT_FUNC_AW(m_pfn, GetConsoleCommandHistory, m_dllKernel32); - if ( !m_pfnGetConsoleCommandHistory ) - return false; - - wxDL_INIT_FUNC_AW(m_pfn, GetConsoleCommandHistoryLength, m_dllKernel32); - if ( !m_pfnGetConsoleCommandHistoryLength ) - return false; - - // remember the current command history to be able to compare with it later - // in IsHistoryUnchanged() - m_historyLen = GetCommandHistory(m_history); - if ( !m_history ) - return false; - - - // now find the first blank line above the current position - CONSOLE_SCREEN_BUFFER_INFO csbi; - - if ( !::GetConsoleScreenBufferInfo(m_hStderr, &csbi) ) - { - wxLogLastError(wxT("GetConsoleScreenBufferInfo")); - return false; - } - - COORD pos; - pos.X = 0; - pos.Y = csbi.dwCursorPosition.Y + 1; - - // we decide that a line is empty if first 4 characters are spaces - DWORD ret; - char buf[4]; - do - { - pos.Y--; - if ( !::ReadConsoleOutputCharacterA(m_hStderr, buf, WXSIZEOF(buf), - pos, &ret) ) - { - wxLogLastError(wxT("ReadConsoleOutputCharacterA")); - return false; - } - } while ( wxStrncmp(" ", buf, WXSIZEOF(buf)) != 0 ); - - // calculate line offset and length of data - m_dataLine = csbi.dwCursorPosition.Y - pos.Y; - m_dataLen = m_dataLine*csbi.dwMaximumWindowSize.X + csbi.dwCursorPosition.X; - - if ( m_dataLen > 0 ) - { - m_data.extend(m_dataLen); - if ( !::ReadConsoleOutputCharacterA(m_hStderr, m_data.data(), m_dataLen, - pos, &ret) ) - { - wxLogLastError(wxT("ReadConsoleOutputCharacterA")); - return false; - } - } - - return true; -} - -int wxConsoleStderr::GetCommandHistory(wxWxCharBuffer& buf) const -{ - // these functions are internal and may only be called by cmd.exe - static const wxChar *CMD_EXE = wxT("cmd.exe"); - - const int len = m_pfnGetConsoleCommandHistoryLength(CMD_EXE); - if ( len ) - { - buf.extend(len); - - int len2 = m_pfnGetConsoleCommandHistory(buf.data(), len, CMD_EXE); - -#if !wxUSE_UNICODE - // there seems to be a bug in the GetConsoleCommandHistoryA(), it - // returns the length of Unicode string and not ANSI one - len2 /= 2; -#endif // !wxUSE_UNICODE - - if ( len2 != len ) - { - wxFAIL_MSG( wxT("failed getting history?") ); - } - } - - return len; -} - -bool wxConsoleStderr::IsHistoryUnchanged() const -{ - wxASSERT_MSG( m_ok == 1, wxT("shouldn't be called if not initialized") ); - - // get (possibly changed) command history - wxWxCharBuffer history; - const int historyLen = GetCommandHistory(history); - - // and compare it with the original one - return historyLen == m_historyLen && history && - memcmp(m_history, history, historyLen) == 0; -} - -bool wxConsoleStderr::Write(const wxString& text) -{ - wxASSERT_MSG( m_hStderr != INVALID_HANDLE_VALUE, - wxT("should only be called if Init() returned true") ); - - // get current position - CONSOLE_SCREEN_BUFFER_INFO csbi; - if ( !::GetConsoleScreenBufferInfo(m_hStderr, &csbi) ) - { - wxLogLastError(wxT("GetConsoleScreenBufferInfo")); - return false; - } - - // and calculate new position (where is empty line) - csbi.dwCursorPosition.X = 0; - csbi.dwCursorPosition.Y -= m_dataLine; - - if ( !::SetConsoleCursorPosition(m_hStderr, csbi.dwCursorPosition) ) - { - wxLogLastError(wxT("SetConsoleCursorPosition")); - return false; - } - - DWORD ret; - if ( !::FillConsoleOutputCharacter(m_hStderr, wxT(' '), m_dataLen, - csbi.dwCursorPosition, &ret) ) - { - wxLogLastError(wxT("FillConsoleOutputCharacter")); - return false; - } - - if ( !::WriteConsole(m_hStderr, text.t_str(), text.length(), &ret, NULL) ) - { - wxLogLastError(wxT("WriteConsole")); - return false; - } - - WriteConsoleA(m_hStderr, m_data, m_dataLen, &ret, 0); - - return true; -} - -wxConsoleStderr s_consoleStderr; - -} // anonymous namespace - -bool wxGUIAppTraits::CanUseStderr() -{ - return s_consoleStderr.IsOkToUse(); -} - -bool wxGUIAppTraits::WriteToStderr(const wxString& text) -{ - return s_consoleStderr.IsOkToUse() && s_consoleStderr.Write(text); -} - -#else // !wxUSE_DYNLIB_CLASS - -bool wxGUIAppTraits::CanUseStderr() -{ - return false; -} - -bool wxGUIAppTraits::WriteToStderr(const wxString& WXUNUSED(text)) -{ - return false; -} - -#endif // wxUSE_DYNLIB_CLASS/!wxUSE_DYNLIB_CLASS - -#endif // !__WXWINCE__ - // =========================================================================== // wxApp implementation // =========================================================================== @@ -639,6 +289,20 @@ bool wxApp::Initialize(int& argc, wxChar **argv) // ensure that base cleanup is done if we return too early wxCallBaseCleanup callBaseCleanup(this); +#ifdef __WXWINCE__ + wxString tmp = GetAppName(); + tmp += wxT("ClassName"); + wxCanvasClassName = wxStrdup( tmp.c_str() ); + tmp += wxT("NR"); + wxCanvasClassNameNR = wxStrdup( tmp.c_str() ); + HWND hWnd = FindWindow( wxCanvasClassNameNR, NULL ); + if (hWnd) + { + SetForegroundWindow( (HWND)(((DWORD)hWnd)|0x01) ); + return false; + } +#endif + #if !defined(__WXMICROWIN__) InitCommonControls(); #endif // !defined(__WXMICROWIN__) @@ -655,6 +319,10 @@ bool wxApp::Initialize(int& argc, wxChar **argv) wxOleInitialize(); + RegisterWindowClasses(); + + wxWinHandleHash = new wxWinHashTable(wxKEY_INTEGER, 100); + #if !defined(__WXMICROWIN__) && !defined(__WXWINCE__) wxSetKeyboardHook(true); #endif @@ -665,101 +333,153 @@ bool wxApp::Initialize(int& argc, wxChar **argv) } // --------------------------------------------------------------------------- -// Win32 window class registration +// RegisterWindowClasses // --------------------------------------------------------------------------- -/* static */ -const wxChar *wxApp::GetRegisteredClassName(const wxChar *name, - int bgBrushCol, - int extraStyles) +// TODO we should only register classes really used by the app. For this it +// would be enough to just delay the class registration until an attempt +// to create a window of this class is made. +bool wxApp::RegisterWindowClasses() { - const size_t count = gs_regClassesInfo.size(); - for ( size_t n = 0; n < count; n++ ) - { - if ( gs_regClassesInfo[n].regname == name ) - return gs_regClassesInfo[n].regname.c_str(); - } - - // we need to register this class WNDCLASS wndclass; wxZeroMemory(wndclass); + // for each class we register one with CS_(V|H)REDRAW style and one + // without for windows created with wxNO_FULL_REDRAW_ON_REPAINT flag + static const long styleNormal = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS; + static const long styleNoRedraw = CS_DBLCLKS; + + // the fields which are common to all classes wndclass.lpfnWndProc = (WNDPROC)wxWndProc; - wndclass.hInstance = wxGetInstance(); - wndclass.hCursor = ::LoadCursor(NULL, IDC_ARROW); - wndclass.hbrBackground = (HBRUSH)wxUIntToPtr(bgBrushCol + 1); - wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | extraStyles; + wndclass.hInstance = wxhInstance; + wndclass.hCursor = ::LoadCursor((HINSTANCE)NULL, IDC_ARROW); + // register the class for all normal windows + wndclass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); + wndclass.lpszClassName = wxCanvasClassName; + wndclass.style = styleNormal; - ClassRegInfo regClass(name); - wndclass.lpszClassName = regClass.regname.t_str(); - if ( !::RegisterClass(&wndclass) ) + if ( !RegisterClass(&wndclass) ) { - wxLogLastError(wxString::Format(wxT("RegisterClass(%s)"), - regClass.regname)); - return NULL; + wxLogLastError(wxT("RegisterClass(frame)")); } - wndclass.style &= ~(CS_HREDRAW | CS_VREDRAW); - wndclass.lpszClassName = regClass.regnameNR.t_str(); - if ( !::RegisterClass(&wndclass) ) + // "no redraw" frame + wndclass.lpszClassName = wxCanvasClassNameNR; + wndclass.style = styleNoRedraw; + + if ( !RegisterClass(&wndclass) ) { - wxLogLastError(wxString::Format(wxT("RegisterClass(%s)"), - regClass.regname)); - ::UnregisterClass(regClass.regname.c_str(), wxGetInstance()); - return NULL; + wxLogLastError(wxT("RegisterClass(no redraw frame)")); } - gs_regClassesInfo.push_back(regClass); + // Register the MDI frame window class. + wndclass.hbrBackground = (HBRUSH)NULL; // paint MDI frame ourselves + wndclass.lpszClassName = wxMDIFrameClassName; + wndclass.style = styleNormal; - // take care to return the pointer which will remain valid after the - // function returns (it could be invalidated later if new elements are - // added to the vector and it's reallocated but this shouldn't matter as - // this pointer should be used right now, not stored) - return gs_regClassesInfo.back().regname.t_str(); + if ( !RegisterClass(&wndclass) ) + { + wxLogLastError(wxT("RegisterClass(MDI parent)")); + } + + // "no redraw" MDI frame + wndclass.lpszClassName = wxMDIFrameClassNameNoRedraw; + wndclass.style = styleNoRedraw; + + if ( !RegisterClass(&wndclass) ) + { + wxLogLastError(wxT("RegisterClass(no redraw MDI parent frame)")); + } + + // Register the MDI child frame window class. + wndclass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); + wndclass.lpszClassName = wxMDIChildFrameClassName; + wndclass.style = styleNormal; + + if ( !RegisterClass(&wndclass) ) + { + wxLogLastError(wxT("RegisterClass(MDI child)")); + } + + // "no redraw" MDI child frame + wndclass.lpszClassName = wxMDIChildFrameClassNameNoRedraw; + wndclass.style = styleNoRedraw; + + if ( !RegisterClass(&wndclass) ) + { + wxLogLastError(wxT("RegisterClass(no redraw MDI child)")); + } + + return true; } -bool wxApp::IsRegisteredClassName(const wxString& name) +// --------------------------------------------------------------------------- +// UnregisterWindowClasses +// --------------------------------------------------------------------------- + +bool wxApp::UnregisterWindowClasses() { - const size_t count = gs_regClassesInfo.size(); - for ( size_t n = 0; n < count; n++ ) + bool retval = true; + +#ifndef __WXMICROWIN__ + // MDI frame window class. + if ( !::UnregisterClass(wxMDIFrameClassName, wxhInstance) ) { - if ( gs_regClassesInfo[n].regname == name || - gs_regClassesInfo[n].regnameNR == name ) - return true; + wxLogLastError(wxT("UnregisterClass(MDI parent)")); + + retval = false; } - return false; -} - -void wxApp::UnregisterWindowClasses() -{ - const size_t count = gs_regClassesInfo.size(); - for ( size_t n = 0; n < count; n++ ) + // "no redraw" MDI frame + if ( !::UnregisterClass(wxMDIFrameClassNameNoRedraw, wxhInstance) ) { - const ClassRegInfo& regClass = gs_regClassesInfo[n]; - if ( !::UnregisterClass(regClass.regname.c_str(), wxGetInstance()) ) - { - wxLogLastError(wxString::Format(wxT("UnregisterClass(%s)"), - regClass.regname)); - } + wxLogLastError(wxT("UnregisterClass(no redraw MDI parent frame)")); - if ( !::UnregisterClass(regClass.regnameNR.c_str(), wxGetInstance()) ) - { - wxLogLastError(wxString::Format(wxT("UnregisterClass(%s)"), - regClass.regnameNR)); - } + retval = false; } - gs_regClassesInfo.clear(); + // MDI child frame window class. + if ( !::UnregisterClass(wxMDIChildFrameClassName, wxhInstance) ) + { + wxLogLastError(wxT("UnregisterClass(MDI child)")); + + retval = false; + } + + // "no redraw" MDI child frame + if ( !::UnregisterClass(wxMDIChildFrameClassNameNoRedraw, wxhInstance) ) + { + wxLogLastError(wxT("UnregisterClass(no redraw MDI child)")); + + retval = false; + } + + // canvas class name + if ( !::UnregisterClass(wxCanvasClassName, wxhInstance) ) + { + wxLogLastError(wxT("UnregisterClass(canvas)")); + + retval = false; + } + + if ( !::UnregisterClass(wxCanvasClassNameNR, wxhInstance) ) + { + wxLogLastError(wxT("UnregisterClass(no redraw canvas)")); + + retval = false; + } +#endif // __WXMICROWIN__ + + return retval; } void wxApp::CleanUp() { - // all objects pending for deletion must be deleted first, otherwise - // UnregisterWindowClasses() call wouldn't succeed (because windows - // using the classes being unregistered still exist), so call the base - // class method first and only then do our clean up + // all objects pending for deletion must be deleted first, otherwise we + // would crash when they use wxWinHandleHash (and UnregisterWindowClasses() + // call wouldn't succeed as long as any windows still exist), so call the + // base class method first and only then do our clean up wxAppBase::CleanUp(); #if !defined(__WXMICROWIN__) && !defined(__WXWINCE__) @@ -773,6 +493,14 @@ void wxApp::CleanUp() // which case the registration will fail after the first time if we don't // unregister the classes now UnregisterWindowClasses(); + + delete wxWinHandleHash; + wxWinHandleHash = NULL; + +#ifdef __WXWINCE__ + free( wxCanvasClassName ); + free( wxCanvasClassNameNR ); +#endif } // ---------------------------------------------------------------------------- @@ -792,14 +520,16 @@ wxApp::~wxApp() // wxApp idle handling // ---------------------------------------------------------------------------- -void wxApp::OnIdle(wxIdleEvent& WXUNUSED(event)) +void wxApp::OnIdle(wxIdleEvent& event) { + wxAppBase::OnIdle(event); + #if wxUSE_DC_CACHEING // automated DC cache management: clear the cached DCs and bitmap // if it's likely that the app has finished with them, that is, we // get an idle event and we're not dragging anything. if (!::GetKeyState(MK_LBUTTON) && !::GetKeyState(MK_MBUTTON) && !::GetKeyState(MK_RBUTTON)) - wxMSWDCImpl::ClearCache(); + wxDC::ClearCache(); #endif // wxUSE_DC_CACHEING } @@ -845,24 +575,8 @@ void wxApp::WakeUpIdle() void wxApp::OnEndSession(wxCloseEvent& WXUNUSED(event)) { - // Windows will terminate the process soon after we return from - // WM_ENDSESSION handler or when we delete our last window, so make sure we - // at least execute our cleanup code before - - // prevent the window from being destroyed when the corresponding wxTLW is - // destroyed: this will result in a leak of a HWND, of course, but who - // cares when the process is being killed anyhow - if ( !wxTopLevelWindows.empty() ) - wxTopLevelWindows[0]->SetHWND(0); - - const int rc = OnExit(); - - wxEntryCleanup(); - - // calling exit() instead of ExitProcess() or not doing anything at all and - // being killed by Windows has the advantage of executing the dtors of - // global objects - exit(rc); + if (GetTopWindow()) + GetTopWindow()->Close(true); } // Default behaviour: close the application with prompts. The @@ -877,45 +591,15 @@ void wxApp::OnQueryEndSession(wxCloseEvent& event) } // ---------------------------------------------------------------------------- -// system DLL versions +// miscellaneous // ---------------------------------------------------------------------------- -// these functions have trivial inline implementations for CE -#ifndef __WXWINCE__ - -#if wxUSE_DYNLIB_CLASS - -namespace -{ - -// helper function: retrieve the DLL version by using DllGetVersion(), returns -// 0 if the DLL doesn't export such function -int CallDllGetVersion(wxDynamicLibrary& dll) -{ - // now check if the function is available during run-time - wxDYNLIB_FUNCTION( DLLGETVERSIONPROC, DllGetVersion, dll ); - if ( !pfnDllGetVersion ) - return 0; - - DLLVERSIONINFO dvi; - dvi.cbSize = sizeof(dvi); - - HRESULT hr = (*pfnDllGetVersion)(&dvi); - if ( FAILED(hr) ) - { - wxLogApiError(wxT("DllGetVersion"), hr); - - return 0; - } - - return 100*dvi.dwMajorVersion + dvi.dwMinorVersion; -} - -} // anonymous namespace - /* static */ int wxApp::GetComCtl32Version() { +#if defined(__WXMICROWIN__) || defined(__WXWINCE__) + return 0; +#else // cache the result // // NB: this is MT-ok as in the worst case we'd compute s_verComCtl32 twice, @@ -924,105 +608,138 @@ int wxApp::GetComCtl32Version() if ( s_verComCtl32 == -1 ) { + // initally assume no comctl32.dll at all + s_verComCtl32 = 0; + // we're prepared to handle the errors wxLogNull noLog; +#if wxUSE_DYNLIB_CLASS // we don't want to load comctl32.dll, it should be already loaded but, // depending on the OS version and the presence of the manifest, it can // be either v5 or v6 and instead of trying to guess it just get the // handle of the already loaded version - wxLoadedDLL dllComCtl32(wxT("comctl32.dll")); + wxLoadedDLL dllComCtl32(_T("comctl32.dll")); if ( !dllComCtl32.IsLoaded() ) { s_verComCtl32 = 0; return 0; } - // try DllGetVersion() for recent DLLs - s_verComCtl32 = CallDllGetVersion(dllComCtl32); - - // if DllGetVersion() is unavailable either during compile or - // run-time, try to guess the version otherwise - if ( !s_verComCtl32 ) + // if so, then we can check for the version + if ( dllComCtl32.IsLoaded() ) { - // InitCommonControlsEx is unique to 4.70 and later - void *pfn = dllComCtl32.GetSymbol(wxT("InitCommonControlsEx")); - if ( !pfn ) + // now check if the function is available during run-time + wxDYNLIB_FUNCTION( DLLGETVERSIONPROC, DllGetVersion, dllComCtl32 ); + if ( pfnDllGetVersion ) { - // not found, must be 4.00 - s_verComCtl32 = 400; - } - else // 4.70+ - { - // many symbols appeared in comctl32 4.71, could use any of - // them except may be DllInstall() - pfn = dllComCtl32.GetSymbol(wxT("InitializeFlatSB")); - if ( !pfn ) + DLLVERSIONINFO dvi; + dvi.cbSize = sizeof(dvi); + + HRESULT hr = (*pfnDllGetVersion)(&dvi); + if ( FAILED(hr) ) { - // not found, must be 4.70 - s_verComCtl32 = 470; + wxLogApiError(_T("DllGetVersion"), hr); } else { - // found, must be 4.71 or later - s_verComCtl32 = 471; + // this is incompatible with _WIN32_IE values, but + // compatible with the other values returned by + // GetComCtl32Version() + s_verComCtl32 = 100*dvi.dwMajorVersion + + dvi.dwMinorVersion; + } + } + + // if DllGetVersion() is unavailable either during compile or + // run-time, try to guess the version otherwise + if ( !s_verComCtl32 ) + { + // InitCommonControlsEx is unique to 4.70 and later + void *pfn = dllComCtl32.GetSymbol(_T("InitCommonControlsEx")); + if ( !pfn ) + { + // not found, must be 4.00 + s_verComCtl32 = 400; + } + else // 4.70+ + { + // many symbols appeared in comctl32 4.71, could use any of + // them except may be DllInstall() + pfn = dllComCtl32.GetSymbol(_T("InitializeFlatSB")); + if ( !pfn ) + { + // not found, must be 4.70 + s_verComCtl32 = 470; + } + else + { + // found, must be 4.71 or later + s_verComCtl32 = 471; + } } } } +#endif // wxUSE_DYNLIB_CLASS } return s_verComCtl32; +#endif // Microwin/!Microwin } -/* static */ -int wxApp::GetShell32Version() +// Yield to incoming messages + +bool wxApp::Yield(bool onlyIfNeeded) { - static int s_verShell32 = -1; - if ( s_verShell32 == -1 ) + // MT-FIXME + static bool s_inYield = false; + +#if wxUSE_LOG + // disable log flushing from here because a call to wxYield() shouldn't + // normally result in message boxes popping up &c + wxLog::Suspend(); +#endif // wxUSE_LOG + + if ( s_inYield ) { - // we're prepared to handle the errors - wxLogNull noLog; - - wxDynamicLibrary dllShell32(wxT("shell32.dll"), wxDL_VERBATIM); - if ( dllShell32.IsLoaded() ) + if ( !onlyIfNeeded ) { - s_verShell32 = CallDllGetVersion(dllShell32); + wxFAIL_MSG( wxT("wxYield called recursively" ) ); + } - if ( !s_verShell32 ) - { - // there doesn't seem to be any way to distinguish between 4.00 - // and 4.70 (starting from 4.71 we have DllGetVersion()) so - // just assume it is 4.0 - s_verShell32 = 400; - } - } - else // failed load the DLL? - { - s_verShell32 = 0; - } + return false; } - return s_verShell32; + s_inYield = true; + + // we don't want to process WM_QUIT from here - it should be processed in + // the main event loop in order to stop it + wxEventLoopGuarantor dummyLoopIfNeeded; + MSG msg; + while ( PeekMessage(&msg, (HWND)0, 0, 0, PM_NOREMOVE) && + msg.message != WM_QUIT ) + { +#if wxUSE_THREADS + wxMutexGuiLeaveOrEnter(); +#endif // wxUSE_THREADS + + if ( !wxTheApp->Dispatch() ) + break; + } + + // if there are pending events, we must process them. + ProcessPendingEvents(); + +#if wxUSE_LOG + // let the logs be flashed again + wxLog::Resume(); +#endif // wxUSE_LOG + + s_inYield = false; + + return true; } -#else // !wxUSE_DYNLIB_CLASS - -/* static */ -int wxApp::GetComCtl32Version() -{ - return 0; -} - -/* static */ -int wxApp::GetShell32Version() -{ - return 0; -} - -#endif // wxUSE_DYNLIB_CLASS/!wxUSE_DYNLIB_CLASS - -#endif // !__WXWINCE__ - #if wxUSE_EXCEPTIONS // ---------------------------------------------------------------------------- @@ -1037,10 +754,10 @@ bool wxApp::OnExceptionInMainLoop() ::MessageBox ( NULL, - wxT("An unhandled exception occurred. Press \"Abort\" to \ + _T("An unhandled exception occurred. Press \"Abort\" to \ terminate the program,\r\n\ \"Retry\" to exit the program normally and \"Ignore\" to try to continue."), - wxT("Unhandled exception"), + _T("Unhandled exception"), MB_ABORTRETRYIGNORE | MB_ICONERROR| MB_TASKMODAL @@ -1051,7 +768,7 @@ terminate the program,\r\n\ throw; default: - wxFAIL_MSG( wxT("unexpected MessageBox() return code") ); + wxFAIL_MSG( _T("unexpected MessageBox() return code") ); // fall through case IDRETRY: @@ -1063,3 +780,30 @@ terminate the program,\r\n\ } #endif // wxUSE_EXCEPTIONS + +// ---------------------------------------------------------------------------- +// deprecated event loop functions +// ---------------------------------------------------------------------------- + +#if WXWIN_COMPATIBILITY_2_4 + +void wxApp::DoMessage(WXMSG *pMsg) +{ + wxEventLoop *evtLoop = wxEventLoop::GetActive(); + if ( evtLoop ) + evtLoop->ProcessMessage(pMsg); +} + +bool wxApp::DoMessage() +{ + wxEventLoop *evtLoop = wxEventLoop::GetActive(); + return evtLoop ? evtLoop->Dispatch() : false; +} + +bool wxApp::ProcessMessage(WXMSG* pMsg) +{ + wxEventLoop *evtLoop = wxEventLoop::GetActive(); + return evtLoop && evtLoop->PreProcessMessage(pMsg); +} + +#endif // WXWIN_COMPATIBILITY_2_4 diff --git a/Source/3rd Party/wx/src/msw/artmsw.cpp b/Source/3rd Party/wx/src/msw/artmsw.cpp deleted file mode 100644 index f4c50ca64..000000000 --- a/Source/3rd Party/wx/src/msw/artmsw.cpp +++ /dev/null @@ -1,133 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/msw/artmsw.cpp -// Purpose: stock wxArtProvider instance with native MSW stock icons -// Author: Vaclav Slavik -// Modified by: -// Created: 2008-10-15 -// RCS-ID: $Id$ -// Copyright: (c) Vaclav Slavik, 2008 -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// --------------------------------------------------------------------------- -// headers -// --------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#if defined(__BORLANDC__) - #pragma hdrstop -#endif - -#include "wx/artprov.h" -#include "wx/image.h" -#include "wx/msw/wrapwin.h" - - -// ---------------------------------------------------------------------------- -// wxWindowsArtProvider -// ---------------------------------------------------------------------------- - -class wxWindowsArtProvider : public wxArtProvider -{ -protected: - virtual wxBitmap CreateBitmap(const wxArtID& id, const wxArtClient& client, - const wxSize& size); -}; - -static wxBitmap CreateFromStdIcon(const char *iconName, - const wxArtClient& client) -{ - wxIcon icon(iconName); - wxBitmap bmp; - bmp.CopyFromIcon(icon); - -#if wxUSE_IMAGE - // The standard native message box icons are in message box size (32x32). - // If they are requested in any size other than the default or message - // box size, they must be rescaled first. - if ( client != wxART_MESSAGE_BOX && client != wxART_OTHER ) - { - const wxSize size = wxArtProvider::GetNativeSizeHint(client); - if ( size != wxDefaultSize ) - { - wxImage img = bmp.ConvertToImage(); - img.Rescale(size.x, size.y); - bmp = wxBitmap(img); - } - } -#endif // wxUSE_IMAGE - - return bmp; -} - -wxBitmap wxWindowsArtProvider::CreateBitmap(const wxArtID& id, - const wxArtClient& client, - const wxSize& WXUNUSED(size)) -{ - // handle message box icons specially (wxIcon ctor treat these names - // as special cases via wxICOResourceHandler::LoadIcon): - const char *name = NULL; - if ( id == wxART_ERROR ) - name = "wxICON_ERROR"; - else if ( id == wxART_INFORMATION ) - name = "wxICON_INFORMATION"; - else if ( id == wxART_WARNING ) - name = "wxICON_WARNING"; - else if ( id == wxART_QUESTION ) - name = "wxICON_QUESTION"; - - if ( name ) - return CreateFromStdIcon(name, client); - - // for anything else, fall back to generic provider: - return wxNullBitmap; -} - -// ---------------------------------------------------------------------------- -// wxArtProvider::InitNativeProvider() -// ---------------------------------------------------------------------------- - -/*static*/ void wxArtProvider::InitNativeProvider() -{ - PushBack(new wxWindowsArtProvider); -} - -// ---------------------------------------------------------------------------- -// wxArtProvider::GetNativeSizeHint() -// ---------------------------------------------------------------------------- - -/*static*/ -wxSize wxArtProvider::GetNativeSizeHint(const wxArtClient& client) -{ - if ( client == wxART_TOOLBAR ) - { - return wxSize(24, 24); - } - else if ( client == wxART_MENU ) - { - return wxSize(16, 16); - } - else if ( client == wxART_FRAME_ICON ) - { - return wxSize(::GetSystemMetrics(SM_CXSMICON), - ::GetSystemMetrics(SM_CYSMICON)); - } - else if ( client == wxART_CMN_DIALOG || - client == wxART_MESSAGE_BOX ) - { - return wxSize(::GetSystemMetrics(SM_CXICON), - ::GetSystemMetrics(SM_CYICON)); - } - else if (client == wxART_BUTTON) - { - return wxSize(16, 16); - } - else if (client == wxART_LIST) - { - return wxSize(16, 16); - } - - return wxDefaultSize; -} diff --git a/Source/3rd Party/wx/src/msw/basemsw.cpp b/Source/3rd Party/wx/src/msw/basemsw.cpp index 63b84989f..5c820d4de 100644 --- a/Source/3rd Party/wx/src/msw/basemsw.cpp +++ b/Source/3rd Party/wx/src/msw/basemsw.cpp @@ -1,12 +1,12 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: src/msw/basemsw.cpp +// Name: msw/basemsw.cpp // Purpose: misc stuff only used in console applications under MSW // Author: Vadim Zeitlin // Modified by: // Created: 22.06.2003 -// RCS-ID: $Id$ +// RCS-ID: $Id: basemsw.cpp 39831 2006-06-25 23:53:53Z VZ $ // Copyright: (c) 2003 Vadim Zeitlin -// Licence: wxWindows licence +// License: wxWindows licence /////////////////////////////////////////////////////////////////////////////// // ============================================================================ @@ -25,35 +25,35 @@ #endif #ifndef WX_PRECOMP - #include "wx/event.h" #endif //WX_PRECOMP #include "wx/apptrait.h" -#include "wx/evtloop.h" -#include "wx/msw/private/timer.h" // MBN: this is a workaround for MSVC 5: if it is not #included in // some wxBase file, wxRecursionGuard methods won't be exported from // wxBase.dll, and MSVC 5 will give linker errors #include "wx/recguard.h" -#include "wx/crt.h" #include "wx/msw/private.h" -// ============================================================================ -// wxAppTraits implementation -// ============================================================================ - -#if wxUSE_THREADS -WXDWORD wxAppTraits::DoSimpleWaitForThread(WXHANDLE hThread) -{ - return ::WaitForSingleObject((HANDLE)hThread, INFINITE); -} -#endif // wxUSE_THREADS - // ============================================================================ // wxConsoleAppTraits implementation // ============================================================================ +void wxConsoleAppTraits::AlwaysYield() +{ + // we need to use special logic to deal with WM_PAINT: as this pseudo + // message is generated automatically as long as there are invalidated + // windows belonging to this thread, we'd never return if we waited here + // until we have no more of them left. OTOH, this message is always the + // last one in the queue, so we can safely return as soon as we detect it + MSG msg; + while ( ::PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) ) + { + if ( msg.message == WM_PAINT ) + break; + } +} + void *wxConsoleAppTraits::BeforeChildWaitLoop() { // nothing to do here @@ -65,39 +65,9 @@ void wxConsoleAppTraits::AfterChildWaitLoop(void * WXUNUSED(data)) // nothing to do here } -#if wxUSE_THREADS bool wxConsoleAppTraits::DoMessageFromThreadWait() { // nothing to process here return true; } -WXDWORD wxConsoleAppTraits::WaitForThread(WXHANDLE hThread, int WXUNUSED(flags)) -{ - return DoSimpleWaitForThread(hThread); -} -#endif // wxUSE_THREADS - -#if wxUSE_TIMER - -wxTimerImpl *wxConsoleAppTraits::CreateTimerImpl(wxTimer *timer) -{ - return new wxMSWTimerImpl(timer); -} - -#endif // wxUSE_TIMER - -wxEventLoopBase *wxConsoleAppTraits::CreateEventLoop() -{ -#if wxUSE_CONSOLE_EVENTLOOP - return new wxEventLoop(); -#else // !wxUSE_CONSOLE_EVENTLOOP - return NULL; -#endif // wxUSE_CONSOLE_EVENTLOOP/!wxUSE_CONSOLE_EVENTLOOP -} - - -bool wxConsoleAppTraits::WriteToStderr(const wxString& text) -{ - return wxFprintf(stderr, "%s", text) != -1; -} diff --git a/Source/3rd Party/wx/src/msw/bitmap.cpp b/Source/3rd Party/wx/src/msw/bitmap.cpp index e705fe9f1..fec02d9fd 100644 --- a/Source/3rd Party/wx/src/msw/bitmap.cpp +++ b/Source/3rd Party/wx/src/msw/bitmap.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 04/01/98 -// RCS-ID: $Id$ +// RCS-ID: $Id: bitmap.cpp 56488 2008-10-22 17:01:02Z RR $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -40,13 +40,12 @@ #endif #include "wx/msw/private.h" -#include "wx/msw/dc.h" #if wxUSE_WXDIB #include "wx/msw/dib.h" #endif -#ifdef wxHAS_RAW_BITMAP +#ifdef wxHAVE_RAW_BITMAP #include "wx/rawbmp.h" #endif @@ -56,7 +55,7 @@ #endif // no CLR_INVALID // ---------------------------------------------------------------------------- -// wxBitmapRefData +// Bitmap data // ---------------------------------------------------------------------------- class WXDLLEXPORT wxBitmapRefData : public wxGDIImageRefData @@ -92,12 +91,12 @@ public: // MSW-specific // ------------ -#if wxDEBUG_LEVEL +#ifdef __WXDEBUG__ // this field is solely for error checking: we detect selecting a bitmap // into more than one DC at once or deleting a bitmap still selected into a // DC (both are serious programming errors under Windows) wxDC *m_selectedInto; -#endif // wxDEBUG_LEVEL +#endif // __WXDEBUG__ #if wxUSE_WXDIB // when GetRawData() is called for a DDB we need to convert it to a DIB @@ -185,7 +184,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxBitmapHandler, wxObject) wxBitmapRefData::wxBitmapRefData() { -#if wxDEBUG_LEVEL +#ifdef __WXDEBUG__ m_selectedInto = NULL; #endif m_bitmapMask = NULL; @@ -202,7 +201,7 @@ wxBitmapRefData::wxBitmapRefData() wxBitmapRefData::wxBitmapRefData(const wxBitmapRefData& data) : wxGDIImageRefData(data) { -#if wxDEBUG_LEVEL +#ifdef __WXDEBUG__ m_selectedInto = NULL; #endif @@ -212,10 +211,10 @@ wxBitmapRefData::wxBitmapRefData(const wxBitmapRefData& data) m_bitmapMask = new wxMask(*data.m_bitmapMask); // FIXME: we don't copy m_hBitmap currently but we should, see wxBitmap:: - // CloneGDIRefData() + // CloneRefData() wxASSERT_MSG( !data.m_isDIB, - wxT("can't copy bitmap locked for raw access!") ); + _T("can't copy bitmap locked for raw access!") ); m_isDIB = false; m_hasAlpha = data.m_hasAlpha; @@ -227,7 +226,7 @@ void wxBitmapRefData::Free() wxT("deleting bitmap still selected into wxMemoryDC") ); #if wxUSE_WXDIB - wxASSERT_MSG( !m_dib, wxT("forgot to call wxBitmap::UngetRawData()!") ); + wxASSERT_MSG( !m_dib, _T("forgot to call wxBitmap::UngetRawData()!") ); #endif if ( m_hBitmap) @@ -238,7 +237,8 @@ void wxBitmapRefData::Free() } } - wxDELETE(m_bitmapMask); + delete m_bitmapMask; + m_bitmapMask = NULL; } // ---------------------------------------------------------------------------- @@ -250,10 +250,10 @@ wxGDIImageRefData *wxBitmap::CreateData() const return new wxBitmapRefData; } -wxGDIRefData *wxBitmap::CloneGDIRefData(const wxGDIRefData *dataOrig) const +wxObjectRefData *wxBitmap::CloneRefData(const wxObjectRefData *dataOrig) const { const wxBitmapRefData * - data = static_cast(dataOrig); + data = wx_static_cast(const wxBitmapRefData *, dataOrig); if ( !data ) return NULL; @@ -261,7 +261,7 @@ wxGDIRefData *wxBitmap::CloneGDIRefData(const wxGDIRefData *dataOrig) const // wxBitmapRefData using its copy ctor but instead it modifies this // bitmap itself and then returns its m_refData -- which works, of // course (except in !wxUSE_WXDIB), but is completely illogical - wxBitmap *self = const_cast(this); + wxBitmap *self = wx_const_cast(wxBitmap *, this); wxBitmapRefData *selfdata; #if wxUSE_WXDIB @@ -271,7 +271,7 @@ wxGDIRefData *wxBitmap::CloneGDIRefData(const wxGDIRefData *dataOrig) const wxDIB dib((HBITMAP)(data->m_hBitmap)); self->CopyFromDIB(dib); - selfdata = static_cast(m_refData); + selfdata = wx_static_cast(wxBitmapRefData *, m_refData); selfdata->m_hasAlpha = data->m_hasAlpha; } else @@ -292,8 +292,9 @@ wxGDIRefData *wxBitmap::CloneGDIRefData(const wxGDIRefData *dataOrig) const return selfdata; } -bool wxBitmap::CopyFromIconOrCursor(const wxGDIImage& icon, - wxBitmapTransparency transp) +#ifdef __WIN32__ + +bool wxBitmap::CopyFromIconOrCursor(const wxGDIImage& icon) { #if !defined(__WXMICROWIN__) && !defined(__WXWINCE__) // it may be either HICON or HCURSOR @@ -319,71 +320,31 @@ bool wxBitmap::CopyFromIconOrCursor(const wxGDIImage& icon, refData->m_hBitmap = (WXHBITMAP)iconInfo.hbmColor; - switch ( transp ) - { - default: - wxFAIL_MSG( wxT("unknown wxBitmapTransparency value") ); - - case wxBitmapTransparency_None: - // nothing to do, refData->m_hasAlpha is false by default - break; - - case wxBitmapTransparency_Auto: #if wxUSE_WXDIB - // If the icon is 32 bits per pixel then it may have alpha channel - // data, although there are some icons that are 32 bpp but have no - // alpha... So convert to a DIB and manually check the 4th byte for - // each pixel. + // If the icon is 32 bits per pixel then it may have alpha channel data, + // although there are some icons that are 32 bpp but have no alpha... So + // convert to a DIB and manually check the 4th byte for each pixel. + BITMAP bm; + if ( ::GetObject(iconInfo.hbmColor, sizeof(BITMAP), (LPVOID)&bm) + && bm.bmBitsPixel == 32) + { + wxDIB dib(iconInfo.hbmColor); + if (dib.IsOk()) + { + unsigned char* pixels = dib.GetData(); + for (int idx=0; idxm_hasAlpha = true; - break; - } - } - - if ( refData->m_hasAlpha ) - { - // If we do have alpha, ensure we use premultiplied - // data for our pixels as this is what the bitmaps - // created in other ways do and this is necessary - // for e.g. AlphaBlend() to work with this bitmap. - for ( idx = 0; idx < w*h*4; idx += 4 ) - { - const unsigned char a = pixels[idx+3]; - - pixels[idx] = ((pixels[idx] *a) + 127)/255; - pixels[idx+1] = ((pixels[idx+1]*a) + 127)/255; - pixels[idx+2] = ((pixels[idx+2]*a) + 127)/255; - } - - ::DeleteObject(refData->m_hBitmap); - refData->m_hBitmap = dib.Detach(); - } - } + // If there is an alpha byte that is non-zero then set the + // alpha flag and bail out of the loop. + refData->m_hasAlpha = true; + break; } } - break; -#endif // wxUSE_WXDIB - - case wxBitmapTransparency_Always: - refData->m_hasAlpha = true; - break; + } } - +#endif if ( !refData->m_hasAlpha ) { // the mask returned by GetIconInfo() is inverted compared to the usual @@ -395,46 +356,46 @@ bool wxBitmap::CopyFromIconOrCursor(const wxGDIImage& icon, ::DeleteObject(iconInfo.hbmMask); return true; -#else // __WXMICROWIN__ || __WXWINCE__ +#else wxUnusedVar(icon); - wxUnusedVar(transp); - return false; -#endif // !__WXWINCE__/__WXWINCE__ +#endif } -bool wxBitmap::CopyFromCursor(const wxCursor& cursor, wxBitmapTransparency transp) +#endif // Win32 + +bool wxBitmap::CopyFromCursor(const wxCursor& cursor) { UnRef(); - if ( !cursor.IsOk() ) + if ( !cursor.Ok() ) return false; - return CopyFromIconOrCursor(cursor, transp); + return CopyFromIconOrCursor(cursor); } -bool wxBitmap::CopyFromIcon(const wxIcon& icon, wxBitmapTransparency transp) +bool wxBitmap::CopyFromIcon(const wxIcon& icon) { UnRef(); - if ( !icon.IsOk() ) + if ( !icon.Ok() ) return false; - return CopyFromIconOrCursor(icon, transp); + return CopyFromIconOrCursor(icon); } #ifndef NEVER_USE_DIB bool wxBitmap::CopyFromDIB(const wxDIB& dib) { - wxCHECK_MSG( dib.IsOk(), false, wxT("invalid DIB in CopyFromDIB") ); + wxCHECK_MSG( dib.IsOk(), false, _T("invalid DIB in CopyFromDIB") ); #ifdef SOMETIMES_USE_DIB HBITMAP hbitmap = dib.CreateDDB(); if ( !hbitmap ) return false; #else // ALWAYS_USE_DIB - HBITMAP hbitmap = const_cast(dib).Detach(); + HBITMAP hbitmap = ((wxDIB &)dib).Detach(); // const_cast #endif // SOMETIMES_USE_DIB/ALWAYS_USE_DIB UnRef(); @@ -513,7 +474,7 @@ wxBitmap::wxBitmap(const char bits[], int width, int height, int depth) else { // bits should already be in Windows standard format - data = const_cast(bits); + data = (char *)bits; // const_cast is harmless } HBITMAP hbmp = ::CreateBitmap(width, height, 1, depth, data); @@ -531,19 +492,24 @@ wxBitmap::wxBitmap(const char bits[], int width, int height, int depth) #endif } +wxBitmap::wxBitmap(int w, int h, int d) +{ + (void)Create(w, h, d); +} + wxBitmap::wxBitmap(int w, int h, const wxDC& dc) { (void)Create(w, h, dc); } -wxBitmap::wxBitmap(const void* data, wxBitmapType type, int width, int height, int depth) +wxBitmap::wxBitmap(const void* data, long type, int width, int height, int depth) { (void)Create(data, type, width, height, depth); } wxBitmap::wxBitmap(const wxString& filename, wxBitmapType type) { - LoadFile(filename, type); + LoadFile(filename, (int)type); } bool wxBitmap::Create(int width, int height, int depth) @@ -553,14 +519,9 @@ bool wxBitmap::Create(int width, int height, int depth) bool wxBitmap::Create(int width, int height, const wxDC& dc) { - wxCHECK_MSG( dc.IsOk(), false, wxT("invalid HDC in wxBitmap::Create()") ); + wxCHECK_MSG( dc.Ok(), false, _T("invalid HDC in wxBitmap::Create()") ); - const wxMSWDCImpl *impl = wxDynamicCast( dc.GetImpl(), wxMSWDCImpl ); - - if (impl) - return DoCreate(width, height, -1, impl->GetHDC()); - else - return false; + return DoCreate(width, height, -1, dc.GetHDC()); } bool wxBitmap::DoCreate(int w, int h, int d, WXHDC hdc) @@ -625,7 +586,7 @@ bool wxBitmap::DoCreate(int w, int h, int d, WXHDC hdc) SetHBITMAP((WXHBITMAP)hbmp); - return IsOk(); + return Ok(); } #if wxUSE_IMAGE @@ -759,7 +720,7 @@ wxImage wxBitmap::ConvertToImage() const // so the 'depth' argument is ignored. // TODO: transparency (create a mask image) - if (!IsOk()) + if (!Ok()) { wxFAIL_MSG( wxT("bitmap is invalid") ); return wxNullImage; @@ -767,7 +728,7 @@ wxImage wxBitmap::ConvertToImage() const wxImage image; - wxCHECK_MSG( IsOk(), wxNullImage, wxT("invalid bitmap") ); + wxCHECK_MSG( Ok(), wxNullImage, wxT("invalid bitmap") ); // create an wxImage object int width = GetWidth(); @@ -828,22 +789,17 @@ bool wxBitmap::CreateFromImage(const wxImage& image, int depth) bool wxBitmap::CreateFromImage(const wxImage& image, const wxDC& dc) { - wxCHECK_MSG( dc.IsOk(), false, - wxT("invalid HDC in wxBitmap::CreateFromImage()") ); + wxCHECK_MSG( dc.Ok(), false, + _T("invalid HDC in wxBitmap::CreateFromImage()") ); - const wxMSWDCImpl *impl = wxDynamicCast( dc.GetImpl(), wxMSWDCImpl ); - - if (impl) - return CreateFromImage(image, -1, impl->GetHDC()); - else - return false; + return CreateFromImage(image, -1, dc.GetHDC()); } #if wxUSE_WXDIB bool wxBitmap::CreateFromImage(const wxImage& image, int depth, WXHDC hdc) { - wxCHECK_MSG( image.IsOk(), false, wxT("invalid image") ); + wxCHECK_MSG( image.Ok(), false, wxT("invalid image") ); UnRef(); @@ -859,7 +815,7 @@ bool wxBitmap::CreateFromImage(const wxImage& image, int depth, WXHDC hdc) if (depth == -1) depth = dib.GetDepth(); - + // store the bitmap parameters wxBitmapRefData * const refData = new wxBitmapRefData; refData->m_width = w; @@ -924,7 +880,7 @@ bool wxBitmap::CreateFromImage(const wxImage& image, int depth, WXHDC hdc) hbitmap = ::CreateBitmap(w, h, 1, 1, data); if ( !hbitmap ) { - wxLogLastError(wxT("CreateBitmap(mask)")); + wxLogLastError(_T("CreateBitmap(mask)")); } else { @@ -949,7 +905,7 @@ wxImage wxBitmap::ConvertToImage() const // and then DIB to our wxImage wxImage image = dib.ConvertToImage(); - if ( !image.IsOk() ) + if ( !image.Ok() ) { return wxNullImage; } @@ -1043,7 +999,7 @@ wxImage wxBitmap::ConvertToImage() const // loading and saving bitmaps // ---------------------------------------------------------------------------- -bool wxBitmap::LoadFile(const wxString& filename, wxBitmapType type) +bool wxBitmap::LoadFile(const wxString& filename, long type) { UnRef(); @@ -1059,7 +1015,7 @@ bool wxBitmap::LoadFile(const wxString& filename, wxBitmapType type) else // no bitmap handler found { wxImage image; - if ( image.LoadFile( filename, type ) && image.IsOk() ) + if ( image.LoadFile( filename, type ) && image.Ok() ) { *this = wxBitmap(image); @@ -1071,7 +1027,7 @@ bool wxBitmap::LoadFile(const wxString& filename, wxBitmapType type) return false; } -bool wxBitmap::Create(const void* data, wxBitmapType type, int width, int height, int depth) +bool wxBitmap::Create(const void* data, long type, int width, int height, int depth) { UnRef(); @@ -1090,8 +1046,8 @@ bool wxBitmap::Create(const void* data, wxBitmapType type, int width, int height } bool wxBitmap::SaveFile(const wxString& filename, - wxBitmapType type, - const wxPalette *palette) const + int type, + const wxPalette *palette) { wxBitmapHandler *handler = wxDynamicCast(FindHandler(type), wxBitmapHandler); @@ -1104,7 +1060,7 @@ bool wxBitmap::SaveFile(const wxString& filename, { // FIXME what about palette? shouldn't we use it? wxImage image = ConvertToImage(); - if ( image.IsOk() ) + if ( image.Ok() ) { return image.SaveFile(filename, type); } @@ -1126,14 +1082,14 @@ wxBitmap wxBitmap::GetSubBitmap( const wxRect& rect ) const wxBitmap wxBitmap::GetSubBitmapOfHDC( const wxRect& rect, WXHDC hdc ) const { - wxCHECK_MSG( IsOk() && + wxCHECK_MSG( Ok() && (rect.x >= 0) && (rect.y >= 0) && (rect.x+rect.width <= GetWidth()) && (rect.y+rect.height <= GetHeight()), wxNullBitmap, wxT("Invalid bitmap or bitmap region") ); wxBitmap ret( rect.width, rect.height, GetDepth() ); - wxASSERT_MSG( ret.IsOk(), wxT("GetSubBitmap error") ); + wxASSERT_MSG( ret.Ok(), wxT("GetSubBitmap error") ); #ifndef __WXMICROWIN__ // handle alpha channel, if any @@ -1146,16 +1102,16 @@ wxBitmap wxBitmap::GetSubBitmapOfHDC( const wxRect& rect, WXHDC hdc ) const { SelectInHDC selectDst(dcDst, GetHbitmapOf(ret)); - + if ( !selectDst ) { - wxLogLastError(wxT("SelectObject(destBitmap)")); + wxLogLastError(_T("SelectObject(destBitmap)")); } if ( !::BitBlt(dcDst, 0, 0, rect.width, rect.height, (HDC)hdc, rect.x, rect.y, SRCCOPY) ) { - wxLogLastError(wxT("BitBlt")); + wxLogLastError(_T("BitBlt")); } } @@ -1170,7 +1126,7 @@ wxBitmap wxBitmap::GetSubBitmapOfHDC( const wxRect& rect, WXHDC hdc ) const if ( !::BitBlt(dcDst, 0, 0, rect.width, rect.height, dcSrc, rect.x, rect.y, SRCCOPY) ) { - wxLogLastError(wxT("BitBlt")); + wxLogLastError(_T("BitBlt")); } wxMask *mask = new wxMask((WXHBITMAP) hbmpMask); @@ -1189,13 +1145,13 @@ wxBitmap wxBitmap::GetSubBitmapOfHDC( const wxRect& rect, WXHDC hdc ) const wxPalette* wxBitmap::GetPalette() const { return GetBitmapData() ? &GetBitmapData()->m_bitmapPalette - : NULL; + : (wxPalette *) NULL; } #endif wxMask *wxBitmap::GetMask() const { - return GetBitmapData() ? GetBitmapData()->GetMask() : NULL; + return GetBitmapData() ? GetBitmapData()->GetMask() : (wxMask *) NULL; } wxBitmap wxBitmap::GetMaskBitmap() const @@ -1207,15 +1163,24 @@ wxBitmap wxBitmap::GetMaskBitmap() const return bmp; } +#ifdef __WXDEBUG__ + wxDC *wxBitmap::GetSelectedInto() const { -#if wxDEBUG_LEVEL - return GetBitmapData() ? GetBitmapData()->m_selectedInto : NULL; -#else - return NULL; -#endif + return GetBitmapData() ? GetBitmapData()->m_selectedInto : (wxDC *) NULL; } +#endif + +#if WXWIN_COMPATIBILITY_2_4 + +int wxBitmap::GetQuality() const +{ + return 0; +} + +#endif // WXWIN_COMPATIBILITY_2_4 + void wxBitmap::UseAlpha() { if ( GetBitmapData() ) @@ -1231,16 +1196,16 @@ bool wxBitmap::HasAlpha() const // wxBitmap setters // ---------------------------------------------------------------------------- +#ifdef __WXDEBUG__ + void wxBitmap::SetSelectedInto(wxDC *dc) { -#if wxDEBUG_LEVEL if ( GetBitmapData() ) GetBitmapData()->m_selectedInto = dc; -#else - wxUnusedVar(dc); -#endif } +#endif + #if wxUSE_PALETTE void wxBitmap::SetPalette(const wxPalette& palette) @@ -1259,16 +1224,23 @@ void wxBitmap::SetMask(wxMask *mask) GetBitmapData()->SetMask(mask); } +#if WXWIN_COMPATIBILITY_2_4 + +void wxBitmap::SetQuality(int WXUNUSED(quality)) +{ +} + +#endif // WXWIN_COMPATIBILITY_2_4 + // ---------------------------------------------------------------------------- // raw bitmap access support // ---------------------------------------------------------------------------- -#ifdef wxHAS_RAW_BITMAP - +#ifdef wxHAVE_RAW_BITMAP void *wxBitmap::GetRawData(wxPixelDataBase& data, int bpp) { #if wxUSE_WXDIB - if ( !IsOk() ) + if ( !Ok() ) { // no bitmap, no data (raw or otherwise) return NULL; @@ -1281,7 +1253,7 @@ void *wxBitmap::GetRawData(wxPixelDataBase& data, int bpp) if ( !GetBitmapData()->m_isDIB ) { wxCHECK_MSG( !GetBitmapData()->m_dib, NULL, - wxT("GetRawData() may be called only once") ); + _T("GetRawData() may be called only once") ); wxDIB *dib = new wxDIB(*this); if ( !dib->IsOk() ) @@ -1304,7 +1276,7 @@ void *wxBitmap::GetRawData(wxPixelDataBase& data, int bpp) DIBSECTION ds; if ( ::GetObject(hDIB, sizeof(ds), &ds) != sizeof(DIBSECTION) ) { - wxFAIL_MSG( wxT("failed to get DIBSECTION from a DIB?") ); + wxFAIL_MSG( _T("failed to get DIBSECTION from a DIB?") ); return NULL; } @@ -1312,7 +1284,7 @@ void *wxBitmap::GetRawData(wxPixelDataBase& data, int bpp) // check that the bitmap is in correct format if ( ds.dsBm.bmBitsPixel != bpp ) { - wxFAIL_MSG( wxT("incorrect bitmap type in wxBitmap::GetRawData()") ); + wxFAIL_MSG( _T("incorrect bitmap type in wxBitmap::GetRawData()") ); return NULL; } @@ -1346,7 +1318,7 @@ void *wxBitmap::GetRawData(wxPixelDataBase& data, int bpp) void wxBitmap::UngetRawData(wxPixelDataBase& dataBase) { #if wxUSE_WXDIB - if ( !IsOk() ) + if ( !Ok() ) return; if ( !&dataBase ) @@ -1370,7 +1342,7 @@ void wxBitmap::UngetRawData(wxPixelDataBase& dataBase) } #endif // wxUSE_WXDIB } -#endif // wxHAS_RAW_BITMAP +#endif // #ifdef wxHAVE_RAW_BITMAP // ---------------------------------------------------------------------------- // wxMask @@ -1407,7 +1379,7 @@ wxMask::wxMask(const wxMask &mask) SelectObject(destDC, (HBITMAP) m_maskBitmap); BitBlt(destDC, 0, 0, w, h, srcDC, 0, 0, SRCCOPY); - + SelectObject(srcDC, 0); DeleteDC(srcDC); SelectObject(destDC, 0); @@ -1447,8 +1419,8 @@ wxMask::~wxMask() bool wxMask::Create(const wxBitmap& bitmap) { #ifndef __WXMICROWIN__ - wxCHECK_MSG( bitmap.IsOk() && bitmap.GetDepth() == 1, false, - wxT("can't create mask from invalid or not monochrome bitmap") ); + wxCHECK_MSG( bitmap.Ok() && bitmap.GetDepth() == 1, false, + _T("can't create mask from invalid or not monochrome bitmap") ); if ( m_maskBitmap ) { @@ -1488,7 +1460,7 @@ bool wxMask::Create(const wxBitmap& bitmap, int paletteIndex) } #if wxUSE_PALETTE - if (bitmap.IsOk() && bitmap.GetPalette()->IsOk()) + if (bitmap.Ok() && bitmap.GetPalette()->Ok()) { unsigned char red, green, blue; if (bitmap.GetPalette()->GetRGB(paletteIndex, &red, &green, &blue)) @@ -1507,7 +1479,7 @@ bool wxMask::Create(const wxBitmap& bitmap, int paletteIndex) bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour) { #ifndef __WXMICROWIN__ - wxCHECK_MSG( bitmap.IsOk(), false, wxT("invalid bitmap in wxMask::Create") ); + wxCHECK_MSG( bitmap.Ok(), false, _T("invalid bitmap in wxMask::Create") ); if ( m_maskBitmap ) { @@ -1534,7 +1506,7 @@ bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour) // SelectObject() will fail wxASSERT_MSG( !bitmap.GetSelectedInto(), - wxT("bitmap can't be selected in another DC") ); + _T("bitmap can't be selected in another DC") ); HGDIOBJ hbmpSrcOld = ::SelectObject(srcDC, GetHbitmapOf(bitmap)); if ( !hbmpSrcOld ) @@ -1580,27 +1552,27 @@ bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour) bool wxBitmapHandler::Create(wxGDIImage *image, const void* data, - wxBitmapType type, + long flags, int width, int height, int depth) { wxBitmap *bitmap = wxDynamicCast(image, wxBitmap); - return bitmap && Create(bitmap, data, type, width, height, depth); + return bitmap && Create(bitmap, data, flags, width, height, depth); } bool wxBitmapHandler::Load(wxGDIImage *image, const wxString& name, - wxBitmapType type, + long flags, int width, int height) { wxBitmap *bitmap = wxDynamicCast(image, wxBitmap); - return bitmap && LoadFile(bitmap, name, type, width, height); + return bitmap && LoadFile(bitmap, name, flags, width, height); } -bool wxBitmapHandler::Save(const wxGDIImage *image, +bool wxBitmapHandler::Save(wxGDIImage *image, const wxString& name, - wxBitmapType type) const + int type) { wxBitmap *bitmap = wxDynamicCast(image, wxBitmap); @@ -1609,7 +1581,7 @@ bool wxBitmapHandler::Save(const wxGDIImage *image, bool wxBitmapHandler::Create(wxBitmap *WXUNUSED(bitmap), const void* WXUNUSED(data), - wxBitmapType WXUNUSED(type), + long WXUNUSED(type), int WXUNUSED(width), int WXUNUSED(height), int WXUNUSED(depth)) @@ -1619,21 +1591,72 @@ bool wxBitmapHandler::Create(wxBitmap *WXUNUSED(bitmap), bool wxBitmapHandler::LoadFile(wxBitmap *WXUNUSED(bitmap), const wxString& WXUNUSED(name), - wxBitmapType WXUNUSED(type), + long WXUNUSED(type), int WXUNUSED(desiredWidth), int WXUNUSED(desiredHeight)) { return false; } -bool wxBitmapHandler::SaveFile(const wxBitmap *WXUNUSED(bitmap), +bool wxBitmapHandler::SaveFile(wxBitmap *WXUNUSED(bitmap), const wxString& WXUNUSED(name), - wxBitmapType WXUNUSED(type), - const wxPalette *WXUNUSED(palette)) const + int WXUNUSED(type), + const wxPalette *WXUNUSED(palette)) { return false; } +// ---------------------------------------------------------------------------- +// DIB functions +// ---------------------------------------------------------------------------- + +#ifndef __WXMICROWIN__ +bool wxCreateDIB(long xSize, long ySize, long bitsPerPixel, + HPALETTE hPal, LPBITMAPINFO* lpDIBHeader) +{ + unsigned long i, headerSize; + + // Allocate space for a DIB header + headerSize = (sizeof(BITMAPINFOHEADER) + (256 * sizeof(PALETTEENTRY))); + LPBITMAPINFO lpDIBheader = (BITMAPINFO *) malloc(headerSize); + LPPALETTEENTRY lpPe = (PALETTEENTRY *)((BYTE*)lpDIBheader + sizeof(BITMAPINFOHEADER)); + + GetPaletteEntries(hPal, 0, 256, lpPe); + + memset(lpDIBheader, 0x00, sizeof(BITMAPINFOHEADER)); + + // Fill in the static parts of the DIB header + lpDIBheader->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + lpDIBheader->bmiHeader.biWidth = xSize; + lpDIBheader->bmiHeader.biHeight = ySize; + lpDIBheader->bmiHeader.biPlanes = 1; + + // this value must be 1, 4, 8 or 24 so PixelDepth can only be + lpDIBheader->bmiHeader.biBitCount = (WORD)(bitsPerPixel); + lpDIBheader->bmiHeader.biCompression = BI_RGB; + lpDIBheader->bmiHeader.biSizeImage = (xSize * abs((int)ySize) * bitsPerPixel) >> 3; + lpDIBheader->bmiHeader.biClrUsed = 256; + + + // Initialize the DIB palette + for (i = 0; i < 256; i++) { + lpDIBheader->bmiColors[i].rgbReserved = lpPe[i].peFlags; + lpDIBheader->bmiColors[i].rgbRed = lpPe[i].peRed; + lpDIBheader->bmiColors[i].rgbGreen = lpPe[i].peGreen; + lpDIBheader->bmiColors[i].rgbBlue = lpPe[i].peBlue; + } + + *lpDIBHeader = lpDIBheader; + + return true; +} + +void wxFreeDIB(LPBITMAPINFO lpDIBHeader) +{ + free(lpDIBHeader); +} +#endif + // ---------------------------------------------------------------------------- // global helper functions implemented here // ---------------------------------------------------------------------------- @@ -1645,7 +1668,7 @@ HICON wxBitmapToIconOrCursor(const wxBitmap& bmp, int hotSpotX, int hotSpotY) { - if ( !bmp.IsOk() ) + if ( !bmp.Ok() ) { // we can't create an icon/cursor form nothing return 0; @@ -1653,25 +1676,9 @@ HICON wxBitmapToIconOrCursor(const wxBitmap& bmp, if ( bmp.HasAlpha() ) { - HBITMAP hbmp; - -#if wxUSE_WXDIB && wxUSE_IMAGE - // CreateIconIndirect() requires non-pre-multiplied pixel data on input - // as it does pre-multiplication internally itself so we need to create - // a special DIB in such format to pass to it. This is inefficient but - // better than creating an icon with wrong colours. - AutoHBITMAP hbmpRelease; - hbmp = wxDIB(bmp.ConvertToImage(), - wxDIB::PixelFormat_NotPreMultiplied).Detach(); - hbmpRelease.Init(hbmp); -#else // !(wxUSE_WXDIB && wxUSE_IMAGE) - hbmp = GetHbitmapOf(bmp); -#endif // wxUSE_WXDIB && wxUSE_IMAGE - // Create an empty mask bitmap. // it doesn't seem to work if we mess with the mask at all. - AutoHBITMAP - hMonoBitmap(CreateBitmap(bmp.GetWidth(),bmp.GetHeight(),1,1,NULL)); + HBITMAP hMonoBitmap = CreateBitmap(bmp.GetWidth(),bmp.GetHeight(),1,1,NULL); ICONINFO iconInfo; wxZeroMemory(iconInfo); @@ -1683,9 +1690,13 @@ HICON wxBitmapToIconOrCursor(const wxBitmap& bmp, } iconInfo.hbmMask = hMonoBitmap; - iconInfo.hbmColor = hbmp; + iconInfo.hbmColor = GetHbitmapOf(bmp); - return ::CreateIconIndirect(&iconInfo); + HICON hicon = ::CreateIconIndirect(&iconInfo); + + ::DeleteObject(hMonoBitmap); + + return hicon; } wxMask* mask = bmp.GetMask(); @@ -1706,8 +1717,7 @@ HICON wxBitmapToIconOrCursor(const wxBitmap& bmp, iconInfo.yHotspot = hotSpotY; } - AutoHBITMAP hbmpMask(wxInvertMask((HBITMAP)mask->GetMaskBitmap())); - iconInfo.hbmMask = hbmpMask; + iconInfo.hbmMask = wxInvertMask((HBITMAP)mask->GetMaskBitmap()); iconInfo.hbmColor = GetHbitmapOf(bmp); // black out the transparent area to preserve background colour, because @@ -1721,7 +1731,7 @@ HICON wxBitmapToIconOrCursor(const wxBitmap& bmp, if ( !::BitBlt(dcDst, 0, 0, bmp.GetWidth(), bmp.GetHeight(), dcSrc, 0, 0, SRCAND) ) { - wxLogLastError(wxT("BitBlt")); + wxLogLastError(_T("BitBlt")); } } @@ -1733,6 +1743,9 @@ HICON wxBitmapToIconOrCursor(const wxBitmap& bmp, delete mask; } + // delete the inverted mask bitmap we created as well + ::DeleteObject(iconInfo.hbmMask); + return hicon; } @@ -1749,7 +1762,7 @@ HCURSOR wxBitmapToHCURSOR(const wxBitmap& bmp, int hotSpotX, int hotSpotY) HBITMAP wxInvertMask(HBITMAP hbmpMask, int w, int h) { #ifndef __WXMICROWIN__ - wxCHECK_MSG( hbmpMask, 0, wxT("invalid bitmap in wxInvertMask") ); + wxCHECK_MSG( hbmpMask, 0, _T("invalid bitmap in wxInvertMask") ); // get width/height from the bitmap if not given if ( !w || !h ) diff --git a/Source/3rd Party/wx/src/msw/bmpbuttn.cpp b/Source/3rd Party/wx/src/msw/bmpbuttn.cpp index 4aecb35f0..679765910 100644 --- a/Source/3rd Party/wx/src/msw/bmpbuttn.cpp +++ b/Source/3rd Party/wx/src/msw/bmpbuttn.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 04/01/98 -// RCS-ID: $Id$ +// RCS-ID: $Id: bmpbuttn.cpp 42816 2006-10-31 08:50:17Z RD $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -27,7 +27,6 @@ #endif #include "wx/msw/private.h" -#include "wx/msw/dc.h" // for wxDCTemp #include "wx/msw/uxtheme.h" @@ -54,8 +53,64 @@ // macros // ---------------------------------------------------------------------------- +#if wxUSE_EXTENDED_RTTI + +WX_DEFINE_FLAGS( wxBitmapButtonStyle ) + +wxBEGIN_FLAGS( wxBitmapButtonStyle ) + // new style border flags, we put them first to + // use them for streaming out + wxFLAGS_MEMBER(wxBORDER_SIMPLE) + wxFLAGS_MEMBER(wxBORDER_SUNKEN) + wxFLAGS_MEMBER(wxBORDER_DOUBLE) + wxFLAGS_MEMBER(wxBORDER_RAISED) + wxFLAGS_MEMBER(wxBORDER_STATIC) + wxFLAGS_MEMBER(wxBORDER_NONE) + + // old style border flags + wxFLAGS_MEMBER(wxSIMPLE_BORDER) + wxFLAGS_MEMBER(wxSUNKEN_BORDER) + wxFLAGS_MEMBER(wxDOUBLE_BORDER) + wxFLAGS_MEMBER(wxRAISED_BORDER) + wxFLAGS_MEMBER(wxSTATIC_BORDER) + wxFLAGS_MEMBER(wxBORDER) + + // standard window styles + wxFLAGS_MEMBER(wxTAB_TRAVERSAL) + wxFLAGS_MEMBER(wxCLIP_CHILDREN) + wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW) + wxFLAGS_MEMBER(wxWANTS_CHARS) + wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE) + wxFLAGS_MEMBER(wxALWAYS_SHOW_SB ) + wxFLAGS_MEMBER(wxVSCROLL) + wxFLAGS_MEMBER(wxHSCROLL) + + wxFLAGS_MEMBER(wxBU_AUTODRAW) + wxFLAGS_MEMBER(wxBU_LEFT) + wxFLAGS_MEMBER(wxBU_RIGHT) + wxFLAGS_MEMBER(wxBU_TOP) + wxFLAGS_MEMBER(wxBU_BOTTOM) +wxEND_FLAGS( wxBitmapButtonStyle ) + +IMPLEMENT_DYNAMIC_CLASS_XTI(wxBitmapButton, wxButton,"wx/bmpbuttn.h") + +wxBEGIN_PROPERTIES_TABLE(wxBitmapButton) + wxPROPERTY_FLAGS( WindowStyle , wxBitmapButtonStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE, 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style +wxEND_PROPERTIES_TABLE() + +wxBEGIN_HANDLERS_TABLE(wxBitmapButton) +wxEND_HANDLERS_TABLE() + +wxCONSTRUCTOR_5( wxBitmapButton , wxWindow* , Parent , wxWindowID , Id , wxBitmap , Bitmap , wxPoint , Position , wxSize , Size ) + +#else +IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton, wxButton) +#endif + BEGIN_EVENT_TABLE(wxBitmapButton, wxBitmapButtonBase) EVT_SYS_COLOUR_CHANGED(wxBitmapButton::OnSysColourChanged) + EVT_ENTER_WINDOW(wxBitmapButton::OnMouseEnterOrLeave) + EVT_LEAVE_WINDOW(wxBitmapButton::OnMouseEnterOrLeave) END_EVENT_TABLE() /* @@ -68,29 +123,524 @@ bitmap "focus" , bitmap "disabled" , */ -bool wxBitmapButton::Create(wxWindow *parent, - wxWindowID id, - const wxBitmap& bitmap, - const wxPoint& pos, - const wxSize& size, long style, - const wxValidator& validator, - const wxString& name) +bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, + const wxBitmap& bitmap, + const wxPoint& pos, + const wxSize& size, long style, + const wxValidator& wxVALIDATOR_PARAM(validator), + const wxString& name) { - if ( !wxBitmapButtonBase::Create(parent, id, pos, size, style, - validator, name) ) + m_bmpNormal = bitmap; + SetName(name); + +#if wxUSE_VALIDATORS + SetValidator(validator); +#endif // wxUSE_VALIDATORS + + parent->AddChild(this); + + m_windowStyle = style; + + if ( style & wxBU_AUTODRAW ) + { + m_marginX = + m_marginY = 4; + } + + if (id == wxID_ANY) + m_windowId = NewControlId(); + else + m_windowId = id; + + long msStyle = WS_VISIBLE | WS_TABSTOP | WS_CHILD | BS_OWNERDRAW ; + + if ( m_windowStyle & wxCLIP_SIBLINGS ) + msStyle |= WS_CLIPSIBLINGS; + +#ifdef __WIN32__ + if(m_windowStyle & wxBU_LEFT) + msStyle |= BS_LEFT; + if(m_windowStyle & wxBU_RIGHT) + msStyle |= BS_RIGHT; + if(m_windowStyle & wxBU_TOP) + msStyle |= BS_TOP; + if(m_windowStyle & wxBU_BOTTOM) + msStyle |= BS_BOTTOM; +#endif + + m_hWnd = (WXHWND) CreateWindowEx( + 0, + wxT("BUTTON"), + wxEmptyString, + msStyle, + 0, 0, 0, 0, + GetWinHwnd(parent), + (HMENU)m_windowId, + wxGetInstance(), + NULL + ); + + // Subclass again for purposes of dialog editing mode + SubclassWin(m_hWnd); + + SetPosition(pos); + SetInitialSize(size); + + return true; +} + +bool wxBitmapButton::SetBackgroundColour(const wxColour& colour) +{ + if ( !wxBitmapButtonBase::SetBackgroundColour(colour) ) + { + // didn't change + return false; + } + + // invalidate the brush, it will be recreated the next time it's needed + m_brushDisabled = wxNullBrush; + + return true; +} + +void wxBitmapButton::OnSysColourChanged(wxSysColourChangedEvent& event) +{ + m_brushDisabled = wxNullBrush; + + if ( !IsEnabled() ) + { + // this change affects our current state + Refresh(); + } + + event.Skip(); +} + +void wxBitmapButton::OnMouseEnterOrLeave(wxMouseEvent& event) +{ + if ( IsEnabled() && m_bmpHover.Ok() ) + Refresh(); + + event.Skip(); +} + +void wxBitmapButton::OnSetBitmap() +{ + // if the focus bitmap is specified but hover one isn't, use the focus + // bitmap for hovering as well if this is consistent with the current + // Windows version look and feel + // + // rationale: this is compatible with the old wxGTK behaviour and also + // makes it much easier to do "the right thing" for all platforms (some of + // them, such as Windows XP, have "hot" buttons while others don't) + if ( !m_bmpHover.Ok() && + m_bmpFocus.Ok() && + wxUxThemeEngine::GetIfActive() ) + { + m_bmpHover = m_bmpFocus; + } + + // this will redraw us + wxBitmapButtonBase::OnSetBitmap(); +} + +#if wxUSE_UXTHEME +static +void MSWDrawXPBackground(wxButton *button, WXDRAWITEMSTRUCT *wxdis) +{ + LPDRAWITEMSTRUCT lpDIS = (LPDRAWITEMSTRUCT)wxdis; + HDC hdc = lpDIS->hDC; + UINT state = lpDIS->itemState; + RECT rectBtn; + CopyRect(&rectBtn, &lpDIS->rcItem); + + wxUxThemeHandle theme(button, L"BUTTON"); + int iState; + + if ( state & ODS_SELECTED ) + { + iState = PBS_PRESSED; + } + else if ( button->HasCapture() || button->IsMouseInWindow() ) + { + iState = PBS_HOT; + } + else if ( state & ODS_FOCUS ) + { + iState = PBS_DEFAULTED; + } + else if ( state & ODS_DISABLED ) + { + iState = PBS_DISABLED; + } + else + { + iState = PBS_NORMAL; + } + + // draw parent background if needed + if ( wxUxThemeEngine::Get()->IsThemeBackgroundPartiallyTransparent(theme, + BP_PUSHBUTTON, + iState) ) + { + wxUxThemeEngine::Get()->DrawThemeParentBackground(GetHwndOf(button), hdc, &rectBtn); + } + + // draw background + wxUxThemeEngine::Get()->DrawThemeBackground(theme, hdc, BP_PUSHBUTTON, iState, + &rectBtn, NULL); + + // calculate content area margins + MARGINS margins; + wxUxThemeEngine::Get()->GetThemeMargins(theme, hdc, BP_PUSHBUTTON, iState, + TMT_CONTENTMARGINS, &rectBtn, &margins); + RECT rectClient; + ::CopyRect(&rectClient, &rectBtn); + ::InflateRect(&rectClient, -margins.cxLeftWidth, -margins.cyTopHeight); + + // if focused and !nofocus rect + if ( (state & ODS_FOCUS) && !(state & ODS_NOFOCUSRECT) ) + { + DrawFocusRect(hdc, &rectClient); + } + + if ( button->UseBgCol() ) + { + COLORREF colBg = wxColourToRGB(button->GetBackgroundColour()); + HBRUSH hbrushBackground = ::CreateSolidBrush(colBg); + + // don't overwrite the focus rect + ::InflateRect(&rectClient, -1, -1); + FillRect(hdc, &rectClient, hbrushBackground); + ::DeleteObject(hbrushBackground); + } +} +#endif // wxUSE_UXTHEME + +// VZ: should be at the very least less than wxDEFAULT_BUTTON_MARGIN +#define FOCUS_MARGIN 3 + +bool wxBitmapButton::MSWOnDraw(WXDRAWITEMSTRUCT *item) +{ +#ifndef __WXWINCE__ + long style = GetWindowLong((HWND) GetHWND(), GWL_STYLE); + if (style & BS_BITMAP) + { + // Let default procedure draw the bitmap, which is defined + // in the Windows resource. + return false; + } +#endif + + LPDRAWITEMSTRUCT lpDIS = (LPDRAWITEMSTRUCT) item; + HDC hDC = lpDIS->hDC; + UINT state = lpDIS->itemState; + bool isSelected = (state & ODS_SELECTED) != 0; + bool autoDraw = (GetWindowStyleFlag() & wxBU_AUTODRAW) != 0; + + + // choose the bitmap to use depending on the button state + wxBitmap *bitmap; + + if ( isSelected && m_bmpSelected.Ok() ) + bitmap = &m_bmpSelected; + else if ( m_bmpHover.Ok() && IsMouseInWindow() ) + bitmap = &m_bmpHover; + else if ((state & ODS_FOCUS) && m_bmpFocus.Ok()) + bitmap = &m_bmpFocus; + else if ((state & ODS_DISABLED) && m_bmpDisabled.Ok()) + bitmap = &m_bmpDisabled; + else + bitmap = &m_bmpNormal; + + if ( !bitmap->Ok() ) return false; - if ( bitmap.IsOk() ) - SetBitmapLabel(bitmap); + // centre the bitmap in the control area + int x = lpDIS->rcItem.left; + int y = lpDIS->rcItem.top; + int width = lpDIS->rcItem.right - x; + int height = lpDIS->rcItem.bottom - y; + int wBmp = bitmap->GetWidth(); + int hBmp = bitmap->GetHeight(); - if ( !size.IsFullySpecified() ) +#if wxUSE_UXTHEME + if ( autoDraw && wxUxThemeEngine::GetIfActive() ) { - // As our bitmap has just changed, our best size has changed as well so - // reset the initial size using the new value. - SetInitialSize(size); + MSWDrawXPBackground(this, item); + wxUxThemeHandle theme(this, L"BUTTON"); + + // calculate content area margins + // assuming here that each state is the same size + MARGINS margins; + wxUxThemeEngine::Get()->GetThemeMargins(theme, NULL, + BP_PUSHBUTTON, PBS_NORMAL, + TMT_CONTENTMARGINS, NULL, + &margins); + int marginX = margins.cxLeftWidth + 1; + int marginY = margins.cyTopHeight + 1; + int x1,y1; + + if ( m_windowStyle & wxBU_LEFT ) + { + x1 = x + marginX; + } + else if ( m_windowStyle & wxBU_RIGHT ) + { + x1 = x + (width - wBmp) - marginX; + } + else + { + x1 = x + (width - wBmp) / 2; + } + + if ( m_windowStyle & wxBU_TOP ) + { + y1 = y + marginY; + } + else if ( m_windowStyle & wxBU_BOTTOM ) + { + y1 = y + (height - hBmp) - marginY; + } + else + { + y1 = y + (height - hBmp) / 2; + } + + // draw the bitmap + wxDCTemp dst((WXHDC)hDC); + dst.DrawBitmap(*bitmap, x1, y1, true); + + return true; + } +#endif // wxUSE_UXTHEME + + int x1,y1; + + if(m_windowStyle & wxBU_LEFT) + x1 = x + (FOCUS_MARGIN+1); + else if(m_windowStyle & wxBU_RIGHT) + x1 = x + (width - wBmp) - (FOCUS_MARGIN+1); + else + x1 = x + (width - wBmp) / 2; + + if(m_windowStyle & wxBU_TOP) + y1 = y + (FOCUS_MARGIN+1); + else if(m_windowStyle & wxBU_BOTTOM) + y1 = y + (height - hBmp) - (FOCUS_MARGIN+1); + else + y1 = y + (height - hBmp) / 2; + + if ( isSelected && autoDraw ) + { + x1++; + y1++; + } + + // draw the face, if auto-drawing + if ( autoDraw ) + { + DrawFace((WXHDC) hDC, + lpDIS->rcItem.left, lpDIS->rcItem.top, + lpDIS->rcItem.right, lpDIS->rcItem.bottom, + isSelected); + } + + // draw the bitmap + wxDCTemp dst((WXHDC)hDC); + dst.DrawBitmap(*bitmap, x1, y1, true); + + // draw focus / disabled state, if auto-drawing + if ( (state & ODS_DISABLED) && autoDraw ) + { + DrawButtonDisable((WXHDC) hDC, + lpDIS->rcItem.left, lpDIS->rcItem.top, + lpDIS->rcItem.right, lpDIS->rcItem.bottom, + true); + } + else if ( (state & ODS_FOCUS) && autoDraw ) + { + DrawButtonFocus((WXHDC) hDC, + lpDIS->rcItem.left, + lpDIS->rcItem.top, + lpDIS->rcItem.right, + lpDIS->rcItem.bottom, + isSelected); } return true; } +// GRG Feb/2000, support for bmp buttons with Win95/98 standard LNF + +void wxBitmapButton::DrawFace( WXHDC dc, int left, int top, + int right, int bottom, bool sel ) +{ + HPEN oldp; + HPEN penHiLight; + HPEN penLight; + HPEN penShadow; + HPEN penDkShadow; + HBRUSH brushFace; + + // create needed pens and brush + penHiLight = CreatePen(PS_SOLID, 0, GetSysColor(COLOR_3DHILIGHT)); + penLight = CreatePen(PS_SOLID, 0, GetSysColor(COLOR_3DLIGHT)); + penShadow = CreatePen(PS_SOLID, 0, GetSysColor(COLOR_3DSHADOW)); + penDkShadow = CreatePen(PS_SOLID, 0, GetSysColor(COLOR_3DDKSHADOW)); + brushFace = CreateSolidBrush(GetSysColor(COLOR_BTNFACE)); + + // draw the rectangle + RECT rect; + rect.left = left; + rect.right = right; + rect.top = top; + rect.bottom = bottom; + FillRect((HDC) dc, &rect, brushFace); + + // draw the border + oldp = (HPEN) SelectObject( (HDC) dc, sel? penDkShadow : penHiLight); + + wxDrawLine((HDC) dc, left, top, right-1, top); + wxDrawLine((HDC) dc, left, top+1, left, bottom-1); + + SelectObject( (HDC) dc, sel? penShadow : penLight); + wxDrawLine((HDC) dc, left+1, top+1, right-2, top+1); + wxDrawLine((HDC) dc, left+1, top+2, left+1, bottom-2); + + SelectObject( (HDC) dc, sel? penLight : penShadow); + wxDrawLine((HDC) dc, left+1, bottom-2, right-1, bottom-2); + wxDrawLine((HDC) dc, right-2, bottom-3, right-2, top); + + SelectObject( (HDC) dc, sel? penHiLight : penDkShadow); + wxDrawLine((HDC) dc, left, bottom-1, right+2, bottom-1); + wxDrawLine((HDC) dc, right-1, bottom-2, right-1, top-1); + + // delete allocated resources + SelectObject((HDC) dc,oldp); + DeleteObject(penHiLight); + DeleteObject(penLight); + DeleteObject(penShadow); + DeleteObject(penDkShadow); + DeleteObject(brushFace); +} + +void wxBitmapButton::DrawButtonFocus( WXHDC dc, int left, int top, int right, + int bottom, bool WXUNUSED(sel) ) +{ + RECT rect; + rect.left = left; + rect.top = top; + rect.right = right; + rect.bottom = bottom; + InflateRect( &rect, - FOCUS_MARGIN, - FOCUS_MARGIN ); + + // GRG: the focus rectangle should not move when the button is pushed! +/* + if ( sel ) + OffsetRect( &rect, 1, 1 ); +*/ + + DrawFocusRect( (HDC) dc, &rect ); +} + +void +wxBitmapButton::DrawButtonDisable( WXHDC dc, + int left, int top, int right, int bottom, + bool with_marg ) +{ + if ( !m_brushDisabled.Ok() ) + { + // draw a bitmap with two black and two background colour pixels + wxBitmap bmp(2, 2); + wxMemoryDC dc; + dc.SelectObject(bmp); + dc.SetPen(*wxBLACK_PEN); + dc.DrawPoint(0, 0); + dc.DrawPoint(1, 1); + dc.SetPen(GetBackgroundColour()); + dc.DrawPoint(0, 1); + dc.DrawPoint(1, 0); + + m_brushDisabled = wxBrush(bmp); + } + + SelectInHDC selectBrush((HDC)dc, GetHbrushOf(m_brushDisabled)); + + // ROP for "dest |= pattern" operation -- as it doesn't have a standard + // name, give it our own + static const DWORD PATTERNPAINT = 0xFA0089UL; + + if ( with_marg ) + { + left += m_marginX; + top += m_marginY; + right -= 2 * m_marginX; + bottom -= 2 * m_marginY; + } + + ::PatBlt( (HDC) dc, left, top, right, bottom, PATTERNPAINT); +} + +void wxBitmapButton::SetDefault() +{ + wxButton::SetDefault(); +} + +wxSize wxBitmapButton::DoGetBestSize() const +{ + if ( m_bmpNormal.Ok() ) + { + int width = m_bmpNormal.GetWidth(), + height = m_bmpNormal.GetHeight(); + int marginH = 0, + marginV = 0; + +#if wxUSE_UXTHEME + if ( wxUxThemeEngine::GetIfActive() ) + { + wxUxThemeHandle theme((wxBitmapButton *)this, L"BUTTON"); + + MARGINS margins; + wxUxThemeEngine::Get()->GetThemeMargins(theme, NULL, + BP_PUSHBUTTON, PBS_NORMAL, + TMT_CONTENTMARGINS, NULL, + &margins); + + // XP doesn't draw themed buttons correctly when the client area is + // smaller than 8x8 - enforce this minimum size for small bitmaps + if ( width < 8 ) + width = 8; + if ( height < 8 ) + height = 8; + + // don't add margins for the borderless buttons, they don't need + // them and it just makes them appear larger than needed + if ( !HasFlag(wxBORDER_NONE) ) + { + // we need 2 extra pixels for the focus rectangle, without them + // it's overwritten by the bitmap itself + marginH = margins.cxLeftWidth + margins.cxRightWidth + 2; + marginV = margins.cyTopHeight + margins.cyBottomHeight + 2; + } + } + else +#endif // wxUSE_UXTHEME + { + if ( !HasFlag(wxBORDER_NONE) ) + { + marginH = 2*m_marginX; + marginV = 2*m_marginY; + } + } + + wxSize best(width + marginH, height + marginV); + CacheBestSize(best); + return best; + } + + // no idea what our best size should be, defer to the base class + return wxBitmapButtonBase::DoGetBestSize(); +} + #endif // wxUSE_BMPBUTTON diff --git a/Source/3rd Party/wx/src/msw/brush.cpp b/Source/3rd Party/wx/src/msw/brush.cpp index 70c5c918d..ac03729cb 100644 --- a/Source/3rd Party/wx/src/msw/brush.cpp +++ b/Source/3rd Party/wx/src/msw/brush.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 04/01/98 -// RCS-ID: $Id$ +// RCS-ID: $Id: brush.cpp 42776 2006-10-30 22:03:53Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -30,7 +30,6 @@ #include "wx/list.h" #include "wx/utils.h" #include "wx/app.h" - #include "wx/bitmap.h" #endif // WX_PRECOMP #include "wx/msw/private.h" @@ -42,7 +41,7 @@ class WXDLLEXPORT wxBrushRefData: public wxGDIRefData { public: - wxBrushRefData(const wxColour& colour = wxNullColour, wxBrushStyle style = wxBRUSHSTYLE_SOLID); + wxBrushRefData(const wxColour& colour = wxNullColour, int style = wxSOLID); wxBrushRefData(const wxBitmap& stipple); wxBrushRefData(const wxBrushRefData& data); virtual ~wxBrushRefData(); @@ -53,17 +52,17 @@ public: void Free(); const wxColour& GetColour() const { return m_colour; } - wxBrushStyle GetStyle() const { return m_style; } + int GetStyle() const { return m_style; } wxBitmap *GetStipple() { return &m_stipple; } void SetColour(const wxColour& colour) { Free(); m_colour = colour; } - void SetStyle(wxBrushStyle style) { Free(); m_style = style; } + void SetStyle(int style) { Free(); m_style = style; } void SetStipple(const wxBitmap& stipple) { Free(); DoSetStipple(stipple); } private: void DoSetStipple(const wxBitmap& stipple); - wxBrushStyle m_style; + int m_style; wxBitmap m_stipple; wxColour m_colour; HBRUSH m_hBrush; @@ -85,7 +84,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxBrush, wxGDIObject) // wxBrushRefData ctors/dtor // ---------------------------------------------------------------------------- -wxBrushRefData::wxBrushRefData(const wxColour& colour, wxBrushStyle style) +wxBrushRefData::wxBrushRefData(const wxColour& colour, int style) : m_colour(colour) { m_style = style; @@ -131,8 +130,7 @@ bool wxBrushRefData::operator==(const wxBrushRefData& data) const void wxBrushRefData::DoSetStipple(const wxBitmap& stipple) { m_stipple = stipple; - m_style = stipple.GetMask() ? wxBRUSHSTYLE_STIPPLE_MASK_OPAQUE - : wxBRUSHSTYLE_STIPPLE; + m_style = stipple.GetMask() ? wxSTIPPLE_MASK_OPAQUE : wxSTIPPLE; } // ---------------------------------------------------------------------------- @@ -155,12 +153,12 @@ static int TranslateHatchStyle(int style) { switch ( style ) { - case wxBRUSHSTYLE_BDIAGONAL_HATCH: return HS_BDIAGONAL; - case wxBRUSHSTYLE_CROSSDIAG_HATCH: return HS_DIAGCROSS; - case wxBRUSHSTYLE_FDIAGONAL_HATCH: return HS_FDIAGONAL; - case wxBRUSHSTYLE_CROSS_HATCH: return HS_CROSS; - case wxBRUSHSTYLE_HORIZONTAL_HATCH:return HS_HORIZONTAL; - case wxBRUSHSTYLE_VERTICAL_HATCH: return HS_VERTICAL; + case wxBDIAGONAL_HATCH: return HS_BDIAGONAL; + case wxCROSSDIAG_HATCH: return HS_DIAGCROSS; + case wxFDIAGONAL_HATCH: return HS_FDIAGONAL; + case wxCROSS_HATCH: return HS_CROSS; + case wxHORIZONTAL_HATCH:return HS_HORIZONTAL; + case wxVERTICAL_HATCH: return HS_VERTICAL; default: return -1; } } @@ -178,24 +176,24 @@ HBRUSH wxBrushRefData::GetHBRUSH() { switch ( m_style ) { - case wxBRUSHSTYLE_TRANSPARENT: + case wxTRANSPARENT: m_hBrush = (HBRUSH)::GetStockObject(NULL_BRUSH); break; - case wxBRUSHSTYLE_STIPPLE: + case wxSTIPPLE: m_hBrush = ::CreatePatternBrush(GetHbitmapOf(m_stipple)); break; - case wxBRUSHSTYLE_STIPPLE_MASK_OPAQUE: + case wxSTIPPLE_MASK_OPAQUE: m_hBrush = ::CreatePatternBrush((HBITMAP)m_stipple.GetMask() ->GetMaskBitmap()); break; default: - wxFAIL_MSG( wxT("unknown brush style") ); + wxFAIL_MSG( _T("unknown brush style") ); // fall through - case wxBRUSHSTYLE_SOLID: + case wxSOLID: m_hBrush = ::CreateSolidBrush(m_colour.GetPixel()); break; } @@ -209,7 +207,7 @@ HBRUSH wxBrushRefData::GetHBRUSH() if ( !m_hBrush ) { - wxLogLastError(wxT("CreateXXXBrush()")); + wxLogLastError(_T("CreateXXXBrush()")); } } @@ -228,18 +226,11 @@ wxBrush::wxBrush() { } -wxBrush::wxBrush(const wxColour& col, wxBrushStyle style) +wxBrush::wxBrush(const wxColour& col, int style) { m_refData = new wxBrushRefData(col, style); } -#if FUTURE_WXWIN_COMPATIBILITY_3_0 -wxBrush::wxBrush(const wxColour& col, int style) -{ - m_refData = new wxBrushRefData(col, (wxBrushStyle)style); -} -#endif - wxBrush::wxBrush(const wxBitmap& stipple) { m_refData = new wxBrushRefData(stipple); @@ -261,12 +252,12 @@ bool wxBrush::operator==(const wxBrush& brush) const return m_refData ? (brushData && *M_BRUSHDATA == *brushData) : !brushData; } -wxGDIRefData *wxBrush::CreateGDIRefData() const +wxObjectRefData *wxBrush::CreateRefData() const { return new wxBrushRefData; } -wxGDIRefData *wxBrush::CloneGDIRefData(const wxGDIRefData *data) const +wxObjectRefData *wxBrush::CloneRefData(const wxObjectRefData *data) const { return new wxBrushRefData(*(const wxBrushRefData *)data); } @@ -277,28 +268,28 @@ wxGDIRefData *wxBrush::CloneGDIRefData(const wxGDIRefData *data) const wxColour wxBrush::GetColour() const { - wxCHECK_MSG( IsOk(), wxNullColour, wxT("invalid brush") ); + wxCHECK_MSG( Ok(), wxNullColour, _T("invalid brush") ); return M_BRUSHDATA->GetColour(); } -wxBrushStyle wxBrush::GetStyle() const +int wxBrush::GetStyle() const { - wxCHECK_MSG( IsOk(), wxBRUSHSTYLE_INVALID, wxT("invalid brush") ); + wxCHECK_MSG( Ok(), 0, _T("invalid brush") ); return M_BRUSHDATA->GetStyle(); } wxBitmap *wxBrush::GetStipple() const { - wxCHECK_MSG( IsOk(), NULL, wxT("invalid brush") ); + wxCHECK_MSG( Ok(), NULL, _T("invalid brush") ); return M_BRUSHDATA->GetStipple(); } WXHANDLE wxBrush::GetResourceHandle() const { - wxCHECK_MSG( IsOk(), FALSE, wxT("invalid brush") ); + wxCHECK_MSG( Ok(), FALSE, _T("invalid brush") ); return (WXHANDLE)M_BRUSHDATA->GetHBRUSH(); } @@ -321,7 +312,7 @@ void wxBrush::SetColour(unsigned char r, unsigned char g, unsigned char b) M_BRUSHDATA->SetColour(wxColour(r, g, b)); } -void wxBrush::SetStyle(wxBrushStyle style) +void wxBrush::SetStyle(int style) { AllocExclusive(); diff --git a/Source/3rd Party/wx/src/msw/button.cpp b/Source/3rd Party/wx/src/msw/button.cpp index a53472666..635e4b926 100644 --- a/Source/3rd Party/wx/src/msw/button.cpp +++ b/Source/3rd Party/wx/src/msw/button.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 04/01/98 -// RCS-ID: $Id$ +// RCS-ID: $Id: button.cpp 51575 2008-02-06 19:58:30Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -37,34 +37,109 @@ #include "wx/dcscreen.h" #include "wx/dcclient.h" #include "wx/toplevel.h" - #include "wx/msw/wrapcctl.h" - #include "wx/msw/private.h" - #include "wx/msw/missing.h" #endif -#include "wx/imaglist.h" #include "wx/stockitem.h" -#include "wx/msw/private/button.h" -#include "wx/msw/private/dc.h" -#include "wx/private/window.h" +#include "wx/tokenzr.h" +#include "wx/msw/private.h" -#if wxUSE_MARKUP - #include "wx/generic/private/markuptext.h" -#endif // wxUSE_MARKUP +#if wxUSE_UXTHEME + #include "wx/msw/uxtheme.h" -// set the value for BCM_SETSHIELD (for the UAC shield) if it's not defined in -// the header -#ifndef BCM_SETSHIELD - #define BCM_SETSHIELD 0x160c + // no need to include tmschema.h + #ifndef BP_PUSHBUTTON + #define BP_PUSHBUTTON 1 + + #define PBS_NORMAL 1 + #define PBS_HOT 2 + #define PBS_PRESSED 3 + #define PBS_DISABLED 4 + #define PBS_DEFAULTED 5 + + #define TMT_CONTENTMARGINS 3602 + #endif +#endif // wxUSE_UXTHEME + +#ifndef WM_THEMECHANGED + #define WM_THEMECHANGED 0x031A +#endif + +#ifndef ODS_NOACCEL + #define ODS_NOACCEL 0x0100 +#endif + +#ifndef ODS_NOFOCUSRECT + #define ODS_NOFOCUSRECT 0x0200 #endif // ---------------------------------------------------------------------------- // macros // ---------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(wxButton, wxButtonBase) - EVT_CHAR_HOOK(wxButton::OnCharHook) -END_EVENT_TABLE() +#if wxUSE_EXTENDED_RTTI + +WX_DEFINE_FLAGS( wxButtonStyle ) + +wxBEGIN_FLAGS( wxButtonStyle ) + // new style border flags, we put them first to + // use them for streaming out + wxFLAGS_MEMBER(wxBORDER_SIMPLE) + wxFLAGS_MEMBER(wxBORDER_SUNKEN) + wxFLAGS_MEMBER(wxBORDER_DOUBLE) + wxFLAGS_MEMBER(wxBORDER_RAISED) + wxFLAGS_MEMBER(wxBORDER_STATIC) + wxFLAGS_MEMBER(wxBORDER_NONE) + + // old style border flags + wxFLAGS_MEMBER(wxSIMPLE_BORDER) + wxFLAGS_MEMBER(wxSUNKEN_BORDER) + wxFLAGS_MEMBER(wxDOUBLE_BORDER) + wxFLAGS_MEMBER(wxRAISED_BORDER) + wxFLAGS_MEMBER(wxSTATIC_BORDER) + wxFLAGS_MEMBER(wxBORDER) + + // standard window styles + wxFLAGS_MEMBER(wxTAB_TRAVERSAL) + wxFLAGS_MEMBER(wxCLIP_CHILDREN) + wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW) + wxFLAGS_MEMBER(wxWANTS_CHARS) + wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE) + wxFLAGS_MEMBER(wxALWAYS_SHOW_SB ) + wxFLAGS_MEMBER(wxVSCROLL) + wxFLAGS_MEMBER(wxHSCROLL) + + wxFLAGS_MEMBER(wxBU_LEFT) + wxFLAGS_MEMBER(wxBU_RIGHT) + wxFLAGS_MEMBER(wxBU_TOP) + wxFLAGS_MEMBER(wxBU_BOTTOM) + wxFLAGS_MEMBER(wxBU_EXACTFIT) +wxEND_FLAGS( wxButtonStyle ) + +IMPLEMENT_DYNAMIC_CLASS_XTI(wxButton, wxControl,"wx/button.h") + +wxBEGIN_PROPERTIES_TABLE(wxButton) + wxEVENT_PROPERTY( Click , wxEVT_COMMAND_BUTTON_CLICKED , wxCommandEvent) + + wxPROPERTY( Font , wxFont , SetFont , GetFont , EMPTY_MACROVALUE, 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY( Label, wxString , SetLabel, GetLabel, wxString(), 0 /*flags*/ , wxT("Helpstring") , wxT("group") ) + + wxPROPERTY_FLAGS( WindowStyle , wxButtonStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style + +wxEND_PROPERTIES_TABLE() + +wxBEGIN_HANDLERS_TABLE(wxButton) +wxEND_HANDLERS_TABLE() + +wxCONSTRUCTOR_6( wxButton , wxWindow* , Parent , wxWindowID , Id , wxString , Label , wxPoint , Position , wxSize , Size , long , WindowStyle ) + + +#else +IMPLEMENT_DYNAMIC_CLASS(wxButton, wxControl) +#endif + +// this macro tries to adjust the default button height to a reasonable value +// using the char height as the base +#define BUTTON_HEIGHT_FROM_CHAR_HEIGHT(cy) (11*EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy)/10) // ============================================================================ // implementation @@ -86,14 +161,16 @@ bool wxButton::Create(wxWindow *parent, wxString label(lbl); if (label.empty() && wxIsStockID(id)) { - // On Windows, some buttons aren't supposed to have mnemonics - label = wxGetStockLabel - ( - id, - id == wxID_OK || id == wxID_CANCEL || id == wxID_CLOSE - ? wxSTOCK_NOFLAGS - : wxSTOCK_WITH_MNEMONIC - ); + // On Windows, some buttons aren't supposed to have + // mnemonics, so strip them out. + + label = wxGetStockLabel(id +#if defined(__WXMSW__) || defined(__WXWINCE__) + , ( id != wxID_OK && + id != wxID_CANCEL && + id != wxID_CLOSE ) +#endif + ); } if ( !CreateControl(parent, id, pos, size, style, validator, name) ) @@ -102,15 +179,21 @@ bool wxButton::Create(wxWindow *parent, WXDWORD exstyle; WXDWORD msStyle = MSWGetStyle(style, &exstyle); +#ifdef __WIN32__ // if the label contains several lines we must explicitly tell the button // about it or it wouldn't draw it correctly ("\n"s would just appear as // black boxes) // // NB: we do it here and not in MSWGetStyle() because we need the label - // value and the label is not set yet when MSWGetStyle() is called - msStyle |= wxMSWButton::GetMultilineStyle(label); + // value and m_label is not set yet when MSWGetStyle() is called; + // besides changing BS_MULTILINE during run-time is pointless anyhow + if ( label.find(_T('\n')) != wxString::npos ) + { + msStyle |= BS_MULTILINE; + } +#endif // __WIN32__ - return MSWCreateControl(wxT("BUTTON"), msStyle, pos, size, label, exstyle); + return MSWCreateControl(_T("BUTTON"), msStyle, pos, size, label, exstyle); } wxButton::~wxButton() @@ -135,10 +218,11 @@ WXDWORD wxButton::MSWGetStyle(long style, WXDWORD *exstyle) const ); // we must use WS_CLIPSIBLINGS with the buttons or they would draw over - // each other in any resizable dialog which has more than one button in + // each other in any resizeable dialog which has more than one button in // the bottom msStyle |= WS_CLIPSIBLINGS; +#ifdef __WIN32__ // don't use "else if" here: weird as it is, but you may combine wxBU_LEFT // and wxBU_RIGHT to get BS_CENTER! if ( style & wxBU_LEFT ) @@ -154,10 +238,47 @@ WXDWORD wxButton::MSWGetStyle(long style, WXDWORD *exstyle) const if ( style & wxNO_BORDER ) msStyle |= BS_FLAT; #endif // __WXWINCE__ +#endif // __WIN32__ return msStyle; } +// ---------------------------------------------------------------------------- +// size management including autosizing +// ---------------------------------------------------------------------------- + +wxSize wxButton::DoGetBestSize() const +{ + wxClientDC dc(wx_const_cast(wxButton *, this)); + dc.SetFont(GetFont()); + + wxCoord wBtn, + hBtn; + dc.GetMultiLineTextExtent(GetLabelText(), &wBtn, &hBtn); + + // add a margin -- the button is wider than just its label + wBtn += 3*GetCharWidth(); + hBtn = BUTTON_HEIGHT_FROM_CHAR_HEIGHT(hBtn); + + // all buttons have at least the standard size unless the user explicitly + // wants them to be of smaller size and used wxBU_EXACTFIT style when + // creating the button + if ( !HasFlag(wxBU_EXACTFIT) ) + { + wxSize sz = GetDefaultSize(); + if (wBtn > sz.x) + sz.x = wBtn; + if (hBtn > sz.y) + sz.y = hBtn; + + return sz; + } + + wxSize best(wBtn, hBtn); + CacheBestSize(best); + return best; +} + /* static */ wxSize wxButtonBase::GetDefaultSize() { @@ -168,20 +289,16 @@ wxSize wxButtonBase::GetDefaultSize() wxScreenDC dc; dc.SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)); - // The size of a standard button in the dialog units is 50x14, - // translate this to pixels. - // - // Windows' computes dialog units using average character width over - // upper- and lower-case ASCII alphabet and not using the average - // character width metadata stored in the font; see - // http://support.microsoft.com/default.aspx/kb/145994 for detailed - // discussion. - // - // NB: wxMulDivInt32() is used, because it correctly rounds the result - - const wxSize base = wxPrivate::GetAverageASCIILetterSize(dc); - s_sizeBtn.x = wxMulDivInt32(50, base.x, 4); - s_sizeBtn.y = wxMulDivInt32(14, base.y, 8); + // the size of a standard button in the dialog units is 50x14, + // translate this to pixels + // NB1: the multipliers come from the Windows convention + // NB2: the extra +1/+2 were needed to get the size be the same as the + // size of the buttons in the standard dialog - I don't know how + // this happens, but on my system this size is 75x23 in pixels and + // 23*8 isn't even divisible by 14... Would be nice to understand + // why these constants are needed though! + s_sizeBtn.x = (50 * (dc.GetCharWidth() + 1))/4; + s_sizeBtn.y = ((14 * dc.GetCharHeight()) + 2)/8; } return s_sizeBtn; @@ -192,14 +309,6 @@ wxSize wxButtonBase::GetDefaultSize() // ---------------------------------------------------------------------------- /* - The comment below and all this code is probably due to not using WM_NEXTDLGCTL - message when changing focus (but just SetFocus() which is not enough), see - http://blogs.msdn.com/oldnewthing/archive/2004/08/02/205624.aspx for the - full explanation. - - TODO: Do use WM_NEXTDLGCTL and get rid of all this code. - - "Everything you ever wanted to know about the default buttons" or "Why do we have to do all this?" @@ -234,16 +343,18 @@ wxSize wxButtonBase::GetDefaultSize() */ // set this button as the (permanently) default one in its panel -wxWindow *wxButton::SetDefault() +void wxButton::SetDefault() { + wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent(this), wxTopLevelWindow); + + wxCHECK_RET( tlw, _T("button without top level window?") ); + // set this one as the default button both for wxWidgets ... - wxWindow *winOldDefault = wxButtonBase::SetDefault(); + wxWindow *winOldDefault = tlw->SetDefaultItem(this); // ... and Windows SetDefaultStyle(wxDynamicCast(winOldDefault, wxButton), false); SetDefaultStyle(this, true); - - return winOldDefault; } // return the top level parent window if it's not being deleted yet, otherwise @@ -266,10 +377,10 @@ static wxTopLevelWindow *GetTLWParentIfNotBeingDeleted(wxWindow *win) win = parent; } - wxASSERT_MSG( win, wxT("button without top level parent?") ); + wxASSERT_MSG( win, _T("button without top level parent?") ); wxTopLevelWindow * const tlw = wxDynamicCast(win, wxTopLevelWindow); - wxASSERT_MSG( tlw, wxT("logic error in GetTLWParentIfNotBeingDeleted()") ); + wxASSERT_MSG( tlw, _T("logic error in GetTLWParentIfNotBeingDeleted()") ); return tlw; } @@ -277,7 +388,7 @@ static wxTopLevelWindow *GetTLWParentIfNotBeingDeleted(wxWindow *win) // set this button as being currently default void wxButton::SetTmpDefault() { - wxTopLevelWindow * const tlw = GetTLWParentIfNotBeingDeleted(this); + wxTopLevelWindow * const tlw = GetTLWParentIfNotBeingDeleted(GetParent()); if ( !tlw ) return; @@ -291,7 +402,7 @@ void wxButton::SetTmpDefault() // unset this button as currently default, it may still stay permanent default void wxButton::UnsetTmpDefault() { - wxTopLevelWindow * const tlw = GetTLWParentIfNotBeingDeleted(this); + wxTopLevelWindow * const tlw = GetTLWParentIfNotBeingDeleted(GetParent()); if ( !tlw ) return; @@ -321,7 +432,7 @@ wxButton::SetDefaultStyle(wxButton *btn, bool on) return; wxWindow * const tlw = wxGetTopLevelParent(btn); - wxCHECK_RET( tlw, wxT("button without top level window?") ); + wxCHECK_RET( tlw, _T("button without top level window?") ); ::SendMessage(GetHwndOf(tlw), DM_SETDEFID, btn->GetId(), 0L); @@ -374,25 +485,6 @@ void wxButton::Command(wxCommandEvent & event) // event/message handlers // ---------------------------------------------------------------------------- -void wxButton::OnCharHook(wxKeyEvent& event) -{ - // We want to ensure that the button always processes Enter key events - // itself, even if it's inside some control that normally takes over them - // (this happens when the button is part of an in-place editor control for - // example). - if ( event.GetKeyCode() == WXK_RETURN ) - { - // We should ensure that subsequent key events are still generated even - // if we did handle EVT_CHAR_HOOK (normally this would suppress their - // generation). - event.DoAllowNextEvent(); - } - else - { - event.Skip(); - } -} - bool wxButton::MSWCommand(WXUINT param, WXWORD WXUNUSED(id)) { bool processed = false; @@ -432,30 +524,367 @@ WXLRESULT wxButton::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) { UnsetTmpDefault(); } + else if ( nMsg == WM_LBUTTONDBLCLK ) + { + // emulate a click event to force an owner-drawn button to change its + // appearance - without this, it won't do it + (void)wxControl::MSWWindowProc(WM_LBUTTONDOWN, wParam, lParam); + + // and continue with processing the message normally as well + } +#if wxUSE_UXTHEME + else if ( nMsg == WM_THEMECHANGED ) + { + // need to recalculate the best size here + // as the theme size might have changed + InvalidateBestSize(); + } + else if ( wxUxThemeEngine::GetIfActive() ) + { + // we need to Refresh() if mouse has entered or left window + // so we can update the hot tracking state + // must use m_mouseInWindow here instead of IsMouseInWindow() + // since we need to know the first time the mouse enters the window + // and IsMouseInWindow() would return true in this case + if ( ( nMsg == WM_MOUSEMOVE && !m_mouseInWindow ) || + nMsg == WM_MOUSELEAVE ) + { + Refresh(); + } + } +#endif // wxUSE_UXTHEME // let the base class do all real processing - return wxAnyButton::MSWWindowProc(nMsg, wParam, lParam); + return wxControl::MSWWindowProc(nMsg, wParam, lParam); } // ---------------------------------------------------------------------------- -// authentication needed handling +// owner-drawn buttons support // ---------------------------------------------------------------------------- -bool wxButton::DoGetAuthNeeded() const -{ - return m_authNeeded; -} +#ifdef __WIN32__ -void wxButton::DoSetAuthNeeded(bool show) +// drawing helpers + +static void DrawButtonText(HDC hdc, + RECT *pRect, + const wxString& text, + COLORREF col) { - // show/hide UAC symbol on Windows Vista and later - if ( wxGetWinVersion() >= wxWinVersion_6 ) + COLORREF colOld = SetTextColor(hdc, col); + int modeOld = SetBkMode(hdc, TRANSPARENT); + + if ( text.find(_T('\n')) != wxString::npos ) { - m_authNeeded = show; - ::SendMessage(GetHwnd(), BCM_SETSHIELD, 0, show); - InvalidateBestSize(); + // draw multiline label + + // first we need to compute its bounding rect + RECT rc; + ::CopyRect(&rc, pRect); + ::DrawText(hdc, text, text.length(), &rc, DT_CENTER | DT_CALCRECT); + + // now center this rect inside the entire button area + const LONG w = rc.right - rc.left; + const LONG h = rc.bottom - rc.top; + rc.left = (pRect->right - pRect->left)/2 - w/2; + rc.right = rc.left+w; + rc.top = (pRect->bottom - pRect->top)/2 - h/2; + rc.bottom = rc.top+h; + + ::DrawText(hdc, text, text.length(), &rc, DT_CENTER); + } + else // single line label + { + // Note: we must have DT_SINGLELINE for DT_VCENTER to work. + ::DrawText(hdc, text, text.length(), pRect, + DT_SINGLELINE | DT_CENTER | DT_VCENTER); + } + + SetBkMode(hdc, modeOld); + SetTextColor(hdc, colOld); +} + +static void DrawRect(HDC hdc, const RECT& r) +{ + wxDrawLine(hdc, r.left, r.top, r.right, r.top); + wxDrawLine(hdc, r.right, r.top, r.right, r.bottom); + wxDrawLine(hdc, r.right, r.bottom, r.left, r.bottom); + wxDrawLine(hdc, r.left, r.bottom, r.left, r.top); +} + +void wxButton::MakeOwnerDrawn() +{ + long style = GetWindowLong(GetHwnd(), GWL_STYLE); + if ( (style & BS_OWNERDRAW) != BS_OWNERDRAW ) + { + // make it so + style |= BS_OWNERDRAW; + SetWindowLong(GetHwnd(), GWL_STYLE, style); } } -#endif // wxUSE_BUTTON +bool wxButton::SetBackgroundColour(const wxColour &colour) +{ + if ( !wxControl::SetBackgroundColour(colour) ) + { + // nothing to do + return false; + } + MakeOwnerDrawn(); + + Refresh(); + + return true; +} + +bool wxButton::SetForegroundColour(const wxColour &colour) +{ + if ( !wxControl::SetForegroundColour(colour) ) + { + // nothing to do + return false; + } + + MakeOwnerDrawn(); + + Refresh(); + + return true; +} + +/* + The button frame looks like this normally: + + WWWWWWWWWWWWWWWWWWB + WHHHHHHHHHHHHHHHHGB W = white (HILIGHT) + WH GB H = light grey (LIGHT) + WH GB G = dark grey (SHADOW) + WH GB B = black (DKSHADOW) + WH GB + WGGGGGGGGGGGGGGGGGB + BBBBBBBBBBBBBBBBBBB + + When the button is selected, the button becomes like this (the total button + size doesn't change): + + BBBBBBBBBBBBBBBBBBB + BWWWWWWWWWWWWWWWWBB + BWHHHHHHHHHHHHHHGBB + BWH GBB + BWH GBB + BWGGGGGGGGGGGGGGGBB + BBBBBBBBBBBBBBBBBBB + BBBBBBBBBBBBBBBBBBB + + When the button is pushed (while selected) it is like: + + BBBBBBBBBBBBBBBBBBB + BGGGGGGGGGGGGGGGGGB + BG GB + BG GB + BG GB + BG GB + BGGGGGGGGGGGGGGGGGB + BBBBBBBBBBBBBBBBBBB +*/ + +static void DrawButtonFrame(HDC hdc, const RECT& rectBtn, + bool selected, bool pushed) +{ + RECT r; + CopyRect(&r, &rectBtn); + + HPEN hpenBlack = CreatePen(PS_SOLID, 1, GetSysColor(COLOR_3DDKSHADOW)), + hpenGrey = CreatePen(PS_SOLID, 1, GetSysColor(COLOR_3DSHADOW)), + hpenLightGr = CreatePen(PS_SOLID, 1, GetSysColor(COLOR_3DLIGHT)), + hpenWhite = CreatePen(PS_SOLID, 1, GetSysColor(COLOR_3DHILIGHT)); + + HPEN hpenOld = (HPEN)SelectObject(hdc, hpenBlack); + + r.right--; + r.bottom--; + + if ( pushed ) + { + DrawRect(hdc, r); + + (void)SelectObject(hdc, hpenGrey); + ::InflateRect(&r, -1, -1); + + DrawRect(hdc, r); + } + else // !pushed + { + if ( selected ) + { + DrawRect(hdc, r); + + ::InflateRect(&r, -1, -1); + } + + wxDrawLine(hdc, r.left, r.bottom, r.right, r.bottom); + wxDrawLine(hdc, r.right, r.bottom, r.right, r.top - 1); + + (void)SelectObject(hdc, hpenWhite); + wxDrawLine(hdc, r.left, r.bottom - 1, r.left, r.top); + wxDrawLine(hdc, r.left, r.top, r.right, r.top); + + (void)SelectObject(hdc, hpenLightGr); + wxDrawLine(hdc, r.left + 1, r.bottom - 2, r.left + 1, r.top + 1); + wxDrawLine(hdc, r.left + 1, r.top + 1, r.right - 1, r.top + 1); + + (void)SelectObject(hdc, hpenGrey); + wxDrawLine(hdc, r.left + 1, r.bottom - 1, r.right - 1, r.bottom - 1); + wxDrawLine(hdc, r.right - 1, r.bottom - 1, r.right - 1, r.top); + } + + (void)SelectObject(hdc, hpenOld); + DeleteObject(hpenWhite); + DeleteObject(hpenLightGr); + DeleteObject(hpenGrey); + DeleteObject(hpenBlack); +} + +#if wxUSE_UXTHEME +static +void MSWDrawXPBackground(wxButton *button, WXDRAWITEMSTRUCT *wxdis) +{ + LPDRAWITEMSTRUCT lpDIS = (LPDRAWITEMSTRUCT)wxdis; + HDC hdc = lpDIS->hDC; + UINT state = lpDIS->itemState; + RECT rectBtn; + CopyRect(&rectBtn, &lpDIS->rcItem); + + wxUxThemeHandle theme(button, L"BUTTON"); + int iState; + + if ( state & ODS_SELECTED ) + { + iState = PBS_PRESSED; + } + else if ( button->HasCapture() || button->IsMouseInWindow() ) + { + iState = PBS_HOT; + } + else if ( state & ODS_FOCUS ) + { + iState = PBS_DEFAULTED; + } + else if ( state & ODS_DISABLED ) + { + iState = PBS_DISABLED; + } + else + { + iState = PBS_NORMAL; + } + + // draw parent background if needed + if ( wxUxThemeEngine::Get()->IsThemeBackgroundPartiallyTransparent(theme, + BP_PUSHBUTTON, + iState) ) + { + wxUxThemeEngine::Get()->DrawThemeParentBackground(GetHwndOf(button), hdc, &rectBtn); + } + + // draw background + wxUxThemeEngine::Get()->DrawThemeBackground(theme, hdc, BP_PUSHBUTTON, iState, + &rectBtn, NULL); + + // calculate content area margins + MARGINS margins; + wxUxThemeEngine::Get()->GetThemeMargins(theme, hdc, BP_PUSHBUTTON, iState, + TMT_CONTENTMARGINS, &rectBtn, &margins); + RECT rectClient; + ::CopyRect(&rectClient, &rectBtn); + ::InflateRect(&rectClient, -margins.cxLeftWidth, -margins.cyTopHeight); + + // if focused and !nofocus rect + if ( (state & ODS_FOCUS) && !(state & ODS_NOFOCUSRECT) ) + { + DrawFocusRect(hdc, &rectClient); + } + + if ( button->UseBgCol() ) + { + COLORREF colBg = wxColourToRGB(button->GetBackgroundColour()); + HBRUSH hbrushBackground = ::CreateSolidBrush(colBg); + + // don't overwrite the focus rect + ::InflateRect(&rectClient, -1, -1); + FillRect(hdc, &rectClient, hbrushBackground); + ::DeleteObject(hbrushBackground); + } +} +#endif // wxUSE_UXTHEME + +bool wxButton::MSWOnDraw(WXDRAWITEMSTRUCT *wxdis) +{ + LPDRAWITEMSTRUCT lpDIS = (LPDRAWITEMSTRUCT)wxdis; + HDC hdc = lpDIS->hDC; + UINT state = lpDIS->itemState; + RECT rectBtn; + CopyRect(&rectBtn, &lpDIS->rcItem); + +#if wxUSE_UXTHEME + if ( wxUxThemeEngine::GetIfActive() ) + { + MSWDrawXPBackground(this, wxdis); + } + else +#endif // wxUSE_UXTHEME + { + COLORREF colBg = wxColourToRGB(GetBackgroundColour()); + + // first, draw the background + HBRUSH hbrushBackground = ::CreateSolidBrush(colBg); + FillRect(hdc, &rectBtn, hbrushBackground); + ::DeleteObject(hbrushBackground); + + // draw the border for the current state + bool selected = (state & ODS_SELECTED) != 0; + if ( !selected ) + { + wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent(this), wxTopLevelWindow); + if ( tlw ) + { + selected = tlw->GetDefaultItem() == this; + } + } + bool pushed = (SendMessage(GetHwnd(), BM_GETSTATE, 0, 0) & BST_PUSHED) != 0; + + DrawButtonFrame(hdc, rectBtn, selected, pushed); + + // if focused and !nofocus rect + if ( (state & ODS_FOCUS) && !(state & ODS_NOFOCUSRECT) ) + { + RECT rectFocus; + CopyRect(&rectFocus, &rectBtn); + + // I don't know where does this constant come from, but this is how + // Windows draws them + InflateRect(&rectFocus, -4, -4); + + DrawFocusRect(hdc, &rectFocus); + } + + if ( pushed ) + { + // the label is shifted by 1 pixel to create "pushed" effect + OffsetRect(&rectBtn, 1, 1); + } + } + + COLORREF colFg = wxColourToRGB(GetForegroundColour()); + if ( state & ODS_DISABLED ) colFg = GetSysColor(COLOR_GRAYTEXT) ; + wxString label = GetLabel(); + if ( state & ODS_NOACCEL ) label = GetLabelText() ; + DrawButtonText(hdc, &rectBtn, label, colFg); + + return true; +} + +#endif // __WIN32__ + +#endif // wxUSE_BUTTON diff --git a/Source/3rd Party/wx/src/msw/caret.cpp b/Source/3rd Party/wx/src/msw/caret.cpp index aa9b1e55b..9c43cdf61 100644 --- a/Source/3rd Party/wx/src/msw/caret.cpp +++ b/Source/3rd Party/wx/src/msw/caret.cpp @@ -1,10 +1,10 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: src/msw/caret.cpp +// Name: msw/caret.cpp // Purpose: MSW implementation of wxCaret // Author: Vadim Zeitlin // Modified by: // Created: 23.05.99 -// RCS-ID: $Id$ +// RCS-ID: $Id: caret.cpp 35650 2005-09-23 12:56:45Z MR $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -39,11 +39,9 @@ // macros // --------------------------------------------------------------------------- -#define CALL_CARET_API(api, args) \ - if ( !api args ) \ - { \ - wxLogLastError(wxT(#api)); \ - } +#define CALL_CARET_API(api, args) \ + if ( !api args ) \ + wxLogLastError(_T(#api)) // =========================================================================== // implementation diff --git a/Source/3rd Party/wx/src/msw/checkbox.cpp b/Source/3rd Party/wx/src/msw/checkbox.cpp index 4ff0c5000..550afd740 100644 --- a/Source/3rd Party/wx/src/msw/checkbox.cpp +++ b/Source/3rd Party/wx/src/msw/checkbox.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 04/01/98 -// RCS-ID: $Id$ +// RCS-ID: $Id: checkbox.cpp 40331 2006-07-25 18:47:39Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -30,21 +30,37 @@ #ifndef WX_PRECOMP #include "wx/brush.h" - #include "wx/dcclient.h" #include "wx/dcscreen.h" #include "wx/settings.h" #endif -#include "wx/msw/dc.h" // for wxDCTemp -#include "wx/renderer.h" #include "wx/msw/uxtheme.h" -#include "wx/msw/private/button.h" -#include "wx/msw/missing.h" +#include "wx/msw/private.h" // ---------------------------------------------------------------------------- // constants // ---------------------------------------------------------------------------- +#ifndef BST_UNCHECKED + #define BST_UNCHECKED 0x0000 +#endif + +#ifndef BST_CHECKED + #define BST_CHECKED 0x0001 +#endif + +#ifndef BST_INDETERMINATE + #define BST_INDETERMINATE 0x0002 +#endif + +#ifndef DFCS_HOT + #define DFCS_HOT 0x1000 +#endif + +#ifndef DT_HIDEPREFIX + #define DT_HIDEPREFIX 0x00100000 +#endif + #ifndef BP_CHECKBOX #define BP_CHECKBOX 3 #endif @@ -79,6 +95,59 @@ enum // implementation // ============================================================================ +#if wxUSE_EXTENDED_RTTI +WX_DEFINE_FLAGS( wxCheckBoxStyle ) + +wxBEGIN_FLAGS( wxCheckBoxStyle ) + // new style border flags, we put them first to + // use them for streaming out + wxFLAGS_MEMBER(wxBORDER_SIMPLE) + wxFLAGS_MEMBER(wxBORDER_SUNKEN) + wxFLAGS_MEMBER(wxBORDER_DOUBLE) + wxFLAGS_MEMBER(wxBORDER_RAISED) + wxFLAGS_MEMBER(wxBORDER_STATIC) + wxFLAGS_MEMBER(wxBORDER_NONE) + + // old style border flags + wxFLAGS_MEMBER(wxSIMPLE_BORDER) + wxFLAGS_MEMBER(wxSUNKEN_BORDER) + wxFLAGS_MEMBER(wxDOUBLE_BORDER) + wxFLAGS_MEMBER(wxRAISED_BORDER) + wxFLAGS_MEMBER(wxSTATIC_BORDER) + wxFLAGS_MEMBER(wxNO_BORDER) + + // standard window styles + wxFLAGS_MEMBER(wxTAB_TRAVERSAL) + wxFLAGS_MEMBER(wxCLIP_CHILDREN) + wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW) + wxFLAGS_MEMBER(wxWANTS_CHARS) + wxFLAGS_MEMBER(wxNO_FULL_REPAINT_ON_RESIZE) + wxFLAGS_MEMBER(wxALWAYS_SHOW_SB ) + wxFLAGS_MEMBER(wxVSCROLL) + wxFLAGS_MEMBER(wxHSCROLL) + +wxEND_FLAGS( wxCheckBoxStyle ) + +IMPLEMENT_DYNAMIC_CLASS_XTI(wxCheckBox, wxControl,"wx/checkbox.h") + +wxBEGIN_PROPERTIES_TABLE(wxCheckBox) + wxEVENT_PROPERTY( Click , wxEVT_COMMAND_CHECKBOX_CLICKED , wxCommandEvent ) + + wxPROPERTY( Font , wxFont , SetFont , GetFont , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY( Label,wxString, SetLabel, GetLabel, wxString() , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY( Value ,bool, SetValue, GetValue, EMPTY_MACROVALUE, 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY_FLAGS( WindowStyle , wxCheckBoxStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE, 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style +wxEND_PROPERTIES_TABLE() + +wxBEGIN_HANDLERS_TABLE(wxCheckBox) +wxEND_HANDLERS_TABLE() + +wxCONSTRUCTOR_6( wxCheckBox , wxWindow* , Parent , wxWindowID , Id , wxString , Label , wxPoint , Position , wxSize , Size , long , WindowStyle ) +#else +IMPLEMENT_DYNAMIC_CLASS(wxCheckBox, wxControl) +#endif + + // ---------------------------------------------------------------------------- // wxCheckBox creation // ---------------------------------------------------------------------------- @@ -100,24 +169,28 @@ bool wxCheckBox::Create(wxWindow *parent, { Init(); - WXValidateStyle(&style); if ( !CreateControl(parent, id, pos, size, style, validator, name) ) return false; long msStyle = WS_TABSTOP; if ( style & wxCHK_3STATE ) + { msStyle |= BS_3STATE; + } else + { + wxASSERT_MSG( !Is3rdStateAllowedForUser(), + wxT("Using wxCH_ALLOW_3RD_STATE_FOR_USER") + wxT(" style flag for a 2-state checkbox is useless") ); msStyle |= BS_CHECKBOX; + } if ( style & wxALIGN_RIGHT ) { msStyle |= BS_LEFTTEXT | BS_RIGHT; } - msStyle |= wxMSWButton::GetMultilineStyle(label); - return MSWCreateControl(wxT("BUTTON"), msStyle, pos, size, label, 0); } @@ -142,24 +215,9 @@ wxSize wxCheckBox::DoGetBestSize() const int wCheckbox, hCheckbox; if ( !str.empty() ) { - wxClientDC dc(const_cast(this)); - dc.SetFont(GetFont()); - dc.GetMultiLineTextExtent(GetLabelText(str), &wCheckbox, &hCheckbox); + GetTextExtent(GetLabelText(str), &wCheckbox, &hCheckbox); wCheckbox += s_checkSize + GetCharWidth(); - if ( ::GetWindowLong(GetHwnd(), GWL_STYLE) & BS_MULTILINE ) - { - // We need to make the checkbox even wider in this case because - // otherwise it wraps lines automatically and not only on "\n"s as - // we need and this makes the size computed here wrong resulting in - // checkbox contents being truncated when it's actually displayed. - // Without this hack simple checkbox with "Some thing\n and more" - // label appears on 3 lines, not 2, under Windows 2003 using - // classic look and feel (although it works fine under Windows 7, - // with or without themes). - wCheckbox += s_checkSize; - } - if ( hCheckbox < s_checkSize ) hCheckbox = s_checkSize; } @@ -181,13 +239,6 @@ wxSize wxCheckBox::DoGetBestSize() const // wxCheckBox operations // ---------------------------------------------------------------------------- -void wxCheckBox::SetLabel(const wxString& label) -{ - wxMSWButton::UpdateMultilineStyle(GetHwnd(), label); - - wxCheckBoxBase::SetLabel(label); -} - void wxCheckBox::SetValue(bool val) { Set3StateValue(val ? wxCHK_CHECKED : wxCHK_UNCHECKED); @@ -273,7 +324,7 @@ bool wxCheckBox::SetForegroundColour(const wxColour& colour) // the only way to change the checkbox foreground colour under Windows XP // is to owner draw it if ( wxUxThemeEngine::GetIfActive() ) - MakeOwnerDrawn(colour.IsOk()); + MakeOwnerDrawn(colour.Ok()); return true; } @@ -398,24 +449,28 @@ bool wxCheckBox::MSWOnDraw(WXDRAWITEMSTRUCT *item) const bool isFocused = m_isPressed || FindFocus() == this; - // draw the checkbox itself - wxDCTemp dc(hdc); + // draw the checkbox itself: note that this should really, really be in + // wxRendererNative but unfortunately we can't add a new virtual function + // to it without breaking backwards compatibility - int flags = 0; + // classic Win32 version -- this can be useful when we move this into + // wxRendererNative +#if defined(__WXWINCE__) || !wxUSE_UXTHEME + UINT state = DFCS_BUTTONCHECK; if ( !IsEnabled() ) - flags |= wxCONTROL_DISABLED; + state |= DFCS_INACTIVE; switch ( Get3StateValue() ) { case wxCHK_CHECKED: - flags |= wxCONTROL_CHECKED; + state |= DFCS_CHECKED; break; case wxCHK_UNDETERMINED: - flags |= wxCONTROL_PRESSED; + state |= DFCS_PUSHED; break; default: - wxFAIL_MSG( wxT("unexpected Get3StateValue() return value") ); + wxFAIL_MSG( _T("unexpected Get3StateValue() return value") ); // fall through case wxCHK_UNCHECKED: @@ -424,10 +479,62 @@ bool wxCheckBox::MSWOnDraw(WXDRAWITEMSTRUCT *item) } if ( wxFindWindowAtPoint(wxGetMousePosition()) == this ) - flags |= wxCONTROL_CURRENT; + state |= DFCS_HOT; - wxRendererNative::Get(). - DrawCheckBox(this, dc, wxRectFromRECT(rectCheck), flags); + if ( !::DrawFrameControl(hdc, &rectCheck, DFC_BUTTON, state) ) + { + wxLogLastError(_T("DrawFrameControl(DFC_BUTTON)")); + } +#else // XP version + wxUxThemeEngine *themeEngine = wxUxThemeEngine::GetIfActive(); + if ( !themeEngine ) + return false; + + wxUxThemeHandle theme(this, L"BUTTON"); + if ( !theme ) + return false; + + int state; + switch ( Get3StateValue() ) + { + case wxCHK_CHECKED: + state = CBS_CHECKEDNORMAL; + break; + + case wxCHK_UNDETERMINED: + state = CBS_MIXEDNORMAL; + break; + + default: + wxFAIL_MSG( _T("unexpected Get3StateValue() return value") ); + // fall through + + case wxCHK_UNCHECKED: + state = CBS_UNCHECKEDNORMAL; + break; + } + + if ( !IsEnabled() ) + state += CBS_DISABLED_OFFSET; + else if ( m_isPressed ) + state += CBS_PRESSED_OFFSET; + else if ( m_isHot ) + state += CBS_HOT_OFFSET; + + HRESULT hr = themeEngine->DrawThemeBackground + ( + theme, + hdc, + BP_CHECKBOX, + state, + &rectCheck, + NULL + ); + if ( FAILED(hr) ) + { + wxLogApiError(_T("DrawThemeBackground(BP_CHECKBOX)"), hr); + } +#endif // 0/1 // draw the text const wxString& label = GetLabel(); @@ -447,10 +554,10 @@ bool wxCheckBox::MSWOnDraw(WXDRAWITEMSTRUCT *item) // around it if ( isFocused ) { - if ( !::DrawText(hdc, label.t_str(), label.length(), &rectLabel, + if ( !::DrawText(hdc, label, label.length(), &rectLabel, fmt | DT_CALCRECT) ) { - wxLogLastError(wxT("DrawText(DT_CALCRECT)")); + wxLogLastError(_T("DrawText(DT_CALCRECT)")); } } @@ -459,9 +566,9 @@ bool wxCheckBox::MSWOnDraw(WXDRAWITEMSTRUCT *item) ::SetTextColor(hdc, ::GetSysColor(COLOR_GRAYTEXT)); } - if ( !::DrawText(hdc, label.t_str(), label.length(), &rectLabel, fmt) ) + if ( !::DrawText(hdc, label, label.length(), &rectLabel, fmt) ) { - wxLogLastError(wxT("DrawText()")); + wxLogLastError(_T("DrawText()")); } // finally draw the focus @@ -471,7 +578,7 @@ bool wxCheckBox::MSWOnDraw(WXDRAWITEMSTRUCT *item) rectLabel.right++; if ( !::DrawFocusRect(hdc, &rectLabel) ) { - wxLogLastError(wxT("DrawFocusRect()")); + wxLogLastError(_T("DrawFocusRect()")); } } diff --git a/Source/3rd Party/wx/src/msw/checklst.cpp b/Source/3rd Party/wx/src/msw/checklst.cpp index 90336a8e5..f01f5884d 100644 --- a/Source/3rd Party/wx/src/msw/checklst.cpp +++ b/Source/3rd Party/wx/src/msw/checklst.cpp @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin // Modified by: // Created: 16.11.97 -// RCS-ID: $Id$ +// RCS-ID: $Id: checklst.cpp 62511 2009-10-30 14:11:03Z JMS $ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -29,7 +29,7 @@ #include "wx/checklst.h" #ifndef WX_PRECOMP - #include "wx/msw/wrapcctl.h" + #include "wx/msw/wrapwin.h" #include "wx/object.h" #include "wx/colour.h" #include "wx/font.h" @@ -45,9 +45,7 @@ #include -#include "wx/renderer.h" #include "wx/msw/private.h" -#include "wx/msw/dc.h" // ---------------------------------------------------------------------------- // private functions @@ -56,113 +54,233 @@ // get item (converted to right type) #define GetItem(n) ((wxCheckListBoxItem *)(GetItem(n))) -namespace -{ - // space around check mark bitmap in pixels - static const int CHECKMARK_EXTRA_SPACE = 1; - - // space betwen check bitmap and text label - static const int CHECKMARK_LABEL_SPACE = 2; - -} // anonymous namespace - // ============================================================================ // implementation // ============================================================================ + +#if wxUSE_EXTENDED_RTTI +WX_DEFINE_FLAGS( wxCheckListBoxStyle ) + +wxBEGIN_FLAGS( wxCheckListBoxStyle ) + // new style border flags, we put them first to + // use them for streaming out + wxFLAGS_MEMBER(wxBORDER_SIMPLE) + wxFLAGS_MEMBER(wxBORDER_SUNKEN) + wxFLAGS_MEMBER(wxBORDER_DOUBLE) + wxFLAGS_MEMBER(wxBORDER_RAISED) + wxFLAGS_MEMBER(wxBORDER_STATIC) + wxFLAGS_MEMBER(wxBORDER_NONE) + + // old style border flags + wxFLAGS_MEMBER(wxSIMPLE_BORDER) + wxFLAGS_MEMBER(wxSUNKEN_BORDER) + wxFLAGS_MEMBER(wxDOUBLE_BORDER) + wxFLAGS_MEMBER(wxRAISED_BORDER) + wxFLAGS_MEMBER(wxSTATIC_BORDER) + wxFLAGS_MEMBER(wxBORDER) + + // standard window styles + wxFLAGS_MEMBER(wxTAB_TRAVERSAL) + wxFLAGS_MEMBER(wxCLIP_CHILDREN) + wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW) + wxFLAGS_MEMBER(wxWANTS_CHARS) + wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE) + wxFLAGS_MEMBER(wxALWAYS_SHOW_SB ) + wxFLAGS_MEMBER(wxVSCROLL) + wxFLAGS_MEMBER(wxHSCROLL) + + wxFLAGS_MEMBER(wxLB_SINGLE) + wxFLAGS_MEMBER(wxLB_MULTIPLE) + wxFLAGS_MEMBER(wxLB_EXTENDED) + wxFLAGS_MEMBER(wxLB_HSCROLL) + wxFLAGS_MEMBER(wxLB_ALWAYS_SB) + wxFLAGS_MEMBER(wxLB_NEEDED_SB) + wxFLAGS_MEMBER(wxLB_SORT) + wxFLAGS_MEMBER(wxLB_OWNERDRAW) + +wxEND_FLAGS( wxCheckListBoxStyle ) + +IMPLEMENT_DYNAMIC_CLASS_XTI(wxCheckListBox, wxListBox,"wx/checklst.h") + +wxBEGIN_PROPERTIES_TABLE(wxCheckListBox) + wxEVENT_PROPERTY( Toggle , wxEVT_COMMAND_CHECKLISTBOX_TOGGLED , wxCommandEvent ) + wxPROPERTY_FLAGS( WindowStyle , wxCheckListBoxStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , wxLB_OWNERDRAW /*flags*/ , wxT("Helpstring") , wxT("group")) // style +wxEND_PROPERTIES_TABLE() + +wxBEGIN_HANDLERS_TABLE(wxCheckListBox) +wxEND_HANDLERS_TABLE() + +wxCONSTRUCTOR_4( wxCheckListBox , wxWindow* , Parent , wxWindowID , Id , wxPoint , Position , wxSize , Size ) + +#else +IMPLEMENT_DYNAMIC_CLASS(wxCheckListBox, wxListBox) +#endif + // ---------------------------------------------------------------------------- // declaration and implementation of wxCheckListBoxItem class // ---------------------------------------------------------------------------- class wxCheckListBoxItem : public wxOwnerDrawn { +friend class WXDLLIMPEXP_FWD_CORE wxCheckListBox; public: // ctor - wxCheckListBoxItem(wxCheckListBox *parent); + wxCheckListBoxItem(wxCheckListBox *pParent, size_t nIndex); // drawing functions virtual bool OnDrawItem(wxDC& dc, const wxRect& rc, wxODAction act, wxODStatus stat); // simple accessors and operations - wxCheckListBox *GetParent() const - { return m_parent; } + bool IsChecked() const { return m_bChecked; } - int GetIndex() const - { return m_parent->GetItemIndex(const_cast(this)); } + void Check(bool bCheck); + void Toggle() { Check(!IsChecked()); } - wxString GetName() const - { return m_parent->GetString(GetIndex()); } - - - bool IsChecked() const - { return m_checked; } - - void Check(bool bCheck) - { m_checked = bCheck; } - - void Toggle() - { Check(!IsChecked()); } + void SendEvent(); private: - wxCheckListBox *m_parent; - bool m_checked; + bool m_bChecked; + wxCheckListBox *m_pParent; + size_t m_nIndex; - wxDECLARE_NO_COPY_CLASS(wxCheckListBoxItem); + DECLARE_NO_COPY_CLASS(wxCheckListBoxItem) }; -wxCheckListBoxItem::wxCheckListBoxItem(wxCheckListBox *parent) +wxCheckListBoxItem::wxCheckListBoxItem(wxCheckListBox *pParent, size_t nIndex) + : wxOwnerDrawn(wxEmptyString, true) // checkable { - m_parent = parent; - m_checked = false; + m_bChecked = false; + m_pParent = pParent; + m_nIndex = nIndex; - wxSize size = wxRendererNative::Get().GetCheckBoxSize(parent); - size.x += 2 * CHECKMARK_EXTRA_SPACE + CHECKMARK_LABEL_SPACE; + // we don't initialize m_nCheckHeight/Width vars because it's + // done in OnMeasure while they are used only in OnDraw and we + // know that there will always be OnMeasure before OnDraw - SetMarginWidth(size.GetWidth()); - SetBackgroundColour(parent->GetBackgroundColour()); + // fix appearance for check list boxes: they don't look quite the same as + // menu icons + SetOwnMarginWidth(::GetSystemMetrics(SM_CXMENUCHECK) - + 2*wxSystemSettings::GetMetric(wxSYS_EDGE_X) + 1); + + SetBackgroundColour(pParent->GetBackgroundColour()); } bool wxCheckListBoxItem::OnDrawItem(wxDC& dc, const wxRect& rc, wxODAction act, wxODStatus stat) { // first draw the label + if ( IsChecked() ) + stat = (wxOwnerDrawn::wxODStatus)(stat | wxOwnerDrawn::wxODChecked); + if ( !wxOwnerDrawn::OnDrawItem(dc, rc, act, stat) ) return false; + // now draw the check mark part - wxMSWDCImpl *impl = (wxMSWDCImpl*) dc.GetImpl(); - HDC hdc = GetHdcOf(*impl); + size_t nCheckWidth = GetDefaultMarginWidth(), + nCheckHeight = m_pParent->GetItemHeight(); - wxSize size = wxRendererNative::Get().GetCheckBoxSize(GetParent()); + int x = rc.GetX(), + y = rc.GetY(); - // first create bitmap in a memory DC - MemoryHDC hdcMem(hdc); - CompatibleBitmap hBmpCheck(hdc, size.GetWidth(), size.GetHeight()); + HDC hdc = (HDC)dc.GetHDC(); - // then draw a check mark into it + // create pens, brushes &c + COLORREF colBg = wxColourToRGB(GetBackgroundColour()); + AutoHPEN hpenBack(colBg), + hpenGray(RGB(0xc0, 0xc0, 0xc0)); + + SelectInHDC selPen(hdc, (HGDIOBJ)hpenBack); + AutoHBRUSH hbrBack(colBg); + SelectInHDC selBrush(hdc, hbrBack); + + // erase the background: it could have been filled with the selected colour + Rectangle(hdc, x, y, x + nCheckWidth + 1, rc.GetBottom() + 1); + + // shift check mark 1 pixel to the right, looks better like this + x++; + + if ( IsChecked() ) { - SelectInHDC selBmp(hdcMem, hBmpCheck); + // first create a monochrome bitmap in a memory DC + MemoryHDC hdcMem(hdc); + MonoBitmap hbmpCheck(nCheckWidth, nCheckHeight); + SelectInHDC selBmp(hdcMem, hbmpCheck); - int flags = wxCONTROL_FLAT; - if ( IsChecked() ) - flags |= wxCONTROL_CHECKED; + // then draw a check mark into it + RECT rect = { 0, 0, nCheckWidth, nCheckHeight }; + ::DrawFrameControl(hdcMem, &rect, +#ifdef __WXWINCE__ + DFC_BUTTON, DFCS_BUTTONCHECK +#else + DFC_MENU, DFCS_MENUCHECK +#endif + ); - wxDCTemp dcMem(hdcMem); - wxRendererNative::Get().DrawCheckBox(GetParent(), dcMem, wxRect(size), flags); - } // select hBmpCheck out of hdcMem + // finally copy it to screen DC + ::BitBlt(hdc, x, y, nCheckWidth, nCheckHeight, hdcMem, 0, 0, SRCCOPY); + } - // finally draw bitmap to screen + // now we draw the smaller rectangle + y++; + nCheckWidth -= 2; + nCheckHeight -= 2; - // position of check mark bitmap - int x = rc.GetX() + CHECKMARK_EXTRA_SPACE; - int y = rc.GetY() + (rc.GetHeight() - size.GetHeight()) / 2; + // draw hollow gray rectangle + (void)::SelectObject(hdc, (HGDIOBJ)hpenGray); - UINT uState = stat & wxOwnerDrawn::wxODSelected ? wxDSB_SELECTED : wxDSB_NORMAL; - wxDrawStateBitmap(hdc, hBmpCheck, x, y, uState); + SelectInHDC selBrush2(hdc, ::GetStockObject(NULL_BRUSH)); + Rectangle(hdc, x, y, x + nCheckWidth, y + nCheckHeight); + + if (stat & wxODHasFocus) + { + RECT rect; + wxCopyRectToRECT(rc, rect); + DrawFocusRect(hdc, &rect); + } return true; } +// change the state of the item and redraw it +void wxCheckListBoxItem::Check(bool check) +{ + m_bChecked = check; + + // index may be changed because new items were added/deleted + if ( m_pParent->GetItemIndex(this) != (int)m_nIndex ) + { + // update it + int index = m_pParent->GetItemIndex(this); + + wxASSERT_MSG( index != wxNOT_FOUND, wxT("what does this item do here?") ); + + m_nIndex = (size_t)index; + } + + HWND hwndListbox = (HWND)m_pParent->GetHWND(); + + RECT rcUpdate; + + if ( ::SendMessage(hwndListbox, LB_GETITEMRECT, + m_nIndex, (LPARAM)&rcUpdate) == LB_ERR ) + { + wxLogDebug(wxT("LB_GETITEMRECT failed")); + } + + ::InvalidateRect(hwndListbox, &rcUpdate, FALSE); +} + +// send an "item checked" event +void wxCheckListBoxItem::SendEvent() +{ + wxCommandEvent event(wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, m_pParent->GetId()); + event.SetInt(m_nIndex); + event.SetEventObject(m_pParent); + m_pParent->ProcessCommand(event); +} + // ---------------------------------------------------------------------------- // implementation of wxCheckListBox class // ---------------------------------------------------------------------------- @@ -221,64 +339,77 @@ bool wxCheckListBox::Create(wxWindow *parent, wxWindowID id, style | wxLB_OWNERDRAW, validator, name); } +// misc overloaded methods +// ----------------------- + +void wxCheckListBox::Delete(unsigned int n) +{ + wxCHECK_RET( IsValid(n), + wxT("invalid index in wxListBox::Delete") ); + + wxListBox::Delete(n); + + // free memory + delete m_aItems[n]; + + m_aItems.RemoveAt(n); +} + +bool wxCheckListBox::SetFont( const wxFont &font ) +{ + unsigned int i; + for ( i = 0; i < m_aItems.GetCount(); i++ ) + m_aItems[i]->SetFont(font); + + wxListBox::SetFont(font); + + return true; +} + // create/retrieve item // -------------------- // create a check list box item -wxOwnerDrawn *wxCheckListBox::CreateLboxItem(size_t WXUNUSED(n)) +wxOwnerDrawn *wxCheckListBox::CreateLboxItem(size_t nIndex) { - wxCheckListBoxItem *pItem = new wxCheckListBoxItem(this); - return pItem; + wxCheckListBoxItem *pItem = new wxCheckListBoxItem(this, nIndex); + return pItem; } // return item size // ---------------- bool wxCheckListBox::MSWOnMeasure(WXMEASUREITEMSTRUCT *item) { - if ( wxListBox::MSWOnMeasure(item) ) - { - MEASUREITEMSTRUCT *pStruct = (MEASUREITEMSTRUCT *)item; + if ( wxListBox::MSWOnMeasure(item) ) { + MEASUREITEMSTRUCT *pStruct = (MEASUREITEMSTRUCT *)item; - wxSize size = wxRendererNative::Get().GetCheckBoxSize(this); - size.x += 2 * CHECKMARK_EXTRA_SPACE; - size.y += 2 * CHECKMARK_EXTRA_SPACE; + // save item height + m_nItemHeight = pStruct->itemHeight; - // add place for the check mark - pStruct->itemWidth += size.GetWidth(); + // add place for the check mark + pStruct->itemWidth += wxOwnerDrawn::GetDefaultMarginWidth(); - if ( pStruct->itemHeight < static_cast(size.GetHeight()) ) - pStruct->itemHeight = size.GetHeight(); - - return true; - } - - return false; + return true; } + return false; +} + // check items // ----------- bool wxCheckListBox::IsChecked(unsigned int uiIndex) const { - wxCHECK_MSG( IsValid(uiIndex), false, wxT("bad wxCheckListBox index") ); + wxCHECK_MSG( IsValid(uiIndex), false, _T("bad wxCheckListBox index") ); return GetItem(uiIndex)->IsChecked(); } void wxCheckListBox::Check(unsigned int uiIndex, bool bCheck) { - wxCHECK_RET( IsValid(uiIndex), wxT("bad wxCheckListBox index") ); + wxCHECK_RET( IsValid(uiIndex), _T("bad wxCheckListBox index") ); GetItem(uiIndex)->Check(bCheck); - RefreshItem(uiIndex); -} - -void wxCheckListBox::Toggle(unsigned int uiIndex) -{ - wxCHECK_RET( IsValid(uiIndex), wxT("bad wxCheckListBox index") ); - - GetItem(uiIndex)->Toggle(); - RefreshItem(uiIndex); } // process events @@ -289,33 +420,33 @@ void wxCheckListBox::OnKeyDown(wxKeyEvent& event) // what do we do? enum { - NONE, - TOGGLE, - SET, - CLEAR + None, + Toggle, + Set, + Clear } oper; switch ( event.GetKeyCode() ) { case WXK_SPACE: - oper = TOGGLE; + oper = Toggle; break; case WXK_NUMPAD_ADD: case '+': - oper = SET; + oper = Set; break; case WXK_NUMPAD_SUBTRACT: case '-': - oper = CLEAR; + oper = Clear; break; default: - oper = NONE; + oper = None; } - if ( oper != NONE ) + if ( oper != None ) { wxArrayInt selections; int count = 0; @@ -335,26 +466,31 @@ void wxCheckListBox::OnKeyDown(wxKeyEvent& event) for ( int i = 0; i < count; i++ ) { - int nItem = selections[i]; + wxCheckListBoxItem *item = GetItem(selections[i]); + if ( !item ) + { + wxFAIL_MSG( _T("no wxCheckListBoxItem?") ); + continue; + } switch ( oper ) { - case TOGGLE: - Toggle(nItem); + case Toggle: + item->Toggle(); break; - case SET: - case CLEAR: - Check(nItem, oper == SET); + case Set: + case Clear: + item->Check( oper == Set ); break; default: - wxFAIL_MSG( wxT("what should this key do?") ); + wxFAIL_MSG( _T("what should this key do?") ); } // we should send an event as this has been done by the user and // not by the program - SendEvent(nItem); + item->SendEvent(); } } else // nothing to do @@ -366,70 +502,45 @@ void wxCheckListBox::OnKeyDown(wxKeyEvent& event) void wxCheckListBox::OnLeftClick(wxMouseEvent& event) { // clicking on the item selects it, clicking on the checkmark toggles - - int nItem = HitTest(event.GetX(), event.GetY()); - - if ( nItem != wxNOT_FOUND ) + if ( event.GetX() <= wxOwnerDrawn::GetDefaultMarginWidth() ) { - wxRect rect; - GetItemRect(nItem, rect); + int nItem = HitTest(event.GetX(), event.GetY()); - // convert item rect to check mark rect - wxSize size = wxRendererNative::Get().GetCheckBoxSize(this); - rect.x += CHECKMARK_EXTRA_SPACE; - rect.y += (rect.GetHeight() - size.GetHeight()) / 2; - rect.SetSize(size); - - if ( rect.Contains(event.GetX(), event.GetY()) ) + if ( nItem != wxNOT_FOUND ) { - // people expect to get "kill focus" event for the currently - // focused control before getting events from the other controls - // and, equally importantly, they may prevent the focus change from - // taking place at all (e.g. because the old control contents is - // invalid and needs to be corrected) in which case we shouldn't - // generate this event at all - SetFocus(); - if ( FindFocus() == this ) - { - Toggle(nItem); - SendEvent(nItem); - - // scroll one item down if the item is the last one - // and isn't visible at all - int h; - GetClientSize(NULL, &h); - if ( rect.GetBottom() > h ) - ScrollLines(1); - } - } - else - { - // implement default behaviour: clicking on the item selects it - event.Skip(); + wxCheckListBoxItem *item = GetItem(nItem); + item->Toggle(); + item->SendEvent(); } + //else: it's not an error, just click outside of client zone } else { - // implement default behaviour on click outside of client zone + // implement default behaviour: clicking on the item selects it event.Skip(); } } -wxSize wxCheckListBox::DoGetBestClientSize() const +int wxCheckListBox::DoHitTestItem(wxCoord x, wxCoord y) const { - wxSize best = wxListBox::DoGetBestClientSize(); + int nItem = (int)::SendMessage + ( + (HWND)GetHWND(), + LB_ITEMFROMPOINT, + 0, + MAKELPARAM(x, y) + ); - // add room for the checkbox - wxSize size = wxRendererNative::Get().GetCheckBoxSize(const_cast(this)); - size.x += 2 * CHECKMARK_EXTRA_SPACE; - size.y += 2 * CHECKMARK_EXTRA_SPACE; + return nItem >= (int)m_noItems ? wxNOT_FOUND : nItem; +} - best.x += size.GetWidth(); - if ( best.y < size.GetHeight() ) - best.y = size.GetHeight(); +wxSize wxCheckListBox::DoGetBestSize() const +{ + wxSize best = wxListBox::DoGetBestSize(); + best.x += wxOwnerDrawn::GetDefaultMarginWidth(); // add room for the checkbox CacheBestSize(best); return best; } -#endif // wxUSE_CHECKLISTBOX +#endif diff --git a/Source/3rd Party/wx/src/msw/choice.cpp b/Source/3rd Party/wx/src/msw/choice.cpp index 5f350f6a5..d154a30e0 100644 --- a/Source/3rd Party/wx/src/msw/choice.cpp +++ b/Source/3rd Party/wx/src/msw/choice.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: Vadim Zeitlin to derive from wxChoiceBase // Created: 04/01/98 -// RCS-ID: $Id$ +// RCS-ID: $Id: choice.cpp 51616 2008-02-09 15:22:15Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -30,7 +30,6 @@ #ifndef WX_PRECOMP #include "wx/utils.h" - #include "wx/app.h" #include "wx/log.h" #include "wx/brush.h" #include "wx/settings.h" @@ -38,6 +37,64 @@ #include "wx/msw/private.h" +#if wxUSE_EXTENDED_RTTI +WX_DEFINE_FLAGS( wxChoiceStyle ) + +wxBEGIN_FLAGS( wxChoiceStyle ) + // new style border flags, we put them first to + // use them for streaming out + wxFLAGS_MEMBER(wxBORDER_SIMPLE) + wxFLAGS_MEMBER(wxBORDER_SUNKEN) + wxFLAGS_MEMBER(wxBORDER_DOUBLE) + wxFLAGS_MEMBER(wxBORDER_RAISED) + wxFLAGS_MEMBER(wxBORDER_STATIC) + wxFLAGS_MEMBER(wxBORDER_NONE) + + // old style border flags + wxFLAGS_MEMBER(wxSIMPLE_BORDER) + wxFLAGS_MEMBER(wxSUNKEN_BORDER) + wxFLAGS_MEMBER(wxDOUBLE_BORDER) + wxFLAGS_MEMBER(wxRAISED_BORDER) + wxFLAGS_MEMBER(wxSTATIC_BORDER) + wxFLAGS_MEMBER(wxBORDER) + + // standard window styles + wxFLAGS_MEMBER(wxTAB_TRAVERSAL) + wxFLAGS_MEMBER(wxCLIP_CHILDREN) + wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW) + wxFLAGS_MEMBER(wxWANTS_CHARS) + wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE) + wxFLAGS_MEMBER(wxALWAYS_SHOW_SB ) + wxFLAGS_MEMBER(wxVSCROLL) + wxFLAGS_MEMBER(wxHSCROLL) + +wxEND_FLAGS( wxChoiceStyle ) + +IMPLEMENT_DYNAMIC_CLASS_XTI(wxChoice, wxControl,"wx/choice.h") + +wxBEGIN_PROPERTIES_TABLE(wxChoice) + wxEVENT_PROPERTY( Select , wxEVT_COMMAND_CHOICE_SELECTED , wxCommandEvent ) + + wxPROPERTY( Font , wxFont , SetFont , GetFont , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY_COLLECTION( Choices , wxArrayString , wxString , AppendString , GetStrings , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY( Selection ,int, SetSelection, GetSelection, EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY_FLAGS( WindowStyle , wxChoiceStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style +wxEND_PROPERTIES_TABLE() + +wxBEGIN_HANDLERS_TABLE(wxChoice) +wxEND_HANDLERS_TABLE() + +wxCONSTRUCTOR_4( wxChoice , wxWindow* , Parent , wxWindowID , Id , wxPoint , Position , wxSize , Size ) +#else +IMPLEMENT_DYNAMIC_CLASS(wxChoice, wxControl) +#endif +/* + TODO PROPERTIES + selection (long) + content (list) + item +*/ + // ============================================================================ // implementation // ============================================================================ @@ -60,8 +117,8 @@ bool wxChoice::Create(wxWindow *parent, wxASSERT_MSG( !(style & wxCB_DROPDOWN) && !(style & wxCB_READONLY) && !(style & wxCB_SIMPLE), - wxT("this style flag is ignored by wxChoice, you ") - wxT("probably want to use a wxComboBox") ); + _T("this style flag is ignored by wxChoice, you ") + _T("probably want to use a wxComboBox") ); return CreateAndInit(parent, id, pos, size, n, choices, style, validator, name); @@ -85,8 +142,15 @@ bool wxChoice::CreateAndInit(wxWindow *parent, return false; + // choice/combobox normally has "white" (depends on colour scheme, of + // course) background rather than inheriting the parent's background + SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); + // initialize the controls contents - Append(n, choices); + for ( int i = 0; i < n; i++ ) + { + Append(choices[i]); + } // and now we may finally size the control properly (if needed) SetInitialSize(size); @@ -94,6 +158,20 @@ bool wxChoice::CreateAndInit(wxWindow *parent, return true; } +bool wxChoice::Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style, + const wxValidator& validator, + const wxString& name) +{ + wxCArrayString chs(choices); + return Create(parent, id, pos, size, chs.GetCount(), chs.GetStrings(), + style, validator, name); +} + void wxChoice::SetLabel(const wxString& label) { if ( FindString(label) == wxNOT_FOUND ) @@ -109,20 +187,6 @@ void wxChoice::SetLabel(const wxString& label) wxChoiceBase::SetLabel(label); } -bool wxChoice::Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - long style, - const wxValidator& validator, - const wxString& name) -{ - wxCArrayString chs(choices); - return Create(parent, id, pos, size, chs.GetCount(), chs.GetStrings(), - style, validator, name); -} - bool wxChoice::MSWShouldPreProcessMessage(WXMSG *pMsg) { MSG *msg = (MSG *) pMsg; @@ -160,109 +224,95 @@ WXDWORD wxChoice::MSWGetStyle(long style, WXDWORD *exstyle) const return msStyle; } -#ifndef EP_EDITTEXT - #define EP_EDITTEXT 1 - #define ETS_NORMAL 1 -#endif - -wxVisualAttributes -wxChoice::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant)) -{ - // it is important to return valid values for all attributes from here, - // GetXXX() below rely on this - wxVisualAttributes attrs; - - // FIXME: Use better dummy window? - wxWindow* wnd = wxTheApp->GetTopWindow(); - if (!wnd) - return attrs; - - attrs.font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); - - // there doesn't seem to be any way to get the text colour using themes - // API: TMT_TEXTCOLOR doesn't work neither for EDIT nor COMBOBOX - attrs.colFg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT); - - // NB: use EDIT, not COMBOBOX (the latter works in XP but not Vista) - attrs.colBg = wnd->MSWGetThemeColour(L"EDIT", - EP_EDITTEXT, - ETS_NORMAL, - ThemeColourBackground, - wxSYS_COLOUR_WINDOW); - - return attrs; -} - wxChoice::~wxChoice() { - Clear(); + Free(); } // ---------------------------------------------------------------------------- // adding/deleting items to/from the list // ---------------------------------------------------------------------------- -int wxChoice::DoInsertItems(const wxArrayStringsAdapter& items, - unsigned int pos, - void **clientData, wxClientDataType type) +int wxChoice::DoAppend(const wxString& item) { - MSWAllocStorage(items, CB_INITSTORAGE); - - const bool append = pos == GetCount(); - - // use CB_ADDSTRING when appending at the end to make sure the control is - // resorted if it has wxCB_SORT style - const unsigned msg = append ? CB_ADDSTRING : CB_INSERTSTRING; - - if ( append ) - pos = 0; - - int n = wxNOT_FOUND; - const unsigned numItems = items.GetCount(); - for ( unsigned i = 0; i < numItems; ++i ) + int n = (int)SendMessage(GetHwnd(), CB_ADDSTRING, 0, (LPARAM)item.c_str()); + if ( n == CB_ERR ) { - n = MSWInsertOrAppendItem(pos, items[i], msg); - if ( n == wxNOT_FOUND ) - return n; - - if ( !append ) - pos++; - - AssignNewItemClientData(n, clientData, i, type); + wxLogLastError(wxT("SendMessage(CB_ADDSTRING)")); + } + else // ok + { + // we need to refresh our size in order to have enough space for the + // newly added items + if ( !IsFrozen() ) + UpdateVisibleHeight(); } - // we need to refresh our size in order to have enough space for the - // newly added items - if ( !IsFrozen() ) - MSWUpdateDropDownHeight(); - InvalidateBestSize(); - return n; } -void wxChoice::DoDeleteOneItem(unsigned int n) +int wxChoice::DoInsert(const wxString& item, unsigned int pos) +{ + wxCHECK_MSG(!(GetWindowStyle() & wxCB_SORT), -1, wxT("can't insert into sorted list")); + wxCHECK_MSG(IsValidInsert(pos), -1, wxT("invalid index")); + + int n = (int)SendMessage(GetHwnd(), CB_INSERTSTRING, pos, (LPARAM)item.c_str()); + if ( n == CB_ERR ) + { + wxLogLastError(wxT("SendMessage(CB_INSERTSTRING)")); + } + else // ok + { + if ( !IsFrozen() ) + UpdateVisibleHeight(); + } + + InvalidateBestSize(); + return n; +} + +void wxChoice::Delete(unsigned int n) { wxCHECK_RET( IsValid(n), wxT("invalid item index in wxChoice::Delete") ); + if ( HasClientObjectData() ) + { + delete GetClientObject(n); + } + SendMessage(GetHwnd(), CB_DELETESTRING, n, 0); if ( !IsFrozen() ) - MSWUpdateDropDownHeight(); + UpdateVisibleHeight(); InvalidateBestSize(); } -void wxChoice::DoClear() +void wxChoice::Clear() { + Free(); + SendMessage(GetHwnd(), CB_RESETCONTENT, 0, 0); if ( !IsFrozen() ) - MSWUpdateDropDownHeight(); + UpdateVisibleHeight(); InvalidateBestSize(); } +void wxChoice::Free() +{ + if ( HasClientObjectData() ) + { + unsigned int count = GetCount(); + for ( unsigned int n = 0; n < count; n++ ) + { + delete GetClientObject(n); + } + } +} + // ---------------------------------------------------------------------------- // selection // ---------------------------------------------------------------------------- @@ -333,7 +383,7 @@ int wxChoice::FindString(const wxString& s, bool bCase) const else { int pos = (int)SendMessage(GetHwnd(), CB_FINDSTRINGEXACT, - (WPARAM)-1, wxMSW_CONV_LPARAM(s)); + (WPARAM)-1, (LPARAM)s.c_str()); return pos == LB_ERR ? wxNOT_FOUND : pos; } @@ -347,32 +397,26 @@ void wxChoice::SetString(unsigned int n, const wxString& s) // we have to delete and add back the string as there is no way to change a // string in place - // we need to preserve the client data manually - void *oldData = NULL; - wxClientData *oldObjData = NULL; - if ( HasClientUntypedData() ) - oldData = GetClientData(n); - else if ( HasClientObjectData() ) - oldObjData = GetClientObject(n); - - // and also the selection if we're going to delete the item that was - // selected - const bool wasSelected = static_cast(n) == GetSelection(); + // we need to preserve the client data + void *data; + if ( m_clientDataItemsType != wxClientData_None ) + { + data = DoGetItemClientData(n); + } + else // no client data + { + data = NULL; + } ::SendMessage(GetHwnd(), CB_DELETESTRING, n, 0); - ::SendMessage(GetHwnd(), CB_INSERTSTRING, n, wxMSW_CONV_LPARAM(s) ); + ::SendMessage(GetHwnd(), CB_INSERTSTRING, n, (LPARAM)s.c_str() ); - // restore the client data - if ( oldData ) - SetClientData(n, oldData); - else if ( oldObjData ) - SetClientObject(n, oldObjData); + if ( data ) + { + DoSetItemClientData(n, data); + } + //else: it's already NULL by default - // and the selection - if ( wasSelected ) - SetSelection(n); - - // the width could have changed so the best size needs to be recomputed InvalidateBestSize(); } @@ -414,7 +458,7 @@ void wxChoice::DoSetItemClientData(unsigned int n, void* clientData) void* wxChoice::DoGetItemClientData(unsigned int n) const { LPARAM rc = SendMessage(GetHwnd(), CB_GETITEMDATA, n, 0); - if ( rc == CB_ERR && GetLastError() != ERROR_SUCCESS ) + if ( rc == CB_ERR ) { wxLogLastError(wxT("CB_GETITEMDATA")); @@ -425,46 +469,24 @@ void* wxChoice::DoGetItemClientData(unsigned int n) const return (void *)rc; } -// ---------------------------------------------------------------------------- -// wxMSW-specific geometry management -// ---------------------------------------------------------------------------- - -namespace +void wxChoice::DoSetItemClientObject(unsigned int n, wxClientData* clientData) { - -// there is a difference between the height passed to CB_SETITEMHEIGHT and the -// real height of the combobox; it is probably not constant for all Windows -// versions/settings but right now I don't know how to find what it is so it is -// temporarily hardcoded to its value under XP systems with normal fonts sizes -const int COMBO_HEIGHT_ADJ = 6; - -} // anonymous namespace - -void wxChoice::MSWUpdateVisibleHeight() -{ - if ( m_heightOwn != wxDefaultCoord ) - { - ::SendMessage(GetHwnd(), CB_SETITEMHEIGHT, - (WPARAM)-1, m_heightOwn - COMBO_HEIGHT_ADJ); - } + DoSetItemClientData(n, clientData); } -#if wxUSE_DEFERRED_SIZING -void wxChoice::MSWEndDeferWindowPos() +wxClientData* wxChoice::DoGetItemClientObject(unsigned int n) const { - // we can only set the height of the choice itself now as it is reset to - // default every time the control is resized - MSWUpdateVisibleHeight(); - - wxChoiceBase::MSWEndDeferWindowPos(); + return (wxClientData *)DoGetItemClientData(n); } -#endif // wxUSE_DEFERRED_SIZING -void wxChoice::MSWUpdateDropDownHeight() +// ---------------------------------------------------------------------------- +// wxMSW specific helpers +// ---------------------------------------------------------------------------- + +void wxChoice::UpdateVisibleHeight() { // be careful to not change the width here - DoSetSize(wxDefaultCoord, wxDefaultCoord, wxDefaultCoord, GetSize().y, - wxSIZE_USE_EXISTING); + DoSetSize(wxDefaultCoord, wxDefaultCoord, wxDefaultCoord, GetSize().y, wxSIZE_USE_EXISTING); } void wxChoice::DoMoveWindow(int x, int y, int width, int height) @@ -487,109 +509,133 @@ void wxChoice::DoMoveWindow(int x, int y, int width, int height) void wxChoice::DoGetSize(int *w, int *h) const { - wxControl::DoGetSize(w, h); - // this is weird: sometimes, the height returned by Windows is clearly the // total height of the control including the drop down list -- but only - // sometimes, and sometimes it isn't so work around this here by using our - // own stored value if we have it - if ( h && m_heightOwn != wxDefaultCoord ) - *h = m_heightOwn; + // sometimes, and normally it isn't... I have no idea about what to do with + // this + wxControl::DoGetSize(w, h); } void wxChoice::DoSetSize(int x, int y, int width, int height, int sizeFlags) { - const int heightBest = GetBestSize().y; + int heightOrig = height; + + // the height which we must pass to Windows should be the total height of + // the control including the drop down list while the height given to us + // is, of course, just the height of the permanently visible part of it + if ( height != wxDefaultCoord ) + { + // don't make the drop down list too tall, arbitrarily limit it to 40 + // items max and also don't leave it empty + size_t nItems = GetCount(); + if ( !nItems ) + nItems = 9; + else if ( nItems > 24 ) + nItems = 24; - // we need the real height below so get the current one if it's not given - if ( height == wxDefaultCoord ) - { - // height not specified, use the same as before - DoGetSize(NULL, &height); + // add space for the drop down list + const int hItem = SendMessage(GetHwnd(), CB_GETITEMHEIGHT, 0, 0); + height += hItem*(nItems + 1); } - else if ( height == heightBest ) + else { - // we don't need to manually manage our height, let the system use the - // default one - m_heightOwn = wxDefaultCoord; - } - else // non-default height specified - { - // set our new own height but be careful not to make it too big: the - // native control apparently stores it as a single byte and so setting - // own height to 256 pixels results in default height being used (255 - // is still ok) - m_heightOwn = height; - - if ( m_heightOwn > UCHAR_MAX ) - m_heightOwn = UCHAR_MAX; - // nor too small: see MSWUpdateVisibleHeight() - else if ( m_heightOwn < COMBO_HEIGHT_ADJ ) - m_heightOwn = COMBO_HEIGHT_ADJ; + // We cannot pass wxDefaultCoord as height to wxControl. wxControl uses + // wxGetWindowRect() to determine the current height of the combobox, + // and then again sets the combobox's height to that value. Unfortunately, + // wxGetWindowRect doesn't include the dropdown list's height (at least + // on Win2K), so this would result in a combobox with dropdown height of + // 1 pixel. We have to determine the default height ourselves and call + // wxControl with that value instead. + int w, h; + RECT r; + DoGetSize(&w, &h); + if (::SendMessage(GetHwnd(), CB_GETDROPPEDCONTROLRECT, 0, (LPARAM) &r) != 0) + { + height = h + r.bottom - r.top; + } } + wxControl::DoSetSize(x, y, width, height, sizeFlags); + + // If we're storing a pending size, make sure we store + // the original size for reporting back to the app. + if (m_pendingSize != wxDefaultSize) + m_pendingSize = wxSize(width, heightOrig); + + // This solution works on XP, but causes choice/combobox lists to be + // too short on W2K and earlier. +#if 0 + int widthCurrent, heightCurrent; + DoGetSize(&widthCurrent, &heightCurrent); // the height which we must pass to Windows should be the total height of // the control including the drop down list while the height given to us - // is, of course, just the height of the permanently visible part of it so - // add the drop down height to it - - // don't make the drop down list too tall, arbitrarily limit it to 30 - // items max and also don't make it too small if it's currently empty - size_t nItems = GetCount(); - if (!HasFlag(wxCB_SIMPLE)) + // is, of course, just the height of the permanently visible part of it + if ( height != wxDefaultCoord && height != heightCurrent ) { + // don't make the drop down list too tall, arbitrarily limit it to 40 + // items max and also don't leave it empty + unsigned int nItems = GetCount(); if ( !nItems ) nItems = 9; - else if ( nItems > 30 ) - nItems = 30; + else if ( nItems > 24 ) + nItems = 24; + + // add space for the drop down list + const int hItem = SendMessage(GetHwnd(), CB_GETITEMHEIGHT, 0, 0); + height += hItem*(nItems + 1); } - - const int hItem = SendMessage(GetHwnd(), CB_GETITEMHEIGHT, 0, 0); - int heightWithItems = 0; - if (!HasFlag(wxCB_SIMPLE)) - // The extra item (" + 1") is required to prevent a vertical - // scrollbar from appearing with comctl32.dll versions earlier - // than 6.0 (such as found in Win2k). - heightWithItems = height + hItem*(nItems + 1); - else - heightWithItems = SetHeightSimpleComboBox(nItems); - - - // do resize the native control - wxControl::DoSetSize(x, y, width, heightWithItems, sizeFlags); - - - // make the control itself of the requested height: notice that this - // must be done after changing its size or it has no effect (apparently - // the height is reset to default during the control layout) and that it's - // useless to do it when using the deferred sizing -- in this case it - // will be done from MSWEndDeferWindowPos() -#if wxUSE_DEFERRED_SIZING - if ( m_pendingSize == wxDefaultSize ) + else // keep the same height as now { - // not using deferred sizing, update it immediately - MSWUpdateVisibleHeight(); + // normally wxWindow::DoSetSize() checks if we set the same size as the + // window already has and does nothing in this case, but for us the + // check fails as the size we pass to it includes the dropdown while + // the size returned by our GetSize() does not, so test if the size + // didn't really change ourselves here + if ( width == wxDefaultCoord || width == widthCurrent ) + { + // size doesn't change, what about position? + int xCurrent, yCurrent; + DoGetPosition(&xCurrent, &yCurrent); + const bool defMeansUnchanged = !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE); + if ( ((x == wxDefaultCoord && defMeansUnchanged) || x == xCurrent) + && + ((y == wxDefaultCoord && defMeansUnchanged) || y == yCurrent) ) + { + // nothing changes, nothing to do + return; + } + } + + // We cannot pass wxDefaultCoord as height to wxControl. wxControl uses + // wxGetWindowRect() to determine the current height of the combobox, + // and then again sets the combobox's height to that value. Unfortunately, + // wxGetWindowRect doesn't include the dropdown list's height (at least + // on Win2K), so this would result in a combobox with dropdown height of + // 1 pixel. We have to determine the default height ourselves and call + // wxControl with that value instead. + // + // Also notice that sometimes CB_GETDROPPEDCONTROLRECT seems to return + // wildly incorrect values (~32000) which looks like a bug in it, just + // ignore them in this case + RECT r; + if ( ::SendMessage(GetHwnd(), CB_GETDROPPEDCONTROLRECT, 0, (LPARAM) &r) + && r.bottom < 30000 ) + { + height = heightCurrent + r.bottom - r.top; + } } - else // in the middle of deferred sizing - { - // we need to report the size of the visible part of the control back - // in GetSize() and not height stored by DoSetSize() in m_pendingSize - m_pendingSize = wxSize(width, height); - } -#else // !wxUSE_DEFERRED_SIZING - // always update the visible height immediately - MSWUpdateVisibleHeight(); -#endif // wxUSE_DEFERRED_SIZING + + wxControl::DoSetSize(x, y, width, height, sizeFlags); +#endif } wxSize wxChoice::DoGetBestSize() const { // find the widest string int wChoice = 0; - int hChoice; const unsigned int nItems = GetCount(); for ( unsigned int i = 0; i < nItems; i++ ) { @@ -606,63 +652,12 @@ wxSize wxChoice::DoGetBestSize() const // the combobox should be slightly larger than the widest string wChoice += 5*GetCharWidth(); - if( HasFlag( wxCB_SIMPLE ) ) - { - hChoice = SetHeightSimpleComboBox( nItems ); - } - else - hChoice = EDIT_HEIGHT_FROM_CHAR_HEIGHT(GetCharHeight()); - wxSize best(wChoice, hChoice); + wxSize best(wChoice, EDIT_HEIGHT_FROM_CHAR_HEIGHT(GetCharHeight())); CacheBestSize(best); return best; } -int wxChoice::SetHeightSimpleComboBox(int nItems) const -{ - int cx, cy; - wxGetCharSize( GetHWND(), &cx, &cy, GetFont() ); - int hItem = SendMessage(GetHwnd(), CB_GETITEMHEIGHT, (WPARAM)-1, 0); - return EDIT_HEIGHT_FROM_CHAR_HEIGHT( cy ) * wxMin( wxMax( nItems, 3 ), 6 ) + hItem - 1; -} - -// ---------------------------------------------------------------------------- -// Popup operations -// ---------------------------------------------------------------------------- - -void wxChoice::MSWDoPopupOrDismiss(bool show) -{ - wxASSERT_MSG( !HasFlag(wxCB_SIMPLE), - wxT("can't popup/dismiss the list for simple combo box") ); - - // we *must* set focus to the combobox before showing or hiding the drop - // down as without this we get WM_LBUTTONDOWN messages with invalid HWND - // when hiding it (whether programmatically or manually) resulting in a - // crash when we pass them to IsDialogMessage() - // - // this can be seen in the combo page of the widgets sample under Windows 7 - SetFocus(); - - ::SendMessage(GetHwnd(), CB_SHOWDROPDOWN, show, 0); -} - -bool wxChoice::Show(bool show) -{ - if ( !wxChoiceBase::Show(show) ) - return false; - - // When hiding the combobox, we also need to hide its popup part as it - // doesn't happen automatically. - if ( !show && ::SendMessage(GetHwnd(), CB_GETDROPPEDSTATE, 0, 0) ) - MSWDoPopupOrDismiss(false); - - return true; -} - -// ---------------------------------------------------------------------------- -// MSW message handlers -// ---------------------------------------------------------------------------- - WXLRESULT wxChoice::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) { switch ( nMsg ) @@ -740,6 +735,13 @@ bool wxChoice::MSWCommand(WXUINT param, WXWORD WXUNUSED(id)) // need to reset the selection back to it if it's eventually // cancelled by user m_lastAcceptedSelection = GetCurrentSelection(); + if ( m_lastAcceptedSelection == -1 ) + { + // no current selection so no need to restore it later (this + // happens when opening a combobox containing text not from its + // list of items and we shouldn't erase this text) + m_lastAcceptedSelection = wxID_NONE; + } break; case CBN_CLOSEUP: @@ -791,7 +793,7 @@ bool wxChoice::MSWCommand(WXUINT param, WXWORD WXUNUSED(id)) WXHBRUSH wxChoice::MSWControlColor(WXHDC hDC, WXHWND hWnd) { - if ( !IsThisEnabled() ) + if ( !IsEnabled() ) return MSWControlColorDisabled(hDC); return wxChoiceBase::MSWControlColor(hDC, hWnd); diff --git a/Source/3rd Party/wx/src/msw/clipbrd.cpp b/Source/3rd Party/wx/src/msw/clipbrd.cpp index 2cdbb5ddc..8091f2dd6 100644 --- a/Source/3rd Party/wx/src/msw/clipbrd.cpp +++ b/Source/3rd Party/wx/src/msw/clipbrd.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 04/01/98 -// RCS-ID: $Id$ +// RCS-ID: $Id: clipbrd.cpp 43884 2006-12-09 19:49:40Z PC $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -79,7 +79,6 @@ // --------------------------------------------------------------------------- static bool gs_wxClipboardIsOpen = false; -static int gs_htmlcfid = 0; bool wxOpenClipboard() { @@ -91,15 +90,13 @@ bool wxOpenClipboard() gs_wxClipboardIsOpen = ::OpenClipboard((HWND)win->GetHWND()) != 0; if ( !gs_wxClipboardIsOpen ) - { wxLogSysError(_("Failed to open the clipboard.")); - } return gs_wxClipboardIsOpen; } else { - wxLogDebug(wxT("Cannot open clipboard without a main window.")); + wxLogDebug(wxT("Can not open clipboard without a main window.")); return false; } @@ -140,9 +137,7 @@ bool wxIsClipboardOpened() bool wxIsClipboardFormatAvailable(wxDataFormat dataFormat) { - wxDataFormat::NativeFormat cf = dataFormat.GetFormatId(); - if (cf == wxDF_HTML) - cf = gs_htmlcfid; + wxDataFormat::NativeFormat cf = dataFormat.GetFormatId(); if ( ::IsClipboardFormatAvailable(cf) ) { @@ -217,7 +212,7 @@ bool wxSetClipboardData(wxDataFormat dataFormat, { wxBitmap *bitmap = (wxBitmap *)data; - if ( bitmap && bitmap->IsOk() ) + if ( bitmap && bitmap->Ok() ) { wxDIB dib(*bitmap); if ( dib.IsOk() ) @@ -307,6 +302,10 @@ bool wxSetClipboardData(wxDataFormat dataFormat, char *buf = new char [400 + strlen(html)]; if(!buf) return false; + // Get clipboard id for HTML format... + static int cfid = 0; + if(!cfid) cfid = RegisterClipboardFormat(wxT("HTML Format")); + // Create a template string for the HTML header... strcpy(buf, "Version:0.9\r\n" @@ -331,19 +330,19 @@ bool wxSetClipboardData(wxDataFormat dataFormat, // string when you overwrite it so you follow up with code to replace // the 0 appended at the end with a '\r'... char *ptr = strstr(buf, "StartHTML"); - sprintf(ptr+10, "%08u", (unsigned)(strstr(buf, "") - buf)); + sprintf(ptr+10, "%08u", strstr(buf, "") - buf); *(ptr+10+8) = '\r'; ptr = strstr(buf, "EndHTML"); - sprintf(ptr+8, "%08u", (unsigned)strlen(buf)); + sprintf(ptr+8, "%08u", strlen(buf)); *(ptr+8+8) = '\r'; ptr = strstr(buf, "StartFragment"); - sprintf(ptr+14, "%08u", (unsigned)(strstr(buf, "