[Wx Widget] trying to get core to update to wxWidgets-2.8.12 code

This commit is contained in:
zilmar 2015-10-16 16:42:42 +11:00
parent 9c5643d141
commit e9f27087e3
902 changed files with 65855 additions and 151840 deletions

View File

@ -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 <vadim@wxwindows.org>
// 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

View File

@ -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 <flags>-<keycode> format
// where <flags> 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 <flags> 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

View File

@ -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_

View File

@ -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_

View File

@ -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 <zeitlin@dptmaths.ens-cachan.fr>
// 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) */

View File

@ -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

View File

@ -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

File diff suppressed because it is too large Load Diff

View File

@ -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_

View File

@ -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 <vadim@wxwidgets.org>
// 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_

View File

@ -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*>(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<appname*>(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_

View File

@ -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 <vadim@wxwidgets.org>
// 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

View File

@ -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);

View File

@ -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 <zeitlin@dptmaths.ens-cachan.fr>
// 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<int>(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<int>(ui); \
return wx_static_cast(int, ui); \
} \
} \
\

View File

@ -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 <zeitlin@dptmaths.ens-cachan.fr>
// 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 <iterator>
#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<wxArrayString*>(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<wxArrayString*>(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 <class Iterator>
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

View File

@ -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_

View File

@ -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 <atomic.h>
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_

View File

@ -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_

View File

@ -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 <zeitlin@dptmaths.ens-cachan.fr>
// 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 */

View File

@ -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

View File

@ -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__)

View File

@ -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 <vadim@wxwidgets.org>
// 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

View File

@ -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<int>(s) == static_cast<int>(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_

View File

@ -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 <zeitlin@dptmaths.ens-cachan.fr>
// 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 <stdlib.h> // 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<T> for persistent variant.
template <typename T>
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<CharType*>(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<wxScopedCharTypeBuffer*>(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<CharType *>(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<Data *>(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<char> wxScopedCharBuffer;
typedef wxScopedCharTypeBuffer<wchar_t> wxScopedWCharBuffer;
// this buffer class always stores data in "owned" (persistent) manner
template <typename T>
class wxCharTypeBuffer : public wxScopedCharTypeBuffer<T>
{
protected:
typedef typename wxScopedCharTypeBuffer<T>::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<T>(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<T>::operator=(src);
return *this;
}
wxCharTypeBuffer(const wxScopedCharTypeBuffer<T>& src)
{
this->MakeOwnedCopyOf(src);
}
wxCharTypeBuffer& operator=(const wxScopedCharTypeBuffer<T>& 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<char> )
WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE( wxCharTypeBuffer<char> )
class wxCharBuffer : public wxCharTypeBuffer<char>
{
public:
typedef wxCharTypeBuffer<char> wxCharTypeBufferBase;
typedef wxScopedCharTypeBuffer<char> 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<wchar_t> )
WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE( wxCharTypeBuffer<wchar_t> )
class wxWCharBuffer : public wxCharTypeBuffer<wchar_t>
{
public:
typedef wxCharTypeBuffer<wchar_t> wxCharTypeBufferBase;
typedef wxScopedCharTypeBuffer<wchar_t> 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<T> implicitly convertible to T*
template <typename T>
class wxWritableCharTypeBuffer : public wxCharTypeBuffer<T>
{
public:
typedef typename wxScopedCharTypeBuffer<T>::CharType CharType;
wxWritableCharTypeBuffer(const wxScopedCharTypeBuffer<T>& src)
: wxCharTypeBuffer<T>(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<T>(str) {}
operator CharType*() { return this->data(); }
};
typedef wxWritableCharTypeBuffer<char> wxWritableCharBuffer;
typedef wxWritableCharTypeBuffer<wchar_t> 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;
};

View File

@ -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 <vadim@wxwidgets.org>
// 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_

View File

@ -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
/////////////////////////////////////////////////////////////////////////////

View File

@ -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_

View File

@ -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 <cairo.h>
extern "C"
{
bool wxCairoInit();
void wxCairoCleanUp();
}
#endif // wxUSE_CAIRO
#endif // _WX_CAIRO_H_BASE_

View File

@ -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

View File

@ -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 <sys/types.h>
#ifdef __cplusplus
extern "C" {
#endif
#endif /* Cygwin */
#include <wchar.h>
#if defined(__CYGWIN__) && defined(__cplusplus)
}
#endif /* Cygwin and C++ */
#elif defined(HAVE_WCSTR_H)
/* old compilers have relevant declarations here */
#include <wcstr.h>
#elif defined(__FreeBSD__) || defined(__DARWIN__) || defined(__EMX__)
/* include stdlib.h for wchar_t */
#include <stdlib.h>
#endif /* HAVE_WCHAR_H */
#ifdef HAVE_WIDEC_H
#include <widec.h>
#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 <ctype.h>
#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 <stddef.h>
#include <string.h>
#include <ctype.h>
#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 <tchar.h>
/* 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 <ctype.h>
#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_ */

View File

@ -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_

View File

@ -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_

View File

@ -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__)

File diff suppressed because it is too large Load Diff

View File

@ -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
/////////////////////////////////////////////////////////////////////////////

View File

@ -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__)

View File

@ -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<wxBookCtrlBase>
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<int>(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

View File

@ -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<wxDataFormat> 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

View File

@ -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__

View File

@ -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))

View File

@ -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 <vadim@wxwindows.org>
// 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 <typename T>
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 <typename T>
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_

View File

@ -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 <zeitlin@dptmaths.ens-cachan.fr>
// 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_

View File

@ -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_

View File

@ -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; }

View File

@ -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"

View File

@ -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

View File

@ -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__)

View File

@ -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_

View File

@ -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,

View File

@ -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_

View File

@ -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 <vadim@wxwidgets.org>
// 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 W>
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 <class T>
void SetForAllParts(bool (wxWindowBase::*func)(const T&), const T& arg)
{
DoSetForAllParts<const T&>(func, arg);
}
template <class T>
void SetForAllParts(bool (wxWindowBase::*func)(T*), T* arg)
{
DoSetForAllParts<T*>(func, arg);
}
template <class T>
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_

View File

@ -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 <zeitlin@dptmaths.ens-cachan.fr>
// 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 <typename T>
bool Read(const wxString& key, T* value) const
{
wxString s;
if ( !Read(key, &s) )
return false;
return wxFromString(s, value);
}
template <typename T>
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 <typename T>
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 <typename T>
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_

View File

@ -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

View File

@ -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 <zeitlin@dptmaths.ens-cachan.fr>
// RCS-ID: $Id: containr.h 50863 2007-12-20 18:32:55Z VS $
// Copyright: (c) 2001 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
// 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 W>
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_

View File

@ -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 <b>, <i> and <span>. 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 "&lt;" 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 "&amp;" 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__)

View File

@ -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_

View File

@ -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 <vadim@wxwindows.org>
* 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_

View File

@ -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_

View File

@ -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

View File

@ -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<void **>(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<void **>(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<Window,
// Container> instead of Window and Container interface directly.
template <class W, class C>
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<wxControl, wxItemContainer>
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

View File

@ -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

View File

@ -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 <integral type> 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

View File

@ -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 <zeitlin@dptmaths.ens-cachan.fr>
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -17,23 +17,19 @@
#if wxUSE_DATETIME
#ifdef __WXWINCE__
#include "wx/msw/wince/time.h"
#ifndef __WXWINCE__
#include <time.h>
#else
#include <time.h>
#endif // OS
#include "wx/msw/wince/time.h"
#endif
#include <limits.h> // 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<int>((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
// ----------------------------------------------------------------------------

View File

@ -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

File diff suppressed because it is too large Load Diff

View File

@ -4,7 +4,7 @@
// Author: Ron Lee <ron@debian.org>
// 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

View File

@ -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_

View File

@ -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_

View File

@ -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_

View File

@ -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 <vadim@wxwidgets.org>
// 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_

View File

@ -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_

View File

@ -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_

View File

@ -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_

View File

@ -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

View File

@ -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 <vadim@wxwidgets.org>
// 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 <zeitlin@dptmaths.ens-cachan.fr>
* 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 <assert.h>
#endif // systems without assert.h
#ifndef _WX_DEBUG_H_
#define _WX_DEBUG_H_
#include <limits.h> // for CHAR_BIT used below
#ifndef __WXWINCE__
#include <assert.h>
#endif
#include <limits.h> /* 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 (<assert.h> 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 <bool x> struct STATIC_ASSERTION_FAILURE;
template <> struct STATIC_ASSERTION_FAILURE<true> { enum { value = 1 }; };
// HP aCC cannot deal with missing names for template value parameters
template<int x> 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<int x> 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_ */

File diff suppressed because it is too large Load Diff

View File

@ -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_

View File

@ -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) \

View File

@ -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 <zeitlin@dptmaths.ens-cachan.fr>
// 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_

View File

@ -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,

View File

@ -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_

View File

@ -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 <vadim@wxwindows.org>
// 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);

View File

@ -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 <vadim@wxwidgets.org>
* 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 <typename T> class Foo { ... };
WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE( Foo<int> )
(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_ */

View File

@ -1,850 +0,0 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/dlist.h
// Purpose: wxDList<T> 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 <algorithm>
#include <iterator>
#include <list>
#include "wx/afterstd.h"
template<typename T>
class wxDList: public std::list<T*>
{
private:
bool m_destroy;
typedef std::list<T*> BaseListType;
typedef wxDList<T> 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<T>;
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<ListType*>(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<ListType*>(this)->begin(),
const_cast<ListType*>(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<ListType*>(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<ListType*>(this)->begin() );
}
compatibility_iterator GetLast() const
{
iterator i = const_cast<ListType*>(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 <typename T>
class wxDList
{
public:
class Node
{
public:
Node(wxDList<T> *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<T> *m_list; // list we belong to
friend class wxDList<T>;
};
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<T>& 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<T>& 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<T> &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<T>& l, const iterator& first, const iterator& last)
{ insert(it, first, last); l.erase(first, last); }
void splice(const iterator& it, wxDList<T>& l)
{ splice(it, l, l.begin(), l.end() ); }
void splice(const iterator& it, wxDList<T>& 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<T>& 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_

View File

@ -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

View File

@ -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<wxMDIParentFrame> 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<wxMDIChildFrame, wxMDIParentFrame> 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_

File diff suppressed because it is too large Load Diff

View File

@ -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 <zeitlin@dptmaths.ens-cachan.fr>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
@ -14,7 +14,7 @@
#include "wx/defs.h"
#if wxUSE_STD_CONTAINERS
#if wxUSE_STL
#include "wx/beforestd.h"
#include <vector>
#include <algorithm>
@ -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 T>
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 T, typename F>
class wxSortedArray_SortFunction
class WXDLLIMPEXP_BASE wxSortedArray_SortFunction
{
public:
typedef F CMPFUNC;
@ -121,78 +119,32 @@ classexp name : public std::vector<T> \
typedef predicate::CMPFUNC SCMPFUNC; \
public: \
typedef wxArray_SortFunction<T>::CMPFUNC CMPFUNC; \
\
public: \
typedef T base_type; \
\
name() : std::vector<T>() { } \
name(size_type n) : std::vector<T>(n) { } \
name(size_type n, const_reference v) : std::vector<T>(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]); \

View File

@ -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

View File

@ -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 <ron@debian.org>
// 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)
};

View File

@ -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

View File

@ -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_

View File

@ -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 <vadim@wxwidgets.org>
// 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);

File diff suppressed because it is too large Load Diff

View File

@ -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 <vadim@wxwidgets.org>
// 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_

View File

@ -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 <zeitlin@dptmaths.ens-cachan.fr>
// 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_

View File

@ -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 <vadim@wxwidgets.org>
// 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_

View File

@ -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))

View File

@ -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 <vadim@wxwidgets.org>
* 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_ */

View File

@ -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 <zeitlin@dptmaths.ens-cachan.fr>
// 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();

Some files were not shown because too many files have changed in this diff Show More